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,1177 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.graphs sage.modules
3
+ """
4
+ Tensor products of crystals
5
+
6
+ Main entry points:
7
+
8
+ - :class:`~sage.combinat.crystals.tensor_product.TensorProductOfCrystals`
9
+ - :class:`~sage.combinat.crystals.tensor_product.CrystalOfTableaux`
10
+
11
+ AUTHORS:
12
+
13
+ - Anne Schilling, Nicolas Thiery (2007): initial version
14
+ - Ben Salisbury, Travis Scrimshaw (2013): refactored tensor products to handle
15
+ non-regular crystals and created new subclass to take advantage of
16
+ the regularity
17
+ - Travis Scrimshaw (2020): added queer crystal
18
+ """
19
+ #*****************************************************************************
20
+ # Copyright (C) 2007 Anne Schilling <anne at math.ucdavis.edu>
21
+ # Nicolas Thiery <nthiery at users.sf.net>
22
+ # 2020 Travis Scrimshaw <tcscrims at gmail.com>
23
+ # Ben Salisbury <salis1bt at cmich.edu>
24
+ #
25
+ # Distributed under the terms of the GNU General Public License (GPL)
26
+ #
27
+ # This code is distributed in the hope that it will be useful,
28
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
29
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
+ # General Public License for more details.
31
+ #
32
+ # The full text of the GPL is available at:
33
+ #
34
+ # http://www.gnu.org/licenses/
35
+ #****************************************************************************
36
+
37
+ import operator
38
+ from sage.misc.cachefunc import cached_method
39
+ from sage.structure.parent import Parent
40
+ from sage.structure.unique_representation import UniqueRepresentation
41
+ from sage.structure.global_options import GlobalOptions
42
+ from sage.categories.category import Category
43
+ from sage.categories.cartesian_product import cartesian_product
44
+ from sage.categories.classical_crystals import ClassicalCrystals
45
+ from sage.categories.regular_crystals import RegularCrystals
46
+ from sage.categories.sets_cat import Sets
47
+ from sage.combinat.root_system.cartan_type import CartanType, SuperCartanType_standard
48
+ from sage.combinat.partition import _Partitions
49
+ from .letters import CrystalOfLetters
50
+ from .spins import CrystalOfSpins, CrystalOfSpinsMinus, CrystalOfSpinsPlus
51
+ from sage.combinat.crystals.tensor_product_element import (TensorProductOfCrystalsElement,
52
+ TensorProductOfRegularCrystalsElement, CrystalOfTableauxElement,
53
+ TensorProductOfSuperCrystalsElement, TensorProductOfQueerSuperCrystalsElement)
54
+ from sage.misc.flatten import flatten
55
+ from sage.structure.element import get_coercion_model
56
+ from sage.rings.semirings.non_negative_integer_semiring import NN
57
+ from sage.arith.misc import integer_trunc as trunc
58
+
59
+
60
+ ##############################################################################
61
+ # Support classes
62
+ ##############################################################################
63
+
64
+ class CrystalOfWords(UniqueRepresentation, Parent):
65
+ """
66
+ Auxiliary class to provide a call method to create tensor product elements.
67
+ This class is shared with several tensor product classes and is also used
68
+ in :class:`~sage.combinat.crystals.tensor_product.CrystalOfTableaux`
69
+ to allow tableaux of different tensor product structures in
70
+ column-reading (and hence different shapes) to be considered elements
71
+ in the same crystal.
72
+ """
73
+
74
+ def _element_constructor_(self, *crystalElements):
75
+ """
76
+ EXAMPLES::
77
+
78
+ sage: C = crystals.Letters(['A',2])
79
+ sage: T = crystals.TensorProduct(C,C)
80
+ sage: T(1,1)
81
+ [1, 1]
82
+ sage: _.parent()
83
+ Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]]
84
+ sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
85
+ sage: T(C(2), C(1), C(1))
86
+ [2, 1, 1]
87
+ """
88
+ return self.element_class(self, list(crystalElements))
89
+
90
+ class Element(TensorProductOfCrystalsElement):
91
+ pass
92
+
93
+
94
+ class TensorProductOfCrystals(CrystalOfWords):
95
+ r"""
96
+ Tensor product of crystals.
97
+
98
+ Given two crystals `B` and `B'` of the same Cartan type,
99
+ one can form the tensor product `B \otimes B^{\prime}`. As a set
100
+ `B \otimes B^{\prime}` is the Cartesian product
101
+ `B \times B^{\prime}`. The crystal operators `f_i` and
102
+ `e_i` act on `b \otimes b^{\prime} \in B \otimes B^{\prime}` as
103
+ follows:
104
+
105
+ .. MATH::
106
+
107
+ f_i(b \otimes b^{\prime}) = \begin{cases}
108
+ f_i(b) \otimes b^{\prime} & \text{if } \varepsilon_i(b) \geq
109
+ \varphi_i(b^{\prime}) \\
110
+ b \otimes f_i(b^{\prime}) & \text{otherwise}
111
+ \end{cases}
112
+
113
+ and
114
+
115
+ .. MATH::
116
+
117
+ e_i(b \otimes b') = \begin{cases}
118
+ e_i(b) \otimes b' & \text{if } \varepsilon_i(b) >
119
+ \varphi_i(b') \\ b \otimes e_i(b') & \text{otherwise.}
120
+ \end{cases}
121
+
122
+ We also define:
123
+
124
+ .. MATH::
125
+
126
+ \begin{aligned}
127
+ \varphi_i(b \otimes b') & = \max\left( \varphi_i(b),
128
+ \varphi_i(b') + \langle \alpha_i^{\vee}, \mathrm{wt}(b) \rangle
129
+ \right),
130
+ \\ \varepsilon_i(b \otimes b') & = \max\left( \varepsilon_i(b'),
131
+ \varepsilon_i(b) - \langle \alpha_i^{\vee}, \mathrm{wt}(b') \rangle
132
+ \right).
133
+ \end{aligned}
134
+
135
+ .. NOTE::
136
+
137
+ This is the opposite of Kashiwara's convention for tensor
138
+ products of crystals.
139
+
140
+ Since tensor products are associative `(\mathcal{B} \otimes \mathcal{C})
141
+ \otimes \mathcal{D} \cong \mathcal{B} \otimes (\mathcal{C} \otimes
142
+ \mathcal{D})` via the natural isomorphism `(b \otimes c) \otimes d \mapsto
143
+ b \otimes (c \otimes d)`, we can generalizing this to arbitrary tensor
144
+ products. Thus consider `B_N \otimes \cdots \otimes B_1`, where each
145
+ `B_k` is an abstract crystal. The underlying set of the tensor product is
146
+ `B_N \times \cdots \times B_1`, while the crystal structure is given
147
+ as follows. Let `I` be the index set, and fix some `i \in I` and `b_N
148
+ \otimes \cdots \otimes b_1 \in B_N \otimes \cdots \otimes B_1`. Define
149
+
150
+ .. MATH::
151
+
152
+ a_i(k) := \varepsilon_i(b_k) - \sum_{j=1}^{k-1} \langle
153
+ \alpha_i^{\vee}, \mathrm{wt}(b_j) \rangle.
154
+
155
+ Then
156
+
157
+ .. MATH::
158
+
159
+ \begin{aligned}
160
+ \mathrm{wt}(b_N \otimes \cdots \otimes b_1) &=
161
+ \mathrm{wt}(b_N) + \cdots + \mathrm{wt}(b_1),
162
+ \\ \varepsilon_i(b_N \otimes \cdots \otimes b_1) &= \max_{1 \leq k
163
+ \leq n}\left( \sum_{j=1}^k \varepsilon_i(b_j) - \sum_{j=1}^{k-1}
164
+ \varphi_i(b_j) \right)
165
+ \\ & = \max_{1 \leq k \leq N}\bigl( a_i(k) \bigr),
166
+ \\ \varphi_i(b_N \otimes \cdots \otimes b_1) &= \max_{1 \leq k \leq N}
167
+ \left( \varphi_i(b_N) + \sum_{j=k}^{N-1} \big( \varphi_i(b_j) -
168
+ \varepsilon_i(b_{j+1}) \big) \right)
169
+ \\ & = \max_{1 \leq k \leq N}\bigl( \lambda_i + a_i(k) \bigr)
170
+ \end{aligned}
171
+
172
+ where `\lambda_i = \langle \alpha_i^{\vee}, \mathrm{wt}(b_N \otimes \cdots
173
+ \otimes b_1) \rangle`. Then for `k = 1, \ldots, N` the action of the
174
+ Kashiwara operators is determined as follows.
175
+
176
+ - If `a_i(k) > a_i(j)` for `1 \leq j < k` and `a_i(k) \geq a_i(j)`
177
+ for `k < j \leq N`:
178
+
179
+ .. MATH::
180
+
181
+ e_i(b_N \otimes \cdots \otimes b_1) = b_N \otimes \cdots \otimes
182
+ e_i b_k \otimes \cdots \otimes b_1.
183
+
184
+ - If `a_i(k) \geq a_i(j)` for `1 \leq j < k` and `a_i(k) > a_i(j)`
185
+ for `k < j \leq N`:
186
+
187
+ .. MATH::
188
+
189
+ f_i(b_N \otimes \cdots \otimes b_1) = b_N \otimes \cdots \otimes
190
+ f_i b_k \otimes \cdots \otimes b_1.
191
+
192
+ Note that this is just recursively applying the definition of the tensor
193
+ product on two crystals. Recall that `\langle \alpha_i^{\vee},
194
+ \mathrm{wt}(b_j) \rangle = \varphi_i(b_j) - \varepsilon_i(b_j)` by the
195
+ definition of a crystal.
196
+
197
+ .. RUBRIC:: Regular crystals
198
+
199
+ Now if all crystals `B_k` are regular crystals, all `\varepsilon_i` and
200
+ `\varphi_i` are nonnegative and we can
201
+ define tensor product by the *signature rule*. We start by writing a word
202
+ in `+` and `-` as follows:
203
+
204
+ .. MATH::
205
+
206
+ \underbrace{- \cdots -}_{\varphi_i(b_N) \text{ times}} \quad
207
+ \underbrace{+ \cdots +}_{\varepsilon_i(b_N) \text{ times}}
208
+ \quad \cdots \quad
209
+ \underbrace{- \cdots -}_{\varphi_i(b_1) \text{ times}} \quad
210
+ \underbrace{+ \cdots +}_{\varepsilon_i(b_1) \text{ times}},
211
+
212
+ and then canceling ordered pairs of `+-` until the word is in the reduced
213
+ form:
214
+
215
+ .. MATH::
216
+
217
+ \underbrace{- \cdots -}_{\varphi_i \text{ times}} \quad
218
+ \underbrace{+ \cdots +}_{\varepsilon_i \text{ times}}.
219
+
220
+ Here `e_i` acts on the factor corresponding to the leftmost `+` and `f_i`
221
+ on the factor corresponding to the rightmost `-`. If there is no `+` or
222
+ `-` respectively, then the result is `0` (``None``).
223
+
224
+ EXAMPLES:
225
+
226
+ We construct the type `A_2`-crystal generated by `2 \otimes 1 \otimes 1`::
227
+
228
+ sage: C = crystals.Letters(['A',2])
229
+ sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
230
+
231
+ It has `8` elements::
232
+
233
+ sage: T.list()
234
+ [[2, 1, 1], [2, 1, 2], [2, 1, 3], [3, 1, 3],
235
+ [3, 2, 3], [3, 1, 1], [3, 1, 2], [3, 2, 2]]
236
+
237
+ One can also check the Cartan type of the crystal::
238
+
239
+ sage: T.cartan_type()
240
+ ['A', 2]
241
+
242
+ Other examples include crystals of tableaux (which internally are
243
+ represented as tensor products obtained by reading the tableaux
244
+ columnwise)::
245
+
246
+ sage: C = crystals.Tableaux(['A',3], shape=[1,1,0])
247
+ sage: D = crystals.Tableaux(['A',3], shape=[1,0,0])
248
+ sage: T = crystals.TensorProduct(C,D, generators=[[C(rows=[[1], [2]]), D(rows=[[1]])], [C(rows=[[2], [3]]), D(rows=[[1]])]])
249
+ sage: T.cardinality()
250
+ 24
251
+ sage: TestSuite(T).run()
252
+ sage: T.module_generators
253
+ ([[[1], [2]], [[1]]], [[[2], [3]], [[1]]])
254
+ sage: [x.weight() for x in T.module_generators]
255
+ [(2, 1, 0, 0), (1, 1, 1, 0)]
256
+
257
+ If no module generators are specified, we obtain the full tensor
258
+ product::
259
+
260
+ sage: C = crystals.Letters(['A',2])
261
+ sage: T = crystals.TensorProduct(C,C)
262
+ sage: T.list()
263
+ [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]
264
+ sage: T.cardinality()
265
+ 9
266
+
267
+ For a tensor product of crystals without module generators, the
268
+ default implementation of ``module_generators`` contains all elements
269
+ in the tensor product of the crystals. If there is a subset of
270
+ elements in the tensor product that still generates the crystal,
271
+ this needs to be implemented for the specific crystal separately::
272
+
273
+ sage: T.module_generators.list()
274
+ [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]
275
+
276
+ For classical highest weight crystals, it is also possible to list
277
+ all highest weight elements::
278
+
279
+ sage: C = crystals.Letters(['A',2])
280
+ sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)],[C(1),C(2),C(1)]])
281
+ sage: T.highest_weight_vectors()
282
+ ([2, 1, 1], [1, 2, 1])
283
+
284
+ Examples with non-regular and infinite crystals (these did not work
285
+ before :issue:`14402`)::
286
+
287
+ sage: B = crystals.infinity.Tableaux(['D',10])
288
+ sage: T = crystals.TensorProduct(B,B)
289
+ sage: T
290
+ Full tensor product of the crystals
291
+ [The infinity crystal of tableaux of type ['D', 10],
292
+ The infinity crystal of tableaux of type ['D', 10]]
293
+
294
+ sage: B = crystals.infinity.GeneralizedYoungWalls(15)
295
+ sage: T = crystals.TensorProduct(B,B,B)
296
+ sage: T
297
+ Full tensor product of the crystals
298
+ [Crystal of generalized Young walls of type ['A', 15, 1],
299
+ Crystal of generalized Young walls of type ['A', 15, 1],
300
+ Crystal of generalized Young walls of type ['A', 15, 1]]
301
+
302
+ sage: La = RootSystem(['A',2,1]).weight_lattice(extended=True).fundamental_weights()
303
+ sage: B = crystals.GeneralizedYoungWalls(2,La[0]+La[1])
304
+ sage: C = crystals.GeneralizedYoungWalls(2,2*La[2])
305
+ sage: D = crystals.GeneralizedYoungWalls(2,3*La[0]+La[2])
306
+ sage: T = crystals.TensorProduct(B,C,D)
307
+ sage: T
308
+ Full tensor product of the crystals
309
+ [Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight Lambda[0] + Lambda[1],
310
+ Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight 2*Lambda[2],
311
+ Highest weight crystal of generalized Young walls of Cartan type ['A', 2, 1] and highest weight 3*Lambda[0] + Lambda[2]]
312
+
313
+ There is also a global option for setting the convention (by default Sage
314
+ uses anti-Kashiwara)::
315
+
316
+ sage: C = crystals.Letters(['A',2])
317
+ sage: T = crystals.TensorProduct(C,C)
318
+ sage: elt = T(C(1), C(2)); elt
319
+ [1, 2]
320
+ sage: crystals.TensorProduct.options.convention = "Kashiwara"
321
+ sage: elt
322
+ [2, 1]
323
+ sage: crystals.TensorProduct.options._reset()
324
+ """
325
+ @staticmethod
326
+ def __classcall_private__(cls, *crystals, **options):
327
+ """
328
+ Create the correct parent object.
329
+
330
+ EXAMPLES::
331
+
332
+ sage: C = crystals.Letters(['A',2])
333
+ sage: T = crystals.TensorProduct(C, C)
334
+ sage: T2 = crystals.TensorProduct(C, C, cartan_type=['A',2])
335
+ sage: T is T2
336
+ True
337
+ sage: T.category()
338
+ Category of tensor products of classical crystals
339
+
340
+ sage: T3 = crystals.TensorProduct(C, C, C)
341
+ sage: T3p = crystals.TensorProduct(T, C)
342
+ sage: T3 is T3p
343
+ True
344
+ sage: B1 = crystals.TensorProduct(T, C)
345
+ sage: B2 = crystals.TensorProduct(C, T)
346
+ sage: B3 = crystals.TensorProduct(C, C, C)
347
+ sage: B1 is B2 and B2 is B3
348
+ True
349
+
350
+ sage: B = crystals.infinity.Tableaux(['A',2])
351
+ sage: T = crystals.TensorProduct(B, B)
352
+ sage: T.category()
353
+ Category of infinite tensor products of highest weight crystals
354
+
355
+ Check that we get a tensor product of super crystals when given
356
+ a super Cartan type (:issue:`33518`)::
357
+
358
+ sage: L = crystals.Letters(['A',[1,2]])
359
+ sage: type(crystals.TensorProduct(L, L))
360
+ <class 'sage.combinat.crystals.tensor_product.FullTensorProductOfSuperCrystals_with_category'>
361
+
362
+ sage: L = crystals.Letters(['Q',2])
363
+ sage: type(crystals.TensorProduct(L, L))
364
+ <class 'sage.combinat.crystals.tensor_product.FullTensorProductOfQueerSuperCrystals_with_category'>
365
+
366
+ TESTS:
367
+
368
+ Check that mismatched Cartan types raise an error::
369
+
370
+ sage: A2 = crystals.Letters(['A', 2])
371
+ sage: A3 = crystals.Letters(['A', 3])
372
+ sage: crystals.TensorProduct(A2, A3)
373
+ Traceback (most recent call last):
374
+ ...
375
+ ValueError: all crystals must be of the same Cartan type
376
+ """
377
+ crystals = tuple(crystals)
378
+ if "cartan_type" in options:
379
+ cartan_type = CartanType(options.pop("cartan_type"))
380
+ else:
381
+ if not crystals:
382
+ raise ValueError("you need to specify the Cartan type if the tensor product list is empty")
383
+ else:
384
+ cartan_type = crystals[0].cartan_type()
385
+
386
+ if any(c.cartan_type() != cartan_type for c in crystals):
387
+ raise ValueError("all crystals must be of the same Cartan type")
388
+
389
+ if cartan_type.type() == 'Q':
390
+ return FullTensorProductOfQueerSuperCrystals(crystals, **options)
391
+ if isinstance(cartan_type, SuperCartanType_standard):
392
+ return FullTensorProductOfSuperCrystals(crystals, **options)
393
+
394
+ if "generators" in options:
395
+ generators = tuple(tuple(x) if isinstance(x, list) else x for x in options["generators"])
396
+
397
+ if all(c in RegularCrystals() for c in crystals):
398
+ return TensorProductOfRegularCrystalsWithGenerators(crystals, generators, cartan_type)
399
+ return TensorProductOfCrystalsWithGenerators(crystals, generators, cartan_type)
400
+
401
+ # Flatten out tensor products
402
+ tp = sum([B.crystals if isinstance(B, FullTensorProductOfCrystals) else (B,)
403
+ for B in crystals], ())
404
+
405
+ if all(c in RegularCrystals() for c in crystals):
406
+ return FullTensorProductOfRegularCrystals(tp, cartan_type=cartan_type)
407
+ return FullTensorProductOfCrystals(tp, cartan_type=cartan_type)
408
+
409
+ # add options to class
410
+ class options(GlobalOptions):
411
+ r"""
412
+ Set the global options for tensor products of crystals. The default is to
413
+ use the anti-Kashiwara convention.
414
+
415
+ There are two conventions for how `e_i` and `f_i` act on tensor products,
416
+ and the difference between the two is the order of the tensor factors
417
+ are reversed. This affects both the input and output. See the example
418
+ below.
419
+
420
+ @OPTIONS@
421
+
422
+ .. NOTE::
423
+
424
+ Changing the ``convention`` also changes how the input is handled.
425
+
426
+ .. WARNING::
427
+
428
+ Internally, the crystals are always stored using the anti-Kashiwara
429
+ convention.
430
+
431
+ If no parameters are set, then the function returns a copy of the
432
+ options dictionary.
433
+
434
+ EXAMPLES::
435
+
436
+ sage: C = crystals.Letters(['A',2])
437
+ sage: T = crystals.TensorProduct(C,C)
438
+ sage: elt = T(C(1), C(2)); elt
439
+ [1, 2]
440
+ sage: crystals.TensorProduct.options.convention = "Kashiwara"
441
+ sage: elt
442
+ [2, 1]
443
+ sage: T(C(1), C(2)) == elt
444
+ False
445
+ sage: T(C(2), C(1)) == elt
446
+ True
447
+ sage: crystals.TensorProduct.options._reset()
448
+ """
449
+ NAME = 'TensorProductOfCrystals'
450
+ module = 'sage.combinat.crystals'
451
+ convention = dict(default='antiKashiwara',
452
+ description='Sets the convention used for displaying/inputting tensor product of crystals',
453
+ values=dict(antiKashiwara='use the anti-Kashiwara convention',
454
+ Kashiwara='use the Kashiwara convention'),
455
+ alias=dict(anti='antiKashiwara', opposite='antiKashiwara'),
456
+ case_sensitive=False)
457
+
458
+ def _element_constructor_(self, *crystalElements):
459
+ """
460
+ EXAMPLES::
461
+
462
+ sage: C = crystals.Letters(['A',2])
463
+ sage: T = crystals.TensorProduct(C,C)
464
+ sage: T(1,1)
465
+ [1, 1]
466
+ sage: _.parent()
467
+ Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]]
468
+ sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
469
+ sage: T(C(2), C(1), C(1))
470
+ [2, 1, 1]
471
+ """
472
+ if self.options.convention == "Kashiwara":
473
+ crystalElements = reversed(crystalElements)
474
+ return self.element_class(self, list(crystalElements))
475
+
476
+
477
+ class TensorProductOfCrystalsWithGenerators(TensorProductOfCrystals):
478
+ """
479
+ Tensor product of crystals with a generating set.
480
+
481
+ .. TODO::
482
+
483
+ Deprecate this class in favor of using
484
+ :meth:`~sage.categories.crystals.Crystals.ParentMethods.subcrystal`.
485
+ """
486
+
487
+ def __init__(self, crystals, generators, cartan_type):
488
+ """
489
+ EXAMPLES::
490
+
491
+ sage: C = crystals.Letters(['A',2])
492
+ sage: T = crystals.TensorProduct(C,C,C,generators=[[C(2),C(1),C(1)]])
493
+ sage: TestSuite(T).run()
494
+ """
495
+ assert isinstance(crystals, tuple)
496
+ assert isinstance(generators, tuple)
497
+ category = Category.meet([crystal.category() for crystal in crystals])
498
+ Parent.__init__(self, category=category)
499
+ self.crystals = crystals
500
+ self._cartan_type = cartan_type
501
+ self.module_generators = tuple([self(*x) for x in generators])
502
+
503
+ def _repr_(self):
504
+ """
505
+ Return a string representation of ``self``.
506
+
507
+ EXAMPLES::
508
+
509
+ sage: C = crystals.Letters(['A',2])
510
+ sage: crystals.TensorProduct(C,C,generators=[[C(2),C(1)]])
511
+ The tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]]
512
+ """
513
+ if self.options.convention == "Kashiwara":
514
+ st = repr(list(reversed(self.crystals)))
515
+ else:
516
+ st = repr(list(self.crystals))
517
+ return "The tensor product of the crystals {}".format(st)
518
+
519
+
520
+ class FullTensorProductOfCrystals(TensorProductOfCrystals):
521
+ """
522
+ Full tensor product of crystals.
523
+
524
+ .. TODO::
525
+
526
+ Merge this into :class:`TensorProductOfCrystals`.
527
+ """
528
+
529
+ def __init__(self, crystals, **options):
530
+ """
531
+ TESTS::
532
+
533
+ sage: from sage.combinat.crystals.tensor_product import FullTensorProductOfCrystals
534
+ sage: C = crystals.Letters(['A',2])
535
+ sage: T = crystals.TensorProduct(C,C)
536
+ sage: isinstance(T, FullTensorProductOfCrystals)
537
+ True
538
+ sage: TestSuite(T).run()
539
+ """
540
+ category = Category.meet([crystal.category() for crystal in crystals])
541
+ category = category.TensorProducts()
542
+ if any(c in Sets().Infinite() for c in crystals):
543
+ category = category.Infinite()
544
+ Parent.__init__(self, category=category)
545
+ self.crystals = crystals
546
+ if 'cartan_type' in options:
547
+ self._cartan_type = CartanType(options['cartan_type'])
548
+ else:
549
+ if not crystals:
550
+ raise ValueError("you need to specify the Cartan type if the tensor product list is empty")
551
+ else:
552
+ self._cartan_type = crystals[0].cartan_type()
553
+ self.cartesian_product = cartesian_product(self.crystals)
554
+ self.module_generators = self
555
+
556
+ def _repr_(self):
557
+ """
558
+ Return a string representation of ``self``.
559
+
560
+ EXAMPLES::
561
+
562
+ sage: C = crystals.Letters(['A',2])
563
+ sage: crystals.TensorProduct(C,C)
564
+ Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]]
565
+ """
566
+ if self.options.convention == "Kashiwara":
567
+ st = repr(list(reversed(self.crystals)))
568
+ else:
569
+ st = repr(list(self.crystals))
570
+ return "Full tensor product of the crystals {}".format(st)
571
+
572
+ # TODO: __iter__ and cardinality should be inherited from EnumeratedSets().CartesianProducts()
573
+ def __iter__(self):
574
+ """
575
+ EXAMPLES::
576
+
577
+ sage: C = crystals.Letters(['A',2])
578
+ sage: T = crystals.TensorProduct(C,C)
579
+ sage: list(T)
580
+ [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]
581
+ sage: _[0].parent()
582
+ Full tensor product of the crystals [The crystal of letters for type ['A', 2], The crystal of letters for type ['A', 2]]
583
+ """
584
+ for x in self.cartesian_product:
585
+ yield self(*x)
586
+
587
+ def cardinality(self):
588
+ """
589
+ Return the cardinality of ``self``.
590
+
591
+ EXAMPLES::
592
+
593
+ sage: C = crystals.Letters(['A',2])
594
+ sage: T = crystals.TensorProduct(C,C)
595
+ sage: T.cardinality()
596
+ 9
597
+ """
598
+ return self.cartesian_product.cardinality()
599
+
600
+ @cached_method
601
+ def weight_lattice_realization(self):
602
+ r"""
603
+ Return the weight lattice realization used to express weights.
604
+
605
+ The weight lattice realization is the common parent which all
606
+ weight lattice realizations of the crystals of ``self`` coerce
607
+ into.
608
+
609
+ EXAMPLES::
610
+
611
+ sage: B = crystals.elementary.B(['A',4], 2)
612
+ sage: B.weight_lattice_realization()
613
+ Root lattice of the Root system of type ['A', 4]
614
+ sage: T = crystals.infinity.Tableaux(['A',4])
615
+ sage: T.weight_lattice_realization()
616
+ Ambient space of the Root system of type ['A', 4]
617
+ sage: TP = crystals.TensorProduct(B, T)
618
+ sage: TP.weight_lattice_realization()
619
+ Ambient space of the Root system of type ['A', 4]
620
+ """
621
+ cm = get_coercion_model()
622
+ return cm.common_parent(*[crystal.weight_lattice_realization()
623
+ for crystal in self.crystals])
624
+
625
+
626
+ class FullTensorProductOfRegularCrystals(FullTensorProductOfCrystals):
627
+ """
628
+ Full tensor product of regular crystals.
629
+ """
630
+ class Element(TensorProductOfRegularCrystalsElement):
631
+ pass
632
+
633
+
634
+ class TensorProductOfRegularCrystalsWithGenerators(TensorProductOfCrystalsWithGenerators):
635
+ """
636
+ Tensor product of regular crystals with a generating set.
637
+ """
638
+ class Element(TensorProductOfRegularCrystalsElement):
639
+ pass
640
+
641
+
642
+ class FullTensorProductOfSuperCrystals(FullTensorProductOfCrystals):
643
+ r"""
644
+ Tensor product of super crystals.
645
+
646
+ EXAMPLES::
647
+
648
+ sage: L = crystals.Letters(['A', [1,1]])
649
+ sage: T = tensor([L,L,L])
650
+ sage: T.cardinality()
651
+ 64
652
+ """
653
+ class Element(TensorProductOfSuperCrystalsElement):
654
+ pass
655
+
656
+
657
+ class QueerSuperCrystalsMixin:
658
+ """
659
+ Mixin class with methods for a finite queer supercrystal.
660
+ """
661
+ @cached_method
662
+ def index_set(self):
663
+ """
664
+ Return the enlarged index set.
665
+
666
+ EXAMPLES::
667
+
668
+ sage: Q = crystals.Letters(['Q',3])
669
+ sage: T = tensor([Q,Q])
670
+ sage: T.index_set()
671
+ (-4, -3, -2, -1, 1, 2)
672
+ """
673
+ n = self.cartan_type().n
674
+ return tuple(range(-2*n, 0)) + tuple(range(1, n+1))
675
+
676
+ @cached_method
677
+ def _long_element(self):
678
+ r"""
679
+ Return the long element in `S_n`.
680
+
681
+ This method is used in the construction of the crystal operators
682
+ `e_i` and `f_i`.
683
+
684
+ EXAMPLES::
685
+
686
+ sage: Q = crystals.Letters(['Q', 4])
687
+ sage: T = tensor([Q,Q,Q,Q])
688
+ sage: T._long_element()
689
+ (3, 2, 1, 3, 2, 3)
690
+ """
691
+ from sage.combinat.permutation import Permutations
692
+ n = self.cartan_type().n
693
+ return tuple(Permutations(n+1).long_element().reduced_word())
694
+
695
+
696
+ class FullTensorProductOfQueerSuperCrystals(FullTensorProductOfCrystals, QueerSuperCrystalsMixin):
697
+ r"""
698
+ Tensor product of queer super crystals.
699
+ """
700
+ class Element(TensorProductOfQueerSuperCrystalsElement):
701
+ pass
702
+
703
+
704
+ #########################################################
705
+ ## Crystal of tableaux
706
+
707
+ class CrystalOfTableaux(CrystalOfWords):
708
+ r"""
709
+ A class for crystals of tableaux with integer valued shapes.
710
+
711
+ INPUT:
712
+
713
+ - ``cartan_type`` -- a Cartan type
714
+ - ``shape`` -- a partition of length at most ``cartan_type.rank()``
715
+ - ``shapes`` -- list of such partitions
716
+
717
+ This constructs a classical crystal with the given Cartan type and
718
+ highest weight(s) corresponding to the given shape(s).
719
+
720
+ If the type is `D_r`, the shape is permitted to have a negative
721
+ value in the `r`-th position. Thus if the shape equals `[s_1,\ldots,s_r]`,
722
+ then `s_r` may be negative but in any case `s_1 \geq \cdots \geq s_{r-1}
723
+ \geq |s_r|`. This crystal is related to that of shape
724
+ `[s_1,\ldots,|s_r|]` by the outer automorphism of `SO(2r)`.
725
+
726
+ If the type is `D_r` or `B_r`, the shape is permitted to be of
727
+ length `r` with all parts of half integer value. This corresponds
728
+ to having one spin column at the beginning of the tableau. If
729
+ several shapes are provided, they currently should all or none
730
+ have this property.
731
+
732
+ Crystals of tableaux are constructed using an embedding into
733
+ tensor products following Kashiwara and Nakashima [KN1994]_. Sage's tensor
734
+ product rule for crystals differs from that of Kashiwara and Nakashima
735
+ by reversing the order of the tensor factors. Sage produces the same
736
+ crystals of tableaux as Kashiwara and Nakashima. With Sage's convention,
737
+ the tensor product of crystals is the same as the monoid operation on
738
+ tableaux and hence the plactic monoid.
739
+
740
+ .. SEEALSO::
741
+
742
+ :mod:`sage.combinat.crystals.crystals` for general help on
743
+ crystals, and in particular plotting and `\LaTeX` output.
744
+
745
+ EXAMPLES:
746
+
747
+ We create the crystal of tableaux for type `A_2`, with
748
+ highest weight given by the partition `[2,1,1]`::
749
+
750
+ sage: T = crystals.Tableaux(['A',3], shape = [2,1,1])
751
+
752
+ Here is the list of its elements::
753
+
754
+ sage: T.list()
755
+ [[[1, 1], [2], [3]], [[1, 2], [2], [3]], [[1, 3], [2], [3]],
756
+ [[1, 4], [2], [3]], [[1, 4], [2], [4]], [[1, 4], [3], [4]],
757
+ [[2, 4], [3], [4]], [[1, 1], [2], [4]], [[1, 2], [2], [4]],
758
+ [[1, 3], [2], [4]], [[1, 3], [3], [4]], [[2, 3], [3], [4]],
759
+ [[1, 1], [3], [4]], [[1, 2], [3], [4]], [[2, 2], [3], [4]]]
760
+
761
+ Internally, a tableau of a given Cartan type is represented as a
762
+ tensor product of letters of the same type. The order in which the
763
+ tensor factors appear is by reading the columns of the tableaux
764
+ left to right, top to bottom (in French notation). As an example::
765
+
766
+ sage: T = crystals.Tableaux(['A',2], shape = [3,2])
767
+ sage: T.module_generators[0]
768
+ [[1, 1, 1], [2, 2]]
769
+ sage: list(T.module_generators[0])
770
+ [2, 1, 2, 1, 1]
771
+
772
+ To create a tableau, one can use::
773
+
774
+ sage: Tab = crystals.Tableaux(['A',3], shape = [2,2])
775
+ sage: Tab(rows=[[1,2],[3,4]])
776
+ [[1, 2], [3, 4]]
777
+ sage: Tab(columns=[[3,1],[4,2]])
778
+ [[1, 2], [3, 4]]
779
+
780
+ .. TODO::
781
+
782
+ FIXME:
783
+
784
+ - Do we want to specify the columns increasingly or
785
+ decreasingly? That is, should this be
786
+ ``Tab(columns = [[1,3],[2,4]])``?
787
+ - Make this fully consistent with
788
+ :func:`~sage.combinat.tableau.Tableau`!
789
+
790
+ We illustrate the use of a shape with a negative last entry in
791
+ type `D`::
792
+
793
+ sage: T = crystals.Tableaux(['D',4],shape=[1,1,1,-1])
794
+ sage: T.cardinality()
795
+ 35
796
+ sage: TestSuite(T).run()
797
+
798
+ We illustrate the construction of crystals of spin tableaux when
799
+ the partitions have half integer values in type `B` and `D`::
800
+
801
+ sage: T = crystals.Tableaux(['B',3],shape=[3/2,1/2,1/2]); T
802
+ The crystal of tableaux of type ['B', 3] and shape(s) [[3/2, 1/2, 1/2]]
803
+ sage: T.cardinality()
804
+ 48
805
+ sage: T.module_generators
806
+ ([+++, [[1]]],)
807
+ sage: TestSuite(T).run()
808
+
809
+ sage: T = crystals.Tableaux(['D',3],shape=[3/2,1/2,-1/2]); T
810
+ The crystal of tableaux of type ['D', 3] and shape(s) [[3/2, 1/2, -1/2]]
811
+ sage: T.cardinality()
812
+ 20
813
+ sage: T.module_generators
814
+ ([++-, [[1]]],)
815
+ sage: TestSuite(T).run()
816
+
817
+ We can also construct the tableaux for `\mathfrak{gl}(m|n)` as
818
+ given by [BKK2000]_::
819
+
820
+ sage: T = crystals.Tableaux(['A', [1,2]], shape=[4,2,1,1,1])
821
+ sage: T.cardinality()
822
+ 1392
823
+
824
+ We can also construct the tableaux for `\mathfrak{q}(n)` as
825
+ given by [GJK+2014]_::
826
+
827
+ sage: T = crystals.Tableaux(['Q', 3], shape=[3,1])
828
+ sage: T.cardinality()
829
+ 24
830
+
831
+ TESTS:
832
+
833
+ Base cases::
834
+
835
+ sage: T = crystals.Tableaux(['A',2], shape = [])
836
+ sage: T.list()
837
+ [[]]
838
+ sage: TestSuite(T).run()
839
+
840
+ sage: T = crystals.Tableaux(['C',2], shape = [1])
841
+ sage: T.list()
842
+ [[[1]], [[2]], [[-2]], [[-1]]]
843
+ sage: TestSuite(T).run()
844
+
845
+ sage: T = crystals.Tableaux(['A',2], shapes = [[],[1],[2]])
846
+ sage: T.list()
847
+ [[], [[1]], [[2]], [[3]], [[1, 1]], [[1, 2]], [[2, 2]], [[1, 3]], [[2, 3]], [[3, 3]]]
848
+ sage: T.module_generators
849
+ ([], [[1]], [[1, 1]])
850
+
851
+ sage: T = crystals.Tableaux(['B',2], shape=[3])
852
+ sage: T(rows=[[1,1,0]])
853
+ [[1, 1, 0]]
854
+
855
+ Input tests::
856
+
857
+ sage: T = crystals.Tableaux(['A',3], shape = [2,2])
858
+ sage: C = T.letters
859
+ sage: list(Tab(rows = [[1,2],[3,4]])) == [C(3),C(1),C(4),C(2)]
860
+ True
861
+ sage: list(Tab(columns = [[3,1],[4,2]])) == [C(3),C(1),C(4),C(2)]
862
+ True
863
+
864
+ For compatibility with
865
+ :func:`~sage.combinat.crystals.tensor_product.TensorProductOfCrystals` we
866
+ need to accept as input the internal list or sequence of elements::
867
+
868
+ sage: list(Tab(list = [3,1,4,2])) == [C(3),C(1),C(4),C(2)]
869
+ True
870
+ sage: list(Tab(3,1,4,2)) == [C(3),C(1),C(4),C(2)]
871
+ True
872
+
873
+ The next example checks whether a given tableau is in fact a valid
874
+ type `C` tableau or not::
875
+
876
+ sage: T = crystals.Tableaux(['C',3], shape = [2,2,2])
877
+ sage: Tab = T(rows=[[1,3],[2,-3],[3,-1]])
878
+ sage: Tab in T.list()
879
+ True
880
+ sage: Tab = T(rows=[[2,3],[3,-3],[-3,-2]])
881
+ sage: Tab in T.list()
882
+ False
883
+
884
+ Check that entries are weakly decreasing also in the spin case::
885
+
886
+ sage: crystals.Tableaux(['D',4], shape=[-1/2,1/2,1/2,-1/2])
887
+ Traceback (most recent call last):
888
+ ...
889
+ ValueError: entries of each shape must be weakly decreasing
890
+ """
891
+
892
+ @staticmethod
893
+ def __classcall_private__(cls, cartan_type, shapes=None, shape=None):
894
+ """
895
+ Normalize the input arguments to ensure unique representation,
896
+ and to delegate the construction of spin tableaux.
897
+
898
+ EXAMPLES::
899
+
900
+ sage: T1 = crystals.Tableaux(CartanType(['A',3]), shape = [2,2])
901
+ sage: T2 = crystals.Tableaux(['A',3], shape = (2,2))
902
+ sage: T3 = crystals.Tableaux(['A',3], shapes = ([2,2],))
903
+ sage: T2 is T1, T3 is T1
904
+ (True, True)
905
+
906
+ sage: T1 = crystals.Tableaux(['A', [1,1]], shape=[3,1,1,1])
907
+ sage: T1
908
+ Crystal of BKK tableaux of shape [3, 1, 1, 1] of gl(2|2)
909
+ sage: T2 = crystals.Tableaux(['A', [1,1]], [3,1,1,1])
910
+ sage: T1 is T2
911
+ True
912
+ """
913
+ cartan_type = CartanType(cartan_type)
914
+ if cartan_type.letter == 'A' and isinstance(cartan_type, SuperCartanType_standard):
915
+ if shape is None:
916
+ shape = shapes
917
+ shape = _Partitions(shape)
918
+ from sage.combinat.crystals.bkk_crystals import CrystalOfBKKTableaux
919
+ return CrystalOfBKKTableaux(cartan_type, shape=shape)
920
+ if cartan_type.letter == 'Q':
921
+ if any(shape[i] == shape[i+1] for i in range(len(shape)-1)):
922
+ raise ValueError("not a strict partition")
923
+ shape = _Partitions(shape)
924
+ return CrystalOfQueerTableaux(cartan_type, shape=shape)
925
+ n = cartan_type.rank()
926
+ # standardize shape/shapes input into a tuple of tuples
927
+ # of length n, or n+1 in type A
928
+ assert operator.xor(shape is not None, shapes is not None)
929
+ if shape is not None:
930
+ shapes = (shape,)
931
+ if cartan_type.type() == "A":
932
+ n1 = n + 1
933
+ else:
934
+ n1 = n
935
+ if not all(i == 0 for shape in shapes for i in shape[n1:]):
936
+ raise ValueError("shapes should all have length at most equal to the rank or the rank + 1 in type A")
937
+ spin_shapes = tuple((tuple(shape) + (0,)*(n1-len(shape)))[:n1] for shape in shapes)
938
+ try:
939
+ shapes = tuple(tuple(trunc(i) for i in shape) for shape in spin_shapes)
940
+ except Exception:
941
+ raise ValueError("shapes should all be partitions or half-integer partitions")
942
+ if spin_shapes == shapes:
943
+ shapes = tuple(_Partitions(shape) if shape[n1-1] in NN else shape for shape in shapes)
944
+ return super().__classcall__(cls, cartan_type, shapes)
945
+
946
+ # Handle the construction of a crystals of spin tableaux
947
+ # Caveat: this currently only supports all shapes being half
948
+ # integer partitions of length the rank for type B and D. In
949
+ # particular, for type D, the spins all have to be plus or all
950
+ # minus spins
951
+ if any(len(sh) != n for sh in shapes):
952
+ raise ValueError("the length of all half-integer partition shapes should be the rank")
953
+ if any(2*i % 2 != 1 for shape in spin_shapes for i in shape):
954
+ raise ValueError("shapes should be either all partitions or all half-integer partitions")
955
+ if any(any(i < j for i, j in zip(shape, shape[1:-1] + (abs(shape[-1]),))) for shape in spin_shapes):
956
+ raise ValueError("entries of each shape must be weakly decreasing")
957
+ if cartan_type.type() == 'D':
958
+ if all(i >= 0 for shape in spin_shapes for i in shape):
959
+ S = CrystalOfSpinsPlus(cartan_type)
960
+ elif all(shape[-1] < 0 for shape in spin_shapes):
961
+ S = CrystalOfSpinsMinus(cartan_type)
962
+ else:
963
+ raise ValueError("in type D spins should all be positive or negative")
964
+ else:
965
+ if any(i < 0 for shape in spin_shapes for i in shape):
966
+ raise ValueError("shapes should all be partitions")
967
+ S = CrystalOfSpins(cartan_type)
968
+ B = CrystalOfTableaux(cartan_type, shapes=shapes)
969
+ T = TensorProductOfCrystals(S, B, generators=[[S.module_generators[0],x] for x in B.module_generators])
970
+ T.rename("The crystal of tableaux of type %s and shape(s) %s" % (cartan_type, list(list(shape) for shape in spin_shapes)))
971
+ T.shapes = spin_shapes
972
+ return T
973
+
974
+ def __init__(self, cartan_type, shapes):
975
+ """
976
+ Construct the crystal of all tableaux of the given shapes.
977
+
978
+ INPUT:
979
+
980
+ - ``cartan_type`` -- (data coercible into) a Cartan type
981
+ - ``shapes`` -- list (or iterable) of shapes
982
+ - ``shape`` -- a shape
983
+
984
+ Shapes themselves are lists (or iterable) of integers.
985
+
986
+ EXAMPLES::
987
+
988
+ sage: T = crystals.Tableaux(['A',3], shape = [2,2])
989
+ sage: TestSuite(T).run()
990
+ """
991
+ # super().__init__(category = FiniteEnumeratedSets())
992
+ Parent.__init__(self, category=ClassicalCrystals())
993
+ self.letters = CrystalOfLetters(cartan_type)
994
+ self.shapes = shapes
995
+ self.module_generators = tuple(self.module_generator(la) for la in shapes)
996
+ self.rename("The crystal of tableaux of type %s and shape(s) %s"
997
+ % (cartan_type, list(list(shape) for shape in shapes)))
998
+
999
+ def cartan_type(self):
1000
+ """
1001
+ Return the Cartan type of the associated crystal.
1002
+
1003
+ EXAMPLES::
1004
+
1005
+ sage: T = crystals.Tableaux(['A',3], shape = [2,2])
1006
+ sage: T.cartan_type()
1007
+ ['A', 3]
1008
+ """
1009
+ return self.letters.cartan_type()
1010
+
1011
+ def module_generator(self, shape):
1012
+ """
1013
+ This yields the module generator (or highest weight element) of a classical
1014
+ crystal of given shape. The module generator is the unique tableau with equal
1015
+ shape and content.
1016
+
1017
+ EXAMPLES::
1018
+
1019
+ sage: T = crystals.Tableaux(['D',3], shape = [1,1])
1020
+ sage: T.module_generator([1,1])
1021
+ [[1], [2]]
1022
+
1023
+ sage: T = crystals.Tableaux(['D',4],shape=[2,2,2,-2])
1024
+ sage: T.module_generator(tuple([2,2,2,-2]))
1025
+ [[1, 1], [2, 2], [3, 3], [-4, -4]]
1026
+ sage: T.cardinality()
1027
+ 294
1028
+ sage: T = crystals.Tableaux(['D',4],shape=[2,2,2,2])
1029
+ sage: T.module_generator(tuple([2,2,2,2]))
1030
+ [[1, 1], [2, 2], [3, 3], [4, 4]]
1031
+ sage: T.cardinality()
1032
+ 294
1033
+ """
1034
+ type = self.cartan_type()
1035
+ if type[0] == 'D' and len(shape) == type[1] and shape[type[1]-1] < 0:
1036
+ invert = True
1037
+ shape = shape[:-1] + (-shape[type[1]-1],)
1038
+ else:
1039
+ invert = False
1040
+ p = _Partitions(shape).conjugate()
1041
+ # The column canonical tableau, read by columns
1042
+ module_generator = flatten([[val-i for i in range(val)] for val in p])
1043
+ if invert:
1044
+ module_generator = [(-x if x == type[1] else x) for x in module_generator]
1045
+ return self(list=[self.letters(x) for x in module_generator])
1046
+
1047
+ def _element_constructor_(self, *args, **options):
1048
+ """
1049
+ Return a
1050
+ :class:`~sage.combinat.crystals.tensor_product.CrystalOfTableauxElement`.
1051
+
1052
+ EXAMPLES::
1053
+
1054
+ sage: T = crystals.Tableaux(['A',3], shape = [2,2])
1055
+ sage: T(rows=[[1,2],[3,4]])
1056
+ [[1, 2], [3, 4]]
1057
+ sage: T(columns=[[3,1],[4,2]])
1058
+ [[1, 2], [3, 4]]
1059
+ """
1060
+ return self.element_class(self, *args, **options)
1061
+
1062
+ class Element(CrystalOfTableauxElement):
1063
+ pass
1064
+
1065
+
1066
+ class CrystalOfQueerTableaux(CrystalOfWords, QueerSuperCrystalsMixin):
1067
+ """
1068
+ A queer crystal of the semistandard decomposition tableaux of a given shape.
1069
+
1070
+ INPUT:
1071
+
1072
+ - ``cartan_type`` -- a Cartan type
1073
+ - ``shape`` -- a shape
1074
+ """
1075
+
1076
+ def __init__(self, cartan_type, shape):
1077
+ """
1078
+ Initialize ``self``.
1079
+
1080
+ EXAMPLES::
1081
+
1082
+ sage: T = crystals.Tableaux(['Q',3], shape=[4,2])
1083
+ sage: TestSuite(T).run()
1084
+ sage: T = crystals.Tableaux(['Q',4], shape=[4,1])
1085
+ sage: TestSuite(T).run() # long time
1086
+ """
1087
+ from sage.categories.regular_supercrystals import RegularSuperCrystals
1088
+ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
1089
+ Parent.__init__(self, category=(RegularSuperCrystals(), FiniteEnumeratedSets()))
1090
+ self.shape = shape
1091
+ self._cartan_type = cartan_type
1092
+ self.letters = CrystalOfLetters(cartan_type)
1093
+ n = cartan_type.rank() + 1
1094
+ data = sum(([self.letters(n-i)] * row_len for i,row_len in enumerate(shape)), [])
1095
+ mg = self.element_class(self, list=data)
1096
+ self.module_generators = (mg,)
1097
+
1098
+ def _repr_(self):
1099
+ """
1100
+ Return a string representation of ``self``.
1101
+
1102
+ EXAMPLES::
1103
+
1104
+ sage: crystals.Tableaux(['Q',3], shape=[4,2])
1105
+ The crystal of tableaux of type ['Q', 3] and shape [4, 2]
1106
+ """
1107
+ return "The crystal of tableaux of type {} and shape {}".format(self._cartan_type, self.shape)
1108
+
1109
+ class Element(TensorProductOfQueerSuperCrystalsElement):
1110
+ def _repr_(self):
1111
+ """
1112
+ Return a string representation of ``self``.
1113
+
1114
+ EXAMPLES::
1115
+
1116
+ sage: B = crystals.Tableaux(['Q',3], shape=[3,2,1])
1117
+ sage: B.an_element()
1118
+ [[3, 3, 3], [2, 2], [1]]
1119
+ """
1120
+ return repr([list(reversed(row)) for row in self.rows()])
1121
+
1122
+ def _ascii_art_(self):
1123
+ r"""
1124
+ Return an ASCII art representation of ``self``.
1125
+
1126
+ EXAMPLES::
1127
+
1128
+ sage: B = crystals.Tableaux(['Q',3], shape=[3,2,1])
1129
+ sage: t = B.an_element()
1130
+ sage: t._ascii_art_()
1131
+ 3 3 3
1132
+ 2 2
1133
+ 1
1134
+ """
1135
+ from sage.typeset.ascii_art import AsciiArt
1136
+ ret = [" "*(3*i) + "".join("%3s" % str(x) for x in reversed(row))
1137
+ for i, row in enumerate(self.rows())]
1138
+ return AsciiArt(ret)
1139
+
1140
+ def _latex_(self):
1141
+ r"""
1142
+ Return latex code for ``self``.
1143
+
1144
+ EXAMPLES::
1145
+
1146
+ sage: B = crystals.Tableaux(['Q',3], shape=[3,2,1])
1147
+ sage: t = B.an_element()
1148
+ sage: latex(t)
1149
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
1150
+ \raisebox{-.6ex}{$\begin{array}[b]{*{3}c}\cline{1-3}
1151
+ \lr{3}&\lr{3}&\lr{3}\\\cline{1-3}
1152
+ &\lr{2}&\lr{2}\\\cline{2-3}
1153
+ &&\lr{1}\\\cline{3-3}
1154
+ \end{array}$}
1155
+ }
1156
+ """
1157
+ from sage.combinat.output import tex_from_array
1158
+ return tex_from_array([[None]*i + list(reversed(row))
1159
+ for i, row in enumerate(self.rows())])
1160
+
1161
+ def rows(self):
1162
+ """
1163
+ Return the list of rows of ``self``.
1164
+
1165
+ EXAMPLES::
1166
+
1167
+ sage: B = crystals.Tableaux(['Q',3], shape=[3,2,1])
1168
+ sage: t = B.an_element()
1169
+ sage: t.rows()
1170
+ [[3, 3, 3], [2, 2], [1]]
1171
+ """
1172
+ ret = []
1173
+ pos = 0
1174
+ for l in self.parent().shape:
1175
+ ret.append(self[pos:pos+l])
1176
+ pos += l
1177
+ return ret