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,667 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.graphs sage.modules
3
+ r"""
4
+ Grossman-Larson Hopf algebras
5
+
6
+ AUTHORS:
7
+
8
+ - Frédéric Chapoton (2017)
9
+ """
10
+
11
+ # ****************************************************************************
12
+ # Copyright (C) 2017 Frédéric Chapoton
13
+ #
14
+ # Distributed under the terms of the GNU General Public License (GPL)
15
+ # as published by the Free Software Foundation; either version 2 of
16
+ # the License, or (at your option) any later version.
17
+ # https://www.gnu.org/licenses/
18
+ # ****************************************************************************
19
+
20
+ from sage.categories.hopf_algebras import HopfAlgebras
21
+ from sage.combinat.free_module import CombinatorialFreeModule
22
+ from sage.combinat.words.alphabet import Alphabet
23
+ from sage.combinat.rooted_tree import (RootedTrees, RootedTree,
24
+ LabelledRootedTrees,
25
+ LabelledRootedTree)
26
+ from sage.categories.rings import Rings
27
+ from sage.sets.family import Family
28
+ from sage.rings.integer_ring import ZZ
29
+ from itertools import combinations, product
30
+
31
+ # we use a fixed special symbol for the fake root
32
+ ROOT = '#'
33
+
34
+
35
+ class GrossmanLarsonAlgebra(CombinatorialFreeModule):
36
+ r"""
37
+ The Grossman-Larson Hopf Algebra.
38
+
39
+ The Grossman-Larson Hopf Algebras are Hopf algebras with a basis
40
+ indexed by forests of decorated rooted trees. They are the
41
+ universal enveloping algebras of free pre-Lie algebras, seen
42
+ as Lie algebras.
43
+
44
+ The Grossman-Larson Hopf algebra on a given set `E` has an
45
+ explicit description using rooted forests. The underlying vector
46
+ space has a basis indexed by finite rooted forests endowed with a
47
+ map from their vertices to `E` (called the "labeling").
48
+ In this basis, the product of two
49
+ (decorated) rooted forests `S * T` is a sum over all maps from
50
+ the set of roots of `T` to the union of a singleton `\{\#\}` and
51
+ the set of vertices of `S`. Given such a map, one defines a new
52
+ forest as follows. Starting from the disjoint union of all rooted trees
53
+ of `S` and `T`, one adds an edge from every root of `T` to its
54
+ image when this image is not the fake vertex labelled ``#``.
55
+ The coproduct sends a rooted forest `T` to the sum of all tensors
56
+ `T_1 \otimes T_2` obtained by splitting the connected components
57
+ of `T` into two subsets and letting `T_1` be the forest formed
58
+ by the first subset and `T_2` the forest formed by the second.
59
+ This yields a connected graded Hopf algebra (the degree of a
60
+ forest is its number of vertices).
61
+
62
+ See [Pana2002]_ (Section 2) and [GroLar1]_.
63
+ (Note that both references use rooted trees rather than rooted
64
+ forests, so think of each rooted forest grafted onto a new root.
65
+ Also, the product is reversed, so they are defining the opposite
66
+ algebra structure.)
67
+
68
+ .. WARNING::
69
+
70
+ For technical reasons, instead of using forests as labels for
71
+ the basis, we use rooted trees. Their root vertex should be
72
+ considered as a fake vertex. This fake root vertex is labelled
73
+ ``'#'`` when labels are present.
74
+
75
+ EXAMPLES::
76
+
77
+ sage: G = algebras.GrossmanLarson(QQ, 'xy')
78
+ sage: x, y = G.single_vertex_all()
79
+ sage: ascii_art(x*y)
80
+ B + B
81
+ # #_
82
+ | / /
83
+ x x y
84
+ |
85
+ y
86
+
87
+ sage: ascii_art(x*x*x)
88
+ B + B + 3*B + B
89
+ # # #_ _#__
90
+ | | / / / / /
91
+ x x_ x x x x x
92
+ | / / |
93
+ x x x x
94
+ |
95
+ x
96
+
97
+ The Grossman-Larson algebra is associative::
98
+
99
+ sage: z = x * y
100
+ sage: x * (y * z) == (x * y) * z
101
+ True
102
+
103
+ It is not commutative::
104
+
105
+ sage: x * y == y * x
106
+ False
107
+
108
+ When ``None`` is given as input, unlabelled forests are used instead;
109
+ this corresponds to a `1`-element set `E`::
110
+
111
+ sage: G = algebras.GrossmanLarson(QQ, None)
112
+ sage: x = G.single_vertex_all()[0]
113
+ sage: ascii_art(x*x)
114
+ B + B
115
+ o o_
116
+ | / /
117
+ o o o
118
+ |
119
+ o
120
+
121
+ .. NOTE::
122
+
123
+ Variables names can be ``None``, a list of strings, a string
124
+ or an integer. When ``None`` is given, unlabelled rooted
125
+ forests are used. When a single string is given, each letter is taken
126
+ as a variable. See
127
+ :func:`sage.combinat.words.alphabet.build_alphabet`.
128
+
129
+ .. WARNING::
130
+
131
+ Beware that the underlying combinatorial free module is based
132
+ either on ``RootedTrees`` or on ``LabelledRootedTrees``, with no
133
+ restriction on the labellings. This means that all code calling
134
+ the :meth:`basis` method would not give meaningful results, since
135
+ :meth:`basis` returns many "chaff" elements that do not belong to
136
+ the algebra.
137
+
138
+ REFERENCES:
139
+
140
+ - [Pana2002]_
141
+
142
+ - [GroLar1]_
143
+ """
144
+ @staticmethod
145
+ def __classcall_private__(cls, R, names=None):
146
+ """
147
+ Normalize input to ensure a unique representation.
148
+
149
+ EXAMPLES::
150
+
151
+ sage: F1 = algebras.GrossmanLarson(QQ, 'xyz')
152
+ sage: F2 = algebras.GrossmanLarson(QQ, ['x','y','z'])
153
+ sage: F3 = algebras.GrossmanLarson(QQ, Alphabet('xyz'))
154
+ sage: F1 is F2 and F1 is F3
155
+ True
156
+ """
157
+ if names is not None:
158
+ if names not in ZZ and ',' in names:
159
+ names = [u for u in names if u != ',']
160
+ names = Alphabet(names)
161
+
162
+ if R not in Rings():
163
+ raise TypeError("argument R must be a ring")
164
+ return super().__classcall__(cls, R, names)
165
+
166
+ def __init__(self, R, names=None):
167
+ """
168
+ Initialize ``self``.
169
+
170
+ TESTS::
171
+
172
+ sage: A = algebras.GrossmanLarson(QQ, '@'); A
173
+ Grossman-Larson Hopf algebra on one generator ['@']
174
+ over Rational Field
175
+ sage: TestSuite(A).run() # long time
176
+
177
+ sage: F = algebras.GrossmanLarson(QQ, 'xy')
178
+ sage: TestSuite(F).run() # long time
179
+
180
+ sage: A = algebras.GrossmanLarson(QQ, None); A
181
+ Grossman-Larson Hopf algebra on one generator ['o'] over
182
+ Rational Field
183
+
184
+ sage: F = algebras.GrossmanLarson(QQ, ['x','y']); F
185
+ Grossman-Larson Hopf algebra on 2 generators ['x', 'y']
186
+ over Rational Field
187
+
188
+ sage: A = algebras.GrossmanLarson(QQ, []); A
189
+ Grossman-Larson Hopf algebra on 0 generators [] over
190
+ Rational Field
191
+ """
192
+ if names is None:
193
+ Trees = RootedTrees()
194
+ key = RootedTree.sort_key
195
+ self._alphabet = Alphabet(['o'])
196
+ else:
197
+ Trees = LabelledRootedTrees()
198
+ key = LabelledRootedTree.sort_key
199
+ self._alphabet = names
200
+ # Here one would need LabelledRootedTrees(names)
201
+ # so that one can restrict the labels to some fixed set
202
+
203
+ cat = HopfAlgebras(R).WithBasis().Graded()
204
+ CombinatorialFreeModule.__init__(self, R, Trees,
205
+ latex_prefix='',
206
+ sorting_key=key,
207
+ category=cat)
208
+
209
+ def variable_names(self):
210
+ r"""
211
+ Return the names of the variables.
212
+
213
+ This returns the set `E` (as a family).
214
+
215
+ EXAMPLES::
216
+
217
+ sage: R = algebras.GrossmanLarson(QQ, 'xy')
218
+ sage: R.variable_names()
219
+ {'x', 'y'}
220
+
221
+ sage: R = algebras.GrossmanLarson(QQ, ['a','b'])
222
+ sage: R.variable_names()
223
+ {'a', 'b'}
224
+
225
+ sage: R = algebras.GrossmanLarson(QQ, 2)
226
+ sage: R.variable_names()
227
+ {0, 1}
228
+
229
+ sage: R = algebras.GrossmanLarson(QQ, None)
230
+ sage: R.variable_names()
231
+ {'o'}
232
+ """
233
+ return self._alphabet
234
+
235
+ def _repr_(self):
236
+ """
237
+ Return the string representation of ``self``.
238
+
239
+ EXAMPLES::
240
+
241
+ sage: algebras.GrossmanLarson(QQ, '@') # indirect doctest
242
+ Grossman-Larson Hopf algebra on one generator ['@'] over Rational Field
243
+ sage: algebras.GrossmanLarson(QQ, None) # indirect doctest
244
+ Grossman-Larson Hopf algebra on one generator ['o'] over Rational Field
245
+ sage: algebras.GrossmanLarson(QQ, ['a','b'])
246
+ Grossman-Larson Hopf algebra on 2 generators ['a', 'b'] over Rational Field
247
+ """
248
+ n = len(self.single_vertex_all())
249
+ if n == 1:
250
+ gen = "one generator"
251
+ else:
252
+ gen = "{} generators".format(n)
253
+ s = "Grossman-Larson Hopf algebra on {} {} over {}"
254
+ try:
255
+ return s.format(gen, self._alphabet.list(), self.base_ring())
256
+ except NotImplementedError:
257
+ return s.format(gen, self._alphabet, self.base_ring())
258
+
259
+ def single_vertex(self, i):
260
+ r"""
261
+ Return the ``i``-th rooted forest with one vertex.
262
+
263
+ This is the rooted forest with just one vertex, labelled by the
264
+ ``i``-th element of the label list.
265
+
266
+ .. SEEALSO:: :meth:`single_vertex_all`.
267
+
268
+ INPUT:
269
+
270
+ - ``i`` -- nonnegative integer
271
+
272
+ EXAMPLES::
273
+
274
+ sage: F = algebras.GrossmanLarson(ZZ, 'xyz')
275
+ sage: F.single_vertex(0)
276
+ B[#[x[]]]
277
+
278
+ sage: F.single_vertex(4)
279
+ Traceback (most recent call last):
280
+ ...
281
+ IndexError: argument i (= 4) must be between 0 and 2
282
+ """
283
+ G = self.single_vertex_all()
284
+ n = len(G)
285
+ if i < 0 or not i < n:
286
+ m = "argument i (= {}) must be between 0 and {}".format(i, n - 1)
287
+ raise IndexError(m)
288
+ return G[i]
289
+
290
+ def single_vertex_all(self):
291
+ """
292
+ Return the rooted forests with one vertex in ``self``.
293
+
294
+ They freely generate the Lie algebra of primitive elements
295
+ as a pre-Lie algebra.
296
+
297
+ .. SEEALSO:: :meth:`single_vertex`.
298
+
299
+ EXAMPLES::
300
+
301
+ sage: A = algebras.GrossmanLarson(ZZ, 'fgh')
302
+ sage: A.single_vertex_all()
303
+ (B[#[f[]]], B[#[g[]]], B[#[h[]]])
304
+
305
+ sage: A = algebras.GrossmanLarson(QQ, ['x1','x2'])
306
+ sage: A.single_vertex_all()
307
+ (B[#[x1[]]], B[#[x2[]]])
308
+
309
+ sage: A = algebras.GrossmanLarson(ZZ, None)
310
+ sage: A.single_vertex_all()
311
+ (B[[[]]],)
312
+ """
313
+ Trees = self.basis().keys()
314
+ return tuple(Family(self._alphabet,
315
+ lambda a: self.monomial(Trees([Trees([], a)], ROOT))))
316
+
317
+ def _first_ngens(self, n):
318
+ """
319
+ Return the first generators.
320
+
321
+ EXAMPLES::
322
+
323
+ sage: A = algebras.GrossmanLarson(QQ, ['x1','x2'])
324
+ sage: A._first_ngens(2)
325
+ (B[#[x1[]]], B[#[x2[]]])
326
+
327
+ sage: A = algebras.GrossmanLarson(ZZ, None)
328
+ sage: A._first_ngens(1)
329
+ (B[[[]]],)
330
+ """
331
+ return self.single_vertex_all()[:n]
332
+
333
+ def change_ring(self, R):
334
+ """
335
+ Return the Grossman-Larson algebra in the same variables over `R`.
336
+
337
+ INPUT:
338
+
339
+ - ``R`` -- a ring
340
+
341
+ EXAMPLES::
342
+
343
+ sage: A = algebras.GrossmanLarson(ZZ, 'fgh')
344
+ sage: A.change_ring(QQ)
345
+ Grossman-Larson Hopf algebra on 3 generators ['f', 'g', 'h']
346
+ over Rational Field
347
+ """
348
+ return GrossmanLarsonAlgebra(R, names=self.variable_names())
349
+
350
+ def degree_on_basis(self, t):
351
+ """
352
+ Return the degree of a rooted forest in the Grossman-Larson algebra.
353
+
354
+ This is the total number of vertices of the forest.
355
+
356
+ EXAMPLES::
357
+
358
+ sage: A = algebras.GrossmanLarson(QQ, '@')
359
+ sage: RT = A.basis().keys()
360
+ sage: A.degree_on_basis(RT([RT([])]))
361
+ 1
362
+ """
363
+ return t.node_number() - 1
364
+
365
+ def _an_element_(self):
366
+ """
367
+ Return an element of ``self``.
368
+
369
+ EXAMPLES::
370
+
371
+ sage: A = algebras.GrossmanLarson(QQ, 'xy')
372
+ sage: A.an_element()
373
+ B[#[x[]]] + 2*B[#[x[x[]]]] + 2*B[#[x[], x[]]]
374
+ """
375
+ o = self.single_vertex(0)
376
+ return o + 2 * o * o
377
+
378
+ def some_elements(self):
379
+ """
380
+ Return some elements of the Grossman-Larson Hopf algebra.
381
+
382
+ EXAMPLES::
383
+
384
+ sage: A = algebras.GrossmanLarson(QQ, None)
385
+ sage: A.some_elements()
386
+ [B[[[]]], B[[]] + B[[[[]]]] + B[[[], []]],
387
+ 4*B[[[[]]]] + 4*B[[[], []]]]
388
+
389
+ With several generators::
390
+
391
+ sage: A = algebras.GrossmanLarson(QQ, 'xy')
392
+ sage: A.some_elements()
393
+ [B[#[x[]]],
394
+ B[#[]] + B[#[x[x[]]]] + B[#[x[], x[]]],
395
+ B[#[x[x[]]]] + 3*B[#[x[y[]]]] + B[#[x[], x[]]] + 3*B[#[x[], y[]]]]
396
+ """
397
+ o = self.single_vertex(0)
398
+ o1 = self.single_vertex_all()[-1]
399
+ x = o * o
400
+ y = o * o1
401
+ return [o, 1 + x, x + 3 * y]
402
+
403
+ def product_on_basis(self, x, y):
404
+ """
405
+ Return the product of two forests `x` and `y`.
406
+
407
+ This is the sum over all possible ways for the components
408
+ of the forest `y` to either fall side-by-side with components
409
+ of `x` or be grafted on a vertex of `x`.
410
+
411
+ EXAMPLES::
412
+
413
+ sage: A = algebras.GrossmanLarson(QQ, None)
414
+ sage: RT = A.basis().keys()
415
+ sage: x = RT([RT([])])
416
+ sage: A.product_on_basis(x, x)
417
+ B[[[[]]]] + B[[[], []]]
418
+
419
+ Check that the product is the correct one::
420
+
421
+ sage: A = algebras.GrossmanLarson(QQ, 'uv')
422
+ sage: RT = A.basis().keys()
423
+ sage: Tu = RT([RT([],'u')],'#')
424
+ sage: Tv = RT([RT([],'v')],'#')
425
+ sage: A.product_on_basis(Tu, Tv)
426
+ B[#[u[v[]]]] + B[#[u[], v[]]]
427
+ """
428
+ return self.sum(self.basis()[x.single_graft(y, graftingFunction)]
429
+ for graftingFunction in
430
+ product(list(x.paths()), repeat=len(y)))
431
+
432
+ def one_basis(self):
433
+ """
434
+ Return the empty rooted forest.
435
+
436
+ EXAMPLES::
437
+
438
+ sage: A = algebras.GrossmanLarson(QQ, 'ab')
439
+ sage: A.one_basis()
440
+ #[]
441
+
442
+ sage: A = algebras.GrossmanLarson(QQ, None)
443
+ sage: A.one_basis()
444
+ []
445
+ """
446
+ Trees = self.basis().keys()
447
+ return Trees([], ROOT)
448
+
449
+ def coproduct_on_basis(self, x):
450
+ """
451
+ Return the coproduct of a forest.
452
+
453
+ EXAMPLES::
454
+
455
+ sage: G = algebras.GrossmanLarson(QQ,2)
456
+ sage: x, y = G.single_vertex_all()
457
+ sage: ascii_art(G.coproduct(x)) # indirect doctest
458
+ 1 # B + B # 1
459
+ # #
460
+ | |
461
+ 0 0
462
+
463
+ sage: Delta_xy = G.coproduct(y*x)
464
+ sage: ascii_art(Delta_xy) # random indirect doctest
465
+ 1 # B + 1 # B + B # B + B # 1 + B # B + B # 1
466
+ #_ # # # #_ # # #
467
+ / / | | | / / | | |
468
+ 0 1 1 0 1 0 1 1 0 1
469
+ | |
470
+ 0 0
471
+
472
+ TESTS::
473
+
474
+ sage: Delta_xy.coefficients()
475
+ [1, 1, 1, 1, 1, 1]
476
+ sage: sortkey = G.print_options()['sorting_key']
477
+ sage: doublekey = lambda tt: (sortkey(tt[0]), sortkey(tt[1]))
478
+ sage: sorted(Delta_xy.monomial_coefficients(), key=doublekey)
479
+ [(#[], #[1[0[]]]),
480
+ (#[], #[0[], 1[]]),
481
+ (#[0[]], #[1[]]),
482
+ (#[1[]], #[0[]]),
483
+ (#[1[0[]]], #[]),
484
+ (#[0[], 1[]], #[])]
485
+ """
486
+ B = self.basis()
487
+ Trees = B.keys()
488
+ subtrees = list(x)
489
+ num_subtrees = len(subtrees)
490
+ indx = list(range(num_subtrees))
491
+ return sum(B[Trees([subtrees[i] for i in S], ROOT)].tensor(
492
+ B[Trees([subtrees[i] for i in indx if i not in S], ROOT)])
493
+ for k in range(num_subtrees + 1)
494
+ for S in combinations(indx, k))
495
+
496
+ def counit_on_basis(self, x):
497
+ """
498
+ Return the counit on a basis element.
499
+
500
+ This is zero unless the forest `x` is empty.
501
+
502
+ EXAMPLES::
503
+
504
+ sage: A = algebras.GrossmanLarson(QQ, 'xy')
505
+ sage: RT = A.basis().keys()
506
+ sage: x = RT([RT([],'x')],'#')
507
+ sage: A.counit_on_basis(x)
508
+ 0
509
+ sage: A.counit_on_basis(RT([],'#'))
510
+ 1
511
+ """
512
+ if x.node_number() == 1:
513
+ return self.base_ring().one()
514
+ return self.base_ring().zero()
515
+
516
+ def antipode_on_basis(self, x):
517
+ """
518
+ Return the antipode of a forest.
519
+
520
+ EXAMPLES::
521
+
522
+ sage: G = algebras.GrossmanLarson(QQ,2)
523
+ sage: x, y = G.single_vertex_all()
524
+ sage: G.antipode(x) # indirect doctest
525
+ -B[#[0[]]]
526
+
527
+ sage: G.antipode(y*x) # indirect doctest
528
+ B[#[0[1[]]]] + B[#[0[], 1[]]]
529
+ """
530
+ B = self.basis()
531
+ Trees = B.keys()
532
+ subtrees = list(x)
533
+ if not subtrees:
534
+ return self.one()
535
+ num_subtrees = len(subtrees)
536
+ indx = list(range(num_subtrees))
537
+ return sum(- self.antipode_on_basis(Trees([subtrees[i] for i in S], ROOT))
538
+ * B[Trees([subtrees[i] for i in indx if i not in S], ROOT)]
539
+ for k in range(num_subtrees)
540
+ for S in combinations(indx, k))
541
+
542
+ def _element_constructor_(self, x):
543
+ r"""
544
+ Convert ``x`` into ``self``.
545
+
546
+ EXAMPLES::
547
+
548
+ sage: R = algebras.GrossmanLarson(QQ, 'xy')
549
+ sage: x, y = R.single_vertex_all()
550
+ sage: R(x)
551
+ B[#[x[]]]
552
+ sage: R(x+4*y)
553
+ B[#[x[]]] + 4*B[#[y[]]]
554
+
555
+ sage: Trees = R.basis().keys()
556
+ sage: R(Trees([],'#'))
557
+ B[#[]]
558
+
559
+ sage: D = algebras.GrossmanLarson(ZZ, 'xy')
560
+ sage: X, Y = D.single_vertex_all()
561
+ sage: R(X-Y).parent()
562
+ Grossman-Larson Hopf algebra on 2 generators ['x', 'y'] over Rational Field
563
+
564
+ TESTS::
565
+
566
+ sage: Trees = R.basis().keys()
567
+ sage: R(Trees([],'x'))
568
+ Traceback (most recent call last):
569
+ ...
570
+ ValueError: incorrect root label
571
+
572
+ sage: R.<x,y> = algebras.GrossmanLarson(QQ)
573
+ sage: R(x) is x
574
+ True
575
+ sage: S.<z> = algebras.GrossmanLarson(GF(3))
576
+ sage: R(z)
577
+ Traceback (most recent call last):
578
+ ...
579
+ TypeError: not able to convert this to this algebra
580
+ """
581
+ if (isinstance(x, (RootedTree, LabelledRootedTree))
582
+ and x in self.basis().keys()):
583
+ if hasattr(x, 'label') and x.label() != ROOT:
584
+ raise ValueError('incorrect root label')
585
+ return self.monomial(x)
586
+ try:
587
+ P = x.parent()
588
+ if isinstance(P, GrossmanLarsonAlgebra):
589
+ if P is self:
590
+ return x
591
+ if self._coerce_map_from_(P):
592
+ return self.element_class(self, x.monomial_coefficients())
593
+ except AttributeError:
594
+ raise TypeError('not able to convert this to this algebra')
595
+ else:
596
+ raise TypeError('not able to convert this to this algebra')
597
+ # Ok, not an element (or should not be viewed as one).
598
+
599
+ def _coerce_map_from_(self, R):
600
+ r"""
601
+ Return ``True`` if there is a coercion from ``R`` into ``self``
602
+ and ``False`` otherwise.
603
+
604
+ The things that coerce into ``self`` are
605
+
606
+ - Grossman-Larson Hopf algebras whose set `E` of labels is
607
+ a subset of the corresponding set of ``self``, and whose base
608
+ ring has a coercion map into ``self.base_ring()``
609
+
610
+ EXAMPLES::
611
+
612
+ sage: F = algebras.GrossmanLarson(GF(7), 'xyz'); F
613
+ Grossman-Larson Hopf algebra on 3 generators ['x', 'y', 'z']
614
+ over Finite Field of size 7
615
+
616
+ Elements of the Grossman-Larson Hopf algebra canonically coerce in::
617
+
618
+ sage: x, y, z = F.single_vertex_all()
619
+ sage: F.coerce(x+y) == x+y
620
+ True
621
+
622
+ The Grossman-Larson Hopf algebra over `\ZZ` on `x, y, z`
623
+ coerces in, since `\ZZ` coerces to `\GF{7}`::
624
+
625
+ sage: G = algebras.GrossmanLarson(ZZ, 'xyz')
626
+ sage: Gx,Gy,Gz = G.single_vertex_all()
627
+ sage: z = F.coerce(Gx+Gy); z
628
+ B[#[x[]]] + B[#[y[]]]
629
+ sage: z.parent() is F
630
+ True
631
+
632
+ However, `\GF{7}` does not coerce to `\ZZ`, so the Grossman-Larson
633
+ algebra over `\GF{7}` does not coerce to the one over `\ZZ`::
634
+
635
+ sage: G.coerce(y)
636
+ Traceback (most recent call last):
637
+ ...
638
+ TypeError: no canonical coercion from Grossman-Larson Hopf algebra
639
+ on 3 generators ['x', 'y', 'z'] over Finite Field of size
640
+ 7 to Grossman-Larson Hopf algebra on 3 generators ['x', 'y', 'z']
641
+ over Integer Ring
642
+
643
+ TESTS::
644
+
645
+ sage: F = algebras.GrossmanLarson(ZZ, 'xyz')
646
+ sage: G = algebras.GrossmanLarson(QQ, 'xyz')
647
+ sage: H = algebras.GrossmanLarson(ZZ, 'y')
648
+ sage: F._coerce_map_from_(G)
649
+ False
650
+ sage: G._coerce_map_from_(F)
651
+ True
652
+ sage: F._coerce_map_from_(H)
653
+ True
654
+ sage: F._coerce_map_from_(QQ)
655
+ False
656
+ sage: G._coerce_map_from_(QQ)
657
+ False
658
+ sage: F.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z'))
659
+ False
660
+ """
661
+ # Grossman-Larson algebras containing the same variables
662
+ # over any base that coerces in:
663
+ if isinstance(R, GrossmanLarsonAlgebra):
664
+ if all(x in self.variable_names() for x in R.variable_names()):
665
+ if self.base_ring().has_coerce_map_from(R.base_ring()):
666
+ return True
667
+ return False