# The Stacks Project

## Tag 0BCQ

### 30.16. Complements of affine opens

In this section we discuss the result that the complement of an affine open in a variety has pure codimension $1$.

Lemma 30.16.1. Let $(A, \mathfrak m)$ be a Noetherian local ring. The punctured spectrum $U = \mathop{\mathrm{Spec}}(A) \setminus \{\mathfrak m\}$ of $A$ is affine if and only if $\dim(A) \leq 1$.

Proof. If $\dim(A) = 0$, then $U$ is empty hence affine (equal to the spectrum of the $0$ ring). If $\dim(A) = 1$, then we can choose an element $f \in \mathfrak m$ not contained in any of the finite number of minimal primes of $A$ (Algebra, Lemmas 10.30.6 and 10.14.2). Then $U = \mathop{\mathrm{Spec}}(A_f)$ is affine.

The converse is more interesting. We will give a somewhat nonstandard proof and discuss the standard argument in a remark below. Assume $U = \mathop{\mathrm{Spec}}(B)$ is affine. Since affineness and dimension are not affecting by going to the reduction we may replace $A$ by the quotient by its ideal of nilpotent elements and assume $A$ is reduced. Set $Q = B/A$ viewed as an $A$-module. The support of $Q$ is $\{\mathfrak m\}$ as $A_\mathfrak p = B_\mathfrak p$ for all nonmaximal primes $\mathfrak p$ of $A$. We may assume $\dim(A) \geq 1$, hence as above we can pick $f \in \mathfrak m$ not contained in any of the minimal ideals of $A$. Since $A$ is reduced this implies that $f$ is a nonzerodivisor. In particular $\dim(A/fA) = \dim(A) - 1$, see Algebra, Lemma 10.59.12. Applying the snake lemma to multiplication by $f$ on the short exact sequence $0 \to A \to B \to Q \to 0$ we obtain $$0 \to Q[f] \to A/fA \to B/fB \to Q/fQ \to 0$$ where $Q[f] = \mathop{\mathrm{Ker}}(f : Q \to Q)$. This implies that $Q[f]$ is a finite $A$-module. Since the support of $Q[f]$ is $\{\mathfrak m\}$ we see $l = \text{length}_A(Q[f]) < \infty$ (Algebra, Lemma 10.61.3). Set $l_n = \text{length}_A(Q[f^n])$. The exact sequence $$0 \to Q[f^n] \to Q[f^{n + 1}] \xrightarrow{f^n} Q[f]$$ shows inductively that $l_n < \infty$ and that $l_n \leq l_{n + 1}$. Considering the exact sequence $$0 \to Q[f] \to Q[f^{n + 1}] \xrightarrow{f} Q[f^n] \to Q/fQ$$ and we see that the image of $Q[f^n]$ in $Q/fQ$ has length $l_n - l_{n + 1} + l \leq l$. Since $Q = \bigcup Q[f^n]$ we find that the length of $Q/fQ$ is at most $l$, i.e., bounded. Thus $Q/fQ$ is a finite $A$-module. Hence $A/fA \to B/fB$ is a finite ring map, in particular induces a closed map on spectra (Algebra, Lemmas 10.35.22 and 10.40.6). On the other hand $\mathop{\mathrm{Spec}}(B/fB)$ is the punctured spectrum of $\mathop{\mathrm{Spec}}(A/fA)$. This is a contradiction unless $\mathop{\mathrm{Spec}}(B/fB) = \emptyset$ which means that $\dim(A/fA) = 0$ as desired. $\square$

Remark 30.16.2. If $(A, \mathfrak m)$ is a Noetherian local normal domain of dimension $\geq 2$ and $U$ is the punctured spectrum of $A$, then $\Gamma(U, \mathcal{O}_U) = A$. This algebraic version of Hartog's theorem follows from the fact that $A = \bigcap_{\text{height}(\mathfrak p) = 1} A_\mathfrak p$ we've seen in Algebra, Lemma 10.151.6. Thus in this case $U$ cannot be affine (since it would force $\mathfrak m$ to be a point of $U$). This is often used as the starting point of the proof of Lemma 30.16.1. To reduce the case of a general Noetherian local ring to this case, we first complete (to get a Nagata local ring), then replace $A$ by $A/\mathfrak q$ for a suitable minimal prime, and then normalize. Each of these steps does not change the dimension and we obtain a contradiction. You can skip the completion step, but then the normalization in general is not a Noetherian domain. However, it is still a Krull domain of the same dimension (this is proved using Krull-Akizuki) and one can apply the same argument.

