Union of Mappings which Agree is Mapping/Family of Mappings

Theorem
Let $Y$ be a set.

Let $\family {A_i}_{i \mathop \in I}$ be a family of sets indexed by $I$.

Let $\family {f_i: A_i \to Y}$ be a family of mappings indexed by $I$.

Let $X = \ds \bigcup_{i \mathop \in I} A_i$.

Let $f = \ds \bigcup_{i \mathop \in I} f_i : X \to Y$ where $\ds \bigcup_{i \mathop \in I} f_i$ is the union of relations.

Let for all $i, j \in I$, $f_i$ and $f_j$ agree on $A_i \cap A_j$.

Then:
 * $f : X \to Y$ is a mapping

Proof
By definition, $f = \ds \bigcup_{i \mathop \in I} f_i$ is a relation whose domain is $X = \ds \bigcup_{i \mathop \in I} A_i$.

Let $\tuple {x, y_1}, \tuple {x, y_2} \in f$.

Then there exists $i, j \in I$ such that:
 * $\tuple {x, y_1} \in f_i$ and $\tuple {x, y_2} \in f_j$

Case 1 : $i = j$
Let $i = j$.

Then $\tuple {x, y_1}, \tuple {x, y_2} \in f_i$.

By definition of a mapping:
 * $y_1 = y_2$.

Case 2 : $i \ne j$
Let $i \ne j$.

Then $y_1 = \map {f_i} x$ and $y_2 = \map {f_i} x$.

But then $x \in A_i \cap A_j$.

By definition of agreement of mappings:
 * $y_1 = \map {f_i} x = \map {f_j} x = y_2$

Thus in both cases:
 * $\tuple {x, y_1}, \tuple {x, y_2} \in f \implies y_1 = y_2$

It follows that $f : X \to Y$ is a mapping by definition.