Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/bimodules.py
4069 views
1
r"""
2
Bimodules
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.misc.cachefunc import cached_method
16
from sage.categories.left_modules import LeftModules
17
from sage.categories.right_modules import RightModules
18
19
from sage.categories.rings import Rings
20
_Rings = Rings()
21
22
#?class Bimodules(Category_over_base_rng, Category_over_base_rng):
23
class Bimodules(Category):
24
"""
25
The category of `(R,S)`-bimodules
26
27
For `R` and `S` rings, a `(R,S)`-bimodule `X` is a left `R`-module
28
and right `S`-module such that the left and right actions commute:
29
`r*(x*s) = (r*x)*s`.
30
31
EXAMPLES::
32
33
sage: Bimodules(QQ, ZZ)
34
Category of bimodules over Rational Field on the left and Integer Ring on the right
35
sage: Bimodules(QQ, ZZ).super_categories()
36
[Category of left modules over Rational Field, Category of right modules over Integer Ring]
37
"""
38
39
def __init__(self, left_base, right_base, name=None):
40
"""
41
EXAMPLES::
42
43
sage: C = Bimodules(QQ, ZZ)
44
sage: TestSuite(C).run()
45
"""
46
Category.__init__(self, name)
47
assert left_base in _Rings, "The left base must be a ring"
48
assert right_base in _Rings, "The right base must be a ring"
49
self._left_base_ring = left_base
50
self._right_base_ring = right_base
51
52
@classmethod
53
def an_instance(cls):
54
"""
55
Returns an instance of this class
56
57
EXAMPLES::
58
59
sage: Bimodules.an_instance()
60
Category of bimodules over Rational Field on the left and Real Field with 53 bits of precision on the right
61
"""
62
from sage.rings.all import QQ, RR
63
return cls(QQ, RR)
64
65
def _repr_object_names(self):
66
"""
67
EXAMPLES::
68
69
sage: Bimodules(QQ, ZZ) # indirect doctest
70
Category of bimodules over Rational Field on the left and Integer Ring on the right
71
"""
72
return "bimodules over %s on the left and %s on the right" \
73
%(self._left_base_ring, self._right_base_ring)
74
75
def left_base_ring(self):
76
"""
77
Returns the left base ring over which elements of this category are
78
defined.
79
80
EXAMPLES::
81
82
sage: Bimodules(QQ, ZZ).left_base_ring()
83
Rational Field
84
"""
85
return self._left_base_ring
86
87
def right_base_ring(self):
88
"""
89
Returns the right base ring over which elements of this category are
90
defined.
91
92
EXAMPLES::
93
94
sage: Bimodules(QQ, ZZ).right_base_ring()
95
Integer Ring
96
"""
97
return self._right_base_ring
98
99
def _latex_(self):
100
"""
101
EXAMPLES::
102
103
sage: print Bimodules(QQ, ZZ)._latex_()
104
{\mathbf{Bimodules}}_{\Bold{Q}}_{\Bold{Z}}
105
"""
106
from sage.misc.latex import latex
107
return "{%s}_{%s}_{%s}"%(Category._latex_(self), latex(self._left_base_ring), latex(self._right_base_ring))
108
109
def super_categories(self):
110
"""
111
EXAMPLES::
112
113
sage: Bimodules(QQ, ZZ).super_categories()
114
[Category of left modules over Rational Field, Category of right modules over Integer Ring]
115
"""
116
R = self.left_base_ring()
117
S = self.right_base_ring()
118
return [LeftModules(R), RightModules(S)]
119
120
class ParentMethods:
121
pass
122
123
class ElementMethods:
124
pass
125
126