The comprehension axioms follows from the replacement schema. I hope to show that the comprehension axioms follows from the replacement schema.
This is a solution that professor wrote.
$P(u,u)$: every set $u$, exists an unique $u$ such that $\psi(u)$.
Then exist a set $y=\{u:P(u,u) \text{ and } u \in X\}$
Let $F=\{(u,u) : \psi(u)\}$. Then $F(X) \in u$ and $y=\{u \in F(x) : \psi(u)\}$
I took some notes but I think that there are much errors.
Thanks in advance.
 A: Suppose that $x$ is a set, and $\varphi(u)$ is a formula. Let $\psi(u,v)$ be the formula $$u=v\land\varphi(u)\;.\tag{1}$$ The first conjunct, $u=v$, of $(1)$ ensures that for any $u$ there is at most one $v$ such that $\psi(u,v)$ holds, namely, $u$ itself. Thus, the formula $\psi$ behaves like a function, and the axiom schema of replacement says that if $z$ is any set, we can form the set
$$\left\{v:\exists u\in z\big(\psi(u,v)\big)\right\}\;.\tag{2}$$
If we write $v=F(u)$ as an abbreviation for the statement $\psi(u,v)$, we can rewrite $(2)$ in a more intuitive form: it’s the set
$$\{F(u):u\in z\}\;.$$
Now take for $z$ the specific set $x$, and expand $\psi(u,v)$. Then $(2)$ becomes
$$\left\{v:\exists u\in x\big(u=v\land\varphi(u)\big)\right\}\;,$$
which is easily seen to be the same as
$$\{u\in x:\varphi(x)\}\;.$$
Thus, we’ve deduced this specific instance of the axiom schema of comprehension from the axiom schema of replacement.
My notation is a little different, but this is essentially the argument that your professor gave.
