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,1427 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+ """
4
+ Generic code for bases
5
+
6
+ This is a collection of code that is shared by bases of noncommutative
7
+ symmetric functions and quasisymmetric functions.
8
+
9
+ AUTHORS:
10
+
11
+ - Jason Bandlow
12
+ - Franco Saliola
13
+ - Chris Berg
14
+ """
15
+ #*****************************************************************************
16
+ # Copyright (C) 2010 Jason Bandlow <jbandlow@gmail.com>,
17
+ # 2012 Franco Saliola <saliola@gmail.com>,
18
+ #
19
+ # Distributed under the terms of the GNU General Public License (GPL)
20
+ #
21
+ # This code is distributed in the hope that it will be useful,
22
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
+ # General Public License for more details.
25
+ #
26
+ # The full text of the GPL is available at:
27
+ #
28
+ # http://www.gnu.org/licenses/
29
+ #*****************************************************************************
30
+
31
+ from sage.misc.cachefunc import cached_method
32
+ from sage.categories.realizations import Category_realization_of_parent
33
+ from sage.categories.modules_with_basis import ModulesWithBasis
34
+ from sage.modules.with_basis.morphism import ModuleMorphismByLinearity
35
+ from sage.combinat.composition import Compositions, Composition
36
+ from sage.combinat.partition import Partition
37
+ from sage.combinat.permutation import Permutations
38
+ from sage.rings.integer import Integer
39
+ from sage.categories.algebras_with_basis import AlgebrasWithBasis
40
+ from sage.misc.lazy_attribute import lazy_attribute
41
+ from sage.misc.abstract_method import abstract_method
42
+ from sage.categories.category_types import Category_over_base_ring
43
+ from sage.categories.realizations import RealizationsCategory
44
+
45
+
46
+ class BasesOfQSymOrNCSF(Category_realization_of_parent):
47
+
48
+ def _repr_object_names(self):
49
+ r"""
50
+ Return the name of the objects of this category.
51
+
52
+ TESTS::
53
+
54
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import BasesOfQSymOrNCSF
55
+ sage: QSym = QuasiSymmetricFunctions(QQ)
56
+ sage: C = BasesOfQSymOrNCSF(QSym)
57
+ sage: C._repr_object_names()
58
+ 'bases of Non-Commutative Symmetric Functions or Quasisymmetric functions over the Rational Field'
59
+ sage: C
60
+ Category of bases of Non-Commutative Symmetric Functions or Quasisymmetric functions over the Rational Field
61
+ """
62
+ return "bases of Non-Commutative Symmetric Functions or Quasisymmetric functions over the %s" % self.base().base_ring()
63
+
64
+ def super_categories(self):
65
+ r"""
66
+ TESTS::
67
+
68
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import BasesOfQSymOrNCSF
69
+ sage: QSym = QuasiSymmetricFunctions(QQ)
70
+ sage: BasesOfQSymOrNCSF(QSym).super_categories()
71
+ [Category of realizations of Quasisymmetric functions over the Rational Field,
72
+ Category of graded Hopf algebras with basis over Rational Field,
73
+ Join of Category of realizations of Hopf algebras over Rational Field
74
+ and Category of graded algebras over Rational Field
75
+ and Category of graded coalgebras over Rational Field]
76
+ """
77
+ R = self.base().base_ring()
78
+ from sage.categories.graded_hopf_algebras_with_basis import GradedHopfAlgebrasWithBasis
79
+ from sage.categories.graded_hopf_algebras import GradedHopfAlgebras
80
+ return [self.base().Realizations(),
81
+ GradedHopfAlgebrasWithBasis(R),
82
+ GradedHopfAlgebras(R).Realizations()]
83
+
84
+ class ParentMethods:
85
+
86
+ def _repr_(self):
87
+ """
88
+ TESTS::
89
+
90
+ sage: S = NonCommutativeSymmetricFunctions(QQ).complete()
91
+ sage: S._repr_()
92
+ 'Non-Commutative Symmetric Functions over the Rational Field in the Complete basis'
93
+ sage: F = QuasiSymmetricFunctions(ZZ).Fundamental()
94
+ sage: F._repr_()
95
+ 'Quasisymmetric functions over the Integer Ring in the Fundamental basis'
96
+ """
97
+ return "%s in the %s basis" % (self.realization_of(), self._realization_name())
98
+
99
+ def __getitem__(self, c, *rest):
100
+ """
101
+ This method implements the abuses of notations::
102
+
103
+ sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
104
+ sage: Psi[2,1]
105
+ Psi[2, 1]
106
+ sage: Psi[[2,1]]
107
+ Psi[2, 1]
108
+ sage: Psi[Composition([2,1])]
109
+ Psi[2, 1]
110
+
111
+ .. TODO::
112
+
113
+ This should call ``super.monomial`` if the input can't
114
+ be made into a composition so as not to interfere with
115
+ the standard notation ``Psi['x,y,z']``.
116
+
117
+ This could possibly be shared with Sym, FQSym, and
118
+ other algebras with bases indexed by list-like objects
119
+ """
120
+ if isinstance(c, Composition):
121
+ assert len(rest) == 0
122
+ else:
123
+ if len(rest) > 0 or isinstance(c, (int, Integer)):
124
+ c = self._indices([c] + list(rest))
125
+ else:
126
+ c = self._indices(list(c))
127
+ return self.monomial(c)
128
+
129
+ # could go to Algebras(...).Graded().Connected() or Modules(...).Graded().Connected()
130
+ @cached_method
131
+ def one_basis(self):
132
+ r"""
133
+ Return the empty composition.
134
+
135
+ OUTPUT: the empty composition
136
+
137
+ EXAMPLES::
138
+
139
+ sage: L = NonCommutativeSymmetricFunctions(QQ).L()
140
+ sage: parent(L)
141
+ <class 'sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.Elementary_with_category'>
142
+ sage: parent(L).one_basis()
143
+ []
144
+ """
145
+ return Compositions()([])
146
+
147
+ # Combinatorial rules
148
+
149
+ def sum_of_finer_compositions(self, composition):
150
+ r"""
151
+ Return the sum of all finer compositions.
152
+
153
+ INPUT:
154
+
155
+ - ``composition`` -- a composition
156
+
157
+ OUTPUT:
158
+
159
+ - The sum of all basis ``self`` elements which are indexed by
160
+ compositions finer than ``composition``.
161
+
162
+ EXAMPLES::
163
+
164
+ sage: L = NonCommutativeSymmetricFunctions(QQ).L()
165
+ sage: L.sum_of_finer_compositions(Composition([2,1]))
166
+ L[1, 1, 1] + L[2, 1]
167
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
168
+ sage: R.sum_of_finer_compositions(Composition([1,3]))
169
+ R[1, 1, 1, 1] + R[1, 1, 2] + R[1, 2, 1] + R[1, 3]
170
+ """
171
+
172
+ return self.sum_of_monomials( compo for compo in composition.finer() )
173
+
174
+ def sum_of_fatter_compositions(self, composition):
175
+ r"""
176
+ Return the sum of all fatter compositions.
177
+
178
+ INPUT:
179
+
180
+ - ``composition`` -- a composition
181
+
182
+ OUTPUT:
183
+
184
+ - the sum of all basis elements which are indexed by
185
+ compositions fatter (coarser?) than ``composition``.
186
+
187
+ EXAMPLES::
188
+
189
+ sage: L = NonCommutativeSymmetricFunctions(QQ).L()
190
+ sage: L.sum_of_fatter_compositions(Composition([2,1]))
191
+ L[2, 1] + L[3]
192
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
193
+ sage: R.sum_of_fatter_compositions(Composition([1,3]))
194
+ R[1, 3] + R[4]
195
+ """
196
+ return self.sum_of_monomials( compo for compo in composition.fatter() )
197
+
198
+ def alternating_sum_of_compositions(self, n):
199
+ r"""
200
+ Alternating sum over compositions of ``n``.
201
+
202
+ Note that this differs from the method
203
+ :meth:`alternating_sum_of_finer_compositions` because the
204
+ coefficient of the composition `1^n` is positive. This
205
+ method is used in the expansion of the elementary generators
206
+ into the complete generators and vice versa.
207
+
208
+ INPUT:
209
+
210
+ - ``n`` -- positive integer
211
+
212
+ OUTPUT:
213
+
214
+ - The expansion of the complete generator indexed by ``n``
215
+ into the elementary basis.
216
+
217
+ EXAMPLES::
218
+
219
+ sage: L = NonCommutativeSymmetricFunctions(QQ).L()
220
+ sage: L.alternating_sum_of_compositions(0)
221
+ L[]
222
+ sage: L.alternating_sum_of_compositions(1)
223
+ L[1]
224
+ sage: L.alternating_sum_of_compositions(2)
225
+ L[1, 1] - L[2]
226
+ sage: L.alternating_sum_of_compositions(3)
227
+ L[1, 1, 1] - L[1, 2] - L[2, 1] + L[3]
228
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
229
+ sage: S.alternating_sum_of_compositions(3)
230
+ S[1, 1, 1] - S[1, 2] - S[2, 1] + S[3]
231
+ """
232
+ ring = self.base_ring()
233
+ return (-ring.one())**(n)*self.sum_of_terms(
234
+ (compo, ring((-1)**(len(compo)))) for compo in Compositions(n) )
235
+
236
+ def alternating_sum_of_finer_compositions(self, composition, conjugate=False):
237
+ """
238
+ Return the alternating sum of finer compositions in a basis of the
239
+ non-commutative symmetric functions.
240
+
241
+ INPUT:
242
+
243
+ - ``composition`` -- a composition
244
+ - ``conjugate`` -- boolean (default: ``False``)
245
+
246
+ OUTPUT:
247
+
248
+ - The alternating sum of the compositions finer than ``composition``,
249
+ in the basis ``self``. The alternation is upon the length of the
250
+ compositions, and is normalized so that ``composition`` has
251
+ coefficient `1`. If the variable ``conjugate`` is set to ``True``,
252
+ then the conjugate of ``composition`` is used instead of
253
+ ``composition``.
254
+
255
+ EXAMPLES::
256
+
257
+ sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
258
+ sage: elementary = NCSF.elementary()
259
+ sage: elementary.alternating_sum_of_finer_compositions(Composition([2,2,1]))
260
+ L[1, 1, 1, 1, 1] - L[1, 1, 2, 1] - L[2, 1, 1, 1] + L[2, 2, 1]
261
+ sage: elementary.alternating_sum_of_finer_compositions(Composition([1,2]))
262
+ -L[1, 1, 1] + L[1, 2]
263
+
264
+ TESTS::
265
+
266
+ sage: complete = NonCommutativeSymmetricFunctions(ZZ).complete()
267
+ sage: I = Composition([2])
268
+ sage: x = complete.alternating_sum_of_finer_compositions(I)
269
+ sage: [c.parent() for c in x.coefficients()]
270
+ [Integer Ring, Integer Ring]
271
+ """
272
+ if conjugate:
273
+ composition = composition.conjugate()
274
+ l = len(composition)
275
+ ring = self.base_ring()
276
+ return self.sum_of_terms( (compo, ring((-1)**(len(compo)-l))) for compo in composition.finer() )
277
+
278
+ def alternating_sum_of_fatter_compositions(self, composition):
279
+ """
280
+ Return the alternating sum of fatter compositions in a basis of the
281
+ non-commutative symmetric functions.
282
+
283
+ INPUT:
284
+
285
+ - ``composition`` -- a composition
286
+
287
+ OUTPUT:
288
+
289
+ - The alternating sum of the compositions fatter than ``composition``,
290
+ in the basis ``self``. The alternation is upon the length of the
291
+ compositions, and is normalized so that ``composition`` has
292
+ coefficient `1`.
293
+
294
+ EXAMPLES::
295
+
296
+ sage: NCSF=NonCommutativeSymmetricFunctions(QQ)
297
+ sage: elementary = NCSF.elementary()
298
+ sage: elementary.alternating_sum_of_fatter_compositions(Composition([2,2,1]))
299
+ L[2, 2, 1] - L[2, 3] - L[4, 1] + L[5]
300
+ sage: elementary.alternating_sum_of_fatter_compositions(Composition([1,2]))
301
+ L[1, 2] - L[3]
302
+
303
+ TESTS::
304
+
305
+ sage: complete = NonCommutativeSymmetricFunctions(ZZ).complete()
306
+ sage: I = Composition([1,1])
307
+ sage: x = complete.alternating_sum_of_fatter_compositions(I)
308
+ sage: [c.parent() for c in x.coefficients()]
309
+ [Integer Ring, Integer Ring]
310
+ """
311
+ l = len(composition)
312
+ ring = self.base_ring()
313
+ return self.sum_of_terms( (compo, ring((-1)**(len(compo)-l))) for compo in composition.fatter() )
314
+
315
+ def sum_of_partition_rearrangements(self, par):
316
+ """
317
+ Return the sum of all basis elements indexed by compositions which can be
318
+ sorted to obtain a given partition.
319
+
320
+ INPUT:
321
+
322
+ - ``par`` -- a partition
323
+
324
+ OUTPUT:
325
+
326
+ - The sum of all ``self`` basis elements indexed by compositions
327
+ which are permutations of ``par`` (without multiplicity).
328
+
329
+ EXAMPLES::
330
+
331
+ sage: NCSF=NonCommutativeSymmetricFunctions(QQ)
332
+ sage: elementary = NCSF.elementary()
333
+ sage: elementary.sum_of_partition_rearrangements(Partition([2,2,1]))
334
+ L[1, 2, 2] + L[2, 1, 2] + L[2, 2, 1]
335
+ sage: elementary.sum_of_partition_rearrangements(Partition([3,2,1]))
336
+ L[1, 2, 3] + L[1, 3, 2] + L[2, 1, 3] + L[2, 3, 1] + L[3, 1, 2] + L[3, 2, 1]
337
+ sage: elementary.sum_of_partition_rearrangements(Partition([]))
338
+ L[]
339
+ """
340
+ return self.sum_of_monomials( self._indices(comp) for comp in Permutations(par) )
341
+
342
+ def _comp_to_par(self, comp):
343
+ """
344
+ Return the partition if the composition is actually a partition. Otherwise
345
+ returns nothing.
346
+
347
+ INPUT:
348
+
349
+ - ``comp`` -- a composition
350
+
351
+ OUTPUT:
352
+
353
+ - ``comp`` as a partition, if it is sorted; otherwise returns
354
+ ``None`` (nothing).
355
+
356
+ EXAMPLES::
357
+
358
+ sage: NCSF=NonCommutativeSymmetricFunctions(QQ)
359
+ sage: L = NCSF.elementary()
360
+ sage: L._comp_to_par(Composition([1,1,3,1,2]))
361
+ sage: L.sum_of_partition_rearrangements(Composition([]))
362
+ L[]
363
+ sage: L._comp_to_par(Composition([3,2,1,1]))
364
+ [3, 2, 1, 1]
365
+ """
366
+ try:
367
+ return Partition(comp)
368
+ except ValueError:
369
+ return None
370
+
371
+ def degree_on_basis(self, I):
372
+ r"""
373
+ Return the degree of the basis element indexed by `I`.
374
+
375
+ INPUT:
376
+
377
+ - ``I`` -- a composition
378
+
379
+ OUTPUT:
380
+
381
+ - The degree of the non-commutative symmetric function basis
382
+ element of ``self`` indexed by ``I``. By definition, this is
383
+ the size of the composition ``I``.
384
+
385
+ EXAMPLES::
386
+
387
+ sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon()
388
+ sage: R.degree_on_basis(Composition([2,3]))
389
+ 5
390
+ sage: M = QuasiSymmetricFunctions(QQ).Monomial()
391
+ sage: M.degree_on_basis(Composition([3,2]))
392
+ 5
393
+ sage: M.degree_on_basis(Composition([]))
394
+ 0
395
+ """
396
+ return I.size()
397
+
398
+ def skew(self, x, y, side='left'):
399
+ r"""
400
+ Return a function ``x`` in ``self`` skewed by a function
401
+ ``y`` in the Hopf dual of ``self``.
402
+
403
+ INPUT:
404
+
405
+ - ``x`` -- a non-commutative or quasi-symmetric function; it is
406
+ an element of ``self``
407
+ - ``y`` -- a quasi-symmetric or non-commutative symmetric
408
+ function; it is an element of the dual algebra of ``self``
409
+ - ``side`` -- (default: ``'left'``)
410
+ either ``'left'`` or ``'right'``
411
+
412
+ OUTPUT:
413
+
414
+ - The result of skewing the element ``x`` by the Hopf algebra
415
+ element ``y`` (either from the left or from the right, as
416
+ determined by ``side``), written in the basis ``self``.
417
+
418
+ EXAMPLES::
419
+
420
+ sage: S = NonCommutativeSymmetricFunctions(QQ).complete()
421
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
422
+ sage: S.skew(S[2,2,2], F[1,1])
423
+ S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1]
424
+ sage: S.skew(S[2,2,2], F[2])
425
+ S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1] + 3*S[2, 2]
426
+
427
+ ::
428
+
429
+ sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon()
430
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
431
+ sage: R.skew(R[2,2,2], F[1,1])
432
+ R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4]
433
+ sage: R.skew(R[2,2,2], F[2])
434
+ R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
435
+
436
+ ::
437
+
438
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
439
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
440
+ sage: M = QuasiSymmetricFunctions(QQ).M()
441
+ sage: M.skew(M[3,2], S[2])
442
+ 0
443
+ sage: M.skew(M[3,2], S[2], side='right')
444
+ M[3]
445
+ sage: M.skew(M[3,2], S[3])
446
+ M[2]
447
+ sage: M.skew(M[3,2], S[3], side='right')
448
+ 0
449
+
450
+ TESTS::
451
+
452
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
453
+ sage: R.skew([2,1], [1])
454
+ Traceback (most recent call last):
455
+ ...
456
+ AssertionError: x must be an element of Non-Commutative Symmetric Functions over the Rational Field
457
+ sage: R([2,1]).skew_by([1])
458
+ Traceback (most recent call last):
459
+ ...
460
+ AssertionError: y must be an element of Quasisymmetric functions over the Rational Field
461
+ sage: F = QuasiSymmetricFunctions(QQ).F()
462
+ sage: F([2,1]).skew_by([1])
463
+ Traceback (most recent call last):
464
+ ...
465
+ AssertionError: y must be an element of Non-Commutative Symmetric Functions over the Rational Field
466
+ """
467
+ alg = self.realization_of()
468
+ assert x in alg, "x must be an element of %s" % alg
469
+ assert y in alg.dual(), "y must be an element of %s" % alg.dual()
470
+ if hasattr(self, 'dual'):
471
+ x = self(x)
472
+ y = self.dual()(y)
473
+ v = 1 if side == 'left' else 0
474
+ return self.sum(coeff * y[IJ[1-v]] * self[IJ[v]]
475
+ for (IJ, coeff) in x.coproduct()
476
+ if IJ[1-v] in y.support())
477
+ else:
478
+ return self._skew_by_coercion(x, y, side=side)
479
+
480
+ def _skew_by_coercion(self, x, y, side='left'):
481
+ r"""
482
+ Return a function ``x`` in ``self`` skewed by a function
483
+ ``y`` in the Hopf dual of ``self`` using coercion.
484
+
485
+ INPUT:
486
+
487
+ - ``x`` -- a non-commutative or quasi-symmetric function; it is
488
+ an element of ``self``
489
+ - ``y`` -- a quasi-symmetric or non-commutative symmetric
490
+ function; it is an element of the dual algebra of ``self``
491
+ - ``side`` -- (default: ``'left'``)
492
+ either ``'left'`` or ``'right'``
493
+
494
+ OUTPUT:
495
+
496
+ - The result of skewing the element ``x`` by the Hopf algebra
497
+ element ``y`` (either from the left or from the right, as
498
+ determined by ``side``), written in the basis ``self``.
499
+ This uses coercion to a concrete realization (either the
500
+ complete basis of non-commutative symmetric functions or
501
+ the monomial basis of the quasi-symmetric functions).
502
+
503
+ EXAMPLES::
504
+
505
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
506
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
507
+ sage: M = QuasiSymmetricFunctions(QQ).M()
508
+ sage: M._skew_by_coercion(M[1,2,1,3], R[1])
509
+ M[2, 1, 3]
510
+ sage: M._skew_by_coercion(M[1,2,1,3], R[1],side='right')
511
+ 0
512
+ """
513
+ a_realization = self.realization_of().a_realization()
514
+ return self(a_realization.skew(a_realization(x), y, side=side))
515
+
516
+ def duality_pairing(self, x, y):
517
+ r"""
518
+ The duality pairing between elements of `NSym` and elements
519
+ of `QSym`.
520
+
521
+ This is a default implementation that uses
522
+ ``self.realizations_of().a_realization()`` and its dual basis.
523
+
524
+ INPUT:
525
+
526
+ - ``x`` -- an element of ``self``
527
+ - ``y`` -- an element in the dual basis of ``self``
528
+
529
+ OUTPUT:
530
+
531
+ - The result of pairing the function ``x`` from ``self`` with the function
532
+ ``y`` from the dual basis of ``self``
533
+
534
+ EXAMPLES::
535
+
536
+ sage: R = NonCommutativeSymmetricFunctions(QQ).Ribbon()
537
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
538
+ sage: R.duality_pairing(R[1,1,2], F[1,1,2])
539
+ 1
540
+ sage: R.duality_pairing(R[1,2,1], F[1,1,2])
541
+ 0
542
+ sage: F.duality_pairing(F[1,2,1], R[1,1,2])
543
+ 0
544
+
545
+ ::
546
+
547
+ sage: S = NonCommutativeSymmetricFunctions(QQ).Complete()
548
+ sage: M = QuasiSymmetricFunctions(QQ).Monomial()
549
+ sage: S.duality_pairing(S[1,1,2], M[1,1,2])
550
+ 1
551
+ sage: S.duality_pairing(S[1,2,1], M[1,1,2])
552
+ 0
553
+ sage: M.duality_pairing(M[1,1,2], S[1,1,2])
554
+ 1
555
+ sage: M.duality_pairing(M[1,2,1], S[1,1,2])
556
+ 0
557
+
558
+ ::
559
+
560
+ sage: S = NonCommutativeSymmetricFunctions(QQ).Complete()
561
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
562
+ sage: S.duality_pairing(S[1,2], F[1,1,1])
563
+ 0
564
+ sage: S.duality_pairing(S[1,1,1,1], F[4])
565
+ 1
566
+
567
+ TESTS:
568
+
569
+ The result has the right parent even if the sum is empty::
570
+
571
+ sage: x = S.duality_pairing(S.zero(), F.zero()); x
572
+ 0
573
+ sage: parent(x)
574
+ Rational Field
575
+ """
576
+ if hasattr(self, 'dual'):
577
+ x = self(x)
578
+ y = self.dual()(y)
579
+ return self.base_ring().sum(coeff * y[I] for (I, coeff) in x)
580
+ else:
581
+ return self.duality_pairing_by_coercion(x, y)
582
+
583
+ def duality_pairing_by_coercion(self, x, y):
584
+ r"""
585
+ The duality pairing between elements of NSym and elements of QSym.
586
+
587
+ This is a default implementation that uses
588
+ ``self.realizations_of().a_realization()`` and its dual basis.
589
+
590
+ INPUT:
591
+
592
+ - ``x`` -- an element of ``self``
593
+ - ``y`` -- an element in the dual basis of ``self``
594
+
595
+ OUTPUT:
596
+
597
+ - The result of pairing the function ``x`` from ``self`` with
598
+ the function ``y`` from the dual basis of ``self``
599
+
600
+ EXAMPLES::
601
+
602
+ sage: L = NonCommutativeSymmetricFunctions(QQ).Elementary()
603
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
604
+ sage: L.duality_pairing_by_coercion(L[1,2], F[1,2])
605
+ 0
606
+ sage: F.duality_pairing_by_coercion(F[1,2], L[1,2])
607
+ 0
608
+ sage: L.duality_pairing_by_coercion(L[1,1,1], F[1,2])
609
+ 1
610
+ sage: F.duality_pairing_by_coercion(F[1,2], L[1,1,1])
611
+ 1
612
+
613
+ TESTS:
614
+
615
+ The result has the right parent even if the sum is empty::
616
+
617
+ sage: x = F.duality_pairing_by_coercion(F.zero(), L.zero()); x
618
+ 0
619
+ sage: parent(x)
620
+ Rational Field
621
+ """
622
+ a_realization = self.realization_of().a_realization()
623
+ x = a_realization(x)
624
+ y = a_realization.dual()(y)
625
+ return self.base_ring().sum(coeff * y[I] for (I, coeff) in x)
626
+
627
+ def duality_pairing_matrix(self, basis, degree):
628
+ r"""
629
+ The matrix of scalar products between elements of NSym and
630
+ elements of QSym.
631
+
632
+ INPUT:
633
+
634
+ - ``basis`` -- a basis of the dual Hopf algebra
635
+ - ``degree`` -- nonnegative integer
636
+
637
+ OUTPUT:
638
+
639
+ - The matrix of scalar products between the basis ``self``
640
+ and the basis ``basis`` in the dual Hopf algebra in
641
+ degree ``degree``.
642
+
643
+ EXAMPLES:
644
+
645
+ The ribbon basis of NCSF is dual to the fundamental basis of
646
+ QSym::
647
+
648
+ sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon()
649
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
650
+ sage: R.duality_pairing_matrix(F, 3)
651
+ [1 0 0 0]
652
+ [0 1 0 0]
653
+ [0 0 1 0]
654
+ [0 0 0 1]
655
+ sage: F.duality_pairing_matrix(R, 3)
656
+ [1 0 0 0]
657
+ [0 1 0 0]
658
+ [0 0 1 0]
659
+ [0 0 0 1]
660
+
661
+ The complete basis of NCSF is dual to the monomial basis of
662
+ QSym::
663
+
664
+ sage: S = NonCommutativeSymmetricFunctions(QQ).complete()
665
+ sage: M = QuasiSymmetricFunctions(QQ).Monomial()
666
+ sage: S.duality_pairing_matrix(M, 3)
667
+ [1 0 0 0]
668
+ [0 1 0 0]
669
+ [0 0 1 0]
670
+ [0 0 0 1]
671
+ sage: M.duality_pairing_matrix(S, 3)
672
+ [1 0 0 0]
673
+ [0 1 0 0]
674
+ [0 0 1 0]
675
+ [0 0 0 1]
676
+
677
+ The matrix between the ribbon basis of NCSF and the monomial
678
+ basis of QSym::
679
+
680
+ sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon()
681
+ sage: M = QuasiSymmetricFunctions(QQ).Monomial()
682
+ sage: R.duality_pairing_matrix(M, 3)
683
+ [ 1 -1 -1 1]
684
+ [ 0 1 0 -1]
685
+ [ 0 0 1 -1]
686
+ [ 0 0 0 1]
687
+ sage: M.duality_pairing_matrix(R, 3)
688
+ [ 1 0 0 0]
689
+ [-1 1 0 0]
690
+ [-1 0 1 0]
691
+ [ 1 -1 -1 1]
692
+
693
+ The matrix between the complete basis of NCSF and the
694
+ fundamental basis of QSym::
695
+
696
+ sage: S = NonCommutativeSymmetricFunctions(QQ).complete()
697
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
698
+ sage: S.duality_pairing_matrix(F, 3)
699
+ [1 1 1 1]
700
+ [0 1 0 1]
701
+ [0 0 1 1]
702
+ [0 0 0 1]
703
+
704
+ A base case test::
705
+
706
+ sage: R.duality_pairing_matrix(M,0)
707
+ [1]
708
+ """
709
+ from sage.matrix.constructor import matrix
710
+ # TODO: generalize to keys indexing the basis of the graded component
711
+ from sage.combinat.composition import Compositions
712
+ return matrix(self.base_ring(),
713
+ [[self.duality_pairing(self[I], basis[J])
714
+ for J in Compositions(degree)]
715
+ for I in Compositions(degree)])
716
+
717
+ def counit_on_basis(self, I):
718
+ r"""
719
+ The counit is defined by sending all elements of positive degree to zero.
720
+
721
+ EXAMPLES::
722
+
723
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
724
+ sage: S.counit_on_basis([1,3])
725
+ 0
726
+ sage: M = QuasiSymmetricFunctions(QQ).M()
727
+ sage: M.counit_on_basis([1,3])
728
+ 0
729
+
730
+ TESTS::
731
+
732
+ sage: S.counit_on_basis([])
733
+ 1
734
+ sage: S.counit_on_basis(Composition([]))
735
+ 1
736
+ sage: M.counit_on_basis([])
737
+ 1
738
+ sage: M.counit_on_basis(Composition([]))
739
+ 1
740
+ """
741
+ if I:
742
+ return self.base_ring().zero()
743
+ else:
744
+ return self.base_ring().one()
745
+
746
+ def degree_negation(self, element):
747
+ r"""
748
+ Return the image of ``element`` under the degree negation
749
+ automorphism of ``self``.
750
+
751
+ The degree negation is the automorphism which scales every
752
+ homogeneous element of degree `k` by `(-1)^k` (for all `k`).
753
+
754
+ INPUT:
755
+
756
+ - ``element`` -- element of ``self``
757
+
758
+ EXAMPLES::
759
+
760
+ sage: NSym = NonCommutativeSymmetricFunctions(ZZ)
761
+ sage: S = NSym.S()
762
+ sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]]
763
+ sage: S.degree_negation(f)
764
+ -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1]
765
+
766
+ sage: QSym = QuasiSymmetricFunctions(QQ)
767
+ sage: dI = QSym.dualImmaculate()
768
+ sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1]
769
+ sage: dI.degree_negation(f)
770
+ -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
771
+
772
+ TESTS:
773
+
774
+ Using :meth:`degree_negation` on an element of a different
775
+ basis works correctly::
776
+
777
+ sage: NSym = NonCommutativeSymmetricFunctions(QQ)
778
+ sage: S = NSym.S()
779
+ sage: Phi = NSym.Phi()
780
+ sage: S.degree_negation(Phi[2])
781
+ -S[1, 1] + 2*S[2]
782
+ sage: S.degree_negation(Phi[3])
783
+ -S[1, 1, 1] + 3/2*S[1, 2] + 3/2*S[2, 1] - 3*S[3]
784
+ sage: Phi.degree_negation(S[3])
785
+ -1/6*Phi[1, 1, 1] - 1/4*Phi[1, 2] - 1/4*Phi[2, 1] - 1/3*Phi[3]
786
+
787
+ The zero element behaves well::
788
+
789
+ sage: a = Phi.degree_negation(S.zero()); a
790
+ 0
791
+ sage: parent(a)
792
+ Non-Commutative Symmetric Functions over the Rational Field in the Phi basis
793
+
794
+ .. TODO::
795
+
796
+ Generalize this to all graded vector spaces?
797
+ """
798
+ return self.sum_of_terms([ (lam, (-1)**(sum(lam) % 2) * a)
799
+ for lam, a in self(element) ],
800
+ distinct=True)
801
+
802
+ class ElementMethods:
803
+
804
+ def degree_negation(self):
805
+ r"""
806
+ Return the image of ``self`` under the degree negation
807
+ automorphism of the parent of ``self``.
808
+
809
+ The degree negation is the automorphism which scales every
810
+ homogeneous element of degree `k` by `(-1)^k` (for all `k`).
811
+
812
+ Calling ``degree_negation(self)`` is equivalent to calling
813
+ ``self.parent().degree_negation(self)``.
814
+
815
+ EXAMPLES::
816
+
817
+ sage: NSym = NonCommutativeSymmetricFunctions(ZZ)
818
+ sage: S = NSym.S()
819
+ sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]]
820
+ sage: f.degree_negation()
821
+ -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1]
822
+
823
+ sage: QSym = QuasiSymmetricFunctions(QQ)
824
+ sage: dI = QSym.dualImmaculate()
825
+ sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1]
826
+ sage: f.degree_negation()
827
+ -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
828
+
829
+ TESTS:
830
+
831
+ The zero element behaves well::
832
+
833
+ sage: a = S.zero().degree_negation(); a
834
+ 0
835
+ sage: parent(a)
836
+ Non-Commutative Symmetric Functions over the Integer Ring in the Complete basis
837
+
838
+ .. TODO::
839
+
840
+ Generalize this to all graded vector spaces?
841
+ """
842
+ return self.parent().sum_of_terms([ (lam, (-1)**(sum(lam) % 2) * a)
843
+ for lam, a in self ],
844
+ distinct=True)
845
+
846
+ def duality_pairing(self, y):
847
+ r"""
848
+ The duality pairing between elements of `NSym` and elements
849
+ of `QSym`.
850
+
851
+ The complete basis is dual to the monomial basis with respect
852
+ to this pairing.
853
+
854
+ INPUT:
855
+
856
+ - ``y`` -- an element of the dual Hopf algebra of ``self``
857
+
858
+ OUTPUT: the result of pairing ``self`` with ``y``
859
+
860
+ EXAMPLES::
861
+
862
+ sage: R = NonCommutativeSymmetricFunctions(QQ).Ribbon()
863
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
864
+ sage: R[1,1,2].duality_pairing(F[1,1,2])
865
+ 1
866
+ sage: R[1,2,1].duality_pairing(F[1,1,2])
867
+ 0
868
+
869
+ ::
870
+
871
+ sage: L = NonCommutativeSymmetricFunctions(QQ).Elementary()
872
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
873
+ sage: L[1,2].duality_pairing(F[1,2])
874
+ 0
875
+ sage: L[1,1,1].duality_pairing(F[1,2])
876
+ 1
877
+ """
878
+ return self.parent().duality_pairing(self, y)
879
+
880
+ def skew_by(self, y, side='left'):
881
+ r"""
882
+ The operation which is dual to multiplication by ``y``, where ``y``
883
+ is an element of the dual space of ``self``.
884
+
885
+ This is calculated through the coproduct of ``self`` and the
886
+ expansion of ``y`` in the dual basis.
887
+
888
+ INPUT:
889
+
890
+ - ``y`` -- an element of the dual Hopf algebra of ``self``
891
+ - ``side`` -- (default: ``'left'``) either ``'left'`` or ``'right'``
892
+
893
+ OUTPUT: the result of skewing ``self`` by ``y``, on the side ``side``
894
+
895
+ EXAMPLES:
896
+
897
+ Skewing an element of NCSF by an element of QSym::
898
+
899
+ sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon()
900
+ sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
901
+ sage: R([2,2,2]).skew_by(F[1,1])
902
+ R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4]
903
+ sage: R([2,2,2]).skew_by(F[2])
904
+ R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
905
+
906
+ Skewing an element of QSym by an element of NCSF::
907
+
908
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
909
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
910
+ sage: F = QuasiSymmetricFunctions(QQ).F()
911
+ sage: F[3,2].skew_by(R[1,1])
912
+ 0
913
+ sage: F[3,2].skew_by(R[1,1], side='right')
914
+ 0
915
+ sage: F[3,2].skew_by(S[1,1,1], side='right')
916
+ F[2]
917
+ sage: F[3,2].skew_by(S[1,2], side='right')
918
+ F[2]
919
+ sage: F[3,2].skew_by(S[2,1], side='right')
920
+ 0
921
+ sage: F[3,2].skew_by(S[1,1,1])
922
+ F[2]
923
+ sage: F[3,2].skew_by(S[1,1])
924
+ F[1, 2]
925
+ sage: F[3,2].skew_by(S[1])
926
+ F[2, 2]
927
+
928
+ ::
929
+
930
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
931
+ sage: R = NonCommutativeSymmetricFunctions(QQ).R()
932
+ sage: M = QuasiSymmetricFunctions(QQ).M()
933
+ sage: M[3,2].skew_by(S[2])
934
+ 0
935
+ sage: M[3,2].skew_by(S[2], side='right')
936
+ M[3]
937
+ sage: M[3,2].skew_by(S[3])
938
+ M[2]
939
+ sage: M[3,2].skew_by(S[3], side='right')
940
+ 0
941
+ """
942
+ return self.parent().skew(self, y, side=side)
943
+
944
+ def degree(self):
945
+ """
946
+ The maximum of the degrees of the homogeneous summands.
947
+
948
+ .. SEEALSO:: :meth:`~sage.categories.graded_algebras_with_basis.GradedAlgebrasWithBasis.ElementMethods.homogeneous_degree`
949
+
950
+ EXAMPLES::
951
+
952
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
953
+ sage: (x, y) = (S[2], S[3])
954
+ sage: x.degree()
955
+ 2
956
+ sage: (x^3 + 4*y^2).degree()
957
+ 6
958
+ sage: ((1 + x)^3).degree()
959
+ 6
960
+
961
+ ::
962
+
963
+ sage: F = QuasiSymmetricFunctions(QQ).F()
964
+ sage: (x, y) = (F[2], F[3])
965
+ sage: x.degree()
966
+ 2
967
+ sage: (x^3 + 4*y^2).degree()
968
+ 6
969
+ sage: ((1 + x)^3).degree()
970
+ 6
971
+
972
+ TESTS::
973
+
974
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
975
+ sage: S.zero().degree()
976
+ Traceback (most recent call last):
977
+ ...
978
+ ValueError: the zero element does not have a well-defined degree
979
+ sage: F = QuasiSymmetricFunctions(QQ).F()
980
+ sage: F.zero().degree()
981
+ Traceback (most recent call last):
982
+ ...
983
+ ValueError: the zero element does not have a well-defined degree
984
+ """
985
+ return self.maximal_degree()
986
+
987
+
988
+ class AlgebraMorphism(ModuleMorphismByLinearity): # Find a better name
989
+ """
990
+ A class for algebra morphism defined on a free algebra from the image of the generators
991
+ """
992
+
993
+ def __init__(self, domain, on_generators, position=0, codomain=None, category=None, anti=False):
994
+ """
995
+ Given a map on the multiplicative basis of a free algebra, this method
996
+ returns the algebra morphism that is the linear extension of its image
997
+ on generators.
998
+
999
+ INPUT:
1000
+
1001
+ - ``domain`` -- an algebra with a multiplicative basis
1002
+ - ``on_generators`` -- a function defined on the index set of the generators
1003
+ - ``codomain`` -- the codomain
1004
+ - ``position`` -- integer (default: 0)
1005
+ - ``category`` -- a category (default: ``None``)
1006
+ - ``anti`` -- boolean (default: ``False``)
1007
+
1008
+ OUTPUT: module morphism
1009
+
1010
+ EXAMPLES:
1011
+
1012
+ We construct explicitly an algebra morphism::
1013
+
1014
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import AlgebraMorphism
1015
+ sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
1016
+ sage: Psi = NCSF.Psi()
1017
+ sage: f = AlgebraMorphism(Psi, attrcall('conjugate'), codomain=Psi)
1018
+ sage: f
1019
+ Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Psi basis
1020
+
1021
+ Usually, however, one constructs algebra morphisms
1022
+ using the ``algebra_morphism`` method for an algebra::
1023
+
1024
+ sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
1025
+ sage: Psi = NCSF.Psi()
1026
+ sage: def double(i) : return Psi[i,i]
1027
+ sage: f = Psi.algebra_morphism(double, codomain = Psi)
1028
+ sage: f
1029
+ Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Psi basis
1030
+ sage: f(2*Psi[[]] + 3 * Psi[1,3,2] + Psi[2,4] )
1031
+ 2*Psi[] + 3*Psi[1, 1, 3, 3, 2, 2] + Psi[2, 2, 4, 4]
1032
+ sage: f.category()
1033
+ Category of endsets of unital magmas and right modules over Rational Field and left modules over Rational Field
1034
+
1035
+ When extra properties about the morphism are known, one
1036
+ can specify the category of which it is a morphism::
1037
+
1038
+ sage: def negate(i): return -Psi[i]
1039
+ sage: f = Psi.algebra_morphism(negate, codomain = Psi, category = GradedHopfAlgebrasWithBasis(QQ))
1040
+ sage: f
1041
+ Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Psi basis
1042
+ sage: f(2*Psi[[]] + 3 * Psi[1,3,2] + Psi[2,4] )
1043
+ 2*Psi[] - 3*Psi[1, 3, 2] + Psi[2, 4]
1044
+ sage: f.category()
1045
+ Category of endsets of Hopf algebras over Rational Field and graded modules over Rational Field
1046
+
1047
+ If ``anti`` is true, this returns an anti-algebra morphism::
1048
+
1049
+ sage: f = Psi.algebra_morphism(double, codomain = Psi, anti=True)
1050
+ sage: f
1051
+ Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Psi basis
1052
+ sage: f(2*Psi[[]] + 3 * Psi[1,3,2] + Psi[2,4] )
1053
+ 2*Psi[] + 3*Psi[2, 2, 3, 3, 1, 1] + Psi[4, 4, 2, 2]
1054
+ sage: f.category()
1055
+ Category of endsets of modules with basis over Rational Field
1056
+
1057
+ TESTS::
1058
+
1059
+ sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
1060
+ sage: Phi = NonCommutativeSymmetricFunctions(QQ).Phi()
1061
+ sage: f = Psi.algebra_morphism(Phi.antipode_on_generators, codomain=Phi)
1062
+ sage: f(Psi[1, 2, 2, 1])
1063
+ Phi[1, 2, 2, 1]
1064
+ sage: f(Psi[3, 1, 2])
1065
+ -Phi[3, 1, 2]
1066
+ sage: f.__class__
1067
+ <class 'sage.combinat.ncsf_qsym.generic_basis_code.AlgebraMorphism_with_category'>
1068
+ sage: TestSuite(f).run(skip=['_test_nonzero_equal'])
1069
+ """
1070
+ assert position == 0
1071
+ assert codomain is not None
1072
+ if category is None:
1073
+ if anti:
1074
+ category = ModulesWithBasis(domain.base_ring())
1075
+ else:
1076
+ category = AlgebrasWithBasis(domain.base_ring())
1077
+ self._anti = anti
1078
+ self._on_generators = on_generators
1079
+ ModuleMorphismByLinearity.__init__(self, domain=domain,
1080
+ codomain=codomain,
1081
+ position=position,
1082
+ category=category)
1083
+
1084
+ def __eq__(self, other):
1085
+ """
1086
+ Check equality.
1087
+
1088
+ EXAMPLES::
1089
+
1090
+ sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
1091
+ sage: Phi = NonCommutativeSymmetricFunctions(QQ).Phi()
1092
+ sage: f = Psi.algebra_morphism(Phi.antipode_on_generators, codomain=Phi)
1093
+ sage: g = Psi.algebra_morphism(Phi.antipode_on_generators, codomain=Phi)
1094
+ sage: f == g
1095
+ True
1096
+ sage: f is g
1097
+ False
1098
+ """
1099
+ return (self.__class__ is other.__class__ and self.parent() == other.parent()
1100
+ and self._zero == other._zero
1101
+ and self._on_generators == other._on_generators
1102
+ and self._position == other._position
1103
+ and self._is_module_with_basis_over_same_base_ring
1104
+ == other._is_module_with_basis_over_same_base_ring)
1105
+
1106
+ def __ne__(self, other):
1107
+ """
1108
+ Check equality.
1109
+
1110
+ EXAMPLES::
1111
+
1112
+ sage: Psi = NonCommutativeSymmetricFunctions(QQ).Psi()
1113
+ sage: Phi = NonCommutativeSymmetricFunctions(QQ).Phi()
1114
+ sage: f = Psi.algebra_morphism(Phi.antipode_on_generators, codomain=Phi)
1115
+ sage: g = Psi.algebra_morphism(Phi.antipode_on_generators, codomain=Phi)
1116
+ sage: f != g
1117
+ False
1118
+ sage: h = Phi.algebra_morphism(Psi.antipode_on_generators, codomain=Psi)
1119
+ sage: f != h
1120
+ True
1121
+ """
1122
+ return not (self == other)
1123
+
1124
+ def _on_basis(self, c):
1125
+ r"""
1126
+ Compute the image of this morphism on the basis element indexed by
1127
+ ``c``.
1128
+
1129
+ INPUT:
1130
+
1131
+ - ``c`` -- an iterable that spits out generators
1132
+
1133
+ OUTPUT: element of the codomain
1134
+
1135
+ EXAMPLES::
1136
+
1137
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import AlgebraMorphism
1138
+ sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
1139
+ sage: Psi = NCSF.Psi()
1140
+ sage: Phi = NCSF.Phi()
1141
+ sage: f = AlgebraMorphism(Psi, lambda i : Phi[i,i], codomain=Phi)
1142
+ sage: f._on_basis([ 3, 2 ])
1143
+ Phi[3, 3, 2, 2]
1144
+ """
1145
+ if self._anti:
1146
+ c = reversed(c)
1147
+ return self.codomain().prod(self._on_generators(i) for i in c)
1148
+
1149
+
1150
+ class GradedModulesWithInternalProduct(Category_over_base_ring):
1151
+ r"""
1152
+ Construct the class of modules with internal product. This is used to give an internal
1153
+ product structure to the non-commutative symmetric functions.
1154
+
1155
+ EXAMPLES::
1156
+
1157
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct
1158
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
1159
+ sage: R = N.ribbon()
1160
+ sage: R in GradedModulesWithInternalProduct(QQ)
1161
+ True
1162
+ """
1163
+ @cached_method
1164
+ def super_categories(self):
1165
+ """
1166
+ EXAMPLES::
1167
+
1168
+ sage: from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct
1169
+ sage: GradedModulesWithInternalProduct(ZZ).super_categories()
1170
+ [Category of graded modules over Integer Ring]
1171
+ """
1172
+ from sage.categories.graded_modules import GradedModules
1173
+ R = self.base_ring()
1174
+ return [GradedModules(R)]
1175
+
1176
+ class ParentMethods:
1177
+ @abstract_method(optional=True)
1178
+ def internal_product_on_basis(self, I, J):
1179
+ """
1180
+ The internal product of the two basis elements indexed by ``I`` and
1181
+ ``J`` (optional)
1182
+
1183
+ INPUT:
1184
+
1185
+ - ``I``, ``J`` -- compositions indexing two elements of the basis of self
1186
+
1187
+ Returns the internal product of the corresponding basis elements.
1188
+ If this method is implemented, the internal product is defined from
1189
+ it by linearity.
1190
+
1191
+ EXAMPLES::
1192
+
1193
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
1194
+ sage: S = N.complete()
1195
+ sage: S.internal_product_on_basis([2,2], [1,2,1])
1196
+ 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1]
1197
+ sage: S.internal_product_on_basis([2,2], [2,1])
1198
+ 0
1199
+ """
1200
+
1201
+ @lazy_attribute
1202
+ def internal_product(self):
1203
+ r"""
1204
+ The bilinear product inherited from the isomorphism with
1205
+ the descent algebra.
1206
+
1207
+ This is constructed by extending the method
1208
+ :meth:`internal_product_on_basis` bilinearly, if available,
1209
+ or using the method
1210
+ :meth:`~GradedModulesWithInternalProduct.Realizations.ParentMethods.internal_product_by_coercion`.
1211
+
1212
+ OUTPUT:
1213
+
1214
+ - The internal product map of the algebra the non-commutative
1215
+ symmetric functions.
1216
+
1217
+ EXAMPLES::
1218
+
1219
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
1220
+ sage: S = N.complete()
1221
+ sage: S.internal_product
1222
+ Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis
1223
+ sage: S.internal_product(S[2,2], S[1,2,1])
1224
+ 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1]
1225
+ sage: S.internal_product(S[2,2], S[1,2])
1226
+ 0
1227
+
1228
+ ::
1229
+
1230
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
1231
+ sage: R = N.ribbon()
1232
+ sage: R.internal_product
1233
+ <bound method ....internal_product_by_coercion ...>
1234
+ sage: R.internal_product_by_coercion(R[1, 1], R[1,1])
1235
+ R[2]
1236
+ sage: R.internal_product(R[2,2], R[1,2])
1237
+ 0
1238
+ """
1239
+ if self.internal_product_on_basis is not NotImplemented:
1240
+ return self.module_morphism(
1241
+ self.module_morphism(self.internal_product_on_basis,
1242
+ position=0,
1243
+ codomain=self),
1244
+ position=1)
1245
+ else:
1246
+ return self.internal_product_by_coercion
1247
+
1248
+ itensor = internal_product
1249
+ kronecker_product = internal_product
1250
+
1251
+ class ElementMethods:
1252
+ def internal_product(self, other):
1253
+ r"""
1254
+ Return the internal product of two non-commutative
1255
+ symmetric functions.
1256
+
1257
+ The internal product on the algebra of non-commutative symmetric
1258
+ functions is adjoint to the internal coproduct on the algebra of
1259
+ quasisymmetric functions with respect to the duality pairing
1260
+ between these two algebras. This means, explicitly, that any
1261
+ two non-commutative symmetric functions `f` and `g` and any
1262
+ quasi-symmetric function `h` satisfy
1263
+
1264
+ .. MATH::
1265
+
1266
+ \langle f * g, h \rangle
1267
+ = \sum_i \left\langle f, h^{\prime}_i \right\rangle
1268
+ \left\langle g, h^{\prime\prime}_i \right\rangle,
1269
+
1270
+ where we write `\Delta^{\times}(h)` as `\sum_i h^{\prime}_i
1271
+ \otimes h^{\prime\prime}_i`. Here, `f * g` denotes the internal
1272
+ product of the non-commutative symmetric functions `f` and `g`.
1273
+
1274
+ If `f` and `g` are two homogeneous elements of `NSym` having
1275
+ distinct degrees, then the internal product `f * g` is zero.
1276
+
1277
+ Explicit formulas can be given for internal products of
1278
+ elements of the complete and the Psi bases. First, the formula
1279
+ for the Complete basis ([NCSF1]_ Proposition 5.1): If `I` and
1280
+ `J` are two compositions of lengths `p` and `q`, respectively,
1281
+ then the corresponding Complete homogeneous non-commutative
1282
+ symmetric functions `S^I` and `S^J` have internal product
1283
+
1284
+ .. MATH::
1285
+
1286
+ S^I * S^J = \sum S^{\operatorname*{comp}M},
1287
+
1288
+ where the sum ranges over all `p \times q`-matrices
1289
+ `M \in \NN^{p \times q}` (with nonnegative integers as
1290
+ entries) whose row sum vector is `I` (that is, the sum of the
1291
+ entries of the `r`-th row is the `r`-th part of `I` for all
1292
+ `r`) and whose column sum vector is `J` (that is, the sum of
1293
+ all entries of the `s`-th row is the `s`-th part of `J` for
1294
+ all `s`). Here, for any `M \in \NN^{p \times q}`, we denote
1295
+ by `\operatorname*{comp}M` the composition obtained by
1296
+ reading the entries of the matrix `M` in the usual order
1297
+ (row by row, proceeding left to right in each row,
1298
+ traversing the rows from top to bottom).
1299
+
1300
+ The formula on the Psi basis ([NCSF2]_ Lemma 3.10) is more
1301
+ complicated. Let `I` and `J` be two compositions of lengths
1302
+ `p` and `q`, respectively, having the same size `|I| = |J|`.
1303
+ We denote by `\Psi^K` the element of the Psi basis
1304
+ corresponding to any composition `K`.
1305
+
1306
+ - If `p > q`, then `\Psi^I * \Psi^J` is plainly `0`.
1307
+
1308
+ - Assume that `p = q`. Let `\widetilde{\delta}_{I, J}` denote
1309
+ the integer `1` if the compositions `I` and `J` are
1310
+ permutations of each other, and the integer `0` otherwise.
1311
+ For every positive integer `i`, let `m_i` denote the number
1312
+ of parts of `I` equal to `i`. Then, `\Psi^I * \Psi^J` equals
1313
+ `\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I`.
1314
+
1315
+ - Now assume that `p < q`. Write the composition `I` as
1316
+ `I = (i_1, i_2, \ldots, i_p)`. For every nonempty
1317
+ composition `K = (k_1, k_2, \ldots, k_s)`, denote by
1318
+ `\Gamma_K` the non-commutative symmetric function
1319
+ `k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}],
1320
+ \ldots \Psi_{k_s}]`. For any subset `A` of
1321
+ `\{ 1, 2, \ldots, q \}`, let `J_A` be the composition
1322
+ obtained from `J` by removing the `r`-th parts for all
1323
+ `r \notin A` (while keeping the `r`-th parts for all
1324
+ `r \in A` in order). Then, `\Psi^I * \Psi^J` equals the
1325
+ sum of `\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots
1326
+ \Gamma_{J_{K_p}}` over all ordered set partitions
1327
+ `(K_1, K_2, \ldots, K_p)` of `\{ 1, 2, \ldots, q \}`
1328
+ into `p` parts such that each `1 \leq k \leq p` satisfies
1329
+ `\left\lvert J_{K_k} \right\rvert = i_k`.
1330
+ (See
1331
+ :meth:`~sage.combinat.set_partition_ordered.OrderedSetPartition`
1332
+ for the meaning of "ordered set partition".)
1333
+
1334
+ Aliases for :meth:`internal_product()` are :meth:`itensor()` and
1335
+ :meth:`kronecker_product()`.
1336
+
1337
+ INPUT:
1338
+
1339
+ - ``other`` -- another non-commutative symmetric function
1340
+
1341
+ OUTPUT:
1342
+
1343
+ - The result of taking the internal product of ``self`` with
1344
+ ``other``.
1345
+
1346
+ EXAMPLES::
1347
+
1348
+ sage: N = NonCommutativeSymmetricFunctions(QQ)
1349
+ sage: S = N.complete()
1350
+ sage: x = S.an_element(); x
1351
+ 2*S[] + 2*S[1] + 3*S[1, 1]
1352
+ sage: x.internal_product(S[2])
1353
+ 3*S[1, 1]
1354
+ sage: x.internal_product(S[1])
1355
+ 2*S[1]
1356
+ sage: S[1,2].internal_product(S[1,2])
1357
+ S[1, 1, 1] + S[1, 2]
1358
+
1359
+ Let us check the duality between the inner product and the inner
1360
+ coproduct in degree `4`::
1361
+
1362
+ sage: M = QuasiSymmetricFunctions(FiniteField(29)).M()
1363
+ sage: S = NonCommutativeSymmetricFunctions(FiniteField(29)).S()
1364
+ sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right>
1365
+ ....: result = h.base_ring().zero()
1366
+ ....: h_parent = h.parent()
1367
+ ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items():
1368
+ ....: result += coeff * f.duality_pairing(h_parent[partition_pair[0]]) * g.duality_pairing(h_parent[partition_pair[1]])
1369
+ ....: return result
1370
+ sage: def testall(n):
1371
+ ....: return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w])
1372
+ ....: for w in Compositions(n) )
1373
+ ....: for v in Compositions(n) )
1374
+ ....: for u in Compositions(n) )
1375
+ sage: testall(2)
1376
+ True
1377
+ sage: testall(3) # long time
1378
+ True
1379
+ sage: testall(4) # not tested, too long
1380
+ True
1381
+
1382
+ The internal product on the algebra of non-commutative symmetric
1383
+ functions commutes with the canonical commutative projection on
1384
+ the symmetric functions::
1385
+
1386
+ sage: S = NonCommutativeSymmetricFunctions(ZZ).S()
1387
+ sage: e = SymmetricFunctions(ZZ).e()
1388
+ sage: def int_pr_of_S_in_e(I, J):
1389
+ ....: return (S[I].internal_product(S[J])).to_symmetric_function()
1390
+ sage: all( all( int_pr_of_S_in_e(I, J)
1391
+ ....: == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function())
1392
+ ....: for I in Compositions(3) )
1393
+ ....: for J in Compositions(3) )
1394
+ True
1395
+ """
1396
+ return self.parent().internal_product(self, other)
1397
+
1398
+ itensor = internal_product
1399
+ kronecker_product = internal_product
1400
+
1401
+ class Realizations(RealizationsCategory):
1402
+ class ParentMethods:
1403
+ def internal_product_by_coercion(self, left, right):
1404
+ r"""
1405
+ Internal product of ``left`` and ``right``.
1406
+
1407
+ This is a default implementation that computes
1408
+ the internal product in the realization specified
1409
+ by ``self.realization_of().a_realization()``.
1410
+
1411
+ INPUT:
1412
+
1413
+ - ``left`` -- an element of the non-commutative symmetric functions
1414
+ - ``right`` -- an element of the non-commutative symmetric functions
1415
+
1416
+ OUTPUT: the internal product of ``left`` and ``right``
1417
+
1418
+ EXAMPLES::
1419
+
1420
+ sage: S = NonCommutativeSymmetricFunctions(QQ).S()
1421
+ sage: S.internal_product_by_coercion(S[2,1], S[3])
1422
+ S[2, 1]
1423
+ sage: S.internal_product_by_coercion(S[2,1], S[4])
1424
+ 0
1425
+ """
1426
+ R = self.realization_of().a_realization()
1427
+ return self(R.internal_product(R(left), R(right)))