Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/commutative_rings.py
4072 views
1
r"""
2
Commutative rings
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2005 David Kohel <[email protected]>
6
# William Stein <[email protected]>
7
# 2008 Teresa Gomez-Diaz (CNRS) <[email protected]>
8
# 2008-2009 Nicolas M. Thiery <nthiery at users.sf.net>
9
#
10
# Distributed under the terms of the GNU General Public License (GPL)
11
# http://www.gnu.org/licenses/
12
#******************************************************************************
13
14
from sage.categories.category import Category
15
from sage.categories.category_singleton import Category_singleton
16
from sage.misc.cachefunc import cached_method
17
18
class CommutativeRings(Category_singleton):
19
"""
20
The category of commutative rings
21
22
commutative rings with unity, i.e. rings with commutative * and
23
a multiplicative identity
24
25
EXAMPLES::
26
27
sage: CommutativeRings()
28
Category of commutative rings
29
sage: CommutativeRings().super_categories()
30
[Category of rings]
31
32
TESTS::
33
34
sage: TestSuite(CommutativeRings()).run()
35
36
sage: QQ['x,y,z'] in CommutativeRings()
37
True
38
sage: GroupAlgebra(DihedralGroup(3), QQ) in CommutativeRings()
39
False
40
sage: MatrixSpace(QQ,2,2) in CommutativeRings()
41
False
42
43
GroupAlgebra should be fixed::
44
45
sage: GroupAlgebra(CyclicPermutationGroup(3), QQ) in CommutativeRings() # todo: not implemented
46
True
47
48
"""
49
50
@cached_method
51
def super_categories(self):
52
"""
53
EXAMPLES::
54
55
sage: CommutativeRings().super_categories()
56
[Category of rings]
57
"""
58
from sage.categories.rings import Rings
59
return [Rings()]
60
61
class ParentMethods:
62
def is_commutative(self):
63
"""
64
Return True, since commutative rings are commutative.
65
66
EXAMPLES::
67
68
sage: Parent(QQ,category=CommutativeRings()).is_commutative()
69
True
70
71
"""
72
return True
73
74
class ElementMethods:
75
pass
76
77