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

Commit 50ecfe4

Browse files
author
Travis Scrimshaw
committed
Reviewer changes for #18678.
- Documentation changes. - Moved coproduct_iterated to coalgebras (with basis). - Updated doctests due to changes in the category heirarchy.
1 parent a1d962a commit 50ecfe4

5 files changed

+148
-136
lines changed

src/sage/categories/bialgebras_with_basis.py

+81-129
Original file line numberDiff line numberDiff line change
@@ -37,36 +37,43 @@ def convolution_product(self, *maps):
3737
r"""
3838
Return the convolution product (a map) of the given maps.
3939
40-
INPUT:
40+
Let `A` and `B` be bialgebras over a commutative ring `R`.
41+
Given maps `f_i : A \to B` for `1 \leq i < n`, define the
42+
convolution product
4143
42-
- ``maps`` -- any number `n \geq 0` of linear maps `R, S, \dots,
43-
T` on ``self``; or a single ``list`` or ``tuple`` of such maps.
44+
.. MATH::
4445
45-
OUTPUT:
46+
(f_1 * f_2 * \cdots * f_n) := \mu^{(n-1)} \circ (f_1 \otimes
47+
f_2 \otimes \cdots \otimes f_n) \circ \Delta^{(n-1)},
4648
47-
- the new map `R * S * \cdots * T` representing their convolution
48-
product.
49+
where `\Delta^{(k)} := \bigl(\Delta \otimes
50+
\mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`,
51+
with `\Delta^{(1)} = \Delta` (the ordinary coproduct in `A`) and
52+
`\Delta^{(0)} = \mathrm{Id}`; and with `\mu^{(k)} := \mu \circ
53+
\bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu`
54+
(the ordinary product in `B`). See [Sw1969]_.
4955
50-
.. MATH::
56+
(In the literature, one finds, e.g., `\Delta^{(2)}` for what we
57+
denote above as `\Delta^{(1)}`. See [KMN2012]_.)
5158
52-
(R*S*\cdots*T) := \mu^{(n-1)} \circ (R \otimes S \otimes\cdot\otimes T) \circ \Delta^{(n-1)},
59+
INPUT:
60+
61+
- ``maps`` -- any number `n \geq 0` of linear maps `f_1, f_2,
62+
\ldots, f_n` on ``self``; or a single ``list`` or ``tuple``
63+
of such maps
5364
54-
where `\Delta^{(k)} := \bigl(\Delta \otimes \mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`,
55-
with `\Delta^{(1)} = \Delta` (the ordinary coproduct) and `\Delta^{(0)} = \mathrm{Id}`;
56-
and with `\mu^{(k)} := \mu \circ \bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu`
57-
(the ordinary product). See [Sw1969]_.
65+
OUTPUT:
5866
59-
(In the literature, one finds, e.g., `\Delta^{(2)}` for what we denote above as `\Delta^{(1)}`. See [KMN2012]_.)
67+
- the new map `f_1 * f_2 * \cdots * f_2` representing their
68+
convolution product
6069
6170
.. SEEALSO::
6271
6372
:meth:`sage.categories.bialgebras.ElementMethods.convolution_product`
6473
6574
AUTHORS:
6675
67-
Aaron Lauve - 12 June 2015 - Sage Days 65
68-
- based off of .adams_operator() code in sage-trac ticket #18350
69-
- by Jean-Baptiste Priez
76+
- Aaron Lauve - 12 June 2015 - Sage Days 65
7077
7178
.. TODO::
7279
@@ -128,40 +135,39 @@ def convolution_product(self, *maps):
128135
sage: T(x)
129136
2*[1, 3, 2] + [2, 1, 3] + 2*[2, 3, 1] + 3*[3, 1, 2] + 3*[3, 2, 1]
130137
"""
131-
H = self
132-
# TYPE-CHECK:
133-
if not H in ModulesWithBasis:
134-
raise AttributeError('`self` (%s) must belong to ModulesWithBasis. Try defining convolution product on a basis of `self` instead.' % H._repr_())
135-
136-
onbasis = lambda x: H.term(x).convolution_product(*maps)
137-
return H.module_morphism(on_basis=onbasis, codomain=H)
138+
onbasis = lambda x: self.term(x).convolution_product(*maps)
139+
return self.module_morphism(on_basis=onbasis, codomain=self)
138140

139141
class ElementMethods:
140142

