I'm studying "Algebraic number theory" written by S. Lang. In proposition 21 of chapter 1.7 it says if $A$ is a Dedekind ring and $K$ its quotient field, for a separable extension $L/K$, $[L:K]=\sum_{P|p} e_P f_P$ where $p$ is a prime ideal in $A$ and $e_P, f_P$ are ramification indexes and residue class degrees.
My problem is a part of its proof; It says if $B$ is $A$'s integral closure in $L$ then $B/pB$ is an $A/p$-vector space of dimension $[L:K]$. I don't see why this holds. I tried to show if $a_1,...,a_n$ are basis of $L$ as a $K$-vector space then $a_i$s are integral over $A$ hence a generator for $B$ as an $A$-module so that from $[B/pB:A/p]=[B:A]$ the result can be obtained. But the leading coefficient wouldn't remain unity over $A$
I'd say that we need to look at $A_p=(A-p)^{-1}A$ which is a PID (and DVR). The separability of $L/K$ gives that $A_p B$ is a finitely generated $A_p$-module
Then we use a general linear algebra theorem that finitely generated $R$-modules are free whenever they are contained in a $Frac(R)$-vector space and $R$ is a PID.
Since $K B = L$ is a $[L:K]$-dimensional $K$-vector space it gives that $A_pB$ is a free $A_p$-module of rank $[L:K]$, so that $[B/pB:A/pA]=[A_pB/pA_pB:A_p/pA_p]=[L:K]$.