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

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

r""" 

Bialgebras with basis 

""" 

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

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

# Copyright (C) 2008-2011 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 sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring 

from sage.categories.modules_with_basis import ModulesWithBasis 

from sage.categories.tensor import tensor 

 

class BialgebrasWithBasis(CategoryWithAxiom_over_base_ring): 

r""" 

The category of bialgebras with a distinguished basis. 

 

EXAMPLES:: 

 

sage: C = BialgebrasWithBasis(QQ); C 

Category of bialgebras with basis over Rational Field 

 

sage: sorted(C.super_categories(), key=str) 

[Category of algebras with basis over Rational Field, 

Category of bialgebras over Rational Field, 

Category of coalgebras with basis over Rational Field] 

 

TESTS:: 

 

sage: TestSuite(BialgebrasWithBasis(ZZ)).run() 

""" 

class ParentMethods: 

 

def convolution_product(self, *maps): 

r""" 

Return the convolution product (a map) of the given maps. 

 

Let `A` and `B` be bialgebras over a commutative ring `R`. 

Given maps `f_i : A \to B` for `1 \leq i < n`, define the 

convolution product 

 

.. MATH:: 

 

(f_1 * f_2 * \cdots * f_n) := \mu^{(n-1)} \circ (f_1 \otimes 

f_2 \otimes \cdots \otimes f_n) \circ \Delta^{(n-1)}, 

 

where `\Delta^{(k)} := \bigl(\Delta \otimes 

\mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`, 

with `\Delta^{(1)} = \Delta` (the ordinary coproduct in `A`) and 

`\Delta^{(0)} = \mathrm{Id}`; and with `\mu^{(k)} := \mu \circ 

\bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu` 

(the ordinary product in `B`). See [Swe1969]_. 

 

(In the literature, one finds, e.g., `\Delta^{(2)}` for what we 

denote above as `\Delta^{(1)}`. See [KMN2012]_.) 

 

INPUT: 

 

- ``maps`` -- any number `n \geq 0` of linear maps `f_1, f_2, 

\ldots, f_n` on ``self``; or a single ``list`` or ``tuple`` 

of such maps 

 

OUTPUT: 

 

- the new map `f_1 * f_2 * \cdots * f_2` representing their 

convolution product 

 

.. SEEALSO:: 

 

:meth:`sage.categories.bialgebras.ElementMethods.convolution_product` 

 

AUTHORS: 

 

- Aaron Lauve - 12 June 2015 - Sage Days 65 

 

.. TODO:: 

 

Remove dependency on ``modules_with_basis`` methods. 

 

EXAMPLES: 

 

We construct some maps: the identity, the antipode and 

projection onto the homogeneous componente of degree 2:: 

 

sage: Id = lambda x: x 

sage: Antipode = lambda x: x.antipode() 

sage: Proj2 = lambda x: x.parent().sum_of_terms([(m, c) for (m, c) in x if m.size() == 2]) 

 

Compute the convolution product of the identity with itself and 

with the projection ``Proj2`` on the Hopf algebra of 

non-commutative symmetric functions:: 

 

sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() 

sage: T = R.convolution_product([Id, Id]) 

sage: [T(R(comp)) for comp in Compositions(3)] 

[4*R[1, 1, 1] + R[1, 2] + R[2, 1], 

2*R[1, 1, 1] + 4*R[1, 2] + 2*R[2, 1] + 2*R[3], 

2*R[1, 1, 1] + 2*R[1, 2] + 4*R[2, 1] + 2*R[3], 

R[1, 2] + R[2, 1] + 4*R[3]] 

sage: T = R.convolution_product(Proj2, Id) 

sage: [T(R([i])) for i in range(1, 5)] 

[0, R[2], R[2, 1] + R[3], R[2, 2] + R[4]] 

 

Compute the convolution product of no maps on the Hopf algebra of 

symmetric functions in non-commuting variables. This is the 

composition of the counit with the unit:: 

 

sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() 

sage: T = m.convolution_product() 

sage: [T(m(lam)) for lam in SetPartitions(0).list() + SetPartitions(2).list()] 

[m{}, 0, 0] 

 

Compute the convolution product of the projection ``Proj2`` with 

the identity on the Hopf algebra of symmetric functions in 

non-commuting variables:: 

 

sage: T = m.convolution_product(Proj2, Id) 

sage: [T(m(lam)) for lam in SetPartitions(3)] 

[0, 

m{{1, 2}, {3}} + m{{1, 2, 3}}, 

m{{1, 2}, {3}} + m{{1, 2, 3}}, 

m{{1, 2}, {3}} + m{{1, 2, 3}}, 

3*m{{1}, {2}, {3}} + 3*m{{1}, {2, 3}} + 3*m{{1, 3}, {2}}] 

 

Compute the convolution product of the antipode with itself and the 

identity map on group algebra of the symmetric group:: 

 

sage: G = SymmetricGroup(3) 

sage: QG = GroupAlgebra(G, QQ) 

sage: x = QG.sum_of_terms([(p,p.number_of_peaks() + p.number_of_inversions()) for p in Permutations(3)]); x 

2*[1, 3, 2] + [2, 1, 3] + 3*[2, 3, 1] + 2*[3, 1, 2] + 3*[3, 2, 1] 

sage: T = QG.convolution_product(Antipode, Antipode, Id) 

sage: T(x) 

2*[1, 3, 2] + [2, 1, 3] + 2*[2, 3, 1] + 3*[3, 1, 2] + 3*[3, 2, 1] 

""" 

