Skip to content

Commit 47d3a1b

Browse files
author
Travis Scrimshaw
committed
Merge branch 'public/categories/filtered_algebras-17096' of trac.sagemath.org:sage into public/algebras/convolution_product_hopf_algebras-18678
Conflicts: src/sage/categories/bialgebras.py src/sage/misc/c3_controlled.pyx
2 parents ca0f846 + 6cc8b84 commit 47d3a1b

33 files changed

+3297
-384
lines changed

src/doc/en/reference/algebras/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Algebras
44
.. toctree::
55
:maxdepth: 2
66

7+
sage/algebras/associated_graded
8+
79
sage/algebras/catalog
810

911
sage/algebras/clifford_algebra

src/doc/en/reference/categories/index.rst

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Individual Categories
6363
sage/categories/enumerated_sets
6464
sage/categories/euclidean_domains
6565
sage/categories/fields
66+
sage/categories/filtered_algebras
67+
sage/categories/filtered_algebras_with_basis
68+
sage/categories/filtered_modules
69+
sage/categories/filtered_modules_with_basis
6670
sage/categories/finite_coxeter_groups
6771
sage/categories/finite_crystals
6872
sage/categories/finite_dimensional_algebras_with_basis
+341
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
r"""
2+
Associated Graded Algebras To Filtered Algebras
3+
4+
AUTHORS:
5+
6+
- Travis Scrimshaw (2014-10-08): Initial version
7+
"""
8+
9+
#*****************************************************************************
10+
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
11+
#
12+
# Distributed under the terms of the GNU General Public License (GPL)
13+
# http://www.gnu.org/licenses/
14+
#*****************************************************************************
15+
16+
from sage.misc.cachefunc import cached_method
17+
from copy import copy
18+
19+
from sage.categories.modules_with_basis import ModulesWithBasis
20+
from sage.sets.family import Family
21+
from sage.combinat.free_module import CombinatorialFreeModule
22+
23+
class AssociatedGradedAlgebra(CombinatorialFreeModule):
24+
r"""
25+
The associated graded algebra/module `\operatorname{gr} A`
26+
of a filtered algebra/module with basis `A`.
27+
28+
Let `A` be a filtered module over a commutative ring `R`.
29+
Let `(F_i)_{i \in I}` be the filtration of `A`, with `I` being
30+
a totally ordered set. Define
31+
32+
.. MATH::
33+
34+
G_i = F_i / \sum_{j < i} F_j
35+
36+
for every `i \in I`, and then
37+
38+
.. MATH::
39+
40+
\operatorname{gr} A = \bigoplus_{i \in I} G_i.
41+
42+
There are canonical projections `p_i : F_i \to G_i` for
43+
every `i \in I`. Moreover `\operatorname{gr} A` is naturally a
44+
graded `R`-module with `G_i` being the `i`-th graded component.
45+
This graded `R`-module is known as the *associated graded module*
46+
(or, for short, just *graded module*) of `A`.
47+
48+
Now, assume that `A` (endowed with the filtration
49+
`(F_i)_{i \in I}`) is not just a filtered `R`-module, but also
50+
a filtered `R`-algebra.
51+
Let `u \in G_i` and `v \in G_j`, and let `u' \in F_i` and
52+
`v' \in F_j` be lifts of `u` and `v`, respectively (so that
53+
`u = p_i(u')` and `v = p_j(v')`). Then, we define a
54+
multiplication `*` on `\operatorname{gr} A` (not to be mistaken
55+
for the multiplication of the original algebra `A`) by
56+
57+
.. MATH::
58+
59+
u * v = p_{i+j} (u' v').
60+
61+
The *associated graded algebra* (or, for short, just
62+
*graded algebra*) of `A` is the graded algebra
63+
`\operatorname{gr} A` (endowed with this multiplication).
64+
65+
Now, assume that `A` is a filtered `R`-algebra with basis.
66+
Let `(b_x)_{x \in X}` be the basis of `A`,
67+
and consider the partition `X = \bigsqcup_{i \in I} X_i` of
68+
the set `X`, which is part of the data of a filtered
69+
algebra with basis. We know (see
70+
:class:`~sage.categories.filtered_modules_with_basis.FilteredModulesWithBasis`)
71+
that `A` (being a filtered `R`-module with basis) is canonically
72+
(when the basis is considered to be part of the data)
73+
isomorphic to `\operatorname{gr} A` as an `R`-module. Therefore
74+
the `k`-th graded component `G_k` can be identified with
75+
the span of `(b_x)_{x \in X_k}`, or equivalently the
76+
`k`-th homogeneous component of `A`. Suppose
77+
that `u' v' = \sum_{k \leq i+j} m_k` where `m_k \in G_k` (which
78+
has been identified with the `k`-th homogeneous component of `A`).
79+
Then `u * v = m_{i+j}`. We also note that the choice of
80+
identification of `G_k` with the `k`-th homogeneous component
81+
of `A` depends on the given basis.
82+
83+
The basis `(b_x)_{x \in X}` of `A` gives rise to a basis
84+
of `\operatorname{gr} A`. This latter basis is still indexed
85+
by the elements of `X`, and consists of the images of the
86+
`b_x` under the `R`-module isomorphism from `A` to
87+
`\operatorname{gr} A`. It makes `\operatorname{gr} A` into
88+
a graded `R`-algebra with basis.
89+
90+
In this class, the `R`-module isomorphism from `A` to
91+
`\operatorname{gr} A` is implemented as
92+
:meth:`to_graded_conversion` and also as the default
93+
conversion from `A` to `\operatorname{gr} A`. Its
94+
inverse map is implemented as
95+
:meth:`from_graded_conversion`.
96+
The projection `p_i : F_i \to G_i` is implemented as
97+
:meth:`projection` ``(i)``.
98+
99+
INPUT:
100+
101+
- ``A`` -- a filtered module (or algebra) with basis
102+
103+
OUTPUT:
104+
105+
The associated graded module of `A`, if `A` is just a filtered
106+
`R`-module.
107+
The associated graded algebra of `A`, if `A` is a filtered
108+
`R`-algebra.
109+
110+
EXAMPLES:
111+
112+
Associated graded module of a filtered module::
113+
114+
sage: A = Modules(QQ).WithBasis().Filtered().example()
115+
sage: grA = A.graded_algebra()
116+
sage: grA.category()
117+
Category of graded modules with basis over Rational Field
118+
sage: x = A.basis()[Partition([3,2,1])]
119+
sage: grA(x)
120+
Bbar[[3, 2, 1]]
121+
122+
Associated graded algebra of a filtered algebra::
123+
124+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
125+
sage: grA = A.graded_algebra()
126+
sage: grA.category()
127+
Category of graded algebras with basis over Rational Field
128+
sage: x,y,z = map(lambda s: grA.algebra_generators()[s], ['x','y','z'])
129+
sage: x
130+
bar(U['x'])
131+
sage: y * x + z
132+
bar(U['x']*U['y']) + bar(U['z'])
133+
sage: A(y) * A(x) + A(z)
134+
U['x']*U['y']
135+
136+
We note that the conversion between ``A`` and ``grA`` is
137+
the canonical ``QQ``-module isomorphism stemming from the
138+
fact that the underlying ``QQ``-modules of ``A`` and
139+
``grA`` are isomorphic::
140+
141+
sage: grA(A.an_element())
142+
bar(U['x']^2*U['y']^2*U['z']^3)
143+
sage: elt = A.an_element() + A.algebra_generators()['x'] + 2
144+
sage: grelt = grA(elt); grelt
145+
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
146+
sage: A(grelt) == elt
147+
True
148+
149+
.. TODO::
150+
151+
The algebra ``A`` must currently be an instance of (a subclass of)
152+
:class:`CombinatorialFreeModule`. This should work with any
153+
filtered algebra with a basis.
154+
155+
.. TODO::
156+
157+
Implement a version of associated graded algebra for
158+
filtered algebras without a distinguished basis.
159+
160+
REFERENCES:
161+
162+
- :wikipedia:`Filtered_algebra#Associated_graded_algebra`
163+
"""
164+
def __init__(self, A, category=None):
165+
"""
166+
Initialize ``self``.
167+
168+
EXAMPLES::
169+
170+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
171+
sage: grA = A.graded_algebra()
172+
sage: TestSuite(grA).run(elements=[prod(grA.algebra_generators())])
173+
"""
174+
if A not in ModulesWithBasis(A.base_ring().category()).Filtered():
175+
raise ValueError("the base algebra must be filtered and with basis")
176+
self._A = A
177+
178+
base_ring = A.base_ring()
179+
base_one = base_ring.one()
180+
181+
category = A.category().Graded().or_subcategory(category)
182+
try:
183+
opts = copy(A.print_options())
184+
if not opts['prefix'] and not opts['bracket']:
185+
opts['bracket'] = '('
186+
opts['prefix'] = opts['prefix'] + 'bar'
187+
except AttributeError:
188+
opts = {'prefix': 'Abar'}
189+
190+
CombinatorialFreeModule.__init__(self, base_ring, A.basis().keys(),
191+
category=category, **opts)
192+
193+
# Setup the conversion back
194+
phi = self.module_morphism(diagonal=lambda x: base_one, codomain=A)
195+
self._A.register_conversion(phi)
196+
197+
def _repr_(self):
198+
"""
199+
Return a string representation of ``self``.
200+
201+
EXAMPLES::
202+
203+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
204+
sage: A.graded_algebra()
205+
Graded Algebra of An example of a filtered algebra with basis:
206+
the universal enveloping algebra of Lie algebra of RR^3
207+
with cross product over Rational Field
208+
"""
209+
from sage.categories.algebras_with_basis import AlgebrasWithBasis
210+
if self in AlgebrasWithBasis:
211+
return "Graded Algebra of {}".format(self._A)
212+
return "Graded Module of {}".format(self._A)
213+
214+
def _latex_(self):
215+
r"""
216+
Return a latex representation of ``self``.
217+
218+
EXAMPLES::
219+
220+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
221+
sage: latex(A.graded_algebra())
222+
\operatorname{gr} ...
223+
"""
224+
from sage.misc.latex import latex
225+
return "\\operatorname{gr} " + latex(self._A)
226+
227+
def _element_constructor_(self, x):
228+
r"""
229+
Construct an element of ``self`` from ``x``.
230+
231+
If ``self`` `= \operatorname{gr} A` for a filtered algebra
232+
`A` with basis, and if ``x`` is an element of `A`, then
233+
this returns the image of `x` under the canonical `R`-module
234+
isomorphism `A \to \operatorname{gr} A`. (In this case,
235+
this is equivalent to calling
236+
``self.to_graded_conversion()(x)``.)
237+
238+
EXAMPLES::
239+
240+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
241+
sage: grA = A.graded_algebra()
242+
sage: grA(A.an_element())
243+
bar(U['x']^2*U['y']^2*U['z']^3)
244+
sage: grA(A.an_element() + A.algebra_generators()['x'] + 2)
245+
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
246+
"""
247+
if isinstance(x, CombinatorialFreeModule.Element):
248+
if x.parent() is self._A:
249+
return self._from_dict(dict(x))
250+
return super(AssociatedGradedAlgebra, self)._element_constructor_(x)
251+
252+
def gen(self, *args, **kwds):
253+
"""
254+
Return a generator of ``self``.
255+
256+
EXAMPLES::
257+
258+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
259+
sage: grA = A.graded_algebra()
260+
sage: grA.gen('x')
261+
bar(U['x'])
262+
"""
263+
try:
264+
x = self._A.gen(*args, **kwds)
265+
except AttributeError:
266+
x = self._A.algebra_generators()[args[0]]
267+
return self(x)
268+
269+
@cached_method
270+
def algebra_generators(self):
271+
"""
272+
Return the algebra generators of ``self``.
273+
274+
This assumes that the algebra generators of `A` provided by
275+
its ``algebra_generators`` method are homogeneous.
276+
277+
EXAMPLES::
278+
279+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
280+
sage: grA = A.graded_algebra()
281+
sage: grA.algebra_generators()
282+
Finite family {'y': bar(U['y']), 'x': bar(U['x']), 'z': bar(U['z'])}
283+
"""
284+
G = self._A.algebra_generators()
285+
return Family(G.keys(), lambda x: self(G[x]), name="generator")
286+
287+
def degree_on_basis(self, x):
288+
"""
289+
Return the degree of the basis element indexed by ``x``.
290+
291+
EXAMPLES::
292+
293+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
294+
sage: grA = A.graded_algebra()
295+
sage: all(A.degree_on_basis(x) == grA.degree_on_basis(x)
296+
....: for g in grA.algebra_generators() for x in g.support())
297+
True
298+
"""
299+
return self._A.degree_on_basis(x)
300+
301+
@cached_method
302+
def one_basis(self):
303+
"""
304+
Return the basis index of the element `1` of
305+
`\operatorname{gr} A`.
306+
307+
This assumes that the unity `1` of `A` belongs to `F_0`.
308+
309+
EXAMPLES::
310+
311+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
312+
sage: grA = A.graded_algebra()
313+
sage: grA.one_basis()
314+
1
315+
"""
316+
return self._A.one_basis()
317+
318+
def product_on_basis(self, x, y):
319+
"""
320+
Return the product on basis elements given by the
321+
indices ``x`` and ``y``.
322+
323+
EXAMPLES::
324+
325+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
326+
sage: grA = A.graded_algebra()
327+
sage: G = grA.algebra_generators()
328+
sage: x,y,z = G['x'], G['y'], G['z']
329+
sage: x * y # indirect doctest
330+
bar(U['x']*U['y'])
331+
sage: y * x
332+
bar(U['x']*U['y'])
333+
sage: z * y * x
334+
bar(U['x']*U['y']*U['z'])
335+
"""
336+
ret = self._A.product_on_basis(x, y)
337+
deg = self._A.degree_on_basis(x) + self._A.degree_on_basis(y)
338+
return self.sum_of_terms([(i,c) for i,c in ret
339+
if self._A.degree_on_basis(i) == deg],
340+
distinct=True)
341+

0 commit comments

Comments
 (0)