Union of Functions Theorem

Theorem
Let $X$ be a set.

Let $\sequence {X_i: i \in \N}$ be an exhausting sequence of sets on $X$.

For each $i \in \N$, let $g_i: X_i \to Y$ be a mapping such that:
 * $g_{i + 1} \restriction X_i = g_i$

where $g_{i + 1} \restriction X_i$ denotes the restriction of $g_{i + 1}$ to $g_i$.

Then:
 * $\ds \bigcup \set {g_i: i \in \N}$

is a mapping from $X$ to $Y$.

Proof
By definition, $\ds g = \bigcup \set {g_i: i \in \N}$ is a relation whose domain is $X$.

$g$ is not a mapping.

Then for some $x \in X$ and $i, h \in \N$:
 * $(1): \quad x \in X_i, \map {g_i} x \ne \map {g_{i + h} } x$

Let $k \in \N$ be the smallest such that:
 * $\map {g_i} x \ne g_{i + k}$

where $x$ and $i$ are the same as in $(1)$.

Then:
 * $\map {g_{i + k - 1} } x = g_i$

But then:
 * $g_{i + k} \restriction X_{i + k - 1} = g_{i + k - 1}$

From this contradiction it follows that our supposition that $g$ is not a mapping must be false.

That is:
 * $\ds \bigcup \set {g_i: i \in \N}$

is a mapping from $X$ to $Y$.