Remark 30.16.3. It is not clear how to characterize the non-Noetherian local rings $(A, \mathfrak m)$ whose punctured spectrum is affine. Such a ring has a finitely generated ideal $I$ with $\mathfrak m = \sqrt{I}$. Of course if we can take $I$ generated by $1$ element, then $A$ has an affine puncture spectrum; this gives lots of non-Noetherian examples. Conversely, it follows from the argument in the proof of Lemma 30.16.1 that such a ring cannot possess a nonzerodivisor $f \in \mathfrak m$ with $H^0_I(A/fA) = 0$ (so $A$ cannot have a regular sequence of length $2$). Moreover, the same holds for any ring $A'$ which is the target of a local homomorphism of local rings $A \to A'$ such that $\mathfrak m_{A'} = \sqrt{\mathfrak mA'}$.

Lemma 30.16.4. Let $X$ be a locally Noetherian scheme. Let $U \subset X$ be an open subscheme such that the inclusion morphism $U \to X$ is affine. For every generic point $\xi$ of an irreducible component of $X \setminus U$ the local ring $\mathcal{O}_{X, \xi}$ has dimension $\leq 1$. If $U$ is dense or if $\xi$ is in the closure of $U$, then $\dim(\mathcal{O}_{X, \xi}) = 1$.

Proof. Since $\xi$ is a generic point of $X \setminus U$, we see that $$U_\xi = U \times_X \mathop{\mathrm{Spec}}(\mathcal{O}_{X, \xi}) \subset \mathop{\mathrm{Spec}}(\mathcal{O}_{X, \xi})$$ is the punctured spectrum of $\mathcal{O}_{X, \xi}$ (hint: use Schemes, Lemma 25.13.2). As $U \to X$ is affine, we see that $U_\xi \to \mathop{\mathrm{Spec}}(\mathcal{O}_{X, \xi})$ is affine (Morphisms, Lemma 28.11.8) and we conclude that $U_\xi$ is affine. Hence $\dim(\mathcal{O}_{X, \xi}) \leq 1$ by Lemma 30.16.1. If $\xi \in \overline{U}$, then there is a specialization $\eta \to \xi$ where $\eta \in U$ (just take $\eta$ a generic point of an irreducible component of $\overline{U}$ which contains $\xi$; since $\overline{U}$ is locally Noetherian, hence locally has finitely many irreducible components, we see that $\eta \in U$). Then $\eta \in \mathop{\mathrm{Spec}}(\mathcal{O}_{X, \xi})$ and we see that the dimension cannot be $0$. $\square$

Lemma 30.16.5. Let $X$ be a separated locally Noetherian scheme. Let $U \subset X$ be an affine open. For every generic point $\xi$ of an irreducible component of $X \setminus U$ the local ring $\mathcal{O}_{X, \xi}$ has dimension $\leq 1$. If $U$ is dense or if $\xi$ is in the closure of $U$, then $\dim(\mathcal{O}_{X, \xi}) = 1$.

Proof. This follows from Lemma 30.16.4 because the morphism $U \to X$ is affine by Morphisms, Lemma 28.11.11. $\square$

The following lemma can sometimes be used to produce effective Cartier divisors.

Lemma 30.16.6. Let $X$ be a Noetherian separated scheme. Let $U \subset X$ be a dense affine open. If $\mathcal{O}_{X, x}$ is a UFD for all $x \in X \setminus U$, then there exists an effective Cartier divisor $D \subset X$ with $U = X \setminus D$.

Proof. Since $X$ is Noetherian, the complement $X \setminus U$ has finitely many irreducible components $D_1, \ldots, D_r$ (Properties, Lemma 27.5.7 applied to the reduced induced subscheme structure on $X \setminus U$). Each $D_i \subset X$ has codimension $1$ by Lemma 30.16.5 (and Properties, Lemma 27.10.3). Thus $D_i$ is an effective Cartier divisor by Lemma 30.15.7. Hence we can take $D = D_1 + \ldots + D_r$. $\square$

