hcju/stacksqa huggingface dataset:
We have seen the equivalence of (1) and (2) in Lemma \ref{lemma-geometrically-reduced-p}. We have seen that (2) implies (3) in Lemma \ref{lemma-geometrically-reduced-dense-smooth-open}. If (3) holds, then $U$ is geometrically reduced (see for example Lemma \ref{lemma-geometrically-regular-smooth}) and hence $X$ is geometrically reduced by Lemma \ref{lemma-generic-points-geometrically-reduced}. In this way we see that (1), (2), and (3) are equivalent. \medskip\noindent Assume (1), (2), and (3) hold. Since $F_{X/k}$ is a homeomorphism (Lemma \ref{lemma-relative-frobenius}) we see that $X^{(p)}$ is a variety. Then $F_{X/k}$ is finite by Lemma \ref{lemma-relative-frobenius-finite}. It is dominant as it is surjective. To compute the degree (Morphisms, Definition \ref{morphisms-definition-degree}) it suffices to compute the degree of $F_{U/k} : U \to U^{(p)}$ (as $F_{U/k} = F_{X/k}|_U$ by Lemma \ref{lemma-relative-frobenius-endomorphism-identity}). After shrinking $U$ a bit we may assume there exists an \'etale morphism $h : U \to \mathbf{A}^n_k$, see Morphisms, Lemma \ref{morphisms-lemma-smooth-etale-over-affine-space}. Of course $n = \dim(U)$ because $\mathbf{A}^n_k \to \Spec(k)$ is smooth of relative dimension $n$, the \'etale morphism $h$ is smooth of relative dimension $0$, and $U \to \Spec(k)$ is smooth of relative dimension $\dim(U)$ and relative dimensions add up correctly (Morphisms, Lemma \ref{morphisms-lemma-composition-relative-dimension-d}). Observe that $h$ is a generically finite dominant morphism of varieties, and hence $\deg(h)$ is defined. By Lemma \ref{lemma-relative-frobenius-endomorphism-identity} we have a commutative diagram $$ \xymatrix{ X \ar[rr]_{F_{X/k}} \ar[d]_h & & X^{(p)} \ar[d]^{h^{(p)}} \\ \mathbf{A}^n_k \ar[rr]^{F_{\mathbf{A}^n_k/k}} & & (\mathbf{A}^n_k)^{(p)} } $$ Since $h^{(p)}$ is a base change of $h$ it is \'etale as well and it follows that $h^{(p)}$ is a generically finite dominant morphism of varieties as well. The degree of $h^{(p)}$ is the degree of the extension $k(X^{(p)})/k((\mathbf{A}^n_k)^{(p)})$ which is the same as the degree of the extension $k(X)/k(\mathbf{A}^n_k)$ because $h^{(p)}$ is the base change of $h$ (small detail omitted). By multiplicativity of degrees (Morphisms, Lemma \ref{morphisms-lemma-degree-composition}) it suffices to show that the degree of $F_{\mathbf{A}^n_k/k}$ is $p^n$. To see this observe that $(\mathbf{A}^n_k)^{(p)} = \mathbf{A}^n_k$ and that $F_{\mathbf{A}^n_k/k}$ is given by the map sending the coordinates to their $p$th powers.
It is clear that (2) implies (1). On the other hand, if $A \otimes B \to K$ is not surjective, then the image $C \subset K$ is not a field hence $C$ has a nonzero maximal ideal $\mathfrak m$. Choose a valuation ring $\mathcal{O} \subset K$ dominating $C_\mathfrak m$. By Algebra, Lemma \ref{algebra-lemma-krull-akizuki} applied to $A \subset \mathcal{O}$ the ring $\mathcal{O}$ is Noetherian. Hence $\mathcal{O}$ is a discrete valuation ring by Algebra, Lemma \ref{algebra-lemma-valuation-ring-Noetherian-discrete}.
Let $\mathfrak m_B$ be the Jacobson radical of $B$. The structure of $B'$ results from Algebra, Lemma \ref{algebra-lemma-integral-closure-Dedekind}. Given $x, y \in B'$ as in the statement of the lemma consider the subring $B \subset A \subset B'$ generated by $x$ and $y$. Then $A$ is finite over $B$ (Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral}). Since the fraction fields of $B$ and $A$ are the same we see that the finite module $A/B$ is supported on the set of closed points of $B$. Thus $\mathfrak m_B^n A \subset B$ for a suitable $n$. Moreover, $\Spec(B') \to \Spec(A)$ is surjective (Algebra, Lemma \ref{algebra-lemma-integral-overring-surjective}), hence $A$ is semi-local as well. It also follows that $x$ is in the Jacobson radical $\mathfrak m_A$ of $A$. Note that $\mathfrak m_A = \sqrt{\mathfrak m_B A}$. Thus $x^m y \in \mathfrak m_B A$ for some $m$. Then $x^{nm} y \in B$.
Special case: $B$ is integrally closed in $K$. This means that $B$ is a Dedekind domain (Algebra, Lemma \ref{algebra-lemma-characterize-Dedekind}) whence all of its localizations at maximal ideals are discrete valuation rings. Let $\mathfrak m_1, \ldots, \mathfrak m_r$ be the maximal ideals of $B$. We set $$ R_1 = A \times_K B_{\mathfrak m_1} $$ Observing that $A \otimes_{R_1} B_{\mathfrak m_1} \to K$ is surjective we conclude from Lemma \ref{lemma-semi-local} that $A$ and $B_{\mathfrak m_1}$ define open subschemes covering $\Spec(R_1)$ and that $K = A \otimes_{R_1} B_{\mathfrak m_1}$. In particular $R_1$ is a semi-local Noetherian ring of dimension $1$. By induction we define $$ R_{i + 1} = R_i \times_K B_{\mathfrak m_{i + 1}} $$ for $i = 1, \ldots, r - 1$. Observe that $R = R_n$ because $B = B_{\mathfrak m_1} \cap \ldots \cap B_{\mathfrak m_r}$ (see Algebra, Lemma \ref{algebra-lemma-normal-domain-intersection-localizations-height-1}). It follows from the inductive procedure that $R \to A$ defines an open immersion $\Spec(A) \to \Spec(R)$. On the other hand, the maximal ideals $\mathfrak n_i$ of $R$ not in this open correspond to the maximal ideals $\mathfrak m_i$ of $B$ and in fact the ring map $R \to B$ defines an isomorphisms $R_{\mathfrak n_i} \to B_{\mathfrak m_i}$ (details omitted; hint: in each step we added exactly one maximal ideal to $\Spec(R_i)$). It follows that $\Spec(B) \to \Spec(R)$ is an open immersion as desired. \medskip\noindent General case. Let $B' \subset K$ be the integral closure of $B$. See Lemma \ref{lemma-semi-local-dimension-one-conductor}. Then the special case applies to $R' = A \times_K B'$. Pick $x \in R'$ which is not contained in the maximal ideals of $A$ and is contained in the maximal ideals of $B'$ (see Algebra, Lemma \ref{algebra-lemma-chinese-remainder}). By Lemma \ref{lemma-semi-local-dimension-one-conductor} there exists an integer $n$ such that $x^n \in R = A \times_K B$. Replace $x$ by $x^n$ so $x \in R$. For every $y \in R'$ there exists an integer $n$ such that $x^n y \in R$. On the other hand, it is clear that $R'_x = A$. Thus $R_x = A$. Exchanging the roles of $A$ and $B$ we also find an $y \in R$ such that $B = R_y$. Note that inverting both $x$ and $y$ leaves no primes except $(0)$. Thus $K = R_{xy} = R_x \otimes_R R_y$. This finishes the proof.
Namely, we can take $A = A_1 \cap \ldots \cap A_r$. First we note that (3), once (1) and (2) have been proven, follows from the assumption that $A_i \otimes A_j \to K$ is surjective since if $\mathfrak m \in j_i(\Spec(A_i)) \cap j_j(\Spec(A_j))$, then $A_i \otimes A_j \to K$ ends up in $A_\mathfrak m$. To prove (1) and (2) we argue by induction on $r$. If $r > 1$ by induction we have the results (1) and (2) for $B = A_2 \cap \ldots \cap A_r$. Then we apply Lemma \ref{lemma-semi-local-both-side} to see they hold for $A = A_1 \cap B$.
Let $B_i'$ be the integral closure of $B_i$ in $K$. Suppose we find a nonzero $x \in A$ such that $x^{-1}$ is in the Jacobson radical of $B'_i$ for $i = 1, \ldots, r$. Then by Lemma \ref{lemma-semi-local-dimension-one-conductor}, after replacing $x$ by a power we get $x^{-1} \in B_i$. Since $\Spec(B'_i) \to \Spec(B_i)$ is surjective we see that $x^{-1}$ is then also in the Jacobson radical of $B_i$. Thus we may assume that each $B_i$ is a semi-local Dedekind domain. \medskip\noindent If $B_i$ is not local, then remove $B_i$ from the list and add back the finite collection of local rings $(B_i)_\mathfrak m$. Thus we may assume that $B_i$ is a discrete valuation ring for $i = 1, \ldots, r$. \medskip\noindent Let $v_i : K \to \mathbf{Z}$, $i = 1, \ldots, r$ be the corresponding discrete valuations (see Algebra, Lemma \ref{algebra-lemma-characterize-Dedekind}). We are looking for a nonzero $x \in A$ with $v_i(x) < 0$ for $i = 1, \ldots, r$. We will prove this by induction on $r$. \medskip\noindent If $r = 1$ and the result is wrong, then $A \subset B$ and the map $A \otimes B \to K$ is not surjective, contradiction. \medskip\noindent If $r > 1$, then by induction we can find a nonzero $x \in A$ such that $v_i(x) < 0$ for $i = 1, \ldots, r - 1$. If $v_r(x) < 0$ then we are done, so we may assume $v_r(x) \geq 0$. By the base case we can find $y \in A$ nonzero such that $v_r(y) < 0$. After replacing $x$ by a power we may assume that $v_i(x) < v_i(y)$ for $i = 1, \ldots, r - 1$. Then $x + y$ is the element we are looking for.
Since $A$ is Noetherian we have $I^t = 0$ for some $t > 0$. Suppose that we know that $f = a + i$ with $i \in I^kL$. Then $f^n = a^n + na^{n - 1}i \bmod I^{k + 1}L$. Hence it suffices to show that $na^{n - 1}i$ is in the image of $I^k \to I^kL$ for some $n \gg 0$. To see this, pick a $g \in A$ such that $\mathfrak m_A = \sqrt{(g)}$ (Algebra, Lemma \ref{algebra-lemma-height-1}). Then $L = A_g$ for example by Algebra, Proposition \ref{algebra-proposition-dimension-zero-ring}. On the other hand, there is an $n$ such that $a^n \in (g)$. Hence we can clear denominators for elements of $L$ by multiplying by a high power of $a$.
If $a, b \in A$ and $a, b \in S$, then $a, b \not \in \mathfrak p_i$ hence $ab \not \in \mathfrak p_i$, hence $ab \in S$. Also $1 \in S$. Thus $S$ is a multiplicative subset of $A$. By the description of $\Spec(S^{-1}A)$ in Algebra, Lemma \ref{algebra-lemma-spec-localization} and by Algebra, Lemma \ref{algebra-lemma-silly} we see that the primes of $S^{-1}A$ correspond to the primes of $A$ contained in one of the $\mathfrak p_i$. Hence the maximal ideals of $S^{-1}A$ correspond one-to-one with the maximal (w.r.t.\ inclusion) elements of the set $\{\mathfrak p_1, \ldots, \mathfrak p_r\}$.
We may check the vanishing of $R^pj_*\mathcal{F}$ at stalks. Formation of $R^qj_*$ commutes with flat base change, see Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology}. Thus we may assume that $X$ is the spectrum of a Noetherian local ring of dimension $\leq 1$. In this case $X$ has a closed point $x$ and finitely many other points $x_1, \ldots, x_n$ which specialize to $x$ but not each other (see Algebra, Lemma \ref{algebra-lemma-Noetherian-irreducible-components}). If $x \in U$, then $U = X$ and the result is clear. If not, then $U = \{x_1, \ldots, x_r\}$ for some $r$ after possibly renumbering the points. Then $U$ is affine (Schemes, Lemma \ref{schemes-lemma-scheme-finite-discrete-affine}). Thus the result follows from Cohomology of Schemes, Lemma \ref{coherent-lemma-relative-affine-vanishing}.
Denote $j : U \to X$ the inclusion morphism. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_U$-module. By Lemma \ref{lemma-affine} the higher direct images $R^pj_*\mathcal{F}$ are zero. The $\mathcal{O}_X$-module $j_*\mathcal{F}$ is quasi-coherent (Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}). Hence it has vanishing higher cohomology groups by Cohomology of Schemes, Lemma \ref{coherent-lemma-quasi-coherent-affine-cohomology-zero}. By the Leray spectral sequence Cohomology, Lemma \ref{cohomology-lemma-apply-Leray} we have $H^p(U, \mathcal{F}) = 0$ for all $p > 0$. Thus $U$ is affine, for example by Cohomology of Schemes, Lemma \ref{coherent-lemma-quasi-compact-h1-zero-covering}.
Let $X \setminus U = \{x_i; i \in I\}$. Choose affine opens $U_i \subset X$ with $x_i \in X$ and $x_j \not \in U_i$ for $j \not = i$. This is possible by condition (2). Say $U_i = \Spec(A_i)$. Let $\mathfrak m_i \subset A_i$ be the maximal ideal corresponding to $x_i$. By our assumption on the local rings there are only a finite number of prime ideals $\mathfrak q \subset \mathfrak m_i$, $\mathfrak q \not = \mathfrak m_i$ (see Algebra, Lemma \ref{algebra-lemma-Noetherian-irreducible-components}). Thus by prime avoidance (Algebra, Lemma \ref{algebra-lemma-silly}) we can find $f_i \in \mathfrak m_i$ not contained in any of those primes. Then $V(f_i) = \{\mathfrak m_i\} \amalg Z_i$ for some closed subset $Z_i \subset U_i$ because $Z_i$ is a retrocompact open subset of $V(f_i)$ closed under specialization, see Algebra, Lemma \ref{algebra-lemma-constructible-stable-specialization-closed}. After shrinking $U_i$ we may assume $V(f_i) = \{x_i\}$. Then $$ \mathcal{U} : X = U \cup \bigcup U_i $$ is an open covering of $X$. Consider the $2$-cocycle with values in $\mathcal{O}_X^*$ given by $f_i$ on $U \cap U_i$ and by $f_i/f_j$ on $U_i \cap U_j$. This defines a line bundle $\mathcal{L}$ such that the section $s$ defined by $1$ on $U$ and $f_i$ on $U_i$ is as in the statement of the lemma. \medskip\noindent Let $\mathcal{N}$ be an invertible $\mathcal{O}_U$-module. Let $N_i$ be the invertible $(A_i)_{f_i}$ module such that $\mathcal{N}|_{U \cap U_i}$ is equal to $\tilde N_i$. Observe that $(A_{\mathfrak m_i})_{f_i}$ is an Artinian ring (as a dimension zero Noetherian ring, see Algebra, Lemma \ref{algebra-lemma-Noetherian-dimension-0}). Thus it is a product of local rings (Algebra, Lemma \ref{algebra-lemma-artinian-finite-length}) and hence has trivial Picard group. Thus, after shrinking $U_i$ (i.e., after replacing $A_i$ by $(A_i)_g$ for some $g \in A_i$, $g \not \in \mathfrak m_i$) we can assume that $N_i = (A_i)_{f_i}$, i.e., that $\mathcal{N}|_{U \cap U_i}$ is trivial. In this case it is clear how to extend $\mathcal{N}$ to an invertible sheaf over $X$ (by extending it by a trivial invertible module over each $U_i$).
Say $U = \Spec(A)$ and let $K$ be the function field of $X$. Write $B_i = \mathcal{O}_{X, x_i}$ and $\mathfrak m_i = \mathfrak m_{x_i}$. Since $x_i \not \in U$ we see that the open $U \times_X \Spec(B_i)$ of $\Spec(B_i)$ has only one point, i.e., $U \times_X \Spec(B_i) = \Spec(K)$. Since $X$ is separated, we find that $\Spec(K)$ is a closed subscheme of $U \times \Spec(B_i)$, i.e., the map $A \otimes B_i \to K$ is a surjection. By Lemma \ref{lemma-create-globally-generated} we can find a nonzero $f \in A$ such that $f^{-1} \in \mathfrak m_i$ for $i = 1, \ldots, r$. Pick opens $x_i \in U_i \subset X$ such that $f^{-1} \in \mathcal{O}(U_i)$. Then $$ \mathcal{U} : X = U \cup \bigcup U_i $$ is an open covering of $X$. Consider the $2$-cocycle with values in $\mathcal{O}_X^*$ given by $f$ on $U \cap U_i$ and by $1$ on $U_i \cap U_j$. This defines a line bundle $\mathcal{L}$ with two sections: \begin{enumerate} \item a section $s$ defined by $1$ on $U$ and $f^{-1}$ on $U_i$ is as in the statement of the lemma, and \item a section $t$ defined by $f$ on $U$ and $1$ on $U_i$. \end{enumerate} Note that $X_t \supset U_1 \cup \ldots \cup U_r$. Hence $s, t$ generate $\mathcal{L}$ and the lemma is proved.
Since $X$ is quasi-compact we can find a finite collection $(\mathcal{L}_i, s_i)$, $i = 1, \ldots, n$ of pairs such that $X_{s_i}$ is affine and $X = \bigcup X_{s_i}$. Again because $X$ is quasi-compact we can find, for each $i$, a finite collection of sections $t_{i, j}$, $j = 1, \ldots, m_i$ such that $X = \bigcup X_{t_{i, j}}$. Set $t_{i, 0} = s_i$. Consider the invertible sheaf $$ \mathcal{L} = \mathcal{L}_1  \otimes_{\mathcal{O}_X} \ldots \otimes_{\mathcal{O}_X} \mathcal{L}_n $$ and the global sections $$ \tau_J = t_{1, j_1} \otimes \ldots \otimes t_{n, j_n} $$ By Properties, Lemma \ref{properties-lemma-affine-cap-s-open} the open $X_{\tau_J}$ is affine as soon as $j_i = 0$ for some $i$. It is a simple matter to see that these opens cover $X$. Hence $\mathcal{L}$ is ample by definition.
Choose an affine open covering $X = U_1 \cup \ldots \cup U_n$. Since $X$ is Noetherian, each of the sets $X \setminus U_i$ is finite. Thus by Lemma \ref{lemma-find-globally-generated} we can find a pair $(\mathcal{L}_i, s_i)$ consisting of a globally generated invertible sheaf $\mathcal{L}_i$ and a global section $s_i$ such that $U_i = X_{s_i}$. We conclude that $X$ has an ample invertible sheaf by Lemma \ref{lemma-enough-globally-generated-ample}.
We will use that $\Pic(X) = H^1(X, \mathcal{O}_X^*)$, see Cohomology, Lemma \ref{cohomology-lemma-h1-invertible}. Consider the Leray spectral sequence for the abelian sheaf $\mathcal{O}_X^*$ and $f$, see Cohomology, Lemma \ref{cohomology-lemma-Leray}. Consider the induced map $$ H^1(X, \mathcal{O}_X^*) \longrightarrow H^0(Y, R^1f_*\mathcal{O}_X^*) $$ Divisors, Lemma \ref{divisors-lemma-finite-trivialize-invertible-upstairs} says exactly that this map is zero. Hence Leray gives $H^1(X, \mathcal{O}_X^*) = H^1(Y, f_*\mathcal{O}_X^*)$. Next we consider the map $$ f^\sharp : \mathcal{O}_Y^* \longrightarrow f_*\mathcal{O}_X^* $$ By assumption the kernel and cokernel of this map are supported on the closed subset $T = Y \setminus V$ of $Y$. Since $T$ is a discrete topological space by assumption the higher cohomology groups of any abelian sheaf on $Y$ supported on $T$ is zero (follows from Cohomology, Lemma \ref{cohomology-lemma-cohomology-and-closed-immersions}, Modules, Lemma \ref{modules-lemma-i-star-exact}, and the fact that $H^i(T, \mathcal{F}) = 0$ for any $i > 0$ and any abelian sheaf $\mathcal{F}$ on $T$). Breaking the displayed map into short exact sequences $$ 0 \to \Ker(f^\sharp) \to \mathcal{O}_Y^* \to \Im(f^\sharp) \to 0,\quad 0 \to \Im(f^\sharp) \to f_*\mathcal{O}_X^* \to \Coker(f^\sharp) \to 0 $$ we first conclude that $H^1(Y, \mathcal{O}_Y^*) \to H^1(Y, \Im(f^\sharp))$ is surjective and then that $H^1(Y, \Im(f^\sharp)) \to H^1(Y, f_*\mathcal{O}_X^*)$ is surjective. Combining all the above we find that $H^1(Y, \mathcal{O}_Y^*) \to H^1(X, \mathcal{O}_X^*)$ is surjective as desired.
The existence of $\mathcal{L}$ can be deduced from Lemma \ref{lemma-surjective-pic-birational-finite} but we will also give a direct proof and we will use the direct proof to see the statement about sections is true. Set $T = \bigcup_{i \not = j} Z_i \cap Z_j$. As $X$ is reduced we have $$ X \setminus T = \bigcup (Z_i \setminus T) $$ as schemes. Assumption (3) implies $T$ is a discrete subset of $X$. Thus for each $t \in T$ we can find an open $U_t \subset X$ with $t \in U_t$ but $t' \not \in U_t$ for $t' \in T$, $t' \not = t$. By shrinking $U_t$ if necessary, we may assume that there exist isomorphisms $\varphi_{t, i} : \mathcal{L}_i|_{U_t \cap Z_i} \to \mathcal{O}_{U_t \cap Z_i}$. Furthermore, for each $i$ choose an open covering $$ Z_i \setminus T = \bigcup\nolimits_j U_{ij} $$ such that there exist isomorphisms $\varphi_{i, j} : \mathcal{L}_i|_{U_{ij}} \cong \mathcal{O}_{U_{ij}}$. Observe that $$ \mathcal{U} : X = \bigcup U_t \cup \bigcup U_{ij} $$ is an open covering of $X$. We claim that we can use the isomorphisms $\varphi_{t, i}$ and $\varphi_{i, j}$ to define a $2$-cocycle with values in $\mathcal{O}_X^*$ for this covering that defines $\mathcal{L}$ as in the statement of the lemma. \medskip\noindent Namely, if $i \not = i'$, then $U_{i, j} \cap U_{i', j'} = \emptyset$ and there is nothing to do. For $U_{i, j} \cap U_{i, j'}$ we have $\mathcal{O}_X(U_{i, j} \cap U_{i, j'}) = \mathcal{O}_{Z_i}(U_{i, j} \cap U_{i, j'})$ by the first remark of the proof. Thus the transition function for $\mathcal{L}_i$ (more precisely $\varphi_{i, j} \circ \varphi_{i, j'}^{-1}$) defines the value of our cocycle on this intersection. For $U_t \cap U_{i, j}$ we can do the same thing. Finally, for $t \not = t'$ we have $$ U_t \cap U_{t'} = \coprod (U_t \cap U_{t'}) \cap Z_i $$ and moreover the intersection $U_t \cap U_{t'} \cap Z_i$ is contained in $Z_i \setminus T$. Hence by the same reasoning as before we see that $$ \mathcal{O}_X(U_t \cap U_{t'}) = \prod \mathcal{O}_{Z_i}(U_t \cap U_{t'} \cap Z_i) $$ and we can use the transition functions for $\mathcal{L}_i$ (more precisely $\varphi_{t, i} \circ \varphi_{t', i}^{-1}$) to define the value of our cocycle on $U_t \cap U_{t'}$. This finishes the proof of existence of $\mathcal{L}$. \medskip\noindent Given sections $s_i$ as in the last assertion of the lemma, in the argument above, we choose $U_t$ such that $s_i|_{U_t \cap Z_i}$ is nonvanishing and we choose $\varphi_{t, i}$ such that $\varphi_{t, i}(s_i|_{U_t \cap Z_i}) = 1$. Then using $1$ over $U_t$ and $\varphi_{i, j}(s_i|_{U_{i, j}})$ over $U_{i, j}$ will define a section of $\mathcal{L}$ which restricts to $s_i$ over $Z_i$.
Let $Z_i$, $i = 1, \ldots, n$ be the irreducible components of $X$. We view these as reduced closed subschemes of $X$. By Lemma \ref{lemma-dim-1-noetherian-integral-separated-has-ample} there exist ample invertible sheaves $\mathcal{L}_i$ on $Z_i$. Set $T = \bigcup_{i \not = j} Z_i \cap Z_j$. As $X$ is Noetherian of dimension $1$, the set $T$ is finite and consists of closed points of $X$. For each $i$ we may, possibly after replacing $\mathcal{L}_i$ by a power, choose $s_i \in \Gamma(Z_i, \mathcal{L}_i)$ such that $(Z_i)_{s_i}$ is affine and contains $T \cap Z_i$, see Properties, Lemma \ref{properties-lemma-ample-finite-set-in-principal-affine}. \medskip\noindent By Lemma \ref{lemma-glue-invertible-sheaves} we can find an invertible sheaf $\mathcal{L}$ on $X$ and $s \in \Gamma(X, \mathcal{L})$ such that $(\mathcal{L}, s)|_{Z_i} = (\mathcal{L}_i, s_i)$. Observe that $X_s$ contains $T$ and is set theoretically equal to the affine closed subschemes $(Z_i)_{s_i}$. Thus it is affine by Limits, Lemma \ref{limits-lemma-affines-glued-in-closed-affine}. To finish the proof, it suffices to find for every $x \in X$, $x \not \in T$ an integer $m > 0$ and a section $t \in \Gamma(X, \mathcal{L}^{\otimes m})$ such that $X_t$ is affine and $x \in X_t$. Since $x \not \in T$ we see that $x \in Z_i$ for some unique $i$, say $i = 1$. Let $Z \subset X$ be the reduced closed subscheme whose underlying topological space is $Z_2 \cup \ldots \cup Z_n$. Let $\mathcal{I} \subset \mathcal{O}_X$ be the ideal sheaf of $Z$. Denote that $\mathcal{I}_1 \subset \mathcal{O}_{Z_1}$ the inverse image of this ideal sheaf under the inclusion morphism $Z_1 \to X$. Observe that $$ \Gamma(X, \mathcal{I}\mathcal{L}^{\otimes m}) = \Gamma(Z_1, \mathcal{I}_1 \mathcal{L}_1^{\otimes m}) $$ see Remark \ref{remark-conductor}. Thus it suffices to find $m > 0$ and $t \in \Gamma(Z_1, \mathcal{I}_1 \mathcal{L}_1^{\otimes m})$ with $x \in (Z_1)_t$ affine. Since $\mathcal{L}_1$ is ample and since $x$ is not in $Z_1 \cap T = V(\mathcal{I}_1)$ we can find a section $t_1 \in \Gamma(Z_1, \mathcal{I}_1 \mathcal{L}_1^{\otimes m_1})$ with $x \in (Z_1)_{t_1}$, see Properties, Proposition \ref{properties-proposition-characterize-ample}. Since $\mathcal{L}_1$ is ample we can find a section $t_2 \in \Gamma(Z_1, \mathcal{L}_1^{\otimes m_2})$ with $x \in (Z_1)_{t_2}$ and $(Z_1)_{t_2}$ affine, see Properties, Definition \ref{properties-definition-ample}. Set $m = m_1 + m_2$ and $t = t_1 t_2$. Then $t \in \Gamma(Z_1, \mathcal{I}_1 \mathcal{L}_1^{\otimes m})$ with $x \in (Z_1)_t$ by construction and $(Z_1)_t$ is affine by Properties, Lemma \ref{properties-lemma-affine-cap-s-open}.
Consider the short exact sequence $$ 0 \to (1 + \mathcal{I}) \cap \mathcal{O}_X^* \to \mathcal{O}^*_X \to i_*\mathcal{O}^*_Z \to 0 $$ of sheaves of abelian groups on $X$ where $\mathcal{I}$ is the quasi-coherent sheaf of ideals corresponding to $Z$. Since $\dim(X) \leq 1$ we see that $H^2(X, \mathcal{F}) = 0$ for any abelian sheaf $\mathcal{F}$, see Cohomology, Proposition \ref{cohomology-proposition-vanishing-Noetherian}. Hence the map $H^1(X, \mathcal{O}^*_X) \to H^1(X, i_*\mathcal{O}_Z^*)$ is surjective. By Cohomology, Lemma \ref{cohomology-lemma-cohomology-and-closed-immersions} we have $H^1(X, i_*\mathcal{O}_Z^*) = H^1(Z, \mathcal{O}_Z^*)$. This proves the lemma by Cohomology, Lemma \ref{cohomology-lemma-h1-invertible}.
We factor $f$ as $X \to Z \to Y$ where $Z$ is the scheme theoretic image of $f$. Then $X \to Z$ is an isomorphism over $V \cap Z$ and Lemma \ref{lemma-surjective-pic-birational-finite} applies. On the other hand, Lemma \ref{lemma-lift-line-bundle-from-reduction-dimension-1} applies to $Z \to Y$. Some details omitted.