A a PID, then dimension of a free A-module well defined. I am reading Lang's Algebra, and given $A$, a principal ideal domain, a free $A$-module $M$, and a basis $\{x_i\}_{i \in I}$ of $M$, Lang defines the dimension of $M$ as in the cardinality of $I$. Now, he states this is well defined because the cardinality of $I$ is uniquely determined. Noting that this is proved by taking a prime elemet $p \in A$, and observing that $\frac{M}{pM}$ is a vector space over the field $\frac{A}{pA}$, whose dimension is exactly the cardinality of $I$.
Ok.. So I think I understand the idea of this. I get that ''$\frac{M}{pM}$ is a vector space over the field $\frac{A}{pA}$''. 
My doubt is, how can I assure that dimension? Why can I not find two elements in the basis that belong to the same equivalence class? I think the idea of this is that if there are two elements in your basis that belong to the same equivalence class, then you ''loose'' the linear independence of the basis, but I cannot seem to prove it. 
It seemed pretty trivial to Lang, so I might not be seeing something. 
Thanks in advanced, and sorry for my sloppy english.
 A: Suppose $\{x_i\}_{i \in I}$ is a basis for $M$ and $\sum a_i x_i$ is in $pM$ where $a_i \in A$ and all but finitely many are non zero. Then we can write $\sum a_i x_i = pm = \sum pb_i x_i$ where $m=\Sigma b_i x_i$. Then we have $\sum (a_i-pb_i)x_i = 0$ and $a_i-pb_i=0$. The statement that two elements of the basis belong to the same equivalence class would be $x_i-x_j \in pM$. In this case $a_i=1$, $a_j=-1$, and zero otherwise. This then implies $b_k=0$ for $k \neq i,j$ and we have the following equalities
$$1=pb_i$$
$$-1=pb_j$$
However, by definition $p$ cannot be a unit since it is a prime element. This results in a contradiction so two elements of the basis cannot be in the same conjugacy class
A: The right way to understand this is to say that a basis of a module $M$ should really be defined not as a subset of $M$ but rather as a set $I$ together with a map $f:I\to M$, such that for each $m\in M$, there is a unique function $c:I\to A$ which sends all but finitely many elements of $I$ to $0$ and such that $m=\sum_{i\in I}c(i)f(i)$.  The cardinality of such a basis $(I,f)$ is then the cardinality of the set $I$.  Note that the uniqueness of $c$ means that $f$ must be injective (if $f(i)=f(j)$ for $i\neq j$, then there are two different $c$'s that work for $m=f(i)$).  So the cardinality of $I$ is indeed the same as the cardinality of the subset $f(I)\subset M$, which is a basis in the more familiar sense.
The key observation is then that if $f:I\to M$ is a basis for $M$ as an $A$-module and $q:M\to M/pM$ is the quotient map, then $q\circ f:I\to M/pM$ is a basis for $M$ as an $A/pA$-module.  Indeed, the proof of this statement is exactly the same as the usual proof that the image of a basis for $M$ under $q$ is a basis for $M/pM$.  But now the cardinality of this basis is obviously the same as the cardinality of the original basis, since the set $I$ hasn't changed!
In terms of your original question, what's going on here is that because the map $q\circ f$ is a basis (rather than just its image being a basis), it is automatically injective.  In your language, that means two basis elements from $M$ (corresponding to different elements of $I$) cannot become the same basis element in $M/pM$.
