# Criteria for dense open subset of schemes

The purpose of this question is to expand on a remark made in Definition 7.1.27 in Qing Liu's book. All of what is discussed below is answered in the posts mentioned at the end of this question.

Proposition. Let $X$ be a scheme and $U$ an open subset of $X$. Consider the following statements.
1) $U$ is dense in $X$.
2) $U$ contains all generic points of $X$.
3) $\text {codim} ( X - U , X ) \geq 1$.
Then, $3) \Longleftrightarrow 2) \implies 1)$. If, moreover, $X$ is locally Noetherian, these conditions are equivalent.

We need a Lemma first (which is exercise $2.5.2$ in Qing Liu's book).

Lemma. Let $X$ be a scheme and $x \in X$. Then, $\text{codim} ( \overline { \left \{ x \right \} } , X ) = \dim \mathcal{O}_{X,x}$. If $Z$ is a closed subset of $X$, then $\text{ codim} ( Z, X ) = \min _ { z \in Z } \dim \mathcal{O}_{X,z}$.

Proof. If $\left \{ x \right \} \subseteq Z_{0} \subsetneq Z_{1} \ldots, \subsetneq Z_{n} = X$ is a sequence of irreducible closed subsets of $X$, then, for any open $U \subset X$ containing $x$, we have $\left \{ x \right \} \subseteq U \cap Z_{0} \subsetneq U \cap Z_{1} \subsetneq \ldots \subsetneq U \cap Z_{n} = U$. We may thus assume that $U$ is the spectra of a ring $A$, and $x = \mathfrak{p}$ is a prime. Then, $\overline { \left \{ x \right \} } = V ( \mathfrak{p} )$ and $\text { codim } ( V( \mathfrak{p} ) , X ) = \text{ht} ( \mathfrak{p} ) = \dim A_{ \mathfrak{p} } = \dim \mathcal{O} _ { X , x }$.

Let $Z$ be a closed subset of $X$. Let $C_{i}$ be the irreducible closed subsets of $Z$. Then, by definition, $\text{codim} ( Z, X ) = \inf _{ i } \text{ codim } ( C_{i} , X )$. It therefore suffices to assume that $Z$ is irreducible. Moreover, if $U_{j}$ is an open covering of $Z$, then $\text{codim} ( Z, X ) = \inf _{ j } \text{codim } ( Z \cap U _{ j } , U _{ j } )$ for similar reasons as above. We may thus also assume that $X$ is affine and $Z$ is an irreducible closed subset i.e. $X =$ Spec $A$ and $Z = V ( \mathfrak { p } )$ for some prime $\mathfrak { p }$ of $A$. Then, $\text {codim} ( Z, X ) = \text{ht} ( \mathfrak{p} ) = \dim A_ { \mathfrak { p } } = \min _ { \mathfrak{q} \supset \mathfrak{p} } \dim A_{\mathfrak{q} } = \min _ { z \in Z } \dim \mathcal{ O } _ { X , z }$. $\quad \quad \quad \quad$ $\square$

We now turn to the proof of the proposition.
$\boxed { 3) \Longleftrightarrow 2) }$. By the Lemma, we see that $\text{codim} ( X - U , x ) \geq 1$ iff $U$ contains points all the points of codimension $0$, which are the same as generic points.

$\boxed { 2) \implies 1 ) }$ If $U$ contains all generic points, then any closed subset of $X$ that contains $U$ must contain all the generic points, and thus, must contain all the irreducible components of $X$, and thus must equal $X$.

Suppose now that $X$ is locally Noetherian.

$\boxed { 1) \implies 2) }$ Suppose that $\eta$ is a generic point of $X$ outside $U$. Then, $U \cap \overline { \left \{ \eta \right \} } = \emptyset$. Consider the set $S = \left \{ Z | Z \text{ irreducible component of } X \right \} \setminus \overline { \left \{ \eta \right \} }$. Let $$C = \bigcup _ { Z \in S } Z .$$ We claim that $C$ is closed. This will result in a contradiction since $C \supset U$ and $C \neq X$. Let $V$ be an open affine subset of $X$. Then, since $V$ is Noehterian, the union $\bigcup _ { Z \in S } V \cap Z$ is a finite union of closed subsets of $V$, and is thus closed in $V$. Thus, $C$ is closed in $X$.