TITLE: Pullback divisor as a preimage scheme?
QUESTION [5 upvotes]: If $D$ is an effective divisor on a curve $Y$, then I can represented $D$ as a zero dimensional quasi-compact subscheme: for a closed point of multiplicity $n \geq 0$, we have a closed immersion from $Spec k[x] / (x^n)$ onto $Y$. 
Suppose that $f : X \to Y$ is a morphism between smooth curves. Is it true that the pullback divisor $f^*(D)$ agrees with the preimage scheme $f^{-1}(D)$?
It clearly suffice to consider the case of a point $Q \in Y$ of multiplicity $n$. Then for each preimage point $P$, the pullback divisor gives that point multiplicity $n*e_p$, where $e_p$ is the degree of vanishing of the pullback of a local equation for $\phi_Q$ for $Q$. To compute that order at $P$, we find a local equation $\phi_P$ for $P$ on $X$ and then apply the valuation in $O_{X,P}$ given by $(\phi_P) \subseteq O_{X,P}$ to the function $\phi_Q \circ f$. 
On the other hand, the length of the preimage scheme is given by $\dim_k (k \otimes_{k[y]} k[x])$, where $k[x]$ is a $k[y]$ module via the map $f^*$, and where $k$ is $k[y]$ module via the map $y \mapsto 0$. 
I'm not sure how to relate these notions now. There must be some subtlty because of course (?) the preimage scheme cannot have negative length.
Thank you for your help!

REPLY [2 votes]: Over a smooth curve $Y$ there is a bijective correspondence between effective divisors $D \in \operatorname {\mathcal Div_+(Y)}$ and closed subschemes $S\subset Y$.
$\bullet $ To $D$ associate the subscheme $S$ given by the coherent ideal subsheaf $\mathcal I_S=\mathcal O_Y(-D)\subset \mathcal O_Y$.
$\bullet \bullet$ To the subscheme $S\subset Y$ associate the divisor $D=\sum_{s\in S} (\operatorname {length} \mathcal O_{S,s})\cdot [s]$  
It is then true that for a finite map $f:X\to Y$ of smooth curves the subscheme $f^{-1}(S)\subset X$ corresponds in the above correspondence to the divisor $f^{*}(D)\in \operatorname {\mathcal Div_+(X)}$.
The proof is the one you sketched. A wide generalization to flat morphisms between varieties of arbitrary dimensions can be be found in Fulton's Intersection Theory, page 18, Lemma 1.7.1 .   
Edit
A very general version of this correspondence, valid for a completely arbitrary scheme, can be found on page 302 of Görsten-Wedhorn's book.
The result on the correspondence between pull-backs of subschemes and effective divisors under flat morphisms is Corollary 11.49, page 313.