Proof (basis for submodule of tuples of Euclidean domain)

By the previous proposition, $N$ is generated by $x_1, \ldots, x_n\in R^m$ for some $n\leq m$. Put the matrix into Smith normal form $$ \begin{align*} \underbrace{\pmat{| & | && | \\ x_1 & x_2 & \ldots & x_n \\ | & | && |}}_{m\times n} \quad ={}& \quad \underbrace{\pmat{| & | && | \\ v_1 & v_2 & \ldots & v_m \\ | & | && |}}_{m\times m} \quad \underbrace{\pmat{d_1 \\ &\ddots \\ && d_r \\ &&& 0 \\ &&&& \ddots \\ &&&&& 0 \\ &&&&& \vdots \\ &&&&& 0}}_{m\times n} \underbrace{Q}_{n\times n} \quad \\ ={}& \pmat{| && | & | && |\\ d_1v_1 & \ldots & d_r v_r & 0 & \ldots & 0\\ | && | & | && |} Q \\ \end{align*} $$ where $P$ is invertible, $d_i \neq 0$ and $d_i\mid d_{i+1}$.

$\set{d_1 v_1, \ldots, d_r v_r}$ generates $\set{x_1, \ldots, x_n}$ and thus $N$. Since $\pmat{v_1 & \ldots & v_m}$ is invertible, $\set{v_1, \ldots, v_m}$ is a basis for $R^m$.

Moreover $\set{d_1 v_1, \ldots, d_r v_r}$ is linearly independent, because for $s_1, \ldots, s_r\in R$, $$ \begin{align*} s_1 d_1 v_1 + \ldots + s_r d_r v_r = 0 \implies s_1 d_1 = \ldots = s_r d_r = 0 \implies s_1 = \ldots = s_r = 0 \end{align*} $$ by the linear independence of $\set{v_1, \ldots, v_m}$, so it is a basis for $N$.