> [!theorem] Set Theoretic Gluing Lemma > > Let $X$ and $Y$ be sets, $\seqi{U}$ be a family of sets with $\bigcup_{i \in I}U_i = X$, and $f_i:U_i \to Y$ be a family of [[Function|functions]]. If for any $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 function $f: X \to Y$ such that $f|_{U_i} = f_i$ for all $i \in I$. > > *Proof*. Each $f_i$ can be identified with its graph $\Gamma_i \subset U_i \times Y$. Let $\Gamma = \bigcup_{i \in I}\Gamma_i$, then $\Gamma \subset X \times Y$. Let $\pi_1: X \times Y \to X$ be the projection map to the first coordinate. For each $x \in X$, there exists $i \in I$ with $x \in U_i$, hence $\pi_1(\Gamma) \supset \pi_1(\Gamma_i) \ni x$. Moreover, > $ > \bracs{(x', y) \in \Gamma: x' = x} = \pi_1^{-1}(x) \cap \Gamma = \bigcup_{i \in I}\pi_1^{-1}(x) \cap \Gamma_i > $ > Where for any $i \in I$, $\pi_1^{-1}(x) \cap \Gamma_i = \emptyset$ or $\pi_1^{-1}(x) \cap \Gamma_i = \bracs{f_i(x)}$. For any $i, j \in I$ where $x \in U_i \cap U_j$, $\pi_1^{-1}(x) \cap \Gamma_i = \pi_1^{-1}(x) \cap \Gamma_j$. Therefore $\bigcup_{i \in I}\pi_1^{-1}(x) \cap \Gamma_i$ contains one unique element. > > Hence $\Gamma$ defines the graph of a function $f$, which is the desired extension. > [!theorem] Gluing Lemma on Manifolds > > Let $X$ and $Y$ be $C^p$-[[Manifold|manifolds]], $\seqi{U}$ be an [[Open Cover|open cover]] of $X$, and $f_i: U_i \to Y$ be a family of [[Manifold Morphism|morphisms]] satisfying the condition of the previous theorem, then there exists a unique morphism $f: X \to Y$ such that $f|_{U_i} = f_i$ for all $i \in I$. > > *Proof*. It's sufficient to show that $f$ is a morphism. To that end, let $p \in X$, then there exists $i \in I$ such that $p \in U_i$. In which case there exists a chart $(U, \varphi) \in X$ such that $U \subset U_i$. Let $(V, \psi) \in Y$ be a chart at $f(p) = f_i(p)$ and assume without loss of generality that $V \supset f_i(U)$, then ${f_i}_{U, V}$ is $C^p$ at $p$. Since $f_i|_U = f|_U$, $f_{U, V}$ is also $C^p$ at $p$. Hence $f$ is a morphism.