passagemath-objects 10.6.47__cp311-cp311-macosx_13_0_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. passagemath_objects/.dylibs/libgmp.10.dylib +0 -0
  2. passagemath_objects/__init__.py +3 -0
  3. passagemath_objects-10.6.47.dist-info/METADATA +115 -0
  4. passagemath_objects-10.6.47.dist-info/RECORD +280 -0
  5. passagemath_objects-10.6.47.dist-info/WHEEL +6 -0
  6. passagemath_objects-10.6.47.dist-info/top_level.txt +3 -0
  7. sage/all__sagemath_objects.py +37 -0
  8. sage/arith/all__sagemath_objects.py +5 -0
  9. sage/arith/long.pxd +411 -0
  10. sage/arith/numerical_approx.cpython-311-darwin.so +0 -0
  11. sage/arith/numerical_approx.pxd +35 -0
  12. sage/arith/numerical_approx.pyx +75 -0
  13. sage/arith/power.cpython-311-darwin.so +0 -0
  14. sage/arith/power.pxd +31 -0
  15. sage/arith/power.pyx +127 -0
  16. sage/categories/action.cpython-311-darwin.so +0 -0
  17. sage/categories/action.pxd +29 -0
  18. sage/categories/action.pyx +641 -0
  19. sage/categories/algebra_functor.py +745 -0
  20. sage/categories/all__sagemath_objects.py +33 -0
  21. sage/categories/basic.py +62 -0
  22. sage/categories/cartesian_product.py +295 -0
  23. sage/categories/category.py +3401 -0
  24. sage/categories/category_cy_helper.cpython-311-darwin.so +0 -0
  25. sage/categories/category_cy_helper.pxd +8 -0
  26. sage/categories/category_cy_helper.pyx +322 -0
  27. sage/categories/category_singleton.cpython-311-darwin.so +0 -0
  28. sage/categories/category_singleton.pxd +3 -0
  29. sage/categories/category_singleton.pyx +342 -0
  30. sage/categories/category_types.py +637 -0
  31. sage/categories/category_with_axiom.py +2876 -0
  32. sage/categories/covariant_functorial_construction.py +703 -0
  33. sage/categories/facade_sets.py +228 -0
  34. sage/categories/functor.cpython-311-darwin.so +0 -0
  35. sage/categories/functor.pxd +7 -0
  36. sage/categories/functor.pyx +691 -0
  37. sage/categories/homset.py +1338 -0
  38. sage/categories/homsets.py +364 -0
  39. sage/categories/isomorphic_objects.py +73 -0
  40. sage/categories/map.cpython-311-darwin.so +0 -0
  41. sage/categories/map.pxd +34 -0
  42. sage/categories/map.pyx +2106 -0
  43. sage/categories/morphism.cpython-311-darwin.so +0 -0
  44. sage/categories/morphism.pxd +14 -0
  45. sage/categories/morphism.pyx +895 -0
  46. sage/categories/objects.py +167 -0
  47. sage/categories/primer.py +1696 -0
  48. sage/categories/pushout.py +4834 -0
  49. sage/categories/quotients.py +64 -0
  50. sage/categories/realizations.py +200 -0
  51. sage/categories/sets_cat.py +3290 -0
  52. sage/categories/sets_with_partial_maps.py +52 -0
  53. sage/categories/subobjects.py +64 -0
  54. sage/categories/subquotients.py +21 -0
  55. sage/categories/with_realizations.py +311 -0
  56. sage/cpython/__init__.py +19 -0
  57. sage/cpython/_py2_random.py +619 -0
  58. sage/cpython/all.py +3 -0
  59. sage/cpython/atexit.cpython-311-darwin.so +0 -0
  60. sage/cpython/atexit.pyx +269 -0
  61. sage/cpython/builtin_types.cpython-311-darwin.so +0 -0
  62. sage/cpython/builtin_types.pyx +7 -0
  63. sage/cpython/cython_metaclass.cpython-311-darwin.so +0 -0
  64. sage/cpython/cython_metaclass.h +117 -0
  65. sage/cpython/cython_metaclass.pxd +3 -0
  66. sage/cpython/cython_metaclass.pyx +130 -0
  67. sage/cpython/debug.cpython-311-darwin.so +0 -0
  68. sage/cpython/debug.pyx +302 -0
  69. sage/cpython/dict_del_by_value.cpython-311-darwin.so +0 -0
  70. sage/cpython/dict_del_by_value.pxd +9 -0
  71. sage/cpython/dict_del_by_value.pyx +191 -0
  72. sage/cpython/dict_internal.h +245 -0
  73. sage/cpython/getattr.cpython-311-darwin.so +0 -0
  74. sage/cpython/getattr.pxd +9 -0
  75. sage/cpython/getattr.pyx +439 -0
  76. sage/cpython/pycore_long.h +97 -0
  77. sage/cpython/pycore_long.pxd +10 -0
  78. sage/cpython/python_debug.h +44 -0
  79. sage/cpython/python_debug.pxd +47 -0
  80. sage/cpython/pyx_visit.h +13 -0
  81. sage/cpython/string.cpython-311-darwin.so +0 -0
  82. sage/cpython/string.pxd +76 -0
  83. sage/cpython/string.pyx +34 -0
  84. sage/cpython/string_impl.h +60 -0
  85. sage/cpython/type.cpython-311-darwin.so +0 -0
  86. sage/cpython/type.pxd +2 -0
  87. sage/cpython/type.pyx +40 -0
  88. sage/cpython/wrapperdescr.pxd +67 -0
  89. sage/ext/all__sagemath_objects.py +3 -0
  90. sage/ext/ccobject.h +64 -0
  91. sage/ext/cplusplus.pxd +17 -0
  92. sage/ext/mod_int.h +30 -0
  93. sage/ext/mod_int.pxd +24 -0
  94. sage/ext/stdsage.pxd +39 -0
  95. sage/groups/all__sagemath_objects.py +1 -0
  96. sage/groups/group.cpython-311-darwin.so +0 -0
  97. sage/groups/group.pxd +14 -0
  98. sage/groups/group.pyx +322 -0
  99. sage/groups/old.cpython-311-darwin.so +0 -0
  100. sage/groups/old.pxd +14 -0
  101. sage/groups/old.pyx +219 -0
  102. sage/libs/all__sagemath_objects.py +3 -0
  103. sage/libs/gmp/__init__.py +1 -0
  104. sage/libs/gmp/all.pxd +6 -0
  105. sage/libs/gmp/binop.pxd +23 -0
  106. sage/libs/gmp/misc.pxd +8 -0
  107. sage/libs/gmp/mpf.pxd +88 -0
  108. sage/libs/gmp/mpn.pxd +57 -0
  109. sage/libs/gmp/mpq.pxd +57 -0
  110. sage/libs/gmp/mpz.pxd +202 -0
  111. sage/libs/gmp/pylong.cpython-311-darwin.so +0 -0
  112. sage/libs/gmp/pylong.pxd +12 -0
  113. sage/libs/gmp/pylong.pyx +150 -0
  114. sage/libs/gmp/random.pxd +25 -0
  115. sage/libs/gmp/randomize.pxd +59 -0
  116. sage/libs/gmp/types.pxd +53 -0
  117. sage/libs/gmpxx.pxd +19 -0
  118. sage/misc/abstract_method.py +276 -0
  119. sage/misc/all__sagemath_objects.py +43 -0
  120. sage/misc/bindable_class.py +253 -0
  121. sage/misc/c3_controlled.cpython-311-darwin.so +0 -0
  122. sage/misc/c3_controlled.pxd +2 -0
  123. sage/misc/c3_controlled.pyx +1402 -0
  124. sage/misc/cachefunc.cpython-311-darwin.so +0 -0
  125. sage/misc/cachefunc.pxd +43 -0
  126. sage/misc/cachefunc.pyx +3781 -0
  127. sage/misc/call.py +188 -0
  128. sage/misc/classcall_metaclass.cpython-311-darwin.so +0 -0
  129. sage/misc/classcall_metaclass.pxd +14 -0
  130. sage/misc/classcall_metaclass.pyx +599 -0
  131. sage/misc/constant_function.cpython-311-darwin.so +0 -0
  132. sage/misc/constant_function.pyx +130 -0
  133. sage/misc/decorators.py +747 -0
  134. sage/misc/fast_methods.cpython-311-darwin.so +0 -0
  135. sage/misc/fast_methods.pxd +20 -0
  136. sage/misc/fast_methods.pyx +351 -0
  137. sage/misc/flatten.py +90 -0
  138. sage/misc/fpickle.cpython-311-darwin.so +0 -0
  139. sage/misc/fpickle.pyx +177 -0
  140. sage/misc/function_mangling.cpython-311-darwin.so +0 -0
  141. sage/misc/function_mangling.pxd +11 -0
  142. sage/misc/function_mangling.pyx +308 -0
  143. sage/misc/inherit_comparison.cpython-311-darwin.so +0 -0
  144. sage/misc/inherit_comparison.pxd +5 -0
  145. sage/misc/inherit_comparison.pyx +105 -0
  146. sage/misc/instancedoc.cpython-311-darwin.so +0 -0
  147. sage/misc/instancedoc.pyx +331 -0
  148. sage/misc/lazy_attribute.cpython-311-darwin.so +0 -0
  149. sage/misc/lazy_attribute.pyx +607 -0
  150. sage/misc/lazy_format.py +135 -0
  151. sage/misc/lazy_import.cpython-311-darwin.so +0 -0
  152. sage/misc/lazy_import.pyx +1299 -0
  153. sage/misc/lazy_import_cache.py +36 -0
  154. sage/misc/lazy_list.cpython-311-darwin.so +0 -0
  155. sage/misc/lazy_list.pxd +19 -0
  156. sage/misc/lazy_list.pyx +1187 -0
  157. sage/misc/lazy_string.cpython-311-darwin.so +0 -0
  158. sage/misc/lazy_string.pxd +7 -0
  159. sage/misc/lazy_string.pyx +546 -0
  160. sage/misc/misc.py +1066 -0
  161. sage/misc/misc_c.cpython-311-darwin.so +0 -0
  162. sage/misc/misc_c.pxd +3 -0
  163. sage/misc/misc_c.pyx +766 -0
  164. sage/misc/namespace_package.py +37 -0
  165. sage/misc/nested_class.cpython-311-darwin.so +0 -0
  166. sage/misc/nested_class.pxd +3 -0
  167. sage/misc/nested_class.pyx +394 -0
  168. sage/misc/persist.cpython-311-darwin.so +0 -0
  169. sage/misc/persist.pyx +1251 -0
  170. sage/misc/prandom.py +418 -0
  171. sage/misc/randstate.cpython-311-darwin.so +0 -0
  172. sage/misc/randstate.pxd +30 -0
  173. sage/misc/randstate.pyx +1059 -0
  174. sage/misc/repr.py +203 -0
  175. sage/misc/reset.cpython-311-darwin.so +0 -0
  176. sage/misc/reset.pyx +196 -0
  177. sage/misc/sage_ostools.cpython-311-darwin.so +0 -0
  178. sage/misc/sage_ostools.pyx +323 -0
  179. sage/misc/sage_timeit.py +275 -0
  180. sage/misc/sage_timeit_class.cpython-311-darwin.so +0 -0
  181. sage/misc/sage_timeit_class.pyx +120 -0
  182. sage/misc/sage_unittest.py +637 -0
  183. sage/misc/sageinspect.py +2768 -0
  184. sage/misc/session.cpython-311-darwin.so +0 -0
  185. sage/misc/session.pyx +392 -0
  186. sage/misc/superseded.py +557 -0
  187. sage/misc/test_nested_class.py +228 -0
  188. sage/misc/timing.py +264 -0
  189. sage/misc/unknown.py +222 -0
  190. sage/misc/verbose.py +253 -0
  191. sage/misc/weak_dict.cpython-311-darwin.so +0 -0
  192. sage/misc/weak_dict.pxd +15 -0
  193. sage/misc/weak_dict.pyx +1231 -0
  194. sage/modules/all__sagemath_objects.py +1 -0
  195. sage/modules/module.cpython-311-darwin.so +0 -0
  196. sage/modules/module.pxd +5 -0
  197. sage/modules/module.pyx +329 -0
  198. sage/rings/all__sagemath_objects.py +3 -0
  199. sage/rings/integer_fake.h +22 -0
  200. sage/rings/integer_fake.pxd +55 -0
  201. sage/sets/all__sagemath_objects.py +3 -0
  202. sage/sets/pythonclass.cpython-311-darwin.so +0 -0
  203. sage/sets/pythonclass.pxd +9 -0
  204. sage/sets/pythonclass.pyx +247 -0
  205. sage/structure/__init__.py +4 -0
  206. sage/structure/all.py +30 -0
  207. sage/structure/category_object.cpython-311-darwin.so +0 -0
  208. sage/structure/category_object.pxd +28 -0
  209. sage/structure/category_object.pyx +1087 -0
  210. sage/structure/coerce.cpython-311-darwin.so +0 -0
  211. sage/structure/coerce.pxd +44 -0
  212. sage/structure/coerce.pyx +2107 -0
  213. sage/structure/coerce_actions.cpython-311-darwin.so +0 -0
  214. sage/structure/coerce_actions.pxd +27 -0
  215. sage/structure/coerce_actions.pyx +988 -0
  216. sage/structure/coerce_dict.cpython-311-darwin.so +0 -0
  217. sage/structure/coerce_dict.pxd +51 -0
  218. sage/structure/coerce_dict.pyx +1557 -0
  219. sage/structure/coerce_exceptions.py +23 -0
  220. sage/structure/coerce_maps.cpython-311-darwin.so +0 -0
  221. sage/structure/coerce_maps.pxd +28 -0
  222. sage/structure/coerce_maps.pyx +718 -0
  223. sage/structure/debug_options.cpython-311-darwin.so +0 -0
  224. sage/structure/debug_options.pxd +6 -0
  225. sage/structure/debug_options.pyx +54 -0
  226. sage/structure/dynamic_class.py +541 -0
  227. sage/structure/element.cpython-311-darwin.so +0 -0
  228. sage/structure/element.pxd +272 -0
  229. sage/structure/element.pyx +4772 -0
  230. sage/structure/element_wrapper.cpython-311-darwin.so +0 -0
  231. sage/structure/element_wrapper.pxd +12 -0
  232. sage/structure/element_wrapper.pyx +582 -0
  233. sage/structure/factorization.py +1422 -0
  234. sage/structure/factorization_integer.py +105 -0
  235. sage/structure/factory.cpython-311-darwin.so +0 -0
  236. sage/structure/factory.pyx +786 -0
  237. sage/structure/formal_sum.py +489 -0
  238. sage/structure/gens_py.py +73 -0
  239. sage/structure/global_options.py +1743 -0
  240. sage/structure/indexed_generators.py +863 -0
  241. sage/structure/list_clone.cpython-311-darwin.so +0 -0
  242. sage/structure/list_clone.pxd +65 -0
  243. sage/structure/list_clone.pyx +1867 -0
  244. sage/structure/list_clone_demo.cpython-311-darwin.so +0 -0
  245. sage/structure/list_clone_demo.pyx +248 -0
  246. sage/structure/list_clone_timings.py +179 -0
  247. sage/structure/list_clone_timings_cy.cpython-311-darwin.so +0 -0
  248. sage/structure/list_clone_timings_cy.pyx +86 -0
  249. sage/structure/mutability.cpython-311-darwin.so +0 -0
  250. sage/structure/mutability.pxd +21 -0
  251. sage/structure/mutability.pyx +348 -0
  252. sage/structure/nonexact.py +69 -0
  253. sage/structure/parent.cpython-311-darwin.so +0 -0
  254. sage/structure/parent.pxd +112 -0
  255. sage/structure/parent.pyx +3093 -0
  256. sage/structure/parent_base.cpython-311-darwin.so +0 -0
  257. sage/structure/parent_base.pxd +13 -0
  258. sage/structure/parent_base.pyx +44 -0
  259. sage/structure/parent_gens.cpython-311-darwin.so +0 -0
  260. sage/structure/parent_gens.pxd +22 -0
  261. sage/structure/parent_gens.pyx +377 -0
  262. sage/structure/parent_old.cpython-311-darwin.so +0 -0
  263. sage/structure/parent_old.pxd +25 -0
  264. sage/structure/parent_old.pyx +294 -0
  265. sage/structure/proof/__init__.py +1 -0
  266. sage/structure/proof/all.py +243 -0
  267. sage/structure/proof/proof.py +300 -0
  268. sage/structure/richcmp.cpython-311-darwin.so +0 -0
  269. sage/structure/richcmp.pxd +213 -0
  270. sage/structure/richcmp.pyx +495 -0
  271. sage/structure/sage_object.cpython-311-darwin.so +0 -0
  272. sage/structure/sage_object.pxd +3 -0
  273. sage/structure/sage_object.pyx +988 -0
  274. sage/structure/sage_object_test.py +19 -0
  275. sage/structure/sequence.py +937 -0
  276. sage/structure/set_factories.py +1178 -0
  277. sage/structure/set_factories_example.py +527 -0
  278. sage/structure/support_view.py +179 -0
  279. sage/structure/test_factory.py +56 -0
  280. sage/structure/unique_representation.py +1359 -0
