# Dimensions of modules of the maximal compact subrings of locally compact fields

I have checked the list of similar titles, proposed by the site. I hope this is not a repetition.
This question arises from a proof of a proposition in the book Basic Number Theory, as follows.

Proposition
Every finitely generated $R$-module $M$ is the direct sum of finitely many summands, each of which is isomorphic either to R or to a module R/$P^v$, $v$>0.
Proof
Let M be generated by elements $m_1,...,m_n$. Take a vector-space $v$ of dimension n over $K$, with a basis $v_1,...v_n$; put $L$=$\Sigma$ $Rv_i$. Then the formula
$\Sigma$ $x_iv_i$=$\Sigma$ $x_im_i$,
where the $x_i$ are taken in $R$ for i from 1 to n, defines a morphism of $L$ onto $M$; therefore $M$ is isomorphic to $L/M'$, where $M'$ is the kernel of that morphism. Apply now corollary 1 to $L$ and $M$; as $M$ is a subset of $L$, we have $v_j$is positive for j from 1 to r, and r=s.

Question
After that proof, Weil then defines $n_i$ as the dimension of $R_i=M_i/M_{i+1}$, where $M_i$:=$\pi^iM$, over the residual field $k=R/P$; moreover, after the proposition is set up, one can define the number$N_v$ as $N_0$=the number of times R appears in the summands, and $N_v$=the number of times R/$P^v$ appears in the summands. Now, Weil asserts that $n_i$=$N_0$+$\Sigma_{v>i}N_v$. And my question is why is this true.
Supplement
Here, R is the maximal compact subring of a p-field $k$, in which $P$ is the maximal ideal, where a $p$-field is a non-discrete locally compact field, either of characteristic $p$, or a finite extension of $Q_p$ the completion of $Q$ with respect to the $p$-adic valuation.
I may not exprese my question explicitly enough, so feel free to ask for explanations, and I will do my best to clarify things.
Thanks and regards here.

-
Hi. Just as a note, the kernel "M" is different from the module "M". And $R_i=M_i/M_{i+1}$. –  John M Jul 25 '11 at 15:06
Note: this is on pg. 30 of Weil's book. I'll try to have a look at your question later, but I'm sure that John's answer is great. –  Dylan Moreland Jul 25 '11 at 16:25
@Dylan Moreland - don't assume it's great! My first answer was bogus. –  John M Jul 25 '11 at 16:30
Here's a question to anyone who has Weil's book: what are the actual conditions on the ring $R$ here? Does $R$ merely have to be Noetherian, and $P$ can be any maximal ideal? –  John M Jul 25 '11 at 16:42
Also, Weil's proposition is also a corollary of the usual structure theorem for finite modules over a principal ring, isn't it? –  Dylan Moreland Jul 26 '11 at 3:27

Here's my stab at this: Here I assume $R$ is a DVR with max ideal $P=(\pi)$. If this isn't correct, let me know.
If the module $M \cong R^{N_0} \oplus (R/P)^{N_1}\oplus\dots$, then $M_i=\pi^iM \cong(P^i)^{N_0}\oplus(P^i/P^{i+1})^{N_{i+1}}\oplus(P^i/P^{i+2})^{N_{i+2}}\oplus\dots$, since the rest of the terms with index less than or equal to $i$ are trivial.
So then we have $M_i/M_{i+1}\cong (P^i/P^{i+1})^{N_0}\oplus(P^i/P^{i+1})^{N_{i+1}}\oplus(P^i/P^{i+1})^{N_{i+2}}\oplus\dots$.
Note that $\text{dim}_{R/P}(P^i/P^{i+1})=1$, so $$n_i=\text{dim}_{R/P}(M_i/M_{i+1})=N_0+\sum_{\nu>i}N_i$$
In fact, one of the main problems I encountered before is that, although I decomposed the ring, I do not know why we can view as trivial those terms with index less than $i$; this is suddenly solved. Thank you. –  awllower Jul 26 '11 at 11:21