the sum of the products of ramification degrees and relative degrees I am reading Algebraic Number Fields by Gerald Janusz and I get confused about the part in the picture below.

Consider two Dedekind domains $R\subset R'$ with quotient fields $K\subset L$. Let $p$ be a nonzero prime ideal of $R$ that factorizes in $R'$:
$$pR'=\mathfrak{B_1}^{e_1}...\mathfrak{B_g}^{e_g}$$
where $\{\mathfrak{B_i}\}$ are distinct prime ideals in $R'$, $\{e_i\}$ their ramification indexes. Let $\{f_i\}$ be their relative degrees.
Here is my problem: in the proof of theorem 6.6, why does it suffice to show that $\mathfrak{B_i}^{a+1}/\mathfrak{B_i}^a$ is $f_i$ dimensional over $R/p$?
I found a similar statement in Algebraic Number Theory by Serge Lang as in this image but I am also stuck in the last paragraph the blue part where he said "from this it follows ...". I guess this part is similar to the problem I get reading Gerald Janusz.

 A: (Note it should be $\mathfrak{P}^{a}/\mathfrak{P}^{a+1}$, not $\mathfrak{P}^{a+1}/\mathfrak{P}^{a}$.) This is a linear algebra fact about composition series: suppose you have a vector space $V$ and an ascending chain of subspaces $0=U_0\subset U_1 \subset \ldots U_n = V$. Then let $W_j= U_j/U_{j-1},j=1,\ldots , n$, and check that $\operatorname{dim} V = \sum_{j=1}^n \operatorname{dim} W_j$ – prove it by induction on $n$. For us $V= R’/\mathfrak{P}^{e_i}$, $U_j=\mathfrak{P}^{e_i-j}$ (technically $U_j=\mathfrak{P}^{e_i-j} /\mathfrak{P}^{e_i}$, to make sense in the context of our choice of $V$, but the dimension of the quotient $U_j/U_{j-1}=(\mathfrak{P}^{e_i-j} /\mathfrak{P}^{e_i})/(\mathfrak{P}^{e_i-j+1} /\mathfrak{P}^{e_i})$ will be the same as that of $\mathfrak{P}^{e_i-j} / \mathfrak{P}^{e_i-j+1} $ if you carefully chase cosets around – this may be the source of your confusion?). Here $n=e_i$, and we are viewing these subspaces as vector spaces over $R/\mathfrak{p}$, where the text shows that $\operatorname{dim} W_j = f_i$ for all $j$, so we get the desired total dimension $e_if_i$.
