Forcing is quite new to me and there is a basic example in Jech that I don't understand. Let $P$ be the following notion of forcing: the forcing conditions are 0-1 sequences and $p$ is stronger than $q$ is $p$ extends $q$. If $M$ is a ground model, let $G\subset P$ be generic over $M$. Then let $f=\cup G$. Since $G$ is a filter then $f$ is a function.
My question is why does $G$ being a filter entails that $f$ is a function?
Since $G$ is a generic set, it has to meet all dense sets in $P$ which are in $M$ (so we can guarantee that the generic set exists). So $G$ contains some 0-1 sequences, and so $f$ is a bunch of 0-1 sequences.
But why is this guaranteed by $G$ being a filter? And what kind of function is $f$, more explicitly? Is $f$ a function taking natural numbers (maybe the length of the sequences) and have the sequences $p$ in its range?
Also: why do generic sets exist only if the ground model is countable. Does it have to do something with the dense sets?
Thanks