passagemath-combinat 10.6.42__cp314-cp314t-win_amd64.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 (401) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/DELVEWHEEL +2 -0
  3. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  4. passagemath_combinat-10.6.42.dist-info/RECORD +401 -0
  5. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  6. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  7. passagemath_combinat.libs/libgmp-10-3a5f019e2510aeaad918cab2b57a689d.dll +0 -0
  8. passagemath_combinat.libs/libsymmetrica-3-7dcf900932804d0df5fd0919b4668720.dll +0 -0
  9. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  10. sage/algebras/all.py +24 -0
  11. sage/algebras/all__sagemath_combinat.py +35 -0
  12. sage/algebras/askey_wilson.py +935 -0
  13. sage/algebras/associated_graded.py +345 -0
  14. sage/algebras/cellular_basis.py +350 -0
  15. sage/algebras/cluster_algebra.py +2766 -0
  16. sage/algebras/down_up_algebra.py +860 -0
  17. sage/algebras/free_algebra.py +1698 -0
  18. sage/algebras/free_algebra_element.py +345 -0
  19. sage/algebras/free_algebra_quotient.py +405 -0
  20. sage/algebras/free_algebra_quotient_element.py +295 -0
  21. sage/algebras/free_zinbiel_algebra.py +885 -0
  22. sage/algebras/hall_algebra.py +783 -0
  23. sage/algebras/hecke_algebras/all.py +4 -0
  24. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  25. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  28. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  29. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  30. sage/algebras/jordan_algebra.py +1773 -0
  31. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  32. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  33. sage/algebras/lie_conformal_algebras/all.py +18 -0
  34. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  35. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  36. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  37. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  38. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  39. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  40. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  41. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  45. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  46. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  47. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  48. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  49. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  50. sage/algebras/nil_coxeter_algebra.py +191 -0
  51. sage/algebras/q_commuting_polynomials.py +673 -0
  52. sage/algebras/q_system.py +608 -0
  53. sage/algebras/quantum_clifford.py +959 -0
  54. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  55. sage/algebras/quantum_groups/all.py +9 -0
  56. sage/algebras/quantum_groups/fock_space.py +2219 -0
  57. sage/algebras/quantum_groups/q_numbers.py +207 -0
  58. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  59. sage/algebras/quantum_groups/representations.py +591 -0
  60. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  61. sage/algebras/quantum_oscillator.py +623 -0
  62. sage/algebras/quaternion_algebra.py +20 -0
  63. sage/algebras/quaternion_algebra_element.py +55 -0
  64. sage/algebras/rational_cherednik_algebra.py +525 -0
  65. sage/algebras/schur_algebra.py +670 -0
  66. sage/algebras/shuffle_algebra.py +1011 -0
  67. sage/algebras/splitting_algebra.py +779 -0
  68. sage/algebras/tensor_algebra.py +709 -0
  69. sage/algebras/yangian.py +1082 -0
  70. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  71. sage/all__sagemath_combinat.py +44 -0
  72. sage/combinat/SJT.py +255 -0
  73. sage/combinat/affine_permutation.py +2405 -0
  74. sage/combinat/algebraic_combinatorics.py +55 -0
  75. sage/combinat/all.py +53 -0
  76. sage/combinat/all__sagemath_combinat.py +195 -0
  77. sage/combinat/alternating_sign_matrix.py +2063 -0
  78. sage/combinat/baxter_permutations.py +346 -0
  79. sage/combinat/bijectionist.py +3220 -0
  80. sage/combinat/binary_recurrence_sequences.py +1180 -0
  81. sage/combinat/blob_algebra.py +685 -0
  82. sage/combinat/catalog_partitions.py +27 -0
  83. sage/combinat/chas/all.py +23 -0
  84. sage/combinat/chas/fsym.py +1180 -0
  85. sage/combinat/chas/wqsym.py +2601 -0
  86. sage/combinat/cluster_complex.py +326 -0
  87. sage/combinat/colored_permutations.py +2039 -0
  88. sage/combinat/colored_permutations_representations.py +964 -0
  89. sage/combinat/composition_signed.py +142 -0
  90. sage/combinat/composition_tableau.py +855 -0
  91. sage/combinat/constellation.py +1729 -0
  92. sage/combinat/core.py +751 -0
  93. sage/combinat/counting.py +12 -0
  94. sage/combinat/crystals/affine.py +742 -0
  95. sage/combinat/crystals/affine_factorization.py +518 -0
  96. sage/combinat/crystals/affinization.py +331 -0
  97. sage/combinat/crystals/alcove_path.py +2013 -0
  98. sage/combinat/crystals/all.py +22 -0
  99. sage/combinat/crystals/bkk_crystals.py +141 -0
  100. sage/combinat/crystals/catalog.py +115 -0
  101. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  102. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  103. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  104. sage/combinat/crystals/crystals.py +257 -0
  105. sage/combinat/crystals/direct_sum.py +260 -0
  106. sage/combinat/crystals/elementary_crystals.py +1251 -0
  107. sage/combinat/crystals/fast_crystals.py +441 -0
  108. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  109. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  110. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  111. sage/combinat/crystals/induced_structure.py +695 -0
  112. sage/combinat/crystals/infinity_crystals.py +730 -0
  113. sage/combinat/crystals/kac_modules.py +863 -0
  114. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  115. sage/combinat/crystals/kyoto_path_model.py +497 -0
  116. sage/combinat/crystals/letters.cp314t-win_amd64.pyd +0 -0
  117. sage/combinat/crystals/letters.pxd +79 -0
  118. sage/combinat/crystals/letters.pyx +3056 -0
  119. sage/combinat/crystals/littelmann_path.py +1518 -0
  120. sage/combinat/crystals/monomial_crystals.py +1262 -0
  121. sage/combinat/crystals/multisegments.py +462 -0
  122. sage/combinat/crystals/mv_polytopes.py +467 -0
  123. sage/combinat/crystals/pbw_crystal.py +511 -0
  124. sage/combinat/crystals/pbw_datum.cp314t-win_amd64.pyd +0 -0
  125. sage/combinat/crystals/pbw_datum.pxd +4 -0
  126. sage/combinat/crystals/pbw_datum.pyx +487 -0
  127. sage/combinat/crystals/polyhedral_realization.py +372 -0
  128. sage/combinat/crystals/spins.cp314t-win_amd64.pyd +0 -0
  129. sage/combinat/crystals/spins.pxd +21 -0
  130. sage/combinat/crystals/spins.pyx +756 -0
  131. sage/combinat/crystals/star_crystal.py +290 -0
  132. sage/combinat/crystals/subcrystal.py +464 -0
  133. sage/combinat/crystals/tensor_product.py +1177 -0
  134. sage/combinat/crystals/tensor_product_element.cp314t-win_amd64.pyd +0 -0
  135. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  136. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  137. sage/combinat/crystals/virtual_crystal.py +420 -0
  138. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  139. sage/combinat/debruijn_sequence.cp314t-win_amd64.pyd +0 -0
  140. sage/combinat/debruijn_sequence.pyx +355 -0
  141. sage/combinat/decorated_permutation.py +270 -0
  142. sage/combinat/degree_sequences.cp314t-win_amd64.pyd +0 -0
  143. sage/combinat/degree_sequences.pyx +588 -0
  144. sage/combinat/derangements.py +527 -0
  145. sage/combinat/descent_algebra.py +1008 -0
  146. sage/combinat/diagram.py +1551 -0
  147. sage/combinat/diagram_algebras.py +5886 -0
  148. sage/combinat/dyck_word.py +4349 -0
  149. sage/combinat/e_one_star.py +1623 -0
  150. sage/combinat/enumerated_sets.py +123 -0
  151. sage/combinat/expnums.cp314t-win_amd64.pyd +0 -0
  152. sage/combinat/expnums.pyx +148 -0
  153. sage/combinat/fast_vector_partitions.cp314t-win_amd64.pyd +0 -0
  154. sage/combinat/fast_vector_partitions.pyx +346 -0
  155. sage/combinat/fqsym.py +1977 -0
  156. sage/combinat/free_dendriform_algebra.py +954 -0
  157. sage/combinat/free_prelie_algebra.py +1141 -0
  158. sage/combinat/fully_commutative_elements.py +1077 -0
  159. sage/combinat/fully_packed_loop.py +1523 -0
  160. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  161. sage/combinat/gray_codes.py +311 -0
  162. sage/combinat/grossman_larson_algebras.py +667 -0
  163. sage/combinat/growth.py +4352 -0
  164. sage/combinat/hall_polynomial.py +188 -0
  165. sage/combinat/hillman_grassl.py +866 -0
  166. sage/combinat/integer_matrices.py +329 -0
  167. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  168. sage/combinat/k_tableau.py +4564 -0
  169. sage/combinat/kazhdan_lusztig.py +215 -0
  170. sage/combinat/key_polynomial.py +885 -0
  171. sage/combinat/knutson_tao_puzzles.py +2286 -0
  172. sage/combinat/lr_tableau.py +311 -0
  173. sage/combinat/matrices/all.py +24 -0
  174. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  175. sage/combinat/matrices/latin.py +2912 -0
  176. sage/combinat/misc.py +401 -0
  177. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  178. sage/combinat/ncsf_qsym/all.py +21 -0
  179. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  180. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  181. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  182. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  183. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  184. sage/combinat/ncsym/all.py +21 -0
  185. sage/combinat/ncsym/bases.py +855 -0
  186. sage/combinat/ncsym/dual.py +593 -0
  187. sage/combinat/ncsym/ncsym.py +2076 -0
  188. sage/combinat/necklace.py +551 -0
  189. sage/combinat/non_decreasing_parking_function.py +634 -0
  190. sage/combinat/nu_dyck_word.py +1474 -0
  191. sage/combinat/output.py +861 -0
  192. sage/combinat/parallelogram_polyomino.py +4326 -0
  193. sage/combinat/parking_functions.py +1602 -0
  194. sage/combinat/partition_algebra.py +1998 -0
  195. sage/combinat/partition_kleshchev.py +1982 -0
  196. sage/combinat/partition_shifting_algebras.py +584 -0
  197. sage/combinat/partition_tuple.py +3114 -0
  198. sage/combinat/path_tableaux/all.py +13 -0
  199. sage/combinat/path_tableaux/catalog.py +29 -0
  200. sage/combinat/path_tableaux/dyck_path.py +380 -0
  201. sage/combinat/path_tableaux/frieze.py +476 -0
  202. sage/combinat/path_tableaux/path_tableau.py +728 -0
  203. sage/combinat/path_tableaux/semistandard.py +510 -0
  204. sage/combinat/perfect_matching.py +779 -0
  205. sage/combinat/plane_partition.py +3300 -0
  206. sage/combinat/q_bernoulli.cp314t-win_amd64.pyd +0 -0
  207. sage/combinat/q_bernoulli.pyx +128 -0
  208. sage/combinat/quickref.py +81 -0
  209. sage/combinat/recognizable_series.py +2051 -0
  210. sage/combinat/regular_sequence.py +4316 -0
  211. sage/combinat/regular_sequence_bounded.py +543 -0
  212. sage/combinat/restricted_growth.py +81 -0
  213. sage/combinat/ribbon.py +20 -0
  214. sage/combinat/ribbon_shaped_tableau.py +489 -0
  215. sage/combinat/ribbon_tableau.py +1180 -0
  216. sage/combinat/rigged_configurations/all.py +46 -0
  217. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  218. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  219. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  222. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  223. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  224. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  225. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  226. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  227. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  228. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  229. sage/combinat/rigged_configurations/bijection.py +143 -0
  230. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  231. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  232. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  233. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  234. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  235. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  236. sage/combinat/rigged_configurations/rigged_partition.cp314t-win_amd64.pyd +0 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  238. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  240. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  241. sage/combinat/rsk.py +3438 -0
  242. sage/combinat/schubert_polynomial.py +508 -0
  243. sage/combinat/set_partition.py +3318 -0
  244. sage/combinat/set_partition_iterator.cp314t-win_amd64.pyd +0 -0
  245. sage/combinat/set_partition_iterator.pyx +136 -0
  246. sage/combinat/set_partition_ordered.py +1590 -0
  247. sage/combinat/sf/abreu_nigro.py +346 -0
  248. sage/combinat/sf/all.py +52 -0
  249. sage/combinat/sf/character.py +576 -0
  250. sage/combinat/sf/classical.py +319 -0
  251. sage/combinat/sf/dual.py +996 -0
  252. sage/combinat/sf/elementary.py +549 -0
  253. sage/combinat/sf/hall_littlewood.py +1028 -0
  254. sage/combinat/sf/hecke.py +336 -0
  255. sage/combinat/sf/homogeneous.py +464 -0
  256. sage/combinat/sf/jack.py +1428 -0
  257. sage/combinat/sf/k_dual.py +1458 -0
  258. sage/combinat/sf/kfpoly.py +447 -0
  259. sage/combinat/sf/llt.py +789 -0
  260. sage/combinat/sf/macdonald.py +2019 -0
  261. sage/combinat/sf/monomial.py +525 -0
  262. sage/combinat/sf/multiplicative.py +113 -0
  263. sage/combinat/sf/new_kschur.py +1786 -0
  264. sage/combinat/sf/ns_macdonald.py +964 -0
  265. sage/combinat/sf/orthogonal.py +246 -0
  266. sage/combinat/sf/orthotriang.py +355 -0
  267. sage/combinat/sf/powersum.py +963 -0
  268. sage/combinat/sf/schur.py +880 -0
  269. sage/combinat/sf/sf.py +1653 -0
  270. sage/combinat/sf/sfa.py +7053 -0
  271. sage/combinat/sf/symplectic.py +253 -0
  272. sage/combinat/sf/witt.py +721 -0
  273. sage/combinat/shifted_primed_tableau.py +2735 -0
  274. sage/combinat/shuffle.py +830 -0
  275. sage/combinat/sidon_sets.py +146 -0
  276. sage/combinat/similarity_class_type.py +1721 -0
  277. sage/combinat/sine_gordon.py +618 -0
  278. sage/combinat/six_vertex_model.py +784 -0
  279. sage/combinat/skew_partition.py +2053 -0
  280. sage/combinat/skew_tableau.py +2989 -0
  281. sage/combinat/sloane_functions.py +8935 -0
  282. sage/combinat/specht_module.py +1403 -0
  283. sage/combinat/species/all.py +48 -0
  284. sage/combinat/species/characteristic_species.py +321 -0
  285. sage/combinat/species/composition_species.py +273 -0
  286. sage/combinat/species/cycle_species.py +284 -0
  287. sage/combinat/species/empty_species.py +155 -0
  288. sage/combinat/species/functorial_composition_species.py +148 -0
  289. sage/combinat/species/generating_series.py +673 -0
  290. sage/combinat/species/library.py +148 -0
  291. sage/combinat/species/linear_order_species.py +169 -0
  292. sage/combinat/species/misc.py +83 -0
  293. sage/combinat/species/partition_species.py +290 -0
  294. sage/combinat/species/permutation_species.py +268 -0
  295. sage/combinat/species/product_species.py +423 -0
  296. sage/combinat/species/recursive_species.py +476 -0
  297. sage/combinat/species/set_species.py +192 -0
  298. sage/combinat/species/species.py +820 -0
  299. sage/combinat/species/structure.py +539 -0
  300. sage/combinat/species/subset_species.py +243 -0
  301. sage/combinat/species/sum_species.py +225 -0
  302. sage/combinat/subword.py +564 -0
  303. sage/combinat/subword_complex.py +2122 -0
  304. sage/combinat/subword_complex_c.cp314t-win_amd64.pyd +0 -0
  305. sage/combinat/subword_complex_c.pyx +119 -0
  306. sage/combinat/super_tableau.py +821 -0
  307. sage/combinat/superpartition.py +1154 -0
  308. sage/combinat/symmetric_group_algebra.py +3774 -0
  309. sage/combinat/symmetric_group_representations.py +1830 -0
  310. sage/combinat/t_sequences.py +877 -0
  311. sage/combinat/tableau.py +9506 -0
  312. sage/combinat/tableau_residues.py +860 -0
  313. sage/combinat/tableau_tuple.py +5353 -0
  314. sage/combinat/tiling.py +2432 -0
  315. sage/combinat/triangles_FHM.py +777 -0
  316. sage/combinat/tutorial.py +1857 -0
  317. sage/combinat/vector_partition.py +337 -0
  318. sage/combinat/words/abstract_word.py +1722 -0
  319. sage/combinat/words/all.py +59 -0
  320. sage/combinat/words/alphabet.py +268 -0
  321. sage/combinat/words/finite_word.py +7201 -0
  322. sage/combinat/words/infinite_word.py +113 -0
  323. sage/combinat/words/lyndon_word.py +652 -0
  324. sage/combinat/words/morphic.py +351 -0
  325. sage/combinat/words/morphism.py +3878 -0
  326. sage/combinat/words/paths.py +2932 -0
  327. sage/combinat/words/shuffle_product.py +278 -0
  328. sage/combinat/words/suffix_trees.py +1873 -0
  329. sage/combinat/words/word.py +769 -0
  330. sage/combinat/words/word_char.cp314t-win_amd64.pyd +0 -0
  331. sage/combinat/words/word_char.pyx +847 -0
  332. sage/combinat/words/word_datatypes.cp314t-win_amd64.pyd +0 -0
  333. sage/combinat/words/word_datatypes.pxd +4 -0
  334. sage/combinat/words/word_datatypes.pyx +1067 -0
  335. sage/combinat/words/word_generators.py +2026 -0
  336. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  337. sage/combinat/words/word_options.py +99 -0
  338. sage/combinat/words/words.py +2396 -0
  339. sage/data_structures/all__sagemath_combinat.py +1 -0
  340. sage/databases/all__sagemath_combinat.py +13 -0
  341. sage/databases/findstat.py +4897 -0
  342. sage/databases/oeis.py +2058 -0
  343. sage/databases/sloane.py +393 -0
  344. sage/dynamics/all__sagemath_combinat.py +14 -0
  345. sage/dynamics/cellular_automata/all.py +7 -0
  346. sage/dynamics/cellular_automata/catalog.py +34 -0
  347. sage/dynamics/cellular_automata/elementary.py +612 -0
  348. sage/dynamics/cellular_automata/glca.py +477 -0
  349. sage/dynamics/cellular_automata/solitons.py +1463 -0
  350. sage/dynamics/finite_dynamical_system.py +1249 -0
  351. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  352. sage/games/all.py +7 -0
  353. sage/games/hexad.py +704 -0
  354. sage/games/quantumino.py +591 -0
  355. sage/games/sudoku.py +889 -0
  356. sage/games/sudoku_backtrack.cp314t-win_amd64.pyd +0 -0
  357. sage/games/sudoku_backtrack.pyx +189 -0
  358. sage/groups/all__sagemath_combinat.py +1 -0
  359. sage/groups/indexed_free_group.py +489 -0
  360. sage/libs/all__sagemath_combinat.py +6 -0
  361. sage/libs/lrcalc/__init__.py +1 -0
  362. sage/libs/lrcalc/lrcalc.py +525 -0
  363. sage/libs/symmetrica/__init__.py +7 -0
  364. sage/libs/symmetrica/all.py +101 -0
  365. sage/libs/symmetrica/kostka.pxi +168 -0
  366. sage/libs/symmetrica/part.pxi +193 -0
  367. sage/libs/symmetrica/plet.pxi +42 -0
  368. sage/libs/symmetrica/sab.pxi +196 -0
  369. sage/libs/symmetrica/sb.pxi +332 -0
  370. sage/libs/symmetrica/sc.pxi +192 -0
  371. sage/libs/symmetrica/schur.pxi +956 -0
  372. sage/libs/symmetrica/symmetrica.cp314t-win_amd64.pyd +0 -0
  373. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  374. sage/libs/symmetrica/symmetrica.pyx +39 -0
  375. sage/monoids/all.py +13 -0
  376. sage/monoids/automatic_semigroup.py +1054 -0
  377. sage/monoids/free_abelian_monoid.py +315 -0
  378. sage/monoids/free_abelian_monoid_element.cp314t-win_amd64.pyd +0 -0
  379. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  380. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  381. sage/monoids/free_monoid.py +335 -0
  382. sage/monoids/free_monoid_element.py +431 -0
  383. sage/monoids/hecke_monoid.py +65 -0
  384. sage/monoids/string_monoid.py +817 -0
  385. sage/monoids/string_monoid_element.py +547 -0
  386. sage/monoids/string_ops.py +143 -0
  387. sage/monoids/trace_monoid.py +972 -0
  388. sage/rings/all__sagemath_combinat.py +2 -0
  389. sage/sat/all.py +4 -0
  390. sage/sat/boolean_polynomials.py +405 -0
  391. sage/sat/converters/__init__.py +6 -0
  392. sage/sat/converters/anf2cnf.py +14 -0
  393. sage/sat/converters/polybori.py +611 -0
  394. sage/sat/solvers/__init__.py +5 -0
  395. sage/sat/solvers/cryptominisat.py +287 -0
  396. sage/sat/solvers/dimacs.py +783 -0
  397. sage/sat/solvers/picosat.py +228 -0
  398. sage/sat/solvers/sat_lp.py +156 -0
  399. sage/sat/solvers/satsolver.cp314t-win_amd64.pyd +0 -0
  400. sage/sat/solvers/satsolver.pxd +3 -0
  401. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,1180 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+ r"""
4
+ Poirier-Reutenauer Hopf algebra of standard tableaux
5
+
6
+ AUTHORS:
7
+
8
+ - Franco Saliola (2012): initial implementation
9
+ - Travis Scrimshaw (2018-04-11): added missing doctests and reorganization
10
+ """
11
+
12
+ # ****************************************************************************
13
+ # Copyright (C) 2012 Franco Saliola <saliola at gmail.com>
14
+ # 2018 Travis Scrimshaw <tcscrims at gmail.com>
15
+ #
16
+ # Distributed under the terms of the GNU General Public License (GPL)
17
+ # as published by the Free Software Foundation; either version 2 of
18
+ # the License, or (at your option) any later version.
19
+ # https://www.gnu.org/licenses/
20
+ # ****************************************************************************
21
+
22
+ from sage.misc.bindable_class import BindableClass
23
+ from sage.misc.cachefunc import cached_method
24
+ from sage.structure.parent import Parent
25
+ from sage.structure.unique_representation import UniqueRepresentation
26
+
27
+ from sage.categories.realizations import Category_realization_of_parent
28
+ from sage.categories.hopf_algebras import HopfAlgebras
29
+
30
+ from sage.combinat.free_module import CombinatorialFreeModule
31
+ from sage.combinat.tableau import Tableau, StandardTableaux
32
+ from sage.combinat.sf.sf import SymmetricFunctions
33
+ from sage.combinat.composition import Composition
34
+
35
+
36
+ class FSymBasis_abstract(CombinatorialFreeModule, BindableClass):
37
+ r"""
38
+ Abstract base class for graded bases of `FSym` and of `FSym^*`
39
+ indexed by standard tableaux.
40
+
41
+ This must define the following attributes:
42
+
43
+ - ``_prefix`` -- the basis prefix
44
+ """
45
+ def __init__(self, alg, graded=True):
46
+ r"""
47
+ Initialize ``self``.
48
+
49
+ EXAMPLES::
50
+
51
+ sage: G = algebras.FSym(QQ).G()
52
+ sage: TestSuite(G).run() # long time
53
+
54
+ Checks for the antipode::
55
+
56
+ sage: FSym = algebras.FSym(QQ)
57
+ sage: G = FSym.G()
58
+ sage: for b in G.basis(degree=3):
59
+ ....: print("%s : %s" % (b, b.antipode()))
60
+ G[123] : -G[1|2|3]
61
+ G[13|2] : -G[13|2]
62
+ G[12|3] : -G[12|3]
63
+ G[1|2|3] : -G[123]
64
+
65
+ sage: F = FSym.dual().F()
66
+ sage: for b in F.basis(degree=3):
67
+ ....: print("%s : %s" % (b, b.antipode()))
68
+ F[123] : -F[1|2|3]
69
+ F[13|2] : -F[13|2]
70
+ F[12|3] : -F[12|3]
71
+ F[1|2|3] : -F[123]
72
+ """
73
+ CombinatorialFreeModule.__init__(self, alg.base_ring(),
74
+ StandardTableaux(),
75
+ category=FSymBases(alg),
76
+ bracket='', prefix=self._prefix)
77
+
78
+ def _coerce_map_from_(self, R):
79
+ r"""
80
+ Return ``True`` if there is a coercion from ``R`` into ``self``
81
+ and ``False`` otherwise.
82
+
83
+ The things that coerce into ``self`` are
84
+
85
+ - elements of the algebra `FSym` over a base ring with
86
+ a coercion map into ``self.base_ring()``
87
+
88
+ EXAMPLES::
89
+
90
+ sage: G = algebras.FSym(GF(7)).G(); G
91
+ Hopf algebra of standard tableaux over the Finite Field of size 7
92
+ in the Fundamental basis
93
+
94
+ Elements of `FSym` canonically coerce in::
95
+
96
+ sage: x, y = G([[1]]), G([[1,3],[2]])
97
+ sage: G.coerce(x + y) == x + y
98
+ True
99
+
100
+ Elements of `FSym` over `\ZZ` coerce in,
101
+ since `\ZZ` coerces to `\GF{7}`::
102
+
103
+ sage: H = algebras.FSym(ZZ).G()
104
+ sage: Hx, Hy = H([[1]]), H([[1,3],[2]])
105
+ sage: z = G.coerce(Hx+Hy); z
106
+ G[1] + G[13|2]
107
+ sage: z.parent() is G
108
+ True
109
+
110
+ However, `\GF{7}` does not coerce to `\ZZ`, so the
111
+ elements of `FSym` over `\GF{7}` do not coerce
112
+ to the same algebra over `\ZZ`::
113
+
114
+ sage: H.coerce(y)
115
+ Traceback (most recent call last):
116
+ ...
117
+ TypeError: no canonical coercion from Hopf algebra of standard tableaux
118
+ over the Finite Field of size 7 in the Fundamental basis
119
+ to Hopf algebra of standard tableaux over the Integer Ring in the Fundamental basis
120
+
121
+ TESTS::
122
+
123
+ sage: G = algebras.FSym(ZZ).G()
124
+ sage: H = algebras.FSym(QQ).G()
125
+ sage: G.has_coerce_map_from(H)
126
+ False
127
+ sage: H.has_coerce_map_from(G)
128
+ True
129
+ sage: G.has_coerce_map_from(QQ)
130
+ False
131
+ sage: H.has_coerce_map_from(QQ)
132
+ True
133
+ sage: G.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z'))
134
+ False
135
+ sage: G = algebras.FSym(QQ).G()
136
+ sage: TG = G.dual_basis()
137
+ sage: TG.coerce_map_from(G) is None
138
+ True
139
+ sage: G.coerce_map_from(TG) is None
140
+ True
141
+ """
142
+ # free symmetric functions in the same variables
143
+ # over any base that coerces in:
144
+ if isinstance(R, FSymBasis_abstract):
145
+ FSym = self.realization_of()
146
+ if R.realization_of() == FSym:
147
+ return True
148
+ if (isinstance(R.realization_of(), FreeSymmetricFunctions) !=
149
+ isinstance(FSym, FreeSymmetricFunctions)):
150
+ # If they are dual bases, then no coercion
151
+ return False
152
+ if not self.base_ring().has_coerce_map_from(R.base_ring()):
153
+ return False
154
+ if self._realization_name() == R._realization_name():
155
+ # The same basis
156
+
157
+ def coerce_base_ring(self, x):
158
+ return self._from_dict(x.monomial_coefficients())
159
+ return coerce_base_ring
160
+ # Otherwise lift that basis up and then coerce over
161
+ target = getattr(FSym, R._realization_name())()
162
+ return self._coerce_map_via([target], R)
163
+ return super()._coerce_map_from_(R)
164
+
165
+ def some_elements(self):
166
+ r"""
167
+ Return some elements of ``self``.
168
+
169
+ EXAMPLES::
170
+
171
+ sage: G = algebras.FSym(QQ).G()
172
+ sage: G.some_elements()
173
+ [G[], G[1], G[12], G[1] + G[1|2], G[] + 1/2*G[1]]
174
+ """
175
+ u = self.one()
176
+ o = self([[1]])
177
+ s = self.base_ring().an_element()
178
+ return [u, o, self([[1, 2]]), o + self([[1], [2]]), u + s * o]
179
+
180
+ def _repr_term(self, phi):
181
+ r"""
182
+ The string representation of a basis element.
183
+
184
+ EXAMPLES:
185
+
186
+ We use a compact notation for standard tableaux::
187
+
188
+ sage: FSym = algebras.FSym(QQ)
189
+ sage: G = FSym.G()
190
+ sage: G.zero()
191
+ 0
192
+ sage: G._repr_term(StandardTableau([[1],[2],[3],[4]]))
193
+ 'G[1|2|3|4]'
194
+ sage: G[[1,3,5],[2,4]]
195
+ G[135|24]
196
+ """
197
+ return "{}[{}]".format(self._prefix,
198
+ "|".join("".join(map(str, block))
199
+ for block in phi))
200
+
201
+
202
+ class FSymBases(Category_realization_of_parent):
203
+ r"""
204
+ The category of graded bases of `FSym` and `FSym^*` indexed
205
+ by standard tableaux.
206
+ """
207
+ def super_categories(self):
208
+ """
209
+ The super categories of ``self``.
210
+
211
+ EXAMPLES::
212
+
213
+ sage: from sage.combinat.chas.fsym import FSymBases
214
+ sage: FSym = algebras.FSym(ZZ)
215
+ sage: bases = FSymBases(FSym)
216
+ sage: bases.super_categories()
217
+ [Category of realizations of Hopf algebra of standard tableaux over the Integer Ring,
218
+ Join of Category of realizations of Hopf algebras over Integer Ring
219
+ and Category of graded algebras over Integer Ring
220
+ and Category of graded coalgebras over Integer Ring,
221
+ Category of graded connected Hopf algebras with basis over Integer Ring]
222
+ """
223
+ R = self.base().base_ring()
224
+ return [self.base().Realizations(),
225
+ HopfAlgebras(R).Graded().Realizations(),
226
+ HopfAlgebras(R).Graded().WithBasis().Graded().Connected()]
227
+
228
+ class ParentMethods:
229
+ def _repr_(self):
230
+ """
231
+ Text representation of this basis of `FSym`.
232
+
233
+ EXAMPLES::
234
+
235
+ sage: FSym = algebras.FSym(ZZ)
236
+ sage: FSym.G()
237
+ Hopf algebra of standard tableaux over the Integer Ring
238
+ in the Fundamental basis
239
+ """
240
+ return "{} in the {} basis".format(self.realization_of(), self._realization_name())
241
+
242
+ def __getitem__(self, key):
243
+ r"""
244
+ Override the ``__getitem__`` method to allow passing a standard
245
+ tableau in a nonstandard form (e.g., as a tuple of rows instead
246
+ of a list of rows; or as a single row for a single-rowed tableau).
247
+
248
+ EXAMPLES:
249
+
250
+ Construct the basis element indexed by a standard tableau by
251
+ passing data that defines the standard tableau::
252
+
253
+ sage: FSym = algebras.FSym(QQ)
254
+ sage: G = FSym.G()
255
+ sage: G[[1,3],[2]]
256
+ G[13|2]
257
+ sage: G[(1,3),(2,)]
258
+ G[13|2]
259
+ sage: G[[1,3],[2]].leading_support() in StandardTableaux()
260
+ True
261
+ sage: G[1,2,3]
262
+ G[123]
263
+ """
264
+ try:
265
+ return self.monomial(self._indices(list(key)))
266
+ except (TypeError, ValueError):
267
+ return self.monomial(self._indices([key]))
268
+
269
+ def basis(self, degree=None):
270
+ r"""
271
+ The basis elements (optionally: of the specified degree).
272
+
273
+ OUTPUT: family
274
+
275
+ EXAMPLES::
276
+
277
+ sage: FSym = algebras.FSym(QQ)
278
+ sage: TG = FSym.G()
279
+ sage: TG.basis()
280
+ Lazy family (Term map from Standard tableaux to Hopf algebra of standard tableaux
281
+ over the Rational Field in the Fundamental basis(i))_{i in Standard tableaux}
282
+ sage: TG.basis().keys()
283
+ Standard tableaux
284
+ sage: TG.basis(degree=3).keys()
285
+ Standard tableaux of size 3
286
+ sage: TG.basis(degree=3).list()
287
+ [G[123], G[13|2], G[12|3], G[1|2|3]]
288
+ """
289
+ from sage.sets.family import Family
290
+ if degree is None:
291
+ return Family(self._indices, self.monomial)
292
+ else:
293
+ return Family(StandardTableaux(degree), self.monomial)
294
+
295
+ @cached_method
296
+ def one_basis(self):
297
+ r"""
298
+ Return the basis index corresponding to `1`.
299
+
300
+ EXAMPLES::
301
+
302
+ sage: FSym = algebras.FSym(QQ)
303
+ sage: TG = FSym.G()
304
+ sage: TG.one_basis()
305
+ []
306
+ """
307
+ return self._indices([])
308
+
309
+ def duality_pairing(self, x, y):
310
+ r"""
311
+ The canonical pairing between `FSym` and `FSym^*`.
312
+
313
+ EXAMPLES::
314
+
315
+ sage: FSym = algebras.FSym(QQ)
316
+ sage: G = FSym.G()
317
+ sage: F = G.dual_basis()
318
+ sage: t1 = StandardTableau([[1,3,5],[2,4]])
319
+ sage: t2 = StandardTableau([[1,3],[2,5],[4]])
320
+ sage: G.duality_pairing(G[t1], F[t2])
321
+ 0
322
+ sage: G.duality_pairing(G[t1], F[t1])
323
+ 1
324
+ sage: G.duality_pairing(G[t2], F[t2])
325
+ 1
326
+ sage: F.duality_pairing(F[t2], G[t2])
327
+ 1
328
+
329
+ sage: z = G[[1,3,5],[2,4]]
330
+ sage: all(F.duality_pairing(F[p1] * F[p2], z) == c
331
+ ....: for ((p1, p2), c) in z.coproduct())
332
+ True
333
+
334
+ TESTS:
335
+
336
+ If ``x`` is zero, then the output still has the right
337
+ type::
338
+
339
+ sage: z = G.duality_pairing(G.zero(), F.zero()); z
340
+ 0
341
+ sage: parent(z)
342
+ Rational Field
343
+ """
344
+ y = self.dual_basis()(y)
345
+ return self.base_ring().sum(coeff * y[t] for (t, coeff) in x)
346
+
347
+ def duality_pairing_matrix(self, basis, degree):
348
+ r"""
349
+ The matrix of scalar products between elements of `FSym` and
350
+ elements of `FSym^*`.
351
+
352
+ INPUT:
353
+
354
+ - ``basis`` -- a basis of the dual Hopf algebra
355
+ - ``degree`` -- nonnegative integer
356
+
357
+ OUTPUT:
358
+
359
+ - the matrix of scalar products between the basis ``self`` and the
360
+ basis ``basis`` in the dual Hopf algebra of degree ``degree``
361
+
362
+ EXAMPLES::
363
+
364
+ sage: FSym = algebras.FSym(QQ)
365
+ sage: G = FSym.G()
366
+ sage: G.duality_pairing_matrix(G.dual_basis(), 3)
367
+ [1 0 0 0]
368
+ [0 1 0 0]
369
+ [0 0 1 0]
370
+ [0 0 0 1]
371
+ """
372
+ from sage.matrix.constructor import matrix
373
+ keys = self.basis(degree=degree).keys()
374
+ return matrix(self.base_ring(),
375
+ [[self.duality_pairing(self[s], basis[t])
376
+ for t in keys] for s in keys])
377
+
378
+ def degree_on_basis(self, t):
379
+ """
380
+ Return the degree of a standard tableau in the algebra
381
+ of free symmetric functions.
382
+
383
+ This is the size of the tableau ``t``.
384
+
385
+ EXAMPLES::
386
+
387
+ sage: G = algebras.FSym(QQ).G()
388
+ sage: t = StandardTableau([[1,3],[2]])
389
+ sage: G.degree_on_basis(t)
390
+ 3
391
+ sage: u = StandardTableau([[1,3,4,5],[2]])
392
+ sage: G.degree_on_basis(u)
393
+ 5
394
+ """
395
+ return t.size()
396
+
397
+ class ElementMethods:
398
+ def duality_pairing(self, other):
399
+ r"""
400
+ Compute the pairing between ``self`` and an element ``other``
401
+ of the dual.
402
+
403
+ EXAMPLES::
404
+
405
+ sage: FSym = algebras.FSym(QQ)
406
+ sage: G = FSym.G()
407
+ sage: F = G.dual_basis()
408
+ sage: elt = G[[1,3],[2]] - 3*G[[1,2],[3]]
409
+ sage: elt.duality_pairing(F[[1,3],[2]])
410
+ 1
411
+ sage: elt.duality_pairing(F[[1,2],[3]])
412
+ -3
413
+ sage: elt.duality_pairing(F[[1,2]])
414
+ 0
415
+ """
416
+ return self.parent().duality_pairing(self, other)
417
+
418
+
419
+ class FreeSymmetricFunctions(UniqueRepresentation, Parent):
420
+ r"""
421
+ The free symmetric functions.
422
+
423
+ The *free symmetric functions* is a combinatorial Hopf algebra
424
+ defined using tableaux and denoted `FSym`.
425
+
426
+ Consider the Hopf algebra `FQSym`
427
+ (:class:`~sage.combinat.fqsym.FreeQuasisymmetricFunctions`)
428
+ over a commutative ring `R`, and its bases `(F_w)` and `(G_w)`
429
+ (where `w`, in both cases, ranges over all permutations in all
430
+ symmetric groups `S_0, S_1, S_2, \ldots`).
431
+ For each word `w`, let `P(w)` be the P-tableau of `w` (that
432
+ is, the first of the two tableaux obtained by applying the
433
+ RSK algorithm to `w`; see :meth:`~sage.combinat.rsk.RSK`).
434
+ If `t` is a standard tableau of size `n`, then we define
435
+ `\mathcal{G}_t \in FQSym` to be the sum of the `F_w` with
436
+ `w` ranging over all permutations of `\{1, 2, \ldots, n\}`
437
+ satisfying `P(w) = t`. Equivalently, `\mathcal{G}_t` is the
438
+ sum of the `G_w` with `w` ranging over all permutations of
439
+ `\{1, 2, \ldots, n\}` satisfying `Q(w) = t` (where `Q(w)`
440
+ denotes the Q-tableau of `w`).
441
+
442
+ The `R`-linear span of the `\mathcal{G}_t` (for `t` ranging
443
+ over all standard tableaux) is a Hopf subalgebra of `FQSym`,
444
+ denoted by `FSym` and known as the *free symmetric functions*
445
+ or the *Poirier-Reutenauer Hopf algebra of tableaux*. It has been
446
+ introduced in [PoiReu95]_, where it was denoted by
447
+ `(\ZZ T, \ast, \delta)`. (What we call `\mathcal{G}_t`
448
+ has just been called `t` in [PoiReu95]_.)
449
+ The family `(\mathcal{G}_t)` (with `t` ranging over all standard
450
+ tableaux) is a basis of `FSym`, called the *Fundamental basis*.
451
+
452
+ EXAMPLES:
453
+
454
+ As explained above, `FSym` is constructed as a Hopf subalgebra of
455
+ `FQSym`::
456
+
457
+ sage: G = algebras.FSym(QQ).G()
458
+ sage: F = algebras.FQSym(QQ).F()
459
+ sage: G[[1,3],[2]]
460
+ G[13|2]
461
+ sage: G[[1,3],[2]].to_fqsym()
462
+ G[2, 1, 3] + G[3, 1, 2]
463
+ sage: F(G[[1,3],[2]])
464
+ F[2, 1, 3] + F[2, 3, 1]
465
+
466
+ This embedding is a Hopf algebra morphism::
467
+
468
+ sage: all(F(G[t1] * G[t2]) == F(G[t1]) * F(G[t2])
469
+ ....: for t1 in StandardTableaux(2)
470
+ ....: for t2 in StandardTableaux(3))
471
+ True
472
+
473
+ sage: FF = F.tensor_square()
474
+ sage: all(FF(G[t].coproduct()) == F(G[t]).coproduct()
475
+ ....: for t in StandardTableaux(4))
476
+ True
477
+
478
+ There is a Hopf algebra map from `FSym` onto the Hopf algebra
479
+ of symmetric functions, which maps a tableau `t` to the Schur
480
+ function indexed by the shape of `t`::
481
+
482
+ sage: TG = algebras.FSym(QQ).G()
483
+ sage: t = StandardTableau([[1,3],[2,4],[5]])
484
+ sage: TG[t]
485
+ G[13|24|5]
486
+ sage: TG[t].to_symmetric_function()
487
+ s[2, 2, 1]
488
+ """
489
+ def __init__(self, base_ring):
490
+ r"""
491
+ TESTS::
492
+
493
+ sage: FSym = algebras.FSym(QQ)
494
+ sage: TestSuite(FSym).run()
495
+ """
496
+ cat = HopfAlgebras(base_ring).Graded().Connected()
497
+ Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
498
+
499
+ _shorthands = ['G']
500
+
501
+ def a_realization(self):
502
+ r"""
503
+ Return a particular realization of ``self`` (the Fundamental basis).
504
+
505
+ EXAMPLES::
506
+
507
+ sage: FSym = algebras.FSym(QQ)
508
+ sage: FSym.a_realization()
509
+ Hopf algebra of standard tableaux over the Rational Field
510
+ in the Fundamental basis
511
+ """
512
+ return self.Fundamental()
513
+
514
+ def dual(self):
515
+ r"""
516
+ Return the dual Hopf algebra of `FSym`.
517
+
518
+ EXAMPLES::
519
+
520
+ sage: algebras.FSym(QQ).dual()
521
+ Dual Hopf algebra of standard tableaux over the Rational Field
522
+ """
523
+ return FreeSymmetricFunctions_Dual(self.base_ring())
524
+
525
+ def _repr_(self):
526
+ r"""
527
+ Return a string representation of ``self``.
528
+
529
+ EXAMPLES::
530
+
531
+ sage: algebras.FSym(QQ)
532
+ Hopf algebra of standard tableaux over the Rational Field
533
+ """
534
+ return "Hopf algebra of standard tableaux over the %s" % self.base_ring()
535
+
536
+ class Fundamental(FSymBasis_abstract):
537
+ r"""
538
+ The Hopf algebra of tableaux on the Fundamental basis.
539
+
540
+ EXAMPLES::
541
+
542
+ sage: FSym = algebras.FSym(QQ)
543
+ sage: TG = FSym.G()
544
+ sage: TG
545
+ Hopf algebra of standard tableaux over the Rational Field
546
+ in the Fundamental basis
547
+
548
+ Elements of the algebra look like::
549
+
550
+ sage: TG.an_element()
551
+ 2*G[] + 2*G[1] + 3*G[12]
552
+
553
+ TESTS::
554
+
555
+ sage: FSym = algebras.FSym(QQ)
556
+ sage: TG = FSym.G()
557
+ sage: TestSuite(TG).run()
558
+ """
559
+ _prefix = "G"
560
+
561
+ def _coerce_map_from_(self, R):
562
+ r"""
563
+ Return ``True`` if there is a coercion from ``R`` into ``self``
564
+ and ``False`` otherwise.
565
+
566
+ The things that coerce into ``self`` are
567
+
568
+ - elements of the algebra `FSym` over a base ring
569
+ with a coercion map into ``self.base_ring()``
570
+ - non-commutative symmetric functions over a base ring with
571
+ a coercion map into ``self.base_ring()``
572
+
573
+ EXAMPLES:
574
+
575
+ There exists a morphism from `NCSF` to `FSym`::
576
+
577
+ sage: G = algebras.FSym(QQ).G()
578
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
579
+ sage: G(R[3,1,2,2,1])
580
+ G[123|46|58|7|9] + G[123|46|58|79] + G[123|468|5|7|9]
581
+ + G[123|468|57|9] + G[123|468|579] + G[123|468|59|7]
582
+ + G[1236|478|5|9] + G[1236|478|59] + G[1236|48|5|7|9]
583
+ + G[1236|48|59|7] + G[12368|4|5|7|9] + G[12368|47|5|9]
584
+ + G[12368|47|59] + G[12368|479|5] + G[12368|49|5|7]
585
+ + G[1238|46|5|7|9] + G[1238|46|57|9] + G[1238|46|59|7]
586
+ + G[1238|469|5|7] + G[1238|469|57]
587
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
588
+ sage: G(S[2,1,2])
589
+ G[12|35|4] + G[123|45] + G[12345] + G[1235|4]
590
+ + G[1245|3] + G[125|3|4] + G[125|34]
591
+ sage: G(R(S[3,1,2,2])) == G(S[3,1,2,2])
592
+ True
593
+
594
+ This mapping is a Hopf algebra morphism::
595
+
596
+ sage: all(G(R[a1] * R[a2]) == G(R[a1]) * G(R[a2])
597
+ ....: for a1 in Compositions(2)
598
+ ....: for a2 in Compositions(4))
599
+ True
600
+
601
+ sage: R2 = R.tensor_square()
602
+ sage: phi = R2.module_morphism(
603
+ ....: lambda x: tensor([G(R[x[0]]), G(R[x[1]])]),
604
+ ....: codomain=G.tensor_square())
605
+ sage: all(phi(R[p].coproduct()) == G(R[p]).coproduct()
606
+ ....: for p in Compositions(4))
607
+ True
608
+
609
+ sage: all(G(S[a1] * S[a2]) == G(S[a1]) * G(S[a2])
610
+ ....: for a1 in Compositions(2)
611
+ ....: for a2 in Compositions(4))
612
+ True
613
+
614
+ sage: S2 = S.tensor_square()
615
+ sage: psi = S2.module_morphism(
616
+ ....: lambda x: tensor([G(S[x[0]]), G(S[x[1]])]),
617
+ ....: codomain=G.tensor_square())
618
+ sage: all(psi(S[p].coproduct()) == G(S[p]).coproduct()
619
+ ....: for p in Compositions(4))
620
+ True
621
+ """
622
+ if hasattr(R, "realization_of"):
623
+ if not self.base_ring().has_coerce_map_from(R.base_ring()):
624
+ return False
625
+ A = R.realization_of()
626
+ # NSym to FSym
627
+ from sage.combinat.ncsf_qsym.ncsf import NonCommutativeSymmetricFunctions
628
+ if isinstance(A, NonCommutativeSymmetricFunctions):
629
+ ribbon = A.ribbon()
630
+ if R is ribbon:
631
+ ST = self._indices
632
+
633
+ def R_to_G_on_basis(alpha):
634
+ return self.sum_of_monomials(ST(t) for t in StandardTableaux(alpha.size())
635
+ if descent_composition(t) == alpha)
636
+ return ribbon.module_morphism(R_to_G_on_basis, codomain=self)
637
+ return self._coerce_map_via([ribbon], R)
638
+ return super()._coerce_map_from_(R)
639
+
640
+ def dual_basis(self):
641
+ r"""
642
+ Return the dual basis to ``self``.
643
+
644
+ EXAMPLES::
645
+
646
+ sage: G = algebras.FSym(QQ).G()
647
+ sage: G.dual_basis()
648
+ Dual Hopf algebra of standard tableaux over the Rational Field
649
+ in the FundamentalDual basis
650
+ """
651
+ return self.realization_of().dual().F()
652
+
653
+ @cached_method
654
+ def product_on_basis(self, t1, t2):
655
+ r"""
656
+ Return the product of basis elements indexed by ``t1`` and ``t2``.
657
+
658
+ EXAMPLES::
659
+
660
+ sage: FSym = algebras.FSym(QQ)
661
+ sage: G = FSym.G()
662
+ sage: t1 = StandardTableau([[1,2], [3]])
663
+ sage: t2 = StandardTableau([[1,2,3]])
664
+ sage: G.product_on_basis(t1, t2)
665
+ G[12456|3] + G[1256|3|4] + G[1256|34] + G[126|35|4]
666
+
667
+ sage: t1 = StandardTableau([[1],[2]])
668
+ sage: t2 = StandardTableau([[1,2]])
669
+ sage: G.product_on_basis(t1, t2)
670
+ G[134|2] + G[14|2|3]
671
+
672
+ sage: t1 = StandardTableau([[1,2],[3]])
673
+ sage: t2 = StandardTableau([[1],[2]])
674
+ sage: G.product_on_basis(t1, t2)
675
+ G[12|3|4|5] + G[12|34|5] + G[124|3|5] + G[124|35]
676
+ """
677
+ n = t1.size()
678
+ m = n + t2.size()
679
+ tableaux = [t for t in StandardTableaux(m)
680
+ if t.restrict(n) == t1
681
+ and standardize(t.anti_restrict(n).rectify()) == t2]
682
+ return self.sum_of_monomials(tableaux)
683
+
684
+ @cached_method
685
+ def coproduct_on_basis(self, t):
686
+ r"""
687
+ Return the coproduct of the basis element indexed by ``t``.
688
+
689
+ EXAMPLES::
690
+
691
+ sage: FSym = algebras.FSym(QQ)
692
+ sage: G = FSym.G()
693
+ sage: t = StandardTableau([[1,2,5], [3,4]])
694
+ sage: G.coproduct_on_basis(t)
695
+ G[] # G[125|34] + G[1] # G[12|34] + G[1] # G[124|3]
696
+ + G[1|2] # G[13|2] + G[12] # G[12|3] + G[12] # G[123]
697
+ + G[12|34] # G[1] + G[123] # G[12] + G[125|34] # G[]
698
+ + G[13|2] # G[1|2] + G[13|2] # G[12] + G[134|2] # G[1]
699
+ """
700
+ # we use the duality to compute this
701
+ n = t.size()
702
+ L = []
703
+ dual_basis = self.dual_basis()
704
+ for i in range(n + 1):
705
+ for t1 in StandardTableaux(i):
706
+ for t2 in StandardTableaux(n - i):
707
+ coeff = (dual_basis[t1] * dual_basis[t2])[t]
708
+ if coeff:
709
+ L.append(((t1, t2), coeff))
710
+ TT = self.tensor_square()
711
+ return TT.sum_of_terms(L)
712
+
713
+ class Element(FSymBasis_abstract.Element):
714
+ def to_fqsym(self):
715
+ r"""
716
+ Return the image of ``self`` under the natural inclusion
717
+ map to `FQSym`.
718
+
719
+ EXAMPLES::
720
+
721
+ sage: FSym = algebras.FSym(QQ)
722
+ sage: G = FSym.G()
723
+ sage: t = StandardTableau([[1,3],[2,4],[5]])
724
+ sage: G[t].to_fqsym()
725
+ G[2, 1, 5, 4, 3] + G[3, 1, 5, 4, 2] + G[3, 2, 5, 4, 1]
726
+ + G[4, 1, 5, 3, 2] + G[4, 2, 5, 3, 1]
727
+ """
728
+ from sage.combinat.fqsym import FreeQuasisymmetricFunctions
729
+ R = self.parent().base_ring()
730
+ G = FreeQuasisymmetricFunctions(R).G()
731
+ return G(self)
732
+
733
+ def to_symmetric_function(self):
734
+ r"""
735
+ Return the image of ``self`` under the natural projection
736
+ map to `Sym`.
737
+
738
+ The natural projection map `FSym \to Sym` sends each
739
+ standard tableau `t` to the Schur function `s_\lambda`,
740
+ where `\lambda` is the shape of `t`.
741
+ This map is a surjective Hopf algebra homomorphism.
742
+
743
+ EXAMPLES::
744
+
745
+ sage: FSym = algebras.FSym(QQ)
746
+ sage: G = FSym.G()
747
+ sage: t = StandardTableau([[1,3],[2,4],[5]])
748
+ sage: G[t].to_symmetric_function()
749
+ s[2, 2, 1]
750
+ """
751
+ s = SymmetricFunctions(self.parent().base_ring()).s()
752
+ return s.sum_of_terms((t.shape(), coeff) for t, coeff in self)
753
+
754
+ G = Fundamental
755
+
756
+
757
+ class FreeSymmetricFunctions_Dual(UniqueRepresentation, Parent):
758
+ r"""
759
+ The Hopf dual `FSym^*` of the free symmetric functions `FSym`.
760
+
761
+ See :class:`FreeSymmetricFunctions` for the definition of the
762
+ latter.
763
+
764
+ Recall that the fundamental basis of `FSym` consists of the
765
+ elements `\mathcal{G}_t` for `t` ranging over all standard
766
+ tableaux. The dual basis of this is called the *dual
767
+ fundamental basis* of `FSym^*`, and is denoted by
768
+ `(\mathcal{G}_t^*)`.
769
+ The Hopf dual `FSym^*` is isomorphic to the Hopf algebra
770
+ `(\ZZ T, \ast', \delta')` from [PoiReu95]_; the
771
+ isomorphism sends a basis element `\mathcal{G}_t^*` to `t`.
772
+
773
+ EXAMPLES::
774
+
775
+ sage: FSym = algebras.FSym(QQ)
776
+ sage: TF = FSym.dual().F()
777
+ sage: TF[1,2] * TF[[1],[2]]
778
+ F[12|3|4] + F[123|4] + F[124|3] + F[13|2|4] + F[134|2] + F[14|2|3]
779
+ sage: TF[[1,2],[3]].coproduct()
780
+ F[] # F[12|3] + F[1] # F[1|2] + F[12] # F[1] + F[12|3] # F[]
781
+
782
+ The Hopf algebra `FSym^*` is a Hopf quotient of `FQSym`;
783
+ the canonical projection sends `F_w` (for a permutation `w`)
784
+ to `\mathcal{G}_{Q(w)}^*`, where `Q(w)` is the Q-tableau of
785
+ `w`. This projection is implemented as a coercion::
786
+
787
+ sage: FQSym = algebras.FQSym(QQ)
788
+ sage: F = FQSym.F()
789
+ sage: TF(F[[1, 3, 2]])
790
+ F[12|3]
791
+ sage: TF(F[[5, 1, 4, 2, 3]])
792
+ F[135|2|4]
793
+ """
794
+ def __init__(self, base_ring):
795
+ r"""
796
+ Initialize ``self``.
797
+
798
+ TESTS::
799
+
800
+ sage: FSymD = algebras.FSym(QQ).dual()
801
+ sage: TestSuite(FSymD).run()
802
+ """
803
+ cat = HopfAlgebras(base_ring).Graded().Connected()
804
+ Parent.__init__(self, base=base_ring, category=cat.WithRealizations())
805
+
806
+ _shorthands = ['F']
807
+
808
+ def a_realization(self):
809
+ r"""
810
+ Return a particular realization of ``self`` (the Fundamental
811
+ dual basis).
812
+
813
+ EXAMPLES::
814
+
815
+ sage: FSym = algebras.FSym(QQ).dual()
816
+ sage: FSym.a_realization()
817
+ Dual Hopf algebra of standard tableaux over the Rational Field
818
+ in the FundamentalDual basis
819
+ """
820
+ return self.FundamentalDual()
821
+
822
+ def dual(self):
823
+ r"""
824
+ Return the dual Hopf algebra of ``self``, which is `FSym`.
825
+
826
+ EXAMPLES::
827
+
828
+ sage: D = algebras.FSym(QQ).dual()
829
+ sage: D.dual()
830
+ Hopf algebra of standard tableaux over the Rational Field
831
+ """
832
+ return FreeSymmetricFunctions(self.base_ring())
833
+
834
+ def _repr_(self):
835
+ r"""
836
+ EXAMPLES::
837
+
838
+ sage: algebras.FSym(QQ).dual()
839
+ Dual Hopf algebra of standard tableaux over the Rational Field
840
+ """
841
+ return "Dual Hopf algebra of standard tableaux over the %s" % self.base_ring()
842
+
843
+ class FundamentalDual(FSymBasis_abstract):
844
+ r"""
845
+ The dual to the Hopf algebra of tableaux,
846
+ on the fundamental dual basis.
847
+
848
+ EXAMPLES::
849
+
850
+ sage: FSym = algebras.FSym(QQ)
851
+ sage: TF = FSym.dual().F()
852
+ sage: TF
853
+ Dual Hopf algebra of standard tableaux over the Rational Field
854
+ in the FundamentalDual basis
855
+
856
+ Elements of the algebra look like::
857
+
858
+ sage: TF.an_element()
859
+ 2*F[] + 2*F[1] + 3*F[12]
860
+
861
+ TESTS::
862
+
863
+ sage: FSym = algebras.FSym(QQ)
864
+ sage: TF = FSym.dual().F()
865
+ sage: TestSuite(TF).run()
866
+ """
867
+ _prefix = "F"
868
+
869
+ def _coerce_map_from_(self, R):
870
+ r"""
871
+ Return ``True`` if there is a coercion from ``R`` into ``self``
872
+ and ``False`` otherwise.
873
+
874
+ The things that coerce into ``self`` are
875
+
876
+ - elements of the algebra `FSym^*` over a base ring
877
+ with a coercion map into ``self.base_ring()``
878
+ - symmetric functions over a base ring with a coercion
879
+ map into ``self.base_ring()``
880
+ - elements of the algebra `FQSym` over a base ring with
881
+ a coercion map into ``self.base_ring()``
882
+
883
+ EXAMPLES:
884
+
885
+ `FSym^*` is a quotient Hopf algebra of `FQSym`: the basis
886
+ element `F_\sigma` indexed by a permutation `\sigma` is
887
+ mapped to the tableau `Q(\sigma)`::
888
+
889
+ sage: TF = algebras.FSym(QQ).dual().F()
890
+ sage: SF = algebras.FQSym(QQ).F()
891
+ sage: TF(SF([3,1,4,5,2]))
892
+ F[134|25]
893
+ sage: SG = algebras.FQSym(QQ).G()
894
+ sage: TF(SG([3,1,4,5,2]))
895
+ F[125|34]
896
+
897
+ This mapping is a Hopf algebra morphism::
898
+
899
+ sage: all(TF(SF[p1] * SF[p2]) == TF(SF[p1]) * TF(SF[p2])
900
+ ....: for p1 in Permutations(2)
901
+ ....: for p2 in Permutations(3))
902
+ True
903
+
904
+ sage: SSym2 = SF.tensor_square()
905
+ sage: phi = SSym2.module_morphism(
906
+ ....: lambda x: tensor([TF(SF[x[0]]), TF(SF[x[1]])]),
907
+ ....: codomain=TF.tensor_square())
908
+ sage: all(phi(SF[p].coproduct()) == TF(SF[p]).coproduct()
909
+ ....: for p in Permutations(4))
910
+ True
911
+
912
+ There is also an injective Hopf algebra morphism
913
+ `Sym \to FSym^*` (adjoint to the projection `FSym \to Sym`
914
+ implemented as
915
+ :meth:`FreeSymmetricFunctions.Fundamental.Element.to_symmetric_function`)
916
+ that sends each Schur function `s_\lambda` to the sum of
917
+ all standard tableaux of shape `\lambda`::
918
+
919
+ sage: Sym = SymmetricFunctions(QQ)
920
+ sage: s = Sym.schur()
921
+ sage: TF = algebras.FSym(QQ).dual().F()
922
+ sage: TF(s[2,1])
923
+ F[12|3] + F[13|2]
924
+ sage: TF(s[2,2,1])
925
+ F[12|34|5] + F[12|35|4] + F[13|24|5] + F[13|25|4] + F[14|25|3]
926
+ sage: h = Sym.h()
927
+ sage: TF(h[2,1])
928
+ F[12|3] + F[123] + F[13|2]
929
+
930
+ This mapping is a Hopf algebra morphism::
931
+
932
+ sage: all(TF(s[p1] * s[p2]) == TF(s[p1]) * TF(s[p2]) # needs lrcalc_python
933
+ ....: for p1 in Partitions(2)
934
+ ....: for p2 in Partitions(3))
935
+ True
936
+
937
+ sage: s2 = s.tensor_square()
938
+ sage: phi = s2.module_morphism(
939
+ ....: lambda x: tensor([TF(s[x[0]]), TF(s[x[1]])]),
940
+ ....: codomain=TF.tensor_square())
941
+ sage: all(phi(s[p].coproduct()) == TF(s[p]).coproduct() # needs lrcalc_python
942
+ ....: for p in Partitions(4))
943
+ True
944
+ """
945
+ if hasattr(R, "realization_of"):
946
+ if not self.base_ring().has_coerce_map_from(R.base_ring()):
947
+ return False
948
+ A = R.realization_of()
949
+ # FQSym to FSym^*
950
+ from sage.combinat.fqsym import FreeQuasisymmetricFunctions
951
+ if isinstance(A, FreeQuasisymmetricFunctions):
952
+ F = A.F()
953
+ if R is F:
954
+ def F_to_SF_on_basis(sigma):
955
+ return self.monomial(sigma.right_tableau())
956
+ return F.module_morphism(F_to_SF_on_basis, codomain=self)
957
+ return self._coerce_map_via([F], R)
958
+
959
+ # Sym to FSym^*
960
+ if isinstance(A, SymmetricFunctions):
961
+ s = A.s()
962
+ if R is s:
963
+ def s_to_F_on_basis(mu):
964
+ return self.sum_of_monomials(StandardTableaux(mu))
965
+ return s.module_morphism(s_to_F_on_basis, codomain=self)
966
+ return self._coerce_map_via([s], R)
967
+ return super()._coerce_map_from_(R)
968
+
969
+ def dual_basis(self):
970
+ r"""
971
+ Return the dual basis to ``self``.
972
+
973
+ EXAMPLES::
974
+
975
+ sage: F = algebras.FSym(QQ).dual().F()
976
+ sage: F.dual_basis()
977
+ Hopf algebra of standard tableaux over the Rational Field
978
+ in the Fundamental basis
979
+ """
980
+ return self.realization_of().dual().G()
981
+
982
+ @cached_method
983
+ def product_on_basis(self, t1, t2):
984
+ r"""
985
+ EXAMPLES::
986
+
987
+ sage: FSym = algebras.FSym(QQ)
988
+ sage: TF = FSym.dual().F()
989
+ sage: t1 = StandardTableau([[1,2]])
990
+ sage: TF.product_on_basis(t1, t1)
991
+ F[12|34] + F[123|4] + F[1234] + F[124|3] + F[13|24] + F[134|2]
992
+ sage: t0 = StandardTableau([])
993
+ sage: TF.product_on_basis(t1, t0) == TF[t1] == TF.product_on_basis(t0, t1)
994
+ True
995
+ """
996
+ z = []
997
+ n = t1.size()
998
+ m = t2.size()
999
+ npmp1 = n + m + 1
1000
+ ST = self._indices
1001
+ from itertools import combinations
1002
+ for I in combinations(range(1, npmp1), n):
1003
+ J = [j for j in range(1, npmp1) if (j not in I)]
1004
+ tt1 = [[I[x - 1] for x in row] for row in t1]
1005
+ tt2 = [tuple([J[x - 1] for x in row]) for row in t2]
1006
+ z.append(ST(Tableau(tt1).slide_multiply(tt2)))
1007
+ return self.sum_of_monomials(z)
1008
+
1009
+ @cached_method
1010
+ def coproduct_on_basis(self, t):
1011
+ r"""
1012
+ EXAMPLES::
1013
+
1014
+ sage: FSym = algebras.FSym(QQ)
1015
+ sage: TF = FSym.dual().F()
1016
+ sage: t = StandardTableau([[1,2,5], [3,4]])
1017
+ sage: TF.coproduct_on_basis(t)
1018
+ F[] # F[125|34] + F[1] # F[134|2] + F[12] # F[123]
1019
+ + F[12|3] # F[12] + F[12|34] # F[1] + F[125|34] # F[]
1020
+ """
1021
+ terms = [(t.restrict(i), standardize(t.anti_restrict(i).rectify()))
1022
+ for i in range(t.size() + 1)]
1023
+ return self.tensor_square().sum_of_monomials(terms)
1024
+
1025
+ class Element(FSymBasis_abstract.Element):
1026
+ def to_quasisymmetric_function(self):
1027
+ r"""
1028
+ Return the image of ``self`` under the canonical projection
1029
+ `FSym^* \to QSym` to the ring of quasi-symmetric functions.
1030
+
1031
+ This projection is the adjoint of the canonical injection
1032
+ `NSym \to FSym` (see
1033
+ :meth:`~sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.Bases.ElementMethods.to_fsym`).
1034
+ It sends each tableau `t` to the fundamental quasi-symmetric
1035
+ function `F_\alpha`, where `\alpha` is the descent composition
1036
+ of `t`.
1037
+
1038
+ EXAMPLES::
1039
+
1040
+ sage: F = algebras.FSym(QQ).dual().F()
1041
+ sage: F[[1,3,5],[2,4]].to_quasisymmetric_function()
1042
+ F[1, 2, 2]
1043
+ """
1044
+ from sage.combinat.ncsf_qsym.qsym import QuasiSymmetricFunctions
1045
+ QF = QuasiSymmetricFunctions(self.base_ring()).Fundamental()
1046
+ return QF.sum_of_terms((descent_composition(t), coeff)
1047
+ for t, coeff in self)
1048
+
1049
+ F = FundamentalDual
1050
+
1051
+
1052
+ # some utility functions for tableaux
1053
+
1054
+ def standardize(t):
1055
+ r"""
1056
+ Return the standard tableau corresponding to a given
1057
+ semistandard tableau ``t`` with no repeated entries.
1058
+
1059
+ .. NOTE::
1060
+
1061
+ This is an optimized version of :meth:`Tableau.standardization`
1062
+ for computations in `FSym` by using the assumption of no
1063
+ repeated entries in ``t``.
1064
+
1065
+ EXAMPLES::
1066
+
1067
+ sage: from sage.combinat.chas.fsym import standardize
1068
+ sage: t = Tableau([[1,3,5,7],[2,4,8],[9]])
1069
+ sage: standardize(t)
1070
+ [[1, 3, 5, 6], [2, 4, 7], [8]]
1071
+ sage: t = Tableau([[3,8,9,15],[5,10,12],[133]])
1072
+ sage: standardize(t)
1073
+ [[1, 3, 4, 7], [2, 5, 6], [8]]
1074
+
1075
+ TESTS:
1076
+
1077
+ This returns an equal tableau if already standard::
1078
+
1079
+ sage: t = Tableau([[1,3,4,5],[2,6,7],[8]])
1080
+ sage: standardize(t)
1081
+ [[1, 3, 4, 5], [2, 6, 7], [8]]
1082
+ sage: standardize(t) == t
1083
+ True
1084
+ """
1085
+ A = sorted(sum(t, ()))
1086
+ std = {j: i + 1 for i, j in enumerate(A)}
1087
+ ST = StandardTableaux()
1088
+ return ST([[std[i] for i in row] for row in t])
1089
+
1090
+
1091
+ def ascent_set(t):
1092
+ """
1093
+ Return the ascent set of a standard tableau ``t``
1094
+ (encoded as a sorted list).
1095
+
1096
+ The *ascent set* of a standard tableau `t` is defined as
1097
+ the set of all entries `i` of `t` such that the number `i+1`
1098
+ either appears to the right of `i` or appears in a row above
1099
+ `i` or does not appear in `t` at all.
1100
+
1101
+ EXAMPLES::
1102
+
1103
+ sage: from sage.combinat.chas.fsym import ascent_set
1104
+ sage: t = StandardTableau([[1,3,4,7],[2,5,6],[8]])
1105
+ sage: ascent_set(t)
1106
+ [2, 3, 5, 6, 8]
1107
+ sage: ascent_set(StandardTableau([]))
1108
+ []
1109
+ sage: ascent_set(StandardTableau([[1, 2, 3]]))
1110
+ [1, 2, 3]
1111
+ sage: ascent_set(StandardTableau([[1, 2, 4], [3]]))
1112
+ [1, 3, 4]
1113
+ sage: ascent_set([[1, 3, 5], [2, 4]])
1114
+ [2, 4, 5]
1115
+ """
1116
+ row_locations = {}
1117
+ for (i, row) in enumerate(t):
1118
+ for entry in row:
1119
+ row_locations[entry] = i
1120
+ n = len(row_locations)
1121
+ if not n:
1122
+ return []
1123
+ ascents = [n]
1124
+ for i in range(1, n):
1125
+ # ascent means i+1 appears to the right or above
1126
+ x = row_locations[i]
1127
+ u = row_locations[i + 1]
1128
+ if u <= x:
1129
+ ascents.append(i)
1130
+ return sorted(ascents)
1131
+
1132
+
1133
+ def descent_set(t):
1134
+ """
1135
+ Return the descent set of a standard tableau ``t``
1136
+ (encoded as a sorted list).
1137
+
1138
+ The *descent set* of a standard tableau `t` is defined as
1139
+ the set of all entries `i` of `t` such that the number `i+1`
1140
+ appears in a row below `i` in `t`.
1141
+
1142
+ EXAMPLES::
1143
+
1144
+ sage: from sage.combinat.chas.fsym import descent_set
1145
+ sage: t = StandardTableau([[1,3,4,7],[2,5,6],[8]])
1146
+ sage: descent_set(t)
1147
+ [1, 4, 7]
1148
+ sage: descent_set(StandardTableau([]))
1149
+ []
1150
+ sage: descent_set(StandardTableau([[1, 2, 3]]))
1151
+ []
1152
+ sage: descent_set(StandardTableau([[1, 2, 4], [3]]))
1153
+ [2]
1154
+ sage: descent_set([[1, 3, 5], [2, 4]])
1155
+ [1, 3]
1156
+ """
1157
+ ascents = set(ascent_set(t))
1158
+ n = sum(len(row) for row in t)
1159
+ return [i for i in range(1, n) if i not in ascents]
1160
+
1161
+
1162
+ def descent_composition(t):
1163
+ """
1164
+ Return the descent composition of a standard tableau ``t``.
1165
+
1166
+ This is the composition of the size of `t` whose partial
1167
+ sums are the elements of the descent set of ``t`` (see
1168
+ :meth:`descent_set`).
1169
+
1170
+ EXAMPLES::
1171
+
1172
+ sage: from sage.combinat.chas.fsym import descent_composition
1173
+ sage: t = StandardTableau([[1,3,4,7],[2,5,6],[8]])
1174
+ sage: descent_composition(t)
1175
+ [1, 3, 3, 1]
1176
+ sage: descent_composition([[1, 3, 5], [2, 4]])
1177
+ [1, 2, 2]
1178
+ """
1179
+ n = sum(len(row) for row in t)
1180
+ return Composition(from_subset=(descent_set(t), n))