I'm currently reading the Stacks Project section on gluing schemes. I can understand the proof of Lemma 01JB, but it is hard for me to understand the proof of Lemma 01JC. By constructions of the locally ring space $(X, \mathscr O_X)$ in Lemma 01JB, we know that we can look at the restrictions $\mathscr O_X|_{U_i}$ which are isomorphic to $\mathscr O_{U_i}=(\varphi_i)_*\mathscr O_i$. Then clearly if the $(U_i, \mathscr O_{U_i})$ are schemes the restrictions are then schemes. But why are the locally ringed spaces $(U_i, \mathscr O_{U_i})$ and $(X_i, \mathscr O_i)$ isomorphic? Is it true that because the inverse of $\varphi_i$ is an open immersion (a homomorphism to the entire $X_i$ and the canonical map $\varphi_i^{-1}(\varphi_i)_*\mathscr O_i\to\mathscr O_i$ is an isomorphism), by Lemma 01HH on open immersions, there is an isomorphism of locally ringed spaces from $(U_i, \mathscr O_{U_i})$ to $(X_i,\mathscr O_i)$?
Stacks Project proof that gluing locally ringed spaces which happen to be schemes gives a scheme
algebraic-geometryringed-spacesschemes
Related Solutions
I don't know whether the following is available in published form somewhere, I learned it from Jens Franke. I have written notes in german, and Martin has them in english, I think?
Suppose $f: X\to Z$ and $g: Y\to Z$ are morphisms of locally ringed spaces. The fiber product $X\times_Z Y$ of $f$ and $g$ in the category $\textbf{LRS}$ can be described as follows:
Underlying set: The set underlying of $X\times_Z Y$ is given by $$X\times_Z Y := \{(x,y,{\mathfrak p})\ |\ x\in X, y\in Y, f(x)=g(y)=:z,\\\quad\quad\quad\quad\quad\quad{\mathfrak p}\in\text{Spec}({\mathcal O}_{X,x}\otimes_{\mathcal O_{Z,z}}{\mathcal O}_{Y,y}),\\ \quad\quad\quad\quad\quad\quad\quad\quad\ \iota_{x,y,X}^{-1}({\mathfrak p})={\mathfrak m}_{X,x}, \iota^{-1}_{x,y,Y}({\mathfrak p}) = {\mathfrak m}_{Y,y}\}$$ Here, $\iota_{x,y,X}: {\mathcal O}_{X,x}\to{\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y}$ and $\iota_{x,y,Y}: {\mathcal O}_{Y,y}\to{\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y}$ are the canonical maps.
Topology: For $U\subset X$ and $V\subset Y$ open and $f\in{\mathcal O}_X(U)\otimes_{{\mathcal O}_Z(Z)}{\mathcal O}_Y(V)$ put $${\mathcal U}(U,V,f)\ :=\ \{(x,y,{\mathfrak p})\in X\times_Z Y\ |\ x\in U, y\in V, (\text{im. of } f\text{ in } {\mathcal O}_{X,x}\otimes_{\mathcal O_{Z,z}}{\mathcal O}_{Y,y})\notin {\mathfrak p}\}.$$ This defines the base for a topology on $X\times_Z Y$.
Structure sheaf: For $(x,y,{\mathfrak p})$ denote ${\mathcal O}_{X\times_ ZY,(x,y,{\mathfrak p})} := ({\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y})_{\mathfrak p}$. For $W\subset X\times_Z Y$ put $${\mathcal O}_{X\times_Z Y}(W) := \{(\lambda_{x,y,{\mathfrak p}})\in\prod\limits_{(x,y,{\mathfrak p})\in W} {\mathcal O}_{X\times_Z Y,(x,y,{\mathfrak p})}\ |\ \text{for every } (x,y,{\mathfrak p})\in W\text{ there ex. } \\ \text{std. open }{\mathcal U}(U,V,f)\subset W\text{ cont. } (x,y,{\mathfrak p})\text{ and }\mu\in({\mathcal O}_X(U)\otimes_{{\mathcal O}_Z(Z)}{\mathcal O}_{Y}(V))_f\\ \text{s.t. for all }(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})\in{\mathcal U}(U,V,f)\text{ we have } \lambda_{(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})}=\mu_{(x^{\prime},y^{\prime},{\mathfrak p}^{\prime})}\}$$ (The stalk of ${\mathcal O}_{X\times_Z Y}$ at $(x,y,{\mathfrak p})$ it then indeed $({\mathcal O}_{X,x}\otimes_{{\mathcal O}_{Z,z}}{\mathcal O}_{Y,y})_{\mathfrak p})$
Structure morphisms: One has canonical projections $X\leftarrow X\times_Z Y\to Y$, details ommitted for now.
There are many things to be checked, but maybe you want to think about them yourself to familiarize with the definitions?
Best Answer
The statement of lemma 01JB involves open subspaces $U_i$ of $X$, and isomorphisms $X_i \rightarrow U_i$. This means that $U_i$ is isomorphic as a locally ringed space to $X_i$.
To show this, you can check that the inclusion $X_i \rightarrow X$ is an open immersion of locally ringed spaces giving an isomorphism $X_i \sim U_i$. It's an open embedding on the level of topological spaces, and since $O_X$ is constructed by gluing $O_{X_i}$, the structure sheaves agree.
Therefore, if all $X_i$'s are schemes, then $X$ can be covered by schemes, so $X$ is a scheme.