Collection of all partial functions is a set I'm studying real analysis from prof. Tao's book "Analysis 1" and I'm stuck on the following exercise:
"Let $ X $ , $ Y $ be sets. Define a partial function from $ X $ to $ Y $ to be any function $ f: X' -> Y' $ whose domain $ X' $ is a subset of $ X $, and whose range $ Y' $ is a subset of $ Y $.
Show that the collection of all partial functions from $ X $ to $ Y $ is itself a set."
My attempt:
I know that if I "build" the set  {  $Y_1^{X_1} , Y_2^{X_2},... $ } ($X_i \in 2^X$, $Y_i \in 2^Y$) then the result follows immediately from the axiom of union, so my goal is to build that set.
To do so I let $ X' $ be an arbitrary element of $ 2^X $ (power set of $X$) and for every $Y' \in  2^Y$ I let $ P(Y',y):="y=Y'^{X'}"$.
From the axiom of replacement I now know that the set {$f:X'->Y'| Y' \in 2^Y$}={$Y_1^{X'}, Y_2^{X'},...$} exists.
  Now I want to allow $X'$ in the set above to vary in $2^X$ (this, together with the axiom of union should be enough to conclude the proof) but I haven't been able to do it so far (I think I should use the axiom of replacement again but I don't know how to apply it).
So, I would appreciate any hint about how to conclude this last step.
Best regards,
lorenzo.
 A: Completely revised.
I’m assuming that you’ve already shown (or assumed) that for any sets $S$ and $T$ the set $T^S$ is well-defined. 
Note that if $f:S\to T\subseteq Y$, then $f:S\to Y$ as well. Thus, we really need only 
$$\bigcup\left\{Y^S:S\in 2^X\right\}\;.$$
Let $P(x,y)$ hold iff $x\in 2^X$ and $y=Y^x$, or $x\notin 2^X$ and $y=\varnothing$; clearly $P$ is functional, and $2^X$ is a set, so we can apply replacement to conclude that
$$\left\{Y^S:S\in 2^X\right\}$$
exists. Now just apply the union axiom.
A: Given a set $Y$ and an element $X′$ of the power set $\mathcal{X}=\{X′:X′\subseteq X\}$ such that there is a unique power set $Y^{X′}$ for every $X′ \in X$. Then there is a set $\{Y^{X′}:X′\subseteq X\}$ such that for every $z$:
$$
z \in {Y^{X′}:X′ \subseteq X} \leftrightarrow z \text{ is the unique power set for some }X′.
$$
Now that $\{Y^{X′}:X′ \subseteq X\}$ is a set (of sets of partial functions from $X$ to $Y$) the union axiom may be applied to define the set of all partial functions from $X$ to $Y$ to be
$$ \bigcup\{Y^{X′}:X′ \subseteq X\}. $$
