Lemma 2.0.11 (Gluing for Functions). Let $X, Y$ be sets, $\seq{U_i}\subset 2^{X}$, and $\seqi{f}$ with $f_{i}: U_{i} \to Y$ for all $i \in I$. If:
$\bigcup_{i \in I}U_{i} = X$.
For each $i, j \in I$, either $U_{i} \cap U_{j} = \emptyset$, or $f_{i}|_{U_i \cap U_j}= f_{j}|_{U_i \cap U_j}$.
then there exists a unique $f: X \to Y$ such that $f|_{U_i}= f_{i}$ for all $i \in I$.
Proof. For each $i \in I$, let $\Gamma_{i} \subset U_{i} \times Y$ be the graph of $f_{i}$. Let $\Gamma = \bigcup_{i \in I}\Gamma_{i}$, then:
By assumption (a), $\bracs{x|(x, y) \in \Gamma}= \bigcup_{i \in I}U_{i} = X$.
For any $x \in X$, there exists $y \in Y$ with $(x, y) \in \Gamma$, and $i \in I$ such that $(x, y) \in \Gamma_{i}$. If $(x, y') \in \Gamma_{j} \subset \Gamma$, then $x \in U_{i} \cap U_{j} \ne \emptyset$. By assumption (b), $y = y'$.
Thus $\Gamma$ is the graph of a function $f: X \to Y$ with $f|_{U_i}= f_{i}$ for all $i \in I$.$\square$