Skip to content

Commit

Permalink
make a category of Dedekind domains, remove code from ring.pyx
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Feb 5, 2024
1 parent 0c390a0 commit c85a268
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 147 deletions.
2 changes: 1 addition & 1 deletion src/sage/categories/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
RingModules = Modules
from sage.categories.vector_spaces import VectorSpaces

# (hopf) algebra structures
# (Hopf) algebra structures
from sage.categories.algebras import Algebras
from sage.categories.commutative_algebras import CommutativeAlgebras
from sage.categories.coalgebras import Coalgebras
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from sage.categories.commutative_rings import CommutativeRings
from sage.categories.integral_domains import IntegralDomains
from sage.categories.gcd_domains import GcdDomains
from sage.categories.dedekind_domains import DedekindDomains
from sage.categories.principal_ideal_domains import PrincipalIdealDomains
from sage.categories.euclidean_domains import EuclideanDomains
from sage.categories.unique_factorization_domains import UniqueFactorizationDomains
Expand Down
3 changes: 2 additions & 1 deletion src/sage/categories/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
_join_cache = WeakValueDictionary()


HALL_OF_FAME = ['Coxeter', 'Hopf', 'Weyl', 'Lie', 'Hecke']
HALL_OF_FAME = ['Coxeter', 'Hopf', 'Weyl', 'Lie', 'Hecke', 'Dedekind']


