(exercise from Tao's analysis book) Proof of a lemma relating to power set of X I'm stuck at one exercise from chapter of sets from Terence Tao's analysis book.
I need to proof the lemma:
Lemma: Let $X$ be a set. Then the set
$\{Y : Y \:\text{is a subset of}\: X\}$
is a set.
Note: The set $\{Y : Y \:\text{is a subset of}\: X\}$ is known as the power set of $X$, defined as  $2^X $
I can understand why the lemma is true, but I have no clue how to prove it. Furthermore, the author gave a hint that I found very confusing, it follows:
Hint: start with the set $\{0, 1\}^X$
and apply the replacement axiom, replacing each function $f$ with the
object $f^{-1}(\{1\})$.
 A: Going from the hint:
The set $\{{}0,1\}{}^X$ is the set of all functions $f:X\rightarrow{}\{{}0,1\}{}$.  We can consider for elements $x\in{}X$ that $f(x)=0$ means that $x\notin{}Y$ and $f(x)=1$ means that $x\in{}Y$.
For a subset $Y$ of $X$, there will be a function $f_Y:X\rightarrow{}\{{}0,1\}{}$ describing the elements of $Y$ as above.  Then using replacement we replace the function $f_Y$ with $f_Y^{-1}(\{{}1\}{})=Y$.  Proceeding for all functions $f$, we define all subsets of $X$ and $\{{}0,1\}{}^X$ being a set implies this is a set. 
This is fairly hand-wavy when it gets to replacement since I'm not sure how your book is defining it.  This should be a general approach though.
A: Usually this is an axiom (the Powerset Axiom). Since apparently Tao adopts a different axiom instead — existence of $Y^X$, the set of all functions $X\to Y$ for any $X,Y$ — you'll have to use that to prove the usual Powerset axiom.
You can use existence of empty set and the axiom of pairing to define a set $T = \{\emptyset, \{\emptyset\}\}$, and prove that it has two distinct elements.
Every $f\in T^X$ is essentially the characteristic function of a subset of $X$:
$$
S_f = \{x\in X\mid f(x) \ne \emptyset\},
$$
and every subset of $S\subseteq X$ is represented by some $f$ in $T^X$ via 
$$
I_S = \left\{(x,y) \in X\times T\mid y = \begin{cases} \{\emptyset\}&\text{if $x\in S$,}\\
\emptyset&\text{if $x\notin S$} \end{cases}
\right\},
$$
$S_f$ and $I_S$ both exist by the Axiom of Specification, and these operations are inverses of each other.
Now you can use the Axiom of Replacement to show that the following is a set:
$$
P := \{S_f\mid f\in T^X\}.
$$
Using $I_S$, you can show that $P = \mathcal{P}(X)$, i.e. $P = \{S\mid S\subseteq X\}$. 
