Let $\mathsf{R}$ be a PID and consider a collection of free, finitely generated $\mathsf{R}$-modules $V_1,\ldots,V_n$ along with module maps $m_j:V_j \to V_{j+1}$. That is, we have the following sequence

$$ V_1 \stackrel{m_1}{\to} V_2 \stackrel{m_2}{\to} \ldots \stackrel{m_{n-1}}{\to} V_n $$

In particular, if we fix bases of each $V_j$ a priori, we may view each $m_j$ as a matrix with entries in $\mathsf{R}$. Recall that the Smith Normal Form (SNF) of such a matrix is obtained by performing row and column operations - that is, change of bases of $V_j$ and $V_{j+1}$- so that the end result is a canonical matrix with zero off-diagonal entries and where each diagonal entry divides the next.

Start at the end of this sequence and note that we can always put the last matrix $m_{n-1}$ in SNF by performing suitable row and column operations. But now, if we try to do the same with $m_{n-2}$ for instance, we would generically have to change the basis of $V_{n-1}$ and in this new basis $m_{n-1}$ may no longer be in SNF.

Here are the questions:

Under what conditions can one prove the existence of bases of the $V_j$s such that each $m_j$ is in SNF with respect to the chosen basis of $V_j$ and $V_{j+1}$?

And when such conditions hold,

Is there an efficient algorithm for finding these bases?