# Ring not recognized as a PID

I need to work with finitely generated modules over a PID, which the localization at a prime of the ring of Gaussian integers. It happens to be a PID, but if I try to execute the following code:

K.<i> = NumberField(x^2 + 1)
R = K.maximal_order().localization(7)
MS = span([[0, 1, 0]], R)


I get this error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-41-97a6c80cace8> in <module>
----> 1 MS = span([[Integer(0),Integer(1),Integer(0)]],R)

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/modules/free_module.py in span(gens, base_ring, check, already_echelonized)
686     if R not in PrincipalIdealDomains():
687         raise TypeError("The base_ring (= %s) must be a principal ideal "
--> 688                         "domain." % R)
689     if not gens:
690         return FreeModule(R, 0)

TypeError: The base_ring (= Gaussian Integers in Number Field in i with defining polynomial x^2 + 1 localized at (7,)) must be a principal ideal domain.


I have tried with R = K.maximal_order() and R = ZZ.localization(5), but they yield similar errors. So I understand that Sage doesn't automatically recognize those rings as PIDs, even though they are and there is a constructive way to find the generator of an ideal. Is there a way for me to get Sage to see my ring as a PID?

edit retag close merge delete

## Comments

Note that Sage does not even recognize the maximal order as a PID

sage: O = K.maximal_order()
sage: O.class_number()
1
sage: O in PrincipalIdealDomains()
False

( 2021-04-14 08:48:34 +0100 )edit

There would be a lot to do around orders in number fields in Sage.

( 2021-04-15 18:13:46 +0100 )edit