hcju/stacksqa huggingface dataset:
First we write $\mathcal{A} = \colim_i \mathcal{F}_i$ as a directed colimit of finitely presented quasi-coherent sheaves as in Lemma \ref{lemma-directed-colimit-finite-presentation}. For each $i$ let $\mathcal{B}_i = \text{Sym}(\mathcal{F}_i)$ be the symmetric algebra on $\mathcal{F}_i$ over $\mathcal{O}_X$. Write $\mathcal{I}_i = \Ker(\mathcal{B}_i \to \mathcal{A})$. Write $\mathcal{I}_i = \colim_j \mathcal{F}_{i, j}$ where $\mathcal{F}_{i, j}$ is a finite type quasi-coherent submodule of $\mathcal{I}_i$, see Lemma \ref{lemma-quasi-coherent-colimit-finite-type}. Set $\mathcal{I}_{i, j} \subset \mathcal{I}_i$ equal to the $\mathcal{B}_i$-ideal generated by $\mathcal{F}_{i, j}$. Set $\mathcal{A}_{i, j} = \mathcal{B}_i/\mathcal{I}_{i, j}$. Then $\mathcal{A}_{i, j}$ is a quasi-coherent finitely presented $\mathcal{O}_X$-algebra. Define $(i, j) \leq (i', j')$ if $i \leq i'$ and the map $\mathcal{B}_i \to \mathcal{B}_{i'}$ maps the ideal $\mathcal{I}_{i, j}$ into the ideal $\mathcal{I}_{i', j'}$. Then it is clear that $\mathcal{A} = \colim_{i, j} \mathcal{A}_{i, j}$.
If $\mathcal{A}_1, \mathcal{A}_2 \subset \mathcal{F}$ are quasi-coherent $\mathcal{O}_X$-subalgebras of finite type, then the image of $\mathcal{A}_1 \otimes_{\mathcal{O}_X} \mathcal{A}_2 \to \mathcal{A}$ is also a quasi-coherent $\mathcal{O}_X$-subalgebra of finite type (some details omitted) which contains both $\mathcal{A}_1$ and $\mathcal{A}_2$. In this way we see that the system is directed. To show that $\mathcal{A}$ is the colimit of this system, write $\mathcal{A} = \colim_i \mathcal{A}_i$ as a directed colimit of finitely presented quasi-coherent $\mathcal{O}_X$-algebras as in Lemma \ref{lemma-algebra-directed-colimit-finite-presentation}. Then the images $\mathcal{A}'_i = \Im(\mathcal{A}_i \to \mathcal{A})$ are quasi-coherent subalgebras of $\mathcal{A}$ of finite type. Since $\mathcal{A}$ is the colimit of these the result follows.
By Lemma \ref{lemma-finite-directed-colimit-surjective-maps} there exists a finitely presented $\mathcal{O}_X$-module $\mathcal{F}$ and a surjection $\mathcal{F} \to \mathcal{A}$. Using the algebra structure we obtain a surjection $$ \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}) \longrightarrow \mathcal{A} $$ Denote $\mathcal{J}$ the kernel. Write $\mathcal{J} = \colim \mathcal{E}_i$ as a filtered colimit of finite type $\mathcal{O}_X$-submodules $\mathcal{E}_i$ (Lemma \ref{lemma-quasi-coherent-colimit-finite-type}). Set $$ \mathcal{A}_i = \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F})/(\mathcal{E}_i) $$ where $(\mathcal{E}_i)$ indicates the ideal sheaf generated by the image of $\mathcal{E}_i \to \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F})$. Then each $\mathcal{A}_i$ is a finitely presented $\mathcal{O}_X$-algebra, the transition maps are surjections, and $\mathcal{A} = \colim \mathcal{A}_i$. To finish the proof we still have to show that $\mathcal{A}_i$ is a finite $\mathcal{O}_X$-algebra for $i$ sufficiently large. To do this we choose an affine open covering $X = U_1 \cup \ldots \cup U_m$. Take generators $f_{j, 1}, \ldots, f_{j, N_j} \in \Gamma(U_i, \mathcal{F})$. As $\mathcal{A}(U_j)$ is a finite $\mathcal{O}_X(U_j)$-algebra we see that for each $k$ there exists a monic polynomial $P_{j, k} \in \mathcal{O}(U_j)[T]$ such that $P_{j, k}(f_{j, k})$ is zero in $\mathcal{A}(U_j)$. Since $\mathcal{A} = \colim \mathcal{A}_i$ by construction, we have $P_{j, k}(f_{j, k}) = 0$ in $\mathcal{A}_i(U_j)$ for all sufficiently large $i$. For such $i$ the algebras $\mathcal{A}_i$ are finite.
By Lemma \ref{lemma-algebra-directed-colimit-finite-type} we have $\mathcal{A} = \colim \mathcal{A}_i$ where $\mathcal{A}_i \subset \mathcal{A}$ runs through the quasi-coherent $\mathcal{O}_X$-algebras of finite type. Any finite type quasi-coherent $\mathcal{O}_X$-subalgebra of $\mathcal{A}$ is finite (apply Algebra, Lemma \ref{algebra-lemma-characterize-finite-in-terms-of-integral} to $\mathcal{A}_i(U) \subset \mathcal{A}(U)$ for affine opens $U$ in $X$). This proves (1). \medskip\noindent To prove (2), write $\mathcal{A} = \colim \mathcal{F}_i$ as a colimit of finitely presented $\mathcal{O}_X$-modules using Lemma \ref{lemma-directed-colimit-finite-presentation}. For each $i$, let $\mathcal{J}_i$ be the kernel of the map $$ \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}_i) \longrightarrow \mathcal{A} $$ For $i' \geq i$ there is an induced map $\mathcal{J}_i \to \mathcal{J}_{i'}$ and we have $\mathcal{A} = \colim \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}_i)/\mathcal{J}_i$. Moreover, the quasi-coherent $\mathcal{O}_X$-algebras $\text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}_i)/\mathcal{J}_i$ are finite (see above). Write $\mathcal{J}_i = \colim \mathcal{E}_{ik}$ as a colimit of finitely presented $\mathcal{O}_X$-modules. Given $i' \geq i$ and $k$ there exists a $k'$ such that we have a map $\mathcal{E}_{ik} \to \mathcal{E}_{i'k'}$ making $$ \xymatrix{ \mathcal{J}_i \ar[r] & \mathcal{J}_{i'} \\ \mathcal{E}_{ik} \ar[u] \ar[r] & \mathcal{E}_{i'k'} \ar[u] } $$ commute. This follows from Modules, Lemma \ref{modules-lemma-finite-presentation-quasi-compact-colimit}. This induces a map $$ \mathcal{A}_{ik} = \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}_i)/(\mathcal{E}_{ik}) \longrightarrow \text{Sym}^*_{\mathcal{O}_X}(\mathcal{F}_{i'})/(\mathcal{E}_{i'k'}) = \mathcal{A}_{i'k'} $$ where $(\mathcal{E}_{ik})$ denotes the ideal generated by $\mathcal{E}_{ik}$. The quasi-coherent $\mathcal{O}_X$-algebras $\mathcal{A}_{ki}$ are of finite presentation and finite for $k$ large enough (see proof of Lemma \ref{lemma-finite-algebra-directed-colimit-finite-finitely-presented}). Finally, we have $$ \colim \mathcal{A}_{ik} = \colim \mathcal{A}_i = \mathcal{A} $$ Namely, the first equality was shown in the proof of Lemma \ref{lemma-finite-algebra-directed-colimit-finite-finitely-presented} and the second equality because $\mathcal{A}$ is the colimit of the modules $\mathcal{F}_i$.
Choose an affine open covering $X = \bigcup_{i \in I} U_i$. For each pair $i, j$ choose an affine open covering $U_i \cap U_j = \bigcup_{k \in I_{ij}} U_{ijk}$. Write $U_i = \Spec(A_i)$ and $U_{ijk} = \Spec(A_{ijk})$. Let $\kappa$ be any infinite cardinal $\geq$ than the cardinality of any of the sets $I$, $I_{ij}$. \medskip\noindent Let $\mathcal{F}$ be a quasi-coherent sheaf. Set $M_i = \mathcal{F}(U_i)$ and $M_{ijk} = \mathcal{F}(U_{ijk})$. Note that $$ M_i \otimes_{A_i} A_{ijk} = M_{ijk} = M_j \otimes_{A_j} A_{ijk}. $$ see Schemes, Lemma \ref{schemes-lemma-widetilde-pullback}. Using the axiom of choice we choose a map $$ (i, j, k, m) \mapsto S(i, j, k, m) $$ which associates to every $i, j \in I$, $k \in I_{ij}$ and $m \in M_i$ a finite subset $S(i, j, k, m) \subset M_j$ such that we have $$ m \otimes 1 = \sum\nolimits_{m' \in S(i, j, k, m)} m' \otimes a_{m'} $$ in $M_{ijk}$ for some $a_{m'} \in A_{ijk}$. Moreover, let's agree that $S(i, i, k, m) = \{m\}$ for all $i, j = i, k, m$ as above. Fix such a map. \medskip\noindent Given a family $\mathcal{S} = (S_i)_{i \in I}$ of subsets $S_i \subset M_i$ of cardinality at most $\kappa$ we set $\mathcal{S}' = (S'_i)$ where $$ S'_j = \bigcup\nolimits_{(i, j, k, m)\text{ such that }m \in S_i} S(i, j, k, m) $$ Note that $S_i \subset S'_i$. Note that $S'_i$ has cardinality at most $\kappa$ because it is a union over a set of cardinality at most $\kappa$ of finite sets. Set $\mathcal{S}^{(0)} = \mathcal{S}$, $\mathcal{S}^{(1)} = \mathcal{S}'$ and by induction $\mathcal{S}^{(n + 1)} = (\mathcal{S}^{(n)})'$. Then set $\mathcal{S}^{(\infty)} = \bigcup_{n \geq 0} \mathcal{S}^{(n)}$. Writing $\mathcal{S}^{(\infty)} = (S^{(\infty)}_i)$ we see that for any element $m \in S^{(\infty)}_i$ the image of $m$ in $M_{ijk}$ can be written as a finite sum $\sum m' \otimes a_{m'}$ with $m' \in S_j^{(\infty)}$. In this way we see that setting $$ N_i = A_i\text{-submodule of }M_i\text{ generated by }S^{(\infty)}_i $$ we have $$ N_i \otimes_{A_i} A_{ijk} = N_j \otimes_{A_j} A_{ijk}. $$ as submodules of $M_{ijk}$. Thus there exists a quasi-coherent subsheaf $\mathcal{G} \subset \mathcal{F}$ with $\mathcal{G}(U_i) = N_i$. Moreover, by construction the sheaf $\mathcal{G}$ is $\kappa$-generated. \medskip\noindent Let $\{\mathcal{G}_t\}_{t \in T}$ be the set of $\kappa$-generated quasi-coherent subsheaves. If $t, t' \in T$ then $\mathcal{G}_t + \mathcal{G}_{t'}$ is also a $\kappa$-generated quasi-coherent subsheaf as it is the image of the map $\mathcal{G}_t \oplus \mathcal{G}_{t'} \to \mathcal{F}$. Hence the system (ordered by inclusion) is directed. The arguments above show that every section of $\mathcal{F}$ over $U_i$ is in one of the $\mathcal{G}_t$ (because we can start with $\mathcal{S}$ such that the given section is an element of $S_i$). Hence $\colim_t \mathcal{G}_t \to \mathcal{F}$ is both injective and surjective as desired.
The equivalence of (1), (2), and (3) follows from Lemma \ref{lemma-quasi-separated-quasi-compact-open-retrocompact}. Assume (1), (2), (3). Let $T = X \setminus U$. By Schemes, Lemma \ref{schemes-lemma-reduced-closed-subscheme} there exists a unique quasi-coherent sheaf of ideals $\mathcal{J}$ cutting out the reduced induced closed subscheme structure on $T$. Note that $\mathcal{J}|_U = \mathcal{O}_U$ which is an $\mathcal{O}_U$-modules of finite type. By Lemma \ref{lemma-extend} there exists a quasi-coherent subsheaf $\mathcal{I} \subset \mathcal{J}$ which is of finite type and has the property that $\mathcal{I}|_U = \mathcal{J}|_U$. Then $X \setminus U = V(\mathcal{I})$ and we obtain (4). Conversely, if $\mathcal{I}$ is as in (4) and $W = \Spec(R) \subset X$ is an affine open, then $\mathcal{I}|_W = \widetilde{I}$ for some finitely generated ideal $I \subset R$, see Lemma \ref{lemma-finite-type-module}. It follows that $U \cap W = \Spec(R) \setminus V(I)$ is quasi-compact, see Algebra, Lemma \ref{algebra-lemma-qc-open}. Hence $U \subset X$ is retrocompact by Lemma \ref{lemma-retrocompact}.
It is clear that the rule defining $\mathcal{F}'$ gives a subsheaf of $\mathcal{F}$ (the sheaf condition is easy to verify). Hence we may work locally on $X$ to verify the other statements. In other words we may assume that $X = \Spec(A)$, $\mathcal{F} = \widetilde{M}$ and $\mathcal{I} = \widetilde{I}$. It is clear that in this case $\mathcal{F}'(U) = \{x \in M \mid Ix = 0\} =: M'$ because $\widetilde{I}$ is generated by its global sections $I$ which proves (2). To show $\mathcal{F}'$ is quasi-coherent it suffices to show that for every $f \in A$ we have $\{x \in M_f \mid I_f x = 0\} = (M')_f$. Write $I = (g_1, \ldots, g_t)$, which is possible because $\mathcal{I}$ is of finite type, see Lemma \ref{lemma-finite-type-module}. If $x = y/f^n$ and $I_fx = 0$, then that means that for every $i$ there exists an $m \geq 0$ such that $f^mg_ix = 0$. We may choose one $m$ which works for all $i$ (and this is where we use that $I$ is finitely generated). Then we see that $f^mx \in M'$ and $x/f^n = f^mx/f^{n + m}$ in $(M')_f$ as desired. The proof of (3) is similar and omitted.
Part (1) is Algebra, Lemma \ref{algebra-lemma-qc-open}. Let $U = \Spec(A)$ and $I$ be as in (1). Then $\mathcal{F}|_U$ is the quasi-coherent sheaf associated to some $A$-module $M$. We have $$ \mathcal{F}'(U) = \{x \in M \mid x = 0\text{ in }M_\mathfrak p \text{ for all }\mathfrak p \not \in Z\}. $$ by Modules, Definition \ref{modules-definition-support}. Thus $x \in \mathcal{F}'(U)$ if and only if $V(\text{Ann}(x)) \subset V(I)$, see Algebra, Lemma \ref{algebra-lemma-support-element}. Since $I$ is finitely generated this is equivalent to $I^n x = 0$ for some $n$. This proves (2). \medskip\noindent Proof of (3). Observe that given $U \subset X$ open there is an exact sequence $$ 0 \to \mathcal{F}'(U) \to \mathcal{F}(U) \to \mathcal{F}(U \setminus Z) $$ If we denote $j : X \setminus Z \to X$ the inclusion morphism, then we observe that $\mathcal{F}(U \setminus Z)$ is the sections of the module $j_*(\mathcal{F}|_{X \setminus Z})$ over $U$. Thus we have an exact sequence $$ 0 \to \mathcal{F}' \to \mathcal{F} \to j_*(\mathcal{F}|_{X \setminus Z}) $$ The restriction $\mathcal{F}|_{X \setminus Z}$ is quasi-coherent. Hence $j_*(\mathcal{F}|_{X \setminus Z})$ is quasi-coherent by Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent} and our assumption that $j$ is quasi-compact (any open immersion is separated). Hence $\mathcal{F}'$ is quasi-coherent as a kernel of a map of quasi-coherent modules, see Schemes, Section \ref{schemes-section-quasi-coherent}.
Omitted. (Hint: First show that $X \setminus f^{-1}Z$ is retrocompact in $X$ as $Y \setminus Z$ is retrocompact in $Y$. Hence Lemma \ref{lemma-sections-supported-on-closed-subset} applies to $f^{-1}Z$ and $\mathcal{F}$. As $f$ is quasi-compact and quasi-separated we see that $f_*\mathcal{F}$ is quasi-coherent. Hence Lemma \ref{lemma-sections-supported-on-closed-subset} applies to $Z$ and $f_*\mathcal{F}$. Finally, match the sheaves directly.)
Let $\Spec(A) = W \subset X$ be an affine open. Write $\mathcal{F}|_W = \widetilde{M}$ for some $A$-module $M$ and $\mathcal{I}|_W = \widetilde{I}$ for some finite type ideal $I \subset A$. Restricting the first displayed map of the lemma to $W$ we obtain the first displayed map of Lemma \ref{lemma-sections-over-quasi-compact-open-in-affine}. Since we can cover $X$ by a finite number of affine opens this proves the first displayed map of the lemma is injective. \medskip\noindent We have $\mathcal{F}_n|_W = \widetilde{M_n}$ where $M_n \subset M$ is defined as in Lemma \ref{lemma-sections-over-quasi-compact-open-in-affine} (details omitted). The lemma guarantees that we have a bijection $$ \colim_n  \Hom_{\mathcal{O}_W}( \mathcal{I}^n|_W, (\mathcal{F}/\mathcal{F}_n)|_W) \longrightarrow \Gamma(U \cap W, \mathcal{F}) $$ for any such affine open $W$. \medskip\noindent To see the second displayed arrow of the lemma is bijective, we choose a finite affine open covering $X = \bigcup_{j = 1, \ldots, m} W_j$. The injectivity follows immediately from the above and the finiteness of the covering. If $X$ is quasi-separated, then for each pair $j, j'$ we choose a finite affine open covering $$ W_j \cap W_{j'} = \bigcup\nolimits_{k = 1, \ldots, m_{jj'}} W_{jj'k}. $$ Let $s \in \Gamma(U, \mathcal{F})$. As seen above for each $j$ there exists an $n_j$ and a map $\varphi_j : \mathcal{I}^{n_j}|_{W_j} \to (\mathcal{F}/\mathcal{F}_{n_j})|_{W_j}$ which corresponds to $s|_{W_j}$. By the same token for each triple $(j, j', k)$ there exists an integer $n_{jj'k}$ such that the restriction of $\varphi_j$ and $\varphi_{j'}$ as maps $\mathcal{I}^{n_{jj'k}} \to \mathcal{F}/\mathcal{F}_{n_{jj'k}}$ agree over $W_{jj'l}$. Let $n = \max\{n_j, n_{jj'k}\}$ and we see that the $\varphi_j$ glue as maps $\mathcal{I}^n \to \mathcal{F}/\mathcal{F}_n$ over $X$. This proves surjectivity of the map.
We check the conditions of Definition \ref{definition-ample}. As $\mathcal{L}$ is ample we see that $X$ is quasi-compact. Let $x \in X$. Choose $n \geq 1$, $m \geq 1$, $s \in \Gamma(X, \mathcal{L}^{\otimes n})$, and $t \in \Gamma(X, \mathcal{M}^{\otimes m})$ such that $x \in X_s$, $x \in X_t$ and $X_s$ is affine. Then $s^mt^n \in \Gamma(X, (\mathcal{L} \otimes \mathcal{M})^{\otimes nm})$, $x \in X_{s^mt^n}$, and $X_{s^mt^n}$ is affine by Lemma \ref{lemma-affine-cap-s-open}.
Let $x \in X$. Choose an affine open neighbourhood $\Spec(R) = U \subset X$ of $x$. By assumption, there exists a $n \geq 1$ and a $s \in \Gamma(X, \mathcal{L}^{\otimes n})$ such that $X_s \subset U$. By Lemma \ref{lemma-affine-cap-s-open} above the intersection $X_s = U \cap X_s$ is affine. Since $U$ can be chosen arbitrarily small we win.
We show first that $X$ is quasi-separated.  By assumption we can find a covering of $X$ by affine opens of the form $X_s$.  By Lemma \ref{lemma-affine-cap-s-open}, the intersection of any two such sets is affine, so Schemes, Lemma \ref{schemes-lemma-characterize-quasi-separated} implies that $X$ is quasi-separated. \medskip\noindent To show that $X$ is separated, we can use the valuative criterion, Schemes, Lemma \ref{schemes-lemma-valuative-criterion-separatedness}. Thus, let $A$ be a valuation ring with fraction field $K$ and consider two morphisms $f, g : \Spec(A) \to X$ such that the two compositions $\Spec(K) \to \Spec(A) \to X$ agree. As $A$ is local, there exists $p, q \ge 1$, $s \in \Gamma(X, \mathcal{L}^{\otimes p})$, and $t \in \Gamma(X, \mathcal{L}^{\otimes q})$ such that $X_s$ and $X_t$ are affine, $f(\Spec A) \subseteq X_s$, and $g(\Spec A) \subseteq X_t$.  We now replace $s$ by $s^q$, $t$ by $t^p$, and $\mathcal{L}$ by $\mathcal{L}^{\otimes pq}$.  This is harmless as $X_s = X_{s^q}$ and $X_t = X_{t^p}$, and now $s$ and $t$ are both sections of the same sheaf $\mathcal{L}$. \medskip\noindent The quasi-coherent module $f^*\mathcal{L}$ corresponds to an $A$-module $M$ and $g^*\mathcal{L}$ corresponds to an $A$-module $N$ by our classification of quasi-coherent modules over affine schemes (Schemes, Lemma \ref{schemes-lemma-quasi-coherent-affine}). The $A$-modules $M$ and $N$ are locally free of rank $1$ (Lemma \ref{lemma-locally-free-module}) and as $A$ is local they are free (Algebra, Lemma \ref{algebra-lemma-K0-local}).  Therefore we may identify $M$ and $N$ with $A$-submodules of $M \otimes_A K$ and $N \otimes_A K$.  The equality $f|_{\Spec(K)} = g|_{\Spec(K)}$ determines an isomorphism $\phi \colon M \otimes_A K \to N \otimes_A K$. \medskip\noindent Let $x \in M$ and $y \in N$ be the elements corresponding to the pullback of $s$ along $f$ and $g$, respectively.  These satisfy $\phi(x \otimes 1) = y \otimes 1$.  The image of $f$ is contained in $X_s$, so $x \not\in \mathfrak{m}_A M$, that is, $x$ generates $M$.  Hence $\phi$ determines an isomorphism of $M$ with the submodule of $N$ generated by $y$.  Arguing symmetrically using $t$, $\phi^{-1}$ determines an isomorphism of $N$ with a submodule of $M$. Consequently $\phi$ restricts to an isomorphism of $M$ and $N$.  Since $x$ generates $M$, its image $y$ generates $N$, implying $y \not\in \mathfrak{m}_A N$.  Therefore $g(\Spec(A)) \subseteq X_s$.  Because $X_s$ is affine, it is separated by Schemes, Lemma \ref{schemes-lemma-affine-separated}, and we conclude $f = g$.
Denote $\psi : S \to \Gamma_*(X, \mathcal{L})$ the identity map. We are going to use the triple $(U(\psi), r_{\mathcal{L}, \psi}, \theta)$ of Constructions, Lemma \ref{constructions-lemma-invertible-map-into-proj}. By assumption the open subscheme $U(\psi)$ of equals $X$. Hence $r_{\mathcal{L}, \psi} : U(\psi) \to Y$ is defined on all of $X$. We set $f = r_{\mathcal{L}, \psi}$. The maps in part (2) are the components of $\theta$. Part (3) follows from condition (2) in the lemma cited above. Part (1) follows from (3) combined with condition (1) in the lemma cited above. Part (4) follows from the last statement in Constructions, Lemma \ref{constructions-lemma-invertible-map-into-proj} since the map $\alpha$ mentioned there is an isomorphism.
To prove $f$ is quasi-compact it suffices to show that $f^{-1}(D_{+}(s))$ is quasi-compact for any $s \in S_{+}$ homogeneous. Write $X = \bigcup_{i = 1, \ldots, n} X_i$ as a finite union of affine opens. By Lemma \ref{lemma-affine-cap-s-open} each intersection $X_s \cap X_i$ is affine. Hence $X_s = \bigcup_{i = 1, \ldots, n} X_s \cap X_i$ is quasi-compact. Assume that the image of $f$ is not dense to get a contradiction. Then, since the opens $D_+(s)$ with $s \in S_+$ homogeneous form a basis for the topology on $\text{Proj}(S)$, we can find such an $s$ with $D_+(s) \not = \emptyset$ and $f(X) \cap D_+(s) = \emptyset$. By Lemma \ref{lemma-map-into-proj} this means $X_s = \emptyset$. By Lemma \ref{lemma-invert-s-sections} this means that a power $s^n$ is the zero section of $\mathcal{L}^{\otimes n\deg(s)}$. This in turn means that $D_+(s) = \emptyset$ which is the desired contradiction.
By Lemma \ref{lemma-affine-s-opens-cover-quasi-separated} we see that $X$ is quasi-separated. Choose finitely many $s_1, \ldots, s_n \in S_{+}$ homogeneous such that $X_{s_i}$ are affine, and $X = \bigcup X_{s_i}$. Say $s_i$ has degree $d_i$. The inverse image of $D_{+}(s_i)$ under $f$ is $X_{s_i}$, see Lemma \ref{lemma-map-into-proj}. By Lemma \ref{lemma-invert-s-sections} the ring map $$ (S^{(d_i)})_{(s_i)} = \Gamma(D_{+}(s_i), \mathcal{O}_{\text{Proj}(S)}) \longrightarrow \Gamma(X_{s_i}, \mathcal{O}_X) $$ is an isomorphism. Hence $f$ induces an isomorphism $X_{s_i} \to D_{+}(s_i)$. Thus $f$ is an isomorphism of $X$ onto the open subscheme $\bigcup_{i = 1, \ldots, n} D_{+}(s_i)$ of $\text{Proj}(S)$. The image is dense by Lemma \ref{lemma-map-into-proj-quasi-compact}.
Observe that in cases (1) and (3) the scheme $X'$ is quasi-compact as $X$ is quasi-compact by Definition \ref{definition-ample}. Thus it suffices to prove (2) and (4). Since (2) is a special case of (4) it suffices to prove (4). \medskip\noindent Assume condition (4) holds. For $s \in \Gamma(X, \mathcal{L}^{\otimes d})$ denote $s' = i^*s$ the pullback of $s$ to $X'$. Note that $s'$ is a section of $(i^*\mathcal{L})^{\otimes d}$. By Proposition \ref{proposition-characterize-ample} the opens $X_s$, for $s \in \Gamma(X, \mathcal{L}^{\otimes d})$, form a basis for the topology on $X$. Since $X'_{s'} = i^{-1}(X_s)$ and since $X' \to i(X')$ is a homeomorphism, we conclude the opens $X'_{s'}$ form a basis for the topology of $X'$. Hence $i^*\mathcal{L}$ is ample by Proposition \ref{proposition-characterize-ample}.
The morphism $i : X \times_S Y \to X \times Y$ is a quasi-compact immersion, see Schemes, Lemma \ref{schemes-lemma-fibre-product-after-map}. On the other hand, $\mathcal{M}$ is the pullback by $i$ of the corresponding invertible module on $X \times Y$. By Lemma \ref{lemma-ample-on-locally-closed} it suffices to prove the lemma for $X \times Y$. We check (1) and (2) of Definition \ref{definition-ample} for $\mathcal{M}$ on $X \times Y$. \medskip\noindent Since $X$ and $Y$ are quasi-compact, so is $X \times Y$. Let $z \in X \times Y$ be a point. Let $x \in X$ and $y \in Y$ be the projections. Choose $n > 0$ and $s \in \Gamma(X, \mathcal{L}^{\otimes n})$ such that $X_s$ is an affine open neighbourhood of $x$. Choose $m > 0$ and $t \in \Gamma(Y, \mathcal{N}^{\otimes m})$ such that $Y_t$ is an affine open neighbourhood of $y$. Then $r = \text{pr}_1^*s \otimes \text{pr}_2^*t$ is a section of $\mathcal{M}$ with $(X \times Y)_r = X_s \times Y_t$. This is an affine open neighbourhood of $z$ and the proof is complete.
Suppose that $X$ is quasi-affine. Set $A = \Gamma(X, \mathcal{O}_X)$. Consider the open immersion $$ j : X \longrightarrow \Spec(A) $$ from Lemma \ref{lemma-quasi-affine}. Note that $\Spec(A) = \text{Proj}(A[T])$, see Constructions, Example \ref{constructions-example-trivial-proj}. Hence we can apply Lemma \ref{lemma-open-in-proj-ample} to deduce that $\mathcal{O}_X$ is ample. \medskip\noindent Suppose that $\mathcal{O}_X$ is ample. Note that $\Gamma_*(X, \mathcal{O}_X) \cong A[T]$ as graded rings. Hence the result follows from Lemmas \ref{lemma-ample-immersion-into-proj} and \ref{lemma-quasi-affine} taking into account that $\Spec(A) = \text{Proj}(A[T])$ for any ring $A$ as seen above.
This can be proved directly without making use of the material on ample invertible sheaves; we urge the reader to do this on a napkin. Since $X$ is quasi-affine, we have that $\mathcal{O}_X$ is ample by Lemma \ref{lemma-quasi-affine-O-ample}. Then $\mathcal{O}_{X'}$ is ample by Lemma \ref{lemma-ample-on-locally-closed}. Then $X'$ is quasi-affine by Lemma \ref{lemma-quasi-affine-O-ample}.
Assume we have $f_1, \ldots, f_n$ as in the lemma. We may write $1 = \sum g_i f_i$ for some $g_j \in \Gamma(X, \mathcal{O}_X)$ and hence it is clear that $X = \bigcup X_{f_i}$. (The $f_i$'s cannot all vanish at a point.) Since each $X_{f_i}$ is quasi-compact (being affine) it follows that $X$ is quasi-compact. Hence we see that $X$ is quasi-affine by Lemma \ref{lemma-quasi-affine-O-ample} above. Consider the open immersion $$ j : X \to \Spec(\Gamma(X, \mathcal{O}_X)), $$ see Lemma \ref{lemma-quasi-affine}. The inverse image of the standard open $D(f_i)$ on the right hand side is equal to $X_{f_i}$ on the left hand side and the morphism $j$ induces an isomorphism $X_{f_i} \cong D(f_i)$, see Lemma \ref{lemma-invert-f-affine}. Since the $f_i$ generate the unit ideal we see that $\Spec(\Gamma(X, \mathcal{O}_X)) = \bigcup_{i = 1, \ldots, n} D(f_i)$. Thus $j$ is an isomorphism.