Set of all partial functions exists For sets $A$ and $B$, let $f: A’ \rightarrow B’, A’ \subseteq A$ and $B’ \subseteq B,$ be called a partial function. Show that the set of all partial functions from $A$ to $B$ is a set. Use only the power set axiom, axiom of replacement, and union. 
Note that this is from Tao’s Analysis text and Cartesian products have not yet been defined.
This question has been asked before here but the answers do not follow Tao’s definition of function equality. Namely two functions must have the same ranges to be considered equal (ie if $Y$ and $Y’$ are the ranges of two functions $f, g$, respectively, the functions cannot be equal even if their inverse images are equal).
 A: Tao proves that if $A$ is a set, then $\{X\mid X\subseteq A\}$ is also a set.
For every fixed $Y\subseteq B$, consider the function $F(X)=Y^X$, and by Replacement, the set $\{Y^X\mid X\subseteq A\}$ exists. For each $Y\subseteq B$.
Next, define the function $G(Y)=\{Y^X\mid X\subseteq A\}$, and again by Replacement the set $\{G(Y)\mid Y\subseteq B\}$ exists. 
Finally, apply the Union axiom (two times).
A: I'm assuming you have already read the other answer to this question, and are currently stuck on why it suffices to show the existence of the set $$\{Y^S: S \in \mathcal{P}(X)\}.$$
If we wanted to be picky and state that two partial functions are not considered to be equal if their codomains are unequal (as Tao does), we could instead revise the proof given in the link above to work for every fixed subset $Y' \subset Y$. In particular, we show the existence of the set $$\{{Y'}^S: S \in \mathcal{P}(X)\}$$ for each $Y' \subset Y$. Then it follows from the axiom of replacement on $\mathcal{P}(Y)$ that $$\{\{T^S: S \in \mathcal{P}(X)\}: T \in \mathcal{P}(Y)\}$$ is a set (by taking $P(x, y) = \text{$x \in \mathcal{P}(Y)$ and $y = \{x^S: S \in \mathcal{P}(X)\}$}$). Note that the set above is a set of sets; in particular, if we apply the axiom of union $$\bigcup \{\{T^S: S \in \mathcal{P}(X)\}: T \in \mathcal{P}(Y)\},$$ we see that the resulting set is what we wanted; the set of all partial functions from $X$ to $Y$.
A: Emory's answer is almost correct, you actually need to use the axiom of union two times. Here is a very small example explaining how to correct Emory's answer.
Let's take $X=Y=\emptyset$. We have $2^X=2^Y=\{\emptyset\}$ and $\emptyset^\emptyset=\{f\}$ where $f$ is the empty function from $\emptyset$ to $\emptyset$ (see example 3.3.9 from Tao's book).
Hence $\{\emptyset^S:S\in 2^X\}=\{\emptyset^\emptyset\}=\{\{f\}\}$ and it follows that $\{\{T^S:S\in 2^X\}:T\in 2^Y\}=\{\{\emptyset^S:S\in 2^X\}\}=\{\{\{f\}\}\}$.
Hence $\bigcup\,\{\{T^S:S\in 2^X\}:T\in 2^Y\}=\{\{f\}\}$, you can see that you actually get a set of sets of functions instead of a set of functions. A possible correction would be $\bigcup\bigcup\,\{\{T^S:S\in 2^X\}:T\in 2^Y\}$.
Another equivalent solution is $\bigcup\,\{\bigcup\,\{T^S:S\in 2^X\}:T\in 2^Y\}$.
