Cantor-Bernstein-Schröder Theorem/Lemma

Theorem
Let $S$ be a set.

Let $T \subseteq S$.

Suppose that $f: S \to T$ is an injection.

Then there is a bijection $g: S \to T$.

Proof
Recursively define a sequence $\langle C_n \rangle$ in the power set of $S$ as follows:


 * $C_0 = S \setminus T$, the difference between $S$ and $T$.
 * $C_{n+1} = f(C_n)$, the image of $C_n$ under $f$.

Let $\displaystyle C = \bigcup_{n \in \N} C_n$.

Define a mapping $h: S \to T$ as follows:


 * $\displaystyle h(x) = \cases {

f(x) & \text{if $x \in C$} \\ x & \text{if $x \notin C$} }$

$h$ is indeed a mapping from $S$ to $T$
By the Principle of Recursive Definition the construction produces a mapping from $S$ to $S$.

We need only show that $h(x) \in T$ for each $x \in S$.

Let $x \in S$.

By Law of Excluded Middle:


 * $x \in C$ or $x \notin C$.

If $x \in C$, then $h(x) = f(x) \in T$.

If $x \notin C$, then by Subset of Union, $x \notin C_0$.

Thus $x \in S \setminus C_0 = T$.

Since $h(x) = x$ in this case:


 * $h(x) \in T$

$h$ is injective
Let $x, y \in S$ and suppose that $h(x) = h(y)$.

If $x, y \in C$, then $x = y$ because $f$ is injective.

If $x, y \notin C$, then $x = y$ by Identity Mapping is Injection.

If $x \in C$ and $y \notin C$, then:

$x \in C_n$ for some $n$ by the definition of union.


 * $h(x) = f(x) \in C_{n+1} \subseteq C$ by Subset of Union.

Thus $h(x) \in C$.


 * $h(y) = y$ by the definition of $h$.

Since $y \notin C$, this contradicts the assumption that $h(x) = h(y)$.

Thus $h(x) = h(y) \implies x = y$ for all $x, y \in S$, so $h$ is injective.

$h$ is surjective
Let $y \in T$.

If $y \notin C$, then $h(y) = y$.

If $y \in C$, then since $y \notin C_0 = S \setminus T$:


 * $y \in C_{n+1}$ for some $n \ge 0$.

Thus $y = f(x)$ for some $x \in C_n$.

By the definition of union, $x \in C$.

Thus $h(x) = f(x) = y$.

This in all cases we can find an $x \in S$ such that $h(x) = y$, so $h$ is surjective.