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,2219 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ # sage.doctest: needs sage.combinat sage.modules
3
+ r"""
4
+ Fock Space
5
+
6
+ AUTHORS:
7
+
8
+ - Travis Scrimshaw (2013-05-03): Initial version
9
+ """
10
+
11
+ # ****************************************************************************
12
+ # Copyright (C) 2013-2017 Travis Scrimshaw <tcscrims at gmail.com>
13
+ #
14
+ # This program is free software: you can redistribute it and/or modify
15
+ # it under the terms of the GNU General Public License as published by
16
+ # the Free Software Foundation, either version 2 of the License, or
17
+ # (at your option) any later version.
18
+ # https://www.gnu.org/licenses/
19
+ # ****************************************************************************
20
+
21
+ from sage.misc.cachefunc import cached_method
22
+ from sage.misc.bindable_class import BindableClass
23
+ from sage.structure.parent import Parent
24
+ from sage.structure.unique_representation import UniqueRepresentation
25
+ from sage.structure.global_options import GlobalOptions
26
+ from sage.categories.modules_with_basis import ModulesWithBasis
27
+ from sage.categories.realizations import Realizations, Category_realization_of_parent
28
+
29
+ from sage.rings.integer_ring import ZZ
30
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
31
+ from sage.rings.fraction_field import FractionField
32
+ from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
33
+ from sage.combinat.free_module import CombinatorialFreeModule
34
+ from sage.combinat.partition import (_Partitions, Partitions,
35
+ RegularPartitions_truncated)
36
+ from sage.combinat.partition_tuple import PartitionTuples
37
+ from sage.algebras.quantum_groups.q_numbers import q_factorial
38
+
39
+
40
+ #############################
41
+ # Fock space options
42
+
43
+ class FockSpaceOptions(GlobalOptions):
44
+ r"""
45
+ Set and display the global options for elements of the Fock
46
+ space classes. If no parameters are set, then the function
47
+ returns a copy of the options dictionary.
48
+
49
+ The ``options`` to Fock space can be accessed as the method
50
+ :obj:`FockSpaceOptions` of :class:`FockSpace` and
51
+ related parent classes.
52
+
53
+ @OPTIONS@
54
+
55
+ EXAMPLES::
56
+
57
+ sage: FS = FockSpace(4)
58
+ sage: F = FS.natural()
59
+ sage: x = F.an_element()
60
+ sage: y = x.f(3,2,2,0,1)
61
+ sage: y
62
+ ((3*q^2+3)/q)*|3, 3, 1> + (3*q^2+3)*|3, 2, 1, 1>
63
+ sage: Partitions.options.display = 'diagram'
64
+ sage: y
65
+ ((3*q^2+3)/q)*|3, 3, 1> + (3*q^2+3)*|3, 2, 1, 1>
66
+ sage: ascii_art(y)
67
+ ((3*q^2+3)/q)*|***\ + (3*q^2+3)*|***\
68
+ |*** > |** \
69
+ |* / |* /
70
+ |* /
71
+ sage: FockSpace.options.display = 'list'
72
+ sage: ascii_art(y)
73
+ ((3*q^2+3)/q)*F + (3*q^2+3)*F
74
+ *** ***
75
+ *** **
76
+ * *
77
+ *
78
+ sage: Partitions.options.display = 'compact_high'
79
+ sage: y
80
+ ((3*q^2+3)/q)*F3^2,1 + (3*q^2+3)*F3,2,1^2
81
+
82
+ sage: Partitions.options._reset()
83
+ sage: FockSpace.options._reset()
84
+ """
85
+ NAME = 'FockSpace'
86
+ module = 'sage.algebras.quantum_groups.fock_space'
87
+
88
+ display = {'default': "ket",
89
+ 'description': 'Specifies how terms of the natural basis of Fock space should be printed',
90
+ 'values': {'ket': 'displayed as a ket in bra-ket notation',
91
+ 'list': 'displayed as a list'},
92
+ 'case_sensitive': False}
93
+
94
+
95
+ ###############################################################################
96
+ # Fock space
97
+
98
+ class FockSpace(Parent, UniqueRepresentation):
99
+ r"""
100
+ The (fermionic) Fock space of `U_q(\widehat{\mathfrak{sl}}_n)` with
101
+ multicharge `(\gamma_1, \ldots, \gamma_m)`.
102
+
103
+ Fix a positive integer `n > 1` and fix a sequence
104
+ `\gamma = (\gamma_1, \ldots, \gamma_m)`, where `\gamma_i \in \ZZ / n \ZZ`.
105
+ *(fermionic) Fock space* `\mathcal{F}` with multicharge `\gamma` is a
106
+ `U_q(\widehat{\mathfrak{gl}}_n)`-representation with a basis
107
+ `\{ |\lambda \rangle \}`, where `\lambda` is a partition tuple of
108
+ level `m`. By considering `\mathcal{F}` as a
109
+ `U_q(\widehat{\mathfrak{sl}}_n)`-representation,
110
+ it is not irreducible, but the submodule generated by
111
+ `| \emptyset^m \rangle` is isomorphic to the highest weight module
112
+ `V(\mu)`, where the highest weight `\mu = \sum_i \Lambda_{\gamma_i}`.
113
+
114
+ Let `R_i(\lambda)` and `A_i(\lambda)` be the set of removable and
115
+ addable, respectively, `i`-cells of `\lambda`, where an `i`-cell is
116
+ a cell of residue `i` (i.e., content modulo n).
117
+ The action of `U_q(\widehat{\mathfrak{sl}}_n)` is given as follows:
118
+
119
+ .. MATH::
120
+
121
+ \begin{aligned}
122
+ e_i | \lambda \rangle & = \sum_{c \in R_i(\lambda)}
123
+ q^{M_i(\lambda, c)} | \lambda + c \rangle, \\
124
+ f_i | \lambda \rangle & = \sum_{c \in A_i(\lambda)}
125
+ q^{N_i(\lambda, c)} | \lambda - c \rangle, \\
126
+ q^{h_i} | \lambda \rangle & = q^{N_i(\lambda)} | \lambda \rangle, \\
127
+ q^d | \lambda \rangle & = q^{-N^{(0)}(\lambda)} | \lambda \rangle,
128
+ \end{aligned}
129
+
130
+ where
131
+
132
+ - `M_i(\lambda, c)` (resp. `N_i(\lambda, c)`) is the number of removable
133
+ (resp. addable) `i`-cells of `\lambda` below (resp. above) `c` minus
134
+ the number of addable (resp. removable) `i`-cells of `\lambda` below
135
+ (resp. above) `c`,
136
+ - `N_i(\lambda)` is the number of addable `i`-cells minus the number of
137
+ removable `i`-cells, and
138
+ - `N^{(0)}(\lambda)` is the total number of `0`-cells of `\lambda`.
139
+
140
+ Another interpretation of Fock space is as a semi-infinite wedge
141
+ product (which each factor we can think of as fermions). This allows
142
+ a description of the `U_q(\widehat{\mathfrak{gl}}_n)` action, as well
143
+ as an explicit description of the bar involution. In particular, the
144
+ bar involution is the unique semi-linear map satisfying
145
+
146
+ - `q \mapsto q^{-1}`,
147
+ - `\overline{| \emptyset \rangle} = | \emptyset \rangle`, and
148
+ - `\overline{f_i | \lambda \rangle} = f_i \overline{| \lambda \rangle}`.
149
+
150
+ We then define the *canonical basis* or *(lower) global crystal basis*
151
+ as the unique basis of `\mathcal{F}` such that
152
+
153
+ - `\overline{G(\lambda)} = G(\lambda)`,
154
+ - `G(\lambda) \equiv | \lambda \rangle \mod q \ZZ[q]`.
155
+
156
+ It is also known that this basis is upper unitriangular with respect to
157
+ dominance order and that both the natural basis and the canonical basis
158
+ of `\mathcal{F}` are `\ZZ`-graded by `|\lambda|`. Additionally, the
159
+ transition matrices `(d_{\lambda, \nu})_{\lambda,\nu \vdash n}` given by
160
+
161
+ .. MATH::
162
+
163
+ G(\nu) = \sum_{\lambda \vdash |\nu|} d_{\lambda,\nu} |\lambda \rangle
164
+
165
+ described the decomposition matrices of the Hecke algebras when
166
+ restricting to `V(\mu)` [Ariki1996]_.
167
+
168
+ To go between the canonical basis and the natural basis, for level 1
169
+ Fock space, we follow the LLT algorithm [LLT1996]_. Indeed, we first
170
+ construct a basis `\{ A(\nu) \}` that is an approximation to the
171
+ lower global crystal basis, in the sense that it is bar-invariant,
172
+ and then use Gaussian elimination to construct the lower global
173
+ crystal basis. For higher level Fock space, we follow [Fayers2010]_,
174
+ where the higher level is considered as a tensor product space
175
+ of the corresponding level 1 Fock spaces.
176
+
177
+ There are three bases currently implemented:
178
+
179
+ - The natural basis:
180
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.F`.
181
+ - The approximation basis that comes from LLT(-type) algorithms:
182
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.A`.
183
+ - The lower global crystal basis:
184
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpace.G`.
185
+
186
+ .. TODO::
187
+
188
+ - Implement the approximation and lower global crystal bases on
189
+ all partition tuples.
190
+ - Implement the bar involution.
191
+ - Implement the full `U_q(\widehat{\mathfrak{gl}})`-action.
192
+
193
+ INPUT:
194
+
195
+ - ``n`` -- the value `n`
196
+ - ``multicharge`` -- (default: ``[0]``) the multicharge
197
+ - ``q`` -- (optional) the parameter `q`
198
+ - ``base_ring`` -- (optional) the base ring containing ``q``
199
+
200
+ EXAMPLES:
201
+
202
+ We start by constructing the natural basis and doing
203
+ some computations::
204
+
205
+ sage: Fock = FockSpace(3)
206
+ sage: F = Fock.natural()
207
+ sage: u = F.highest_weight_vector()
208
+ sage: u.f(0,2,(1,2),0)
209
+ |2, 2, 1> + q*|2, 1, 1, 1>
210
+ sage: u.f(0,2,(1,2),0,2)
211
+ |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>
212
+ sage: x = u.f(0,2,(1,2),0,2)
213
+ sage: [x.h(i) for i in range(3)]
214
+ [q*|3, 2, 1> + q^2*|3, 1, 1, 1> + q^2*|2, 2, 2> + q^3*|2, 1, 1, 1, 1>,
215
+ |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>,
216
+ |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>]
217
+ sage: [x.h_inverse(i) for i in range(3)]
218
+ [1/q*|3, 2, 1> + |3, 1, 1, 1> + |2, 2, 2> + q*|2, 1, 1, 1, 1>,
219
+ |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>,
220
+ |3, 2, 1> + q*|3, 1, 1, 1> + q*|2, 2, 2> + q^2*|2, 1, 1, 1, 1>]
221
+ sage: x.d()
222
+ 1/q^2*|3, 2, 1> + 1/q*|3, 1, 1, 1> + 1/q*|2, 2, 2> + |2, 1, 1, 1, 1>
223
+
224
+ Next, we construct the approximation and lower global crystal bases
225
+ and convert to the natural basis::
226
+
227
+ sage: A = Fock.A()
228
+ sage: G = Fock.G()
229
+ sage: F(A[4,2,2,1])
230
+ |4, 2, 2, 1> + q*|4, 2, 1, 1, 1>
231
+ sage: F(G[4,2,2,1])
232
+ |4, 2, 2, 1> + q*|4, 2, 1, 1, 1>
233
+ sage: F(A[7,3,2,1,1])
234
+ |7, 3, 2, 1, 1> + q*|7, 2, 2, 2, 1> + q^2*|7, 2, 2, 1, 1, 1>
235
+ + q*|6, 3, 3, 1, 1> + q^2*|6, 2, 2, 2, 2> + q^3*|6, 2, 2, 1, 1, 1, 1>
236
+ + q*|5, 5, 2, 1, 1> + q^2*|5, 4, 3, 1, 1> + (q^2+1)*|4, 4, 3, 2, 1>
237
+ + (q^3+q)*|4, 4, 3, 1, 1, 1> + (q^3+q)*|4, 4, 2, 2, 2>
238
+ + (q^4+q^2)*|4, 4, 2, 1, 1, 1, 1> + q*|4, 3, 3, 3, 1>
239
+ + q^2*|4, 3, 2, 1, 1, 1, 1, 1> + q^2*|4, 2, 2, 2, 2, 2>
240
+ + q^3*|4, 2, 2, 2, 1, 1, 1, 1> + q^2*|3, 3, 3, 3, 2>
241
+ + q^3*|3, 3, 3, 1, 1, 1, 1, 1> + q^3*|3, 2, 2, 2, 2, 2, 1>
242
+ + q^4*|3, 2, 2, 2, 2, 1, 1, 1>
243
+ sage: F(G[7,3,2,1,1])
244
+ |7, 3, 2, 1, 1> + q*|7, 2, 2, 2, 1> + q^2*|7, 2, 2, 1, 1, 1>
245
+ + q*|6, 3, 3, 1, 1> + q^2*|6, 2, 2, 2, 2>
246
+ + q^3*|6, 2, 2, 1, 1, 1, 1> + q*|5, 5, 2, 1, 1>
247
+ + q^2*|5, 4, 3, 1, 1> + q^2*|4, 4, 3, 2, 1>
248
+ + q^3*|4, 4, 3, 1, 1, 1> + q^3*|4, 4, 2, 2, 2>
249
+ + q^4*|4, 4, 2, 1, 1, 1, 1>
250
+ sage: A(F(G[7,3,2,1,1]))
251
+ A[7, 3, 2, 1, 1] - A[4, 4, 3, 2, 1]
252
+ sage: G(F(A[7,3,2,1,1]))
253
+ G[7, 3, 2, 1, 1] + G[4, 4, 3, 2, 1]
254
+ sage: A(F(G[8,4,3,2,2,1]))
255
+ A[8, 4, 3, 2, 2, 1] - A[6, 4, 4, 2, 2, 1, 1] - A[5, 5, 4, 3, 2, 1]
256
+ + ((-q^2-1)/q)*A[5, 4, 4, 3, 2, 1, 1]
257
+ sage: G(F(A[8,4,3,2,2,1]))
258
+ G[8, 4, 3, 2, 2, 1] + G[6, 4, 4, 2, 2, 1, 1] + G[5, 5, 4, 3, 2, 1]
259
+ + ((q^2+1)/q)*G[5, 4, 4, 3, 2, 1, 1]
260
+
261
+ We can also construct higher level Fock spaces and perform
262
+ similar computations::
263
+
264
+ sage: Fock = FockSpace(3, [1,0])
265
+ sage: F = Fock.natural()
266
+ sage: A = Fock.A()
267
+ sage: G = Fock.G()
268
+ sage: F(G[[2,1],[4,1,1]])
269
+ |[2, 1], [4, 1, 1]> + q*|[2, 1], [3, 2, 1]>
270
+ + q^2*|[2, 1], [3, 1, 1, 1]> + q^2*|[2], [4, 2, 1]>
271
+ + q^3*|[2], [4, 1, 1, 1]> + q^4*|[2], [3, 2, 1, 1]>
272
+ + q*|[1, 1, 1], [4, 1, 1]> + q^2*|[1, 1, 1], [3, 2, 1]>
273
+ + q^3*|[1, 1, 1], [3, 1, 1, 1]> + q^2*|[1, 1], [3, 2, 2]>
274
+ + q^3*|[1, 1], [3, 1, 1, 1, 1]> + q^3*|[1], [4, 2, 2]>
275
+ + q^4*|[1], [4, 1, 1, 1, 1]> + q^4*|[1], [3, 2, 2, 1]>
276
+ + q^5*|[1], [3, 2, 1, 1, 1]>
277
+ sage: A(F(G[[2,1],[4,1,1]]))
278
+ A([2, 1], [4, 1, 1]) - A([2], [4, 2, 1])
279
+ sage: G(F(A[[2,1],[4,1,1]]))
280
+ G([2, 1], [4, 1, 1]) + G([2], [4, 2, 1])
281
+
282
+ For level `0`, the truncated Fock space of [GW1999]_
283
+ is implemented. This can be used to improve the speed
284
+ of the computation of the lower global crystal basis,
285
+ provided the truncation is not too small::
286
+
287
+ sage: FS = FockSpace(2)
288
+ sage: F = FS.natural()
289
+ sage: G = FS.G()
290
+ sage: FS3 = FockSpace(2, truncated=3)
291
+ sage: F3 = FS3.natural()
292
+ sage: G3 = FS3.G()
293
+ sage: F(G[6,2,1])
294
+ |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2> + q^3*|5, 2, 1, 1>
295
+ + q*|4, 2, 1, 1, 1> + q^2*|3, 3, 1, 1, 1> + q^3*|3, 2, 2, 1, 1>
296
+ + q^4*|3, 2, 1, 1, 1, 1>
297
+ sage: F3(G3[6,2,1])
298
+ |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2>
299
+ sage: FS5 = FockSpace(2, truncated=5)
300
+ sage: F5 = FS5.natural()
301
+ sage: G5 = FS5.G()
302
+ sage: F5(G5[6,2,1])
303
+ |6, 2, 1> + q*|5, 3, 1> + q^2*|5, 2, 2> + q^3*|5, 2, 1, 1>
304
+ + q*|4, 2, 1, 1, 1> + q^2*|3, 3, 1, 1, 1> + q^3*|3, 2, 2, 1, 1>
305
+
306
+ REFERENCES:
307
+
308
+ - [Ariki1996]_
309
+ - [LLT1996]_
310
+ - [Fayers2010]_
311
+ - [GW1999]_
312
+ """
313
+ @staticmethod
314
+ def __classcall_private__(cls, n, multicharge=[0], q=None, base_ring=None, truncated=None):
315
+ r"""
316
+ Standardize input to ensure a unique representation.
317
+
318
+ EXAMPLES::
319
+
320
+ sage: R.<q> = ZZ[]
321
+ sage: F1 = FockSpace(3, [0])
322
+ sage: F2 = FockSpace(3, 0, q)
323
+ sage: F3 = FockSpace(3, (0,), q, R)
324
+ sage: F1 is F2 and F2 is F3
325
+ True
326
+ """
327
+ if q is None:
328
+ base_ring = PolynomialRing(ZZ, 'q')
329
+ q = base_ring.gen(0)
330
+ if base_ring is None:
331
+ base_ring = q.parent()
332
+ base_ring = FractionField(base_ring)
333
+ q = base_ring(q)
334
+ M = IntegerModRing(n)
335
+ if multicharge in ZZ:
336
+ multicharge = (multicharge,)
337
+ multicharge = tuple(M(e) for e in multicharge)
338
+ if truncated is not None:
339
+ return FockSpaceTruncated(n, truncated, q, base_ring)
340
+ return super().__classcall__(cls, n, multicharge, q, base_ring)
341
+
342
+ def __init__(self, n, multicharge, q, base_ring):
343
+ r"""
344
+ Initialize ``self``.
345
+
346
+ EXAMPLES::
347
+
348
+ sage: F = FockSpace(3, [0])
349
+ sage: TestSuite(F).run()
350
+ sage: F = FockSpace(3, [1, 2])
351
+ sage: TestSuite(F).run()
352
+ """
353
+ self._n = n
354
+ self._q = q
355
+ self._multicharge = multicharge
356
+ self._index_set = set(range(n))
357
+ cat = ModulesWithBasis(base_ring).WithRealizations()
358
+ Parent.__init__(self, base=base_ring, category=cat)
359
+ self._realizations = [self.natural(), self.A(), self.G()]
360
+
361
+ def _repr_(self):
362
+ r"""
363
+ Return a string representation of ``self``.
364
+
365
+ EXAMPLES::
366
+
367
+ sage: FockSpace(2)
368
+ Fock space of rank 2 of multicharge (0,) over Fraction Field
369
+ of Univariate Polynomial Ring in q over Integer Ring
370
+ sage: FockSpace(4, [2, 0, 1])
371
+ Fock space of rank 4 of multicharge (2, 0, 1) over Fraction Field
372
+ of Univariate Polynomial Ring in q over Integer Ring
373
+ """
374
+ return "Fock space of rank {} of multicharge {} over {}".format(
375
+ self._n, self._multicharge, self.base_ring())
376
+
377
+ def _latex_(self):
378
+ r"""
379
+ Return a latex representation of ``self``.
380
+
381
+ EXAMPLES::
382
+
383
+ sage: F = FockSpace(2)
384
+ sage: latex(F)
385
+ \mathcal{F}_{q}^{2}\left(0\right)
386
+ sage: F = FockSpace(4, [2, 0, 1])
387
+ sage: latex(F)
388
+ \mathcal{F}_{q}^{4}\left(2, 0, 1\right)
389
+ """
390
+ from sage.misc.latex import latex
391
+ return "\\mathcal{{F}}_{{{q}}}^{{{n}}}{mc}".format(q=latex(self._q), n=self._n,
392
+ mc=latex(self._multicharge))
393
+
394
+ options = FockSpaceOptions
395
+
396
+ def q(self):
397
+ r"""
398
+ Return the parameter `q` of ``self``.
399
+
400
+ EXAMPLES::
401
+
402
+ sage: F = FockSpace(2)
403
+ sage: F.q()
404
+ q
405
+
406
+ sage: F = FockSpace(2, q=-1)
407
+ sage: F.q()
408
+ -1
409
+ """
410
+ return self._q
411
+
412
+ def multicharge(self):
413
+ r"""
414
+ Return the multicharge of ``self``.
415
+
416
+ EXAMPLES::
417
+
418
+ sage: F = FockSpace(2)
419
+ sage: F.multicharge()
420
+ (0,)
421
+
422
+ sage: F = FockSpace(4, [2, 0, 1])
423
+ sage: F.multicharge()
424
+ (2, 0, 1)
425
+ """
426
+ return self._multicharge
427
+
428
+ def a_realization(self):
429
+ r"""
430
+ Return a realization of ``self``.
431
+
432
+ EXAMPLES::
433
+
434
+ sage: FS = FockSpace(2)
435
+ sage: FS.a_realization()
436
+ Fock space of rank 2 of multicharge (0,) over
437
+ Fraction Field of Univariate Polynomial Ring in q over Integer Ring
438
+ in the natural basis
439
+ """
440
+ return self.natural()
441
+
442
+ def inject_shorthands(self, verbose=True):
443
+ r"""
444
+ Import standard shorthands into the global namespace.
445
+
446
+ INPUT:
447
+
448
+ - ``verbose`` -- boolean (default: ``True``); if ``True``, prints
449
+ the defined shorthands
450
+
451
+ EXAMPLES::
452
+
453
+ sage: FS = FockSpace(4)
454
+ sage: FS.inject_shorthands()
455
+ Injecting A as shorthand for Fock space of rank 4
456
+ of multicharge (0,) over Fraction Field
457
+ of Univariate Polynomial Ring in q over Integer Ring
458
+ in the approximation basis
459
+ Injecting F as shorthand for Fock space of rank 4
460
+ of multicharge (0,) over Fraction Field
461
+ of Univariate Polynomial Ring in q over Integer Ring
462
+ in the natural basis
463
+ Injecting G as shorthand for Fock space of rank 4
464
+ of multicharge (0,) over Fraction Field
465
+ of Univariate Polynomial Ring in q over Integer Ring
466
+ in the lower global crystal basis
467
+ """
468
+ from sage.misc.misc import inject_variable
469
+ for shorthand in ['A', 'F', 'G']:
470
+ realization = getattr(self, shorthand)()
471
+ if verbose:
472
+ print('Injecting {} as shorthand for {}'.format(shorthand, realization))
473
+ inject_variable(shorthand, realization)
474
+
475
+ def highest_weight_vector(self):
476
+ r"""
477
+ Return the module generator of ``self`` in the natural basis.
478
+
479
+ EXAMPLES::
480
+
481
+ sage: FS = FockSpace(2)
482
+ sage: FS.highest_weight_vector()
483
+ |>
484
+ sage: FS = FockSpace(4, [2, 0, 1])
485
+ sage: FS.highest_weight_vector()
486
+ |[], [], []>
487
+ """
488
+ return self.natural().highest_weight_vector()
489
+
490
+ def __getitem__(self, i):
491
+ r"""
492
+ Return the basis element indexed by ``i``.
493
+
494
+ INPUT:
495
+
496
+ - ``i`` -- a partition
497
+
498
+ EXAMPLES::
499
+
500
+ sage: FS = FockSpace(2)
501
+ sage: FS[[]]
502
+ |>
503
+ sage: FS[1]
504
+ |1>
505
+ sage: FS[2,2,1]
506
+ |2, 2, 1>
507
+
508
+ sage: FS = FockSpace(3, [1, 2])
509
+ sage: FS[[], []]
510
+ |[], []>
511
+ sage: FS[[2,1], [3,1,1]]
512
+ |[2, 1], [3, 1, 1]>
513
+ """
514
+ return self.natural()[i]
515
+
516
+ class F(CombinatorialFreeModule, BindableClass):
517
+ r"""
518
+ The natural basis of the Fock space.
519
+
520
+ This is the basis indexed by partitions. This has an action
521
+ of the quantum group `U_q(\widehat{\mathfrak{sl}}_n)`
522
+ described in
523
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpace`.
524
+
525
+ EXAMPLES:
526
+
527
+ We construct the natural basis and perform some computations::
528
+
529
+ sage: F = FockSpace(4).natural()
530
+ sage: q = F.q()
531
+ sage: u = F.highest_weight_vector()
532
+ sage: u
533
+ |>
534
+ sage: u.f(0,1,2)
535
+ |3>
536
+ sage: u.f(0,1,3)
537
+ |2, 1>
538
+ sage: u.f(0,1,2,0)
539
+ 0
540
+ sage: u.f(0,1,3,2)
541
+ |3, 1> + q*|2, 1, 1>
542
+ sage: u.f(0,1,2,3)
543
+ |4> + q*|3, 1>
544
+ sage: u.f(0,1,3,2,2,0)
545
+ ((q^2+1)/q)*|3, 2, 1>
546
+ sage: x = (q^4 * u + u.f(0,1,3,(2,2)))
547
+ sage: x
548
+ |3, 1, 1> + q^4*|>
549
+ sage: x.f(0,1,3)
550
+ |4, 3, 1> + q*|4, 2, 1, 1> + q*|3, 3, 2>
551
+ + q^2*|3, 2, 2, 1> + q^4*|2, 1>
552
+ sage: x.h_inverse(2)
553
+ q^2*|3, 1, 1> + q^4*|>
554
+ sage: x.h_inverse(0)
555
+ 1/q*|3, 1, 1> + q^3*|>
556
+ sage: x.d()
557
+ 1/q*|3, 1, 1> + q^4*|>
558
+ sage: x.e(2)
559
+ |3, 1> + q*|2, 1, 1>
560
+ """
561
+ def __init__(self, F):
562
+ """
563
+ Initialize ``self``.
564
+
565
+ EXAMPLES::
566
+
567
+ sage: F = FockSpace(2).natural()
568
+ sage: TestSuite(F).run() # long time
569
+ """
570
+ self._basis_name = "natural"
571
+ # If the cell x is above the cell y
572
+ if len(F._multicharge) == 1: # For partitions
573
+ self._above = lambda x, y: x[0] < y[0]
574
+ else: # For partition tuples
575
+ self._above = lambda x,y: x[0] < y[0] or (x[0] == y[0] and x[1] < y[1])
576
+ self._addable = lambda la,i: [x for x in la.outside_corners()
577
+ if la.content(*x, multicharge=F._multicharge) == i]
578
+ self._removable = lambda la,i: [x for x in la.corners()
579
+ if la.content(*x, multicharge=F._multicharge) == i]
580
+
581
+ indices = PartitionTuples(level=len(F._multicharge))
582
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
583
+ prefix='F',
584
+ latex_prefix='',
585
+ bracket=False,
586
+ latex_bracket=['\\left\\lvert', '\\right\\rangle'],
587
+ sorting_reverse=True,
588
+ category=FockSpaceBases(F))
589
+
590
+ options = FockSpaceOptions
591
+
592
+ def _repr_term(self, m):
593
+ r"""
594
+ Return a representation of the monomial indexed by ``m``.
595
+
596
+ EXAMPLES::
597
+
598
+ sage: F = FockSpace(2).natural()
599
+ sage: F._repr_term(Partition([2,1,1]))
600
+ '|2, 1, 1>'
601
+ sage: F.highest_weight_vector()
602
+ |>
603
+ sage: F = FockSpace(2, [2, 1, 1]).natural()
604
+ sage: mg = F.highest_weight_vector(); mg
605
+ |[], [], []>
606
+ sage: q = F.q()
607
+ sage: mg.f(1).f(1).f(0) / (q^-1 + q)
608
+ |[1], [1], [1]> + q*|[], [2], [1]> + q^2*|[], [1, 1], [1]>
609
+ + q^3*|[], [1], [2]> + q^4*|[], [1], [1, 1]>
610
+ """
611
+ if self.options.display != 'ket':
612
+ return CombinatorialFreeModule._repr_term(self, m)
613
+ return '|' + m._repr_list()[1:-1] + ">" # Strip the outer brackets of m
614
+
615
+ def _ascii_art_term(self, m):
616
+ r"""
617
+ Return a representation of the monomial indexed by ``m``.
618
+
619
+ EXAMPLES::
620
+
621
+ sage: FS = FockSpace(4)
622
+ sage: F = FS.natural()
623
+ sage: x = F.an_element()
624
+ sage: ascii_art(x)
625
+ 3*|**> + 2*|*> + 2*|->
626
+ sage: ascii_art(x.f(3,2,2,0,1))
627
+ ((3*q^2+3)/q)*|***\ + (3*q^2+3)*|***\
628
+ |*** > |** \
629
+ |* / |* /
630
+ |* /
631
+ """
632
+ if self.options.display != 'ket':
633
+ return CombinatorialFreeModule._ascii_art_term(self, m)
634
+ from sage.typeset.ascii_art import AsciiArt, ascii_art
635
+ a = ascii_art(m)
636
+ h = a.height()
637
+ l = AsciiArt(['|']*h)
638
+ r = AsciiArt([' '*i + '\\' for i in range(h//2)], baseline=0)
639
+ if h % 2:
640
+ r *= AsciiArt([' '*(h//2) + '>'], baseline=0)
641
+ r *= AsciiArt([' '*i + '/' for i in reversed(range(h//2))], baseline=0)
642
+ ret = l + a + r
643
+ ret._baseline = h - 1
644
+ return ret
645
+
646
+ def _unicode_art_term(self, m):
647
+ r"""
648
+ Return an unicode art representing the generator indexed by ``m``.
649
+
650
+ TESTS::
651
+
652
+ sage: FS = FockSpace(4)
653
+ sage: F = FS.natural()
654
+ sage: x = F.an_element()
655
+ sage: unicode_art(x)
656
+ 3*│┌┬┐╲ + 2*│┌┐╲ + 2*│∅〉
657
+ │└┴┘╱ │└┘╱
658
+ sage: unicode_art(x.f(3,2,2,0,1))
659
+ ((3*q^2+3)/q)*│┌┬┬┐╲ + (3*q^2+3)*│┌┬┬┐╲
660
+ │├┼┼┤ ╲ │├┼┼┘ ╲
661
+ │├┼┴┘ ╱ │├┼┘ 〉
662
+ │└┘ ╱ │├┤ ╱
663
+ │└┘ ╱
664
+ """
665
+ if self.options.display != 'ket':
666
+ return CombinatorialFreeModule._ascii_art_term(self, m)
667
+ from sage.typeset.unicode_art import UnicodeArt, unicode_art
668
+ a = unicode_art(m)
669
+ h = a.height()
670
+ l = UnicodeArt(['│']*h, baseline=0)
671
+ r = UnicodeArt([" "*i + '╲' for i in range(h//2)], baseline=0)
672
+ if h % 2:
673
+ r *= UnicodeArt([" "*(h//2) + '〉'], baseline=0)
674
+ r *= UnicodeArt([" "*i + '╱' for i in reversed(range(h//2))], baseline=0)
675
+ ret = l + a + r
676
+ ret._baseline = h - 1
677
+ return ret
678
+
679
+ def _test_representation(self, **options):
680
+ r"""
681
+ Test that ``self`` is a
682
+ `U_q(\widehat{\mathfrak{sl}}_n)`-representation.
683
+
684
+ EXAMPLES::
685
+
686
+ sage: F = FockSpace(3, [0,1]).natural()
687
+ sage: F._test_representation() # long time
688
+ """
689
+ from sage.combinat.root_system.cartan_matrix import CartanMatrix
690
+ from sage.combinat.root_system.root_system import RootSystem
691
+ from sage.algebras.quantum_groups.q_numbers import q_binomial
692
+
693
+ tester = self._tester(**options)
694
+ F = self.realization_of()
695
+ q = F.q()
696
+ n = F._n
697
+ I = F._index_set
698
+ A = CartanMatrix(['A',n-1,1])
699
+ P = RootSystem(['A',n-1,1]).weight_lattice()
700
+ al = P.simple_roots()
701
+ ac = P.simple_coroots()
702
+ zero = self.zero()
703
+ for x in self.some_elements():
704
+ for i in I:
705
+ for j in I:
706
+ tester.assertEqual(x.h_inverse(j).f(i).h(j), q**-al[i].scalar(ac[j]) * x.f(i))
707
+ tester.assertEqual(x.h_inverse(j).e(i).h(j), q**al[i].scalar(ac[j]) * x.e(i))
708
+ if i == j:
709
+ tester.assertEqual(x.f(i).e(i) - x.e(i).f(i),
710
+ (x.h(i) - x.h_inverse(i)) / (q - q**-1))
711
+ continue
712
+ tester.assertEqual(x.f(j).e(i) - x.e(i).f(j), zero)
713
+ aij = A[i,j]
714
+ tester.assertEqual(zero,
715
+ sum((-1)**k
716
+ * q_binomial(1-aij, k, q)
717
+ * x.e(*([i]*(1-aij-k) + [j] + [i]*k))
718
+ for k in range(1-aij+1)))
719
+ tester.assertEqual(zero,
720
+ sum((-1)**k
721
+ * q_binomial(1-aij, k, q)
722
+ * x.f(*([i]*(1-aij-k) + [j] + [i]*k))
723
+ for k in range(1-aij+1)))
724
+
725
+ class Element(CombinatorialFreeModule.Element):
726
+ """
727
+ An element in the Fock space.
728
+ """
729
+ def _e(self, i):
730
+ r"""
731
+ Apply `e_i` to ``self``.
732
+
733
+ EXAMPLES::
734
+
735
+ sage: F = FockSpace(2)
736
+ sage: F[2,1,1]._e(1)
737
+ 1/q*|1, 1, 1>
738
+ sage: F[2,1,1]._e(0)
739
+ |2, 1>
740
+ sage: F[3,2,1]._e(1)
741
+ 0
742
+
743
+ sage: F = FockSpace(4, [2, 0, 1])
744
+ sage: F[[2,1],[1],[2]]._e(2)
745
+ |[2, 1], [1], [1]>
746
+ """
747
+ P = self.parent()
748
+
749
+ def N_left(la, x, i):
750
+ return (sum(1 for y in P._addable(la, i) if P._above(x, y))
751
+ - sum(1 for y in P._removable(la, i) if P._above(x, y)))
752
+ q = P.realization_of()._q
753
+ return P.sum_of_terms((la.remove_cell(*x), c * q**(-N_left(la, x, i)))
754
+ for la,c in self for x in P._removable(la, i))
755
+
756
+ def e(self, *data):
757
+ r"""
758
+ Apply the action of the divided power operator
759
+ `e_i^{(p)} = e_i^{p} / [p]_q` on ``self``.
760
+
761
+ INPUT:
762
+
763
+ - ``*data`` -- list of indices or pairs `(i, p)`
764
+
765
+ EXAMPLES::
766
+
767
+ sage: F = FockSpace(2)
768
+ sage: F[2,1,1].e(1)
769
+ 1/q*|1, 1, 1>
770
+ sage: F[2,1,1].e(0)
771
+ |2, 1>
772
+ sage: F[2,1,1].e(0).e(1)
773
+ |2> + q*|1, 1>
774
+ sage: F[2,1,1].e(0).e(1).e(1)
775
+ ((q^2+1)/q)*|1>
776
+ sage: F[2,1,1].e(0).e((1, 2))
777
+ |1>
778
+ sage: F[2,1,1].e(0, 1, 1, 1)
779
+ 0
780
+ sage: F[2,1,1].e(0, (1, 3))
781
+ 0
782
+ sage: F[2,1,1].e(0, (1,2), 0)
783
+ |>
784
+ sage: F[2,1,1].e(1, 0, 1, 0)
785
+ 1/q*|>
786
+
787
+ sage: F = FockSpace(4, [2, 0, 1])
788
+ sage: F[[2,1],[1],[2]]
789
+ |[2, 1], [1], [2]>
790
+ sage: F[[2,1],[1],[2]].e(2)
791
+ |[2, 1], [1], [1]>
792
+ sage: F[[2,1],[1],[2]].e(1)
793
+ 1/q*|[2], [1], [2]>
794
+ sage: F[[2,1],[1],[2]].e(0)
795
+ 1/q*|[2, 1], [], [2]>
796
+ sage: F[[2,1],[1],[2]].e(3)
797
+ 1/q^2*|[1, 1], [1], [2]>
798
+ sage: F[[2,1],[1],[2]].e(3, 2, 1)
799
+ 1/q^2*|[1, 1], [1], []> + 1/q^2*|[1], [1], [1]>
800
+ sage: F[[2,1],[1],[2]].e(3, 2, 1, 0, 1, 2)
801
+ 2/q^3*|[], [], []>
802
+ """
803
+ ret = self
804
+ q = self.parent().realization_of()._q
805
+ I = self.parent().realization_of()._index_set
806
+ for i in data:
807
+ if isinstance(i, tuple):
808
+ i, p = i
809
+ else:
810
+ p = 1
811
+ if i not in I:
812
+ raise ValueError("{} not in the index set".format(i))
813
+
814
+ for _ in range(p):
815
+ ret = ret._e(i)
816
+ if p > 1:
817
+ ret = ret / q_factorial(p, q)
818
+ return ret
819
+
820
+ def _f(self, i):
821
+ r"""
822
+ Apply `f_i` to ``self``.
823
+
824
+ EXAMPLES::
825
+
826
+ sage: F = FockSpace(2)
827
+ sage: F.highest_weight_vector()._f(0)
828
+ |1>
829
+ sage: F[5,2,2,1]._f(0)
830
+ 1/q*|5, 2, 2, 2> + |5, 2, 2, 1, 1>
831
+ sage: F[5,2,2,1]._f(1)
832
+ |6, 2, 2, 1> + q*|5, 3, 2, 1>
833
+
834
+ sage: F = FockSpace(4, [2, 0, 1])
835
+ sage: F[[3,1], [1,1,1], [4,2,2]]._f(0)
836
+ 1/q*|[3, 1, 1], [1, 1, 1], [4, 2, 2]>
837
+ sage: F[[3,1], [1,1,1], [4,2,2]]._f(1)
838
+ |[4, 1], [1, 1, 1], [4, 2, 2]>
839
+ + |[3, 1], [2, 1, 1], [4, 2, 2]>
840
+ + q*|[3, 1], [1, 1, 1, 1], [4, 2, 2]>
841
+ + q^2*|[3, 1], [1, 1, 1], [5, 2, 2]>
842
+ """
843
+ P = self.parent()
844
+
845
+ def N_right(la, x, i):
846
+ return (sum(1 for y in P._addable(la, i) if P._above(y, x))
847
+ - sum(1 for y in P._removable(la, i) if P._above(y, x)))
848
+ q = P.realization_of()._q
849
+ return P.sum_of_terms((la.add_cell(*x), c * q**N_right(la, x, i))
850
+ for la,c in self for x in P._addable(la, i))
851
+
852
+ def f(self, *data):
853
+ r"""
854
+ Apply the action of the divided power operator
855
+ `f_i^{(p)} = f_i^{p} / [p]_q` on ``self``.
856
+
857
+ INPUT:
858
+
859
+ - ``*data`` -- list of indices or pairs `(i, p)`
860
+
861
+ EXAMPLES::
862
+
863
+ sage: F = FockSpace(2)
864
+ sage: mg = F.highest_weight_vector()
865
+ sage: mg.f(0)
866
+ |1>
867
+ sage: mg.f(0).f(1)
868
+ |2> + q*|1, 1>
869
+ sage: mg.f(0).f(0)
870
+ 0
871
+ sage: mg.f((0, 2))
872
+ 0
873
+ sage: mg.f(0, 1, 1)
874
+ ((q^2+1)/q)*|2, 1>
875
+ sage: mg.f(0, (1, 2))
876
+ |2, 1>
877
+ sage: mg.f(0, 1, 0)
878
+ |3> + q*|1, 1, 1>
879
+
880
+ sage: F = FockSpace(4, [2, 0, 1])
881
+ sage: mg = F.highest_weight_vector()
882
+ sage: mg.f(0)
883
+ |[], [1], []>
884
+ sage: mg.f(2)
885
+ |[1], [], []>
886
+ sage: mg.f(1)
887
+ |[], [], [1]>
888
+ sage: mg.f(1, 0)
889
+ |[], [1], [1]> + q*|[], [], [1, 1]>
890
+ sage: mg.f(0, 1)
891
+ |[], [2], []> + q*|[], [1], [1]>
892
+ sage: mg.f(0, 1, 3)
893
+ |[], [2, 1], []> + q*|[], [1, 1], [1]>
894
+ sage: mg.f(3)
895
+ 0
896
+ """
897
+ ret = self
898
+ q = self.parent().realization_of()._q
899
+ I = self.parent().realization_of()._index_set
900
+ for i in data:
901
+ if isinstance(i, tuple):
902
+ i, p = i
903
+ else:
904
+ p = 1
905
+ if i not in I:
906
+ raise ValueError("{} not in the index set".format(i))
907
+
908
+ for _ in range(p):
909
+ ret = ret._f(i)
910
+ if p > 1:
911
+ ret = ret / q_factorial(p, q)
912
+ return ret
913
+
914
+ def h(self, *data):
915
+ r"""
916
+ Apply the action of `h_i` on ``self``.
917
+
918
+ EXAMPLES::
919
+
920
+ sage: F = FockSpace(2)
921
+ sage: F[2,1,1].h(0)
922
+ q*|2, 1, 1>
923
+ sage: F[2,1,1].h(1)
924
+ |2, 1, 1>
925
+ sage: F[2,1,1].h(0, 0)
926
+ q^2*|2, 1, 1>
927
+
928
+ sage: F = FockSpace(4, [2,0,1])
929
+ sage: elt = F[[2,1],[1],[2]]
930
+ sage: elt.h(0)
931
+ q^2*|[2, 1], [1], [2]>
932
+ sage: elt.h(1)
933
+ |[2, 1], [1], [2]>
934
+ sage: elt.h(2)
935
+ |[2, 1], [1], [2]>
936
+ sage: elt.h(3)
937
+ q*|[2, 1], [1], [2]>
938
+ """
939
+ P = self.parent()
940
+ q = P.realization_of()._q
941
+ I = self.parent().realization_of()._index_set
942
+ d = self.monomial_coefficients(copy=True)
943
+ for i in data:
944
+ if i not in I:
945
+ raise ValueError("{} not in the index set".format(i))
946
+ for la in d:
947
+ d[la] *= q**(len(P._addable(la, i)) - len(P._removable(la, i)))
948
+ return P._from_dict(d, coerce=False)
949
+
950
+ def h_inverse(self, *data):
951
+ r"""
952
+ Apply the action of `h_i^{-1}` on ``self``.
953
+
954
+ EXAMPLES::
955
+
956
+ sage: F = FockSpace(2)
957
+ sage: F[2,1,1].h_inverse(0)
958
+ 1/q*|2, 1, 1>
959
+ sage: F[2,1,1].h_inverse(1)
960
+ |2, 1, 1>
961
+ sage: F[2,1,1].h_inverse(0, 0)
962
+ 1/q^2*|2, 1, 1>
963
+
964
+ sage: F = FockSpace(4, [2,0,1])
965
+ sage: elt = F[[2,1],[1],[2]]
966
+ sage: elt.h_inverse(0)
967
+ 1/q^2*|[2, 1], [1], [2]>
968
+ sage: elt.h_inverse(1)
969
+ |[2, 1], [1], [2]>
970
+ sage: elt.h_inverse(2)
971
+ |[2, 1], [1], [2]>
972
+ sage: elt.h_inverse(3)
973
+ 1/q*|[2, 1], [1], [2]>
974
+ """
975
+ P = self.parent()
976
+ q = P.realization_of()._q
977
+ I = self.parent().realization_of()._index_set
978
+ d = self.monomial_coefficients(copy=True)
979
+ for i in data:
980
+ if i not in I:
981
+ raise ValueError("{} not in the index set".format(i))
982
+ for la in d:
983
+ d[la] *= q**-(len(P._addable(la, i)) - len(P._removable(la, i)))
984
+ return P._from_dict(d, coerce=False)
985
+
986
+ def d(self):
987
+ r"""
988
+ Apply the action of `d` on ``self``.
989
+
990
+ EXAMPLES::
991
+
992
+ sage: F = FockSpace(2)
993
+ sage: F.highest_weight_vector().d()
994
+ |>
995
+ sage: F[2,1,1].d()
996
+ 1/q^2*|2, 1, 1>
997
+ sage: F[5,3,3,1,1,1].d()
998
+ 1/q^7*|5, 3, 3, 1, 1, 1>
999
+
1000
+ sage: F = FockSpace(4, [2,0,1])
1001
+ sage: F.highest_weight_vector().d()
1002
+ |[], [], []>
1003
+ sage: F[[2,1],[1],[2]].d()
1004
+ 1/q*|[2, 1], [1], [2]>
1005
+ sage: F[[4,2,2,1],[1],[5,2]].d()
1006
+ 1/q^5*|[4, 2, 2, 1], [1], [5, 2]>
1007
+ """
1008
+ P = self.parent()
1009
+ R = P.realization_of()
1010
+ q = R._q
1011
+ d = self.monomial_coefficients(copy=True)
1012
+ for la in d:
1013
+ d[la] *= q**-sum(1 for x in la.cells()
1014
+ if la.content(*x, multicharge=R._multicharge) == 0)
1015
+ return P._from_dict(d, coerce=False)
1016
+
1017
+ natural = F
1018
+
1019
+ class A(CombinatorialFreeModule, BindableClass):
1020
+ r"""
1021
+ The `A` basis of the Fock space which is the approximation
1022
+ of the lower global crystal basis.
1023
+
1024
+ The approximation basis `A` is a basis that is constructed
1025
+ from the highest weight element by applying divided
1026
+ difference operators using the ladder construction of
1027
+ [LLT1996]_ and [GW1999]_. Thus, this basis is bar invariant
1028
+ and upper unitriangular (using dominance order on partitions)
1029
+ when expressed in the natural basis. This basis is then
1030
+ converted to the lower global crystal basis by using
1031
+ Gaussian elimination.
1032
+
1033
+ EXAMPLES:
1034
+
1035
+ We construct Example 6.5 and 6.7 in [LLT1996]_::
1036
+
1037
+ sage: FS = FockSpace(2)
1038
+ sage: F = FS.natural()
1039
+ sage: G = FS.G()
1040
+ sage: A = FS.A()
1041
+ sage: F(A[5])
1042
+ |5> + |3, 2> + 2*q*|3, 1, 1> + q^2*|2, 2, 1> + q^2*|1, 1, 1, 1, 1>
1043
+ sage: F(A[4,1])
1044
+ |4, 1> + q*|2, 1, 1, 1>
1045
+ sage: F(A[3,2])
1046
+ |3, 2> + q*|3, 1, 1> + q^2*|2, 2, 1>
1047
+ sage: F(G[5])
1048
+ |5> + q*|3, 1, 1> + q^2*|1, 1, 1, 1, 1>
1049
+
1050
+ We construct the examples in Section 5.1 of [Fayers2010]_::
1051
+
1052
+ sage: FS = FockSpace(2, [0, 0])
1053
+ sage: F = FS.natural()
1054
+ sage: A = FS.A()
1055
+ sage: F(A[[2,1],[1]])
1056
+ |[2, 1], [1]> + q*|[2], [2]> + q^2*|[2], [1, 1]> + q^2*|[1, 1], [2]>
1057
+ + q^3*|[1, 1], [1, 1]> + q^4*|[1], [2, 1]>
1058
+ sage: F(A[[4],[]])
1059
+ |[4], []> + q*|[3, 1], []> + q*|[2, 1, 1], []>
1060
+ + (q^2+1)*|[2, 1], [1]> + 2*q*|[2], [2]> + 2*q^2*|[2], [1, 1]>
1061
+ + q^2*|[1, 1, 1, 1], []> + 2*q^2*|[1, 1], [2]>
1062
+ + 2*q^3*|[1, 1], [1, 1]> + (q^4+q^2)*|[1], [2, 1]>
1063
+ + q^2*|[], [4]> + q^3*|[], [3, 1]> + q^3*|[], [2, 1, 1]>
1064
+ + q^4*|[], [1, 1, 1, 1]>
1065
+ """
1066
+ def __init__(self, F):
1067
+ r"""
1068
+ Initialize ``self``.
1069
+
1070
+ EXAMPLES::
1071
+
1072
+ sage: A = FockSpace(2).A()
1073
+ sage: TestSuite(A).run()
1074
+ """
1075
+ self._basis_name = "approximation"
1076
+ indices = PartitionTuples(level=len(F._multicharge),
1077
+ regular=F._n)
1078
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
1079
+ prefix='A', bracket=False,
1080
+ sorting_reverse=True,
1081
+ category=FockSpaceBases(F))
1082
+ self.module_morphism(self._A_to_fock_basis,
1083
+ triangular='upper', unitriangular=True,
1084
+ codomain=F.natural()).register_as_coercion()
1085
+
1086
+ options = FockSpaceOptions
1087
+
1088
+ @cached_method
1089
+ def _A_to_fock_basis(self, la):
1090
+ r"""
1091
+ Return the `A` basis indexed by ``la`` in the natural basis.
1092
+
1093
+ EXAMPLES::
1094
+
1095
+ sage: A = FockSpace(3).A()
1096
+ sage: A._A_to_fock_basis(Partition([3]))
1097
+ |3> + q*|2, 1>
1098
+ sage: A._A_to_fock_basis(Partition([2,1]))
1099
+ |2, 1> + q*|1, 1, 1>
1100
+
1101
+ sage: FS = FockSpace(2, [0,1])
1102
+ sage: F = FS.natural()
1103
+ sage: A = FS.A()
1104
+ sage: F(A[[],[1]])
1105
+ |[], [1]>
1106
+ """
1107
+ R = self.realization_of()
1108
+ fock = R.natural()
1109
+
1110
+ if la.size() == 0:
1111
+ return fock.highest_weight_vector()
1112
+
1113
+ if len(R._multicharge) > 1:
1114
+ # Find one more than the first non-empty partition
1115
+ k = 1
1116
+ for p in la:
1117
+ if p.size() != 0:
1118
+ break
1119
+ k += 1
1120
+
1121
+ # Reduce down to the lower level Fock space and do the computation
1122
+ # and then lift back up to us by prepending empty partitions
1123
+ if k == len(R._multicharge): # This means we get the empty partition
1124
+ cur = fock.highest_weight_vector()
1125
+ else:
1126
+ F = FockSpace(R._n, R._multicharge[k:], R._q, R.base_ring())
1127
+ Gp = F.G()
1128
+ if k + 1 == len(R._multicharge):
1129
+ cur = Gp._G_to_fock_basis(Gp._indices(la[k]))
1130
+ cur = fock.sum_of_terms((fock._indices([[]]*k + [p]), c)
1131
+ for p,c in cur)
1132
+ else:
1133
+ cur = Gp._G_to_fock_basis(Gp._indices(la[k:]))
1134
+ cur = fock.sum_of_terms((fock._indices([[]]*k + list(pt)), c)
1135
+ for pt,c in cur)
1136
+ la = la[k-1]
1137
+ r = R._multicharge[k-1]
1138
+ else:
1139
+ cur = fock.highest_weight_vector()
1140
+ r = R._multicharge[0]
1141
+
1142
+ # Get the ladders and apply it to the current element
1143
+ corners = la.corners()
1144
+ cells = set(la.cells())
1145
+ q = R._q
1146
+ k = R._n - 1 # This is sl_{k+1}
1147
+ b = ZZ.zero()
1148
+ # While there is some cell left to count
1149
+ while any(c[1]*k + c[0] >= b for c in corners):
1150
+ power = 0
1151
+ i = -b + r # This will be converted to a mod n number
1152
+ for x in range(b // k + 1):
1153
+ if (b-x*k, x) in cells:
1154
+ power += 1
1155
+ cur = cur.f(i)
1156
+ cur /= q_factorial(power, q)
1157
+ b += 1
1158
+ return cur
1159
+
1160
+ approximation = A
1161
+
1162
+ class G(CombinatorialFreeModule, BindableClass):
1163
+ r"""
1164
+ The lower global crystal basis living inside of Fock space.
1165
+
1166
+ EXAMPLES:
1167
+
1168
+ We construct some of the tables/entries given in Section 10
1169
+ of [LLT1996]_. For `\widehat{\mathfrak{sl}}_2`::
1170
+
1171
+ sage: FS = FockSpace(2)
1172
+ sage: F = FS.natural()
1173
+ sage: G = FS.G()
1174
+ sage: F(G[2])
1175
+ |2> + q*|1, 1>
1176
+ sage: F(G[3])
1177
+ |3> + q*|1, 1, 1>
1178
+ sage: F(G[2,1])
1179
+ |2, 1>
1180
+ sage: F(G[4])
1181
+ |4> + q*|3, 1> + q*|2, 1, 1> + q^2*|1, 1, 1, 1>
1182
+ sage: F(G[3,1])
1183
+ |3, 1> + q*|2, 2> + q^2*|2, 1, 1>
1184
+ sage: F(G[5])
1185
+ |5> + q*|3, 1, 1> + q^2*|1, 1, 1, 1, 1>
1186
+ sage: F(G[4,2])
1187
+ |4, 2> + q*|4, 1, 1> + q*|3, 3> + q^2*|3, 1, 1, 1>
1188
+ + q^2*|2, 2, 2> + q^3*|2, 2, 1, 1>
1189
+ sage: F(G[4,2,1])
1190
+ |4, 2, 1> + q*|3, 3, 1> + q^2*|3, 2, 2> + q^3*|3, 2, 1, 1>
1191
+ sage: F(G[6,2])
1192
+ |6, 2> + q*|6, 1, 1> + q*|5, 3> + q^2*|5, 1, 1, 1> + q*|4, 3, 1>
1193
+ + q^2*|4, 2, 2> + (q^3+q)*|4, 2, 1, 1> + q^2*|4, 1, 1, 1, 1>
1194
+ + q^2*|3, 3, 1, 1> + q^3*|3, 2, 2, 1> + q^3*|3, 1, 1, 1, 1, 1>
1195
+ + q^3*|2, 2, 2, 1, 1> + q^4*|2, 2, 1, 1, 1, 1>
1196
+ sage: F(G[5,3,1])
1197
+ |5, 3, 1> + q*|5, 2, 2> + q^2*|5, 2, 1, 1> + q*|4, 4, 1>
1198
+ + q^2*|4, 2, 1, 1, 1> + q^2*|3, 3, 3> + q^3*|3, 3, 1, 1, 1>
1199
+ + q^3*|3, 2, 2, 2> + q^4*|3, 2, 2, 1, 1>
1200
+ sage: F(G[4,3,2,1])
1201
+ |4, 3, 2, 1>
1202
+ sage: F(G[7,2,1])
1203
+ |7, 2, 1> + q*|5, 2, 1, 1, 1> + q^2*|3, 2, 1, 1, 1, 1, 1>
1204
+ sage: F(G[10,1])
1205
+ |10, 1> + q*|8, 1, 1, 1> + q^2*|6, 1, 1, 1, 1, 1>
1206
+ + q^3*|4, 1, 1, 1, 1, 1, 1, 1>
1207
+ + q^4*|2, 1, 1, 1, 1, 1, 1, 1, 1, 1>
1208
+ sage: F(G[6,3,2])
1209
+ |6, 3, 2> + q*|6, 3, 1, 1> + q^2*|6, 2, 2, 1> + q^3*|5, 3, 2, 1>
1210
+ + q*|4, 3, 2, 1, 1> + q^2*|4, 3, 1, 1, 1, 1>
1211
+ + q^3*|4, 2, 2, 1, 1, 1> + q^4*|3, 3, 2, 1, 1, 1>
1212
+ sage: F(G[5,3,2,1])
1213
+ |5, 3, 2, 1> + q*|4, 4, 2, 1> + q^2*|4, 3, 3, 1>
1214
+ + q^3*|4, 3, 2, 2> + q^4*|4, 3, 2, 1, 1>
1215
+
1216
+ For `\widehat{\mathfrak{sl}}_3`::
1217
+
1218
+ sage: FS = FockSpace(3)
1219
+ sage: F = FS.natural()
1220
+ sage: G = FS.G()
1221
+ sage: F(G[2])
1222
+ |2>
1223
+ sage: F(G[1,1])
1224
+ |1, 1>
1225
+ sage: F(G[3])
1226
+ |3> + q*|2, 1>
1227
+ sage: F(G[2,1])
1228
+ |2, 1> + q*|1, 1, 1>
1229
+ sage: F(G[4])
1230
+ |4> + q*|2, 2>
1231
+ sage: F(G[3,1])
1232
+ |3, 1>
1233
+ sage: F(G[2,2])
1234
+ |2, 2> + q*|1, 1, 1, 1>
1235
+ sage: F(G[2,1,1])
1236
+ |2, 1, 1>
1237
+ sage: F(G[5])
1238
+ |5> + q*|2, 2, 1>
1239
+ sage: F(G[2,2,1])
1240
+ |2, 2, 1> + q*|2, 1, 1, 1>
1241
+ sage: F(G[4,1,1])
1242
+ |4, 1, 1> + q*|3, 2, 1> + q^2*|3, 1, 1, 1>
1243
+ sage: F(G[5,2])
1244
+ |5, 2> + q*|4, 3> + q^2*|4, 2, 1>
1245
+ sage: F(G[8])
1246
+ |8> + q*|5, 2, 1> + q*|3, 3, 1, 1> + q^2*|2, 2, 2, 2>
1247
+ sage: F(G[7,2])
1248
+ |7, 2> + q*|4, 2, 2, 1>
1249
+ sage: F(G[6,2,2])
1250
+ |6, 2, 2> + q*|6, 1, 1, 1, 1> + q*|4, 4, 2> + q^2*|3, 3, 2, 1, 1>
1251
+
1252
+ For `\widehat{\mathfrak{sl}}_4`::
1253
+
1254
+ sage: FS = FockSpace(4)
1255
+ sage: F = FS.natural()
1256
+ sage: G = FS.G()
1257
+ sage: F(G[4])
1258
+ |4> + q*|3, 1>
1259
+ sage: F(G[3,1])
1260
+ |3, 1> + q*|2, 1, 1>
1261
+ sage: F(G[2,2])
1262
+ |2, 2>
1263
+ sage: F(G[2,1,1])
1264
+ |2, 1, 1> + q*|1, 1, 1, 1>
1265
+ sage: F(G[3,2])
1266
+ |3, 2> + q*|2, 2, 1>
1267
+ sage: F(G[2,2,2])
1268
+ |2, 2, 2> + q*|1, 1, 1, 1, 1, 1>
1269
+ sage: F(G[6,1])
1270
+ |6, 1> + q*|4, 3>
1271
+ sage: F(G[3,2,2,1])
1272
+ |3, 2, 2, 1> + q*|3, 1, 1, 1, 1, 1> + q*|2, 2, 2, 2>
1273
+ + q^2*|2, 1, 1, 1, 1, 1, 1>
1274
+ sage: F(G[7,2])
1275
+ |7, 2> + q*|6, 2, 1> + q*|5, 4> + q^2*|5, 3, 1>
1276
+ sage: F(G[5,2,2,1])
1277
+ |5, 2, 2, 1> + q*|5, 1, 1, 1, 1, 1> + q*|4, 2, 2, 1, 1>
1278
+ + q^2*|4, 2, 1, 1, 1, 1>
1279
+
1280
+ We construct the examples in Section 5.1 of [Fayers2010]_::
1281
+
1282
+ sage: FS = FockSpace(2, [0, 0])
1283
+ sage: F = FS.natural()
1284
+ sage: G = FS.G()
1285
+ sage: F(G[[2,1],[1]])
1286
+ |[2, 1], [1]> + q*|[2], [2]> + q^2*|[2], [1, 1]>
1287
+ + q^2*|[1, 1], [2]> + q^3*|[1, 1], [1, 1]> + q^4*|[1], [2, 1]>
1288
+ sage: F(G[[4],[]])
1289
+ |[4], []> + q*|[3, 1], []> + q*|[2, 1, 1], []> + q^2*|[2, 1], [1]>
1290
+ + q*|[2], [2]> + q^2*|[2], [1, 1]> + q^2*|[1, 1, 1, 1], []>
1291
+ + q^2*|[1, 1], [2]> + q^3*|[1, 1], [1, 1]> + q^2*|[1], [2, 1]>
1292
+ + q^2*|[], [4]> + q^3*|[], [3, 1]> + q^3*|[], [2, 1, 1]>
1293
+ + q^4*|[], [1, 1, 1, 1]>
1294
+ """
1295
+ def __init__(self, F):
1296
+ r"""
1297
+ Initialize ``self``.
1298
+
1299
+ EXAMPLES::
1300
+
1301
+ sage: G = FockSpace(2).G()
1302
+ sage: TestSuite(G).run()
1303
+ """
1304
+ self._basis_name = "lower global crystal"
1305
+ indices = PartitionTuples(level=len(F._multicharge),
1306
+ regular=F._n)
1307
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
1308
+ prefix='G', bracket=False,
1309
+ sorting_reverse=True,
1310
+ category=FockSpaceBases(F))
1311
+ self.module_morphism(self._G_to_fock_basis,
1312
+ triangular='upper', unitriangular=True,
1313
+ codomain=F.natural()).register_as_coercion()
1314
+
1315
+ options = FockSpaceOptions
1316
+
1317
+ @cached_method
1318
+ def _G_to_fock_basis(self, la):
1319
+ r"""
1320
+ Return the `G` basis indexed by ``la`` in the natural basis.
1321
+
1322
+ EXAMPLES::
1323
+
1324
+ sage: G = FockSpace(3).G()
1325
+ sage: G._G_to_fock_basis(Partition([3]))
1326
+ |3> + q*|2, 1>
1327
+ sage: G._G_to_fock_basis(Partition([2,1]))
1328
+ |2, 1> + q*|1, 1, 1>
1329
+ """
1330
+ # Special case for the empty partition
1331
+ if la.size() == 0:
1332
+ return self.realization_of().natural().highest_weight_vector()
1333
+
1334
+ # Special case for empty leading partitions
1335
+ R = self.realization_of()
1336
+ if len(R._multicharge) > 1 and la[0].size() == 0:
1337
+ fock = R.natural()
1338
+ # Find the first non-empty partition
1339
+ k = 0
1340
+ for p in la:
1341
+ if p.size() != 0:
1342
+ break
1343
+ k += 1
1344
+
1345
+ # Reduce down to the lower level Fock space and do the computation
1346
+ # and then lift back up by prepending empty partitions
1347
+ # Note that this will never be for the empty partition, which
1348
+ # is already taken care of
1349
+ F = FockSpace(R._n, R._multicharge[k:], R._q, R.base_ring())
1350
+ Gp = F.G()
1351
+ if k + 1 == len(R._multicharge):
1352
+ cur = Gp._G_to_fock_basis(Gp._indices(la[k]))
1353
+ return fock.sum_of_terms((fock._indices([[]]*k + [p]), c) for p,c in cur)
1354
+ cur = Gp._G_to_fock_basis(Gp._indices(la[k:]))
1355
+ return fock.sum_of_terms((fock._indices([[]]*k + list(pt)), c) for pt,c in cur)
1356
+
1357
+ cur = R.A()._A_to_fock_basis(la)
1358
+ s = sorted(cur.support()) # Sort lex, which respects dominance order
1359
+ s.pop() # Remove the largest
1360
+
1361
+ q = R._q
1362
+ while s:
1363
+ mu = s.pop()
1364
+ d = cur[mu].denominator()
1365
+ k = d.degree()
1366
+ n = cur[mu].numerator()
1367
+ if k != 0 or n.constant_coefficient() != 0:
1368
+ gamma = sum(n[i] * (q**(i-k) + q**(k-i))
1369
+ for i in range(min(n.degree(), k)))
1370
+ gamma += n[k]
1371
+ cur -= gamma * self._G_to_fock_basis(mu)
1372
+
1373
+ # Add any new support elements
1374
+ for x in cur.support():
1375
+ if x == mu or not mu.dominates(x): # Add only things (strictly) dominated by mu
1376
+ continue
1377
+ for i in reversed(range(len(s))):
1378
+ if not s[i].dominates(x):
1379
+ s.insert(i+1, x)
1380
+ break
1381
+ return cur
1382
+
1383
+ lower_global_crystal = G
1384
+ canonical = G
1385
+
1386
+
1387
+ ###############################################################################
1388
+ # Bases Category
1389
+
1390
+ class FockSpaceBases(Category_realization_of_parent):
1391
+ r"""
1392
+ The category of bases of a (truncated) Fock space.
1393
+ """
1394
+ def __init__(self, base):
1395
+ r"""
1396
+ Initialize the bases of a Fock space.
1397
+
1398
+ INPUT:
1399
+
1400
+ - ``base`` -- a Fock space
1401
+
1402
+ TESTS::
1403
+
1404
+ sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases
1405
+ sage: F = FockSpace(2)
1406
+ sage: bases = FockSpaceBases(F)
1407
+ sage: TestSuite(bases).run()
1408
+ """
1409
+ Category_realization_of_parent.__init__(self, base)
1410
+
1411
+ def _repr_(self):
1412
+ r"""
1413
+ Return the representation of ``self``.
1414
+
1415
+ EXAMPLES::
1416
+
1417
+ sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases
1418
+ sage: F = FockSpace(2)
1419
+ sage: FockSpaceBases(F)
1420
+ Category of bases of Fock space of rank 2 of multicharge (0,) over
1421
+ Fraction Field of Univariate Polynomial Ring in q over Integer Ring
1422
+ """
1423
+ return "Category of bases of {}".format(self.base())
1424
+
1425
+ def super_categories(self):
1426
+ r"""
1427
+ The super categories of ``self``.
1428
+
1429
+ EXAMPLES::
1430
+
1431
+ sage: from sage.algebras.quantum_groups.fock_space import FockSpaceBases
1432
+ sage: F = FockSpace(2)
1433
+ sage: bases = FockSpaceBases(F)
1434
+ sage: bases.super_categories()
1435
+ [Category of vector spaces with basis over Fraction Field
1436
+ of Univariate Polynomial Ring in q over Integer Ring,
1437
+ Category of realizations of Fock space of rank 2 of multicharge (0,)
1438
+ over Fraction Field of Univariate Polynomial Ring in q over Integer Ring]
1439
+ """
1440
+ return [ModulesWithBasis(self.base().base_ring()), Realizations(self.base())]
1441
+
1442
+ class ParentMethods:
1443
+ def _repr_(self):
1444
+ r"""
1445
+ Text representation of this basis of Fock space.
1446
+
1447
+ EXAMPLES::
1448
+
1449
+ sage: FS = FockSpace(2)
1450
+ sage: FS.A()
1451
+ Fock space of rank 2 of multicharge (0,) over Fraction Field of
1452
+ Univariate Polynomial Ring in q over Integer Ring
1453
+ in the approximation basis
1454
+ sage: FS.G()
1455
+ Fock space of rank 2 of multicharge (0,) over Fraction Field of
1456
+ Univariate Polynomial Ring in q over Integer Ring
1457
+ in the lower global crystal basis
1458
+ """
1459
+ return "{} in the {} basis".format(self.realization_of(), self._basis_name)
1460
+
1461
+ def some_elements(self):
1462
+ r"""
1463
+ Return some elements of ``self``.
1464
+
1465
+ EXAMPLES::
1466
+
1467
+ sage: F = FockSpace(3).natural()
1468
+ sage: F.some_elements()[::13]
1469
+ [3*|2> + 2*|1> + 2*|>,
1470
+ |5>,
1471
+ |3, 1, 1, 1>,
1472
+ |3, 2, 2>,
1473
+ |5, 1, 1, 1>,
1474
+ |2, 2, 1, 1, 1, 1>,
1475
+ |5, 2, 1, 1>,
1476
+ |3, 2, 1, 1, 1, 1>]
1477
+
1478
+ sage: F = FockSpace(3, [0,1]).natural()
1479
+ sage: F.some_elements()[::13] # needs sage.libs.flint
1480
+ [2*|[1], []> + 4*|[], [1]> + |[], []>,
1481
+ |[1, 1], [1]>,
1482
+ |[1, 1, 1], [1]>,
1483
+ |[5], []>,
1484
+ |[3], [1, 1]>,
1485
+ |[1], [2, 2]>,
1486
+ |[4, 1, 1], []>,
1487
+ |[2, 1, 1, 1], [1]>]
1488
+ """
1489
+ others = [self.monomial(la) for la in self.basis().keys().some_elements()]
1490
+ return [self.an_element()] + others
1491
+
1492
+ def q(self):
1493
+ r"""
1494
+ Return the parameter `q` of ``self``.
1495
+
1496
+ EXAMPLES::
1497
+
1498
+ sage: FS = FockSpace(2)
1499
+ sage: A = FS.A()
1500
+ sage: A.q()
1501
+ q
1502
+
1503
+ sage: FS = FockSpace(2, q=-1)
1504
+ sage: G = FS.G()
1505
+ sage: G.q()
1506
+ -1
1507
+ """
1508
+ return self.realization_of()._q
1509
+
1510
+ def multicharge(self):
1511
+ r"""
1512
+ Return the multicharge of ``self``.
1513
+
1514
+ EXAMPLES::
1515
+
1516
+ sage: FS = FockSpace(4)
1517
+ sage: A = FS.A()
1518
+ sage: A.multicharge()
1519
+ (0,)
1520
+
1521
+ sage: FS = FockSpace(4, [1,0,2])
1522
+ sage: G = FS.G()
1523
+ sage: G.multicharge()
1524
+ (1, 0, 2)
1525
+ """
1526
+ return self.realization_of()._multicharge
1527
+
1528
+ @cached_method
1529
+ def highest_weight_vector(self):
1530
+ r"""
1531
+ Return the highest weight vector of ``self``.
1532
+
1533
+ EXAMPLES::
1534
+
1535
+ sage: FS = FockSpace(2)
1536
+ sage: F = FS.natural()
1537
+ sage: F.highest_weight_vector()
1538
+ |>
1539
+ sage: A = FS.A()
1540
+ sage: A.highest_weight_vector()
1541
+ A[]
1542
+ sage: G = FS.G()
1543
+ sage: G.highest_weight_vector()
1544
+ G[]
1545
+ """
1546
+ level = len(self.realization_of()._multicharge)
1547
+ if level == 1:
1548
+ return self.monomial(self._indices([]))
1549
+ return self.monomial(self._indices([[]]*level))
1550
+
1551
+ def __getitem__(self, i):
1552
+ r"""
1553
+ Return the basis element indexed by ``i``.
1554
+
1555
+ INPUT:
1556
+
1557
+ - ``i`` -- a partition
1558
+
1559
+ EXAMPLES::
1560
+
1561
+ sage: F = FockSpace(3)
1562
+ sage: A = F.A()
1563
+ sage: A[[]]
1564
+ A[]
1565
+ sage: A[4]
1566
+ A[4]
1567
+ sage: A[2,2,1]
1568
+ A[2, 2, 1]
1569
+ sage: G = F.G()
1570
+ sage: G[[]]
1571
+ G[]
1572
+ sage: G[4]
1573
+ G[4]
1574
+ sage: G[2,2,1]
1575
+ G[2, 2, 1]
1576
+
1577
+ For higher levels::
1578
+
1579
+ sage: F = FockSpace(2, [0, 0])
1580
+ sage: G = F.G()
1581
+ sage: G[[2,1],[1]]
1582
+ G([2, 1], [1])
1583
+
1584
+ TESTS::
1585
+
1586
+ sage: F = FockSpace(3)
1587
+ sage: A = F.A()
1588
+ sage: A[2,2,2,1]
1589
+ Traceback (most recent call last):
1590
+ ...
1591
+ ValueError: [2, 2, 2, 1] is not an element of 3-Regular Partitions
1592
+
1593
+ sage: F = FockSpace(3, [0, 0])
1594
+ sage: A = F.A()
1595
+ sage: A[[], [2,2,2,1]]
1596
+ Traceback (most recent call last):
1597
+ ...
1598
+ ValueError: [[], [2, 2, 2, 1]] is not a 3-Regular partition tuples of level 2
1599
+ """
1600
+ if i in ZZ:
1601
+ i = [i]
1602
+
1603
+ i = self._indices(i)
1604
+ if i.size() == 0:
1605
+ return self.highest_weight_vector()
1606
+ return self.monomial(i)
1607
+
1608
+ ###############################################################################
1609
+ # Truncated Fock space
1610
+
1611
+
1612
+ class FockSpaceTruncated(FockSpace):
1613
+ r"""
1614
+ This is the Fock space given by partitions of length no more than `k`.
1615
+
1616
+ This can be formed as the quotient `\mathcal{F} / \mathcal{F}_k`,
1617
+ where `\mathcal{F}_k` is the submodule spanned by all diagrams
1618
+ of length (strictly) more than `k`.
1619
+
1620
+ We have three bases:
1621
+
1622
+ - The natural basis indexed by truncated `n`-regular partitions:
1623
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.F`.
1624
+ - The approximation basis that comes from LLT(-type) algorithms:
1625
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.A`.
1626
+ - The lower global crystal basis:
1627
+ :class:`~sage.algebras.quantum_groups.fock_space.FockSpaceTruncated.G`.
1628
+
1629
+ .. SEEALSO::
1630
+
1631
+ :class:`FockSpace`
1632
+
1633
+ EXAMPLES::
1634
+
1635
+ sage: F = FockSpace(2, truncated=2)
1636
+ sage: mg = F.highest_weight_vector()
1637
+ sage: mg.f(0)
1638
+ |1>
1639
+ sage: mg.f(0).f(1)
1640
+ |2> + q*|1, 1>
1641
+ sage: mg.f(0).f(1).f(0)
1642
+ |3>
1643
+
1644
+ Compare this to the full Fock space::
1645
+
1646
+ sage: F = FockSpace(2)
1647
+ sage: mg = F.highest_weight_vector()
1648
+ sage: mg.f(0).f(1).f(0)
1649
+ |3> + q*|1, 1, 1>
1650
+
1651
+ REFERENCES:
1652
+
1653
+ - [GW1999]_
1654
+ """
1655
+ @staticmethod
1656
+ def __classcall_private__(cls, n, k, q=None, base_ring=None):
1657
+ r"""
1658
+ Standardize input to ensure a unique representation.
1659
+
1660
+ EXAMPLES::
1661
+
1662
+ sage: R.<q> = ZZ[]
1663
+ sage: F1 = FockSpace(3, truncated=2)
1664
+ sage: F2 = FockSpace(3, q=q, truncated=2)
1665
+ sage: F3 = FockSpace(3, q=q, base_ring=R, truncated=2)
1666
+ sage: F1 is F2 and F2 is F3
1667
+ True
1668
+ sage: from sage.algebras.quantum_groups.fock_space import FockSpaceTruncated
1669
+ sage: F4 = FockSpaceTruncated(3, 2, q, R)
1670
+ sage: F1 is F4
1671
+ True
1672
+ """
1673
+ if q is None:
1674
+ base_ring = PolynomialRing(ZZ, 'q')
1675
+ q = base_ring.gen(0)
1676
+ if base_ring is None:
1677
+ base_ring = q.parent()
1678
+ base_ring = FractionField(base_ring)
1679
+ q = base_ring(q)
1680
+ return super().__classcall__(cls, n, k, q, base_ring)
1681
+
1682
+ def __init__(self, n, k, q, base_ring):
1683
+ r"""
1684
+ Initialize ``self``.
1685
+
1686
+ EXAMPLES::
1687
+
1688
+ sage: F = FockSpace(2, truncated=3)
1689
+ sage: TestSuite(F).run()
1690
+ """
1691
+ M = IntegerModRing(n)
1692
+ self._k = k
1693
+ FockSpace.__init__(self, n, (M(0),), q, base_ring)
1694
+
1695
+ def _repr_(self):
1696
+ r"""
1697
+ Return a string representation of ``self``.
1698
+
1699
+ EXAMPLES::
1700
+
1701
+ sage: FockSpace(2, truncated=3)
1702
+ Fock space of rank 2 truncated at 3 over Fraction Field of
1703
+ Univariate Polynomial Ring in q over Integer Ring
1704
+ """
1705
+ return "Fock space of rank {} truncated at {} over {}".format(self._n, self._k, self.base_ring())
1706
+
1707
+ class F(CombinatorialFreeModule, BindableClass):
1708
+ r"""
1709
+ The natural basis of the truncated Fock space.
1710
+
1711
+ This is the natural basis of the full Fock space projected
1712
+ onto the truncated Fock space. It inherits the
1713
+ `U_q(\widehat{\widetilde{sl}}_n)`-action from the action
1714
+ on the full Fock space.
1715
+
1716
+ EXAMPLES::
1717
+
1718
+ sage: FS = FockSpace(4)
1719
+ sage: F = FS.natural()
1720
+ sage: FS3 = FockSpace(4, truncated=3)
1721
+ sage: F3 = FS3.natural()
1722
+ sage: u = F.highest_weight_vector()
1723
+ sage: u3 = F3.highest_weight_vector()
1724
+
1725
+ sage: u3.f(0,3,2,1)
1726
+ |2, 1, 1>
1727
+ sage: u.f(0,3,2,1)
1728
+ |2, 1, 1> + q*|1, 1, 1, 1>
1729
+
1730
+ sage: u.f(0,3,2,1,1)
1731
+ ((q^2+1)/q)*|2, 1, 1, 1>
1732
+ sage: u3.f(0,3,2,1,1)
1733
+ 0
1734
+ """
1735
+ def __init__(self, F):
1736
+ r"""
1737
+ Initialize ``self``.
1738
+
1739
+ EXAMPLES::
1740
+
1741
+ sage: F = FockSpace(2, truncated=3).natural()
1742
+ sage: TestSuite(F).run() # long time
1743
+ """
1744
+ self._basis_name = "natural"
1745
+ # If the cell x is above the cell y
1746
+ if len(F._multicharge) == 1: # For partitions
1747
+ self._above = lambda x,y: x[0] < y[0]
1748
+ else: # For partition tuples
1749
+ self._above = lambda x,y: x[0] < y[0] or (x[0] == y[0] and x[1] < y[1])
1750
+ self._addable = lambda la,i: [x for x in la.outside_corners()
1751
+ if la.content(*x, multicharge=F._multicharge) == i]
1752
+ self._removable = lambda la,i: [x for x in la.corners()
1753
+ if la.content(*x, multicharge=F._multicharge) == i]
1754
+
1755
+ indices = Partitions(max_length=F._k)
1756
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
1757
+ prefix='', bracket=['|', '>'],
1758
+ latex_bracket=['\\lvert', '\\rangle'],
1759
+ sorting_reverse=True,
1760
+ category=FockSpaceBases(F))
1761
+
1762
+ options = FockSpaceOptions
1763
+
1764
+ def _repr_term(self, m):
1765
+ r"""
1766
+ Return a representation of the monomial indexed by ``m``.
1767
+
1768
+ EXAMPLES::
1769
+
1770
+ sage: F = FockSpace(2, truncated=3).natural()
1771
+ sage: F._repr_term(Partition([2,1,1]))
1772
+ '|2, 1, 1>'
1773
+ sage: F.highest_weight_vector()
1774
+ |>
1775
+ """
1776
+ return '|' + repr(m)[1:-1] + ">" # Strip the outer brackets of m
1777
+
1778
+ class Element(FockSpace.natural.Element):
1779
+ r"""
1780
+ An element in the truncated Fock space.
1781
+ """
1782
+ def _f(self, i):
1783
+ r"""
1784
+ Apply the action of `f_i` on ``self``.
1785
+
1786
+ EXAMPLES::
1787
+
1788
+ sage: F = FockSpace(2, truncated=3).natural()
1789
+ sage: mg = F.highest_weight_vector()
1790
+ sage: mg.f(0)
1791
+ |1>
1792
+ sage: mg.f(0,1)
1793
+ |2> + q*|1, 1>
1794
+ sage: mg.f(0,1,0)
1795
+ |3> + q*|1, 1, 1>
1796
+ sage: mg.f(0,1,0,0)
1797
+ 0
1798
+ sage: mg.f(0,1,0,1)
1799
+ |4> + q*|3, 1> + q*|2, 1, 1>
1800
+ sage: mg.f(0,1,0,1,0)
1801
+ |5> + |3, 2> + 2*q*|3, 1, 1> + q^2*|2, 2, 1>
1802
+ """
1803
+ P = self.parent()
1804
+
1805
+ def N_right(la, x, i):
1806
+ return (sum(1 for y in P._addable(la, i) if P._above(y, x))
1807
+ - sum(1 for y in P._removable(la, i) if P._above(y, x)))
1808
+ q = P.realization_of()._q
1809
+ k = P.realization_of()._k
1810
+ return P.sum_of_terms([(la.add_cell(*x), c * q**N_right(la, x, i))
1811
+ for la,c in self for x in P._addable(la, i)
1812
+ if x[0] < k])
1813
+
1814
+ natural = F
1815
+
1816
+ class A(CombinatorialFreeModule, BindableClass):
1817
+ r"""
1818
+ The `A` basis of the Fock space, which is the approximation
1819
+ basis of the lower global crystal basis.
1820
+
1821
+ INPUT:
1822
+
1823
+ - ``algorithm`` -- (default: ``'GW'``) the algorithm to use when
1824
+ computing this basis in the Fock space; the possible values are:
1825
+
1826
+ * ``'GW'`` -- use the algorithm given by Goodman and Wenzl
1827
+ in [GW1999]_
1828
+ * ``'LLT'`` -- use the LLT algorithm given in [LLT1996]_
1829
+
1830
+ .. NOTE::
1831
+
1832
+ The bases produced by the two algorithms are not the same
1833
+ in general.
1834
+
1835
+ EXAMPLES::
1836
+
1837
+ sage: FS = FockSpace(5, truncated=4)
1838
+ sage: F = FS.natural()
1839
+ sage: A = FS.A()
1840
+
1841
+ We demonstrate that they are different bases, but both algorithms
1842
+ still compute the basis `G`::
1843
+
1844
+ sage: A2 = FS.A('LLT')
1845
+ sage: G = FS.G()
1846
+ sage: F(A[12,9])
1847
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+1)*|8, 8, 4, 1>
1848
+ sage: F(A2[12,9])
1849
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+2)*|8, 8, 4, 1>
1850
+ sage: G._G_to_fock_basis(Partition([12,9]), 'GW')
1851
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + q^2*|8, 8, 4, 1>
1852
+ sage: G._G_to_fock_basis(Partition([12,9]), 'LLT')
1853
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + q^2*|8, 8, 4, 1>
1854
+ """
1855
+ def __init__(self, F, algorithm='GW'):
1856
+ r"""
1857
+ Initialize ``self``.
1858
+
1859
+ EXAMPLES::
1860
+
1861
+ sage: FS = FockSpace(2, truncated=3)
1862
+ sage: A = FS.A()
1863
+ sage: TestSuite(A).run()
1864
+ sage: A2 = FS.A('LLT')
1865
+ sage: TestSuite(A2).run()
1866
+ """
1867
+ self._basis_name = "approximation"
1868
+ if algorithm not in ['GW', 'LLT']:
1869
+ raise ValueError("invalid algorithm")
1870
+ self._alg = algorithm
1871
+ indices = RegularPartitions_truncated(F._n, F._k)
1872
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
1873
+ prefix='A', bracket=False,
1874
+ sorting_reverse=True,
1875
+ category=FockSpaceBases(F))
1876
+ self.module_morphism(self._A_to_fock_basis,
1877
+ triangular='upper', unitriangular=True,
1878
+ codomain=F.natural()).register_as_coercion()
1879
+
1880
+ options = FockSpaceOptions
1881
+
1882
+ @cached_method
1883
+ def _LLT(self, la):
1884
+ r"""
1885
+ Return the result from the regular LLT algorithm on the partition
1886
+ ``la`` to compute the `A`-basis element in the corresponding
1887
+ Fock space.
1888
+
1889
+ EXAMPLES::
1890
+
1891
+ sage: FS = FockSpace(5, truncated=4)
1892
+ sage: F = FS.natural()
1893
+ sage: A = FS.A()
1894
+ sage: F(A[12,9])
1895
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+1)*|8, 8, 4, 1>
1896
+ sage: A._LLT(Partition([12,9]))
1897
+ |12, 9> + q*|12, 4, 4, 1> + q*|8, 8, 5> + (q^2+2)*|8, 8, 4, 1>
1898
+ """
1899
+ R = self.realization_of()
1900
+ fock = R.natural()
1901
+ k = R._k
1902
+
1903
+ cur = fock.highest_weight_vector()
1904
+ # Get the ladders and apply it to the current element
1905
+ corners = la.corners()
1906
+ cells = set(la.cells())
1907
+ q = R._q
1908
+ k = R._n - 1 # This is sl_{k+1}
1909
+ r = R._multicharge[0]
1910
+ b = ZZ.zero()
1911
+ while any(c[1]*k + c[0] >= b for c in corners): # While there is some cell left to count
1912
+ power = 0
1913
+ i = -b + r # This will be converted to a mod n number
1914
+ for x in range(b // k + 1):
1915
+ if (b-x*k, x) in cells:
1916
+ power += 1
1917
+ cur = cur.f(i)
1918
+ cur /= q_factorial(power, q)
1919
+ b += 1
1920
+ return cur
1921
+
1922
+ def _skew_tableau(self, cur, nu, d):
1923
+ r"""
1924
+ Return the action of the skew tableaux formed from ``nu`` by
1925
+ applying the ``d`` fundamental weights.
1926
+
1927
+ EXAMPLES::
1928
+
1929
+ sage: FS = FockSpace(3, truncated=3)
1930
+ sage: F = FS.natural()
1931
+ sage: A = FS.A()
1932
+ sage: G = FS.G()
1933
+ sage: sk = A._skew_tableau(F(G[6,3]), Partition([6,3]), [1,1]); sk
1934
+ |8, 4> + q*|8, 2, 2> + q*|7, 4, 1> + q^2*|7, 3, 2> + q*|6, 6>
1935
+ + q^2*|6, 5, 1> + q^2*|5, 4, 3> + q^3*|4, 4, 4>
1936
+ sage: sk == F(A[8,4])
1937
+ True
1938
+ """
1939
+ R = self.realization_of()
1940
+ last = None
1941
+ power = 0
1942
+ q = R._q
1943
+ for i in reversed(range(len(d))):
1944
+ for dummy in range(d[i]):
1945
+ for j in range(i+1):
1946
+ col = nu[j] if j < len(nu) else 0
1947
+ res = nu.content(j, col, multicharge=R._multicharge)
1948
+ if res != last:
1949
+ cur /= q_factorial(power, q)
1950
+ power = 1
1951
+ last = res
1952
+ else:
1953
+ power += 1
1954
+ cur = cur.f(res)
1955
+ nu = nu.add_cell(j, col)
1956
+ return cur / q_factorial(power, q)
1957
+
1958
+ @cached_method
1959
+ def _A_to_fock_basis(self, la):
1960
+ r"""
1961
+ Return the `A` basis indexed by ``la`` in the natural basis.
1962
+
1963
+ EXAMPLES::
1964
+
1965
+ sage: FS = FockSpace(2, truncated=3)
1966
+ sage: F = FS.natural()
1967
+ sage: A = FS.A()
1968
+ sage: A._A_to_fock_basis(Partition([2,1]))
1969
+ |2, 1>
1970
+ sage: F(A[3,1])
1971
+ |3, 1> + q*|2, 2> + q^2*|2, 1, 1>
1972
+ sage: A._A_to_fock_basis(Partition([3]))
1973
+ |3> + q*|1, 1, 1>
1974
+
1975
+ sage: FS = FockSpace(2, truncated=5)
1976
+ sage: F = FS.natural()
1977
+ sage: A = FS.A()
1978
+ sage: F(A[7,4,3])
1979
+ |7, 4, 3> + q*|7, 4, 1, 1, 1> + q^2*|7, 2, 2, 2, 1> + |5, 4, 3, 2>
1980
+ + 2*q*|5, 4, 3, 1, 1> + 2*q^2*|5, 4, 2, 2, 1>
1981
+ + 2*q^3*|5, 3, 3, 2, 1> + q^4*|4, 4, 3, 2, 1>
1982
+ sage: F(A[7,4,3,2])
1983
+ |7, 4, 3, 2> + q*|7, 4, 3, 1, 1> + q^2*|7, 4, 2, 2, 1>
1984
+ + q^3*|7, 3, 3, 2, 1> + q^4*|6, 4, 3, 2, 1>
1985
+ """
1986
+ if self._alg == 'LLT':
1987
+ return self._LLT(la)
1988
+
1989
+ # Otherwise we use the GW algorithm
1990
+ fock = self.realization_of().natural()
1991
+ k = self.realization_of()._k
1992
+
1993
+ # We do some special cases first
1994
+ # For the empty partition
1995
+ if la.size() == 0:
1996
+ return fock.highest_weight_vector()
1997
+
1998
+ # For length k partitions
1999
+ if len(la) == k:
2000
+ G = self.realization_of().G()
2001
+ return G._G_to_fock_basis(la)
2002
+
2003
+ # For critical partitions
2004
+ n = self.realization_of()._n
2005
+ if len(la) == k-1 and all((la[i] - la[i+1] + 1) % n == 0 for i in range(k-2)) \
2006
+ and (la[-1] + 1) % n == 0:
2007
+ return fock.monomial(la)
2008
+
2009
+ # For interior partitions
2010
+ shifted = [la[i] - (n - 1)*(k - 1 - i) for i in range(len(la))]
2011
+ if len(la) == k - 1 and shifted in _Partitions:
2012
+ # Construct the d's and the critical partition
2013
+ d = [(la[i] - la[i+1] + 1) % n for i in range(len(la)-1)]
2014
+ d.append((la[-1] + 1) % n)
2015
+ crit = list(la)
2016
+ for i,d_i in enumerate(d):
2017
+ for j in range(i+1):
2018
+ crit[j] -= d_i
2019
+ nu = fock._indices(crit)
2020
+ return self._skew_tableau(fock.monomial(nu), nu, d)
2021
+
2022
+ # For non-interior partitions
2023
+ # Construct the d's and the partition ``a``
2024
+ a = list(la) + [0]*(k - 1 - len(la)) # Add 0s to get the correct length
2025
+ a = [a[i] + (k - 1 - i) for i in range(k-1)] # Shift the diagram
2026
+ #shifted = list(a) # Make a copy of the shifted partition in case we need it later
2027
+ d = [(a[i] - a[i+1]) % n for i in range(k-2)]
2028
+ d.append(a[-1] % n)
2029
+ for i,d_i in enumerate(d):
2030
+ for j in range(i+1):
2031
+ a[j] -= d_i
2032
+ if sum(a) == 0: # a is contained in the fundamental box
2033
+ return self._LLT(la)
2034
+
2035
+ p = list(a) # Make a copy that we can change
2036
+ for i in range(k-2):
2037
+ if a[i] - a[i+1] == 0:
2038
+ d[i] -= 1
2039
+ for j in range(i+1):
2040
+ p[j] += 1
2041
+ if a[-1] == 0:
2042
+ d[-1] -= 1
2043
+ for j in range(k-1):
2044
+ p[j] += 1
2045
+ p = [p[i] - (k - 1 - i) for i in range(k-1)]
2046
+ I = self._indices
2047
+ nu = I(p)
2048
+
2049
+ while not max(nu.to_exp()) < n:
2050
+ # It is not regular, so we need to find the first regular
2051
+ # partition after adding columns
2052
+ while d[-1] == 0:
2053
+ d.pop()
2054
+ for j in range(d[-1]):
2055
+ p[j] += 1
2056
+ nu = I(p)
2057
+
2058
+ if la == nu:
2059
+ j = -1
2060
+ for i in range(k-2):
2061
+ if p[i] - p[i+1] == 0:
2062
+ j = -2
2063
+ break
2064
+ if p[i] > n and p[i] - p[i+1] > n:
2065
+ j = i
2066
+ if j != -2 and p[-1] > n:
2067
+ j = k - 1
2068
+ if j < 0:
2069
+ return self._LLT(la)
2070
+
2071
+ G = self.realization_of().G()
2072
+ nu = I([p[i] - n if i <= j else p[i] for i in range(k-1)])
2073
+ d = [0]*j + [n]
2074
+ return self._skew_tableau(G._G_to_fock_basis(nu), nu, d)
2075
+
2076
+ G = self.realization_of().G()
2077
+ return self._skew_tableau(G._G_to_fock_basis(nu), nu, d)
2078
+
2079
+ approximation = A
2080
+
2081
+ class G(CombinatorialFreeModule, BindableClass):
2082
+ r"""
2083
+ The lower global crystal basis living inside of a
2084
+ truncated Fock space.
2085
+
2086
+ EXAMPLES::
2087
+
2088
+ sage: FS = FockSpace(4, truncated=2)
2089
+ sage: F = FS.natural()
2090
+ sage: G = FS.G()
2091
+ sage: F(G[3,1])
2092
+ |3, 1>
2093
+ sage: F(G[6,2])
2094
+ |6, 2> + q*|5, 3>
2095
+ sage: F(G[14])
2096
+ |14> + q*|11, 3>
2097
+
2098
+ sage: FS = FockSpace(3, truncated=4)
2099
+ sage: F = FS.natural()
2100
+ sage: G = FS.G()
2101
+ sage: F(G[4,1])
2102
+ |4, 1> + q*|3, 2>
2103
+ sage: F(G[4,2,2])
2104
+ |4, 2, 2> + q*|3, 2, 2, 1>
2105
+
2106
+ We check against the tables in [LLT1996]_ (after truncating)::
2107
+
2108
+ sage: FS = FockSpace(3, truncated=3)
2109
+ sage: F = FS.natural()
2110
+ sage: G = FS.G()
2111
+ sage: F(G[10])
2112
+ |10> + q*|8, 2> + q*|7, 2, 1>
2113
+ sage: F(G[6,4])
2114
+ |6, 4> + q*|6, 2, 2> + q^2*|4, 4, 2>
2115
+ sage: F(G[5,5])
2116
+ |5, 5> + q*|4, 3, 3>
2117
+
2118
+ sage: FS = FockSpace(4, truncated=3)
2119
+ sage: F = FS.natural()
2120
+ sage: G = FS.G()
2121
+ sage: F(G[3,3,1])
2122
+ |3, 3, 1>
2123
+ sage: F(G[3,2,2])
2124
+ |3, 2, 2>
2125
+ sage: F(G[7])
2126
+ |7> + q*|3, 3, 1>
2127
+ """
2128
+ def __init__(self, F):
2129
+ r"""
2130
+ Initialize ``self``.
2131
+
2132
+ EXAMPLES::
2133
+
2134
+ sage: G = FockSpace(2, truncated=3).G()
2135
+ sage: TestSuite(G).run()
2136
+ sage: G = FockSpace(4, truncated=3).G()
2137
+ sage: TestSuite(G).run()
2138
+ """
2139
+ self._basis_name = "lower global crystal"
2140
+ indices = RegularPartitions_truncated(F._n, F._k)
2141
+ CombinatorialFreeModule.__init__(self, F.base_ring(), indices,
2142
+ prefix='G', bracket=False,
2143
+ sorting_reverse=True,
2144
+ category=FockSpaceBases(F))
2145
+ self.module_morphism(self._G_to_fock_basis,
2146
+ triangular='upper', unitriangular=True,
2147
+ codomain=F.natural()).register_as_coercion()
2148
+
2149
+ options = FockSpaceOptions
2150
+
2151
+ @cached_method
2152
+ def _G_to_fock_basis(self, la, algorithm='GW'):
2153
+ r"""
2154
+ Return the `G` basis indexed by ``la`` in the natural basis.
2155
+
2156
+ EXAMPLES::
2157
+
2158
+ sage: G = FockSpace(3, truncated=3).G()
2159
+ sage: G._G_to_fock_basis(Partition([3]))
2160
+ |3> + q*|2, 1>
2161
+ sage: G._G_to_fock_basis(Partition([2,1]))
2162
+ |2, 1> + q*|1, 1, 1>
2163
+ sage: G._G_to_fock_basis(Partition([2,1]), 'LLT')
2164
+ |2, 1> + q*|1, 1, 1>
2165
+ """
2166
+ fock = self.realization_of().natural()
2167
+
2168
+ # Special cases:
2169
+ # For the empty partition
2170
+ if la.size() == 0:
2171
+ return fock.highest_weight_vector()
2172
+
2173
+ # For length k partitions
2174
+ if algorithm == 'GW':
2175
+ n = self.realization_of()._n
2176
+ k = self.realization_of()._k
2177
+ if len(la) == k:
2178
+ x = la[-1]
2179
+ mu = _Partitions([p - x for p in la])
2180
+
2181
+ def add_cols(nu):
2182
+ return _Partitions([v + x for v in list(nu) + [0]*(k - len(nu))])
2183
+ return fock.sum_of_terms((add_cols(nu), c) for nu,c in self._G_to_fock_basis(mu))
2184
+
2185
+ # For critical partitions
2186
+ n = self.realization_of()._n
2187
+ if len(la) == k-1 and all((la[i] - la[i+1] + 1) % n == 0 for i in range(k-2)) \
2188
+ and (la[-1] + 1) % n == 0:
2189
+ return fock.monomial(la)
2190
+
2191
+ # Perform the triangular reduction
2192
+ cur = self.realization_of().A(algorithm)._A_to_fock_basis(la)
2193
+ s = sorted(cur.support()) # Sort lex, which respects dominance order
2194
+ s.pop() # Remove the largest
2195
+
2196
+ q = self.realization_of()._q
2197
+ while s:
2198
+ mu = s.pop()
2199
+ d = cur[mu].denominator()
2200
+ k = d.degree()
2201
+ n = cur[mu].numerator()
2202
+ if k != 0 or n.constant_coefficient() != 0:
2203
+ gamma = sum(n[i] * (q**(i-k) + q**(k-i))
2204
+ for i in range(min(n.degree(), k)))
2205
+ gamma += n[k]
2206
+ cur -= gamma * self._G_to_fock_basis(mu, algorithm)
2207
+
2208
+ # Add any new support elements
2209
+ for x in cur.support():
2210
+ if x == mu or not mu.dominates(x): # Add only things (strictly) dominated by mu
2211
+ continue
2212
+ for i in reversed(range(len(s))):
2213
+ if not s[i].dominates(x):
2214
+ s.insert(i+1, x)
2215
+ break
2216
+ return cur
2217
+
2218
+ lower_global_crystal = G
2219
+ canonical = G