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
sage/combinat/core.py ADDED
@@ -0,0 +1,751 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ """
3
+ Cores
4
+
5
+ A `k`-core is a partition from which no rim hook of size `k` can be removed.
6
+ Alternatively, a `k`-core is an integer partition such that the Ferrers
7
+ diagram for the partition contains no cells with a hook of size (a
8
+ multiple of) `k`.
9
+
10
+ Authors:
11
+
12
+ - Anne Schilling and Mike Zabrocki (2011): initial version
13
+ - Travis Scrimshaw (2012): Added latex output for Core class
14
+ """
15
+ # ****************************************************************************
16
+ # Copyright (C) 2011 Anne Schilling <anne at math.ucdavis.edu>
17
+ # Mike Zabrocki <zabrocki at mathstat.yorku.ca>
18
+ #
19
+ # Distributed under the terms of the GNU General Public License (GPL)
20
+ #
21
+ # This code is distributed in the hope that it will be useful,
22
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
+ # General Public License for more details.
25
+ #
26
+ # The full text of the GPL is available at:
27
+ #
28
+ # https://www.gnu.org/licenses/
29
+ # ***************************************************************************
30
+
31
+ from sage.structure.unique_representation import UniqueRepresentation
32
+ from sage.structure.parent import Parent
33
+ from sage.combinat.partition import Partitions, Partition
34
+ from sage.combinat.combinat import CombinatorialElement
35
+ from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
36
+ from sage.combinat.combinatorial_map import combinatorial_map
37
+
38
+
39
+ class Core(CombinatorialElement):
40
+ r"""
41
+ A `k`-core is an integer partition from which no rim hook of size `k`
42
+ can be removed.
43
+
44
+ EXAMPLES::
45
+
46
+ sage: c = Core([2,1],4); c
47
+ [2, 1]
48
+ sage: c = Core([3,1],4); c
49
+ Traceback (most recent call last):
50
+ ...
51
+ ValueError: [3, 1] is not a 4-core
52
+ """
53
+ @staticmethod
54
+ def __classcall_private__(cls, part, k):
55
+ r"""
56
+ Implement the shortcut ``Core(part, k)`` to ``Cores(k,l)(part)``
57
+ where `l` is the length of the core.
58
+
59
+ TESTS::
60
+
61
+ sage: c = Core([2,1],4); c
62
+ [2, 1]
63
+ sage: c.parent()
64
+ 4-Cores of length 3
65
+ sage: type(c)
66
+ <class 'sage.combinat.core.Cores_length_with_category.element_class'>
67
+
68
+ sage: Core([2,1],3)
69
+ Traceback (most recent call last):
70
+ ...
71
+ ValueError: [2, 1] is not a 3-core
72
+ """
73
+ if isinstance(part, cls):
74
+ return part
75
+ part = Partition(part)
76
+ if not part.is_core(k):
77
+ raise ValueError("%s is not a %s-core" % (part, k))
78
+ l = sum(part.k_boundary(k).row_lengths())
79
+ return Cores(k, l)(part)
80
+
81
+ def __init__(self, parent, core):
82
+ """
83
+ TESTS::
84
+
85
+ sage: C = Cores(4,3)
86
+ sage: c = C([2,1]); c
87
+ [2, 1]
88
+ sage: type(c)
89
+ <class 'sage.combinat.core.Cores_length_with_category.element_class'>
90
+ sage: c.parent()
91
+ 4-Cores of length 3
92
+ sage: TestSuite(c).run()
93
+
94
+ sage: C = Cores(3,3)
95
+ sage: C([2,1])
96
+ Traceback (most recent call last):
97
+ ...
98
+ ValueError: [2, 1] is not a 3-core
99
+ """
100
+ k = parent.k
101
+ part = Partition(core)
102
+ if not part.is_core(k):
103
+ raise ValueError("%s is not a %s-core" % (part, k))
104
+ CombinatorialElement.__init__(self, parent, core)
105
+
106
+ def __eq__(self, other) -> bool:
107
+ """
108
+ Test for equality.
109
+
110
+ EXAMPLES::
111
+
112
+ sage: c = Core([4,2,1,1],5)
113
+ sage: d = Core([4,2,1,1],5)
114
+ sage: e = Core([4,2,1,1],6)
115
+ sage: c == [4,2,1,1]
116
+ False
117
+ sage: c == d
118
+ True
119
+ sage: c == e
120
+ False
121
+ """
122
+ if isinstance(other, Core):
123
+ return (self._list == other._list and
124
+ self.parent().k == other.parent().k)
125
+ return False
126
+
127
+ def __ne__(self, other) -> bool:
128
+ """
129
+ Test for un-equality.
130
+
131
+ EXAMPLES::
132
+
133
+ sage: c = Core([4,2,1,1],5)
134
+ sage: d = Core([4,2,1,1],5)
135
+ sage: e = Core([4,2,1,1],6)
136
+ sage: c != [4,2,1,1]
137
+ True
138
+ sage: c != d
139
+ False
140
+ sage: c != e
141
+ True
142
+ """
143
+ return not (self == other)
144
+
145
+ def __hash__(self):
146
+ """
147
+ Compute the hash of ``self`` by computing the hash of the
148
+ underlying list and of the additional parameter.
149
+
150
+ The hash is cached and stored in ``self._hash``.
151
+
152
+ EXAMPLES::
153
+
154
+ sage: c = Core([4,2,1,1],3)
155
+ sage: c._hash is None
156
+ True
157
+ sage: hash(c) #random
158
+ 1335416675971793195
159
+ sage: c._hash #random
160
+ 1335416675971793195
161
+
162
+ TESTS::
163
+
164
+ sage: c = Core([4,2,1,1],5)
165
+ sage: d = Core([4,2,1,1],6)
166
+ sage: hash(c) == hash(d)
167
+ False
168
+ """
169
+ if self._hash is None:
170
+ self._hash = hash(tuple(self._list)) + hash(self.parent().k)
171
+ return self._hash
172
+
173
+ def _latex_(self) -> str:
174
+ r"""
175
+ Output the LaTeX representation of this core as a partition.
176
+
177
+ See the ``_latex_`` method of :class:`Partition`.
178
+
179
+ EXAMPLES::
180
+
181
+ sage: c = Core([2,1],4)
182
+ sage: latex(c)
183
+ {\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
184
+ \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2}
185
+ \lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-2}
186
+ \lr{\phantom{x}}\\\cline{1-1}
187
+ \end{array}$}
188
+ }
189
+ """
190
+ return self.to_partition()._latex_()
191
+
192
+ def k(self):
193
+ r"""
194
+ Return `k` of the `k`-core ``self``.
195
+
196
+ EXAMPLES::
197
+
198
+ sage: c = Core([2,1],4)
199
+ sage: c.k()
200
+ 4
201
+ """
202
+ return self.parent().k
203
+
204
+ @combinatorial_map(name="to partition")
205
+ def to_partition(self):
206
+ r"""
207
+ Turn the core ``self`` into the partition identical to ``self``.
208
+
209
+ EXAMPLES::
210
+
211
+ sage: mu = Core([2,1,1],3)
212
+ sage: mu.to_partition()
213
+ [2, 1, 1]
214
+ """
215
+ return Partition(self)
216
+
217
+ @combinatorial_map(name="to bounded partition")
218
+ def to_bounded_partition(self):
219
+ r"""
220
+ Bijection between `k`-cores and `(k-1)`-bounded partitions.
221
+
222
+ This maps the `k`-core ``self`` to the corresponding `(k-1)`-bounded partition.
223
+ This bijection is achieved by deleting all cells in ``self`` of hook length
224
+ greater than `k`.
225
+
226
+ EXAMPLES::
227
+
228
+ sage: gamma = Core([9,5,3,2,1,1], 5)
229
+ sage: gamma.to_bounded_partition()
230
+ [4, 3, 2, 2, 1, 1]
231
+ """
232
+ k_boundary = self.to_partition().k_boundary(self.k())
233
+ return Partition(k_boundary.row_lengths())
234
+
235
+ def size(self):
236
+ r"""
237
+ Return the size of ``self`` as a partition.
238
+
239
+ EXAMPLES::
240
+
241
+ sage: Core([2,1],4).size()
242
+ 3
243
+ sage: Core([4,2],3).size()
244
+ 6
245
+ """
246
+ return self.to_partition().size()
247
+
248
+ def length(self):
249
+ r"""
250
+ Return the length of ``self``.
251
+
252
+ The length of a `k`-core is the size of the corresponding `(k-1)`-bounded partition
253
+ which agrees with the length of the corresponding Grassmannian element,
254
+ see :meth:`to_grassmannian`.
255
+
256
+ EXAMPLES::
257
+
258
+ sage: c = Core([4,2],3); c.length()
259
+ 4
260
+ sage: c.to_grassmannian().length() # needs sage.modules
261
+ 4
262
+
263
+ sage: Core([9,5,3,2,1,1], 5).length()
264
+ 13
265
+ """
266
+ return self.to_bounded_partition().size()
267
+
268
+ def to_grassmannian(self):
269
+ r"""
270
+ Bijection between `k`-cores and Grassmannian elements in the affine Weyl group of type `A_{k-1}^{(1)}`.
271
+
272
+ For further details, see the documentation of the method
273
+ :meth:`~sage.combinat.partition.Partition.from_kbounded_to_reduced_word` and
274
+ :meth:`~sage.combinat.partition.Partition.from_kbounded_to_grassmannian`.
275
+
276
+ EXAMPLES::
277
+
278
+ sage: c = Core([3,1,1],3)
279
+ sage: w = c.to_grassmannian(); w # needs sage.modules
280
+ [-1 1 1]
281
+ [-2 2 1]
282
+ [-2 1 2]
283
+ sage: c.parent()
284
+ 3-Cores of length 4
285
+ sage: w.parent() # needs sage.modules
286
+ Weyl Group of type ['A', 2, 1] (as a matrix group acting on the root space)
287
+
288
+ sage: c = Core([],3)
289
+ sage: c.to_grassmannian() # needs sage.modules
290
+ [1 0 0]
291
+ [0 1 0]
292
+ [0 0 1]
293
+ """
294
+ bp = self.to_bounded_partition()
295
+ return bp.from_kbounded_to_grassmannian(self.k() - 1)
296
+
297
+ def affine_symmetric_group_simple_action(self, i):
298
+ r"""
299
+ Return the action of the simple transposition `s_i` of the affine symmetric group on ``self``.
300
+
301
+ This gives the action of the affine symmetric group of type `A_k^{(1)}` on the `k`-core
302
+ ``self``. If ``self`` has outside (resp. inside) corners of content `i` modulo `k`, then
303
+ these corners are added (resp. removed). Otherwise the action is trivial.
304
+
305
+ EXAMPLES::
306
+
307
+ sage: c = Core([4,2],3)
308
+ sage: c.affine_symmetric_group_simple_action(0) # needs sage.modules
309
+ [3, 1]
310
+ sage: c.affine_symmetric_group_simple_action(1) # needs sage.modules
311
+ [5, 3, 1]
312
+ sage: c.affine_symmetric_group_simple_action(2) # needs sage.modules
313
+ [4, 2]
314
+
315
+ This action corresponds to the left action by the `i`-th simple reflection in the affine
316
+ symmetric group::
317
+
318
+ sage: c = Core([4,2],3)
319
+ sage: W = c.to_grassmannian().parent() # needs sage.modules
320
+ sage: i = 0
321
+ sage: (c.affine_symmetric_group_simple_action(i).to_grassmannian() # needs sage.modules
322
+ ....: == W.simple_reflection(i)*c.to_grassmannian())
323
+ True
324
+ sage: i = 1
325
+ sage: (c.affine_symmetric_group_simple_action(i).to_grassmannian() # needs sage.modules
326
+ ....: == W.simple_reflection(i)*c.to_grassmannian())
327
+ True
328
+ """
329
+ mu = self.to_partition()
330
+ corners = [p for p in mu.outside_corners()
331
+ if mu.content(p[0], p[1]) % self.k() == i]
332
+ if not corners:
333
+ corners = [p for p in mu.corners()
334
+ if mu.content(p[0], p[1]) % self.k() == i]
335
+ if not corners:
336
+ return self
337
+ for p in corners:
338
+ mu = mu.remove_cell(p[0])
339
+ else:
340
+ for p in corners:
341
+ mu = mu.add_cell(p[0])
342
+ return Core(mu, self.k())
343
+
344
+ def affine_symmetric_group_action(self, w, transposition=False):
345
+ r"""
346
+ Return the (left) action of the affine symmetric group on ``self``.
347
+
348
+ INPUT:
349
+
350
+ - ``w`` -- tuple of integers `[w_1,\ldots,w_m]` with `0\le w_j<k`.
351
+ If transposition is set to be ``True``, then `w = [w_0,w_1]` is
352
+ interpreted as a transposition `t_{w_0, w_1}`
353
+ (see :meth:`_transposition_to_reduced_word`).
354
+
355
+ - ``transposition`` -- boolean (default: ``False``)
356
+
357
+ The output is the (left) action of the product of the corresponding simple transpositions
358
+ on ``self``, that is `s_{w_1} \cdots s_{w_m}(self)`. See :meth:`affine_symmetric_group_simple_action`.
359
+
360
+ EXAMPLES::
361
+
362
+ sage: c = Core([4,2],3)
363
+ sage: c.affine_symmetric_group_action([0,1,0,2,1])
364
+ [8, 6, 4, 2]
365
+ sage: c.affine_symmetric_group_action([0,2], transposition=True)
366
+ [4, 2, 1, 1]
367
+
368
+ sage: c = Core([11,8,5,5,3,3,1,1,1],4)
369
+ sage: c.affine_symmetric_group_action([2,5],transposition=True)
370
+ [11, 8, 7, 6, 5, 4, 3, 2, 1]
371
+ """
372
+ c = self
373
+ if transposition:
374
+ w = self._transposition_to_reduced_word(w)
375
+ w.reverse()
376
+ for i in w:
377
+ c = c.affine_symmetric_group_simple_action(i)
378
+ return c
379
+
380
+ def _transposition_to_reduced_word(self, t):
381
+ r"""
382
+ Convert the transposition `t = [r,s]` to a reduced word.
383
+
384
+ INPUT:
385
+
386
+ - ``t`` -- a tuple `[r,s]` such that `r` and `s` are not equivalent mod `k`
387
+
388
+ OUTPUT: list of integers in `\{0,1,\ldots,k-1\}` representing a
389
+ reduced word for the transposition `t`
390
+
391
+ EXAMPLES::
392
+
393
+ sage: c = Core([],4)
394
+ sage: c._transposition_to_reduced_word([2, 5])
395
+ [2, 3, 0, 3, 2]
396
+ sage: c._transposition_to_reduced_word([2, 5]) == c._transposition_to_reduced_word([5,2])
397
+ True
398
+ sage: c._transposition_to_reduced_word([2, 2])
399
+ Traceback (most recent call last):
400
+ ...
401
+ ValueError: t_0 and t_1 cannot be equal mod k
402
+
403
+ sage: c = Core([],30)
404
+ sage: c._transposition_to_reduced_word([4, 12])
405
+ [4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4]
406
+
407
+ sage: c = Core([],3)
408
+ sage: c._transposition_to_reduced_word([4, 12])
409
+ [1, 2, 0, 1, 2, 0, 2, 1, 0, 2, 1]
410
+ """
411
+ k = self.k()
412
+ if (t[0] - t[1]) % k == 0:
413
+ raise ValueError("t_0 and t_1 cannot be equal mod k")
414
+ if t[0] > t[1]:
415
+ return self._transposition_to_reduced_word([t[1], t[0]])
416
+ else:
417
+ resu = [i % k for i in range(t[0], t[1] - (t[1] - t[0]) // k)]
418
+ resu += [(t[1] - (t[1] - t[0]) // k - 2 - i) % k
419
+ for i in range(t[1] - (t[1] - t[0]) // k - t[0] - 1)]
420
+ return resu
421
+
422
+ def weak_le(self, other):
423
+ r"""
424
+ Weak order comparison on cores.
425
+
426
+ INPUT:
427
+
428
+ - ``other`` -- another `k`-core
429
+
430
+ OUTPUT: boolean
431
+
432
+ This returns whether ``self`` <= ``other`` in weak order.
433
+
434
+ EXAMPLES::
435
+
436
+ sage: c = Core([4,2],3)
437
+ sage: x = Core([5,3,1],3)
438
+ sage: c.weak_le(x) # needs sage.modules
439
+ True
440
+ sage: c.weak_le([5,3,1]) # needs sage.modules
441
+ True
442
+
443
+ sage: x = Core([4,2,2,1,1],3)
444
+ sage: c.weak_le(x) # needs sage.modules
445
+ False
446
+
447
+ sage: x = Core([5,3,1],6)
448
+ sage: c.weak_le(x)
449
+ Traceback (most recent call last):
450
+ ...
451
+ ValueError: the two cores do not have the same k
452
+ """
453
+ if isinstance(other, Core):
454
+ if self.k() != other.k():
455
+ raise ValueError("the two cores do not have the same k")
456
+ else:
457
+ other = Core(other, self.k())
458
+ w = self.to_grassmannian()
459
+ v = other.to_grassmannian()
460
+ return w.weak_le(v, side='left')
461
+
462
+ def weak_covers(self):
463
+ r"""
464
+ Return a list of all elements that cover ``self`` in weak order.
465
+
466
+ EXAMPLES::
467
+
468
+ sage: c = Core([1],3)
469
+ sage: c.weak_covers() # needs sage.modules
470
+ [[1, 1], [2]]
471
+
472
+ sage: c = Core([4,2],3)
473
+ sage: c.weak_covers() # needs sage.modules
474
+ [[5, 3, 1]]
475
+ """
476
+ w = self.to_grassmannian()
477
+ S = w.upper_covers(side='left')
478
+ S = (x for x in S if x.is_affine_grassmannian())
479
+ return [x.affine_grassmannian_to_core() for x in set(S)]
480
+
481
+ def strong_le(self, other):
482
+ r"""
483
+ Strong order (Bruhat) comparison on cores.
484
+
485
+ INPUT:
486
+
487
+ - ``other`` -- another `k`-core
488
+
489
+ OUTPUT: boolean
490
+
491
+ This returns whether ``self`` <= ``other`` in Bruhat (or strong) order.
492
+
493
+ EXAMPLES::
494
+
495
+ sage: c = Core([4,2],3)
496
+ sage: x = Core([4,2,2,1,1],3)
497
+ sage: c.strong_le(x)
498
+ True
499
+ sage: c.strong_le([4,2,2,1,1])
500
+ True
501
+
502
+ sage: x = Core([4,1],4)
503
+ sage: c.strong_le(x)
504
+ Traceback (most recent call last):
505
+ ...
506
+ ValueError: the two cores do not have the same k
507
+ """
508
+ if isinstance(other, Core):
509
+ if self.k() != other.k():
510
+ raise ValueError("the two cores do not have the same k")
511
+ else:
512
+ other = Core(other, self.k())
513
+ return other.contains(self)
514
+
515
+ def contains(self, other) -> bool:
516
+ r"""
517
+ Check whether ``self`` contains ``other``.
518
+
519
+ INPUT:
520
+
521
+ - ``other`` -- another `k`-core or a list
522
+
523
+ OUTPUT: boolean
524
+
525
+ This returns ``True`` if the Ferrers diagram of ``self`` contains the
526
+ Ferrers diagram of ``other``.
527
+
528
+ EXAMPLES::
529
+
530
+ sage: c = Core([4,2],3)
531
+ sage: x = Core([4,2,2,1,1],3)
532
+ sage: x.contains(c)
533
+ True
534
+ sage: c.contains(x)
535
+ False
536
+ """
537
+ la = self.to_partition()
538
+ mu = Core(other, self.k()).to_partition()
539
+ return la.contains(mu)
540
+
541
+ def strong_covers(self):
542
+ r"""
543
+ Return a list of all elements that cover ``self`` in strong order.
544
+
545
+ EXAMPLES::
546
+
547
+ sage: c = Core([1],3)
548
+ sage: c.strong_covers()
549
+ [[2], [1, 1]]
550
+ sage: c = Core([4,2],3)
551
+ sage: c.strong_covers()
552
+ [[5, 3, 1], [4, 2, 1, 1]]
553
+ """
554
+ S = Cores(self.k(), length=self.length() + 1)
555
+ return [ga for ga in S if ga.contains(self)]
556
+
557
+ def strong_down_list(self):
558
+ r"""
559
+ Return a list of all elements that are covered by ``self`` in strong order.
560
+
561
+ EXAMPLES::
562
+
563
+ sage: c = Core([1],3)
564
+ sage: c.strong_down_list()
565
+ [[]]
566
+ sage: c = Core([5,3,1],3)
567
+ sage: c.strong_down_list()
568
+ [[4, 2], [3, 1, 1]]
569
+ """
570
+ if not self:
571
+ return []
572
+ return [ga for ga in Cores(self.k(), length=self.length() - 1)
573
+ if self.contains(ga)]
574
+
575
+
576
+ def Cores(k, length=None, **kwargs):
577
+ r"""
578
+ A `k`-core is a partition from which no rim hook of size `k` can be removed.
579
+ Alternatively, a `k`-core is an integer partition such that the Ferrers
580
+ diagram for the partition contains no cells with a hook of size (a multiple of) `k`.
581
+
582
+ The `k`-cores generally have two notions of size which are
583
+ useful for different applications. One is the number of cells in the
584
+ Ferrers diagram with hook less than `k`, the other is the total
585
+ number of cells of the Ferrers diagram. In the implementation in
586
+ Sage, the first of notion is referred to as the ``length`` of the `k`-core
587
+ and the second is the ``size`` of the `k`-core. The class
588
+ of Cores requires that either the size or the length of the elements in
589
+ the class is specified.
590
+
591
+ EXAMPLES:
592
+
593
+ We create the set of the `4`-cores of length `6`. Here the length of a `k`-core is the size
594
+ of the corresponding `(k-1)`-bounded partition, see also :meth:`~sage.combinat.core.Core.length`::
595
+
596
+ sage: C = Cores(4, 6); C
597
+ 4-Cores of length 6
598
+ sage: C.list()
599
+ [[6, 3], [5, 2, 1], [4, 1, 1, 1], [4, 2, 2], [3, 3, 1, 1], [3, 2, 1, 1, 1], [2, 2, 2, 1, 1, 1]]
600
+ sage: C.cardinality()
601
+ 7
602
+ sage: C.an_element()
603
+ [6, 3]
604
+
605
+ We may also list the set of `4`-cores of size `6`, where the size is the number of boxes in the
606
+ core, see also :meth:`~sage.combinat.core.Core.size`::
607
+
608
+ sage: C = Cores(4, size=6); C
609
+ 4-Cores of size 6
610
+ sage: C.list()
611
+ [[4, 1, 1], [3, 2, 1], [3, 1, 1, 1]]
612
+ sage: C.cardinality()
613
+ 3
614
+ sage: C.an_element()
615
+ [4, 1, 1]
616
+ """
617
+ if length is None and 'size' in kwargs:
618
+ return Cores_size(k, kwargs['size'])
619
+ if length is not None:
620
+ return Cores_length(k, length)
621
+ raise ValueError("you need to either specify the length or size of the cores considered")
622
+
623
+
624
+ class Cores_length(UniqueRepresentation, Parent):
625
+ r"""
626
+ The class of `k`-cores of length `n`.
627
+ """
628
+
629
+ def __init__(self, k, n):
630
+ """
631
+ TESTS::
632
+
633
+ sage: C = Cores(3, 4)
634
+ sage: TestSuite(C).run()
635
+ """
636
+ self.k = k
637
+ self.n = n
638
+ Parent.__init__(self, category=FiniteEnumeratedSets())
639
+
640
+ def _repr_(self):
641
+ """
642
+ TESTS::
643
+
644
+ sage: repr(Cores(4, 3)) #indirect doctest
645
+ '4-Cores of length 3'
646
+ """
647
+ return "%s-Cores of length %s" % (self.k, self.n)
648
+
649
+ def list(self):
650
+ r"""
651
+ Return the list of all `k`-cores of length `n`.
652
+
653
+ EXAMPLES::
654
+
655
+ sage: C = Cores(3,4)
656
+ sage: C.list()
657
+ [[4, 2], [3, 1, 1], [2, 2, 1, 1]]
658
+ """
659
+ return [la.to_core(self.k - 1)
660
+ for la in Partitions(self.n, max_part=self.k - 1)]
661
+
662
+ def from_partition(self, part):
663
+ r"""
664
+ Convert the partition ``part`` into a core (as the identity map).
665
+
666
+ This is the inverse method to :meth:`~sage.combinat.core.Core.to_partition`.
667
+
668
+ EXAMPLES::
669
+
670
+ sage: C = Cores(3,4)
671
+ sage: c = C.from_partition([4,2]); c
672
+ [4, 2]
673
+
674
+ sage: mu = Partition([2,1,1])
675
+ sage: C = Cores(3,3)
676
+ sage: C.from_partition(mu).to_partition() == mu
677
+ True
678
+
679
+ sage: mu = Partition([])
680
+ sage: C = Cores(3,0)
681
+ sage: C.from_partition(mu).to_partition() == mu
682
+ True
683
+ """
684
+ return Core(part, self.k)
685
+
686
+ Element = Core
687
+
688
+
689
+ class Cores_size(UniqueRepresentation, Parent):
690
+ r"""
691
+ The class of `k`-cores of size `n`.
692
+ """
693
+
694
+ def __init__(self, k, n):
695
+ """
696
+ TESTS::
697
+
698
+ sage: C = Cores(3, size = 4)
699
+ sage: TestSuite(C).run()
700
+ """
701
+ self.k = k
702
+ self.n = n
703
+ Parent.__init__(self, category=FiniteEnumeratedSets())
704
+
705
+ def _repr_(self):
706
+ """
707
+ TESTS::
708
+
709
+ sage: repr(Cores(4, size = 3)) #indirect doctest
710
+ '4-Cores of size 3'
711
+ """
712
+ return "%s-Cores of size %s" % (self.k, self.n)
713
+
714
+ def list(self):
715
+ r"""
716
+ Return the list of all `k`-cores of size `n`.
717
+
718
+ EXAMPLES::
719
+
720
+ sage: C = Cores(3, size = 4)
721
+ sage: C.list()
722
+ [[3, 1], [2, 1, 1]]
723
+ """
724
+ return [Core(x, self.k) for x in Partitions(self.n)
725
+ if x.is_core(self.k)]
726
+
727
+ def from_partition(self, part):
728
+ r"""
729
+ Convert the partition ``part`` into a core (as the identity map).
730
+
731
+ This is the inverse method to :meth:`to_partition`.
732
+
733
+ EXAMPLES::
734
+
735
+ sage: C = Cores(3,size=4)
736
+ sage: c = C.from_partition([2,1,1]); c
737
+ [2, 1, 1]
738
+
739
+ sage: mu = Partition([2,1,1])
740
+ sage: C = Cores(3,size=4)
741
+ sage: C.from_partition(mu).to_partition() == mu
742
+ True
743
+
744
+ sage: mu = Partition([])
745
+ sage: C = Cores(3,size=0)
746
+ sage: C.from_partition(mu).to_partition() == mu
747
+ True
748
+ """
749
+ return Core(part, self.k)
750
+
751
+ Element = Core