I vaguely recall the following fact that I'd like to use in my research. It should be easy to see that this holds (if it does) but I can't seem to prove it.

Let $p:X\longrightarrow S$ be a (regular) arithmetic surface over a Dedekind scheme $S$.

Let $P:S\longrightarrow X$ be a section and let $\omega$ be a non-zero rational section of $\omega_{X/S}$. Let $K_{X} = \mathrm{div}(\omega) $ be the canonical divisor defined by $\omega$. (A better notation for $K_X$ would be $K_{X/S}$, maybe.)

By definition, the intersection number $(K_X,P)$ is defined as $$\sum_{s } i_s (K_{X}, P) \log( \mathrm{card}( k (s)) ), $$ where the sum runs over the closed points of $S$ and $$i_s(K_{X},P) = \sum_{x} i_x(K_{X}, P) [k(x):k(s)],$$ where the sum runs over the closed points of $X_s$ and $i_x$ denotes the intersection number at $x$.

Now, I wonder if the following equality is trivial to see.

Write $\omega = df$ for some rational function $f\in K(X)$. (We assume this to be possible.) Do we have that

$$(K_{X}, P) = \sum_{s} \mathrm{ord}_s(P^\ast\omega) \log(\mathrm{card}(k(s)))?$$

To see this, it suffices to prove the following equality: $$\mathrm{ord}_s(P^\ast \omega) =i_s (K_{X}, P) .$$ Does this hold?