Rank has been defined to me as the maximum number of elements of M which are linearly independent, allowing the rank to be $0$ if the module is of torsion, or $\infty$ if there is no maximum. Now, the course is based pretty much on the book Abstract Algebra by Dummit and Foote, and there the rank is defined to be as the length of a basis of $M$ (assume $M$ has a finite basis and that $R$ is commutative with $1$ here to have a well defined rank).
We now are seeing the following theorem:
Let $R$ be a PID and $M$ a free module of rank $n$. Then any submodule $N$ of $M$ satisfies:
(1) $N$ is free of rank less than $n$.
(2) There is a basis $y_1,...,y_n$ of $M$ such that $r_1y_1,...,r_ty_t$ is a basis for $N$, for some $t \le n$.
I think that, according to my definition, the length of the basis' of M doesn't have to be n. It certainly can't be more than n, cause then the elements would be l.d., but it could be less than n. In consequence, the assertion (2) makes no sense a priori.
My question is whether the fact that $R$ is a PID and $M$ is a free module over $R$ implies that both definitions of rank coincide (i.e., that the maximum number of l.i. elements is also the length of a basis's of $M$), or whether this was just a mistake due to my professor giving a different definition of rank.