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