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

r""" 

Coalgebras 

""" 

from __future__ import absolute_import 

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

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

# Copyright (C) 2008-2009 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 .category_types import Category_over_base_ring 

from sage.categories.all import Modules 

from sage.categories.tensor import TensorProductsCategory, tensor 

from sage.categories.dual import DualObjectsCategory 

from sage.categories.super_modules import SuperModulesCategory 

from sage.categories.realizations import RealizationsCategory 

from sage.categories.with_realizations import WithRealizationsCategory 

from sage.misc.abstract_method import abstract_method 

from sage.misc.cachefunc import cached_method 

from sage.misc.lazy_import import LazyImport 

 

class Coalgebras(Category_over_base_ring): 

""" 

The category of coalgebras 

 

EXAMPLES:: 

 

sage: Coalgebras(QQ) 

Category of coalgebras over Rational Field 

sage: Coalgebras(QQ).super_categories() 

[Category of vector spaces over Rational Field] 

 

TESTS:: 

 

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

""" 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Coalgebras(QQ).super_categories() 

[Category of vector spaces over Rational Field] 

""" 

return [Modules(self.base_ring())] 

 

WithBasis = LazyImport('sage.categories.coalgebras_with_basis', 'CoalgebrasWithBasis') 

 

class ParentMethods: 

#def __init_add__(self): # The analogue of initDomainAdd 

# # Will declare the coproduct of self to the coercion mechanism when it exists 

# pass 

 

@abstract_method 

def counit(self, x): 

""" 

Returns the counit of x. 

 

Eventually, there will be a default implementation, 

delegating to the overloading mechanism and forcing the 

conversion back 

 

EXAMPLES:: 

 

sage: A = HopfAlgebrasWithBasis(QQ).example(); A 

An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field 

sage: [a,b] = A.algebra_generators() 

sage: a, A.counit(a) 

(B[(1,2,3)], 1) 

sage: b, A.counit(b) 

(B[(1,3)], 1) 

 

TODO: implement some tests of the axioms of coalgebras, bialgebras 

and Hopf algebras using the counit. 

""" 

 

 

@abstract_method 

def coproduct(self, x): 

""" 

Returns the coproduct of x. 

 

Eventually, there will be a default implementation, 

delegating to the overloading mechanism and forcing the 

conversion back 

 

EXAMPLES:: 

 

sage: A = HopfAlgebrasWithBasis(QQ).example(); A 

An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field 

sage: [a,b] = A.algebra_generators() 

sage: a, A.coproduct(a) 

