hcju/stacksqa huggingface dataset:
After replacing $X$ by an open neighbourhood of $i(Y)$ we may assume that $i$ is a closed immersion. Let $T = i(Y)$ be the corresponding closed subscheme of $X$. Since $T \cong Y$ the morphism $T \to S$ is flat and of finite presentation (Morphisms, Lemmas \ref{morphisms-lemma-syntomic-locally-finite-presentation} and \ref{morphisms-lemma-syntomic-flat}). Also a smooth morphism is flat and locally of finite presentation (Morphisms, Lemmas \ref{morphisms-lemma-smooth-flat} and \ref{morphisms-lemma-smooth-locally-finite-presentation}). Thus, according to Lemma \ref{lemma-fibre-quasi-regular}, it suffices to show that $T_s \subset X_s$ is a quasi-regular closed subscheme. As $X_s$ is locally of finite type over a field, it is Noetherian (Morphisms, Lemma \ref{morphisms-lemma-finite-type-noetherian}). Thus we can check that $T_s \subset X_s$ is a quasi-regular immersion at points, see Lemma \ref{lemma-Noetherian-scheme-regular-ideal}. Take $t \in T_s$. By Morphisms, Lemma \ref{morphisms-lemma-local-complete-intersection} the local ring $\mathcal{O}_{T_s, t}$ is a local complete intersection over $\kappa(s)$. The local ring $\mathcal{O}_{X_s, t}$ is regular, see Algebra, Lemma \ref{algebra-lemma-characterize-smooth-over-field}. By Algebra, Lemma \ref{algebra-lemma-lci-local} we see that the kernel of the surjection $\mathcal{O}_{X_s, t} \to \mathcal{O}_{T_s, t}$ is generated by a regular sequence, which is what we had to show.
Let $y \in Y$ be any point. Set $x = i(y)$ and set $s = j(y)$. It suffices to prove the result after replacing $X, S$ by open neighbourhoods $U, V$ of $x, s$ and $Y$ by an open neighbourhood of $y$ in $i^{-1}(U) \cap j^{-1}(V)$. Hence we may assume that $Y$, $X$ and $S$ are affine. In this case we can choose a closed immersion $h : X \to \mathbf{A}^n_S$ over $S$ for some $n$. Note that $h$ is a regular immersion by Lemma \ref{lemma-immersion-smooth-into-smooth-regular-immersion}. Hence $h \circ i$ is a Koszul-regular (resp.\ $H_1$-regular, quasi-regular) immersion, see Lemmas \ref{lemma-composition-regular-immersion} and \ref{lemma-regular-quasi-regular-immersion}. In this way we reduce to the case $X = \mathbf{A}^n_S$ and $S$ affine. \medskip\noindent After replacing $S$ by an affine open $V$ and replacing $Y$ by $j^{-1}(V)$ we may assume that $i$ is a closed immersion and $S$ affine. Write $S = \Spec(A)$. Then $j : Y \to S$ defines an isomorphism of $Y$ to the closed subscheme $\Spec(A/I)$ for some ideal $I \subset A$. The map $i : Y = \Spec(A/I) \to \mathbf{A}^n_S = \Spec(A[x_1, \ldots, x_n])$ corresponds to an $A$-algebra homomorphism $i^\sharp : A[x_1, \ldots, x_n] \to A/I$. Choose $a_i \in A$ which map to $i^\sharp(x_i)$ in $A/I$. Observe that the ideal of the closed immersion $i$ is $$ J = (x_1 - a_1, \ldots, x_n - a_n) + IA[x_1, \ldots, x_n]. $$ Set $K = (x_1 - a_1, \ldots, x_n - a_n)$. We claim the sequence $$ 0 \to K/KJ \to J/J^2 \to J/(K + J^2) \to 0 $$ is split exact. To see this note that $K/K^2$ is free with basis $x_i - a_i$ over the ring $A[x_1, \ldots, x_n]/K \cong A$. Hence $K/KJ$ is free with the same basis over the ring $A[x_1, \ldots, x_n]/J \cong A/I$. On the other hand, taking derivatives gives a map $$ \text{d}_{A[x_1, \ldots, x_n]/A} : J/J^2 \longrightarrow \Omega_{A[x_1, \ldots, x_n]/A} \otimes_{A[x_1, \ldots, x_n]} A[x_1, \ldots, x_n]/J $$ which maps the generators $x_i - a_i$ to the basis elements $\text{d}x_i$ of the free module on the right. The claim follows. Moreover, note that $x_1 - a_1, \ldots, x_n - a_n$ is a regular sequence in $A[x_1, \ldots, x_n]$ with quotient ring $A[x_1, \ldots, x_n]/(x_1 - a_1, \ldots, x_n - a_n) \cong A$. Thus we have a factorization $$ Y \to V(x_1 - a_1, \ldots, x_n - a_n) \to \mathbf{A}^n_S $$ of our closed immersion $i$ where the composition is Koszul-regular (resp.\ $H_1$-regular, quasi-regular), the second arrow is a regular immersion, and the associated conormal sequence is split. Now the result follows from Lemma \ref{lemma-permanence-regular-immersion}.
The question is local on $X$ and $Y$. Hence we reduce to the case where $X = \Spec(A)$, $Y = \Spec(R)$ and $f$ is given by a ring map $\varphi : R \to A$. By the characterization of regular sections of the structure sheaf in Lemma \ref{lemma-regular-section-structure-sheaf} we have to show that $R \to A$ maps nonzerodivisors to nonzerodivisors. Let $t \in R$ be a nonzerodivisor. \medskip\noindent If $R \to A$ is flat, then $t : R \to R$ being injective shows that $t : A \to A$ is injective. This proves (7). \medskip\noindent In the other cases we note that $t$ is not contained in any of the minimal primes of $R$ (because every element of a minimal prime in a ring is a zerodivisor). Hence in case (1) we see that $\varphi(t)$ is not contained in any weakly associated prime of $A$. Thus this case follows from Algebra, Lemma \ref{algebra-lemma-weakly-ass-zero-divisors}. Case (5) is a special case of (1) by Lemma \ref{lemma-ass-weakly-ass}. Case (6) follows from (5) and the definitions. Case (4) is a special case of (1) by Lemma \ref{lemma-weakass-reduced}. Cases (2) and (3) are special cases of (4).
Observe that a locally finite direct sum of sheaves of modules is equal to the product since you can check this on stalks for example. Then since $\mathcal{K}_X(\mathcal{F}) = \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{K}_X$ we see that (2) follows from the other statements. Also, observe that part (6) follows from the initial statement of the lemma and Morphisms, Lemma \ref{morphisms-lemma-integral-scheme-rational-functions} when $X^0$ is finite; the general case of (6) follows from this by glueing (argument omitted). \medskip\noindent Let $j : Y = \coprod\nolimits_{\eta \in X^0} \Spec(\mathcal{O}_{X, \eta}) \to X$ be the product of the morphisms $j_\eta$. We have to show that $\mathcal{K}_X = j_*\mathcal{O}_Y$. First note that $\mathcal{K}_Y = \mathcal{O}_Y$ as $Y$ is a disjoint union of spectra of local rings of dimension $0$: in a local ring of dimension zero any nonzerodivisor is a unit. Next, note that pullbacks of meromorphic functions are defined for $j$ by Lemma \ref{lemma-pullback-meromorphic-sections-defined}. This gives a map $$ \mathcal{K}_X \longrightarrow j_*\mathcal{O}_Y. $$ Let $\Spec(A) = U \subset X$ be an affine open. Then $A$ is a ring with finitely many minimal primes $\mathfrak q_1, \ldots, \mathfrak q_t$ and every weakly associated prime of $A$ is one of the $\mathfrak q_i$. We obtain $Q(A) = \prod A_{\mathfrak q_i}$ by Algebra, Lemmas \ref{algebra-lemma-total-ring-fractions-no-embedded-points} and \ref{algebra-lemma-weakly-ass-zero-divisors}. In other words, already the value of the presheaf $U \mapsto \mathcal{S}(U)^{-1}\mathcal{O}_X(U)$ agrees with $j_*\mathcal{O}_Y(U)$ on our affine open $U$. Hence the displayed map is an isomorphism which proves the first displayed equality in the statement of the lemma. \medskip\noindent Finally, we prove (1), (3), (4), and (5). Part (5) we saw during the course of the proof that $\mathcal{K}_X = j_*\mathcal{O}_Y$. The morphism $j$ is quasi-compact by our assumption that the set of irreducible components of $X$ is locally finite. Hence $j$ is quasi-compact and quasi-separated (as $Y$ is separated). By Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} $j_*\mathcal{O}_Y$ is quasi-coherent. This proves (1). Let $x \in X$. We may choose an affine open neighbourhood $U = \Spec(A)$ of $x$ all of whose irreducible components pass through $x$. Then $A \subset A_\mathfrak p$ because every weakly associated prime of $A$ is contained in $\mathfrak p$ hence elements of $A \setminus \mathfrak p$ are nonzerodivisors by Algebra, Lemma \ref{algebra-lemma-weakly-ass-zero-divisors}. It follows easily that any nonzerodivisor of $A_\mathfrak p$ is the image of a nonzerodivisor on a (possibly smaller) affine open neighbourhood of $x$. This proves (3). Part (4) follows from part (3) by computing stalks.
To prove this lemma we may assume $X$ is the spectrum of a Noetherian ring $A$. Say $x \in X$ corresponds to $\mathfrak p \subset A$. \medskip\noindent Proof of (1). It is clear that $\mathcal{S}_x$ is contained in the set of nonzerodivisors of $\mathcal{O}_{X, x} = A_\mathfrak p$. For the converse, let $f, g \in A$, $g \not \in \mathfrak p$ and assume $f/g$ is a nonzerodivisor in $A_{\mathfrak p}$. Let $I = \{a \in A \mid af = 0\}$. Then we see that $I_{\mathfrak p} = 0$ by exactness of localization. Since $A$ is Noetherian we see that $I$ is finitely generated and hence that $g'I = 0$ for some $g' \in A$, $g' \not \in \mathfrak p$. Hence $f$ is a nonzerodivisor in $A_{g'}$, i.e., in a Zariski open neighbourhood of $\mathfrak p$. Thus $f/g$ is an element of $\mathcal{S}_x$. \medskip\noindent Proof of (2). Let $f \in \Gamma(X, \mathcal{K}_X)$ be a meromorphic function. Set $I = \{a \in A \mid af \in A\}$. Fix a prime $\mathfrak p \subset A$ corresponding to the point $x \in X$. By (1) we can write the image of $f$ in the stalk at $\mathfrak p$ as $a/b$, $a, b \in A_{\mathfrak p}$ with $b \in A_{\mathfrak p}$ not a zerodivisor. Write $b = c/d$ with $c, d \in A$, $d \not \in \mathfrak p$. Then $ad - cf$ is a section of $\mathcal{K}_X$ which vanishes in an open neighbourhood of $x$. Say it vanishes on $D(e)$ with $e \in A$, $e \not \in \mathfrak p$. Then $e^n(ad - cf) = 0$ for some $n \gg 0$ by Lemma \ref{lemma-meromorphic-section-restricts-to-zero}. Thus $e^nc \in I$ and $e^nc$ maps to a nonzerodivisor in $A_{\mathfrak p}$. Let $\text{Ass}(A) = \{\mathfrak q_1, \ldots, \mathfrak q_t\}$ be the associated primes of $A$. By looking at $IA_{\mathfrak q_i}$ and using Algebra, Lemma \ref{algebra-lemma-associated-primes-localize} the above says that $I \not \subset \mathfrak q_i$ for each $i$. By Algebra, Lemma \ref{algebra-lemma-silly} there exists an element $x \in I$, $x \not \in \bigcup \mathfrak q_i$. By Algebra, Lemma \ref{algebra-lemma-ass-zero-divisors} we see that $x$ is not a zerodivisor on $A$. Hence $f = (xf)/x$ is an element of the total ring of fractions of $A$. This proves (2).
For each generic point $\eta$ of $X$ pick a generator $s_\eta$ of the free rank $1$ module $\mathcal{L}_\eta$ over the artinian local ring $\mathcal{O}_{X, \eta}$. It follows immediately from the description of $\mathcal{K}_X$ and $\mathcal{K}_X(\mathcal{L})$ in Lemma \ref{lemma-quasi-coherent-K} that $s = \prod s_\eta$ is a regular meromorphic section of $\mathcal{L}$.
Reduce to the affine case with $\mathcal{L} \cong \mathcal{O}_X$, and $s = a/b$ with $a, b \in A$ both nonzerodivisors. Proof of reduction step omitted. Write $\mathcal{F} = \widetilde{M}$. Let $I = \{x \in A \mid x(a/b) \in A\}$ so that $\mathcal{I} = \widetilde{I}$ (see proof of Lemma \ref{lemma-regular-meromorphic-ideal-denominators}). Note that $T = V(I) \cup V((a/b)I)$. For any $A$-module $M$ consider the map $1 : IM \to M$; this is the map that gives rise to the map $1$ of the lemma. Consider on the other hand the map $\sigma : IM \to M_b, x \mapsto ax/b$. Since $b$ is not a zerodivisor in $A$, and since $M$ has support $\Spec(A)$ and no embedded primes we see that $b$ is a nonzerodivisor on $M$ also. Hence $M \subset M_b$. By definition of $I$ we have $\sigma(IM) \subset M$ as submodules of $M_b$. Hence we get an $A$-module map $s : IM \to M$ (namely the unique map such that $s(z)/1 = \sigma(z)$ in $M_b$ for all $z \in IM$). It is injective because $a$ is a nonzerodivisor also (on both $A$ and $M$). It is clear that $M/IM$ is annihilated by $I$ and that $M/s(IM)$ is annihilated by $(a/b)I$. Thus the lemma follows.
In case (1) let $\eta \in X$ be the generic point. We have seen in Lemma \ref{lemma-meromorphic-functions-integral-scheme} that $\mathcal{K}_X$, resp.\ $\mathcal{K}_X(\mathcal{L})$ is the constant sheaf with value $\kappa(\eta)$, resp.\ $\mathcal{L}_\eta$. Since $\dim_{\kappa(\eta)} \mathcal{L}_\eta = 1$ we can pick a nonzero element $s \in \mathcal{L}_\eta$. Clearly $s$ is a regular meromorphic section of $\mathcal{L}$. In case (2) pick $s_\eta \in \mathcal{L}_\eta$ nonzero for all generic points $\eta$ of $X$; this is possible as $\mathcal{L}_\eta$ is a $1$-dimensional vector space over $\kappa(\eta)$. It follows immediately from the description of $\mathcal{K}_X$ and $\mathcal{K}_X(\mathcal{L})$ in Lemma \ref{lemma-reduced-finite-irreducible} that $s = \prod s_\eta$ is a regular meromorphic section of $\mathcal{L}$. Case (3) is Lemma \ref{lemma-regular-meromorphic-section-exists-noetherian}.
Let $U \subset X$ be a quasi-compact open subscheme. Then $U$ is a Noetherian scheme, and hence has a Noetherian underlying topological space (Properties, Lemma \ref{properties-lemma-Noetherian-topology}). Hence every subspace is Noetherian and has finitely many irreducible components (see Topology, Lemma \ref{topology-lemma-Noetherian}).
There exists a nonempty open subscheme $U \subset X$ such that $s$ corresponds to a section of $\Gamma(U, \mathcal{L})$ which generates $\mathcal{L}$ over $U$. Hence the prime divisors which can occur in the sets of the lemma are all irreducible components of $X \setminus U$. Hence Lemma \ref{lemma-components-locally-finite}. gives the desired result.
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module whose associated Weil divisor class is trivial. Let $s$ be a regular meromorphic section of $\mathcal{L}$. The assumption means that $\text{div}_\mathcal{L}(s) = \text{div}(f)$ for some $f \in R(X)^*$. Then we see that $t = f^{-1}s$ is a regular meromorphic section of $\mathcal{L}$ with $\text{div}_\mathcal{L}(t) = 0$, see Lemma \ref{lemma-divisor-meromorphic-well-defined}. We will show that $t$ defines a trivialization of $\mathcal{L}$ which finishes the proof of the lemma. In order to prove this we may work locally on $X$. Hence we may assume that $X = \Spec(A)$ is affine and that $\mathcal{L}$ is trivial. Then $A$ is a Noetherian normal domain and $t$ is an element of its fraction field such that $\text{ord}_{A_\mathfrak p}(t) = 0$ for all height $1$ primes $\mathfrak p$ of $A$. Our goal is to show that $t$ is a unit of $A$. Since $A_\mathfrak p$ is a discrete valuation ring for height one primes of $A$ (Algebra, Lemma \ref{algebra-lemma-criterion-normal}), the condition signifies that $t \in A_\mathfrak p^*$ for all primes $\mathfrak p$ of height $1$. This implies $t \in A$ and $t^{-1} \in A$ by Algebra, Lemma \ref{algebra-lemma-normal-domain-intersection-localizations-height-1} and the proof is complete.
If (1) holds, then $X$ is normal by Algebra, Lemma \ref{algebra-lemma-UFD-normal}. Hence the map (\ref{equation-c1}) is injective by Lemma \ref{lemma-normal-c1-injective}. Moreover, every prime divisor $D \subset X$ is an effective Cartier divisor by Lemma \ref{lemma-weil-divisor-is-cartier-UFD}. In this case the canonical section $1_D$ of $\mathcal{O}_X(D)$ (Definition \ref{definition-invertible-sheaf-effective-Cartier-divisor}) vanishes exactly along $D$ and we see that the class of $D$ is the image of $\mathcal{O}_X(D)$ under the map (\ref{equation-c1}). Thus the map is surjective as well. \medskip\noindent Assume (2) holds. Pick a prime divisor $D \subset X$. Since (\ref{equation-c1}) is surjective there exists an invertible sheaf $\mathcal{L}$, a regular meromorphic section $s$, and $f \in R(X)^*$ such that $\text{div}_\mathcal{L}(s) + \text{div}(f) = [D]$. In other words, $\text{div}_\mathcal{L}(fs) = [D]$. Let $x \in X$ and let $A = \mathcal{O}_{X, x}$. Thus $A$ is a Noetherian local normal domain with fraction field $K = R(X)$. Every height $1$ prime of $A$ corresponds to a prime divisor on $X$ and every invertible $\mathcal{O}_X$-module restricts to the trivial invertible module on $\Spec(A)$. It follows that for every height $1$ prime $\mathfrak p \subset A$ there exists an element $f \in K$ such that $\text{ord}_{A_\mathfrak p}(f) = 1$ and $\text{ord}_{A_{\mathfrak p'}}(f) = 0$ for every other height one prime $\mathfrak p'$. Then $f \in A$ by Algebra, Lemma \ref{algebra-lemma-normal-domain-intersection-localizations-height-1}. Arguing in the same fashion we see that every element $g \in \mathfrak p$ is of the form $g = af$ for some $a \in A$. Thus we see that every height one prime ideal of $A$ is principal and $A$ is a UFD by Algebra, Lemma \ref{algebra-lemma-characterize-UFD-height-1}.
Let $D' \subset X$ be the scheme theoretic image of the morphism $D \to X$. Since $X$ is locally Noetherian the morphism $D \to X$ is quasi-compact, see Properties, Lemma \ref{properties-lemma-immersion-into-noetherian}. Hence the formation of $D'$ commutes with passing to opens in $X$ by Morphisms, Lemma \ref{morphisms-lemma-quasi-compact-scheme-theoretic-image}. Thus we may assume $X = \Spec(A)$ is affine. Let $I \subset A$ be the ideal corresponding to $D'$. Let $\mathfrak p \subset A$ be a prime ideal corresponding to a point of $X \setminus U$. To finish the proof it is enough to show that $I_\mathfrak p$ is generated by one element, see Lemma \ref{lemma-effective-Cartier-in-points}. Thus we may replace $X$ by $\Spec(A_\mathfrak p)$, see Morphisms, Lemma \ref{morphisms-lemma-flat-base-change-scheme-theoretic-image}. In other words, we may assume that $X$ is the spectrum of a local UFD $A$. Then all local rings of $A$ are UFD's. It follows that $D = \sum a_i D_i$ with $D_i \subset U$ an integral effective Cartier divisor, see Lemma \ref{lemma-effective-Cartier-divisor-is-a-sum}. The generic points $\xi_i$ of $D_i$ correspond to prime ideals $\mathfrak p_i \subset A$ of height $1$, see Lemma \ref{lemma-effective-Cartier-codimension-1}. Then $\mathfrak p_i = (f_i)$ for some prime element $f_i \in A$ and we conclude that $D'$ is cut out by $\prod f_i^{a_i}$ as desired.
Choose $x \in X$, $x \not \in U$. We will show there exists an affine open neighbourhood $W \subset X$, such that $\mathcal{L}|_{W \cap U}$ extends to an invertible sheaf on $W$. This implies by glueing of sheaves (Sheaves, Section \ref{sheaves-section-glueing-sheaves}) that we can extend $\mathcal{L}$ to the strictly bigger open $U \cup W$. Let $W = \Spec(A)$ be an affine open neighbourhood. Since $U \cap W$ is quasi-affine, we see that we can write $\mathcal{L}|_{W \cap U}$ as $\mathcal{O}(D_1) \otimes \mathcal{O}(D_2)^{\otimes -1}$ for some effective Cartier divisors $D_1, D_2 \subset W \cap U$, see Lemma \ref{lemma-quasi-projective-Noetherian-pic-effective-Cartier}. Then $D_1$ and $D_2$ extend to effective Cartier divisors of $W$ by Lemma \ref{lemma-closure-effective-cartier-divisor} which gives us the extension of the invertible sheaf. \medskip\noindent If $X$ is Noetherian (which is the case most used in practice), the above combined with Noetherian induction finishes the proof. In the general case we argue as follows. First, because every local ring of a point outside of $U$ is a domain and $X$ is locally Noetherian, we see that the closure of $U$ in $X$ is open. Thus we may assume that $U \subset X$ is dense and schematically dense. Now we consider the set $T$ of triples $(U', \mathcal{L}', \alpha)$ where $U \subset U' \subset X$ is an open subscheme, $\mathcal{L}'$ is an invertible $\mathcal{O}_{U'}$-module, and $\alpha : \mathcal{L}'|_U \to \mathcal{L}$ is an isomorphism. We endow $T$ with a partial ordering $\leq$ defined by the rule $(U', \mathcal{L}', \alpha) \leq (U'', \mathcal{L}'', \alpha')$ if and only if $U' \subset U''$ and there exists an isomorphism $\beta : \mathcal{L}''|_{U'} \to \mathcal{L}'$ compatible with $\alpha$ and $\alpha'$. Observe that $\beta$ is unique (if it exists) because $U \subset X$ is dense. The first part of the proof shows that for any element $t = (U', \mathcal{L}', \alpha)$ of $T$ with $U' \not = X$ there exists a $t' \in T$ with $t' > t$. Hence to finish the proof it suffices to show that Zorn's lemma applies. Thus consider a totally ordered subset $I \subset T$. If $i \in I$ corresponds to the triple $(U_i, \mathcal{L}_i, \alpha_i)$, then we can construct an invertible module $\mathcal{L}'$ on $U' = \bigcup U_i$ as follows. For $W \subset U'$ open and quasi-compact we see that $W \subset U_i$ for some $i$ and we set $$ \mathcal{L}'(W) = \mathcal{L}_i(W) $$ For the transition maps we use the $\beta$'s (which are unique and hence compose correctly). This defines an invertible $\mathcal{O}$-module $\mathcal{L}'$ on the basis of quasi-compact opens of $U'$ which is sufficient to define an invertible module (Sheaves, Section \ref{sheaves-section-bases}). We omit the details.
Since $R$ is a UFD so is any localization of it and any polynomial ring over it (Algebra, Lemma \ref{algebra-lemma-polynomial-ring-UFD}). Thus if $U \subset \mathbf{A}^n_R$ is open, then the map $\Pic(\mathbf{A}^n_R) \to \Pic(U)$ is surjective by Lemma \ref{lemma-extend-invertible-module}. The vanishing of $\Pic(\mathbf{A}^n_R)$ is equivalent to the vanishing of the picard group of the UFD $R[x_1, \ldots, x_n]$ which is proved in More on Algebra, Lemma \ref{more-algebra-lemma-UFD-Pic-trivial}.
Observe that the local rings of $X = \mathbf{P}^n_R$ are UFDs because $X$ is covered by affine pieces isomorphic to $\mathbf{A}^n_R$ and $R[x_1, \ldots, x_n]$ is a UFD (Algebra, Lemma \ref{algebra-lemma-polynomial-ring-UFD}). Hence $X$ is an integral Noetherian scheme all of whose local rings are UFDs and we see that $\Pic(X) = \text{Cl}(X)$ by Lemma \ref{lemma-local-rings-UFD-c1-bijective}. \medskip\noindent The displayed map is a group homomorphism by Constructions, Lemma \ref{constructions-lemma-apply-modules}. The map is injective because $H^0$ of $\mathcal{O}_X$ and $\mathcal{O}_X(m)$ are non-isomorphic $R$-modules if $m > 0$, see Cohomology of Schemes, Lemma \ref{coherent-lemma-cohomology-projective-space-over-ring}. Let $\mathcal{L}$ be an invertible module on $X$. Consider the open $U = D_+(T_0) \cong \mathbf{A}^n_R$. The complement $H = X \setminus U$ is a prime divisor because it is isomorphic to $\text{Proj}(R[T_1, \ldots, T_n])$ which is integral by the discussion in the previous paragraph. In fact $H$ is the zero scheme of the regular global section $T_0$ of $\mathcal{O}_X(1)$ hence $\mathcal{O}_X(1)$ maps to the class of $H$ in $\text{Cl}(X)$. By Lemma \ref{lemma-open-subscheme-UFD} we see that $\mathcal{L}|_U \cong \mathcal{O}_U$. Let $s \in \mathcal{L}(U)$ be a trivializing section. Then we can think of $s$ as a regular meromorphic section of $\mathcal{L}$ and we see that necessarily $\text{div}_\mathcal{L}(s) = m[H]$ for some $m \in \mathbf{Z}$ as $H$ is the only prime divisor of $X$ not meeting $U$. In other words, we see that $\mathcal{L}$ and $\mathcal{O}_X(m)$ map to the same element of $\text{Cl}(X)$ and hence $\mathcal{L} \cong \mathcal{O}_X(m)$ as desired.
Although not strictly necessary, we recommend reading Remark \ref{remark-tensor} before proceeding with the proof. Choose an open subscheme $j : U \to X$ such that every irreducible component of $X \setminus U$ has codimension $\geq 2$ in $X$ and such that $j^*\mathcal{F}$ and $j^*\mathcal{G}$ are finite locally free, see Lemma \ref{lemma-reflexive-over-normal}. The map $$ \SheafHom_{\mathcal{O}_U}(j^*\mathcal{F}, \mathcal{O}_U) \otimes_{\mathcal{O}_U} j^*\mathcal{G} \to \SheafHom_{\mathcal{O}_U}(j^*\mathcal{F}, j^*\mathcal{G}) $$ is an isomorphism, because we may check it locally and it is clear when the modules are finite free. Observe that $j^*$ applied to the displayed arrow of the lemma gives the arrow we've just shown is an isomorphism (small detail omitted). Since $j^*$ defines an equivalence between coherent reflexive modules on $U$ and coherent reflexive modules on $X$ (by Lemma \ref{lemma-reflexive-S2-extend} and Serre's criterion Properties, Lemma \ref{properties-lemma-criterion-normal}), we conclude that the arrow of the lemma is an isomorphism too. If $\mathcal{F}$ has rank $1$, then $j^*\mathcal{F}$ is an invertible $\mathcal{O}_U$-module and the reflexive module $\mathcal{F}^\vee = \SheafHom(\mathcal{F}, \mathcal{O}_X)$ restricts to its inverse. It follows in the same manner as before that $(\mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{F}^\vee)^{**} = \mathcal{O}_X$. In this way we see that we have inverses for the group law given in the statement of the lemma.