| 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.letters import Letter |
| 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 | |
| 34 | |
| 35 | def KirillovReshetikhinCrystal(cartan_type, r, s): |
| 36 | r""" |
| 37 | Returns the Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. |
| 38 | |
| 39 | For most cases the Kirillov-Reshetikhin crystals are constructed from a |
| 40 | classical crystal together with an automorphism `p` on the level of crystals which |
| 41 | corresponds to a Dynkin diagram automorphism mapping node 0 to some other node i. |
| 42 | The action of `f_0` and `e_0` is then constructed using |
| 43 | `f_0 = p^{-1} \circ f_i \circ p`. |
| 44 | |
| 45 | For example, for type `A_n^{(1)}` the Kirillov-Reshetikhin crystal `B^{r,s}` |
| 46 | is obtained from the classical crystal `B(s\omega_r)` using the |
| 47 | promotion operator. For other types, see |
| 48 | |
| 49 | M. Shimozono |
| 50 | "Affine type A crystal structure on tensor products of rectangles, |
| 51 | Demazure characters, and nilpotent varieties", |
| 52 | J. Algebraic Combin. 15 (2002), no. 2, 151-187 |
| 53 | (arXiv:math.QA/9804039) |
| 54 | |
| 55 | A. Schilling, "Combinatorial structure of Kirillov-Reshetikhin crystals of |
| 56 | type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`", J. Algebra 319 (2008) 2938-2962 |
| 57 | (arXiv:0704.2046 [math.QA]) |
| 58 | |
| 59 | G. Fourier, M. Okado, A. Schilling, |
| 60 | "Kirillov-Reshetikhin crystals for nonexceptional types" |
| 61 | Advances in Math., to appear (arXiv:0810.5067 [math.RT]) |
| 62 | |
| 63 | INPUT: |
| 64 | |
| 65 | - ``cartan_type`` Affine type and rank |
| 66 | |
| 67 | - ``r`` label of finite Dynkin diagram |
| 68 | |
| 69 | - ``s`` positive integer |
| 70 | |
| 71 | EXAMPLES:: |
| 72 | |
| 73 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2, 1) |
| 74 | sage: K.index_set() |
| 75 | [0, 1, 2, 3] |
| 76 | sage: K.list() |
| 77 | [[[1], [2]], [[1], [3]], [[2], [3]], [[1], [4]], [[2], [4]], [[3], [4]]] |
| 78 | sage: b=K(rows=[[1],[2]]) |
| 79 | sage: b.weight() |
| 80 | -Lambda[0] + Lambda[2] |
| 81 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 82 | sage: K.automorphism(K.module_generators[0]) |
| 83 | [[2, 2], [3, 3]] |
| 84 | sage: K.module_generators[0].e(0) |
| 85 | [[1, 2], [2, 4]] |
| 86 | sage: K.module_generators[0].f(2) |
| 87 | [[1, 1], [2, 3]] |
| 88 | sage: K.module_generators[0].f(1) |
| 89 | sage: K.module_generators[0].phi(0) |
| 90 | 0 |
| 91 | sage: K.module_generators[0].phi(1) |
| 92 | 0 |
| 93 | sage: K.module_generators[0].phi(2) |
| 94 | 2 |
| 95 | sage: K.module_generators[0].epsilon(0) |
| 96 | 2 |
| 97 | sage: K.module_generators[0].epsilon(1) |
| 98 | 0 |
| 99 | sage: K.module_generators[0].epsilon(2) |
| 100 | 0 |
| 101 | sage: b = K(rows=[[1,2],[2,3]]) |
| 102 | sage: b |
| 103 | [[1, 2], [2, 3]] |
| 104 | sage: b.f(2) |
| 105 | [[1, 2], [3, 3]] |
| 106 | """ |
| 107 | ct = CartanType(cartan_type) |
| 108 | if ct.letter == 'A' and ct[2] == 1: |
| 109 | return KR_type_A(ct, r, s) |
| 110 | elif ct.letter == 'D' and ct[2] == 1 and r<ct[1]-1: |
| 111 | return KR_type_vertical(ct, r, s) |
| 112 | elif ct.letter == 'B' and ct[2] ==1 and r<ct[1]: |
| 113 | return KR_type_vertical(ct, r, s) |
| 114 | elif ct.letter == 'A' and ct[2] ==2 and is_even(ct[1]): |
| 115 | return KR_type_vertical(ct, r, s) |
| 116 | else: |
| 117 | raise NotImplementedError |
| 118 | |
| 119 | |
| 120 | class KirillovReshetikhinGenericCrystal(AffineCrystalFromClassical): |
| 121 | r""" |
| 122 | Generic class for Kirillov-Reshetikhin crystal `B^{r,s}` of the given type. |
| 123 | |
| 124 | This generic class assumes that the Kirillov-Reshetikhin crystal is constructed |
| 125 | from a classical crystal 'classical_decomposition' and an automorphism 'promotion' and its inverse |
| 126 | which corresponds to a Dynkin diagram automorphism 'dynkin_diagram_automorphism'. |
| 127 | |
| 128 | Each instance using this class needs to implement the methods: |
| 129 | - classical_decomposition |
| 130 | - promotion |
| 131 | - promotion_inverse |
| 132 | - dynkin_diagram_automorphism |
| 133 | """ |
| 134 | def __init__(self, cartan_type, r, s): |
| 135 | self._cartan_type = CartanType(cartan_type) |
| 136 | self._r = r |
| 137 | self._s = s |
| 138 | self._name = "Kirillov-Reshetikhin crystal of type %s with (r,s)=(%d,%d)" % (cartan_type, r, s) |
| 139 | AffineCrystalFromClassical.__init__(self, cartan_type, self.classical_decomposition(), |
| 140 | self.promotion(), self.promotion_inverse(), self.dynkin_diagram_automorphism(0)) |
| 141 | |
| 142 | def cartan_type(self): |
| 143 | """ |
| 144 | Returns the Cartan type of the underlying Kirillov-Reshetikhin crystal |
| 145 | |
| 146 | EXAMPLE:: |
| 147 | |
| 148 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 149 | sage: K.cartan_type() |
| 150 | ['D', 4, 1] |
| 151 | """ |
| 152 | return self._cartan_type |
| 153 | |
| 154 | def r(self): |
| 155 | """ |
| 156 | Returns r of the underlying Kirillov-Reshetikhin crystal `B^{r,s}` |
| 157 | |
| 158 | EXAMPLE:: |
| 159 | |
| 160 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 161 | sage: K.r() |
| 162 | 2 |
| 163 | """ |
| 164 | return self._r |
| 165 | |
| 166 | def s(self): |
| 167 | """ |
| 168 | Returns s of the underlying Kirillov-Reshetikhin crystal `B^{r,s}` |
| 169 | |
| 170 | EXAMPLE:: |
| 171 | |
| 172 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2, 1) |
| 173 | sage: K.s() |
| 174 | 1 |
| 175 | """ |
| 176 | return self._s |
| 177 | |
| 178 | class KR_type_A(KirillovReshetikhinGenericCrystal): |
| 179 | r""" |
| 180 | Class of Kirillov-Reshetikhin crystals of type `A_n^{(1)}`. |
| 181 | |
| 182 | EXAMPLES:: |
| 183 | |
| 184 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 185 | sage: b = K(rows=[[1,2],[2,4]]) |
| 186 | sage: b.f(0) |
| 187 | [[1, 1], [2, 2]] |
| 188 | """ |
| 189 | |
| 190 | def classical_decomposition(self): |
| 191 | """ |
| 192 | Specifies the classical crystal underlying the KR crystal of type A. |
| 193 | |
| 194 | EXAMPLES:: |
| 195 | |
| 196 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 197 | sage: K.classical_decomposition() |
| 198 | The crystal of tableaux of type ['A', 3] and shape(s) ([2, 2],) |
| 199 | """ |
| 200 | return CrystalOfTableaux(self._cartan_type.classical(), shape = [self.s() for i in range(1,self.r()+1)]) |
| 201 | |
| 202 | def promotion(self): |
| 203 | """ |
| 204 | Specifies the promotion operator used to construct the affine type A crystal. |
| 205 | For type A this corresponds to the Dynkin diagram automorphism which maps i to i+1 mod n+1, |
| 206 | where n is the rank. |
| 207 | |
| 208 | EXAMPLES: |
| 209 | |
| 210 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 211 | sage: b = K.classical_decomposition()(rows=[[1,2],[3,4]]) |
| 212 | sage: K.promotion()(b) |
| 213 | [[1, 3], [2, 4]] |
| 214 | """ |
| 215 | return lambda x : self.classical_crystal(x.to_tableau().promotion(self._cartan_type[1])) |
| 216 | |
| 217 | def promotion_inverse(self): |
| 218 | """ |
| 219 | Specifies the inverse promotion operator used to construct the affine type A crystal. |
| 220 | |
| 221 | EXAMPLES: |
| 222 | |
| 223 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 224 | sage: b = K.classical_decomposition()(rows=[[1,3],[2,4]]) |
| 225 | sage: K.promotion()(b) |
| 226 | [[1, 2], [3, 4]] |
| 227 | """ |
| 228 | return lambda x : self.classical_crystal(x.to_tableau().promotion_inverse(self._cartan_type[1])) |
| 229 | |
| 230 | def dynkin_diagram_automorphism(self, i): |
| 231 | """ |
| 232 | Specifies the Dynkin diagram automorphism underlying the promotion action on the crystal |
| 233 | elements. The automorphism needs to map node 0 to some other Dynkin node. |
| 234 | |
| 235 | For type A we use the Dynkin diagram automorphism which maps i to i+1 mod n+1, where n is the rank. |
| 236 | |
| 237 | EXAMPLES:: |
| 238 | |
| 239 | sage: K = KirillovReshetikhinCrystal(['A',3,1], 2,2) |
| 240 | sage: K.dynkin_diagram_automorphism(0) |
| 241 | 1 |
| 242 | sage: K.dynkin_diagram_automorphism(3) |
| 243 | 0 |
| 244 | """ |
| 245 | aut = range(1,self.cartan_type().rank())+[0] |
| 246 | return aut[i] |
| 247 | |
| 248 | class KR_type_vertical(KirillovReshetikhinGenericCrystal): |
| 249 | r""" |
| 250 | Class of Kirillov-Reshetikhin crystals `B^{r,s}` of type `D_n^{(1)}` for `r\le n-2`, |
| 251 | `B_n^{(1)}` for `r<n`, and `A_{2n}^{(2)}` for `r\le n`. |
| 252 | |
| 253 | EXAMPLES:: |
| 254 | |
| 255 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 256 | sage: b = K(rows=[]) |
| 257 | sage: b.f(0) |
| 258 | [[1], [2]] |
| 259 | sage: b.f(0).f(0) |
| 260 | [[1, 1], [2, 2]] |
| 261 | sage: b.e(0) |
| 262 | [[-2], [-1]] |
| 263 | sage: b.e(0).e(0) |
| 264 | [[-2, -2], [-1, -1]] |
| 265 | |
| 266 | sage: K = KirillovReshetikhinCrystal(['B',3,1], 1,1) |
| 267 | sage: [[b,b.f(0)] for b in K] |
| 268 | [[[[1]], None], [[[2]], None], [[[3]], None], [[[0]], None], [[[-3]], None], [[[-2]], [[1]]], [[[-1]], [[2]]]] |
| 269 | sage: K = KirillovReshetikhinCrystal(['A',6,2], 1,1) |
| 270 | sage: [[b,b.f(0)] for b in K] |
| 271 | [[[[1]], None], [[[2]], None], [[[3]], None], [[[-3]], None], [[[-2]], [[1]]], [[[-1]], [[2]]]] |
| 272 | """ |
| 273 | |
| 274 | def classical_decomposition(self): |
| 275 | """ |
| 276 | Specifies the classical crystal underlying the Kirillov-Reshetikhin crystal of type `D_n^{(1)}`, `B_n^{(1)}`, |
| 277 | and `A_{2n}^{(2)}`. |
| 278 | It is given by `B^{r,s} \cong \oplus_\Lambda B(\Lambda)` where `\Lambda` are weights obtained from |
| 279 | a rectangle of width s and height r by removing verticle dominoes. Here we identify the fundamental |
| 280 | weight `\Lambda_i` with a column of height `i`. |
| 281 | |
| 282 | EXAMPLES:: |
| 283 | |
| 284 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 285 | sage: K.classical_decomposition() |
| 286 | The crystal of tableaux of type ['D', 4] and shape(s) [[], [1, 1], [2, 2]] |
| 287 | """ |
| 288 | return CrystalOfTableaux(self.cartan_type().classical(), |
| 289 | shapes = self.vertical_dominoes_removed(self.r(),self.s())) |
| 290 | |
| 291 | def promotion(self): |
| 292 | """ |
| 293 | Specifies the promotion operator used to construct the affine type 'D_n^{(1)}` crystal. |
| 294 | For type D, this corresponds to the Dynkin diagram automorphism which interchanges nodes 0 and 1, |
| 295 | and leaves all other nodes unchanged. On the level of crystals it is constructed using |
| 296 | `\pm` diagrams. |
| 297 | |
| 298 | EXAMPLES: |
| 299 | |
| 300 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 301 | sage: promotion = K.promotion() |
| 302 | sage: b = K.classical_decomposition()(rows=[]) |
| 303 | sage: promotion(b) |
| 304 | [[1, 2], [-2, -1]] |
| 305 | sage: b = K.classical_decomposition()(rows=[[1,3],[2,-1]]) |
| 306 | sage: promotion(b) |
| 307 | [[1, 3], [2, -1]] |
| 308 | sage: b = K.classical_decomposition()(rows=[[1],[-3]]) |
| 309 | sage: promotion(b) |
| 310 | [[2, -3], [-2, -1]] |
| 311 | """ |
| 312 | T = self.classical_decomposition() |
| 313 | ind = T.index_set() |
| 314 | ind.remove(1) |
| 315 | return T.crystal_morphism( self.promotion_on_highest_weight_vectors(), index_set = ind) |
| 316 | |
| 317 | promotion_inverse = promotion |
| 318 | |
| 319 | def dynkin_diagram_automorphism(self, i): |
| 320 | """ |
| 321 | Specifies the Dynkin diagram automorphism underlying the promotion action on the crystal |
| 322 | elements. The automorphism needs to map node 0 to some other Dynkin node. |
| 323 | |
| 324 | For type D we use the Dynkin diagram automorphism which interchanges nodes 0 and 1 and leaves |
| 325 | all other nodes unchanged. |
| 326 | |
| 327 | EXAMPLES:: |
| 328 | |
| 329 | sage: K = KirillovReshetikhinCrystal(['D',4,1],1,1) |
| 330 | sage: K.dynkin_diagram_automorphism(0) |
| 331 | 1 |
| 332 | sage: K.dynkin_diagram_automorphism(1) |
| 333 | 0 |
| 334 | sage: K.dynkin_diagram_automorphism(4) |
| 335 | 4 |
| 336 | """ |
| 337 | aut = [1,0]+range(2,self.cartan_type().rank()) |
| 338 | return aut[i] |
| 339 | |
| 340 | def partitions_in_box(self, r, s): |
| 341 | """ |
| 342 | Returns all partitions in a box of width s and height r. |
| 343 | |
| 344 | EXAMPLES:: |
| 345 | |
| 346 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 1,2) |
| 347 | sage: K.partitions_in_box(3,2) |
| 348 | [[], [1], [2], [1, 1], [2, 1], [1, 1, 1], [2, 2], [2, 1, 1], |
| 349 | [2, 2, 1], [2, 2, 2]] |
| 350 | """ |
| 351 | return [x for n in range(r*s+1) for x in Partitions(n,max_part=s,max_length=r)] |
| 352 | |
| 353 | def vertical_dominoes_removed(self, r, s): |
| 354 | """ |
| 355 | Returns all partitions obtained from a rectangle of width s and height r by removing |
| 356 | vertical dominoes. |
| 357 | |
| 358 | EXAMPLES:: |
| 359 | |
| 360 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 1,2) |
| 361 | sage: K.vertical_dominoes_removed(2,2) |
| 362 | [[], [1, 1], [2, 2]] |
| 363 | sage: K.vertical_dominoes_removed(3,2) |
| 364 | [[2], [2, 1, 1], [2, 2, 2]] |
| 365 | """ |
| 366 | list = [ [y for y in x] + [0 for i in range(s-x.length())] for x in self.partitions_in_box(s, int(r/2)) ] |
| 367 | two = lambda x : 2*(x-int(r/2)) + r |
| 368 | return [Partition([two(y) for y in x]).conjugate() for x in list] |
| 369 | |
| 370 | def promotion_on_highest_weight_vectors(self): |
| 371 | """ |
| 372 | Calculates promotion on `{2,3,...,n}` highest weight vectors. |
| 373 | |
| 374 | EXAMPLES:: |
| 375 | |
| 376 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 377 | sage: T = K.classical_decomposition() |
| 378 | sage: hw = [ b for b in T if all(b.epsilon(i)==0 for i in [2,3,4]) ] |
| 379 | sage: [K.promotion_on_highest_weight_vectors()(b) for b in hw] |
| 380 | [[[1, 2], [-2, -1]], [[2, 2], [-2, -1]], [[1, 2], [3, -1]], [[2], [-2]], |
| 381 | [[1, 2], [2, -2]], [[2, 2], [-1, -1]], [[2, 2], [3, -1]], [[2, 2], [3, 3]], |
| 382 | [], [[1], [2]], [[1, 1], [2, 2]], [[2], [-1]], [[1, 2], [2, -1]], [[2], [3]], |
| 383 | [[1, 2], [2, 3]]] |
| 384 | """ |
| 385 | return lambda b: self.from_pm_diagram_to_highest_weight_vector(self.from_highest_weight_vector_to_pm_diagram(b).sigma()) |
| 386 | |
| 387 | def from_highest_weight_vector_to_pm_diagram(self, b): |
| 388 | """ |
| 389 | This gives the bijection between an element b in the classical decomposition |
| 390 | of the KR crystal that is {2,3,..,n}-highest weight and `\pm` diagrams. |
| 391 | |
| 392 | EXAMPLES:: |
| 393 | |
| 394 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 395 | sage: T = K.classical_decomposition() |
| 396 | sage: b = T(rows=[[2],[-2]]) |
| 397 | sage: pm = K.from_highest_weight_vector_to_pm_diagram(b); pm |
| 398 | [[1, 1], [0, 0], [0]] |
| 399 | sage: pm.__repr__(pretty_printing=True) |
| 400 | + |
| 401 | - |
| 402 | sage: b = T(rows=[]) |
| 403 | sage: pm=K.from_highest_weight_vector_to_pm_diagram(b); pm |
| 404 | [[0, 2], [0, 0], [0]] |
| 405 | sage: pm.__repr__(pretty_printing=True) |
| 406 | |
| 407 | sage: hw = [ b for b in T if all(b.epsilon(i)==0 for i in [2,3,4]) ] |
| 408 | sage: all(K.from_pm_diagram_to_highest_weight_vector(K.from_highest_weight_vector_to_pm_diagram(b)) == b for b in hw) |
| 409 | True |
| 410 | """ |
| 411 | n = self.cartan_type().rank()-1 |
| 412 | inner = Partition([Integer(b.weight()[i]) for i in range(1,n+1)]) |
| 413 | inter = Partition([len([i for i in r if i>0]) for r in b.to_tableau()]) |
| 414 | outer = b.to_tableau().shape() |
| 415 | return PMDiagram([self.r(), self.s(), outer, inter, inner], from_shapes=True) |
| 416 | |
| 417 | def from_pm_diagram_to_highest_weight_vector(self, pm): |
| 418 | """ |
| 419 | This gives the bijection between a `\pm` diagram and an element b in the classical |
| 420 | decomposition of the KR crystal that is {2,3,..,n}-highest weight. |
| 421 | |
| 422 | EXAMPLES:: |
| 423 | |
| 424 | sage: K = KirillovReshetikhinCrystal(['D',4,1], 2,2) |
| 425 | sage: pm = sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1, 1], [0, 0], [0]]) |
| 426 | sage: K.from_pm_diagram_to_highest_weight_vector(pm) |
| 427 | [[2], [-2]] |
| 428 | """ |
| 429 | u = [b for b in self.classical_decomposition().module_generators if b.to_tableau().shape() == pm.outer_shape()][0] |
| 430 | ct = self.cartan_type() |
| 431 | rank = ct.rank()-1 |
| 432 | list = [] |
| 433 | for h in pm.heights_of_addable_plus(): |
| 434 | list += range(1,h+1) |
| 435 | for h in pm.heights_of_minus(): |
| 436 | if ct.letter == 'D': |
| 437 | list += range(1,rank+1)+[rank-2-k for k in range(rank-1-h)] |
| 438 | elif ct.letter == 'B': |
| 439 | list += range(1,rank+1)+[rank-k for k in range(rank+1-h)] |
| 440 | else: |
| 441 | list += range(1,rank+1)+[rank-1-k for k in range(rank-h)] |
| 442 | for i in reversed(list): |
| 443 | u = u.f(i) |
| 444 | return u |
| 445 | |
| 446 | |
| 447 | class PMDiagram(CombinatorialObject): |
| 448 | """ |
| 449 | Class of `\pm` diagrams. These diagrams are in one-to-one bijection with `X_{n-1}` highest weight vectors |
| 450 | in an `X_n` highest weight crystal `X=B,C,D`. See Section 4.1 of A. Schilling, "Combinatorial structure of |
| 451 | Kirillov-Reshetikhin crystals of type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)`", J. Algebra 319 (2008) 2938-2962 |
| 452 | (arXiv:0704.2046[math.QA]). |
| 453 | |
| 454 | 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. |
| 455 | The tuple `[a_i,b_i]` specifies the number of `a_i` + and `b_i` - in the i-th row of the pm diagram |
| 456 | if `n-i` is odd and the number of `a_i` +- pairs above row i and `b_i` columns of height i not containing |
| 457 | any + or - if `n-i` is even. |
| 458 | |
| 459 | Setting the option 'from_shapes = True' one can also input a `\pm` diagram in terms of its |
| 460 | outer, intermediate and inner shape by specifying a tuple [n, s, outer, intermediate, inner] |
| 461 | where `s` is the width of the `\pm` diagram, and 'outer' , 'intermediate', |
| 462 | and 'inner' are the outer, intermediate and inner shape, respectively. |
| 463 | |
| 464 | EXAMPLES:: |
| 465 | |
| 466 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 467 | sage: pm.pm_diagram |
| 468 | [[0, 1], [1, 2], [1]] |
| 469 | sage: pm._list |
| 470 | [1, 1, 2, 0, 1] |
| 471 | sage: pm.n |
| 472 | 2 |
| 473 | sage: pm.width |
| 474 | 5 |
| 475 | sage: pm.__repr__(pretty_printing=True) |
| 476 | . . . . |
| 477 | . + - - |
| 478 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([2,5,[4,4],[4,2],[4,1]], from_shapes=True) |
| 479 | [[0, 1], [1, 2], [1]] |
| 480 | |
| 481 | TESTS:: |
| 482 | |
| 483 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 484 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([pm.n, pm.width, pm.outer_shape(), pm.intermediate_shape(), pm.inner_shape()], from_shapes=True) == pm |
| 485 | True |
| 486 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 487 | sage: sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([pm.n, pm.width, pm.outer_shape(), pm.intermediate_shape(), pm.inner_shape()], from_shapes=True) == pm |
| 488 | True |
| 489 | """ |
| 490 | |
| 491 | def __init__(self, pm_diagram, from_shapes = None): |
| 492 | if from_shapes: |
| 493 | n = pm_diagram[0] |
| 494 | s = pm_diagram[1] |
| 495 | outer = [s]+list(pm_diagram[2])+[0 for i in range(n)] |
| 496 | intermediate = [s]+list(pm_diagram[3])+[0 for i in range(n)] |
| 497 | inner = [s]+list(pm_diagram[4])+[0 for i in range(n)] |
| 498 | pm = [[inner[n]]] |
| 499 | for i in range(int((n+1)/2)): |
| 500 | pm.append([intermediate[n-2*i]-inner[n-2*i], inner[n-2*i-1]-intermediate[n-2*i]]) |
| 501 | pm.append([outer[n-2*i]-inner[n-2*i-1], inner[n-2*i-2]-outer[n-2*i]]) |
| 502 | if is_odd(n): |
| 503 | pm.pop(n+1) |
| 504 | pm_diagram = list(reversed(pm)) |
| 505 | self.pm_diagram = pm_diagram |
| 506 | self.n = len(pm_diagram)-1 |
| 507 | self._list = [i for a in reversed(pm_diagram) for i in a] |
| 508 | self.width = sum(i for i in self._list) |
| 509 | |
| 510 | def __repr__(self, pretty_printing = None): |
| 511 | """ |
| 512 | Turning on pretty printing allows to display the pm diagram as a |
| 513 | tableau with the + and - displayed |
| 514 | |
| 515 | EXAMPLES:: |
| 516 | |
| 517 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,0],[0,1],[2,0],[0,0],[0]]) |
| 518 | sage: pm.__repr__(pretty_printing=True) |
| 519 | . . . + |
| 520 | . . - - |
| 521 | + + |
| 522 | - - |
| 523 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,2], [0,0], [0]]) |
| 524 | sage: pm.__repr__(pretty_printing=True) |
| 525 | |
| 526 | """ |
| 527 | if pretty_printing is None: |
| 528 | return repr(self.pm_diagram) |
| 529 | t = [] |
| 530 | ish = self.inner_shape() + [0]*self.n |
| 531 | msh = self.intermediate_shape() + [0]*self.n |
| 532 | osh = self.outer_shape() + [0]*self.n |
| 533 | for i in range(self.n): |
| 534 | t.append(['.']*ish[i]+['+']*(msh[i]-ish[i])+['-']*(osh[i]-msh[i])) |
| 535 | t=[i for i in t if i!= []] |
| 536 | return Tableau(t).pp() |
| 537 | |
| 538 | def inner_shape(self): |
| 539 | """ |
| 540 | Returns the inner shape of the pm diagram |
| 541 | |
| 542 | EXAMPLES:: |
| 543 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 544 | sage: pm.inner_shape() |
| 545 | [4, 1] |
| 546 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 547 | sage: pm.inner_shape() |
| 548 | [7, 5, 3, 1] |
| 549 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 550 | sage: pm.inner_shape() |
| 551 | [10, 7, 5, 3, 1] |
| 552 | """ |
| 553 | t = [] |
| 554 | ll = self._list |
| 555 | for i in range(self.n): |
| 556 | t.append(sum(ll[0:2*i+1])) |
| 557 | return Partition(list(reversed(t))) |
| 558 | |
| 559 | def outer_shape(self): |
| 560 | """ |
| 561 | Returns the outer shape of the pm diagram |
| 562 | |
| 563 | EXAMPLES:: |
| 564 | |
| 565 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 566 | sage: pm.outer_shape() |
| 567 | [4, 4] |
| 568 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 569 | sage: pm.outer_shape() |
| 570 | [8, 8, 4, 4] |
| 571 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 572 | sage: pm.outer_shape() |
| 573 | [13, 8, 8, 4, 4] |
| 574 | """ |
| 575 | t = [] |
| 576 | ll = self._list |
| 577 | for i in range((self.n)/2): |
| 578 | t.append(sum(ll[0:4*i+4])) |
| 579 | t.append(sum(ll[0:4*i+4])) |
| 580 | if is_even(self.n+1): |
| 581 | t.append(sum(ll[0:2*self.n+2])) |
| 582 | return Partition(list(reversed(t))) |
| 583 | |
| 584 | def intermediate_shape(self): |
| 585 | """ |
| 586 | Returns the intermediate shape of the pm diagram (innner shape plus positions of plusses) |
| 587 | |
| 588 | EXAMPLES:: |
| 589 | |
| 590 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 591 | sage: pm.intermediate_shape() |
| 592 | [4, 2] |
| 593 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 594 | sage: pm.intermediate_shape() |
| 595 | [8, 6, 4, 2] |
| 596 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 597 | sage: pm.intermediate_shape() |
| 598 | [11, 8, 6, 4, 2] |
| 599 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,0],[0,1],[2,0],[0,0],[0]]) |
| 600 | sage: pm.intermediate_shape() |
| 601 | [4, 2, 2] |
| 602 | """ |
| 603 | p = self.inner_shape() |
| 604 | p = p + [0,0] |
| 605 | ll = list(reversed(self._list)) |
| 606 | p = [ p[i]+ll[2*i+1] for i in range(self.n) ] |
| 607 | return Partition(p) |
| 608 | |
| 609 | def heights_of_minus(self): |
| 610 | """ |
| 611 | Returns a list with the heights of all minus in the `\pm` diagram. |
| 612 | |
| 613 | EXAMPLES:: |
| 614 | |
| 615 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 616 | sage: pm.heights_of_minus() |
| 617 | [5, 5, 3, 3, 1, 1] |
| 618 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 619 | sage: pm.heights_of_minus() |
| 620 | [4, 4, 2, 2] |
| 621 | """ |
| 622 | n = self.n |
| 623 | heights = [] |
| 624 | for i in range(int((n+1)/2)): |
| 625 | heights += [n-2*i]*((self.outer_shape()+[0]*n)[n-2*i-1]-(self.intermediate_shape()+[0]*n)[n-2*i-1]) |
| 626 | return heights |
| 627 | |
| 628 | def heights_of_addable_plus(self): |
| 629 | """ |
| 630 | Returns a list with the heights of all addable plus in the `\pm` diagram. |
| 631 | |
| 632 | EXAMPLES:: |
| 633 | |
| 634 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,2],[1,1],[1,1],[1,1],[1]]) |
| 635 | sage: pm.heights_of_addable_plus() |
| 636 | [1, 1, 2, 3, 4, 5] |
| 637 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[1,2],[1,1],[1,1],[1,1],[1]]) |
| 638 | sage: pm.heights_of_addable_plus() |
| 639 | [1, 2, 3, 4] |
| 640 | """ |
| 641 | heights = [] |
| 642 | for i in range(1,self.n+1): |
| 643 | heights += [i]*self.sigma().pm_diagram[i][0] |
| 644 | return heights |
| 645 | |
| 646 | def sigma(self): |
| 647 | """ |
| 648 | Returns sigma on pm diagrams as needed for the analogue of the Dynkin diagram automorphism |
| 649 | that interchanges nodes `0` and `1` for type `D_n(1)`, `B_n(1)`, `A_{2n-1}(2)` for |
| 650 | Kirillov-Reshetikhin crystals. |
| 651 | |
| 652 | EXAMPLES:: |
| 653 | |
| 654 | sage: pm=sage.combinat.crystals.kirillov_reshetikhin.PMDiagram([[0,1],[1,2],[1]]) |
| 655 | sage: pm.sigma().pm_diagram |
| 656 | [[1, 0], [2, 1], [1]] |
| 657 | """ |
| 658 | pm = self.pm_diagram |
| 659 | return PMDiagram([list(reversed(a)) for a in pm]) |
| 660 | |