hcju/stacksqa huggingface dataset:
Note that (2) follows from (1) by Lemmas \ref{lemma-2-product-fibred-categories-over-C} and \ref{lemma-fibred-equivalent}. Thus it suffices to prove (1). We will use without further mention the construction of the $2$-fibre product from Lemma \ref{lemma-2-product-fibred-categories-over-C}. In particular an object of $\mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S}$ is a triple $(x, y, (\iota, \kappa))$ where $x$ and $y$ are objects of $\mathcal{S}$, and $(\iota, \kappa) : (x, x, \text{id}_{F(x)}) \to (y, y, \text{id}_{F(y)})$ is an isomorphism in $\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}$. This just means that $\iota, \kappa : x \to y$ are isomorphisms and that $F(\iota) = F(\kappa)$. Consider the functor $$ I_{\mathcal{S}/\mathcal{S}'} \longrightarrow \mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S} $$ which to an object $(x, \alpha)$ of the left hand side assigns the object $(x, x, (\alpha, \text{id}_x))$ of the right hand side and to a morphism $\phi$ of the left hand side assigns the morphism $(\phi, \phi)$ of the right hand side. We claim that a quasi-inverse to that morphism is given by the functor $$ \mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S} \longrightarrow I_{\mathcal{S}/\mathcal{S}'} $$ which to an object $(x, y, (\iota, \kappa))$ of the left hand side assigns the object $(x, \kappa^{-1} \circ \iota)$ of the right hand side and to a morphism $(\phi, \phi') : (x, y, (\iota, \kappa)) \to (z, w, (\lambda, \mu))$ of the left hand side assigns the morphism $\phi$. Indeed, the endo-functor of $I_{\mathcal{S}/\mathcal{S}'}$ induced by composing the two functors above is the identity on the nose, and the endo-functor induced on $\mathcal{S} \times_{\Delta, (\mathcal{S} \times_{\mathcal{S}'} \mathcal{S}), \Delta} \mathcal{S}$ is isomorphic to the identity via the natural isomorphism $$ (\text{id}_x, \kappa) : (x, x, (\kappa^{-1} \circ \iota, \text{id}_x)) \longrightarrow (x, y, (\iota, \kappa)). $$ Some details omitted.
Assume $p : \mathcal{S} \to \mathcal{C}$ is fibred in groupoids. To show all fibre categories $\mathcal{S}_U$ for $U \in \Ob(\mathcal{C})$ are groupoids, we must exhibit for every $f : y \to x$ in $\mathcal{S}_U$ an inverse morphism.  The diagram on the left (in $\mathcal{S}_U$) is mapped by $p$ to the diagram on the right: $$ \xymatrix{ y \ar[r]^f & x & U \ar[r]^{\text{id}_U} & U \\ x \ar@{-->}[u] \ar[ru]_{\text{id}_x} & & U \ar@{-->}[u]\ar[ru]_{\text{id}_U} & \\ } $$ Since only $\text{i}d_U$ makes the diagram on the right commute, there is a unique $g : x \to y$ making the diagram on the left commute, so $fg = \text{id}_x$. By a similar argument there is a unique $h : y \to x$ so that $gh = \text{id}_y$. Then $fgh = f : y \to x$.  We have $fg = \text{id}_x$, so $h = f$. Condition (2) of Definition \ref{definition-fibred-groupoids} says exactly that every morphism of $\mathcal{S}$ is strongly cartesian. Hence condition (1) of Definition \ref{definition-fibred-groupoids} implies that $\mathcal{S}$ is a fibred category over $\mathcal{C}$. \medskip\noindent Conversely, assume all fibre categories are groupoids and $\mathcal{S}$ is a fibred category over $\mathcal{C}$. We have to check conditions (1) and (2) of Definition \ref{definition-fibred-groupoids}. The first condition follows trivially. Let $\phi : y \to x$, $\psi : z \to x$ and $f : p(z) \to p(y)$ such that $p(\phi) \circ f = p(\psi)$ be as in condition (2) of Definition \ref{definition-fibred-groupoids}. Write $U = p(x)$, $V = p(y)$, $W = p(z)$, $p(\phi) = g : V \to U$, $p(\psi) = h : W \to U$. Choose a strongly cartesian $g^*x \to x$ lying over $g$. Then we get a morphism $i : y \to g^*x$ in $\mathcal{S}_V$, which is therefore an isomorphism. We also get a morphism $j : z \to g^*x$ corresponding to the pair $(\psi, f)$ as $g^*x \to x$ is strongly cartesian. Then one checks that $\chi = i^{-1} \circ j$ is a solution. \medskip\noindent We have seen in the proof of (1) $\Rightarrow$ (2) that every morphism of $\mathcal{S}$ is strongly cartesian. The final statement follows directly from Lemma \ref{lemma-fibred}.
Note that the construction makes sense since by Lemma \ref{lemma-composition-cartesian} the identity morphism of any object of $\mathcal{S}$ is strongly cartesian, and the composition of strongly cartesian morphisms is strongly cartesian. The first lifting property of Definition \ref{definition-fibred-groupoids} follows from the condition that in a fibred category given any morphism $f : V \to U$ and $x$ lying over $U$ there exists a strongly cartesian morphism $\varphi : y \to x$ lying over $f$. Let us check the second lifting property of Definition \ref{definition-fibred-groupoids} for the category $p' : \mathcal{S}' \to \mathcal{C}$ over $\mathcal{C}$. To do this we argue as in the discussion following Definition \ref{definition-fibred-groupoids}. Thus in Diagram \ref{equation-fibred-groupoids} the morphisms $\phi$, $\psi$ and $\gamma$ are strongly cartesian morphisms of $\mathcal{S}$. Hence $\gamma$ and $\phi \circ \psi$ are strongly cartesian morphisms of $\mathcal{S}$ lying over the same arrow of $\mathcal{C}$ and having the same target in $\mathcal{S}$. By the discussion following Definition \ref{definition-cartesian-over-C} this means these two arrows are isomorphic as desired (here we use also that any isomorphism in $\mathcal{S}$ is strongly cartesian, by Lemma \ref{lemma-composition-cartesian} again).
By Lemma \ref{lemma-2-product-fibred-categories-over-C} the fibre product as described in Lemma \ref{lemma-2-product-categories-over-C} is a fibred category. Hence it suffices to prove that the fibre categories are groupoids, see Lemma \ref{lemma-fibred-groupoids}. By Lemma \ref{lemma-fibre-2-fibre-product-categories-over-C} it is enough to show that the $2$-fibre product of groupoids is a groupoid, which is clear (from the construction in Lemma \ref{lemma-2-fibre-product-categories} for example).
By Lemma \ref{lemma-equivalence-fibred-categories} it suffices to look at fibre categories over an object $U$ of $\mathcal{C}$. An object of the right hand side is a triple $(x, x', \alpha)$ where $\alpha : G(x) \to G(x')$ is a morphism in $\mathcal{S}'_U$. The functor $\Delta_G$ maps the object $x$ of $\mathcal{S}_U$ to the triple $(x, x, \text{id}_{G(x)})$. Note that $(x, x', \alpha)$ is in the essential image of $\Delta_G$ if and only if $\alpha = G(\beta)$ for some morphism $\beta : x \to x'$ in $\mathcal{S}_U$ (details omitted). Hence in order for $\Delta_G$ to be an equivalence, every $\alpha$ has to be the image of a morphism $\beta : x \to x'$, and also every two distinct morphisms $\beta, \beta' : x \to x'$ have to give distinct morphisms $G(\beta), G(\beta')$. This proves the lemma.
Clear from the construction in Lemma \ref{lemma-inertia-fibred-category} or by using (from the same lemma) that $I_\mathcal{S} \to \mathcal{S} \times_{\Delta, \mathcal{S} \times_\mathcal{C} \mathcal{S}, \Delta}\mathcal{S}$ is an equivalence and appealing to Lemma \ref{lemma-2-product-fibred-categories}.
We have already seen in Lemma \ref{lemma-cute} that $p'$ is a fibred category. Hence it suffices to prove the fibre categories are groupoids, see Lemma \ref{lemma-fibred-groupoids}. For $V \in \Ob(\mathcal{C})$ we have $$ \mathcal{S}_V = \coprod\nolimits_{f : V \to U} \mathcal{S}_{(f : V \to U)} $$ where the left hand side is the fibre category of $p$ and the right hand side is the disjoint union of the fibre categories of $p'$. Hence the result.
One can prove this directly from the definition. However, we will argue using the criterion of Lemma \ref{lemma-fibred-groupoids}. By Lemma \ref{lemma-fibred-over-fibred} we see that $\mathcal{A}$ is fibred over $\mathcal{C}$. To finish the proof we show that the fibre category $\mathcal{A}_U$ is a groupoid for $U$ in $\mathcal{C}$. Namely, if $x \to y$ is a morphism of $\mathcal{A}_U$, then its image in $\mathcal{B}$ is an isomorphism as $\mathcal{B}_U$ is a groupoid. But then $x \to y$ is an isomorphism, for example by Lemma \ref{lemma-composition-cartesian} and the fact that every morphism of $\mathcal{A}$ is strongly $\mathcal{B}$-cartesian (see Lemma \ref{lemma-fibred-groupoids}).
Denote $p : \mathcal{X} \to \mathcal{C}$ and $q : \mathcal{Y} \to \mathcal{C}$ the structure functors. We construct $\mathcal{X}'$ explicitly as follows. An object of $\mathcal{X}'$ is a quadruple $(U, x, y, f)$ where $x \in \Ob(\mathcal{X}_U)$, $y \in \Ob(\mathcal{Y}_U)$ and $f : F(x) \to y$ is an isomorphism in $\mathcal{Y}_U$. A morphism $(a, b) : (U, x, y, f) \to (U', x', y', f')$ is given by $a : x \to x'$ and $b : y \to y'$ with $p(a) = q(b)$ and such that $f' \circ F(a) = b \circ f$. In other words $\mathcal{X}' = \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ with the construction of the $2$-fibre product from Lemma \ref{lemma-2-product-categories-over-C}. By Lemma \ref{lemma-2-product-fibred-categories} we see that $\mathcal{X}'$ is a category fibred in groupoids over $\mathcal{C}$ and that $\mathcal{X}' \to \mathcal{Y}$ is a morphism of categories over $\mathcal{C}$. As functor $\mathcal{X} \to \mathcal{X}'$ we take $x \mapsto (p(x), x, F(x), \text{id}_{F(x)})$ on objects and $(a : x \to x') \mapsto (a, F(a))$ on morphisms. It is clear that the composition $\mathcal{X} \to \mathcal{X}' \to \mathcal{Y}$ equals $F$. We omit the verification that $\mathcal{X} \to \mathcal{X}'$ is an equivalence of fibred categories over $\mathcal{C}$. \medskip\noindent Finally, we have to show that $\mathcal{X}' \to \mathcal{Y}$ is a category fibred in groupoids. Let $b : y' \to y$ be a morphism in $\mathcal{Y}$ and let $(U, x, y, f)$ be an object of $\mathcal{X}'$ lying over $y$. Because $\mathcal{X}$ is fibred in groupoids over $\mathcal{C}$ we can find a morphism $a : x' \to x$ lying over $U' = q(y') \to q(y) = U$. Since $\mathcal{Y}$ is fibred in groupoids over $\mathcal{C}$ and since both $F(x') \to F(x)$ and $y' \to y$ lie over the same morphism $U' \to U$ we can find $f' : F(x') \to y'$ lying over $\text{id}_{U'}$ such that $f \circ F(a) = b \circ f'$. Hence we obtain $(a, b) : (U', x', y', f') \to (U, x, y, f)$. This verifies the first condition (1) of Definition \ref{definition-fibred-groupoids}. To see (2) let $(a, b) : (U', x', y', f') \to (U, x, y, f)$ and $(a', b') : (U'', x'', y'', f'') \to (U, x, y, f)$ be morphisms of $\mathcal{X}'$ and let $b'' : y' \to y''$ be a morphism of $\mathcal{Y}$ such that $b' \circ b'' = b$. We have to show that there exists a unique morphism $a'' : x' \to x''$ such that $f'' \circ F(a'') = b'' \circ f'$ and such that $(a', b') \circ (a'', b'') = (a, b)$. Because $\mathcal{X}$ is fibred in groupoids we know there exists a unique morphism $a'' : x' \to x''$ such that $a' \circ a'' = a$ and $p(a'') = q(b'')$. Because $\mathcal{Y}$ is fibred in groupoids we see that $F(a'')$ is the unique morphism $F(x') \to F(x'')$ such that $F(a') \circ F(a'') = F(a)$ and $q(F(a'')) = q(b'')$. The relation $f'' \circ F(a'') = b'' \circ f'$ follows from this and the given relations $f \circ F(a) = b \circ f'$ and $f \circ F(a') = b' \circ f''$.
We will show that both $\mathcal{X}'$ and $\mathcal{X}''$ over $\mathcal{Y}$ are equivalent to the category fibred in groupoids $\mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ over $\mathcal{Y}$, see proof of Lemma \ref{lemma-ameliorate-morphism-categories-fibred-groupoids}. Choose a quasi-inverse $b^{-1} : \mathcal{X}'' \to \mathcal{X}$ in the $2$-category of categories over $\mathcal{C}$. Since the right triangle of the diagram is $2$-commutative we see that $$ \xymatrix{ \mathcal{X} \ar[d]_F & \mathcal{X}'' \ar[l]^{b^{-1}} \ar[d]^g \\ \mathcal{Y} & \mathcal{Y} \ar[l] } $$ is $2$-commutative. Hence we obtain a $1$-morphism $c : \mathcal{X}'' \to \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$ by the universal property of the $2$-fibre product. Moreover $c$ is a morphism of categories over $\mathcal{Y}$ (!) and an equivalence (by the assumption that $b$ is an equivalence, see Lemma \ref{lemma-equivalence-2-fibre-product}). Hence $c$ is an equivalence in the $2$-category of categories fibred in groupoids over $\mathcal{Y}$ by Lemma \ref{lemma-equivalence-fibred-categories}. \medskip\noindent We still have to construct a $2$-isomorphism between $c \circ b$ and the functor $d : \mathcal{X} \to \mathcal{X} \times_{F, \mathcal{Y}, \text{id}} \mathcal{Y}$, $x \mapsto (p(x), x, F(x), \text{id}_{F(x)})$ constructed in the proof of Lemma \ref{lemma-ameliorate-morphism-categories-fibred-groupoids}. Let $\alpha : F \to g \circ b$ and $\beta : b^{-1} \circ b \to \text{id}$ be $2$-isomorphisms between $1$-morphisms of categories over $\mathcal{C}$. Note that $c \circ b$ is given by the rule $$ x \mapsto (p(x), b^{-1}(b(x)), g(b(x)), \alpha_x \circ F(\beta_x)) $$ on objects. Then we see that $$ (\beta_x, \alpha_x) : (p(x), x, F(x), \text{id}_{F(x)}) \longrightarrow (p(x), b^{-1}(b(x)), g(b(x)), \alpha_x \circ F(\beta_x)) $$ is a functorial isomorphism which gives our $2$-morphism $d \to b \circ c$. Finally, if the diagram commutes then $\alpha_x$ is the identity for all $x$ and we see that this $2$-morphism is a $2$-morphism in the $2$-category of categories over $\mathcal{Y}$.
Let us make a choice of pullbacks (see Definition \ref{definition-pullback-functor-fibred-category}). By Lemma \ref{lemma-fibred} we get pullback functors $f^*$ for every morphism $f$ of $\mathcal{C}$. \medskip\noindent We construct a new category $\mathcal{S}'$ as follows. The objects of $\mathcal{S}'$ are pairs $(x, f)$ consisting of a morphism $f : V \to U$ of $\mathcal{C}$ and an object $x$ of $\mathcal{S}$ over $U$, i.e., $x\in \Ob(\mathcal{S}_U)$. The functor $p' : \mathcal{S}' \to \mathcal{C}$ will map the pair $(x, f)$ to the source of the morphism $f$, in other words $p'(x, f : V\to U) = V$. A morphism $\varphi : (x_1, f_1: V_1 \to U_1) \to (x_2, f_2 : V_2 \to U_2)$ is given by a pair $(\varphi, g)$ consisting of a morphism $g : V_1 \to V_2$ and a morphism $\varphi : f_1^\ast x_1 \to f_2^\ast x_2$ with $p(\varphi) = g$. It is no problem to define the composition law: $(\varphi, g) \circ (\psi, h) = (\varphi \circ \psi, g\circ h)$ for any pair of composable morphisms. There is a natural functor $\mathcal{S} \to \mathcal{S}'$ which simply maps $x$ over $U$ to the pair $(x, \text{id}_U)$. \medskip\noindent At this point we need to check that $p'$ makes $\mathcal{S}'$ into a fibred category over $\mathcal{C}$, and we need to check that $\mathcal{S} \to \mathcal{S}'$ is an equivalence of categories over $\mathcal{C}$ which maps strongly cartesian morphisms to strongly cartesian morphisms. We omit the verifications. \medskip\noindent Finally, we can define pullback functors on $\mathcal{S}'$ by setting $g^\ast(x, f) = (x, f \circ g)$ on objects if $g : V' \to V$ and $f : V \to U$. On morphisms $(\varphi, \text{id}_V) : (x_1, f_1) \to (x_2, f_2)$ between morphisms in $\mathcal{S}'_V$ we set $g^\ast(\varphi, \text{id}_V) = (g^\ast\varphi, \text{id}_{V'})$ where we use the unique identifications $g^\ast f_i^\ast x_i = (f_i \circ g)^\ast x_i$ from Lemma \ref{lemma-fibred} to think of $g^\ast\varphi$ as a morphism from $(f_1 \circ g)^\ast x_1$ to $(f_2 \circ g)^\ast x_2$. Clearly, these pullback functors $g^\ast$ have the property that $g_1^\ast \circ g_2^\ast = (g_2\circ g_1)^\ast$, in other words $\mathcal{S}'$ is split as desired.
Make a choice of pullbacks (see Definition \ref{definition-pullback-functor-fibred-category}). By Lemmas \ref{lemma-fibred} and \ref{lemma-fibred-groupoids} we get pullback functors $f^*$ for every morphism $f$ of $\mathcal{C}$. \medskip\noindent We construct a new category $\mathcal{S}'$ as follows. The objects of $\mathcal{S}'$ are pairs $(x, f)$ consisting of a morphism $f : V \to U$ of $\mathcal{C}$ and an object $x$ of $\mathcal{S}$ over $U$, i.e., $x\in \Ob(\mathcal{S}_U)$. The functor $p' : \mathcal{S}' \to \mathcal{C}$ will map the pair $(x, f)$ to the source of the morphism $f$, in other words $p'(x, f : V\to U) = V$. A morphism $\varphi : (x_1, f_1: V_1 \to U_1) \to (x_2, f_2 : V_2 \to U_2)$ is given by a pair $(\varphi, g)$ consisting of a morphism $g : V_1 \to V_2$ and a morphism $\varphi : f_1^\ast x_1 \to f_2^\ast x_2$ with $p(\varphi) = g$. It is no problem to define the composition law: $(\varphi, g) \circ (\psi, h) = (\varphi \circ \psi, g\circ h)$ for any pair of composable morphisms. There is a natural functor $\mathcal{S} \to \mathcal{S}'$ which simply maps $x$ over $U$ to the pair $(x, \text{id}_U)$. \medskip\noindent At this point we need to check that $p'$ makes $\mathcal{S}'$ into a category fibred in groupoids over $\mathcal{C}$, and we need to check that $\mathcal{S} \to \mathcal{S}'$ is an equivalence of categories over $\mathcal{C}$. We omit the verifications. \medskip\noindent Finally, we can define pullback functors on $\mathcal{S}'$ by setting $g^\ast(x, f) = (x, f \circ g)$ on objects if $g : V' \to V$ and $f : V \to U$. On morphisms $(\varphi, \text{id}_V) : (x_1, f_1) \to (x_2, f_2)$ between morphisms in $\mathcal{S}'_V$ we set $g^\ast(\varphi, \text{id}_V) = (g^\ast\varphi, \text{id}_{V'})$ where we use the unique identifications $g^\ast f_i^\ast x_i = (f_i \circ g)^\ast x_i$ from Lemma \ref{lemma-fibred-groupoids} to think of $g^\ast\varphi$ as a morphism from $(f_1 \circ g)^\ast x_1$ to $(f_2 \circ g)^\ast x_2$. Clearly, these pullback functors $g^\ast$ have the property that $g_1^\ast \circ g_2^\ast = (g_2\circ g_1)^\ast$, in other words $\mathcal{S}'$ is split as desired.
The first assertion is clear, as the only morphisms in the fibre categories are identities. \medskip\noindent Suppose that $p : \mathcal{S} \to \mathcal{C}$ is fibred in sets. Let $f : V \to U$ be a morphism in $\mathcal{C}$ and let $x \in \Ob(\mathcal{S}_U)$. Then there is exactly one choice for the object $f^\ast x$. Thus we see that $(f \circ g)^\ast x = g^\ast(f^\ast x)$ for $f, g$ as in Lemma \ref{lemma-fibred-groupoids}. It follows that we may think of the assignments $U \mapsto \Ob(\mathcal{S}_U)$ and $f \mapsto f^\ast$ as a presheaf on $\mathcal{C}$.
By Lemma \ref{lemma-2-category-fibred-sets} the target of $F$ is a category hence the assertion makes sense. The construction of Lemma \ref{lemma-setoid-fibres} part (2) assigns to $\mathcal{S}$ the category fibred in sets whose value over $U$ is the set of isomorphism classes in $\mathcal{S}_U$. Hence it is clear that it defines a functor as indicated. Let $f, g : \mathcal{S}_1 \to \mathcal{S}_2$ with $F(f) = F(g)$ be as in (1). For each object $U$ of $\mathcal{C}$ and each object $x$ of $\mathcal{S}_{1, U}$ we see that $f(x) \cong g(x)$ by assumption. As $\mathcal{S}_2$ is fibred in setoids there exists a unique isomorphism $t_x : f(x) \to g(x)$ in $\mathcal{S}_{2, U}$. Clearly the rule $x \mapsto t_x$ gives the desired $2$-isomorphism $f \to g$. We omit the proofs of (2) and (3). To see the final assertion use Lemma \ref{lemma-2-category-fibred-sets} to see that the right hand side is equal to $\Mor_{\textit{Cat}/\mathcal{C}}(F(\mathcal{S}_1), F(\mathcal{S}_2))$ and apply (1) and (2) above.
The first assertion follows immediately from Lemma \ref{lemma-setoid-fibres}. For the second, suppose that $j' : \mathcal{S} \to \mathcal{C}/X'$ is a second such pair. Choose a $1$-morphism $t' : \mathcal{C}/X' \to \mathcal{S}$ such that $j' \circ t' \cong \text{id}_{\mathcal{C}/X'}$ and $t' \circ j' \cong \text{id}_\mathcal{S}$. Then $j \circ t' : \mathcal{C}/X' \to \mathcal{C}/X$ is an equivalence. Hence it is an isomorphism, see Lemma \ref{lemma-2-category-fibred-sets}. Hence by the Yoneda Lemma \ref{lemma-yoneda} (via Example \ref{example-fibred-category-from-functor-of-points} for example) it is given by an isomorphism $X' \to X$.
By Example \ref{example-fibred-category-from-functor-of-points} we have $\mathcal{C}/X = \mathcal{S}_{h_X}$ and $\mathcal{C}/Y = \mathcal{S}_{h_Y}$. By Lemma \ref{lemma-2-category-fibred-setoids} we have $$ \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{X}, \mathcal{Y}) \Big/ 2\text{-isomorphism} = \Mor_{\textit{PSh}(\mathcal{C})}(h_X, h_Y) $$ By the Yoneda Lemma \ref{lemma-yoneda} we have $\Mor_{\textit{PSh}(\mathcal{C})}(h_X, h_Y) = \Mor_\mathcal{C}(X, Y)$.
Make a choice of pullbacks for $\mathcal{S}$ (see Definition \ref{definition-pullback-functor-fibred-category}). We define a functor $$ \mathcal{S}_U \longrightarrow \Mor_{\textit{Cat}/\mathcal{C}}(\mathcal{C}/U, \mathcal{S}) $$ as follows. Given $x \in \Ob(\mathcal{S}_U)$ the associated functor is \begin{enumerate} \item on objects: $(f : V \to U) \mapsto f^*x$, and \item on morphisms: the arrow $(g : V'/U \to V/U)$ maps to the composition $$ (f \circ g)^*x \xrightarrow{(\alpha_{g, f})_x} g^*f^*x \rightarrow f^*x $$ where $\alpha_{g, f}$ is as in Lemma \ref{lemma-fibred-groupoids}. \end{enumerate} We omit the verification that this is an inverse to the functor of the lemma.
We have already seen in Lemma \ref{lemma-2-product-fibred-categories} that the composition $$ (\mathcal{C}/U) \times_\mathcal{Y} \mathcal{X} \longrightarrow \mathcal{C}/U \longrightarrow \mathcal{C} $$ is a category fibred in groupoids. Then the lemma follows from Lemma \ref{lemma-cute-groupoids}.
Suppose the diagonal is representable, and let $U, G$ be given. Consider any $V \in \Ob(\mathcal{C})$ and any $G' : \mathcal{C}/V \to \mathcal{S}$. Note that $\mathcal{C}/U \times \mathcal{C}/V = \mathcal{C}/U \times V$ is representable. Hence the fibre product $$ \xymatrix{ (\mathcal{C}/U \times V) \times_{(\mathcal{S} \times \mathcal{S})} \mathcal{S} \ar[r] \ar[d] & \mathcal{S} \ar[d] \\ \mathcal{C}/U \times V \ar[r]^{(G, G')} & \mathcal{S} \times \mathcal{S} } $$ is representable by assumption. This means there exists $W \to U \times V$ in $\mathcal{C}$, such that $$ \xymatrix{ \mathcal{C}/W \ar[d] \ar[r] & \mathcal{S} \ar[d] \\ \mathcal{C}/U \times \mathcal{C}/V \ar[r] & \mathcal{S} \times \mathcal{S} } $$ is cartesian. This implies that $\mathcal{C}/W \cong \mathcal{C}/U \times_\mathcal{S} \mathcal{C}/V$ (see Lemma \ref{lemma-diagonal-1}) as desired. \medskip\noindent Assume (2) holds. Consider any $V \in \Ob(\mathcal{C})$ and any $(G, G') : \mathcal{C}/V \to \mathcal{S} \times \mathcal{S}$. We have to show that $\mathcal{C}/V \times_{\mathcal{S} \times \mathcal{S}} \mathcal{S}$ is representable. What we know is that $\mathcal{C}/V \times_{G, \mathcal{S}, G'} \mathcal{C}/V$ is representable, say by $a : W \to V$ in $\mathcal{C}/V$. The equivalence $$ \mathcal{C}/W \to \mathcal{C}/V \times_{G, \mathcal{S}, G'} \mathcal{C}/V $$ followed by the second projection to $\mathcal{C}/V$ gives a second morphism $a' : W \to V$. Consider $W' = W \times_{(a, a'), V \times V} V$. There exists an equivalence $$ \mathcal{C}/W' \cong \mathcal{C}/V \times_{\mathcal{S} \times \mathcal{S}} \mathcal{S} $$ namely \begin{eqnarray*} \mathcal{C}/W' & \cong & \mathcal{C}/W \times_{(\mathcal{C}/V \times \mathcal{C}/V)} \mathcal{C}/V \\ & \cong & \left(\mathcal{C}/V \times_{(G, \mathcal{S}, G')} \mathcal{C}/V\right) \times_{(\mathcal{C}/V \times \mathcal{C}/V)} \mathcal{C}/V \\ & \cong & \mathcal{C}/V \times_{(\mathcal{S} \times \mathcal{S})} \mathcal{S} \end{eqnarray*} (for the last isomorphism see Lemma \ref{lemma-diagonal-2}) which proves the lemma.
Since each $T_i \to T$ is an open immersion, we see by Sets, Lemma \ref{sets-lemma-what-is-in-it} that each $T_i$ is isomorphic to an object $V_i$ of $\Sch_{Zar}$. The covering $\{V_i \to T\}_{i \in I}$ is tautologically equivalent to $\{T_i \to T\}_{i \in I}$ (using the identity map on $I$ both ways). Moreover, $\{V_i \to T\}_{i \in I}$ is combinatorially equivalent to a covering $\{U_j \to T\}_{j \in J}$ of $T$ in the site $\Sch_{Zar}$ by Sets, Lemma \ref{sets-lemma-coverings-site}.