Triangularization of matrix over PID Let $R$ be a PID and let  $A \in Mat_n(R)$ with all of its eigenvalues in R. Is it true that I can always find $P \in GL_n(R)$ such that $P^{-1}AP$ is uppertriangular?  If so can I have a reference for this. Otherwise what additional hypotheses on $A$ do I need in order for it to be true. If it helps the case I am interested in is when $R$ is the ring of integers of some extension of $\mathbb{Q}_p$ or even just $\mathcal{O}_{\mathbb{C}_p}$. 
Thank you.
 A: Let $R$ be a PID with quotient field $F$, let $n$ be a positive integer, let $L\cong R^n$ be a free $R$-module of rank $n$, and let $V=F^n$, so that $L \subseteq V$ is an $R$-lattice in the $F$-vector space $V$. Given an endomorphism $A \in \mathrm{End}_R(L)$ we will call $A$ $F$-split if all the roots of its characteristic polynomial $p(t)=\mathrm{det}(t\cdot 1 -A)$ are elements of $F$ (in other words, if the characteristic polynomial splits into linear factors over $F$). We will show that, given an $F$-split endomorphism $A$ of $L$, there is some basis of $L$ with respect to which $A$ is upper triangular. (Note that since $R$ is a PID, it is in particular integrally closed, so that once we assume the roots of the characteristic polynomial are in $F$ they are a fortiori elements of $R$). 
We proceed by induction on $n$. For $n=1$ the result is trivially true. In general let $v \in V$ be an eigenvector for $A$ of some eigenvalue $\lambda$ (this exists by our hypothesis). Let $L_1=F v \cap L$, which is an $A$-stable $R$-submodule of $L$. Since $R$ is a PID, any finitely generated generate torsion free $R$-module is free, and hence $L_1$ and $L'=L/L_1$ are free. Moreover, the rank of $L'$ (that is, the dimension of $F \otimes_R L'$ as an $F$-vector space) is one less than the rank of $L$. The characteristic polynomial $p'$ of $A$ as an endomorphism of $L'$ satisfies
$$p=(t-\lambda)\cdot p',$$ where $p$ is the characteristic polynomial of $A$ as an endomorphism of $L$, so that our inductive hypothesis applies to $A$ acting on $L'$, and there is a basis $\overline{v_2},\dots,\overline{v_n}$ of $L'$ with respect to which $A$ is upper triangular, where $v_2,\dots,v_n \in L$. Now choosing a basis element $v_1$ of $L_1$ gives a basis with respect to which $A$ is upper triangular. This completes the proof.
The proof amounts to an algorithm for computing such a basis of $L$, provided that your PID R is given in such a way that you can compute a basis element $v_1$ of $L_1$. The first step is to compute any eigenvector $v$ in $F^n$; one must then find the least common multiple of the denominators of the coordinates of $v$ to compute $v_1$. Thus at least whenever you have some version of the Euclidean algorithm available for $R$ (e.g., in $\mathbf{Z}$ or $\mathbf{Z}[i]$, and certainly in case $R$ is a DVR such as $\mathbf{Z}_p$ or the completion of a ring of algebraic integers at a prime ideal) the proof can be made into an effective computation.
