TITLE: Elementary questions on principal divisors
QUESTION [5 upvotes]: I have some elementary questions related to divisors. I will state them below.


Question 1: Let $X$ a Noetherian scheme be regular in codimension 1 (every local ring of dimension $1$ is regular). Then in Ravi FOAG's (Jun 2013 version) he defines the following. Let $\mathcal{L}$ be an invertible sheaf, $s$ a rational section. Then $\operatorname{div}(s) := \sum_Y \nu_Y(s) [Y]$ where the sum is over all irreducible codimension $1$ subsets of $X$. What is this $\nu_Y(s)$? Do I simply take any $y\in Y$ and calculate the valuation of $s$ in $\mathcal{O}_{X,y}$?
Question 2: Suppose $A$ is a domain and $x \in A$ such that $(x)$ a prime ideal. Then is the divisor $[(x)]$ principal, equal to $\operatorname{div}(x)$? Some might say this is pretty much the definition, but I have $\operatorname{div} (x) := \sum_{ Y} \nu_Y(x)[Y]$ where $Y$ is a codimension $1$ closed subset of $\operatorname{Spec} A$. It is not clear to me from this definition that $\operatorname{div}(x) = [(x)]$.

REPLY [5 votes]: Question 1
There is a subtle trap here: we certainly have a group morphism $v_Y:K(X)^*\to \mathbb Z  $ defined on rational functions but  $s$ is not a rational function and the notation $v_Y(s)$ does not a priori make sense !
The key to this riddle is to choose a trivialization $\mathcal L|U \stackrel {\cong} {\to} \mathcal O_U$ on some open subset $U\subset X$.
  The rational section $s|U\in \Gamma_{\text {rat }} (U,\mathcal L)$ will be transformed into a rational function $s'\in K(U)=K(X)$ and we define $v_Y(s):=v_Y(s')$.
This definition trivially does not depend on the trivialization.
[For ease of notation I have assumed the scheme $X$ integral. If it isn't, this construction  must be adapted.]  
The simplest example
Consider the  point $p=(0:1)\in \mathbb P^1_{z:w}$ and the line bundle $\mathcal L=\mathcal O(p).$
(Recall that   $\mathcal O(p)$ consists of rational functions having at most a pole of order one at $p$)
What is the divisor $div(s)$ associated to the section $s=1\in \Gamma(\mathbb P^1,\mathcal O(p))$ ?
Despite appearances it is not the zero divisor!
A trivialization $\mathcal L|U \stackrel {\cong} {\to} \mathcal O_U$ of our line bundle around $p$ over $U=\mathbb A^1_t$ is given by  multiplication by $t=\frac zw$
So the constant function $1|U$ is transformed into the coordinate function $s'=t\in \Gamma(\mathbb A^1,\mathcal O)$ and since $v_p(t)=1$, we get finally $$div(s)=1\cdot p$$
Question 2
Write $\mathfrak p:=(x)\in \text {Spec} A$
(i) Since $x$ generates the maximal ideal $\mathfrak pA_\mathfrak p$ of the DVR $A_\mathfrak p$ we already have $$ v_\mathfrak p (x)=1         $$  (ii) Now consider some other prime $\mathfrak q\neq \mathfrak p$ of height one in $ \text {Spec} A$ .
We have $x\in A\subset A_\mathfrak q$ but I claim that $x\notin \mathfrak q A_\mathfrak q$.
 Indeed if that were the case we would have $x\in  \mathfrak qA_\mathfrak q \cap A=\mathfrak q$ and thus $(x)=\mathfrak p\subset \mathfrak q$.
This is absurd since different height one primes cannot be included in one another.
So in reality $x\in A_\mathfrak q\setminus \mathfrak q A_\mathfrak q $ and thus $$v_\mathfrak q(x)=0$$  
From (i) and (ii) we conclude that, as desired, $$\text {div}(x)=1\cdot \mathfrak p=1\cdot (x)       $$