Lemma 30.16.7. Let $X$ be a Noetherian scheme with affine diagonal. Let $U \subset X$ be a dense affine open. If $\mathcal{O}_{X, x}$ is a UFD for all $x \in X \setminus U$, then there exists an effective Cartier divisor $D \subset X$ with $U = X \setminus D$.

Proof. Since $X$ is Noetherian, the complement $X \setminus U$ has finitely many irreducible components $D_1, \ldots, D_r$ (Properties, Lemma 27.5.7 applied to the reduced induced subscheme structure on $X \setminus U$). We view $D_i$ as a reduced closed subscheme of $X$. Let $X = \bigcup_{j \in J} X_j$ be an affine open covering of $X$. For all $j$ in $J$, set $U_j = U \cap X_j$. Since $X$ has affine diagonal, the scheme $$U_j = X \times_{(X \times X)} (U \times X_j)$$ is affine. Therefore, as $X_j$ is separated, it follows from Lemma 30.16.6 and its proof that for all $j \in J$ and $1 \leq i \leq r$ the intersection $D_i \cap X_j$ is either empty or an effective Cartier divisor in $X_j$. Thus $D_i \subset X$ is an effective Cartier divisor (as this is a local property). Hence we can take $D = D_1 + \ldots + D_r$. $\square$

The code snippet corresponding to this tag is a part of the file divisors.tex and is located in lines 3033–3246 (see updates for more information).

\section{Complements of affine opens}
\label{section-complement-affine-open}

\noindent
In this section we discuss the result that the complement of an
affine open in a variety has pure codimension $1$.

\begin{lemma}
\label{lemma-affine-punctured-spec}
Let $(A, \mathfrak m)$ be a Noetherian local ring.
The punctured spectrum $U = \Spec(A) \setminus \{\mathfrak m\}$
of $A$ is affine if and only if $\dim(A) \leq 1$.
\end{lemma}

\begin{proof}
If $\dim(A) = 0$, then $U$ is empty hence affine (equal to the spectrum of
the $0$ ring). If $\dim(A) = 1$, then we can choose an element
$f \in \mathfrak m$ not contained in any of the finite number of minimal
primes of $A$
(Algebra, Lemmas \ref{algebra-lemma-Noetherian-irreducible-components} and
\ref{algebra-lemma-silly}). Then $U = \Spec(A_f)$
is affine.

\medskip\noindent
The converse is more interesting. We will give a somewhat nonstandard proof
and discuss the standard argument in a remark below.
Assume $U = \Spec(B)$ is affine. Since affineness and dimension are not
affecting by going to the reduction we may replace $A$ by the quotient by
its ideal of nilpotent elements and assume $A$ is reduced.
Set $Q = B/A$ viewed as an $A$-module.
The support of $Q$ is $\{\mathfrak m\}$ as $A_\mathfrak p = B_\mathfrak p$
for all nonmaximal primes $\mathfrak p$ of $A$.
We may assume $\dim(A) \geq 1$, hence as above we can pick
$f \in \mathfrak m$ not contained in any of the minimal ideals of $A$.
Since $A$ is reduced this implies that $f$ is a nonzerodivisor.
In particular $\dim(A/fA) = \dim(A) - 1$, see
Algebra, Lemma \ref{algebra-lemma-one-equation}.
Applying the snake lemma to multiplication by $f$ on the short
exact sequence $0 \to A \to B \to Q \to 0$ we obtain
$$0 \to Q[f] \to A/fA \to B/fB \to Q/fQ \to 0$$
where $Q[f] = \Ker(f : Q \to Q)$.
This implies that $Q[f]$ is a finite $A$-module. Since the support of
$Q[f]$ is $\{\mathfrak m\}$ we see $l = \text{length}_A(Q[f]) < \infty$
(Algebra, Lemma \ref{algebra-lemma-support-point}).
Set $l_n = \text{length}_A(Q[f^n])$. The exact sequence
$$0 \to Q[f^n] \to Q[f^{n + 1}] \xrightarrow{f^n} Q[f]$$
shows inductively that $l_n < \infty$ and that $l_n \leq l_{n + 1}$.
Considering the exact sequence
$$0 \to Q[f] \to Q[f^{n + 1}] \xrightarrow{f} Q[f^n] \to Q/fQ$$
and we see that the image of $Q[f^n]$ in $Q/fQ$ has length
$l_n - l_{n + 1} + l \leq l$. Since $Q = \bigcup Q[f^n]$ we
find that the length of $Q/fQ$ is at most $l$, i.e., bounded.
Thus $Q/fQ$ is a finite $A$-module. Hence $A/fA \to B/fB$ is a
finite ring map, in particular induces a closed map on spectra
(Algebra, Lemmas \ref{algebra-lemma-integral-going-up} and
\ref{algebra-lemma-going-up-closed}).
On the other hand $\Spec(B/fB)$ is the punctured spectrum of $\Spec(A/fA)$.
This is a contradiction unless $\Spec(B/fB) = \emptyset$ which
means that $\dim(A/fA) = 0$ as desired.
\end{proof}