141143
def adams_operator(self, n):
142144
r"""
143-
Compute the `n`-th convolution power of the identity morphism `Id`
144-
on ``self``.
145+
Compute the `n`-th convolution power of the identity morphism
146+
`\mathrm{Id}` on ``self``.
145147
146148
INPUT:
147149
148-
- ``n`` -- a nonnegative integer.
150+
- ``n`` -- a nonnegative integer
149151
150152
OUTPUT:
151153
152-
- the image of ``self`` under the convolution power `Id^{*n}`.
154+
- the image of ``self`` under the convolution power `\mathrm{Id}^{*n}`
153155
154-
.. SEEALSO::
156+
.. NOTE::
157+
158+
In the literature, this is also called a Hopf power or
159+
Sweedler power, cf. [AL2015]_.
155160
156-
:mod:`sage.categories.bialgebras.ElementMethods.convolution_product`
161+
.. SEEALSO::
157162
158-
(In the literature, this is also called a Hopf power or Sweedler power, cf. [AL2015]_.)
163+
:meth:`sage.categories.bialgebras.ElementMethods.convolution_product`
159164
160165
REFERENCES:
161166
162-
.. [AL2015] The characteristic polynomial of the Adams operators on graded connected Hopf algebras.
163-
Marcelo Aguiar and Aaron Lauve.
164-
Algebra Number Theory, v.9, 2015, n.3, 2015.
167+
.. [AL2015] *The characteristic polynomial of the Adams operators
168+
on graded connected Hopf algebras*.
169+
Marcelo Aguiar and Aaron Lauve.
170+
Algebra Number Theory, v.9, 2015, n.3, 2015.
165171
166172
.. TODO::
167173
@@ -195,14 +201,13 @@ def adams_operator(self, n):
195201
sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
196202
sage: m[[1,3],[2]].adams_operator(-2)
197203
3*m{{1}, {2, 3}} + 3*m{{1, 2}, {3}} + 6*m{{1, 2, 3}} - 2*m{{1, 3}, {2}}
198-
199204
"""
200205
if n < 0:
201206
if hasattr(self, 'antipode'):
202207
T = lambda x: x.antipode()
203208
n = abs(n)
204209
else:
205-
raise ValueError("`self` has no antipode, hence cannot take negative convolution powers of identity_map: %s < 0" % str(n))
210+
raise ValueError("antipode not defined; cannot take negative convolution powers: {} < 0".format(n))
206211
else:
207212
T = lambda x: x
208213
return self.convolution_product([T] * n)
@@ -212,40 +217,48 @@ def convolution_product(self, *maps):
212217
Return the image of ``self`` under the convolution product (map) of
213218
the maps.
214219
215-
INPUT:
220+
Let `A` and `B` be bialgebras over a commutative ring `R`.
221+
Given maps `f_i : A \to B` for `1 \leq i < n`, define the
222+
convolution product
216223
217-
- ``maps`` -- any number `n \geq 0` of linear maps `R, S, \dots,
218-
T` on ``self.parent()``; or a single ``list`` or ``tuple`` of
219-
such maps.
224+
.. MATH::
220225
221-
OUTPUT:
226+
(f_1 * f_2 * \cdots * f_n) := \mu^{(n-1)} \circ (f_1 \otimes
227+
f_2 \otimes \cdots \otimes f_n) \circ \Delta^{(n-1)},
222228
223-
- `(R * S * \cdots * T)` applied to ``self``.
229+
where `\Delta^{(k)} := \bigl(\Delta \otimes
230+
\mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`,
231+
with `\Delta^{(1)} = \Delta` (the ordinary coproduct in `A`) and
232+
`\Delta^{(0)} = \mathrm{Id}`; and with `\mu^{(k)} := \mu \circ
233+
\bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu`
234+
(the ordinary product in `B`). See [Sw1969]_.
224235
225-
.. MATH::
236+
(In the literature, one finds, e.g., `\Delta^{(2)}` for what we
237+
denote above as `\Delta^{(1)}`. See [KMN2012]_.)
226238
227-
(R*S*\cdots*T)(h) := \mu^{(n-1)} \circ (R \otimes S \otimes\cdot\otimes T) \circ \Delta^{(n-1)}(h),
239+
INPUT:
240+
241+
- ``maps`` -- any number `n \geq 0` of linear maps `f_1, f_2,
242+
\ldots, f_n` on ``self.parent()``; or a single ``list`` or
243+
``tuple`` of such maps
228244
229-
where `\Delta^{(k)} := \bigl(\Delta \otimes \mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`,
230-
with `\Delta^{(1)} = \Delta` (the ordinary coproduct) and `\Delta^{(0)} = \mathrm{Id}`;
231-
and with `\mu^{(k)} := \mu \circ \bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu`
232-
(the ordinary product). See [Sw1969]_.
245+
OUTPUT:
233246
234-
(In the literature, one finds, e.g., `\Delta^{(2)}` for what we denote above as `\Delta^{(1)}`. See [KMN2012]_.)
247+
- the convolution product of ``maps`` applied to ``self``
235248
236249
REFERENCES:
237250
238251
.. [KMN2012] On the trace of the antipode and higher indicators.
239-
Yevgenia Kashina and Susan Montgomery and Richard Ng.
240-
Israel J. Math., v.188, 2012.
252+
Yevgenia Kashina and Susan Montgomery and Richard Ng.
253+
Israel J. Math., v.188, 2012.
241254
242255
.. [Sw1969] Hopf algebras.
243-
Moss Sweedler.
244-
W.A. Benjamin, Math Lec Note Ser., 1969.
256+
Moss Sweedler.
257+
W.A. Benjamin, Math Lec Note Ser., 1969.
245258
246259
AUTHORS:
247260
248-
Amy Pang - 12 June 2015 - Sage Days 65
261+
- Amy Pang - 12 June 2015 - Sage Days 65
249262
250263
.. TODO::
251264
@@ -301,7 +314,6 @@ def convolution_product(self, *maps):
301314
sage: x.convolution_product([Id]*6)
302315
9*[1, 2, 3]
303316
304-
305317
TESTS::
306318
307319
sage: Id = lambda x: x
@@ -323,7 +335,8 @@ def convolution_product(self, *maps):
323335
324336
sage: S = NonCommutativeSymmetricFunctions(QQ).S()
325337
sage: S[4].convolution_product([Id]*5)
326-
5*S[1, 1, 1, 1] + 10*S[1, 1, 2] + 10*S[1, 2, 1] + 10*S[1, 3] + 10*S[2, 1, 1] + 10*S[2, 2] + 10*S[3, 1] + 5*S[4]
338+
5*S[1, 1, 1, 1] + 10*S[1, 1, 2] + 10*S[1, 2, 1] + 10*S[1, 3]
339+
+ 10*S[2, 1, 1] + 10*S[2, 2] + 10*S[3, 1] + 5*S[4]
327340
328341
::
329342
@@ -360,7 +373,6 @@ def convolution_product(self, *maps):
360373
361374
sage: s[3,2].counit().parent() == s[3,2].convolution_product().parent()
362375
False
363-
364376
"""
365377
# Be flexible on how the maps are entered: accept a list/tuple of
366378
# maps as well as multiple arguments
@@ -370,87 +382,27 @@ def convolution_product(self, *maps):
370382
T = maps
371383

372384
H = self.parent()
373-
# TYPE-CHECK:
374-
if not H in ModulesWithBasis:
375-
raise AttributeError('`parent` (%s) must belong to ModulesWithBasis. Try defining convolution product on a basis of `parent` instead.' % H._repr_())
376385

377386
n = len(T)
378387
if n == 0:
379388
return H.one() * self.counit()
380-
elif n == 1:
389+
if n == 1:
381390
return T[0](self)
382-
else:
383-
# We apply the maps T_i and products concurrently with coproducts, as this
384-
# seems to be faster than applying a composition of maps, e.g., (H.nfold_product) * tensor(T) * (H.nfold_coproduct).
385391

386-
i = 0
387-
out = tensor((H.one(),self))
388-
HH = tensor((H,H))
392+
# We apply the maps T_i and products concurrently with coproducts, as this
393+
# seems to be faster than applying a composition of maps, e.g., (H.nfold_product) * tensor(T) * (H.nfold_coproduct).
394+
395+
out = tensor((H.one(),self))
396+
HH = tensor((H,H))
389397

398+
for mor in T[:-1]:
390399
#ALGORITHM:
391400
#`split_convolve` moves terms of the form x # y to x*Ti(y1) # y2 in Sweedler notation.
392-
split_convolve = lambda (x,y): (((xy1,y2),c*d) for ((y1,y2),d) in H.term(y).coproduct() for (xy1,c) in H.term(x)*T[i](H.term(y1)))
393-
while i < n-1:
394-
out = HH.module_morphism(on_basis=lambda t: HH.sum_of_terms(split_convolve(t)), codomain = HH)(out)
395-
i += 1
396-
397-
#Apply final map `T_n` to last term, `y`, and multiply.
398-
out = HH.module_morphism(on_basis=lambda (x,y): H.term(x)*T[n-1](H.term(y)), codomain=H)(out)
401+
split_convolve = lambda (x,y): ( ((xy1,y2),c*d)
402+
for ((y1,y2),d) in H.term(y).coproduct()
403+
for (xy1,c) in H.term(x)*mor(H.term(y1)) )
404+
out = HH.module_morphism(on_basis=lambda t: HH.sum_of_terms(split_convolve(t)), codomain=HH)(out)
399405

400-
return out
401-
402-
403-
def coproduct_iterated(self, n=1):
404-
r"""
405-
Apply `n` coproducts to ``self``.
406-
407-
.. TODO::
408-
409-
Remove dependency on ``modules_with_basis`` methods.
410-
411-
EXAMPLES::
412-
413-
sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
414-
sage: Psi[2,2].coproduct_iterated(0)
415-
Psi[2, 2]
416-
sage: Psi[2,2].coproduct_iterated(2)
417-
Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[2] # Psi[2] + Psi[] # Psi[2, 2] # Psi[] + 2*Psi[2] # Psi[] # Psi[2] + 2*Psi[2] # Psi[2] # Psi[] + Psi[2, 2] # Psi[] # Psi[]
418-
419-
TESTS::
420-
421-
sage: p = SymmetricFunctions(QQ).p()
422-
sage: p[5,2,2].coproduct_iterated()
423-
p[] # p[5, 2, 2] + 2*p[2] # p[5, 2] + p[2, 2] # p[5] + p[5] # p[2, 2] + 2*p[5, 2] # p[2] + p[5, 2, 2] # p[]
424-
sage: p([]).coproduct_iterated(3)
425-
p[] # p[] # p[] # p[]
426-
427-
::
428-
429-
sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
430-
sage: Psi[2,2].coproduct_iterated(0)
431-
Psi[2, 2]
432-
sage: Psi[2,2].coproduct_iterated(3)
433-
Psi[] # Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[] # Psi[2] # Psi[2] + Psi[] # Psi[] # Psi[2, 2] # Psi[] + 2*Psi[] # Psi[2] # Psi[] # Psi[2] + 2*Psi[] # Psi[2] # Psi[2] # Psi[] + Psi[] # Psi[2, 2] # Psi[] # Psi[] + 2*Psi[2] # Psi[] # Psi[] # Psi[2] + 2*Psi[2] # Psi[] # Psi[2] # Psi[] + 2*Psi[2] # Psi[2] # Psi[] # Psi[] + Psi[2, 2] # Psi[] # Psi[] # Psi[]
434-
435-
::
436-
437-
sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
438-
sage: m[[1,3],[2]].coproduct_iterated(2)
439-
m{} # m{} # m{{1, 3}, {2}} + m{} # m{{1}} # m{{1, 2}} + m{} # m{{1, 2}} # m{{1}} + m{} # m{{1, 3}, {2}} # m{} + m{{1}} # m{} # m{{1, 2}} + m{{1}} # m{{1, 2}} # m{} + m{{1, 2}} # m{} # m{{1}} + m{{1, 2}} # m{{1}} # m{} + m{{1, 3}, {2}} # m{} # m{}
440-
sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0)
441-
(m{} # m{} # m{} # m{}, m{{1, 3}, {2}})
442-
"""
443-
if n < 0:
444-
raise ValueError("cannot take fewer than 0 coproduct iterations: %s < 0" % str(n))
445-
if n==0:
446-
return self
447-
elif n==1:
448-
return self.coproduct()
449-
else:
450-
from sage.functions.all import floor, ceil
451-
from sage.rings.all import Integer
406+
#Apply final map `T_n` to last term, `y`, and multiply.
407+
return HH.module_morphism(on_basis=lambda (x,y): H.term(x)*T[-1](H.term(y)), codomain=H)(out)
452408

453-
# Use coassociativity of `\Delta` to perform many coproducts simultaneously.
454-
fn = floor(Integer(n-1)/2); cn = ceil(Integer(n-1)/2)
455-
def split(a,b): return tensor([a.coproduct_iterated(fn), b.coproduct_iterated(cn)])
456-
return (self.coproduct()).apply_multilinear_morphism(split)

src/sage/categories/coalgebras_with_basis.py

+64-1
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,68 @@ def counit(self):
127127
return self.module_morphism(self.counit_on_basis,codomain=self.base_ring())
128128

129129
class ElementMethods:
130-
pass
130+
def coproduct_iterated(self, n=1):
131+
r"""
132+
Apply ``n`` coproducts to ``self``.
133+
134+
.. TODO::
135+
136+
Remove dependency on ``modules_with_basis`` methods.
137+
138+
EXAMPLES::
139+
140+
sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
141+
sage: Psi[2,2].coproduct_iterated(0)
142+
Psi[2, 2]
143+
sage: Psi[2,2].coproduct_iterated(2)
144+
Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[2] # Psi[2]
145+
+ Psi[] # Psi[2, 2] # Psi[] + 2*Psi[2] # Psi[] # Psi[2]
146+
+ 2*Psi[2] # Psi[2] # Psi[] + Psi[2, 2] # Psi[] # Psi[]
147+
148+
TESTS::
149+
150+
sage: p = SymmetricFunctions(QQ).p()
151+
sage: p[5,2,2].coproduct_iterated()
152+
p[] # p[5, 2, 2] + 2*p[2] # p[5, 2] + p[2, 2] # p[5]
153+
+ p[5] # p[2, 2] + 2*p[5, 2] # p[2] + p[5, 2, 2] # p[]
154+
sage: p([]).coproduct_iterated(3)
155+
p[] # p[] # p[] # p[]
156+
157+
::
158+
159+
sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
160+
sage: Psi[2,2].coproduct_iterated(0)
161+
Psi[2, 2]
162+
sage: Psi[2,2].coproduct_iterated(3)
163+
Psi[] # Psi[] # Psi[] # Psi[2, 2] + 2*Psi[] # Psi[] # Psi[2] # Psi[2]
164+
+ Psi[] # Psi[] # Psi[2, 2] # Psi[] + 2*Psi[] # Psi[2] # Psi[] # Psi[2]
165+
+ 2*Psi[] # Psi[2] # Psi[2] # Psi[] + Psi[] # Psi[2, 2] # Psi[] # Psi[]
166+
+ 2*Psi[2] # Psi[] # Psi[] # Psi[2] + 2*Psi[2] # Psi[] # Psi[2] # Psi[]
167+
+ 2*Psi[2] # Psi[2] # Psi[] # Psi[] + Psi[2, 2] # Psi[] # Psi[] # Psi[]
168+
169+
::
170+
171+
sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m()
172+
sage: m[[1,3],[2]].coproduct_iterated(2)
173+
m{} # m{} # m{{1, 3}, {2}} + m{} # m{{1}} # m{{1, 2}}
174+
+ m{} # m{{1, 2}} # m{{1}} + m{} # m{{1, 3}, {2}} # m{}
175+
+ m{{1}} # m{} # m{{1, 2}} + m{{1}} # m{{1, 2}} # m{}
176+
+ m{{1, 2}} # m{} # m{{1}} + m{{1, 2}} # m{{1}} # m{}
177+
+ m{{1, 3}, {2}} # m{} # m{}
178+
sage: m[[]].coproduct_iterated(3), m[[1,3],[2]].coproduct_iterated(0)
179+
(m{} # m{} # m{} # m{}, m{{1, 3}, {2}})
180+
"""
181+
if n < 0:
182+
raise ValueError("cannot take fewer than 0 coproduct iterations: %s < 0" % str(n))
183+
if n == 0:
184+
return self
185+
if n == 1:
186+
return self.coproduct()
187+
from sage.functions.all import floor, ceil
188+
from sage.rings.all import Integer
189+
190+
# Use coassociativity of `\Delta` to perform many coproducts simultaneously.
191+
fn = floor(Integer(n-1)/2); cn = ceil(Integer(n-1)/2)
192+
split = lambda a,b: tensor([a.coproduct_iterated(fn), b.coproduct_iterated(cn)])
193+
return self.coproduct().apply_multilinear_morphism(split)
131194

0 commit comments

Comments
 (0)