@@ -0,0 +1,745 @@
1
+ # sage_setup: distribution = sagemath-objects
2
+ # sage.doctest: needs sage.groups sage.modules
3
+ r"""
4
+ Group algebras and beyond: the Algebra functorial construction
5
+
6
+ Introduction: group algebras
7
+ ============================
8
+
9
+ Let `G` be a group and `R` be a ring. For example::
10
+
11
+ sage: G = DihedralGroup(3)
12
+ sage: R = QQ
13
+
14
+ The *group algebra* `A = RG` of `G` over `R` is the space of formal
15
+ linear combinations of elements of `group` with coefficients in `R`::
16
+
17
+ sage: A = G.algebra(R); A
18
+ Algebra of Dihedral group of order 6 as a permutation group
19
+ over Rational Field
20
+ sage: a = A.an_element(); a
21
+ () + (1,2) + 3*(1,2,3) + 2*(1,3,2)
22
+
23
+ This space is endowed with an algebra structure, obtained by extending
24
+ by bilinearity the multiplication of `G` to a multiplication on `RG`::
25
+
26
+ sage: A in Algebras
27
+ True
28
+ sage: a * a
29
+ 14*() + 5*(2,3) + 2*(1,2) + 10*(1,2,3) + 13*(1,3,2) + 5*(1,3)
30
+
31
+ In particular, the product of two basis elements is induced by the
32
+ product of the corresponding elements of the group, and the unit of
33
+ the group algebra is indexed by the unit of the group::
34
+
35
+ sage: (s, t) = A.algebra_generators()
36
+ sage: s*t
37
+ (1,2)
38
+ sage: A.one_basis()
39
+ ()
40
+ sage: A.one()
41
+ ()
42
+
43
+ For the user convenience and backward compatibility, the group algebra
44
+ can also be constructed with::
45
+
46
+ sage: GroupAlgebra(G, R)
47
+ Algebra of Dihedral group of order 6 as a permutation group
48
+ over Rational Field
49
+
50
+ Since :issue:`18700`, both constructions are strictly equivalent::
51
+
52
+ sage: GroupAlgebra(G, R) is G.algebra(R)
53
+ True
54
+
55
+ Group algebras are further endowed with a Hopf algebra structure; see
56
+ below.
57
+
58
+ Generalizations
59
+ ===============
60
+
61
+ The above construction extends to weaker multiplicative structures
62
+ than groups: magmas, semigroups, monoids. For a monoid `S`, we obtain
63
+ the monoid algebra `RS`, which is defined exactly as above::
64
+
65
+ sage: S = Monoids().example(); S
66
+ An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
67
+ sage: A = S.algebra(QQ); A
68
+ Algebra of An example of a monoid: the free monoid generated by ('a', 'b', 'c', 'd')
69
+ over Rational Field
70
+ sage: A.category()
71
+ Category of monoid algebras over Rational Field
72
+
73
+ This construction also extends to additive structures: magmas,
74
+ semigroups, monoids, or groups::
75
+
76
+ sage: S = CommutativeAdditiveMonoids().example(); S
77
+ An example of a commutative monoid:
78
+ the free commutative monoid generated by ('a', 'b', 'c', 'd')
79
+ sage: U = S.algebra(QQ); U
80
+ Algebra of An example of a commutative monoid:
81
+ the free commutative monoid generated by ('a', 'b', 'c', 'd')
82
+ over Rational Field
83
+
84
+ Despite saying "free module", this is really an algebra, whose
85
+ multiplication is induced by the addition of elements of `S`::
86
+
87
+ sage: U in Algebras(QQ)
88
+ True
89
+ sage: (a,b,c,d) = S.additive_semigroup_generators()
90
+ sage: U(a) * U(b)
91
+ B[a + b]
92
+
93
+ To catter uniformly for the use cases above and some others, for `S` a
94
+ set and `K` a ring, we define in Sage the *algebra of `S`* as the
95
+ `K`-free module with basis indexed by `S`, endowed with whatever
96
+ algebraic structure can be induced from that of `S`.
97
+
98
+ .. WARNING::
99
+
100
+ In most use cases, the result is actually an algebra, hence the
101
+ name of this construction. In other cases this name is
102
+ misleading::
103
+
104
+ sage: A = Sets().example().algebra(QQ); A
105
+ Algebra of Set of prime numbers (basic implementation)
106
+ over Rational Field
107
+ sage: A.category()
108
+ Category of set algebras over Rational Field
109
+ sage: A in Algebras(QQ)
110
+ False
111
+
112
+ Suggestions for a uniform, meaningful, and non misleading name are
113
+ welcome!
114
+
115
+ To achieve this flexibility, the features are implemented as a
116
+ :ref:`sage.categories.covariant_functorial_construction` that is
117
+ essentially a hierarchy of categories each providing the relevant
118
+ additional features::
119
+
120
+ sage: A = DihedralGroup(3).algebra(QQ)
121
+ sage: A.categories()
122
+ [Category of finite group algebras over Rational Field,
123
+ ...
124
+ Category of group algebras over Rational Field,
125
+ ...
126
+ Category of monoid algebras over Rational Field,
127
+ ...
128
+ Category of semigroup algebras over Rational Field,
129
+ ...
130
+ Category of unital magma algebras over Rational Field,
131
+ Category of magma algebras over Rational Field,
132
+ ...
133
+ Category of set algebras over Rational Field,
134
+ ...]
135
+
136
+
137
+ Specifying the algebraic structure
138
+ ==================================
139
+
140
+ Constructing the algebra of a set endowed with both an
141
+ additive and a multiplicative structure is ambiguous::
142
+
143
+ sage: Z3 = IntegerModRing(3)
144
+ sage: A = Z3.algebra(QQ)
145
+ Traceback (most recent call last):
146
+ ...
147
+ TypeError: `S = Ring of integers modulo 3` is both
148
+ an additive and a multiplicative semigroup.
149
+ Constructing its algebra is ambiguous.
150
+ Please use, e.g., S.algebra(QQ, category=Semigroups())
151
+
152
+ This ambiguity can be resolved using the ``category`` argument
153
+ of the construction::
154
+
155
+ sage: A = Z3.algebra(QQ, category=Monoids()); A
156
+ Algebra of Ring of integers modulo 3 over Rational Field
157
+ sage: A.category()
158
+ Category of finite dimensional monoid algebras over Rational Field
159
+
160
+ sage: A = Z3.algebra(QQ, category=CommutativeAdditiveGroups()); A
161
+ Algebra of Ring of integers modulo 3 over Rational Field
162
+ sage: A.category()
163
+ Category of finite dimensional commutative additive group algebras
164
+ over Rational Field
165
+
166
+ In general, the ``category`` argument can be used to specify which
167
+ structure of `S` shall be extended to `KS`.
168
+
169
+ Group algebras, continued
170
+ =========================
171
+
172
+ Let us come back to the case of a group algebra `A=RG`. It is endowed
173
+ with more structure and in particular that of a *Hopf algebra*::
174
+
175
+ sage: G = DihedralGroup(3)
176
+ sage: A = G.algebra(R); A
177
+ Algebra of Dihedral group of order 6 as a permutation group
178
+ over Rational Field
179
+ sage: A in HopfAlgebras(R).FiniteDimensional().WithBasis()
180
+ True
181
+
182
+ The basis elements are *group-like* for the coproduct:
183
+ `\Delta(g) = g \otimes g`::
184
+
185
+ sage: s
186
+ (1,2,3)
187
+ sage: s.coproduct()
188
+ (1,2,3) # (1,2,3)
189
+
190
+ The counit is the constant function `1` on the basis elements::
191
+
192
+ sage: A = GroupAlgebra(DihedralGroup(6), QQ)
193
+ sage: [A.counit(g) for g in A.basis()]
194
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
195
+
196
+ The antipode is given on basis elements by `\chi(g) = g^{-1}`::
197
+
198
+ sage: A = GroupAlgebra(DihedralGroup(3), QQ)
199
+ sage: s
200
+ (1,2,3)
201
+ sage: s.antipode()
202
+ (1,3,2)
203
+
204
+ By Maschke's theorem, for a finite group whose cardinality does not
205
+ divide the characteristic of the base field, the algebra is
206
+ semisimple::
207
+
208
+ sage: SymmetricGroup(5).algebra(QQ) in Algebras(QQ).Semisimple() # needs sage.combinat
209
+ True
210
+ sage: CyclicPermutationGroup(10).algebra(FiniteField(7)) in Algebras.Semisimple
211
+ True
212
+ sage: CyclicPermutationGroup(10).algebra(FiniteField(5)) in Algebras.Semisimple
213
+ False
214
+
215
+
216
+ Coercions
217
+ =========
218
+
219
+ Let `RS` be the algebra of some structure `S`. Then `RS` admits the
220
+ natural coercion from any other algebra `R'S'` of some structure `S'`,
221
+ as long as `R'` coerces into `R` and `S'` coerces into `S`.
222
+
223
+ For example, since there is a natural inclusion from the dihedral
224
+ group `D_2` of order 4 into the symmetric group `S_4` of order 4!, and
225
+ since there is a natural map from the integers to the rationals, there
226
+ is a natural map from `\ZZ[D_2]` to `\QQ[S_4]`::
227
+
228
+ sage: # needs sage.combinat
229
+ sage: A = DihedralGroup(2).algebra(ZZ)
230
+ sage: B = SymmetricGroup(4).algebra(QQ)
231
+ sage: a = A.an_element(); a
232
+ () + 2*(3,4) + 3*(1,2) + (1,2)(3,4)
233
+ sage: b = B.an_element(); b
234
+ () + (2,3,4) + 2*(1,3)(2,4) + 3*(1,4)(2,3)
235
+ sage: B(a)
236
+ () + 2*(3,4) + 3*(1,2) + (1,2)(3,4)
237
+ sage: a * b # a is automatically converted to an element of B
238
+ () + 2*(3,4) + 2*(2,3) + (2,3,4) + 3*(1,2) + (1,2)(3,4) + (1,3,2)
239
+ + 3*(1,3,4,2) + 5*(1,3)(2,4) + 13*(1,3,2,4) + 12*(1,4,2,3) + 5*(1,4)(2,3)
240
+ sage: parent(a * b)
241
+ Symmetric group algebra of order 4 over Rational Field
242
+
243
+ There is no obvious map in the other direction, though::
244
+
245
+ sage: A(b)
246
+ Traceback (most recent call last):
247
+ ...
248
+ TypeError: do not know how to make x (= () + (2,3,4) + 2*(1,3)(2,4) + 3*(1,4)(2,3))
249
+ an element of self
250
+ (=Algebra of Dihedral group of order 4 as a permutation group over Integer Ring)
251
+
252
+ If `S` is a unital (additive) magma, then `RS` is a unital algebra,
253
+ and thus admits a coercion from its base ring `R` and any ring that
254
+ coerces into `R`. ::
255
+
256
+ sage: G = DihedralGroup(2)
257
+ sage: A = G.algebra(ZZ)
258
+ sage: A(2)
259
+ 2*()
260
+
261
+ If `S` is a multiplicative group, then `RS` admits a coercion from `S`
262
+ and from any group which coerce into `S`::
263
+
264
+ sage: g = DihedralGroup(2).gen(0); g
265
+ (3,4)
266
+ sage: A(g)
267
+ (3,4)
268
+ sage: A(2) * g
269
+ 2*(3,4)
270
+
271
+ Note that there is an ambiguity if `S'` is a group which coerces into
272
+ both `R` and `S`. For example) if `S` is the additive group `(\ZZ,+)`,
273
+ and `A = RS` is its group algebra, then the integer `2` can be coerced
274
+ into `A` in two ways -- via `S`, or via the base ring `R` -- and *the
275
+ answers are different*. It that case the coercion to `R` takes
276
+ precedence. In particular, if `\ZZ` is the ring (or group) of
277
+ integers, then `\ZZ` will coerce to any `RS`, by sending `\ZZ` to `R`.
278
+ In generic code, it is therefore recommended to always explicitly use
279
+ ``A.monomial(g)`` to convert an element of the group into `A`.
280
+
281
+ TESTS:
282
+
283
+ Given a group and a base ring, the corresponding group algebra is
284
+ unique::
285
+
286
+ sage: A = GL(3, QQ).algebra(ZZ)
287
+ sage: B = GL(3, QQ).algebra(ZZ)
288
+ sage: A is B
289
+ True
290
+ sage: C = GL(3, QQ).algebra(QQ)
291
+ sage: A == C
292
+ False
293
+
294
+ Equality tests::
295
+
296
+ sage: AbelianGroup(1).algebra(QQ) == AbelianGroup(1).algebra(QQ)
297
+ True
298
+ sage: AbelianGroup(1).algebra(QQ) == AbelianGroup(1).algebra(ZZ)
299
+ False
300
+ sage: AbelianGroup(2).algebra(QQ) == AbelianGroup(1).algebra(QQ)
301
+ False
302
+
303
+ sage: A = KleinFourGroup().algebra(ZZ)
304
+ sage: B = KleinFourGroup().algebra(QQ)
305
+ sage: A == B
306
+ False
307
+ sage: A == A
308
+ True
309
+
310
+ Properties of group algebras::
311
+
312
+ sage: SU(2, GF(4, 'a')).algebra(IntegerModRing(12)).category() # needs sage.rings.finite_rings
313
+ Category of finite group algebras over Ring of integers modulo 12
314
+
315
+ sage: SymmetricGroup(2).algebra(QQ).is_commutative() # needs sage.combinat
316
+ True
317
+ sage: SymmetricGroup(3).algebra(QQ).is_commutative() # needs sage.combinat
318
+ False
319
+
320
+ sage: G = DihedralGroup(4)
321
+ sage: A = G.algebra(QQ['x'])
322
+ sage: A(1)
323
+ ()
324
+ sage: A(2)
325
+ 2*()
326
+ sage: A(0)
327
+ 0
328
+ sage: A(int(2)).coefficients()
329
+ [2]
330
+ sage: A(int(2)).coefficients()[0].parent()
331
+ Univariate Polynomial Ring in x over Rational Field
332
+ sage: g = G.an_element()
333
+ sage: A(g)
334
+ (1,3)
335
+
336
+ Hopf algebra structure::
337
+
338
+ sage: D4 = DihedralGroup(4)
339
+ sage: kD4 = D4.algebra(GF(7))
340
+ sage: kD4 in HopfAlgebras
341
+ True
342
+ sage: a = kD4.an_element(); a
343
+ () + (1,3) + 2*(1,3)(2,4) + 3*(1,4,3,2)
344
+ sage: a.antipode()
345
+ () + 3*(1,2,3,4) + (1,3) + 2*(1,3)(2,4)
346
+ sage: a.coproduct()
347
+ () # () + (1,3) # (1,3) + 2*(1,3)(2,4) # (1,3)(2,4) + 3*(1,4,3,2) # (1,4,3,2)
348
+
349
+ Coercions from the base ring::
350
+
351
+ sage: A = GL(3, GF(7)).algebra(ZZ); A
352
+ Algebra of General Linear Group of degree 3 over Finite Field of size 7
353
+ over Integer Ring
354
+ sage: A.has_coerce_map_from(GL(3, GF(7)))
355
+ True
356
+
357
+ Coercion from the group::
358
+
359
+ sage: G = GL(3, GF(7))
360
+ sage: ZG = G.algebra(ZZ)
361
+ sage: c, d = G.random_element(), G.random_element()
362
+ sage: zc, zd = ZG(c), ZG(d)
363
+ sage: zc * d == zc * zd # d is automatically converted to an element of ZG
364
+ True
365
+
366
+ sage: G = SymmetricGroup(5)
367
+ sage: x,y = G.gens()
368
+ sage: A = G.algebra(QQ) # needs sage.combinat
369
+ sage: A( A(x) )
370
+ (1,2,3,4,5)
371
+
372
+ sage: G = KleinFourGroup()
373
+ sage: f = G.gen(0)
374
+ sage: ZG = GroupAlgebra(G)
375
+ sage: ZG(f) # indirect doctest
376
+ (3,4)
377
+ sage: ZG(1) == ZG(G(1))
378
+ True
379
+
380
+ Coercion from the base ring takes precedences over coercion from the
381
+ group::
382
+
383
+ sage: # needs sage.rings.number_field
384
+ sage: G = GL(2,7)
385
+ sage: OG = GroupAlgebra(G, ZZ[AA(5).sqrt()])
386
+ sage: OG(2)
387
+ 2*[1 0]
388
+ [0 1]
389
+ sage: OG(G(2))
390
+ [2 0]
391
+ [0 2]
392
+ sage: OG(FormalSum([ (1, G(2)), (2, RR(0.77)) ]) )
393
+ Traceback (most recent call last):
394
+ ...
395
+ TypeError: Attempt to coerce non-integral RealNumber to Integer
396
+ sage: OG(OG.base_ring().basis()[1])
397
+ a*[1 0]
398
+ [0 1]
399
+
400
+ Coercions from other group algebras::
401
+
402
+ sage: P = RootSystem(['A',2,1]).weight_lattice()
403
+ sage: W = RootSystem(['A',2,1]).weight_space()
404
+ sage: PA = P.algebra(QQ)
405
+ sage: WA = W.algebra(QQ)
406
+ sage: WA.coerce_map_from(PA)
407
+ Generic morphism:
408
+ From: Algebra of the Weight lattice of the Root system of type ['A', 2, 1] over Rational Field
409
+ To: Algebra of the Weight space over the Rational Field of the Root system of type ['A', 2, 1] over Rational Field
410
+
411
+ Using the functor `R \mapsto RG` to build the base ring extension
412
+ morphism::
413
+
414
+ sage: G = SymmetricGroup(3)
415
+ sage: A = G.algebra(ZZ) # needs sage.combinat
416
+ sage: h = GF(5).coerce_map_from(ZZ)
417
+
418
+ sage: functor = A.construction()[0]; functor
419
+ GroupAlgebraFunctor
420
+ sage: hh = functor(h)
421
+ sage: hh
422
+ Generic morphism:
423
+ From: Symmetric group algebra of order 3 over Integer Ring
424
+ To: Symmetric group algebra of order 3 over Finite Field of size 5
425
+ sage: a = 2 * A.an_element(); a
426
+ 2*() + 2*(2,3) + 6*(1,2,3) + 4*(1,3,2)
427
+
428
+ sage: hh(a)
429
+ 2*() + 2*(2,3) + (1,2,3) + 4*(1,3,2)
430
+
431
+ Conversion from a formal sum::
432
+
433
+ sage: G = AbelianGroup(1)
434
+ sage: ZG = G.algebra(ZZ)
435
+ sage: f = G.gen()
436
+ sage: ZG(FormalSum([(1,f), (2, f**2)]))
437
+ f + 2*f^2
438
+
439
+
440
+ AUTHORS:
441
+
442
+ - David Loeffler (2008-08-24): initial version
443
+ - Martin Raum (2009-08): update to use new coercion model -- see
444
+ :issue:`6670`.
445
+ - John Palmieri (2011-07): more updates to coercion, categories, etc.,
446
+ group algebras constructed using CombinatorialFreeModule -- see
447
+ :issue:`6670`.
448
+ - Nicolas M. Thiéry (2010-2017), Travis Scrimshaw (2017):
449
+ generalization to a covariant functorial construction for
450
+ monoid algebras, and beyond -- see e.g. :issue:`18700`.
451
+ """
452
+ # ****************************************************************************
453
+ # Copyright (C) 2010-2017 Nicolas M. Thiéry <nthiery at users.sf.net>
454
+ #
455
+ # Distributed under the terms of the GNU General Public License (GPL)
456
+ # https://www.gnu.org/licenses/
457
+ # ****************************************************************************
458
+
459
+ from sage.categories.pushout import ConstructionFunctor
460
+ from sage.categories.morphism import SetMorphism
461
+
462
+ from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory, FunctorialConstructionCategory
463
+ from sage.categories.category_types import Category_over_base_ring
464
+
465
+ # TODO: merge the two univariate functors below into a bivariate one
466
+
467
+
468
+ class AlgebraFunctor(CovariantFunctorialConstruction):
469
+ r"""
470
+ For a fixed ring, a functor sending a group/... to the
471
+ corresponding group/... algebra.
472
+
473
+ EXAMPLES::
474
+
475
+ sage: from sage.categories.algebra_functor import AlgebraFunctor
476
+ sage: F = AlgebraFunctor(QQ); F
477
+ The algebra functorial construction
478
+ sage: F(DihedralGroup(3))
479
+ Algebra of Dihedral group of order 6 as a permutation group
480
+ over Rational Field
481
+ """
482
+ _functor_name = "algebra"
483
+ _functor_category = "Algebras"
484
+
485
+ def __init__(self, base_ring):
486
+ """
487
+ EXAMPLES::
488
+
489
+ sage: from sage.categories.algebra_functor import AlgebraFunctor
490
+ sage: F = AlgebraFunctor(QQ); F
491
+ The algebra functorial construction
492
+ sage: TestSuite(F).run()
493
+ """
494
+ from sage.categories.rings import Rings
495
+ assert base_ring in Rings()
496
+ self._base_ring = base_ring
497
+
498
+ def base_ring(self):
499
+ """
500
+ Return the base ring for this functor.
501
+
502
+ EXAMPLES::
503
+
504
+ sage: from sage.categories.algebra_functor import AlgebraFunctor
505
+ sage: AlgebraFunctor(QQ).base_ring()
506
+ Rational Field
507
+ """
508
+ return self._base_ring
509
+
510
+ def __call__(self, G, category=None):
511
+ """
512
+ Return the algebra of ``G``.
513
+
514
+ See :ref:`sage.categories.algebra_functor` for details.
515
+
516
+ INPUT:
517
+
518
+ - ``G`` -- a group
519
+ - ``category`` -- a category, or ``None``
520
+
521
+ EXAMPLES::
522
+
523
+ sage: from sage.categories.algebra_functor import AlgebraFunctor
524
+ sage: F = AlgebraFunctor(QQ)
525
+ sage: G = DihedralGroup(3)
526
+ sage: A = F(G, category=Monoids()); A
527
+ Algebra of Dihedral group of order 6 as a permutation group
528
+ over Rational Field
529
+ sage: A.category()
530
+ Category of finite dimensional monoid algebras over Rational Field
531
+ """
532
+ return G.algebra(self._base_ring, category=category)
533
+
534
+
535
+ class GroupAlgebraFunctor(ConstructionFunctor):
536
+ r"""
537
+ For a fixed group, a functor sending a commutative ring to the
538
+ corresponding group algebra.
539
+
540
+ INPUT:
541
+
542
+ - ``group`` -- the group associated to each group algebra under
543
+ consideration
544
+
545
+ EXAMPLES::
546
+
547
+ sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
548
+ sage: F = GroupAlgebraFunctor(KleinFourGroup()); F
549
+ GroupAlgebraFunctor
550
+ sage: A = F(QQ); A
551
+ Algebra of The Klein 4 group of order 4, as a permutation group over Rational Field
552
+
553
+ TESTS::
554
+
555
+ sage: loads(dumps(F)) == F
556
+ True
557
+ sage: A is KleinFourGroup().algebra(QQ)
558
+ True
559
+ """
560
+ def __init__(self, group):
561
+ r"""
562
+ See :class:`GroupAlgebraFunctor` for full documentation.
563
+
564
+ EXAMPLES::
565
+
566
+ sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
567
+ sage: GroupAlgebra(SU(2, GF(4, 'a')), IntegerModRing(12)).category() # needs sage.rings.finite_rings
568
+ Category of finite group algebras over Ring of integers modulo 12
569
+ """
570
+ self.__group = group
571
+ from sage.categories.rings import Rings
572
+ ConstructionFunctor.__init__(self, Rings(), Rings())
573
+
574
+ def group(self):
575
+ r"""
576
+ Return the group which is associated to this functor.
577
+
578
+ EXAMPLES::
579
+
580
+ sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
581
+ sage: GroupAlgebraFunctor(CyclicPermutationGroup(17)).group() == CyclicPermutationGroup(17)
582
+ True
583
+ """
584
+ return self.__group
585
+
586
+ def _apply_functor(self, base_ring):
587
+ r"""
588
+ Create the group algebra with given base ring over ``self.group()``.
589
+
590
+ INPUT:
591
+
592
+ - ``base_ring`` -- the base ring of the group algebra
593
+
594
+ OUTPUT: a group algebra
595
+
596
+ EXAMPLES::
597
+
598
+ sage: from sage.categories.algebra_functor import GroupAlgebraFunctor
599
+ sage: F = GroupAlgebraFunctor(CyclicPermutationGroup(17))
600
+ sage: F(QQ)
601
+ Algebra of Cyclic group of order 17 as a permutation group
602
+ over Rational Field
603
+ """
604
+ return self.__group.algebra(base_ring)
605
+
606
+ def _apply_functor_to_morphism(self, f):
607
+ r"""
608
+ Lift a homomorphism of rings to the corresponding homomorphism
609
+ of the group algebras of ``self.group()``.
610
+
611
+ INPUT:
612
+
613
+ - ``f`` -- a morphism of rings
614
+
615
+ OUTPUT: a morphism of group algebras
616
+
617
+ EXAMPLES::
618
+
619
+ sage: # needs sage.combinat
620
+ sage: G = SymmetricGroup(3)
621
+ sage: A = GroupAlgebra(G, ZZ)
622
+ sage: h = GF(5).coerce_map_from(ZZ)
623
+ sage: hh = A.construction()[0](h); hh
624
+ Generic morphism:
625
+ From: Symmetric group algebra of order 3 over Integer Ring
626
+ To: Symmetric group algebra of order 3 over Finite Field of size 5
627
+ sage: a = 2 * A.an_element(); a
628
+ 2*() + 2*(2,3) + 6*(1,2,3) + 4*(1,3,2)
629
+ sage: hh(a)
630
+ 2*() + 2*(2,3) + (1,2,3) + 4*(1,3,2)
631
+ """
632
+ from sage.categories.rings import Rings
633
+ domain = self(f.domain())
634
+ codomain = self(f.codomain())
635
+ # we would want to use something like:
636
+ # domain.module_morphism(on_coefficients=h, codomain=codomain, category=Rings())
637
+ return SetMorphism(domain.Hom(codomain, category=Rings()),
638
+ lambda x: codomain.sum_of_terms((g, f(c)) for (g, c) in x))
639
+
640
+
641
+ class AlgebrasCategory(CovariantConstructionCategory, Category_over_base_ring):
642
+ r"""
643
+ An abstract base class for categories of monoid algebras,
644
+ groups algebras, and the like.
645
+
646
+ .. SEEALSO::
647
+
648
+ - :meth:`Sets.ParentMethods.algebra`
649
+ - :meth:`Sets.SubcategoryMethods.Algebras`
650
+ - :class:`~sage.categories.covariant_functorial_construction.CovariantFunctorialConstruction`
651
+
652
+ INPUT:
653
+
654
+ - ``base_ring`` -- a ring
655
+
656
+ EXAMPLES::
657
+
658
+ sage: C = Groups().Algebras(QQ); C
659
+ Category of group algebras over Rational Field
660
+ sage: C = Monoids().Algebras(QQ); C
661
+ Category of monoid algebras over Rational Field
662
+
663
+ sage: C._short_name()
664
+ 'Algebras'
665
+ sage: latex(C) # todo: improve that
666
+ \mathbf{Algebras}(\mathbf{Monoids})
667
+ """
668
+
669
+ _functor_category = "Algebras"
670
+
671
+ def _repr_object_names(self):
672
+ """
673
+ EXAMPLES::
674
+
675
+ sage: Semigroups().Algebras(QQ) # indirect doctest
676
+ Category of semigroup algebras over Rational Field
677
+ """
678
+ return "{} algebras over {}".format(self.base_category()._repr_object_names()[:-1],
679
+ self.base_ring())
680
+
681
+ @staticmethod
682
+ def __classcall__(cls, category=None, R=None):
683
+ """
684
+ Make ``CatAlgebras(**)`` a shorthand for ``Cat().Algebras(**)``.
685
+
686
+ EXAMPLES::
687
+
688
+ sage: GradedModules(ZZ) # indirect doctest
689
+ Category of graded modules over Integer Ring
690
+ sage: Modules(ZZ).Graded()
691
+ Category of graded modules over Integer Ring
692
+ sage: Modules.Graded(ZZ)
693
+ Category of graded modules over Integer Ring
694
+ sage: GradedModules(ZZ) is Modules(ZZ).Graded()
695
+ True
696
+
697
+ .. SEEALSO:: :meth:`_base_category_class`
698
+
699
+ .. TODO::
700
+
701
+ The logic is very similar to the default implementation
702
+ :class:`FunctorialConstructionCategory.__classcall__`;
703
+ the only difference is whether the additional arguments
704
+ should be passed to ``Cat`` or to the construction.
705
+
706
+ Find a way to refactor this to avoid the duplication.
707
+ """
708
+ base_category_class = cls._base_category_class[0]
709
+ if isinstance(category, base_category_class):
710
+ return super(FunctorialConstructionCategory, cls).__classcall__(cls, category, R)
711
+ else:
712
+ # category should now be the base ring ...
713
+ return cls.category_of(base_category_class(), category)
714
+
715
+ class ParentMethods:
716
+
717
+ # coalgebra structure
718
+
719
+ def coproduct_on_basis(self, g):
720
+ r"""
721
+ Return the coproduct of the element ``g`` of the basis.
722
+
723
+ Each basis element ``g`` is group-like. This method is
724
+ used to compute the coproduct of any element.
725
+
726
+ EXAMPLES::
727
+
728
+ sage: # needs sage.combinat
729
+ sage: PF = NonDecreasingParkingFunctions(4)
730
+ sage: A = PF.algebra(ZZ); A
731
+ Algebra of Non-decreasing parking functions of size 4 over Integer Ring
732
+ sage: g = PF.an_element(); g
733
+ [1, 1, 1, 1]
734
+ sage: A.coproduct_on_basis(g)
735
+ B[[1, 1, 1, 1]] # B[[1, 1, 1, 1]]
736
+ sage: a = A.an_element(); a
737
+ 2*B[[1, 1, 1, 1]] + 2*B[[1, 1, 1, 2]] + 3*B[[1, 1, 1, 3]]
738
+ sage: a.coproduct()
739
+ 2*B[[1, 1, 1, 1]] # B[[1, 1, 1, 1]] +
740
+ 2*B[[1, 1, 1, 2]] # B[[1, 1, 1, 2]] +
741
+ 3*B[[1, 1, 1, 3]] # B[[1, 1, 1, 3]]
742
+ """
743
+ from sage.categories.tensor import tensor
744
+ g = self.term(g)
745
+ return tensor([g, g])