hcju/stacksqa huggingface dataset:
Proof of (1). By Lemma \ref{lemma-module-quotient-direct-sum} every sheaf of sets $\mathcal{F}$ is the target of a surjection whose source is a coprod $\mathcal{F}_0$ of sheaves the form $h_{U}^\#$ with $U \in \mathcal{B}$. Applying this to $\mathcal{F}_0 \times_\mathcal{F} \mathcal{F}_0$ we find that $\mathcal{F}$ is a coequalizer of a pair of maps $$ \xymatrix{ \coprod\nolimits_{j \in J} h_{V_j}^\# \ar@<1ex>[r] \ar@<-1ex>[r] & \coprod\nolimits_{i \in I} h_{U_i}^\# } $$ for some index sets $I$, $J$ and $V_j$ and $U_i$ in $\mathcal{B}$. For every finite subset $J' \subset J$ there is a finite subset $I' \subset I$ such that the coproduct over $j \in J'$ maps into the coprod over $i \in I'$ via both maps, see Sites, Lemma \ref{sites-lemma-directed-colimits-sections}. (Details omitted; hint: an infinite coproduct is the filtered colimit of the finite sub-coproducts.) Thus our sheaf is the colimit of the cokernels of these maps between finite coproducts. \medskip\noindent Proof of (2). By Lemma \ref{lemma-module-quotient-direct-sum} every module is a quotient of a direct sum of modules of the form $j_{U!}\mathcal{O}_U$ with $U \in \mathcal{B}$. Thus every module is a cokernel $$ \Coker\left( \bigoplus\nolimits_{j \in J} j_{V_j!}\mathcal{O}_{V_j} \longrightarrow \bigoplus\nolimits_{i \in I} j_{U_i!}\mathcal{O}_{U_i} \right) $$ for some index sets $I$, $J$ and $V_j$ and $U_i$ in $\mathcal{B}$. For every finite subset $J' \subset J$ there is a finite subset $I' \subset I$ such that the direct sum over $j \in J'$ maps into the direct sum over $i \in I'$, see Lemma \ref{lemma-quasi-compact-hom-from}. Thus our module is the colimit of the cokernels of these maps between finite direct sums.
Let $\mathcal{F} = \Coker(\bigoplus j_{V_j!}\mathcal{O}_{V_j} \to \bigoplus j_{U_i!}\mathcal{O}_{U_i})$ as in (\ref{equation-towards-constructible}). It suffices to show that the cokernel of a map $\varphi : j_{W!}\mathcal{O}_W \to \mathcal{F}$ with $W \in \mathcal{B}$ is another module of the same type. The map $\varphi$ corresponds to $s \in \mathcal{F}(W)$. Since $\bigoplus j_{U_i!}\mathcal{O}_{U_i} \to \mathcal{F}$ is surjective, by (\ref{item-enough}) we may choose a covering $\{W_k \to W\}_{k \in K}$ with $W_k \in \mathcal{B}$ such that $s|_{W_k}$ is the image of some section $s_k$ of $\bigoplus j_{U_i!}\mathcal{O}_{U_i})$. By (\ref{item-enough-qc}) the object $W$ is quasi-compact. By Lemma \ref{lemma-silly-quasi-compact} there is a finite subset $K' \subset K$ such that $\bigoplus_{k \in K'} j_{W_k!}\mathcal{O}_{W_k} \to j_{W!}\mathcal{O}_W$ is surjective. We conclude that $\Coker(\varphi)$ is equal to $$ \Coker\left( \bigoplus\nolimits_{k \in K'} j_{W_k!}\mathcal{O}_{W_k} \oplus \bigoplus j_{V_j!}\mathcal{O}_{V_j} \longrightarrow \bigoplus j_{U_i!}\mathcal{O}_{U_i} \right) $$ where the map $\bigoplus_{k \in K'} j_{W_k!}\mathcal{O}_{W_k} \to \bigoplus j_{U_i!}\mathcal{O}_{U_i}$ corresponds to $\sum_{k \in K'} s_k$. This finishes the proof.
Since $U_i$ is quasi-compact, we may choose finite subsets $K'_i \subset K_i$ as in Lemma \ref{lemma-silly-quasi-compact}. Then since $\bigoplus_{i = 1, \ldots, n} \bigoplus_{k \in K'_i} j_{U_{ik}!}\mathcal{O}_{U_{ik}} \to \bigoplus_{i = 1, \ldots, n} j_{U_i!}\mathcal{O}_{U_i}$ is surjective, we can find coverings $\{V_{jm} \to V_j\}_{m \in M_j}$ with $V_{jm} \in \mathcal{B}$ such that we can find a commutative diagram $$ \xymatrix{ \bigoplus_{j = 1, \ldots, m} \bigoplus_{m \in M_j} j_{V_{jm}!}\mathcal{O}_{V_{jm}} \ar[d] \ar[r] & \bigoplus_{i = 1, \ldots n} \bigoplus_{k \in K'_i} j_{U_{ik}!}\mathcal{O}_{U_{ik}} \ar[d] \\ \bigoplus_{j = 1, \ldots, m} j_{V_j!}\mathcal{O}_{V_j} \ar[r] & \bigoplus_{i = 1, \ldots, n} j_{U_i!}\mathcal{O}_{U_i} } $$ Since $V_j$ is quasi-compact, we can choose finite subsets $M'_j \subset M_j$ as in Lemma \ref{lemma-silly-quasi-compact}. Set $$ L = \left(\coprod\nolimits_{i = 1, \ldots, n} K'_i \times K'_i \right) \coprod \left(\coprod\nolimits_{j = 1, \ldots, m} M'_j\right) $$ and for $l = (k, k') \in K'_i \times K'_i \subset L$ set $W_l = U_{ik} \times_{U_i} U_{ik'}$ and for $l = m \in M'_j \subset L$ set $W_l = V_{jm}$. Since we have the exact sequences of Lemma \ref{lemma-silly-quasi-compact} for the families $\{U_{ik} \to U_i\}_{k \in K'_i}$ we conclude that we get a diagram as in the statement of the lemma (details omitted), except that it is not yet clear that $W_l \in \mathcal{B}$. However, since $W_l$ is quasi-compact for all $l \in L$ we do another application of Lemma \ref{lemma-silly-quasi-compact} and find finite families of maps $\{W_{lt} \to W_l\}_{t \in T_l}$ with $W_{lt} \in \mathcal{B}$ such that $\bigoplus j_{W_{lt}!}\mathcal{O}_{W_{lt}} \to j_{W_l!}\mathcal{O}_{W_l}$ is surjective. Then we replace $L$ by $\coprod_{l \in L} T_l$ and everything is clear.
Let $0 \to \mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3 \to 0$ be a short exact sequence of $\mathcal{O}$-modules with $\mathcal{F}_1$ and $\mathcal{F}_3$ as in (\ref{equation-towards-constructible}). Choose presentations $$ \bigoplus A_{V_j} \to \bigoplus A_{U_i} \to \mathcal{F}_1 \to 0 \quad\text{and}\quad \bigoplus A_{T_j} \to \bigoplus A_{W_i} \to \mathcal{F}_3 \to 0 $$ In this proof the direct sums are always finite, and we write $A_U = j_{U!}\mathcal{O}_U$ for $U \in \mathcal{B}$. Since $\mathcal{F}_2 \to \mathcal{F}_3$ is surjective, we can choose coverings $\{W_{ik} \to W_i\}$ with $W_{ik} \in \mathcal{B}$ such that $A_{W_{ik}} \to \mathcal{F}_3$ lifts to a map $A_{W_{ik}} \to \mathcal{F}_2$. By Lemma \ref{lemma-change-presentation-towards-constructibles} we may replace our collection $\{W_i\}$ by a finite subcollection of the collection $\{W_{ik}\}$ and assume the map $\bigoplus A_{W_i} \to \mathcal{F}_3$ lifts to a map into $\mathcal{F}_2$. Consider the kernel $$ \mathcal{K}_2 = \Ker(\bigoplus A_{U_i} \oplus \bigoplus A_{W_i} \longrightarrow \mathcal{F}_2) $$ By the snake lemma this kernel surjects onto $\mathcal{K}_3 = \Ker(\bigoplus A_{W_i} \to \mathcal{F}_3)$. Thus, arguing as above, after replacing each $T_j$ by a finite family of elements of $\mathcal{B}$ (permissible by Lemma \ref{lemma-silly-quasi-compact}) we may assume there is a map $\bigoplus A_{T_j} \to \mathcal{K}_2$ lifting the given map $\bigoplus A_{T_j} \to \mathcal{K}_3$. Then $\bigoplus A_{V_j} \oplus \bigoplus A_{T_j} \to \mathcal{K}_2$ is surjective which finishes the proof.
We will use the criterion of Homology, Lemma \ref{homology-lemma-characterize-weak-serre-subcategory}. By the results of Lemmas \ref{lemma-cokernel-map-towards-constructibles} and \ref{lemma-extension-towards-constructibles} it suffices to see that the kernel of a map $\mathcal{F} \to \mathcal{G}$ between objects of $\mathcal{A}$ is in $\mathcal{A}$. To prove this choose presentations $$ \bigoplus A_{V_j} \to \bigoplus A_{U_i} \to \mathcal{F} \to 0 \quad\text{and}\quad \bigoplus A_{T_j} \to \bigoplus A_{W_i} \to \mathcal{G} \to 0 $$ In this proof the direct sums are always finite, and we write $A_U = j_{U!}\mathcal{O}_U$ for $U \in \mathcal{B}$. Using Lemmas \ref{lemma-covering-gives-surjection} and \ref{lemma-change-presentation-towards-constructibles} and arguing as in the proof of Lemma \ref{lemma-extension-towards-constructibles} we may assume that the map $\mathcal{F} \to \mathcal{G}$ lifts to a map of presentations $$ \xymatrix{ \bigoplus A_{V_j} \ar[r] \ar[d] & \bigoplus A_{U_i} \ar[r] \ar[d] & \mathcal{F} \ar[r] \ar[d] & 0 \\ \bigoplus A_{T_j} \ar[r] & \bigoplus A_{W_i} \ar[r] & \mathcal{G} \ar[r] & 0 } $$ Then we see that $$ \Ker(\mathcal{F} \to \mathcal{G}) = \Coker\left(\bigoplus A_{V_j} \to \Ker\left( \bigoplus A_{T_j} \oplus \bigoplus A_{U_i} \to \bigoplus A_{W_i}\right)\right) $$ and the lemma follows from the assumption and Lemma \ref{lemma-cokernel-map-towards-constructibles}.
Given an abelian sheaf $\mathcal{G}$ on $\mathcal{C}'$ the underlying sheaf of sets of $f^{-1}\mathcal{G}$ is the same as $f^{-1}$ of the underlying sheaf of sets of $\mathcal{G}$, see Sites, Section \ref{sites-section-sheaves-algebraic-structures}. Hence the exactness of $f^{-1}$ for sheaves of sets (required in the definition of a morphism of topoi, see Sites, Definition \ref{sites-definition-topos}) implies the exactness of $f^{-1}$ as a functor on abelian sheaves. \medskip\noindent To see the statement on modules recall that $f^*\mathcal{F}$ is defined as the tensor product $f^{-1}\mathcal{F} \otimes_{f^{-1}\mathcal{O}', f^\sharp} \mathcal{O}$. Hence $f^*$ is a composition of functors both of which are exact.
Assume (1). Then the functor $- \otimes_\mathcal{O} \mathcal{L}$ is essentially surjective, hence there exists an $\mathcal{O}$-module $\mathcal{N}$ as in (2). If (2) holds, then the functor $- \otimes_\mathcal{O} \mathcal{N}$ is a quasi-inverse to the functor $- \otimes_\mathcal{O} \mathcal{L}$ and we see that (1) holds. \medskip\noindent Assume (1) and (2) hold. Since $- \otimes_\mathcal{O} \mathcal{L}$ is an equivalence, it is exact, and hence $\mathcal{L}$ is flat. Denote $\psi : \mathcal{L} \otimes_\mathcal{O} \mathcal{N} \to \mathcal{O}$ the given isomorphism. Let $U$ be an object of $\mathcal{C}$. We will show that the restriction $\mathcal{L}$ to the members of a covering of $U$ is a direct summand of a free module, which will certainly imply that $\mathcal{L}$ is of finite presentation. By construction of $\otimes$ we may assume (after replacing $U$ by the members of a covering) that there exists an integer $n \geq 1$ and sections $x_i \in \mathcal{L}(U)$, $y_i \in \mathcal{N}(U)$ such that $\psi(\sum x_i \otimes y_i) = 1$. Consider the isomorphisms $$ \mathcal{L}|_U \to \mathcal{L}|_U \otimes_{\mathcal{O}_U} \mathcal{L}|_U \otimes_{\mathcal{O}_U} \mathcal{N}|_U \to \mathcal{L}|_U $$ where the first arrow sends $x$ to $\sum x_i \otimes x \otimes y_i$ and the second arrow sends $x \otimes x' \otimes y$ to $\psi(x' \otimes y)x$. We conclude that $x \mapsto \sum \psi(x \otimes y_i)x_i$ is an automorphism of $\mathcal{L}|_U$. This automorphism factors as $$ \mathcal{L}|_U \to \mathcal{O}_U^{\oplus n} \to \mathcal{L}|_U $$ where the first arrow is given by $x \mapsto (\psi(x \otimes y_1), \ldots, \psi(x \otimes y_n))$ and the second arrow by $(a_1, \ldots, a_n) \mapsto \sum a_i x_i$. In this way we conclude that $\mathcal{L}|_U$ is a direct summand of a finite free $\mathcal{O}_U$-module. \medskip\noindent Assume (1) and (2) hold. Consider the evaluation map $$ \mathcal{L} \otimes_\mathcal{O} \SheafHom_\mathcal{O}(\mathcal{L}, \mathcal{O}_X) \longrightarrow \mathcal{O}_X $$ To finish the proof of the lemma we will show this is an isomorphism. By Lemma \ref{lemma-internal-hom-adjoint-tensor} we have $$ \Hom_\mathcal{O}(\mathcal{O}, \mathcal{O}) = \Hom_\mathcal{O} (\mathcal{N} \otimes_\mathcal{O} \mathcal{L}, \mathcal{O}) \longrightarrow \Hom_\mathcal{O} (\mathcal{N}, \SheafHom_\mathcal{O}(\mathcal{L}, \mathcal{O})) $$ The image of $1$ gives a morphism $\mathcal{N} \to \SheafHom_\mathcal{O}(\mathcal{L}, \mathcal{O})$. Tensoring with $\mathcal{L}$ we obtain $$ \mathcal{O} = \mathcal{L} \otimes_\mathcal{O} \mathcal{N} \longrightarrow \mathcal{L} \otimes_\mathcal{O} \SheafHom_\mathcal{O}(\mathcal{L}, \mathcal{O}) $$ This map is the inverse to the evaluation map; computation omitted.
By Lemma \ref{lemma-invertible} there exists an $\mathcal{O}_\mathcal{D}$-module $\mathcal{N}$ such that $\mathcal{L} \otimes_{\mathcal{O}_\mathcal{D}} \mathcal{N} \cong \mathcal{O}_\mathcal{D}$. Pulling back we get $f^*\mathcal{L} \otimes_{\mathcal{O}_\mathcal{C}} f^*\mathcal{N} \cong \mathcal{O}_\mathcal{C}$ by Lemma \ref{lemma-tensor-product-pullback}. Thus $f^*\mathcal{L}$ is invertible by Lemma \ref{lemma-invertible}.
Consider the map (\ref{equation-define-module-differentials}). There is a similar map of presheaves whose value on $U \in \Ob(\mathcal{C})$ is $$ \mathcal{O}_2(U)[\mathcal{O}_2(U) \times \mathcal{O}_2(U)] \oplus \mathcal{O}_2(U)[\mathcal{O}_2(U) \times \mathcal{O}_2(U)] \oplus \mathcal{O}_2(U)[\mathcal{O}_1(U)] \longrightarrow \mathcal{O}_2(U)[\mathcal{O}_2(U)] $$ The cokernel of this map has value $\Omega_{\mathcal{O}_2(U)/\mathcal{O}_1(U)}$ over $U$ by the construction of the module of differentials in  Algebra, Definition \ref{algebra-definition-differentials}. On the other hand, the sheaves in (\ref{equation-define-module-differentials}) are the sheafifications of the presheaves above. Thus the result follows as sheafification is exact.
For a local section $f$ of $\mathcal{I}$ denote $\overline{f}$ the image of $f$ in $\mathcal{I}/\mathcal{I}^2$. To show that the map $\overline{f} \mapsto \text{d}f \otimes 1$ is well defined we just have to check that $\text{d} f_1f_2 \otimes 1 = 0$ if $f_1, f_2$ are local sections of $\mathcal{I}$. And this is clear from the Leibniz rule $\text{d} f_1f_2 \otimes 1 = (f_1 \text{d}f_2 + f_2 \text{d} f_1 )\otimes 1 = \text{d}f_2 \otimes f_1 + \text{d}f_2 \otimes f_1 = 0$. A similar computation show this map is $\mathcal{O}'_2 = \mathcal{O}_2/\mathcal{I}$-linear. The map on the right is the one from Lemma \ref{lemma-functoriality-differentials}. \medskip\noindent To see that the sequence is exact, we argue as follows. Let $\mathcal{O}''_2 \subset \mathcal{O}'_2$ be the presheaf of $\mathcal{O}_1$-algebras whose value on $U$ is the image of $\mathcal{O}_2(U) \to \mathcal{O}'_2(U)$. By Algebra, Lemma \ref{algebra-lemma-differential-seq} the sequences $$ \mathcal{I}(U)/\mathcal{I}(U)^2 \longrightarrow \Omega_{\mathcal{O}_2(U)/\mathcal{O}_1(U)} \otimes_{\mathcal{O}_2(U)} \mathcal{O}''_2(U) \longrightarrow \Omega_{\mathcal{O}''_2(U)/\mathcal{O}_1(U)} \longrightarrow 0 $$ are exact for all objects $U$ of $\mathcal{C}$. Since sheafification is exact this gives an exact sequence of sheaves of $(\mathcal{O}'_2)^\#$-modules. By Lemma \ref{lemma-differentials-sheafify} and the fact that $(\mathcal{O}''_2)^\# = \mathcal{O}'_2$ we conclude.
By Sites, Lemma \ref{sites-lemma-point-pushforward-sheaf} we have (1). By Sites, Lemmas \ref{sites-lemma-adjoint-point-push-stalk} we see that $\textit{PSh}(\mathcal{C}) \to \textit{Sets}$, $\mathcal{F} \mapsto \mathcal{F}_p$ is a left adjoint, and by Sites, Lemma \ref{sites-lemma-point-pushforward-sheaf} we see the same thing for $\textit{Sh}(\mathcal{C}) \to \textit{Sets}$, $\mathcal{F} \mapsto \mathcal{F}_p$. Hence the stalk functor commutes with arbitrary colimits (see Categories, Lemma \ref{categories-lemma-adjoint-exact}). It follows from the definition of a point of a site, see Sites, Definition \ref{sites-definition-point} that $\Sh(\mathcal{C}) \to \textit{Sets}$, $\mathcal{F} \mapsto \mathcal{F}_p$ is exact. Since sheafification is exact (Sites, Lemma \ref{sites-lemma-sheafification-exact}) it follows that $\textit{PSh}(\mathcal{C}) \to \textit{Sets}$, $\mathcal{F} \mapsto \mathcal{F}_p$ is exact.
We have $$ f^*\mathcal{F} = f^{-1}\mathcal{F} \otimes_{f^{-1}\mathcal{O}_\mathcal{D}} \mathcal{O}_\mathcal{C} $$ by definition. Since taking stalks at $p$ (i.e., applying $p^{-1}$) commutes with $\otimes$ by Lemma \ref{lemma-tensor-product-pullback} we win by the relation between the stalk of pullbacks at $p$ and stalks at $q$ explained in Sites, Lemma \ref{sites-lemma-point-morphism-sites} or Sites, Lemma \ref{sites-lemma-point-morphism-topoi}.
By Sites, Lemma \ref{sites-lemma-stalk-skyscraper} there are functorial maps $A \to p^{-1}p_*A \to A$ whose composition equals $\text{id}_A$. Hence a functorial direct sum decomposition as in (2) with $I(A)$ the kernel of the adjunction map $p^{-1}p_*A \to A$. The functor $p_*$ is left exact by Lemma \ref{lemma-exactness-pushforward-pullback}. The functor $p_*$ transforms surjections into surjections by Sites, Lemma \ref{sites-lemma-skyscraper-functor-exact}. Hence (1) holds.
Part (1) and surjectivity in (2) follow immediately from the corresponding result for abelian sheaves in Lemma \ref{lemma-skyscraper-exact}. Since $p^{-1}\mathcal{O} = \mathcal{O}_p$ we have $p^{-1} = p^*$ and hence $p^{-1}p_*M \to M$ is the same as the counit $p^*p_*M \to M$ of the adjunction for modules, whence linear. \medskip\noindent Proof of (3). Suppose that $G$ is a group. Consider the topos $G\textit{-Sets} = \Sh(\mathcal{T}_G)$ and the point $p : \textit{Sets} \to G\textit{-Sets}$. See Sites, Section \ref{sites-section-example-sheaf-G-sets} and Example \ref{sites-example-point-G-sets}. Here $p^{-1}$ is the functor forgetting about the $G$-action. And $p_*$ is the right adjoint of the forgetful functor, sending $M$ to $\text{Map}(G, M)$. The maps in the direct sum decomposition are the maps $$ M \to \text{Map}(G, M) \to M $$ where the first sends $m \in M$ to the constant map with value $m$ and where the second map is evaluation at the identity element $1$ of $G$. Next, suppose that $R$ is a ring endowed with an action of $G$. This determines a sheaf of rings $\mathcal{O}$ on $\mathcal{T}_G$. The category of $\mathcal{O}$-modules is the category of $R$-modules $M$ endowed with an action of $G$ compatible with the action on $R$. The $R$-module structure on $\text{Map}(G, M)$ is given by $$ ( r f ) (\sigma) = \sigma(r) f(\sigma) $$ for $r \in R$ and $f \in \text{Map}(G, M)$. This is true because it is the unique $G$-invariant $R$-module strucure compatible with evaluation at $1$. The reader observes that in general the image of $M \to \text{Map}(G, M)$ is not an $R$-submodule (for example take $M = R$ and assume the $G$-action is nontrivial), which concludes the proof.
We use the description of $j_{U!}\mathcal{G}$ as the sheaf associated to the presheaf $V \mapsto \bigoplus\nolimits_{\varphi \in \Mor_\mathcal{C}(V, U)} \mathcal{G}(V/_\varphi U)$ of Lemma \ref{lemma-extension-by-zero}. The stalk of $j_{U!}\mathcal{G}$ at $p$ is equal to the stalk of this presheaf, see Lemma \ref{lemma-stalk-exact-modules}. Let $u : \mathcal{C} \to \textit{Sets}$ be the functor corresponding to $p$ (see Sites, Section \ref{sites-section-points}). Hence we see that $$ (j_{U!}\mathcal{G})_p = \colim_{(V, y)} \bigoplus\nolimits_{\varphi : V \to U} \mathcal{G}(V/_\varphi U) $$ where the colimit is taken in the category of abelian groups. To a quadruple $(V, y, \varphi, s)$ occurring in this colimit, we can assign $x = u(\varphi)(y) \in u(U)$. Hence we obtain $$ (j_{U!}\mathcal{G})_p = \bigoplus\nolimits_{x \in u(U)} \colim_{(\varphi : V \to U, y), \ u(\varphi)(y) = x} \mathcal{G}(V/_\varphi U). $$ This is equal to the expression of the lemma by the description of the points $q$ lying over $x$ in Sites, Lemma \ref{sites-lemma-points-above-point}.
In Section \ref{section-skyscraper} we have seen that we can think of $p$ as a morphism of ringed topoi $$ (p, \text{id}_{\mathcal{O}_p}) : (\Sh(pt), \mathcal{O}_p) \longrightarrow (\Sh(\mathcal{C}), \mathcal{O}). $$ such that the pullback functor $p^* : \textit{Mod}(\mathcal{O}) \to \textit{Mod}(\mathcal{O}_p)$ equals the stalk functor. Thus the lemma follows from Lemma \ref{lemma-pullback-flat}.
By Lemma \ref{lemma-stalk-flat} we see one of the implications. For the converse, use that $(\mathcal{F} \otimes_\mathcal{O} \mathcal{G})_p = \mathcal{F}_p \otimes_{\mathcal{O}_p} \mathcal{G}_p$ by Lemma \ref{lemma-tensor-product-pullback} (as taking stalks at $p$ is given by $p^{-1}$) and Lemma \ref{lemma-check-exactness-stalks}.
Since $f^{-1}$ is exact we have the short exact sequence $0 \to f^{-1}\mathcal{F} \to f^{-1}\mathcal{G} \to f^{-1}\mathcal{H} \to 0$ of $f^{-1}\mathcal{O}$-modules. By Lemma \ref{lemma-pullback-flat} the $f^{-1}\mathcal{O}$-module $f^{-1}\mathcal{H}$ is flat. By Lemma \ref{lemma-flat-tor-zero} this implies that tensoring the sequence over $f^{-1}\mathcal{O}$ with $\mathcal{O}'$ the sequence remains exact. Since $f^*\mathcal{F} = f^{-1}\mathcal{F} \otimes_{f^{-1}\mathcal{O}} \mathcal{O}'$ and similarly for $\mathcal{G}$ and $\mathcal{H}$ we conclude.
Assume (1). Let $p$ be a point of $\mathcal{C}$ given by a functor $u : \mathcal{C} \to \textit{Sets}$. Let $f_p \in \mathcal{O}_p$. Since $\mathcal{O}_p$ is computed by Sites, Equation (\ref{sites-equation-stalk}) we may represent $f_p$ by a triple $(U, x, f)$ where $x \in U(U)$ and $f \in \mathcal{O}(U)$. By assumption there exists a covering $\{U_i \to U\}$ such that for each $i$ either $f$ or $1 - f$ is invertible on $U_i$. Because $u$ defines a point of the site we see that for some $i$ there exists an $x_i \in u(U_i)$ which maps to $x \in u(U)$. By the discussion surrounding Sites, Equation (\ref{sites-equation-stalk}) we see that $(U, x, f)$ and $(U_i, x_i, f|_{U_i})$ define the same element of $\mathcal{O}_p$. Hence we conclude that either $f_p$ or $1 - f_p$ is invertible. Thus $\mathcal{O}_p$ is a ring such that for every element $a$ either $a$ or $1 - a$ is invertible. This means that $\mathcal{O}_p$ is either zero or a local ring, see Algebra, Lemma \ref{algebra-lemma-characterize-local-ring}. \medskip\noindent Assume (2) and assume that $\mathcal{C}$ has enough points. Consider the map of sheaves of sets $$ \mathcal{O} \times \mathcal{O} \amalg \mathcal{O} \times \mathcal{O} \longrightarrow \mathcal{O} \times \mathcal{O} $$ of Lemma \ref{lemma-locally-ringed} part (3). For any local ring $R$ the corresponding map $(R \times R) \amalg (R \times R) \to R \times R$ is surjective, see for example Algebra, Lemma \ref{algebra-lemma-characterize-local-ring}. Since each $\mathcal{O}_p$ is a local ring or zero the map is surjective on stalks. Hence, by our assumption that $\mathcal{C}$ has enough points it is surjective and we win.
It is clear that (2) follows from (1). To prove (1) note that as $f^{-1}$ is exact we have $f^{-1}* = *$, $f^{-1}\emptyset^\# = \emptyset^\#$, and $f^{-1}$ commutes with products, equalizers and transforms isomorphisms and surjections into isomorphisms and surjections. Thus $f^{-1}$ transforms the isomorphism (\ref{equation-one-is-never-zero}) into its analogue for $f^{-1}\mathcal{O}$ and transforms the surjection of Lemma \ref{lemma-locally-ringed} part (3) into the corresponding surjection for $f^{-1}\mathcal{O}$.
Assume $\mathcal{L}$ is locally free of rank $1$ and consider the evaluation map $$ \mathcal{L} \otimes_\mathcal{O} \SheafHom_\mathcal{O}(\mathcal{L}, \mathcal{O}) \longrightarrow \mathcal{O} $$ Given any object $U$ of $\mathcal{C}$ and restricting to the members of a covering trivializing $\mathcal{L}$, we see that this map is an isomorphism (details omitted). Hence $\mathcal{L}$ is invertible by Lemma \ref{lemma-invertible}. \medskip\noindent Assume $(\Sh(\mathcal{C}), \mathcal{O})$ is locally ringed. Let $U$ be an object of $\mathcal{C}$. In the proof of Lemma \ref{lemma-invertible} we have seen that there exists a covering $\{U_i \to U\}$ such that $\mathcal{L}|_{\mathcal{C}/U_i}$ is a direct summand of a finite free $\mathcal{O}_{U_i}$-module. After replacing $U$ by $U_i$, let $p : \mathcal{O}_U^{\oplus r} \to \mathcal{O}_U^{\oplus r}$ be a projector whose image is isomorphic to $\mathcal{L}|_{\mathcal{C}/U}$. Then $p$ corresponds to a matrix $$ P = (p_{ij}) \in \text{Mat}(r \times r, \mathcal{O}(U)) $$ which is a projector: $P^2  = P$. Set $A = \mathcal{O}(U)$ so that $P \in \text{Mat}(r \times r, A)$. By Algebra, Lemma \ref{algebra-lemma-finite-projective} the image of $P$ is a finite locally free module $M$ over $A$. Hence there are $f_1, \ldots, f_t \in A$ generating the unit ideal, such that $M_{f_i}$ is finite free. By Lemma \ref{lemma-locally-ringed} after replacing $U$ by the members of an open covering, we may assume that $M$ is free. This means that $\mathcal{L}|_U$ is free (details omitted). Of course, since $\mathcal{L}$ is invertible, this is only possible if the rank of $\mathcal{L}|_U$ is $1$ and the proof is complete.
Note that the diagram $$ \xymatrix{ \mathcal{O}^* \ar[rr] \ar[d]_{u \mapsto (u, u^{-1})} & & {*} \ar[d]^{1} \\ \mathcal{O} \times \mathcal{O} \ar[rr]^-{(a, b) \mapsto ab} & & \mathcal{O} } $$ is cartesian. Since $f^{-1}$ is exact we conclude that $$ \xymatrix{ f^{-1}(\mathcal{O}^*) \ar[d]_{u \mapsto (u, u^{-1})} \ar[rr] & & {*} \ar[d]^{1} \\ f^{-1}\mathcal{O} \times f^{-1}\mathcal{O} \ar[rr]^-{(a, b) \mapsto ab} & & f^{-1}\mathcal{O} } $$ is cartesian which implies the first assertion. For the second, note that $(\mathcal{C}', f^{-1}\mathcal{O})$ is a locally ringed site by Lemma \ref{lemma-locally-ringed-intrinsic} so that the assertion makes sense. Now the first part implies that the morphism is a morphism of locally ringed topoi.