passagemath-combinat 10.6.1__cp312-cp312-musllinux_1_2_aarch64.whl → 10.8.1a1__cp312-cp312-musllinux_1_2_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/METADATA +17 -20
  3. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/RECORD +220 -218
  4. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/WHEEL +1 -1
  5. passagemath_combinat-10.8.1a1.dist-info/top_level.txt +3 -0
  6. sage/algebras/affine_nil_temperley_lieb.py +3 -3
  7. sage/algebras/all.py +0 -1
  8. sage/algebras/askey_wilson.py +1 -1
  9. sage/algebras/associated_graded.py +2 -2
  10. sage/algebras/cellular_basis.py +3 -6
  11. sage/algebras/cluster_algebra.py +2 -3
  12. sage/algebras/down_up_algebra.py +6 -6
  13. sage/algebras/free_algebra.py +3 -32
  14. sage/algebras/free_algebra_element.py +21 -25
  15. sage/algebras/free_algebra_quotient_element.py +9 -38
  16. sage/algebras/free_zinbiel_algebra.py +4 -3
  17. sage/algebras/hall_algebra.py +2 -2
  18. sage/algebras/hecke_algebras/ariki_koike_algebra.py +8 -8
  19. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +2 -2
  20. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +11 -14
  21. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1 -1
  22. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +5 -5
  23. sage/algebras/iwahori_hecke_algebra.py +59 -57
  24. sage/algebras/jordan_algebra.py +97 -89
  25. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +6 -6
  26. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +14 -12
  27. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +6 -6
  28. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +4 -4
  29. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +13 -13
  30. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +8 -6
  31. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +7 -5
  32. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +7 -7
  33. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +6 -5
  34. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +12 -11
  35. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +3 -3
  36. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +3 -3
  37. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +11 -11
  38. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +3 -3
  39. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +8 -7
  40. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +9 -8
  41. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +6 -5
  42. sage/algebras/nil_coxeter_algebra.py +4 -4
  43. sage/algebras/q_commuting_polynomials.py +6 -6
  44. sage/algebras/q_system.py +3 -3
  45. sage/algebras/quantum_clifford.py +8 -8
  46. sage/algebras/quantum_groups/fock_space.py +48 -8
  47. sage/algebras/quantum_groups/quantum_group_gap.py +5 -7
  48. sage/algebras/quantum_matrix_coordinate_algebra.py +7 -7
  49. sage/algebras/quantum_oscillator.py +3 -3
  50. sage/algebras/quaternion_algebra_element.py +5 -3
  51. sage/algebras/schur_algebra.py +3 -3
  52. sage/algebras/shuffle_algebra.py +5 -8
  53. sage/algebras/splitting_algebra.py +129 -85
  54. sage/algebras/tensor_algebra.py +7 -7
  55. sage/algebras/yangian.py +16 -15
  56. sage/algebras/yokonuma_hecke_algebra.py +13 -11
  57. sage/combinat/all.py +9 -0
  58. sage/combinat/all__sagemath_combinat.py +1 -0
  59. sage/combinat/alternating_sign_matrix.py +36 -29
  60. sage/combinat/baxter_permutations.py +32 -12
  61. sage/combinat/bijectionist.py +13 -17
  62. sage/combinat/chas/fsym.py +6 -6
  63. sage/combinat/chas/wqsym.py +23 -29
  64. sage/combinat/colored_permutations.py +9 -11
  65. sage/combinat/colored_permutations_representations.py +13 -12
  66. sage/combinat/composition_tableau.py +2 -2
  67. sage/combinat/constellation.py +57 -30
  68. sage/combinat/crystals/affine_factorization.py +5 -4
  69. sage/combinat/crystals/alcove_path.py +2 -2
  70. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +3 -2
  71. sage/combinat/crystals/infinity_crystals.py +18 -18
  72. sage/combinat/crystals/kac_modules.py +1 -1
  73. sage/combinat/crystals/kirillov_reshetikhin.py +2 -2
  74. sage/combinat/crystals/letters.cpython-312-aarch64-linux-musl.so +0 -0
  75. sage/combinat/crystals/littelmann_path.py +1 -1
  76. sage/combinat/crystals/pbw_datum.cpython-312-aarch64-linux-musl.so +0 -0
  77. sage/combinat/crystals/pbw_datum.pyx +3 -2
  78. sage/combinat/crystals/spins.cpython-312-aarch64-linux-musl.so +0 -0
  79. sage/combinat/crystals/tensor_product.py +7 -5
  80. sage/combinat/crystals/tensor_product_element.cpython-312-aarch64-linux-musl.so +0 -0
  81. sage/combinat/debruijn_sequence.cpython-312-aarch64-linux-musl.so +0 -0
  82. sage/combinat/debruijn_sequence.pyx +1 -2
  83. sage/combinat/degree_sequences.cpython-312-aarch64-linux-musl.so +0 -0
  84. sage/combinat/degree_sequences.pyx +241 -188
  85. sage/combinat/derangements.py +28 -22
  86. sage/combinat/diagram_algebras.py +12 -14
  87. sage/combinat/dyck_word.py +15 -14
  88. sage/combinat/e_one_star.py +1 -1
  89. sage/combinat/expnums.cpython-312-aarch64-linux-musl.so +0 -0
  90. sage/combinat/fast_vector_partitions.cpython-312-aarch64-linux-musl.so +0 -0
  91. sage/combinat/fqsym.py +13 -19
  92. sage/combinat/free_dendriform_algebra.py +2 -2
  93. sage/combinat/free_prelie_algebra.py +2 -2
  94. sage/combinat/fully_commutative_elements.py +8 -8
  95. sage/combinat/fully_packed_loop.py +9 -9
  96. sage/combinat/gelfand_tsetlin_patterns.py +4 -5
  97. sage/combinat/gray_codes.py +3 -4
  98. sage/combinat/grossman_larson_algebras.py +2 -2
  99. sage/combinat/growth.py +13 -13
  100. sage/combinat/hall_polynomial.py +1 -1
  101. sage/combinat/hillman_grassl.py +1 -1
  102. sage/combinat/integer_matrices.py +5 -7
  103. sage/combinat/k_tableau.py +8 -7
  104. sage/combinat/kazhdan_lusztig.py +3 -3
  105. sage/combinat/key_polynomial.py +845 -298
  106. sage/combinat/knutson_tao_puzzles.py +11 -13
  107. sage/combinat/matrices/hadamard_matrix.py +1 -1
  108. sage/combinat/matrices/latin.py +75 -92
  109. sage/combinat/misc.py +3 -3
  110. sage/combinat/multiset_partition_into_sets_ordered.py +27 -10
  111. sage/combinat/ncsf_qsym/generic_basis_code.py +5 -5
  112. sage/combinat/ncsf_qsym/ncsf.py +6 -5
  113. sage/combinat/ncsf_qsym/qsym.py +9 -17
  114. sage/combinat/ncsym/ncsym.py +8 -12
  115. sage/combinat/nu_dyck_word.py +1 -1
  116. sage/combinat/parallelogram_polyomino.py +3 -5
  117. sage/combinat/parking_functions.py +6 -5
  118. sage/combinat/partition_algebra.py +22 -57
  119. sage/combinat/partition_kleshchev.py +4 -4
  120. sage/combinat/partition_tuple.py +12 -10
  121. sage/combinat/plane_partition.py +10 -13
  122. sage/combinat/positive_integer_semigroup_test.py +17 -0
  123. sage/combinat/q_bernoulli.cpython-312-aarch64-linux-musl.so +0 -0
  124. sage/combinat/quickref.py +2 -2
  125. sage/combinat/recognizable_series.py +2 -2
  126. sage/combinat/regular_sequence.py +7 -7
  127. sage/combinat/regular_sequence_bounded.py +15 -21
  128. sage/combinat/restricted_growth.py +3 -3
  129. sage/combinat/ribbon.py +3 -3
  130. sage/combinat/rigged_configurations/bijection.py +3 -3
  131. sage/combinat/rigged_configurations/rigged_partition.cpython-312-aarch64-linux-musl.so +0 -0
  132. sage/combinat/rsk.py +2 -0
  133. sage/combinat/schubert_polynomial.py +11 -2
  134. sage/combinat/set_partition.py +3 -7
  135. sage/combinat/set_partition_iterator.cpython-312-aarch64-linux-musl.so +0 -0
  136. sage/combinat/set_partition_iterator.pyx +0 -1
  137. sage/combinat/set_partition_ordered.py +2 -2
  138. sage/combinat/sf/classical.py +1 -1
  139. sage/combinat/sf/dual.py +4 -8
  140. sage/combinat/sf/elementary.py +13 -7
  141. sage/combinat/sf/hall_littlewood.py +10 -8
  142. sage/combinat/sf/homogeneous.py +6 -3
  143. sage/combinat/sf/jack.py +11 -9
  144. sage/combinat/sf/llt.py +4 -5
  145. sage/combinat/sf/macdonald.py +10 -11
  146. sage/combinat/sf/monomial.py +6 -0
  147. sage/combinat/sf/ns_macdonald.py +92 -51
  148. sage/combinat/sf/powersum.py +9 -14
  149. sage/combinat/sf/schur.py +6 -0
  150. sage/combinat/sf/sf.py +21 -19
  151. sage/combinat/sf/sfa.py +13 -64
  152. sage/combinat/shifted_primed_tableau.py +5 -7
  153. sage/combinat/shuffle.py +1 -1
  154. sage/combinat/sine_gordon.py +18 -38
  155. sage/combinat/skew_partition.py +9 -12
  156. sage/combinat/skew_tableau.py +2 -7
  157. sage/combinat/sloane_functions.py +1 -1
  158. sage/combinat/species/all.py +67 -2
  159. sage/combinat/species/characteristic_species.py +3 -0
  160. sage/combinat/species/composition_species.py +3 -0
  161. sage/combinat/species/cycle_species.py +4 -0
  162. sage/combinat/species/empty_species.py +3 -0
  163. sage/combinat/species/functorial_composition_species.py +3 -0
  164. sage/combinat/species/generating_series.py +3 -0
  165. sage/combinat/species/library.py +3 -0
  166. sage/combinat/species/linear_order_species.py +3 -0
  167. sage/combinat/species/partition_species.py +3 -0
  168. sage/combinat/species/permutation_species.py +4 -0
  169. sage/combinat/species/product_species.py +3 -0
  170. sage/combinat/species/recursive_species.py +3 -0
  171. sage/combinat/species/set_species.py +3 -0
  172. sage/combinat/species/species.py +13 -7
  173. sage/combinat/species/structure.py +8 -9
  174. sage/combinat/species/subset_species.py +3 -0
  175. sage/combinat/species/sum_species.py +3 -0
  176. sage/combinat/subword.py +4 -1
  177. sage/combinat/subword_complex.py +7 -7
  178. sage/combinat/subword_complex_c.cpython-312-aarch64-linux-musl.so +0 -0
  179. sage/combinat/superpartition.py +1 -1
  180. sage/combinat/symmetric_group_algebra.py +9 -9
  181. sage/combinat/symmetric_group_representations.py +5 -5
  182. sage/combinat/t_sequences.py +4 -4
  183. sage/combinat/tableau.py +3 -4
  184. sage/combinat/tableau_tuple.py +2 -2
  185. sage/combinat/tiling.py +39 -42
  186. sage/combinat/triangles_FHM.py +38 -15
  187. sage/combinat/tutorial.py +2 -2
  188. sage/combinat/vector_partition.py +43 -31
  189. sage/combinat/words/abstract_word.py +4 -4
  190. sage/combinat/words/alphabet.py +12 -12
  191. sage/combinat/words/finite_word.py +25 -229
  192. sage/combinat/words/infinite_word.py +1 -1
  193. sage/combinat/words/morphic.py +13 -13
  194. sage/combinat/words/morphism.py +3 -12
  195. sage/combinat/words/paths.py +16 -17
  196. sage/combinat/words/word.py +60 -35
  197. sage/combinat/words/word_char.cpython-312-aarch64-linux-musl.so +0 -0
  198. sage/combinat/words/word_char.pyx +46 -7
  199. sage/combinat/words/word_datatypes.cpython-312-aarch64-linux-musl.so +0 -0
  200. sage/combinat/words/word_generators.py +39 -38
  201. sage/databases/findstat.py +72 -31
  202. sage/databases/oeis.py +125 -25
  203. sage/databases/sloane.py +14 -8
  204. sage/games/sudoku_backtrack.cpython-312-aarch64-linux-musl.so +0 -0
  205. sage/groups/indexed_free_group.py +3 -4
  206. sage/libs/symmetrica/symmetrica.cpython-312-aarch64-linux-musl.so +0 -0
  207. sage/libs/symmetrica/symmetrica.pxi +1 -0
  208. sage/monoids/automatic_semigroup.py +1 -3
  209. sage/monoids/free_abelian_monoid.py +7 -33
  210. sage/monoids/free_abelian_monoid_element.cpython-312-aarch64-linux-musl.so +0 -0
  211. sage/monoids/free_monoid.py +8 -40
  212. sage/monoids/free_monoid_element.py +1 -9
  213. sage/monoids/string_monoid.py +5 -2
  214. sage/monoids/string_monoid_element.py +12 -66
  215. sage/rings/all__sagemath_combinat.py +7 -0
  216. sage/sat/solvers/__init__.py +3 -4
  217. sage/sat/solvers/cryptominisat.py +2 -3
  218. sage/sat/solvers/picosat.py +2 -3
  219. sage/sat/solvers/sat_lp.py +2 -2
  220. sage/sat/solvers/satsolver.cpython-312-aarch64-linux-musl.so +0 -0
  221. passagemath_combinat-10.6.1.dist-info/top_level.txt +0 -2
