----
Assume $(X, \mathcal{O}_{X})$ is a [[locally Noetherian scheme|Noetherian]], [[integral scheme|integral]] [[scheme]] [[scheme over a field|over]] a [[field]] $k$ which is [[regular scheme|regular]] in [[codimension of a closed subspace|codimension]] $1$. (This is the default for this chapter of the course.)
> [!definition] Definition. ([[prime divisor in a scheme]])
> A **prime divisor** on $X$ is an [[integral scheme|integral]] (equivalently [[irreducible scheme|irreducible]] + [[reduced scheme|reduced]]) [[subscheme|closed subscheme]] of $X$ having [[codimension of a closed subspace|codimension]] $1$.
>
> We denote by $\text{Div}(X)$ the [[free abelian group]] generated by prime divisors. The elements of $\text{Div}(X)$ are called **(Weil) divisors**.
>
> For $Y \subset X$ a prime divisor, let $\xi$ denote its [[generic point of an integral scheme|generic point]].[^3] Then $\text{dim }{ \mathcal{O}_{X, \xi} }=1$, because $\text{codim}(Y, X)=1$.[^5] [[every DVR is a Noetherian local domain of dimension 1|This means]] $\mathcal{O}_{X, \xi}$ is [[regular local ring|regular]], hence a [[DVR]].[^2] So we have a [[discrete valuation|valuation]][^4] $\nu_{Y}:K(X)^{*} \to \mathbb{Z}.$
> [[discrete valuation|In particular]]: $\mathcal{O}_{X, \xi}=\{ f \in K(X)^{*}: \nu (f) \geq 0 \} \cup \{ 0 \}$
> So each prime divisor $Y$ corresponds to a [[discrete valuation|valuation]] $\nu_{Y}$ on the [[generic point of an integral scheme|function field]] $K(X)$ of $X$. We think of $\nu_{Y}(f)$ as specifying the order of zero of the [[rational function]] $f$ on $X$ along $Y$. (Or something... there is some intuition from complex analysis)
> [!basicexample]
> Let $X=\mathbb{A}^{1}_{k}=\text{Spec }k[x]$ be the [[affine scheme|scheme-theoretic affine line]]. Let $\mathfrak{p}=\langle x-a \rangle \subset k[x]$. Then $\mathcal{O}_{X, \mathfrak{p}}=k[x]_{\langle x-a \rangle}$ [[rational function|and]] $K(X)=k(x)$. Given $\frac{f}{g}\in K(X)$ nonzero, we may factor out $( x-a )^{m}$, $m \in \mathbb{Z}$, to get $\frac{f}{g}=\left( \frac{p}{q} \right)(x-a)^{m}$ [[greatest common divisor|with]] $\text{gcd}(p, x-a)=1=\text{gcd}(q, x-a)$. Then with $Y=V(\mathfrak{p})$ ([[correspondence between height-1 primes and prime divisors in affine schemes|recall]]), have (using that $\nu_{Y}$ is a [[group homomorphism]]) $\nu_{Y}\left( \frac{f}{g} \right)= \nu_{Y}\left( \frac{p}{q} \right)+ \sum \underbrace{ \nu_{Y}\big( x-a \big) }_{ =1, x-a \text{ uniformizer} }=m.$
> Thus, $\nu_{Y}$ counts the order of vanishing (if $m>0$) or the order of pole (if $m<0$) of the rational function $\frac{f}{g}$ at the point $x=a$. By definition of [[DVR]], $\mathcal{O}_{X, \mathfrak{p}}=\left\{ \frac{f}{g} \in K(X)^{*} : \nu_{Y}\left( \frac{f}{g} \right) \geq 0 \right\} \cup \{ 0 \}$
> collects the rational functions without poles at $x=a$. We can say that such rational functions are 'regular along the divisor $Y