Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/combinat/crystals/direct_sum.py
8817 views
1
"""
2
Direct Sum of Crystals
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2010 Anne Schilling <anne at math.ucdavis.edu>
6
#
7
# Distributed under the terms of the GNU General Public License (GPL)
8
#
9
# This code is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# General Public License for more details.
13
#
14
# The full text of the GPL is available at:
15
#
16
# http://www.gnu.org/licenses/
17
#****************************************************************************
18
19
from sage.structure.parent import Parent
20
from sage.categories.category import Category
21
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
22
from sage.structure.element_wrapper import ElementWrapper
23
24
class DirectSumOfCrystals(DisjointUnionEnumeratedSets):
25
r"""
26
Direct sum of crystals.
27
28
Given a list of crystals `B_0, \ldots, B_k` of the same Cartan type,
29
one can form the direct sum `B_0 \oplus \cdots \oplus B_k`.
30
31
INPUT:
32
33
- ``crystals`` -- a list of crystals of the same Cartan type
34
- ``keepkey`` -- a boolean
35
36
The option ``keepkey`` is by default set to ``False``, assuming
37
that the crystals are all distinct. In this case the elements of
38
the direct sum are just represented by the elements in the
39
crystals `B_i`. If the crystals are not all distinct, one should
40
set the ``keepkey`` option to ``True``. In this case, the
41
elements of the direct sum are represented as tuples `(i, b)`
42
where `b \in B_i`.
43
44
EXAMPLES::
45
46
sage: C = CrystalOfLetters(['A',2])
47
sage: C1 = CrystalOfTableaux(['A',2],shape=[1,1])
48
sage: B = DirectSumOfCrystals([C,C1])
49
sage: B.list()
50
[1, 2, 3, [[1], [2]], [[1], [3]], [[2], [3]]]
51
sage: [b.f(1) for b in B]
52
[2, None, None, None, [[2], [3]], None]
53
sage: B.module_generators
54
[1, [[1], [2]]]
55
56
::
57
58
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
59
sage: B.list()
60
[(0, 1), (0, 2), (0, 3), (1, 1), (1, 2), (1, 3)]
61
sage: B.module_generators
62
[(0, 1), (1, 1)]
63
sage: b = B( tuple([0,C(1)]) )
64
sage: b
65
(0, 1)
66
sage: b.weight()
67
(1, 0, 0)
68
69
The following is required, because :class:`DirectSumOfCrystals`
70
takes the same arguments as :class:`DisjointUnionEnumeratedSets`
71
(which see for details).
72
73
TESTS::
74
75
sage: C = CrystalOfLetters(['A',2])
76
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
77
sage: B
78
Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
79
80
sage: TestSuite(C).run()
81
"""
82
__classcall_private__ = staticmethod(DisjointUnionEnumeratedSets.__classcall_private__)
83
84
85
def __init__(self, crystals, **options):
86
"""
87
TESTS::
88
89
sage: C = CrystalOfLetters(['A',2])
90
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
91
sage: B
92
Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
93
sage: B.cartan_type()
94
['A', 2]
95
96
sage: isinstance(B, DirectSumOfCrystals)
97
True
98
"""
99
if options.has_key('keepkey'):
100
keepkey = options['keepkey']
101
else:
102
keepkey = False
103
# facade = options['facade']
104
if keepkey:
105
facade = False
106
else:
107
facade = True
108
category = Category.meet([Category.join(crystal.categories()) for crystal in crystals])
109
Parent.__init__(self, category = category)
110
DisjointUnionEnumeratedSets.__init__(self, crystals, keepkey = keepkey, facade = facade)
111
self.rename("Direct sum of the crystals %s"%(crystals,))
112
self._keepkey = keepkey
113
self.crystals = crystals
114
if len(crystals) == 0:
115
raise ValueError, "The direct sum is empty"
116
else:
117
assert(crystal.cartan_type() == crystals[0].cartan_type() for crystal in crystals)
118
self._cartan_type = crystals[0].cartan_type()
119
if keepkey:
120
self.module_generators = [ self(tuple([i,b])) for i in range(len(crystals))
121
for b in crystals[i].module_generators ]
122
else:
123
self.module_generators = sum( (list(B.module_generators) for B in crystals), [])
124
125
126
class Element(ElementWrapper):
127
r"""
128
A class for elements of direct sums of crystals
129
"""
130
131
def e(self, i):
132
r"""
133
Returns the action of `e_i` on self.
134
135
EXAMPLES::
136
137
sage: C = CrystalOfLetters(['A',2])
138
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
139
sage: [[b, b.e(2)] for b in B]
140
[[(0, 1), None], [(0, 2), None], [(0, 3), (0, 2)], [(1, 1), None], [(1, 2), None], [(1, 3), (1, 2)]]
141
"""
142
v = self.value
143
vn = v[1].e(i)
144
if vn is None:
145
return None
146
else:
147
return self.parent()(tuple([v[0],vn]))
148
149
def f(self, i):
150
r"""
151
Returns the action of `f_i` on self.
152
153
EXAMPLES::
154
155
sage: C = CrystalOfLetters(['A',2])
156
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
157
sage: [[b,b.f(1)] for b in B]
158
[[(0, 1), (0, 2)], [(0, 2), None], [(0, 3), None], [(1, 1), (1, 2)], [(1, 2), None], [(1, 3), None]]
159
"""
160
v = self.value
161
vn = v[1].f(i)
162
if vn is None:
163
return None
164
else:
165
return self.parent()(tuple([v[0],vn]))
166
167
def weight(self):
168
r"""
169
Returns the weight of self.
170
171
EXAMPLES::
172
173
sage: C = CrystalOfLetters(['A',2])
174
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
175
sage: b = B( tuple([0,C(2)]) )
176
sage: b
177
(0, 2)
178
sage: b.weight()
179
(0, 1, 0)
180
"""
181
return self.value[1].weight()
182
183
def phi(self, i):
184
r"""
185
EXAMPLES::
186
187
sage: C = CrystalOfLetters(['A',2])
188
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
189
sage: b = B( tuple([0,C(2)]) )
190
sage: b.phi(2)
191
1
192
"""
193
return self.value[1].phi(i)
194
195
def epsilon(self, i):
196
r"""
197
EXAMPLES::
198
199
sage: C = CrystalOfLetters(['A',2])
200
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
201
sage: b = B( tuple([0,C(2)]) )
202
sage: b.epsilon(2)
203
0
204
"""
205
return self.value[1].epsilon(i)
206
207
208