passagemath-combinat 10.6.42__cp314-cp314-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. passagemath_combinat-10.6.42.dist-info/METADATA +160 -0
  3. passagemath_combinat-10.6.42.dist-info/RECORD +400 -0
  4. passagemath_combinat-10.6.42.dist-info/WHEEL +5 -0
  5. passagemath_combinat-10.6.42.dist-info/top_level.txt +3 -0
  6. passagemath_combinat.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  7. passagemath_combinat.libs/libsymmetrica-81fe8739.so.3.0.0 +0 -0
  8. sage/algebras/affine_nil_temperley_lieb.py +263 -0
  9. sage/algebras/all.py +24 -0
  10. sage/algebras/all__sagemath_combinat.py +35 -0
  11. sage/algebras/askey_wilson.py +935 -0
  12. sage/algebras/associated_graded.py +345 -0
  13. sage/algebras/cellular_basis.py +350 -0
  14. sage/algebras/cluster_algebra.py +2766 -0
  15. sage/algebras/down_up_algebra.py +860 -0
  16. sage/algebras/free_algebra.py +1698 -0
  17. sage/algebras/free_algebra_element.py +345 -0
  18. sage/algebras/free_algebra_quotient.py +405 -0
  19. sage/algebras/free_algebra_quotient_element.py +295 -0
  20. sage/algebras/free_zinbiel_algebra.py +885 -0
  21. sage/algebras/hall_algebra.py +783 -0
  22. sage/algebras/hecke_algebras/all.py +4 -0
  23. sage/algebras/hecke_algebras/ariki_koike_algebra.py +1796 -0
  24. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +475 -0
  25. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +3520 -0
  26. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1473 -0
  27. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +1079 -0
  28. sage/algebras/iwahori_hecke_algebra.py +3095 -0
  29. sage/algebras/jordan_algebra.py +1773 -0
  30. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +113 -0
  31. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +156 -0
  32. sage/algebras/lie_conformal_algebras/all.py +18 -0
  33. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +134 -0
  34. sage/algebras/lie_conformal_algebras/examples.py +43 -0
  35. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +131 -0
  36. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +139 -0
  37. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +174 -0
  38. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +167 -0
  39. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +107 -0
  40. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +135 -0
  41. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +353 -0
  42. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +236 -0
  43. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +78 -0
  44. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +328 -0
  45. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +117 -0
  46. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +86 -0
  47. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +82 -0
  48. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +205 -0
  49. sage/algebras/nil_coxeter_algebra.py +191 -0
  50. sage/algebras/q_commuting_polynomials.py +673 -0
  51. sage/algebras/q_system.py +608 -0
  52. sage/algebras/quantum_clifford.py +959 -0
  53. sage/algebras/quantum_groups/ace_quantum_onsager.py +693 -0
  54. sage/algebras/quantum_groups/all.py +9 -0
  55. sage/algebras/quantum_groups/fock_space.py +2219 -0
  56. sage/algebras/quantum_groups/q_numbers.py +207 -0
  57. sage/algebras/quantum_groups/quantum_group_gap.py +2695 -0
  58. sage/algebras/quantum_groups/representations.py +591 -0
  59. sage/algebras/quantum_matrix_coordinate_algebra.py +1006 -0
  60. sage/algebras/quantum_oscillator.py +623 -0
  61. sage/algebras/quaternion_algebra.py +20 -0
  62. sage/algebras/quaternion_algebra_element.py +55 -0
  63. sage/algebras/rational_cherednik_algebra.py +525 -0
  64. sage/algebras/schur_algebra.py +670 -0
  65. sage/algebras/shuffle_algebra.py +1011 -0
  66. sage/algebras/splitting_algebra.py +779 -0
  67. sage/algebras/tensor_algebra.py +709 -0
  68. sage/algebras/yangian.py +1082 -0
  69. sage/algebras/yokonuma_hecke_algebra.py +1018 -0
  70. sage/all__sagemath_combinat.py +35 -0
  71. sage/combinat/SJT.py +255 -0
  72. sage/combinat/affine_permutation.py +2405 -0
  73. sage/combinat/algebraic_combinatorics.py +55 -0
  74. sage/combinat/all.py +53 -0
  75. sage/combinat/all__sagemath_combinat.py +195 -0
  76. sage/combinat/alternating_sign_matrix.py +2063 -0
  77. sage/combinat/baxter_permutations.py +346 -0
  78. sage/combinat/bijectionist.py +3220 -0
  79. sage/combinat/binary_recurrence_sequences.py +1180 -0
  80. sage/combinat/blob_algebra.py +685 -0
  81. sage/combinat/catalog_partitions.py +27 -0
  82. sage/combinat/chas/all.py +23 -0
  83. sage/combinat/chas/fsym.py +1180 -0
  84. sage/combinat/chas/wqsym.py +2601 -0
  85. sage/combinat/cluster_complex.py +326 -0
  86. sage/combinat/colored_permutations.py +2039 -0
  87. sage/combinat/colored_permutations_representations.py +964 -0
  88. sage/combinat/composition_signed.py +142 -0
  89. sage/combinat/composition_tableau.py +855 -0
  90. sage/combinat/constellation.py +1729 -0
  91. sage/combinat/core.py +751 -0
  92. sage/combinat/counting.py +12 -0
  93. sage/combinat/crystals/affine.py +742 -0
  94. sage/combinat/crystals/affine_factorization.py +518 -0
  95. sage/combinat/crystals/affinization.py +331 -0
  96. sage/combinat/crystals/alcove_path.py +2013 -0
  97. sage/combinat/crystals/all.py +22 -0
  98. sage/combinat/crystals/bkk_crystals.py +141 -0
  99. sage/combinat/crystals/catalog.py +115 -0
  100. sage/combinat/crystals/catalog_elementary_crystals.py +18 -0
  101. sage/combinat/crystals/catalog_infinity_crystals.py +33 -0
  102. sage/combinat/crystals/catalog_kirillov_reshetikhin.py +18 -0
  103. sage/combinat/crystals/crystals.py +257 -0
  104. sage/combinat/crystals/direct_sum.py +260 -0
  105. sage/combinat/crystals/elementary_crystals.py +1251 -0
  106. sage/combinat/crystals/fast_crystals.py +441 -0
  107. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +1205 -0
  108. sage/combinat/crystals/generalized_young_walls.py +1076 -0
  109. sage/combinat/crystals/highest_weight_crystals.py +436 -0
  110. sage/combinat/crystals/induced_structure.py +695 -0
  111. sage/combinat/crystals/infinity_crystals.py +730 -0
  112. sage/combinat/crystals/kac_modules.py +863 -0
  113. sage/combinat/crystals/kirillov_reshetikhin.py +4196 -0
  114. sage/combinat/crystals/kyoto_path_model.py +497 -0
  115. sage/combinat/crystals/letters.cpython-314-x86_64-linux-musl.so +0 -0
  116. sage/combinat/crystals/letters.pxd +79 -0
  117. sage/combinat/crystals/letters.pyx +3056 -0
  118. sage/combinat/crystals/littelmann_path.py +1518 -0
  119. sage/combinat/crystals/monomial_crystals.py +1262 -0
  120. sage/combinat/crystals/multisegments.py +462 -0
  121. sage/combinat/crystals/mv_polytopes.py +467 -0
  122. sage/combinat/crystals/pbw_crystal.py +511 -0
  123. sage/combinat/crystals/pbw_datum.cpython-314-x86_64-linux-musl.so +0 -0
  124. sage/combinat/crystals/pbw_datum.pxd +4 -0
  125. sage/combinat/crystals/pbw_datum.pyx +487 -0
  126. sage/combinat/crystals/polyhedral_realization.py +372 -0
  127. sage/combinat/crystals/spins.cpython-314-x86_64-linux-musl.so +0 -0
  128. sage/combinat/crystals/spins.pxd +21 -0
  129. sage/combinat/crystals/spins.pyx +756 -0
  130. sage/combinat/crystals/star_crystal.py +290 -0
  131. sage/combinat/crystals/subcrystal.py +464 -0
  132. sage/combinat/crystals/tensor_product.py +1177 -0
  133. sage/combinat/crystals/tensor_product_element.cpython-314-x86_64-linux-musl.so +0 -0
  134. sage/combinat/crystals/tensor_product_element.pxd +35 -0
  135. sage/combinat/crystals/tensor_product_element.pyx +1870 -0
  136. sage/combinat/crystals/virtual_crystal.py +420 -0
  137. sage/combinat/cyclic_sieving_phenomenon.py +204 -0
  138. sage/combinat/debruijn_sequence.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/combinat/debruijn_sequence.pyx +355 -0
  140. sage/combinat/decorated_permutation.py +270 -0
  141. sage/combinat/degree_sequences.cpython-314-x86_64-linux-musl.so +0 -0
  142. sage/combinat/degree_sequences.pyx +588 -0
  143. sage/combinat/derangements.py +527 -0
  144. sage/combinat/descent_algebra.py +1008 -0
  145. sage/combinat/diagram.py +1551 -0
  146. sage/combinat/diagram_algebras.py +5886 -0
  147. sage/combinat/dyck_word.py +4349 -0
  148. sage/combinat/e_one_star.py +1623 -0
  149. sage/combinat/enumerated_sets.py +123 -0
  150. sage/combinat/expnums.cpython-314-x86_64-linux-musl.so +0 -0
  151. sage/combinat/expnums.pyx +148 -0
  152. sage/combinat/fast_vector_partitions.cpython-314-x86_64-linux-musl.so +0 -0
  153. sage/combinat/fast_vector_partitions.pyx +346 -0
  154. sage/combinat/fqsym.py +1977 -0
  155. sage/combinat/free_dendriform_algebra.py +954 -0
  156. sage/combinat/free_prelie_algebra.py +1141 -0
  157. sage/combinat/fully_commutative_elements.py +1077 -0
  158. sage/combinat/fully_packed_loop.py +1523 -0
  159. sage/combinat/gelfand_tsetlin_patterns.py +1409 -0
  160. sage/combinat/gray_codes.py +311 -0
  161. sage/combinat/grossman_larson_algebras.py +667 -0
  162. sage/combinat/growth.py +4352 -0
  163. sage/combinat/hall_polynomial.py +188 -0
  164. sage/combinat/hillman_grassl.py +866 -0
  165. sage/combinat/integer_matrices.py +329 -0
  166. sage/combinat/integer_vectors_mod_permgroup.py +1238 -0
  167. sage/combinat/k_tableau.py +4564 -0
  168. sage/combinat/kazhdan_lusztig.py +215 -0
  169. sage/combinat/key_polynomial.py +885 -0
  170. sage/combinat/knutson_tao_puzzles.py +2286 -0
  171. sage/combinat/lr_tableau.py +311 -0
  172. sage/combinat/matrices/all.py +24 -0
  173. sage/combinat/matrices/hadamard_matrix.py +3790 -0
  174. sage/combinat/matrices/latin.py +2912 -0
  175. sage/combinat/misc.py +401 -0
  176. sage/combinat/multiset_partition_into_sets_ordered.py +3541 -0
  177. sage/combinat/ncsf_qsym/all.py +21 -0
  178. sage/combinat/ncsf_qsym/combinatorics.py +317 -0
  179. sage/combinat/ncsf_qsym/generic_basis_code.py +1427 -0
  180. sage/combinat/ncsf_qsym/ncsf.py +5637 -0
  181. sage/combinat/ncsf_qsym/qsym.py +4053 -0
  182. sage/combinat/ncsf_qsym/tutorial.py +447 -0
  183. sage/combinat/ncsym/all.py +21 -0
  184. sage/combinat/ncsym/bases.py +855 -0
  185. sage/combinat/ncsym/dual.py +593 -0
  186. sage/combinat/ncsym/ncsym.py +2076 -0
  187. sage/combinat/necklace.py +551 -0
  188. sage/combinat/non_decreasing_parking_function.py +634 -0
  189. sage/combinat/nu_dyck_word.py +1474 -0
  190. sage/combinat/output.py +861 -0
  191. sage/combinat/parallelogram_polyomino.py +4326 -0
  192. sage/combinat/parking_functions.py +1602 -0
  193. sage/combinat/partition_algebra.py +1998 -0
  194. sage/combinat/partition_kleshchev.py +1982 -0
  195. sage/combinat/partition_shifting_algebras.py +584 -0
  196. sage/combinat/partition_tuple.py +3114 -0
  197. sage/combinat/path_tableaux/all.py +13 -0
  198. sage/combinat/path_tableaux/catalog.py +29 -0
  199. sage/combinat/path_tableaux/dyck_path.py +380 -0
  200. sage/combinat/path_tableaux/frieze.py +476 -0
  201. sage/combinat/path_tableaux/path_tableau.py +728 -0
  202. sage/combinat/path_tableaux/semistandard.py +510 -0
  203. sage/combinat/perfect_matching.py +779 -0
  204. sage/combinat/plane_partition.py +3300 -0
  205. sage/combinat/q_bernoulli.cpython-314-x86_64-linux-musl.so +0 -0
  206. sage/combinat/q_bernoulli.pyx +128 -0
  207. sage/combinat/quickref.py +81 -0
  208. sage/combinat/recognizable_series.py +2051 -0
  209. sage/combinat/regular_sequence.py +4316 -0
  210. sage/combinat/regular_sequence_bounded.py +543 -0
  211. sage/combinat/restricted_growth.py +81 -0
  212. sage/combinat/ribbon.py +20 -0
  213. sage/combinat/ribbon_shaped_tableau.py +489 -0
  214. sage/combinat/ribbon_tableau.py +1180 -0
  215. sage/combinat/rigged_configurations/all.py +46 -0
  216. sage/combinat/rigged_configurations/bij_abstract_class.py +548 -0
  217. sage/combinat/rigged_configurations/bij_infinity.py +370 -0
  218. sage/combinat/rigged_configurations/bij_type_A.py +163 -0
  219. sage/combinat/rigged_configurations/bij_type_A2_dual.py +338 -0
  220. sage/combinat/rigged_configurations/bij_type_A2_even.py +218 -0
  221. sage/combinat/rigged_configurations/bij_type_A2_odd.py +199 -0
  222. sage/combinat/rigged_configurations/bij_type_B.py +900 -0
  223. sage/combinat/rigged_configurations/bij_type_C.py +267 -0
  224. sage/combinat/rigged_configurations/bij_type_D.py +771 -0
  225. sage/combinat/rigged_configurations/bij_type_D_tri.py +392 -0
  226. sage/combinat/rigged_configurations/bij_type_D_twisted.py +576 -0
  227. sage/combinat/rigged_configurations/bij_type_E67.py +402 -0
  228. sage/combinat/rigged_configurations/bijection.py +143 -0
  229. sage/combinat/rigged_configurations/kleber_tree.py +1475 -0
  230. sage/combinat/rigged_configurations/kr_tableaux.py +1898 -0
  231. sage/combinat/rigged_configurations/rc_crystal.py +461 -0
  232. sage/combinat/rigged_configurations/rc_infinity.py +540 -0
  233. sage/combinat/rigged_configurations/rigged_configuration_element.py +2403 -0
  234. sage/combinat/rigged_configurations/rigged_configurations.py +1918 -0
  235. sage/combinat/rigged_configurations/rigged_partition.cpython-314-x86_64-linux-musl.so +0 -0
  236. sage/combinat/rigged_configurations/rigged_partition.pxd +15 -0
  237. sage/combinat/rigged_configurations/rigged_partition.pyx +680 -0
  238. sage/combinat/rigged_configurations/tensor_product_kr_tableaux.py +499 -0
  239. sage/combinat/rigged_configurations/tensor_product_kr_tableaux_element.py +428 -0
  240. sage/combinat/rsk.py +3438 -0
  241. sage/combinat/schubert_polynomial.py +508 -0
  242. sage/combinat/set_partition.py +3318 -0
  243. sage/combinat/set_partition_iterator.cpython-314-x86_64-linux-musl.so +0 -0
  244. sage/combinat/set_partition_iterator.pyx +136 -0
  245. sage/combinat/set_partition_ordered.py +1590 -0
  246. sage/combinat/sf/abreu_nigro.py +346 -0
  247. sage/combinat/sf/all.py +52 -0
  248. sage/combinat/sf/character.py +576 -0
  249. sage/combinat/sf/classical.py +319 -0
  250. sage/combinat/sf/dual.py +996 -0
  251. sage/combinat/sf/elementary.py +549 -0
  252. sage/combinat/sf/hall_littlewood.py +1028 -0
  253. sage/combinat/sf/hecke.py +336 -0
  254. sage/combinat/sf/homogeneous.py +464 -0
  255. sage/combinat/sf/jack.py +1428 -0
  256. sage/combinat/sf/k_dual.py +1458 -0
  257. sage/combinat/sf/kfpoly.py +447 -0
  258. sage/combinat/sf/llt.py +789 -0
  259. sage/combinat/sf/macdonald.py +2019 -0
  260. sage/combinat/sf/monomial.py +525 -0
  261. sage/combinat/sf/multiplicative.py +113 -0
  262. sage/combinat/sf/new_kschur.py +1786 -0
  263. sage/combinat/sf/ns_macdonald.py +964 -0
  264. sage/combinat/sf/orthogonal.py +246 -0
  265. sage/combinat/sf/orthotriang.py +355 -0
  266. sage/combinat/sf/powersum.py +963 -0
  267. sage/combinat/sf/schur.py +880 -0
  268. sage/combinat/sf/sf.py +1653 -0
  269. sage/combinat/sf/sfa.py +7053 -0
  270. sage/combinat/sf/symplectic.py +253 -0
  271. sage/combinat/sf/witt.py +721 -0
  272. sage/combinat/shifted_primed_tableau.py +2735 -0
  273. sage/combinat/shuffle.py +830 -0
  274. sage/combinat/sidon_sets.py +146 -0
  275. sage/combinat/similarity_class_type.py +1721 -0
  276. sage/combinat/sine_gordon.py +618 -0
  277. sage/combinat/six_vertex_model.py +784 -0
  278. sage/combinat/skew_partition.py +2053 -0
  279. sage/combinat/skew_tableau.py +2989 -0
  280. sage/combinat/sloane_functions.py +8935 -0
  281. sage/combinat/specht_module.py +1403 -0
  282. sage/combinat/species/all.py +48 -0
  283. sage/combinat/species/characteristic_species.py +321 -0
  284. sage/combinat/species/composition_species.py +273 -0
  285. sage/combinat/species/cycle_species.py +284 -0
  286. sage/combinat/species/empty_species.py +155 -0
  287. sage/combinat/species/functorial_composition_species.py +148 -0
  288. sage/combinat/species/generating_series.py +673 -0
  289. sage/combinat/species/library.py +148 -0
  290. sage/combinat/species/linear_order_species.py +169 -0
  291. sage/combinat/species/misc.py +83 -0
  292. sage/combinat/species/partition_species.py +290 -0
  293. sage/combinat/species/permutation_species.py +268 -0
  294. sage/combinat/species/product_species.py +423 -0
  295. sage/combinat/species/recursive_species.py +476 -0
  296. sage/combinat/species/set_species.py +192 -0
  297. sage/combinat/species/species.py +820 -0
  298. sage/combinat/species/structure.py +539 -0
  299. sage/combinat/species/subset_species.py +243 -0
  300. sage/combinat/species/sum_species.py +225 -0
  301. sage/combinat/subword.py +564 -0
  302. sage/combinat/subword_complex.py +2122 -0
  303. sage/combinat/subword_complex_c.cpython-314-x86_64-linux-musl.so +0 -0
  304. sage/combinat/subword_complex_c.pyx +119 -0
  305. sage/combinat/super_tableau.py +821 -0
  306. sage/combinat/superpartition.py +1154 -0
  307. sage/combinat/symmetric_group_algebra.py +3774 -0
  308. sage/combinat/symmetric_group_representations.py +1830 -0
  309. sage/combinat/t_sequences.py +877 -0
  310. sage/combinat/tableau.py +9506 -0
  311. sage/combinat/tableau_residues.py +860 -0
  312. sage/combinat/tableau_tuple.py +5353 -0
  313. sage/combinat/tiling.py +2432 -0
  314. sage/combinat/triangles_FHM.py +777 -0
  315. sage/combinat/tutorial.py +1857 -0
  316. sage/combinat/vector_partition.py +337 -0
  317. sage/combinat/words/abstract_word.py +1722 -0
  318. sage/combinat/words/all.py +59 -0
  319. sage/combinat/words/alphabet.py +268 -0
  320. sage/combinat/words/finite_word.py +7201 -0
  321. sage/combinat/words/infinite_word.py +113 -0
  322. sage/combinat/words/lyndon_word.py +652 -0
  323. sage/combinat/words/morphic.py +351 -0
  324. sage/combinat/words/morphism.py +3878 -0
  325. sage/combinat/words/paths.py +2932 -0
  326. sage/combinat/words/shuffle_product.py +278 -0
  327. sage/combinat/words/suffix_trees.py +1873 -0
  328. sage/combinat/words/word.py +769 -0
  329. sage/combinat/words/word_char.cpython-314-x86_64-linux-musl.so +0 -0
  330. sage/combinat/words/word_char.pyx +847 -0
  331. sage/combinat/words/word_datatypes.cpython-314-x86_64-linux-musl.so +0 -0
  332. sage/combinat/words/word_datatypes.pxd +4 -0
  333. sage/combinat/words/word_datatypes.pyx +1067 -0
  334. sage/combinat/words/word_generators.py +2026 -0
  335. sage/combinat/words/word_infinite_datatypes.py +1218 -0
  336. sage/combinat/words/word_options.py +99 -0
  337. sage/combinat/words/words.py +2396 -0
  338. sage/data_structures/all__sagemath_combinat.py +1 -0
  339. sage/databases/all__sagemath_combinat.py +13 -0
  340. sage/databases/findstat.py +4897 -0
  341. sage/databases/oeis.py +2058 -0
  342. sage/databases/sloane.py +393 -0
  343. sage/dynamics/all__sagemath_combinat.py +14 -0
  344. sage/dynamics/cellular_automata/all.py +7 -0
  345. sage/dynamics/cellular_automata/catalog.py +34 -0
  346. sage/dynamics/cellular_automata/elementary.py +612 -0
  347. sage/dynamics/cellular_automata/glca.py +477 -0
  348. sage/dynamics/cellular_automata/solitons.py +1463 -0
  349. sage/dynamics/finite_dynamical_system.py +1249 -0
  350. sage/dynamics/finite_dynamical_system_catalog.py +382 -0
  351. sage/games/all.py +7 -0
  352. sage/games/hexad.py +704 -0
  353. sage/games/quantumino.py +591 -0
  354. sage/games/sudoku.py +889 -0
  355. sage/games/sudoku_backtrack.cpython-314-x86_64-linux-musl.so +0 -0
  356. sage/games/sudoku_backtrack.pyx +189 -0
  357. sage/groups/all__sagemath_combinat.py +1 -0
  358. sage/groups/indexed_free_group.py +489 -0
  359. sage/libs/all__sagemath_combinat.py +6 -0
  360. sage/libs/lrcalc/__init__.py +1 -0
  361. sage/libs/lrcalc/lrcalc.py +525 -0
  362. sage/libs/symmetrica/__init__.py +7 -0
  363. sage/libs/symmetrica/all.py +101 -0
  364. sage/libs/symmetrica/kostka.pxi +168 -0
  365. sage/libs/symmetrica/part.pxi +193 -0
  366. sage/libs/symmetrica/plet.pxi +42 -0
  367. sage/libs/symmetrica/sab.pxi +196 -0
  368. sage/libs/symmetrica/sb.pxi +332 -0
  369. sage/libs/symmetrica/sc.pxi +192 -0
  370. sage/libs/symmetrica/schur.pxi +956 -0
  371. sage/libs/symmetrica/symmetrica.cpython-314-x86_64-linux-musl.so +0 -0
  372. sage/libs/symmetrica/symmetrica.pxi +1172 -0
  373. sage/libs/symmetrica/symmetrica.pyx +39 -0
  374. sage/monoids/all.py +13 -0
  375. sage/monoids/automatic_semigroup.py +1054 -0
  376. sage/monoids/free_abelian_monoid.py +315 -0
  377. sage/monoids/free_abelian_monoid_element.cpython-314-x86_64-linux-musl.so +0 -0
  378. sage/monoids/free_abelian_monoid_element.pxd +16 -0
  379. sage/monoids/free_abelian_monoid_element.pyx +397 -0
  380. sage/monoids/free_monoid.py +335 -0
  381. sage/monoids/free_monoid_element.py +431 -0
  382. sage/monoids/hecke_monoid.py +65 -0
  383. sage/monoids/string_monoid.py +817 -0
  384. sage/monoids/string_monoid_element.py +547 -0
  385. sage/monoids/string_ops.py +143 -0
  386. sage/monoids/trace_monoid.py +972 -0
  387. sage/rings/all__sagemath_combinat.py +2 -0
  388. sage/sat/all.py +4 -0
  389. sage/sat/boolean_polynomials.py +405 -0
  390. sage/sat/converters/__init__.py +6 -0
  391. sage/sat/converters/anf2cnf.py +14 -0
  392. sage/sat/converters/polybori.py +611 -0
  393. sage/sat/solvers/__init__.py +5 -0
  394. sage/sat/solvers/cryptominisat.py +287 -0
  395. sage/sat/solvers/dimacs.py +783 -0
  396. sage/sat/solvers/picosat.py +228 -0
  397. sage/sat/solvers/sat_lp.py +156 -0
  398. sage/sat/solvers/satsolver.cpython-314-x86_64-linux-musl.so +0 -0
  399. sage/sat/solvers/satsolver.pxd +3 -0
  400. sage/sat/solvers/satsolver.pyx +405 -0
