Injection iff Left Inverse/Proof 3

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.

That is, iff $f$ has a left inverse.

Proof
Let $f: S \to T$ be an injection.

Then $f$ is a one-to-many relation.

By Inverse of Many-to-One Relation is One-to-Many, $f^{-1}: T \to S$ is many-to-one.

By Many-to-One Relation Extends to Mapping, there is a Mapping $g: T \to S$ such that $f^{-1} \subseteq g$.

Let $(x, y) \in g \circ f$.

Then for some $z \in T$, $(x, z) \in f$ and $(z, y) \in g$.

Since $(x,z) \in f$, $(z, x) \in f^{-1} \subseteq g$.

Since $(z,y) \in g$, $(z,x) \in g$, and $g$ is a mapping, $x = y$, so $(x,y) \in I_S$.

So we see that $g \circ f \subseteq I_S$.

Let $x \in S$.

Then $(x, f(x)) \in f$ and $(f(x), x) \in f^{-1} \subseteq g$.

So $(x, x) \in g \circ f$.

Thus $I_S \subseteq g \circ f$.

By definition of set equality:
 * $I_S = g \circ f$