A characterization of principal rings

I would like to know if the following characterization (for principal rings, not necessarily domains) is true:

$$A$$ is principal $$\leftrightarrow$$ $$A_\mathscr{M}$$ is principal $$\forall \mathscr{M} \in SpecMax (A)$$

Where:

$$SpecMax(A)$$ is the set of maximal ideals of $$A$$.

$$A_\mathscr{M}$$ is the localization of $$A$$ for the ideal $$\mathscr{M}$$

I know it's true that:

$$A$$ is principal $$\rightarrow$$ $$A_\mathscr{M}$$ is principal $$\forall \mathscr{M} \in SpecMax (A)$$

I would like to know if anyone knows of any proof for the converse, or some counterexample.

Thank you

• No, this is not true. Consider the example of $A$ a Dedekind domain. The localization of $A$ at any maximal ideal is a DVR (hence a PID), but there are many Dedekind domains which are not PIDs, e.g. $\mathbb{Z}[\sqrt{-5}]$. (The obstruction is precisely unique factorization: a Dedekind domain is a UFD if and only if it is a PID.) – Alex Wertheim Apr 30 at 18:44
• Seems to me that you could write that as an answer. – Captain Lama Apr 30 at 18:48
• @CaptainLama: I once wrote a short (but correct!) answer, and another MSE user wrote me a nasty comment saying I had ''botched it'' and accusing me of trying to write a short, cheap answer (for internet points, of all things). I am loath to repeat that experience. If I have a bit more time later, I'll write an answer if no one else has, but in the meantime, anyone is welcome to turn my comment into an answer if they want to. – Alex Wertheim Apr 30 at 18:57
• @AlexWertheim Well, if a user was able to derail you from contributing correct answers with one dumb comment, perhaps one user can get you writing them again with a new comment? You can count this post as well as Captain Lama's as two, if you like. – rschwieb Apr 30 at 19:35
• @rschwieb: thanks for the kind comment. I'll give it a go! – Alex Wertheim May 1 at 6:32

So, for example, $$\prod_{i=1}^\infty F_2$$ would work.