| 1 | r""" |
| 2 | Affine crystals |
| 3 | """ |
| 4 | |
| 5 | #***************************************************************************** |
| 6 | # Copyright (C) 2009 Anne Schilling <anne at math.ucdavis.edu> |
| 7 | # |
| 8 | # Distributed under the terms of the GNU General Public License (GPL) |
| 9 | # |
| 10 | # This code is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | # General Public License for more details. |
| 14 | # |
| 15 | # The full text of the GPL is available at: |
| 16 | # |
| 17 | # http://www.gnu.org/licenses/ |
| 18 | #**************************************************************************** |
| 19 | # Acknowledgment: most of the design and implementation of this |
| 20 | # library is heavily inspired from MuPAD-Combinat. |
| 21 | #**************************************************************************** |
| 22 | |
| 23 | from sage.combinat.combinat import CombinatorialObject |
| 24 | from sage.rings.integer import Integer |
| 25 | from sage.misc.functional import is_even, is_odd |
| 26 | from sage.combinat.crystals.crystals import Crystal, ClassicalCrystal, CrystalElement |
| 27 | from sage.combinat.crystals.affine import AffineCrystal, AffineCrystalFromClassical, AffineCrystalFromClassicalElement |
| 28 | from sage.combinat.crystals.affine import AffineCrystalFromClassicalAndPromotion, AffineCrystalFromClassicalAndPromotionElement |
| 29 | from sage.combinat.root_system.cartan_type import CartanType |
| 30 | from sage.combinat.crystals.tensor_product import CrystalOfTableaux |
| 31 | from sage.combinat.tableau import Tableau_class, Tableau |
| 32 | from sage.combinat.partition import Partition, Partitions |
| 33 | from sage.combinat.integer_vector import IntegerVectors |
| 34 | |
| 35 | |
| 36 | def KirillovReshetikhinCrystal(cartan_type, r, s): |
| 37 | r""" |
| 38 | Returns the Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. |
| 39 | |
| 40 | For more information about general crystals see :mod:`sage.combinat.crystals`. |
| 41 | |
| 42 | Many Kirillov-Reshetikhin crystals are constructed from a |
| 43 | classical crystal together with an automorphism `p` on the level of crystals which |
| 44 | corresponds to a Dynkin diagram automorphism mapping node 0 to some other node i. |
| 45 | The action of `f_0` and `e_0` is then constructed using |
| 46 | `f_0 = p^{-1} \circ f_i \circ p`. |
| 47 | |
| 48 | For example, for type `A_n^{(1)}` the Kirillov-Reshetikhin crystal `B^{r,s}` |
| 49 | is obtained from the classical crystal `B(s\omega_r)` using the |
| 50 | promotion operator. For other types, see |
| 51 | |
| 52 | M. Shimozono |
| 53 | "Affine type A crystal structure on tensor products of rectangles, |
| 54 | Demazure characters, and nilpotent varieties", |
| 55 | J. Algebraic Combin. 15 (2002), no. 2, 151-187 |
| 56 | (arXiv:math.QA/9804039) |
| 57 | |
| 58 | A. Schilling, "Combinatorial structure of Kirillov-Reshetikhin crystals of |
| 59 | type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`", J. Algebra 319 (2008) 2938-2962 |
| 60 | (arXiv:0704.2046 [math.QA]) |
| 61 | |
| 62 | Other Kirillov-Reshetikhin crystals are constructed using similarity methods. |
| 63 | See Section 4 of |
| 64 | |
| 65 | G. Fourier, M. Okado, A. Schilling, |
| 66 | "Kirillov-Reshetikhin crystals for nonexceptional types" |
| 67 | Advances in Math., to appear (arXiv:0810.5067 [math.RT]) |
| 68 | |
| 69 | INPUT: |
| 70 | |
| 71 | - ``cartan_type`` Affine type and rank |
| 72 | |
| 73 | - ``r`` Label of finite Dynkin diagram |
| 74 | |
| 75 | - ``s`` Positive integer |
| 76 | |
| 77 | EXAMPLES:: |
| 78 | |
| 79 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2, 1) |
| 80 | sage: K.index_set() |
| 81 | [0, 1, 2, 3] |
| 82 | sage: K.list() |
| 83 | [[[1], [2]], [[1], [3]], [[2], [3]], [[1], [4]], [[2], [4]], [[3], [4]]] |
| 84 | sage: b=K(rows=[[1],[2]]) |
| 85 | sage: b.weight() |
| 86 | -Lambda[0] + Lambda[2] |
| 87 | |
| 88 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 89 | sage: K.automorphism(K.module_generators[0]) |
| 90 | [[2, 2], [3, 3]] |
| 91 | sage: K.module_generators[0].e(0) |
| 92 | [[1, 2], [2, 4]] |
| 93 | sage: K.module_generators[0].f(2) |
| 94 | [[1, 1], [2, 3]] |
| 95 | sage: K.module_generators[0].f(1) |
| 96 | sage: K.module_generators[0].phi(0) |
| 97 | 0 |
| 98 | sage: K.module_generators[0].phi(1) |
| 99 | 0 |
| 100 | sage: K.module_generators[0].phi(2) |
| 101 | 2 |
| 102 | sage: K.module_generators[0].epsilon(0) |
| 103 | 2 |
| 104 | sage: K.module_generators[0].epsilon(1) |
| 105 | 0 |
| 106 | sage: K.module_generators[0].epsilon(2) |
| 107 | 0 |
| 108 | sage: b = K(rows=[[1,2],[2,3]]) |
| 109 | sage: b |
| 110 | [[1, 2], [2, 3]] |
| 111 | sage: b.f(2) |
| 112 | [[1, 2], [3, 3]] |
| 113 | |
| 114 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 115 | sage: K.cartan_type() |
| 116 | ['D', 4, 1] |
| 117 | sage: type(K.module_generators[0]) |
| 118 | <class 'sage.combinat.crystals.affine.AffineCrystalFromClassicalAndPromotionElement'> |
| 119 | """ |
| 120 | ct = CartanType(cartan_type) |
| 121 | assert ct.is_affine() |
| 122 | if ct.is_untwisted_affine(): |
| 123 | if ct.type() == 'A': |
| 124 | return KR_type_A(ct, r, s) |
| 125 | elif ct.type() == 'D' and r<ct.rank()-2: |
| 126 | return KR_type_vertical(ct, r, s) |
| 127 | elif ct.type() == 'B' and r<ct.rank()-1: |
| 128 | return KR_type_vertical(ct, r, s) |
| 129 | elif ct.type() == 'C' and r<ct.rank()-1: |
| 130 | return KR_type_C(ct, r, s) |
| 131 | else: |
| 132 | raise NotImplementedError |
| 133 | else: |
| 134 | if ct.dual().type() == 'B': |
| 135 | return KR_type_vertical(ct, r, s) |
| 136 | elif ct.type() == 'BC': |
| 137 | return KR_type_box(ct, r, s) |
| 138 | elif ct.dual().type() == 'C' and r<ct.rank()-1: |
| 139 | return KR_type_box(ct, r, s) |
| 140 | else: |
| 141 | raise NotImplementedError |
| 142 | |
| 143 | |
| 144 | class KirillovReshetikhinGenericCrystal(AffineCrystal): |
| 145 | r""" |
| 146 | Generic class for Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. |
| 147 | |
| 148 | Input is a Dynkin node `r`, a positive integer `s`, and a Cartan type `cartan_type`. |
| 149 | """ |
| 150 | def __init__(self, cartan_type, r, s): |
| 151 | r""" |
| 152 | Initializes a generic Kirillov-Reshetikhin crystal. |
| 153 | |
| 154 | TESTS:: |
| 155 | |
| 156 | sage: K = sage.combinat.crystals.kirillov_reshetikhin.KirillovReshetikhinGenericCrystal(['A',2,1], 1, 1) |
| 157 | sage: K |
| 158 | Kirillov-Reshetikhin crystal of type ['A', 2, 1] with (r,s)=(1,1) |
| 159 | sage: K.r() |
| 160 | 1 |
| 161 | sage: K.s() |
| 162 | 1 |
| 163 | """ |
| 164 | self._cartan_type = CartanType(cartan_type) |
| 165 | self._r = r |
| 166 | self._s = s |
| 167 | self._name = "Kirillov-Reshetikhin crystal of type %s with (r,s)=(%d,%d)" % (cartan_type, r, s) |
| 168 | |
| 169 | def r(self): |
| 170 | """ |
| 171 | Returns r of the underlying Kirillov-Reshetikhin crystal `B^{r,s}` |
| 172 | |
| 173 | EXAMPLE:: |
| 174 | |
| 175 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 176 | sage: K.r() |
| 177 | 2 |
| 178 | """ |
| 179 | return self._r |
| 180 | |
| 181 | def s(self): |
| 182 | """ |
| 183 | Returns s of the underlying Kirillov-Reshetikhin crystal `B^{r,s}` |
| 184 | |
| 185 | EXAMPLE:: |
| 186 | |
| 187 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 188 | sage: K.s() |
| 189 | 1 |
| 190 | """ |
| 191 | return self._s |
| 192 | |
| 193 | |
| 194 | class KirillovReshetikhinCrystalFromPromotion(KirillovReshetikhinGenericCrystal, AffineCrystalFromClassicalAndPromotion): |
| 195 | r""" |
| 196 | This generic class assumes that the Kirillov-Reshetikhin crystal is constructed |
| 197 | from a classical crystal 'classical_decomposition' and an automorphism 'promotion' and its inverse |
| 198 | which corresponds to a Dynkin diagram automorphism 'dynkin_diagram_automorphism'. |
| 199 | |
| 200 | Each instance using this class needs to implement the methods: |
| 201 | - classical_decomposition |
| 202 | - promotion |
| 203 | - promotion_inverse |
| 204 | - dynkin_diagram_automorphism |
| 205 | """ |
| 206 | def __init__(self, cartan_type, r, s): |
| 207 | r""" |
| 208 | TESTS:: |
| 209 | |
| 210 | sage: K = KirillovReshetikhinCrystal(['B',2,1], 1, 1) |
| 211 | sage: K |
| 212 | Kirillov-Reshetikhin crystal of type ['B', 2, 1] with (r,s)=(1,1) |
| 213 | """ |
| 214 | KirillovReshetikhinGenericCrystal.__init__(self, cartan_type, r ,s) |
| 215 | AffineCrystalFromClassicalAndPromotion.__init__(self, cartan_type, self.classical_decomposition(), |
| 216 | self.promotion(), self.promotion_inverse(), |
| 217 | self.dynkin_diagram_automorphism(0)) |
| 218 | |
| 219 | |
| 220 | class KR_type_A(KirillovReshetikhinCrystalFromPromotion): |
| 221 | r""" |
| 222 | Class of Kirillov-Reshetikhin crystals of type `A_n^{(1)}`. |
| 223 | |
| 224 | EXAMPLES:: |
| 225 | |
| 226 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 227 | sage: b = K(rows=[[1,2],[2,4]]) |
| 228 | sage: b.f(0) |
| 229 | [[1, 1], [2, 2]] |
| 230 | """ |
| 231 | |
| 232 | def classical_decomposition(self): |
| 233 | """ |
| 234 | Specifies the classical crystal underlying the KR crystal of type A. |
| 235 | |
| 236 | EXAMPLES:: |
| 237 | |
| 238 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 239 | sage: K.classical_decomposition() |
| 240 | The crystal of tableaux of type ['A', 3] and shape(s) ([2, 2],) |
| 241 | """ |
| 242 | return CrystalOfTableaux(self.cartan_type().classical(), shape = [self.s() for i in range(1,self.r()+1)]) |
| 243 | |
| 244 | def promotion(self): |
| 245 | """ |
| 246 | Specifies the promotion operator used to construct the affine type A crystal. |
| 247 | For type A this corresponds to the Dynkin diagram automorphism which maps i to i+1 mod n+1, |
| 248 | where n is the rank. |
| 249 | |
| 250 | EXAMPLES: |
| 251 | |
| 252 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 253 | sage: b = K.classical_decomposition()(rows=[[1,2],[3,4]]) |
| 254 | sage: K.promotion()(b) |
| 255 | [[1, 3], [2, 4]] |
| 256 | """ |
| 257 | return lambda x : self.classical_crystal(x.to_tableau().promotion(self._cartan_type[1])) |
| 258 | |
| 259 | def promotion_inverse(self): |
| 260 | """ |
| 261 | Specifies the inverse promotion operator used to construct the affine type A crystal. |
| 262 | For type A this corresponds to the Dynkin diagram automorphism which maps i to i-1 mod n+1, |
| 263 | where n is the rank. |
| 264 | |
| 265 | EXAMPLES: |
| 266 | |
| 267 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 268 | sage: b = K.classical_decomposition()(rows=[[1,3],[2,4]]) |
| 269 | sage: K.promotion_inverse()(b) |
| 270 | [[1, 2], [3, 4]] |
| 271 | sage: b = K.classical_decomposition()(rows=[[1,2],[3,3]]) |
| 272 | sage: K.promotion_inverse()(K.promotion()(b)) |
| 273 | [[1, 2], [3, 3]] |
| 274 | """ |
| 275 | return lambda x : self.classical_crystal(x.to_tableau().promotion_inverse(self._cartan_type[1])) |
| 276 | |
| 277 | def dynkin_diagram_automorphism(self, i): |
| 278 | """ |
| 279 | Specifies the Dynkin diagram automorphism underlying the promotion action on the crystal |
| 280 | elements. The automorphism needs to map node 0 to some other Dynkin node. |
| 281 | |
| 282 | For type A we use the Dynkin diagram automorphism which maps i to i+1 mod n+1, where n is the rank. |
| 283 | |
| 284 | EXAMPLES:: |
| 285 | |
| 286 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 287 | sage: K.dynkin_diagram_automorphism(0) |
| 288 | 1 |
| 289 | sage: K.dynkin_diagram_automorphism(3) |
| 290 | 0 |
| 291 | """ |
| 292 | aut = range(1,self.cartan_type().rank())+[0] |
| 293 | return aut[i] |
| 294 | |
| 295 | class KR_type_vertical(KirillovReshetikhinCrystalFromPromotion): |
| 296 | r""" |
| 297 | Class of Kirillov-Reshetikhin crystals `B^{r,s}` of type `D_n^{(1)}` for `r\le n-2`, |
| 298 | `B_n^{(1)}` for `r<n`, and `A_{2n-1}^{(2)}` for `r\le n`. |
| 299 | |
| 300 | EXAMPLES:: |
| 301 | |
| 302 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 303 | sage: b = K(rows=[]) |
| 304 | sage: b.f(0) |
| 305 | [[1], [2]] |
| 306 | sage: b.f(0).f(0) |
| 307 | [[1, 1], [2, 2]] |
| 308 | sage: b.e(0) |
| 309 | [[-2], [-1]] |
| 310 | sage: b.e(0).e(0) |
| 311 | [[-2, -2], [-1, -1]] |
| 312 | |
| 313 | sage: K = KirillovReshetikhinCrystal(['B',3,1], 1,1) |
| 314 | sage: [[b,b.f(0)] for b in K] |
| 315 | [[[[1]], None], [[[2]], None], [[[3]], None], [[[0]], None], [[[-3]], None], [[[-2]], [[1]]], [[[-1]], [[2]]]] |
| 316 | |
| 317 | sage: K = KirillovReshetikhinCrystal(['A',5,2], 1,1) |
| 318 | sage: [[b,b.f(0)] for b in K] |
| 319 | [[[[1]], None], [[[2]], None], [[[3]], None], [[[-3]], None], [[[-2]], [[1]]], [[[-1]], [[2]]]] |
| 320 | """ |
| 321 | |
| 322 | def classical_decomposition(self): |
| 323 | r""" |
| 324 | Specifies the classical crystal underlying the Kirillov-Reshetikhin crystal of type `D_n^{(1)}`, |
| 325 | `B_n^{(1)}`, and `A_{2n-1}^{(2)}`. |
| 326 | It is given by `B^{r,s} \cong \oplus_\Lambda B(\Lambda)` where `\Lambda` are weights obtained from |
| 327 | a rectangle of width s and height r by removing verticle dominoes. Here we identify the fundamental |
| 328 | weight `\Lambda_i` with a column of height `i`. |
| 329 | |
| 330 | EXAMPLES:: |
| 331 | |
| 332 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 333 | sage: K.classical_decomposition() |
| 334 | The crystal of tableaux of type ['D', 4] and shape(s) [[], [1, 1], [2, 2]] |
| 335 | """ |
| 336 | return CrystalOfTableaux(self.cartan_type().classical(), |
| 337 | shapes = vertical_dominoes_removed(self.r(),self.s())) |
| 338 | |
| 339 | def promotion(self): |
| 340 | """ |
| 341 | Specifies the promotion operator used to construct the affine type `D_n^{(1)}` etc. crystal. |
| 342 | This corresponds to the Dynkin diagram automorphism which interchanges nodes 0 and 1, |
| 343 | and leaves all other nodes unchanged. On the level of crystals it is constructed using |
| 344 | `\pm` diagrams. |
| 345 | |
| 346 | EXAMPLES: |
| 347 | |
| 348 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 349 | sage: promotion = K.promotion() |
| 350 | sage: b = K.classical_decomposition()(rows=[]) |
| 351 | sage: promotion(b) |
| 352 | [[1, 2], [-2, -1]] |
| 353 | sage: b = K.classical_decomposition()(rows=[[1,3],[2,-1]]) |
| 354 | sage: promotion(b) |
| 355 | [[1, 3], [2, -1]] |
| 356 | sage: b = K.classical_decomposition()(rows=[[1],[-3]]) |
| 357 | sage: promotion(b) |
| 358 | [[2, -3], [-2, -1]] |
| 359 | """ |
| 360 | T = self.classical_decomposition() |
| 361 | ind = T.index_set() |
| 362 | ind.remove(1) |
| 363 | return T.crystal_morphism( self.promotion_on_highest_weight_vectors(), index_set = ind) |
| 364 | |
| 365 | promotion_inverse = promotion |
| 366 | |
| 367 | def dynkin_diagram_automorphism(self, i): |
| 368 | """ |
| 369 | Specifies the Dynkin diagram automorphism underlying the promotion action on the crystal |
| 370 | elements. The automorphism needs to map node 0 to some other Dynkin node. |
| 371 | |
| 372 | Here we use the Dynkin diagram automorphism which interchanges nodes 0 and 1 and leaves |
| 373 | all other nodes unchanged. |
| 374 | |
| 375 | EXAMPLES:: |
| 376 | |
| 377 | sage: K = KirillovReshetikhinCrystal(['D',4,1],1,1) |
| 378 | sage: K.dynkin_diagram_automorphism(0) |
| 379 | 1 |
| 380 | sage: K.dynkin_diagram_automorphism(1) |
| 381 | 0 |
| 382 | sage: K.dynkin_diagram_automorphism(4) |
| 383 | 4 |
| 384 | """ |
| 385 | aut = [1,0]+range(2,self.cartan_type().rank()) |
| 386 | return aut[i] |
| 387 | |
| 388 | def promotion_on_highest_weight_vectors(self): |
| 389 | """ |
| 390 | Calculates promotion on `{2,3,...,n}` highest weight vectors. |
| 391 | |
| 392 | EXAMPLES:: |
| 393 | |
| 394 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 395 | sage: T = K.classical_decomposition() |
| 396 | sage: hw = [ b for b in T if all(b.epsilon(i)==0 for i in [2,3,4]) ] |
| 397 | sage: [K.promotion_on_highest_weight_vectors()(b) for b in hw] |
| 398 | [[[1, 2], [-2, -1]], [[2, 2], [-2, -1]], [[1, 2], [3, -1]], [[2], [-2]], |
| 399 | [[1, 2], [2, -2]], [[2, 2], [-1, -1]], [[2, 2], [3, -1]], [[2, 2], [3, 3]], |
| 400 | [], [[1], [2]], [[1, 1], [2, 2]], [[2], [-1]], [[1, 2], [2, -1]], [[2], [3]], |
| 401 | [[1, 2], [2, 3]]] |
| 402 | """ |
| 403 | return lambda b: self.from_pm_diagram_to_highest_weight_vector(self.from_highest_weight_vector_to_pm_diagram(b).sigma()) |
| 404 | |
| 405 | def from_highest_weight_vector_to_pm_diagram(self, b): |
| 406 | """ |
| 407 | This gives the bijection between an element b in the classical decomposition |
| 408 | of the KR crystal that is `{2,3,..,n}`-highest weight and `\pm` diagrams. |
| 409 | |
| 410 | EXAMPLES:: |
| 411 | |
| 412 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 413 | sage: T = K.classical_decomposition() |
| 414 | sage: b = T(rows=[[2],[-2]]) |
| 415 | sage: pm = K.from_highest_weight_vector_to_pm_diagram(b); pm |
| 416 | [[1, 1], [0, 0], [0]] |
| 417 | sage: pm.__repr__(pretty_printing=True) |
| 418 | + |
| 419 | - |
| 420 | sage: b = T(rows=[]) |
| 421 | sage: pm=K.from_highest_weight_vector_to_pm_diagram(b); pm |
| 422 | [[0, 2], [0, 0], [0]] |
| 423 | sage: pm.__repr__(pretty_printing=True) |
| 424 | |
| 425 | sage: hw = [ b for b in T if all(b.epsilon(i)==0 for i in [2,3,4]) ] |
| 426 | sage: all(K.from_pm_diagram_to_highest_weight_vector(K.from_highest_weight_vector_to_pm_diagram(b)) == b for b in hw) |
| 427 | True |
| 428 | """ |
| 429 | n = self.cartan_type().rank()-1 |
| 430 | inner = Partition([Integer(b.weight()[i]) for i in range(1,n+1)]) |
| 431 | inter = Partition([len([i for i in r if i>0]) for r in b.to_tableau()]) |
| 432 | outer = b.to_tableau().shape() |
| 433 | return PMDiagram([self.r(), self.s(), outer, inter, inner], from_shapes=True) |
| 434 | |
| 435 | def from_pm_diagram_to_highest_weight_vector(self, pm): |
| 436 | """ |
| 437 | This gives the bijection between a `\pm` diagram and an element b in the classical |
| 438 | decomposition of the KR crystal that is {2,3,..,n}-highest weight. |
| 439 | |
| 440 | EXAMPLES:: |
| 441 | |
| 442 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 443 | sage: pm = sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1, 1], [0, 0], [0]]) |
| 444 | sage: K.from_pm_diagram_to_highest_weight_vector(pm) |
| 445 | [[2], [-2]] |
| 446 | """ |
| 447 | u = [b for b in self.classical_decomposition().module_generators if b.to_tableau().shape() == pm.outer_shape()][0] |
| 448 | ct = self.cartan_type() |
| 449 | rank = ct.rank()-1 |
| 450 | ct_type = ct.classical().type() |
| 451 | assert ct_type in ['B', 'C', 'D'] |
| 452 | list = [] |
| 453 | for h in pm.heights_of_addable_plus(): |
| 454 | list += range(1,h+1) |
| 455 | for h in pm.heights_of_minus(): |
| 456 | if ct_type == 'D': |
| 457 | list += range(1,rank+1)+[rank-2-k for k in range(rank-1-h)] |
| 458 | elif ct_type == 'B': |
| 459 | list += range(1,rank+1)+[rank-k for k in range(rank+1-h)] |
| 460 | else: |
| 461 | list += range(1,rank+1)+[rank-1-k for k in range(rank-h)] |
| 462 | for i in reversed(list): |
| 463 | u = u.f(i) |
| 464 | return u |
| 465 | |
| 466 | |
| 467 | class KR_type_C(KirillovReshetikhinGenericCrystal, AffineCrystalFromClassical): |
| 468 | r""" |
| 469 | Class of Kirillov-Reshetikhin crystals `B^{r,s}` of type `C_n^{(1)}` for `r<n`. |
| 470 | |
| 471 | EXAMPLES:: |
| 472 | |
| 473 | sage: K = KirillovReshetikhinCrystal(['C',2,1], 1,2) |
| 474 | sage: K |
| 475 | Kirillov-Reshetikhin crystal of type ['C', 2, 1] with (r,s)=(1,2) |
| 476 | sage: b = K(rows=[]) |
| 477 | sage: b.f(0) |
| 478 | [[1, 1]] |
| 479 | sage: b.e(0) |
| 480 | [[-1, -1]] |
| 481 | """ |
| 482 | def __init__(self, cartan_type, r, s): |
| 483 | r""" |
| 484 | Initializes a Kirillov-Reshetikhin crystal of type `C_n^{(1)}`. |
| 485 | |
| 486 | TESTS:: |
| 487 | |
| 488 | sage: K = sage.combinat.crystals.kirillov_reshetikhin.KR_type_C(['C',2,1], 1, 1) |
| 489 | sage: K |
| 490 | Kirillov-Reshetikhin crystal of type ['C', 2, 1] with (r,s)=(1,1) |
| 491 | """ |
| 492 | KirillovReshetikhinGenericCrystal.__init__(self, cartan_type, r ,s) |
| 493 | AffineCrystalFromClassical.__init__(self, cartan_type, self.classical_decomposition()) |
| 494 | |
| 495 | def classical_decomposition(self): |
| 496 | """ |
| 497 | Specifies the classical crystal underlying the Kirillov-Reshetikhin crystal of type `C_n^{(1)}`. |
| 498 | It is given by `B^{r,s} \cong \oplus_\Lambda B(\Lambda)` where `\Lambda` are weights obtained from |
| 499 | a rectangle of width s and height r by removing horizontal dominoes. Here we identify the fundamental |
| 500 | weight `\Lambda_i` with a column of height `i`. |
| 501 | |
| 502 | EXAMPLES:: |
| 503 | |
| 504 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 505 | sage: K.classical_decomposition() |
| 506 | The crystal of tableaux of type ['C', 3] and shape(s) [[], [2], [2, 2]] |
| 507 | """ |
| 508 | return CrystalOfTableaux(self.cartan_type().classical(), |
| 509 | shapes = horizontal_dominoes_removed(self.r(),self.s())) |
| 510 | |
| 511 | def ambient_crystal(self): |
| 512 | r""" |
| 513 | Returns the ambient crystal `'B^{r,s}` of type `A_{2n+1}^{(2)}` associated to the Kirillov-Reshetikhin |
| 514 | crystal of type `C_n^{(1)}`. This ambient crystal is used to construct the zero arrows. |
| 515 | |
| 516 | EXAMPLES:: |
| 517 | |
| 518 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,3) |
| 519 | sage: K.ambient_crystal() |
| 520 | Kirillov-Reshetikhin crystal of type ['B', 4, 1]^* with (r,s)=(2,3) |
| 521 | """ |
| 522 | return KirillovReshetikhinCrystal(['A',2*self.cartan_type().classical().rank()+1,2], self.r(), self.s()) |
| 523 | |
| 524 | def ambient_dict_pm_diagrams(self): |
| 525 | r""" |
| 526 | Gives a dictionary of all self-dual `\pm` diagrams for the ambient crystal. |
| 527 | Their key is their inner shape. |
| 528 | |
| 529 | EXAMPLES:: |
| 530 | |
| 531 | sage: K = KirillovReshetikhinCrystal(['C',2,1], 1,2) |
| 532 | sage: K.ambient_dict_pm_diagrams() |
| 533 | {[]: [[1, 1], [0]], [2]: [[0, 0], [2]]} |
| 534 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 535 | sage: K.ambient_dict_pm_diagrams() |
| 536 | {[2, 2]: [[0, 0], [0, 0], [2]], []: [[1, 1], [0, 0], [0]], [2]: [[0, 0], [1, 1], [0]]} |
| 537 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,3) |
| 538 | sage: K.ambient_dict_pm_diagrams() |
| 539 | {[3, 3]: [[0, 0], [0, 0], [3]], [3, 1]: [[0, 0], [1, 1], [1]], [1, 1]: [[1, 1], [0, 0], [1]]} |
| 540 | """ |
| 541 | list = [] |
| 542 | s = self.s() |
| 543 | r = self.r() |
| 544 | m = int(s/2) |
| 545 | for i in range(m+1): |
| 546 | for la in IntegerVectors(m-i, min_length=r, max_length=r): |
| 547 | list.append(PMDiagram([[j,j] for j in la]+[[s-2*m+2*i]])) |
| 548 | return dict( (x.inner_shape(), x) for x in list ) |
| 549 | |
| 550 | def ambient_highest_weight_dict(self): |
| 551 | r""" |
| 552 | Gives a dictionary of all `{2,...,n+1}`-highest weight vectors in the ambient crystal. |
| 553 | Their key is the inner shape of their corresponding `\pm` diagram, or equivalently, their |
| 554 | `{2,...,n+1}` weight. |
| 555 | |
| 556 | EXAMPLES:: |
| 557 | |
| 558 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 559 | sage: K.ambient_highest_weight_dict() |
| 560 | {[]: [[2], [-2]], [2, 2]: [[2, 2], [3, 3]], [2]: [[1, 2], [2, -1]]} |
| 561 | """ |
| 562 | A = self.ambient_dict_pm_diagrams() |
| 563 | ambient = self.ambient_crystal() |
| 564 | return dict( (key, ambient.retract(ambient.from_pm_diagram_to_highest_weight_vector(A[key]))) for key in A ) |
| 565 | |
| 566 | def highest_weight_dict(self): |
| 567 | r""" |
| 568 | Gives a dictionary of the classical highest weight vectors of self. |
| 569 | Their key is their shape. |
| 570 | |
| 571 | EXAMPLES:: |
| 572 | |
| 573 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 574 | sage: K.highest_weight_dict() |
| 575 | {[2, 2]: [[1, 1], [2, 2]], []: [], [2]: [[1, 1]]} |
| 576 | """ |
| 577 | return dict( (x.lift().to_tableau().shape(),x) for x in self.module_generators ) |
| 578 | |
| 579 | def to_ambient_crystal(self): |
| 580 | r""" |
| 581 | Provides a map from the Kirillov-Reshetikhin crystal of type `C_n^{(1)}` to the |
| 582 | ambient crystal of type `A_{2n+1}^{(2)}`. |
| 583 | |
| 584 | EXAMPLES:: |
| 585 | |
| 586 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 587 | sage: b=K(rows=[[1,1]]) |
| 588 | sage: K.to_ambient_crystal()(b) |
| 589 | [[1, 2], [2, -1]] |
| 590 | sage: b=K(rows=[]) |
| 591 | sage: K.to_ambient_crystal()(b) |
| 592 | [[2], [-2]] |
| 593 | sage: type(K.to_ambient_crystal()(b)) |
| 594 | <class 'sage.combinat.crystals.affine.AffineCrystalFromClassicalAndPromotionElement'> |
| 595 | """ |
| 596 | keys = self.highest_weight_dict().keys() |
| 597 | pdict = dict( (self.highest_weight_dict()[key], self.ambient_highest_weight_dict()[key]) for key in keys ) |
| 598 | return self.crystal_morphism( pdict, index_set = self.cartan_type().classical().index_set(), |
| 599 | automorphism = lambda i : i+1 ) |
| 600 | |
| 601 | def from_ambient_crystal(self): |
| 602 | r""" |
| 603 | Provides a map from the ambient crystal of type `A_{2n+1}^{(2)}` to the Kirillov-Reshetikhin crystal of |
| 604 | type `C_n^{(1)}`. Note that this map is only well-defined on elements that are in the image |
| 605 | type `C_n^{(1)}` elements under `to_ambient_crystal`. |
| 606 | |
| 607 | EXAMPLES:: |
| 608 | |
| 609 | sage: K = KirillovReshetikhinCrystal(['C',3,1], 2,2) |
| 610 | sage: b=K.ambient_crystal()(rows=[[2,2],[3,3]]) |
| 611 | sage: K.from_ambient_crystal()(b) |
| 612 | [[1, 1], [2, 2]] |
| 613 | """ |
| 614 | keys = self.highest_weight_dict().keys() |
| 615 | pdict_inv = dict( (self.ambient_highest_weight_dict()[key], self.highest_weight_dict()[key]) for key in keys ) |
| 616 | return self.crystal_morphism( pdict_inv, index_set = [j+1 for j in self.cartan_type().classical().index_set()], |
| 617 | automorphism = lambda i : i-1 ) |
| 618 | |
| 619 | class KR_type_CElement(AffineCrystalFromClassicalElement): |
| 620 | r""" |
| 621 | Class for the elements in the Kirillov-Reshetikhin crystals `B^{r,s}` of type `C_n^{(1)}` for `r<n`. |
| 622 | |
| 623 | EXAMPLES:: |
| 624 | |
| 625 | sage: K=KirillovReshetikhinCrystal(['C',3,1],1,2) |
| 626 | sage: type(K.module_generators[0]) |
| 627 | <class 'sage.combinat.crystals.kirillov_reshetikhin.KR_type_CElement'> |
| 628 | """ |
| 629 | |
| 630 | def e0(self): |
| 631 | r""" |
| 632 | Gives `e_0` on self by mapping self to the ambient crystal, calculating `e_1 e_0` there and |
| 633 | pulling the element back. |
| 634 | |
| 635 | EXAMPLES:: |
| 636 | |
| 637 | sage: K=KirillovReshetikhinCrystal(['C',3,1],1,2) |
| 638 | sage: b = K(rows=[]) |
| 639 | sage: b.e(0) |
| 640 | [[-1, -1]] |
| 641 | """ |
| 642 | b = self.parent().to_ambient_crystal()(self).e(1) |
| 643 | if b is None: |
| 644 | return None |
| 645 | b = b.e(0) |
| 646 | return self.parent().from_ambient_crystal()(b) |
| 647 | |
| 648 | def f0(self): |
| 649 | r""" |
| 650 | Gives `f_0` on self by mapping self to the ambient crystal, calculating `f_1 f_0` there and |
| 651 | pulling the element back. |
| 652 | |
| 653 | EXAMPLES:: |
| 654 | |
| 655 | sage: K=KirillovReshetikhinCrystal(['C',3,1],1,2) |
| 656 | sage: b = K(rows=[]) |
| 657 | sage: b.f(0) |
| 658 | [[1, 1]] |
| 659 | """ |
| 660 | b = self.parent().to_ambient_crystal()(self).f(1) |
| 661 | if b is None: |
| 662 | return None |
| 663 | b = b.f(0) |
| 664 | return self.parent().from_ambient_crystal()(b) |
| 665 | |
| 666 | def epsilon0(self): |
| 667 | r""" |
| 668 | Calculates `\epsilon_0` of self by mapping the element to the ambient crystal |
| 669 | and calculating `\epsilon_1` there. |
| 670 | |
| 671 | EXAMPLES:: |
| 672 | |
| 673 | sage: K = KirillovReshetikhinCrystal(['C',2,1], 1,2) |
| 674 | sage: b=K(rows=[[1,1]]) |
| 675 | sage: b.epsilon(0) |
| 676 | 2 |
| 677 | """ |
| 678 | b = self.parent().to_ambient_crystal()(self) |
| 679 | return b.epsilon(1) |
| 680 | |
| 681 | def phi0(self): |
| 682 | r""" |
| 683 | Calculates `\phi_0` of self by mapping the element to the ambient crystal |
| 684 | and calculating `\phi_1` there. |
| 685 | |
| 686 | EXAMPLES:: |
| 687 | |
| 688 | sage: K = KirillovReshetikhinCrystal(['C',2,1], 1,2) |
| 689 | sage: b=K(rows=[[-1,-1]]) |
| 690 | sage: b.phi(0) |
| 691 | 2 |
| 692 | """ |
| 693 | b = self.parent().to_ambient_crystal()(self) |
| 694 | return b.phi(1) |
| 695 | |
| 696 | KR_type_C.element_class = KR_type_CElement |
| 697 | |
| 698 | |
| 699 | class KR_type_box(KirillovReshetikhinGenericCrystal, AffineCrystalFromClassical): |
| 700 | r""" |
| 701 | Class of Kirillov-Reshetikhin crystals `B^{r,s}` of type `A_{2n}^{(2)}` for `r\le n` |
| 702 | and type `D_{n+1}^{(2)}` for `r<n'. |
| 703 | |
| 704 | EXAMPLES:: |
| 705 | |
| 706 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 1,1) |
| 707 | sage: K |
| 708 | Kirillov-Reshetikhin crystal of type ['BC', 2, 2] with (r,s)=(1,1) |
| 709 | sage: b = K(rows=[]) |
| 710 | sage: b.f(0) |
| 711 | [[1]] |
| 712 | sage: b.e(0) |
| 713 | [[-1]] |
| 714 | """ |
| 715 | def __init__(self, cartan_type, r, s): |
| 716 | r""" |
| 717 | Initializes a Kirillov-Reshetikhin crystal self. |
| 718 | |
| 719 | TESTS:: |
| 720 | |
| 721 | sage: K = sage.combinat.crystals.kirillov_reshetikhin.KR_type_box(['A',4,2], 1, 1) |
| 722 | sage: K |
| 723 | Kirillov-Reshetikhin crystal of type ['BC', 2, 2] with (r,s)=(1,1) |
| 724 | sage: K = sage.combinat.crystals.kirillov_reshetikhin.KR_type_box(['D',4,2], 1, 1) |
| 725 | sage: K |
| 726 | Kirillov-Reshetikhin crystal of type ['C', 3, 1]^* with (r,s)=(1,1) |
| 727 | """ |
| 728 | KirillovReshetikhinGenericCrystal.__init__(self, cartan_type, r ,s) |
| 729 | AffineCrystalFromClassical.__init__(self, cartan_type, self.classical_decomposition()) |
| 730 | |
| 731 | def classical_decomposition(self): |
| 732 | r""" |
| 733 | Specifies the classical crystal underlying the Kirillov-Reshetikhin crystal of type `A_{2n}^{(2)}` |
| 734 | and `D_{n+1}^{(2)}`. |
| 735 | It is given by `B^{r,s} \cong \oplus_\Lambda B(\Lambda)` where `\Lambda` are weights obtained from |
| 736 | a rectangle of width s and height r by removing boxes. Here we identify the fundamental |
| 737 | weight `\Lambda_i` with a column of height `i`. |
| 738 | |
| 739 | EXAMPLES:: |
| 740 | |
| 741 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 2,2) |
| 742 | sage: K.classical_decomposition() |
| 743 | The crystal of tableaux of type ['C', 2] and shape(s) [[], [1], [2], [1, 1], [2, 1], [2, 2]] |
| 744 | sage: K = KirillovReshetikhinCrystal(['D',4,2], 2,3) |
| 745 | sage: K.classical_decomposition() |
| 746 | The crystal of tableaux of type ['B', 3] and shape(s) [[], [1], [2], [1, 1], [3], [2, 1], [3, 1], [2, 2], [3, 2], [3, 3]] |
| 747 | """ |
| 748 | return CrystalOfTableaux(self.cartan_type().classical(), |
| 749 | shapes = partitions_in_box(self.r(),self.s())) |
| 750 | |
| 751 | def ambient_crystal(self): |
| 752 | r""" |
| 753 | Returns the ambient crystal `'B^{r,2s}` of type `C_n^{(1)}` associated to the Kirillov-Reshetikhin. |
| 754 | This ambient crystal is used to construct the zero arrows. |
| 755 | |
| 756 | EXAMPLES:: |
| 757 | |
| 758 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 2,2) |
| 759 | sage: K.ambient_crystal() |
| 760 | Kirillov-Reshetikhin crystal of type ['C', 2, 1] with (r,s)=(2,4) |
| 761 | """ |
| 762 | # calling KR_type_C instead of KirillovReshetikhin(['C',n,1],r,s) has the advantage that |
| 763 | # that this also works for r=n for A_{2n}^{(2)}. |
| 764 | return KR_type_C(['C', self.cartan_type().classical().rank(),1], self.r(), 2*self.s()) |
| 765 | |
| 766 | def highest_weight_dict(self): |
| 767 | r""" |
| 768 | Gives a dictionary of the classical highest weight vectors of self. |
| 769 | Their key is 2 times their shape. |
| 770 | |
| 771 | EXAMPLES:: |
| 772 | |
| 773 | sage: K = KirillovReshetikhinCrystal(['A',6,2], 2,2) |
| 774 | sage: K.highest_weight_dict() |
| 775 | {[4, 2]: [[1, 1], [2]], [2, 2]: [[1], [2]], []: [], [4]: [[1, 1]], [4, 4]: [[1, 1], [2, 2]], [2]: [[1]]} |
| 776 | """ |
| 777 | return dict( (Partition([2*i for i in x.lift().to_tableau().shape()]),x) for x in self.module_generators ) |
| 778 | |
| 779 | def ambient_highest_weight_dict(self): |
| 780 | r""" |
| 781 | Gives a dictionary of the classical highest weight vectors of the ambient crystal of self. |
| 782 | Their key is their shape. |
| 783 | |
| 784 | EXAMPLES:: |
| 785 | |
| 786 | sage: K = KirillovReshetikhinCrystal(['A',6,2], 2,2) |
| 787 | sage: K.ambient_highest_weight_dict() |
| 788 | {[4, 2]: [[1, 1, 1, 1], [2, 2]], [2, 2]: [[1, 1], [2, 2]], []: [], [4]: [[1, 1, 1, 1]], [4, 4]: [[1, 1, 1, 1], [2, 2, 2, 2]], |
| 789 | [2]: [[1, 1]]} |
| 790 | """ |
| 791 | return dict( (x.lift().to_tableau().shape(),x) for x in self.ambient_crystal().module_generators ) |
| 792 | |
| 793 | def similarity_factor(self): |
| 794 | r""" |
| 795 | Sets the similarity factor used to map to the ambient crystal. |
| 796 | |
| 797 | EXAMPLES:: |
| 798 | |
| 799 | sage: K = KirillovReshetikhinCrystal(['A',6,2], 2,2) |
| 800 | sage: K.similarity_factor() |
| 801 | {1: 2, 2: 2, 3: 2} |
| 802 | sage: K = KirillovReshetikhinCrystal(['D',5,2], 1,1) |
| 803 | sage: K.similarity_factor() |
| 804 | {1: 2, 2: 2, 3: 2, 4: 1} |
| 805 | """ |
| 806 | C = self.cartan_type().classical() |
| 807 | p = dict( (i,2) for i in C.index_set() ) |
| 808 | if C.type() == 'B': |
| 809 | p[C.rank()] = 1 |
| 810 | return p |
| 811 | |
| 812 | def to_ambient_crystal(self): |
| 813 | r""" |
| 814 | Provides a map from self to the ambient crystal of type `C_n^{(1)}`. |
| 815 | |
| 816 | EXAMPLES:: |
| 817 | |
| 818 | sage: K = KirillovReshetikhinCrystal(['D',4,2], 1,1) |
| 819 | sage: [K.to_ambient_crystal()(b) for b in K] |
| 820 | [[], [[1, 1]], [[2, 2]], [[3, 3]], [[3, -3]], [[-3, -3]], [[-2, -2]], [[-1, -1]]] |
| 821 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 1,1) |
| 822 | sage: [K.to_ambient_crystal()(b) for b in K] |
| 823 | [[], [[1, 1]], [[2, 2]], [[-2, -2]], [[-1, -1]]] |
| 824 | """ |
| 825 | keys = self.highest_weight_dict().keys() |
| 826 | pdict = dict( (self.highest_weight_dict()[key], self.ambient_highest_weight_dict()[key]) for key in keys ) |
| 827 | return self.crystal_morphism( pdict, index_set = self.cartan_type().classical().index_set(), |
| 828 | similarity_factor = self.similarity_factor() ) |
| 829 | |
| 830 | def from_ambient_crystal(self): |
| 831 | r""" |
| 832 | Provides a map from the ambient crystal of type `C_n^{(1)}` to the Kirillov-Reshetikhin crystal self. |
| 833 | Note that this map is only well-defined on elements that are in the image under `to_ambient_crystal`. |
| 834 | |
| 835 | EXAMPLES:: |
| 836 | |
| 837 | sage: K = KirillovReshetikhinCrystal(['D',4,2], 1,1) |
| 838 | sage: b = K.ambient_crystal()(rows=[[3,-3]]) |
| 839 | sage: K.from_ambient_crystal()(b) |
| 840 | [[0]] |
| 841 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 1,1) |
| 842 | sage: b = K.ambient_crystal()(rows=[]) |
| 843 | sage: K.from_ambient_crystal()(b) |
| 844 | [] |
| 845 | """ |
| 846 | keys = self.highest_weight_dict().keys() |
| 847 | pdict_inv = dict( (self.ambient_highest_weight_dict()[key], self.highest_weight_dict()[key]) for key in keys ) |
| 848 | return self.crystal_morphism( pdict_inv, index_set = self.cartan_type().classical().index_set(), |
| 849 | similarity_factor_domain = self.similarity_factor() ) |
| 850 | |
| 851 | |
| 852 | class KR_type_boxElement(AffineCrystalFromClassicalElement): |
| 853 | r""" |
| 854 | Class for the elements in the Kirillov-Reshetikhin crystals `B^{r,s}` of type `A_{2n}^{(2)}` for `r\le n` |
| 855 | and type `D_{n+1}^{(2)}` for `r<n`. |
| 856 | |
| 857 | EXAMPLES:: |
| 858 | |
| 859 | sage: K=KirillovReshetikhinCrystal(['A',4,2],1,2) |
| 860 | sage: type(K.module_generators[0]) |
| 861 | <class 'sage.combinat.crystals.kirillov_reshetikhin.KR_type_boxElement'> |
| 862 | """ |
| 863 | |
| 864 | def e0(self): |
| 865 | r""" |
| 866 | Gives `e_0` on self by mapping self to the ambient crystal, calculating `e_0` there and |
| 867 | pulling the element back. |
| 868 | |
| 869 | EXAMPLES:: |
| 870 | |
| 871 | sage: K=KirillovReshetikhinCrystal(['A',4,2],1,1) |
| 872 | sage: b = K(rows=[]) |
| 873 | sage: b.e(0) |
| 874 | [[-1]] |
| 875 | """ |
| 876 | b = self.parent().to_ambient_crystal()(self).e(0) |
| 877 | if b is None: |
| 878 | return None |
| 879 | return self.parent().from_ambient_crystal()(b) |
| 880 | |
| 881 | def f0(self): |
| 882 | r""" |
| 883 | Gives `f_0` on self by mapping self to the ambient crystal, calculating `f_0` there and |
| 884 | pulling the element back. |
| 885 | |
| 886 | EXAMPLES:: |
| 887 | |
| 888 | sage: K=KirillovReshetikhinCrystal(['A',4,2],1,1) |
| 889 | sage: b = K(rows=[]) |
| 890 | sage: b.f(0) |
| 891 | [[1]] |
| 892 | """ |
| 893 | b = self.parent().to_ambient_crystal()(self).f(0) |
| 894 | if b is None: |
| 895 | return None |
| 896 | return self.parent().from_ambient_crystal()(b) |
| 897 | |
| 898 | def epsilon0(self): |
| 899 | r""" |
| 900 | Calculates `\epsilon_0` of self by mapping the element to the ambient crystal |
| 901 | and calculating `\epsilon_0` there. |
| 902 | |
| 903 | EXAMPLES:: |
| 904 | |
| 905 | sage: K = KirillovReshetikhinCrystal(['A',4,2], 1,1) |
| 906 | sage: b=K(rows=[[1]]) |
| 907 | sage: b.epsilon(0) |
| 908 | 2 |
| 909 | """ |
| 910 | b = self.parent().to_ambient_crystal()(self) |
| 911 | return b.epsilon(0) |
| 912 | |
| 913 | def phi0(self): |
| 914 | r""" |
| 915 | Calculates `\phi_0` of self by mapping the element to the ambient crystal |
| 916 | and calculating `\phi_0` there. |
| 917 | |
| 918 | EXAMPLES:: |
| 919 | |
| 920 | sage: K = KirillovReshetikhinCrystal(['D',3,2], 1,1) |
| 921 | sage: b=K(rows=[[-1]]) |
| 922 | sage: b.phi(0) |
| 923 | 2 |
| 924 | """ |
| 925 | b = self.parent().to_ambient_crystal()(self) |
| 926 | return b.phi(0) |
| 927 | |
| 928 | KR_type_box.element_class = KR_type_boxElement |
| 929 | |
| 930 | |
| 931 | class PMDiagram(CombinatorialObject): |
| 932 | """ |
| 933 | Class of `\pm` diagrams. These diagrams are in one-to-one bijection with `X_{n-1}` highest weight vectors |
| 934 | in an `X_n` highest weight crystal `X=B,C,D`. See Section 4.1 of A. Schilling, "Combinatorial structure of |
| 935 | Kirillov-Reshetikhin crystals of type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`", J. Algebra 319 (2008) 2938-2962 |
| 936 | (arXiv:0704.2046[math.QA]). |
| 937 | |
| 938 | The input is a list `pm = [[a_0,b_0],[a_1,b_1],...,[a_{n-1},b_{n-1}],[b_n]]` of 2-tuples and a last 1-tuple. |
| 939 | The tuple `[a_i,b_i]` specifies the number of `a_i` + and `b_i` - in the i-th row of the pm diagram |
| 940 | if `n-i` is odd and the number of `a_i` +- pairs above row `i` and `b_i` columns of height `i` not containing |
| 941 | any + or - if `n-i` is even. |
| 942 | |
| 943 | Setting the option 'from_shapes = True' one can also input a `\pm` diagram in terms of its |
| 944 | outer, intermediate and inner shape by specifying a tuple [n, s, outer, intermediate, inner] |
| 945 | where `s` is the width of the `\pm` diagram, and 'outer' , 'intermediate', |
| 946 | and 'inner' are the outer, intermediate and inner shape, respectively. |
| 947 | |
| 948 | EXAMPLES:: |
| 949 | |
| 950 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 951 | sage: pm.pm_diagram |
| 952 | [[0, 1], [1, 2], [1]] |
| 953 | sage: pm._list |
| 954 | [1, 1, 2, 0, 1] |
| 955 | sage: pm.n |
| 956 | 2 |
| 957 | sage: pm.width |
| 958 | 5 |
| 959 | sage: pm.__repr__(pretty_printing=True) |
| 960 | . . . . |
| 961 | . + - - |
| 962 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([2,5,[4,4],[4,2],[4,1]], from_shapes=True) |
| 963 | [[0, 1], [1, 2], [1]] |
| 964 | |
| 965 | TESTS:: |
| 966 | |
| 967 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 968 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([pm.n, pm.width, pm.outer_shape(), pm.intermediate_shape(), pm.inner_shape()], from_shapes=True) == pm |
| 969 | True |
| 970 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 971 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([pm.n, pm.width, pm.outer_shape(), pm.intermediate_shape(), pm.inner_shape()], from_shapes=True) == pm |
| 972 | True |
| 973 | """ |
| 974 | |
| 975 | def __init__(self, pm_diagram, from_shapes = None): |
| 976 | r""" |
| 977 | Initializes `\pm` diagrams. |
| 978 | |
| 979 | TESTS:: |
| 980 | |
| 981 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 982 | [[0, 1], [1, 2], [1]] |
| 983 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([2,5,[4,4],[4,2],[4,1]], from_shapes=True) |
| 984 | [[0, 1], [1, 2], [1]] |
| 985 | """ |
| 986 | if from_shapes: |
| 987 | n = pm_diagram[0] |
| 988 | s = pm_diagram[1] |
| 989 | outer = [s]+list(pm_diagram[2])+[0 for i in range(n)] |
| 990 | intermediate = [s]+list(pm_diagram[3])+[0 for i in range(n)] |
| 991 | inner = [s]+list(pm_diagram[4])+[0 for i in range(n)] |
| 992 | pm = [[inner[n]]] |
| 993 | for i in range(int((n+1)/2)): |
| 994 | pm.append([intermediate[n-2*i]-inner[n-2*i], inner[n-2*i-1]-intermediate[n-2*i]]) |
| 995 | pm.append([outer[n-2*i]-inner[n-2*i-1], inner[n-2*i-2]-outer[n-2*i]]) |
| 996 | if is_odd(n): |
| 997 | pm.pop(n+1) |
| 998 | pm_diagram = list(reversed(pm)) |
| 999 | self.pm_diagram = pm_diagram |
| 1000 | self.n = len(pm_diagram)-1 |
| 1001 | self._list = [i for a in reversed(pm_diagram) for i in a] |
| 1002 | self.width = sum(i for i in self._list) |
| 1003 | |
| 1004 | def __repr__(self, pretty_printing = None): |
| 1005 | """ |
| 1006 | Turning on pretty printing allows to display the pm diagram as a |
| 1007 | tableau with the + and - displayed |
| 1008 | |
| 1009 | EXAMPLES:: |
| 1010 | |
| 1011 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,0],[0,1],[2,0],[0,0],[0]]) |
| 1012 | sage: pm.__repr__(pretty_printing=True) |
| 1013 | . . . + |
| 1014 | . . - - |
| 1015 | + + |
| 1016 | - - |
| 1017 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,2], [0,0], [0]]) |
| 1018 | sage: pm.__repr__(pretty_printing=True) |
| 1019 | |
| 1020 | """ |
| 1021 | if pretty_printing is None: |
| 1022 | return repr(self.pm_diagram) |
| 1023 | t = [] |
| 1024 | ish = self.inner_shape() + [0]*self.n |
| 1025 | msh = self.intermediate_shape() + [0]*self.n |
| 1026 | osh = self.outer_shape() + [0]*self.n |
| 1027 | for i in range(self.n): |
| 1028 | t.append(['.']*ish[i]+['+']*(msh[i]-ish[i])+['-']*(osh[i]-msh[i])) |
| 1029 | t=[i for i in t if i!= []] |
| 1030 | return Tableau(t).pp() |
| 1031 | |
| 1032 | def inner_shape(self): |
| 1033 | """ |
| 1034 | Returns the inner shape of the pm diagram |
| 1035 | |
| 1036 | EXAMPLES:: |
| 1037 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 1038 | sage: pm.inner_shape() |
| 1039 | [4, 1] |
| 1040 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1041 | sage: pm.inner_shape() |
| 1042 | [7, 5, 3, 1] |
| 1043 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1044 | sage: pm.inner_shape() |
| 1045 | [10, 7, 5, 3, 1] |
| 1046 | """ |
| 1047 | t = [] |
| 1048 | ll = self._list |
| 1049 | for i in range(self.n): |
| 1050 | t.append(sum(ll[0:2*i+1])) |
| 1051 | return Partition(list(reversed(t))) |
| 1052 | |
| 1053 | def outer_shape(self): |
| 1054 | """ |
| 1055 | Returns the outer shape of the pm diagram |
| 1056 | |
| 1057 | EXAMPLES:: |
| 1058 | |
| 1059 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 1060 | sage: pm.outer_shape() |
| 1061 | [4, 4] |
| 1062 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1063 | sage: pm.outer_shape() |
| 1064 | [8, 8, 4, 4] |
| 1065 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1066 | sage: pm.outer_shape() |
| 1067 | [13, 8, 8, 4, 4] |
| 1068 | """ |
| 1069 | t = [] |
| 1070 | ll = self._list |
| 1071 | for i in range((self.n)/2): |
| 1072 | t.append(sum(ll[0:4*i+4])) |
| 1073 | t.append(sum(ll[0:4*i+4])) |
| 1074 | if is_even(self.n+1): |
| 1075 | t.append(sum(ll[0:2*self.n+2])) |
| 1076 | return Partition(list(reversed(t))) |
| 1077 | |
| 1078 | def intermediate_shape(self): |
| 1079 | """ |
| 1080 | Returns the intermediate shape of the pm diagram (innner shape plus positions of plusses) |
| 1081 | |
| 1082 | EXAMPLES:: |
| 1083 | |
| 1084 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 1085 | sage: pm.intermediate_shape() |
| 1086 | [4, 2] |
| 1087 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1088 | sage: pm.intermediate_shape() |
| 1089 | [8, 6, 4, 2] |
| 1090 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1091 | sage: pm.intermediate_shape() |
| 1092 | [11, 8, 6, 4, 2] |
| 1093 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,0],[0,1],[2,0],[0,0],[0]]) |
| 1094 | sage: pm.intermediate_shape() |
| 1095 | [4, 2, 2] |
| 1096 | """ |
| 1097 | p = self.inner_shape() |
| 1098 | p = p + [0,0] |
| 1099 | ll = list(reversed(self._list)) |
| 1100 | p = [ p[i]+ll[2*i+1] for i in range(self.n) ] |
| 1101 | return Partition(p) |
| 1102 | |
| 1103 | def heights_of_minus(self): |
| 1104 | """ |
| 1105 | Returns a list with the heights of all minus in the `\pm` diagram. |
| 1106 | |
| 1107 | EXAMPLES:: |
| 1108 | |
| 1109 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1110 | sage: pm.heights_of_minus() |
| 1111 | [5, 5, 3, 3, 1, 1] |
| 1112 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1113 | sage: pm.heights_of_minus() |
| 1114 | [4, 4, 2, 2] |
| 1115 | """ |
| 1116 | n = self.n |
| 1117 | heights = [] |
| 1118 | for i in range(int((n+1)/2)): |
| 1119 | heights += [n-2*i]*((self.outer_shape()+[0]*n)[n-2*i-1]-(self.intermediate_shape()+[0]*n)[n-2*i-1]) |
| 1120 | return heights |
| 1121 | |
| 1122 | def heights_of_addable_plus(self): |
| 1123 | """ |
| 1124 | Returns a list with the heights of all addable plus in the `\pm` diagram. |
| 1125 | |
| 1126 | EXAMPLES:: |
| 1127 | |
| 1128 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1129 | sage: pm.heights_of_addable_plus() |
| 1130 | [1, 1, 2, 3, 4, 5] |
| 1131 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 1132 | sage: pm.heights_of_addable_plus() |
| 1133 | [1, 2, 3, 4] |
| 1134 | """ |
| 1135 | heights = [] |
| 1136 | for i in range(1,self.n+1): |
| 1137 | heights += [i]*self.sigma().pm_diagram[i][0] |
| 1138 | return heights |
| 1139 | |
| 1140 | def sigma(self): |
| 1141 | """ |
| 1142 | Returns sigma on pm diagrams as needed for the analogue of the Dynkin diagram automorphism |
| 1143 | that interchanges nodes `0` and `1` for type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)` for |
| 1144 | Kirillov-Reshetikhin crystals. |
| 1145 | |
| 1146 | EXAMPLES:: |
| 1147 | |
| 1148 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 1149 | sage: pm.sigma().pm_diagram |
| 1150 | [[1, 0], [2, 1], [1]] |
| 1151 | """ |
| 1152 | pm = self.pm_diagram |
| 1153 | return PMDiagram([list(reversed(a)) for a in pm]) |
| 1154 | |
| 1155 | |
| 1156 | def partitions_in_box(r, s): |
| 1157 | """ |
| 1158 | Returns all partitions in a box of width s and height r. |
| 1159 | |
| 1160 | EXAMPLES:: |
| 1161 | |
| 1162 | sage: sage.combinat.crystals.kirillov_reshetikhin.partitions_in_box(3,2) |
| 1163 | [[], [1], [2], [1, 1], [2, 1], [1, 1, 1], [2, 2], [2, 1, 1], |
| 1164 | [2, 2, 1], [2, 2, 2]] |
| 1165 | """ |
| 1166 | return [x for n in range(r*s+1) for x in Partitions(n,max_part=s,max_length=r)] |
| 1167 | |
| 1168 | def vertical_dominoes_removed(r, s): |
| 1169 | """ |
| 1170 | Returns all partitions obtained from a rectangle of width s and height r by removing |
| 1171 | vertical dominoes. |
| 1172 | |
| 1173 | EXAMPLES:: |
| 1174 | |
| 1175 | sage: sage.combinat.crystals.kirillov_reshetikhin.vertical_dominoes_removed(2,2) |
| 1176 | [[], [1, 1], [2, 2]] |
| 1177 | sage: sage.combinat.crystals.kirillov_reshetikhin.vertical_dominoes_removed(3,2) |
| 1178 | [[2], [2, 1, 1], [2, 2, 2]] |
| 1179 | sage: sage.combinat.crystals.kirillov_reshetikhin.vertical_dominoes_removed(4,2) |
| 1180 | [[], [1, 1], [1, 1, 1, 1], [2, 2], [2, 2, 1, 1], [2, 2, 2, 2]] |
| 1181 | """ |
| 1182 | return [x.conjugate() for x in horizontal_dominoes_removed(s,r)] |
| 1183 | |
| 1184 | def horizontal_dominoes_removed(r, s): |
| 1185 | """ |
| 1186 | Returns all partitions obtained from a rectangle of width s and height r by removing |
| 1187 | horizontal dominoes. |
| 1188 | |
| 1189 | EXAMPLES:: |
| 1190 | |
| 1191 | sage: sage.combinat.crystals.kirillov_reshetikhin.horizontal_dominoes_removed(2,2) |
| 1192 | [[], [2], [2, 2]] |
| 1193 | sage: sage.combinat.crystals.kirillov_reshetikhin.horizontal_dominoes_removed(3,2) |
| 1194 | [[], [2], [2, 2], [2, 2, 2]] |
| 1195 | """ |
| 1196 | list = [ [y for y in x] + [0 for i in range(r-x.length())] for x in partitions_in_box(r, int(s/2)) ] |
| 1197 | two = lambda x : 2*(x-int(s/2)) + s |
| 1198 | return [Partition([two(y) for y in x]) for x in list] |
| 1199 | |