I want to prove that the mappings set between two sets is a set. Here's what I did:
Let $X,Y$ be sets. We've seen that $X\times Y$ is a set as well, so from the power set axiom we get that $\mathcal{P}\left(X\times Y\right)$ is a set as well.
Now we define the formula
$$P\left(z\right):\forall x\ \left(\exists y\ \left\langle x,y\right\rangle \in z\right) \\ \land\left(\forall y_{1}\forall y_{2}\ \left\langle x,y_{1}\right\rangle \in z\land\left\langle x,y_{2}\right\rangle \in z\rightarrow y_{1}=y_{2}\right)$$
which gives us both a value for each x and uniqueness, therefore the relation will be a function. So from the axiom of separation with $\mathcal{P}\left(X\times Y\right)$ we are done.
I'm mostly wondering if my use of the axiom of separation is correct - I'm having trouble with the "formula" part. Should I use the axiom of replacement instead?