TITLE: An exercise in Kunen. Getting Axiom of Replacement from set-like transitive closure.
QUESTION [8 upvotes]: I am studying Kunen's Set Theory (2011 edition) on my own. I got stuck at the excercise I.9.6 which is:
Excercise I.9.6. Derive the axiom of replacement from lemma I.9.5.
And the mentioned lemma is this:
Lemma I.9.5. For a relation R and a class A, if R is set-like on A, then R* is set-like on A.
Here R* is the transitive closure of R. Also, a relation R is set-like on a class A if { x\in A : xRy } is a set for all y\in A.
Help appreciated.

REPLY [15 votes]: Suppose that the lemma holds and that we are considering an instance of the replacement axiom, so we have a set $X$ and for some parameter $z$ and for every $x\in X$ there is a unique $y$ such that $\varphi(x,y,z)$. Fix any set $w$ not in $X$, and let $R$ be the class relation such that $R(x,w)$ for each $x\in X$, and such that $R(y,x)$ whenever $\varphi(x,y,z)$. That is, the children of $w$ are exactly the members of $X$, and the child of any $x\in X$ is precisely the corresponding $y$. Thus, the relation $R$ is set-like, since $X$ is a set, and $\{y\}$ is a set for each $y$ that arises. But the transitive closure of $R$ will relate all the $y$'s that arise from any $x\in X$ to $w$. And so if the transitive closure of $R$ is set-like, then the set $\{y\mid \exists x\in X\, \varphi(x,y,z)\}$ will be a set, thereby verifying this instance of the replacement axiom.