Skip to content

Commit

Permalink
Trac #33568: Add method is_integral_domain for polynomial quotient …
Browse files Browse the repository at this point in the history
…rings

We add a method `is_integral_domain`
to the `PolynomialQuotientRing` class.

URL: https://trac.sagemath.org/33568
Reported by: gh-schmittj
Ticket author(s): Johannes Schmitt
Reviewer(s): Vincent Delecroix
  • Loading branch information
Release Manager committed Mar 31, 2022
2 parents 76d0d33 + 3173fbe commit 3dd4e6b
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 8 deletions.
6 changes: 3 additions & 3 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=configure-VERSION.tar.gz
sha1=a0eb0004d52bcf6279753f7afc196124f41a2aec
md5=f23c9203da185c3f6e436dd7e99b45e5
cksum=1232840594
sha1=b96c0334857e7afceccdb63b4e9ccb0c2560961f
md5=e18f9c50c26c1c4e6c004137fd9db79d
cksum=2456915872
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f43e375fb59b4b297a3b2b4c3da31f0d4d34adb3
d7a2f1f4880be729ef4d26ceaf3f1b8af941feb8
81 changes: 81 additions & 0 deletions src/sage/rings/polynomial/polynomial_quotient_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,87 @@ def is_field(self, proof = True):
self._refine_category_(Fields())
return ret

def is_integral_domain(self, proof = True):
"""
Return whether or not this quotient ring is an integral domain.
EXAMPLES::
sage: R.<z> = PolynomialRing(ZZ)
sage: S = R.quotient(z^2 - z)
sage: S.is_integral_domain()
False
sage: T = R.quotient(z^2 + 1)
sage: T.is_integral_domain()
True
sage: U = R.quotient(-1)
sage: U.is_integral_domain()
False
sage: R2.<y> = PolynomialRing(R)
sage: S2 = R2.quotient(z^2 - y^3)
sage: S2.is_integral_domain()
True
sage: S3 = R2.quotient(z^2 - 2*y*z + y^2)
sage: S3.is_integral_domain()
False
sage: R.<z> = PolynomialRing(ZZ.quotient(4))
sage: S = R.quotient(z-1)
sage: S.is_integral_domain()
False
TESTS:
Here is an example of a quotient ring which is not an integral
domain, even though the base ring is integral and the modulus is
irreducible::
sage: B = ZZ.extension(x^2 - 5, 'a')
sage: R.<y> = PolynomialRing(B)
sage: S = R.quotient(y^2 - y - 1)
sage: S.is_integral_domain()
Traceback (most recent call last):
...
NotImplementedError
sage: S.is_integral_domain(proof = False)
False
The reason that the modulus y^2 - y -1 is not prime is that it
divides the product
(2*y-(1+a))*(2*y-(1-a)) = 4*y^2 - 4*y - 4.
Unfortunately, the program above is already unable to determine
that the modulus is irreducible.
"""
from sage.categories.all import IntegralDomains
if self.category().is_subcategory(IntegralDomains()):
return True
ret = self.base_ring().is_integral_domain(proof)
if ret:
try:
irr = self.modulus().is_irreducible()
if not irr:
# since the modulus is nonzero, the condition of the base ring being an
# integral domain and the modulus being irreducible are
# necessary but not sufficient
ret = False
else:
from sage.categories.gcd_domains import GcdDomains
if self.base_ring() in GcdDomains():
# if the base ring is a GCD domain, the conditions are sufficient
ret = True
else:
raise NotImplementedError
except NotImplementedError:
if proof:
raise
else:
ret = False

if ret:
self._refine_category_(IntegralDomains())
return ret

def krull_dimension(self):
"""
Return the Krull dimension.
Expand Down
6 changes: 2 additions & 4 deletions src/sage/rings/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -982,11 +982,9 @@ cdef class Ring(ParentWithGens):
sage: R.fraction_field()
Traceback (most recent call last):
...
NotImplementedError
TypeError: self must be an integral domain.
sage: R.is_integral_domain()
Traceback (most recent call last):
...
NotImplementedError
False
Forward the proof flag to ``is_field``, see :trac:`22910`::
Expand Down

0 comments on commit 3dd4e6b

Please sign in to comment.