@@ -472,8 +472,14 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
472
472
 
473
473
  sage: A = algebras.WQSym(QQ)
474
474
  sage: TestSuite(A).run() # long time
475
+
476
+ sage: M = algebras.WQSym(ZZ).M()
477
+ sage: M.is_commutative()
478
+ False
475
479
  """
476
480
  category = HopfAlgebras(R).Graded().Connected()
481
+ if R.is_zero():
482
+ category = category.Commutative()
477
483
  Parent.__init__(self, base=R, category=category.WithRealizations())
478
484
 
479
485
  def _repr_(self):
@@ -499,7 +505,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
499
505
  """
500
506
  return self.M()
501
507
 
502
- _shorthands = tuple(['M', 'X', 'C', 'Q', 'Phi'])
508
+ _shorthands = ('M', 'X', 'C', 'Q', 'Phi')
503
509
 
504
510
  # add options to class
505
511
  class options(GlobalOptions):
@@ -762,7 +768,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
762
768
  # for the formula we're using here.
763
769
  Q = self.parent()
764
770
  OSPs = Q.basis().keys()
765
- return Q._from_dict({OSPs(A.reversed()): c for (A, c) in self},
771
+ return Q._from_dict({OSPs(A.reversed()): c for A, c in self},
766
772
  remove_zeros=False)
767
773
 
768
774
  def coalgebraic_complement(self):
@@ -799,7 +805,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
799
805
  # for the formula we're using here.
800
806
  Q = self.parent()
801
807
  OSPs = Q.basis().keys()
802
- return Q._from_dict({OSPs(A.complement()): c for (A, c) in self},
808
+ return Q._from_dict({OSPs(A.complement()): c for A, c in self},
803
809
  remove_zeros=False)
804
810
 
805
811
  def star_involution(self):
@@ -835,7 +841,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
835
841
  # for the formula we're using here.
836
842
  Q = self.parent()
837
843
  OSPs = Q.basis().keys()
838
- return Q._from_dict({OSPs(A.complement().reversed()): c for (A, c) in self},
844
+ return Q._from_dict({OSPs(A.complement().reversed()): c for A, c in self},
839
845
  remove_zeros=False)
840
846
 
841
847
  X = Characteristic
@@ -1281,7 +1287,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1281
1287
  return {OSPs(P): (one if (len(R) % 2 == len(P) % 2)
1282
1288
  else mine)
1283
1289
  for R in Rs for P in R.strongly_fatter()}
1284
- return Q._from_dict(linear_combination((img(A), c) for (A, c) in self))
1290
+ return Q._from_dict(linear_combination((img(A), c) for A, c in self))
1285
1291
 
1286
1292
  def coalgebraic_complement(self):
1287
1293
  r"""
@@ -1329,7 +1335,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1329
1335
  return {OSPs(P): (one if (len(R) % 2 == len(P) % 2)
1330
1336
  else mine)
1331
1337
  for R in Rs for P in R.strongly_fatter()}
1332
- return Q._from_dict(linear_combination((img(A), c) for (A, c) in self))
1338
+ return Q._from_dict(linear_combination((img(A), c) for A, c in self))
1333
1339
 
1334
1340
  def star_involution(self):
1335
1341
  r"""
@@ -1364,7 +1370,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1364
1370
  # for the formula we're using here.
1365
1371
  Q = self.parent()
1366
1372
  OSPs = Q.basis().keys()
1367
- return Q._from_dict({OSPs(A.complement().reversed()): c for (A, c) in self},
1373
+ return Q._from_dict({OSPs(A.complement().reversed()): c for A, c in self},
1368
1374
  remove_zeros=False)
1369
1375
 
1370
1376
  Q = StronglyCoarser
@@ -1634,7 +1640,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1634
1640
  return self.monomial(x)
1635
1641
  xlist = [(j, (k == 0))
1636
1642
  for part in x
1637
- for (k, j) in enumerate(sorted(part))]
1643
+ for k, j in enumerate(sorted(part))]
1638
1644
  # xlist is a list of the form
1639
1645
  # [(e_1, s_1), (e_2, s_2), ..., (e_n, s_n)],
1640
1646
  # where e_1, e_2, ..., e_n are the entries of the parts of
@@ -1644,7 +1650,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1644
1650
  m = max(max(part) for part in x) # The degree of x
1645
1651
  ylist = [(m + j, (k == 0))
1646
1652
  for part in y
1647
- for (k, j) in enumerate(sorted(part))]
1653
+ for k, j in enumerate(sorted(part))]
1648
1654
  # ylist is like xlist, but for y instead of x, and with
1649
1655
  # a shift by m.
1650
1656
 
@@ -1749,7 +1755,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1749
1755
  deconcatenates.append((left, right))
1750
1756
  T = self.tensor_square()
1751
1757
  return T.sum_of_monomials((standardize(left), standardize(right))
1752
- for (left, right) in deconcatenates)
1758
+ for left, right in deconcatenates)
1753
1759
 
1754
1760
  class Element(WQSymBasis_abstract.Element):
1755
1761
  def algebraic_complement(self):
@@ -1798,7 +1804,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1798
1804
  return {OSPs(P): (one if (len(R) % 2 == len(P) % 2)
1799
1805
  else mine)
1800
1806
  for R in Rs for P in R.strongly_finer()}
1801
- return Phi._from_dict(linear_combination((img(A), c) for (A, c) in self))
1807
+ return Phi._from_dict(linear_combination((img(A), c) for A, c in self))
1802
1808
 
1803
1809
  def coalgebraic_complement(self):
1804
1810
  r"""
@@ -1846,7 +1852,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1846
1852
  return {OSPs(P): (one if (len(R) % 2 == len(P) % 2)
1847
1853
  else mine)
1848
1854
  for R in Rs for P in R.strongly_finer()}
1849
- return Phi._from_dict(linear_combination((img(A), c) for (A, c) in self))
1855
+ return Phi._from_dict(linear_combination((img(A), c) for A, c in self))
1850
1856
 
1851
1857
  def star_involution(self):
1852
1858
  r"""
@@ -1881,7 +1887,7 @@ class WordQuasiSymmetricFunctions(UniqueRepresentation, Parent):
1881
1887
  # for the formula we're using here.
1882
1888
  Phi = self.parent()
1883
1889
  OSPs = Phi.basis().keys()
1884
- return Phi._from_dict({OSPs(A.complement().reversed()): c for (A, c) in self},
1890
+ return Phi._from_dict({OSPs(A.complement().reversed()): c for A, c in self},
1885
1891
  remove_zeros=False)
1886
1892
 
1887
1893
  Phi = StronglyFiner
@@ -2042,18 +2048,6 @@ class WQSymBases(Category_realization_of_parent):
2042
2048
  """
2043
2049
  return False
2044
2050
 
2045
- def is_commutative(self):
2046
- """
2047
- Return whether ``self`` is commutative.
2048
-
2049
- EXAMPLES::
2050
-
2051
- sage: M = algebras.WQSym(ZZ).M()
2052
- sage: M.is_commutative()
2053
- False
2054
- """
2055
- return self.base_ring().is_zero()
2056
-
2057
2051
  def one_basis(self):
2058
2052
  """
2059
2053
  Return the index of the unit.
@@ -2263,7 +2257,7 @@ class WQSymBases(Category_realization_of_parent):
2263
2257
  # complement componentwise, then convert back.
2264
2258
  parent = self.parent()
2265
2259
  M = parent.realization_of().M()
2266
- dct = {I.reversed(): coeff for (I, coeff) in M(self)}
2260
+ dct = {I.reversed(): coeff for I, coeff in M(self)}
2267
2261
  return parent(M._from_dict(dct, remove_zeros=False))
2268
2262
 
2269
2263
  def coalgebraic_complement(self):
@@ -2428,7 +2422,7 @@ class WQSymBases(Category_realization_of_parent):
2428
2422
  # complement componentwise, then convert back.
2429
2423
  parent = self.parent()
2430
2424
  M = parent.realization_of().M()
2431
- dct = {I.complement(): coeff for (I, coeff) in M(self)}
2425
+ dct = {I.complement(): coeff for I, coeff in M(self)}
2432
2426
  return parent(M._from_dict(dct, remove_zeros=False))
2433
2427
 
2434
2428
  def star_involution(self):
@@ -2556,7 +2550,7 @@ class WQSymBases(Category_realization_of_parent):
2556
2550
  # complement componentwise, then convert back.
2557
2551
  parent = self.parent()
2558
2552
  M = parent.realization_of().M()
2559
- dct = {I.reversed().complement(): coeff for (I, coeff) in M(self)}
2553
+ dct = {I.reversed().complement(): coeff for I, coeff in M(self)}
2560
2554
  return parent(M._from_dict(dct, remove_zeros=False))
2561
2555
 
2562
2556
  def to_quasisymmetric_function(self):
@@ -2598,4 +2592,4 @@ class WQSymBases(Category_realization_of_parent):
2598
2592
  M = QuasiSymmetricFunctions(self.parent().base_ring()).Monomial()
2599
2593
  MW = self.parent().realization_of().M()
2600
2594
  return M.sum_of_terms((i.to_composition(), coeff)
2601
- for (i, coeff) in MW(self))
2595
+ for i, coeff in MW(self))
@@ -8,7 +8,7 @@ Colored permutations
8
8
  generalized to `G \wr S_n`
9
9
  """
10
10
  import itertools
11
- from random import choice
11
+ from sage.misc.prandom import choice
12
12
 
13
13
  from sage.structure.element import MultiplicativeGroupElement
14
14
  from sage.structure.parent import Parent
@@ -19,7 +19,7 @@ from sage.misc.lazy_import import lazy_import
19
19
  from sage.misc.misc_c import prod
20
20
  from sage.arith.functions import lcm
21
21
 
22
- from sage.combinat.partition_tuple import PartitionTuples, PartitionTuple
22
+ from sage.combinat.partition_tuple import PartitionTuples
23
23
  from sage.combinat.permutation import Permutations
24
24
  from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
25
25
  from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
@@ -274,7 +274,7 @@ class ColoredPermutation(MultiplicativeGroupElement):
274
274
  """
275
275
  Cp = CyclotomicField(self.parent()._m)
276
276
  g = Cp.gen()
277
- D = diagonal_matrix(Cp, [g ** i for i in self._colors])
277
+ D = diagonal_matrix(Cp, [g**i for i in self._colors])
278
278
  return self._perm.to_matrix() * D
279
279
 
280
280
  def has_left_descent(self, i) -> bool:
@@ -474,7 +474,7 @@ class ShephardToddFamilyGroup(UniqueRepresentation, Parent):
474
474
  return ColoredPermutations(m, n)
475
475
  return super().__classcall__(cls, m, p, n)
476
476
 
477
- def __init__(self, m, p, n):
477
+ def __init__(self, m, p, n) -> None:
478
478
  r"""
479
479
  Initialize ``self``.
480
480
 
@@ -507,9 +507,7 @@ class ShephardToddFamilyGroup(UniqueRepresentation, Parent):
507
507
  self._C = IntegerModRing(self._m)
508
508
  self._P = Permutations(self._n)
509
509
 
510
- if (self._p == 1 and (self._m == 1 or self._m == 2)
511
- or (self._p == 2 and self._m == 2)
512
- or (self._n == 2 and self._p == self._m)):
510
+ if self._p <= self._m <= 2 or (self._n == 2 and self._p == self._m):
513
511
  from sage.categories.finite_coxeter_groups import FiniteCoxeterGroups
514
512
  category = FiniteCoxeterGroups()
515
513
  if not (self._n == self._m == self._p == 2): # special case of type D_2
@@ -521,7 +519,7 @@ class ShephardToddFamilyGroup(UniqueRepresentation, Parent):
521
519
  category = category.WellGenerated()
522
520
  Parent.__init__(self, category=category)
523
521
 
524
- def _repr_(self):
522
+ def _repr_(self) -> str:
525
523
  """
526
524
  Return a string representation of ``self``.
527
525
 
@@ -741,8 +739,8 @@ class ShephardToddFamilyGroup(UniqueRepresentation, Parent):
741
739
  if i == self._n + 1 or self._n == 1:
742
740
  return sn ** self._p
743
741
 
744
- snm = self.simple_reflection(self._n-1)
745
- return sn**(self._m-1) * snm * sn
742
+ snm = self.simple_reflection(self._n - 1)
743
+ return sn**(self._m - 1) * snm * sn
746
744
 
747
745
  @cached_method
748
746
  def _inverse_simple_reflections(self):
@@ -1126,7 +1124,7 @@ class ShephardToddFamilyGroup(UniqueRepresentation, Parent):
1126
1124
  q = PolynomialRing(ZZ, 'q').gen(0)
1127
1125
  return prod(q + d - 1 for d in self.degrees())
1128
1126
 
1129
- def is_well_generated(self):
1127
+ def is_well_generated(self) -> bool:
1130
1128
  r"""
1131
1129
  Return if ``self`` is a well-generated complex reflection group.
1132
1130
 
@@ -211,7 +211,7 @@ class TabloidModule(Representation_abstract, CombinatorialFreeModule):
211
211
  data = [cartesian_product([OrderedSetPartitions([val * x for x, val in zip(sorted(X), signs)], la),
212
212
  OrderedSetPartitions(sorted(Y), mu)])
213
213
  for (X, Y) in OrderedSetPartitions(G._n, [sum(la), sum(mu)])
214
- for signs in product([1,-1], repeat=sum(la))]
214
+ for signs in product([1, -1], repeat=sum(la))]
215
215
  tabloids = DisjointUnionEnumeratedSets(data)
216
216
  tabloids.rename(f"Tabloids of shape {self._diagram}")
217
217
 
@@ -511,8 +511,8 @@ class SpechtModule(Representation_abstract, SubmoduleWithBasis):
511
511
  n = T.size()
512
512
  for sigma in T.column_stabilizer():
513
513
  sigma = sigma.tuple()
514
- for signs in product(*[[1,-1] if i not in mu_vals else [1]
515
- for i in range(1,n+1)]):
514
+ for signs in product(*[[1, -1] if i not in mu_vals else [1]
515
+ for i in range(1, n+1)]):
516
516
  yield self._semigroup([s * val for s, val in zip(signs, sigma)])
517
517
 
518
518
  return ambient.sum_of_terms((ambient._semigroup_basis_action(elt, tab),
@@ -605,7 +605,7 @@ class SpechtModule(Representation_abstract, SubmoduleWithBasis):
605
605
  COB = matrix([b.lift().to_vector() for b in B]).T
606
606
  P, L, U = COB.LU()
607
607
  # Since U is upper triangular, the nonzero entriesm must be in the
608
- # upper square portiion of the matrix
608
+ # upper square portion of the matrix
609
609
  n = len(B)
610
610
 
611
611
  Uinv = U.matrix_from_rows(range(n)).inverse()
@@ -906,7 +906,7 @@ class SimpleModule(Representation_abstract, QuotientModuleWithBasis):
906
906
  [0 0 0 0 0 0 1 0]
907
907
  [0 0 0 0 0 0 0 1]
908
908
  """
909
- def __init__(self, specht_module):
909
+ def __init__(self, specht_module) -> None:
910
910
  r"""
911
911
  Initialize ``self``.
912
912
 
@@ -916,18 +916,19 @@ class SimpleModule(Representation_abstract, QuotientModuleWithBasis):
916
916
  sage: D = B4.simple_module([[2,1], [1]], GF(3))
917
917
  sage: TestSuite(D).run()
918
918
  """
919
- self._diagram = specht_module._diagram
920
919
  p = specht_module.base_ring().characteristic()
921
- if (not all(la.is_regular(p) for la in specht_module._diagram)
922
- or (p == 2 and specht_module._diagram[0])):
920
+ d = self._diagram = specht_module._diagram
921
+ if (p == 2 and d[0]) or not all(la.is_regular(p) for la in d):
923
922
  raise ValueError(f"the partition must be {p}-regular")
924
- Representation_abstract.__init__(self, specht_module._semigroup, specht_module._side,
923
+ Representation_abstract.__init__(self, specht_module._semigroup,
924
+ specht_module._side,
925
925
  algebra=specht_module._semigroup_algebra)
926
926
  cat = specht_module.category()
927
- QuotientModuleWithBasis.__init__(self, specht_module.maximal_submodule(),
927
+ QuotientModuleWithBasis.__init__(self,
928
+ specht_module.maximal_submodule(),
928
929
  cat, prefix='D', bracket='')
929
930
 
930
- def _repr_(self):
931
+ def _repr_(self) -> str:
931
932
  r"""
932
933
  Return a string representation of ``self``.
933
934
 
@@ -939,7 +940,7 @@ class SimpleModule(Representation_abstract, QuotientModuleWithBasis):
939
940
  """
940
941
  return f"Simple module of {self._diagram} over {self.base_ring()}"
941
942
 
942
- def _latex_(self):
943
+ def _latex_(self) -> str:
943
944
  r"""
944
945
  Return a latex representation of ``self``.
945
946
 
@@ -200,7 +200,7 @@ class CompositionTableau(CombinatorialElement, metaclass=ClasscallMetaclass):
200
200
  for row in self:
201
201
  for i in row:
202
202
  w[i] += 1
203
- return Composition([w[i] for i in range(1, self.size()+1)])
203
+ return Composition([w[i] for i in range(1, self.size() + 1)])
204
204
 
205
205
  def descent_set(self):
206
206
  r"""
@@ -254,7 +254,7 @@ class CompositionTableau(CombinatorialElement, metaclass=ClasscallMetaclass):
254
254
  """
255
255
  return Partition(sorted((len(row) for row in self), reverse=True))
256
256
 
257
- def is_standard(self):
257
+ def is_standard(self) -> bool:
258
258
  r"""
259
259
  Return ``True`` if ``self`` is a standard composition tableau and
260
260
  ``False`` otherwise.
@@ -20,7 +20,7 @@ EXAMPLES::
20
20
  g2 (1,3,2)
21
21
  sage: C = Constellations(3,4); C
22
22
  Connected constellations of length 3 and degree 4 on {1, 2, 3, 4}
23
- sage: C.cardinality() # long time
23
+ sage: C.cardinality()
24
24
  426
25
25
 
26
26
  sage: C = Constellations(3, 4, domain=('a', 'b', 'c', 'd'))
@@ -59,10 +59,12 @@ from sage.structure.richcmp import (op_NE, op_EQ, richcmp_not_equal,
59
59
  rich_to_bool)
60
60
 
61
61
  from sage.rings.integer import Integer
62
+ from sage.rings.integer_ring import ZZ
62
63
  from sage.combinat.partition import Partition
63
64
  from sage.misc.misc_c import prod
64
65
  from sage.misc.lazy_import import lazy_import
65
66
  from sage.categories.groups import Groups
67
+ from sage.functions.other import factorial
66
68
 
67
69
  lazy_import('sage.graphs.graph', 'Graph')
68
70
  lazy_import('sage.graphs.digraph', 'DiGraph')
@@ -231,7 +233,7 @@ class Constellation_class(Element):
231
233
  raise ValueError("cannot hash mutable constellation")
232
234
  return hash(tuple(self._g))
233
235
 
234
- def set_immutable(self):
236
+ def set_immutable(self) -> None:
235
237
  r"""
236
238
  Do nothing, as ``self`` is already immutable.
237
239
 
@@ -244,7 +246,7 @@ class Constellation_class(Element):
244
246
  """
245
247
  self._mutable = False
246
248
 
247
- def is_mutable(self):
249
+ def is_mutable(self) -> bool:
248
250
  r"""
249
251
  Return ``False`` as ``self`` is immutable.
250
252
 
@@ -428,7 +430,7 @@ class Constellation_class(Element):
428
430
 
429
431
  # GENERAL PROPERTIES
430
432
 
431
- def is_connected(self):
433
+ def is_connected(self) -> bool:
432
434
  r"""
433
435
  Test of connectedness.
434
436
 
@@ -443,10 +445,9 @@ class Constellation_class(Element):
443
445
  """
444
446
  if self._connected:
445
447
  return True
446
- else:
447
- return perms_are_connected(self._g, self.degree())
448
+ return perms_are_connected(self._g, self.degree())
448
449
 
449
- def connected_components(self):
450
+ def connected_components(self) -> list:
450
451
  """
451
452
  Return the connected components.
452
453
 
@@ -884,9 +885,9 @@ class Constellation_class(Element):
884
885
  g1 (0)(1,4)(2)(3)
885
886
  g2 (0,1,3,2,4)
886
887
  sage: G = c.braid_group_orbit()
887
- sage: G.num_verts()
888
+ sage: G.n_vertices()
888
889
  4
889
- sage: G.num_edges()
890
+ sage: G.n_edges()
890
891
  12
891
892
  """
892
893
  G = DiGraph(multiedges=True, loops=True)
@@ -926,7 +927,11 @@ class Constellations_ld(UniqueRepresentation, Parent):
926
927
  """
927
928
  TESTS::
928
929
 
929
- sage: TestSuite(Constellations(length=6,degree=4)).run(skip='_test_cardinality')
930
+ sage: TestSuite(Constellations(length=6, degree=4)).run()
931
+
932
+ sage: TestSuite(Constellations(2, 3, connected=False)).run()
933
+
934
+ sage: TestSuite(Constellations(3, 4, domain='abcd')).run()
930
935
  """
931
936
  from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
932
937
  Parent.__init__(self, category=FiniteEnumeratedSets())
@@ -941,7 +946,7 @@ class Constellations_ld(UniqueRepresentation, Parent):
941
946
 
942
947
  self._connected = bool(connected)
943
948
 
944
- def is_empty(self):
949
+ def is_empty(self) -> bool:
945
950
  r"""
946
951
  Return whether this set of constellations is empty.
947
952
 
@@ -956,7 +961,7 @@ class Constellations_ld(UniqueRepresentation, Parent):
956
961
  """
957
962
  return self._connected and self._length == 1 and self._degree > 1
958
963
 
959
- def __contains__(self, elt):
964
+ def __contains__(self, elt) -> bool:
960
965
  r"""
961
966
  TESTS::
962
967
 
@@ -1023,17 +1028,6 @@ class Constellations_ld(UniqueRepresentation, Parent):
1023
1028
  Connected constellations of length 3 and degree 3 on {1, 2, 3}
1024
1029
  sage: len([v for v in const])
1025
1030
  26
1026
-
1027
- One can check the first few terms of sequence :oeis:`220754`::
1028
-
1029
- sage: Constellations(4,1).cardinality()
1030
- 1
1031
- sage: Constellations(4,2).cardinality()
1032
- 7
1033
- sage: Constellations(4,3).cardinality()
1034
- 194
1035
- sage: Constellations(4,4).cardinality() # long time
1036
- 12858
1037
1031
  """
1038
1032
  from itertools import product
1039
1033
 
@@ -1048,6 +1042,37 @@ class Constellations_ld(UniqueRepresentation, Parent):
1048
1042
  continue
1049
1043
  yield self(list(p) + [None], check=False)
1050
1044
 
1045
+ def cardinality(self):
1046
+ r"""
1047
+ Return the cardinality of ``self``.
1048
+
1049
+ EXAMPLES:
1050
+
1051
+ One can check the first few terms of sequence :oeis:`A220754`::
1052
+
1053
+ sage: [Constellations(4, d).cardinality() for d in range(1, 6)]
1054
+ [1, 7, 194, 12858, 1647384]
1055
+
1056
+ sage: [Constellations(3, d, connected=False).cardinality() for d in range(1, 6)]
1057
+ [1, 4, 36, 576, 14400]
1058
+ """
1059
+ k = self._length
1060
+ if not k:
1061
+ return ZZ.one()
1062
+
1063
+ if not self._connected:
1064
+ return factorial(self._degree) ** (k-1)
1065
+
1066
+ # recurrence from :oeis:`A220754`
1067
+ a = []
1068
+ for n in range(self._degree):
1069
+ n = ZZ(n)
1070
+ a.append(factorial(n+1) ** (k-1)
1071
+ - (factorial(n)
1072
+ * ZZ.sum(a[i] * factorial(n-i) ** (k-2) // factorial(i)
1073
+ for i in range(n))))
1074
+ return a[-1]
1075
+
1051
1076
  def random_element(self, mutable=False):
1052
1077
  r"""
1053
1078
  Return a random element.
@@ -1057,7 +1082,7 @@ class Constellations_ld(UniqueRepresentation, Parent):
1057
1082
 
1058
1083
  EXAMPLES::
1059
1084
 
1060
- sage: const = Constellations(3,3)
1085
+ sage: const = Constellations(3, 3)
1061
1086
  sage: const.random_element()
1062
1087
  Constellation of length 3 and degree 3
1063
1088
  ...
@@ -1070,15 +1095,17 @@ class Constellations_ld(UniqueRepresentation, Parent):
1070
1095
  from sage.groups.perm_gps.permgroup import PermutationGroup
1071
1096
 
1072
1097
  l = self._length
1073
- d = self._degree
1074
1098
  Sd = self._sym
1075
1099
 
1076
- g = [Sd.random_element() for _ in range(l - 1)]
1077
- G = PermutationGroup(g)
1078
- while not G.degree() == d or (self._connected and
1079
- not G.is_transitive()):
1100
+ if self._connected:
1101
+ d = self._degree
1102
+ while True:
1103
+ g = [Sd.random_element() for _ in range(l - 1)]
1104
+ G = PermutationGroup(g)
1105
+ if G.degree() == d and G.is_transitive():
1106
+ break
1107
+ else:
1080
1108
  g = [Sd.random_element() for _ in range(l - 1)]
1081
- G = PermutationGroup(g)
1082
1109
 
1083
1110
  return self([sigma.domain() for sigma in g] + [None], mutable=mutable)
1084
1111
 
@@ -439,7 +439,8 @@ def affine_factorizations(w, l, weight=None):
439
439
  else:
440
440
  return []
441
441
  else:
442
- return [[u]+p for (u,v) in w.left_pieri_factorizations() for p in affine_factorizations(v,l-1) ]
442
+ return [[u] + p for u, v in w.left_pieri_factorizations()
443
+ for p in affine_factorizations(v, l - 1)]
443
444
  else:
444
445
  if l != len(weight):
445
446
  return []
@@ -449,11 +450,11 @@ def affine_factorizations(w, l, weight=None):
449
450
  else:
450
451
  return []
451
452
  else:
452
- return [[u]+p for (u,v) in w.left_pieri_factorizations(max_length=weight[0]) if u.length() == weight[0]
453
- for p in affine_factorizations(v,l-1,weight[1:]) ]
453
+ return [[u] + p for u, v in w.left_pieri_factorizations(max_length=weight[0]) if u.length() == weight[0]
454
+ for p in affine_factorizations(v, l - 1, weight[1:])]
454
455
 
455
456
  #####################################################################
456
- ## Crystal isomorphisms
457
+ # Crystal isomorphisms
457
458
 
458
459
 
459
460
  class FactorizationToTableaux(CrystalMorphism):
@@ -105,7 +105,7 @@ class CrystalOfAlcovePaths(UniqueRepresentation, Parent):
105
105
  ....: })
106
106
  sage: G.is_isomorphic(GG)
107
107
  True
108
- sage: for (u,v,i) in G.edges(sort=True):
108
+ sage: for u, v, i in G.edges(sort=True):
109
109
  ....: print((u.integer_sequence() , v.integer_sequence(), i))
110
110
  ([], [0], 2)
111
111
  ([0], [0, 8], 1)
@@ -485,7 +485,7 @@ class CrystalOfAlcovePathsElement(ElementWrapper):
485
485
  """
486
486
  return iter(self.value)
487
487
 
488
- def is_admissible(self):
488
+ def is_admissible(self) -> bool:
489
489
  r"""
490
490
  Diagnostic test to check if ``self`` is a valid element of the crystal.
491
491
 
@@ -826,14 +826,15 @@ def _check_containment(t, parent):
826
826
  factors = len(t)
827
827
  max_value = parent.max_value
828
828
  from sage.monoids.hecke_monoid import HeckeMonoid
829
- H = HeckeMonoid(SymmetricGroup(max_value+1))
829
+ H = HeckeMonoid(SymmetricGroup(max_value + 1))
830
830
  w = tuple(H.from_reduced_word(x for factor in t for x in factor).reduced_word())
831
831
  excess = sum(len(l) for l in t) - len(w)
832
832
 
833
833
  if factors != parent.factors:
834
834
  raise ValueError("number of factors do not match")
835
835
  if w != parent.w:
836
- raise ValueError("self and parent must be specified based on equivalent words")
836
+ raise ValueError("self and parent must be specified based "
837
+ "on equivalent words")
837
838
  if excess != parent.excess:
838
839
  raise ValueError("number of excess letters do not match")
839
840