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!