# Direct image of principal divisor on one-dimensional scheme is 0

I am trying to read the proof of the following lemma (Stacks project, 29.18.2):

Let $X$ be a 1-dimensional integral scheme and $c : X \to \mathrm{Spec}(K)$ a proper morphism to the spectrum of a field $K$. For any invertible rational function $f \in R(X)^*$, the direct image of the associated divisor $\mathrm{div}(f)$ is 0.

Let $f : U \to \mathbb{A}^1_\mathbb{Z}$ be a representative of the rational function, with $U \subset X$ a dense open subscheme. There is supposed to be a canonically associated morphism $g : U \to \mathbb{P}^1_K$; I guess the construction should be something like this: take the composite of $f$ with an isomorphism identifying $\mathbb{A}^1_\mathbb{Z}$ with an affine open subset of $\mathbb{P}^1_\mathbb{Z}$, and the canonical morphism $\mathbb{P}^1_\mathbb{Z} \to \mathbb{P}^1_K$; however I only know about a canonical morphism in the other direction. My first question is, what is the right way to construct this?

Now let $Y$ be the closure of the graph of $g$, i.e. the image of $\Gamma_g : X \to X \times_K \mathbb{P}^1_K$. Now one proves (Stacks, 29.17.3) that the projection morphism $p : Y \to X$ is proper; that the restriction of $p$ to $p^{-1}(U)$ is an isomorphism of schemes; and that the divisor $\mathrm{div}_X(f)$ is equal to the direct image $p_*(\mathrm{div}_Y(f))$ of the divisor associated to $f$ on $Y$ (presumably this means the divisor associated to the rational function $U \times_K \mathbb{P}^1_K \to U \to \mathbb{A}^1_\mathbb{Z}$).

Now to the proof of this lemma. Let $q: Y \to X \times_K \mathbb{P}^1_K \to \mathbb{P}^1_K$ and let $c' : \mathbb{P}^1_K \to \mathrm{Spec}(K)$ be the respective projection morphisms. We want to show $$c_*(\mathrm{div}_X(f)) = c_*(p_*(\mathrm{div}_Y(f))) = c'_*(q_*(\mathrm{div}_Y(f))) = 0$$ Since $\mathrm{dim}(\mathbb{P}^1_K) = 1$ and $q(Y) \subset \mathbb{P}^1_K$ is a closed irreducible subscheme, either the image $q(Y)$ is equal to a closed point or the whole projective line. In the first case, $\mathrm{div}_X(f) = 0$; why?

-

First there is no need to use $U\to \mathbb A^1_{\mathbb Z}$, consider $U\to \mathbb A^1_{K}$ instead.
Second, when $q(Y)$ is one point, as $Y\to X$ is birational and $q$ coincide with $f$ on $U$, we have $f(U)$ equal to one point of $\mathbb A^1_K$. As $U$ is dense in $X$, we have $f(X)$ equal to one point. This point is different from $0$ because $f\in R(X)^*$. So $f$ never vanishes in $X$, this implies that $f\in O(X)^*$. So its divisor is $0$.
Thank you. I don't understand why the divisor of a constant function is 0. This property isn't related to the morphism of sheaves, only to the topological map. So I don't see what $f$ being constant has to do with the corresponding element of the fraction field of the stalk at a point and thus I don't see how to show that the order of f at a point is 0. I must be missing something obvious? –  Adeel Khan Feb 20 '13 at 19:59
I missed the fact that $U$ is not proper in general. I edited the proof. –  user18119 Feb 21 '13 at 14:32
Since the projection $q : U \times_K \mathbb{P}^1_K \to \mathbb{P}^1_K$ factors through $p$ and $f$, we have $f(p(Y)) = q(Y)$, a single point. But $p(Y)$ is a closed integral subscheme of the 1-dimensional scheme $X$ and hence is either a closed point or the whole space $X$; however $p(Y) \subset U$ implies that it is just a point. So we can't conclude that $f$ is really constant on $U$. Am I wrong? –  Adeel Khan Feb 21 '13 at 18:33
Also $f$ could have domain of definition different than the whole $X$, so what do you mean by $f(X)$? –  Adeel Khan Feb 21 '13 at 18:40
$p: Y\to X$ is an isomorphism above $U$, so $p(Y)$ contains $U$ and $p(Y)=X$. When $f$ is a constant morphism, it is defined everywhere. Suppose for simplicity that $K$ is algebraically closed. Then there exists $\lambda\in K$ such that $f(u)=\lambda$ for all $u\in U$. So $f-\lambda=0$ in $O(U)$, thus $f-\lambda=0$ in $R(U)=R(X)$. –  user18119 Feb 21 '13 at 21:35