Injection has Surjective Left Inverse Mapping/Proof 1

Theorem
Let $f: S \to T$ be a injection.

Then there is a surjection $g: T \to S$ such that $g \circ f = I_S$.

Proof
Since $S$ is non-empty, we can choose an element $x \in S$.

Since $f$ is an injection, for each $t \in \operatorname{im}\left({f}\right)$ there exists a unique $s \in S$ such that $f\left({s}\right) = t$.

Thus by Law of Excluded Middle we have a well defined mapping $T \to S$ given by:
 * $\displaystyle g \left({t}\right) =

\begin{cases} s & : (t \in \operatorname{im} f) \wedge (f(s) = t) \\ x &: t \notin \operatorname{im} f \end{cases}$

By construction, for any given $s \in S$, the element $f\left({s}\right)$ maps to $s$ under $g$.

Therefore $g : T \to S$ is a surjection.