Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/algebra_modules.py
4057 views
1
r"""
2
Algebra modules
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_module
15
from modules import Modules
16
17
class AlgebraModules(Category_module):
18
"""
19
The category of modules over a fixed algebra $A$.
20
21
EXAMPLES::
22
23
sage: AlgebraModules(QQ['a'])
24
Category of algebra modules over Univariate Polynomial Ring in a over Rational Field
25
sage: AlgebraModules(QQ['a']).super_categories()
26
[Category of modules over Univariate Polynomial Ring in a over Rational Field]
27
28
Note: as of now, `A` is required to be commutative, ensuring that
29
the categories of left and right modules are isomorphic. Feedback
30
and use cases for potential generalizations to the non commutative
31
case are welcome.
32
33
"""
34
def __init__(self, A):
35
"""
36
EXAMPLES::
37
38
sage: AlgebraModules(QQ['a'])
39
Category of algebra modules over Univariate Polynomial Ring in a over Rational Field
40
sage: AlgebraModules(QQ['a,b']) # todo: not implemented (QQ['a,b'] should be in Algebras(QQ))
41
sage: AlgebraModules(FreeAlgebra(QQ,2,'a,b'))
42
Traceback (most recent call last):
43
...
44
TypeError: A (=Free Algebra on 2 generators (a, b) over Rational Field) must be a commutative algebra
45
sage: AlgebraModules(QQ)
46
Traceback (most recent call last):
47
...
48
TypeError: A (=Rational Field) must be a commutative algebra
49
50
TESTS::
51
52
sage: TestSuite(AlgebraModules(QQ['a'])).run()
53
"""
54
from sage.categories.commutative_algebras import CommutativeAlgebras
55
if not hasattr(A, "base_ring") or not A in CommutativeAlgebras(A.base_ring()):
56
raise TypeError, "A (=%s) must be a commutative algebra"%A
57
Category_module.__init__(self, A)
58
59
@classmethod
60
def an_instance(cls):
61
"""
62
Returns an instance of this class
63
64
EXAMPLES::
65
66
sage: AlgebraModules.an_instance()
67
Category of algebra modules over Univariate Polynomial Ring in x over Rational Field
68
"""
69
from sage.rings.rational_field import QQ
70
return cls(QQ['x'])
71
72
def algebra(self):
73
"""
74
EXAMPLES::
75
76
sage: AlgebraModules(QQ[x]).algebra()
77
Univariate Polynomial Ring in x over Rational Field
78
"""
79
return self.base_ring()
80
81
def super_categories(self):
82
"""
83
EXAMPLES::
84
85
sage: AlgebraModules(QQ[x]).super_categories()
86
[Category of modules over Univariate Polynomial Ring in x over Rational Field]
87
"""
88
R = self.algebra()
89
return [Modules(R)]
90
91