I'm having troubles understanding how the following definition is a possible version of the axiom of choice:
Let $X,Y$ be sets and $f:$ $X$$\,\to\,$$Y$ a surjective function, then a function $g:$ $Y$$\,\to\,$$X$ exists with $f \circ g = i$ with $i$ the identity function of $Y$.
I'm familiar with the following definition of the axiom of choice:
Let $Y$ be a set and $\chi$ a subset of $\mathcal{P}(Y)$, then a function $\alpha$ : $\chi $$\,\to\,$ $Y$ exists with $\alpha(X)\in X$ for every $X \in \chi$.
More precisely I don't understand what $X,Y$ represents in the first definition in regards to the second one. Is $Y$ the same in both? Is $X$ in the first definition the equivalent of $\chi$ in the second one?
The choice function should be definable for a collection of non-empty sets, so we demand that $\forall A \in \chi: A \neq \emptyset$
If $f:X \to Y$ is surjective we apply the choice function to the family $\chi=\{f^{-1}[\{y\}]: y \in Y\} \subseteq \mathscr{P}(X)$, which is a set of non-empty subsets iff $f$ is surjective.
The $X$ and $Y$ in both formulations are independent of each other (they're just "local names", or technically "bound variables". Here we apply the second one for the set $Y=X$ (where $X$ is from the first one).