Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 5f63379

Browse files
author
Travis Scrimshaw
committed
Addressing Darij's comments.
1 parent 2ff607a commit 5f63379

6 files changed

+81
-12
lines changed

src/sage/algebras/associated_graded.py

+41-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from sage.misc.cachefunc import cached_method
1717
from sage.misc.misc_c import prod
18+
from copy import copy
1819

1920
from sage.categories.algebras_with_basis import AlgebrasWithBasis
2021
from sage.categories.graded_algebras_with_basis import GradedAlgebrasWithBasis
@@ -37,6 +38,35 @@ class AssociatedGradedAlgebra(CombinatorialFreeModule):
3738
INPUT:
3839
3940
- ``A`` -- a filtered algebra
41+
42+
EXAMPLES:
43+
44+
sage: A = Algebras(QQ).WithBasis().Filtered().example()
45+
sage: grA = A.graded_algebra()
46+
sage: x,y,z = map(lambda s: grA.algebra_generators()[s], ['x','y','z'])
47+
sage: x
48+
bar(U['x'])
49+
sage: y * x + z
50+
bar(U['x']*U['y']) + bar(U['z'])
51+
sage: A(y) * A(x) + A(z)
52+
U['x']*U['y']
53+
54+
We note that the conversion between ``A`` and ``grA`` is the canonical
55+
``QQ``-module isomorphism::
56+
57+
sage: grA(A.an_element())
58+
bar(U['x']^2*U['y']^2*U['z']^3)
59+
sage: elt = A.an_element() + A.algebra_generators()['x'] + 2
60+
sage: grelt = grA(elt); grelt
61+
bar(U['x']^2*U['y']^2*U['z']^3) + bar(U['x']) + 2*bar(1)
62+
sage: A(grelt) == elt
63+
True
64+
65+
.. TODO::
66+
67+
The algebra ``A`` must currently be an instance of (a subclass of)
68+
:class:`CombinatorialFreeModule`. This should work with any algebra
69+
with a basis.
4070
"""
4171
def __init__(self, A, category=None):
4272
"""
@@ -51,16 +81,21 @@ def __init__(self, A, category=None):
5181
if A not in AlgebrasWithBasis(A.base_ring()).Filtered():
5282
raise ValueError("the base algebra must be filtered")
5383
self._A = A
84+
5485
if category is None:
5586
category = A.category().Graded()
56-
from copy import copy
5787
opts = copy(A.print_options())
5888
if not opts['prefix'] and not opts['bracket']:
5989
opts['bracket'] = '('
6090
opts['prefix'] = opts['prefix'] + 'bar'
91+
6192
CombinatorialFreeModule.__init__(self, A.base_ring(), A.indices(),
6293
category=category, **opts)
6394

95+
# Setup the conversion back
96+
phi = self.module_morphism(lambda x: A.monomial(x), codomain=A)
97+
self._A.register_conversion(phi)
98+
6499
def _repr_(self):
65100
"""
66101
Return a string representation of ``self``.
@@ -92,6 +127,11 @@ def _element_constructor_(self, x):
92127
"""
93128
Construct an element of ``self`` from ``x``.
94129
130+
.. NOTE::
131+
132+
This constructs an element from the filtered algebra ``A``
133+
by the canonical module isomorphism.
134+
95135
EXAMPLES::
96136
97137
sage: A = Algebras(QQ).WithBasis().Filtered().example()

src/sage/categories/examples/filtered_algebras_with_basis.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from sage.sets.family import Family
1515
from sage.misc.misc import powerset
1616

17-
class IntersectionFilteredAlgebra(CombinatorialFreeModule):
17+
class PBWBasisCrossProduct(CombinatorialFreeModule):
1818
r"""
1919
This class illustrates an implementation of a filtered algebra
2020
with basis: the universal enveloping algebra of the Lie algebra
@@ -32,6 +32,9 @@ class IntersectionFilteredAlgebra(CombinatorialFreeModule):
3232
3333
- A set of algebra generators -- the set of generators `x,y,z`.
3434
35+
- The index of the unit element -- the unit element in the monoid
36+
of monomials.
37+
3538
- A product -- this is given on basis elements by using
3639
:meth:`product_on_basis`.
3740
@@ -115,6 +118,9 @@ def degree_on_basis(self, m):
115118
"""
116119
return len(m)
117120