onbasis = lambda x: self.term(x).convolution_product(*maps) 

return self.module_morphism(on_basis=onbasis, codomain=self) 

 

class ElementMethods: 

 

def adams_operator(self, n): 

r""" 

Compute the `n`-th convolution power of the identity morphism 

`\mathrm{Id}` on ``self``. 

 

INPUT: 

 

- ``n`` -- a nonnegative integer 

 

OUTPUT: 

 

- the image of ``self`` under the convolution power `\mathrm{Id}^{*n}` 

 

.. NOTE:: 

 

In the literature, this is also called a Hopf power or 

Sweedler power, cf. [AL2015]_. 

 

.. SEEALSO:: 

 

:meth:`sage.categories.bialgebras.ElementMethods.convolution_product` 

 

.. TODO:: 

 

Remove dependency on ``modules_with_basis`` methods. 

 

EXAMPLES:: 

 

sage: h = SymmetricFunctions(QQ).h() 

sage: h[5].adams_operator(2) 

2*h[3, 2] + 2*h[4, 1] + 2*h[5] 

sage: h[5].plethysm(2*h[1]) 

2*h[3, 2] + 2*h[4, 1] + 2*h[5] 

sage: h([]).adams_operator(0) 

h[] 

sage: h([]).adams_operator(1) 

h[] 

sage: h[3,2].adams_operator(0) 

0 

sage: h[3,2].adams_operator(1) 

h[3, 2] 

 

:: 

 

sage: S = NonCommutativeSymmetricFunctions(QQ).S() 

sage: S[4].adams_operator(5) 

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] 

 

 

:: 

 

sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() 

sage: m[[1,3],[2]].adams_operator(-2) 

3*m{{1}, {2, 3}} + 3*m{{1, 2}, {3}} + 6*m{{1, 2, 3}} - 2*m{{1, 3}, {2}} 

""" 

if n < 0: 

if hasattr(self, 'antipode'): 

T = lambda x: x.antipode() 

n = abs(n) 

else: 

raise ValueError("antipode not defined; cannot take negative convolution powers: {} < 0".format(n)) 

else: 

T = lambda x: x 

return self.convolution_product([T] * n) 

 

def convolution_product(self, *maps): 

