Injection iff Left Inverse

Theorem
A mapping $$f: S \to T, S \ne \varnothing$$ is an injection iff:

$$\exists g: T \to S: g \circ f = I_S$$

... where $$g$$ is a mapping.

This mapping $$g: T \to S$$ is called a left inverse.

Proof

 * Assume $$\exists g: T \to S: g \circ f = I_S$$.

From Identity Mapping is an Injection, $$I_S$$ is injective, so $$g \circ f$$ is injective.

So from Composite with Injection is an Injection, $$f$$ is an injection.

Note that the existence of such a $$g$$ requires that $$S \ne \varnothing$$.


 * Now, assume $$f$$ is an injection.

We now define a mapping $$g: T \to S$$ as follows.

As $$S \ne \varnothing$$, we choose $$x_0 \in S$$. Then we define:

$$g \left({y}\right) = \begin{cases} x_0: & y \in T - \mathrm{Im} \left({f}\right) \\ f^{-1} \left({y}\right): & y \in \mathrm{Im} \left({f}\right) \end{cases} $$

... which we know we can do, as $$f^{-1}: \mathrm{Im} \left({f}\right) \to S$$ is an inverse mapping.

So, for all $$x \in S$$, $$g \circ f \left({x}\right) = g \left({f \left({x}\right)}\right)$$ is the unique element of $$S$$ which $$f$$ maps to $$f \left({x}\right)$$.

This unique element is $$x$$.

Thus $$g \circ f = I_S$$.

Comment
Notice that it does not matter what the elements of $$T - \mathrm{Im} \left({f}\right)$$ are - using the construction given, the equation $$g \circ f = I_S$$ holds whatever value (or values) we choose for $$g \left({T - \mathrm{Im} \left({f}\right)}\right)$$. The left-over elements of $$T$$ we can map how we wish and they will not affect the final destination of any $$x \in S$$ under the mapping $$g \circ f$$.