@@ -0,0 +1,1830 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules sage.groups
3
+ r"""
4
+ Representations of the symmetric group
5
+
6
+ .. TODO::
7
+
8
+ - construct the product of two irreducible representations.
9
+
10
+ - implement Induction/Restriction of representations.
11
+
12
+ .. WARNING::
13
+
14
+ This code uses a different convention than in Sagan's book "The Symmetric
15
+ Group"
16
+ """
17
+ # ****************************************************************************
18
+ # Copyright (C) 2009 Franco Saliola <saliola@gmail.com>
19
+ # 2024 Travis Scrimshaw <tcscrims at gmail.com>
20
+ #
21
+ # Distributed under the terms of the GNU General Public License (GPL)
22
+ #
23
+ # This code is distributed in the hope that it will be useful,
24
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
+ # General Public License for more details.
27
+ #
28
+ # The full text of the GPL is available at:
29
+ #
30
+ # https://www.gnu.org/licenses/
31
+ # ****************************************************************************
32
+
33
+ from sage.misc.lazy_import import lazy_import
34
+ from sage.misc.functional import sqrt
35
+ from sage.combinat.partition import Partition, Partitions
36
+ from sage.combinat.permutation import Permutation, Permutations, from_cycles
37
+ from sage.combinat.tableau import StandardTableaux, Tableau
38
+ from sage.matrix.constructor import matrix
39
+ from sage.misc.cachefunc import cached_method
40
+ from sage.misc.lazy_attribute import lazy_attribute
41
+ from sage.rings.integer_ring import ZZ
42
+ from sage.rings.rational_field import QQ
43
+ from sage.structure.parent import Parent
44
+ from sage.structure.element import Element
45
+ from sage.structure.unique_representation import UniqueRepresentation
46
+ from sage.sets.finite_enumerated_set import FiniteEnumeratedSets
47
+
48
+ lazy_import("sage.combinat.yang_baxter_graph", "YangBaxterGraph_partition")
49
+ lazy_import("sage.groups.perm_gps.constructor", "PermutationGroupElement", as_='PermutationConstructor')
50
+ lazy_import("sage.symbolic.ring", "SR")
51
+
52
+
53
+ # #### Constructor function ################################################
54
+
55
+
56
+ def SymmetricGroupRepresentation(partition, implementation='specht',
57
+ ring=None, cache_matrices=True):
58
+ r"""
59
+ The irreducible representation of the symmetric group corresponding to
60
+ ``partition``.
61
+
62
+ INPUT:
63
+
64
+ - ``partition`` -- a partition of a positive integer
65
+
66
+ - ``implementation`` -- string (default: ``'specht'``); one of:
67
+
68
+ * ``'seminormal'`` -- for Young's seminormal representation
69
+ * ``'orthogonal'`` -- for Young's orthogonal representation
70
+ * ``'specht'`` -- for Specht's representation
71
+ * ``'unitary'`` -- for the unitary representation
72
+
73
+ - ``ring`` -- the ring over which the representation is defined
74
+
75
+ - ``cache_matrices`` -- boolean (default: ``True``); if ``True``, then any
76
+ representation matrices that are computed are cached
77
+
78
+ EXAMPLES:
79
+
80
+ Young's orthogonal representation: the matrices are orthogonal.
81
+
82
+ ::
83
+
84
+ sage: orth = SymmetricGroupRepresentation([2,1], "orthogonal"); orth # needs sage.symbolic
85
+ Orthogonal representation of the symmetric group corresponding to [2, 1]
86
+ sage: all(a*a.transpose() == a.parent().identity_matrix() for a in orth) # needs sage.symbolic
87
+ True
88
+
89
+ ::
90
+
91
+ sage: # needs sage.symbolic
92
+ sage: orth = SymmetricGroupRepresentation([3,2], "orthogonal"); orth
93
+ Orthogonal representation of the symmetric group corresponding to [3, 2]
94
+ sage: orth([2,1,3,4,5])
95
+ [ 1 0 0 0 0]
96
+ [ 0 1 0 0 0]
97
+ [ 0 0 -1 0 0]
98
+ [ 0 0 0 1 0]
99
+ [ 0 0 0 0 -1]
100
+ sage: orth([1,3,2,4,5])
101
+ [ 1 0 0 0 0]
102
+ [ 0 -1/2 1/2*sqrt(3) 0 0]
103
+ [ 0 1/2*sqrt(3) 1/2 0 0]
104
+ [ 0 0 0 -1/2 1/2*sqrt(3)]
105
+ [ 0 0 0 1/2*sqrt(3) 1/2]
106
+ sage: orth([1,2,4,3,5])
107
+ [ -1/3 2/3*sqrt(2) 0 0 0]
108
+ [2/3*sqrt(2) 1/3 0 0 0]
109
+ [ 0 0 1 0 0]
110
+ [ 0 0 0 1 0]
111
+ [ 0 0 0 0 -1]
112
+
113
+ The Specht representation::
114
+
115
+ sage: spc = SymmetricGroupRepresentation([3,2], "specht")
116
+ sage: spc.scalar_product_matrix(Permutation([1,2,3,4,5]))
117
+ [ 1 0 0 0 0]
118
+ [ 0 -1 0 0 0]
119
+ [ 0 0 1 0 0]
120
+ [ 0 0 0 1 0]
121
+ [-1 0 0 0 -1]
122
+ sage: spc.scalar_product_matrix(Permutation([5,4,3,2,1]))
123
+ [ 1 -1 0 1 0]
124
+ [ 0 0 1 0 -1]
125
+ [ 0 0 0 -1 1]
126
+ [ 0 1 -1 -1 1]
127
+ [-1 0 0 0 -1]
128
+ sage: spc([5,4,3,2,1])
129
+ [ 1 -1 0 1 0]
130
+ [ 0 0 -1 0 1]
131
+ [ 0 0 0 -1 1]
132
+ [ 0 1 -1 -1 1]
133
+ [ 0 1 0 -1 1]
134
+ sage: spc.verify_representation()
135
+ True
136
+
137
+ The unitary representation::
138
+
139
+ sage: unitary = SymmetricGroupRepresentation([3,1], "unitary"); unitary # needs sage.symbolic
140
+ Unitary representation of the symmetric group corresponding to [3, 1]
141
+
142
+ sage: # needs sage.rings.finite_rings
143
+ sage: unitary_GF49 = SymmetricGroupRepresentation([3,1], "unitary", ring=GF(7**2))
144
+ sage: unitary_GF49
145
+ Unitary representation of the symmetric group corresponding to [3, 1]
146
+ sage: unitary_GF49([2,1,3,4])
147
+ [6 0 0]
148
+ [0 1 0]
149
+ [0 0 1]
150
+ sage: unitary_GF49([3,2,1,4])
151
+ [ 4 2*z2 + 3 0]
152
+ [5*z2 + 5 3 0]
153
+ [ 0 0 1]
154
+ sage: unitary_GF49.verify_representation()
155
+ True
156
+
157
+ By default, any representation matrices that are computed are cached::
158
+
159
+ sage: spc = SymmetricGroupRepresentation([3,2], "specht")
160
+ sage: spc([5,4,3,2,1])
161
+ [ 1 -1 0 1 0]
162
+ [ 0 0 -1 0 1]
163
+ [ 0 0 0 -1 1]
164
+ [ 0 1 -1 -1 1]
165
+ [ 0 1 0 -1 1]
166
+ sage: spc._cache__representation_matrix
167
+ {(([5, 4, 3, 2, 1],), ()): [ 1 -1 0 1 0]
168
+ [ 0 0 -1 0 1]
169
+ [ 0 0 0 -1 1]
170
+ [ 0 1 -1 -1 1]
171
+ [ 0 1 0 -1 1]}
172
+
173
+ This can be turned off with the keyword ``cache_matrices``::
174
+
175
+ sage: spc = SymmetricGroupRepresentation([3,2], "specht", cache_matrices=False)
176
+ sage: spc([5,4,3,2,1])
177
+ [ 1 -1 0 1 0]
178
+ [ 0 0 -1 0 1]
179
+ [ 0 0 0 -1 1]
180
+ [ 0 1 -1 -1 1]
181
+ [ 0 1 0 -1 1]
182
+ sage: hasattr(spc, '_cache__representation_matrix')
183
+ False
184
+
185
+ .. NOTE::
186
+
187
+ The implementation is based on the paper [Las]_.
188
+
189
+ REFERENCES:
190
+
191
+ .. [Las] Alain Lascoux, 'Young representations of the symmetric group.'
192
+ http://phalanstere.univ-mlv.fr/~al/ARTICLES/ProcCrac.ps.gz
193
+
194
+ AUTHORS:
195
+
196
+ - Franco Saliola (2009-04-23)
197
+ """
198
+ partition = Partition(partition)
199
+ Rep = SymmetricGroupRepresentations(sum(partition), implementation=implementation,
200
+ ring=ring, cache_matrices=cache_matrices)
201
+ return Rep(partition)
202
+
203
+
204
+ def SymmetricGroupRepresentations(n, implementation='specht', ring=None,
205
+ cache_matrices=True):
206
+ r"""
207
+ Irreducible representations of the symmetric group.
208
+
209
+ INPUT:
210
+
211
+ - ``n`` -- positive integer
212
+
213
+ - ``implementation`` -- string (default: ``'specht'``); one of:
214
+
215
+ * ``'seminormal'`` -- for Young's seminormal representation
216
+ * ``'orthogonal'`` -- for Young's orthogonal representation
217
+ * ``'specht'`` -- for Specht's representation
218
+ * ``'unitary'`` -- for the unitary representation
219
+
220
+ - ``ring`` -- the ring over which the representation is defined
221
+
222
+ - ``cache_matrices`` -- boolean (default: ``True``); if ``True``, then any
223
+ representation matrices that are computed are cached
224
+
225
+ EXAMPLES:
226
+
227
+ Young's orthogonal representation: the matrices are orthogonal.
228
+
229
+ ::
230
+
231
+ sage: orth = SymmetricGroupRepresentations(3, "orthogonal"); orth # needs sage.symbolic
232
+ Orthogonal representations of the symmetric group of order 3! over Symbolic Ring
233
+ sage: orth.list() # needs sage.symbolic
234
+ [Orthogonal representation of the symmetric group corresponding to [3],
235
+ Orthogonal representation of the symmetric group corresponding to [2, 1],
236
+ Orthogonal representation of the symmetric group corresponding to [1, 1, 1]]
237
+ sage: orth([2,1])([1,2,3]) # needs sage.symbolic
238
+ [1 0]
239
+ [0 1]
240
+
241
+ Young's seminormal representation.
242
+
243
+ ::
244
+
245
+ sage: snorm = SymmetricGroupRepresentations(3, "seminormal"); snorm
246
+ Seminormal representations of the symmetric group of order 3! over Rational Field
247
+ sage: sgn = snorm([1,1,1]); sgn
248
+ Seminormal representation of the symmetric group corresponding to [1, 1, 1]
249
+ sage: list(map(sgn, Permutations(3)))
250
+ [[1], [-1], [-1], [1], [1], [-1]]
251
+
252
+ The Specht Representation.
253
+
254
+ ::
255
+
256
+ sage: spc = SymmetricGroupRepresentations(5, "specht"); spc
257
+ Specht representations of the symmetric group of order 5! over Integer Ring
258
+ sage: spc([3,2])([5,4,3,2,1])
259
+ [ 1 -1 0 1 0]
260
+ [ 0 0 -1 0 1]
261
+ [ 0 0 0 -1 1]
262
+ [ 0 1 -1 -1 1]
263
+ [ 0 1 0 -1 1]
264
+
265
+ The unitary representation.
266
+
267
+ ::
268
+
269
+ sage: unitary = SymmetricGroupRepresentations(3, "unitary"); unitary # needs sage.symbolic
270
+ Unitary representations of the symmetric group of order 3! over Symbolic Ring
271
+
272
+ sage: # needs sage.rings.finite_rings
273
+ sage: unitary_GF49 = SymmetricGroupRepresentations(4, "unitary", ring=GF(7**2)); unitary_GF49
274
+ Unitary representations of the symmetric group of order 4! over Finite Field in z2 of size 7^2
275
+ sage: unitary_GF49([3,1])([2,1,3,4])
276
+ [6 0 0]
277
+ [0 1 0]
278
+ [0 0 1]
279
+ sage: unitary_GF49([3,1])([3,2,1,4])
280
+ [ 4 2*z2 + 3 0]
281
+ [5*z2 + 5 3 0]
282
+ [ 0 0 1]
283
+
284
+ .. NOTE::
285
+
286
+ The implementation is based on the paper [Las]_.
287
+
288
+ AUTHORS:
289
+
290
+ - Franco Saliola (2009-04-23)
291
+ """
292
+ if implementation == "seminormal":
293
+ return YoungRepresentations_Seminormal(n, ring=ring, cache_matrices=cache_matrices)
294
+ elif implementation == "orthogonal":
295
+ return YoungRepresentations_Orthogonal(n, ring=ring, cache_matrices=cache_matrices)
296
+ elif implementation == "specht":
297
+ return SpechtRepresentations(n, ring=ring, cache_matrices=cache_matrices)
298
+ elif implementation == "unitary":
299
+ return UnitaryRepresentations(n, ring=ring, cache_matrices=cache_matrices)
300
+ else:
301
+ raise NotImplementedError("only seminormal, orthogonal and specht are implemented")
302
+
303
+ # #### Generic classes for symmetric group representations #################
304
+
305
+
306
+ class SymmetricGroupRepresentation_generic_class(Element):
307
+ r"""
308
+ Generic methods for a representation of the symmetric group.
309
+ """
310
+ _default_ring = None
311
+
312
+ def __init__(self, parent, partition):
313
+ r"""
314
+ An irreducible representation of the symmetric group corresponding
315
+ to ``partition``.
316
+
317
+ For more information, see the documentation for
318
+ :func:`SymmetricGroupRepresentation`.
319
+
320
+ EXAMPLES::
321
+
322
+ sage: spc = SymmetricGroupRepresentation([3])
323
+ sage: spc([3,2,1])
324
+ [1]
325
+ sage: spc == loads(dumps(spc))
326
+ True
327
+
328
+ sage: spc = SymmetricGroupRepresentation([3], cache_matrices=False)
329
+ sage: spc([3,2,1])
330
+ [1]
331
+ sage: spc == loads(dumps(spc))
332
+ True
333
+ """
334
+ self._partition = Partition(partition)
335
+ self._n = parent._n
336
+ self._ring = parent._ring
337
+ if not parent._cache_matrices:
338
+ self.representation_matrix = self._representation_matrix_uncached
339
+ Element.__init__(self, parent)
340
+
341
+ def __hash__(self):
342
+ r"""
343
+ TESTS::
344
+
345
+ sage: spc1 = SymmetricGroupRepresentation([3], cache_matrices=True)
346
+ sage: hash(spc1) ^^ hash((3,)) == hash(ZZ)
347
+ True
348
+ """
349
+ return hash(self._ring) ^ hash(self._partition)
350
+
351
+ def __eq__(self, other):
352
+ r"""
353
+ Test for equality.
354
+
355
+ EXAMPLES::
356
+
357
+ sage: spc1 = SymmetricGroupRepresentation([3], cache_matrices=True)
358
+ sage: spc1([3,1,2])
359
+ [1]
360
+ sage: spc2 = loads(dumps(spc1))
361
+ sage: spc1 == spc2
362
+ True
363
+
364
+ ::
365
+
366
+ sage: spc3 = SymmetricGroupRepresentation([3], cache_matrices=False)
367
+ sage: spc3([3,1,2])
368
+ [1]
369
+ sage: spc4 = loads(dumps(spc3))
370
+ sage: spc3 == spc4
371
+ True
372
+ sage: spc1 == spc3
373
+ True
374
+
375
+ TESTS:
376
+
377
+ The following tests against some bug that was fixed in :issue:`8611`::
378
+
379
+ sage: spc = SymmetricGroupRepresentation([3])
380
+ sage: spc.important_info = 'Sage rules'
381
+ sage: spc == SymmetricGroupRepresentation([3])
382
+ True
383
+ """
384
+ if not isinstance(other, type(self)):
385
+ return False
386
+ return (self._ring, self._partition) == (other._ring, other._partition)
387
+
388
+ def __ne__(self, other):
389
+ """
390
+ Test for inequality.
391
+
392
+ EXAMPLES::
393
+
394
+ sage: spc1 = SymmetricGroupRepresentation([3], cache_matrices=True)
395
+ sage: loads(dumps(spc1)) != spc1
396
+ False
397
+ sage: spc2 = SymmetricGroupRepresentation([2,1])
398
+ sage: spc1 != spc2
399
+ True
400
+ sage: spc3 = SymmetricGroupRepresentation([3], cache_matrices=False)
401
+ sage: spc1 != spc3
402
+ False
403
+ """
404
+ return not (self == other)
405
+
406
+ def __call__(self, permutation):
407
+ r"""
408
+ Return the image of ``permutation`` in the representation.
409
+
410
+ EXAMPLES::
411
+
412
+ sage: spc = SymmetricGroupRepresentation([2,1])
413
+ sage: spc([1,3,2])
414
+ [ 1 0]
415
+ [ 1 -1]
416
+ """
417
+ return self.representation_matrix(Permutation(permutation))
418
+
419
+ def __iter__(self):
420
+ r"""
421
+ Iterate over the matrices representing the elements of the
422
+ symmetric group.
423
+
424
+ EXAMPLES::
425
+
426
+ sage: spc = SymmetricGroupRepresentation([1,1,1])
427
+ sage: list(spc)
428
+ [[1], [-1], [-1], [1], [1], [-1]]
429
+ """
430
+ for permutation in Permutations(self._n):
431
+ yield self.representation_matrix(permutation)
432
+
433
+ def verify_representation(self):
434
+ r"""
435
+ Verify the representation.
436
+
437
+ This tests that the images of the simple transpositions are
438
+ involutions and tests that the braid relations hold.
439
+
440
+ EXAMPLES::
441
+
442
+ sage: spc = SymmetricGroupRepresentation([1,1,1])
443
+ sage: spc.verify_representation()
444
+ True
445
+ sage: spc = SymmetricGroupRepresentation([4,2,1])
446
+ sage: spc.verify_representation()
447
+ True
448
+ """
449
+ n = self._n
450
+ transpositions = [from_cycles(n, ((i, i + 1),)) for i in range(1, n)]
451
+ repn_matrices = [self.representation_matrix(t) for t in transpositions]
452
+ for i, si in enumerate(repn_matrices):
453
+ for j, sj in enumerate(repn_matrices):
454
+ if i == j:
455
+ if si * sj != si.parent().identity_matrix():
456
+ return False, "si si != 1 for i = %s" % (i,)
457
+ elif abs(i - j) > 1:
458
+ if si * sj != sj * si:
459
+ return False, "si sj != sj si for (i,j) =(%s,%s)" % (i, j)
460
+ else:
461
+ if si * sj * si != sj * si * sj:
462
+ return False, "si sj si != sj si sj for (i,j) = (%s,%s)" % (i, j)
463
+ return True
464
+
465
+ def to_character(self):
466
+ r"""
467
+ Return the character of the representation.
468
+
469
+ EXAMPLES:
470
+
471
+ The trivial character::
472
+
473
+ sage: rho = SymmetricGroupRepresentation([3])
474
+ sage: chi = rho.to_character(); chi
475
+ Character of Symmetric group of order 3! as a permutation group
476
+ sage: chi.values()
477
+ [1, 1, 1]
478
+ sage: all(chi(g) == 1 for g in SymmetricGroup(3))
479
+ True
480
+
481
+ The sign character::
482
+
483
+ sage: rho = SymmetricGroupRepresentation([1,1,1])
484
+ sage: chi = rho.to_character(); chi
485
+ Character of Symmetric group of order 3! as a permutation group
486
+ sage: chi.values()
487
+ [1, -1, 1]
488
+ sage: all(chi(g) == g.sign() for g in SymmetricGroup(3))
489
+ True
490
+
491
+ The defining representation::
492
+
493
+ sage: triv = SymmetricGroupRepresentation([4])
494
+ sage: hook = SymmetricGroupRepresentation([3,1])
495
+ sage: def_rep = lambda p : triv(p).block_sum(hook(p)).trace()
496
+ sage: list(map(def_rep, Permutations(4)))
497
+ [4, 2, 2, 1, 1, 2, 2, 0, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 0, 1, 1, 2, 0, 0]
498
+ sage: [p.to_matrix().trace() for p in Permutations(4)]
499
+ [4, 2, 2, 1, 1, 2, 2, 0, 1, 0, 0, 1, 1, 0, 2, 1, 0, 0, 0, 1, 1, 2, 0, 0]
500
+ """
501
+ from sage.groups.perm_gps.permgroup_named import SymmetricGroup
502
+ Sym = SymmetricGroup(sum(self._partition))
503
+ values = [self(g).trace() for g in Sym.conjugacy_classes_representatives()]
504
+ return Sym.character(values)
505
+
506
+
507
+ class SymmetricGroupRepresentations_class(UniqueRepresentation,Parent):
508
+ r"""
509
+ Generic methods for the CombinatorialClass of irreducible
510
+ representations of the symmetric group.
511
+ """
512
+
513
+ def __init__(self, n, ring=None, cache_matrices=True):
514
+ r"""
515
+ Irreducible representations of the symmetric group.
516
+
517
+ See the documentation for :func:`SymmetricGroupRepresentations`
518
+ for more information.
519
+
520
+ EXAMPLES::
521
+
522
+ sage: snorm = SymmetricGroupRepresentations(3, "seminormal")
523
+ sage: snorm == loads(dumps(snorm))
524
+ True
525
+ """
526
+ self._n = n
527
+ self._ring = ring if ring is not None else self._default_ring
528
+ self._cache_matrices = cache_matrices
529
+ Parent.__init__(self, category=FiniteEnumeratedSets())
530
+
531
+ def _element_constructor_(self, partition):
532
+ r"""
533
+ Return the irreducible representation corresponding to ``partition``.
534
+
535
+ EXAMPLES::
536
+
537
+ sage: sp = SymmetricGroupRepresentations(3, "specht")
538
+ sage: sp([1,1,1])
539
+ Specht representation of the symmetric group corresponding to [1, 1, 1]
540
+
541
+ sage: snorm = SymmetricGroupRepresentations(3, "seminormal")
542
+ sage: snorm([2,1])
543
+ Seminormal representation of the symmetric group corresponding to [2, 1]
544
+ """
545
+ if Partition(partition).size() != self._n:
546
+ raise TypeError("not a partition of %s" % self._n)
547
+ return self.element_class(self, partition)
548
+
549
+ def cardinality(self):
550
+ """
551
+ Return the cardinality of ``self``.
552
+
553
+ EXAMPLES::
554
+
555
+ sage: sp = SymmetricGroupRepresentations(4, "specht")
556
+ sage: sp.cardinality()
557
+ 5
558
+ """
559
+ return Partitions(self._n).cardinality()
560
+
561
+ def __iter__(self):
562
+ r"""
563
+ Iterate through all the irreducible representations of the
564
+ symmetric group.
565
+
566
+ EXAMPLES::
567
+
568
+ sage: orth = SymmetricGroupRepresentations(3, "orthogonal") # needs sage.symbolic
569
+ sage: for x in orth: print(x) # needs sage.symbolic
570
+ Orthogonal representation of the symmetric group corresponding to [3]
571
+ Orthogonal representation of the symmetric group corresponding to [2, 1]
572
+ Orthogonal representation of the symmetric group corresponding to [1, 1, 1]
573
+ """
574
+ for partition in Partitions(self._n):
575
+ yield self.element_class(self, partition)
576
+
577
+ # #### Young's Seminormal Representation ###################################
578
+
579
+
580
+ class YoungRepresentation_generic(SymmetricGroupRepresentation_generic_class):
581
+ r"""
582
+ Generic methods for Young's representations of the symmetric group.
583
+ """
584
+ @lazy_attribute
585
+ def _yang_baxter_graph(self):
586
+ r"""
587
+ Return the Yang-Baxter graph associated with the representation,
588
+ with vertices labelled by the vector of contents of the partition.
589
+
590
+ EXAMPLES::
591
+
592
+ sage: orth = SymmetricGroupRepresentation([3,2], "orthogonal") # needs sage.symbolic
593
+ sage: orth._yang_baxter_graph # needs sage.symbolic
594
+ Yang-Baxter graph of [3, 2], with top vertex (0, -1, 2, 1, 0)
595
+ """
596
+ Y = YangBaxterGraph_partition(self._partition)
597
+ n = self._n
598
+ # relabel vertices with "vector of contents"
599
+ Y.relabel_vertices(partition_to_vector_of_contents(self._partition,
600
+ reverse=True))
601
+ # relabel edges with "differences"
602
+ edge_relabel_dict = {}
603
+ for u, v, op in Y.edges():
604
+ i = op.position() + 1
605
+ edge_relabel_dict[u, v] = (n - i, QQ((1, u[i] - u[i - 1])))
606
+ Y.relabel_edges(edge_relabel_dict)
607
+ return Y
608
+
609
+ @lazy_attribute
610
+ def _tableau_dict(self):
611
+ r"""
612
+ A dictionary pairing the vertices of the underlying Yang-Baxter
613
+ graph with standard tableau.
614
+
615
+ EXAMPLES::
616
+
617
+ sage: orth = SymmetricGroupRepresentation([3,2], "orthogonal") # needs sage.symbolic
618
+ sage: orth._tableau_dict # needs sage.symbolic
619
+ {(0, -1, 2, 1, 0): [[1, 2, 3], [4, 5]],
620
+ (0, 2, -1, 1, 0): [[1, 2, 4], [3, 5]],
621
+ (0, 2, 1, -1, 0): [[1, 3, 4], [2, 5]],
622
+ (2, 0, -1, 1, 0): [[1, 2, 5], [3, 4]],
623
+ (2, 0, 1, -1, 0): [[1, 3, 5], [2, 4]]}
624
+ """
625
+ # construct a dictionary pairing vertices with tableau
626
+ t = StandardTableaux(self._partition).last()
627
+ tableau_dict = {self._yang_baxter_graph.root(): t}
628
+ for u, w, (i, _) in self._yang_baxter_graph._edges_in_bfs():
629
+ # TODO: improve the following
630
+ si = PermutationConstructor((i, i + 1))
631
+ tableau_dict[w] = Tableau([[si(b) for b in row]
632
+ for row in tableau_dict[u]])
633
+ return tableau_dict
634
+
635
+ @lazy_attribute
636
+ def _word_dict(self):
637
+ r"""
638
+ A dictionary pairing the vertices of the underlying Yang-Baxter
639
+ graph with words readings of standard tableau.
640
+
641
+ EXAMPLES::
642
+
643
+ sage: orth = SymmetricGroupRepresentation([3,2], "orthogonal") # needs sage.symbolic
644
+ sage: orth._word_dict # needs sage.symbolic
645
+ {(0, -1, 2, 1, 0): (4, 5, 1, 2, 3),
646
+ (0, 2, -1, 1, 0): (3, 5, 1, 2, 4),
647
+ (0, 2, 1, -1, 0): (2, 5, 1, 3, 4),
648
+ (2, 0, -1, 1, 0): (3, 4, 1, 2, 5),
649
+ (2, 0, 1, -1, 0): (2, 4, 1, 3, 5)}
650
+ """
651
+ return {v: sum(reversed(t), ())
652
+ for v, t in self._tableau_dict.items()}
653
+
654
+ @cached_method
655
+ def representation_matrix_for_simple_transposition(self, i):
656
+ r"""
657
+ Return the matrix representing the transposition that swaps ``i`` and
658
+ ``i+1``.
659
+
660
+ EXAMPLES::
661
+
662
+ sage: orth = SymmetricGroupRepresentation([2,1], "orthogonal") # needs sage.symbolic
663
+ sage: orth.representation_matrix_for_simple_transposition(1) # needs sage.symbolic
664
+ [ 1 0]
665
+ [ 0 -1]
666
+ sage: orth.representation_matrix_for_simple_transposition(2) # needs sage.symbolic
667
+ [ -1/2 1/2*sqrt(3)]
668
+ [1/2*sqrt(3) 1/2]
669
+
670
+ sage: norm = SymmetricGroupRepresentation([2,1], "seminormal")
671
+ sage: norm.representation_matrix_for_simple_transposition(1)
672
+ [ 1 0]
673
+ [ 0 -1]
674
+ sage: norm.representation_matrix_for_simple_transposition(2)
675
+ [-1/2 3/2]
676
+ [ 1/2 1/2]
677
+ """
678
+ from copy import copy
679
+ if not (1 <= i < sum(self._partition)):
680
+ raise TypeError
681
+ Y = self._yang_baxter_graph
682
+ index_lookup = {b: a for a, b in enumerate(list(Y))}
683
+ digraph = copy(Y._digraph)
684
+ digraph.delete_edges((u, v) for (u, v, (j, beta)) in digraph.edges(sort=True)
685
+ if j != i)
686
+ M = matrix(self._ring, digraph.num_verts())
687
+ for g in digraph.connected_components_subgraphs():
688
+ if g.num_verts() == 1:
689
+ [v] = g.vertices(sort=True)
690
+ w = self._word_dict[v]
691
+ trivial = None
692
+ for j, a in enumerate(w):
693
+ if a == i and w[j + 1] == i + 1:
694
+ trivial = True
695
+ break
696
+ elif a == i + 1:
697
+ trivial = False
698
+ break
699
+ j = index_lookup[v]
700
+ M[j, j] = 1 if trivial is True else -1
701
+ else:
702
+ [(u, v, (j, beta))] = g.edges(sort=True)
703
+ iu = index_lookup[u]
704
+ iv = index_lookup[v]
705
+ M[iu, iu], M[iu, iv], M[iv, iu], M[iv, iv] = \
706
+ self._2x2_matrix_entries(self._ring(beta))
707
+ return M
708
+
709
+ def _representation_matrix_uncached(self, permutation):
710
+ r"""
711
+ Return the matrix representing ``permutation``.
712
+
713
+ EXAMPLES::
714
+
715
+ sage: orth = SymmetricGroupRepresentation([2,1], "orthogonal") # needs sage.symbolic
716
+ sage: orth._representation_matrix_uncached(Permutation([2,1,3])) # needs sage.symbolic
717
+ [ 1 0]
718
+ [ 0 -1]
719
+ sage: orth._representation_matrix_uncached(Permutation([1,3,2])) # needs sage.symbolic
720
+ [ -1/2 1/2*sqrt(3)]
721
+ [1/2*sqrt(3) 1/2]
722
+
723
+ ::
724
+
725
+ sage: norm = SymmetricGroupRepresentation([2,1], "seminormal")
726
+ sage: p = PermutationGroupElement([2,1,3])
727
+ sage: norm._representation_matrix_uncached(p)
728
+ [ 1 0]
729
+ [ 0 -1]
730
+ sage: p = PermutationGroupElement([1,3,2])
731
+ sage: norm._representation_matrix_uncached(p)
732
+ [-1/2 3/2]
733
+ [ 1/2 1/2]
734
+ """
735
+ m = self._yang_baxter_graph._digraph.num_verts()
736
+ M = matrix(self._ring, m, m, 1)
737
+ for i in Permutation(permutation).reduced_word():
738
+ M *= self.representation_matrix_for_simple_transposition(i)
739
+ return M
740
+
741
+ @cached_method
742
+ def representation_matrix(self, permutation):
743
+ r"""
744
+ Return the matrix representing ``permutation``.
745
+
746
+ EXAMPLES::
747
+
748
+ sage: orth = SymmetricGroupRepresentation([2,1], "orthogonal") # needs sage.symbolic
749
+ sage: orth.representation_matrix(Permutation([2,1,3])) # needs sage.symbolic
750
+ [ 1 0]
751
+ [ 0 -1]
752
+ sage: orth.representation_matrix(Permutation([1,3,2])) # needs sage.symbolic
753
+ [ -1/2 1/2*sqrt(3)]
754
+ [1/2*sqrt(3) 1/2]
755
+
756
+ ::
757
+
758
+ sage: norm = SymmetricGroupRepresentation([2,1], "seminormal")
759
+ sage: p = PermutationGroupElement([2,1,3])
760
+ sage: norm.representation_matrix(p)
761
+ [ 1 0]
762
+ [ 0 -1]
763
+ sage: p = PermutationGroupElement([1,3,2])
764
+ sage: norm.representation_matrix(p)
765
+ [-1/2 3/2]
766
+ [ 1/2 1/2]
767
+ """
768
+ ret = self._representation_matrix_uncached(permutation)
769
+ ret.set_immutable()
770
+ return ret
771
+
772
+
773
+ class YoungRepresentation_Seminormal(YoungRepresentation_generic):
774
+ def _repr_(self):
775
+ r"""
776
+ String representation of ``self``.
777
+
778
+ EXAMPLES::
779
+
780
+ sage: SymmetricGroupRepresentation([2,1], "seminormal")
781
+ Seminormal representation of the symmetric group corresponding to [2, 1]
782
+ """
783
+ return "Seminormal representation of the symmetric group corresponding to {}".format(self._partition)
784
+
785
+ def _2x2_matrix_entries(self, beta):
786
+ r"""
787
+ Young's representations are constructed by combining
788
+ `2 \times 2`-matrices that depend on ``beta``.
789
+
790
+ For the seminormal representation, this is the following matrix::
791
+
792
+ [ -beta 1+beta ]
793
+ [ 1-beta beta ]
794
+
795
+ EXAMPLES::
796
+
797
+ sage: snorm = SymmetricGroupRepresentation([2,1], "seminormal")
798
+ sage: snorm._2x2_matrix_entries(1/2)
799
+ (-1/2, 3/2, 1/2, 1/2)
800
+ """
801
+ return (-beta, 1 + beta, 1 - beta, beta)
802
+
803
+
804
+ class YoungRepresentations_Seminormal(SymmetricGroupRepresentations_class):
805
+ _default_ring = QQ
806
+
807
+ Element = YoungRepresentation_Seminormal
808
+
809
+ def _repr_(self):
810
+ r"""
811
+ String representation of ``self``.
812
+
813
+ EXAMPLES::
814
+
815
+ sage: from sage.combinat.symmetric_group_representations import YoungRepresentations_Seminormal
816
+ sage: YoungRepresentations_Seminormal(3)
817
+ Seminormal representations of the symmetric group of order 3! over Rational Field
818
+ """
819
+ return "Seminormal representations of the symmetric group of order %s! over %s" % (self._n, self._ring)
820
+
821
+ # #### Young's Orthogonal Representation ###################################
822
+
823
+
824
+ class YoungRepresentation_Orthogonal(YoungRepresentation_generic):
825
+ def _repr_(self):
826
+ r"""
827
+ String representation of ``self``.
828
+
829
+ EXAMPLES::
830
+
831
+ sage: SymmetricGroupRepresentation([2,1], "orthogonal") # needs sage.symbolic
832
+ Orthogonal representation of the symmetric group corresponding to [2, 1]
833
+ """
834
+ return "Orthogonal representation of the symmetric group corresponding to {}".format(self._partition)
835
+
836
+ def _2x2_matrix_entries(self, beta):
837
+ r"""
838
+ Young's representations are constructed by combining
839
+ `2 \times 2`-matrices that depend on ``beta``.
840
+
841
+ For the orthogonal representation, this is the following matrix::
842
+
843
+ [ -beta sqrt(1-beta^2) ]
844
+ [ sqrt(1-beta^2) beta ]
845
+
846
+ EXAMPLES::
847
+
848
+ sage: orth = SymmetricGroupRepresentation([2,1], "orthogonal") # needs sage.symbolic
849
+ sage: orth._2x2_matrix_entries(1/2) # needs sage.symbolic
850
+ (-1/2, 1/2*sqrt(3), 1/2*sqrt(3), 1/2)
851
+ """
852
+ return (-beta, sqrt(1 - beta**2), sqrt(1 - beta**2), beta)
853
+
854
+
855
+ class YoungRepresentations_Orthogonal(SymmetricGroupRepresentations_class):
856
+ _default_ring = SR
857
+
858
+ Element = YoungRepresentation_Orthogonal
859
+
860
+ def _repr_(self):
861
+ r"""
862
+ String representation of ``self``.
863
+
864
+ EXAMPLES::
865
+
866
+ sage: from sage.combinat.symmetric_group_representations import YoungRepresentations_Orthogonal
867
+ sage: YoungRepresentations_Orthogonal(3) # needs sage.symbolic
868
+ Orthogonal representations of the symmetric group of order 3! over Symbolic Ring
869
+ """
870
+ return "Orthogonal representations of the symmetric group of order %s! over %s" % (self._n, self._ring)
871
+
872
+ # #### Specht Representation ###############################################
873
+
874
+
875
+ class SpechtRepresentation(SymmetricGroupRepresentation_generic_class):
876
+ def _repr_(self):
877
+ r"""
878
+ String representation of ``self``.
879
+
880
+ EXAMPLES::
881
+
882
+ sage: SymmetricGroupRepresentation([2,1], "specht")
883
+ Specht representation of the symmetric group corresponding to [2, 1]
884
+ """
885
+ return "Specht representation of the symmetric group corresponding to {}".format(self._partition)
886
+
887
+ _default_ring = ZZ
888
+
889
+ @lazy_attribute
890
+ def _yang_baxter_graph(self):
891
+ r"""
892
+ Construct and cache the underlying Yang-Baxter graph.
893
+
894
+ EXAMPLES::
895
+
896
+ sage: rho = SymmetricGroupRepresentation([3,2], 'specht')
897
+ sage: rho._yang_baxter_graph
898
+ Yang-Baxter graph of [3, 2], with top vertex (1, 0, 2, 1, 0)
899
+ """
900
+ return YangBaxterGraph_partition(self._partition)
901
+
902
+ @lazy_attribute
903
+ def _dual_vertices(self):
904
+ r"""
905
+ Return a list of the dual vertices of the vertices of the underlying
906
+ Yang-Baxter graph.
907
+
908
+ EXAMPLES::
909
+
910
+ sage: spc = SymmetricGroupRepresentation([3,2], 'specht')
911
+ sage: spc._dual_vertices
912
+ [(3, 3, 0, 0, 0), (3, 0, 3, 0, 0), (3, 0, 0, 3, 0), (0, 3, 3, 0, 0), (0, 3, 0, 3, 0)]
913
+ """
914
+ top = self._yang_baxter_graph.root()
915
+ exponents = tuple(i - x for i, x in enumerate(reversed(top)))[::-1]
916
+ relabelling = self._yang_baxter_graph.vertex_relabelling_dict(exponents)
917
+ return [relabelling[u] for u in self._yang_baxter_graph]
918
+
919
+ @cached_method
920
+ def scalar_product(self, u, v):
921
+ r"""
922
+ Return ``0`` if ``u+v`` is not a permutation, and the signature of the
923
+ permutation otherwise.
924
+
925
+ This is the scalar product of a vertex ``u`` of the underlying
926
+ Yang-Baxter graph with the vertex ``v`` in the 'dual' Yang-Baxter
927
+ graph.
928
+
929
+ EXAMPLES::
930
+
931
+ sage: spc = SymmetricGroupRepresentation([3,2], 'specht')
932
+ sage: spc.scalar_product((1,0,2,1,0),(0,3,0,3,0))
933
+ -1
934
+ sage: spc.scalar_product((1,0,2,1,0),(3,0,0,3,0))
935
+ 0
936
+ """
937
+ uv = [a + v[i] + 1 for i, a in enumerate(u)]
938
+ if uv not in Permutations():
939
+ return 0
940
+ else:
941
+ return Permutation(uv).signature()
942
+
943
+ def scalar_product_matrix(self, permutation=None):
944
+ r"""
945
+ Return the scalar product matrix corresponding to ``permutation``.
946
+
947
+ The entries are given by the scalar products of ``u`` and
948
+ ``permutation.action(v)``, where ``u`` is a vertex in the underlying
949
+ Yang-Baxter graph and ``v`` is a vertex in the dual graph.
950
+
951
+ EXAMPLES::
952
+
953
+ sage: spc = SymmetricGroupRepresentation([3,1], 'specht')
954
+ sage: spc.scalar_product_matrix()
955
+ [ 1 0 0]
956
+ [ 0 -1 0]
957
+ [ 0 0 1]
958
+ """
959
+ if permutation is None:
960
+ permutation = Permutation(range(1, 1 + self._n))
961
+ Q = matrix(self._ring, len(self._yang_baxter_graph))
962
+ for i, v in enumerate(self._dual_vertices):
963
+ for j, u in enumerate(self._yang_baxter_graph):
964
+ Q[i, j] = self.scalar_product(tuple(permutation.action(v)), u)
965
+ return Q
966
+
967
+ @lazy_attribute
968
+ def _scalar_product_matrix_inverse(self):
969
+ r"""
970
+ Compute and store the inverse of the scalar product matrix.
971
+
972
+ EXAMPLES::
973
+
974
+ sage: spc = SymmetricGroupRepresentation([3,1], 'specht')
975
+ sage: spc._scalar_product_matrix_inverse
976
+ [ 1 0 0]
977
+ [ 0 -1 0]
978
+ [ 0 0 1]
979
+ """
980
+ return self.scalar_product_matrix().inverse()
981
+
982
+ @cached_method
983
+ def representation_matrix(self, permutation):
984
+ r"""
985
+ Return the matrix representing the ``permutation`` in this
986
+ irreducible representation.
987
+
988
+ .. NOTE::
989
+
990
+ This method caches the results.
991
+
992
+ EXAMPLES::
993
+
994
+ sage: spc = SymmetricGroupRepresentation([3,1], 'specht')
995
+ sage: spc.representation_matrix(Permutation([2,1,3,4]))
996
+ [ 0 -1 0]
997
+ [-1 0 0]
998
+ [ 0 0 1]
999
+ sage: spc.representation_matrix(Permutation([3,2,1,4]))
1000
+ [0 0 1]
1001
+ [0 1 0]
1002
+ [1 0 0]
1003
+ """
1004
+ ret = self._representation_matrix_uncached(permutation)
1005
+ ret.set_immutable()
1006
+ return ret
1007
+
1008
+ def _representation_matrix_uncached(self, permutation):
1009
+ r"""
1010
+ Return the matrix representing the ``permutation`` in this
1011
+ irreducible representation.
1012
+
1013
+ EXAMPLES::
1014
+
1015
+ sage: spc = SymmetricGroupRepresentation([3,1], 'specht')
1016
+ sage: spc._representation_matrix_uncached(Permutation([2,1,3,4]))
1017
+ [ 0 -1 0]
1018
+ [-1 0 0]
1019
+ [ 0 0 1]
1020
+ sage: spc._representation_matrix_uncached(Permutation([3,2,1,4]))
1021
+ [0 0 1]
1022
+ [0 1 0]
1023
+ [1 0 0]
1024
+ """
1025
+ R = self.scalar_product_matrix(permutation)
1026
+ return self._scalar_product_matrix_inverse * R
1027
+
1028
+
1029
+ class SpechtRepresentations(SymmetricGroupRepresentations_class):
1030
+ _default_ring = ZZ
1031
+
1032
+ Element = SpechtRepresentation
1033
+
1034
+ def _repr_(self):
1035
+ r"""
1036
+ String representation of ``self``.
1037
+
1038
+ EXAMPLES::
1039
+
1040
+ sage: spc = SymmetricGroupRepresentations(4)
1041
+ sage: spc
1042
+ Specht representations of the symmetric group of order 4! over Integer Ring
1043
+ """
1044
+ return "Specht representations of the symmetric group of order %s! over %s" % (self._n, self._ring)
1045
+
1046
+ # #### Unitary Representation ###############################################
1047
+
1048
+
1049
+ class UnitaryRepresentation(SymmetricGroupRepresentation_generic_class):
1050
+ r"""
1051
+ A unitary representation of the symmetric group.
1052
+
1053
+ In characteristic zero, this is the same as the orthogonal representation since
1054
+ they are defined over the reals. In positive characteristic, we are able to construct
1055
+ representations when the field is finite, has square order, and the characteristic does not divide
1056
+ the order of the group. In this case, we construct the representation by first
1057
+ constructing the orthogonal representation `\rho` and then taking the extended
1058
+ Cholesky decomposition of the unique solution `U` to the equation
1059
+ `\rho(g)^T U \rho(g) = U` for all `g` in `G`.
1060
+ """
1061
+ def __init__(self, parent, partition):
1062
+ r"""
1063
+ Initialize ``self``.
1064
+
1065
+ EXAMPLES::
1066
+
1067
+ sage: # needs sage.symbolic
1068
+ sage: U = SymmetricGroupRepresentation([2,1], "unitary")
1069
+ sage: TestSuite(U).run()
1070
+
1071
+ sage: U = SymmetricGroupRepresentation([2,1], "unitary", GF(7))
1072
+ Traceback (most recent call last):
1073
+ ...
1074
+ ValueError: the base ring must be a finite field of square order
1075
+
1076
+ sage: # needs sage.rings.finite_rings
1077
+ sage: U = SymmetricGroupRepresentation([2,1], "unitary", GF(7**2))
1078
+ sage: TestSuite(U).run()
1079
+ """
1080
+ if parent._ring.characteristic() == 0:
1081
+ orth = SymmetricGroupRepresentation(partition, 'orthogonal')
1082
+ self.representation_matrix = orth.representation_matrix
1083
+ self._representation_matrix_uncached = orth._representation_matrix_uncached
1084
+ else:
1085
+ if not (parent._ring.is_field()
1086
+ and parent._ring.is_finite()
1087
+ and parent._ring.order().is_square()):
1088
+ raise ValueError("the base ring must be a finite field of square order")
1089
+ from sage.arith.misc import factorial
1090
+ if parent._ring.characteristic().divides(factorial(parent._n)):
1091
+ raise NotImplementedError("not implemented when p|n!; dimension of invariant forms may be greater than one")
1092
+ self._q = parent._ring.order().sqrt()
1093
+ self._specht = Permutations(sum(partition)).algebra(parent._ring).specht_module(partition)
1094
+ super().__init__(parent, partition)
1095
+
1096
+ def _repr_(self):
1097
+ r"""
1098
+ String representation of ``self``.
1099
+
1100
+ EXAMPLES::
1101
+
1102
+ sage: SymmetricGroupRepresentation([2,1], "unitary") # needs sage.symbolic
1103
+ Unitary representation of the symmetric group corresponding to [2, 1]
1104
+ """
1105
+ return f"Unitary representation of the symmetric group corresponding to {self._partition}"
1106
+
1107
+ @cached_method
1108
+ def representation_matrix(self, permutation):
1109
+ r"""
1110
+ Return the matrix representing the ``permutation`` in this
1111
+ irreducible representation.
1112
+
1113
+ .. NOTE::
1114
+
1115
+ This method caches the results.
1116
+
1117
+ EXAMPLES::
1118
+
1119
+ sage: # needs sage.rings.finite_rings
1120
+ sage: unitary_specht = SymmetricGroupRepresentation([3,1], 'unitary', ring=GF(7**2))
1121
+ sage: unitary_specht.representation_matrix(Permutation([2,1,3,4]))
1122
+ [6 0 0]
1123
+ [0 1 0]
1124
+ [0 0 1]
1125
+ sage: unitary_specht.representation_matrix(Permutation([3,2,1,4]))
1126
+ [ 4 2*z2 + 3 0]
1127
+ [5*z2 + 5 3 0]
1128
+ [ 0 0 1]
1129
+ sage: all(A * A.H == 1 for A in [unitary_specht.representation_matrix(g)
1130
+ ....: for g in Permutations(4)])
1131
+ True
1132
+ """
1133
+ ret = self._representation_matrix_uncached(permutation)
1134
+ ret.set_immutable()
1135
+ return ret
1136
+
1137
+ @lazy_attribute
1138
+ def _unitary_change_basis_matrix(self):
1139
+ """
1140
+ Compute the change of basis matrix.
1141
+
1142
+ We first compute a `G`-invariant symmetric bilinear form. This yields a solution `U`
1143
+ to the equation `\rho(g)^T U \rho(g) = U` for all `g` in `G`. We can
1144
+ solve this equation by computing the null space of the matrix of coefficients of the linear
1145
+ equations. Generically, this null space will be one dimensional (it may have higher dimension
1146
+ in the modular case when the decomposition factors have multiplicity). We then take the
1147
+ extended Cholesky decomposition of the unique solution to the equation.
1148
+
1149
+ EXAMPLES::
1150
+
1151
+ sage: # needs sage.rings.finite_rings
1152
+ sage: unitary_specht = SymmetricGroupRepresentation([3,1], 'unitary', ring=GF(7**2))
1153
+ sage: unitary_specht._unitary_change_basis_matrix
1154
+ [ 1 4 4]
1155
+ [ 0 2*z2 + 2 3*z2 + 3]
1156
+ [ 0 0 6*z2 + 1]
1157
+ sage: unitary_specht = SymmetricGroupRepresentation([2,2], 'unitary', ring=GF(7**2))
1158
+ sage: unitary_specht._unitary_change_basis_matrix
1159
+ [ 1 4]
1160
+ [ 0 2*z2 + 2]
1161
+ """
1162
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
1163
+ G = Permutations(self._n)
1164
+ F = self._ring
1165
+ rho = self._specht.representation_matrix
1166
+
1167
+ # compute the invariant symmetric bilinear matrix
1168
+ d_rho = self._specht.dimension()
1169
+ R = PolynomialRing(F, 'u', d_rho**2)
1170
+ U_vars = R.gens()
1171
+ Utemp = matrix(R, d_rho, d_rho, U_vars)
1172
+
1173
+ def augmented_matrix(g):
1174
+ rho_g = rho(g)
1175
+ equation_matrix = rho_g.transpose() * Utemp * rho_g.conjugate() - Utemp
1176
+ augmented_system = []
1177
+ for i in range(d_rho):
1178
+ for j in range(d_rho):
1179
+ linear_expression = equation_matrix[i, j]
1180
+ row = [linear_expression.coefficient(u) for u in U_vars]
1181
+ augmented_system.append(row)
1182
+ return augmented_system
1183
+
1184
+ total_system = sum((augmented_matrix(g) for g in G), [])
1185
+ null_space = matrix(F, total_system).right_kernel()
1186
+ U = matrix(F, d_rho, d_rho, null_space.basis()[0])
1187
+ return U.cholesky(extended=True).H
1188
+
1189
+ def _representation_matrix_uncached(self, permutation):
1190
+ r"""
1191
+ Return the matrix representing the ``permutation`` in this
1192
+ irreducible representation.
1193
+
1194
+ We use the unitary change of basis matrix to conjugate
1195
+ the representation matrix. These are unitary since
1196
+
1197
+ .. MATH::
1198
+
1199
+ (A rho(g) A^{-1})^* \cdot (A rho(g) A^{-1})
1200
+ = (A^{-1})^* rho(g)^* A^* A rho(g) A^{-1}
1201
+ = (A^{-1})^*H rho(g)^T U rho(g) A^{-1}
1202
+ = (A^{-1})^* U A^{-1} = 1.
1203
+
1204
+ .. NOTE::
1205
+
1206
+ This method caches the results.
1207
+
1208
+ EXAMPLES::
1209
+
1210
+ sage: # needs sage.rings.finite_rings
1211
+ sage: unitary_specht = SymmetricGroupRepresentation([2,2], 'unitary', ring=GF(7**2))
1212
+ sage: unitary_specht._representation_matrix_uncached(Permutation([3,1,4,2]))
1213
+ [ 4 5*z2 + 4]
1214
+ [2*z2 + 2 3]
1215
+ sage: unitary_specht._representation_matrix_uncached(Permutation([1,2,4,3]))
1216
+ [6 0]
1217
+ [0 1]
1218
+ sage: all(A * A.H == 1 for A in [unitary_specht._representation_matrix_uncached(g)
1219
+ ....: for g in Permutations(4)])
1220
+ True
1221
+ """
1222
+ assert self._ring.characteristic() > 0
1223
+ rho = self._specht.representation_matrix
1224
+ A = self._unitary_change_basis_matrix
1225
+ return A * rho(permutation) * A.inverse()
1226
+
1227
+
1228
+ class UnitaryRepresentations(SymmetricGroupRepresentations_class):
1229
+ _default_ring = SR
1230
+
1231
+ Element = UnitaryRepresentation
1232
+
1233
+ def _repr_(self):
1234
+ r"""
1235
+ String representation of ``self``.
1236
+
1237
+ EXAMPLES::
1238
+
1239
+ sage: spc = SymmetricGroupRepresentations(4)
1240
+ sage: spc
1241
+ Specht representations of the symmetric group of order 4! over Integer Ring
1242
+ """
1243
+ return "Unitary representations of the symmetric group of order %s! over %s" % (self._n, self._ring)
1244
+
1245
+ # ##### Miscellaneous functions ############################################
1246
+
1247
+
1248
+ def partition_to_vector_of_contents(partition, reverse=False):
1249
+ r"""
1250
+ Return the "vector of contents" associated to ``partition``.
1251
+
1252
+ EXAMPLES::
1253
+
1254
+ sage: from sage.combinat.symmetric_group_representations import partition_to_vector_of_contents
1255
+ sage: partition_to_vector_of_contents([3,2])
1256
+ (0, 1, 2, -1, 0)
1257
+ """
1258
+ v = []
1259
+ for i, p in enumerate(partition):
1260
+ v.extend(range(-i, -i + p))
1261
+ if reverse:
1262
+ return tuple(v)[::-1]
1263
+ return tuple(v)
1264
+
1265
+
1266
+ # #### Garsia-Procesi modules ################################################
1267
+
1268
+ from sage.rings.quotient_ring import QuotientRing_generic
1269
+ from sage.combinat.specht_module import SymmetricGroupRepresentation as SymmetricGroupRepresentation_mixin
1270
+
1271
+
1272
+ class GarsiaProcesiModule(UniqueRepresentation, QuotientRing_generic, SymmetricGroupRepresentation_mixin):
1273
+ r"""
1274
+ A Garsia-Procesi module.
1275
+
1276
+ Let `\lambda` be a partition of `n` and `R` be a commutative
1277
+ ring. The *Garsia-Procesi module* is defined by `R_{\lambda}
1278
+ := R[x_1, \ldots, x_n] / I_{\lambda}`, where
1279
+
1280
+ .. MATH::
1281
+
1282
+ I_{\lambda} := \langle e_r(x_{i_1}, \ldots, x_{i_k}) \mid
1283
+ \{i_1, \ldots, i_k\} \subseteq [n] \text{ and }
1284
+ k \geq r > k - d_k(\lambda) \rangle,
1285
+
1286
+ with `e_r` being the `r`-the elementary symmetric function and
1287
+ `d_k(\lambda) = \lambda'_n + \cdots + \lambda'_{n+1-k}`, is the
1288
+ *Tanisaki ideal*.
1289
+
1290
+ If we consider `R = \QQ`, then the Garsia-Procesi module has the
1291
+ following interpretation. Let `\mathcal{F}_n = GL_n / B` denote
1292
+ the (complex type A) flag variety. Consider the Springer fiber
1293
+ `F_{\lambda} \subseteq \mathcal{F}_n` associated to a nilpotent
1294
+ matrix with Jordan blocks sizes `\lambda`. Springer showed that
1295
+ the cohomology ring `H^*(F_{\lambda})` admits a graded `S_n`-action
1296
+ that agrees with the induced representation of the sign representation
1297
+ of the Young subgroup `S_{\lambda}`. From work of De Concini
1298
+ and Procesi, this `S_n`-representation is isomorphic to `R_{\lambda}`.
1299
+ Moreover, the graded Frobenius image is known to be a modified
1300
+ Hall-Littlewood polynomial.
1301
+
1302
+ EXAMPLES::
1303
+
1304
+ sage: SGA = SymmetricGroupAlgebra(QQ, 7)
1305
+ sage: GP421 = SGA.garsia_procesi_module([4, 2, 1])
1306
+ sage: GP421.dimension()
1307
+ 105
1308
+ sage: v = GP421.an_element(); v
1309
+ -gp1 - gp2 - gp3 - gp4 - gp5 - gp6
1310
+ sage: SGA.an_element() * v
1311
+ -6*gp1 - 6*gp2 - 6*gp3 - 6*gp4 - 6*gp5 - 5*gp6
1312
+
1313
+ We verify the result is a modified Hall-Littlewood polynomial by using
1314
+ the `Q'` Hall-Littlewood polynomials, replacing `q \mapsto q^{-1}` and
1315
+ multiplying by the smallest power of `q` so the coefficients are again
1316
+ polynomials::
1317
+
1318
+ sage: GP421.graded_frobenius_image()
1319
+ q^4*s[4, 2, 1] + q^3*s[4, 3] + q^3*s[5, 1, 1] + (q^3+q^2)*s[5, 2]
1320
+ + (q^2+q)*s[6, 1] + s[7]
1321
+ sage: R.<q> = QQ[]
1322
+ sage: Sym = SymmetricFunctions(R)
1323
+ sage: s = Sym.s()
1324
+ sage: Qp = Sym.hall_littlewood(q).Qp()
1325
+ sage: mHL = s(Qp[4,2,1]); mHL
1326
+ s[4, 2, 1] + q*s[4, 3] + q*s[5, 1, 1] + (q^2+q)*s[5, 2]
1327
+ + (q^3+q^2)*s[6, 1] + q^4*s[7]
1328
+ sage: mHL.map_coefficients(lambda c: R(q^4*c(q^-1)))
1329
+ q^4*s[4, 2, 1] + q^3*s[4, 3] + q^3*s[5, 1, 1] + (q^3+q^2)*s[5, 2]
1330
+ + (q^2+q)*s[6, 1] + s[7]
1331
+
1332
+ We show that the maximal degree component corresponds to the Yamanouchi
1333
+ words of content `\lambda`::
1334
+
1335
+ sage: B = GP421.graded_decomposition(4).basis()
1336
+ sage: top_deg = [Word([i+1 for i in b.lift().lift().exponents()[0]]) for b in B]
1337
+ sage: yamanouchi = [P.to_packed_word() for P in OrderedSetPartitions(range(7), [4, 2, 1])
1338
+ ....: if P.to_packed_word().reversal().is_yamanouchi()]
1339
+ sage: set(top_deg) == set(yamanouchi)
1340
+ True
1341
+ """
1342
+ @staticmethod
1343
+ def __classcall_private__(cls, SGA, shape):
1344
+ """
1345
+ Normalize input to ensure a unique representation.
1346
+
1347
+ EXAMPLES::
1348
+
1349
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
1350
+ sage: from sage.combinat.symmetric_group_representations import GarsiaProcesiModule
1351
+ sage: GP1 = GarsiaProcesiModule(SGA, [2, 2, 1])
1352
+ sage: GP2 = GarsiaProcesiModule(SGA, Partitions(5)([2, 2, 1]))
1353
+ sage: GP1 is GP2
1354
+ True
1355
+ sage: GarsiaProcesiModule(SGA, [3])
1356
+ Traceback (most recent call last):
1357
+ ...
1358
+ ValueError: [3] is not a partition of 5
1359
+ """
1360
+ shape = Partition(shape)
1361
+ if sum(shape) != SGA.n:
1362
+ raise ValueError(f"{shape} is not a partition of {SGA.n}")
1363
+ return super().__classcall__(cls, SGA, shape)
1364
+
1365
+ def __init__(self, SGA, shape):
1366
+ r"""
1367
+ Initialize ``self``.
1368
+
1369
+ EXAMPLES::
1370
+
1371
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1372
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1373
+ sage: TestSuite(GP).run()
1374
+
1375
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
1376
+ sage: GP = SGA.garsia_procesi_module([3, 1, 1])
1377
+ sage: TestSuite(GP).run()
1378
+ """
1379
+ self._shape = shape
1380
+ SymmetricGroupRepresentation_mixin.__init__(self, SGA)
1381
+
1382
+ # Construct the Tanisaki ideal
1383
+ from sage.combinat.sf.sf import SymmetricFunctions
1384
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
1385
+ from itertools import combinations
1386
+ n = SGA.n
1387
+
1388
+ conj = list(shape.conjugate())
1389
+ conj += [0]*(n - len(conj))
1390
+
1391
+ def p(k):
1392
+ return sum(conj[i] for i in range(n-k, n))
1393
+
1394
+ BR = SGA.base_ring()
1395
+ R = PolynomialRing(BR, 'x', n)
1396
+ gens = R.gens()
1397
+ e = SymmetricFunctions(BR).e()
1398
+ I = R.ideal([e[d].expand(k)(*S)
1399
+ for k in range(n+1) for d in range(k-p(k)+1, k+1)
1400
+ for S in combinations(gens, k)])
1401
+
1402
+ # Finalize the initialization
1403
+ names = tuple([f"gp{i}" for i in range(n)])
1404
+ from sage.categories.commutative_rings import CommutativeRings
1405
+ from sage.categories.algebras import Algebras
1406
+ cat = CommutativeRings().Quotients() & Algebras(SGA.base_ring()).Graded().WithBasis().FiniteDimensional()
1407
+ QuotientRing_generic.__init__(self, R, I, names=names, category=cat)
1408
+
1409
+ def _repr_(self):
1410
+ r"""
1411
+ Return a string representation of ``self``.
1412
+
1413
+ EXAMPLES::
1414
+
1415
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1416
+ sage: SGA.garsia_procesi_module([2, 2])
1417
+ Garsia-Procesi module of shape [2, 2] over Rational Field
1418
+ """
1419
+ return "Garsia-Procesi module of shape {} over {}".format(self._shape, self.base_ring())
1420
+
1421
+ def _latex_(self):
1422
+ r"""
1423
+ Return a latex representation of ``self``.
1424
+
1425
+ EXAMPLES::
1426
+
1427
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1428
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1429
+ sage: latex(GP)
1430
+ R_{{\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
1431
+ \raisebox{-.6ex}{$\begin{array}[b]{*{2}c}\cline{1-2}
1432
+ \lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-2}
1433
+ \lr{\phantom{x}}&\lr{\phantom{x}}\\\cline{1-2}
1434
+ \end{array}$}
1435
+ }}^{\Bold{Q}}
1436
+ """
1437
+ from sage.misc.latex import latex
1438
+ return "R_{{{}}}^{{{}}}".format(latex(self._shape), latex(self.base_ring()))
1439
+
1440
+ def _coerce_map_from_base_ring(self):
1441
+ r"""
1442
+ Disable the coercion from the base ring from the category.
1443
+
1444
+ TESTS::
1445
+
1446
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1447
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1448
+ sage: GP._coerce_map_from_base_ring() is None
1449
+ True
1450
+ """
1451
+ return None # don't need anything special
1452
+
1453
+ @cached_method
1454
+ def get_order(self):
1455
+ """
1456
+ Return the order of the elements in the basis.
1457
+
1458
+ EXAMPLES::
1459
+
1460
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1461
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1462
+ sage: GP.get_order()
1463
+ (0, 1, 2, 3, 4, 5)
1464
+ """
1465
+ return tuple(self.basis().keys())
1466
+
1467
+ @cached_method
1468
+ def basis(self):
1469
+ r"""
1470
+ Return a basis of ``self``.
1471
+
1472
+ EXAMPLES::
1473
+
1474
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1475
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1476
+ sage: GP.basis()
1477
+ Family (gp2*gp3, gp1*gp3, gp3, gp2, gp1, 1)
1478
+ """
1479
+ from sage.sets.family import Family
1480
+ B = self.defining_ideal().normal_basis()
1481
+ return Family([self.retract(b) for b in B])
1482
+
1483
+ @cached_method
1484
+ def one_basis(self):
1485
+ r"""
1486
+ Return the index of the basis element `1`.
1487
+
1488
+ EXAMPLES::
1489
+
1490
+ sage: SGA = SymmetricGroupAlgebra(QQ, 4)
1491
+ sage: GP = SGA.garsia_procesi_module([2, 2])
1492
+ sage: GP.one_basis()
1493
+ 5
1494
+ """
1495
+ B = self.defining_ideal().normal_basis()
1496
+ for i, b in enumerate(B):
1497
+ if b.is_one():
1498
+ return ZZ(i)
1499
+
1500
+ @cached_method
1501
+ def dimension(self):
1502
+ r"""
1503
+ Return the dimension of ``self``.
1504
+
1505
+ The graded Frobenius character of the Garsia-Procesi module
1506
+ `R_{\lambda}` is given by the modified Hall-Littlewood polynomial
1507
+ `\widetilde{H}_{\lambda'}(x; q)`.
1508
+
1509
+ EXAMPLES::
1510
+
1511
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
1512
+ sage: Sym = SymmetricFunctions(QQ)
1513
+ sage: s = Sym.s()
1514
+ sage: Qp = Sym.hall_littlewood(1).Qp()
1515
+ sage: for la in Partitions(5):
1516
+ ....: print(SGA.garsia_procesi_module(la).dimension(),
1517
+ ....: sum(c * StandardTableaux(la).cardinality()
1518
+ ....: for la, c in s(Qp[la])))
1519
+ 1 1
1520
+ 5 5
1521
+ 10 10
1522
+ 20 20
1523
+ 30 30
1524
+ 60 60
1525
+ 120 120
1526
+ """
1527
+ return self.defining_ideal().vector_space_dimension()
1528
+
1529
+ @cached_method
1530
+ def graded_frobenius_image(self):
1531
+ r"""
1532
+ Return the graded Frobenius image of ``self``.
1533
+
1534
+ The graded Frobenius image is the sum of the :meth:`frobenius_image`
1535
+ of each graded component, which is known to result in the modified
1536
+ Hall-Littlewood polynomial `\widetilde{H}_{\lambda}(x; q)`.
1537
+
1538
+ EXAMPLES:
1539
+
1540
+ We verify that the result is the modified Hall-Littlewood polynomial
1541
+ for `n = 5`::
1542
+
1543
+ sage: R.<q> = QQ[]
1544
+ sage: Sym = SymmetricFunctions(R)
1545
+ sage: s = Sym.s()
1546
+ sage: Qp = Sym.hall_littlewood(q).Qp()
1547
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
1548
+ sage: for la in Partitions(5):
1549
+ ....: f = SGA.garsia_procesi_module(la).graded_frobenius_image()
1550
+ ....: d = f[la].degree()
1551
+ ....: assert f.map_coefficients(lambda c: R(c(~q)*q^d)) == s(Qp[la])
1552
+ """
1553
+ from sage.combinat.sf.sf import SymmetricFunctions
1554
+ R = QQ['q']
1555
+ q = R.gen()
1556
+ Sym = SymmetricFunctions(R)
1557
+ p = Sym.p()
1558
+ s = Sym.s()
1559
+ G = self._semigroup
1560
+ CCR = [(elt, elt.cycle_type()) for elt in G.conjugacy_classes_representatives()]
1561
+ B = self.basis()
1562
+ return s(p._from_dict({la: coeff / la.centralizer_size() for elt, la in CCR
1563
+ if (coeff := sum(q**b.degree() * (elt * b).lift().monomial_coefficient(b.lift())
1564
+ for b in B))},
1565
+ remove_zeros=False))
1566
+
1567
+ @cached_method
1568
+ def graded_character(self):
1569
+ r"""
1570
+ Return the graded character of ``self``.
1571
+
1572
+ EXAMPLES::
1573
+
1574
+ sage: SGA = SymmetricGroupAlgebra(QQ, 5)
1575
+ sage: GP = SGA.garsia_procesi_module([2, 2, 1])
1576
+ sage: gchi = GP.graded_character(); gchi
1577
+ (5*q^4 + 11*q^3 + 9*q^2 + 4*q + 1, -q^4 + q^3 + 3*q^2 + 2*q + 1,
1578
+ q^4 - q^3 + q^2 + 1, -q^4 - q^3 + q + 1, -q^4 + q^3 - q + 1,
1579
+ q^4 - q^3 - q^2 + 1, q^3 - q^2 - q + 1)
1580
+ sage: R.<q> = QQ[]
1581
+ sage: gchi == sum(q^d * D.character()
1582
+ ....: for d, D in GP.graded_decomposition().items())
1583
+ True
1584
+ """
1585
+ q = QQ['q'].gen()
1586
+ G = self._semigroup
1587
+ B = self.basis()
1588
+ from sage.modules.free_module_element import vector
1589
+ return vector([sum(q**b.degree() * (g * b).lift().monomial_coefficient(b.lift()) for b in B)
1590
+ for g in G.conjugacy_classes_representatives()],
1591
+ immutable=True)
1592
+
1593
+ @lazy_attribute
1594
+ def _graded_decomposition(self):
1595
+ """
1596
+ Construct the (internal) dictionary that encodes the graded
1597
+ decomposition of ``self``.
1598
+
1599
+ EXAMPLES::
1600
+
1601
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
1602
+ sage: GP32 = SGA.garsia_procesi_module([3, 2])
1603
+ sage: GP32._graded_decomposition
1604
+ {0: Subrepresentation with basis {0} of Garsia-Procesi ...,
1605
+ 1: Subrepresentation with basis {0, 1, 2, 3} of Garsia-Procesi ...,
1606
+ 2: Subrepresentation with basis {0, 1, 2, 3, 4} of Garsia-Procesi ...}
1607
+ """
1608
+ d = {}
1609
+ for b in self.basis():
1610
+ deg = b.degree()
1611
+ if deg not in d:
1612
+ d[deg] = [b]
1613
+ else:
1614
+ d[deg].append(b)
1615
+ return {deg: self.subrepresentation(gens, is_closed=True)
1616
+ for deg, gens in sorted(d.items())}
1617
+
1618
+ def graded_decomposition(self, k=None):
1619
+ r"""
1620
+ Return the decomposition of ``self`` as a direct sum of
1621
+ representations given by a fixed grading.
1622
+
1623
+ INPUT:
1624
+
1625
+ - ``k`` -- (optional) integer; if given, return the `k`-th graded part
1626
+
1627
+ EXAMPLES::
1628
+
1629
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
1630
+ sage: GP32 = SGA.garsia_procesi_module([3, 2])
1631
+ sage: decomp = GP32.graded_decomposition(); decomp
1632
+ {0: Subrepresentation with basis {0} of Garsia-Procesi ...,
1633
+ 1: Subrepresentation with basis {0, 1, 2, 3} of Garsia-Procesi ...,
1634
+ 2: Subrepresentation with basis {0, 1, 2, 3, 4} of Garsia-Procesi ...}
1635
+ sage: decomp[2] is GP32.graded_decomposition(2)
1636
+ True
1637
+ sage: GP32.graded_decomposition(10)
1638
+ Subrepresentation with basis {} of Garsia-Procesi module
1639
+ of shape [3, 2] over Finite Field of size 2
1640
+ """
1641
+ if k is None:
1642
+ # make a copy since mutable
1643
+ return dict(self._graded_decomposition)
1644
+ if k < 0 or k not in self._graded_decomposition:
1645
+ return self.subrepresentation([], is_closed=True)
1646
+ return self._graded_decomposition[k]
1647
+
1648
+ def graded_representation_matrix(self, elt, q=None):
1649
+ r"""
1650
+ Return the matrix corresponding to the left action of the symmetric
1651
+ group (algebra) element ``elt`` on ``self``.
1652
+
1653
+ EXAMPLES::
1654
+
1655
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 3)
1656
+ sage: GP = SGA.garsia_procesi_module([1, 1, 1])
1657
+ sage: elt = SGA.an_element(); elt
1658
+ [1, 2, 3] + 2*[1, 3, 2] + [3, 1, 2]
1659
+ sage: X = GP.graded_representation_matrix(elt); X
1660
+ [ 0 0 0 0 0 0]
1661
+ [ 0 q^2 0 0 0 0]
1662
+ [ 0 q^2 0 0 0 0]
1663
+ [ 0 0 0 q 0 0]
1664
+ [ 0 0 0 q 0 0]
1665
+ [ 0 0 0 0 0 1]
1666
+ sage: X.parent()
1667
+ Full MatrixSpace of 6 by 6 dense matrices over
1668
+ Univariate Polynomial Ring in q over Finite Field of size 3
1669
+ sage: R.<q> = GF(3)[]
1670
+ sage: t = R.quotient([q^2+2*q+1]).gen()
1671
+ sage: GP.graded_representation_matrix(elt, t)
1672
+ [ 0 0 0 0 0 0]
1673
+ [ 0 qbar + 2 0 0 0 0]
1674
+ [ 0 qbar + 2 0 0 0 0]
1675
+ [ 0 0 0 qbar 0 0]
1676
+ [ 0 0 0 qbar 0 0]
1677
+ [ 0 0 0 0 0 1]
1678
+ """
1679
+ if q is None:
1680
+ q = self.base_ring()['q'].gen()
1681
+ R = q.parent()
1682
+ return matrix(R, [q**b.degree() * (elt * b).to_vector().change_ring(R)
1683
+ for b in self.basis()])
1684
+
1685
+ def graded_brauer_character(self):
1686
+ r"""
1687
+ Return the graded Brauer character of ``self``.
1688
+
1689
+ EXAMPLES::
1690
+
1691
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 5)
1692
+ sage: GP311 = SGA.garsia_procesi_module([3, 1, 1])
1693
+ sage: GP311.graded_brauer_character()
1694
+ (6*q^3 + 9*q^2 + 4*q + 1, q + 1, q^3 - q^2 - q + 1)
1695
+ """
1696
+ q = QQ['q'].gen()
1697
+ return sum(q**d * SM.brauer_character() for d, SM in self._graded_decomposition.items())
1698
+
1699
+ class Element(QuotientRing_generic.Element):
1700
+ def _acted_upon_(self, scalar, self_on_left=True):
1701
+ r"""
1702
+ Return the action of ``scalar`` on ``self``.
1703
+
1704
+ EXAMPLES::
1705
+
1706
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 4)
1707
+ sage: GP22 = SGA.garsia_procesi_module([2, 2])
1708
+ sage: x = SGA.an_element(); x
1709
+ [1, 2, 3, 4] + 2*[1, 2, 4, 3] + [4, 1, 2, 3]
1710
+ sage: v = GP22.an_element(); v
1711
+ -gp1 - gp2 - gp3
1712
+ sage: g = SGA.group().an_element(); g
1713
+ [4, 1, 2, 3]
1714
+ sage: g * v # indirect doctest
1715
+ gp3
1716
+ sage: x * v # indirect doctest
1717
+ gp3
1718
+ sage: 2 * v # indirect doctest
1719
+ gp1 + gp2 + gp3
1720
+ """
1721
+ P = self.parent()
1722
+ if scalar in P.base_ring():
1723
+ return super()._acted_upon_(scalar, self_on_left)
1724
+ if scalar in P._semigroup:
1725
+ gens = P.ambient().gens()
1726
+ return P.retract(self.lift().subs({g: gens[scalar(i+1)-1] for i, g in enumerate(gens)}))
1727
+ if not self_on_left and scalar in P._semigroup_algebra:
1728
+ scalar = P._semigroup_algebra(scalar)
1729
+ gens = P.ambient().gens()
1730
+ return P.sum(c * P.retract(self.lift().subs({g: gens[sigma(i+1)-1] for i, g in enumerate(gens)}))
1731
+ for sigma, c in scalar.monomial_coefficients(copy=False).items())
1732
+ return super()._acted_upon_(scalar, self_on_left)
1733
+
1734
+ def to_vector(self, order=None):
1735
+ r"""
1736
+ Return ``self`` as a (dense) free module vector.
1737
+
1738
+ EXAMPLES::
1739
+
1740
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 4)
1741
+ sage: GP22 = SGA.garsia_procesi_module([2, 2])
1742
+ sage: v = GP22.an_element(); v
1743
+ -gp1 - gp2 - gp3
1744
+ sage: v.to_vector()
1745
+ (0, 0, 2, 2, 2, 0)
1746
+ """
1747
+ P = self.parent()
1748
+ B = P.basis()
1749
+ FM = P._dense_free_module()
1750
+ f = self.lift()
1751
+ return FM([f.monomial_coefficient(b.lift()) for b in B])
1752
+
1753
+ _vector_ = to_vector
1754
+
1755
+ def monomial_coefficients(self, copy=None):
1756
+ r"""
1757
+ Return the monomial coefficients of ``self``.
1758
+
1759
+ EXAMPLES::
1760
+
1761
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 4)
1762
+ sage: GP31 = SGA.garsia_procesi_module([3, 1])
1763
+ sage: v = GP31.an_element(); v
1764
+ -gp1 - gp2 - gp3
1765
+ sage: v.monomial_coefficients()
1766
+ {0: 2, 1: 2, 2: 2, 3: 0}
1767
+ """
1768
+ B = self.parent().basis()
1769
+ f = self.lift()
1770
+ return {i: f.monomial_coefficient(b.lift()) for i, b in enumerate(B)}
1771
+
1772
+ def degree(self):
1773
+ r"""
1774
+ Return the degree of ``self``.
1775
+
1776
+ EXAMPLES::
1777
+
1778
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 4)
1779
+ sage: GP22 = SGA.garsia_procesi_module([2, 2])
1780
+ sage: for b in GP22.basis():
1781
+ ....: print(b, b.degree())
1782
+ gp2*gp3 2
1783
+ gp1*gp3 2
1784
+ gp3 1
1785
+ gp2 1
1786
+ gp1 1
1787
+ 1 0
1788
+ sage: v = sum(GP22.basis())
1789
+ sage: v.degree()
1790
+ 2
1791
+ """
1792
+ return self.lift().degree()
1793
+
1794
+ def homogeneous_degree(self):
1795
+ r"""
1796
+ Return the (homogeneous) degree of ``self`` if homogeneous
1797
+ otherwise raise an error.
1798
+
1799
+ EXAMPLES::
1800
+
1801
+ sage: SGA = SymmetricGroupAlgebra(GF(2), 4)
1802
+ sage: GP31 = SGA.garsia_procesi_module([3, 1])
1803
+ sage: for b in GP31.basis():
1804
+ ....: print(b, b.homogeneous_degree())
1805
+ gp3 1
1806
+ gp2 1
1807
+ gp1 1
1808
+ 1 0
1809
+ sage: v = sum(GP31.basis()); v
1810
+ gp1 + gp2 + gp3 + 1
1811
+ sage: v.homogeneous_degree()
1812
+ Traceback (most recent call last):
1813
+ ...
1814
+ ValueError: element is not homogeneous
1815
+
1816
+ TESTS::
1817
+
1818
+ sage: SGA = SymmetricGroupAlgebra(GF(3), 4)
1819
+ sage: GP4 = SGA.garsia_procesi_module([4])
1820
+ sage: GP4.zero().homogeneous_degree()
1821
+ Traceback (most recent call last):
1822
+ ...
1823
+ ValueError: the zero element does not have a well-defined degree
1824
+ """
1825
+ if not self:
1826
+ raise ValueError("the zero element does not have a well-defined degree")
1827
+ f = self.lift()
1828
+ if not f.is_homogeneous():
1829
+ raise ValueError("element is not homogeneous")
1830
+ return f.degree()