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,1008 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+ """
4
+ Descent algebras
5
+
6
+ AUTHORS:
7
+
8
+ - Travis Scrimshaw (2013-07-28): initial version
9
+ """
10
+ # ****************************************************************************
11
+ # Copyright (C) 2013 Travis Scrimshaw <tscrim at ucdavis.edu>
12
+ #
13
+ # Distributed under the terms of the GNU General Public License (GPL)
14
+ # https://www.gnu.org/licenses/
15
+ # ****************************************************************************
16
+
17
+ from sage.arith.misc import factorial
18
+ from sage.categories.algebras import Algebras
19
+ from sage.categories.commutative_rings import CommutativeRings
20
+ from sage.categories.fields import Fields
21
+ from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis
22
+ from sage.categories.realizations import Realizations, Category_realization_of_parent
23
+ from sage.combinat.composition import Compositions
24
+ from sage.combinat.free_module import CombinatorialFreeModule
25
+ from sage.combinat.integer_matrices import IntegerMatrices
26
+ from sage.combinat.ncsf_qsym.ncsf import NonCommutativeSymmetricFunctions
27
+ from sage.combinat.permutation import Permutations
28
+ from sage.combinat.subset import SubsetsSorted
29
+ from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
30
+ from sage.misc.bindable_class import BindableClass
31
+ from sage.misc.cachefunc import cached_method
32
+ from sage.misc.lazy_attribute import lazy_attribute
33
+ from sage.rings.integer_ring import ZZ
34
+ from sage.rings.rational_field import QQ
35
+ from sage.structure.parent import Parent
36
+ from sage.structure.unique_representation import UniqueRepresentation
37
+
38
+
39
+ class DescentAlgebra(UniqueRepresentation, Parent):
40
+ r"""
41
+ Solomon's descent algebra.
42
+
43
+ The descent algebra `\Sigma_n` over a ring `R` is a subalgebra of the
44
+ symmetric group algebra `R S_n`. (The product in the latter algebra
45
+ is defined by `(pq)(i) = q(p(i))` for any two permutations `p` and
46
+ `q` in `S_n` and every `i \in \{ 1, 2, \ldots, n \}`. The algebra
47
+ `\Sigma_n` inherits this product.)
48
+
49
+ There are three bases currently implemented for `\Sigma_n`:
50
+
51
+ - the standard basis `D_S` of (sums of) descent classes, indexed by
52
+ subsets `S` of `\{1, 2, \ldots, n-1\}`,
53
+ - the subset basis `B_p`, indexed by compositions `p` of `n`,
54
+ - the idempotent basis `I_p`, indexed by compositions `p` of `n`,
55
+ which is used to construct the mutually orthogonal idempotents
56
+ of the symmetric group algebra.
57
+
58
+ The idempotent basis is only defined when `R` is a `\QQ`-algebra.
59
+
60
+ We follow the notations and conventions in [GR1989]_, apart from the
61
+ order of multiplication being different from the one used in that
62
+ article. Schocker's exposition [Sch2004]_, in turn, uses the
63
+ same order of multiplication as we are, but has different notations
64
+ for the bases.
65
+
66
+ INPUT:
67
+
68
+ - ``R`` -- the base ring
69
+
70
+ - ``n`` -- nonnegative integer
71
+
72
+ REFERENCES:
73
+
74
+ - [GR1989]_
75
+
76
+ - [At1992]_
77
+
78
+ - [MR1995]_
79
+
80
+ - [Sch2004]_
81
+
82
+ EXAMPLES::
83
+
84
+ sage: DA = DescentAlgebra(QQ, 4)
85
+ sage: D = DA.D(); D
86
+ Descent algebra of 4 over Rational Field in the standard basis
87
+ sage: B = DA.B(); B
88
+ Descent algebra of 4 over Rational Field in the subset basis
89
+ sage: I = DA.I(); I
90
+ Descent algebra of 4 over Rational Field in the idempotent basis
91
+ sage: basis_B = B.basis()
92
+ sage: elt = basis_B[Composition([1,2,1])] + 4*basis_B[Composition([1,3])]; elt
93
+ B[1, 2, 1] + 4*B[1, 3]
94
+ sage: D(elt)
95
+ 5*D{} + 5*D{1} + D{1, 3} + D{3}
96
+ sage: I(elt)
97
+ 7/6*I[1, 1, 1, 1] + 2*I[1, 1, 2] + 3*I[1, 2, 1] + 4*I[1, 3]
98
+
99
+
100
+ As syntactic sugar, one can use the notation ``D[i,...,l]`` to
101
+ construct elements of the basis; note that for the empty set one
102
+ must use ``D[[]]`` due to Python's syntax::
103
+
104
+ sage: D[[]] + D[2] + 2*D[1,2]
105
+ D{} + 2*D{1, 2} + D{2}
106
+
107
+ The same syntax works for the other bases::
108
+
109
+ sage: I[1,2,1] + 3*I[4] + 2*I[3,1]
110
+ I[1, 2, 1] + 2*I[3, 1] + 3*I[4]
111
+
112
+ TESTS:
113
+
114
+ We check that we can go back and forth between our bases::
115
+
116
+ sage: DA = DescentAlgebra(QQ, 4)
117
+ sage: D = DA.D()
118
+ sage: B = DA.B()
119
+ sage: I = DA.I()
120
+ sage: all(D(B(b)) == b for b in D.basis())
121
+ True
122
+ sage: all(D(I(b)) == b for b in D.basis())
123
+ True
124
+ sage: all(B(D(b)) == b for b in B.basis())
125
+ True
126
+ sage: all(B(I(b)) == b for b in B.basis())
127
+ True
128
+ sage: all(I(D(b)) == b for b in I.basis())
129
+ True
130
+ sage: all(I(B(b)) == b for b in I.basis())
131
+ True
132
+ """
133
+
134
+ def __init__(self, R, n):
135
+ r"""
136
+ EXAMPLES::
137
+
138
+ sage: TestSuite(DescentAlgebra(QQ, 4)).run()
139
+
140
+ TESTS::
141
+
142
+ sage: B = DescentAlgebra(QQ, 4).B()
143
+ sage: B.is_commutative()
144
+ False
145
+ sage: B = DescentAlgebra(QQ, 1).B()
146
+ sage: B.is_commutative()
147
+ True
148
+
149
+ sage: B = DescentAlgebra(QQ, 4).B()
150
+ sage: B in Fields()
151
+ False
152
+ sage: B = DescentAlgebra(QQ, 1).B()
153
+ sage: B in Fields()
154
+ True
155
+ """
156
+ self._n = n
157
+ cat = FiniteDimensionalAlgebrasWithBasis(R)
158
+ if R in CommutativeRings() and n <= 2:
159
+ cat = cat.Commutative()
160
+ if R in Fields() and n <= 1:
161
+ cat &= Fields()
162
+ self._category = cat
163
+ Parent.__init__(self, base=R, category=self._category.WithRealizations())
164
+
165
+ def _repr_(self) -> str:
166
+ r"""
167
+ Return a string representation of ``self``.
168
+
169
+ EXAMPLES::
170
+
171
+ sage: DescentAlgebra(QQ, 4)
172
+ Descent algebra of 4 over Rational Field
173
+ """
174
+ return "Descent algebra of {0} over {1}".format(self._n, self.base_ring())
175
+
176
+ def a_realization(self):
177
+ r"""
178
+ Return a particular realization of ``self`` (the `B`-basis).
179
+
180
+ EXAMPLES::
181
+
182
+ sage: DA = DescentAlgebra(QQ, 4)
183
+ sage: DA.a_realization()
184
+ Descent algebra of 4 over Rational Field in the subset basis
185
+ """
186
+ return self.B()
187
+
188
+ class D(CombinatorialFreeModule, BindableClass):
189
+ r"""
190
+ The standard basis of a descent algebra.
191
+
192
+ This basis is indexed by `S \subseteq \{1, 2, \ldots, n-1\}`,
193
+ and the basis vector indexed by `S` is the sum of all permutations,
194
+ taken in the symmetric group algebra `R S_n`, whose descent set is `S`.
195
+ We denote this basis vector by `D_S`.
196
+
197
+ Occasionally this basis appears in literature but indexed by
198
+ compositions of `n` rather than subsets of
199
+ `\{1, 2, \ldots, n-1\}`. The equivalence between these two
200
+ indexings is owed to the bijection from the power set of
201
+ `\{1, 2, \ldots, n-1\}` to the set of all compositions of `n`
202
+ which sends every subset `\{i_1, i_2, \ldots, i_k\}` of
203
+ `\{1, 2, \ldots, n-1\}` (with `i_1 < i_2 < \cdots < i_k`) to
204
+ the composition `(i_1, i_2-i_1, \ldots, i_k-i_{k-1}, n-i_k)`.
205
+
206
+ The basis element corresponding to a composition `p` (or to
207
+ the subset of `\{1, 2, \ldots, n-1\}`) is denoted `\Delta^p`
208
+ in [Sch2004]_.
209
+
210
+ EXAMPLES::
211
+
212
+ sage: DA = DescentAlgebra(QQ, 4)
213
+ sage: D = DA.D()
214
+ sage: list(D.basis())
215
+ [D{}, D{1}, D{2}, D{3}, D{1, 2}, D{1, 3}, D{2, 3}, D{1, 2, 3}]
216
+
217
+ sage: DA = DescentAlgebra(QQ, 0)
218
+ sage: D = DA.D()
219
+ sage: list(D.basis())
220
+ [D{}]
221
+ """
222
+
223
+ def __init__(self, alg, prefix='D'):
224
+ r"""
225
+ Initialize ``self``.
226
+
227
+ EXAMPLES::
228
+
229
+ sage: TestSuite(DescentAlgebra(QQ, 4).D()).run()
230
+ """
231
+ self._prefix = prefix
232
+ self._basis_name = "standard"
233
+ CombinatorialFreeModule.__init__(self, alg.base_ring(),
234
+ SubsetsSorted(range(1, alg._n)),
235
+ category=DescentAlgebraBases(alg),
236
+ bracket='', prefix=prefix)
237
+
238
+ # Change of basis:
239
+ B = alg.B()
240
+ self.module_morphism(self.to_B_basis,
241
+ codomain=B, category=self.category()
242
+ ).register_as_coercion()
243
+
244
+ B.module_morphism(B.to_D_basis,
245
+ codomain=self, category=self.category()
246
+ ).register_as_coercion()
247
+
248
+ def _element_constructor_(self, x):
249
+ """
250
+ Construct an element of ``self``.
251
+
252
+ EXAMPLES::
253
+
254
+ sage: D = DescentAlgebra(QQ, 4).D()
255
+ sage: D([1, 3])
256
+ D{1, 3}
257
+ """
258
+ if isinstance(x, (list, set)):
259
+ x = tuple(x)
260
+ if isinstance(x, tuple):
261
+ return self.monomial(x)
262
+ return CombinatorialFreeModule._element_constructor_(self, x)
263
+
264
+ # We need to overwrite this since our basis elements must be indexed by tuples
265
+ def _repr_term(self, S) -> str:
266
+ r"""
267
+ EXAMPLES::
268
+
269
+ sage: DA = DescentAlgebra(QQ, 4)
270
+ sage: DA.D()._repr_term((1, 3))
271
+ 'D{1, 3}'
272
+ """
273
+ return self._prefix + '{' + repr(list(S))[1:-1] + '}'
274
+
275
+ def product_on_basis(self, S, T):
276
+ r"""
277
+ Return `D_S D_T`, where `S` and `T` are subsets of `[n-1]`.
278
+
279
+ EXAMPLES::
280
+
281
+ sage: DA = DescentAlgebra(QQ, 4)
282
+ sage: D = DA.D()
283
+ sage: D.product_on_basis((1, 3), (2,))
284
+ D{} + D{1} + D{1, 2} + 2*D{1, 2, 3} + D{1, 3} + D{2} + D{2, 3} + D{3}
285
+ """
286
+ return self(self.to_B_basis(S) * self.to_B_basis(T))
287
+
288
+ @cached_method
289
+ def one_basis(self) -> tuple:
290
+ r"""
291
+ Return the identity element, as per
292
+ ``AlgebrasWithBasis.ParentMethods.one_basis``.
293
+
294
+ EXAMPLES::
295
+
296
+ sage: DescentAlgebra(QQ, 4).D().one_basis()
297
+ ()
298
+ sage: DescentAlgebra(QQ, 0).D().one_basis()
299
+ ()
300
+
301
+ sage: all( U * DescentAlgebra(QQ, 3).D().one() == U
302
+ ....: for U in DescentAlgebra(QQ, 3).D().basis() )
303
+ True
304
+ """
305
+ return tuple()
306
+
307
+ @cached_method
308
+ def to_B_basis(self, S):
309
+ r"""
310
+ Return `D_S` as a linear combination of `B_p`-basis elements.
311
+
312
+ EXAMPLES::
313
+
314
+ sage: DA = DescentAlgebra(QQ, 4)
315
+ sage: D = DA.D()
316
+ sage: B = DA.B()
317
+ sage: list(map(B, D.basis())) # indirect doctest
318
+ [B[4],
319
+ B[1, 3] - B[4],
320
+ B[2, 2] - B[4],
321
+ B[3, 1] - B[4],
322
+ B[1, 1, 2] - B[1, 3] - B[2, 2] + B[4],
323
+ B[1, 2, 1] - B[1, 3] - B[3, 1] + B[4],
324
+ B[2, 1, 1] - B[2, 2] - B[3, 1] + B[4],
325
+ B[1, 1, 1, 1] - B[1, 1, 2] - B[1, 2, 1] + B[1, 3]
326
+ - B[2, 1, 1] + B[2, 2] + B[3, 1] - B[4]]
327
+ """
328
+ B = self.realization_of().B()
329
+
330
+ if not S:
331
+ return B.one()
332
+
333
+ n = self.realization_of()._n
334
+ C = Compositions(n)
335
+ lenS = len(S)
336
+ return B.sum_of_terms([(C.from_subset(T, n), (-1)**(lenS - len(T)))
337
+ for T in SubsetsSorted(S)])
338
+
339
+ def to_symmetric_group_algebra_on_basis(self, S):
340
+ """
341
+ Return `D_S` as a linear combination of basis elements in the
342
+ symmetric group algebra.
343
+
344
+ EXAMPLES::
345
+
346
+ sage: D = DescentAlgebra(QQ, 4).D()
347
+ sage: [D.to_symmetric_group_algebra_on_basis(tuple(b)) # needs sage.graphs
348
+ ....: for b in Subsets(3)]
349
+ [[1, 2, 3, 4],
350
+ [2, 1, 3, 4] + [3, 1, 2, 4] + [4, 1, 2, 3],
351
+ [1, 3, 2, 4] + [1, 4, 2, 3] + [2, 3, 1, 4]
352
+ + [2, 4, 1, 3] + [3, 4, 1, 2],
353
+ [1, 2, 4, 3] + [1, 3, 4, 2] + [2, 3, 4, 1],
354
+ [3, 2, 1, 4] + [4, 2, 1, 3] + [4, 3, 1, 2],
355
+ [2, 1, 4, 3] + [3, 1, 4, 2] + [3, 2, 4, 1]
356
+ + [4, 1, 3, 2] + [4, 2, 3, 1],
357
+ [1, 4, 3, 2] + [2, 4, 3, 1] + [3, 4, 2, 1],
358
+ [4, 3, 2, 1]]
359
+ """
360
+ n = self.realization_of()._n
361
+ SGA = SymmetricGroupAlgebra(self.base_ring(), n)
362
+ # Need to convert S to a list of positions by -1 for indexing
363
+ P = Permutations(descents=([x - 1 for x in S], n))
364
+ return SGA.sum_of_terms([(p, 1) for p in P])
365
+
366
+ def __getitem__(self, S):
367
+ """
368
+ Return the basis element indexed by ``S``.
369
+
370
+ INPUT:
371
+
372
+ - ``S`` -- a subset of `[n-1]`
373
+
374
+ EXAMPLES::
375
+
376
+ sage: D = DescentAlgebra(QQ, 4).D()
377
+ sage: D[3]
378
+ D{3}
379
+ sage: D[1, 3]
380
+ D{1, 3}
381
+ sage: D[[]]
382
+ D{}
383
+
384
+ TESTS::
385
+
386
+ sage: D = DescentAlgebra(QQ, 0).D()
387
+ sage: D[[]]
388
+ D{}
389
+ """
390
+ n = self.realization_of()._n
391
+ if S in ZZ:
392
+ if S >= n or S <= 0:
393
+ raise ValueError("({0},) is not a subset of {{1, ..., {1}}}".format(S, n - 1))
394
+ return self.monomial((S,))
395
+ if not S:
396
+ return self.one()
397
+ S = sorted(S)
398
+ if S[-1] >= n or S[0] <= 0:
399
+ raise ValueError("{0} is not a subset of {{1, ..., {1}}}".format(S, n - 1))
400
+ return self.monomial(tuple(S))
401
+
402
+ standard = D
403
+
404
+ class B(CombinatorialFreeModule, BindableClass):
405
+ r"""
406
+ The subset basis of a descent algebra (indexed by compositions).
407
+
408
+ The subset basis `(B_S)_{S \subseteq \{1, 2, \ldots, n-1\}}` of
409
+ `\Sigma_n` is formed by
410
+
411
+ .. MATH::
412
+
413
+ B_S = \sum_{T \subseteq S} D_T,
414
+
415
+ where `(D_S)_{S \subseteq \{1, 2, \ldots, n-1\}}` is the
416
+ :class:`standard basis <DescentAlgebra.D>`. However it is more
417
+ natural to index the subset basis by compositions
418
+ of `n` under the bijection `\{i_1, i_2, \ldots, i_k\} \mapsto
419
+ (i_1, i_2 - i_1, i_3 - i_2, \ldots, i_k - i_{k-1}, n - i_k)`
420
+ (where `i_1 < i_2 < \cdots < i_k`), which is what Sage uses to
421
+ index the basis.
422
+
423
+ The basis element `B_p` is denoted `\Xi^p` in [Sch2004]_.
424
+
425
+ By using compositions of `n`, the product `B_p B_q` becomes a
426
+ sum over the nonnegative-integer matrices `M` with row sum `p`
427
+ and column sum `q`. The summand corresponding to `M` is `B_c`,
428
+ where `c` is the composition obtained by reading `M` row-by-row
429
+ from left-to-right and top-to-bottom and removing all zeroes.
430
+ This multiplication rule is commonly called "Solomon's Mackey
431
+ formula".
432
+
433
+ EXAMPLES::
434
+
435
+ sage: DA = DescentAlgebra(QQ, 4)
436
+ sage: B = DA.B()
437
+ sage: list(B.basis())
438
+ [B[1, 1, 1, 1], B[1, 1, 2], B[1, 2, 1], B[1, 3],
439
+ B[2, 1, 1], B[2, 2], B[3, 1], B[4]]
440
+ """
441
+
442
+ def __init__(self, alg, prefix='B'):
443
+ r"""
444
+ Initialize ``self``.
445
+
446
+ EXAMPLES::
447
+
448
+ sage: TestSuite(DescentAlgebra(QQ, 4).B()).run()
449
+ """
450
+ self._prefix = prefix
451
+ self._basis_name = "subset"
452
+ CombinatorialFreeModule.__init__(self, alg.base_ring(),
453
+ Compositions(alg._n),
454
+ category=DescentAlgebraBases(alg),
455
+ bracket='', prefix=prefix)
456
+
457
+ S = NonCommutativeSymmetricFunctions(alg.base_ring()).Complete()
458
+ self.module_morphism(self.to_nsym,
459
+ codomain=S, category=Algebras(alg.base_ring())
460
+ ).register_as_coercion()
461
+
462
+ def product_on_basis(self, p, q):
463
+ r"""
464
+ Return `B_p B_q`, where `p` and `q` are compositions of `n`.
465
+
466
+ EXAMPLES::
467
+
468
+ sage: DA = DescentAlgebra(QQ, 4)
469
+ sage: B = DA.B()
470
+ sage: p = Composition([1,2,1])
471
+ sage: q = Composition([3,1])
472
+ sage: B.product_on_basis(p, q)
473
+ B[1, 1, 1, 1] + 2*B[1, 2, 1]
474
+ """
475
+ IM = IntegerMatrices(list(p), list(q))
476
+ P = Compositions(self.realization_of()._n)
477
+
478
+ def to_composition(m):
479
+ return P([x for x in m.list() if x != 0])
480
+ return self.sum_of_monomials([to_composition(mat) for mat in IM])
481
+
482
+ @cached_method
483
+ def one_basis(self):
484
+ r"""
485
+ Return the identity element which is the composition `[n]`, as per
486
+ ``AlgebrasWithBasis.ParentMethods.one_basis``.
487
+
488
+ EXAMPLES::
489
+
490
+ sage: DescentAlgebra(QQ, 4).B().one_basis()
491
+ [4]
492
+ sage: DescentAlgebra(QQ, 0).B().one_basis()
493
+ []
494
+
495
+ sage: all( U * DescentAlgebra(QQ, 3).B().one() == U
496
+ ....: for U in DescentAlgebra(QQ, 3).B().basis() )
497
+ True
498
+ """
499
+ n = self.realization_of()._n
500
+ P = Compositions(n)
501
+ if not n: # n == 0
502
+ return P([])
503
+ return P([n])
504
+
505
+ @cached_method
506
+ def to_I_basis(self, p):
507
+ r"""
508
+ Return `B_p` as a linear combination of `I`-basis elements.
509
+
510
+ This is done using the formula
511
+
512
+ .. MATH::
513
+
514
+ B_p = \sum_{q \leq p} \frac{1}{\mathbf{k}!(q,p)} I_q,
515
+
516
+ where `\leq` is the refinement order and `\mathbf{k}!(q,p)` is
517
+ defined as follows: When `q \leq p`, we can write `q` as a
518
+ concatenation `q_{(1)} q_{(2)} \cdots q_{(k)}` with each `q_{(i)}`
519
+ being a composition of the `i`-th entry of `p`, and then
520
+ we set `\mathbf{k}!(q,p)` to be
521
+ `l(q_{(1)})! l(q_{(2)})! \cdots l(q_{(k)})!`, where `l(r)`
522
+ denotes the number of parts of any composition `r`.
523
+
524
+ EXAMPLES::
525
+
526
+ sage: DA = DescentAlgebra(QQ, 4)
527
+ sage: B = DA.B()
528
+ sage: I = DA.I()
529
+ sage: list(map(I, B.basis())) # indirect doctest
530
+ [I[1, 1, 1, 1],
531
+ 1/2*I[1, 1, 1, 1] + I[1, 1, 2],
532
+ 1/2*I[1, 1, 1, 1] + I[1, 2, 1],
533
+ 1/6*I[1, 1, 1, 1] + 1/2*I[1, 1, 2] + 1/2*I[1, 2, 1] + I[1, 3],
534
+ 1/2*I[1, 1, 1, 1] + I[2, 1, 1],
535
+ 1/4*I[1, 1, 1, 1] + 1/2*I[1, 1, 2] + 1/2*I[2, 1, 1] + I[2, 2],
536
+ 1/6*I[1, 1, 1, 1] + 1/2*I[1, 2, 1] + 1/2*I[2, 1, 1] + I[3, 1],
537
+ 1/24*I[1, 1, 1, 1] + 1/6*I[1, 1, 2] + 1/6*I[1, 2, 1]
538
+ + 1/2*I[1, 3] + 1/6*I[2, 1, 1] + 1/2*I[2, 2] + 1/2*I[3, 1] + I[4]]
539
+ """
540
+ I = self.realization_of().I()
541
+
542
+ def coeff(p, q):
543
+ ret = QQ.one()
544
+ last = 0
545
+ for val in p:
546
+ count = 0
547
+ s = 0
548
+ while s != val:
549
+ s += q[last + count]
550
+ count += 1
551
+ ret /= factorial(count)
552
+ last += count
553
+ return ret
554
+
555
+ return I.sum_of_terms([(q, coeff(p, q)) for q in p.finer()])
556
+
557
+ @cached_method
558
+ def to_D_basis(self, p):
559
+ r"""
560
+ Return `B_p` as a linear combination of `D`-basis elements.
561
+
562
+ EXAMPLES::
563
+
564
+ sage: DA = DescentAlgebra(QQ, 4)
565
+ sage: B = DA.B()
566
+ sage: D = DA.D()
567
+ sage: list(map(D, B.basis())) # indirect doctest
568
+ [D{} + D{1} + D{1, 2} + D{1, 2, 3}
569
+ + D{1, 3} + D{2} + D{2, 3} + D{3},
570
+ D{} + D{1} + D{1, 2} + D{2},
571
+ D{} + D{1} + D{1, 3} + D{3},
572
+ D{} + D{1},
573
+ D{} + D{2} + D{2, 3} + D{3},
574
+ D{} + D{2},
575
+ D{} + D{3},
576
+ D{}]
577
+
578
+ TESTS:
579
+
580
+ Check to make sure the empty case is handled correctly::
581
+
582
+ sage: DA = DescentAlgebra(QQ, 0)
583
+ sage: B = DA.B()
584
+ sage: D = DA.D()
585
+ sage: list(map(D, B.basis()))
586
+ [D{}]
587
+ """
588
+ D = self.realization_of().D()
589
+
590
+ if not p:
591
+ return D.one()
592
+
593
+ return D.sum_of_terms([(tuple(sorted(s)), 1) for s in p.to_subset().subsets()])
594
+
595
+ def to_nsym(self, p):
596
+ """
597
+ Return `B_p` as an element in `NSym`, the non-commutative
598
+ symmetric functions.
599
+
600
+ This maps `B_p` to `S_p` where `S` denotes the Complete basis of
601
+ `NSym`.
602
+
603
+ EXAMPLES::
604
+
605
+ sage: B = DescentAlgebra(QQ, 4).B()
606
+ sage: S = NonCommutativeSymmetricFunctions(QQ).Complete()
607
+ sage: list(map(S, B.basis())) # indirect doctest
608
+ [S[1, 1, 1, 1],
609
+ S[1, 1, 2],
610
+ S[1, 2, 1],
611
+ S[1, 3],
612
+ S[2, 1, 1],
613
+ S[2, 2],
614
+ S[3, 1],
615
+ S[4]]
616
+ """
617
+ S = NonCommutativeSymmetricFunctions(self.base_ring()).Complete()
618
+ return S.monomial(p)
619
+
620
+ subset = B
621
+
622
+ class I(CombinatorialFreeModule, BindableClass):
623
+ r"""
624
+ The idempotent basis of a descent algebra.
625
+
626
+ The idempotent basis `(I_p)_{p \models n}` is a basis for `\Sigma_n`
627
+ whenever the ground ring is a `\QQ`-algebra. One way to compute it
628
+ is using the formula (Theorem 3.3 in [GR1989]_)
629
+
630
+ .. MATH::
631
+
632
+ I_p = \sum_{q \leq p}
633
+ \frac{(-1)^{l(q)-l(p)}}{\mathbf{k}(q,p)} B_q,
634
+
635
+ where `\leq` is the refinement order and `l(r)` denotes the number
636
+ of parts of any composition `r`, and where `\mathbf{k}(q,p)` is
637
+ defined as follows: When `q \leq p`, we can write `q` as a
638
+ concatenation `q_{(1)} q_{(2)} \cdots q_{(k)}` with each `q_{(i)}`
639
+ being a composition of the `i`-th entry of `p`, and then
640
+ we set `\mathbf{k}(q,p)` to be the product
641
+ `l(q_{(1)}) l(q_{(2)}) \cdots l(q_{(k)})`.
642
+
643
+ Let `\lambda(p)` denote the partition obtained from a composition
644
+ `p` by sorting. This basis is called the idempotent basis since for
645
+ any `q` such that `\lambda(p) = \lambda(q)`, we have:
646
+
647
+ .. MATH::
648
+
649
+ I_p I_q = s(\lambda) I_p
650
+
651
+ where `\lambda` denotes `\lambda(p) = \lambda(q)`, and where
652
+ `s(\lambda)` is the stabilizer of `\lambda` in `S_n`. (This is
653
+ part of Theorem 4.2 in [GR1989]_.)
654
+
655
+ It is also straightforward to compute the idempotents `E_{\lambda}`
656
+ for the symmetric group algebra by the formula
657
+ (Theorem 3.2 in [GR1989]_):
658
+
659
+ .. MATH::
660
+
661
+ E_{\lambda} = \frac{1}{k!} \sum_{\lambda(p) = \lambda} I_p.
662
+
663
+ .. NOTE::
664
+
665
+ The basis elements are not orthogonal idempotents.
666
+
667
+ EXAMPLES::
668
+
669
+ sage: DA = DescentAlgebra(QQ, 4)
670
+ sage: I = DA.I()
671
+ sage: list(I.basis())
672
+ [I[1, 1, 1, 1], I[1, 1, 2], I[1, 2, 1], I[1, 3], I[2, 1, 1], I[2, 2], I[3, 1], I[4]]
673
+ """
674
+
675
+ def __init__(self, alg, prefix='I'):
676
+ r"""
677
+ Initialize ``self``.
678
+
679
+ EXAMPLES::
680
+
681
+ sage: TestSuite(DescentAlgebra(QQ, 4).B()).run()
682
+ """
683
+ self._prefix = prefix
684
+ self._basis_name = "idempotent"
685
+ CombinatorialFreeModule.__init__(self, alg.base_ring(),
686
+ Compositions(alg._n),
687
+ category=DescentAlgebraBases(alg),
688
+ bracket='', prefix=prefix)
689
+
690
+ # Change of basis:
691
+ B = alg.B()
692
+ self.module_morphism(self.to_B_basis,
693
+ codomain=B, category=self.category()
694
+ ).register_as_coercion()
695
+
696
+ B.module_morphism(B.to_I_basis,
697
+ codomain=self, category=self.category()
698
+ ).register_as_coercion()
699
+
700
+ def product_on_basis(self, p, q):
701
+ r"""
702
+ Return `I_p I_q`, where `p` and `q` are compositions of `n`.
703
+
704
+ EXAMPLES::
705
+
706
+ sage: DA = DescentAlgebra(QQ, 4)
707
+ sage: I = DA.I()
708
+ sage: p = Composition([1,2,1])
709
+ sage: q = Composition([3,1])
710
+ sage: I.product_on_basis(p, q)
711
+ 0
712
+ sage: I.product_on_basis(p, p)
713
+ 2*I[1, 2, 1]
714
+ """
715
+ # These do not act as orthogonal idempotents, so we have to lift
716
+ # to the B basis to do the multiplication
717
+ # TODO: if the partitions of p and q match, return s*I_p where
718
+ # s is the size of the stabilizer of the partition of p
719
+ return self(self.to_B_basis(p) * self.to_B_basis(q))
720
+
721
+ @cached_method
722
+ def one(self):
723
+ r"""
724
+ Return the identity element, which is `B_{[n]}`, in the `I` basis.
725
+
726
+ EXAMPLES::
727
+
728
+ sage: DescentAlgebra(QQ, 4).I().one()
729
+ 1/24*I[1, 1, 1, 1] + 1/6*I[1, 1, 2] + 1/6*I[1, 2, 1]
730
+ + 1/2*I[1, 3] + 1/6*I[2, 1, 1] + 1/2*I[2, 2]
731
+ + 1/2*I[3, 1] + I[4]
732
+ sage: DescentAlgebra(QQ, 0).I().one()
733
+ I[]
734
+
735
+ TESTS::
736
+
737
+ sage: all( U * DescentAlgebra(QQ, 3).I().one() == U
738
+ ....: for U in DescentAlgebra(QQ, 3).I().basis() )
739
+ True
740
+ """
741
+ B = self.realization_of().B()
742
+ return B.to_I_basis(B.one_basis())
743
+
744
+ def one_basis(self):
745
+ """
746
+ The element `1` is not (generally) a basis vector in the `I`
747
+ basis, thus this raises a :exc:`TypeError`.
748
+
749
+ EXAMPLES::
750
+
751
+ sage: DescentAlgebra(QQ, 4).I().one_basis()
752
+ Traceback (most recent call last):
753
+ ...
754
+ TypeError: 1 is not a basis element in the I basis
755
+ """
756
+ raise TypeError("1 is not a basis element in the I basis")
757
+
758
+ @cached_method
759
+ def to_B_basis(self, p):
760
+ r"""
761
+ Return `I_p` as a linear combination of `B`-basis elements.
762
+
763
+ This is computed using the formula (Theorem 3.3 in [GR1989]_)
764
+
765
+ .. MATH::
766
+
767
+ I_p = \sum_{q \leq p}
768
+ \frac{(-1)^{l(q)-l(p)}}{\mathbf{k}(q,p)} B_q,
769
+
770
+ where `\leq` is the refinement order and `l(r)` denotes the number
771
+ of parts of any composition `r`, and where `\mathbf{k}(q,p)` is
772
+ defined as follows: When `q \leq p`, we can write `q` as a
773
+ concatenation `q_{(1)} q_{(2)} \cdots q_{(k)}` with each `q_{(i)}`
774
+ being a composition of the `i`-th entry of `p`, and then
775
+ we set `\mathbf{k}(q,p)` to be
776
+ `l(q_{(1)}) l(q_{(2)}) \cdots l(q_{(k)})`.
777
+
778
+ EXAMPLES::
779
+
780
+ sage: DA = DescentAlgebra(QQ, 4)
781
+ sage: B = DA.B()
782
+ sage: I = DA.I()
783
+ sage: list(map(B, I.basis())) # indirect doctest
784
+ [B[1, 1, 1, 1],
785
+ -1/2*B[1, 1, 1, 1] + B[1, 1, 2],
786
+ -1/2*B[1, 1, 1, 1] + B[1, 2, 1],
787
+ 1/3*B[1, 1, 1, 1] - 1/2*B[1, 1, 2] - 1/2*B[1, 2, 1] + B[1, 3],
788
+ -1/2*B[1, 1, 1, 1] + B[2, 1, 1],
789
+ 1/4*B[1, 1, 1, 1] - 1/2*B[1, 1, 2] - 1/2*B[2, 1, 1] + B[2, 2],
790
+ 1/3*B[1, 1, 1, 1] - 1/2*B[1, 2, 1] - 1/2*B[2, 1, 1] + B[3, 1],
791
+ -1/4*B[1, 1, 1, 1] + 1/3*B[1, 1, 2] + 1/3*B[1, 2, 1]
792
+ - 1/2*B[1, 3] + 1/3*B[2, 1, 1] - 1/2*B[2, 2]
793
+ - 1/2*B[3, 1] + B[4]]
794
+ """
795
+ B = self.realization_of().B()
796
+
797
+ def coeff(p, q):
798
+ ret = QQ.one()
799
+ last = 0
800
+ for val in p:
801
+ count = 0
802
+ s = 0
803
+ while s != val:
804
+ s += q[last + count]
805
+ count += 1
806
+ ret /= count
807
+ last += count
808
+ if (len(q) - len(p)) % 2:
809
+ ret = -ret
810
+ return ret
811
+
812
+ return B.sum_of_terms([(q, coeff(p, q)) for q in p.finer()])
813
+
814
+ def idempotent(self, la):
815
+ """
816
+ Return the idempotent corresponding to the partition ``la``
817
+ of `n`.
818
+
819
+ EXAMPLES::
820
+
821
+ sage: I = DescentAlgebra(QQ, 4).I()
822
+ sage: E = I.idempotent([3,1]); E
823
+ 1/2*I[1, 3] + 1/2*I[3, 1]
824
+ sage: E*E == E
825
+ True
826
+ sage: E2 = I.idempotent([2,1,1]); E2
827
+ 1/6*I[1, 1, 2] + 1/6*I[1, 2, 1] + 1/6*I[2, 1, 1]
828
+ sage: E2*E2 == E2
829
+ True
830
+ sage: E*E2 == I.zero()
831
+ True
832
+ """
833
+ from sage.combinat.permutation import Permutations
834
+ k = len(la)
835
+ C = Compositions(self.realization_of()._n)
836
+ return self.sum_of_terms([(C(x), QQ((1, factorial(k))))
837
+ for x in Permutations(la)])
838
+
839
+ idempotent = I
840
+
841
+
842
+ class DescentAlgebraBases(Category_realization_of_parent):
843
+ r"""
844
+ The category of bases of a descent algebra.
845
+ """
846
+
847
+ def __init__(self, base):
848
+ r"""
849
+ Initialize the bases of a descent algebra.
850
+
851
+ INPUT:
852
+
853
+ - ``base`` -- a descent algebra
854
+
855
+ TESTS::
856
+
857
+ sage: from sage.combinat.descent_algebra import DescentAlgebraBases
858
+ sage: DA = DescentAlgebra(QQ, 4)
859
+ sage: bases = DescentAlgebraBases(DA)
860
+ sage: DA.B() in bases
861
+ True
862
+ """
863
+ Category_realization_of_parent.__init__(self, base)
864
+
865
+ def _repr_(self) -> str:
866
+ r"""
867
+ Return the representation of ``self``.
868
+
869
+ EXAMPLES::
870
+
871
+ sage: from sage.combinat.descent_algebra import DescentAlgebraBases
872
+ sage: DA = DescentAlgebra(QQ, 4)
873
+ sage: DescentAlgebraBases(DA)
874
+ Category of bases of Descent algebra of 4 over Rational Field
875
+ """
876
+ return "Category of bases of {}".format(self.base())
877
+
878
+ def super_categories(self) -> list:
879
+ r"""
880
+ The super categories of ``self``.
881
+
882
+ EXAMPLES::
883
+
884
+ sage: from sage.combinat.descent_algebra import DescentAlgebraBases
885
+ sage: DA = DescentAlgebra(QQ, 4)
886
+ sage: bases = DescentAlgebraBases(DA)
887
+ sage: bases.super_categories()
888
+ [Category of finite dimensional algebras with basis over Rational Field,
889
+ Category of realizations of Descent algebra of 4 over Rational Field]
890
+ """
891
+ return [self.base()._category, Realizations(self.base())]
892
+
893
+ class ParentMethods:
894
+ def _repr_(self) -> str:
895
+ """
896
+ Text representation of this basis of a descent algebra.
897
+
898
+ EXAMPLES::
899
+
900
+ sage: DA = DescentAlgebra(QQ, 4)
901
+ sage: DA.B()
902
+ Descent algebra of 4 over Rational Field in the subset basis
903
+ sage: DA.D()
904
+ Descent algebra of 4 over Rational Field in the standard basis
905
+ sage: DA.I()
906
+ Descent algebra of 4 over Rational Field in the idempotent basis
907
+ """
908
+ return "{} in the {} basis".format(self.realization_of(), self._basis_name)
909
+
910
+ def __getitem__(self, p):
911
+ """
912
+ Return the basis element indexed by ``p``.
913
+
914
+ INPUT:
915
+
916
+ - ``p`` -- a composition
917
+
918
+ EXAMPLES::
919
+
920
+ sage: B = DescentAlgebra(QQ, 4).B()
921
+ sage: B[Composition([4])]
922
+ B[4]
923
+ sage: B[1,2,1]
924
+ B[1, 2, 1]
925
+ sage: B[4]
926
+ B[4]
927
+ sage: B[[3,1]]
928
+ B[3, 1]
929
+ """
930
+ C = Compositions(self.realization_of()._n)
931
+ if p in C:
932
+ return self.monomial(C(p)) # Make sure it's a composition
933
+ if not p:
934
+ return self.one()
935
+
936
+ if not isinstance(p, tuple):
937
+ p = [p]
938
+ return self.monomial(C(p))
939
+
940
+ @lazy_attribute
941
+ def to_symmetric_group_algebra(self):
942
+ """
943
+ Morphism from ``self`` to the symmetric group algebra.
944
+
945
+ EXAMPLES::
946
+
947
+ sage: # needs sage.graphs
948
+ sage: D = DescentAlgebra(QQ, 4).D()
949
+ sage: D.to_symmetric_group_algebra(D[1,3])
950
+ [2, 1, 4, 3] + [3, 1, 4, 2] + [3, 2, 4, 1] + [4, 1, 3, 2] + [4, 2, 3, 1]
951
+ sage: B = DescentAlgebra(QQ, 4).B()
952
+ sage: B.to_symmetric_group_algebra(B[1,2,1])
953
+ [1, 2, 3, 4] + [1, 2, 4, 3] + [1, 3, 4, 2] + [2, 1, 3, 4]
954
+ + [2, 1, 4, 3] + [2, 3, 4, 1] + [3, 1, 2, 4] + [3, 1, 4, 2]
955
+ + [3, 2, 4, 1] + [4, 1, 2, 3] + [4, 1, 3, 2] + [4, 2, 3, 1]
956
+ """
957
+ SGA = SymmetricGroupAlgebra(self.base_ring(), self.realization_of()._n)
958
+ return self.module_morphism(self.to_symmetric_group_algebra_on_basis,
959
+ codomain=SGA)
960
+
961
+ def to_symmetric_group_algebra_on_basis(self, S):
962
+ """
963
+ Return the basis element index by ``S`` as a linear combination
964
+ of basis elements in the symmetric group algebra.
965
+
966
+ EXAMPLES::
967
+
968
+ sage: # needs sage.graphs
969
+ sage: B = DescentAlgebra(QQ, 3).B()
970
+ sage: [B.to_symmetric_group_algebra_on_basis(c)
971
+ ....: for c in Compositions(3)]
972
+ [[1, 2, 3] + [1, 3, 2] + [2, 1, 3]
973
+ + [2, 3, 1] + [3, 1, 2] + [3, 2, 1],
974
+ [1, 2, 3] + [2, 1, 3] + [3, 1, 2],
975
+ [1, 2, 3] + [1, 3, 2] + [2, 3, 1],
976
+ [1, 2, 3]]
977
+ sage: I = DescentAlgebra(QQ, 3).I()
978
+ sage: [I.to_symmetric_group_algebra_on_basis(c)
979
+ ....: for c in Compositions(3)]
980
+ [[1, 2, 3] + [1, 3, 2] + [2, 1, 3] + [2, 3, 1]
981
+ + [3, 1, 2] + [3, 2, 1],
982
+ 1/2*[1, 2, 3] - 1/2*[1, 3, 2] + 1/2*[2, 1, 3]
983
+ - 1/2*[2, 3, 1] + 1/2*[3, 1, 2] - 1/2*[3, 2, 1],
984
+ 1/2*[1, 2, 3] + 1/2*[1, 3, 2] - 1/2*[2, 1, 3]
985
+ + 1/2*[2, 3, 1] - 1/2*[3, 1, 2] - 1/2*[3, 2, 1],
986
+ 1/3*[1, 2, 3] - 1/6*[1, 3, 2] - 1/6*[2, 1, 3]
987
+ - 1/6*[2, 3, 1] - 1/6*[3, 1, 2] + 1/3*[3, 2, 1]]
988
+ """
989
+ D = self.realization_of().D()
990
+ return D.to_symmetric_group_algebra(D(self[S]))
991
+
992
+ class ElementMethods:
993
+ def to_symmetric_group_algebra(self):
994
+ """
995
+ Return ``self`` in the symmetric group algebra.
996
+
997
+ EXAMPLES::
998
+
999
+ sage: # needs sage.graphs
1000
+ sage: B = DescentAlgebra(QQ, 4).B()
1001
+ sage: B[1,3].to_symmetric_group_algebra()
1002
+ [1, 2, 3, 4] + [2, 1, 3, 4] + [3, 1, 2, 4] + [4, 1, 2, 3]
1003
+ sage: I = DescentAlgebra(QQ, 4).I()
1004
+ sage: elt = I(B[1,3])
1005
+ sage: elt.to_symmetric_group_algebra()
1006
+ [1, 2, 3, 4] + [2, 1, 3, 4] + [3, 1, 2, 4] + [4, 1, 2, 3]
1007
+ """
1008
+ return self.parent().to_symmetric_group_algebra(self)