Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/algebra_ideals.py
4072 views
1
r"""
2
AlgebraIdeals
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2005 David Kohel <[email protected]>
6
# William Stein <[email protected]>
7
# 2008-2009 Nicolas M. Thiery <nthiery at users.sf.net>
8
#
9
# Distributed under the terms of the GNU General Public License (GPL)
10
# http://www.gnu.org/licenses/
11
#******************************************************************************
12
13
from sage.misc.cachefunc import cached_method
14
from category_types import Category_ideal
15
from algebra_modules import AlgebraModules
16
from commutative_algebras import CommutativeAlgebras
17
18
class AlgebraIdeals(Category_ideal):
19
"""
20
The category of two-sided ideals in a fixed algebra `A`.
21
22
EXAMPLES::
23
24
sage: AlgebraIdeals(FreeAlgebra(QQ,2,'a,b'))
25
Category of algebra ideals in Free Algebra on 2 generators (a, b) over Rational Field
26
27
TODO:
28
- If useful, implement AlgebraLeftIdeals and AlgebraRightIdeals
29
of which AlgebraIdeals would be a subcategory
30
31
- Make AlgebraIdeals(R), return CommutativeAlgebraIdeals(R) when R is
32
commutative
33
"""
34
def __init__(self, A):
35
"""
36
EXAMPLES::
37
38
sage: AlgebraIdeals(FreeAlgebra(QQ,2,'a,b'))
39
Category of algebra ideals in Free Algebra on 2 generators (a, b) over Rational Field
40
sage: AlgebraIdeals(QQ)
41
Traceback (most recent call last):
42
...
43
TypeError: A (=Rational Field) must be an algebra
44
45
TESTS::
46
47
sage: TestSuite(AlgebraIdeals(FreeAlgebra(QQ,2,'a,b'))).run()
48
"""
49
from sage.algebras.algebra import is_Algebra
50
if not is_Algebra(A): # A not in Algebras() ?
51
raise TypeError, "A (=%s) must be an algebra"%A
52
Category_ideal.__init__(self, A)
53
54
def algebra(self):
55
"""
56
EXAMPLES::
57
58
sage: AlgebraIdeals(QQ[x]).algebra()
59
Univariate Polynomial Ring in x over Rational Field
60
"""
61
return self.ambient()
62
63
def super_categories(self):
64
"""
65
The category of algebra modules should be a super category of this category.
66
67
However, since algebra modules are currently only available over commutative rings,
68
we have to omit it if our ring is non-commutative.
69
70
EXAMPLES::
71
72
sage: AlgebraIdeals(QQ[x]).super_categories()
73
[Category of algebra modules over Univariate Polynomial Ring in x over Rational Field]
74
sage: C = AlgebraIdeals(FreeAlgebra(QQ,2,'a,b'))
75
sage: C.super_categories()
76
[]
77
78
"""
79
R = self.algebra()
80
try:
81
if R.is_commutative():
82
return [AlgebraModules(R)]
83
except (AttributeError,NotImplementedError):
84
pass
85
return []
86
87