class Category(UniqueRepresentation, SageObject):
Expand Down Expand Up @@ -2592,6 +2592,7 @@ def category_sample():
sage: from sage.categories.category import category_sample
sage: sorted(category_sample(), key=str) # needs sage.groups
[Category of Coxeter groups,
Category of Dedekind domains,
Category of G-sets for Symmetric group of order 8! as a permutation group,
Category of Hecke modules over Rational Field,
Category of Hopf algebras over Rational Field,
Expand Down
155 changes: 155 additions & 0 deletions src/sage/categories/dedekind_domains.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
r"""
Dedekind Domains
"""
# ****************************************************************************
# Distributed under the terms of the GNU General Public License (GPL)
# https://www.gnu.org/licenses/
# *****************************************************************************
from sage.categories.category import Category
from sage.categories.integral_domains import IntegralDomains


class DedekindDomains(Category):
"""
The category of Dedekind domains.
A Dedekind domain is a Noetherian integral domain of Krull
dimension one that is integrally closed in its field of fractions.
EXAMPLES::
sage: C = DedekindDomains(); C
Category of Dedekind domains
sage: C.super_categories()
[Category of integral domains]
TESTS::
sage: TestSuite(C).run()
"""
def super_categories(self):
"""
EXAMPLES::
sage: DedekindDomains().super_categories()
[Category of integral domains]
"""
return [IntegralDomains()]

class ParentMethods:
def krull_dimension(self):
"""
Return 1 since Dedekind domains have Krull dimension 1.
EXAMPLES:
The following are examples of Dedekind domains::
sage: ZZ.krull_dimension()
1
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.krull_dimension() # needs sage.rings.number_field
1
The following are not Dedekind domains but have
a ``krull_dimension`` function::
sage: QQ.krull_dimension()
0
sage: T.<x,y> = PolynomialRing(QQ,2); T
Multivariate Polynomial Ring in x, y over Rational Field
sage: T.krull_dimension()
2
sage: U.<x,y,z> = PolynomialRing(ZZ,3); U
Multivariate Polynomial Ring in x, y, z over Integer Ring
sage: U.krull_dimension()
4
sage: # needs sage.rings.number_field
sage: K.<i> = QuadraticField(-1)
sage: R = K.order(2*i); R
Order of conductor 2 generated by 2*i
in Number Field in i with defining polynomial x^2 + 1 with i = 1*I
sage: R.is_maximal()
False
sage: R.krull_dimension()
1
"""
from sage.rings.integer_ring import ZZ
return ZZ.one()

def is_integrally_closed(self) -> bool:
"""
Return ``True`` since Dedekind domains are integrally closed.
EXAMPLES:
The following are examples of Dedekind domains::
sage: ZZ.is_integrally_closed()
True
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.is_integrally_closed() # needs sage.rings.number_field
True
These, however, are not Dedekind domains::
sage: QQ.is_integrally_closed()
True
sage: S = ZZ[sqrt(5)]; S.is_integrally_closed() # needs sage.rings.number_field sage.symbolic
False
sage: T.<x,y> = PolynomialRing(QQ, 2); T
Multivariate Polynomial Ring in x, y over Rational Field
sage: T.is_integral_domain()
True
"""
return True

def integral_closure(self):
r"""
Return ``self`` since Dedekind domains are integrally closed.
EXAMPLES::
sage: # needs sage.rings.number_field
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's')
sage: OK = K.ring_of_integers()
sage: OK.integral_closure()
Gaussian Integers generated by s in Number Field in s
with defining polynomial x^2 + 1
sage: OK.integral_closure() == OK
True
sage: QQ.integral_closure() == QQ
True
"""
return self

def is_noetherian(self) -> bool:
r"""
Return ``True`` since Dedekind domains are Noetherian.
EXAMPLES:
The integers, `\ZZ`, and rings of integers of number
fields are Dedekind domains::
sage: ZZ.is_noetherian()
True
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.is_noetherian() # needs sage.rings.number_field
True
sage: QQ.is_noetherian()
True
"""
return True

class ElementMethods:
pass
28 changes: 14 additions & 14 deletions src/sage/rings/integer_ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import sage.rings.rational_field
import sage.rings.ideal
import sage.libs.pari.all
import sage.rings.ideal
from sage.categories.basic import EuclideanDomains
from sage.categories.basic import EuclideanDomains, DedekindDomains
from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets
from sage.rings.number_field.number_field_element_base import NumberFieldElement_base
from sage.structure.coerce cimport is_numpy_type
Expand Down Expand Up @@ -122,7 +122,8 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
sage: Z.is_field()
False
sage: Z.category()
Join of Category of euclidean domains
Join of Category of Dedekind domains
and Category of euclidean domains
and Category of infinite enumerated sets
and Category of metric spaces
sage: Z(2^(2^5) + 1)
Expand Down Expand Up @@ -312,7 +313,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
True
"""
Parent.__init__(self, base=self, names=('x',), normalize=False,
category=(EuclideanDomains(), InfiniteEnumeratedSets().Metric()))
category=(EuclideanDomains(), DedekindDomains(), InfiniteEnumeratedSets().Metric()))
self._populate_coercion_lists_(init_no_parent=True,
convert_method_name='_integer_')

Expand Down Expand Up @@ -852,17 +853,6 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
except TypeError:
return False

def is_noetherian(self):
"""
Return ``True`` since the integers are a Noetherian ring.
EXAMPLES::
sage: ZZ.is_noetherian()
True
"""
return True

def _repr_option(self, key):
"""
Metadata about the :meth:`_repr_` output.
Expand Down Expand Up @@ -1132,6 +1122,11 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
"""
Return the Krull dimension of the integers, which is 1.
.. NOTE::
This should rather be inherited from the category
of ``DedekindDomains``.
EXAMPLES::
sage: ZZ.krull_dimension()
Expand All @@ -1143,6 +1138,11 @@ cdef class IntegerRing_class(PrincipalIdealDomain):
"""
Return that the integer ring is, in fact, integrally closed.
.. NOTE::
This should rather be inherited from the category
of ``DedekindDomains``.
EXAMPLES::
sage: ZZ.is_integrally_closed()
Expand Down
131 changes: 0 additions & 131 deletions src/sage/rings/ring.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1753,137 +1753,6 @@ cdef class NoetherianRing(CommutativeRing):
"""
return True

cdef class DedekindDomain(IntegralDomain):
"""
Generic Dedekind domain class.
A Dedekind domain is a Noetherian integral domain of Krull
dimension one that is integrally closed in its field of fractions.
This class is deprecated, and not actually used anywhere in the
Sage code base. If you think you need it, please create a
category :class:`DedekindDomains`, move the code of this class
there, and use it instead.
"""
def krull_dimension(self):
"""
Return 1 since Dedekind domains have Krull dimension 1.
EXAMPLES:
The following are examples of Dedekind domains (Noetherian integral
domains of Krull dimension one that are integrally closed over its
field of fractions)::
sage: ZZ.krull_dimension()
1
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.krull_dimension() # needs sage.rings.number_field
1
The following are not Dedekind domains but have
a ``krull_dimension`` function::
sage: QQ.krull_dimension()
0
sage: T.<x,y> = PolynomialRing(QQ,2); T
Multivariate Polynomial Ring in x, y over Rational Field
sage: T.krull_dimension()
2
sage: U.<x,y,z> = PolynomialRing(ZZ,3); U
Multivariate Polynomial Ring in x, y, z over Integer Ring
sage: U.krull_dimension()
4
sage: # needs sage.rings.number_field
sage: K.<i> = QuadraticField(-1)
sage: R = K.order(2*i); R
Order of conductor 2 generated by 2*i
in Number Field in i with defining polynomial x^2 + 1 with i = 1*I
sage: R.is_maximal()
False
sage: R.krull_dimension()
1
"""
return 1

def is_integrally_closed(self):
"""
Return ``True`` since Dedekind domains are integrally closed.
EXAMPLES:
The following are examples of Dedekind domains (Noetherian integral
domains of Krull dimension one that are integrally closed over its
field of fractions).
::
sage: ZZ.is_integrally_closed()
True
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.is_integrally_closed() # needs sage.rings.number_field
True
These, however, are not Dedekind domains::
sage: QQ.is_integrally_closed()
True
sage: S = ZZ[sqrt(5)]; S.is_integrally_closed() # needs sage.rings.number_field sage.symbolic
False
sage: T.<x,y> = PolynomialRing(QQ, 2); T
Multivariate Polynomial Ring in x, y over Rational Field
sage: T.is_integral_domain()
True
"""
return True

def integral_closure(self):
r"""
Return ``self`` since Dedekind domains are integrally closed.
EXAMPLES::
sage: # needs sage.rings.number_field
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's')
sage: OK = K.ring_of_integers()
sage: OK.integral_closure()
Gaussian Integers generated by s in Number Field in s
with defining polynomial x^2 + 1
sage: OK.integral_closure() == OK
True
sage: QQ.integral_closure() == QQ
True
"""
return self

def is_noetherian(self):
r"""
Return ``True`` since Dedekind domains are Noetherian.
EXAMPLES:
The integers, `\ZZ`, and rings of integers of number
fields are Dedekind domains::
sage: ZZ.is_noetherian()
True
sage: x = polygen(ZZ, 'x')
sage: K = NumberField(x^2 + 1, 's') # needs sage.rings.number_field
sage: OK = K.ring_of_integers() # needs sage.rings.number_field
sage: OK.is_noetherian() # needs sage.rings.number_field
True
sage: QQ.is_noetherian()
True
"""
return True


cdef class PrincipalIdealDomain(IntegralDomain):
"""
Expand Down

0 comments on commit c85a268

Please sign in to comment.