hcju/stacksqa huggingface dataset:
We first prove that the tensor product of locally free $\mathcal{O}_X$-modules is locally free. This follows if we show that $(\bigoplus_{i \in I} \mathcal{O}_X) \otimes_{\mathcal{O}_X} (\bigoplus_{j \in J} \mathcal{O}_X) \cong \bigoplus_{(i, j) \in I \times J} \mathcal{O}_X$. The sheaf $\bigoplus_{i \in I} \mathcal{O}_X$ is the sheaf associated to the presheaf $U \mapsto \bigoplus_{i \in I} \mathcal{O}_X(U)$. Hence the tensor product is the sheaf associated to the presheaf $$ U \longmapsto (\bigoplus\nolimits_{i \in I} \mathcal{O}_X(U)) \otimes_{\mathcal{O}_X(U)} (\bigoplus\nolimits_{j \in J} \mathcal{O}_X(U)). $$ We deduce what we want since for any ring $R$ we have $(\bigoplus_{i \in I} R) \otimes_R (\bigoplus_{j \in J} R) = \bigoplus_{(i, j) \in I \times J} R$. \medskip\noindent If $\mathcal{F}_2 \to \mathcal{F}_1 \to \mathcal{F} \to 0$ is exact, then by Lemma \ref{lemma-tensor-product-exact} the complex $\mathcal{F}_2 \otimes \mathcal{G} \to \mathcal{F}_1 \otimes \mathcal{G} \to \mathcal{F} \otimes \mathcal{G} \to 0$ is exact. Using this we can prove (5). Namely, in this case there exists locally such an exact sequence with $\mathcal{F}_i$, $i = 1, 2$ finite free. Hence the two terms $\mathcal{F}_2 \otimes \mathcal{G}$ are isomorphic to finite direct sums of $\mathcal{G}$. Since finite direct sums are coherent sheaves, these are coherent and so is the cokernel of the map, see Lemma \ref{lemma-coherent-abelian}. \medskip\noindent And if also $\mathcal{G}_2 \to \mathcal{G}_1 \to \mathcal{G} \to 0$ is exact, then we see that $$ \mathcal{F}_2 \otimes_{\mathcal{O}_X} \mathcal{G}_1 \oplus \mathcal{F}_1 \otimes_{\mathcal{O}_X} \mathcal{G}_2 \to \mathcal{F}_1 \otimes_{\mathcal{O}_X} \mathcal{G}_1 \to \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{G} \to 0 $$ is exact. Using this we can for example prove (3). Namely, the assumption means that we can locally find presentations as above with $\mathcal{F}_i$ and $\mathcal{G}_i$ free $\mathcal{O}_X$-modules. Hence the displayed presentation is a presentation of the tensor product by free sheaves as well. \medskip\noindent The proof of the other statements is omitted.
Let $I$ be a preordered set and let $\{\mathcal{G}_i\}$ be a system over $I$. Set $\mathcal{G} = \colim_i \mathcal{G}_i$. Recall that $\mathcal{G}$ is the sheaf associated to the presheaf $\mathcal{G}' : U \mapsto \colim_i \mathcal{G}_i(U)$, see Sheaves, Section \ref{sheaves-section-limits-sheaves}. By Lemma \ref{lemma-tensor-product-sheafification} the tensor product $\mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{G}$ is the sheafification of the presheaf $$ U \longmapsto \mathcal{F}(U) \otimes_{\mathcal{O}_X(U)} \colim_i \mathcal{G}_i(U) = \colim_i \mathcal{F}(U) \otimes_{\mathcal{O}_X(U)} \mathcal{G}_i(U) $$ where the equality sign is Algebra, Lemma \ref{algebra-lemma-tensor-products-commute-with-limits}. Hence the lemma follows from the description of colimits in $\textit{Mod}(\mathcal{O}_X)$.
Assume $\mathcal{F}_x$ is a flat $\mathcal{O}_{X, x}$-module for all $x \in X$. In this case, if $\mathcal{G} \to \mathcal{H} \to \mathcal{K}$ is exact, then also $\mathcal{G} \otimes_{\mathcal{O}_X} \mathcal{F} \to \mathcal{H} \otimes_{\mathcal{O}_X} \mathcal{F} \to \mathcal{K} \otimes_{\mathcal{O}_X} \mathcal{F}$ is exact because we can check exactness at stalks and because tensor product commutes with taking stalks, see Lemma \ref{lemma-stalk-tensor-product}. Conversely, suppose that $\mathcal{F}$ is flat, and let $x \in X$. Consider the skyscraper sheaves $i_{x, *} M$ where $M$ is a $\mathcal{O}_{X, x}$-module. Note that $$ M \otimes_{\mathcal{O}_{X, x}} \mathcal{F}_x = \left(i_{x, *} M \otimes_{\mathcal{O}_X} \mathcal{F}\right)_x $$ again by Lemma \ref{lemma-stalk-tensor-product}. Since $i_{x, *}$ is exact, we see that the fact that $\mathcal{F}$ is flat implies that $M \mapsto M \otimes_{\mathcal{O}_{X, x}} \mathcal{F}_x$ is exact. Hence $\mathcal{F}_x$ is a flat $\mathcal{O}_{X, x}$-module.
Let $\mathcal{F}$ be an $\mathcal{O}_X$-module. For every open $U \subset X$ and every $s \in \mathcal{F}(U)$ we get a morphism $j_{U!}\mathcal{O}_U \to \mathcal{F}$, namely the adjoint to the morphism $\mathcal{O}_U \to \mathcal{F}|_U$, $1 \mapsto s$. Clearly the map $$ \bigoplus\nolimits_{(U, s)} j_{U!}\mathcal{O}_U \longrightarrow \mathcal{F} $$ is surjective, and the source is flat by combining Lemmas \ref{lemma-colimits-flat} and \ref{lemma-j-shriek-flat}.
Let $\mathcal{I} \subset \mathcal{O}_U$ be the sheaf of ideals generated by $f_1, \ldots, f_n$. Then $\sum f_i \otimes s_i$ is a section of $\mathcal{I} \otimes_{\mathcal{O}_U} \mathcal{F}|_U$ which maps to zero in $\mathcal{F}|_U$. As $\mathcal{F}|_U$ is flat the map $\mathcal{I} \otimes_{\mathcal{O}_U} \mathcal{F}|_U \to \mathcal{F}|_U$ is injective. Since $\mathcal{I} \otimes_{\mathcal{O}_U} \mathcal{F}|_U$ is the sheaf associated to the presheaf tensor product, we see there exists an open neighbourhood $V \subset U$ of $x$ such that $\sum f_i|_V \otimes s_i|_V$ is zero in $\mathcal{I}(V) \otimes_{\mathcal{O}(V)} \mathcal{F}(V)$. Unwinding the definitions using Algebra, Lemma \ref{algebra-lemma-relations} we find $t_1, \ldots, t_m \in \mathcal{F}(V)$ and $a_{ij} \in \mathcal{O}(V)$ such that $\sum a_{ij}f_i|_V = 0$ and $s_i|_V = \sum a_{ij}t_j$.
The assumptions mean that $$ \mathcal{F} \xrightarrow{\eta \otimes 1} \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{G} \otimes_{\mathcal{O}_X} \mathcal{F} \xrightarrow{1 \otimes \epsilon} \mathcal{F} \quad\text{and}\quad \mathcal{G} \xrightarrow{1 \otimes \eta} \mathcal{G} \otimes_{\mathcal{O}_X} \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{G} \xrightarrow{\epsilon \otimes 1} \mathcal{G} $$ are the identity map. Let $x \in X$. We can find an open neighbourhood $U$ of $x$, a finite number of sections $f_1, \ldots, f_n$ and $g_1, \ldots, g_n$ of $\mathcal{F}$ and $\mathcal{G}$ over $U$ such that $\eta(1) = \sum f_i g_i$. Denote $$ \mathcal{O}_U^{\oplus n} \to \mathcal{F}|_U $$ the map sending the $i$th basis vector to $f_i$. Then we can factor the map $\eta|_U$ over a map $\tilde \eta : \mathcal{O}_U \to \mathcal{O}_U^{\oplus n} \otimes_{\mathcal{O}_U} \mathcal{G}|_U$. We obtain a commutative diagram $$ \xymatrix{ \mathcal{F}|_U \ar[rr]_-{\eta \otimes 1} \ar[rrd]_-{\tilde \eta \otimes 1} & & \mathcal{F}|_U \otimes \mathcal{G}|_U \otimes \mathcal{F}|_U \ar[r]_-{1 \otimes \epsilon} & \mathcal{F}|_U \\ & & \mathcal{O}_U^{\oplus n} \otimes \mathcal{G}|_U \otimes \mathcal{F}|_U \ar[u] \ar[r]^-{1 \otimes \epsilon} & \mathcal{O}_U^{\oplus n} \ar[u] } $$ This shows that the identity on $\mathcal{F}$ locally on $X$ factors through a finite free module. This proves (1). Part (2) follows from Categories, Lemma \ref{categories-lemma-left-dual} and its proof. Part (3) follows from the first equality of the proof. You can also deduce (2) and (3) from the uniqueness of left duals (Categories, Remark \ref{categories-remark-left-dual-adjoint}) and the construction of the left dual in Example \ref{example-dual}.
After replacing $X$ by the members of an open covering, we may assume there exists a presentation $$ \mathcal{O}_X^{\oplus r} \to \mathcal{O}_X^{\oplus n} \to \mathcal{F} \to 0 $$ Let $x \in X$. By Lemma \ref{lemma-flat-eq} we can, after shrinking $X$ to an open neighbourhood of $x$, assume there exists a factorization $$ \mathcal{O}_X^{\oplus n} \to \mathcal{O}_X^{\oplus n_1} \to \mathcal{F} $$ such that the composition $\mathcal{O}_X^{\oplus r} \to \mathcal{O}_X^{\oplus n} \to \mathcal{O}_X^{\oplus n_1}$ annihilates the first summand of $\mathcal{O}_X^{\oplus r}$. Repeating this argument $r - 1$ more times we obtain a factorization $$ \mathcal{O}_X^{\oplus n} \to \mathcal{O}_X^{\oplus n_r} \to \mathcal{F} $$ such that the composition $\mathcal{O}_X^{\oplus r} \to \mathcal{O}_X^{\oplus n} \to \mathcal{O}_X^{\oplus n_r}$ is zero. This means that the surjection $\mathcal{O}_X^{\oplus n_r} \to \mathcal{F}$ has a section and we win.
Let $S$ be a singleton set. We will prove the result with $S_i = S$. For every $x \in X$ and element $s \in \mathcal{F}_x$ we can choose a $U(x, s) \in \mathcal{B}$ and $s(x, s) \in \mathcal{F}(U(x, s))$ which maps to $s$ in $\mathcal{F}_x$. By Sheaves, Lemma \ref{sheaves-lemma-j-shriek} the section $s(x, s)$ corresponds to a map of sheaves $j_{U(x, s)!}\underline{S} \to \mathcal{F}$. Then $$ \coprod\nolimits_{(x, s)} j_{U(x, s)!}\underline{S} \to \mathcal{F} $$ is surjective on stalks and hence surjective.
By Lemma \ref{lemma-surjection} every sheaf of sets $\mathcal{F}$ is the target of a surjection whose source $\mathcal{F}_0$ is a coproduct of sheaves the form $j_{U!}\underline{S}$ with $U \in \mathcal{B}$ and $S$ finite. 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_{b \in B} j_{V_b!}\underline{S_b} \ar@<1ex>[r] \ar@<-1ex>[r] & \coprod\nolimits_{a \in A} j_{U_a!}\underline{S_a} } $$ for some index sets $A$, $B$ and $V_b$ and $U_a$ in $\mathcal{B}$ and $S_a$ and $S_b$ finite. For every finite subset $B' \subset B$ there is a finite subset $A' \subset A$ such that the coproduct over $b \in B'$ maps into the coproduct over $a \in A'$ via both maps. Namely, we can view the right hand side as a filtered colimit with injective transition maps. Hence taking sections over the quasi-compact opens $V_b$, $b \in B'$ commutes with this coproduct, see Sheaves, Lemma \ref{sheaves-lemma-directed-colimits-sections}. Thus our sheaf is the colimit of the cokernels of these maps between finite coproducts.
We can write $X = \lim X_i$ as a directed limit of finite sober spaces, see Topology, Lemma \ref{topology-lemma-spectral-inverse-limit-finite-sober-spaces}. Of course the transition maps $X_{i'} \to X_i$ are spectral and hence by Topology, Lemma \ref{topology-lemma-directed-inverse-limit-spectral-spaces} the maps $p_i : X \to X_i$ are spectral. For some $i$ we can find opens $U_{a, i}$ and $V_{b, i}$ of $X_i$ whose inverse images are $U_a$ and $V_b$, see Topology, Lemma \ref{topology-lemma-descend-opens}. The two maps $$ \beta, \gamma : \coprod\nolimits_{b \in B} j_{V_b!}\underline{S_b} \longrightarrow \coprod\nolimits_{a \in A} j_{U_a!}\underline{S_a} $$ whose coequalizer is $\mathcal{F}$ correspond by adjunction to two families $$ \beta_b, \gamma_b : S_b \longrightarrow \Gamma(V_b, \coprod\nolimits_{a \in A} j_{U_a!}\underline{S_a}), \quad b \in B $$ of maps of sets. Observe that $p_i^{-1}(j_{U_{a, i}!}\underline{S_a}) = j_{U_a!}\underline{S_a}$ and $(X_{i'} \to X_i)^{-1}(j_{U_{a, i}!}\underline{S_a}) = j_{U_{a, i'}!}\underline{S_a}$. It follows from Sheaves, Lemma \ref{sheaves-lemma-compute-pullback-to-limit} (and using that $S_b$ and $B$ are finite sets) that after increasing $i$ we find maps $$ \beta_{b, i}, \gamma_{b, i} : S_b \longrightarrow \Gamma(V_{b, i}, \coprod\nolimits_{a \in A} j_{U_{a, i}!}\underline{S_a}) , \quad b \in B $$ which give rise to the maps $\beta_b$ and $\gamma_b$ after pulling back by $p_i$. These maps correspond in turn to maps of sheaves $$ \beta_i, \gamma_i : \coprod\nolimits_{b \in B} j_{V_{b, i}!}\underline{S_b} \longrightarrow \coprod\nolimits_{a \in A} j_{U_{a, i}!}\underline{S_a} $$ on $X_i$. Then we can take $Y = X_i$ and $$ \mathcal{G} = \text{Coequalizer}\left( \xymatrix{ \coprod\nolimits_{b = 1, \ldots, m} j_{V_{b, i}!}\underline{S_b} \ar@<1ex>[r] \ar@<-1ex>[r] & \coprod\nolimits_{a = 1, \ldots, n} j_{U_{a, i}!}\underline{S_a} } \right) $$ We omit some details.
By Lemma \ref{lemma-constructible-comes-from-finite} we reduce to the case of a finite sober topological space and a sheaf with finite stalks. In this case $\mathcal{F} \subset \prod_{x \in X} i_{x, *}\mathcal{F}_x$ where $i_x : \{x\} \to X$ is the embedding. We omit the proof that $i_{x, *}\mathcal{F}_x$ is a constant sheaf on $\overline{\{x\}}$.
The functor $f^*$ is the composition of the exact functor $f^{-1} : \textit{Mod}(\mathcal{O}_Y) \to \textit{Mod}(f^{-1}\mathcal{O}_Y)$ and the change of rings functor $$ \textit{Mod}(f^{-1}\mathcal{O}_Y) \to \textit{Mod}(\mathcal{O}_X), \quad \mathcal{F} \longmapsto \mathcal{F} \otimes_{f^{-1}\mathcal{O}_Y} \mathcal{O}_X. $$ Thus the result follows from the discussion following Definition \ref{definition-flat-morphism}.
These statements for $\text{T}^n(\mathcal{F})$ follow from Lemma \ref{lemma-tensor-product-permanence}. \medskip\noindent Statements (1) and (2) follow from the fact that $\wedge^n(\mathcal{F})$ and $\text{Sym}^n(\mathcal{F})$ are quotients of $\text{T}^n(\mathcal{F})$. \medskip\noindent Statement (6) follows from Algebra, Lemma \ref{algebra-lemma-free-tensor-algebra}. \medskip\noindent For (3) and (5) we will use Lemma \ref{lemma-presentation-sym-exterior} above. By locally choosing a presentation $\mathcal{F}_2 \to \mathcal{F}_1 \to \mathcal{F} \to 0$ with $\mathcal{F}_i$ free, or finite free and applying the lemma we see that $\text{Sym}^n(\mathcal{F})$, $\wedge^n(\mathcal{F})$ has a similar presentation; here we use (6) and Lemma \ref{lemma-tensor-product-permanence}. \medskip\noindent To prove (4) we will use Algebra, Lemma \ref{algebra-lemma-present-sym-wedge}. We may localize on $X$ and assume that $\mathcal{F}$ is generated by a finite set $(s_i)_{i \in I}$ of global sections. The lemma mentioned above combined with Lemma \ref{lemma-local-tensor-algebra} above implies that for $n \geq 2$ there exists an exact sequence $$ \bigoplus\nolimits_{j \in J} \text{T}^{n - 2}(\mathcal{F}) \to \text{T}^n(\mathcal{F}) \to \text{Sym}^n(\mathcal{F}) \to 0 $$ where the index set $J$ is finite. Now we know that $\text{T}^{n - 2}(\mathcal{F})$ is finitely generated and hence the image of the first arrow is a coherent subsheaf of $\text{T}^n(\mathcal{F})$, see Lemma \ref{lemma-coherent-abelian}. By that same lemma we conclude that $\text{Sym}^n(\mathcal{F})$ is coherent.
It is not true that an infinite direct sum $\bigoplus \mathcal{G}_i$ of locally free modules is locally free, or that an infinite direct sum of quasi-coherent modules is quasi-coherent. The problem is that given a point $x \in X$ the open neighbourhoods $U_i$ of $x$ on which $\mathcal{G}_i$ becomes free (resp.\ has a suitable presentation) may have an intersection which is not an open neighbourhood of $x$. However, in the proof of Lemma \ref{lemma-tensor-algebra-permanence} we saw that once a suitable open neighbourhood for $\mathcal{F}$ has been chosen, then this open neighbourhood works for each of the sheaves $\text{T}^n(\mathcal{F})$, $\wedge^n(\mathcal{F})$ and $\text{Sym}^n(\mathcal{F})$. The lemma follows.
By localizing on $X$ we may assume that $\mathcal{F}$ has a presentation $$ \bigoplus\nolimits_{j = 1, \ldots, m} \mathcal{O}_X \longrightarrow \bigoplus\nolimits_{i = 1, \ldots, n} \mathcal{O}_X \to \mathcal{F} \to 0. $$ By Lemma \ref{lemma-internal-hom-exact} this gives an exact sequence $ 0 \to \SheafHom_{\mathcal{O}_X}(\mathcal{F}, \mathcal{G}) \to \bigoplus\nolimits_{i = 1, \ldots, n} \mathcal{G} \longrightarrow \bigoplus\nolimits_{j = 1, \ldots, m} \mathcal{G}. $ Taking stalks we get an exact sequence $ 0 \to \SheafHom_{\mathcal{O}_X}(\mathcal{F}, \mathcal{G})_x \to \bigoplus\nolimits_{i = 1, \ldots, n} \mathcal{G}_x \longrightarrow \bigoplus\nolimits_{j = 1, \ldots, m} \mathcal{G}_x $ and the result follows since $\mathcal{F}_x$ sits in an exact sequence $ \bigoplus\nolimits_{j = 1, \ldots, m} \mathcal{O}_{X, x} \longrightarrow \bigoplus\nolimits_{i = 1, \ldots, n} \mathcal{O}_{X, x} \to \mathcal{F}_x \to 0 $ which induces the exact sequence $ 0 \to \Hom_{\mathcal{O}_{X, x}}(\mathcal{F}_x, \mathcal{G}_x) \to \bigoplus\nolimits_{i = 1, \ldots, n} \mathcal{G}_x \longrightarrow \bigoplus\nolimits_{j = 1, \ldots, m} \mathcal{G}_x $ which is the same as the one above.
Note that $f^*\mathcal{F}$ is also finitely presented (Lemma \ref{lemma-pullback-finite-presentation}). Let $x \in X$ map to $y \in Y$. Looking at the stalks at $x$ we get an isomorphism by Lemma \ref{lemma-stalk-internal-hom} and More on Algebra, Lemma \ref{more-algebra-lemma-pseudo-coherence-and-base-change-ext} to see that in this case $\Hom$ commutes with base change by $\mathcal{O}_{Y, y} \to \mathcal{O}_{X, x}$. Second proof: use the exact same argument as given in the proof of Lemma \ref{lemma-stalk-internal-hom}.
Assume (1). Then the functor $- \otimes_{\mathcal{O}_X} \mathcal{L}$ is essentially surjective, hence there exists an $\mathcal{O}_X$-module $\mathcal{N}$ as in (2). If (2) holds, then the functor $- \otimes_{\mathcal{O}_X} \mathcal{N}$ is a quasi-inverse to the functor $- \otimes_{\mathcal{O}_X} \mathcal{L}$ and we see that (1) holds. \medskip\noindent Assume (1) and (2) hold. Denote $\psi : \mathcal{L} \otimes_{\mathcal{O}_X} \mathcal{N} \to \mathcal{O}_X$ the given isomorphism. Let $x \in X$. Choose an open neighbourhood $U$ an integer $n \geq 1$ and sections $s_i \in \mathcal{L}(U)$, $t_i \in \mathcal{N}(U)$ such that $\psi(\sum s_i \otimes t_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 $s$ to $\sum s_i \otimes s \otimes t_i$ and the second arrow sends $s \otimes s' \otimes t$ to $\psi(s' \otimes t)s$. We conclude that $s \mapsto \sum \psi(s \otimes t_i)s_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 $s \mapsto (\psi(s \otimes t_1), \ldots, \psi(s \otimes t_n))$ and the second arrow by $(a_1, \ldots, a_n) \mapsto \sum a_i s_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}_X} \SheafHom_{\mathcal{O}_X}(\mathcal{L}, \mathcal{O}_X) \longrightarrow \mathcal{O}_X $$ To finish the proof of the lemma we will show this is an isomorphism by checking it induces isomorphisms on stalks. Let $x \in X$. Since we know (by the previous paragraph) that $\mathcal{L}$ is a finitely presented $\mathcal{O}_X$-module we can use Lemma \ref{lemma-stalk-internal-hom} to see that it suffices to show that $$ \mathcal{L}_x \otimes_{\mathcal{O}_{X, x}} \Hom_{\mathcal{O}_{X, x}}(\mathcal{L}_x, \mathcal{O}_{X, x}) \longrightarrow \mathcal{O}_{X, x} $$ is an isomorphism. Since $\mathcal{L}_x \otimes_{\mathcal{O}_{X, x}} \mathcal{N}_x = (\mathcal{L} \otimes_{\mathcal{O}_X} \mathcal{N})_x = \mathcal{O}_{X, x}$ (Lemma \ref{lemma-stalk-tensor-product}) the desired result follows from More on Algebra, Lemma \ref{more-algebra-lemma-invertible}.
By Lemma \ref{lemma-invertible} there exists an $\mathcal{O}_Y$-module $\mathcal{N}$ such that $\mathcal{L} \otimes_{\mathcal{O}_Y} \mathcal{N} \cong \mathcal{O}_Y$. Pulling back we get $f^*\mathcal{L} \otimes_{\mathcal{O}_X} f^*\mathcal{N} \cong \mathcal{O}_X$ by Lemma \ref{lemma-tensor-product-pullback}. Thus $f^*\mathcal{L}$ is invertible by Lemma \ref{lemma-invertible}.
The parenthetical statement follows by considering a one point space $X$ with sheaf of rings $\mathcal{O}_X$ given by a ring $R$. Then invertible $\mathcal{O}_X$-modules correspond to invertible $R$-modules, hence as soon as $\Pic(R)$ is not the trivial group, then we get an example. \medskip\noindent Assume $\mathcal{L}$ is locally free of rank $1$ and consider the evaluation map $$ \mathcal{L} \otimes_{\mathcal{O}_X} \SheafHom_{\mathcal{O}_X}(\mathcal{L}, \mathcal{O}_X) \longrightarrow \mathcal{O}_X $$ Looking over an open covering trivialization $\mathcal{L}$, we see that this map is an isomorphism. Hence $\mathcal{L}$ is invertible by Lemma \ref{lemma-invertible}. \medskip\noindent Assume all stalks $\mathcal{O}_{X, x}$ are local rings and $\mathcal{L}$ invertible. In the proof of Lemma \ref{lemma-invertible} we have seen that $\mathcal{L}_x$ is an invertible $\mathcal{O}_{X, x}$-module for all $x \in X$. Since $\mathcal{O}_{X, x}$ is local, we see that $\mathcal{L}_x \cong \mathcal{O}_{X, x}$ (More on Algebra, Section \ref{more-algebra-section-picard}). Since $\mathcal{L}$ is of finite presentation by Lemma \ref{lemma-invertible} we conclude that $\mathcal{L}$ is locally free of rank $1$ by Lemma \ref{lemma-finite-presentation-stalk-free}.
Recall that any invertible $\mathcal{O}_X$-module is locally a direct summand of a finite free $\mathcal{O}_X$-module, see Lemma \ref{lemma-invertible}. For each open covering $\mathcal{U} : X = \bigcup_{j \in J} U_j$ and map $r : J \to \mathbf{N}$ consider the sheaves of $\mathcal{O}_X$-modules $\mathcal{F}$ such that $\mathcal{F}_j = \mathcal{F}|_{U_j}$ is a direct summand of $\mathcal{O}_{U_j}^{\oplus r(j)}$. The collection of isomorphism classes of $\mathcal{F}_j$ is a set, because $\Hom_{\mathcal{O}_U}(\mathcal{O}_U^{\oplus r}, \mathcal{O}_U^{\oplus r})$ is a set. The sheaf $\mathcal{F}$ is gotten by glueing $\mathcal{F}_j$, see Sheaves, Section \ref{sheaves-section-glueing-sheaves}. Note that the collection of all glueing data forms a set. The collection of all coverings $\mathcal{U} : X = \bigcup_{j \in J} U_i$ where $J \to \mathcal{P}(X)$, $j \mapsto U_j$ is injective forms a set as well. For each covering there is a set of maps $r : J \to \mathbf{N}$. Hence the collection of all $\mathcal{F}$ forms a set.
Suppose $x \in X_s$. We have an isomorphism $$ \mathcal{L}_x \otimes_{\mathcal{O}_{X, x}} (\mathcal{L}^{\otimes -1})_x \longrightarrow \mathcal{O}_{X, x} $$ by Lemma \ref{lemma-constructions-invertible}. Both $\mathcal{L}_x$ and $(\mathcal{L}^{\otimes -1})_x$ are free $\mathcal{O}_{X, x}$-modules of rank $1$. We conclude from Algebra, Nakayama's Lemma \ref{algebra-lemma-NAK} that $s_x$ is a basis for $\mathcal{L}_x$. Hence there exists a basis element $t_x \in (\mathcal{L}^{\otimes -1})_x$ such that $s_x \otimes t_x$ maps to $1$. Choose an open neighbourhood $U$ of $x$ such that $t_x$ comes from a section $t$ of $\mathcal{L}^{\otimes -1}$ over $U$ and such that $s \otimes t$ maps to $1 \in \mathcal{O}_X(U)$. Clearly, for every $x' \in U$ we see that $s$ generates the module $\mathcal{L}_{x'}$. Hence $U \subset X_s$. This proves that $X_s$ is open. Moreover, the section $t$ constructed over $U$ above is unique, and hence these glue to give the section $s'$ of the lemma.
To prove this we may work locally on $X$. Hence we may assume $\mathcal{F}$ is a direct summand of a finite free module, see Lemma \ref{lemma-flat-locally-finite-presentation}. Say $\mathcal{F} \oplus \mathcal{G} = \mathcal{O}_X^{\oplus n}$. Set $R = \mathcal{O}_X(X)$. Then we see $\mathcal{F}(X) \oplus \mathcal{G}(X) = R^{\oplus n}$ and correspondingly $\mathcal{F}(U) \oplus \mathcal{G}(U) = \mathcal{O}_X(U)^{\oplus n}$ for all opens $U \subset X$. We conclude that $\mathcal{F} = \mathcal{F}_M$ as in Lemma \ref{lemma-construct-quasi-coherent-sheaves} with $M = \mathcal{F}(X)$ a finite projective $R$-module. In other words, we have $\mathcal{F}(U) = M \otimes_R \mathcal{O}_X(U)$. This implies that $\det(M) \otimes_R \mathcal{O}_X(U) = \det(\mathcal{F}(U))$ for all open $U \subset X$ with $\det$ as in More on Algebra, Section \ref{more-algebra-section-determinants}. By More on Algebra, Remark \ref{more-algebra-remark-determinant-as-socle} we see that $$ \det(M) \otimes_R \mathcal{O}_X(U) = \det(\mathcal{F}(U)) \subset \wedge^*_{\mathcal{O}_X(U)}(\mathcal{F}(U)) $$ is the annihilator of $\mathcal{F}(U)$. We conclude that $\det(\mathcal{F})$ as defined in the statement of the lemma is equal to $\mathcal{F}_{\det(M)}$. Some details omitted; one has to be careful as annihilators cannot be defined as the sheafification of taking annihilators on sections over opens. Thus $\det(\mathcal{F})$ is the pullback of an invertible module and we conclude.