Proving Zorn's lemma implies axiom of choice (trouble showing every chain has an upper bound) I am attempting to prove the fact that Zorn's lemma implies the axiom of choice, however my proof falls short when I try to prove every chain has an upper bound.  I understand there are other proofs on stackexchange, however my question is quite specific and I have not seen them answered elsewhere.
Here is my attempt so far.
Let $X$ be a non-empty set.  I will use Zorn's lemma to prove a choice function on $X$ exists (a choice function on $X$ is $c: (P(X)-\{\emptyset\}) \to X$ such that for every non-empty set $A \subset X$, $c(A) \in A$).  Then define the set $\mathcal{A}$ to be the collection of all $(f, Y)$ where $f$ is a choice function on $Y$, where $Y \subset X$ , and equip $\mathcal{A}$ with the partial order $(f, Y) \preceq (f', Y')$ if $Y \subset Y'$ and $f'|_{Y} = f$.
Now let $\mathcal{B} \subset \mathcal{A}$ be a linearly ordered subset (or commonly known as "chain") of $\mathcal{A}$.  Then defining $Z = \bigcup_{(f,Y) \in \mathcal{B}}Y$ and $g = \bigcup_{(f,Y) \in \mathcal{B}} f$, I claim $(g, Z) \in \mathcal{A}$ (where I refer to $f$, I'm refering to $f$ as a set, namely $(x, y) \in f \iff y = f(x)$).
This is the part where I'm having trouble.  I know $g$ is a function, since if $(x, y), (x,z) \in g$, then $(x,y) \in f$ and $(x,z) \in f'$, where $(f, Y), (f', Y') \in \mathcal{B}$.  Since $\mathcal{B}$ is linearly ordered, we have without loss of generality $(f, Y) \preceq (f', Y')$ and so $(x,y), (x,z) \in f'$ and since $f'$ is a function, we have $y=z$.  Hence $g$ is a function.
However, I'm having a hard time showing that the domain of $g$ is $P(Z)-\{\emptyset\}$.  Since if $W\subset Z$ and $W \neq \emptyset$, then by defintion of $Z$, $W \subset \bigcup_{(f,Y) \in \mathcal{B}}Y$.  To show $g$ is defined on $W$ then requires us to show there exists a $Y$ such that $W\subset Y$ and $(f,Y) \in \mathcal{B}$ but how do I show such a $Y$ esists?
It seems to me using the fact that $\mathcal{B}$ is linearly ordered is essential, but I fail to see how it works.  I am comfortable with the continuing the rest of the proof to completion.
 A: Your set-up can’t work (even after you fix the issue of the domain of your functions). To see this, consider the case where $X=\mathbb{N}$, and we have the chain $(f_n,\{0,\ldots,n-1\})$ with $f_n$ defined on the nonempty subsets of $n=\{0,\ldots,n-1\}$ and the restriction of $f_n$ to the nonempty subsets of $n-1=\{0,\ldots,n-2\}$ is $f_{n-1}$. Proceeding as you do, we take $Z=\cup n = \mathbb{N}$, and we let $g=\cup f_n$. However, $g$ is only defined on the nonempty finite subsets of $Z$, and not on any infinite subset. So you will not be able to show what you want to show. There are certainly subsets of $Z=\mathbb{N}$ that are not subsets of any $n$.

Instead, consider the collection of all pairs $(f_Y,Y)$, where $Y$ is a subset not of $X$, but of $P(X)-\varnothing$, and $f_Y\colon Y \to X$ satisfies $f_Y(A)\in A$ for all $A$. That is, instead of trying to extend choice functions fully defined on subsets of $X$, consider the collection of all “partial choice functions”, in that they are possibly defined on some subsets of $X$, but perhaps not on all nonempty subsets of $X$. Work on that set.
