hcju/stacksqa huggingface dataset:
We could prove this by the same method as employed in the corresponding lemma in the chapter on cohomology. Instead let us prove this by a double complex argument. \medskip\noindent Choose an injective resolution $\mathcal{F} \to \mathcal{I}^\bullet$ in the category of abelian sheaves on $\mathcal{C}$. Consider the double complex $A^{\bullet, \bullet}$ with terms $$ A^{p, q} = \mathcal{I}^q(K_p) $$ where the differential $d_1^{p, q} : A^{p, q} \to A^{p + 1, q}$ is the one coming from the differential on the complex $s(\mathcal{I}^q(K))$ associated to the cosimplicial abelian group $\mathcal{I}^p(K)$ and the differential $d_2^{p, q} : A^{p, q} \to A^{p, q + 1}$ is the one coming from the differential $\mathcal{I}^q \to \mathcal{I}^{q + 1}$. Denote $\text{Tot}(A^{\bullet, \bullet})$ the total complex associated to the double complex $A^{\bullet, \bullet}$, see Homology, Section \ref{homology-section-double-complexes}. We will use the two spectral sequences $({}'E_r, {}'d_r)$ and $({}''E_r, {}''d_r)$ associated to this double complex, see Homology, Section \ref{homology-section-double-complex}. \medskip\noindent By Lemma \ref{lemma-injective-trivial-cech} the complexes $s(\mathcal{I}^q(K))$ are acyclic in positive degrees and have $H^0$ equal to $\mathcal{I}^q(X)$. Hence by Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution} the natural map $$ \mathcal{I}^\bullet(X) \longrightarrow \text{Tot}(A^{\bullet, \bullet}) $$ is a quasi-isomorphism of complexes of abelian groups. In particular we conclude that $H^n(\text{Tot}(A^{\bullet, \bullet})) = H^n(X, \mathcal{F})$. \medskip\noindent The map $s(\mathcal{F}(K)) \longrightarrow R\Gamma(X, \mathcal{F})$ of the lemma is the composition of the map $s(\mathcal{F}(K)) \to \text{Tot}(A^{\bullet, \bullet})$ followed by the inverse of the displayed quasi-isomorphism above. This works because $\mathcal{I}^\bullet(X)$ is a representative of $R\Gamma(X, \mathcal{F})$. \medskip\noindent Consider the spectral sequence $({}'E_r, {}'d_r)_{r \geq 0}$. By Homology, Lemma \ref{homology-lemma-ss-double-complex} we see that $$ {}'E_2^{p, q} = H^p_I(H^q_{II}(A^{\bullet, \bullet})) $$ In other words, we first take cohomology with respect to $d_2$ which gives the groups ${}'E_1^{p, q} = \underline{H}^q(\mathcal{F})(K_p)$. Hence it is indeed the case (by the description of the differential ${}'d_1$) that ${}'E_2^{p, q} = \check{H}^p(K, \underline{H}^q(\mathcal{F}))$. By the above and Homology, Lemma \ref{homology-lemma-first-quadrant-ss} we see that this converges to $H^n(X, \mathcal{F})$ as desired. \medskip\noindent We omit the proof of the statements regarding the functoriality of the above constructions in the abelian sheaf $\mathcal{F}$ and the hypercovering $K$.
By (\ref{equation-identify-cech}) we have $$ s(\mathcal{F}(K)) = \Hom_{\textit{Ab}(\mathcal{C})}(s(\mathbf{Z}_{F(K)}^\#), \mathcal{F}) $$ The complex $s(\mathbf{Z}_{F(K)}^\#)$ is quasi-isomorphic to $\mathbf{Z}_\mathcal{G}^\#$, see Lemma \ref{lemma-acyclic-hypercover-sheaves}. We conclude that if $\mathcal{I}$ is an injective abelian sheaf, then the complex $s(\mathcal{I}(K))$ is acyclic except possibly in degree $0$. In other words, we have $\check{H}^i(K, \mathcal{I}) = 0$ for $i > 0$. Combined with Lemma \ref{lemma-h0-cech-variant} the lemma is proved.
Choose an injective resolution $\mathcal{F} \to \mathcal{I}^\bullet$ in the category of abelian sheaves on $\mathcal{C}$. Consider the double complex $A^{\bullet, \bullet}$ with terms $$ A^{p, q} = \mathcal{I}^q(K_p) $$ where the differential $d_1^{p, q} : A^{p, q} \to A^{p + 1, q}$ is the one coming from the differential $\mathcal{I}^p \to \mathcal{I}^{p + 1}$ and the differential $d_2^{p, q} : A^{p, q} \to A^{p, q + 1}$ is the one coming from the differential on the complex $s(\mathcal{I}^p(K))$ associated to the cosimplicial abelian group $\mathcal{I}^p(K)$ as explained above. We will use the two spectral sequences $({}'E_r, {}'d_r)$ and $({}''E_r, {}''d_r)$ associated to this double complex, see Homology, Section \ref{homology-section-double-complex}. \medskip\noindent By Lemma \ref{lemma-injective-trivial-cech-variant} the complexes $s(\mathcal{I}^p(K))$ are acyclic in positive degrees and have $H^0$ equal to $H^0(\mathcal{G}, \mathcal{I}^p)$. Hence by Homology, Lemma \ref{homology-lemma-double-complex-gives-resolution} and its proof the spectral sequence $({}'E_r, {}'d_r)$ degenerates, and the natural map $$ H^0(\mathcal{G}, \mathcal{I}^\bullet) \longrightarrow \text{Tot}(A^{\bullet, \bullet}) $$ is a quasi-isomorphism of complexes of abelian groups. The map $s(\mathcal{F}(K)) \longrightarrow R\Gamma(\mathcal{G}, \mathcal{F})$ of the lemma is the composition of the natural map $s(\mathcal{F}(K)) \to \text{Tot}(A^{\bullet, \bullet})$ followed by the inverse of the displayed quasi-isomorphism above. This works because $H^0(\mathcal{G}, \mathcal{I}^\bullet)$ is a representative of $R\Gamma(\mathcal{G}, \mathcal{F})$. \medskip\noindent Consider the spectral sequence $({}''E_r, {}''d_r)_{r \geq 0}$. By Homology, Lemma \ref{homology-lemma-ss-double-complex} we see that $$ {}''E_2^{p, q} = H^p_{II}(H^q_I(A^{\bullet, \bullet})) $$ In other words, we first take cohomology with respect to $d_1$ which gives the groups ${}''E_1^{p, q} = \underline{H}^p(\mathcal{F})(K_q)$. Hence it is indeed the case (by the description of the differential ${}''d_1$) that ${}''E_2^{p, q} = \check{H}^p(K, \underline{H}^q(\mathcal{F}))$. Since this spectral sequence converges to the cohomology of $\text{Tot}(A^{\bullet, \bullet})$ the proof is finished.
The morphism $(K \times_L M)_0 = K_0 \times_{L_0} M_0 \to K_0$ is a base change of a covering by (2), hence a covering, see Lemma \ref{lemma-covering-permanence}. And $K_0 \to \{X \to X\}$ is a covering by (1). Thus $(K \times_L M)_0 \to \{X \to X\}$ is a covering by Lemma \ref{lemma-covering-permanence}. Hence $K \times_L M$ satisfies the first condition of Definition \ref{definition-hypercovering}. \medskip\noindent We still have to check that $$ K_{n + 1} \times_{L_{n + 1}} M_{n + 1} = (K \times_L M)_{n + 1} \longrightarrow (\text{cosk}_n \text{sk}_n (K \times_L M))_{n + 1} $$ is a covering for all $n \geq 0$. We abbreviate as follows: $A = (\text{cosk}_n \text{sk}_n K)_{n + 1}$, $B = (\text{cosk}_n \text{sk}_n L)_{n + 1}$, and $C = (\text{cosk}_n \text{sk}_n M)_{n + 1}$. The functor $\text{cosk}_n \text{sk}_n$ commutes with fibre products, see Simplicial, Lemma \ref{simplicial-lemma-cosk-fibre-product}. Thus the right hand side above is equal to $A \times_B C$. Consider the following commutative diagram $$ \xymatrix{ K_{n + 1} \times_{L_{n + 1}} M_{n + 1} \ar[r] \ar[d] & M_{n + 1} \ar[d] \ar[rd]_\gamma \ar[rrd] & & \\ K_{n + 1} \ar[r] \ar[rd] & L_{n + 1} \ar[rrd] & L_{n + 1} \times_B C \ar[l] \ar[r] & C \ar[d] \\ & A \ar[rr] & & B } $$ This diagram shows that $$ K_{n + 1} \times_{L_{n + 1}} M_{n + 1} = (K_{n + 1} \times_B C) \times_{(L_{n + 1} \times_B C), \gamma} M_{n + 1} $$ Now, $K_{n + 1} \times_B C \to A \times_B C$ is a base change of the covering $K_{n + 1} \to A$ via the morphism $A \times_B C \to A$, hence is a covering. By assumption (3) the morphism $\gamma$ is a covering. Hence the morphism $$ (K_{n + 1} \times_B C) \times_{(L_{n + 1} \times_B C), \gamma} M_{n + 1} \longrightarrow K_{n + 1} \times_B C $$ is a covering as a base change of a covering. The lemma follows as a composition of coverings is a covering.
Write $K_n = \{U_i \to X\}_{i \in I}$. Thus the map $u$ is a morphism of presheaves of sets $u : \mathcal{F} \to \amalg h_{u_i}$. The assumption on $u$ means that for every $i \in I$ there exists a covering $\{U_{ij} \to U_i\}_{j \in I_i}$ of the site $\mathcal{C}$ and a morphism of presheaves $t_{ij} : h_{U_{ij}} \to \mathcal{F}$ such that $u \circ t_{ij}$ is the map $h_{U_{ij}} \to h_{U_i}$ coming from the morphism $U_{ij} \to U_i$. Set $J = \amalg_{i \in I} I_i$, and let $\alpha : J \to I$ be the obvious map. For $j \in J$ denote $V_j = U_{\alpha(j)j}$. Set $Z = \{V_j \to X\}_{j \in J}$. Finally, consider the morphism $u' : Z \to K_n$ given by $\alpha : J \to I$ and the morphisms $V_j = U_{\alpha(j)j} \to U_{\alpha(j)}$ above. Clearly, this is a covering in the category $\text{SR}(\mathcal{C}, X)$, and by construction $F(u') : F(Z) \to F(K_n)$ factors through $u$. Thus the result follows from Lemma \ref{lemma-covering} above.
If $n = 0$, then it follows easily that $V = U \amalg \Delta[0]$ (see below). In this case $\Hom(V, K)_0 = \Hom(U, K)_0 \times K_0$. The result, in this case, then follows from Lemma \ref{lemma-covering-permanence}. \medskip\noindent Let $a : \Delta[n] \to V$ be the morphism associated to $x$ as in Simplicial, Lemma \ref{simplicial-lemma-simplex-map}. Let us write $\partial \Delta[n] = i_{(n-1)!} \text{sk}_{n - 1} \Delta[n]$ for the $(n - 1)$-skeleton of $\Delta[n]$. Let $b : \partial \Delta[n] \to U$ be the restriction of $a$ to the $(n - 1)$ skeleton of $\Delta[n]$. By Simplicial, Lemma \ref{simplicial-lemma-glue-simplex} we have $V = U \amalg_{\partial \Delta[n]} \Delta[n]$. By Simplicial, Lemma \ref{simplicial-lemma-hom-from-coprod} we get that $$ \xymatrix{ \Hom(V, K)_0 \ar[r] \ar[d] & \Hom(U, K)_0 \ar[d] \\ \Hom(\Delta[n], K)_0 \ar[r] & \Hom(\partial \Delta[n], K)_0 } $$ is a fibre product square. Thus it suffices to show that the bottom horizontal arrow is a covering. By Simplicial, Lemma \ref{simplicial-lemma-cosk-shriek} this arrow is identified with $$ K_n \to (\text{cosk}_{n - 1} \text{sk}_{n - 1} K)_n $$ and hence is a covering by definition of a hypercovering.
Recall that $K_0$ is a covering of $X$ by Definition \ref{definition-hypercovering} and that this is equivalent to saying that $K_0 \to \{X \to X\}$ is a covering in the sense of Definition \ref{definition-covering-SR}. Hence (1) follows from (2) because it will prove that the composition $K_n \to K_{n - 1} \to \ldots \to K_0 \to \{X \to X\}$ is a covering by Lemma \ref{lemma-covering-permanence}. \medskip\noindent Proof of (2). Observe that $\Mor(\Delta[n], K)_0 = K_n$ by Simplicial, Lemma \ref{simplicial-lemma-exists-hom-from-simplicial-set-finite}. Therefore (2) follows from Lemma \ref{lemma-add-simplices} applied to the $n + 1$ different inclusions $\Delta[n - 1] \to \Delta[n]$.
The first and third equalities are Simplicial, Lemma \ref{simplicial-lemma-exists-hom-from-simplicial-set-finite}. The second and fourth follow from the cited lemma combined with Simplicial, Lemma \ref{simplicial-lemma-cosk-shriek}. The last assertion follows from the fact that $U$ is the push-out of the bottom and right arrow of the diagram (\ref{equation-dual-diagram}), via Simplicial, Lemma \ref{simplicial-lemma-hom-from-coprod}. To see that $U$ is equal to this push-out it suffices to see that the intersection of $\Delta[n + 1] \amalg \Delta[n + 1]$ and $\Delta[1] \times \partial\Delta[n + 1]$ in $\Delta[1] \times \Delta[n + 1]$ is equal to $\partial\Delta[n + 1] \amalg \partial\Delta[n + 1]$. This we leave to the reader.
Consider the following commutative diagram $$ \xymatrix{ K' \ar@{=}[r]^-{def} \ar[rd]_c & K \times_{(L \times L)} \Hom(\Delta[1], L) \ar[r] \ar[d] & \Hom(\Delta[1], L) \ar[d] \\ & K \ar[r]^{(a, b)} & L \times L } $$ By the functorial property of $\Hom(\Delta[1], L)$ the composition of the horizontal morphisms corresponds to a morphism $K' \times \Delta[1] \to L$ which defines a homotopy between $c \circ a$ and $c \circ b$. Thus if we can show that $K'$ is a hypercovering of $X$, then we obtain the lemma. To see this we will apply Lemma \ref{lemma-funny-gamma} to the pair of morphisms $K \to L \times L$ and $\Hom(\Delta[1], L) \to L \times L$. Condition (1) of Lemma \ref{lemma-funny-gamma} is satisfied. Condition (2) of Lemma \ref{lemma-funny-gamma} is true because $\Hom(\Delta[1], L)_0 = L_1$, and the morphism $(d^1_0, d^1_1) : L_1 \to L_0 \times L_0$ is a covering of $\text{SR}(\mathcal{C}, X)$ by our assumption that $L$ is a hypercovering. To prove condition (3) of Lemma \ref{lemma-funny-gamma} we use Lemma \ref{lemma-hom-hypercovering} above. According to this lemma the morphism $\gamma$ of condition (3) of Lemma \ref{lemma-funny-gamma} is the morphism $$ \Hom(\Delta[1] \times \Delta[n + 1], L)_0 \longrightarrow \Hom(U, L)_0 $$ where $U \subset \Delta[1] \times \Delta[n + 1]$. According to Lemma \ref{lemma-add-simplices} this is a covering and hence the claim has been proven.
The splitting of a simplicial set is unique and is given by the nondegenerate indices $N(I_n)$ in each degree $n$, see Simplicial, Lemma \ref{simplicial-lemma-splitting-simplicial-sets}. The coproduct of two objects $\{U_i\}_{i \in I}$ and $\{U_j\}_{j \in J}$ of $\text{SR}(\mathcal{C})$ is given by $\{U_l\}_{l \in I \amalg J}$ with obvious notation. Hence a splitting of $K$ must be given by $N(K_n) = \{U_i\}_{i \in N(I_n)}$. The equivalence of (1) and (2) now follows by unwinding the definitions. The equivalence of (2) and (3) follows from the fact that any surjection $\varphi : [m] \to [n]$ is a composition of morphisms $\sigma^k_j$ with $k = n, n + 1, \ldots, m - 1$.
This proof is almost the same as the proof of Lemma \ref{lemma-hypercovering-object}. We will only explain the differences. \medskip\noindent Let $n \geq 1$. Let us say that an {\it $n$-truncated $\mathcal{B}$-hypercovering} is given by an $n$-truncated simplicial object $K$ of $\text{SR}(\mathcal{C})$ such that for $i \in I_a$, $0 \leq a \leq n$ we have $U_{a, i} \in \mathcal{B}$ and such that \begin{enumerate} \item $F(K_0)^\# \to *$ is surjective, \item $F(K_1)^\# \to F(K_0)^\# \times F(K_0)^\#$ is surjective, \item $F(K_{a + 1})^\# \to F((\text{cosk}_a \text{sk}_a K)_{a + 1})^\#$ for $a = 1, \ldots, n - 1$ is surjective. \end{enumerate} We first explicitly construct a split $1$-truncated $\mathcal{B}$-hypercovering. \medskip\noindent Take $I_0 = \mathcal{B}$ and $K_0 = \{U\}_{U \in \mathcal{B}}$. Then (1) holds by our assumption on $\mathcal{B}$. Set $$ \Omega = \{(U, V, W, a, b) \mid U, V, W \in \mathcal{B}, a : U \to V, b : U \to W\} $$ Then we set $I_1 = I_0 \amalg \Omega$. For $i \in I_1$ we set $U_{1, i} = U_{0, i}$ if $i \in I_0$ and $U_{1, i} = U$ if $i = (U, V, W, a, b) \in \Omega$. The map $K(\sigma^0_0) : K_0 \to K_1$ corresponds to the inclusion $\alpha(\sigma^0_0) : I_0 \to I_1$ and the identity $f_{\sigma^0_0, i} : U_{0, i} \to U_{1, i}$ on objects. The maps $K(\delta^1_0), K(\delta^1_1) : K_1 \to K_0$ correspond to the two maps $I_1 \to I_0$ which are the identity on $I_0 \subset I_1$ and map $(U, V, W, a, b) \in \Omega \subset I_1$ to $V$, resp.\ $W$. The corresponding morphisms $f_{\delta^1_0, i}, f_{\delta^1_1, i} : U_{1, i} \to U_{0, i}$ are the identity if $i \in I_0$ and $a, b$ in case $i = (U, V, W, a, b) \in \Omega$. The reason that (2) holds is that any section of $F(K_0)^\# \times F(K_0)^\#$ over an object $U$ of $\mathcal{C}$ comes, after replacing $U$ by the members of a covering, from a map $U \to F(K_0) \times F(K_0)$. This in turn means we have $V, W \in \mathcal{B}$ and two morphisms $U \to V$ and $U \to W$. Further replacing $U$ by the members of a covering we may assume $U \in \mathcal{B}$ as desired. \medskip\noindent The lemma follows if we can prove that given a split $n$-truncated $\mathcal{B}$-hypercovering $K$ for $n \geq 1$ we can extend it to a split $(n + 1)$-truncated $\mathcal{B}$-hypercovering. Here the argument proceeds exactly as in the proof of Lemma \ref{lemma-hypercovering-object}. We omit the precise details, except for the following comments. First, we do not need assumption (2) in the proof of the current lemma as we do not need the morphism $K_{n + 1} \to (\text{cosk}_n K)_{n + 1}$ to be covering; we only need it to induce a surjection on associated sheaves of sets which follows from Sites, Lemma \ref{sites-lemma-covering-surjective-after-sheafification}. Second, the assumption that $\mathcal{C}$ has fibre products and equalizers guarantees that $\text{SR}(\mathcal{C})$ has fibre products and equalizers and $F$ commutes with these (Lemma \ref{lemma-coprod-prod-SR}). This suffices assure us the coskeleton functors used exist (see Simplicial, Remark \ref{simplicial-remark-existence-cosk} and Categories, Lemma \ref{categories-lemma-fibre-products-equalizers-exist}).
If we write $K_n = \{U_{n, i}\}_{i \in I_n}$ as in the introduction to this section, then $u(K)$ is the object of $\text{SR}(\mathcal{C})$ given by $u(K_n) = \{u(U_i)\}_{i \in I_n}$. By Sites, Lemma \ref{sites-lemma-pullback-representable-sheaf} we have $f^{-1}h_U^\# = h_{u(U)}^\#$ for $U \in \Ob(\mathcal{D})$. This means that $f^{-1}F(K_n)^\# = F(u(K_n))^\#$ for all $n$. Let us check the conditions (1), (2), (3) for $u(K)$ to be a hypercovering from Definition \ref{definition-hypercovering-variant}. Since $f^{-1}$ is an exact functor, we find that $$ F(u(K_0))^\# = f^{-1}F(K_0)^\# \to f^{-1}* = * $$ is surjective as a pullback of a surjective map and we get (1). Similarly, $$ F(u(K_1))^\# = f^{-1}F(K_1)^\# \to f^{-1} (F(K_0) \times F(K_0))^\# = F(u(K_0))^\# \times F(u(K_0))^\# $$ is surjective as a pullback and we get (2). For condition (3), in order to conclude by the same method it suffices if $$ F((\text{cosk}_n \text{sk}_n u(K))_{n + 1})^\# = f^{-1}F((\text{cosk}_n \text{sk}_n K)_{n + 1})^\# $$ The above shows that $f^{-1}F(-) = F(u(-))$. Thus it suffices to show that $u$ commutes with the limits used in defining $(\text{cosk}_n \text{sk}_n K)_{n + 1}$ for $n \geq 1$. By Simplicial, Remark \ref{simplicial-remark-existence-cosk} these limits are finite connected limits and $u$ commutes with these by assumption.
This is easier than the proof of Lemma \ref{lemma-hypercovering-morphism-sites} because the notion of being a hypercovering of an object is stronger, see Definitions \ref{definition-hypercovering} and \ref{definition-covering-SR}. Namely, $u$ sends coverings to coverings by the definition of a morphism of sites. It suffices to check $u$ commutes with the limits used in defining $(\text{cosk}_n \text{sk}_n K)_{n + 1}$ for $n \geq 1$. This is clear because the induced functor $\mathcal{D}/Y \to \mathcal{C}/X$ commutes with all finite limits (and source and target have all finite limits by Categories, Lemma \ref{categories-lemma-finite-limits-exist}).
This lemma is the analogue of Lemma \ref{lemma-quasi-separated-quasi-compact-hypercovering} for sites. To prove the lemma we follow exactly the proof of Lemma \ref{lemma-hypercovering-object} paying attention to the following two points \begin{enumerate} \item[(a)] We choose our initial covering $\{U_{0, i} \to X\}_{i \in I_0}$ with $U_{0, i} \in \mathcal{B}$ such that the index set $I_0$ is finite, and \item[(b)] in choosing the coverings (\ref{equation-choose-covering-B}) we choose $J_{i'}$ finite. \end{enumerate} The reader sees easily that with these modifications we end up with finite index sets $I_n$ for all $n$.
We check the three conditions of Definition \ref{definition-algebraic-stack}. By construction we have that $[U/R]$ is a stack in groupoids which is the first condition. \medskip\noindent The second condition follows from the stronger Lemma \ref{lemma-diagonal-quotient-stack}. \medskip\noindent Finally, we have to show there exists a scheme $W$ over $S$ and a surjective smooth $1$-morphism $(\Sch/W)_{fppf} \longrightarrow \mathcal{X}$. First choose $W \in \Ob((\Sch/S)_{fppf})$ and a surjective \'etale morphism $W \to U$. Note that this gives a surjective \'etale morphism $\mathcal{S}_W \to \mathcal{S}_U$ of categories fibred in sets, see Lemma \ref{lemma-map-presheaves-representable-by-spaces-transformation-property}. Of course then $\mathcal{S}_W \to \mathcal{S}_U$ is also surjective and smooth, see Lemma \ref{lemma-representable-transformations-property-implication}. Hence $\mathcal{S}_W \to \mathcal{S}_U \to [U/R]$ is surjective and smooth by a combination of Lemmas \ref{lemma-smooth-quotient-smooth-presentation} and \ref{lemma-composition-representable-transformations-property}.
Write $f_1 \times f_2$ as the composition $\mathcal{X}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1 \times \mathcal{Y}_2$. The first arrow is the base change of $f_1$ by the map $\mathcal{Y}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1$, and the second arrow is the base change of $f_2$ by the map $\mathcal{Y}_1 \times \mathcal{Y}_2 \to \mathcal{Y}_2$. Hence this lemma is a formal consequence of Lemmas \ref{lemma-composition-representable-transformations} and \ref{lemma-base-change-representable-transformations}.
This is a reformulation of Bootstrap, Lemma \ref{bootstrap-lemma-representable-by-spaces-over-space}. First note that $\mathcal{Z} \times_{g, \mathcal{Y}, f} \mathcal{X}$ is fibred in setoids over $(\Sch/S)_{fppf}$. Hence it is equivalent to $\mathcal{S}_F$ for some presheaf $F$ on $(\Sch/S)_{fppf}$, see Categories, Lemma \ref{categories-lemma-setoid-fibres}. Moreover, let $G$ be an algebraic space which represents $\mathcal{Z}$. The $1$-morphism $\mathcal{Z} \times_{g, \mathcal{Y}, f} \mathcal{X} \to \mathcal{Z}$ is representable by algebraic spaces by Lemma \ref{lemma-base-change-representable-by-spaces}. And $\mathcal{Z} \times_{g, \mathcal{Y}, f} \mathcal{X} \to \mathcal{Z}$ corresponds to a morphism $F \to G$ by Categories, Lemma \ref{categories-lemma-2-category-fibred-setoids}. Then $F \to G$ is representable by algebraic spaces by Lemma \ref{lemma-map-fibred-setoids-representable-algebraic-spaces}. Hence Bootstrap, Lemma \ref{bootstrap-lemma-representable-by-spaces-over-space} implies that $F$ is an algebraic space as desired.
Write $f_1 \times f_2$ as the composition $\mathcal{X}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1 \times \mathcal{Y}_2$. The first arrow is the base change of $f_1$ by the map $\mathcal{Y}_1 \times \mathcal{X}_2 \to \mathcal{Y}_1$, and the second arrow is the base change of $f_2$ by the map $\mathcal{Y}_1 \times \mathcal{Y}_2 \to \mathcal{Y}_2$. Hence this lemma is a formal consequence of Lemmas \ref{lemma-composition-representable-by-spaces} and \ref{lemma-base-change-representable-by-spaces}.
The property of a morphism being representable by algebraic spaces is preserved under base-change (Lemma \ref{lemma-base-change-by-space-representable-by-space}), and so, passing to the base-change $\mathcal{X} \times_\mathcal{Z} \mathcal{Y}$ over $\mathcal{Y}$, we may reduce to the case of a morphism of categories fibred in groupoids $\mathcal{X} \to \mathcal{Y}$ which is representable by algebraic spaces, and whose target is a stack in groupoids; our goal is then to prove that $\mathcal{X}$ is also a stack in groupoids. This follows from Stacks, Lemma \ref{stacks-lemma-relative-sheaf-over-stack-is-stack} whose assumptions are satisfied as a result of Lemma \ref{lemma-criterion-map-representable-spaces-fibred-in-groupoids}.
We have seen in Lemma \ref{lemma-criterion-map-representable-spaces-fibred-in-groupoids} that $j$ is faithful on fibre categories. Consider a scheme $U$, two objects $u, v$ of $\mathcal{X}_U$, and an isomorphism $t : j(u) \to j(v)$ in $\mathcal{Y}_U$. We have to construct an isomorphism in $\mathcal{X}_U$ between $u$ and $v$. By the $2$-Yoneda lemma (see Section \ref{section-2-yoneda}) we think of $u$, $v$ as $1$-morphisms $u, v : (\Sch/U)_{fppf} \to \mathcal{X}$ and we consider the $2$-fibre product $$ (\Sch/U)_{fppf} \times_{j \circ v, \mathcal{Y}} \mathcal{X}. $$ By assumption this is representable by an algebraic space $F_{j \circ v}$, over $U$ and the morphism $F_{j \circ v} \to U$ is a monomorphism. But since $(1_U, v, 1_{j(v)})$ gives a $1$-morphism of $(\Sch/U)_{fppf}$ into the displayed $2$-fibre product, we see that $F_{j \circ v} = U$ (here we use that if $V \to U$ is a monomorphism of algebraic spaces which has a section, then $V = U$). Therefore the $1$-morphism projecting to the first coordinate $$ (\Sch/U)_{fppf} \times_{j \circ v, \mathcal{Y}} \mathcal{X} \to (\Sch/U)_{fppf} $$ is an equivalence of fibre categories. Since $(1_U, u, t)$ and $(1_U, v, 1_{j(v)})$ give two objects in $((\Sch/U)_{fppf} \times_{j \circ v, \mathcal{Y}} \mathcal{X})_U$ which have the same first coordinate, there must be a $2$-morphism between them in the $2$-fibre product. This is by definition a morphism $\tilde t : u \to v$ such that $j(\tilde t) = t$.