passagemath-combinat 10.6.42__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  3. passagemath_combinat-10.6.42.dist-info/RECORD +400 -0
  4. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  5. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  6. passagemath_combinat.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  7. passagemath_combinat.libs/libsymmetrica-81fe8739.so.3.0.0 +0 -0
  8. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  9. sage/algebras/all.py +24 -0
  10. sage/algebras/all__sagemath_combinat.py +35 -0
  11. sage/algebras/askey_wilson.py +935 -0
  12. sage/algebras/associated_graded.py +345 -0
  13. sage/algebras/cellular_basis.py +350 -0
  14. sage/algebras/cluster_algebra.py +2766 -0
  15. sage/algebras/down_up_algebra.py +860 -0
  16. sage/algebras/free_algebra.py +1698 -0
  17. sage/algebras/free_algebra_element.py +345 -0
  18. sage/algebras/free_algebra_quotient.py +405 -0
  19. sage/algebras/free_algebra_quotient_element.py +295 -0
  20. sage/algebras/free_zinbiel_algebra.py +885 -0
  21. sage/algebras/hall_algebra.py +783 -0
  22. sage/algebras/hecke_algebras/all.py +4 -0
  23. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  24. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  25. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  28. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  29. sage/algebras/jordan_algebra.py +1773 -0
  30. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  31. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  32. sage/algebras/lie_conformal_algebras/all.py +18 -0
  33. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  34. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  35. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  36. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  37. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  38. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  39. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  40. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  41. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  45. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  46. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  47. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  48. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  49. sage/algebras/nil_coxeter_algebra.py +191 -0
  50. sage/algebras/q_commuting_polynomials.py +673 -0
  51. sage/algebras/q_system.py +608 -0
  52. sage/algebras/quantum_clifford.py +959 -0
  53. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  54. sage/algebras/quantum_groups/all.py +9 -0
  55. sage/algebras/quantum_groups/fock_space.py +2219 -0
  56. sage/algebras/quantum_groups/q_numbers.py +207 -0
  57. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  58. sage/algebras/quantum_groups/representations.py +591 -0
  59. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  60. sage/algebras/quantum_oscillator.py +623 -0
  61. sage/algebras/quaternion_algebra.py +20 -0
  62. sage/algebras/quaternion_algebra_element.py +55 -0
  63. sage/algebras/rational_cherednik_algebra.py +525 -0
  64. sage/algebras/schur_algebra.py +670 -0
  65. sage/algebras/shuffle_algebra.py +1011 -0
  66. sage/algebras/splitting_algebra.py +779 -0
  67. sage/algebras/tensor_algebra.py +709 -0
  68. sage/algebras/yangian.py +1082 -0
  69. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  70. sage/all__sagemath_combinat.py +35 -0
  71. sage/combinat/SJT.py +255 -0
  72. sage/combinat/affine_permutation.py +2405 -0
  73. sage/combinat/algebraic_combinatorics.py +55 -0
  74. sage/combinat/all.py +53 -0
  75. sage/combinat/all__sagemath_combinat.py +195 -0
  76. sage/combinat/alternating_sign_matrix.py +2063 -0
  77. sage/combinat/baxter_permutations.py +346 -0
  78. sage/combinat/bijectionist.py +3220 -0
  79. sage/combinat/binary_recurrence_sequences.py +1180 -0
  80. sage/combinat/blob_algebra.py +685 -0
  81. sage/combinat/catalog_partitions.py +27 -0
  82. sage/combinat/chas/all.py +23 -0
  83. sage/combinat/chas/fsym.py +1180 -0
  84. sage/combinat/chas/wqsym.py +2601 -0
  85. sage/combinat/cluster_complex.py +326 -0
  86. sage/combinat/colored_permutations.py +2039 -0
  87. sage/combinat/colored_permutations_representations.py +964 -0
  88. sage/combinat/composition_signed.py +142 -0
  89. sage/combinat/composition_tableau.py +855 -0
  90. sage/combinat/constellation.py +1729 -0
  91. sage/combinat/core.py +751 -0
  92. sage/combinat/counting.py +12 -0
  93. sage/combinat/crystals/affine.py +742 -0
  94. sage/combinat/crystals/affine_factorization.py +518 -0
  95. sage/combinat/crystals/affinization.py +331 -0
  96. sage/combinat/crystals/alcove_path.py +2013 -0
  97. sage/combinat/crystals/all.py +22 -0
  98. sage/combinat/crystals/bkk_crystals.py +141 -0
  99. sage/combinat/crystals/catalog.py +115 -0
  100. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  101. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  102. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  103. sage/combinat/crystals/crystals.py +257 -0
  104. sage/combinat/crystals/direct_sum.py +260 -0
  105. sage/combinat/crystals/elementary_crystals.py +1251 -0
  106. sage/combinat/crystals/fast_crystals.py +441 -0
  107. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  108. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  109. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  110. sage/combinat/crystals/induced_structure.py +695 -0
  111. sage/combinat/crystals/infinity_crystals.py +730 -0
  112. sage/combinat/crystals/kac_modules.py +863 -0
  113. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  114. sage/combinat/crystals/kyoto_path_model.py +497 -0
  115. sage/combinat/crystals/letters.cpython-314-x86_64-linux-musl.so +0 -0
  116. sage/combinat/crystals/letters.pxd +79 -0
  117. sage/combinat/crystals/letters.pyx +3056 -0
  118. sage/combinat/crystals/littelmann_path.py +1518 -0
  119. sage/combinat/crystals/monomial_crystals.py +1262 -0
  120. sage/combinat/crystals/multisegments.py +462 -0
  121. sage/combinat/crystals/mv_polytopes.py +467 -0
  122. sage/combinat/crystals/pbw_crystal.py +511 -0
  123. sage/combinat/crystals/pbw_datum.cpython-314-x86_64-linux-musl.so +0 -0
  124. sage/combinat/crystals/pbw_datum.pxd +4 -0
  125. sage/combinat/crystals/pbw_datum.pyx +487 -0
  126. sage/combinat/crystals/polyhedral_realization.py +372 -0
  127. sage/combinat/crystals/spins.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/combinat/crystals/spins.pxd +21 -0
  129. sage/combinat/crystals/spins.pyx +756 -0
  130. sage/combinat/crystals/star_crystal.py +290 -0
  131. sage/combinat/crystals/subcrystal.py +464 -0
  132. sage/combinat/crystals/tensor_product.py +1177 -0
  133. sage/combinat/crystals/tensor_product_element.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  135. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  136. sage/combinat/crystals/virtual_crystal.py +420 -0
  137. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  138. sage/combinat/debruijn_sequence.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/combinat/debruijn_sequence.pyx +355 -0
  140. sage/combinat/decorated_permutation.py +270 -0
  141. sage/combinat/degree_sequences.cpython-314-x86_64-linux-musl.so +0 -0
  142. sage/combinat/degree_sequences.pyx +588 -0
  143. sage/combinat/derangements.py +527 -0
  144. sage/combinat/descent_algebra.py +1008 -0
  145. sage/combinat/diagram.py +1551 -0
  146. sage/combinat/diagram_algebras.py +5886 -0
  147. sage/combinat/dyck_word.py +4349 -0
  148. sage/combinat/e_one_star.py +1623 -0
  149. sage/combinat/enumerated_sets.py +123 -0
  150. sage/combinat/expnums.cpython-314-x86_64-linux-musl.so +0 -0
  151. sage/combinat/expnums.pyx +148 -0
  152. sage/combinat/fast_vector_partitions.cpython-314-x86_64-linux-musl.so +0 -0
  153. sage/combinat/fast_vector_partitions.pyx +346 -0
  154. sage/combinat/fqsym.py +1977 -0
  155. sage/combinat/free_dendriform_algebra.py +954 -0
  156. sage/combinat/free_prelie_algebra.py +1141 -0
  157. sage/combinat/fully_commutative_elements.py +1077 -0
  158. sage/combinat/fully_packed_loop.py +1523 -0
  159. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  160. sage/combinat/gray_codes.py +311 -0
  161. sage/combinat/grossman_larson_algebras.py +667 -0
  162. sage/combinat/growth.py +4352 -0
  163. sage/combinat/hall_polynomial.py +188 -0
  164. sage/combinat/hillman_grassl.py +866 -0
  165. sage/combinat/integer_matrices.py +329 -0
  166. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  167. sage/combinat/k_tableau.py +4564 -0
  168. sage/combinat/kazhdan_lusztig.py +215 -0
  169. sage/combinat/key_polynomial.py +885 -0
  170. sage/combinat/knutson_tao_puzzles.py +2286 -0
  171. sage/combinat/lr_tableau.py +311 -0
  172. sage/combinat/matrices/all.py +24 -0
  173. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  174. sage/combinat/matrices/latin.py +2912 -0
  175. sage/combinat/misc.py +401 -0
  176. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  177. sage/combinat/ncsf_qsym/all.py +21 -0
  178. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  179. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  180. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  181. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  182. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  183. sage/combinat/ncsym/all.py +21 -0
  184. sage/combinat/ncsym/bases.py +855 -0
  185. sage/combinat/ncsym/dual.py +593 -0
  186. sage/combinat/ncsym/ncsym.py +2076 -0
  187. sage/combinat/necklace.py +551 -0
  188. sage/combinat/non_decreasing_parking_function.py +634 -0
  189. sage/combinat/nu_dyck_word.py +1474 -0
  190. sage/combinat/output.py +861 -0
  191. sage/combinat/parallelogram_polyomino.py +4326 -0
  192. sage/combinat/parking_functions.py +1602 -0
  193. sage/combinat/partition_algebra.py +1998 -0
  194. sage/combinat/partition_kleshchev.py +1982 -0
  195. sage/combinat/partition_shifting_algebras.py +584 -0
  196. sage/combinat/partition_tuple.py +3114 -0
  197. sage/combinat/path_tableaux/all.py +13 -0
  198. sage/combinat/path_tableaux/catalog.py +29 -0
  199. sage/combinat/path_tableaux/dyck_path.py +380 -0
  200. sage/combinat/path_tableaux/frieze.py +476 -0
  201. sage/combinat/path_tableaux/path_tableau.py +728 -0
  202. sage/combinat/path_tableaux/semistandard.py +510 -0
  203. sage/combinat/perfect_matching.py +779 -0
  204. sage/combinat/plane_partition.py +3300 -0
  205. sage/combinat/q_bernoulli.cpython-314-x86_64-linux-musl.so +0 -0
  206. sage/combinat/q_bernoulli.pyx +128 -0
  207. sage/combinat/quickref.py +81 -0
  208. sage/combinat/recognizable_series.py +2051 -0
  209. sage/combinat/regular_sequence.py +4316 -0
  210. sage/combinat/regular_sequence_bounded.py +543 -0
  211. sage/combinat/restricted_growth.py +81 -0
  212. sage/combinat/ribbon.py +20 -0
  213. sage/combinat/ribbon_shaped_tableau.py +489 -0
  214. sage/combinat/ribbon_tableau.py +1180 -0
  215. sage/combinat/rigged_configurations/all.py +46 -0
  216. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  217. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  218. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  219. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  222. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  223. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  224. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  225. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  226. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  227. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  228. sage/combinat/rigged_configurations/bijection.py +143 -0
  229. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  230. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  231. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  232. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  233. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  234. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  235. sage/combinat/rigged_configurations/rigged_partition.cpython-314-x86_64-linux-musl.so +0 -0
  236. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  238. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  240. sage/combinat/rsk.py +3438 -0
  241. sage/combinat/schubert_polynomial.py +508 -0
  242. sage/combinat/set_partition.py +3318 -0
  243. sage/combinat/set_partition_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  244. sage/combinat/set_partition_iterator.pyx +136 -0
  245. sage/combinat/set_partition_ordered.py +1590 -0
  246. sage/combinat/sf/abreu_nigro.py +346 -0
  247. sage/combinat/sf/all.py +52 -0
  248. sage/combinat/sf/character.py +576 -0
  249. sage/combinat/sf/classical.py +319 -0
  250. sage/combinat/sf/dual.py +996 -0
  251. sage/combinat/sf/elementary.py +549 -0
  252. sage/combinat/sf/hall_littlewood.py +1028 -0
  253. sage/combinat/sf/hecke.py +336 -0
  254. sage/combinat/sf/homogeneous.py +464 -0
  255. sage/combinat/sf/jack.py +1428 -0
  256. sage/combinat/sf/k_dual.py +1458 -0
  257. sage/combinat/sf/kfpoly.py +447 -0
  258. sage/combinat/sf/llt.py +789 -0
  259. sage/combinat/sf/macdonald.py +2019 -0
  260. sage/combinat/sf/monomial.py +525 -0
  261. sage/combinat/sf/multiplicative.py +113 -0
  262. sage/combinat/sf/new_kschur.py +1786 -0
  263. sage/combinat/sf/ns_macdonald.py +964 -0
  264. sage/combinat/sf/orthogonal.py +246 -0
  265. sage/combinat/sf/orthotriang.py +355 -0
  266. sage/combinat/sf/powersum.py +963 -0
  267. sage/combinat/sf/schur.py +880 -0
  268. sage/combinat/sf/sf.py +1653 -0
  269. sage/combinat/sf/sfa.py +7053 -0
  270. sage/combinat/sf/symplectic.py +253 -0
  271. sage/combinat/sf/witt.py +721 -0
  272. sage/combinat/shifted_primed_tableau.py +2735 -0
  273. sage/combinat/shuffle.py +830 -0
  274. sage/combinat/sidon_sets.py +146 -0
  275. sage/combinat/similarity_class_type.py +1721 -0
  276. sage/combinat/sine_gordon.py +618 -0
  277. sage/combinat/six_vertex_model.py +784 -0
  278. sage/combinat/skew_partition.py +2053 -0
  279. sage/combinat/skew_tableau.py +2989 -0
  280. sage/combinat/sloane_functions.py +8935 -0
  281. sage/combinat/specht_module.py +1403 -0
  282. sage/combinat/species/all.py +48 -0
  283. sage/combinat/species/characteristic_species.py +321 -0
  284. sage/combinat/species/composition_species.py +273 -0
  285. sage/combinat/species/cycle_species.py +284 -0
  286. sage/combinat/species/empty_species.py +155 -0
  287. sage/combinat/species/functorial_composition_species.py +148 -0
  288. sage/combinat/species/generating_series.py +673 -0
  289. sage/combinat/species/library.py +148 -0
  290. sage/combinat/species/linear_order_species.py +169 -0
  291. sage/combinat/species/misc.py +83 -0
  292. sage/combinat/species/partition_species.py +290 -0
  293. sage/combinat/species/permutation_species.py +268 -0
  294. sage/combinat/species/product_species.py +423 -0
  295. sage/combinat/species/recursive_species.py +476 -0
  296. sage/combinat/species/set_species.py +192 -0
  297. sage/combinat/species/species.py +820 -0
  298. sage/combinat/species/structure.py +539 -0
  299. sage/combinat/species/subset_species.py +243 -0
  300. sage/combinat/species/sum_species.py +225 -0
  301. sage/combinat/subword.py +564 -0
  302. sage/combinat/subword_complex.py +2122 -0
  303. sage/combinat/subword_complex_c.cpython-314-x86_64-linux-musl.so +0 -0
  304. sage/combinat/subword_complex_c.pyx +119 -0
  305. sage/combinat/super_tableau.py +821 -0
  306. sage/combinat/superpartition.py +1154 -0
  307. sage/combinat/symmetric_group_algebra.py +3774 -0
  308. sage/combinat/symmetric_group_representations.py +1830 -0
  309. sage/combinat/t_sequences.py +877 -0
  310. sage/combinat/tableau.py +9506 -0
  311. sage/combinat/tableau_residues.py +860 -0
  312. sage/combinat/tableau_tuple.py +5353 -0
  313. sage/combinat/tiling.py +2432 -0
  314. sage/combinat/triangles_FHM.py +777 -0
  315. sage/combinat/tutorial.py +1857 -0
  316. sage/combinat/vector_partition.py +337 -0
  317. sage/combinat/words/abstract_word.py +1722 -0
  318. sage/combinat/words/all.py +59 -0
  319. sage/combinat/words/alphabet.py +268 -0
  320. sage/combinat/words/finite_word.py +7201 -0
  321. sage/combinat/words/infinite_word.py +113 -0
  322. sage/combinat/words/lyndon_word.py +652 -0
  323. sage/combinat/words/morphic.py +351 -0
  324. sage/combinat/words/morphism.py +3878 -0
  325. sage/combinat/words/paths.py +2932 -0
  326. sage/combinat/words/shuffle_product.py +278 -0
  327. sage/combinat/words/suffix_trees.py +1873 -0
  328. sage/combinat/words/word.py +769 -0
  329. sage/combinat/words/word_char.cpython-314-x86_64-linux-musl.so +0 -0
  330. sage/combinat/words/word_char.pyx +847 -0
  331. sage/combinat/words/word_datatypes.cpython-314-x86_64-linux-musl.so +0 -0
  332. sage/combinat/words/word_datatypes.pxd +4 -0
  333. sage/combinat/words/word_datatypes.pyx +1067 -0
  334. sage/combinat/words/word_generators.py +2026 -0
  335. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  336. sage/combinat/words/word_options.py +99 -0
  337. sage/combinat/words/words.py +2396 -0
  338. sage/data_structures/all__sagemath_combinat.py +1 -0
  339. sage/databases/all__sagemath_combinat.py +13 -0
  340. sage/databases/findstat.py +4897 -0
  341. sage/databases/oeis.py +2058 -0
  342. sage/databases/sloane.py +393 -0
  343. sage/dynamics/all__sagemath_combinat.py +14 -0
  344. sage/dynamics/cellular_automata/all.py +7 -0
  345. sage/dynamics/cellular_automata/catalog.py +34 -0
  346. sage/dynamics/cellular_automata/elementary.py +612 -0
  347. sage/dynamics/cellular_automata/glca.py +477 -0
  348. sage/dynamics/cellular_automata/solitons.py +1463 -0
  349. sage/dynamics/finite_dynamical_system.py +1249 -0
  350. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  351. sage/games/all.py +7 -0
  352. sage/games/hexad.py +704 -0
  353. sage/games/quantumino.py +591 -0
  354. sage/games/sudoku.py +889 -0
  355. sage/games/sudoku_backtrack.cpython-314-x86_64-linux-musl.so +0 -0
  356. sage/games/sudoku_backtrack.pyx +189 -0
  357. sage/groups/all__sagemath_combinat.py +1 -0
  358. sage/groups/indexed_free_group.py +489 -0
  359. sage/libs/all__sagemath_combinat.py +6 -0
  360. sage/libs/lrcalc/__init__.py +1 -0
  361. sage/libs/lrcalc/lrcalc.py +525 -0
  362. sage/libs/symmetrica/__init__.py +7 -0
  363. sage/libs/symmetrica/all.py +101 -0
  364. sage/libs/symmetrica/kostka.pxi +168 -0
  365. sage/libs/symmetrica/part.pxi +193 -0
  366. sage/libs/symmetrica/plet.pxi +42 -0
  367. sage/libs/symmetrica/sab.pxi +196 -0
  368. sage/libs/symmetrica/sb.pxi +332 -0
  369. sage/libs/symmetrica/sc.pxi +192 -0
  370. sage/libs/symmetrica/schur.pxi +956 -0
  371. sage/libs/symmetrica/symmetrica.cpython-314-x86_64-linux-musl.so +0 -0
  372. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  373. sage/libs/symmetrica/symmetrica.pyx +39 -0
  374. sage/monoids/all.py +13 -0
  375. sage/monoids/automatic_semigroup.py +1054 -0
  376. sage/monoids/free_abelian_monoid.py +315 -0
  377. sage/monoids/free_abelian_monoid_element.cpython-314-x86_64-linux-musl.so +0 -0
  378. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  379. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  380. sage/monoids/free_monoid.py +335 -0
  381. sage/monoids/free_monoid_element.py +431 -0
  382. sage/monoids/hecke_monoid.py +65 -0
  383. sage/monoids/string_monoid.py +817 -0
  384. sage/monoids/string_monoid_element.py +547 -0
  385. sage/monoids/string_ops.py +143 -0
  386. sage/monoids/trace_monoid.py +972 -0
  387. sage/rings/all__sagemath_combinat.py +2 -0
  388. sage/sat/all.py +4 -0
  389. sage/sat/boolean_polynomials.py +405 -0
  390. sage/sat/converters/__init__.py +6 -0
  391. sage/sat/converters/anf2cnf.py +14 -0
  392. sage/sat/converters/polybori.py +611 -0
  393. sage/sat/solvers/__init__.py +5 -0
  394. sage/sat/solvers/cryptominisat.py +287 -0
  395. sage/sat/solvers/dimacs.py +783 -0
  396. sage/sat/solvers/picosat.py +228 -0
  397. sage/sat/solvers/sat_lp.py +156 -0
  398. sage/sat/solvers/satsolver.cpython-314-x86_64-linux-musl.so +0 -0
  399. sage/sat/solvers/satsolver.pxd +3 -0
  400. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,3056 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.graphs sage.modules
