I was just going through a proof of the following fact from a textbook. Generally $M$ is an $R$-module.
$\textbf{Theorem.}$ A finitely generated torsion-free module over a PID is free.
$\textbf{Proof.}$ The proof given in the book is as follows. Let $M$ be a torsion-free non-zero module, generated by $X=\{x_{1},\dots,x_{m}\}$. By reordering if necessary, we may assume that, $\mathscr{B} =\{x_{1},x_{2},\dots,x_{m}\}$ is a maximal linearly independent subset of $X$. Let $F=\text{span}\:\mathscr{B}$. Since $M$ is non-zero and torsion-free, we have $m \geq 1$. For each $i$, there are scalars, $a_{i},a_{ij}$ not all zero such that $a_{i}x_{i} + \sum\limits_{j=1}^{m} a_{ij}x_{j}=0.\qquad\qquad\qquad\qquad (\star)$ Since $\mathscr{B}$ is linearly independent, it is clear that $a_{i} \neq 0$, for all $i$. Let $a=a_{1}a_{2}\cdots a_{n}$ so that $a_{n} \neq 0$. For $(\star)$, $a_{i}x_{i} \in F$ and so $ax_{i} \in F$, for all $i$, i.e. $aM \subseteq F$. Now the map $\nu:M \to F$, $x \to ax$, is $R$-linear and a monomorphism since $M$ is torsion-free. Hence $M \cong \nu(M)$ which is submodule of the free module $F$ and so $\nu(M)$ is free by $\textbf{Theorem A}$ (see below), i.e. $M$ is free as required.
$\textbf{Theorem A.}$ Let $F$ be a free $R$-module and $M$ a submodule of $F$. Then $M$ is also free and $\dim_RM \leq \dim_RF$.
I would like to know in the proof of the above theorem, where have we assumed any facts about $\textbf{PID}$. It seems as if this theorem is true for a torsion-free module over a general ring as well (which I know is not true).