r""" 

Return the image of ``self`` under the convolution product (map) of 

the maps. 

 

Let `A` and `B` be bialgebras over a commutative ring `R`. 

Given maps `f_i : A \to B` for `1 \leq i < n`, define the 

convolution product 

 

.. MATH:: 

 

(f_1 * f_2 * \cdots * f_n) := \mu^{(n-1)} \circ (f_1 \otimes 

f_2 \otimes \cdots \otimes f_n) \circ \Delta^{(n-1)}, 

 

where `\Delta^{(k)} := \bigl(\Delta \otimes 

\mathrm{Id}^{\otimes(k-1)}\bigr) \circ \Delta^{(k-1)}`, 

with `\Delta^{(1)} = \Delta` (the ordinary coproduct in `A`) and 

`\Delta^{(0)} = \mathrm{Id}`; and with `\mu^{(k)} := \mu \circ 

\bigl(\mu^{(k-1)} \otimes \mathrm{Id})` and `\mu^{(1)} = \mu` 

(the ordinary product in `B`). See [Swe1969]_. 

 

(In the literature, one finds, e.g., `\Delta^{(2)}` for what we 

denote above as `\Delta^{(1)}`. See [KMN2012]_.) 

 

INPUT: 

 

- ``maps`` -- any number `n \geq 0` of linear maps `f_1, f_2, 

\ldots, f_n` on ``self.parent()``; or a single ``list`` or 

``tuple`` of such maps 

 

OUTPUT: 

 

- the convolution product of ``maps`` applied to ``self`` 

 

AUTHORS: 

 

- Amy Pang - 12 June 2015 - Sage Days 65 

 

.. TODO:: 

 

Remove dependency on ``modules_with_basis`` methods. 

 

EXAMPLES: 

 

We compute convolution products of the identity and antipode maps 

on Schur functions:: 

 

sage: Id = lambda x: x 

sage: Antipode = lambda x: x.antipode() 

sage: s = SymmetricFunctions(QQ).schur() 

sage: s[3].convolution_product(Id, Id) 

2*s[2, 1] + 4*s[3] 

sage: s[3,2].convolution_product(Id) == s[3,2] 

True 

 

The method accepts multiple arguments, or a single argument 

consisting of a list of maps:: 

 

sage: s[3,2].convolution_product(Id, Id) 

2*s[2, 1, 1, 1] + 6*s[2, 2, 1] + 6*s[3, 1, 1] + 12*s[3, 2] + 6*s[4, 1] + 2*s[5] 

sage: s[3,2].convolution_product([Id, Id]) 

2*s[2, 1, 1, 1] + 6*s[2, 2, 1] + 6*s[3, 1, 1] + 12*s[3, 2] + 6*s[4, 1] + 2*s[5] 

 

We test the defining property of the antipode morphism; namely, 

that the antipode is the inverse of the identity map in the 

convolution algebra whose identity element is the composition of 

the counit and unit:: 

 

sage: s[3,2].convolution_product() == s[3,2].convolution_product(Antipode, Id) == s[3,2].convolution_product(Id, Antipode) 

True 

 

:: 

 

sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi() 

sage: Psi[2,1].convolution_product(Id, Id, Id) 

3*Psi[1, 2] + 6*Psi[2, 1] 

sage: (Psi[5,1] - Psi[1,5]).convolution_product(Id, Id, Id) 

-3*Psi[1, 5] + 3*Psi[5, 1] 

 

:: 

 

sage: G = SymmetricGroup(3) 

sage: QG = GroupAlgebra(G,QQ) 

sage: x = QG.sum_of_terms([(p,p.length()) for p in Permutations(3)]); x 

[1, 3, 2] + [2, 1, 3] + 2*[2, 3, 1] + 2*[3, 1, 2] + 3*[3, 2, 1] 

sage: x.convolution_product(Id, Id) 

5*[1, 2, 3] + 2*[2, 3, 1] + 2*[3, 1, 2] 

sage: x.convolution_product(Id, Id, Id) 

4*[1, 2, 3] + [1, 3, 2] + [2, 1, 3] + 3*[3, 2, 1] 

sage: x.convolution_product([Id]*6) 

9*[1, 2, 3] 

 

TESTS:: 

 

sage: Id = lambda x: x 

sage: Antipode = lambda x: x.antipode() 

 

:: 

 

sage: h = SymmetricFunctions(QQ).h() 

sage: h[5].convolution_product([Id, Id]) 

2*h[3, 2] + 2*h[4, 1] + 2*h[5] 

sage: h.one().convolution_product([Id, Antipode]) 

h[] 

sage: h[3,2].convolution_product([Id, Antipode]) 

0 

sage: h.one().convolution_product([Id, Antipode]) == h.one().convolution_product() 

True 

 

:: 

 

sage: S = NonCommutativeSymmetricFunctions(QQ).S() 

sage: S[4].convolution_product([Id]*5) 

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] 

 

:: 

 

sage: m = SymmetricFunctionsNonCommutingVariables(QQ).m() 

sage: m[[1,3],[2]].convolution_product([Antipode, Antipode]) 

3*m{{1}, {2, 3}} + 3*m{{1, 2}, {3}} + 6*m{{1, 2, 3}} - 2*m{{1, 3}, {2}} 

sage: m[[]].convolution_product([]) 

m{} 

sage: m[[1,3],[2]].convolution_product([]) 

0 

 

:: 

 

sage: QS = SymmetricGroupAlgebra(QQ, 5) 

sage: x = QS.sum_of_terms(zip(Permutations(5)[3:6],[1,2,3])); x 

[1, 2, 4, 5, 3] + 2*[1, 2, 5, 3, 4] + 3*[1, 2, 5, 4, 3] 

sage: x.convolution_product([Antipode, Id]) 

6*[1, 2, 3, 4, 5] 

sage: x.convolution_product(Id, Antipode, Antipode, Antipode) 

3*[1, 2, 3, 4, 5] + [1, 2, 4, 5, 3] + 2*[1, 2, 5, 3, 4] 

 

:: 

 

sage: G = SymmetricGroup(3) 

sage: QG = GroupAlgebra(G,QQ) 

sage: x = QG.sum_of_terms([(p,p.length()) for p in Permutations(3)]); x 

[1, 3, 2] + [2, 1, 3] + 2*[2, 3, 1] + 2*[3, 1, 2] + 3*[3, 2, 1] 

sage: x.convolution_product(Antipode, Id) 

9*[1, 2, 3] 

sage: x.convolution_product([Id, Antipode, Antipode, Antipode]) 

5*[1, 2, 3] + 2*[2, 3, 1] + 2*[3, 1, 2] 

 

:: 

 

sage: s[3,2].counit().parent() == s[3,2].convolution_product().parent() 

False 

""" 