3
+ r"""
4
+ Crystals of letters
5
+ """
6
+
7
+ #*****************************************************************************
8
+ # Copyright (C) 2007 Anne Schilling <anne at math.ucdavis.edu>
9
+ # Nicolas M. Thiery <nthiery at users.sf.net>
10
+ # Daniel Bump <bump at match.stanford.edu>
11
+ # Brant Jones <brant at math.ucdavis.edu>
12
+ # 2017 Travis Scrimshaw <tcscrims at gmail.com>
13
+ # Franco Saliola <saliola@gmail.com>
14
+ #
15
+ # This program is free software: you can redistribute it and/or modify
16
+ # it under the terms of the GNU General Public License as published by
17
+ # the Free Software Foundation, either version 2 of the License, or
18
+ # (at your option) any later version.
19
+ # https://www.gnu.org/licenses/
20
+ #*****************************************************************************
21
+ from cpython.object cimport Py_EQ, Py_NE, Py_LE, Py_GE, Py_LT, Py_GT
22
+ from sage.misc.cachefunc import cached_method
23
+ from sage.misc.lazy_attribute import lazy_attribute
24
+ from sage.structure.unique_representation import UniqueRepresentation
25
+ from sage.structure.parent import Parent
26
+ from sage.structure.element cimport Element
27
+ from sage.categories.enumerated_sets import EnumeratedSets
28
+ from sage.categories.classical_crystals import ClassicalCrystals
29
+ from sage.categories.regular_supercrystals import RegularSuperCrystals
30
+ from sage.combinat.root_system.cartan_type import CartanType
31
+ from sage.rings.integer import Integer
32
+
33
+
34
+ def CrystalOfLetters(cartan_type, element_print_style=None, dual=None):
35
+ r"""
36
+ Return the crystal of letters of the given type.
37
+
38
+ For classical types, this is a combinatorial model for the crystal
39
+ with highest weight `\Lambda_1` (the first fundamental weight).
40
+
41
+ Any irreducible classical crystal appears as the irreducible
42
+ component of the tensor product of several copies of this crystal
43
+ (plus possibly one copy of the spin crystal, see
44
+ :class:`~sage.combinat.crystals.spins.CrystalOfSpins`).
45
+ See [KN1994]_. Elements of this irreducible component have a fixed shape,
46
+ and can be fit inside a tableau shape. Otherwise said, any irreducible
47
+ classical crystal is isomorphic to a crystal of tableaux with cells
48
+ filled by elements of the crystal of letters (possibly tensored with
49
+ the crystal of spins).
50
+
51
+ We also have the crystal of fundamental representation of the
52
+ general linear Lie superalgebra, which are used as letters inside
53
+ of tableaux following [BKK2000]_. Similarly, all of these crystals
54
+ appear as a subcrystal of a sufficiently large tensor power of
55
+ this crystal.
56
+
57
+ INPUT:
58
+
59
+ - ``T`` -- a Cartan type
60
+
61
+ EXAMPLES::
62
+
63
+ sage: C = crystals.Letters(['A',5])
64
+ sage: C.list()
65
+ [1, 2, 3, 4, 5, 6]
66
+ sage: C.cartan_type()
67
+ ['A', 5]
68
+
69
+ For type `E_6`, one can also specify how elements are printed.
70
+ This option is usually set to None and the default representation is used.
71
+ If one chooses the option 'compact', the elements are printed in the more
72
+ compact convention with 27 letters ``+abcdefghijklmnopqrstuvwxyz`` and
73
+ the 27 letters ``-ABCDEFGHIJKLMNOPQRSTUVWXYZ`` for the dual crystal.
74
+
75
+ EXAMPLES::
76
+
77
+ sage: C = crystals.Letters(['E',6], element_print_style = 'compact')
78
+ sage: C
79
+ The crystal of letters for type ['E', 6]
80
+ sage: C.list()
81
+ [+, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
82
+ sage: C = crystals.Letters(['E',6], element_print_style = 'compact', dual = True)
83
+ sage: C
84
+ The crystal of letters for type ['E', 6] (dual)
85
+ sage: C.list()
86
+ [-, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z]
87
+ """
88
+ ct = CartanType(cartan_type)
89
+ if ct.letter == 'A':
90
+ from sage.combinat.root_system.cartan_type import SuperCartanType_standard
91
+ if isinstance(ct, SuperCartanType_standard):
92
+ return CrystalOfBKKLetters(ct, dual=dual)
93
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_A_element)
94
+ elif ct.letter == 'B':
95
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_B_element)
96
+ elif ct.letter == 'C':
97
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_C_element)
98
+ elif ct.letter == 'D':
99
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_D_element)
100
+ elif ct.letter == 'E' and ct.rank() == 6:
101
+ if dual is None:
102
+ return ClassicalCrystalOfLetters(ct,
103
+ Crystal_of_letters_type_E6_element,
104
+ element_print_style)
105
+ else:
106
+ return ClassicalCrystalOfLetters(ct,
107
+ Crystal_of_letters_type_E6_element_dual,
108
+ element_print_style, dual=True)
109
+ elif ct.letter == 'E' and ct.rank() == 7:
110
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_E7_element)
111
+ elif ct.letter == 'E' and ct.rank() == 8 or ct.letter == 'F':
112
+ return ClassicalCrystalOfLettersWrapped(ct)
113
+ elif ct.letter == 'G':
114
+ return ClassicalCrystalOfLetters(ct, Crystal_of_letters_type_G_element)
115
+ elif ct.letter == 'Q':
116
+ return CrystalOfQueerLetters(ct)
117
+ else:
118
+ raise NotImplementedError
119
+
120
+
121
+ class ClassicalCrystalOfLetters(UniqueRepresentation, Parent):
122
+ r"""
123
+ A generic class for classical crystals of letters.
124
+
125
+ All classical crystals of letters should be instances of this class
126
+ or of subclasses. To define a new crystal of letters, one only
127
+ needs to implement a class for the elements (which subclasses
128
+ :class:`~sage.combinat.crystals.Letter`), with appropriate
129
+ `e_i` and `f_i` operations. If the module generator is not `1`, one also
130
+ needs to define the subclass
131
+ :class:`~sage.combinat.crystals.letters.ClassicalCrystalOfLetters` for the
132
+ crystal itself.
133
+
134
+ The basic assumption is that crystals of letters are small, but
135
+ used intensively as building blocks. Therefore, we explicitly build
136
+ in memory the list of all elements, the crystal graph and its
137
+ transitive closure, so as to make the following operations constant
138
+ time: ``list``, ``cmp``, (todo: ``phi``, ``epsilon``, ``e``, and
139
+ ``f`` with caching)
140
+ """
141
+ def __init__(self, cartan_type, element_class,
142
+ element_print_style=None, dual=None):
143
+ """
144
+ EXAMPLES::
145
+
146
+ sage: C = crystals.Letters(['A',5])
147
+ sage: C.category()
148
+ Category of classical crystals
149
+ sage: TestSuite(C).run()
150
+ """
151
+ self.Element = element_class
152
+ Parent.__init__(self, category=ClassicalCrystals())
153
+ self._cartan_type = CartanType(cartan_type)
154
+ self.rename("The crystal of letters for type %s" % self._cartan_type)
155
+ if cartan_type.type() == 'E':
156
+ if cartan_type.rank() == 6:
157
+ if dual:
158
+ self.module_generators = (self._element_constructor_((6,)),)
159
+ self._ambient = CrystalOfLetters(CartanType(['E',6]))
160
+ self.rename("%s (dual)" % self)
161
+ else:
162
+ self.module_generators = (self._element_constructor_((1,)),)
163
+ elif cartan_type.rank() == 7:
164
+ self.module_generators = (self._element_constructor_((7,)),)
165
+ elif cartan_type.rank() == 8:
166
+ from sage.combinat.crystals.monomial_crystals import CrystalOfNakajimaMonomials
167
+ from sage.combinat.root_system.root_system import RootSystem
168
+ la = RootSystem(cartan_type).weight_lattice().fundamental_weight(8)
169
+ C = CrystalOfNakajimaMonomials(cartan_type, la)
170
+ hw = C.highest_weight_vector()
171
+ self.module_generators = (self._element_constructor_(hw),)
172
+ self._list = list(super(ClassicalCrystalOfLetters, self).__iter__())
173
+ elif cartan_type.type() == 'F':
174
+ from sage.combinat.crystals.monomial_crystals import CrystalOfNakajimaMonomials
175
+ from sage.combinat.root_system.root_system import RootSystem
176
+ la = RootSystem(cartan_type).weight_lattice().fundamental_weight(1)
177
+ C = CrystalOfNakajimaMonomials(cartan_type, la)
178
+ hw = C.highest_weight_vector()
179
+ self.module_generators = (self._element_constructor_(hw),)
180
+ self._list = list(super(ClassicalCrystalOfLetters, self).__iter__())
181
+ else:
182
+ self.module_generators = (self._element_constructor_(1),)
183
+ if cartan_type.type() == 'G':
184
+ self._list = [self._element_constructor_(1),
185
+ self._element_constructor_(2),
186
+ self._element_constructor_(3),
187
+ self._element_constructor_(0),
188
+ self._element_constructor_(-3),
189
+ self._element_constructor_(-2),
190
+ self._element_constructor_(-1)]
191
+ else:
192
+ self._list = [self._element_constructor_(i)
193
+ for i in range(1, cartan_type.rank() + 1)]
194
+ if cartan_type.type() == 'B':
195
+ self._list.append(self._element_constructor_(0))
196
+ if cartan_type.type() != 'A':
197
+ self._list += [self._element_constructor_(-i)
198
+ for i in range(cartan_type.rank(), 0, -1)]
199
+ else:
200
+ self._list.append(self._element_constructor_(cartan_type.rank() + 1))
201
+ self._element_print_style = element_print_style
202
+
203
+ def __call__(self, value):
204
+ """
205
+ Parse input to valid values to give to ``_element_constructor_()``.
206
+
207
+ EXAMPLES::
208
+
209
+ sage: C = crystals.Letters(['E',6])
210
+ sage: c = C((1,))
211
+ sage: C([1]) == c
212
+ True
213
+ """
214
+ if value.__class__ == self.element_class and value.parent() is self:
215
+ return value
216
+ if isinstance(value, list):
217
+ return self._element_constructor_(tuple(value))
218
+ return self._element_constructor_(value)
219
+
220
+ @cached_method
221
+ def _element_constructor_(self, value):
222
+ """
223
+ Convert ``value`` into an element of ``self``.
224
+
225
+ EXAMPLES::
226
+
227
+ sage: C = crystals.Letters(['A',5])
228
+ sage: c = C(1); c
229
+ 1
230
+ sage: c.parent()
231
+ The crystal of letters for type ['A', 5]
232
+ sage: c is C(c)
233
+ True
234
+ """
235
+ if value == 'E':
236
+ return EmptyLetter(self)
237
+ else: # Should do sanity checks!
238
+ return self.element_class(self, value)
239
+
240
+ def __iter__(self):
241
+ """
242
+ Iterate through ``self``.
243
+
244
+ EXAMPLES::
245
+
246
+ sage: C = crystals.Letters(['A',5])
247
+ sage: [x for x in C]
248
+ [1, 2, 3, 4, 5, 6]
249
+ """
250
+ return iter(self._list)
251
+
252
+ def list(self):
253
+ """
254
+ Return a list of the elements of ``self``.
255
+
256
+ EXAMPLES::
257
+
258
+ sage: C = crystals.Letters(['A',5])
259
+ sage: C.list()
260
+ [1, 2, 3, 4, 5, 6]
261
+ """
262
+ return self._list
263
+
264
+ @lazy_attribute
265
+ def _digraph_closure(self):
266
+ """
267
+ The transitive closure of the directed graph associated to ``self``.
268
+
269
+ EXAMPLES::
270
+
271
+ sage: crystals.Letters(['A',5])._digraph_closure
272
+ Transitive closure of : Digraph on 6 vertices
273
+ """
274
+ return self.digraph().transitive_closure()
275
+
276
+ def __contains__(self, x):
277
+ """
278
+ EXAMPLES::
279
+
280
+ sage: C = crystals.Letters(['A',5])
281
+ sage: 1 in C
282
+ False
283
+ sage: C(1) in C
284
+ True
285
+ """
286
+ return x in self._list
287
+
288
+ def lt_elements(self, x, y):
289
+ r"""
290
+ Return ``True`` if and only if there is a path from ``x`` to ``y`` in
291
+ the crystal graph, when ``x`` is not equal to ``y``.
292
+
293
+ Because the crystal graph is classical, it is a directed acyclic
294
+ graph which can be interpreted as a poset. This function implements
295
+ the comparison function of this poset.
296
+
297
+ EXAMPLES::
298
+
299
+ sage: C = crystals.Letters(['A', 5])
300
+ sage: x = C(1)
301
+ sage: y = C(2)
302
+ sage: C.lt_elements(x,y)
303
+ True
304
+ sage: C.lt_elements(y,x)
305
+ False
306
+ sage: C.lt_elements(x,x)
307
+ False
308
+ sage: C = crystals.Letters(['D', 4])
309
+ sage: C.lt_elements(C(4),C(-4))
310
+ False
311
+ sage: C.lt_elements(C(-4),C(4))
312
+ False
313
+ """
314
+ if x.parent() is not self or y.parent() is not self:
315
+ raise ValueError("Cannot compare elements of different parents")
316
+ if self._digraph_closure.has_edge(x,y):
317
+ return True
318
+ return False
319
+
320
+ # temporary workaround while an_element is overridden by Parent
321
+ _an_element_ = EnumeratedSets.ParentMethods._an_element_
322
+
323
+
324
+ # Utility. Note: much of this class should be factored out at some point!
325
+ cdef class Letter(Element):
326
+ r"""
327
+ A class for letters.
328
+
329
+ Like :class:`ElementWrapper`, plus delegates ``__lt__`` (comparison)
330
+ to the parent.
331
+
332
+ EXAMPLES::
333
+
334
+ sage: from sage.combinat.crystals.letters import Letter
335
+ sage: a = Letter(ZZ, 1)
336
+ sage: Letter(ZZ, 1).parent()
337
+ Integer Ring
338
+
339
+ sage: Letter(ZZ, 1)._repr_()
340
+ '1'
341
+
342
+ sage: parent1 = ZZ # Any fake value ...
343
+ sage: parent2 = QQ # Any fake value ...
344
+ sage: l11 = Letter(parent1, 1)
345
+ sage: l12 = Letter(parent1, 2)
346
+ sage: l21 = Letter(parent2, 1)
347
+ sage: l22 = Letter(parent2, 2)
348
+ sage: l11 == l11
349
+ True
350
+ sage: l11 == l12
351
+ False
352
+ sage: l11 == l21 # not tested
353
+ False
354
+
355
+ sage: C = crystals.Letters(['B', 3])
356
+ sage: C(0) != C(0)
357
+ False
358
+ sage: C(1) != C(-1)
359
+ True
360
+ """
361
+ def __init__(self, parent, int value):
362
+ """
363
+ EXAMPLES::
364
+
365
+ sage: C = crystals.Letters(['B',4])
366
+ sage: a = C(3)
367
+ sage: TestSuite(a).run()
368
+ """
369
+ self.value = value
370
+ Element.__init__(self, parent)
371
+
372
+ def __setstate__(self, state):
373
+ r"""
374
+ Used in unpickling old pickles.
375
+
376
+ EXAMPLES::
377
+
378
+ sage: C = crystals.Letters(['B',4])
379
+ sage: a = C(3)
380
+ sage: loads(dumps(a)) == a
381
+ True
382
+ """
383
+ P, D = state
384
+ if P is not None:
385
+ self._parent = P
386
+ self.value = D['value']
387
+
388
+ def __reduce__(self):
389
+ r"""
390
+ Used in pickling crystal of letters elements.
391
+
392
+ EXAMPLES::
393
+
394
+ sage: C = crystals.Letters(['A',3])
395
+ sage: a = C(1)
396
+ sage: a.__reduce__()
397
+ (The crystal of letters for type ['A', 3], (1,))
398
+ """
399
+ return (self._parent, (self.value,))
400
+
401
+ def _repr_(self):
402
+ """
403
+ Return a string representation of ``self``.
404
+
405
+ EXAMPLES::
406
+
407
+ sage: C = crystals.Letters(['B', 3])
408
+ sage: C(0)
409
+ 0
410
+ sage: C(1)
411
+ 1
412
+ sage: C(-1)
413
+ -1
414
+ """
415
+ return repr(self.value)
416
+
417
+ def _latex_(self):
418
+ r"""
419
+ A latex representation of ``self``.
420
+
421
+ EXAMPLES::
422
+
423
+ sage: C = crystals.Letters(['D', 4])
424
+ sage: latex(C(2))
425
+ 2
426
+ sage: latex(C(-3))
427
+ \overline{3}
428
+ """
429
+ if self.value < 0:
430
+ return "\\overline{" + repr(-self.value) + "}"
431
+ return repr(self.value)
432
+
433
+ def _unicode_art_(self):
434
+ r"""
435
+ A unicode art representation of ``self``.
436
+
437
+ EXAMPLES::
438
+
439
+ sage: C = crystals.Letters(['D', 4])
440
+ sage: unicode_art(C(2))
441
+ 2
442
+ sage: unicode_art(C(-3))
443
+
444
+
445
+ sage: C = crystals.Letters(['D',12])
446
+ sage: unicode_art(C(12))
447
+ 12
448
+ sage: unicode_art(C(-11))
449
+ 1̄1̄
450
+ """
451
+ from sage.typeset.unicode_art import UnicodeArt
452
+ if self.value < 0:
453
+ return UnicodeArt(["".join(let + u"̄" for let in unicode(-self.value))])
454
+ return UnicodeArt([unicode(self.value)])
455
+
456
+ def __hash__(self):
457
+ """
458
+ Return the hash value of ``self``.
459
+
460
+ EXAMPLES::
461
+
462
+ sage: C = crystals.Letters(['D', 4])
463
+ sage: hash(C(4)) == hash(4)
464
+ True
465
+ """
466
+ return self.value
467
+
468
+ cpdef _richcmp_(left, right, int op):
469
+ """
470
+ Return ``True`` if ``left`` compares with ``right`` based on ``op``.
471
+
472
+ EXAMPLES::
473
+
474
+ sage: C = crystals.Letters(['D', 4])
475
+ sage: C(4) > C(-4) # indirect doctest
476
+ False
477
+ sage: C(4) < C(-3)
478
+ True
479
+ sage: C(4) == C(4)
480
+ True
481
+
482
+ TESTS::
483
+
484
+ sage: C = crystals.Letters(['C', 3])
485
+ sage: C('E') == C(2)
486
+ False
487
+ sage: C(2) == C('E')
488
+ False
489
+ sage: C('E') == C('E')
490
+ True
491
+ """
492
+ # Special case for the empty letter
493
+ if isinstance(left, EmptyLetter):
494
+ return isinstance(right, EmptyLetter) \
495
+ and (op == Py_EQ or op == Py_LE or op == Py_GE)
496
+ if isinstance(right, EmptyLetter):
497
+ return op == Py_NE
498
+
499
+ cdef Letter self, x
500
+ self = left
501
+ x = right
502
+ if op == Py_EQ:
503
+ return self.value == x.value
504
+ if op == Py_NE:
505
+ return self.value != x.value
506
+ if op == Py_LT:
507
+ return self._parent.lt_elements(self, x)
508
+ if op == Py_GT:
509
+ return x._parent.lt_elements(x, self)
510
+ if op == Py_LE:
511
+ return self.value == x.value or self._parent.lt_elements(self, x)
512
+ if op == Py_GE:
513
+ return self.value == x.value or x._parent.lt_elements(x, self)
514
+ return False
515
+
516
+
517
+ cdef class EmptyLetter(Element):
518
+ r"""
519
+ The affine letter `\emptyset` thought of as a classical crystal letter
520
+ in classical type `B_n` and `C_n`.
521
+
522
+ .. WARNING::
523
+
524
+ This is not a classical letter.
525
+
526
+ Used in the rigged configuration bijections.
527
+ """
528
+ def __init__(self, parent):
529
+ """
530
+ Initialize ``self``.
531
+
532
+ EXAMPLES::
533
+
534
+ sage: C = crystals.Letters(['C', 3])
535
+ sage: TestSuite(C('E')).run()
536
+ """
537
+ self.value = 'E'
538
+ Element.__init__(self, parent)
539
+
540
+ def __reduce__(self):
541
+ r"""
542
+ Used in pickling crystal of letters elements.
543
+
544
+ EXAMPLES::
545
+
546
+ sage: C = crystals.Letters(['C',3])
547
+ sage: a = C('E')
548
+ sage: a.__reduce__()
549
+ (The crystal of letters for type ['C', 3], ('E',))
550
+ """
551
+ return (self._parent, ('E',))
552
+
553
+ def _repr_(self):
554
+ """
555
+ Return a string representation of ``self``.
556
+
557
+ EXAMPLES::
558
+
559
+ sage: C = crystals.Letters(['C', 3])
560
+ sage: C('E')
561
+ E
562
+ """
563
+ return 'E'
564
+
565
+ def _latex_(self):
566
+ r"""
567
+ Return a latex representation of ``self``.
568
+
569
+ EXAMPLES::
570
+
571
+ sage: C = crystals.Letters(['C', 3])
572
+ sage: latex(C('E'))
573
+ \emptyset
574
+ """
575
+ return "\\emptyset"
576
+
577
+ def __hash__(self):
578
+ """
579
+ Return the hash value of ``self``.
580
+
581
+ EXAMPLES::
582
+
583
+ sage: C = crystals.Letters(['D', 4])
584
+ sage: hash(C('E')) == hash('E')
585
+ True
586
+ """
587
+ return hash(self.value)
588
+
589
+ cpdef _richcmp_(left, right, int op):
590
+ """
591
+ Return ``True`` if ``left`` compares with ``right`` based on ``op``.
592
+
593
+ EXAMPLES::
594
+
595
+ sage: C = crystals.Letters(['C', 3])
596
+ sage: C('E') == C(2)
597
+ False
598
+ sage: C('E') < C(2)
599
+ False
600
+ sage: C('E') <= C(2)
601
+ False
602
+ sage: C('E') != C(2)
603
+ True
604
+ sage: C('E') == C('E')
605
+ True
606
+ sage: C('E') != C('E')
607
+ False
608
+ sage: C('E') >= C('E')
609
+ True
610
+ sage: C('E') < C('E')
611
+ False
612
+ """
613
+ if isinstance(left, EmptyLetter) and isinstance(right, EmptyLetter):
614
+ return op == Py_EQ or op == Py_LE or op == Py_GE
615
+ return op == Py_NE
616
+
617
+ def weight(self):
618
+ """
619
+ Return the weight of ``self``.
620
+
621
+ EXAMPLES::
622
+
623
+ sage: C = crystals.Letters(['C', 3])
624
+ sage: C('E').weight()
625
+ (0, 0, 0)
626
+ """
627
+ return self._parent.weight_lattice_realization().zero()
628
+
629
+ cpdef e(self, int i):
630
+ """
631
+ Return `e_i` of ``self`` which is ``None``.
632
+
633
+ EXAMPLES::
634
+
635
+ sage: C = crystals.Letters(['C', 3])
636
+ sage: C('E').e(1)
637
+ """
638
+ return None
639
+
640
+ cpdef f(self, int i):
641
+ """
642
+ Return `f_i` of ``self`` which is ``None``.
643
+
644
+ EXAMPLES::
645
+
646
+ sage: C = crystals.Letters(['C', 3])
647
+ sage: C('E').f(1)
648
+ """
649
+ return None
650
+
651
+ cpdef int epsilon(self, int i) noexcept:
652
+ r"""
653
+ Return `\varepsilon_i` of ``self``.
654
+
655
+ EXAMPLES::
656
+
657
+ sage: C = crystals.Letters(['C', 3])
658
+ sage: C('E').epsilon(1)
659
+ 0
660
+ """
661
+ return 0
662
+
663
+ cpdef int phi(self, int i) noexcept:
664
+ r"""
665
+ Return `\varphi_i` of ``self``.
666
+
667
+ EXAMPLES::
668
+
669
+ sage: C = crystals.Letters(['C', 3])
670
+ sage: C('E').phi(1)
671
+ 0
672
+ """
673
+ return 0
674
+
675
+ #########################
676
+ # Type A
677
+ #########################
678
+
679
+ cdef class Crystal_of_letters_type_A_element(Letter):
680
+ r"""
681
+ Type `A` crystal of letters elements.
682
+
683
+ TESTS::
684
+
685
+ sage: C = crystals.Letters(['A',3])
686
+ sage: C.list()
687
+ [1, 2, 3, 4]
688
+ sage: [ [x < y for y in C] for x in C ]
689
+ [[False, True, True, True],
690
+ [False, False, True, True],
691
+ [False, False, False, True],
692
+ [False, False, False, False]]
693
+
694
+ ::
695
+
696
+ sage: C = crystals.Letters(['A',5])
697
+ sage: C(1) < C(1), C(1) < C(2), C(1) < C(3), C(2) < C(1)
698
+ (False, True, True, False)
699
+
700
+ ::
701
+
702
+ sage: TestSuite(C).run()
703
+ """
704
+ def weight(self):
705
+ """
706
+ Return the weight of ``self``.
707
+
708
+ EXAMPLES::
709
+
710
+ sage: [v.weight() for v in crystals.Letters(['A',3])]
711
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)]
712
+ """
713
+ return self._parent.weight_lattice_realization().monomial(self.value-1)
714
+
715
+ cpdef Letter e(self, int i):
716
+ r"""
717
+ Return the action of `e_i` on ``self``.
718
+
719
+ EXAMPLES::
720
+
721
+ sage: C = crystals.Letters(['A',4])
722
+ sage: [(c,i,c.e(i)) for i in C.index_set() for c in C if c.e(i) is not None]
723
+ [(2, 1, 1), (3, 2, 2), (4, 3, 3), (5, 4, 4)]
724
+ """
725
+ if self.value == i+1:
726
+ return self._parent._element_constructor_(self.value-1)
727
+ else:
728
+ return None
729
+
730
+ cpdef Letter f(self, int i):
731
+ r"""
732
+ Return the action of `f_i` on ``self``.
733
+
734
+ EXAMPLES::
735
+
736
+ sage: C = crystals.Letters(['A',4])
737
+ sage: [(c,i,c.f(i)) for i in C.index_set() for c in C if c.f(i) is not None]
738
+ [(1, 1, 2), (2, 2, 3), (3, 3, 4), (4, 4, 5)]
739
+ """
740
+ if self.value == i:
741
+ return self._parent._element_constructor_(self.value+1)
742
+ else:
743
+ return None
744
+
745
+ cpdef int epsilon(self, int i) noexcept:
746
+ r"""
747
+ Return `\varepsilon_i` of ``self``.
748
+
749
+ EXAMPLES::
750
+
751
+ sage: C = crystals.Letters(['A',4])
752
+ sage: [(c,i) for i in C.index_set() for c in C if c.epsilon(i) != 0]
753
+ [(2, 1), (3, 2), (4, 3), (5, 4)]
754
+ """
755
+ if self.value == i+1:
756
+ return 1
757
+ return 0
758
+
759
+ cpdef int phi(self, int i) noexcept:
760
+ r"""
761
+ Return `\varphi_i` of ``self``.
762
+
763
+ EXAMPLES::
764
+
765
+ sage: C = crystals.Letters(['A',4])
766
+ sage: [(c,i) for i in C.index_set() for c in C if c.phi(i) != 0]
767
+ [(1, 1), (2, 2), (3, 3), (4, 4)]
768
+ """
769
+ if self.value == i:
770
+ return 1
771
+ return 0
772
+
773
+ #########################
774
+ # Type B
775
+ #########################
776
+
777
+ cdef class Crystal_of_letters_type_B_element(Letter):
778
+ r"""
779
+ Type `B` crystal of letters elements.
780
+
781
+ TESTS::
782
+
783
+ sage: C = crystals.Letters(['B',3])
784
+ sage: TestSuite(C).run()
785
+ """
786
+ def weight(self):
787
+ """
788
+ Return the weight of ``self``.
789
+
790
+ EXAMPLES::
791
+
792
+ sage: [v.weight() for v in crystals.Letters(['B',3])]
793
+ [(1, 0, 0),
794
+ (0, 1, 0),
795
+ (0, 0, 1),
796
+ (0, 0, 0),
797
+ (0, 0, -1),
798
+ (0, -1, 0),
799
+ (-1, 0, 0)]
800
+ """
801
+ if self.value > 0:
802
+ return self._parent.weight_lattice_realization().monomial(self.value-1)
803
+ elif self.value < 0:
804
+ return -self._parent.weight_lattice_realization().monomial(-self.value-1)
805
+ else:
806
+ return self._parent.weight_lattice_realization()(0)
807
+
808
+ cpdef Letter e(self, int i):
809
+ r"""
810
+ Return the action of `e_i` on ``self``.
811
+
812
+ EXAMPLES::
813
+
814
+ sage: C = crystals.Letters(['B',4])
815
+ sage: [(c,i,c.e(i)) for i in C.index_set() for c in C if c.e(i) is not None]
816
+ [(2, 1, 1),
817
+ (-1, 1, -2),
818
+ (3, 2, 2),
819
+ (-2, 2, -3),
820
+ (4, 3, 3),
821
+ (-3, 3, -4),
822
+ (0, 4, 4),
823
+ (-4, 4, 0)]
824
+ """
825
+ if self.value == i+1:
826
+ return self._parent._element_constructor_(i)
827
+ elif self.value == 0 and i == self._parent._cartan_type.n:
828
+ return self._parent._element_constructor_(self._parent._cartan_type.n)
829
+ elif self.value == -i:
830
+ if i == self._parent._cartan_type.n:
831
+ return self._parent._element_constructor_(0)
832
+ else:
833
+ return self._parent._element_constructor_(-i-1)
834
+ else:
835
+ return None
836
+
837
+ cpdef Letter f(self, int i):
838
+ r"""
839
+ Return the actions of `f_i` on ``self``.
840
+
841
+ EXAMPLES::
842
+
843
+ sage: C = crystals.Letters(['B',4])
844
+ sage: [(c,i,c.f(i)) for i in C.index_set() for c in C if c.f(i) is not None]
845
+ [(1, 1, 2),
846
+ (-2, 1, -1),
847
+ (2, 2, 3),
848
+ (-3, 2, -2),
849
+ (3, 3, 4),
850
+ (-4, 3, -3),
851
+ (4, 4, 0),
852
+ (0, 4, -4)]
853
+ """
854
+ if self.value == i:
855
+ if i < self._parent._cartan_type.n:
856
+ return self._parent._element_constructor_(i+1)
857
+ else:
858
+ return self._parent._element_constructor_(0)
859
+ elif self.value == 0 and i == self._parent._cartan_type.n:
860
+ return self._parent._element_constructor_(-self._parent._cartan_type.n)
861
+ elif self.value == -i-1:
862
+ return self._parent._element_constructor_(-i)
863
+ else:
864
+ return None
865
+
866
+ cpdef int epsilon(self, int i) noexcept:
867
+ r"""
868
+ Return `\varepsilon_i` of ``self``.
869
+
870
+ EXAMPLES::
871
+
872
+ sage: C = crystals.Letters(['B',3])
873
+ sage: [(c,i) for i in C.index_set() for c in C if c.epsilon(i) != 0]
874
+ [(2, 1), (-1, 1), (3, 2), (-2, 2), (0, 3), (-3, 3)]
875
+ """
876
+ cdef int n = self._parent._cartan_type.n
877
+ if self.value == 0:
878
+ if i == n:
879
+ return 1
880
+ return 0
881
+ if i == n and self.value == -n:
882
+ return 2
883
+ if self.value == i+1 or self.value == -i:
884
+ return 1
885
+ return 0
886
+
887
+ cpdef int phi(self, int i) noexcept:
888
+ r"""
889
+ Return `\varphi_i` of ``self``.
890
+
891
+ EXAMPLES::
892
+
893
+ sage: C = crystals.Letters(['B',3])
894
+ sage: [(c,i) for i in C.index_set() for c in C if c.phi(i) != 0]
895
+ [(1, 1), (-2, 1), (2, 2), (-3, 2), (3, 3), (0, 3)]
896
+ """
897
+ cdef int n = self._parent._cartan_type.n
898
+ if self.value == 0:
899
+ if i == n:
900
+ return 1
901
+ return 0
902
+ if i == n and self.value == n:
903
+ return 2
904
+ if self.value == i or self.value == -i-1:
905
+ return 1
906
+ return 0
907
+
908
+ #########################
909
+ # Type C
910
+ #########################
911
+
912
+ cdef class Crystal_of_letters_type_C_element(Letter):
913
+ r"""
914
+ Type `C` crystal of letters elements.
915
+
916
+ TESTS::
917
+
918
+ sage: C = crystals.Letters (['C',3])
919
+ sage: C.list()
920
+ [1, 2, 3, -3, -2, -1]
921
+ sage: [ [x < y for y in C] for x in C ]
922
+ [[False, True, True, True, True, True],
923
+ [False, False, True, True, True, True],
924
+ [False, False, False, True, True, True],
925
+ [False, False, False, False, True, True],
926
+ [False, False, False, False, False, True],
927
+ [False, False, False, False, False, False]]
928
+ sage: TestSuite(C).run()
929
+ """
930
+ def weight(self):
931
+ """
932
+ Return the weight of ``self``.
933
+
934
+ EXAMPLES::
935
+
936
+ sage: [v.weight() for v in crystals.Letters(['C',3])]
937
+ [(1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 0, -1), (0, -1, 0), (-1, 0, 0)]
938
+ """
939
+ if self.value > 0:
940
+ return self._parent.weight_lattice_realization().monomial(self.value-1)
941
+ elif self.value < 0:
942
+ return -self._parent.weight_lattice_realization().monomial(-self.value-1)
943
+ else:
944
+ return self._parent.weight_lattice_realization()(0)
945
+
946
+ cpdef Letter e(self, int i):
947
+ r"""
948
+ Return the action of `e_i` on ``self``.
949
+
950
+ EXAMPLES::
951
+
952
+ sage: C = crystals.Letters(['C',4])
953
+ sage: [(c,i,c.e(i)) for i in C.index_set() for c in C if c.e(i) is not None]
954
+ [(2, 1, 1),
955
+ (-1, 1, -2),
956
+ (3, 2, 2),
957
+ (-2, 2, -3),
958
+ (4, 3, 3),
959
+ (-3, 3, -4),
960
+ (-4, 4, 4)]
961
+ """
962
+ if self.value == -self._parent._cartan_type.n and self.value == -i:
963
+ return self._parent._element_constructor_(-self.value)
964
+ elif self.value == i+1 or self.value == -i:
965
+ return self._parent._element_constructor_(self.value-1)
966
+ else:
967
+ return None
968
+
969
+ cpdef Letter f(self, int i):
970
+ r"""
971
+ Return the action of `f_i` on ``self``.
972
+
973
+ EXAMPLES::
974
+
975
+ sage: C = crystals.Letters(['C',4])
976
+ sage: [(c,i,c.f(i)) for i in C.index_set() for c in C if c.f(i) is not None]
977
+ [(1, 1, 2), (-2, 1, -1), (2, 2, 3),
978
+ (-3, 2, -2), (3, 3, 4), (-4, 3, -3), (4, 4, -4)]
979
+ """
980
+ if self.value == self._parent._cartan_type.n and self.value == i:
981
+ return self._parent._element_constructor_(-self.value)
982
+ elif self.value == i or self.value == -i-1:
983
+ return self._parent._element_constructor_(self.value+1)
984
+ else:
985
+ return None
986
+
987
+ cpdef int epsilon(self, int i) noexcept:
988
+ r"""
989
+ Return `\varepsilon_i` of ``self``.
990
+
991
+ EXAMPLES::
992
+
993
+ sage: C = crystals.Letters(['C',3])
994
+ sage: [(c,i) for i in C.index_set() for c in C if c.epsilon(i) != 0]
995
+ [(2, 1), (-1, 1), (3, 2), (-2, 2), (-3, 3)]
996
+ """
997
+ if self.value == i+1 or self.value == -i:
998
+ return 1
999
+ return 0
1000
+
1001
+ cpdef int phi(self, int i) noexcept:
1002
+ r"""
1003
+ Return `\varphi_i` of ``self``.
1004
+
1005
+ EXAMPLES::
1006
+
1007
+ sage: C = crystals.Letters(['C',3])
1008
+ sage: [(c,i) for i in C.index_set() for c in C if c.phi(i) != 0]
1009
+ [(1, 1), (-2, 1), (2, 2), (-3, 2), (3, 3)]
1010
+ """
1011
+ if self.value == i or self.value == -i-1:
1012
+ return 1
1013
+ return 0
1014
+
1015
+ #########################
1016
+ # Type D
1017
+ #########################
1018
+
1019
+ cdef class Crystal_of_letters_type_D_element(Letter):
1020
+ r"""
1021
+ Type `D` crystal of letters elements.
1022
+
1023
+ TESTS::
1024
+
1025
+ sage: C = crystals.Letters(['D',4])
1026
+ sage: C.list()
1027
+ [1, 2, 3, 4, -4, -3, -2, -1]
1028
+ sage: TestSuite(C).run()
1029
+ """
1030
+ def weight(self):
1031
+ """
1032
+ Return the weight of ``self``.
1033
+
1034
+ EXAMPLES::
1035
+
1036
+ sage: [v.weight() for v in crystals.Letters(['D',4])]
1037
+ [(1, 0, 0, 0),
1038
+ (0, 1, 0, 0),
1039
+ (0, 0, 1, 0),
1040
+ (0, 0, 0, 1),
1041
+ (0, 0, 0, -1),
1042
+ (0, 0, -1, 0),
1043
+ (0, -1, 0, 0),
1044
+ (-1, 0, 0, 0)]
1045
+ """
1046
+ if self.value > 0:
1047
+ return self._parent.weight_lattice_realization().monomial(self.value-1)
1048
+ elif self.value < 0:
1049
+ return -self._parent.weight_lattice_realization().monomial(-self.value-1)
1050
+ else:
1051
+ return self._parent.weight_lattice_realization()(0)
1052
+
1053
+ cpdef Letter e(self, int i):
1054
+ r"""
1055
+ Return the action of `e_i` on ``self``.
1056
+
1057
+ EXAMPLES::
1058
+
1059
+ sage: C = crystals.Letters(['D',5])
1060
+ sage: [(c,i,c.e(i)) for i in C.index_set() for c in C if c.e(i) is not None]
1061
+ [(2, 1, 1),
1062
+ (-1, 1, -2),
1063
+ (3, 2, 2),
1064
+ (-2, 2, -3),
1065
+ (4, 3, 3),
1066
+ (-3, 3, -4),
1067
+ (5, 4, 4),
1068
+ (-4, 4, -5),
1069
+ (-5, 5, 4),
1070
+ (-4, 5, 5)]
1071
+ """
1072
+ if i == self._parent._cartan_type.n:
1073
+ if self.value == -i:
1074
+ return self._parent._element_constructor_(i-1)
1075
+ elif self.value == -(i-1):
1076
+ return self._parent._element_constructor_(i)
1077
+ else:
1078
+ return None
1079
+ elif self.value == i+1:
1080
+ return self._parent._element_constructor_(i)
1081
+ elif self.value == -i:
1082
+ return self._parent._element_constructor_(-(i+1))
1083
+ else:
1084
+ return None
1085
+
1086
+ cpdef Letter f(self, int i):
1087
+ r"""
1088
+ Return the action of `f_i` on ``self``.
1089
+
1090
+ EXAMPLES::
1091
+
1092
+ sage: C = crystals.Letters(['D',5])
1093
+ sage: [(c,i,c.f(i)) for i in C.index_set() for c in C if c.f(i) is not None]
1094
+ [(1, 1, 2),
1095
+ (-2, 1, -1),
1096
+ (2, 2, 3),
1097
+ (-3, 2, -2),
1098
+ (3, 3, 4),
1099
+ (-4, 3, -3),
1100
+ (4, 4, 5),
1101
+ (-5, 4, -4),
1102
+ (4, 5, -5),
1103
+ (5, 5, -4)]
1104
+ """
1105
+ if i == self.value:
1106
+ if i == self._parent._cartan_type.n:
1107
+ return self._parent._element_constructor_(-(i-1))
1108
+ else:
1109
+ return self._parent._element_constructor_(i+1)
1110
+ elif self.value == -(i+1):
1111
+ return self._parent._element_constructor_(-i)
1112
+ elif self.value == self._parent._cartan_type.n-1 and i == self.value+1:
1113
+ return self._parent._element_constructor_(-i)
1114
+ else:
1115
+ return None
1116
+
1117
+ cpdef int epsilon(self, int i) noexcept:
1118
+ r"""
1119
+ Return `\varepsilon_i` of ``self``.
1120
+
1121
+ EXAMPLES::
1122
+
1123
+ sage: C = crystals.Letters(['D',4])
1124
+ sage: [(c,i) for i in C.index_set() for c in C if c.epsilon(i) != 0]
1125
+ [(2, 1), (-1, 1), (3, 2), (-2, 2), (4, 3), (-3, 3), (-4, 4), (-3, 4)]
1126
+ """
1127
+ if self.value == i+1 or self.value == -i:
1128
+ return 1
1129
+ cdef int n = self._parent._cartan_type.n
1130
+ if i == n and self.value == -n+1:
1131
+ return 1
1132
+ return 0
1133
+
1134
+ cpdef int phi(self, int i) noexcept:
1135
+ r"""
1136
+ Return `\varphi_i` of ``self``.
1137
+
1138
+ EXAMPLES::
1139
+
1140
+ sage: C = crystals.Letters(['D',4])
1141
+ sage: [(c,i) for i in C.index_set() for c in C if c.phi(i) != 0]
1142
+ [(1, 1), (-2, 1), (2, 2), (-3, 2), (3, 3), (-4, 3), (3, 4), (4, 4)]
1143
+ """
1144
+ if self.value == i or self.value == -i-1:
1145
+ return 1
1146
+ cdef int n = self._parent._cartan_type.n
1147
+ if i == n and self.value == n-1:
1148
+ return 1
1149
+ return 0
1150
+
1151
+ #########################
1152
+ # Type G2
1153
+ #########################
1154
+
1155
+ cdef class Crystal_of_letters_type_G_element(Letter):
1156
+ r"""
1157
+ Type `G_2` crystal of letters elements.
1158
+
1159
+ TESTS::
1160
+
1161
+ sage: C = crystals.Letters(['G',2])
1162
+ sage: C.list()
1163
+ [1, 2, 3, 0, -3, -2, -1]
1164
+ sage: TestSuite(C).run()
1165
+ """
1166
+ def weight(self):
1167
+ """
1168
+ Return the weight of ``self``.
1169
+
1170
+ EXAMPLES::
1171
+
1172
+ sage: [v.weight() for v in crystals.Letters(['G',2])]
1173
+ [(1, 0, -1), (1, -1, 0), (0, 1, -1), (0, 0, 0), (0, -1, 1), (-1, 1, 0), (-1, 0, 1)]
1174
+ """
1175
+ if self.value == 1:
1176
+ return self._parent.weight_lattice_realization()((1, 0, -1))
1177
+ elif self.value == 2:
1178
+ return self._parent.weight_lattice_realization()((1, -1, 0))
1179
+ elif self.value == 3:
1180
+ return self._parent.weight_lattice_realization()((0, 1, -1))
1181
+ elif self.value == 0:
1182
+ return self._parent.weight_lattice_realization()((0, 0, 0))
1183
+ elif self.value == -3:
1184
+ return self._parent.weight_lattice_realization()((0, -1, 1))
1185
+ elif self.value == -2:
1186
+ return self._parent.weight_lattice_realization()((-1, 1, 0))
1187
+ elif self.value == -1:
1188
+ return self._parent.weight_lattice_realization()((-1, 0, 1))
1189
+ else:
1190
+ raise RuntimeError("G2 crystal of letters element %d not valid" % self.value)
1191
+
1192
+ cpdef Letter e(self, int i):
1193
+ r"""
1194
+ Return the action of `e_i` on ``self``.
1195
+
1196
+ EXAMPLES::
1197
+
1198
+ sage: C = crystals.Letters(['G',2])
1199
+ sage: [(c,i,c.e(i)) for i in C.index_set() for c in C if c.e(i) is not None]
1200
+ [(2, 1, 1),
1201
+ (0, 1, 3),
1202
+ (-3, 1, 0),
1203
+ (-1, 1, -2),
1204
+ (3, 2, 2),
1205
+ (-2, 2, -3)]
1206
+ """
1207
+ if i == 1:
1208
+ if self.value == 2:
1209
+ return self._parent._element_constructor_(1)
1210
+ elif self.value == 0:
1211
+ return self._parent._element_constructor_(3)
1212
+ elif self.value == -3:
1213
+ return self._parent._element_constructor_(0)
1214
+ elif self.value == -1:
1215
+ return self._parent._element_constructor_(-2)
1216
+ else:
1217
+ return None
1218
+ else:
1219
+ if self.value == 3:
1220
+ return self._parent._element_constructor_(2)
1221
+ elif self.value == -2:
1222
+ return self._parent._element_constructor_(-3)
1223
+ else:
1224
+ return None
1225
+
1226
+ cpdef Letter f(self, int i):
1227
+ r"""
1228
+ Return the action of `f_i` on ``self``.
1229
+
1230
+ EXAMPLES::
1231
+
1232
+ sage: C = crystals.Letters(['G',2])
1233
+ sage: [(c,i,c.f(i)) for i in C.index_set() for c in C if c.f(i) is not None]
1234
+ [(1, 1, 2),
1235
+ (3, 1, 0),
1236
+ (0, 1, -3),
1237
+ (-2, 1, -1),
1238
+ (2, 2, 3),
1239
+ (-3, 2, -2)]
1240
+ """
1241
+ if i == 1:
1242
+ if self.value == 1:
1243
+ return self._parent._element_constructor_(2)
1244
+ elif self.value == 3:
1245
+ return self._parent._element_constructor_(0)
1246
+ elif self.value == 0:
1247
+ return self._parent._element_constructor_(-3)
1248
+ elif self.value == -2:
1249
+ return self._parent._element_constructor_(-1)
1250
+ else:
1251
+ return None
1252
+ else:
1253
+ if self.value == 2:
1254
+ return self._parent._element_constructor_(3)
1255
+ elif self.value == -3:
1256
+ return self._parent._element_constructor_(-2)
1257
+ else:
1258
+ return None
1259
+
1260
+ cpdef int epsilon(self, int i) noexcept:
1261
+ r"""
1262
+ Return `\varepsilon_i` of ``self``.
1263
+
1264
+ EXAMPLES::
1265
+
1266
+ sage: C = crystals.Letters(['G',2])
1267
+ sage: [(c,i,c.epsilon(i)) for i in C.index_set() for c in C if c.epsilon(i) != 0]
1268
+ [(2, 1, 1), (0, 1, 1), (-3, 1, 2), (-1, 1, 1), (3, 2, 1), (-2, 2, 1)]
1269
+ """
1270
+ if i == 1:
1271
+ if self.value in (2,0,-1):
1272
+ return 1
1273
+ if self.value == -3:
1274
+ return 2
1275
+ return 0
1276
+ if self.value == 3 or self.value == -2: # i must be 2
1277
+ return 1
1278
+ return 0
1279
+
1280
+ cpdef int phi(self, int i) noexcept:
1281
+ r"""
1282
+ Return `\varphi_i` of ``self``.
1283
+
1284
+ EXAMPLES::
1285
+
1286
+ sage: C = crystals.Letters(['G',2])
1287
+ sage: [(c,i,c.phi(i)) for i in C.index_set() for c in C if c.phi(i) != 0]
1288
+ [(1, 1, 1), (3, 1, 2), (0, 1, 1), (-2, 1, 1), (2, 2, 1), (-3, 2, 1)]
1289
+ """
1290
+ if i == 1:
1291
+ if self.value in (1,0,-2):
1292
+ return 1
1293
+ if self.value == 3:
1294
+ return 2
1295
+ return 0
1296
+ if self.value == -3 or self.value == 2: # i must be 2
1297
+ return 1
1298
+ return 0
1299
+
1300
+ #########################
1301
+ # Type E Letter
1302
+ #########################
1303
+
1304
+ cdef class LetterTuple(Element):
1305
+ """
1306
+ Abstract class for type `E` letters.
1307
+ """
1308
+ def __init__(self, parent, tuple value):
1309
+ """
1310
+ Initialize ``self``.
1311
+
1312
+ EXAMPLES::
1313
+
1314
+ sage: C = crystals.Letters(['E',6])
1315
+ sage: a = C((1,-3))
1316
+ sage: TestSuite(a).run()
1317
+ """
1318
+ self.value = value
1319
+ Element.__init__(self, parent)
1320
+
1321
+ def __setstate__(self, state):
1322
+ r"""
1323
+ Used in unpickling old pickles.
1324
+
1325
+ EXAMPLES::
1326
+
1327
+ sage: C = crystals.Letters(['E',6])
1328
+ sage: a = C((1,-3))
1329
+ sage: loads(dumps(a)) == a
1330
+ True
1331
+ """
1332
+ P, D = state
1333
+ if P is not None:
1334
+ self._parent = P
1335
+ self.value = tuple(D['value'])
1336
+
1337
+ def __reduce__(self):
1338
+ """
1339
+ Used in pickling of letters.
1340
+
1341
+ EXAMPLES::
1342
+
1343
+ sage: C = crystals.Letters(['E',6])
1344
+ sage: a = C((1,-3))
1345
+ sage: a.__reduce__()
1346
+ (The crystal of letters for type ['E', 6], ((1, -3),))
1347
+ """
1348
+ return (self._parent, (self.value,))
1349
+
1350
+ def __hash__(self):
1351
+ """
1352
+ Return the hash value of ``self``.
1353
+
1354
+ EXAMPLES::
1355
+
1356
+ sage: C = crystals.Letters(['E', 6])
1357
+ sage: hash(C((1, -3))) == hash((1, -3))
1358
+ True
1359
+ """
1360
+ return hash(self.value)
1361
+
1362
+ cpdef _richcmp_(left, right, int op):
1363
+ """
1364
+ Check comparison between ``left`` and ``right`` based on ``op``.
1365
+
1366
+ EXAMPLES::
1367
+
1368
+ sage: C = crystals.Letters(['E', 6])
1369
+ sage: C((1,)) < C((-1, 3)) # indirect doctest
1370
+ True
1371
+ sage: C((6,)) < C((1,))
1372
+ False
1373
+ sage: C((-1, 3)) == C((-1, 3))
1374
+ True
1375
+ """
1376
+ cdef LetterTuple self, x
1377
+ self = left
1378
+ x = right
1379
+ if op == Py_EQ:
1380
+ return self.value == x.value
1381
+ if op == Py_NE:
1382
+ return self.value != x.value
1383
+ if op == Py_LT:
1384
+ return self._parent.lt_elements(self, x)
1385
+ if op == Py_GT:
1386
+ return x._parent.lt_elements(x, self)
1387
+ if op == Py_LE:
1388
+ return self.value == x.value or self._parent.lt_elements(self, x)
1389
+ if op == Py_GE:
1390
+ return self.value == x.value or x._parent.lt_elements(x, self)
1391
+ return False
1392
+
1393
+ def _repr_(self):
1394
+ """
1395
+ Return a string representation of ``self``.
1396
+
1397
+ EXAMPLES::
1398
+
1399
+ sage: C = crystals.Letters(['E', 6])
1400
+ sage: C((-1, 3))
1401
+ (-1, 3)
1402
+ """
1403
+ return repr(self.value)
1404
+
1405
+ def _unicode_art_(self):
1406
+ r"""
1407
+ A unicode art representation of ``self``.
1408
+
1409
+ EXAMPLES::
1410
+
1411
+ sage: C = crystals.Letters(['E',6])
1412
+ sage: unicode_art(C.list()[:5])
1413
+ [ (1), (1̄, 3), (3̄, 4), (4̄, 2, 5), (2̄, 5) ]
1414
+ """
1415
+ from sage.typeset.unicode_art import UnicodeArt
1416
+ return UnicodeArt([u"({})".format(u", ".join(unicode(x) if x > 0 else unicode(-x) + u"̄"
1417
+ for x in self.value))])
1418
+
1419
+ def _latex_(self):
1420
+ r"""
1421
+ A latex representation of ``self``.
1422
+
1423
+ EXAMPLES::
1424
+
1425
+ sage: C = crystals.Letters(['E', 6])
1426
+ sage: latex(C((-1, 3)))
1427
+ \left(\overline{1}, 3\right)
1428
+ """
1429
+ ret = "\\left("
1430
+ first = True
1431
+ for v in self.value:
1432
+ if not first:
1433
+ ret += ", "
1434
+ else:
1435
+ first = False
1436
+ if v < 0:
1437
+ ret += "\\overline{" + repr(-v) + "}"
1438
+ else:
1439
+ ret+= repr(v)
1440
+ return ret + "\\right)"
1441
+
1442
+ cpdef int epsilon(self, int i) noexcept:
1443
+ r"""
1444
+ Return `\varepsilon_i` of ``self``.
1445
+
1446
+ EXAMPLES::
1447
+
1448
+ sage: C = crystals.Letters(['E',6])
1449
+ sage: C((-6,)).epsilon(1)
1450
+ 0
1451
+ sage: C((-6,)).epsilon(6)
1452
+ 1
1453
+ """
1454
+ if -i in self.value:
1455
+ return 1
1456
+ return 0
1457
+
1458
+ cpdef int phi(self, int i) noexcept:
1459
+ r"""
1460
+ Return `\varphi_i` of ``self``.
1461
+
1462
+ EXAMPLES::
1463
+
1464
+ sage: C = crystals.Letters(['E',6])
1465
+ sage: C((1,)).phi(1)
1466
+ 1
1467
+ sage: C((1,)).phi(6)
1468
+ 0
1469
+ """
1470
+ if i in self.value:
1471
+ return 1
1472
+ return 0
1473
+
1474
+ #########################
1475
+ # Type E6
1476
+ #########################
1477
+
1478
+ cdef class Crystal_of_letters_type_E6_element(LetterTuple):
1479
+ r"""
1480
+ Type `E_6` crystal of letters elements. This crystal corresponds to the highest weight
1481
+ crystal `B(\Lambda_1)`.
1482
+
1483
+ TESTS::
1484
+
1485
+ sage: C = crystals.Letters(['E',6])
1486
+ sage: C.module_generators
1487
+ ((1,),)
1488
+ sage: C.list()
1489
+ [(1,), (-1, 3), (-3, 4), (-4, 2, 5), (-2, 5), (-5, 2, 6), (-2, -5, 4, 6),
1490
+ (-4, 3, 6), (-3, 1, 6), (-1, 6), (-6, 2), (-2, -6, 4), (-4, -6, 3, 5),
1491
+ (-3, -6, 1, 5), (-1, -6, 5), (-5, 3), (-3, -5, 1, 4), (-1, -5, 4), (-4, 1, 2),
1492
+ (-1, -4, 2, 3), (-3, 2), (-2, -3, 4), (-4, 5), (-5, 6), (-6,), (-2, 1), (-1, -2, 3)]
1493
+ sage: TestSuite(C).run()
1494
+ sage: all(b.f(i).e(i) == b for i in C.index_set() for b in C if b.f(i) is not None)
1495
+ True
1496
+ sage: all(b.e(i).f(i) == b for i in C.index_set() for b in C if b.e(i) is not None)
1497
+ True
1498
+ sage: G = C.digraph()
1499
+ sage: G.show(edge_labels=true, figsize=12, vertex_size=1) # needs sage.plot
1500
+ """
1501
+
1502
+ def _repr_(self):
1503
+ """
1504
+ In their full representation, the vertices of this crystal are labeled
1505
+ by their weight. For example vertex (-5,2,6) indicates that a 5-arrow
1506
+ is coming into this vertex, and a 2-arrow and 6-arrow is leaving the vertex.
1507
+ Specifying element_print_style = 'compact' for a given crystal C, labels the
1508
+ vertices of this crystal by the 27 letters +abcdefghijklmnopqrstuvwxyz.
1509
+
1510
+ EXAMPLES::
1511
+
1512
+ sage: C = crystals.Letters(['E',6], element_print_style = 'compact')
1513
+ sage: C.list()
1514
+ [+, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
1515
+ """
1516
+ if self._parent._element_print_style == 'compact':
1517
+ l=['+','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
1518
+ return l[self._parent.list().index(self)]
1519
+ return repr(self.value)
1520
+
1521
+ def weight(self):
1522
+ """
1523
+ Return the weight of ``self``.
1524
+
1525
+ EXAMPLES::
1526
+
1527
+ sage: [v.weight() for v in crystals.Letters(['E',6])]
1528
+ [(0, 0, 0, 0, 0, -2/3, -2/3, 2/3),
1529
+ (-1/2, 1/2, 1/2, 1/2, 1/2, -1/6, -1/6, 1/6),
1530
+ (1/2, -1/2, 1/2, 1/2, 1/2, -1/6, -1/6, 1/6),
1531
+ (1/2, 1/2, -1/2, 1/2, 1/2, -1/6, -1/6, 1/6),
1532
+ (-1/2, -1/2, -1/2, 1/2, 1/2, -1/6, -1/6, 1/6),
1533
+ (1/2, 1/2, 1/2, -1/2, 1/2, -1/6, -1/6, 1/6),
1534
+ (-1/2, -1/2, 1/2, -1/2, 1/2, -1/6, -1/6, 1/6),
1535
+ (-1/2, 1/2, -1/2, -1/2, 1/2, -1/6, -1/6, 1/6),
1536
+ (1/2, -1/2, -1/2, -1/2, 1/2, -1/6, -1/6, 1/6),
1537
+ (0, 0, 0, 0, 1, 1/3, 1/3, -1/3),
1538
+ (1/2, 1/2, 1/2, 1/2, -1/2, -1/6, -1/6, 1/6),
1539
+ (-1/2, -1/2, 1/2, 1/2, -1/2, -1/6, -1/6, 1/6),
1540
+ (-1/2, 1/2, -1/2, 1/2, -1/2, -1/6, -1/6, 1/6),
1541
+ (1/2, -1/2, -1/2, 1/2, -1/2, -1/6, -1/6, 1/6),
1542
+ (0, 0, 0, 1, 0, 1/3, 1/3, -1/3),
1543
+ (-1/2, 1/2, 1/2, -1/2, -1/2, -1/6, -1/6, 1/6),
1544
+ (1/2, -1/2, 1/2, -1/2, -1/2, -1/6, -1/6, 1/6),
1545
+ (0, 0, 1, 0, 0, 1/3, 1/3, -1/3),
1546
+ (1/2, 1/2, -1/2, -1/2, -1/2, -1/6, -1/6, 1/6),
1547
+ (0, 1, 0, 0, 0, 1/3, 1/3, -1/3),
1548
+ (1, 0, 0, 0, 0, 1/3, 1/3, -1/3),
1549
+ (0, -1, 0, 0, 0, 1/3, 1/3, -1/3),
1550
+ (0, 0, -1, 0, 0, 1/3, 1/3, -1/3),
1551
+ (0, 0, 0, -1, 0, 1/3, 1/3, -1/3),
1552
+ (0, 0, 0, 0, -1, 1/3, 1/3, -1/3),
1553
+ (-1/2, -1/2, -1/2, -1/2, -1/2, -1/6, -1/6, 1/6),
1554
+ (-1, 0, 0, 0, 0, 1/3, 1/3, -1/3)]
1555
+ """
1556
+ R = self._parent.weight_lattice_realization().fundamental_weights()
1557
+ return sum(Integer(i).sign() * R[abs(i)] for i in self.value)
1558
+
1559
+ cpdef LetterTuple e(self, int i):
1560
+ r"""
1561
+ Return the action of `e_i` on ``self``.
1562
+
1563
+ EXAMPLES::
1564
+
1565
+ sage: C = crystals.Letters(['E',6])
1566
+ sage: C((-1,3)).e(1)
1567
+ (1,)
1568
+ sage: C((-2,-3,4)).e(2)
1569
+ (-3, 2)
1570
+ sage: C((1,)).e(1)
1571
+ """
1572
+ if self.value == (-1, 3) and i == 1:
1573
+ return self._parent._element_constructor_((1,))
1574
+ if self.value == (-3, 4) and i == 3:
1575
+ return self._parent._element_constructor_((-1, 3))
1576
+ if self.value == (-4, 2, 5) and i == 4:
1577
+ return self._parent._element_constructor_((-3, 4))
1578
+ if self.value == (-5, 2, 6) and i == 5:
1579
+ return self._parent._element_constructor_((-4, 2, 5))
1580
+ if self.value == (-2, 5) and i == 2:
1581
+ return self._parent._element_constructor_((-4, 2, 5))
1582
+ if self.value == (-6, 2) and i == 6:
1583
+ return self._parent._element_constructor_((-5, 2, 6))
1584
+ if self.value == (-2, -5, 4, 6) and i == 2:
1585
+ return self._parent._element_constructor_((-5, 2, 6))
1586
+ if self.value == (-2, -6, 4) and i == 2:
1587
+ return self._parent._element_constructor_((-6, 2))
1588
+ if self.value == (-2, -5, 4, 6) and i == 5:
1589
+ return self._parent._element_constructor_((-2, 5))
1590
+ if self.value == (-2, -6, 4) and i == 6:
1591
+ return self._parent._element_constructor_((-2, -5, 4, 6))
1592
+ if self.value == (-4, 3, 6) and i == 4:
1593
+ return self._parent._element_constructor_((-2, -5, 4, 6))
1594
+ if self.value == (-4, -6, 3, 5) and i == 4:
1595
+ return self._parent._element_constructor_((-2, -6, 4))
1596
+ if self.value == (-4, -6, 3, 5) and i == 6:
1597
+ return self._parent._element_constructor_((-4, 3, 6))
1598
+ if self.value == (-3, 1, 6) and i == 3:
1599
+ return self._parent._element_constructor_((-4, 3, 6))
1600
+ if self.value == (-5, 3) and i == 5:
1601
+ return self._parent._element_constructor_((-4, -6, 3, 5))
1602
+ if self.value == (-3, -6, 1, 5) and i == 3:
1603
+ return self._parent._element_constructor_((-4, -6, 3, 5))
1604
+ if self.value == (-3, -5, 1, 4) and i == 3:
1605
+ return self._parent._element_constructor_((-5, 3))
1606
+ if self.value == (-3, -6, 1, 5) and i == 6:
1607
+ return self._parent._element_constructor_((-3, 1, 6))
1608
+ if self.value == (-1, 6) and i == 1:
1609
+ return self._parent._element_constructor_((-3, 1, 6))
1610
+ if self.value == (-3, -5, 1, 4) and i == 5:
1611
+ return self._parent._element_constructor_((-3, -6, 1, 5))
1612
+ if self.value == (-1, -6, 5) and i == 1:
1613
+ return self._parent._element_constructor_((-3, -6, 1, 5))
1614
+ if self.value == (-4, 1, 2) and i == 4:
1615
+ return self._parent._element_constructor_((-3, -5, 1, 4))
1616
+ if self.value == (-1, -5, 4) and i == 1:
1617
+ return self._parent._element_constructor_((-3, -5, 1, 4))
1618
+ if self.value == (-2, 1) and i == 2:
1619
+ return self._parent._element_constructor_((-4, 1, 2))
1620
+ if self.value == (-1, -4, 2, 3) and i == 1:
1621
+ return self._parent._element_constructor_((-4, 1, 2))
1622
+ if self.value == (-1, -2, 3) and i == 1:
1623
+ return self._parent._element_constructor_((-2, 1))
1624
+ if self.value == (-1, -6, 5) and i == 6:
1625
+ return self._parent._element_constructor_((-1, 6))
1626
+ if self.value == (-1, -5, 4) and i == 5:
1627
+ return self._parent._element_constructor_((-1, -6, 5))
1628
+ if self.value == (-1, -4, 2, 3) and i == 4:
1629
+ return self._parent._element_constructor_((-1, -5, 4))
1630
+ if self.value == (-1, -2, 3) and i == 2:
1631
+ return self._parent._element_constructor_((-1, -4, 2, 3))
1632
+ if self.value == (-3, 2) and i == 3:
1633
+ return self._parent._element_constructor_((-1, -4, 2, 3))
1634
+ if self.value == (-2, -3, 4) and i == 3:
1635
+ return self._parent._element_constructor_((-1, -2, 3))
1636
+ if self.value == (-2, -3, 4) and i == 2:
1637
+ return self._parent._element_constructor_((-3, 2))
1638
+ if self.value == (-4, 5) and i == 4:
1639
+ return self._parent._element_constructor_((-2, -3, 4))
1640
+ if self.value == (-5, 6) and i == 5:
1641
+ return self._parent._element_constructor_((-4, 5))
1642
+ if self.value == (-6,) and i == 6:
1643
+ return self._parent._element_constructor_((-5, 6))
1644
+ else:
1645
+ return None
1646
+
1647
+ cpdef LetterTuple f(self, int i):
1648
+ r"""
1649
+ Return the action of `f_i` on ``self``.
1650
+
1651
+ EXAMPLES::
1652
+
1653
+ sage: C = crystals.Letters(['E',6])
1654
+ sage: C((1,)).f(1)
1655
+ (-1, 3)
1656
+ sage: C((-6,)).f(1)
1657
+ """
1658
+ if self.value == (1,) and i == 1:
1659
+ return self._parent._element_constructor_((-1, 3))
1660
+ if self.value == (-1, 3) and i == 3:
1661
+ return self._parent._element_constructor_((-3, 4))
1662
+ if self.value == (-3, 4) and i == 4:
1663
+ return self._parent._element_constructor_((-4, 2, 5))
1664
+ if self.value == (-4, 2, 5) and i == 5:
1665
+ return self._parent._element_constructor_((-5, 2, 6))
1666
+ if self.value == (-4, 2, 5) and i == 2:
1667
+ return self._parent._element_constructor_((-2, 5))
1668
+ if self.value == (-5, 2, 6) and i == 6:
1669
+ return self._parent._element_constructor_((-6, 2))
1670
+ if self.value == (-5, 2, 6) and i == 2:
1671
+ return self._parent._element_constructor_((-2, -5, 4, 6))
1672
+ if self.value == (-6, 2) and i == 2:
1673
+ return self._parent._element_constructor_((-2, -6, 4))
1674
+ if self.value == (-2, 5) and i == 5:
1675
+ return self._parent._element_constructor_((-2, -5, 4, 6))
1676
+ if self.value == (-2, -5, 4, 6) and i == 6:
1677
+ return self._parent._element_constructor_((-2, -6, 4))
1678
+ if self.value == (-2, -5, 4, 6) and i == 4:
1679
+ return self._parent._element_constructor_((-4, 3, 6))
1680
+ if self.value == (-2, -6, 4) and i == 4:
1681
+ return self._parent._element_constructor_((-4, -6, 3, 5))
1682
+ if self.value == (-4, 3, 6) and i == 6:
1683
+ return self._parent._element_constructor_((-4, -6, 3, 5))
1684
+ if self.value == (-4, 3, 6) and i == 3:
1685
+ return self._parent._element_constructor_((-3, 1, 6))
1686
+ if self.value == (-4, -6, 3, 5) and i == 5:
1687
+ return self._parent._element_constructor_((-5, 3))
1688
+ if self.value == (-4, -6, 3, 5) and i == 3:
1689
+ return self._parent._element_constructor_((-3, -6, 1, 5))
1690
+ if self.value == (-5, 3) and i == 3:
1691
+ return self._parent._element_constructor_((-3, -5, 1, 4))
1692
+ if self.value == (-3, 1, 6) and i == 6:
1693
+ return self._parent._element_constructor_((-3, -6, 1, 5))
1694
+ if self.value == (-3, 1, 6) and i == 1:
1695
+ return self._parent._element_constructor_((-1, 6))
1696
+ if self.value == (-3, -6, 1, 5) and i == 5:
1697
+ return self._parent._element_constructor_((-3, -5, 1, 4))
1698
+ if self.value == (-3, -6, 1, 5) and i == 1:
1699
+ return self._parent._element_constructor_((-1, -6, 5))
1700
+ if self.value == (-3, -5, 1, 4) and i == 4:
1701
+ return self._parent._element_constructor_((-4, 1, 2))
1702
+ if self.value == (-3, -5, 1, 4) and i == 1:
1703
+ return self._parent._element_constructor_((-1, -5, 4))
1704
+ if self.value == (-4, 1, 2) and i == 2:
1705
+ return self._parent._element_constructor_((-2, 1))
1706
+ if self.value == (-4, 1, 2) and i == 1:
1707
+ return self._parent._element_constructor_((-1, -4, 2, 3))
1708
+ if self.value == (-2, 1) and i == 1:
1709
+ return self._parent._element_constructor_((-1, -2, 3))
1710
+ if self.value == (-1, 6) and i == 6:
1711
+ return self._parent._element_constructor_((-1, -6, 5))
1712
+ if self.value == (-1, -6, 5) and i == 5:
1713
+ return self._parent._element_constructor_((-1, -5, 4))
1714
+ if self.value == (-1, -5, 4) and i == 4:
1715
+ return self._parent._element_constructor_((-1, -4, 2, 3))
1716
+ if self.value == (-1, -4, 2, 3) and i == 2:
1717
+ return self._parent._element_constructor_((-1, -2, 3))
1718
+ if self.value == (-1, -4, 2, 3) and i == 3:
1719
+ return self._parent._element_constructor_((-3, 2))
1720
+ if self.value == (-1, -2, 3) and i == 3:
1721
+ return self._parent._element_constructor_((-2, -3, 4))
1722
+ if self.value == (-3, 2) and i == 2:
1723
+ return self._parent._element_constructor_((-2, -3, 4))
1724
+ if self.value == (-2, -3, 4) and i == 4:
1725
+ return self._parent._element_constructor_((-4, 5))
1726
+ if self.value == (-4, 5) and i == 5:
1727
+ return self._parent._element_constructor_((-5, 6))
1728
+ if self.value == (-5, 6) and i == 6:
1729
+ return self._parent._element_constructor_((-6,))
1730
+ else:
1731
+ return None
1732
+
1733
+ cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple):
1734
+ r"""
1735
+ Type `E_6` crystal of letters elements. This crystal corresponds to the highest weight
1736
+ crystal `B(\Lambda_6)`. This crystal is dual to `B(\Lambda_1)` of type `E_6`.
1737
+
1738
+ TESTS::
1739
+
1740
+ sage: C = crystals.Letters(['E',6], dual = True)
1741
+ sage: C.module_generators
1742
+ ((6,),)
1743
+ sage: all(b==b.retract(b.lift()) for b in C)
1744
+ True
1745
+ sage: C.list()
1746
+ [(6,), (5, -6), (4, -5), (2, 3, -4), (3, -2), (1, 2, -3), (2, -1), (1, 4, -2, -3),
1747
+ (4, -1, -2), (1, 5, -4), (3, 5, -1, -4), (5, -3), (1, 6, -5), (3, 6, -1, -5), (4, 6, -3, -5),
1748
+ (2, 6, -4), (6, -2), (1, -6), (3, -1, -6), (4, -3, -6), (2, 5, -4, -6), (5, -2, -6), (2, -5),
1749
+ (4, -2, -5), (3, -4), (1, -3), (-1,)]
1750
+ sage: TestSuite(C).run()
1751
+ sage: all(b.f(i).e(i) == b for i in C.index_set() for b in C if b.f(i) is not None)
1752
+ True
1753
+ sage: all(b.e(i).f(i) == b for i in C.index_set() for b in C if b.e(i) is not None)
1754
+ True
1755
+ sage: G = C.digraph()
1756
+ sage: G.show(edge_labels=true, figsize=12, vertex_size=1) # needs sage.plot
1757
+ """
1758
+
1759
+ def _repr_(self):
1760
+ """
1761
+ In their full representation, the vertices of this crystal are labeled
1762
+ by their weight. For example vertex (-2,1) indicates that a 2-arrow
1763
+ is coming into this vertex, and a 1-arrow is leaving the vertex.
1764
+ Specifying the option element_print_style = 'compact' for a given crystal C,
1765
+ labels the vertices of this crystal by the 27 letters -ABCDEFGHIJKLMNOPQRSTUVWXYZ
1766
+
1767
+ EXAMPLES::
1768
+
1769
+ sage: C = crystals.Letters(['E',6], element_print_style = 'compact', dual = True)
1770
+ sage: C.list()
1771
+ [-, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z]
1772
+ """
1773
+ if self._parent._element_print_style == 'compact':
1774
+ l=['-','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
1775
+ return l[self._parent.list().index(self)]
1776
+ return repr(self.value)
1777
+
1778
+ cpdef LetterTuple lift(self):
1779
+ """
1780
+ Lift an element of ``self`` to the crystal of letters
1781
+ ``crystals.Letters(['E',6])`` by taking its inverse weight.
1782
+
1783
+ EXAMPLES::
1784
+
1785
+ sage: C = crystals.Letters(['E',6], dual = True)
1786
+ sage: b = C.module_generators[0]
1787
+ sage: b.lift()
1788
+ (-6,)
1789
+ """
1790
+ # Because a generators are not supported and the element constructor
1791
+ # being a cached method can't take lists as input, we have to make a
1792
+ # tuple from a list
1793
+ return self._parent._ambient(tuple([-i for i in self.value]))
1794
+
1795
+ cpdef LetterTuple retract(self, LetterTuple p):
1796
+ """
1797
+ Retract element ``p``, which is an element in
1798
+ ``crystals.Letters(['E',6])`` to an element in
1799
+ ``crystals.Letters(['E',6], dual=True)`` by taking its inverse weight.
1800
+
1801
+ EXAMPLES::
1802
+
1803
+ sage: C = crystals.Letters(['E',6])
1804
+ sage: Cd = crystals.Letters(['E',6], dual = True)
1805
+ sage: b = Cd.module_generators[0]
1806
+ sage: p = C((-1,3))
1807
+ sage: b.retract(p)
1808
+ (1, -3)
1809
+ sage: b.retract(None)
1810
+ """
1811
+ if p is None:
1812
+ return None
1813
+ # Because a generators are not supported and the element constructor
1814
+ # being a cached method can't take lists as input, we have to make a
1815
+ # tuple from a list
1816
+ return self._parent._element_constructor_(tuple([-i for i in p.value]))
1817
+
1818
+ cpdef LetterTuple e(self, int i):
1819
+ r"""
1820
+ Return the action of `e_i` on ``self``.
1821
+
1822
+ EXAMPLES::
1823
+
1824
+ sage: C = crystals.Letters(['E',6], dual = True)
1825
+ sage: C((-1,)).e(1)
1826
+ (1, -3)
1827
+ """
1828
+ return self.retract(self.lift().f(i))
1829
+
1830
+ cpdef LetterTuple f(self, int i):
1831
+ r"""
1832
+ Return the action of `f_i` on ``self``.
1833
+
1834
+ EXAMPLES::
1835
+
1836
+ sage: C = crystals.Letters(['E',6], dual = True)
1837
+ sage: C((6,)).f(6)
1838
+ (5, -6)
1839
+ sage: C((6,)).f(1)
1840
+ """
1841
+ return self.retract(self.lift().e(i))
1842
+
1843
+ def weight(self):
1844
+ """
1845
+ Return the weight of ``self``.
1846
+
1847
+ EXAMPLES::
1848
+
1849
+ sage: C = crystals.Letters(['E',6], dual = True)
1850
+ sage: b=C.module_generators[0]
1851
+ sage: b.weight()
1852
+ (0, 0, 0, 0, 1, -1/3, -1/3, 1/3)
1853
+ sage: [v.weight() for v in C]
1854
+ [(0, 0, 0, 0, 1, -1/3, -1/3, 1/3),
1855
+ (0, 0, 0, 1, 0, -1/3, -1/3, 1/3),
1856
+ (0, 0, 1, 0, 0, -1/3, -1/3, 1/3),
1857
+ (0, 1, 0, 0, 0, -1/3, -1/3, 1/3),
1858
+ (-1, 0, 0, 0, 0, -1/3, -1/3, 1/3),
1859
+ (1, 0, 0, 0, 0, -1/3, -1/3, 1/3),
1860
+ (1/2, 1/2, 1/2, 1/2, 1/2, 1/6, 1/6, -1/6),
1861
+ (0, -1, 0, 0, 0, -1/3, -1/3, 1/3),
1862
+ (-1/2, -1/2, 1/2, 1/2, 1/2, 1/6, 1/6, -1/6),
1863
+ (0, 0, -1, 0, 0, -1/3, -1/3, 1/3),
1864
+ (-1/2, 1/2, -1/2, 1/2, 1/2, 1/6, 1/6, -1/6),
1865
+ (1/2, -1/2, -1/2, 1/2, 1/2, 1/6, 1/6, -1/6),
1866
+ (0, 0, 0, -1, 0, -1/3, -1/3, 1/3),
1867
+ (-1/2, 1/2, 1/2, -1/2, 1/2, 1/6, 1/6, -1/6),
1868
+ (1/2, -1/2, 1/2, -1/2, 1/2, 1/6, 1/6, -1/6),
1869
+ (1/2, 1/2, -1/2, -1/2, 1/2, 1/6, 1/6, -1/6),
1870
+ (-1/2, -1/2, -1/2, -1/2, 1/2, 1/6, 1/6, -1/6),
1871
+ (0, 0, 0, 0, -1, -1/3, -1/3, 1/3),
1872
+ (-1/2, 1/2, 1/2, 1/2, -1/2, 1/6, 1/6, -1/6),
1873
+ (1/2, -1/2, 1/2, 1/2, -1/2, 1/6, 1/6, -1/6),
1874
+ (1/2, 1/2, -1/2, 1/2, -1/2, 1/6, 1/6, -1/6),
1875
+ (-1/2, -1/2, -1/2, 1/2, -1/2, 1/6, 1/6, -1/6),
1876
+ (1/2, 1/2, 1/2, -1/2, -1/2, 1/6, 1/6, -1/6),
1877
+ (-1/2, -1/2, 1/2, -1/2, -1/2, 1/6, 1/6, -1/6),
1878
+ (-1/2, 1/2, -1/2, -1/2, -1/2, 1/6, 1/6, -1/6),
1879
+ (1/2, -1/2, -1/2, -1/2, -1/2, 1/6, 1/6, -1/6),
1880
+ (0, 0, 0, 0, 0, 2/3, 2/3, -2/3)]
1881
+ """
1882
+ return -self.lift().weight()
1883
+
1884
+
1885
+ #########################
1886
+ # Type E7
1887
+ #########################
1888
+
1889
+ cdef class Crystal_of_letters_type_E7_element(LetterTuple):
1890
+ r"""
1891
+ Type `E_7` crystal of letters elements. This crystal corresponds to the highest weight
1892
+ crystal `B(\Lambda_7)`.
1893
+
1894
+ TESTS::
1895
+
1896
+ sage: C = crystals.Letters(['E',7])
1897
+ sage: C.module_generators
1898
+ ((7,),)
1899
+ sage: C.list()
1900
+ [(7,), (-7, 6), (-6, 5), (-5, 4), (-4, 2, 3), (-2, 3), (-3, 1, 2), (-1,
1901
+ 2), (-3, -2, 1, 4), (-1, -2, 4), (-4, 1, 5), (-4, -1, 3, 5), (-3, 5),
1902
+ (-5, 6, 1), (-5, -1, 3, 6), (-5, -3, 4, 6), (-4, 2, 6), (-2, 6), (-6, 7,
1903
+ 1), (-1, -6, 3, 7), (-6, -3, 7, 4), (-6, -4, 2, 7, 5), (-6, -2, 7, 5),
1904
+ (-5, 7, 2), (-5, -2, 4, 7), (-4, 7, 3), (-3, 1, 7), (-1, 7), (-7, 1),
1905
+ (-1, -7, 3), (-7, -3, 4), (-4, -7, 2, 5), (-7, -2, 5), (-5, -7, 6, 2),
1906
+ (-5, -2, -7, 4, 6), (-7, -4, 6, 3), (-3, -7, 1, 6), (-7, -1, 6), (-6,
1907
+ 2), (-2, -6, 4), (-6, -4, 5, 3), (-3, -6, 1, 5), (-6, -1, 5), (-5, 3),
1908
+ (-3, -5, 4, 1), (-5, -1, 4), (-4, 1, 2), (-1, -4, 3, 2), (-3, 2), (-2,
1909
+ -3, 4), (-4, 5), (-5, 6), (-6, 7), (-7,), (-2, 1), (-2, -1, 3)]
1910
+ sage: TestSuite(C).run()
1911
+ sage: all(b.f(i).e(i) == b for i in C.index_set() for b in C if b.f(i) is not None)
1912
+ True
1913
+ sage: all(b.e(i).f(i) == b for i in C.index_set() for b in C if b.e(i) is not None)
1914
+ True
1915
+ sage: G = C.digraph()
1916
+ sage: G.show(edge_labels=true, figsize=12, vertex_size=1) # needs sage.plot
1917
+ """
1918
+
1919
+ def weight(self):
1920
+ """
1921
+ Return the weight of ``self``.
1922
+
1923
+ EXAMPLES::
1924
+
1925
+ sage: [v.weight() for v in crystals.Letters(['E',7])]
1926
+ [(0, 0, 0, 0, 0, 1, -1/2, 1/2), (0, 0, 0, 0, 1, 0, -1/2, 1/2), (0, 0, 0,
1927
+ 1, 0, 0, -1/2, 1/2), (0, 0, 1, 0, 0, 0, -1/2, 1/2), (0, 1, 0, 0, 0, 0,
1928
+ -1/2, 1/2), (-1, 0, 0, 0, 0, 0, -1/2, 1/2), (1, 0, 0, 0, 0, 0, -1/2,
1929
+ 1/2), (1/2, 1/2, 1/2, 1/2, 1/2, 1/2, 0, 0), (0, -1, 0, 0, 0, 0, -1/2,
1930
+ 1/2), (-1/2, -1/2, 1/2, 1/2, 1/2, 1/2, 0, 0), (0, 0, -1, 0, 0, 0, -1/2,
1931
+ 1/2), (-1/2, 1/2, -1/2, 1/2, 1/2, 1/2, 0, 0), (1/2, -1/2, -1/2, 1/2,
1932
+ 1/2, 1/2, 0, 0), (0, 0, 0, -1, 0, 0, -1/2, 1/2), (-1/2, 1/2, 1/2, -1/2,
1933
+ 1/2, 1/2, 0, 0), (1/2, -1/2, 1/2, -1/2, 1/2, 1/2, 0, 0), (1/2, 1/2,
1934
+ -1/2, -1/2, 1/2, 1/2, 0, 0), (-1/2, -1/2, -1/2, -1/2, 1/2, 1/2, 0, 0),
1935
+ (0, 0, 0, 0, -1, 0, -1/2, 1/2), (-1/2, 1/2, 1/2, 1/2, -1/2, 1/2, 0, 0),
1936
+ (1/2, -1/2, 1/2, 1/2, -1/2, 1/2, 0, 0), (1/2, 1/2, -1/2, 1/2, -1/2, 1/2,
1937
+ 0, 0), (-1/2, -1/2, -1/2, 1/2, -1/2, 1/2, 0, 0), (1/2, 1/2, 1/2, -1/2,
1938
+ -1/2, 1/2, 0, 0), (-1/2, -1/2, 1/2, -1/2, -1/2, 1/2, 0, 0), (-1/2, 1/2,
1939
+ -1/2, -1/2, -1/2, 1/2, 0, 0), (1/2, -1/2, -1/2, -1/2, -1/2, 1/2, 0, 0),
1940
+ (0, 0, 0, 0, 0, 1, 1/2, -1/2), (0, 0, 0, 0, 0, -1, -1/2, 1/2), (-1/2,
1941
+ 1/2, 1/2, 1/2, 1/2, -1/2, 0, 0), (1/2, -1/2, 1/2, 1/2, 1/2, -1/2, 0, 0),
1942
+ (1/2, 1/2, -1/2, 1/2, 1/2, -1/2, 0, 0), (-1/2, -1/2, -1/2, 1/2, 1/2,
1943
+ -1/2, 0, 0), (1/2, 1/2, 1/2, -1/2, 1/2, -1/2, 0, 0), (-1/2, -1/2, 1/2,
1944
+ -1/2, 1/2, -1/2, 0, 0), (-1/2, 1/2, -1/2, -1/2, 1/2, -1/2, 0, 0), (1/2,
1945
+ -1/2, -1/2, -1/2, 1/2, -1/2, 0, 0), (0, 0, 0, 0, 1, 0, 1/2, -1/2), (1/2,
1946
+ 1/2, 1/2, 1/2, -1/2, -1/2, 0, 0), (-1/2, -1/2, 1/2, 1/2, -1/2, -1/2, 0,
1947
+ 0), (-1/2, 1/2, -1/2, 1/2, -1/2, -1/2, 0, 0), (1/2, -1/2, -1/2, 1/2,
1948
+ -1/2, -1/2, 0, 0), (0, 0, 0, 1, 0, 0, 1/2, -1/2), (-1/2, 1/2, 1/2, -1/2,
1949
+ -1/2, -1/2, 0, 0), (1/2, -1/2, 1/2, -1/2, -1/2, -1/2, 0, 0), (0, 0, 1,
1950
+ 0, 0, 0, 1/2, -1/2), (1/2, 1/2, -1/2, -1/2, -1/2, -1/2, 0, 0), (0, 1, 0,
1951
+ 0, 0, 0, 1/2, -1/2), (1, 0, 0, 0, 0, 0, 1/2, -1/2), (0, -1, 0, 0, 0, 0,
1952
+ 1/2, -1/2), (0, 0, -1, 0, 0, 0, 1/2, -1/2), (0, 0, 0, -1, 0, 0, 1/2,
1953
+ -1/2), (0, 0, 0, 0, -1, 0, 1/2, -1/2), (0, 0, 0, 0, 0, -1, 1/2, -1/2),
1954
+ (-1/2, -1/2, -1/2, -1/2, -1/2, -1/2, 0, 0), (-1, 0, 0, 0, 0, 0, 1/2,
1955
+ -1/2)]
1956
+ """
1957
+ R = self._parent.weight_lattice_realization().fundamental_weights()
1958
+ return sum(Integer(i).sign() * R[abs(i)] for i in self.value)
1959
+
1960
+ cpdef LetterTuple e(self, int i):
1961
+ r"""
1962
+ Return the action of `e_i` on ``self``.
1963
+
1964
+ EXAMPLES::
1965
+
1966
+ sage: C = crystals.Letters(['E',7])
1967
+ sage: C((7,)).e(7)
1968
+ sage: C((-7,6)).e(7)
1969
+ (7,)
1970
+ """
1971
+ if self.value == (-7, 6) and i == 7:
1972
+ return self._parent._element_constructor_( (7,) )
1973
+ if self.value == (-6, 5) and i == 6:
1974
+ return self._parent._element_constructor_( (-7, 6) )
1975
+ if self.value == (-5, 4) and i == 5:
1976
+ return self._parent._element_constructor_( (-6, 5) )
1977
+ if self.value == (-4, 2, 3) and i == 4:
1978
+ return self._parent._element_constructor_( (-5, 4) )
1979
+ if self.value == (-2, 3) and i == 2:
1980
+ return self._parent._element_constructor_( (-4, 2, 3) )
1981
+ if self.value == (-3, 1, 2) and i == 3:
1982
+ return self._parent._element_constructor_( (-4, 2, 3) )
1983
+ if self.value == (-3, -2, 1, 4) and i == 3:
1984
+ return self._parent._element_constructor_( (-2, 3) )
1985
+ if self.value == (-1, 2) and i == 1:
1986
+ return self._parent._element_constructor_( (-3, 1, 2) )
1987
+ if self.value == (-3, -2, 1, 4) and i == 2:
1988
+ return self._parent._element_constructor_( (-3, 1, 2) )
1989
+ if self.value == (-1, -2, 4) and i == 1:
1990
+ return self._parent._element_constructor_( (-3, -2, 1, 4) )
1991
+ if self.value == (-4, 1, 5) and i == 4:
1992
+ return self._parent._element_constructor_( (-3, -2, 1, 4) )
1993
+ if self.value == (-7, 1) and i == 7:
1994
+ return self._parent._element_constructor_( (-6, 7, 1) )
1995
+ if self.value == (-1, -6, 3, 7) and i == 1:
1996
+ return self._parent._element_constructor_( (-6, 7, 1) )
1997
+ if self.value == (-1, -2, 4) and i == 2:
1998
+ return self._parent._element_constructor_( (-1, 2) )
1999
+ if self.value == (-4, -1, 3, 5) and i == 4:
2000
+ return self._parent._element_constructor_( (-1, -2, 4) )
2001
+ if self.value == (-4, -1, 3, 5) and i == 1:
2002
+ return self._parent._element_constructor_( (-4, 1, 5) )
2003
+ if self.value == (-5, 6, 1) and i == 5:
2004
+ return self._parent._element_constructor_( (-4, 1, 5) )
2005
+ if self.value == (-3, 5) and i == 3:
2006
+ return self._parent._element_constructor_( (-4, -1, 3, 5) )
2007
+ if self.value == (-5, -1, 3, 6) and i == 5:
2008
+ return self._parent._element_constructor_( (-4, -1, 3, 5) )
2009
+ if self.value == (-5, -3, 4, 6) and i == 5:
2010
+ return self._parent._element_constructor_( (-3, 5) )
2011
+ if self.value == (-6, 7, 1) and i == 6:
2012
+ return self._parent._element_constructor_( (-5, 6, 1) )
2013
+ if self.value == (-5, -1, 3, 6) and i == 1:
2014
+ return self._parent._element_constructor_( (-5, 6, 1) )
2015
+ if self.value == (-5, -3, 4, 6) and i == 3:
2016
+ return self._parent._element_constructor_( (-5, -1, 3, 6) )
2017
+ if self.value == (-1, -6, 3, 7) and i == 6:
2018
+ return self._parent._element_constructor_( (-5, -1, 3, 6) )
2019
+ if self.value == (-4, 2, 6) and i == 4:
2020
+ return self._parent._element_constructor_( (-5, -3, 4, 6) )
2021
+ if self.value == (-6, -3, 7, 4) and i == 6:
2022
+ return self._parent._element_constructor_( (-5, -3, 4, 6) )
2023
+ if self.value == (-6, -2, 7, 5) and i == 6:
2024
+ return self._parent._element_constructor_( (-2, 6) )
2025
+ if self.value == (-6, -3, 7, 4) and i == 3:
2026
+ return self._parent._element_constructor_( (-1, -6, 3, 7) )
2027
+ if self.value == (-1, -7, 3) and i == 7:
2028
+ return self._parent._element_constructor_( (-1, -6, 3, 7) )
2029
+ if self.value == (-7, -3, 4) and i == 7:
2030
+ return self._parent._element_constructor_( (-6, -3, 7, 4) )
2031
+ if self.value == (-6, -4, 2, 7, 5) and i == 4:
2032
+ return self._parent._element_constructor_( (-6, -3, 7, 4) )
2033
+ if self.value == (-2, 6) and i == 2:
2034
+ return self._parent._element_constructor_( (-4, 2, 6) )
2035
+ if self.value == (-6, -4, 2, 7, 5) and i == 6:
2036
+ return self._parent._element_constructor_( (-4, 2, 6) )
2037
+ if self.value == (-6, -2, 7, 5) and i == 2:
2038
+ return self._parent._element_constructor_( (-6, -4, 2, 7, 5) )
2039
+ if self.value == (-4, -7, 2, 5) and i == 7:
2040
+ return self._parent._element_constructor_( (-6, -4, 2, 7, 5) )
2041
+ if self.value == (-7, -4, 6, 3) and i == 7:
2042
+ return self._parent._element_constructor_( (-4, 7, 3) )
2043
+ if self.value == (-3, 1, 7) and i == 3:
2044
+ return self._parent._element_constructor_( (-4, 7, 3) )
2045
+ if self.value == (-1, 7) and i == 1:
2046
+ return self._parent._element_constructor_( (-3, 1, 7) )
2047
+ if self.value == (-3, -7, 1, 6) and i == 7:
2048
+ return self._parent._element_constructor_( (-3, 1, 7) )
2049
+ if self.value == (-1, -7, 3) and i == 1:
2050
+ return self._parent._element_constructor_( (-7, 1) )
2051
+ if self.value == (-7, -2, 5) and i == 2:
2052
+ return self._parent._element_constructor_( (-4, -7, 2, 5) )
2053
+ if self.value == (-5, -7, 6, 2) and i == 5:
2054
+ return self._parent._element_constructor_( (-4, -7, 2, 5) )
2055
+ if self.value == (-5, -2, -7, 4, 6) and i == 5:
2056
+ return self._parent._element_constructor_( (-7, -2, 5) )
2057
+ if self.value == (-5, -7, 6, 2) and i == 7:
2058
+ return self._parent._element_constructor_( (-5, 7, 2) )
2059
+ if self.value == (-5, -2, 4, 7) and i == 2:
2060
+ return self._parent._element_constructor_( (-5, 7, 2) )
2061
+ if self.value == (-7, -3, 4) and i == 3:
2062
+ return self._parent._element_constructor_( (-1, -7, 3) )
2063
+ if self.value == (-5, 7, 2) and i == 5:
2064
+ return self._parent._element_constructor_( (-6, -4, 2, 7, 5) )
2065
+ if self.value == (-6, 2) and i == 6:
2066
+ return self._parent._element_constructor_( (-5, -7, 6, 2) )
2067
+ if self.value == (-5, -2, -7, 4, 6) and i == 2:
2068
+ return self._parent._element_constructor_( (-5, -7, 6, 2) )
2069
+ if self.value == (-7, -2, 5) and i == 7:
2070
+ return self._parent._element_constructor_( (-6, -2, 7, 5) )
2071
+ if self.value == (-5, -2, 4, 7) and i == 5:
2072
+ return self._parent._element_constructor_( (-6, -2, 7, 5) )
2073
+ if self.value == (-4, 7, 3) and i == 4:
2074
+ return self._parent._element_constructor_( (-5, -2, 4, 7) )
2075
+ if self.value == (-5, -2, -7, 4, 6) and i == 7:
2076
+ return self._parent._element_constructor_( (-5, -2, 4, 7) )
2077
+ if self.value == (-4, -7, 2, 5) and i == 4:
2078
+ return self._parent._element_constructor_( (-7, -3, 4) )
2079
+ if self.value == (-7, -4, 6, 3) and i == 4:
2080
+ return self._parent._element_constructor_( (-5, -2, -7, 4, 6) )
2081
+ if self.value == (-2, -6, 4) and i == 6:
2082
+ return self._parent._element_constructor_( (-5, -2, -7, 4, 6) )
2083
+ if self.value == (-6, -4, 5, 3) and i == 6:
2084
+ return self._parent._element_constructor_( (-7, -4, 6, 3) )
2085
+ if self.value == (-3, -7, 1, 6) and i == 3:
2086
+ return self._parent._element_constructor_( (-7, -4, 6, 3) )
2087
+ if self.value == (-3, -6, 1, 5) and i == 6:
2088
+ return self._parent._element_constructor_( (-3, -7, 1, 6) )
2089
+ if self.value == (-6, -1, 5) and i == 6:
2090
+ return self._parent._element_constructor_( (-7, -1, 6) )
2091
+ if self.value == (-2, -6, 4) and i == 2:
2092
+ return self._parent._element_constructor_( (-6, 2) )
2093
+ if self.value == (-6, -4, 5, 3) and i == 4:
2094
+ return self._parent._element_constructor_( (-2, -6, 4) )
2095
+ if self.value == (-7, -1, 6) and i == 1:
2096
+ return self._parent._element_constructor_( (-3, -7, 1, 6) )
2097
+ if self.value == (-5, 3) and i == 5:
2098
+ return self._parent._element_constructor_( (-6, -4, 5, 3) )
2099
+ if self.value == (-3, -6, 1, 5) and i == 3:
2100
+ return self._parent._element_constructor_( (-6, -4, 5, 3) )
2101
+ if self.value == (-6, -1, 5) and i == 1:
2102
+ return self._parent._element_constructor_( (-3, -6, 1, 5) )
2103
+ if self.value == (-3, -5, 4, 1) and i == 5:
2104
+ return self._parent._element_constructor_( (-3, -6, 1, 5) )
2105
+ if self.value == (-5, -1, 4) and i == 5:
2106
+ return self._parent._element_constructor_( (-6, -1, 5) )
2107
+ if self.value == (-3, -5, 4, 1) and i == 3:
2108
+ return self._parent._element_constructor_( (-5, 3) )
2109
+ if self.value == (-4, 1, 2) and i == 4:
2110
+ return self._parent._element_constructor_( (-3, -5, 4, 1) )
2111
+ if self.value == (-5, -1, 4) and i == 1:
2112
+ return self._parent._element_constructor_( (-3, -5, 4, 1) )
2113
+ if self.value == (-1, -4, 3, 2) and i == 4:
2114
+ return self._parent._element_constructor_( (-5, -1, 4) )
2115
+ if self.value == (-1, -4, 3, 2) and i == 1:
2116
+ return self._parent._element_constructor_( (-4, 1, 2) )
2117
+ if self.value == (-2, 1) and i == 2:
2118
+ return self._parent._element_constructor_( (-4, 1, 2) )
2119
+ if self.value == (-3, 2) and i == 3:
2120
+ return self._parent._element_constructor_( (-1, -4, 3, 2) )
2121
+ if self.value == (-2, -1, 3) and i == 2:
2122
+ return self._parent._element_constructor_( (-1, -4, 3, 2) )
2123
+ if self.value == (-2, -1, 3) and i == 1:
2124
+ return self._parent._element_constructor_( (-2, 1) )
2125
+ if self.value == (-7, -1, 6) and i == 7:
2126
+ return self._parent._element_constructor_( (-1, 7) )
2127
+ if self.value == (-2, -3, 4) and i == 3:
2128
+ return self._parent._element_constructor_( (-2, -1, 3) )
2129
+ if self.value == (-2, -3, 4) and i == 2:
2130
+ return self._parent._element_constructor_( (-3, 2) )
2131
+ if self.value == (-4, 5) and i == 4:
2132
+ return self._parent._element_constructor_( (-2, -3, 4) )
2133
+ if self.value == (-5, 6) and i == 5:
2134
+ return self._parent._element_constructor_( (-4, 5) )
2135
+ if self.value == (-6, 7) and i == 6:
2136
+ return self._parent._element_constructor_( (-5, 6) )
2137
+ if self.value == (-7,) and i == 7:
2138
+ return self._parent._element_constructor_( (-6, 7) )
2139
+ else:
2140
+ return None
2141
+
2142
+ cpdef LetterTuple f(self, int i):
2143
+ r"""
2144
+ Return the action of `f_i` on ``self``.
2145
+
2146
+ EXAMPLES::
2147
+
2148
+ sage: C = crystals.Letters(['E',7])
2149
+ sage: C((-7,)).f(7)
2150
+ sage: C((7,)).f(7)
2151
+ (-7, 6)
2152
+ """
2153
+ if self.value == (7,) and i == 7:
2154
+ return self._parent._element_constructor_( (-7, 6) )
2155
+ if self.value == (-7, 6) and i == 6:
2156
+ return self._parent._element_constructor_( (-6, 5) )
2157
+ if self.value == (-6, 5) and i == 5:
2158
+ return self._parent._element_constructor_( (-5, 4) )
2159
+ if self.value == (-5, 4) and i == 4:
2160
+ return self._parent._element_constructor_( (-4, 2, 3) )
2161
+ if self.value == (-4, 2, 3) and i == 2:
2162
+ return self._parent._element_constructor_( (-2, 3) )
2163
+ if self.value == (-4, 2, 3) and i == 3:
2164
+ return self._parent._element_constructor_( (-3, 1, 2) )
2165
+ if self.value == (-2, 3) and i == 3:
2166
+ return self._parent._element_constructor_( (-3, -2, 1, 4) )
2167
+ if self.value == (-3, 1, 2) and i == 1:
2168
+ return self._parent._element_constructor_( (-1, 2) )
2169
+ if self.value == (-3, 1, 2) and i == 2:
2170
+ return self._parent._element_constructor_( (-3, -2, 1, 4) )
2171
+ if self.value == (-3, -2, 1, 4) and i == 1:
2172
+ return self._parent._element_constructor_( (-1, -2, 4) )
2173
+ if self.value == (-3, -2, 1, 4) and i == 4:
2174
+ return self._parent._element_constructor_( (-4, 1, 5) )
2175
+ if self.value == (-6, 7, 1) and i == 7:
2176
+ return self._parent._element_constructor_( (-7, 1) )
2177
+ if self.value == (-6, 7, 1) and i == 1:
2178
+ return self._parent._element_constructor_( (-1, -6, 3, 7) )
2179
+ if self.value == (-1, 2) and i == 2:
2180
+ return self._parent._element_constructor_( (-1, -2, 4) )
2181
+ if self.value == (-1, -2, 4) and i == 4:
2182
+ return self._parent._element_constructor_( (-4, -1, 3, 5) )
2183
+ if self.value == (-4, 1, 5) and i == 1:
2184
+ return self._parent._element_constructor_( (-4, -1, 3, 5) )
2185
+ if self.value == (-4, 1, 5) and i == 5:
2186
+ return self._parent._element_constructor_( (-5, 6, 1) )
2187
+ if self.value == (-4, -1, 3, 5) and i == 3:
2188
+ return self._parent._element_constructor_( (-3, 5) )
2189
+ if self.value == (-4, -1, 3, 5) and i == 5:
2190
+ return self._parent._element_constructor_( (-5, -1, 3, 6) )
2191
+ if self.value == (-3, 5) and i == 5:
2192
+ return self._parent._element_constructor_( (-5, -3, 4, 6) )
2193
+ if self.value == (-5, 6, 1) and i == 6:
2194
+ return self._parent._element_constructor_( (-6, 7, 1) )
2195
+ if self.value == (-5, 6, 1) and i == 1:
2196
+ return self._parent._element_constructor_( (-5, -1, 3, 6) )
2197
+ if self.value == (-5, -1, 3, 6) and i == 3:
2198
+ return self._parent._element_constructor_( (-5, -3, 4, 6) )
2199
+ if self.value == (-5, -1, 3, 6) and i == 6:
2200
+ return self._parent._element_constructor_( (-1, -6, 3, 7) )
2201
+ if self.value == (-5, -3, 4, 6) and i == 4:
2202
+ return self._parent._element_constructor_( (-4, 2, 6) )
2203
+ if self.value == (-5, -3, 4, 6) and i == 6:
2204
+ return self._parent._element_constructor_( (-6, -3, 7, 4) )
2205
+ if self.value == (-2, 6) and i == 6:
2206
+ return self._parent._element_constructor_( (-6, -2, 7, 5) )
2207
+ if self.value == (-1, -6, 3, 7) and i == 3:
2208
+ return self._parent._element_constructor_( (-6, -3, 7, 4) )
2209
+ if self.value == (-1, -6, 3, 7) and i == 7:
2210
+ return self._parent._element_constructor_( (-1, -7, 3) )
2211
+ if self.value == (-6, -3, 7, 4) and i == 7:
2212
+ return self._parent._element_constructor_( (-7, -3, 4) )
2213
+ if self.value == (-6, -3, 7, 4) and i == 4:
2214
+ return self._parent._element_constructor_( (-6, -4, 2, 7, 5) )
2215
+ if self.value == (-4, 2, 6) and i == 2:
2216
+ return self._parent._element_constructor_( (-2, 6) )
2217
+ if self.value == (-4, 2, 6) and i == 6:
2218
+ return self._parent._element_constructor_( (-6, -4, 2, 7, 5) )
2219
+ if self.value == (-6, -4, 2, 7, 5) and i == 2:
2220
+ return self._parent._element_constructor_( (-6, -2, 7, 5) )
2221
+ if self.value == (-6, -4, 2, 7, 5) and i == 7:
2222
+ return self._parent._element_constructor_( (-4, -7, 2, 5) )
2223
+ if self.value == (-4, 7, 3) and i == 7:
2224
+ return self._parent._element_constructor_( (-7, -4, 6, 3) )
2225
+ if self.value == (-4, 7, 3) and i == 3:
2226
+ return self._parent._element_constructor_( (-3, 1, 7) )
2227
+ if self.value == (-3, 1, 7) and i == 1:
2228
+ return self._parent._element_constructor_( (-1, 7) )
2229
+ if self.value == (-3, 1, 7) and i == 7:
2230
+ return self._parent._element_constructor_( (-3, -7, 1, 6) )
2231
+ if self.value == (-7, 1) and i == 1:
2232
+ return self._parent._element_constructor_( (-1, -7, 3) )
2233
+ if self.value == (-4, -7, 2, 5) and i == 2:
2234
+ return self._parent._element_constructor_( (-7, -2, 5) )
2235
+ if self.value == (-4, -7, 2, 5) and i == 5:
2236
+ return self._parent._element_constructor_( (-5, -7, 6, 2) )
2237
+ if self.value == (-7, -2, 5) and i == 5:
2238
+ return self._parent._element_constructor_( (-5, -2, -7, 4, 6) )
2239
+ if self.value == (-5, 7, 2) and i == 7:
2240
+ return self._parent._element_constructor_( (-5, -7, 6, 2) )
2241
+ if self.value == (-5, 7, 2) and i == 2:
2242
+ return self._parent._element_constructor_( (-5, -2, 4, 7) )
2243
+ if self.value == (-1, -7, 3) and i == 3:
2244
+ return self._parent._element_constructor_( (-7, -3, 4) )
2245
+ if self.value == (-6, -4, 2, 7, 5) and i == 5:
2246
+ return self._parent._element_constructor_( (-5, 7, 2) )
2247
+ if self.value == (-5, -7, 6, 2) and i == 6:
2248
+ return self._parent._element_constructor_( (-6, 2) )
2249
+ if self.value == (-5, -7, 6, 2) and i == 2:
2250
+ return self._parent._element_constructor_( (-5, -2, -7, 4, 6) )
2251
+ if self.value == (-6, -2, 7, 5) and i == 7:
2252
+ return self._parent._element_constructor_( (-7, -2, 5) )
2253
+ if self.value == (-6, -2, 7, 5) and i == 5:
2254
+ return self._parent._element_constructor_( (-5, -2, 4, 7) )
2255
+ if self.value == (-5, -2, 4, 7) and i == 4:
2256
+ return self._parent._element_constructor_( (-4, 7, 3) )
2257
+ if self.value == (-5, -2, 4, 7) and i == 7:
2258
+ return self._parent._element_constructor_( (-5, -2, -7, 4, 6) )
2259
+ if self.value == (-7, -3, 4) and i == 4:
2260
+ return self._parent._element_constructor_( (-4, -7, 2, 5) )
2261
+ if self.value == (-5, -2, -7, 4, 6) and i == 4:
2262
+ return self._parent._element_constructor_( (-7, -4, 6, 3) )
2263
+ if self.value == (-5, -2, -7, 4, 6) and i == 6:
2264
+ return self._parent._element_constructor_( (-2, -6, 4) )
2265
+ if self.value == (-7, -4, 6, 3) and i == 6:
2266
+ return self._parent._element_constructor_( (-6, -4, 5, 3) )
2267
+ if self.value == (-7, -4, 6, 3) and i == 3:
2268
+ return self._parent._element_constructor_( (-3, -7, 1, 6) )
2269
+ if self.value == (-3, -7, 1, 6) and i == 6:
2270
+ return self._parent._element_constructor_( (-3, -6, 1, 5) )
2271
+ if self.value == (-7, -1, 6) and i == 6:
2272
+ return self._parent._element_constructor_( (-6, -1, 5) )
2273
+ if self.value == (-6, 2) and i == 2:
2274
+ return self._parent._element_constructor_( (-2, -6, 4) )
2275
+ if self.value == (-2, -6, 4) and i == 4:
2276
+ return self._parent._element_constructor_( (-6, -4, 5, 3) )
2277
+ if self.value == (-3, -7, 1, 6) and i == 1:
2278
+ return self._parent._element_constructor_( (-7, -1, 6) )
2279
+ if self.value == (-6, -4, 5, 3) and i == 5:
2280
+ return self._parent._element_constructor_( (-5, 3) )
2281
+ if self.value == (-6, -4, 5, 3) and i == 3:
2282
+ return self._parent._element_constructor_( (-3, -6, 1, 5) )
2283
+ if self.value == (-3, -6, 1, 5) and i == 1:
2284
+ return self._parent._element_constructor_( (-6, -1, 5) )
2285
+ if self.value == (-3, -6, 1, 5) and i == 5:
2286
+ return self._parent._element_constructor_( (-3, -5, 4, 1) )
2287
+ if self.value == (-6, -1, 5) and i == 5:
2288
+ return self._parent._element_constructor_( (-5, -1, 4) )
2289
+ if self.value == (-5, 3) and i == 3:
2290
+ return self._parent._element_constructor_( (-3, -5, 4, 1) )
2291
+ if self.value == (-3, -5, 4, 1) and i == 4:
2292
+ return self._parent._element_constructor_( (-4, 1, 2) )
2293
+ if self.value == (-3, -5, 4, 1) and i == 1:
2294
+ return self._parent._element_constructor_( (-5, -1, 4) )
2295
+ if self.value == (-5, -1, 4) and i == 4:
2296
+ return self._parent._element_constructor_( (-1, -4, 3, 2) )
2297
+ if self.value == (-4, 1, 2) and i == 1:
2298
+ return self._parent._element_constructor_( (-1, -4, 3, 2) )
2299
+ if self.value == (-4, 1, 2) and i == 2:
2300
+ return self._parent._element_constructor_( (-2, 1) )
2301
+ if self.value == (-1, -4, 3, 2) and i == 3:
2302
+ return self._parent._element_constructor_( (-3, 2) )
2303
+ if self.value == (-1, -4, 3, 2) and i == 2:
2304
+ return self._parent._element_constructor_( (-2, -1, 3) )
2305
+ if self.value == (-2, 1) and i == 1:
2306
+ return self._parent._element_constructor_( (-2, -1, 3) )
2307
+ if self.value == (-1, 7) and i == 7:
2308
+ return self._parent._element_constructor_( (-7, -1, 6) )
2309
+ if self.value == (-2, -1, 3) and i == 3:
2310
+ return self._parent._element_constructor_( (-2, -3, 4) )
2311
+ if self.value == (-3, 2) and i == 2:
2312
+ return self._parent._element_constructor_( (-2, -3, 4) )
2313
+ if self.value == (-2, -3, 4) and i == 4:
2314
+ return self._parent._element_constructor_( (-4, 5) )
2315
+ if self.value == (-4, 5) and i == 5:
2316
+ return self._parent._element_constructor_( (-5, 6) )
2317
+ if self.value == (-5, 6) and i == 6:
2318
+ return self._parent._element_constructor_( (-6, 7) )
2319
+ if self.value == (-6, 7) and i == 7:
2320
+ return self._parent._element_constructor_( (-7,) )
2321
+ else:
2322
+ return None
2323
+
2324
+ #########################
2325
+ # Type A(m|n) (in BKK)
2326
+ #########################
2327
+
2328
+ cdef class BKKLetter(Letter):
2329
+ def _repr_(self):
2330
+ r"""
2331
+ A string representation of ``self``.
2332
+
2333
+ EXAMPLES::
2334
+
2335
+ sage: C = crystals.Letters(['A', [2, 1]])
2336
+ sage: C(2)
2337
+ 2
2338
+ sage: C(-3)
2339
+ -3
2340
+
2341
+ sage: C = crystals.Letters(['A', [2, 1]], dual=True)
2342
+ sage: C(2)
2343
+ 2*
2344
+ sage: C(-3)
2345
+ -3*
2346
+ """
2347
+ ret = Letter._repr_(self)
2348
+ if self._parent._dual:
2349
+ ret = ret + '*'
2350
+ return ret
2351
+
2352
+ def _unicode_art_(self):
2353
+ r"""
2354
+ A unicode art representation of ``self``.
2355
+
2356
+ EXAMPLES::
2357
+
2358
+ sage: C = crystals.Letters(['A', [2, 1]])
2359
+ sage: unicode_art(C(2))
2360
+ 2
2361
+ sage: unicode_art(C(-3))
2362
+
2363
+
2364
+ sage: C = crystals.Letters(['A', [2, 1]], dual=True)
2365
+ sage: unicode_art(C(2))
2366
+
2367
+ sage: unicode_art(C(-3))
2368
+ 3̄˅
2369
+ """
2370
+ ret = Letter._unicode_art_(self)
2371
+ from sage.typeset.unicode_art import UnicodeArt
2372
+ if self._parent._dual:
2373
+ ret = ret + UnicodeArt([u'˅'])
2374
+ return ret
2375
+
2376
+ def _latex_(self):
2377
+ r"""
2378
+ A latex representation of ``self``.
2379
+
2380
+ EXAMPLES::
2381
+
2382
+ sage: C = crystals.Letters(['A', [2, 1]])
2383
+ sage: latex(C(2))
2384
+ 2
2385
+ sage: latex(C(-3))
2386
+ \overline{3}
2387
+
2388
+ sage: C = crystals.Letters(['A', [2, 1]], dual=True)
2389
+ sage: latex(C(2))
2390
+ \underline{2}
2391
+ sage: latex(C(-3))
2392
+ \underline{\overline{3}}
2393
+ """
2394
+ ret = Letter._latex_(self)
2395
+ if self._parent._dual:
2396
+ ret = "\\underline{{{}}}".format(ret)
2397
+ return ret
2398
+
2399
+ cpdef Letter e(self, int i):
2400
+ r"""
2401
+ Return the action of `e_i` on ``self``.
2402
+
2403
+ EXAMPLES::
2404
+
2405
+ sage: C = crystals.Letters(['A', [2, 1]])
2406
+ sage: c = C(-2)
2407
+ sage: c.e(-2)
2408
+ -3
2409
+ sage: c = C(1)
2410
+ sage: c.e(0)
2411
+ -1
2412
+ sage: c = C(2)
2413
+ sage: c.e(1)
2414
+ 1
2415
+ sage: c.e(-2)
2416
+ """
2417
+ cdef int b = self.value
2418
+ if self._parent._dual:
2419
+ if 0 < i:
2420
+ if self.value == i:
2421
+ return self._parent._element_constructor_(b + 1)
2422
+ elif i < 0:
2423
+ if b == i - 1:
2424
+ return self._parent._element_constructor_(b + 1)
2425
+ elif i == 0 and b == -1:
2426
+ return self._parent._element_constructor_(1)
2427
+ return None
2428
+
2429
+ if i < 0:
2430
+ if b == i:
2431
+ return self._parent._element_constructor_(b - 1)
2432
+ elif 0 < i:
2433
+ if b == i + 1:
2434
+ return self._parent._element_constructor_(b - 1)
2435
+ elif i == 0 and b == 1:
2436
+ return self._parent._element_constructor_(-1)
2437
+ return None
2438
+
2439
+ cpdef Letter f(self, int i):
2440
+ r"""
2441
+ Return the action of `f_i` on ``self``.
2442
+
2443
+ EXAMPLES::
2444
+
2445
+ sage: C = crystals.Letters(['A', [2, 1]])
2446
+ sage: c = C.an_element()
2447
+ sage: c.f(-2)
2448
+ -2
2449
+ sage: c = C(-1)
2450
+ sage: c.f(0)
2451
+ 1
2452
+ sage: c = C(1)
2453
+ sage: c.f(1)
2454
+ 2
2455
+ sage: c.f(-2)
2456
+ """
2457
+ cdef int b = self.value
2458
+ if self._parent._dual:
2459
+ if i < 0:
2460
+ if b == i:
2461
+ return self._parent._element_constructor_(b - 1)
2462
+ elif 0 < i:
2463
+ if b == i + 1:
2464
+ return self._parent._element_constructor_(b - 1)
2465
+ elif i == 0 and b == 1:
2466
+ return self._parent._element_constructor_(-1)
2467
+ return None
2468
+
2469
+ if 0 < i:
2470
+ if self.value == i:
2471
+ return self._parent._element_constructor_(b + 1)
2472
+ elif i < 0:
2473
+ if b == i - 1:
2474
+ return self._parent._element_constructor_(b + 1)
2475
+ elif i == 0 and b == -1:
2476
+ return self._parent._element_constructor_(1)
2477
+ return None
2478
+
2479
+ def weight(self):
2480
+ """
2481
+ Return weight of ``self``.
2482
+
2483
+ EXAMPLES::
2484
+
2485
+ sage: C = crystals.Letters(['A', [2, 1]])
2486
+ sage: c = C(-1)
2487
+ sage: c.weight()
2488
+ (0, 0, 1, 0, 0)
2489
+ sage: c = C(2)
2490
+ sage: c.weight()
2491
+ (0, 0, 0, 0, 1)
2492
+ """
2493
+ # The ``Integer()`` should not be necessary, otherwise it does not
2494
+ # work properly for a negative Python int
2495
+ ret = self._parent.weight_lattice_realization().basis()[Integer(self.value)]
2496
+ if self._parent._dual:
2497
+ return -ret
2498
+ return ret
2499
+
2500
+
2501
+ class CrystalOfBKKLetters(ClassicalCrystalOfLetters):
2502
+ r"""
2503
+ Crystal of letters for Benkart-Kang-Kashiwara supercrystals.
2504
+
2505
+ This implements the `\mathfrak{gl}(m|n)` crystal of
2506
+ Benkart, Kang and Kashiwara [BKK2000]_.
2507
+
2508
+ EXAMPLES::
2509
+
2510
+ sage: C = crystals.Letters(['A', [1, 1]]); C
2511
+ The crystal of letters for type ['A', [1, 1]]
2512
+
2513
+ sage: C = crystals.Letters(['A', [2,4]], dual=True); C
2514
+ The crystal of letters for type ['A', [2, 4]] (dual)
2515
+ """
2516
+ @staticmethod
2517
+ def __classcall_private__(cls, ct, dual=None):
2518
+ """
2519
+ TESTS::
2520
+
2521
+ sage: crystals.Letters(['A', [1, 1]])
2522
+ The crystal of letters for type ['A', [1, 1]]
2523
+ """
2524
+ if dual is None:
2525
+ dual = False
2526
+ ct = CartanType(ct)
2527
+ return super().__classcall__(cls, ct, dual)
2528
+
2529
+ def __init__(self, ct, dual):
2530
+ """
2531
+ Initialize ``self``.
2532
+
2533
+ EXAMPLES::
2534
+
2535
+ sage: crystals.Letters(['A', [2, 1]])
2536
+ The crystal of letters for type ['A', [2, 1]]
2537
+ """
2538
+ self._dual = dual
2539
+ self._cartan_type = ct
2540
+ Parent.__init__(self, category=RegularSuperCrystals())
2541
+ self.module_generators = (self._element_constructor_(-self._cartan_type.m-1),)
2542
+ self._list = list(self.__iter__())
2543
+
2544
+ def __iter__(self):
2545
+ """
2546
+ Iterate through ``self``.
2547
+
2548
+ EXAMPLES::
2549
+
2550
+ sage: C = crystals.Letters(['A', [2, 1]])
2551
+ sage: [x for x in C]
2552
+ [-3, -2, -1, 1, 2]
2553
+ """
2554
+ cdef int t
2555
+ for t in range(-self._cartan_type.m - 1, self._cartan_type.n + 2):
2556
+ if t != 0:
2557
+ yield self._element_constructor_(t)
2558
+
2559
+ def _repr_(self):
2560
+ """
2561
+ TESTS::
2562
+
2563
+ sage: crystals.Letters(['A', [2, 1]])
2564
+ The crystal of letters for type ['A', [2, 1]]
2565
+ """
2566
+ ret = "The crystal of letters for type %s" % self._cartan_type
2567
+ if self._dual:
2568
+ ret += " (dual)"
2569
+ return ret
2570
+
2571
+ # temporary workaround while an_element is overridden by Parent
2572
+ _an_element_ = EnumeratedSets.ParentMethods._an_element_
2573
+
2574
+ Element = BKKLetter
2575
+
2576
+
2577
+ #################
2578
+ # Type q(n) queer
2579
+ #################
2580
+
2581
+ class CrystalOfQueerLetters(ClassicalCrystalOfLetters):
2582
+ r"""
2583
+ Queer crystal of letters elements.
2584
+
2585
+ The index set is of the form `\{-n, \ldots, -1, 1, \ldots, n\}`.
2586
+ For `1 < i \leq n`, the operators `e_{-i}` and `f_{-i}` are defined as
2587
+
2588
+ .. MATH::
2589
+
2590
+ f_{-i} = s_{w^{-1}_i} f_{-1} s_{w_i}, \quad
2591
+ e_{-i} = s_{w^{-1}_i} e_{-1} s_{w_i},
2592
+
2593
+ where `w_i = s_2 \cdots s_i s_1 \cdots s_{i-1}` and `s_i` is the
2594
+ reflection along the `i`-string in the crystal. See [GJK+2014]_.
2595
+
2596
+ TESTS::
2597
+
2598
+ sage: Q = crystals.Letters(['Q',4])
2599
+ sage: Q.list()
2600
+ [1, 2, 3, 4]
2601
+ sage: [ [x < y for y in Q] for x in Q ]
2602
+ [[False, True, True, True],
2603
+ [False, False, True, True],
2604
+ [False, False, False, True],
2605
+ [False, False, False, False]]
2606
+ sage: Q.module_generators
2607
+ (1,)
2608
+ sage: TestSuite(Q).run()
2609
+ """
2610
+ @staticmethod
2611
+ def __classcall_private__(cls, ct):
2612
+ """
2613
+ Normalize input to ensure a unique representation.
2614
+
2615
+ TESTS::
2616
+
2617
+ sage: crystals.Letters(['Q',3])
2618
+ The queer crystal of letters for q(3)
2619
+ """
2620
+ ct = CartanType(ct)
2621
+ return super().__classcall__(cls, ct)
2622
+
2623
+ def __init__(self, ct):
2624
+ """
2625
+ Initialize ``self``.
2626
+
2627
+ EXAMPLES::
2628
+
2629
+ sage: Q = crystals.Letters(['Q',3]); Q
2630
+ The queer crystal of letters for q(3)
2631
+ sage: Q.module_generators
2632
+ (1,)
2633
+ sage: Q._index_set
2634
+ (1, 2, -2, -1)
2635
+ sage: Q._list
2636
+ [1, 2, 3]
2637
+ """
2638
+ self._cartan_type = ct
2639
+ Parent.__init__(self, category=RegularSuperCrystals())
2640
+ self._index_set = ct.index_set()
2641
+ self.module_generators = (self._element_constructor_(1),)
2642
+ self._list = list(self.__iter__())
2643
+
2644
+ def __iter__(self):
2645
+ """
2646
+ Iterate through ``self``.
2647
+
2648
+ EXAMPLES::
2649
+
2650
+ sage: Q = crystals.Letters(['Q',3])
2651
+ sage: [x for x in Q]
2652
+ [1, 2, 3]
2653
+ """
2654
+ cdef int t
2655
+ for t in range(1, self._cartan_type.n + 2):
2656
+ yield self._element_constructor_(t)
2657
+
2658
+ def _repr_(self):
2659
+ """
2660
+ TESTS::
2661
+
2662
+ sage: crystals.Letters(['Q',3])
2663
+ The queer crystal of letters for q(3)
2664
+ """
2665
+ return "The queer crystal of letters for q(%s)" % (
2666
+ self._cartan_type.n + 1)
2667
+
2668
+ def index_set(self):
2669
+ """
2670
+ Return index set of ``self``.
2671
+
2672
+ EXAMPLES::
2673
+
2674
+ sage: Q = crystals.Letters(['Q',3])
2675
+ sage: Q.index_set()
2676
+ (1, 2, -2, -1)
2677
+ """
2678
+ return self._index_set
2679
+
2680
+ # temporary workaround while an_element is overridden by Parent
2681
+ _an_element_ = EnumeratedSets.ParentMethods._an_element_
2682
+
2683
+ Element = QueerLetter_element
2684
+
2685
+
2686
+ cdef class QueerLetter_element(Letter):
2687
+ r"""
2688
+ Queer supercrystal letters elements.
2689
+
2690
+ TESTS::
2691
+
2692
+ sage: Q = crystals.Letters(['Q',3])
2693
+ sage: Q.list()
2694
+ [1, 2, 3]
2695
+ sage: [ [x < y for y in Q] for x in Q ]
2696
+ [[False, True, True], [False, False, True], [False, False, False]]
2697
+
2698
+ ::
2699
+
2700
+ sage: Q = crystals.Letters(['Q',3])
2701
+ sage: Q(1) < Q(1), Q(1) < Q(2), Q(2)< Q(1)
2702
+ (False, True, False)
2703
+
2704
+ ::
2705
+
2706
+ sage: TestSuite(Q).run()
2707
+ """
2708
+ def weight(self):
2709
+ """
2710
+ Return the weight of ``self``.
2711
+
2712
+ EXAMPLES::
2713
+
2714
+ sage: [v.weight() for v in crystals.Letters(['Q',4])]
2715
+ [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)]
2716
+ """
2717
+ return self._parent.weight_lattice_realization().monomial(self.value-1)
2718
+
2719
+ cpdef Letter e(self, int i):
2720
+ r"""
2721
+ Return the action of `e_i` on ``self``.
2722
+
2723
+ EXAMPLES::
2724
+
2725
+ sage: Q = crystals.Letters(['Q',3])
2726
+ sage: [(c,i,c.e(i)) for i in Q.index_set() for c in Q if c.e(i) is not None]
2727
+ [(2, 1, 1), (3, 2, 2), (3, -2, 2), (2, -1, 1)]
2728
+ """
2729
+ if self.value == -i+1:
2730
+ return self._parent._element_constructor_(self.value-1)
2731
+ if self.value == i+1:
2732
+ return self._parent._element_constructor_(self.value-1)
2733
+ return None
2734
+
2735
+ cpdef Letter f(self, int i):
2736
+ r"""
2737
+ Return the action of `f_i` on ``self``.
2738
+
2739
+ EXAMPLES::
2740
+
2741
+ sage: Q = crystals.Letters(['Q',3])
2742
+ sage: [(c,i,c.f(i)) for i in Q.index_set() for c in Q if c.f(i) is not None]
2743
+ [(1, 1, 2), (2, 2, 3), (2, -2, 3), (1, -1, 2)]
2744
+ """
2745
+ if self.value == -i:
2746
+ return self._parent._element_constructor_(-i+1)
2747
+ if self.value == i:
2748
+ return self._parent._element_constructor_(self.value+1)
2749
+ return None
2750
+
2751
+ cpdef int epsilon(self, int i) noexcept:
2752
+ r"""
2753
+ Return `\varepsilon_i` of ``self``.
2754
+
2755
+ EXAMPLES::
2756
+
2757
+ sage: Q = crystals.Letters(['Q',3])
2758
+ sage: [(c,i) for i in Q.index_set() for c in Q if c.epsilon(i) != 0]
2759
+ [(2, 1), (3, 2), (3, -2), (2, -1)]
2760
+ """
2761
+ if self.value == i+1 or self.value == -i+1:
2762
+ return 1
2763
+ return 0
2764
+
2765
+ cpdef int phi(self, int i) noexcept:
2766
+ r"""
2767
+ Return `\varphi_i` of ``self``.
2768
+
2769
+ EXAMPLES::
2770
+
2771
+ sage: Q = crystals.Letters(['Q',3])
2772
+ sage: [(c,i) for i in Q.index_set() for c in Q if c.phi(i) != 0]
2773
+ [(1, 1), (2, 2), (2, -2), (1, -1)]
2774
+ """
2775
+ if self.value == i or self.value == -i:
2776
+ return 1
2777
+ return 0
2778
+
2779
+ #########################
2780
+ # Wrapped letters
2781
+ #########################
2782
+
2783
+ cdef class LetterWrapped(Element):
2784
+ r"""
2785
+ Element which uses another crystal implementation and converts
2786
+ those elements to a tuple with `\pm i`.
2787
+ """
2788
+ def __init__(self, parent, Element value):
2789
+ """
2790
+ Initialize ``self``.
2791
+
2792
+ EXAMPLES::
2793
+
2794
+ sage: C = crystals.Letters(['E', 8])
2795
+ sage: a = C((1,-4,5))
2796
+ sage: TestSuite(a).run()
2797
+ """
2798
+ self.value = value
2799
+ Element.__init__(self, parent)
2800
+
2801
+ def __reduce__(self):
2802
+ """
2803
+ Used in pickling of letters.
2804
+
2805
+ EXAMPLES::
2806
+
2807
+ sage: C = crystals.Letters(['E', 8])
2808
+ sage: a = C((1,-4,5))
2809
+ sage: a.__reduce__()
2810
+ (The crystal of letters for type ['E', 8], (Y(1,6) Y(4,6)^-1 Y(5,5),))
2811
+ """
2812
+ return (self._parent, (self.value,))
2813
+
2814
+ def __hash__(self):
2815
+ """
2816
+ Return the hash value of ``self``.
2817
+
2818
+ EXAMPLES::
2819
+
2820
+ sage: C = crystals.Letters(['E', 8])
2821
+ sage: c = C((1,-4,5))
2822
+ sage: hash(c) == hash(c.value)
2823
+ True
2824
+ """
2825
+ return hash(self.value)
2826
+
2827
+ cpdef _richcmp_(left, right, int op):
2828
+ """
2829
+ Check comparison between ``left`` and ``right`` based on ``op``.
2830
+
2831
+ EXAMPLES::
2832
+
2833
+ sage: C = crystals.Letters(['E', 8])
2834
+ sage: C((8,)) < C((1,-4,5)) # indirect doctest
2835
+ True
2836
+ sage: C((-2,6)) < C((1,-4,5))
2837
+ False
2838
+ sage: C((1,-4,5)) == C((1,-4,5))
2839
+ True
2840
+ """
2841
+ cdef LetterWrapped self, x
2842
+ self = left
2843
+ x = right
2844
+ if op == Py_EQ:
2845
+ return self.value == x.value
2846
+ if op == Py_NE:
2847
+ return self.value != x.value
2848
+ if op == Py_LT:
2849
+ return self._parent.lt_elements(self, x)
2850
+ if op == Py_GT:
2851
+ return x._parent.lt_elements(x, self)
2852
+ if op == Py_LE:
2853
+ return self.value == x.value or self._parent.lt_elements(self, x)
2854
+ if op == Py_GE:
2855
+ return self.value == x.value or x._parent.lt_elements(x, self)
2856
+ return False
2857
+
2858
+ cpdef tuple _to_tuple(self):
2859
+ r"""
2860
+ Return a tuple encoding the `\varepsilon_i` and `\varphi_i`
2861
+ values of ``elt``.
2862
+
2863
+ EXAMPLES::
2864
+
2865
+ sage: C = crystals.Letters(['E', 8])
2866
+ sage: t = (1,-4,5)
2867
+ sage: elt = C(t)
2868
+ sage: elt._to_tuple() == t
2869
+ True
2870
+ """
2871
+ cdef list ret = []
2872
+ cdef int i
2873
+ for i in self._parent.cartan_type().index_set():
2874
+ ret += [-i]*int(self.value.epsilon(i))
2875
+ ret += [i]*int(self.value.phi(i))
2876
+ return tuple(ret)
2877
+
2878
+ def _repr_(self):
2879
+ """
2880
+ Return a string representation of ``self``.
2881
+
2882
+ EXAMPLES::
2883
+
2884
+ sage: C = crystals.Letters(['E', 8])
2885
+ sage: C((1,-4,5))
2886
+ (1, -4, 5)
2887
+ """
2888
+ return repr(self._to_tuple())
2889
+
2890
+ def _unicode_art_(self):
2891
+ r"""
2892
+ A unicode art representation of ``self``.
2893
+
2894
+ EXAMPLES::
2895
+
2896
+ sage: C = crystals.Letters(['E', 8])
2897
+ sage: unicode_art(C((1,-4,5)))
2898
+ (1, 4̄, 5)
2899
+ """
2900
+ from sage.typeset.unicode_art import UnicodeArt
2901
+ return UnicodeArt([u"({})".format(u", ".join(unicode(x) if x > 0 else unicode(-x) + u"̄"
2902
+ for x in self._to_tuple()))])
2903
+
2904
+ def _latex_(self):
2905
+ r"""
2906
+ A latex representation of ``self``.
2907
+
2908
+ EXAMPLES::
2909
+
2910
+ sage: C = crystals.Letters(['E', 8])
2911
+ sage: latex(C((1,-4,5)))
2912
+ \left(1, \overline{4}, 5\right)
2913
+ """
2914
+ ret = "\\left("
2915
+ first = True
2916
+ for v in self._to_tuple():
2917
+ if not first:
2918
+ ret += ", "
2919
+ else:
2920
+ first = False
2921
+ if v < 0:
2922
+ ret += "\\overline{" + repr(-v) + "}"
2923
+ else:
2924
+ ret+= repr(v)
2925
+ return ret + "\\right)"
2926
+
2927
+ cpdef LetterWrapped e(self, int i):
2928
+ r"""
2929
+ Return `e_i` of ``self``.
2930
+
2931
+ EXAMPLES::
2932
+
2933
+ sage: C = crystals.Letters(['E', 8])
2934
+ sage: C((-8,)).e(1)
2935
+ sage: C((-8,)).e(8)
2936
+ (-7, 8)
2937
+ """
2938
+ cdef Element ret = self.value.e(i)
2939
+ if ret is None:
2940
+ return None
2941
+ return type(self)(self._parent, ret)
2942
+
2943
+ cpdef LetterWrapped f(self, int i):
2944
+ r"""
2945
+ Return `f_i` of ``self``.
2946
+
2947
+ EXAMPLES::
2948
+
2949
+ sage: C = crystals.Letters(['E', 8])
2950
+ sage: C((8,)).f(6)
2951
+ sage: C((8,)).f(8)
2952
+ (7, -8)
2953
+ """
2954
+ cdef Element ret = self.value.f(i)
2955
+ if ret is None:
2956
+ return None
2957
+ return type(self)(self._parent, ret)
2958
+
2959
+ cpdef int epsilon(self, int i) noexcept:
2960
+ r"""
2961
+ Return `\varepsilon_i` of ``self``.
2962
+
2963
+ EXAMPLES::
2964
+
2965
+ sage: C = crystals.Letters(['E', 8])
2966
+ sage: C((-8,)).epsilon(1)
2967
+ 0
2968
+ sage: C((-8,)).epsilon(8)
2969
+ 1
2970
+ """
2971
+ return self.value.epsilon(i)
2972
+
2973
+ cpdef int phi(self, int i) noexcept:
2974
+ r"""
2975
+ Return `\varphi_i` of ``self``.
2976
+
2977
+ EXAMPLES::
2978
+
2979
+ sage: C = crystals.Letters(['E', 8])
2980
+ sage: C((8,)).phi(8)
2981
+ 1
2982
+ sage: C((8,)).phi(6)
2983
+ 0
2984
+ """
2985
+ return self.value.phi(i)
2986
+
2987
+
2988
+ class ClassicalCrystalOfLettersWrapped(ClassicalCrystalOfLetters):
2989
+ r"""
2990
+ Crystal of letters by wrapping another crystal.
2991
+
2992
+ This is used for a crystal of letters of type `E_8` and `F_4`.
2993
+
2994
+ This class follows the same output as the other crystal of letters,
2995
+ where `b` is represented by the "letter" with `\varphi_i(b)` (resp.,
2996
+ `\varepsilon_i`) number of `i`'s (resp., `-i`'s or `\bar{i}`'s).
2997
+ However, this uses an auxiliary crystal to construct these letters
2998
+ to avoid hardcoding the crystal elements and the corresponding edges;
2999
+ in particular, the 248 nodes of `E_8`.
3000
+ """
3001
+ def __init__(self, cartan_type):
3002
+ """
3003
+ Initialize ``self``.
3004
+
3005
+ EXAMPLES::
3006
+
3007
+ sage: C = crystals.Letters(['E', 8])
3008
+ sage: TestSuite(C).run() # long time
3009
+
3010
+ sage: C = crystals.Letters(['F', 4])
3011
+ sage: TestSuite(C).run()
3012
+ """
3013
+ ClassicalCrystalOfLetters.__init__(self, cartan_type, LetterWrapped)
3014
+
3015
+ def __call__(self, value):
3016
+ """
3017
+ Parse input to valid values to give to ``_element_constructor_()``.
3018
+
3019
+ EXAMPLES::
3020
+
3021
+ sage: C = crystals.Letters(['E', 8])
3022
+ sage: c = C((8,))
3023
+ sage: c == C.module_generators[0]
3024
+ True
3025
+ sage: C([8]) == c
3026
+ True
3027
+ """
3028
+ if isinstance(value, self.element_class) and value.parent() is self:
3029
+ return value
3030
+ if value == 'E':
3031
+ return EmptyLetter(self)
3032
+ C = self.module_generators[0].value.parent()
3033
+ if isinstance(value, C.element_class) and value.parent() is C:
3034
+ return self.element_class(self, value)
3035
+ if isinstance(value, list):
3036
+ value = tuple(value)
3037
+ if value in self._tuple_to_element_dict:
3038
+ return self._tuple_to_element_dict[value]
3039
+ raise ValueError("not an element in the crystal")
3040
+
3041
+ @lazy_attribute
3042
+ def _tuple_to_element_dict(self):
3043
+ """
3044
+ A dictionary from tuples to elements of ``self``.
3045
+
3046
+ EXAMPLES::
3047
+
3048
+ sage: C = crystals.Letters(['E', 8])
3049
+ sage: (8,) in C._tuple_to_element_dict
3050
+ True
3051
+ sage: (-4, 4) in C._tuple_to_element_dict
3052
+ True
3053
+ sage: (-4, 3) in C._tuple_to_element_dict
3054
+ False
3055
+ """
3056
+ return {elt._to_tuple(): elt for elt in self}