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,877 @@
1
+ # sage_setup: distribution = sagemath-combinat
2
+ r"""
3
+ T-sequences
4
+
5
+ T-sequences are tuples of four (-1, 0, 1) sequences of length `t` where
6
+ for every `i` exactly one sequence has a nonzero entry at index `i`
7
+ and for which the nonperiodic autocorrelation function is equal to zero
8
+ (i.e. they are complementary). See Definition 7.5 of [Seb2017]_.
9
+
10
+ These can be constructed from Turyn sequences. In particular,
11
+ if Turyn sequences of length `l` exists, there will be T-sequences
12
+ of length `4l-1` and `2l-1`.
13
+
14
+ Turyn sequences are tuples of four (-1, +1) sequences `X, U, Y, V` of length
15
+ `l`, `l`, `l-1`, `l-1` with nonperiodic autocorrelation equal to zero and
16
+ the additional constraints that:
17
+
18
+ * the first element of `X` is 1
19
+ * the last element of `X` is -1
20
+ * the last element of `U` is 1
21
+
22
+ The nonperiodic autocorrelation of a family of sequences
23
+ `X=\{A_1, A_2, ..., A_n\}` is defined as (see Definition 7.2 of [Seb2017]_):
24
+
25
+ .. MATH::
26
+
27
+ N_X(j) = \sum_{i=1}^{n-j}(a_{1,i}a_{1,i+j} + a_{2,i}a_{2,i+j} + ... + a_{n,i}a_{n,i+j})
28
+
29
+ AUTHORS:
30
+
31
+ - Matteo Cati (2022-11-16): initial version
32
+ """
33
+
34
+ # ***************************************************************************
35
+ # Copyright (C) 2022 Matteo Cati matteo.cati@keble.ox.ac.uk
36
+ #
37
+ # This program is free software: you can redistribute it and/or modify
38
+ # it under the terms of the GNU General Public License as published by
39
+ # the Free Software Foundation, either version 2 of the License, or
40
+ # (at your option) any later version.
41
+ # https://www.gnu.org/licenses/
42
+ # ****************************************************************************
43
+
44
+ from sage.structure.sequence import Sequence
45
+
46
+
47
+ def _nonperiodic_autocorrelation(sequences, j):
48
+ r"""
49
+ Compute the nonperiodic autocorrelation of a family of sequences.
50
+
51
+ Namely, given a family of sequences `X` it computes:
52
+
53
+ .. MATH::
54
+
55
+ N_X(j) = \sum_{i=1}^{n-j}(a_{1,i}a_{1,i+j} + a_{2,i}a_{2,i+j} + ... + a_{n,i}a_{n,i+j})
56
+
57
+ INPUT:
58
+
59
+ - ``sequences`` -- either a single sequence or a list of sequences for
60
+ which we want to compute the nonperiodic autocorrelation
61
+
62
+ - ``j`` -- integer; the parameter `j` used when calculating the nonperiodic
63
+ autocorrelation
64
+ """
65
+ if not isinstance(sequences[0], list):
66
+ sequences = [sequences]
67
+
68
+ t = len(sequences[0])
69
+ result = 0
70
+ for i in range(t - j):
71
+ for seq in sequences:
72
+ result += seq[i] * seq[i + j]
73
+ return result
74
+
75
+
76
+ def is_skew(seq, verbose=False):
77
+ r"""
78
+ Check if the given sequence is skew.
79
+
80
+ A sequence `X=\{x_1, x_2, ...,x_n\}` is defined skew (according to Definition
81
+ 7.4 of [Seb2017]_) if `n` is even and `x_i = -x_{n-i+1}`.
82
+
83
+ INPUT:
84
+
85
+ - ``seq`` -- the sequence that should be checked
86
+
87
+ - ``verbose`` -- boolean (default: ``False``); if ``True`` the function
88
+ will be verbose when the sequences do not satisfy the constraints
89
+
90
+ EXAMPLES::
91
+
92
+ sage: from sage.combinat.t_sequences import is_skew
93
+ sage: is_skew([1, -1, 1, -1, 1, -1])
94
+ True
95
+ sage: is_skew([1, -1, -1, -1], verbose=True)
96
+ Constraint not satisfied at index 1
97
+ False
98
+
99
+ TESTS::
100
+
101
+ sage: is_skew([1, -1, -1])
102
+ False
103
+ sage: is_skew([1, -1, -1, 1, -1], verbose=True)
104
+ Sequence should be of even length
105
+ False
106
+ """
107
+ n = len(seq)
108
+
109
+ if n % 2:
110
+ if verbose:
111
+ print('Sequence should be of even length')
112
+ return False
113
+
114
+ for i in range(n):
115
+ if seq[i] != -seq[n-i-1]:
116
+ if verbose:
117
+ print(f'Constraint not satisfied at index {i}')
118
+ return False
119
+ return True
120
+
121
+
122
+ def is_symmetric(seq, verbose=False) -> bool:
123
+ r"""
124
+ Check if the given sequence is symmetric.
125
+
126
+ A sequence `X=\{x_1, x_2, ...,x_n\}` is defined symmetric (according to Definition
127
+ 7.4 of [Seb2017]_) if `n` is odd and `x_i = x_{n-i+1}`.
128
+
129
+ INPUT:
130
+
131
+ - ``seq`` -- the sequence that should be checked
132
+
133
+ - ``verbose`` -- boolean (default: ``False``); if ``True`` the function will be
134
+ verbose when the sequences do not satisfy the constraints
135
+
136
+ EXAMPLES::
137
+
138
+ sage: from sage.combinat.t_sequences import is_symmetric
139
+ sage: is_symmetric([1, -1, 1, -1, 1])
140
+ True
141
+ sage: is_symmetric([1, -1, 1, 1, 1], verbose=True)
142
+ Constraint not satisfied at index 1
143
+ False
144
+
145
+ TESTS::
146
+
147
+ sage: is_symmetric([1, -1, -1, 1])
148
+ False
149
+ sage: is_symmetric([1, -1, -1, 1], verbose=True)
150
+ Sequence should be of odd length
151
+ False
152
+ """
153
+ n = len(seq)
154
+
155
+ if n % 2 == 0:
156
+ if verbose:
157
+ print('Sequence should be of odd length')
158
+ return False
159
+
160
+ for i in range(n):
161
+ if seq[i] != seq[n-i-1]:
162
+ if verbose:
163
+ print(f'Constraint not satisfied at index {i}')
164
+ return False
165
+ return True
166
+
167
+
168
+ def is_T_sequences_set(sequences, verbose=False):
169
+ r"""
170
+ Check if a family of sequences is composed of T-sequences.
171
+
172
+ Given 4 (-1, 0, +1) sequences, they will be T-sequences if
173
+ (Definition 7.4 of [Seb2017]_):
174
+
175
+ * they have all the same length `t`
176
+ * for each index `i`, exactly one sequence is nonzero at `i`
177
+ * the nonperiodic autocorrelation is equal to `0`
178
+
179
+ INPUT:
180
+
181
+ - ``sequences`` -- list of four sequences
182
+
183
+ - ``verbose`` -- boolean (default: ``False``); if ``True`` the function will be
184
+ verbose when the sequences do not satisfy the constraints
185
+
186
+ EXAMPLES::
187
+
188
+ sage: from sage.combinat.t_sequences import is_T_sequences_set
189
+ sage: seqs = [[1, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, -1], [0, 0, 0, 0, 0]]
190
+ sage: is_T_sequences_set(seqs)
191
+ True
192
+ sage: seqs = [[1, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, -1], [0, 0, 0, 0, 0]]
193
+ sage: is_T_sequences_set(seqs, verbose=True)
194
+ There should be exactly a nonzero element at every index, found 2 such
195
+ elements at index 3
196
+ False
197
+
198
+
199
+ TESTS::
200
+
201
+ sage: seqs = [[1, 1, 0, 1, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, -1], [0, 0, 0, 0, 0]]
202
+ sage: is_T_sequences_set(seqs)
203
+ False
204
+ sage: seqs = [[1, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, -1], [0, 0, 0, 0, 0]]
205
+ sage: is_T_sequences_set(seqs, verbose=True)
206
+ Nonperiodic autocorrelation should always be zero, found 2 for parameter 1
207
+ False
208
+ sage: is_T_sequences_set([[1, 0, ], [0, -1, 0], [0, 0, 1]])
209
+ False
210
+ sage: seqs = [[1, 2, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, -1], [0, 0, 0, 0, 0]]
211
+ sage: is_T_sequences_set(seqs, verbose=True)
212
+ Elements should be in (-1, 0, +1), but 2 was found at index 1
213
+ False
214
+ """
215
+ if len(sequences) != 4:
216
+ if verbose:
217
+ print(f"T-Sequence should contain 4 sequences, found {len(sequences)} instead")
218
+ return False
219
+
220
+ t = len(sequences[0])
221
+
222
+ for i in range(t):
223
+ tot = 0
224
+ for seq in sequences:
225
+ if seq[i] not in [-1, 0, 1]:
226
+ if verbose:
227
+ print(f"Elements should be in (-1, 0, +1), but {seq[i]} was found at index {i}")
228
+ return False
229
+ tot += abs(seq[i])
230
+ if tot != 1:
231
+ if verbose:
232
+ print(f"There should be exactly a nonzero element at every index, found {tot} such elements at index {i}")
233
+ return False
234
+
235
+ for j in range(1, t):
236
+ autocorr = _nonperiodic_autocorrelation(sequences, j)
237
+ if autocorr != 0:
238
+ if verbose:
239
+ print(f"Nonperiodic autocorrelation should always be zero, found {autocorr} for parameter {j}")
240
+ return False
241
+
242
+ return True
243
+
244
+
245
+ def turyn_sequences_smallcases(l, existence=False):
246
+ r"""
247
+ Construction of Turyn sequences for small values of `l`.
248
+
249
+ The data is taken from [Seb2017]_ and [CRSKKY1989]_.
250
+
251
+ INPUT:
252
+
253
+ - ``l`` -- integer; the length of the Turyn sequences
254
+
255
+ - ``existence`` -- boolean (default: ``False``); if ``True``, only return
256
+ whether the Turyn sequences are available for the given length
257
+
258
+ EXAMPLES:
259
+
260
+ By default, this method returns the four Turyn sequences ::
261
+
262
+ sage: from sage.combinat.t_sequences import turyn_sequences_smallcases
263
+ sage: turyn_sequences_smallcases(4)
264
+ [[1, 1, -1, -1], [1, 1, -1, 1], [1, 1, 1], [1, -1, 1]]
265
+
266
+ If we pass the ``existence`` flag, the method will return a boolean ::
267
+
268
+ sage: turyn_sequences_smallcases(4, existence=True)
269
+ True
270
+
271
+ TESTS::
272
+
273
+ sage: turyn_sequences_smallcases(17)
274
+ Traceback (most recent call last):
275
+ ...
276
+ ValueError: Turyn sequence of length 17 is not implemented yet.
277
+ sage: turyn_sequences_smallcases(17, existence=True)
278
+ False
279
+ """
280
+ db = {
281
+ 2: [[1, -1], [1, 1], [1], [1]],
282
+ 3: [[1, 1, 1], [1, 1, -1], [1, -1], [1, -1]],
283
+ 4: [[1, 1, -1, -1], [1, 1, -1, 1], [1, 1, 1], [1, -1, 1]],
284
+ 5: [[1, 1, -1, 1, 1], [1, 1, 1, 1, -1], [1, 1, -1, -1], [1, -1, 1, -1]],
285
+ 6: [[1, 1, 1, -1, -1, -1], [1, 1, -1, 1, -1, 1], [1, 1, -1, 1, 1], [1, 1, -1, 1, 1]],
286
+ 7: [[1, 1, 1, -1, 1, 1, 1], [1, 1, -1, -1, -1, 1, -1], [1, 1, -1, 1, -1, -1], [1, 1, -1, 1, -1, -1]],
287
+ 8: [[1, 1, -1, 1, -1, 1, -1, -1], [1, 1, 1, 1, -1, -1, -1, 1], [1, 1, 1, -1, 1, 1, 1], [1, -1, -1, 1, -1, -1, 1]],
288
+ 13: [[1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1], [1, 1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1],
289
+ [1, 1, 1, -1, 1, 1, -1, -1, 1, -1, -1, -1], [1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1]],
290
+ 15: [[1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1], [1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, -1],
291
+ [1, 1, 1, 1, -1, -1, 1, -1, 1, 1, -1, -1, -1, -1], [1, -1, -1, -1, -1, 1, -1, 1, -1, 1, 1, 1, 1, -1]],
292
+ }
293
+
294
+ if existence:
295
+ return l in db
296
+
297
+ if l not in db:
298
+ raise ValueError(f"Turyn sequence of length {l} is not implemented yet.")
299
+
300
+ return list(map(Sequence, db[l]))
301
+
302
+
303
+ def T_sequences_construction_from_base_sequences(base_sequences, check=True):
304
+ r"""
305
+ Construct T-sequences of length `2n+p` from base sequences of length `n+p, n+p, n, n`.
306
+
307
+ Given base sequences `A, B, C, D`, the T-sequences are constructed as described in
308
+ [KTR2005]_:
309
+
310
+ .. MATH::
311
+
312
+ \begin{aligned}
313
+ T_1 &= \frac{1}{2}(A+B); 0_{n} \\
314
+ T_2 &= \frac{1}{2}(A-B); 0_{n} \\
315
+ T_3 &= 0_{n+p} + \frac{1}{2}(C+D) \\
316
+ T_4 &= 0_{n+p} + \frac{1}{2}(C-D)
317
+ \end{aligned}
318
+
319
+ INPUT:
320
+
321
+ - ``base_sequences`` -- the base sequences that should be used to construct
322
+ the T-sequences
323
+
324
+ - ``check`` -- boolean (default: ``True``); check that the sequences
325
+ created are T-sequences before returning them
326
+
327
+ EXAMPLES::
328
+
329
+ sage: from sage.combinat.t_sequences import turyn_sequences_smallcases, T_sequences_construction_from_base_sequences
330
+ sage: seqs = turyn_sequences_smallcases(4)
331
+ sage: T_sequences_construction_from_base_sequences(seqs)
332
+ [[1, 1, -1, 0, 0, 0, 0],
333
+ [0, 0, 0, -1, 0, 0, 0],
334
+ [0, 0, 0, 0, 1, 0, 1],
335
+ [0, 0, 0, 0, 0, 1, 0]]
336
+
337
+ TESTS::
338
+
339
+ sage: from sage.combinat.t_sequences import base_sequences_construction, is_T_sequences_set
340
+ sage: seqs = turyn_sequences_smallcases(4)
341
+ sage: is_T_sequences_set(T_sequences_construction_from_base_sequences(seqs))
342
+ True
343
+ sage: T_sequences_construction_from_base_sequences([[1, -1], [-1, 1], [1]])
344
+ Traceback (most recent call last):
345
+ ...
346
+ AssertionError
347
+ sage: X = [1,1,-1,1,-1,1,-1,1]
348
+ sage: Y = [1,-1,-1,-1,-1,-1,-1,1]
349
+ sage: Z = [1,-1,-1,1,1,1,1,-1]
350
+ sage: W = [1,1,1,-1,1,1,-1]
351
+ sage: base_seqs = base_sequences_construction([X, Y, Z, W])
352
+ sage: is_T_sequences_set(T_sequences_construction_from_base_sequences(base_seqs))
353
+ True
354
+ """
355
+
356
+ assert len(base_sequences) == 4
357
+
358
+ A, B, C, D = base_sequences
359
+ n = len(C)
360
+ p = len(A)-n
361
+
362
+ assert len(A) == len(B) == len(C)+p == len(D)+p
363
+
364
+ def seq_sum(seq1, seq2):
365
+ return [(a+b)//2 for (a, b) in zip(seq1, seq2)]
366
+
367
+ def seq_subtract(seq1, seq2):
368
+ return [(a-b)//2 for (a, b) in zip(seq1, seq2)]
369
+
370
+ def zero_seq(n):
371
+ return [0 for _ in range(n)]
372
+
373
+ X1 = Sequence(seq_sum(A, B) + zero_seq(n))
374
+ X2 = Sequence(seq_subtract(A, B) + zero_seq(n))
375
+ X3 = Sequence(zero_seq(n+p) + seq_sum(C, D))
376
+ X4 = Sequence(zero_seq(n+p) + seq_subtract(C, D))
377
+
378
+ res = [X1, X2, X3, X4]
379
+ if check:
380
+ assert is_T_sequences_set(res)
381
+ return res
382
+
383
+
384
+ def T_sequences_construction_from_turyn_sequences(turyn_sequences, check=True):
385
+ r"""
386
+ Construct T-sequences of length `4l-1` from Turyn sequences of length `l`.
387
+
388
+ Given Turyn sequences `X, U, Y, V`, the T-sequences are constructed as described in
389
+ theorem 7.7 of [Seb2017]_:
390
+
391
+ .. MATH::
392
+
393
+ \begin{aligned}
394
+ T_1 &= 1; 0_{4l-2} \\
395
+ T_2 &= 0; X/Y; 0_{2l-1} \\
396
+ T_3 &= 0_{2l}; U/0_{l-2} \\
397
+ T_4 &= 0_{2l} + 0_{l}/V
398
+ \end{aligned}
399
+
400
+ INPUT:
401
+
402
+ - ``turyn_sequences`` -- the Turyn sequences that should be used to
403
+ construct the T-sequences
404
+
405
+ - ``check`` -- boolean (default: ``True``); check that the sequences
406
+ created are T-sequences before returning them
407
+
408
+ EXAMPLES::
409
+
410
+ sage: from sage.combinat.t_sequences import turyn_sequences_smallcases, T_sequences_construction_from_turyn_sequences, is_T_sequences_set
411
+ sage: seqs = turyn_sequences_smallcases(4)
412
+ sage: T_sequences_construction_from_turyn_sequences(seqs)
413
+ [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
414
+ [0, 1, 1, 1, 1, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0],
415
+ [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, -1, 0, 1],
416
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, 0, 1, 0]]
417
+
418
+ TESTS::
419
+
420
+ sage: seqs = turyn_sequences_smallcases(4)
421
+ sage: is_T_sequences_set(T_sequences_construction_from_turyn_sequences(seqs))
422
+ True
423
+ sage: T_sequences_construction_from_turyn_sequences([[1, -1], [-1, 1], [1]])
424
+ Traceback (most recent call last):
425
+ ...
426
+ AssertionError
427
+ """
428
+
429
+ assert len(turyn_sequences) == 4
430
+
431
+ X, U, Y, V = turyn_sequences
432
+ l = len(X)
433
+
434
+ assert len(X) == len(U) == len(Y)+1 == len(V)+1
435
+
436
+ def zero_seq(n):
437
+ return [0 for _ in range(n)]
438
+
439
+ def interleave(seq1, seq2):
440
+ res = []
441
+ for i in range(len(seq1) + len(seq2)):
442
+ if i % 2 == 0:
443
+ res.append(seq1[i//2])
444
+ else:
445
+ res.append(seq2[i//2])
446
+ return res
447
+
448
+ X1 = Sequence([1] + zero_seq(4*l-2))
449
+ X2 = Sequence([0] + interleave(X, Y) + zero_seq(2*l-1))
450
+ X3 = Sequence(zero_seq(2*l) + interleave(U, zero_seq(l-1)))
451
+ X4 = Sequence(zero_seq(2*l) + interleave(zero_seq(l), V))
452
+
453
+ res = [X1, X2, X3, X4]
454
+ if check:
455
+ assert is_T_sequences_set(res)
456
+ return res
457
+
458
+
459
+ def T_sequences_smallcases(t, existence=False, check=True):
460
+ r"""
461
+ Construct T-sequences for some small values of `t`.
462
+
463
+ This method will try to use the constructions defined in
464
+ :func:`T_sequences_construction_from_base_sequences` and
465
+ :func:`T_sequences_construction_from_turyn_sequences`
466
+ together with the Turyn sequences stored in :func:`turyn_sequences_smallcases`,
467
+ or base sequences created by :func:`base_sequences_smallcases`.
468
+
469
+ This function contains also some T-sequences taken directly from [CRSKKY1989]_.
470
+
471
+ INPUT:
472
+
473
+ - ``t`` -- integer; the length of the T-sequences to construct
474
+
475
+ - ``existence`` -- boolean (default: ``False``); if ``True``, this method
476
+ only returns whether a T-sequences of the given size can be constructed
477
+
478
+ - ``check`` -- boolean (default: ``True``); check that the sequences are
479
+ T-sequences before returning them
480
+
481
+ EXAMPLES:
482
+
483
+ By default, this method returns the four T-sequences ::
484
+
485
+ sage: from sage.combinat.t_sequences import T_sequences_smallcases, is_T_sequences_set
486
+ sage: T_sequences_smallcases(9)
487
+ [[1, 1, 0, 1, 0, 0, 0, 0, 0],
488
+ [0, 0, -1, 0, 1, 0, 0, 0, 0],
489
+ [0, 0, 0, 0, 0, 1, 0, 0, -1],
490
+ [0, 0, 0, 0, 0, 0, 1, -1, 0]]
491
+
492
+ If the existence flag is passed, the method returns a boolean ::
493
+
494
+ sage: T_sequences_smallcases(9, existence=True)
495
+ True
496
+
497
+ TESTS::
498
+
499
+ sage: T_sequences_smallcases(66)
500
+ Traceback (most recent call last):
501
+ ...
502
+ ValueError: T Sequences of length 66 not yet implemented.
503
+ sage: is_T_sequences_set(T_sequences_smallcases(47))
504
+ True
505
+ sage: is_T_sequences_set(T_sequences_smallcases(11))
506
+ True
507
+ sage: T_sequences_smallcases(69, existence=True)
508
+ False
509
+ """
510
+ db = {
511
+ 47: [
512
+ [1,-1,-1,0,0,-1,1,-1]+[0]*8+[1,-1,-1,0,0,-1,-1]+[0]*24,
513
+ [0,0,0,-1,1,0,0,0,-1,-1,-1,1,1,1,1,1,0,0,0,1,-1,0,0,1]+[0]*23,
514
+ [0]*26+[-1,0,1,0,0,0,0,1,-1,1,1,1,0,0,0,0,1,0,-1,0,0],
515
+ [0]*24 + [1,1,0,-1,0,-1,1,1,-1,0,0,0,0,0,-1,1,-1,-1,0,-1,0,-1,1]
516
+ ],
517
+ 65: [
518
+ [0]*33+[1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1],
519
+ [0]*32+[1]+[0]*32,
520
+ [1]*5+[-1,-1,1,1,-1,1,-1,1,1]+[-1]*7+[1,1,-1,1,-1,1,-1,1,1,-1,-1]+[0]*33,
521
+ [0]*65
522
+ ],
523
+ 93: [
524
+ [0,-1,0,0,-1,1,0,-1,1,0,1,1,0,0,1,1,1,0,0,-1,0,-1,1,1,1,-1,0,1,0,0,1]+[0]*33+[1,1,0,0,1,0,0,-1,0,0,-1,1,0,1]+[0]*15,
525
+ [-1,0,-1,1,0,0,1,0,0,-1,0,0,-1,-1,0,0,0,-1,1,0,1]+[0]*5+[-1,0,1,1]+[0]*32+[1,1,0,0,1,1,0,1,-1,0,1,-1,0,0,-1]+[0]*16,
526
+ [0]*32+[1,0,0,1,-1,0,1,-1,0,-1,-1,0,0,-1,-1,1,0,0,-1,0,-1,1,1,1,-1,0,1,0,0,1]+[0]*17+[1,1,0,-1]+[0]*5+[1,0,1,-1,0],
527
+ [0]*31+[1,0,1,-1,0,0,-1,0,0,1,0,0,1,1,0,0,0,-1,1,0,1]+[0]*5+[-1,0,1,1]+[0]*17+[-1,0,0,-1,0,1,-1,-1,-1,1,0,1,0,0,-1]
528
+ ]
529
+ }
530
+
531
+ if t in db:
532
+ if existence:
533
+ return True
534
+ sequences = list(map(Sequence, db[t]))
535
+ if check:
536
+ assert is_T_sequences_set(sequences)
537
+ return sequences
538
+ if (t+1) % 2 == 0 and turyn_sequences_smallcases((t+1)//2, existence=True):
539
+ if existence:
540
+ return True
541
+ turyn_seqs = turyn_sequences_smallcases((t+1)//2)
542
+ return T_sequences_construction_from_base_sequences(turyn_seqs, check=check)
543
+
544
+ if (t+1) % 4 == 0 and turyn_sequences_smallcases((t+1)//4, existence=True):
545
+ if existence:
546
+ return True
547
+ turyn_seqs = turyn_sequences_smallcases((t+1)//4)
548
+ return T_sequences_construction_from_turyn_sequences(turyn_seqs, check=check)
549
+
550
+ for p in range(1, t):
551
+ n = (t-p)//2
552
+ if (t-p) % 2 == 0 and base_sequences_smallcases(n, p, existence=True):
553
+ if existence:
554
+ return True
555
+ base_seqs = base_sequences_smallcases(n, p, check=False)
556
+ return T_sequences_construction_from_base_sequences(base_seqs, check=check)
557
+
558
+ if existence:
559
+ return False
560
+ raise ValueError(f'T Sequences of length {t} not yet implemented.')
561
+
562
+
563
+ def base_sequences_construction(turyn_type_seqs, check=True):
564
+ r"""
565
+ Construct base sequences of length `2n-1, 2n-1, n, n` from Turyn type
566
+ sequences of length `n,n,n,n-1`.
567
+
568
+ Given Turyn type sequences `X, Y, Z, W` of length `n,n,n,n-1`, Theorem 1 of
569
+ [KTR2005]_ shows that the following are base sequences of length
570
+ `2n-1, 2n-1, n, n`:
571
+
572
+ .. MATH::
573
+
574
+ \begin{aligned}
575
+ A &= Z;W \\
576
+ B &= Z; -W \\
577
+ C &= X \\
578
+ D &= Y
579
+ \end{aligned}
580
+
581
+ INPUT:
582
+
583
+ - ``turyn_type_seqs`` -- the list of 4 Turyn type sequences that should be
584
+ used to construct the base sequences
585
+
586
+ - ``check`` -- boolean (default: ``True``); check that the resulting
587
+ sequences are base sequences before returning them
588
+
589
+ OUTPUT: list containing the four base sequences
590
+
591
+ EXAMPLES::
592
+
593
+ sage: from sage.combinat.t_sequences import base_sequences_construction
594
+ sage: X = [1,1,-1,1,-1,1,-1,1]
595
+ sage: Y = [1,-1,-1,-1,-1,-1,-1,1]
596
+ sage: Z = [1,-1,-1,1,1,1,1,-1]
597
+ sage: W = [1,1,1,-1,1,1,-1]
598
+ sage: base_sequences_construction([X, Y, Z, W])
599
+ [[1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1],
600
+ [1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1],
601
+ [1, 1, -1, 1, -1, 1, -1, 1],
602
+ [1, -1, -1, -1, -1, -1, -1, 1]]
603
+
604
+ TESTS::
605
+
606
+ sage: base_sequences_construction([[1, -1], [1], [1], [-1]])
607
+ Traceback (most recent call last):
608
+ ...
609
+ AssertionError
610
+
611
+ .. SEEALSO::
612
+
613
+ :func:`is_base_sequences_tuple`
614
+ """
615
+ assert len(turyn_type_seqs) == 4
616
+ X, Y, Z, W = turyn_type_seqs
617
+
618
+ assert len(X) == len(Y) == len(Z) == len(W)+1
619
+
620
+ A = Sequence(Z + W)
621
+ B = Sequence(Z + [-el for el in W])
622
+ C = X
623
+ D = Y
624
+
625
+ if check:
626
+ assert is_base_sequences_tuple([A, B, C, D])
627
+ return [A, B, C, D]
628
+
629
+
630
+ def is_base_sequences_tuple(base_sequences, verbose=False):
631
+ r"""Check if the given sequences are base sequences.
632
+
633
+ Four (-1, +1) sequences `A, B, C, D` of length `n+p, n+p, n, n` are called
634
+ base sequences if for all `j \ge 1`:
635
+
636
+ .. MATH::
637
+
638
+ N_A(j)+N_B(j)+N_C(j)+N_D(j) = 0
639
+
640
+ where `N_X(j)` is the nonperiodic autocorrelation (See definition in [KTR2005]_).
641
+
642
+ INPUT:
643
+
644
+ - ``base_sequences`` -- the list of 4 sequences that should be checked
645
+
646
+ - ``verbose`` -- boolean (default: ``False``); if ``True`` the function
647
+ will be verbose when the sequences do not satisfy the constraints
648
+
649
+ EXAMPLES::
650
+
651
+ sage: from sage.combinat.t_sequences import is_base_sequences_tuple
652
+ sage: seqs = [[1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1],[1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1],[1, 1, -1, 1, -1, 1, -1, 1],[1, -1, -1, -1, -1, -1, -1, 1]]
653
+ sage: is_base_sequences_tuple(seqs)
654
+ True
655
+
656
+ If verbose is true, the function will be verbose ::
657
+
658
+ sage: seqs = [[1, -1], [1, 1], [-1], [2]]
659
+ sage: is_base_sequences_tuple(seqs, verbose=True)
660
+ Base sequences should only contain -1, +1, found 2
661
+ False
662
+
663
+ TESTS:
664
+
665
+ sage: seqs = [[1, -1], [1], [-1]]
666
+ sage: is_base_sequences_tuple(seqs)
667
+ False
668
+ sage: seqs = [[1, -1], [1, -1], [-1], [1]]
669
+ sage: is_base_sequences_tuple(seqs)
670
+ False
671
+ sage: seqs = [[1, -1], [1, 1], [-1], [2]]
672
+ sage: is_base_sequences_tuple(seqs)
673
+ False
674
+ sage: seqs = [[1, -1], [1], [-1], [1]]
675
+ sage: is_base_sequences_tuple(seqs)
676
+ False
677
+
678
+ .. SEEALSO::
679
+
680
+ :func:`base_sequences_construction`
681
+ """
682
+ if len(base_sequences) != 4:
683
+ if verbose:
684
+ print(f'Base sequences should be 4, found {len(base_sequences)}')
685
+ return False
686
+ A, B, C, D = base_sequences
687
+ n = len(C)
688
+ p = len(A) - len(C)
689
+ if not (len(A) == len(B) == len(C)+p == len(D)+p):
690
+ if verbose:
691
+ print(f'Base sequences should have length n+p, n+p, n, n, found {len(A)}, {len(B)}, {len(C)}, {len(D)}')
692
+ return False
693
+
694
+ for seq in base_sequences:
695
+ for el in seq:
696
+ if abs(el) != 1:
697
+ if verbose:
698
+ print(f'Base sequences should only contain -1, +1, found {el}')
699
+ return False
700
+
701
+ for j in range(1, n+p):
702
+ autocorr = _nonperiodic_autocorrelation(A, j) + _nonperiodic_autocorrelation(B, j) + _nonperiodic_autocorrelation(C, j) + _nonperiodic_autocorrelation(D, j)
703
+ if autocorr != 0:
704
+ if verbose:
705
+ print(f"Nonperiodic autocorrelation should always be zero, found {autocorr} for parameter {j}")
706
+ return False
707
+
708
+ return True
709
+
710
+
711
+ def turyn_type_sequences_smallcases(n, existence=False):
712
+ r"""
713
+ Construction of Turyn type sequences for small values of `n`.
714
+
715
+ The data is taken from [KTR2005]_ for `n= 36`, and from [BDKR2013]_ for `n\le 32`.
716
+
717
+ INPUT:
718
+
719
+ - ``n`` -- integer; the length of the Turyn type sequences
720
+
721
+ - ``existence`` -- boolean (default: ``False``); if ``True``, only return
722
+ whether the Turyn type sequences are available for the given length
723
+
724
+ EXAMPLES:
725
+
726
+ By default, this method returns the four Turyn type sequences ::
727
+
728
+ sage: from sage.combinat.t_sequences import turyn_type_sequences_smallcases
729
+ sage: turyn_type_sequences_smallcases(4)
730
+ [[1, 1, 1, 1], [1, 1, -1, 1], [1, 1, -1, -1], [1, -1, 1]]
731
+
732
+ If we pass the ``existence`` flag, the method will return a boolean ::
733
+
734
+ sage: turyn_type_sequences_smallcases(4, existence=True)
735
+ True
736
+
737
+ TESTS::
738
+
739
+ sage: turyn_type_sequences_smallcases(17)
740
+ Traceback (most recent call last):
741
+ ...
742
+ ValueError: Turyn type sequences of length 17 are not implemented yet.
743
+ sage: turyn_type_sequences_smallcases(17, existence=True)
744
+ False
745
+
746
+ ALGORITHM:
747
+
748
+ The Turyn type sequences are stored in hexadecimal format.
749
+ Given `n` hexadecimal digits `h_1, h_2,...,h_n`, it is possible to get the
750
+ Turyn type sequences by converting each `h_i` (`1 \le i \le n-1`) into a
751
+ four digits binary number. Then, the `j`-th binary digit is `0` if the `i`-th
752
+ number in the `j`-th sequence is `1`, and it is `1` if the number in the
753
+ sequence is -1.
754
+
755
+ For the `n`-th digit, it should be converted to a 3 digits binary number, and
756
+ then the same mapping as before can be used (see also [BDKR2013]_).
757
+ """
758
+ def convertLists(hexstring):
759
+ seqs = [Sequence([]), Sequence([]), Sequence([]), Sequence([])]
760
+ for c in hexstring[:-1]:
761
+ binary = bin(int(c, 16))[2:].zfill(4)
762
+ for i in range(4):
763
+ if binary[i] == '0':
764
+ seqs[i].append(1)
765
+ else:
766
+ seqs[i].append(-1)
767
+ last = bin(int(hexstring[-1], 16))[2:].zfill(3)
768
+ for i in range(3):
769
+ if last[i] == '0':
770
+ seqs[i].append(1)
771
+ else:
772
+ seqs[i].append(-1)
773
+ return seqs
774
+
775
+ db = {
776
+ 2: '01',
777
+ 4: '0161',
778
+ 6: '006d61',
779
+ 8: '06e5c4d1',
780
+ 10: '0001f4a961',
781
+ 12: '0004f90bc961',
782
+ 14: '00036ac71c7651',
783
+ 16: '0000778e52de5561',
784
+ 18: '00006758b30d1e9a51',
785
+ 20: '000038e2739c7a0b6951',
786
+ 22: '00000f702c71a9ad565961',
787
+ 24: '00000b7c2cb2bc4b6cd9a961',
788
+ 26: '000000ff0f846f1ca5a5aa9551',
789
+ 28: '0000067cde3e50639ab46135aa51',
790
+ 30: '000000f70b106f9d427a25e9a96951',
791
+ 32: '00000138f64f1c1e77844f26d95a5961',
792
+ 36: '060989975b685d8fc80750b21c0212eceb26',
793
+ }
794
+
795
+ if existence:
796
+ return n in db
797
+
798
+ if n not in db:
799
+ raise ValueError(f"Turyn type sequences of length {n} are not implemented yet.")
800
+
801
+ return convertLists(db[n])
802
+
803
+
804
+ def base_sequences_smallcases(n, p, existence=False, check=True):
805
+ r"""Construct base sequences of length `n+p, n+p, n, n` from available data.
806
+
807
+ The function uses the construction :func:`base_sequences_construction`,
808
+ together with Turyn type sequences from :func:`turyn_type_sequences_smallcases`
809
+ to construct base sequences with `p = n-1`.
810
+
811
+ Furthermore, this function uses also Turyn sequences (i.e. base sequences
812
+ with `p=1`) from :func:`turyn_sequences_smallcases`.
813
+
814
+ INPUT:
815
+
816
+ - ``n`` -- integer; the length of the last two base sequences
817
+
818
+ - ``p`` -- integer; `n+p` will be the length of the first two base
819
+ sequences
820
+
821
+ - ``existence`` -- boolean (default: ``False``); if ``True``, the function
822
+ will only check whether the base sequences can be constructed
823
+
824
+ - ``check`` -- boolean (default: ``True``); check that the resulting
825
+ sequences are base sequences before returning them
826
+
827
+ OUTPUT:
828
+
829
+ If ``existence`` is ``False``, the function returns a list containing the
830
+ four base sequences, or raises an error if the base sequences cannot be
831
+ constructed. If ``existence`` is ``True``, the function returns a boolean,
832
+ which is ``True`` if the base sequences can be constructed and ``False``
833
+ otherwise.
834
+
835
+ EXAMPLES::
836
+
837
+ sage: from sage.combinat.t_sequences import base_sequences_smallcases
838
+ sage: base_sequences_smallcases(8, 7)
839
+ [[1, -1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1],
840
+ [1, -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1],
841
+ [1, 1, -1, 1, -1, 1, -1, 1],
842
+ [1, -1, -1, -1, -1, -1, -1, 1]]
843
+
844
+ If ``existence`` is ``True``, the function returns a boolean ::
845
+
846
+ sage: base_sequences_smallcases(8, 7, existence=True)
847
+ True
848
+ sage: base_sequences_smallcases(7, 5, existence=True)
849
+ False
850
+
851
+ TESTS::
852
+
853
+ sage: base_sequences_smallcases(7, 5)
854
+ Traceback (most recent call last):
855
+ ...
856
+ ValueError: Base sequences of order 12, 12, 7, 7 not yet implemented.
857
+ sage: seqs = base_sequences_smallcases(16, 15)
858
+ sage: len(seqs[0]) == len(seqs[1]) == 16+15
859
+ True
860
+ sage: len(seqs[2]) == len(seqs[3]) == 16
861
+ True
862
+ """
863
+
864
+ if existence:
865
+ return p == n-1 and turyn_type_sequences_smallcases(n, existence=True)
866
+
867
+ if p == n-1 and turyn_type_sequences_smallcases(n, existence=True):
868
+ if existence:
869
+ return True
870
+ turyn_type_seqs = turyn_type_sequences_smallcases(n)
871
+ return base_sequences_construction(turyn_type_seqs, check=check)
872
+ if p == 1 and turyn_sequences_smallcases(n + p, existence=True):
873
+ if existence:
874
+ return True
875
+ return turyn_sequences_smallcases(n + p)
876
+
877
+ raise ValueError(f'Base sequences of order {n+p}, {n+p}, {n}, {n} not yet implemented.')