Skip to content

Commit

Permalink
Trac #34372: Make is_integral_domain() have the same signature
Browse files Browse the repository at this point in the history
This is not fully consistent within Sage:
{{{
travis@tscrim:~/sage-build$ grep -R "def is_integral_domain" src/sage/*
src/sage/algebras/steenrod/steenrod_algebra.py:    def
is_integral_domain(self, proof=True):
src/sage/algebras/quatalg/quaternion_algebra.py:    def
is_integral_domain(self, proof=True) -> bool:
src/sage/categories/integral_domains.py:        def
is_integral_domain(self):
src/sage/categories/group_algebras.py:        def
is_integral_domain(self, proof=True):
src/sage/combinat/sf/sfa.py:        def is_integral_domain(self,
proof=True):
src/sage/manifolds/chart_func.py:    def is_integral_domain(self,
proof=True):
src/sage/rings/quotient_ring.py:    def is_integral_domain(self,
proof=True):
src/sage/rings/ring.pyx:    def is_integral_domain(self, proof = True):
src/sage/rings/ring.pyx:    def is_integral_domain(self, proof = True):
src/sage/rings/finite_rings/integer_mod_ring.py:    def
is_integral_domain(self, proof=None):
src/sage/rings/multi_power_series_ring.py:    def
is_integral_domain(self, proof=False):
src/sage/rings/polynomial/laurent_polynomial_ring.py:    def
is_integral_domain(self, proof=True):
src/sage/rings/polynomial/multi_polynomial_ring_base.c: *     def
is_integral_domain(self, proof=True):
src/sage/rings/polynomial/multi_polynomial_ring_base.c: *     def
is_integral_domain(self, proof=True):             # <<<<<<<<<<<<<<
src/sage/rings/polynomial/multi_polynomial_ring_base.c: *     def
is_integral_domain(self, proof=True):             # <<<<<<<<<<<<<<
src/sage/rings/polynomial/polynomial_quotient_ring.py:    def
is_integral_domain(self, proof = True):
src/sage/rings/polynomial/infinite_polynomial_ring.py:    def
is_integral_domain(self, *args, **kwds):
src/sage/rings/polynomial/polynomial_ring.py:    def
is_integral_domain(self, proof = True):
src/sage/rings/polynomial/multi_polynomial_ring_base.pyx:    def
is_integral_domain(self, proof=True):
src/sage/rings/polynomial/multi_polynomial_ring.py:    def
is_integral_domain(self, proof=True):
src/sage/rings/tate_algebra.py:    def is_integral_domain(self):
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
# <<<<<<<<<<<<<<
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
# <<<<<<<<<<<<<<
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
# <<<<<<<<<<<<<<
src/sage/rings/ring.c: *     def is_integral_domain(self, proof = True):
# <<<<<<<<<<<<<<
}}}
This causes failures for the tests that also pass a proof argument. For
example:
{{{
sage: A.<x,y> = TateAlgebra(Zp(3))
sage: R.<a,b> = PolynomialRing(A)
sage: R.is_integral_domain()
------------------------------------------------------------------------
---
TypeError                                 Traceback (most recent call
last)
Input In [3], in <cell line: 1>()
----> 1 R.is_integral_domain()

File
~/sage/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx:108, in
sage.rings.polynomial.multi_polynomial_ring_base.MPolynomialRing_base.is
_integral_domain()
    106         False
    107     """
--> 108     return self.base_ring().is_integral_domain(proof)
    109
    110 def is_noetherian(self):

TypeError: TateAlgebra_generic.is_integral_domain() takes 1 positional
argument but 2 were given
}}}

URL: https://trac.sagemath.org/34372
Reported by: tscrim
Ticket author(s): Travis Scrimshaw
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager committed Aug 29, 2022
2 parents e874714 + ae8cfa3 commit 85b5ab9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 11 additions & 4 deletions src/sage/categories/integral_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,23 @@ def _contains_helper(cls):
return Category_contains_method_by_parent_class(cls())

class ParentMethods:
def is_integral_domain(self):
"""
Return True, since this in an object of the category of integral domains.
def is_integral_domain(self, proof=True):
r"""
Return ``True``, since this in an object of the category
of integral domains.
EXAMPLES::
sage: QQ.is_integral_domain()
True
sage: Parent(QQ,category=IntegralDomains()).is_integral_domain()
sage: Parent(QQ, category=IntegralDomains()).is_integral_domain()
True
sage: L.<z> = LazyLaurentSeriesRing(QQ)
sage: L.is_integral_domain()
True
sage: L.is_integral_domain(proof=True)
True
"""
return True

Expand Down Expand Up @@ -138,3 +144,4 @@ def _test_fraction_field(self, **options):

class ElementMethods:
pass

13 changes: 11 additions & 2 deletions src/sage/rings/tate_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,8 @@ def random_element(self, degree=2, terms=5, integral=False, prec=None):
gens = [ self.element_class(self, g) for g in self._integer_ring._gens ]
return self.element_class(self, polring.random_element(degree, terms)(*gens), prec)

def is_integral_domain(self):
"""
def is_integral_domain(self, proof=True):
r"""
Return ``True`` since any Tate algebra is an integral domain.
EXAMPLES::
Expand All @@ -1285,5 +1285,14 @@ def is_integral_domain(self):
sage: A.is_integral_domain()
True
TESTS:
Check that :trac:`34372` is fixed::
sage: A.<x,y> = TateAlgebra(Zp(3))
sage: R.<a,b> = PolynomialRing(A)
sage: R.is_integral_domain(proof=True)
True
"""
return True

0 comments on commit 85b5ab9

Please sign in to comment.