\begin{remark}
\label{remark-affine-punctured-spectrum-standard-proof}
If $(A, \mathfrak m)$ is a Noetherian local normal domain of
dimension $\geq 2$ and $U$
is the punctured spectrum of $A$, then $\Gamma(U, \mathcal{O}_U) = A$.
This algebraic version of Hartog's theorem follows from the fact that
$A = \bigcap_{\text{height}(\mathfrak p) = 1} A_\mathfrak p$
we've seen in Algebra, Lemma
\ref{algebra-lemma-normal-domain-intersection-localizations-height-1}.
Thus in this case $U$ cannot be affine (since it would force $\mathfrak m$
to be a point of $U$). This is often used as the starting point of
the proof of Lemma \ref{lemma-affine-punctured-spec}.
To reduce the case of a general Noetherian local ring to this case,
we first complete (to get a Nagata local ring),
then replace $A$ by $A/\mathfrak q$ for a suitable minimal prime,
and then normalize. Each of these steps does not change the
dimension and we obtain a contradiction.
You can skip the completion step, but then the normalization in
general is not a Noetherian domain. However, it is still a
Krull domain of the same dimension (this is proved using
Krull-Akizuki) and one can apply the same argument.
\end{remark}

\begin{remark}
\label{remark-affine-puctured-spectrum-general}
It is not clear how to characterize the non-Noetherian local
rings $(A, \mathfrak m)$ whose punctured spectrum is affine.
Such a ring has a finitely generated ideal $I$ with
$\mathfrak m = \sqrt{I}$. Of course if we can take $I$
generated by $1$ element, then $A$ has an affine puncture
spectrum; this gives lots of non-Noetherian examples.
Conversely, it follows from the argument in the proof of
Lemma \ref{lemma-affine-punctured-spec}
that such a ring cannot possess a nonzerodivisor $f \in \mathfrak m$
with $H^0_I(A/fA) = 0$ (so $A$ cannot have a regular sequence
of length $2$). Moreover, the same holds for any ring $A'$ which is
the target of a local homomorphism of local rings $A \to A'$ such that
$\mathfrak m_{A'} = \sqrt{\mathfrak mA'}$.
\end{remark}

\begin{lemma}
\label{lemma-complement-affine-open-immersion}
\begin{reference}
\cite[EGA IV, Corollaire 21.12.7]{EGA4}
\end{reference}
Let $X$ be a locally Noetherian scheme. Let $U \subset X$ be an open subscheme
such that the inclusion morphism $U \to X$ is affine.
For every generic point $\xi$ of an irreducible component of
$X \setminus U$ the local ring $\mathcal{O}_{X, \xi}$
has dimension $\leq 1$. If $U$ is dense or if $\xi$ is in the closure
of $U$, then $\dim(\mathcal{O}_{X, \xi}) = 1$.
\end{lemma}

