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,855 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-combinat
|
|
2
|
+
r"""
|
|
3
|
+
Composition tableaux
|
|
4
|
+
|
|
5
|
+
AUTHORS:
|
|
6
|
+
|
|
7
|
+
- Chris Berg, Jeff Ferreira (2012-9): initial version
|
|
8
|
+
"""
|
|
9
|
+
from sage.sets.disjoint_union_enumerated_sets import DisjointUnionEnumeratedSets
|
|
10
|
+
from sage.sets.non_negative_integers import NonNegativeIntegers
|
|
11
|
+
from sage.sets.family import Family
|
|
12
|
+
from sage.misc.classcall_metaclass import ClasscallMetaclass
|
|
13
|
+
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
|
|
14
|
+
from sage.structure.parent import Parent
|
|
15
|
+
from sage.structure.unique_representation import UniqueRepresentation
|
|
16
|
+
from sage.combinat.composition import Composition, Compositions
|
|
17
|
+
from sage.combinat.partition import Partition
|
|
18
|
+
from sage.combinat.combinat import CombinatorialElement
|
|
19
|
+
from sage.rings.integer import Integer
|
|
20
|
+
from sage.combinat.backtrack import GenericBacktracker
|
|
21
|
+
import copy
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CompositionTableau(CombinatorialElement, metaclass=ClasscallMetaclass):
|
|
25
|
+
r"""
|
|
26
|
+
A composition tableau.
|
|
27
|
+
|
|
28
|
+
A *composition tableau* `t` of shape `I = (I_1, \ldots, I_{\ell})` is an
|
|
29
|
+
array of boxes in rows, `I_i` boxes in row `i`, filled with positive
|
|
30
|
+
integers such that:
|
|
31
|
+
|
|
32
|
+
1) the entries in the rows of `t` weakly decrease from left to right,
|
|
33
|
+
2) the left-most column of `t` strictly increase from top to bottom.
|
|
34
|
+
3) Add zero entries to the rows of `t` until the resulting array is
|
|
35
|
+
rectangular of shape `\ell \times m`. For `1 \leq i < j \leq \ell,
|
|
36
|
+
2 \leq k \leq m` and `(t(j,k) \neq 0`, and also if `t(j,k) \geq t(i,k))`
|
|
37
|
+
implies `t(j,k) > t(i,k-1).`
|
|
38
|
+
|
|
39
|
+
INPUT:
|
|
40
|
+
|
|
41
|
+
- ``t`` -- list of lists
|
|
42
|
+
|
|
43
|
+
EXAMPLES::
|
|
44
|
+
|
|
45
|
+
sage: CompositionTableau([[1],[2,2]])
|
|
46
|
+
[[1], [2, 2]]
|
|
47
|
+
sage: CompositionTableau([[1],[3,2],[4,4]])
|
|
48
|
+
[[1], [3, 2], [4, 4]]
|
|
49
|
+
sage: CompositionTableau([])
|
|
50
|
+
[]
|
|
51
|
+
"""
|
|
52
|
+
@staticmethod
|
|
53
|
+
def __classcall_private__(self, t):
|
|
54
|
+
r"""
|
|
55
|
+
This ensures that a composition tableau is only ever constructed as
|
|
56
|
+
an ``element_class`` call of an appropriate parent.
|
|
57
|
+
|
|
58
|
+
TESTS::
|
|
59
|
+
|
|
60
|
+
sage: t = CompositionTableau([[1],[2,2]])
|
|
61
|
+
sage: TestSuite(t).run()
|
|
62
|
+
|
|
63
|
+
sage: t.parent()
|
|
64
|
+
Composition Tableaux
|
|
65
|
+
sage: t.category()
|
|
66
|
+
Category of elements of Composition Tableaux
|
|
67
|
+
"""
|
|
68
|
+
if isinstance(t, CompositionTableau):
|
|
69
|
+
return t
|
|
70
|
+
return CompositionTableaux_all().element_class(CompositionTableaux_all(), t)
|
|
71
|
+
|
|
72
|
+
def __init__(self, parent, t):
|
|
73
|
+
r"""
|
|
74
|
+
Initialize a composition tableau.
|
|
75
|
+
|
|
76
|
+
TESTS::
|
|
77
|
+
|
|
78
|
+
sage: t = CompositionTableaux()([[1],[2,2]])
|
|
79
|
+
sage: s = CompositionTableaux(3)([[1],[2,2]])
|
|
80
|
+
sage: s == t
|
|
81
|
+
True
|
|
82
|
+
sage: t.parent()
|
|
83
|
+
Composition Tableaux
|
|
84
|
+
sage: s.parent()
|
|
85
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
86
|
+
sage: r = CompositionTableaux()(s)
|
|
87
|
+
sage: r.parent()
|
|
88
|
+
Composition Tableaux
|
|
89
|
+
"""
|
|
90
|
+
if isinstance(t, CompositionTableau):
|
|
91
|
+
CombinatorialElement.__init__(self, parent, t._list)
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
# CombinatorialObject verifies that t is a list
|
|
95
|
+
# We must verify t is a list of lists
|
|
96
|
+
if not all(isinstance(row, list) for row in t):
|
|
97
|
+
raise ValueError("a composition tableau must be a list of lists")
|
|
98
|
+
|
|
99
|
+
if any(not r for r in t):
|
|
100
|
+
raise ValueError("a composition tableau must be a list of non-empty lists")
|
|
101
|
+
|
|
102
|
+
# Verify rows weakly decrease from left to right
|
|
103
|
+
for row in t:
|
|
104
|
+
if any(row[i] < row[i + 1] for i in range(len(row) - 1)):
|
|
105
|
+
raise ValueError("rows must weakly decrease from left to right")
|
|
106
|
+
|
|
107
|
+
# Verify leftmost column strictly increases from top to bottom
|
|
108
|
+
first_col = [row[0] for row in t if t != [[]]]
|
|
109
|
+
if any(first_col[i] >= first_col[i + 1] for i in range(len(t) - 1)):
|
|
110
|
+
raise ValueError("leftmost column must strictly increase from top to bottom")
|
|
111
|
+
|
|
112
|
+
# Verify triple condition
|
|
113
|
+
l = len(t)
|
|
114
|
+
m = max((len(r) for r in t), default=0)
|
|
115
|
+
TT = [row+[0]*(m-len(row)) for row in t]
|
|
116
|
+
for i in range(l):
|
|
117
|
+
for j in range(i+1, l):
|
|
118
|
+
for k in range(1, m):
|
|
119
|
+
if TT[j][k] and TT[i][k] <= TT[j][k] <= TT[i][k-1]:
|
|
120
|
+
raise ValueError("triple condition must be satisfied")
|
|
121
|
+
|
|
122
|
+
CombinatorialElement.__init__(self, parent, t)
|
|
123
|
+
|
|
124
|
+
def _repr_diagram(self) -> str:
|
|
125
|
+
r"""
|
|
126
|
+
Return a string representation of ``self`` as an array.
|
|
127
|
+
|
|
128
|
+
EXAMPLES::
|
|
129
|
+
|
|
130
|
+
sage: t = CompositionTableau([[1],[3,2],[4,4]])
|
|
131
|
+
sage: print(t._repr_diagram())
|
|
132
|
+
1
|
|
133
|
+
3 2
|
|
134
|
+
4 4
|
|
135
|
+
"""
|
|
136
|
+
return '\n'.join("".join("%3s" % str(x) for x in row)
|
|
137
|
+
for row in self)
|
|
138
|
+
|
|
139
|
+
def __call__(self, *cell):
|
|
140
|
+
r"""
|
|
141
|
+
Return the value in the corresponding cell of ``self``.
|
|
142
|
+
|
|
143
|
+
EXAMPLES::
|
|
144
|
+
|
|
145
|
+
sage: t = CompositionTableau([[1],[3,2],[4,4]])
|
|
146
|
+
sage: t(1,1)
|
|
147
|
+
2
|
|
148
|
+
sage: t(2,0)
|
|
149
|
+
4
|
|
150
|
+
sage: t(2,2)
|
|
151
|
+
Traceback (most recent call last):
|
|
152
|
+
...
|
|
153
|
+
IndexError: the cell (2,2) is not contained in [[1], [3, 2], [4, 4]]
|
|
154
|
+
"""
|
|
155
|
+
try:
|
|
156
|
+
i, j = cell
|
|
157
|
+
except ValueError:
|
|
158
|
+
i, j = cell[0]
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
return self[i][j]
|
|
162
|
+
except IndexError:
|
|
163
|
+
raise IndexError("the cell (%d,%d) is not contained in %s" % (i, j, self))
|
|
164
|
+
|
|
165
|
+
def pp(self):
|
|
166
|
+
r"""
|
|
167
|
+
Return a pretty print string of ``self``.
|
|
168
|
+
|
|
169
|
+
EXAMPLES::
|
|
170
|
+
|
|
171
|
+
sage: CompositionTableau([[1],[3,2],[4,4]]).pp()
|
|
172
|
+
1
|
|
173
|
+
3 2
|
|
174
|
+
4 4
|
|
175
|
+
"""
|
|
176
|
+
print(self._repr_diagram())
|
|
177
|
+
|
|
178
|
+
def size(self):
|
|
179
|
+
r"""
|
|
180
|
+
Return the number of boxes in ``self``.
|
|
181
|
+
|
|
182
|
+
EXAMPLES::
|
|
183
|
+
|
|
184
|
+
sage: CompositionTableau([[1],[3,2],[4,4]]).size()
|
|
185
|
+
5
|
|
186
|
+
"""
|
|
187
|
+
return sum(len(row) for row in self)
|
|
188
|
+
|
|
189
|
+
def weight(self):
|
|
190
|
+
r"""
|
|
191
|
+
Return a composition where entry `i` is the number of times that `i` appears in
|
|
192
|
+
``self``.
|
|
193
|
+
|
|
194
|
+
EXAMPLES::
|
|
195
|
+
|
|
196
|
+
sage: CompositionTableau([[1],[3,2],[4,4]]).weight()
|
|
197
|
+
[1, 1, 1, 2, 0]
|
|
198
|
+
"""
|
|
199
|
+
w = {i: 0 for i in range(1, self.size() + 1)}
|
|
200
|
+
for row in self:
|
|
201
|
+
for i in row:
|
|
202
|
+
w[i] += 1
|
|
203
|
+
return Composition([w[i] for i in range(1, self.size()+1)])
|
|
204
|
+
|
|
205
|
+
def descent_set(self):
|
|
206
|
+
r"""
|
|
207
|
+
Return the set of all `i` that do *not* have `i+1` appearing strictly
|
|
208
|
+
to the left of `i` in ``self``.
|
|
209
|
+
|
|
210
|
+
EXAMPLES::
|
|
211
|
+
|
|
212
|
+
sage: CompositionTableau([[1],[3,2],[4,4]]).descent_set()
|
|
213
|
+
[1, 3]
|
|
214
|
+
"""
|
|
215
|
+
cols = {i: col for row in self for col, i in enumerate(row)}
|
|
216
|
+
return sorted(i for i in cols if i + 1 in cols and cols[i + 1] >= cols[i])
|
|
217
|
+
|
|
218
|
+
def descent_composition(self):
|
|
219
|
+
r"""
|
|
220
|
+
Return the composition corresponding to the set of all `i` that do
|
|
221
|
+
not have `i+1` appearing strictly to the left of `i` in ``self``.
|
|
222
|
+
|
|
223
|
+
EXAMPLES::
|
|
224
|
+
|
|
225
|
+
sage: CompositionTableau([[1],[3,2],[4,4]]).descent_composition()
|
|
226
|
+
[1, 2, 2]
|
|
227
|
+
"""
|
|
228
|
+
return Composition(from_subset=(self.descent_set(), self.size()))
|
|
229
|
+
|
|
230
|
+
def shape_composition(self):
|
|
231
|
+
r"""
|
|
232
|
+
Return a Composition object which is the shape of ``self``.
|
|
233
|
+
|
|
234
|
+
EXAMPLES::
|
|
235
|
+
|
|
236
|
+
sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).shape_composition()
|
|
237
|
+
[2, 2, 3]
|
|
238
|
+
sage: CompositionTableau([[2,1],[3],[4]]).shape_composition()
|
|
239
|
+
[2, 1, 1]
|
|
240
|
+
"""
|
|
241
|
+
return Composition([len(row) for row in self])
|
|
242
|
+
|
|
243
|
+
def shape_partition(self):
|
|
244
|
+
r"""
|
|
245
|
+
Return a partition which is the shape of ``self`` sorted into weakly
|
|
246
|
+
decreasing order.
|
|
247
|
+
|
|
248
|
+
EXAMPLES::
|
|
249
|
+
|
|
250
|
+
sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).shape_partition()
|
|
251
|
+
[3, 2, 2]
|
|
252
|
+
sage: CompositionTableau([[2,1],[3],[4]]).shape_partition()
|
|
253
|
+
[2, 1, 1]
|
|
254
|
+
"""
|
|
255
|
+
return Partition(sorted((len(row) for row in self), reverse=True))
|
|
256
|
+
|
|
257
|
+
def is_standard(self):
|
|
258
|
+
r"""
|
|
259
|
+
Return ``True`` if ``self`` is a standard composition tableau and
|
|
260
|
+
``False`` otherwise.
|
|
261
|
+
|
|
262
|
+
EXAMPLES::
|
|
263
|
+
|
|
264
|
+
sage: CompositionTableau([[1,1],[3,2],[4,4,3]]).is_standard()
|
|
265
|
+
False
|
|
266
|
+
sage: CompositionTableau([[2,1],[3],[4]]).is_standard()
|
|
267
|
+
True
|
|
268
|
+
"""
|
|
269
|
+
entries = sum(self, [])
|
|
270
|
+
return sorted(entries) == list(range(1, self.size() + 1))
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class CompositionTableaux(UniqueRepresentation, Parent):
|
|
274
|
+
r"""
|
|
275
|
+
Composition tableaux.
|
|
276
|
+
|
|
277
|
+
INPUT:
|
|
278
|
+
|
|
279
|
+
- ``size`` -- the size of the composition tableaux
|
|
280
|
+
- ``shape`` -- the shape of the composition tableaux
|
|
281
|
+
- ``max_entry`` -- the maximum entry for the composition tableaux
|
|
282
|
+
|
|
283
|
+
The first argument is interpreted as ``size`` or ``shape`` depending on
|
|
284
|
+
whether it is an integer or a composition.
|
|
285
|
+
|
|
286
|
+
EXAMPLES::
|
|
287
|
+
|
|
288
|
+
sage: CT = CompositionTableaux(3); CT
|
|
289
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
290
|
+
sage: list(CT)
|
|
291
|
+
[[[1], [2], [3]],
|
|
292
|
+
[[1], [2, 2]],
|
|
293
|
+
[[1], [3, 2]],
|
|
294
|
+
[[1], [3, 3]],
|
|
295
|
+
[[2], [3, 3]],
|
|
296
|
+
[[1, 1], [2]],
|
|
297
|
+
[[1, 1], [3]],
|
|
298
|
+
[[2, 1], [3]],
|
|
299
|
+
[[2, 2], [3]],
|
|
300
|
+
[[1, 1, 1]],
|
|
301
|
+
[[2, 1, 1]],
|
|
302
|
+
[[2, 2, 1]],
|
|
303
|
+
[[2, 2, 2]],
|
|
304
|
+
[[3, 1, 1]],
|
|
305
|
+
[[3, 2, 1]],
|
|
306
|
+
[[3, 2, 2]],
|
|
307
|
+
[[3, 3, 1]],
|
|
308
|
+
[[3, 3, 2]],
|
|
309
|
+
[[3, 3, 3]]]
|
|
310
|
+
|
|
311
|
+
sage: CT = CompositionTableaux([1,2,1]); CT
|
|
312
|
+
Composition tableaux of shape [1, 2, 1] and maximum entry 4
|
|
313
|
+
sage: list(CT)
|
|
314
|
+
[[[1], [2, 2], [3]],
|
|
315
|
+
[[1], [2, 2], [4]],
|
|
316
|
+
[[1], [3, 2], [4]],
|
|
317
|
+
[[1], [3, 3], [4]],
|
|
318
|
+
[[2], [3, 3], [4]]]
|
|
319
|
+
|
|
320
|
+
sage: CT = CompositionTableaux(shape=[1,2,1],max_entry=3); CT
|
|
321
|
+
Composition tableaux of shape [1, 2, 1] and maximum entry 3
|
|
322
|
+
sage: list(CT)
|
|
323
|
+
[[[1], [2, 2], [3]]]
|
|
324
|
+
|
|
325
|
+
sage: CT = CompositionTableaux(2,max_entry=3); CT
|
|
326
|
+
Composition Tableaux of size 2 and maximum entry 3
|
|
327
|
+
sage: list(CT)
|
|
328
|
+
[[[1], [2]],
|
|
329
|
+
[[1], [3]],
|
|
330
|
+
[[2], [3]],
|
|
331
|
+
[[1, 1]],
|
|
332
|
+
[[2, 1]],
|
|
333
|
+
[[2, 2]],
|
|
334
|
+
[[3, 1]],
|
|
335
|
+
[[3, 2]],
|
|
336
|
+
[[3, 3]]]
|
|
337
|
+
|
|
338
|
+
sage: CT = CompositionTableaux(0); CT
|
|
339
|
+
Composition Tableaux of size 0 and maximum entry 0
|
|
340
|
+
sage: list(CT)
|
|
341
|
+
[[]]
|
|
342
|
+
"""
|
|
343
|
+
@staticmethod
|
|
344
|
+
def __classcall_private__(cls, *args, **kwargs):
|
|
345
|
+
r"""
|
|
346
|
+
This is a factory class which returns the appropriate parent based on
|
|
347
|
+
arguments. See the documentation for :class:`CompositionTableaux` for
|
|
348
|
+
more information.
|
|
349
|
+
|
|
350
|
+
TESTS::
|
|
351
|
+
|
|
352
|
+
sage: CT = CompositionTableaux(3); CT
|
|
353
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
354
|
+
sage: CT = CompositionTableaux(size=3); CT
|
|
355
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
356
|
+
sage: CT = CompositionTableaux([1,2]); CT
|
|
357
|
+
Composition tableaux of shape [1, 2] and maximum entry 3
|
|
358
|
+
sage: CT = CompositionTableaux(shape=[1,2]); CT
|
|
359
|
+
Composition tableaux of shape [1, 2] and maximum entry 3
|
|
360
|
+
sage: CT = CompositionTableaux(shape=[]); CT
|
|
361
|
+
Composition tableaux of shape [] and maximum entry 0
|
|
362
|
+
sage: CT = CompositionTableaux(0); CT
|
|
363
|
+
Composition Tableaux of size 0 and maximum entry 0
|
|
364
|
+
sage: CT = CompositionTableaux(max_entry=3); CT
|
|
365
|
+
Composition tableaux with maximum entry 3
|
|
366
|
+
sage: CT = CompositionTableaux([1,2],max_entry=3); CT
|
|
367
|
+
Composition tableaux of shape [1, 2] and maximum entry 3
|
|
368
|
+
sage: CT = CompositionTableaux(size=2,shape=[1,2]); CT
|
|
369
|
+
Traceback (most recent call last):
|
|
370
|
+
...
|
|
371
|
+
ValueError: size and shape are different sizes
|
|
372
|
+
"""
|
|
373
|
+
# Process keyword arguments first
|
|
374
|
+
n = kwargs.get('n', None)
|
|
375
|
+
size = kwargs.get('size', n)
|
|
376
|
+
|
|
377
|
+
comp = kwargs.get('comp', None)
|
|
378
|
+
shape = kwargs.get('shape', comp)
|
|
379
|
+
|
|
380
|
+
max_entry = kwargs.get('max_entry', None)
|
|
381
|
+
|
|
382
|
+
# Process positional arguments
|
|
383
|
+
if args:
|
|
384
|
+
# The first arg could be either a size or a shape
|
|
385
|
+
if isinstance(args[0], (int, Integer)):
|
|
386
|
+
if size is not None:
|
|
387
|
+
raise ValueError("size was specified more than once")
|
|
388
|
+
else:
|
|
389
|
+
size = args[0]
|
|
390
|
+
else:
|
|
391
|
+
if shape is not None:
|
|
392
|
+
raise ValueError("the shape was specified more than once")
|
|
393
|
+
shape = args[0]
|
|
394
|
+
|
|
395
|
+
# Consistency checks
|
|
396
|
+
if size is not None:
|
|
397
|
+
if not isinstance(size, (int, Integer)):
|
|
398
|
+
raise ValueError("size must be an integer")
|
|
399
|
+
elif size < 0:
|
|
400
|
+
raise ValueError("size must be nonnegative")
|
|
401
|
+
|
|
402
|
+
if shape is not None:
|
|
403
|
+
# use in (and not isinstance) below so that lists can be used as
|
|
404
|
+
# shorthand
|
|
405
|
+
if shape not in Compositions():
|
|
406
|
+
raise ValueError("shape must be a composition")
|
|
407
|
+
if any(i == 0 for i in shape):
|
|
408
|
+
raise ValueError("shape must have nonzero parts")
|
|
409
|
+
shape = Composition(shape)
|
|
410
|
+
|
|
411
|
+
if (size is not None) and (shape is not None):
|
|
412
|
+
if sum(shape) != size:
|
|
413
|
+
raise ValueError("size and shape are different sizes")
|
|
414
|
+
|
|
415
|
+
if max_entry is not None:
|
|
416
|
+
if not isinstance(max_entry, (int, Integer)):
|
|
417
|
+
raise ValueError("max_entry must be an integer")
|
|
418
|
+
elif max_entry <= 0:
|
|
419
|
+
raise ValueError("max_entry must be positive")
|
|
420
|
+
|
|
421
|
+
# Dispatch to appropriate class
|
|
422
|
+
if (shape is not None):
|
|
423
|
+
return CompositionTableaux_shape(shape, max_entry)
|
|
424
|
+
|
|
425
|
+
if (size is not None):
|
|
426
|
+
return CompositionTableaux_size(size, max_entry)
|
|
427
|
+
|
|
428
|
+
return CompositionTableaux_all(max_entry)
|
|
429
|
+
|
|
430
|
+
def __init__(self, **kwds):
|
|
431
|
+
r"""
|
|
432
|
+
Initialize ``self``.
|
|
433
|
+
|
|
434
|
+
TESTS::
|
|
435
|
+
|
|
436
|
+
sage: CT = CompositionTableaux()
|
|
437
|
+
sage: TestSuite(CT).run()
|
|
438
|
+
"""
|
|
439
|
+
if 'max_entry' in kwds:
|
|
440
|
+
self.max_entry = kwds['max_entry']
|
|
441
|
+
kwds.pop('max_entry')
|
|
442
|
+
else:
|
|
443
|
+
self.max_entry = None
|
|
444
|
+
super().__init__(**kwds)
|
|
445
|
+
|
|
446
|
+
Element = CompositionTableau
|
|
447
|
+
|
|
448
|
+
def _element_constructor_(self, t):
|
|
449
|
+
r"""
|
|
450
|
+
Construct an object from ``t`` as an element of ``self``, if
|
|
451
|
+
possible.
|
|
452
|
+
|
|
453
|
+
INPUT:
|
|
454
|
+
|
|
455
|
+
- ``t`` -- data which can be interpreted as a composition tableau
|
|
456
|
+
|
|
457
|
+
OUTPUT: the corresponding CompositionTableau object
|
|
458
|
+
|
|
459
|
+
TESTS::
|
|
460
|
+
|
|
461
|
+
sage: CT = CompositionTableaux(3)
|
|
462
|
+
sage: CT([[1],[2,2]]).parent() is CT
|
|
463
|
+
True
|
|
464
|
+
sage: CT([[1],[1,2]])
|
|
465
|
+
Traceback (most recent call last):
|
|
466
|
+
...
|
|
467
|
+
ValueError: [[1], [1, 2]] is not an element of Composition Tableaux of size 3 and maximum entry 3
|
|
468
|
+
"""
|
|
469
|
+
if t not in self:
|
|
470
|
+
raise ValueError("%s is not an element of %s" % (t, self))
|
|
471
|
+
|
|
472
|
+
return self.element_class(self, t)
|
|
473
|
+
|
|
474
|
+
def __contains__(self, T):
|
|
475
|
+
r"""
|
|
476
|
+
Return ``True`` if ``T`` can be interpreted as
|
|
477
|
+
:class:`CompositionTableau`.
|
|
478
|
+
|
|
479
|
+
TESTS::
|
|
480
|
+
|
|
481
|
+
sage: [[1],[2,2]] in CompositionTableaux(3)
|
|
482
|
+
True
|
|
483
|
+
sage: [[1],[2,2]] in CompositionTableaux(shape=[1,2])
|
|
484
|
+
True
|
|
485
|
+
sage: CompositionTableau([[1],[2,2]]) in CompositionTableaux()
|
|
486
|
+
True
|
|
487
|
+
sage: [[1],[2,2],[2]] in CompositionTableaux()
|
|
488
|
+
False
|
|
489
|
+
"""
|
|
490
|
+
if isinstance(T, CompositionTableau):
|
|
491
|
+
return True
|
|
492
|
+
|
|
493
|
+
# leftmost column of T strictly increases from top to bottom
|
|
494
|
+
first_col = [row[0] for row in T]
|
|
495
|
+
if any(first_col[i] >= first_col[i+1] for i in range(len(T)-1)):
|
|
496
|
+
return False
|
|
497
|
+
# rows of T weakly decrease from left to right
|
|
498
|
+
for row in T:
|
|
499
|
+
if any(row[i] < row[i+1] for i in range(len(row)-1)):
|
|
500
|
+
return False
|
|
501
|
+
# for 1 <= i < j <= len(comp), for 2 <= k <= m,
|
|
502
|
+
# T[j,k] \neq 0 and T[j,k] >= T[i,k] ==> T[j,k] > T[i,k-1]
|
|
503
|
+
l = len(T)
|
|
504
|
+
m = max((len(r) for r in T), default=0)
|
|
505
|
+
TT = [row+[0]*(m-len(row)) for row in T]
|
|
506
|
+
for i in range(l):
|
|
507
|
+
for j in range(i+1, l):
|
|
508
|
+
for k in range(1, m):
|
|
509
|
+
if TT[j][k] != 0 and TT[j][k] >= TT[i][k] and TT[j][k] <= TT[i][k-1]:
|
|
510
|
+
return False
|
|
511
|
+
return True
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
class CompositionTableaux_all(CompositionTableaux, DisjointUnionEnumeratedSets):
|
|
515
|
+
r"""
|
|
516
|
+
All composition tableaux.
|
|
517
|
+
"""
|
|
518
|
+
|
|
519
|
+
def __init__(self, max_entry=None):
|
|
520
|
+
r"""
|
|
521
|
+
Initialize ``self``.
|
|
522
|
+
|
|
523
|
+
TESTS::
|
|
524
|
+
|
|
525
|
+
sage: CT = CompositionTableaux()
|
|
526
|
+
sage: TestSuite(CT).run()
|
|
527
|
+
"""
|
|
528
|
+
self.max_entry = max_entry
|
|
529
|
+
CT_n = lambda n: CompositionTableaux_size(n, max_entry)
|
|
530
|
+
DisjointUnionEnumeratedSets.__init__(self,
|
|
531
|
+
Family(NonNegativeIntegers(), CT_n),
|
|
532
|
+
facade=True, keepkey=False)
|
|
533
|
+
|
|
534
|
+
def _repr_(self):
|
|
535
|
+
r"""
|
|
536
|
+
TESTS::
|
|
537
|
+
|
|
538
|
+
sage: CompositionTableaux(3)
|
|
539
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
540
|
+
|
|
541
|
+
sage: CompositionTableaux()
|
|
542
|
+
Composition Tableaux
|
|
543
|
+
"""
|
|
544
|
+
if self.max_entry is not None:
|
|
545
|
+
return f"Composition tableaux with maximum entry {self.max_entry}"
|
|
546
|
+
return "Composition Tableaux"
|
|
547
|
+
|
|
548
|
+
def an_element(self):
|
|
549
|
+
r"""
|
|
550
|
+
Return a particular element of ``self``.
|
|
551
|
+
|
|
552
|
+
EXAMPLES::
|
|
553
|
+
|
|
554
|
+
sage: CT = CompositionTableaux()
|
|
555
|
+
sage: CT.an_element()
|
|
556
|
+
[[1, 1], [2]]
|
|
557
|
+
"""
|
|
558
|
+
return self.element_class(self, [[1, 1], [2]])
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
class CompositionTableaux_size(CompositionTableaux):
|
|
562
|
+
r"""
|
|
563
|
+
Composition tableaux of a fixed size `n`.
|
|
564
|
+
|
|
565
|
+
INPUT:
|
|
566
|
+
|
|
567
|
+
- ``n`` -- nonnegative integer
|
|
568
|
+
- ``max_entry`` -- nonnegative integer (default: `n`)
|
|
569
|
+
|
|
570
|
+
OUTPUT: the class of composition tableaux of size `n`
|
|
571
|
+
"""
|
|
572
|
+
|
|
573
|
+
def __init__(self, n, max_entry=None):
|
|
574
|
+
r"""
|
|
575
|
+
Initialize the class of composition tableaux of size `n`.
|
|
576
|
+
|
|
577
|
+
TESTS::
|
|
578
|
+
|
|
579
|
+
sage: CT = CompositionTableaux(4)
|
|
580
|
+
sage: TestSuite(CT).run()
|
|
581
|
+
"""
|
|
582
|
+
if max_entry is None:
|
|
583
|
+
max_entry = n
|
|
584
|
+
super().__init__(max_entry=max_entry,
|
|
585
|
+
category=FiniteEnumeratedSets())
|
|
586
|
+
self.size = n
|
|
587
|
+
|
|
588
|
+
def __contains__(self, x):
|
|
589
|
+
r"""
|
|
590
|
+
TESTS::
|
|
591
|
+
|
|
592
|
+
sage: [[1],[2,2]] in CompositionTableaux(3)
|
|
593
|
+
True
|
|
594
|
+
sage: [[1],[2,2]] in CompositionTableaux(4)
|
|
595
|
+
False
|
|
596
|
+
"""
|
|
597
|
+
return CompositionTableaux.__contains__(self, x) and sum(map(len, x)) == self.size
|
|
598
|
+
|
|
599
|
+
def __iter__(self):
|
|
600
|
+
r"""
|
|
601
|
+
EXAMPLES::
|
|
602
|
+
|
|
603
|
+
sage: [t for t in CompositionTableaux(3)]
|
|
604
|
+
[[[1], [2], [3]],
|
|
605
|
+
[[1], [2, 2]],
|
|
606
|
+
[[1], [3, 2]],
|
|
607
|
+
[[1], [3, 3]],
|
|
608
|
+
[[2], [3, 3]],
|
|
609
|
+
[[1, 1], [2]],
|
|
610
|
+
[[1, 1], [3]],
|
|
611
|
+
[[2, 1], [3]],
|
|
612
|
+
[[2, 2], [3]],
|
|
613
|
+
[[1, 1, 1]],
|
|
614
|
+
[[2, 1, 1]],
|
|
615
|
+
[[2, 2, 1]],
|
|
616
|
+
[[2, 2, 2]],
|
|
617
|
+
[[3, 1, 1]],
|
|
618
|
+
[[3, 2, 1]],
|
|
619
|
+
[[3, 2, 2]],
|
|
620
|
+
[[3, 3, 1]],
|
|
621
|
+
[[3, 3, 2]],
|
|
622
|
+
[[3, 3, 3]]]
|
|
623
|
+
|
|
624
|
+
sage: CompositionTableaux(3)[0].parent() is CompositionTableaux(3)
|
|
625
|
+
True
|
|
626
|
+
"""
|
|
627
|
+
for comp in Compositions(self.size):
|
|
628
|
+
for T in CompositionTableaux_shape(comp, self.max_entry):
|
|
629
|
+
yield self.element_class(self, T)
|
|
630
|
+
|
|
631
|
+
def _repr_(self):
|
|
632
|
+
r"""
|
|
633
|
+
TESTS::
|
|
634
|
+
|
|
635
|
+
sage: CompositionTableaux(3)
|
|
636
|
+
Composition Tableaux of size 3 and maximum entry 3
|
|
637
|
+
"""
|
|
638
|
+
return "Composition Tableaux of size %s and maximum entry %s" % (str(self.size), str(self.max_entry))
|
|
639
|
+
|
|
640
|
+
def _an_element_(self):
|
|
641
|
+
r"""
|
|
642
|
+
Return a particular element of ``self``.
|
|
643
|
+
|
|
644
|
+
EXAMPLES::
|
|
645
|
+
|
|
646
|
+
sage: CT = CompositionTableaux(4)
|
|
647
|
+
sage: CT.an_element()
|
|
648
|
+
[[1, 1, 1], [2]]
|
|
649
|
+
sage: CompositionTableaux(0).an_element()
|
|
650
|
+
[]
|
|
651
|
+
sage: CompositionTableaux(1).an_element()
|
|
652
|
+
[[1]]
|
|
653
|
+
"""
|
|
654
|
+
if self.size == 0:
|
|
655
|
+
return self.element_class(self, [])
|
|
656
|
+
if self.size == 1:
|
|
657
|
+
return self.element_class(self, [[1]])
|
|
658
|
+
return self.element_class(self, [[1] * (self.size - 1), [2]])
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
class CompositionTableaux_shape(CompositionTableaux):
|
|
662
|
+
r"""
|
|
663
|
+
Composition tableaux of a fixed shape ``comp`` with a given max entry.
|
|
664
|
+
|
|
665
|
+
INPUT:
|
|
666
|
+
|
|
667
|
+
- ``comp`` -- a composition
|
|
668
|
+
- ``max_entry`` -- nonnegative integer (default: size of ``comp``)
|
|
669
|
+
"""
|
|
670
|
+
def __init__(self, comp, max_entry=None):
|
|
671
|
+
"""
|
|
672
|
+
Initialize ``self``.
|
|
673
|
+
|
|
674
|
+
TESTS::
|
|
675
|
+
|
|
676
|
+
sage: CT = CompositionTableaux([1,2])
|
|
677
|
+
sage: TestSuite(CT).run()
|
|
678
|
+
|
|
679
|
+
sage: CT = CompositionTableaux([1,2], max_entry=4)
|
|
680
|
+
sage: TestSuite(CT).run()
|
|
681
|
+
"""
|
|
682
|
+
if max_entry is None:
|
|
683
|
+
max_entry = sum(comp)
|
|
684
|
+
super().__init__(max_entry=max_entry,
|
|
685
|
+
category=FiniteEnumeratedSets())
|
|
686
|
+
self.shape = comp
|
|
687
|
+
|
|
688
|
+
def __iter__(self):
|
|
689
|
+
r"""
|
|
690
|
+
An iterator for composition tableaux of a given shape.
|
|
691
|
+
|
|
692
|
+
EXAMPLES::
|
|
693
|
+
|
|
694
|
+
sage: [t for t in CompositionTableaux([1,2])]
|
|
695
|
+
[[[1], [2, 2]], [[1], [3, 2]], [[1], [3, 3]], [[2], [3, 3]]]
|
|
696
|
+
sage: [t for t in CompositionTableaux([1,2],max_entry=4)]
|
|
697
|
+
[[[1], [2, 2]],
|
|
698
|
+
[[1], [3, 2]],
|
|
699
|
+
[[1], [3, 3]],
|
|
700
|
+
[[1], [4, 2]],
|
|
701
|
+
[[1], [4, 3]],
|
|
702
|
+
[[1], [4, 4]],
|
|
703
|
+
[[2], [3, 3]],
|
|
704
|
+
[[2], [4, 3]],
|
|
705
|
+
[[2], [4, 4]],
|
|
706
|
+
[[3], [4, 4]]]
|
|
707
|
+
"""
|
|
708
|
+
if sum(self.shape) == 0:
|
|
709
|
+
yield CompositionTableau([])
|
|
710
|
+
else:
|
|
711
|
+
for z in CompositionTableauxBacktracker(self.shape, self.max_entry):
|
|
712
|
+
yield CompositionTableau(z)
|
|
713
|
+
|
|
714
|
+
def __contains__(self, x):
|
|
715
|
+
r"""
|
|
716
|
+
TESTS::
|
|
717
|
+
|
|
718
|
+
sage: [[2],[4,3]] in CompositionTableaux([1,2])
|
|
719
|
+
True
|
|
720
|
+
sage: [[2],[3,2]] in CompositionTableaux([1,2])
|
|
721
|
+
False
|
|
722
|
+
"""
|
|
723
|
+
return CompositionTableaux.__contains__(self, x) and [len(r) for r in x] == self.shape
|
|
724
|
+
|
|
725
|
+
def _repr_(self):
|
|
726
|
+
r"""
|
|
727
|
+
TESTS::
|
|
728
|
+
|
|
729
|
+
sage: CompositionTableaux([1,2,1])
|
|
730
|
+
Composition tableaux of shape [1, 2, 1] and maximum entry 4
|
|
731
|
+
sage: CompositionTableaux([1,2,1],max_entry=3)
|
|
732
|
+
Composition tableaux of shape [1, 2, 1] and maximum entry 3
|
|
733
|
+
"""
|
|
734
|
+
return "Composition tableaux of shape %s and maximum entry %s" % (str(self.shape), str(self.max_entry))
|
|
735
|
+
|
|
736
|
+
def _an_element_(self):
|
|
737
|
+
r"""
|
|
738
|
+
Return a particular element of :class:`CompositionTableaux_shape`.
|
|
739
|
+
|
|
740
|
+
EXAMPLES::
|
|
741
|
+
|
|
742
|
+
sage: CT = CompositionTableaux([1,2,1])
|
|
743
|
+
sage: CT.an_element()
|
|
744
|
+
[[1], [2, 2], [3]]
|
|
745
|
+
"""
|
|
746
|
+
if self.shape == []:
|
|
747
|
+
return self.element_class(self, [])
|
|
748
|
+
t = [[i] * len for i, len in enumerate(self.shape, start=1)]
|
|
749
|
+
return self.element_class(self, t)
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
class CompositionTableauxBacktracker(GenericBacktracker):
|
|
753
|
+
r"""
|
|
754
|
+
A backtracker class for generating sets of composition tableaux.
|
|
755
|
+
"""
|
|
756
|
+
|
|
757
|
+
def __init__(self, shape, max_entry=None):
|
|
758
|
+
"""
|
|
759
|
+
EXAMPLES::
|
|
760
|
+
|
|
761
|
+
sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker
|
|
762
|
+
sage: n = CompositionTableauxBacktracker([1,3,2])
|
|
763
|
+
sage: n._ending_position
|
|
764
|
+
(2, 1)
|
|
765
|
+
sage: n._initial_state
|
|
766
|
+
(0, 0)
|
|
767
|
+
"""
|
|
768
|
+
self._shape = shape
|
|
769
|
+
self._n = sum(shape)
|
|
770
|
+
self._initial_data = [[None] * s for s in shape]
|
|
771
|
+
if max_entry is None:
|
|
772
|
+
max_entry = sum(shape)
|
|
773
|
+
self.max_entry = max_entry
|
|
774
|
+
|
|
775
|
+
# The ending position will be at the lowest box which is farthest right
|
|
776
|
+
ending_row = len(shape) - 1
|
|
777
|
+
ending_col = shape[-1] - 1
|
|
778
|
+
self._ending_position = (ending_row, ending_col)
|
|
779
|
+
|
|
780
|
+
# Get the highest box that is farthest left
|
|
781
|
+
starting_row = 0
|
|
782
|
+
starting_col = 0
|
|
783
|
+
|
|
784
|
+
GenericBacktracker.__init__(self, self._initial_data, (starting_row, starting_col))
|
|
785
|
+
|
|
786
|
+
def _rec(self, obj, state):
|
|
787
|
+
r"""
|
|
788
|
+
EXAMPLES::
|
|
789
|
+
|
|
790
|
+
sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker
|
|
791
|
+
sage: n = CompositionTableauxBacktracker([1,3,2])
|
|
792
|
+
sage: obj = [ [None], [None, None, None], [None, None] ]
|
|
793
|
+
sage: list(n._rec(obj, n._initial_state))
|
|
794
|
+
[([[1], [None, None, None], [None, None]], (1, 0), False),
|
|
795
|
+
([[2], [None, None, None], [None, None]], (1, 0), False),
|
|
796
|
+
([[3], [None, None, None], [None, None]], (1, 0), False),
|
|
797
|
+
([[4], [None, None, None], [None, None]], (1, 0), False),
|
|
798
|
+
([[5], [None, None, None], [None, None]], (1, 0), False),
|
|
799
|
+
([[6], [None, None, None], [None, None]], (1, 0), False)]
|
|
800
|
+
"""
|
|
801
|
+
# Append zeros to a copy of obj
|
|
802
|
+
obj_copy = copy.deepcopy(obj)
|
|
803
|
+
N = max(len(u) for u in obj_copy)
|
|
804
|
+
for a in range(len(obj_copy)):
|
|
805
|
+
Na = len(obj_copy[a])
|
|
806
|
+
obj_copy[a] += [0] * (N - Na)
|
|
807
|
+
|
|
808
|
+
# We need to set the i,j^th entry.
|
|
809
|
+
i, j = state
|
|
810
|
+
|
|
811
|
+
# Get the next state
|
|
812
|
+
new_state = self.get_next_pos(i, j)
|
|
813
|
+
yld = bool(new_state is None)
|
|
814
|
+
|
|
815
|
+
for k in range(1, self.max_entry + 1):
|
|
816
|
+
# We check to make sure that k does not violate the rule weak decrease in rows
|
|
817
|
+
if j != 0 and obj[i][j - 1] < k:
|
|
818
|
+
continue
|
|
819
|
+
|
|
820
|
+
# We check to make sure that k does not violate strict increase in first column
|
|
821
|
+
if j == 0 and i != 0 and k <= obj[i - 1][j]:
|
|
822
|
+
continue
|
|
823
|
+
|
|
824
|
+
# We check to make sure that k does not violate the Triple Rule
|
|
825
|
+
if j != 0 and i != 0 and any(k == obj_copy[m][j] for m in range(i)):
|
|
826
|
+
continue
|
|
827
|
+
if j != 0 and i != 0 and any(obj_copy[m][j] < k <= obj_copy[m][j - 1]
|
|
828
|
+
for m in range(i)):
|
|
829
|
+
continue
|
|
830
|
+
|
|
831
|
+
# Fill in the in the i,j box with k
|
|
832
|
+
obj[i][j] = k
|
|
833
|
+
obj_copy[i][j] = k
|
|
834
|
+
|
|
835
|
+
# Yield the object
|
|
836
|
+
yield copy.deepcopy(obj), new_state, yld
|
|
837
|
+
|
|
838
|
+
def get_next_pos(self, ii, jj):
|
|
839
|
+
r"""
|
|
840
|
+
EXAMPLES::
|
|
841
|
+
|
|
842
|
+
sage: from sage.combinat.composition_tableau import CompositionTableauxBacktracker
|
|
843
|
+
sage: T = CompositionTableau([[2,1],[5,4,3,2],[6],[7,7,6]])
|
|
844
|
+
sage: n = CompositionTableauxBacktracker(T.shape_composition())
|
|
845
|
+
sage: n.get_next_pos(1,1)
|
|
846
|
+
(1, 2)
|
|
847
|
+
"""
|
|
848
|
+
if (ii, jj) == self._ending_position:
|
|
849
|
+
return None
|
|
850
|
+
|
|
851
|
+
for j in range(jj + 1, self._shape[ii]):
|
|
852
|
+
if self._shape[ii] >= j:
|
|
853
|
+
return ii, j
|
|
854
|
+
|
|
855
|
+
return ii + 1, 0
|