Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/combinat/crystals/direct_sum.py
4069 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
70
r"""
71
The following is required, because :class:`DirectSumOfCrystals`
72
takes the same arguments as :class:`DisjointUnionEnumeratedSets`
73
(which see for details).
74
75
TESTS::
76
77
sage: C = CrystalOfLetters(['A',2])
78
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
79
sage: B
80
Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
81
82
sage: TestSuite(C).run()
83
"""
84
__classcall_private__ = staticmethod(DisjointUnionEnumeratedSets.__classcall_private__)
85
86
87
def __init__(self, crystals, **options):
88
"""
89
TESTS::
90
91
sage: C = CrystalOfLetters(['A',2])
92
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
93
sage: B
94
Direct sum of the crystals Family (The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2])
95
sage: B.cartan_type()
96
['A', 2]
97
98
sage: isinstance(B, DirectSumOfCrystals)
99
True
100
"""
101
if options.has_key('keepkey'):
102
keepkey = options['keepkey']
103
else:
104
keepkey = False
105
# facade = options['facade']
106
if keepkey:
107
facade = False
108
else:
109
facade = True
110
category = Category.meet([Category.join(crystal.categories()) for crystal in crystals])
111
Parent.__init__(self, category = category)
112
DisjointUnionEnumeratedSets.__init__(self, crystals, keepkey = keepkey, facade = facade)
113
self.rename("Direct sum of the crystals %s"%(crystals,))
114
self._keepkey = keepkey
115
self.crystals = crystals
116
if len(crystals) == 0:
117
raise ValueError, "The direct sum is empty"
118
else:
119
assert(crystal.cartan_type() == crystals[0].cartan_type() for crystal in crystals)
120
self._cartan_type = crystals[0].cartan_type()
121
if keepkey:
122
self.module_generators = [ self(tuple([i,b])) for i in range(len(crystals))
123
for b in crystals[i].module_generators ]
124
else:
125
self.module_generators = sum( (list(B.module_generators) for B in crystals), [])
126
127
128
class Element(ElementWrapper):
129
r"""
130
A class for elements of direct sums of crystals
131
"""
132
133
def e(self, i):
134
r"""
135
Returns the action of `e_i` on self.
136
137
EXAMPLES::
138
139
sage: C = CrystalOfLetters(['A',2])
140
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
141
sage: [[b, b.e(2)] for b in B]
142
[[(0, 1), None], [(0, 2), None], [(0, 3), (0, 2)], [(1, 1), None], [(1, 2), None], [(1, 3), (1, 2)]]
143
"""
144
v = self.value
145
vn = v[1].e(i)
146
if vn is None:
147
return None
148
else:
149
return self.parent()(tuple([v[0],vn]))
150
151
def f(self, i):
152
r"""
153
Returns the action of `f_i` on self.
154
155
EXAMPLES::
156
157
sage: C = CrystalOfLetters(['A',2])
158
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
159
sage: [[b,b.f(1)] for b in B]
160
[[(0, 1), (0, 2)], [(0, 2), None], [(0, 3), None], [(1, 1), (1, 2)], [(1, 2), None], [(1, 3), None]]
161
"""
162
v = self.value
163
vn = v[1].f(i)
164
if vn is None:
165
return None
166
else:
167
return self.parent()(tuple([v[0],vn]))
168
169
def weight(self):
170
r"""
171
Returns the weight of self.
172
173
EXAMPLES::
174
175
sage: C = CrystalOfLetters(['A',2])
176
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
177
sage: b = B( tuple([0,C(2)]) )
178
sage: b
179
(0, 2)
180
sage: b.weight()
181
(0, 1, 0)
182
"""
183
return self.value[1].weight()
184
185
def phi(self, i):
186
r"""
187
EXAMPLES::
188
189
sage: C = CrystalOfLetters(['A',2])
190
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
191
sage: b = B( tuple([0,C(2)]) )
192
sage: b.phi(2)
193
1
194
"""
195
return self.value[1].phi(i)
196
197
def epsilon(self, i):
198
r"""
199
EXAMPLES::
200
201
sage: C = CrystalOfLetters(['A',2])
202
sage: B = DirectSumOfCrystals([C,C], keepkey=True)
203
sage: b = B( tuple([0,C(2)]) )
204
sage: b.epsilon(2)
205
0
206
"""
207
return self.value[1].epsilon(i)
208
209
210