# Be flexible on how the maps are entered: accept a list/tuple of 

# maps as well as multiple arguments 

if len(maps) == 1 and isinstance(maps[0], (list, tuple)): 

T = tuple(maps[0]) 

else: 

T = maps 

 

H = self.parent() 

 

n = len(T) 

if n == 0: 

return H.one() * self.counit() 

if n == 1: 

return T[0](self) 

 

# We apply the maps T_i and products concurrently with coproducts, as this 

# seems to be faster than applying a composition of maps, e.g., (H.nfold_product) * tensor(T) * (H.nfold_coproduct). 

 

out = tensor((H.one(),self)) 

HH = tensor((H,H)) 

 

for mor in T[:-1]: 

#ALGORITHM: 

#`split_convolve` moves terms of the form x # y to x*Ti(y1) # y2 in Sweedler notation. 

def split_convolve(x_y): 

x, y = x_y 

return (((xy1,y2),c*d) 

for ((y1,y2),d) in H.term(y).coproduct() 

for (xy1,c) in H.term(x)*mor(H.term(y1))) 

out = HH.module_morphism(on_basis=lambda t: HH.sum_of_terms(split_convolve(t)), codomain=HH)(out) 

 

#Apply final map `T_n` to last term, `y`, and multiply. 

return HH.module_morphism(on_basis=lambda xy: H.term(xy[0])*T[-1](H.term(xy[1])), codomain=H)(out)