Solution (source code)

= Solution

Suppose first that $M$ is finitely generated. Its quotient $M/N$ is generated by the images of any finite generating set of $M$. A <principal ideal domain> is <Noetherian ring>[Noetherian], so every submodule of the finitely generated $R$-module $M$ is finitely generated; in particular, $N$ is finitely generated.

Conversely, suppose
$$
N=(n_1,\ldots,n_r)
$$
and $M/N$ is generated by the cosets $\overline m_1,\ldots,\overline m_s$. For any $m\in M$, its coset is an $R$-linear combination of the $\overline m_j$, so
$$
m-\sum_{j=1}^sa_jm_j\in N.
$$
Expressing this remainder in terms of the $n_i$ shows that
$$
M=(n_1,\ldots,n_r,m_1,\ldots,m_s).
$$
\b[Thus $M$ is finitely generated if and only if both the <submodule> $N$ and the <quotient module> $M/N$ are finitely generated.]