I'm reading a book about structures on collections, chapter equivalence relations, and I try to get through the explanation of transitive closure. They use the following example:
$A$ is a collection of people. In $A$ the relation $R$ is defined by $xRy$ if $x$ is a parent of $y$.
This parent relation is a relation that is not transitive. Surely, if $a$ is a parent of $b$, and $b$ is a parent of $c$, then $a$ is (in general) not a parent of $c$. Using the parent relation we can define the ancestor relation: $a$ is an ancestor of $b$ if there exists a string of people $c_1, c_2,\ldots, c_n$ for which $a = c_1$, $b = c_n$ and $c_i$ is a parent of $c_{i + 1}$ for each $i \in \{1, \ldots, n - 1\}$. The relation 'ancestor of' is transitive.
We shall now look how we can define the grandparent relation from the parent relation. Let $R$ be the parent relation, $R = \{(x, y)\mid x\text{ is a parent of }y \}$. Then we have: $a$ is a grandparent of $b$ if there is a $p$ of which $a$ is its parent and $p$ is the parent of $b$. The relation 'grandparent of' is then equal to the collection $\{(x, y)\mid\text{there is a }p\text{ for which }xRp\text{ and }pRy\}$.
This last sentence is what confuses me. How exactly does this collection have $(x, y)$? Because to me it seems that what is in the collection is $x\to p\to y$, and not $x\to y$. I cannot for the life of me figure out how this definition is tying $x$ to $y$.