Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

r""" 

Bimodules 

""" 

#***************************************************************************** 

# Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu> 

# William Stein <wstein@math.ucsd.edu> 

# 2008 Teresa Gomez-Diaz (CNRS) <Teresa.Gomez-Diaz@univ-mlv.fr> 

# 2008-2009 Nicolas M. Thiery <nthiery at users.sf.net> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#****************************************************************************** 

from __future__ import print_function 

 

from sage.categories.category import Category, CategoryWithParameters 

from sage.categories.left_modules import LeftModules 

from sage.categories.right_modules import RightModules 

 

from sage.categories.rings import Rings 

_Rings = Rings() 

 

#?class Bimodules(Category_over_base_rng, Category_over_base_rng): 

class Bimodules(CategoryWithParameters): 

""" 

The category of `(R,S)`-bimodules 

 

For `R` and `S` rings, a `(R,S)`-bimodule `X` is a left `R`-module 

and right `S`-module such that the left and right actions commute: 

`r*(x*s) = (r*x)*s`. 

 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ) 

Category of bimodules over Rational Field on the left and Integer Ring on the right 

sage: Bimodules(QQ, ZZ).super_categories() 

[Category of left modules over Rational Field, Category of right modules over Integer Ring] 

""" 

 

def __init__(self, left_base, right_base, name=None): 

""" 

EXAMPLES:: 

 

sage: C = Bimodules(QQ, ZZ) 

sage: TestSuite(C).run() 

""" 

if not ( left_base in Rings or 

(isinstance(left_base, Category) 

and left_base.is_subcategory(Rings())) ): 

raise ValueError("the left base must be a ring or a subcategory of Rings()") 

if not ( right_base in Rings or 

(isinstance(right_base, Category) 

and right_base.is_subcategory(Rings())) ): 

raise ValueError("the right base must be a ring or a subcategory of Rings()") 

self._left_base_ring = left_base 

self._right_base_ring = right_base 

Category.__init__(self, name) 

 

def _make_named_class_key(self, name): 

r""" 

Return what the element/parent/... classes depend on. 

 

Since :trac:`11935`, the element and parent classes of a 

bimodule only depend on the categories of the left and right 

base ring. 

 

.. SEEALSO:: 

 

- :meth:`CategoryWithParameters` 

- :meth:`CategoryWithParameters._make_named_class_key` 

 

EXAMPLES:: 

 

sage: Bimodules(QQ,ZZ)._make_named_class_key('parent_class') 

(Join of Category of number fields 

and Category of quotient fields 

and Category of metric spaces, 

Join of Category of euclidean domains 

and Category of infinite enumerated sets 

and Category of metric spaces) 

 

 

sage: Bimodules(Fields(), ZZ)._make_named_class_key('element_class') 

(Category of fields, 

Join of Category of euclidean domains 

and Category of infinite enumerated sets 

and Category of metric spaces) 

 

sage: Bimodules(QQ, Rings())._make_named_class_key('element_class') 

(Join of Category of number fields 

and Category of quotient fields 

and Category of metric spaces, 

Category of rings) 

 

sage: Bimodules(Fields(), Rings())._make_named_class_key('element_class') 

(Category of fields, Category of rings) 

""" 

return (self._left_base_ring if isinstance(self._left_base_ring, Category) else self._left_base_ring.category(), 

self._right_base_ring if isinstance(self._right_base_ring, Category) else self._right_base_ring.category()) 

 

@classmethod 

def an_instance(cls): 

""" 

Return an instance of this class. 

 

EXAMPLES:: 

 

sage: Bimodules.an_instance() 

Category of bimodules over Rational Field on the left and Real Field with 53 bits of precision on the right 

""" 

from sage.rings.all import QQ, RR 

return cls(QQ, RR) 

 

def _repr_object_names(self): 

""" 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ) # indirect doctest 

Category of bimodules over Rational Field on the left and Integer Ring on the right 

""" 

return "bimodules over %s on the left and %s on the right" \ 

%(self._left_base_ring, self._right_base_ring) 

 

def left_base_ring(self): 

""" 

Return the left base ring over which elements of this category are 

defined. 

 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ).left_base_ring() 

Rational Field 

""" 

return self._left_base_ring 

 

def right_base_ring(self): 

""" 

Return the right base ring over which elements of this category are 

defined. 

 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ).right_base_ring() 

Integer Ring 

""" 

return self._right_base_ring 

 

def _latex_(self): 

""" 

Return a latex representation of ``self``. 

 

EXAMPLES:: 

 

sage: print(Bimodules(QQ, ZZ)._latex_()) 

{\mathbf{Bimodules}}_{\Bold{Q}, \Bold{Z}} 

""" 

from sage.misc.latex import latex 

return "{{{0}}}_{{{1}, {2}}}".format(Category._latex_(self), 

latex(self._left_base_ring), 

latex(self._right_base_ring)) 

 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ).super_categories() 

[Category of left modules over Rational Field, Category of right modules over Integer Ring] 

""" 

R = self.left_base_ring() 

S = self.right_base_ring() 

return [LeftModules(R), RightModules(S)] 

 

def additional_structure(self): 

r""" 

Return ``None``. 

 

Indeed, the category of bimodules defines no additional 

structure: a left and right module morphism between two 

bimodules is a bimodule morphism. 

 

.. SEEALSO:: :meth:`Category.additional_structure` 

 

.. TODO:: Should this category be a :class:`CategoryWithAxiom`? 

 

EXAMPLES:: 

 

sage: Bimodules(QQ, ZZ).additional_structure() 

""" 

return None 

 

class ParentMethods: 

pass 

 

class ElementMethods: 

pass