\begin{proof}
Since $\xi$ is a generic point of $X \setminus U$, we see that
$$U_\xi = U \times_X \Spec(\mathcal{O}_{X, \xi}) \subset \Spec(\mathcal{O}_{X, \xi})$$
is the punctured spectrum of $\mathcal{O}_{X, \xi}$ (hint: use
Schemes, Lemma \ref{schemes-lemma-specialize-points}).
As $U \to X$ is affine, we see that $U_\xi \to \Spec(\mathcal{O}_{X, \xi})$
is affine (Morphisms, Lemma \ref{morphisms-lemma-base-change-affine})
and we conclude that $U_\xi$ is affine.
Hence $\dim(\mathcal{O}_{X, \xi}) \leq 1$ by
Lemma \ref{lemma-affine-punctured-spec}.
If $\xi \in \overline{U}$, then there is a specialization
$\eta \to \xi$ where $\eta \in U$ (just take $\eta$ a generic
point of an irreducible component of $\overline{U}$ which
contains $\xi$; since $\overline{U}$ is locally Noetherian,
hence locally has finitely many irreducible components, we see that
$\eta \in U$). Then $\eta \in \Spec(\mathcal{O}_{X, \xi})$ and
we see that the dimension cannot be $0$.
\end{proof}

\begin{lemma}
\label{lemma-complement-affine-open}
Let $X$ be a separated locally Noetherian scheme. Let $U \subset X$ be an
affine open. For every generic point $\xi$ of an irreducible component of
$X \setminus U$ the local ring $\mathcal{O}_{X, \xi}$
has dimension $\leq 1$. If $U$ is dense or if $\xi$ is in the closure
of $U$, then $\dim(\mathcal{O}_{X, \xi}) = 1$.
\end{lemma}

\begin{proof}
This follows from Lemma \ref{lemma-complement-affine-open-immersion}
because the morphism $U \to X$ is affine by
Morphisms, Lemma \ref{morphisms-lemma-affine-permanence}.
\end{proof}

\noindent
The following lemma can sometimes be used to produce effective
Cartier divisors.

\begin{lemma}
\label{lemma-complement-open-affine-effective-cartier-divisor}
Let $X$ be a Noetherian separated scheme. Let $U \subset X$ be
a dense affine open. If $\mathcal{O}_{X, x}$ is a UFD for all
$x \in X \setminus U$, then there exists an effective Cartier
divisor $D \subset X$ with $U = X \setminus D$.
\end{lemma}

\begin{proof}
Since $X$ is Noetherian, the complement $X \setminus U$ has finitely
many irreducible components $D_1, \ldots, D_r$
(Properties, Lemma \ref{properties-lemma-Noetherian-irreducible-components}
applied to the reduced induced subscheme structure on $X \setminus U$).
Each $D_i \subset X$ has codimension $1$ by
Lemma \ref{lemma-complement-affine-open}
(and Properties, Lemma \ref{properties-lemma-codimension-local-ring}).
Thus $D_i$ is an effective Cartier divisor by
Lemma \ref{lemma-weil-divisor-is-cartier-UFD}.
Hence we can take $D = D_1 + \ldots + D_r$.
\end{proof}

\begin{lemma}
\label{lemma-generalization-of-complement-open-affine-effective-cartier-divisor}
Let $X$ be a Noetherian scheme with affine diagonal. Let $U \subset X$ be
a dense affine open. If $\mathcal{O}_{X, x}$ is a UFD for all
$x \in X \setminus U$, then there exists an effective Cartier
divisor $D \subset X$ with $U = X \setminus D$.
\end{lemma}

\begin{proof}
Since $X$ is Noetherian, the complement $X \setminus U$ has finitely
many irreducible components $D_1, \ldots, D_r$
(Properties, Lemma \ref{properties-lemma-Noetherian-irreducible-components}
applied to the reduced induced subscheme structure on $X \setminus U$).
We view $D_i$ as a reduced closed subscheme of $X$.
Let $X = \bigcup_{j \in J} X_j$ be an affine open covering of $X$. For all
$j$ in $J$, set $U_j = U \cap X_j$. Since $X$ has affine diagonal,
the scheme
$$U_j = X \times_{(X \times X)} (U \times X_j)$$
is affine. Therefore, as $X_j$ is separated, it follows from
Lemma \ref{lemma-complement-open-affine-effective-cartier-divisor}
and its proof that for all $j \in J$ and $1 \leq i \leq r$ the
intersection $D_i \cap X_j$ is either empty or an
effective Cartier divisor in $X_j$.
Thus $D_i \subset X$ is an effective Cartier divisor (as this is
a local property). Hence we can take $D = D_1 + \ldots + D_r$.
\end{proof}

There are no comments yet for this tag.

## Add a comment on tag 0BCQ

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the lower-right corner).