(B[(1,2,3)], B[(1,2,3)] # B[(1,2,3)]) 

sage: b, A.coproduct(b) 

(B[(1,3)], B[(1,3)] # B[(1,3)]) 

""" 

#return self.tensor_square()(overloaded_coproduct(x)) 

 

class ElementMethods: 

def coproduct(self): 

""" 

Returns the coproduct of ``self`` 

 

EXAMPLES:: 

 

sage: A = HopfAlgebrasWithBasis(QQ).example(); A 

An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field 

sage: [a,b] = A.algebra_generators() 

sage: a, a.coproduct() 

(B[(1,2,3)], B[(1,2,3)] # B[(1,2,3)]) 

sage: b, b.coproduct() 

(B[(1,3)], B[(1,3)] # B[(1,3)]) 

""" 

return self.parent().coproduct(self) 

 

def counit(self): 

""" 

Returns the counit of ``self`` 

 

EXAMPLES:: 

 

sage: A = HopfAlgebrasWithBasis(QQ).example(); A 

An example of Hopf algebra with basis: the group algebra of the Dihedral group of order 6 as a permutation group over Rational Field 

sage: [a,b] = A.algebra_generators() 

sage: a, a.counit() 

(B[(1,2,3)], 1) 

sage: b, b.counit() 

(B[(1,3)], 1) 

""" 

return self.parent().counit(self) 

 

class TensorProducts(TensorProductsCategory): 

 

@cached_method 

def extra_super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Coalgebras(QQ).TensorProducts().extra_super_categories() 

[Category of coalgebras over Rational Field] 

sage: Coalgebras(QQ).TensorProducts().super_categories() 

[Category of tensor products of vector spaces over Rational Field, 

Category of coalgebras over Rational Field] 

 

Meaning: a tensor product of coalgebras is a coalgebra 

""" 

return [self.base_category()] 

 

class ParentMethods: 

# TODO: provide this default implementation of one if one_basis is not implemented 

#def one(self): 

# return tensor(module.one() for module in self.modules) 

pass 

 

class ElementMethods: 

pass 

 

class DualObjects(DualObjectsCategory): 

 

def extra_super_categories(self): 

r""" 

Return the dual category. 

 

EXAMPLES: 

 

The category of coalgebras over the Rational Field is dual 

to the category of algebras over the same field:: 

 

sage: C = Coalgebras(QQ) 

sage: C.dual() 

Category of duals of coalgebras over Rational Field 

sage: C.dual().super_categories() # indirect doctest 

[Category of algebras over Rational Field, Category of duals of vector spaces over Rational Field] 

 

.. WARNING:: 

 

This is only correct in certain cases (finite dimension, ...). 

See :trac:`15647`. 

""" 

from sage.categories.algebras import Algebras 

return [Algebras(self.base_category().base_ring())] 

 

class Super(SuperModulesCategory): 

def extra_super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Coalgebras(ZZ).Super().extra_super_categories() 

[Join of Category of graded modules over Integer Ring 

and Category of coalgebras over Integer Ring] 

sage: Coalgebras(ZZ).Super().super_categories() 

[Category of super modules over Integer Ring, 

Category of coalgebras over Integer Ring] 

 

Compare this with the situation for bialgebras:: 

 

sage: Bialgebras(ZZ).Super().extra_super_categories() 

[] 

sage: Bialgebras(ZZ).Super().super_categories() 

[Category of super algebras over Integer Ring, 

Category of super coalgebras over Integer Ring] 

 

The category of bialgebras does not occur in these results, 

since super bialgebras are not bialgebras. 

""" 

return [self.base_category().Graded()] 

 

class WithRealizations(WithRealizationsCategory): 

 

class ParentMethods: 

 

def coproduct(self, x): 

r""" 

Returns the coproduct of ``x``. 

 

EXAMPLES:: 

 

sage: N = NonCommutativeSymmetricFunctions(QQ) 

sage: S = N.complete() 

sage: N.coproduct.__module__ 

'sage.categories.coalgebras' 

sage: N.coproduct(S[2]) 

S[] # S[2] + S[1] # S[1] + S[2] # S[] 

""" 

return self.a_realization()(x).coproduct() 

 

def counit(self, x): 

r""" 

Return the counit of ``x``. 

 

EXAMPLES:: 

 

sage: Sym = SymmetricFunctions(QQ) 

sage: s = Sym.schur() 

sage: f = s[2,1] 

sage: f.counit.__module__ 

'sage.categories.coalgebras' 

sage: f.counit() 

0 

 

:: 

 

sage: N = NonCommutativeSymmetricFunctions(QQ) 

sage: N.counit.__module__ 

'sage.categories.coalgebras' 

sage: N.counit(N.one()) 

1 

sage: x = N.an_element(); x 

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

sage: N.counit(x) 

2 

""" 

return self.a_realization()(x).counit() 

 

class Realizations(RealizationsCategory): 

 

class ParentMethods: 

 

def coproduct_by_coercion(self, x): 

r""" 

Return the coproduct by coercion if ``coproduct_by_basis`` 

is not implemented. 

 

EXAMPLES:: 

 

sage: Sym = SymmetricFunctions(QQ) 

sage: m = Sym.monomial() 

sage: f = m[2,1] 

sage: f.coproduct.__module__ 

'sage.categories.coalgebras' 

sage: m.coproduct_on_basis 

NotImplemented 

sage: m.coproduct == m.coproduct_by_coercion 

True 

sage: f.coproduct() 

m[] # m[2, 1] + m[1] # m[2] + m[2] # m[1] + m[2, 1] # m[] 

 

:: 

 

sage: N = NonCommutativeSymmetricFunctions(QQ) 

sage: R = N.ribbon() 

sage: R.coproduct_by_coercion.__module__ 

'sage.categories.coalgebras' 

sage: R.coproduct_on_basis 

NotImplemented 

sage: R.coproduct == R.coproduct_by_coercion 

True 

sage: R[1].coproduct() 

R[] # R[1] + R[1] # R[] 

""" 

R = self.realization_of().a_realization() 

return self.tensor_square()(R(x).coproduct()) 

 

def counit_by_coercion(self, x): 

r""" 

Return the counit of ``x`` if ``counit_by_basis`` is 

not implemented. 

 

EXAMPLES:: 

 

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

sage: sp.an_element() 

2*sp[] + 2*sp[1] + 3*sp[2] 

sage: sp.counit(sp.an_element()) 

2 

 

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

sage: o.an_element() 

2*o[] + 2*o[1] + 3*o[2] 

sage: o.counit(o.an_element()) 

-1 

""" 

R = self.realization_of().a_realization() 

return R(x).counit()