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,634 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-combinat
|
|
2
|
+
r"""
|
|
3
|
+
Non-decreasing parking functions
|
|
4
|
+
|
|
5
|
+
A *non-decreasing parking function* of size `n` is a non-decreasing
|
|
6
|
+
function `f` from `\{1,\dots,n\}` to itself such that for all `i`, one
|
|
7
|
+
has `f(i) \leq i`.
|
|
8
|
+
|
|
9
|
+
The number of non-decreasing parking functions of size `n` is the `n`-th
|
|
10
|
+
:func:`Catalan number<sage.combinat.combinat.catalan_number>`.
|
|
11
|
+
|
|
12
|
+
The set of non-decreasing parking functions of size `n` is in bijection with
|
|
13
|
+
the set of :mod:`Dyck words<sage.combinat.dyck_word>` of size `n`.
|
|
14
|
+
|
|
15
|
+
AUTHORS:
|
|
16
|
+
|
|
17
|
+
- Florent Hivert (2009-04)
|
|
18
|
+
- Christian Stump (2012-11) added pretty printing
|
|
19
|
+
"""
|
|
20
|
+
# ****************************************************************************
|
|
21
|
+
# Copyright (C) 2007 Florent Hivert <Florent.Hivert@univ-rouen.fr>,
|
|
22
|
+
#
|
|
23
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
24
|
+
#
|
|
25
|
+
# This code is distributed in the hope that it will be useful,
|
|
26
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
28
|
+
# General Public License for more details.
|
|
29
|
+
#
|
|
30
|
+
# The full text of the GPL is available at:
|
|
31
|
+
#
|
|
32
|
+
# https://www.gnu.org/licenses/
|
|
33
|
+
# ****************************************************************************
|
|
34
|
+
from __future__ import annotations
|
|
35
|
+
|
|
36
|
+
from copy import copy
|
|
37
|
+
|
|
38
|
+
from .combinat import catalan_number
|
|
39
|
+
from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets
|
|
40
|
+
from sage.categories.sets_with_grading import SetsWithGrading
|
|
41
|
+
from sage.categories.monoids import Monoids
|
|
42
|
+
from sage.rings.semirings.non_negative_integer_semiring import NN
|
|
43
|
+
from sage.rings.integer import Integer
|
|
44
|
+
from sage.structure.element import Element
|
|
45
|
+
from sage.structure.parent import Parent
|
|
46
|
+
from sage.structure.richcmp import richcmp
|
|
47
|
+
from sage.structure.unique_representation import UniqueRepresentation
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def NonDecreasingParkingFunctions(n=None):
|
|
51
|
+
r"""
|
|
52
|
+
Return the set of Non-Decreasing Parking Functions.
|
|
53
|
+
|
|
54
|
+
A *non-decreasing parking function* of size `n` is a non-decreasing
|
|
55
|
+
function `f` from `\{1,\dots,n\}` to itself such that for all `i`,
|
|
56
|
+
one has `f(i) \leq i`.
|
|
57
|
+
|
|
58
|
+
EXAMPLES:
|
|
59
|
+
|
|
60
|
+
Here are all the-non decreasing parking functions of size 5::
|
|
61
|
+
|
|
62
|
+
sage: NonDecreasingParkingFunctions(3).list()
|
|
63
|
+
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]]
|
|
64
|
+
|
|
65
|
+
If no size is specified, then NonDecreasingParkingFunctions
|
|
66
|
+
returns the set of all non-decreasing parking functions.
|
|
67
|
+
|
|
68
|
+
::
|
|
69
|
+
|
|
70
|
+
sage: PF = NonDecreasingParkingFunctions(); PF
|
|
71
|
+
Non-decreasing parking functions
|
|
72
|
+
sage: [] in PF
|
|
73
|
+
True
|
|
74
|
+
sage: [1] in PF
|
|
75
|
+
True
|
|
76
|
+
sage: [2] in PF
|
|
77
|
+
False
|
|
78
|
+
sage: [1,1,3] in PF
|
|
79
|
+
True
|
|
80
|
+
sage: [1,1,4] in PF
|
|
81
|
+
False
|
|
82
|
+
|
|
83
|
+
If the size `n` is specified, then NonDecreasingParkingFunctions returns
|
|
84
|
+
the set of all non-decreasing parking functions of size `n`.
|
|
85
|
+
|
|
86
|
+
::
|
|
87
|
+
|
|
88
|
+
sage: PF = NonDecreasingParkingFunctions(0)
|
|
89
|
+
sage: PF.list()
|
|
90
|
+
[[]]
|
|
91
|
+
sage: PF = NonDecreasingParkingFunctions(1)
|
|
92
|
+
sage: PF.list()
|
|
93
|
+
[[1]]
|
|
94
|
+
sage: PF = NonDecreasingParkingFunctions(3)
|
|
95
|
+
sage: PF.list()
|
|
96
|
+
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]]
|
|
97
|
+
|
|
98
|
+
sage: PF3 = NonDecreasingParkingFunctions(3); PF3
|
|
99
|
+
Non-decreasing parking functions of size 3
|
|
100
|
+
sage: [] in PF3
|
|
101
|
+
False
|
|
102
|
+
sage: [1] in PF3
|
|
103
|
+
False
|
|
104
|
+
sage: [1,1,3] in PF3
|
|
105
|
+
True
|
|
106
|
+
sage: [1,1,4] in PF3
|
|
107
|
+
False
|
|
108
|
+
|
|
109
|
+
TESTS::
|
|
110
|
+
|
|
111
|
+
sage: PF = NonDecreasingParkingFunctions(5)
|
|
112
|
+
sage: len(PF.list()) == PF.cardinality()
|
|
113
|
+
True
|
|
114
|
+
sage: NonDecreasingParkingFunctions("foo")
|
|
115
|
+
Traceback (most recent call last):
|
|
116
|
+
...
|
|
117
|
+
TypeError: unable to convert 'foo' to an integer
|
|
118
|
+
"""
|
|
119
|
+
if n is None:
|
|
120
|
+
return NonDecreasingParkingFunctions_all()
|
|
121
|
+
else:
|
|
122
|
+
return NonDecreasingParkingFunctions_n(n)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def is_a(x, n=None) -> bool:
|
|
126
|
+
"""
|
|
127
|
+
Check whether a list is a non-decreasing parking function.
|
|
128
|
+
|
|
129
|
+
If a size `n` is specified, checks if a list is a non-decreasing
|
|
130
|
+
parking function of size `n`.
|
|
131
|
+
|
|
132
|
+
TESTS::
|
|
133
|
+
|
|
134
|
+
sage: from sage.combinat.non_decreasing_parking_function import is_a
|
|
135
|
+
sage: is_a([1,1,2])
|
|
136
|
+
True
|
|
137
|
+
sage: is_a([1,1,4])
|
|
138
|
+
False
|
|
139
|
+
sage: is_a([1,1,3], 3)
|
|
140
|
+
True
|
|
141
|
+
"""
|
|
142
|
+
if not isinstance(x, (list, tuple)):
|
|
143
|
+
return False
|
|
144
|
+
prev = 1
|
|
145
|
+
for i, elt in enumerate(x):
|
|
146
|
+
if prev > elt or elt > i + 1:
|
|
147
|
+
return False
|
|
148
|
+
prev = elt
|
|
149
|
+
return n is None or n == len(x)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class NonDecreasingParkingFunction(Element):
|
|
153
|
+
r"""
|
|
154
|
+
A *non decreasing parking function* of size `n` is a non-decreasing
|
|
155
|
+
function `f` from `\{1,\dots,n\}` to itself such that for all `i`,
|
|
156
|
+
one has `f(i) \leq i`.
|
|
157
|
+
|
|
158
|
+
EXAMPLES::
|
|
159
|
+
|
|
160
|
+
sage: NonDecreasingParkingFunction([])
|
|
161
|
+
[]
|
|
162
|
+
sage: NonDecreasingParkingFunction([1])
|
|
163
|
+
[1]
|
|
164
|
+
sage: NonDecreasingParkingFunction([2])
|
|
165
|
+
Traceback (most recent call last):
|
|
166
|
+
...
|
|
167
|
+
ValueError: [2] is not a non-decreasing parking function
|
|
168
|
+
sage: NonDecreasingParkingFunction([1,2])
|
|
169
|
+
[1, 2]
|
|
170
|
+
sage: NonDecreasingParkingFunction([1,1,2])
|
|
171
|
+
[1, 1, 2]
|
|
172
|
+
sage: NonDecreasingParkingFunction([1,1,4])
|
|
173
|
+
Traceback (most recent call last):
|
|
174
|
+
...
|
|
175
|
+
ValueError: [1, 1, 4] is not a non-decreasing parking function
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
def __init__(self, lst):
|
|
179
|
+
"""
|
|
180
|
+
TESTS::
|
|
181
|
+
|
|
182
|
+
sage: NonDecreasingParkingFunction([1, 1, 2, 2, 5, 6])
|
|
183
|
+
[1, 1, 2, 2, 5, 6]
|
|
184
|
+
"""
|
|
185
|
+
if not is_a(lst):
|
|
186
|
+
raise ValueError('%s is not a non-decreasing parking function' % lst)
|
|
187
|
+
parent = NonDecreasingParkingFunctions_n(len(lst))
|
|
188
|
+
Element.__init__(self, parent)
|
|
189
|
+
self._list = lst
|
|
190
|
+
|
|
191
|
+
def __getitem__(self, n):
|
|
192
|
+
"""
|
|
193
|
+
Return the `n`-th item in the underlying list.
|
|
194
|
+
|
|
195
|
+
.. NOTE::
|
|
196
|
+
|
|
197
|
+
Note that this is different than the image of `n` under
|
|
198
|
+
function. It is "off by one".
|
|
199
|
+
|
|
200
|
+
EXAMPLES::
|
|
201
|
+
|
|
202
|
+
sage: p = NonDecreasingParkingFunction([1, 1, 2, 2, 5, 6])
|
|
203
|
+
sage: p[0]
|
|
204
|
+
1
|
|
205
|
+
sage: p[2]
|
|
206
|
+
2
|
|
207
|
+
"""
|
|
208
|
+
return self._list[n]
|
|
209
|
+
|
|
210
|
+
def __call__(self, n):
|
|
211
|
+
"""
|
|
212
|
+
Return the image of ``n`` under the parking function.
|
|
213
|
+
|
|
214
|
+
EXAMPLES::
|
|
215
|
+
|
|
216
|
+
sage: p = NonDecreasingParkingFunction([1, 1, 2, 2, 5, 6])
|
|
217
|
+
sage: p(3)
|
|
218
|
+
2
|
|
219
|
+
sage: p(6)
|
|
220
|
+
6
|
|
221
|
+
"""
|
|
222
|
+
return self._list[n - 1]
|
|
223
|
+
|
|
224
|
+
def _mul_(self, lp) -> NonDecreasingParkingFunction:
|
|
225
|
+
"""
|
|
226
|
+
The composition of non-decreasing parking functions.
|
|
227
|
+
|
|
228
|
+
EXAMPLES::
|
|
229
|
+
|
|
230
|
+
sage: p = NonDecreasingParkingFunction([1,1,3])
|
|
231
|
+
sage: q = NonDecreasingParkingFunction([1,2,2])
|
|
232
|
+
sage: p * q
|
|
233
|
+
[1, 1, 1]
|
|
234
|
+
sage: q * p
|
|
235
|
+
[1, 1, 2]
|
|
236
|
+
"""
|
|
237
|
+
lp = lp._list
|
|
238
|
+
sp = self._list
|
|
239
|
+
lp = lp[:] + [i + 1 for i in range(len(lp), len(lp))] # ?
|
|
240
|
+
sp = sp[:] + [i + 1 for i in range(len(sp), len(lp))]
|
|
241
|
+
return NonDecreasingParkingFunction([sp[i - 1] for i in lp])
|
|
242
|
+
|
|
243
|
+
def to_dyck_word(self):
|
|
244
|
+
"""
|
|
245
|
+
Implement the bijection to :class:`Dyck
|
|
246
|
+
words<sage.combinat.dyck_word.DyckWords>`, which is defined as follows.
|
|
247
|
+
Take a non decreasing parking function, say [1,1,2,4,5,5], and draw
|
|
248
|
+
its graph::
|
|
249
|
+
|
|
250
|
+
___
|
|
251
|
+
| . 5
|
|
252
|
+
_| . 5
|
|
253
|
+
___| . . 4
|
|
254
|
+
_| . . . . 2
|
|
255
|
+
| . . . . . 1
|
|
256
|
+
| . . . . . 1
|
|
257
|
+
|
|
258
|
+
The corresponding Dyck word [1,1,0,1,0,0,1,0,1,1,0,0] is then read off
|
|
259
|
+
from the sequence of horizontal and vertical steps. The converse
|
|
260
|
+
bijection is :meth:`.from_dyck_word`.
|
|
261
|
+
|
|
262
|
+
EXAMPLES::
|
|
263
|
+
|
|
264
|
+
sage: NonDecreasingParkingFunction([1,1,2,4,5,5]).to_dyck_word()
|
|
265
|
+
[1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0]
|
|
266
|
+
sage: NonDecreasingParkingFunction([]).to_dyck_word()
|
|
267
|
+
[]
|
|
268
|
+
sage: NonDecreasingParkingFunction([1,1,1]).to_dyck_word()
|
|
269
|
+
[1, 1, 1, 0, 0, 0]
|
|
270
|
+
sage: NonDecreasingParkingFunction([1,2,3]).to_dyck_word()
|
|
271
|
+
[1, 0, 1, 0, 1, 0]
|
|
272
|
+
sage: NonDecreasingParkingFunction([1,1,3,3,4,6,6]).to_dyck_word()
|
|
273
|
+
[1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0]
|
|
274
|
+
|
|
275
|
+
TESTS::
|
|
276
|
+
|
|
277
|
+
sage: ndpf = NonDecreasingParkingFunctions(5)
|
|
278
|
+
sage: list(ndpf) == [pf.to_dyck_word().to_non_decreasing_parking_function() for pf in ndpf]
|
|
279
|
+
True
|
|
280
|
+
"""
|
|
281
|
+
from sage.combinat.dyck_word import CompleteDyckWords_all
|
|
282
|
+
return CompleteDyckWords_all().from_non_decreasing_parking_function(self)
|
|
283
|
+
|
|
284
|
+
def __len__(self) -> int:
|
|
285
|
+
"""
|
|
286
|
+
Return the length of ``self``.
|
|
287
|
+
|
|
288
|
+
EXAMPLES::
|
|
289
|
+
|
|
290
|
+
sage: ndpf = NonDecreasingParkingFunctions(5)
|
|
291
|
+
sage: len(ndpf.random_element())
|
|
292
|
+
5
|
|
293
|
+
"""
|
|
294
|
+
return len(self._list)
|
|
295
|
+
|
|
296
|
+
grade = __len__ # for the category SetsWithGrading
|
|
297
|
+
|
|
298
|
+
def _repr_(self) -> str:
|
|
299
|
+
"""
|
|
300
|
+
Return the string representation of ``self``.
|
|
301
|
+
|
|
302
|
+
EXAMPLES::
|
|
303
|
+
|
|
304
|
+
sage: NonDecreasingParkingFunction([1,1,1])
|
|
305
|
+
[1, 1, 1]
|
|
306
|
+
"""
|
|
307
|
+
return str(self._list)
|
|
308
|
+
|
|
309
|
+
def _richcmp_(self, other, op) -> bool:
|
|
310
|
+
"""
|
|
311
|
+
Compare ``self`` with ``other``.
|
|
312
|
+
|
|
313
|
+
EXAMPLES::
|
|
314
|
+
|
|
315
|
+
sage: a = NonDecreasingParkingFunction([1,1,1])
|
|
316
|
+
sage: b = NonDecreasingParkingFunction([1,1,2])
|
|
317
|
+
sage: a == b, a < b, b <= a
|
|
318
|
+
(False, True, False)
|
|
319
|
+
"""
|
|
320
|
+
return richcmp(self._list, other._list, op)
|
|
321
|
+
|
|
322
|
+
def __hash__(self) -> int:
|
|
323
|
+
"""
|
|
324
|
+
Return the hash of ``self``.
|
|
325
|
+
|
|
326
|
+
EXAMPLES::
|
|
327
|
+
|
|
328
|
+
sage: a = NonDecreasingParkingFunction([1,1,1])
|
|
329
|
+
sage: b = NonDecreasingParkingFunction([1,1,2])
|
|
330
|
+
sage: hash(a) == hash(b)
|
|
331
|
+
False
|
|
332
|
+
"""
|
|
333
|
+
return hash(tuple(self._list))
|
|
334
|
+
|
|
335
|
+
@classmethod
|
|
336
|
+
def from_dyck_word(cls, dw) -> NonDecreasingParkingFunction:
|
|
337
|
+
"""
|
|
338
|
+
Bijection from :class:`Dyck
|
|
339
|
+
words<sage.combinat.dyck_word.DyckWords>`. It is the inverse of the
|
|
340
|
+
bijection :meth:`.to_dyck_word`. You can find there the mathematical
|
|
341
|
+
definition.
|
|
342
|
+
|
|
343
|
+
EXAMPLES::
|
|
344
|
+
|
|
345
|
+
sage: NonDecreasingParkingFunction.from_dyck_word([])
|
|
346
|
+
[]
|
|
347
|
+
sage: NonDecreasingParkingFunction.from_dyck_word([1,0])
|
|
348
|
+
[1]
|
|
349
|
+
sage: NonDecreasingParkingFunction.from_dyck_word([1,1,0,0])
|
|
350
|
+
[1, 1]
|
|
351
|
+
sage: NonDecreasingParkingFunction.from_dyck_word([1,0,1,0])
|
|
352
|
+
[1, 2]
|
|
353
|
+
sage: NonDecreasingParkingFunction.from_dyck_word([1,0,1,1,0,1,0,0,1,0])
|
|
354
|
+
[1, 2, 2, 3, 5]
|
|
355
|
+
|
|
356
|
+
TESTS::
|
|
357
|
+
|
|
358
|
+
sage: ndpf = NonDecreasingParkingFunctions(5)
|
|
359
|
+
sage: list(ndpf) == [NonDecreasingParkingFunction.from_dyck_word(pf.to_dyck_word()) for pf in ndpf]
|
|
360
|
+
True
|
|
361
|
+
"""
|
|
362
|
+
res = []
|
|
363
|
+
val = 1
|
|
364
|
+
for i in dw:
|
|
365
|
+
if i == 0:
|
|
366
|
+
val += 1
|
|
367
|
+
else:
|
|
368
|
+
res.append(val)
|
|
369
|
+
return cls(res)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
class NonDecreasingParkingFunctions_all(UniqueRepresentation, Parent):
|
|
373
|
+
def __init__(self):
|
|
374
|
+
"""
|
|
375
|
+
TESTS::
|
|
376
|
+
|
|
377
|
+
sage: PF = NonDecreasingParkingFunctions()
|
|
378
|
+
sage: PF == loads(dumps(PF))
|
|
379
|
+
True
|
|
380
|
+
"""
|
|
381
|
+
cat = InfiniteEnumeratedSets() & SetsWithGrading()
|
|
382
|
+
Parent.__init__(self, category=cat)
|
|
383
|
+
|
|
384
|
+
def __repr__(self) -> str:
|
|
385
|
+
"""
|
|
386
|
+
TESTS::
|
|
387
|
+
|
|
388
|
+
sage: repr(NonDecreasingParkingFunctions())
|
|
389
|
+
'Non-decreasing parking functions'
|
|
390
|
+
"""
|
|
391
|
+
return "Non-decreasing parking functions"
|
|
392
|
+
|
|
393
|
+
def __contains__(self, x) -> bool:
|
|
394
|
+
"""
|
|
395
|
+
TESTS::
|
|
396
|
+
|
|
397
|
+
sage: [] in NonDecreasingParkingFunctions()
|
|
398
|
+
True
|
|
399
|
+
sage: [1] in NonDecreasingParkingFunctions()
|
|
400
|
+
True
|
|
401
|
+
sage: [2] in NonDecreasingParkingFunctions()
|
|
402
|
+
False
|
|
403
|
+
sage: [1,1,3] in NonDecreasingParkingFunctions()
|
|
404
|
+
True
|
|
405
|
+
sage: [1,1,4] in NonDecreasingParkingFunctions()
|
|
406
|
+
False
|
|
407
|
+
"""
|
|
408
|
+
if isinstance(x, NonDecreasingParkingFunction):
|
|
409
|
+
return True
|
|
410
|
+
return is_a(x)
|
|
411
|
+
|
|
412
|
+
def __iter__(self):
|
|
413
|
+
"""
|
|
414
|
+
An iterator.
|
|
415
|
+
|
|
416
|
+
TESTS::
|
|
417
|
+
|
|
418
|
+
sage: it = iter(NonDecreasingParkingFunctions()) # indirect doctest
|
|
419
|
+
sage: [next(it) for i in range(8)]
|
|
420
|
+
[[], [1], [1, 1], [1, 2], [1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2]]
|
|
421
|
+
"""
|
|
422
|
+
for n in NN:
|
|
423
|
+
yield from NonDecreasingParkingFunctions_n(n)
|
|
424
|
+
|
|
425
|
+
def graded_component(self, n):
|
|
426
|
+
"""
|
|
427
|
+
Return the graded component.
|
|
428
|
+
|
|
429
|
+
EXAMPLES::
|
|
430
|
+
|
|
431
|
+
sage: P = NonDecreasingParkingFunctions()
|
|
432
|
+
sage: P.graded_component(4) == NonDecreasingParkingFunctions(4)
|
|
433
|
+
True
|
|
434
|
+
"""
|
|
435
|
+
return NonDecreasingParkingFunctions_n(n)
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
class NonDecreasingParkingFunctions_n(UniqueRepresentation, Parent):
|
|
439
|
+
r"""
|
|
440
|
+
The combinatorial class of non-decreasing parking functions of
|
|
441
|
+
size `n`.
|
|
442
|
+
|
|
443
|
+
A *non-decreasing parking function* of size `n` is a non-decreasing
|
|
444
|
+
function `f` from `\{1,\dots,n\}` to itself such that for all `i`,
|
|
445
|
+
one has `f(i) \leq i`.
|
|
446
|
+
|
|
447
|
+
The number of non-decreasing parking functions of size `n` is the
|
|
448
|
+
`n`-th Catalan number.
|
|
449
|
+
|
|
450
|
+
EXAMPLES::
|
|
451
|
+
|
|
452
|
+
sage: PF = NonDecreasingParkingFunctions(3)
|
|
453
|
+
sage: PF.list()
|
|
454
|
+
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]]
|
|
455
|
+
sage: PF = NonDecreasingParkingFunctions(4)
|
|
456
|
+
sage: PF.list()
|
|
457
|
+
[[1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 1, 3], [1, 1, 1, 4], [1, 1, 2, 2], [1, 1, 2, 3], [1, 1, 2, 4], [1, 1, 3, 3], [1, 1, 3, 4], [1, 2, 2, 2], [1, 2, 2, 3], [1, 2, 2, 4], [1, 2, 3, 3], [1, 2, 3, 4]]
|
|
458
|
+
sage: [ NonDecreasingParkingFunctions(i).cardinality() for i in range(10)]
|
|
459
|
+
[1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862]
|
|
460
|
+
|
|
461
|
+
.. warning::
|
|
462
|
+
|
|
463
|
+
The precise order in which the parking function are generated or
|
|
464
|
+
listed is not fixed, and may change in the future.
|
|
465
|
+
|
|
466
|
+
AUTHORS:
|
|
467
|
+
|
|
468
|
+
- Florent Hivert
|
|
469
|
+
"""
|
|
470
|
+
|
|
471
|
+
def __init__(self, n):
|
|
472
|
+
"""
|
|
473
|
+
TESTS::
|
|
474
|
+
|
|
475
|
+
sage: PF = NonDecreasingParkingFunctions(3)
|
|
476
|
+
sage: PF == loads(dumps(PF))
|
|
477
|
+
True
|
|
478
|
+
sage: TestSuite(PF).run(skip='_test_elements')
|
|
479
|
+
"""
|
|
480
|
+
n = Integer(n)
|
|
481
|
+
if n < 0:
|
|
482
|
+
raise ValueError('%s is not a nonnegative integer' % n)
|
|
483
|
+
self.n = n
|
|
484
|
+
Parent.__init__(self, category=Monoids().Enumerated().Finite())
|
|
485
|
+
|
|
486
|
+
def __repr__(self) -> str:
|
|
487
|
+
"""
|
|
488
|
+
TESTS::
|
|
489
|
+
|
|
490
|
+
sage: repr(NonDecreasingParkingFunctions(3))
|
|
491
|
+
'Non-decreasing parking functions of size 3'
|
|
492
|
+
"""
|
|
493
|
+
return "Non-decreasing parking functions of size %s" % self.n
|
|
494
|
+
|
|
495
|
+
def __contains__(self, x) -> bool:
|
|
496
|
+
"""
|
|
497
|
+
TESTS::
|
|
498
|
+
|
|
499
|
+
sage: PF3 = NonDecreasingParkingFunctions(3); PF3
|
|
500
|
+
Non-decreasing parking functions of size 3
|
|
501
|
+
sage: [] in PF3
|
|
502
|
+
False
|
|
503
|
+
sage: [1] in PF3
|
|
504
|
+
False
|
|
505
|
+
sage: [1,1,3] in PF3
|
|
506
|
+
True
|
|
507
|
+
sage: [1,1,1] in PF3
|
|
508
|
+
True
|
|
509
|
+
sage: [1,1,4] in PF3
|
|
510
|
+
False
|
|
511
|
+
sage: all(p in PF3 for p in PF3)
|
|
512
|
+
True
|
|
513
|
+
"""
|
|
514
|
+
if isinstance(x, NonDecreasingParkingFunction):
|
|
515
|
+
return True
|
|
516
|
+
return is_a(x, self.n)
|
|
517
|
+
|
|
518
|
+
def cardinality(self) -> Integer:
|
|
519
|
+
"""
|
|
520
|
+
Return the number of non-decreasing parking functions of size
|
|
521
|
+
`n`.
|
|
522
|
+
|
|
523
|
+
This number is the `n`-th :func:`Catalan
|
|
524
|
+
number<sage.combinat.combinat.catalan_number>`.
|
|
525
|
+
|
|
526
|
+
EXAMPLES::
|
|
527
|
+
|
|
528
|
+
sage: PF = NonDecreasingParkingFunctions(0)
|
|
529
|
+
sage: PF.cardinality()
|
|
530
|
+
1
|
|
531
|
+
sage: PF = NonDecreasingParkingFunctions(1)
|
|
532
|
+
sage: PF.cardinality()
|
|
533
|
+
1
|
|
534
|
+
sage: PF = NonDecreasingParkingFunctions(3)
|
|
535
|
+
sage: PF.cardinality()
|
|
536
|
+
5
|
|
537
|
+
sage: PF = NonDecreasingParkingFunctions(5)
|
|
538
|
+
sage: PF.cardinality()
|
|
539
|
+
42
|
|
540
|
+
"""
|
|
541
|
+
return catalan_number(self.n)
|
|
542
|
+
|
|
543
|
+
def random_element(self) -> NonDecreasingParkingFunction:
|
|
544
|
+
"""
|
|
545
|
+
Return a random parking function of the given size.
|
|
546
|
+
|
|
547
|
+
EXAMPLES::
|
|
548
|
+
|
|
549
|
+
sage: ndpf = NonDecreasingParkingFunctions(5)
|
|
550
|
+
sage: x = ndpf.random_element(); x # random
|
|
551
|
+
[1, 2, 2, 4, 5]
|
|
552
|
+
sage: x in ndpf
|
|
553
|
+
True
|
|
554
|
+
"""
|
|
555
|
+
from sage.combinat.dyck_word import DyckWords
|
|
556
|
+
n = self.n
|
|
557
|
+
dw = DyckWords(n).random_element()
|
|
558
|
+
return NonDecreasingParkingFunction.from_dyck_word(dw)
|
|
559
|
+
|
|
560
|
+
def one(self) -> NonDecreasingParkingFunction:
|
|
561
|
+
"""
|
|
562
|
+
Return the unit of this monoid.
|
|
563
|
+
|
|
564
|
+
This is the non-decreasing parking function [1, 2, ..., n].
|
|
565
|
+
|
|
566
|
+
EXAMPLES::
|
|
567
|
+
|
|
568
|
+
sage: ndpf = NonDecreasingParkingFunctions(5)
|
|
569
|
+
sage: x = ndpf.random_element(); x # random
|
|
570
|
+
sage: e = ndpf.one()
|
|
571
|
+
sage: x == e*x == x*e
|
|
572
|
+
True
|
|
573
|
+
"""
|
|
574
|
+
return NonDecreasingParkingFunction(list(range(1, self.n + 1)))
|
|
575
|
+
|
|
576
|
+
def __iter__(self):
|
|
577
|
+
"""
|
|
578
|
+
Return an iterator for non-decreasing parking functions of size `n`.
|
|
579
|
+
|
|
580
|
+
.. warning::
|
|
581
|
+
|
|
582
|
+
The precise order in which the parking function are
|
|
583
|
+
generated is not fixed, and may change in the future.
|
|
584
|
+
|
|
585
|
+
EXAMPLES::
|
|
586
|
+
|
|
587
|
+
sage: PF = NonDecreasingParkingFunctions(0)
|
|
588
|
+
sage: [e for e in PF] # indirect doctest
|
|
589
|
+
[[]]
|
|
590
|
+
sage: PF = NonDecreasingParkingFunctions(1)
|
|
591
|
+
sage: [e for e in PF] # indirect doctest
|
|
592
|
+
[[1]]
|
|
593
|
+
sage: PF = NonDecreasingParkingFunctions(3)
|
|
594
|
+
sage: [e for e in PF] # indirect doctest
|
|
595
|
+
[[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3]]
|
|
596
|
+
sage: PF = NonDecreasingParkingFunctions(4)
|
|
597
|
+
sage: [e for e in PF] # indirect doctest
|
|
598
|
+
[[1, 1, 1, 1], [1, 1, 1, 2], [1, 1, 1, 3], [1, 1, 1, 4], [1, 1, 2, 2], [1, 1, 2, 3], [1, 1, 2, 4], [1, 1, 3, 3], [1, 1, 3, 4], [1, 2, 2, 2], [1, 2, 2, 3], [1, 2, 2, 4], [1, 2, 3, 3], [1, 2, 3, 4]]
|
|
599
|
+
|
|
600
|
+
TESTS::
|
|
601
|
+
|
|
602
|
+
sage: PF = NonDecreasingParkingFunctions(5)
|
|
603
|
+
sage: [e for e in PF] == PF.list()
|
|
604
|
+
True
|
|
605
|
+
sage: PF = NonDecreasingParkingFunctions(6)
|
|
606
|
+
sage: [e for e in PF] == PF.list()
|
|
607
|
+
True
|
|
608
|
+
|
|
609
|
+
Complexity: constant amortized time.
|
|
610
|
+
"""
|
|
611
|
+
def iterator_rec(n):
|
|
612
|
+
"""
|
|
613
|
+
TESTS::
|
|
614
|
+
|
|
615
|
+
sage: PF = NonDecreasingParkingFunctions(2)
|
|
616
|
+
sage: [e for e in PF] # indirect doctest
|
|
617
|
+
[[1, 1], [1, 2]]
|
|
618
|
+
"""
|
|
619
|
+
if n == 0:
|
|
620
|
+
yield []
|
|
621
|
+
return
|
|
622
|
+
if n == 1:
|
|
623
|
+
yield [1]
|
|
624
|
+
return
|
|
625
|
+
for res1 in iterator_rec(n - 1):
|
|
626
|
+
for i in range(res1[-1], n + 1):
|
|
627
|
+
res = copy(res1)
|
|
628
|
+
res.append(i)
|
|
629
|
+
yield res
|
|
630
|
+
return
|
|
631
|
+
for res in iterator_rec(self.n):
|
|
632
|
+
yield NonDecreasingParkingFunction(res)
|
|
633
|
+
|
|
634
|
+
Element = NonDecreasingParkingFunction
|