121+
# TODO: This is a general procedure of expanding multiplication defined
122+
# on generators to arbitrary monomials and could likely be factored out
123+
# and be useful elsewhere.
118124
def product_on_basis(self, s, t):
119125
"""
120126
Return the product of two basis elements indexed by ``s`` and ``t``.
@@ -142,6 +148,7 @@ def product_on_basis(self, s, t):
142148

143149
if len(t) == 1:
144150
if len(s) == 1:
151+
# Do the product of the generators
145152
a = s.leading_support()
146153
b = t.leading_support()
147154
cur = self.monomial(s*t)
@@ -165,5 +172,5 @@ def product_on_basis(self, s, t):
165172
cur = cur * self.monomial(self._indices.gen(a))
166173
return cur
167174

168-
Example = IntersectionFilteredAlgebra
175+
Example = PBWBasisCrossProduct
169176

src/sage/categories/filtered_algebras.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
from sage.categories.filtered_modules import FilteredModulesCategory
1313

1414
class FilteredAlgebras(FilteredModulesCategory):
15-
"""
15+
r"""
1616
The category of filtered algebras.
1717
18+
An algebra `A` over `R` is *filtered* if `A` is a filtered `R`-module
19+
such that `F_i \cdot F_j \subseteq F_{i+j}` for all `i, j` in the
20+
filteration group.
21+
1822
EXAMPLES::
1923
2024
sage: Algebras(ZZ).Filtered()

src/sage/categories/filtered_algebras_with_basis.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def graded_algebra(self):
4646
class ElementMethods:
4747
def is_homogeneous(self):
4848
"""
49-
Return whether this element is homogeneous.
49+
Return whether ``self`` is homogeneous.
50+
51+
An element `x` is homogeneous if `x \in F_i \setminus F_{i-1}`
52+
for some `i`.
5053
5154
EXAMPLES::
5255
@@ -71,7 +74,7 @@ def is_homogeneous(self):
7174

7275
def homogeneous_degree(self):
7376
"""
74-
The degree of this element.
77+
The degree of ``self``.
7578
7679
.. NOTE::
7780

src/sage/categories/filtered_modules.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
r"""
22
Filtered modules
3+
4+
We require all `F_i \setminus F_{i-1}` to be modules for all `i`.
35
"""
46
#*****************************************************************************
57
# Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
@@ -123,9 +125,14 @@ def _repr_object_names(self):
123125
return "filtered {}".format(self.base_category()._repr_object_names())
124126

125127
class FilteredModules(FilteredModulesCategory):
126-
"""
128+
r"""
127129
The category of filtered modules.
128130
131+
A `R`-module `M` is *filtered* if there exists a `R`-module
132+
isomorphism `A = \bigoplus_{i \in I} F_i`, where `I` is a
133+
totally ordered additive abelian group, such that
134+
`F_{i-1} \subseteq F_i` for all `i \in I`.
135+
129136
EXAMPLES::
130137
131138
sage: Modules(ZZ).Filtered()

src/sage/categories/filtered_modules_with_basis.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ def basis(self, d=None):
4444
4545
INPUT:
4646
47-
- `d` -- non negative integer or ``None``, optional (default: ``None``)
47+
- ``d`` -- (optional, default ``None``) non negative integer
48+
or ``None``
4849
49-
If `d` is None, returns a basis of the module.
50-
Otherwise, returns the basis of the homogeneous component of degree `d`.
50+
If ``d`` is ``None``, returns a basis of the module.
51+
Otherwise, returns the basis of the homogeneous component
52+
of degree ``d`` (i.e., of ``F_d \setminus F_{d-1}``).
5153
5254
EXAMPLES::
5355
@@ -74,6 +76,9 @@ def is_homogeneous(self):
7476
"""
7577
Return whether ``self`` is homogeneous.
7678
79+
An element `x` is homogeneous if `x \in F_i \setminus F_{i-1}`
80+
for some `i`.
81+
7782
EXAMPLES::
7883
7984
sage: A = ModulesWithBasis(ZZ).Filtered().example()
@@ -99,7 +104,10 @@ def is_homogeneous(self):
99104

100105
def degree(self):
101106
"""
102-
The degree of this element in the filtered module.
107+
The degree of ``self`` in the filtered module.
108+
109+
The degree of an element `x` is the value `i` such that
110+
`x \in F_i \setminus F_{i-1}`.
103111
104112
.. NOTE::
105113
@@ -164,7 +172,7 @@ def homogeneous_component(self, n):
164172
def truncate(self, n):
165173
"""
166174
Return the sum of the homogeneous components of degree
167-
strictly less than ``n`` of this element.
175+
strictly less than ``n`` of ``self``.
168176
169177
EXAMPLES::
170178

0 commit comments

Comments
 (0)