This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
graded_connected_hopf_algebras_with_basis.py
115 lines (86 loc) · 3.21 KB
/
graded_connected_hopf_algebras_with_basis.py
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
r"""
Examples of graded connected Hopf algebras with basis
"""
#*****************************************************************************
# Copyright (C) 2015 Jean-Baptiste Priez <jbp@kerios.fr>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*****************************************************************************
from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
from sage.combinat.free_module import CombinatorialFreeModule
from sage.functions.other import binomial
from sage.misc.cachefunc import cached_method
from sage.sets.non_negative_integers import NonNegativeIntegers
class GradedConnectedHopfAlgebraOfInteger(CombinatorialFreeModule):
r"""
This class illustrates an implementation of a graded hopf algebra
with basis: the polynomial Hopf algebra of one variable.
"""
def __init__(self, base_ring):
"""
EXAMPLES::
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: TestSuite(H).run()
"""
CombinatorialFreeModule.__init__(self, base_ring, NonNegativeIntegers(),
category=GradedHopfAlgebrasWithBasis(base_ring).Connected())
@cached_method
def one_basis(self):
"""
Returns 0, which index the unit of the hopf algebra.
EXAMPLES::r
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: H.one_basis()
0
sage: H.one()
P0
"""
return self.basis().keys()(0)
def degree_on_basis(self, t):
"""
The degree of an integer is the integer
TESTS::
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: H.degree_on_basis(45)
45
"""
return t
def _repr_(self):
"""
Print representation
EXAMPLES::
sage: GradedHopfAlgebrasWithBasis(QQ).Connected().example()
An example of a graded connected hopf algebra with basis over Rational Field
"""
return "An example of a graded connected hopf algebra with basis over %s" % self.base_ring()
def _repr_term(self, t):
"""
Print representation for the basis element represented by the
integer ``t``.
EXAMPLES::
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: H._repr_term(45)
'P45'
"""
return 'P' + repr(t)
def product_on_basis(self, i, j):
"""
TESTS::
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: H.monomial(4) * H.monomial(5)
P9
"""
return self.monomial(i+j)
def coproduct_on_basis(self, i):
"""
TESTS::
sage: H = GradedHopfAlgebrasWithBasis(QQ).Connected().example()
sage: H.monomial(3).coproduct()
P0 # P3 + 3*P1 # P2 + 3*P2 # P1 + P3 # P0
"""
return self.sum_of_terms(
((i-j, j), binomial(i, j))
for j in range(i+1)
)
Example = GradedConnectedHopfAlgebraOfInteger