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.
- passagemath_combinat/__init__.py +3 -0
- passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
- passagemath_combinat-10.6.42.dist-info/RECORD +400 -0
- passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
- passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
- passagemath_combinat.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_combinat.libs/libsymmetrica-81fe8739.so.3.0.0 +0 -0
- sage/algebras/affine_nil_temperley_lieb.py +263 -0
- sage/algebras/all.py +24 -0
- sage/algebras/all__sagemath_combinat.py +35 -0
- sage/algebras/askey_wilson.py +935 -0
- sage/algebras/associated_graded.py +345 -0
- sage/algebras/cellular_basis.py +350 -0
- sage/algebras/cluster_algebra.py +2766 -0
- sage/algebras/down_up_algebra.py +860 -0
- sage/algebras/free_algebra.py +1698 -0
- sage/algebras/free_algebra_element.py +345 -0
- sage/algebras/free_algebra_quotient.py +405 -0
- sage/algebras/free_algebra_quotient_element.py +295 -0
- sage/algebras/free_zinbiel_algebra.py +885 -0
- sage/algebras/hall_algebra.py +783 -0
- sage/algebras/hecke_algebras/all.py +4 -0
- sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
- sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
- sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
- sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
- sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
- sage/algebras/iwahori_hecke_algebra.py +3095 -0
- sage/algebras/jordan_algebra.py +1773 -0
- sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
- sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
- sage/algebras/lie_conformal_algebras/all.py +18 -0
- sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
- sage/algebras/lie_conformal_algebras/examples.py +43 -0
- sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
- sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
- sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
- sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
- sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
- sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
- sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
- sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
- sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
- sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
- sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
- sage/algebras/nil_coxeter_algebra.py +191 -0
- sage/algebras/q_commuting_polynomials.py +673 -0
- sage/algebras/q_system.py +608 -0
- sage/algebras/quantum_clifford.py +959 -0
- sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
- sage/algebras/quantum_groups/all.py +9 -0
- sage/algebras/quantum_groups/fock_space.py +2219 -0
- sage/algebras/quantum_groups/q_numbers.py +207 -0
- sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
- sage/algebras/quantum_groups/representations.py +591 -0
- sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
- sage/algebras/quantum_oscillator.py +623 -0
- sage/algebras/quaternion_algebra.py +20 -0
- sage/algebras/quaternion_algebra_element.py +55 -0
- sage/algebras/rational_cherednik_algebra.py +525 -0
- sage/algebras/schur_algebra.py +670 -0
- sage/algebras/shuffle_algebra.py +1011 -0
- sage/algebras/splitting_algebra.py +779 -0
- sage/algebras/tensor_algebra.py +709 -0
- sage/algebras/yangian.py +1082 -0
- sage/algebras/yokonuma_hecke_algebra.py +1018 -0
- sage/all__sagemath_combinat.py +35 -0
- sage/combinat/SJT.py +255 -0
- sage/combinat/affine_permutation.py +2405 -0
- sage/combinat/algebraic_combinatorics.py +55 -0
- sage/combinat/all.py +53 -0
- sage/combinat/all__sagemath_combinat.py +195 -0
- sage/combinat/alternating_sign_matrix.py +2063 -0
- sage/combinat/baxter_permutations.py +346 -0
- sage/combinat/bijectionist.py +3220 -0
- sage/combinat/binary_recurrence_sequences.py +1180 -0
- sage/combinat/blob_algebra.py +685 -0
- sage/combinat/catalog_partitions.py +27 -0
- sage/combinat/chas/all.py +23 -0
- sage/combinat/chas/fsym.py +1180 -0
- sage/combinat/chas/wqsym.py +2601 -0
- sage/combinat/cluster_complex.py +326 -0
- sage/combinat/colored_permutations.py +2039 -0
- sage/combinat/colored_permutations_representations.py +964 -0
- sage/combinat/composition_signed.py +142 -0
- sage/combinat/composition_tableau.py +855 -0
- sage/combinat/constellation.py +1729 -0
- sage/combinat/core.py +751 -0
- sage/combinat/counting.py +12 -0
- sage/combinat/crystals/affine.py +742 -0
- sage/combinat/crystals/affine_factorization.py +518 -0
- sage/combinat/crystals/affinization.py +331 -0
- sage/combinat/crystals/alcove_path.py +2013 -0
- sage/combinat/crystals/all.py +22 -0
- sage/combinat/crystals/bkk_crystals.py +141 -0
- sage/combinat/crystals/catalog.py +115 -0
- sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
- sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
- sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
- sage/combinat/crystals/crystals.py +257 -0
- sage/combinat/crystals/direct_sum.py +260 -0
- sage/combinat/crystals/elementary_crystals.py +1251 -0
- sage/combinat/crystals/fast_crystals.py +441 -0
- sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
- sage/combinat/crystals/generalized_young_walls.py +1076 -0
- sage/combinat/crystals/highest_weight_crystals.py +436 -0
- sage/combinat/crystals/induced_structure.py +695 -0
- sage/combinat/crystals/infinity_crystals.py +730 -0
- sage/combinat/crystals/kac_modules.py +863 -0
- sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
- sage/combinat/crystals/kyoto_path_model.py +497 -0
- sage/combinat/crystals/letters.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/crystals/letters.pxd +79 -0
- sage/combinat/crystals/letters.pyx +3056 -0
- sage/combinat/crystals/littelmann_path.py +1518 -0
- sage/combinat/crystals/monomial_crystals.py +1262 -0
- sage/combinat/crystals/multisegments.py +462 -0
- sage/combinat/crystals/mv_polytopes.py +467 -0
- sage/combinat/crystals/pbw_crystal.py +511 -0
- sage/combinat/crystals/pbw_datum.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/crystals/pbw_datum.pxd +4 -0
- sage/combinat/crystals/pbw_datum.pyx +487 -0
- sage/combinat/crystals/polyhedral_realization.py +372 -0
- sage/combinat/crystals/spins.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/crystals/spins.pxd +21 -0
- sage/combinat/crystals/spins.pyx +756 -0
- sage/combinat/crystals/star_crystal.py +290 -0
- sage/combinat/crystals/subcrystal.py +464 -0
- sage/combinat/crystals/tensor_product.py +1177 -0
- sage/combinat/crystals/tensor_product_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/crystals/tensor_product_element.pxd +35 -0
- sage/combinat/crystals/tensor_product_element.pyx +1870 -0
- sage/combinat/crystals/virtual_crystal.py +420 -0
- sage/combinat/cyclic_sieving_phenomenon.py +204 -0
- sage/combinat/debruijn_sequence.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/debruijn_sequence.pyx +355 -0
- sage/combinat/decorated_permutation.py +270 -0
- sage/combinat/degree_sequences.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/degree_sequences.pyx +588 -0
- sage/combinat/derangements.py +527 -0
- sage/combinat/descent_algebra.py +1008 -0
- sage/combinat/diagram.py +1551 -0
- sage/combinat/diagram_algebras.py +5886 -0
- sage/combinat/dyck_word.py +4349 -0
- sage/combinat/e_one_star.py +1623 -0
- sage/combinat/enumerated_sets.py +123 -0
- sage/combinat/expnums.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/expnums.pyx +148 -0
- sage/combinat/fast_vector_partitions.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/fast_vector_partitions.pyx +346 -0
- sage/combinat/fqsym.py +1977 -0
- sage/combinat/free_dendriform_algebra.py +954 -0
- sage/combinat/free_prelie_algebra.py +1141 -0
- sage/combinat/fully_commutative_elements.py +1077 -0
- sage/combinat/fully_packed_loop.py +1523 -0
- sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
- sage/combinat/gray_codes.py +311 -0
- sage/combinat/grossman_larson_algebras.py +667 -0
- sage/combinat/growth.py +4352 -0
- sage/combinat/hall_polynomial.py +188 -0
- sage/combinat/hillman_grassl.py +866 -0
- sage/combinat/integer_matrices.py +329 -0
- sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
- sage/combinat/k_tableau.py +4564 -0
- sage/combinat/kazhdan_lusztig.py +215 -0
- sage/combinat/key_polynomial.py +885 -0
- sage/combinat/knutson_tao_puzzles.py +2286 -0
- sage/combinat/lr_tableau.py +311 -0
- sage/combinat/matrices/all.py +24 -0
- sage/combinat/matrices/hadamard_matrix.py +3790 -0
- sage/combinat/matrices/latin.py +2912 -0
- sage/combinat/misc.py +401 -0
- sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
- sage/combinat/ncsf_qsym/all.py +21 -0
- sage/combinat/ncsf_qsym/combinatorics.py +317 -0
- sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
- sage/combinat/ncsf_qsym/ncsf.py +5637 -0
- sage/combinat/ncsf_qsym/qsym.py +4053 -0
- sage/combinat/ncsf_qsym/tutorial.py +447 -0
- sage/combinat/ncsym/all.py +21 -0
- sage/combinat/ncsym/bases.py +855 -0
- sage/combinat/ncsym/dual.py +593 -0
- sage/combinat/ncsym/ncsym.py +2076 -0
- sage/combinat/necklace.py +551 -0
- sage/combinat/non_decreasing_parking_function.py +634 -0
- sage/combinat/nu_dyck_word.py +1474 -0
- sage/combinat/output.py +861 -0
- sage/combinat/parallelogram_polyomino.py +4326 -0
- sage/combinat/parking_functions.py +1602 -0
- sage/combinat/partition_algebra.py +1998 -0
- sage/combinat/partition_kleshchev.py +1982 -0
- sage/combinat/partition_shifting_algebras.py +584 -0
- sage/combinat/partition_tuple.py +3114 -0
- sage/combinat/path_tableaux/all.py +13 -0
- sage/combinat/path_tableaux/catalog.py +29 -0
- sage/combinat/path_tableaux/dyck_path.py +380 -0
- sage/combinat/path_tableaux/frieze.py +476 -0
- sage/combinat/path_tableaux/path_tableau.py +728 -0
- sage/combinat/path_tableaux/semistandard.py +510 -0
- sage/combinat/perfect_matching.py +779 -0
- sage/combinat/plane_partition.py +3300 -0
- sage/combinat/q_bernoulli.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/q_bernoulli.pyx +128 -0
- sage/combinat/quickref.py +81 -0
- sage/combinat/recognizable_series.py +2051 -0
- sage/combinat/regular_sequence.py +4316 -0
- sage/combinat/regular_sequence_bounded.py +543 -0
- sage/combinat/restricted_growth.py +81 -0
- sage/combinat/ribbon.py +20 -0
- sage/combinat/ribbon_shaped_tableau.py +489 -0
- sage/combinat/ribbon_tableau.py +1180 -0
- sage/combinat/rigged_configurations/all.py +46 -0
- sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
- sage/combinat/rigged_configurations/bij_infinity.py +370 -0
- sage/combinat/rigged_configurations/bij_type_A.py +163 -0
- sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
- sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
- sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
- sage/combinat/rigged_configurations/bij_type_B.py +900 -0
- sage/combinat/rigged_configurations/bij_type_C.py +267 -0
- sage/combinat/rigged_configurations/bij_type_D.py +771 -0
- sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
- sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
- sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
- sage/combinat/rigged_configurations/bijection.py +143 -0
- sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
- sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
- sage/combinat/rigged_configurations/rc_crystal.py +461 -0
- sage/combinat/rigged_configurations/rc_infinity.py +540 -0
- sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
- sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
- sage/combinat/rigged_configurations/rigged_partition.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
- sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
- sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
- sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
- sage/combinat/rsk.py +3438 -0
- sage/combinat/schubert_polynomial.py +508 -0
- sage/combinat/set_partition.py +3318 -0
- sage/combinat/set_partition_iterator.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/set_partition_iterator.pyx +136 -0
- sage/combinat/set_partition_ordered.py +1590 -0
- sage/combinat/sf/abreu_nigro.py +346 -0
- sage/combinat/sf/all.py +52 -0
- sage/combinat/sf/character.py +576 -0
- sage/combinat/sf/classical.py +319 -0
- sage/combinat/sf/dual.py +996 -0
- sage/combinat/sf/elementary.py +549 -0
- sage/combinat/sf/hall_littlewood.py +1028 -0
- sage/combinat/sf/hecke.py +336 -0
- sage/combinat/sf/homogeneous.py +464 -0
- sage/combinat/sf/jack.py +1428 -0
- sage/combinat/sf/k_dual.py +1458 -0
- sage/combinat/sf/kfpoly.py +447 -0
- sage/combinat/sf/llt.py +789 -0
- sage/combinat/sf/macdonald.py +2019 -0
- sage/combinat/sf/monomial.py +525 -0
- sage/combinat/sf/multiplicative.py +113 -0
- sage/combinat/sf/new_kschur.py +1786 -0
- sage/combinat/sf/ns_macdonald.py +964 -0
- sage/combinat/sf/orthogonal.py +246 -0
- sage/combinat/sf/orthotriang.py +355 -0
- sage/combinat/sf/powersum.py +963 -0
- sage/combinat/sf/schur.py +880 -0
- sage/combinat/sf/sf.py +1653 -0
- sage/combinat/sf/sfa.py +7053 -0
- sage/combinat/sf/symplectic.py +253 -0
- sage/combinat/sf/witt.py +721 -0
- sage/combinat/shifted_primed_tableau.py +2735 -0
- sage/combinat/shuffle.py +830 -0
- sage/combinat/sidon_sets.py +146 -0
- sage/combinat/similarity_class_type.py +1721 -0
- sage/combinat/sine_gordon.py +618 -0
- sage/combinat/six_vertex_model.py +784 -0
- sage/combinat/skew_partition.py +2053 -0
- sage/combinat/skew_tableau.py +2989 -0
- sage/combinat/sloane_functions.py +8935 -0
- sage/combinat/specht_module.py +1403 -0
- sage/combinat/species/all.py +48 -0
- sage/combinat/species/characteristic_species.py +321 -0
- sage/combinat/species/composition_species.py +273 -0
- sage/combinat/species/cycle_species.py +284 -0
- sage/combinat/species/empty_species.py +155 -0
- sage/combinat/species/functorial_composition_species.py +148 -0
- sage/combinat/species/generating_series.py +673 -0
- sage/combinat/species/library.py +148 -0
- sage/combinat/species/linear_order_species.py +169 -0
- sage/combinat/species/misc.py +83 -0
- sage/combinat/species/partition_species.py +290 -0
- sage/combinat/species/permutation_species.py +268 -0
- sage/combinat/species/product_species.py +423 -0
- sage/combinat/species/recursive_species.py +476 -0
- sage/combinat/species/set_species.py +192 -0
- sage/combinat/species/species.py +820 -0
- sage/combinat/species/structure.py +539 -0
- sage/combinat/species/subset_species.py +243 -0
- sage/combinat/species/sum_species.py +225 -0
- sage/combinat/subword.py +564 -0
- sage/combinat/subword_complex.py +2122 -0
- sage/combinat/subword_complex_c.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/subword_complex_c.pyx +119 -0
- sage/combinat/super_tableau.py +821 -0
- sage/combinat/superpartition.py +1154 -0
- sage/combinat/symmetric_group_algebra.py +3774 -0
- sage/combinat/symmetric_group_representations.py +1830 -0
- sage/combinat/t_sequences.py +877 -0
- sage/combinat/tableau.py +9506 -0
- sage/combinat/tableau_residues.py +860 -0
- sage/combinat/tableau_tuple.py +5353 -0
- sage/combinat/tiling.py +2432 -0
- sage/combinat/triangles_FHM.py +777 -0
- sage/combinat/tutorial.py +1857 -0
- sage/combinat/vector_partition.py +337 -0
- sage/combinat/words/abstract_word.py +1722 -0
- sage/combinat/words/all.py +59 -0
- sage/combinat/words/alphabet.py +268 -0
- sage/combinat/words/finite_word.py +7201 -0
- sage/combinat/words/infinite_word.py +113 -0
- sage/combinat/words/lyndon_word.py +652 -0
- sage/combinat/words/morphic.py +351 -0
- sage/combinat/words/morphism.py +3878 -0
- sage/combinat/words/paths.py +2932 -0
- sage/combinat/words/shuffle_product.py +278 -0
- sage/combinat/words/suffix_trees.py +1873 -0
- sage/combinat/words/word.py +769 -0
- sage/combinat/words/word_char.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/words/word_char.pyx +847 -0
- sage/combinat/words/word_datatypes.cpython-314-x86_64-linux-musl.so +0 -0
- sage/combinat/words/word_datatypes.pxd +4 -0
- sage/combinat/words/word_datatypes.pyx +1067 -0
- sage/combinat/words/word_generators.py +2026 -0
- sage/combinat/words/word_infinite_datatypes.py +1218 -0
- sage/combinat/words/word_options.py +99 -0
- sage/combinat/words/words.py +2396 -0
- sage/data_structures/all__sagemath_combinat.py +1 -0
- sage/databases/all__sagemath_combinat.py +13 -0
- sage/databases/findstat.py +4897 -0
- sage/databases/oeis.py +2058 -0
- sage/databases/sloane.py +393 -0
- sage/dynamics/all__sagemath_combinat.py +14 -0
- sage/dynamics/cellular_automata/all.py +7 -0
- sage/dynamics/cellular_automata/catalog.py +34 -0
- sage/dynamics/cellular_automata/elementary.py +612 -0
- sage/dynamics/cellular_automata/glca.py +477 -0
- sage/dynamics/cellular_automata/solitons.py +1463 -0
- sage/dynamics/finite_dynamical_system.py +1249 -0
- sage/dynamics/finite_dynamical_system_catalog.py +382 -0
- sage/games/all.py +7 -0
- sage/games/hexad.py +704 -0
- sage/games/quantumino.py +591 -0
- sage/games/sudoku.py +889 -0
- sage/games/sudoku_backtrack.cpython-314-x86_64-linux-musl.so +0 -0
- sage/games/sudoku_backtrack.pyx +189 -0
- sage/groups/all__sagemath_combinat.py +1 -0
- sage/groups/indexed_free_group.py +489 -0
- sage/libs/all__sagemath_combinat.py +6 -0
- sage/libs/lrcalc/__init__.py +1 -0
- sage/libs/lrcalc/lrcalc.py +525 -0
- sage/libs/symmetrica/__init__.py +7 -0
- sage/libs/symmetrica/all.py +101 -0
- sage/libs/symmetrica/kostka.pxi +168 -0
- sage/libs/symmetrica/part.pxi +193 -0
- sage/libs/symmetrica/plet.pxi +42 -0
- sage/libs/symmetrica/sab.pxi +196 -0
- sage/libs/symmetrica/sb.pxi +332 -0
- sage/libs/symmetrica/sc.pxi +192 -0
- sage/libs/symmetrica/schur.pxi +956 -0
- sage/libs/symmetrica/symmetrica.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/symmetrica/symmetrica.pxi +1172 -0
- sage/libs/symmetrica/symmetrica.pyx +39 -0
- sage/monoids/all.py +13 -0
- sage/monoids/automatic_semigroup.py +1054 -0
- sage/monoids/free_abelian_monoid.py +315 -0
- sage/monoids/free_abelian_monoid_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/monoids/free_abelian_monoid_element.pxd +16 -0
- sage/monoids/free_abelian_monoid_element.pyx +397 -0
- sage/monoids/free_monoid.py +335 -0
- sage/monoids/free_monoid_element.py +431 -0
- sage/monoids/hecke_monoid.py +65 -0
- sage/monoids/string_monoid.py +817 -0
- sage/monoids/string_monoid_element.py +547 -0
- sage/monoids/string_ops.py +143 -0
- sage/monoids/trace_monoid.py +972 -0
- sage/rings/all__sagemath_combinat.py +2 -0
- sage/sat/all.py +4 -0
- sage/sat/boolean_polynomials.py +405 -0
- sage/sat/converters/__init__.py +6 -0
- sage/sat/converters/anf2cnf.py +14 -0
- sage/sat/converters/polybori.py +611 -0
- sage/sat/solvers/__init__.py +5 -0
- sage/sat/solvers/cryptominisat.py +287 -0
- sage/sat/solvers/dimacs.py +783 -0
- sage/sat/solvers/picosat.py +228 -0
- sage/sat/solvers/sat_lp.py +156 -0
- sage/sat/solvers/satsolver.cpython-314-x86_64-linux-musl.so +0 -0
- sage/sat/solvers/satsolver.pxd +3 -0
- sage/sat/solvers/satsolver.pyx +405 -0
|
@@ -0,0 +1,1141 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-combinat
|
|
2
|
+
# sage.doctest: needs sage.combinat sage.graphs sage.modules
|
|
3
|
+
r"""
|
|
4
|
+
Free pre-Lie algebras
|
|
5
|
+
|
|
6
|
+
AUTHORS:
|
|
7
|
+
|
|
8
|
+
- Florent Hivert, Frédéric Chapoton (2011)
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
# ****************************************************************************
|
|
12
|
+
# Copyright (C) 2010-2015 Florent Hivert <Florent.Hivert@lri.fr>,
|
|
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
|
+
from itertools import product
|
|
20
|
+
|
|
21
|
+
from sage.categories.magmatic_algebras import MagmaticAlgebras
|
|
22
|
+
from sage.categories.lie_algebras import LieAlgebras
|
|
23
|
+
from sage.categories.magmas import Magmas
|
|
24
|
+
from sage.categories.pushout import (ConstructionFunctor,
|
|
25
|
+
CompositeConstructionFunctor,
|
|
26
|
+
IdentityConstructionFunctor)
|
|
27
|
+
from sage.categories.rings import Rings
|
|
28
|
+
from sage.categories.functor import Functor
|
|
29
|
+
|
|
30
|
+
from sage.combinat.free_module import CombinatorialFreeModule
|
|
31
|
+
from sage.combinat.integer_vector import IntegerVectors
|
|
32
|
+
from sage.combinat.words.alphabet import Alphabet
|
|
33
|
+
from sage.combinat.rooted_tree import (RootedTrees, RootedTree,
|
|
34
|
+
LabelledRootedTrees,
|
|
35
|
+
LabelledRootedTree)
|
|
36
|
+
from sage.combinat.grossman_larson_algebras import GrossmanLarsonAlgebra, ROOT
|
|
37
|
+
|
|
38
|
+
from sage.misc.lazy_attribute import lazy_attribute
|
|
39
|
+
from sage.misc.cachefunc import cached_method
|
|
40
|
+
from sage.functions.other import factorial
|
|
41
|
+
|
|
42
|
+
from sage.sets.family import Family
|
|
43
|
+
from sage.structure.coerce_exceptions import CoercionException
|
|
44
|
+
from sage.rings.infinity import Infinity
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class FreePreLieAlgebra(CombinatorialFreeModule):
|
|
48
|
+
r"""
|
|
49
|
+
The free pre-Lie algebra.
|
|
50
|
+
|
|
51
|
+
Pre-Lie algebras are non-associative algebras, where the product `*`
|
|
52
|
+
satisfies
|
|
53
|
+
|
|
54
|
+
.. MATH::
|
|
55
|
+
|
|
56
|
+
(x * y) * z - x * (y * z) = (x * z) * y - x * (z * y).
|
|
57
|
+
|
|
58
|
+
We use here the convention where the associator
|
|
59
|
+
|
|
60
|
+
.. MATH::
|
|
61
|
+
|
|
62
|
+
(x, y, z) := (x * y) * z - x * (y * z)
|
|
63
|
+
|
|
64
|
+
is symmetric in its two rightmost arguments. This is sometimes called
|
|
65
|
+
a right pre-Lie algebra.
|
|
66
|
+
|
|
67
|
+
They have appeared in numerical analysis and deformation theory.
|
|
68
|
+
|
|
69
|
+
The free Pre-Lie algebra on a given set `E` has an explicit
|
|
70
|
+
description using rooted trees, just as the free associative algebra
|
|
71
|
+
can be described using words. The underlying vector space has a basis
|
|
72
|
+
indexed by finite rooted trees endowed with a map from their vertices
|
|
73
|
+
to `E`. In this basis, the product of two (decorated) rooted trees `S
|
|
74
|
+
* T` is the sum over vertices of `S` of the rooted tree obtained by
|
|
75
|
+
adding one edge from the root of `T` to the given vertex of `S`. The
|
|
76
|
+
root of these trees is taken to be the root of `S`. The free pre-Lie
|
|
77
|
+
algebra can also be considered as the free algebra over the PreLie operad.
|
|
78
|
+
|
|
79
|
+
.. WARNING::
|
|
80
|
+
|
|
81
|
+
The usual binary operator ``*`` can be used for the pre-Lie product.
|
|
82
|
+
Beware that it but must be parenthesized properly, as the pre-Lie
|
|
83
|
+
product is not associative. By default, a multiple product will be
|
|
84
|
+
taken with left parentheses.
|
|
85
|
+
|
|
86
|
+
EXAMPLES::
|
|
87
|
+
|
|
88
|
+
sage: F = algebras.FreePreLie(ZZ, 'xyz')
|
|
89
|
+
sage: x,y,z = F.gens()
|
|
90
|
+
sage: (x * y) * z
|
|
91
|
+
B[x[y[z[]]]] + B[x[y[], z[]]]
|
|
92
|
+
sage: (x * y) * z - x * (y * z) == (x * z) * y - x * (z * y)
|
|
93
|
+
True
|
|
94
|
+
|
|
95
|
+
The free pre-Lie algebra is non-associative::
|
|
96
|
+
|
|
97
|
+
sage: x * (y * z) == (x * y) * z
|
|
98
|
+
False
|
|
99
|
+
|
|
100
|
+
The default product is with left parentheses::
|
|
101
|
+
|
|
102
|
+
sage: x * y * z == (x * y) * z
|
|
103
|
+
True
|
|
104
|
+
sage: x * y * z * x == ((x * y) * z) * x
|
|
105
|
+
True
|
|
106
|
+
|
|
107
|
+
The NAP product as defined in [Liv2006]_ is also implemented on the same
|
|
108
|
+
vector space::
|
|
109
|
+
|
|
110
|
+
sage: N = F.nap_product
|
|
111
|
+
sage: N(x*y,z*z)
|
|
112
|
+
B[x[y[], z[z[]]]]
|
|
113
|
+
|
|
114
|
+
When ``None`` is given as input, unlabelled trees are used instead::
|
|
115
|
+
|
|
116
|
+
sage: F1 = algebras.FreePreLie(QQ, None)
|
|
117
|
+
sage: w = F1.gen(0); w
|
|
118
|
+
B[[]]
|
|
119
|
+
sage: w * w * w * w
|
|
120
|
+
B[[[[[]]]]] + B[[[[], []]]] + 3*B[[[], [[]]]] + B[[[], [], []]]
|
|
121
|
+
|
|
122
|
+
However, it is equally possible to use labelled trees instead::
|
|
123
|
+
|
|
124
|
+
sage: F1 = algebras.FreePreLie(QQ, 'q')
|
|
125
|
+
sage: w = F1.gen(0); w
|
|
126
|
+
B[q[]]
|
|
127
|
+
sage: w * w * w * w
|
|
128
|
+
B[q[q[q[q[]]]]] + B[q[q[q[], q[]]]] + 3*B[q[q[], q[q[]]]] + B[q[q[], q[], q[]]]
|
|
129
|
+
|
|
130
|
+
The set `E` can be infinite::
|
|
131
|
+
|
|
132
|
+
sage: F = algebras.FreePreLie(QQ, ZZ)
|
|
133
|
+
sage: w = F.gen(1); w
|
|
134
|
+
B[1[]]
|
|
135
|
+
sage: x = F.gen(2); x
|
|
136
|
+
B[-1[]]
|
|
137
|
+
sage: y = F.gen(3); y
|
|
138
|
+
B[2[]]
|
|
139
|
+
sage: w*x
|
|
140
|
+
B[1[-1[]]]
|
|
141
|
+
sage: (w*x)*y
|
|
142
|
+
B[1[-1[2[]]]] + B[1[-1[], 2[]]]
|
|
143
|
+
sage: w*(x*y)
|
|
144
|
+
B[1[-1[2[]]]]
|
|
145
|
+
|
|
146
|
+
Elements of a free pre-Lie algebra can be lifted to the universal
|
|
147
|
+
enveloping algebra of the associated Lie algebra. The universal
|
|
148
|
+
enveloping algebra is the Grossman-Larson Hopf algebra::
|
|
149
|
+
|
|
150
|
+
sage: F = algebras.FreePreLie(QQ,'abc')
|
|
151
|
+
sage: a,b,c = F.gens()
|
|
152
|
+
sage: (a*b+b*c).lift()
|
|
153
|
+
B[#[a[b[]]]] + B[#[b[c[]]]]
|
|
154
|
+
|
|
155
|
+
.. NOTE::
|
|
156
|
+
|
|
157
|
+
Variables names can be ``None``, a list of strings, a string
|
|
158
|
+
or an integer. When ``None`` is given, unlabelled rooted
|
|
159
|
+
trees are used. When a single string is given, each letter is taken
|
|
160
|
+
as a variable. See
|
|
161
|
+
:func:`sage.combinat.words.alphabet.build_alphabet`.
|
|
162
|
+
|
|
163
|
+
.. WARNING::
|
|
164
|
+
|
|
165
|
+
Beware that the underlying combinatorial free module is based
|
|
166
|
+
either on ``RootedTrees`` or on ``LabelledRootedTrees``, with no
|
|
167
|
+
restriction on the labellings. This means that all code calling
|
|
168
|
+
the :meth:`basis` method would not give meaningful results, since
|
|
169
|
+
:meth:`basis` returns many "chaff" elements that do not belong to
|
|
170
|
+
the algebra.
|
|
171
|
+
|
|
172
|
+
REFERENCES:
|
|
173
|
+
|
|
174
|
+
- [ChLi]_
|
|
175
|
+
|
|
176
|
+
- [Liv2006]_
|
|
177
|
+
"""
|
|
178
|
+
@staticmethod
|
|
179
|
+
def __classcall_private__(cls, R, names=None):
|
|
180
|
+
"""
|
|
181
|
+
Normalize input to ensure a unique representation.
|
|
182
|
+
|
|
183
|
+
EXAMPLES::
|
|
184
|
+
|
|
185
|
+
sage: F1 = algebras.FreePreLie(QQ, 'xyz')
|
|
186
|
+
sage: F2 = algebras.FreePreLie(QQ, 'x,y,z')
|
|
187
|
+
sage: F3 = algebras.FreePreLie(QQ, ['x','y','z'])
|
|
188
|
+
sage: F4 = algebras.FreePreLie(QQ, Alphabet('xyz'))
|
|
189
|
+
sage: F1 is F2 and F1 is F3 and F1 is F4
|
|
190
|
+
True
|
|
191
|
+
"""
|
|
192
|
+
if names is not None:
|
|
193
|
+
if isinstance(names, str) and ',' in names:
|
|
194
|
+
names = [u for u in names if u != ',']
|
|
195
|
+
names = Alphabet(names)
|
|
196
|
+
|
|
197
|
+
if R not in Rings():
|
|
198
|
+
raise TypeError("argument R must be a ring")
|
|
199
|
+
|
|
200
|
+
return super().__classcall__(cls, R, names)
|
|
201
|
+
|
|
202
|
+
def __init__(self, R, names=None):
|
|
203
|
+
"""
|
|
204
|
+
Initialize ``self``.
|
|
205
|
+
|
|
206
|
+
TESTS::
|
|
207
|
+
|
|
208
|
+
sage: A = algebras.FreePreLie(QQ, '@'); A
|
|
209
|
+
Free PreLie algebra on one generator ['@'] over Rational Field
|
|
210
|
+
sage: TestSuite(A).run()
|
|
211
|
+
|
|
212
|
+
sage: A = algebras.FreePreLie(QQ, None); A
|
|
213
|
+
Free PreLie algebra on one generator ['o'] over Rational Field
|
|
214
|
+
|
|
215
|
+
sage: F = algebras.FreePreLie(QQ, 'xy')
|
|
216
|
+
sage: TestSuite(F).run() # long time
|
|
217
|
+
"""
|
|
218
|
+
if names is None:
|
|
219
|
+
Trees = RootedTrees()
|
|
220
|
+
key = RootedTree.sort_key
|
|
221
|
+
self._alphabet = Alphabet(['o'])
|
|
222
|
+
else:
|
|
223
|
+
Trees = LabelledRootedTrees()
|
|
224
|
+
key = LabelledRootedTree.sort_key
|
|
225
|
+
self._alphabet = names
|
|
226
|
+
# Here one would need LabelledRootedTrees(names)
|
|
227
|
+
# so that one can restrict the labels to some fixed set
|
|
228
|
+
|
|
229
|
+
cat = MagmaticAlgebras(R).WithBasis().Graded() & LieAlgebras(R).WithBasis().Graded()
|
|
230
|
+
CombinatorialFreeModule.__init__(self, R, Trees,
|
|
231
|
+
latex_prefix='',
|
|
232
|
+
sorting_key=key,
|
|
233
|
+
category=cat)
|
|
234
|
+
|
|
235
|
+
def variable_names(self):
|
|
236
|
+
r"""
|
|
237
|
+
Return the names of the variables.
|
|
238
|
+
|
|
239
|
+
EXAMPLES::
|
|
240
|
+
|
|
241
|
+
sage: R = algebras.FreePreLie(QQ, 'xy')
|
|
242
|
+
sage: R.variable_names()
|
|
243
|
+
{'x', 'y'}
|
|
244
|
+
|
|
245
|
+
sage: R = algebras.FreePreLie(QQ, None)
|
|
246
|
+
sage: R.variable_names()
|
|
247
|
+
{'o'}
|
|
248
|
+
"""
|
|
249
|
+
return self._alphabet
|
|
250
|
+
|
|
251
|
+
def _repr_(self):
|
|
252
|
+
"""
|
|
253
|
+
Return the string representation of ``self``.
|
|
254
|
+
|
|
255
|
+
EXAMPLES::
|
|
256
|
+
|
|
257
|
+
sage: algebras.FreePreLie(QQ, '@') # indirect doctest
|
|
258
|
+
Free PreLie algebra on one generator ['@'] over Rational Field
|
|
259
|
+
|
|
260
|
+
sage: algebras.FreePreLie(QQ, ZZ) # indirect doctest
|
|
261
|
+
Free PreLie algebra on generators indexed by Integer Ring
|
|
262
|
+
over Rational Field
|
|
263
|
+
|
|
264
|
+
sage: enum = EnumeratedSets().Infinite().example()
|
|
265
|
+
sage: algebras.FreePreLie(QQ, enum) # indirect doctest
|
|
266
|
+
Free PreLie algebra on generators indexed by An example of an
|
|
267
|
+
infinite enumerated set: the nonnegative integers
|
|
268
|
+
over Rational Field
|
|
269
|
+
"""
|
|
270
|
+
n = self.algebra_generators().cardinality()
|
|
271
|
+
finite = bool(n < Infinity)
|
|
272
|
+
if not finite:
|
|
273
|
+
gen = "generators indexed by"
|
|
274
|
+
elif n == 1:
|
|
275
|
+
gen = "one generator"
|
|
276
|
+
else:
|
|
277
|
+
gen = "{} generators".format(n)
|
|
278
|
+
s = "Free PreLie algebra on {} {} over {}"
|
|
279
|
+
if finite:
|
|
280
|
+
try:
|
|
281
|
+
return s.format(gen, self._alphabet.list(), self.base_ring())
|
|
282
|
+
except NotImplementedError:
|
|
283
|
+
return s.format(gen, self._alphabet, self.base_ring())
|
|
284
|
+
else:
|
|
285
|
+
return s.format(gen, self._alphabet, self.base_ring())
|
|
286
|
+
|
|
287
|
+
def gen(self, i):
|
|
288
|
+
r"""
|
|
289
|
+
Return the ``i``-th generator of the algebra.
|
|
290
|
+
|
|
291
|
+
INPUT:
|
|
292
|
+
|
|
293
|
+
- ``i`` -- integer
|
|
294
|
+
|
|
295
|
+
EXAMPLES::
|
|
296
|
+
|
|
297
|
+
sage: F = algebras.FreePreLie(ZZ, 'xyz')
|
|
298
|
+
sage: F.gen(0)
|
|
299
|
+
B[x[]]
|
|
300
|
+
|
|
301
|
+
sage: F.gen(4)
|
|
302
|
+
Traceback (most recent call last):
|
|
303
|
+
...
|
|
304
|
+
IndexError: argument i (= 4) must be between 0 and 2
|
|
305
|
+
"""
|
|
306
|
+
G = self.algebra_generators()
|
|
307
|
+
n = G.cardinality()
|
|
308
|
+
if i < 0 or not i < n:
|
|
309
|
+
m = "argument i (= {}) must be between 0 and {}".format(i, n - 1)
|
|
310
|
+
raise IndexError(m)
|
|
311
|
+
return G[G.keys().unrank(i)]
|
|
312
|
+
|
|
313
|
+
@cached_method
|
|
314
|
+
def algebra_generators(self):
|
|
315
|
+
r"""
|
|
316
|
+
Return the generators of this algebra.
|
|
317
|
+
|
|
318
|
+
These are the rooted trees with just one vertex.
|
|
319
|
+
|
|
320
|
+
EXAMPLES::
|
|
321
|
+
|
|
322
|
+
sage: A = algebras.FreePreLie(ZZ, 'fgh'); A
|
|
323
|
+
Free PreLie algebra on 3 generators ['f', 'g', 'h']
|
|
324
|
+
over Integer Ring
|
|
325
|
+
sage: list(A.algebra_generators())
|
|
326
|
+
[B[f[]], B[g[]], B[h[]]]
|
|
327
|
+
|
|
328
|
+
sage: A = algebras.FreePreLie(QQ, ['x1','x2'])
|
|
329
|
+
sage: list(A.algebra_generators())
|
|
330
|
+
[B[x1[]], B[x2[]]]
|
|
331
|
+
"""
|
|
332
|
+
Trees = self.basis().keys()
|
|
333
|
+
return Family(self._alphabet, lambda a: self.monomial(Trees([], a)))
|
|
334
|
+
|
|
335
|
+
def change_ring(self, R):
|
|
336
|
+
"""
|
|
337
|
+
Return the free pre-Lie algebra in the same variables over `R`.
|
|
338
|
+
|
|
339
|
+
INPUT:
|
|
340
|
+
|
|
341
|
+
- ``R`` -- a ring
|
|
342
|
+
|
|
343
|
+
EXAMPLES::
|
|
344
|
+
|
|
345
|
+
sage: A = algebras.FreePreLie(ZZ, 'fgh')
|
|
346
|
+
sage: A.change_ring(QQ)
|
|
347
|
+
Free PreLie algebra on 3 generators ['f', 'g', 'h'] over
|
|
348
|
+
Rational Field
|
|
349
|
+
"""
|
|
350
|
+
return FreePreLieAlgebra(R, names=self.variable_names())
|
|
351
|
+
|
|
352
|
+
def gens(self) -> tuple:
|
|
353
|
+
"""
|
|
354
|
+
Return the generators of ``self`` (as an algebra).
|
|
355
|
+
|
|
356
|
+
EXAMPLES::
|
|
357
|
+
|
|
358
|
+
sage: A = algebras.FreePreLie(ZZ, 'fgh')
|
|
359
|
+
sage: A.gens()
|
|
360
|
+
(B[f[]], B[g[]], B[h[]])
|
|
361
|
+
"""
|
|
362
|
+
return tuple(self.algebra_generators())
|
|
363
|
+
|
|
364
|
+
def degree_on_basis(self, t):
|
|
365
|
+
"""
|
|
366
|
+
Return the degree of a rooted tree in the free Pre-Lie algebra.
|
|
367
|
+
|
|
368
|
+
This is the number of vertices.
|
|
369
|
+
|
|
370
|
+
EXAMPLES::
|
|
371
|
+
|
|
372
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
373
|
+
sage: RT = A.basis().keys()
|
|
374
|
+
sage: A.degree_on_basis(RT([RT([])]))
|
|
375
|
+
2
|
|
376
|
+
"""
|
|
377
|
+
return t.node_number()
|
|
378
|
+
|
|
379
|
+
def _an_element_(self):
|
|
380
|
+
"""
|
|
381
|
+
Return an element of ``self``.
|
|
382
|
+
|
|
383
|
+
EXAMPLES::
|
|
384
|
+
|
|
385
|
+
sage: A = algebras.FreePreLie(QQ, 'xy')
|
|
386
|
+
sage: A.an_element()
|
|
387
|
+
B[x[x[x[x[]]]]] + B[x[x[], x[x[]]]]
|
|
388
|
+
"""
|
|
389
|
+
o = self.gen(0)
|
|
390
|
+
return (o * o) * (o * o)
|
|
391
|
+
|
|
392
|
+
def some_elements(self):
|
|
393
|
+
"""
|
|
394
|
+
Return some elements of the free pre-Lie algebra.
|
|
395
|
+
|
|
396
|
+
EXAMPLES::
|
|
397
|
+
|
|
398
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
399
|
+
sage: A.some_elements()
|
|
400
|
+
[B[[]], B[[[]]], B[[[[[]]]]] + B[[[], [[]]]], B[[[[]]]] + B[[[], []]], B[[[]]]]
|
|
401
|
+
|
|
402
|
+
With several generators::
|
|
403
|
+
|
|
404
|
+
sage: A = algebras.FreePreLie(QQ, 'xy')
|
|
405
|
+
sage: A.some_elements()
|
|
406
|
+
[B[x[]],
|
|
407
|
+
B[x[x[]]],
|
|
408
|
+
B[x[x[x[x[]]]]] + B[x[x[], x[x[]]]],
|
|
409
|
+
B[x[x[x[]]]] + B[x[x[], x[]]],
|
|
410
|
+
B[x[x[y[]]]] + B[x[x[], y[]]]]
|
|
411
|
+
"""
|
|
412
|
+
o = self.gen(0)
|
|
413
|
+
x = o * o
|
|
414
|
+
y = o
|
|
415
|
+
G = self.algebra_generators()
|
|
416
|
+
# Take only the first 3 generators, otherwise the final element is too big
|
|
417
|
+
if G.cardinality() < 3:
|
|
418
|
+
for w in G:
|
|
419
|
+
y = y * w
|
|
420
|
+
else:
|
|
421
|
+
K = G.keys()
|
|
422
|
+
for i in range(3):
|
|
423
|
+
y = y * G[K.unrank(i)]
|
|
424
|
+
return [o, x, x * x, x * o, y]
|
|
425
|
+
|
|
426
|
+
def product_on_basis(self, x, y):
|
|
427
|
+
"""
|
|
428
|
+
Return the pre-Lie product of two trees.
|
|
429
|
+
|
|
430
|
+
This is the sum over all graftings of the root of `y` over a vertex
|
|
431
|
+
of `x`. The root of the resulting trees is the root of `x`.
|
|
432
|
+
|
|
433
|
+
.. SEEALSO::
|
|
434
|
+
|
|
435
|
+
:meth:`pre_Lie_product`
|
|
436
|
+
|
|
437
|
+
EXAMPLES::
|
|
438
|
+
|
|
439
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
440
|
+
sage: RT = A.basis().keys()
|
|
441
|
+
sage: x = RT([RT([])])
|
|
442
|
+
sage: A.product_on_basis(x, x)
|
|
443
|
+
B[[[[[]]]]] + B[[[], [[]]]]
|
|
444
|
+
"""
|
|
445
|
+
return self.sum(self.basis()[u] for u in x.graft_list(y))
|
|
446
|
+
|
|
447
|
+
pre_Lie_product_on_basis = product_on_basis
|
|
448
|
+
|
|
449
|
+
@lazy_attribute
|
|
450
|
+
def pre_Lie_product(self):
|
|
451
|
+
"""
|
|
452
|
+
Return the pre-Lie product.
|
|
453
|
+
|
|
454
|
+
.. SEEALSO::
|
|
455
|
+
|
|
456
|
+
:meth:`pre_Lie_product_on_basis`
|
|
457
|
+
|
|
458
|
+
EXAMPLES::
|
|
459
|
+
|
|
460
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
461
|
+
sage: RT = A.basis().keys()
|
|
462
|
+
sage: x = A(RT([RT([])]))
|
|
463
|
+
sage: A.pre_Lie_product(x, x)
|
|
464
|
+
B[[[[[]]]]] + B[[[], [[]]]]
|
|
465
|
+
"""
|
|
466
|
+
plb = self.pre_Lie_product_on_basis
|
|
467
|
+
return self._module_morphism(self._module_morphism(plb, position=0,
|
|
468
|
+
codomain=self),
|
|
469
|
+
position=1)
|
|
470
|
+
|
|
471
|
+
def bracket_on_basis(self, x, y):
|
|
472
|
+
r"""
|
|
473
|
+
Return the Lie bracket of two trees.
|
|
474
|
+
|
|
475
|
+
This is the commutator `[x, y] = x * y - y * x` of the pre-Lie product.
|
|
476
|
+
|
|
477
|
+
.. SEEALSO::
|
|
478
|
+
|
|
479
|
+
:meth:`pre_Lie_product_on_basis`
|
|
480
|
+
|
|
481
|
+
EXAMPLES::
|
|
482
|
+
|
|
483
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
484
|
+
sage: RT = A.basis().keys()
|
|
485
|
+
sage: x = RT([RT([])])
|
|
486
|
+
sage: y = RT([x])
|
|
487
|
+
sage: A.bracket_on_basis(x, y)
|
|
488
|
+
-B[[[[], [[]]]]] + B[[[], [[[]]]]] - B[[[[]], [[]]]]
|
|
489
|
+
"""
|
|
490
|
+
return self.product_on_basis(x, y) - self.product_on_basis(y, x)
|
|
491
|
+
|
|
492
|
+
def nap_product_on_basis(self, x, y):
|
|
493
|
+
"""
|
|
494
|
+
Return the NAP product of two trees.
|
|
495
|
+
|
|
496
|
+
This is the grafting of the root of `y` over the root
|
|
497
|
+
of `x`. The root of the resulting tree is the root of `x`.
|
|
498
|
+
|
|
499
|
+
.. SEEALSO::
|
|
500
|
+
|
|
501
|
+
:meth:`nap_product`
|
|
502
|
+
|
|
503
|
+
EXAMPLES::
|
|
504
|
+
|
|
505
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
506
|
+
sage: RT = A.basis().keys()
|
|
507
|
+
sage: x = RT([RT([])])
|
|
508
|
+
sage: A.nap_product_on_basis(x, x)
|
|
509
|
+
B[[[], [[]]]]
|
|
510
|
+
"""
|
|
511
|
+
return self.basis()[x.graft_on_root(y)]
|
|
512
|
+
|
|
513
|
+
@lazy_attribute
|
|
514
|
+
def nap_product(self):
|
|
515
|
+
"""
|
|
516
|
+
Return the NAP product.
|
|
517
|
+
|
|
518
|
+
.. SEEALSO::
|
|
519
|
+
|
|
520
|
+
:meth:`nap_product_on_basis`
|
|
521
|
+
|
|
522
|
+
EXAMPLES::
|
|
523
|
+
|
|
524
|
+
sage: A = algebras.FreePreLie(QQ, None)
|
|
525
|
+
sage: RT = A.basis().keys()
|
|
526
|
+
sage: x = A(RT([RT([])]))
|
|
527
|
+
sage: A.nap_product(x, x)
|
|
528
|
+
B[[[], [[]]]]
|
|
529
|
+
"""
|
|
530
|
+
npb = self.nap_product_on_basis
|
|
531
|
+
return self._module_morphism(self._module_morphism(npb,
|
|
532
|
+
position=0,
|
|
533
|
+
codomain=self),
|
|
534
|
+
position=1)
|
|
535
|
+
|
|
536
|
+
def corolla(self, x, y, n, N):
|
|
537
|
+
"""
|
|
538
|
+
Return the corolla obtained with ``x`` as root and ``y`` as leaves.
|
|
539
|
+
|
|
540
|
+
INPUT:
|
|
541
|
+
|
|
542
|
+
- ``x``, ``y`` -- two elements
|
|
543
|
+
- ``n`` -- integer; width of the corolla
|
|
544
|
+
- ``N`` -- integer; truncation order (up to order ``N`` included)
|
|
545
|
+
|
|
546
|
+
OUTPUT:
|
|
547
|
+
|
|
548
|
+
the sum over all possible ways to graft ``n`` copies of ``y``
|
|
549
|
+
on top of ``x`` (with at most ``N`` vertices in total)
|
|
550
|
+
|
|
551
|
+
This operation can be defined by induction starting from the
|
|
552
|
+
pre-Lie product.
|
|
553
|
+
|
|
554
|
+
EXAMPLES::
|
|
555
|
+
|
|
556
|
+
sage: A = algebras.FreePreLie(QQ)
|
|
557
|
+
sage: a = A.gen(0)
|
|
558
|
+
sage: b = A.corolla(a,a,1,4); b
|
|
559
|
+
B[[[]]]
|
|
560
|
+
sage: A.corolla(b,b,2,7)
|
|
561
|
+
B[[[[[]], [[]]]]] + 2*B[[[[]], [[[]]]]] + B[[[], [[]], [[]]]]
|
|
562
|
+
|
|
563
|
+
sage: A = algebras.FreePreLie(QQ, 'o')
|
|
564
|
+
sage: a = A.gen(0)
|
|
565
|
+
sage: b = A.corolla(a,a,1,4)
|
|
566
|
+
|
|
567
|
+
sage: A = algebras.FreePreLie(QQ,'ab')
|
|
568
|
+
sage: a, b = A.gens()
|
|
569
|
+
sage: A.corolla(a,b,1,4)
|
|
570
|
+
B[a[b[]]]
|
|
571
|
+
sage: A.corolla(b,a,3,4)
|
|
572
|
+
B[b[a[], a[], a[]]]
|
|
573
|
+
|
|
574
|
+
sage: A.corolla(a+b,a+b,2,4)
|
|
575
|
+
B[a[a[], a[]]] + 2*B[a[a[], b[]]] + B[a[b[], b[]]] + B[b[a[], a[]]] +
|
|
576
|
+
2*B[b[a[], b[]]] + B[b[b[], b[]]]
|
|
577
|
+
|
|
578
|
+
TESTS::
|
|
579
|
+
|
|
580
|
+
sage: A = algebras.FreePreLie(QQ,'ab')
|
|
581
|
+
sage: a, b = A.gens()
|
|
582
|
+
sage: A.corolla(a,A.zero(),2,2)
|
|
583
|
+
0
|
|
584
|
+
"""
|
|
585
|
+
if not x or not y:
|
|
586
|
+
return self.zero()
|
|
587
|
+
|
|
588
|
+
basering = self.base_ring()
|
|
589
|
+
vx = x.valuation()
|
|
590
|
+
vy = y.valuation()
|
|
591
|
+
min_deg = vy * n + vx
|
|
592
|
+
if min_deg > N:
|
|
593
|
+
return self.zero()
|
|
594
|
+
|
|
595
|
+
try:
|
|
596
|
+
self.gen(0).support()[0].label()
|
|
597
|
+
labels = True
|
|
598
|
+
except AttributeError:
|
|
599
|
+
labels = False
|
|
600
|
+
|
|
601
|
+
deg_x = x.maximal_degree()
|
|
602
|
+
deg_y = y.maximal_degree()
|
|
603
|
+
max_x = min(deg_x, N - n * vy)
|
|
604
|
+
max_y = min(deg_y, N - vx - (n - 1) * vy)
|
|
605
|
+
xx = x.truncate(max_x + 1)
|
|
606
|
+
yy = y.truncate(max_y + 1)
|
|
607
|
+
|
|
608
|
+
y_homog = {i: list(yy.homogeneous_component(i))
|
|
609
|
+
for i in range(vy, max_y + 1)}
|
|
610
|
+
resu = self.zero()
|
|
611
|
+
for k in range(min_deg, N + 1): # total degree of (x ; y, y, y, y)
|
|
612
|
+
for mx, coef_x in xx:
|
|
613
|
+
dx = mx.node_number()
|
|
614
|
+
step = self.zero()
|
|
615
|
+
for pi in IntegerVectors(k - dx, n, min_part=vy, max_part=max_y):
|
|
616
|
+
for ly in product(*[y_homog[part] for part in pi]):
|
|
617
|
+
coef_y = basering.prod(mc[1] for mc in ly)
|
|
618
|
+
arbres_y = [mc[0] for mc in ly]
|
|
619
|
+
step += coef_y * self.sum(self(t)
|
|
620
|
+
for t in corolla_gen(mx, arbres_y, labels))
|
|
621
|
+
resu += coef_x * step
|
|
622
|
+
return resu
|
|
623
|
+
|
|
624
|
+
def group_product(self, x, y, n, N=10):
|
|
625
|
+
r"""
|
|
626
|
+
Return the truncated group product of ``x`` and ``y``.
|
|
627
|
+
|
|
628
|
+
This is a weighted sum of all corollas with up to ``n`` leaves, with
|
|
629
|
+
``x`` as root and ``y`` as leaves.
|
|
630
|
+
|
|
631
|
+
The result is computed up to order ``N`` (included).
|
|
632
|
+
|
|
633
|
+
When considered with infinitely many terms and infinite precision,
|
|
634
|
+
this is an analogue of the Baker-Campbell-Hausdorff formula: it
|
|
635
|
+
defines an associative product on the completed free pre-Lie algebra.
|
|
636
|
+
|
|
637
|
+
INPUT:
|
|
638
|
+
|
|
639
|
+
- ``x``, ``y`` -- two elements
|
|
640
|
+
- ``n`` -- integer; the maximal width of corollas
|
|
641
|
+
- ``N`` -- integer (default: 10); truncation order
|
|
642
|
+
|
|
643
|
+
EXAMPLES:
|
|
644
|
+
|
|
645
|
+
In the free pre-Lie algebra with one generator::
|
|
646
|
+
|
|
647
|
+
sage: PL = algebras.FreePreLie(QQ)
|
|
648
|
+
sage: a = PL.gen(0)
|
|
649
|
+
sage: PL.group_product(a, a, 3, 3)
|
|
650
|
+
B[[]] + B[[[]]] + 1/2*B[[[], []]]
|
|
651
|
+
|
|
652
|
+
In the free pre-Lie algebra with several generators::
|
|
653
|
+
|
|
654
|
+
sage: PL = algebras.FreePreLie(QQ,'@O')
|
|
655
|
+
sage: a, b = PL.gens()
|
|
656
|
+
sage: PL.group_product(a, b, 3, 3)
|
|
657
|
+
B[@[]] + B[@[O[]]] + 1/2*B[@[O[], O[]]]
|
|
658
|
+
sage: PL.group_product(a, b, 3, 10)
|
|
659
|
+
B[@[]] + B[@[O[]]] + 1/2*B[@[O[], O[]]] + 1/6*B[@[O[], O[], O[]]]
|
|
660
|
+
"""
|
|
661
|
+
br = self.base_ring()
|
|
662
|
+
return x + self.sum(self.corolla(x, y, i, N) * ~br(factorial(i))
|
|
663
|
+
for i in range(1, n + 1))
|
|
664
|
+
|
|
665
|
+
def _element_constructor_(self, x):
|
|
666
|
+
r"""
|
|
667
|
+
Convert ``x`` into ``self``.
|
|
668
|
+
|
|
669
|
+
EXAMPLES::
|
|
670
|
+
|
|
671
|
+
sage: R = algebras.FreePreLie(QQ, 'xy')
|
|
672
|
+
sage: x, y = R.gens()
|
|
673
|
+
sage: R(x)
|
|
674
|
+
B[x[]]
|
|
675
|
+
sage: R(x+4*y)
|
|
676
|
+
B[x[]] + 4*B[y[]]
|
|
677
|
+
|
|
678
|
+
sage: Trees = R.basis().keys()
|
|
679
|
+
sage: R(Trees([],'x'))
|
|
680
|
+
B[x[]]
|
|
681
|
+
sage: D = algebras.FreePreLie(ZZ, 'xy')
|
|
682
|
+
sage: X, Y = D.gens()
|
|
683
|
+
sage: R(X-Y).parent()
|
|
684
|
+
Free PreLie algebra on 2 generators ['x', 'y'] over Rational Field
|
|
685
|
+
|
|
686
|
+
TESTS::
|
|
687
|
+
|
|
688
|
+
sage: R.<x,y> = algebras.FreePreLie(QQ)
|
|
689
|
+
sage: S.<z> = algebras.FreePreLie(GF(3))
|
|
690
|
+
sage: R(z)
|
|
691
|
+
Traceback (most recent call last):
|
|
692
|
+
...
|
|
693
|
+
TypeError: not able to convert this to this algebra
|
|
694
|
+
"""
|
|
695
|
+
if (isinstance(x, (RootedTree, LabelledRootedTree)) and
|
|
696
|
+
x in self.basis().keys()):
|
|
697
|
+
return self.monomial(x)
|
|
698
|
+
try:
|
|
699
|
+
P = x.parent()
|
|
700
|
+
if isinstance(P, FreePreLieAlgebra):
|
|
701
|
+
if P is self:
|
|
702
|
+
return x
|
|
703
|
+
if self._coerce_map_from_(P):
|
|
704
|
+
return self.element_class(self, x.monomial_coefficients())
|
|
705
|
+
except AttributeError:
|
|
706
|
+
raise TypeError('not able to convert this to this algebra')
|
|
707
|
+
else:
|
|
708
|
+
raise TypeError('not able to convert this to this algebra')
|
|
709
|
+
# Ok, not a pre-Lie algebra element (or should not be viewed as one).
|
|
710
|
+
|
|
711
|
+
def _coerce_map_from_(self, R):
|
|
712
|
+
r"""
|
|
713
|
+
Return ``True`` if there is a coercion from ``R`` into ``self``
|
|
714
|
+
and ``False`` otherwise.
|
|
715
|
+
|
|
716
|
+
The things that coerce into ``self`` are
|
|
717
|
+
|
|
718
|
+
- free pre-Lie algebras whose set `E` of labels is
|
|
719
|
+
a subset of the corresponding ``self`` of ``set``, and whose base
|
|
720
|
+
ring has a coercion map into ``self.base_ring()``
|
|
721
|
+
|
|
722
|
+
EXAMPLES::
|
|
723
|
+
|
|
724
|
+
sage: F = algebras.FreePreLie(GF(7), 'xyz'); F
|
|
725
|
+
Free PreLie algebra on 3 generators ['x', 'y', 'z']
|
|
726
|
+
over Finite Field of size 7
|
|
727
|
+
|
|
728
|
+
Elements of the free pre-Lie algebra canonically coerce in::
|
|
729
|
+
|
|
730
|
+
sage: x, y, z = F.gens()
|
|
731
|
+
sage: F.coerce(x+y) == x+y
|
|
732
|
+
True
|
|
733
|
+
|
|
734
|
+
The free pre-Lie algebra over `\ZZ` on `x, y, z` coerces in, since
|
|
735
|
+
`\ZZ` coerces to `\GF{7}`::
|
|
736
|
+
|
|
737
|
+
sage: G = algebras.FreePreLie(ZZ, 'xyz')
|
|
738
|
+
sage: Gx,Gy,Gz = G.gens()
|
|
739
|
+
sage: z = F.coerce(Gx+Gy); z
|
|
740
|
+
B[x[]] + B[y[]]
|
|
741
|
+
sage: z.parent() is F
|
|
742
|
+
True
|
|
743
|
+
|
|
744
|
+
However, `\GF{7}` does not coerce to `\ZZ`, so the free pre-Lie
|
|
745
|
+
algebra over `\GF{7}` does not coerce to the one over `\ZZ`::
|
|
746
|
+
|
|
747
|
+
sage: G.coerce(y)
|
|
748
|
+
Traceback (most recent call last):
|
|
749
|
+
...
|
|
750
|
+
TypeError: no canonical coercion from Free PreLie algebra
|
|
751
|
+
on 3 generators ['x', 'y', 'z'] over Finite Field of size
|
|
752
|
+
7 to Free PreLie algebra on 3 generators ['x', 'y', 'z']
|
|
753
|
+
over Integer Ring
|
|
754
|
+
|
|
755
|
+
TESTS::
|
|
756
|
+
|
|
757
|
+
sage: F = algebras.FreePreLie(ZZ, 'xyz')
|
|
758
|
+
sage: G = algebras.FreePreLie(QQ, 'xyz')
|
|
759
|
+
sage: H = algebras.FreePreLie(ZZ, 'y')
|
|
760
|
+
sage: F._coerce_map_from_(G)
|
|
761
|
+
False
|
|
762
|
+
sage: G._coerce_map_from_(F)
|
|
763
|
+
True
|
|
764
|
+
sage: F._coerce_map_from_(H)
|
|
765
|
+
True
|
|
766
|
+
sage: F._coerce_map_from_(QQ)
|
|
767
|
+
False
|
|
768
|
+
sage: G._coerce_map_from_(QQ)
|
|
769
|
+
False
|
|
770
|
+
sage: F.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z'))
|
|
771
|
+
False
|
|
772
|
+
"""
|
|
773
|
+
# free prelie algebras in a subset of variables
|
|
774
|
+
# over any base that coerces in:
|
|
775
|
+
if isinstance(R, FreePreLieAlgebra):
|
|
776
|
+
if all(x in self.variable_names() for x in R.variable_names()):
|
|
777
|
+
if self.base_ring().has_coerce_map_from(R.base_ring()):
|
|
778
|
+
return True
|
|
779
|
+
return False
|
|
780
|
+
|
|
781
|
+
def _construct_UEA(self):
|
|
782
|
+
"""
|
|
783
|
+
Build the universal enveloping algebra.
|
|
784
|
+
|
|
785
|
+
This is a Grossman-Larson Hopf algebra, based on forests of rooted
|
|
786
|
+
trees.
|
|
787
|
+
|
|
788
|
+
EXAMPLES::
|
|
789
|
+
|
|
790
|
+
sage: S = algebras.FreePreLie(QQ, 'zt')
|
|
791
|
+
sage: S._construct_UEA()
|
|
792
|
+
Grossman-Larson Hopf algebra on 2 generators ['z', 't']
|
|
793
|
+
over Rational Field
|
|
794
|
+
"""
|
|
795
|
+
return GrossmanLarsonAlgebra(self.base_ring(), self.variable_names())
|
|
796
|
+
|
|
797
|
+
def construction(self):
|
|
798
|
+
"""
|
|
799
|
+
Return a pair ``(F, R)``, where ``F`` is a :class:`PreLieFunctor`
|
|
800
|
+
and `R` is a ring, such that ``F(R)`` returns ``self``.
|
|
801
|
+
|
|
802
|
+
EXAMPLES::
|
|
803
|
+
|
|
804
|
+
sage: P = algebras.FreePreLie(ZZ, 'x,y')
|
|
805
|
+
sage: x,y = P.gens()
|
|
806
|
+
sage: F, R = P.construction()
|
|
807
|
+
sage: F
|
|
808
|
+
PreLie[x,y]
|
|
809
|
+
sage: R
|
|
810
|
+
Integer Ring
|
|
811
|
+
sage: F(ZZ) is P
|
|
812
|
+
True
|
|
813
|
+
sage: F(QQ)
|
|
814
|
+
Free PreLie algebra on 2 generators ['x', 'y'] over Rational Field
|
|
815
|
+
"""
|
|
816
|
+
return PreLieFunctor(self.variable_names()), self.base_ring()
|
|
817
|
+
|
|
818
|
+
class Element(CombinatorialFreeModule.Element):
|
|
819
|
+
def lift(self):
|
|
820
|
+
"""
|
|
821
|
+
Lift element to the Grossman-Larson algebra.
|
|
822
|
+
|
|
823
|
+
EXAMPLES::
|
|
824
|
+
|
|
825
|
+
sage: F = algebras.FreePreLie(QQ,'abc')
|
|
826
|
+
sage: elt = F.an_element().lift(); elt
|
|
827
|
+
B[#[a[a[a[a[]]]]]] + B[#[a[a[], a[a[]]]]]
|
|
828
|
+
sage: parent(elt)
|
|
829
|
+
Grossman-Larson Hopf algebra on 3 generators ['a', 'b', 'c']
|
|
830
|
+
over Rational Field
|
|
831
|
+
"""
|
|
832
|
+
UEA = self.parent()._construct_UEA()
|
|
833
|
+
LRT = UEA.basis().keys()
|
|
834
|
+
data = {LRT([x], ROOT): cf
|
|
835
|
+
for x, cf in self.monomial_coefficients(copy=False).items()}
|
|
836
|
+
return UEA.element_class(UEA, data)
|
|
837
|
+
|
|
838
|
+
def valuation(self):
|
|
839
|
+
"""
|
|
840
|
+
Return the valuation of ``self``.
|
|
841
|
+
|
|
842
|
+
EXAMPLES::
|
|
843
|
+
|
|
844
|
+
sage: a = algebras.FreePreLie(QQ).gen(0)
|
|
845
|
+
sage: a.valuation()
|
|
846
|
+
1
|
|
847
|
+
sage: (a*a).valuation()
|
|
848
|
+
2
|
|
849
|
+
|
|
850
|
+
sage: a, b = algebras.FreePreLie(QQ,'ab').gens()
|
|
851
|
+
sage: (a+b).valuation()
|
|
852
|
+
1
|
|
853
|
+
sage: (a*b).valuation()
|
|
854
|
+
2
|
|
855
|
+
sage: (a*b+a).valuation()
|
|
856
|
+
1
|
|
857
|
+
|
|
858
|
+
TESTS::
|
|
859
|
+
|
|
860
|
+
sage: z = algebras.FreePreLie(QQ).zero()
|
|
861
|
+
sage: z.valuation()
|
|
862
|
+
+Infinity
|
|
863
|
+
"""
|
|
864
|
+
if self == self.parent().zero():
|
|
865
|
+
return Infinity
|
|
866
|
+
i = 0
|
|
867
|
+
while True:
|
|
868
|
+
i += 1
|
|
869
|
+
if self.homogeneous_component(i):
|
|
870
|
+
return i
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
class PreLieFunctor(ConstructionFunctor):
|
|
874
|
+
"""
|
|
875
|
+
A constructor for pre-Lie algebras.
|
|
876
|
+
|
|
877
|
+
EXAMPLES::
|
|
878
|
+
|
|
879
|
+
sage: P = algebras.FreePreLie(ZZ, 'x,y')
|
|
880
|
+
sage: x,y = P.gens()
|
|
881
|
+
sage: F = P.construction()[0]; F
|
|
882
|
+
PreLie[x,y]
|
|
883
|
+
|
|
884
|
+
sage: A = GF(5)['a,b']
|
|
885
|
+
sage: a, b = A.gens()
|
|
886
|
+
sage: F(A)
|
|
887
|
+
Free PreLie algebra on 2 generators ['x', 'y'] over Multivariate Polynomial Ring in a, b over Finite Field of size 5
|
|
888
|
+
|
|
889
|
+
sage: f = A.hom([a+b,a-b],A)
|
|
890
|
+
sage: F(f)
|
|
891
|
+
Generic endomorphism of Free PreLie algebra on 2 generators ['x', 'y']
|
|
892
|
+
over Multivariate Polynomial Ring in a, b over Finite Field of size 5
|
|
893
|
+
|
|
894
|
+
sage: F(f)(a * F(A)(x))
|
|
895
|
+
(a+b)*B[x[]]
|
|
896
|
+
"""
|
|
897
|
+
rank = 9
|
|
898
|
+
|
|
899
|
+
def __init__(self, vars):
|
|
900
|
+
"""
|
|
901
|
+
EXAMPLES::
|
|
902
|
+
|
|
903
|
+
sage: F = sage.combinat.free_prelie_algebra.PreLieFunctor(['x','y'])
|
|
904
|
+
sage: F
|
|
905
|
+
PreLie[x,y]
|
|
906
|
+
sage: F(ZZ)
|
|
907
|
+
Free PreLie algebra on 2 generators ['x', 'y'] over Integer Ring
|
|
908
|
+
"""
|
|
909
|
+
Functor.__init__(self, Rings(), Magmas())
|
|
910
|
+
self.vars = vars
|
|
911
|
+
|
|
912
|
+
def _apply_functor(self, R):
|
|
913
|
+
"""
|
|
914
|
+
Apply the functor to an object of ``self``'s domain.
|
|
915
|
+
|
|
916
|
+
EXAMPLES::
|
|
917
|
+
|
|
918
|
+
sage: R = algebras.FreePreLie(ZZ, 'x,y,z')
|
|
919
|
+
sage: F = R.construction()[0]; F
|
|
920
|
+
PreLie[x,y,z]
|
|
921
|
+
sage: type(F)
|
|
922
|
+
<class 'sage.combinat.free_prelie_algebra.PreLieFunctor'>
|
|
923
|
+
sage: F(ZZ) # indirect doctest
|
|
924
|
+
Free PreLie algebra on 3 generators ['x', 'y', 'z'] over Integer Ring
|
|
925
|
+
"""
|
|
926
|
+
return FreePreLieAlgebra(R, self.vars)
|
|
927
|
+
|
|
928
|
+
def _apply_functor_to_morphism(self, f):
|
|
929
|
+
"""
|
|
930
|
+
Apply the functor ``self`` to the ring morphism `f`.
|
|
931
|
+
|
|
932
|
+
TESTS::
|
|
933
|
+
|
|
934
|
+
sage: R = algebras.FreePreLie(ZZ, 'x').construction()[0]
|
|
935
|
+
sage: R(ZZ.hom(GF(3))) # indirect doctest
|
|
936
|
+
Generic morphism:
|
|
937
|
+
From: Free PreLie algebra on one generator ['x'] over Integer Ring
|
|
938
|
+
To: Free PreLie algebra on one generator ['x'] over Finite Field of size 3
|
|
939
|
+
"""
|
|
940
|
+
dom = self(f.domain())
|
|
941
|
+
codom = self(f.codomain())
|
|
942
|
+
|
|
943
|
+
def action(x):
|
|
944
|
+
return codom._from_dict({a: f(b)
|
|
945
|
+
for a, b in x.monomial_coefficients().items()})
|
|
946
|
+
return dom.module_morphism(function=action, codomain=codom)
|
|
947
|
+
|
|
948
|
+
def __eq__(self, other):
|
|
949
|
+
"""
|
|
950
|
+
EXAMPLES::
|
|
951
|
+
|
|
952
|
+
sage: F = algebras.FreePreLie(ZZ, 'x,y,z').construction()[0]
|
|
953
|
+
sage: G = algebras.FreePreLie(QQ, 'x,y,z').construction()[0]
|
|
954
|
+
sage: F == G
|
|
955
|
+
True
|
|
956
|
+
sage: G == loads(dumps(G))
|
|
957
|
+
True
|
|
958
|
+
sage: G = algebras.FreePreLie(QQ, 'x,y').construction()[0]
|
|
959
|
+
sage: F == G
|
|
960
|
+
False
|
|
961
|
+
"""
|
|
962
|
+
if not isinstance(other, PreLieFunctor):
|
|
963
|
+
return False
|
|
964
|
+
return self.vars == other.vars
|
|
965
|
+
|
|
966
|
+
def __mul__(self, other):
|
|
967
|
+
"""
|
|
968
|
+
If two PreLie functors are given in a row, form a single PreLie functor
|
|
969
|
+
with all of the variables.
|
|
970
|
+
|
|
971
|
+
EXAMPLES::
|
|
972
|
+
|
|
973
|
+
sage: F = sage.combinat.free_prelie_algebra.PreLieFunctor(['x','y'])
|
|
974
|
+
sage: G = sage.combinat.free_prelie_algebra.PreLieFunctor(['t'])
|
|
975
|
+
sage: G * F
|
|
976
|
+
PreLie[x,y,t]
|
|
977
|
+
"""
|
|
978
|
+
if isinstance(other, IdentityConstructionFunctor):
|
|
979
|
+
return self
|
|
980
|
+
if isinstance(other, PreLieFunctor):
|
|
981
|
+
if set(self.vars).intersection(other.vars):
|
|
982
|
+
raise CoercionException("Overlapping variables (%s,%s)" %
|
|
983
|
+
(self.vars, other.vars))
|
|
984
|
+
return PreLieFunctor(other.vars + self.vars)
|
|
985
|
+
elif (isinstance(other, CompositeConstructionFunctor) and
|
|
986
|
+
isinstance(other.all[-1], PreLieFunctor)):
|
|
987
|
+
return CompositeConstructionFunctor(other.all[:-1],
|
|
988
|
+
self * other.all[-1])
|
|
989
|
+
else:
|
|
990
|
+
return CompositeConstructionFunctor(other, self)
|
|
991
|
+
|
|
992
|
+
def merge(self, other):
|
|
993
|
+
"""
|
|
994
|
+
Merge ``self`` with another construction functor, or return None.
|
|
995
|
+
|
|
996
|
+
EXAMPLES::
|
|
997
|
+
|
|
998
|
+
sage: F = sage.combinat.free_prelie_algebra.PreLieFunctor(['x','y'])
|
|
999
|
+
sage: G = sage.combinat.free_prelie_algebra.PreLieFunctor(['t'])
|
|
1000
|
+
sage: F.merge(G)
|
|
1001
|
+
PreLie[x,y,t]
|
|
1002
|
+
sage: F.merge(F)
|
|
1003
|
+
PreLie[x,y]
|
|
1004
|
+
|
|
1005
|
+
Now some actual use cases::
|
|
1006
|
+
|
|
1007
|
+
sage: R = algebras.FreePreLie(ZZ, 'xyz')
|
|
1008
|
+
sage: x,y,z = R.gens()
|
|
1009
|
+
sage: 1/2 * x
|
|
1010
|
+
1/2*B[x[]]
|
|
1011
|
+
sage: parent(1/2 * x)
|
|
1012
|
+
Free PreLie algebra on 3 generators ['x', 'y', 'z'] over Rational Field
|
|
1013
|
+
|
|
1014
|
+
sage: S = algebras.FreePreLie(QQ, 'zt')
|
|
1015
|
+
sage: z,t = S.gens()
|
|
1016
|
+
sage: x + t
|
|
1017
|
+
B[t[]] + B[x[]]
|
|
1018
|
+
sage: parent(x + t)
|
|
1019
|
+
Free PreLie algebra on 4 generators ['z', 't', 'x', 'y'] over Rational Field
|
|
1020
|
+
"""
|
|
1021
|
+
if isinstance(other, PreLieFunctor):
|
|
1022
|
+
if self.vars == other.vars:
|
|
1023
|
+
return self
|
|
1024
|
+
ret = list(self.vars)
|
|
1025
|
+
cur_vars = set(ret)
|
|
1026
|
+
ret.extend(v for v in other.vars if v not in cur_vars)
|
|
1027
|
+
return PreLieFunctor(Alphabet(ret))
|
|
1028
|
+
|
|
1029
|
+
return None
|
|
1030
|
+
|
|
1031
|
+
def _repr_(self) -> str:
|
|
1032
|
+
"""
|
|
1033
|
+
TESTS::
|
|
1034
|
+
|
|
1035
|
+
sage: algebras.FreePreLie(QQ,'x,y,z,t').construction()[0]
|
|
1036
|
+
PreLie[x,y,z,t]
|
|
1037
|
+
"""
|
|
1038
|
+
return "PreLie[%s]" % ','.join(self.vars)
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
def tree_from_sortkey(ch, labels=True):
|
|
1042
|
+
r"""
|
|
1043
|
+
Transform a list of ``(valence, label)`` into a tree and a remainder.
|
|
1044
|
+
|
|
1045
|
+
This is like an inverse of the ``sort_key`` method.
|
|
1046
|
+
|
|
1047
|
+
INPUT:
|
|
1048
|
+
|
|
1049
|
+
- ``ch`` -- list of pairs ``(integer, label)``
|
|
1050
|
+
- ``labels`` -- boolean (default: ``True``); whether to use labelled trees
|
|
1051
|
+
|
|
1052
|
+
OUTPUT:
|
|
1053
|
+
|
|
1054
|
+
a pair ``(tree, remainder of the input)``
|
|
1055
|
+
|
|
1056
|
+
EXAMPLES::
|
|
1057
|
+
|
|
1058
|
+
sage: from sage.combinat.free_prelie_algebra import tree_from_sortkey
|
|
1059
|
+
sage: a = algebras.FreePreLie(QQ).gen(0)
|
|
1060
|
+
sage: t = (a*a*a*a).support()
|
|
1061
|
+
sage: all(tree_from_sortkey(u.sort_key(), False)[0] == u for u in t)
|
|
1062
|
+
True
|
|
1063
|
+
|
|
1064
|
+
sage: a, b = algebras.FreePreLie(QQ,'ab').gens()
|
|
1065
|
+
sage: t = (a*b*a*b).support()
|
|
1066
|
+
sage: all(tree_from_sortkey(u.sort_key())[0] == u for u in t)
|
|
1067
|
+
True
|
|
1068
|
+
"""
|
|
1069
|
+
if labels:
|
|
1070
|
+
Trees = LabelledRootedTrees()
|
|
1071
|
+
width, label = ch[0]
|
|
1072
|
+
else:
|
|
1073
|
+
Trees = RootedTrees()
|
|
1074
|
+
width = ch[0]
|
|
1075
|
+
|
|
1076
|
+
remainder = ch[1:]
|
|
1077
|
+
if width == 0:
|
|
1078
|
+
if labels:
|
|
1079
|
+
return (Trees([], label), remainder)
|
|
1080
|
+
return (Trees([]), remainder)
|
|
1081
|
+
|
|
1082
|
+
branches = {}
|
|
1083
|
+
for i in range(width):
|
|
1084
|
+
tree, remainder = tree_from_sortkey(remainder, labels=labels)
|
|
1085
|
+
branches[i] = tree
|
|
1086
|
+
|
|
1087
|
+
if labels:
|
|
1088
|
+
return (Trees(branches.values(), label), remainder)
|
|
1089
|
+
return (Trees(branches.values()), remainder)
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
def corolla_gen(tx, list_ty, labels=True):
|
|
1093
|
+
"""
|
|
1094
|
+
Yield the terms in the corolla with given bottom tree and top trees.
|
|
1095
|
+
|
|
1096
|
+
These are the possible terms in the simultaneous grafting of the
|
|
1097
|
+
top trees on vertices of the bottom tree.
|
|
1098
|
+
|
|
1099
|
+
INPUT:
|
|
1100
|
+
|
|
1101
|
+
- ``tx`` -- a tree
|
|
1102
|
+
- ``list_ty`` -- list of trees
|
|
1103
|
+
|
|
1104
|
+
EXAMPLES::
|
|
1105
|
+
|
|
1106
|
+
sage: from sage.combinat.free_prelie_algebra import corolla_gen
|
|
1107
|
+
sage: a = algebras.FreePreLie(QQ).gen(0)
|
|
1108
|
+
sage: ta = a.support()[0]
|
|
1109
|
+
sage: list(corolla_gen(ta,[ta],False))
|
|
1110
|
+
[[[]]]
|
|
1111
|
+
|
|
1112
|
+
sage: a, b = algebras.FreePreLie(QQ,'ab').gens()
|
|
1113
|
+
sage: ta = a.support()[0]
|
|
1114
|
+
sage: tb = b.support()[0]
|
|
1115
|
+
sage: ab = (a*b).support()[0]
|
|
1116
|
+
sage: list(corolla_gen(ta,[tb]))
|
|
1117
|
+
[a[b[]]]
|
|
1118
|
+
sage: list(corolla_gen(tb,[ta,ta]))
|
|
1119
|
+
[b[a[], a[]]]
|
|
1120
|
+
sage: list(corolla_gen(ab,[ab,ta]))
|
|
1121
|
+
[a[a[], b[], a[b[]]], a[a[b[]], b[a[]]], a[a[], b[a[b[]]]],
|
|
1122
|
+
a[b[a[], a[b[]]]]]
|
|
1123
|
+
"""
|
|
1124
|
+
n = len(list_ty)
|
|
1125
|
+
zx = tx.sort_key()
|
|
1126
|
+
nx = len(zx)
|
|
1127
|
+
liste_zy = [t.sort_key() for t in list_ty]
|
|
1128
|
+
for list_pos in product(range(nx), repeat=n):
|
|
1129
|
+
new_zx = tuple(zx)
|
|
1130
|
+
data = zip(list_pos, liste_zy)
|
|
1131
|
+
sorted_data = sorted(data, reverse=True)
|
|
1132
|
+
for pos_t in sorted_data:
|
|
1133
|
+
if labels:
|
|
1134
|
+
idx, lbl = new_zx[pos_t[0]]
|
|
1135
|
+
new_zx = (new_zx[:pos_t[0]] + ((idx + 1, lbl),) +
|
|
1136
|
+
pos_t[1] + new_zx[pos_t[0] + 1:])
|
|
1137
|
+
else:
|
|
1138
|
+
idx = new_zx[pos_t[0]]
|
|
1139
|
+
new_zx = (new_zx[:pos_t[0]] + (idx + 1,) +
|
|
1140
|
+
pos_t[1] + new_zx[pos_t[0] + 1:])
|
|
1141
|
+
yield tree_from_sortkey(new_zx, labels=labels)[0]
|