Surjection iff Cardinal Inequality

Theorem
Let $S$ and $T$ be sets such that $S \sim \left|{S}\right|$ and $T \sim \left|{T}\right|$.

Furthermore, let $S$ be nonempty.

Then:
 * $0 < \left|{T}\right| \le \left|{S}\right|$ iff there exists a surjection $f: S \to T$.

Necessary Condition
Suppose $f: S \to T$ is a surjection.

Then $\operatorname{Im}\left({f}\right) = T$ by Surjection iff Image equals Codomain.

From Cardinality of Image of Mapping not greater than Cardinality of Domain:
 * $\left|{T}\right| \le \left|{S}\right|$

Furthermore, if $S$ is nonempty, then $f\left({x}\right) \in T$ for some $x \in S$.

Thus, $T$ is nonempty and $0 < \left|{T}\right|$ by Cardinality of Empty Set.

Sufficient Condition
Suppose that $0 < \left|{T}\right| \le \left|{S}\right|$.

By Injection iff Cardinal Inequality, it follows that $g : T \to S$ for some injection $g$.

Take an arbitrary $y \in T$.

Define the function $f: S \to T$ as follows:


 * $f \left({x}\right) = \begin{cases}

g^{-1} \left({x}\right) & : x \in \operatorname{Im} \left({g}\right) \\ y & : x \notin \operatorname{Im}\left({g}\right) \end{cases}$

For any $z \in T$, $g \left({z}\right) \in \operatorname{Im} \left({g}\right)$.

Thus, $f \left({x}\right) = z$ for some $x \in S$.

It follows that $f: S \to T$ is a surjection.