passagemath-pari 10.6.32__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.

Potentially problematic release.


This version of passagemath-pari might be problematic. Click here for more details.

Files changed (331) hide show
  1. PARIKernel/__init__.py +2 -0
  2. PARIKernel/__main__.py +5 -0
  3. PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
  4. PARIKernel/io.pxd +7 -0
  5. PARIKernel/io.pyx +84 -0
  6. PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
  7. PARIKernel/kernel.pyx +260 -0
  8. PARIKernel/paridecl.pxd +95 -0
  9. PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
  10. PARIKernel/svg.pyx +52 -0
  11. cypari2/__init__.py +8 -0
  12. cypari2/auto_paridecl.pxd +1070 -0
  13. cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
  14. cypari2/closure.pxd +5 -0
  15. cypari2/closure.pyx +246 -0
  16. cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
  17. cypari2/convert.pxd +80 -0
  18. cypari2/convert.pyx +613 -0
  19. cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
  20. cypari2/custom_block.pyx +30 -0
  21. cypari2/cypari.h +13 -0
  22. cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
  23. cypari2/gen.pxd +69 -0
  24. cypari2/gen.pyx +4819 -0
  25. cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
  26. cypari2/handle_error.pxd +7 -0
  27. cypari2/handle_error.pyx +232 -0
  28. cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
  29. cypari2/pari_instance.pxd +27 -0
  30. cypari2/pari_instance.pyx +1438 -0
  31. cypari2/paridecl.pxd +5353 -0
  32. cypari2/paripriv.pxd +34 -0
  33. cypari2/pycore_long.h +98 -0
  34. cypari2/pycore_long.pxd +9 -0
  35. cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
  36. cypari2/stack.pxd +27 -0
  37. cypari2/stack.pyx +278 -0
  38. cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
  39. cypari2/string_utils.pxd +29 -0
  40. cypari2/string_utils.pyx +65 -0
  41. cypari2/types.pxd +147 -0
  42. passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
  43. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
  44. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
  45. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
  46. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
  47. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
  48. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
  49. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
  50. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
  51. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
  52. passagemath_pari-10.6.32.dist-info/METADATA +209 -0
  53. passagemath_pari-10.6.32.dist-info/RECORD +331 -0
  54. passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
  55. passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
  56. passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
  57. passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  58. passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
  59. passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  60. passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  61. passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
  62. passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  63. passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
  64. passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  65. passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  66. passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  67. passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
  68. passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  69. passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
  70. passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  71. passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
  72. passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  73. passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
  74. passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
  75. passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
  76. passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
  77. sage/all__sagemath_pari.py +26 -0
  78. sage/databases/all__sagemath_pari.py +7 -0
  79. sage/databases/conway.py +274 -0
  80. sage/ext/all__sagemath_pari.py +1 -0
  81. sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/ext/memory.pyx +98 -0
  83. sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
  84. sage/ext_data/pari/buzzard/Tpprog.g +179 -0
  85. sage/ext_data/pari/buzzard/genusn.g +129 -0
  86. sage/ext_data/pari/dokchitser/computel.gp +740 -0
  87. sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
  88. sage/ext_data/pari/dokchitser/ex-bsw +43 -0
  89. sage/ext_data/pari/dokchitser/ex-chgen +48 -0
  90. sage/ext_data/pari/dokchitser/ex-chqua +37 -0
  91. sage/ext_data/pari/dokchitser/ex-delta +35 -0
  92. sage/ext_data/pari/dokchitser/ex-eisen +30 -0
  93. sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
  94. sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
  95. sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
  96. sage/ext_data/pari/dokchitser/ex-nf +48 -0
  97. sage/ext_data/pari/dokchitser/ex-shin +50 -0
  98. sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
  99. sage/ext_data/pari/dokchitser/ex-zeta +27 -0
  100. sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
  101. sage/ext_data/pari/dokchitser/testall +13 -0
  102. sage/ext_data/pari/simon/ell.gp +2129 -0
  103. sage/ext_data/pari/simon/ellQ.gp +2151 -0
  104. sage/ext_data/pari/simon/ellcommon.gp +126 -0
  105. sage/ext_data/pari/simon/qfsolve.gp +722 -0
  106. sage/ext_data/pari/simon/resultant3.gp +306 -0
  107. sage/groups/all__sagemath_pari.py +3 -0
  108. sage/groups/pari_group.py +175 -0
  109. sage/interfaces/all__sagemath_pari.py +1 -0
  110. sage/interfaces/genus2reduction.py +464 -0
  111. sage/interfaces/gp.py +1114 -0
  112. sage/libs/all__sagemath_pari.py +2 -0
  113. sage/libs/linkages/__init__.py +1 -0
  114. sage/libs/linkages/padics/API.pxi +617 -0
  115. sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
  116. sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
  117. sage/libs/linkages/padics/__init__.py +1 -0
  118. sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
  119. sage/libs/linkages/padics/mpz.pxi +691 -0
  120. sage/libs/linkages/padics/relaxed/API.pxi +518 -0
  121. sage/libs/linkages/padics/relaxed/__init__.py +1 -0
  122. sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
  123. sage/libs/linkages/padics/unram_shared.pxi +247 -0
  124. sage/libs/pari/__init__.py +210 -0
  125. sage/libs/pari/all.py +5 -0
  126. sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
  127. sage/libs/pari/convert_flint.pxd +14 -0
  128. sage/libs/pari/convert_flint.pyx +159 -0
  129. sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
  130. sage/libs/pari/convert_gmp.pxd +14 -0
  131. sage/libs/pari/convert_gmp.pyx +210 -0
  132. sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/libs/pari/convert_sage.pxd +16 -0
  134. sage/libs/pari/convert_sage.pyx +588 -0
  135. sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
  136. sage/libs/pari/convert_sage_complex_double.pxd +14 -0
  137. sage/libs/pari/convert_sage_complex_double.pyx +132 -0
  138. sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/libs/pari/convert_sage_matrix.pyx +106 -0
  140. sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
  141. sage/libs/pari/convert_sage_real_double.pxd +5 -0
  142. sage/libs/pari/convert_sage_real_double.pyx +14 -0
  143. sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
  145. sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
  146. sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/libs/pari/misc.pxd +4 -0
  148. sage/libs/pari/misc.pyx +26 -0
  149. sage/libs/pari/tests.py +1848 -0
  150. sage/matrix/all__sagemath_pari.py +1 -0
  151. sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
  152. sage/matrix/matrix_integer_pari.pyx +187 -0
  153. sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
  154. sage/matrix/matrix_rational_pari.pyx +160 -0
  155. sage/quadratic_forms/all__sagemath_pari.py +10 -0
  156. sage/quadratic_forms/genera/all.py +9 -0
  157. sage/quadratic_forms/genera/genus.py +3506 -0
  158. sage/quadratic_forms/genera/normal_form.py +1519 -0
  159. sage/quadratic_forms/genera/spinor_genus.py +243 -0
  160. sage/quadratic_forms/qfsolve.py +255 -0
  161. sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
  162. sage/quadratic_forms/quadratic_form__genus.py +141 -0
  163. sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
  164. sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
  165. sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
  166. sage/quadratic_forms/quadratic_form__mass.py +69 -0
  167. sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
  168. sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
  169. sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
  170. sage/quadratic_forms/special_values.py +323 -0
  171. sage/rings/all__sagemath_pari.py +15 -0
  172. sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
  173. sage/rings/factorint_pari.pyx +80 -0
  174. sage/rings/finite_rings/all__sagemath_pari.py +1 -0
  175. sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/rings/finite_rings/element_givaro.pxd +91 -0
  177. sage/rings/finite_rings/element_givaro.pyx +1769 -0
  178. sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
  179. sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
  180. sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
  181. sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  182. sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
  183. sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
  184. sage/rings/finite_rings/finite_field_givaro.py +612 -0
  185. sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
  186. sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  187. sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
  188. sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
  189. sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  190. sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
  191. sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  192. sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
  193. sage/rings/function_field/all__sagemath_pari.py +1 -0
  194. sage/rings/function_field/valuation.py +1450 -0
  195. sage/rings/function_field/valuation_ring.py +212 -0
  196. sage/rings/number_field/all__sagemath_pari.py +14 -0
  197. sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
  198. sage/rings/number_field/totallyreal.pyx +509 -0
  199. sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
  200. sage/rings/number_field/totallyreal_data.pxd +26 -0
  201. sage/rings/number_field/totallyreal_data.pyx +928 -0
  202. sage/rings/number_field/totallyreal_phc.py +144 -0
  203. sage/rings/number_field/totallyreal_rel.py +1018 -0
  204. sage/rings/padics/CA_template.pxi +1847 -0
  205. sage/rings/padics/CA_template_header.pxi +50 -0
  206. sage/rings/padics/CR_template.pxi +2563 -0
  207. sage/rings/padics/CR_template_header.pxi +57 -0
  208. sage/rings/padics/FM_template.pxi +1575 -0
  209. sage/rings/padics/FM_template_header.pxi +50 -0
  210. sage/rings/padics/FP_template.pxi +2176 -0
  211. sage/rings/padics/FP_template_header.pxi +57 -0
  212. sage/rings/padics/all.py +3 -0
  213. sage/rings/padics/all__sagemath_pari.py +11 -0
  214. sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  215. sage/rings/padics/common_conversion.pxd +15 -0
  216. sage/rings/padics/common_conversion.pyx +508 -0
  217. sage/rings/padics/eisenstein_extension_generic.py +232 -0
  218. sage/rings/padics/factory.py +3623 -0
  219. sage/rings/padics/generic_nodes.py +1615 -0
  220. sage/rings/padics/lattice_precision.py +2889 -0
  221. sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
  222. sage/rings/padics/morphism.pxd +11 -0
  223. sage/rings/padics/morphism.pyx +366 -0
  224. sage/rings/padics/padic_base_generic.py +467 -0
  225. sage/rings/padics/padic_base_leaves.py +1235 -0
  226. sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
  227. sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
  228. sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
  229. sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
  230. sage/rings/padics/padic_capped_relative_element.pxd +14 -0
  231. sage/rings/padics/padic_capped_relative_element.pyx +614 -0
  232. sage/rings/padics/padic_extension_generic.py +990 -0
  233. sage/rings/padics/padic_extension_leaves.py +738 -0
  234. sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
  235. sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
  236. sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
  237. sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
  238. sage/rings/padics/padic_floating_point_element.pxd +14 -0
  239. sage/rings/padics/padic_floating_point_element.pyx +447 -0
  240. sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
  241. sage/rings/padics/padic_generic_element.pxd +48 -0
  242. sage/rings/padics/padic_generic_element.pyx +4642 -0
  243. sage/rings/padics/padic_lattice_element.py +1342 -0
  244. sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
  245. sage/rings/padics/padic_printing.pxd +38 -0
  246. sage/rings/padics/padic_printing.pyx +1505 -0
  247. sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
  248. sage/rings/padics/padic_relaxed_element.pxd +56 -0
  249. sage/rings/padics/padic_relaxed_element.pyx +18 -0
  250. sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
  251. sage/rings/padics/padic_relaxed_errors.pxd +11 -0
  252. sage/rings/padics/padic_relaxed_errors.pyx +71 -0
  253. sage/rings/padics/padic_template_element.pxi +1212 -0
  254. sage/rings/padics/padic_template_element_header.pxi +50 -0
  255. sage/rings/padics/padic_valuation.py +1423 -0
  256. sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
  257. sage/rings/padics/pow_computer_flint.pxd +38 -0
  258. sage/rings/padics/pow_computer_flint.pyx +641 -0
  259. sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
  260. sage/rings/padics/pow_computer_relative.pxd +29 -0
  261. sage/rings/padics/pow_computer_relative.pyx +415 -0
  262. sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
  263. sage/rings/padics/qadic_flint_CA.pxd +21 -0
  264. sage/rings/padics/qadic_flint_CA.pyx +130 -0
  265. sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
  266. sage/rings/padics/qadic_flint_CR.pxd +13 -0
  267. sage/rings/padics/qadic_flint_CR.pyx +172 -0
  268. sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
  269. sage/rings/padics/qadic_flint_FM.pxd +14 -0
  270. sage/rings/padics/qadic_flint_FM.pyx +111 -0
  271. sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
  272. sage/rings/padics/qadic_flint_FP.pxd +12 -0
  273. sage/rings/padics/qadic_flint_FP.pyx +165 -0
  274. sage/rings/padics/relative_extension_leaves.py +429 -0
  275. sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
  276. sage/rings/padics/relative_ramified_CA.pxd +9 -0
  277. sage/rings/padics/relative_ramified_CA.pyx +33 -0
  278. sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
  279. sage/rings/padics/relative_ramified_CR.pxd +8 -0
  280. sage/rings/padics/relative_ramified_CR.pyx +33 -0
  281. sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
  282. sage/rings/padics/relative_ramified_FM.pxd +9 -0
  283. sage/rings/padics/relative_ramified_FM.pyx +33 -0
  284. sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
  285. sage/rings/padics/relative_ramified_FP.pxd +8 -0
  286. sage/rings/padics/relative_ramified_FP.pyx +33 -0
  287. sage/rings/padics/relaxed_template.pxi +4229 -0
  288. sage/rings/padics/relaxed_template_header.pxi +160 -0
  289. sage/rings/padics/tests.py +35 -0
  290. sage/rings/padics/tutorial.py +341 -0
  291. sage/rings/padics/unramified_extension_generic.py +335 -0
  292. sage/rings/padics/witt_vector.py +917 -0
  293. sage/rings/padics/witt_vector_ring.py +934 -0
  294. sage/rings/pari_ring.py +235 -0
  295. sage/rings/polynomial/all__sagemath_pari.py +1 -0
  296. sage/rings/polynomial/padics/all.py +1 -0
  297. sage/rings/polynomial/padics/polynomial_padic.py +360 -0
  298. sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
  299. sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
  300. sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
  301. sage/rings/power_series_pari.pxd +6 -0
  302. sage/rings/power_series_pari.pyx +934 -0
  303. sage/rings/tate_algebra.py +1282 -0
  304. sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  305. sage/rings/tate_algebra_element.pxd +49 -0
  306. sage/rings/tate_algebra_element.pyx +3464 -0
  307. sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  308. sage/rings/tate_algebra_ideal.pxd +7 -0
  309. sage/rings/tate_algebra_ideal.pyx +1307 -0
  310. sage/rings/valuation/all.py +7 -0
  311. sage/rings/valuation/augmented_valuation.py +2118 -0
  312. sage/rings/valuation/developing_valuation.py +362 -0
  313. sage/rings/valuation/gauss_valuation.py +812 -0
  314. sage/rings/valuation/inductive_valuation.py +1686 -0
  315. sage/rings/valuation/limit_valuation.py +946 -0
  316. sage/rings/valuation/mapped_valuation.py +656 -0
  317. sage/rings/valuation/scaled_valuation.py +322 -0
  318. sage/rings/valuation/trivial_valuation.py +382 -0
  319. sage/rings/valuation/valuation.py +1119 -0
  320. sage/rings/valuation/valuation_space.py +1615 -0
  321. sage/rings/valuation/valuations_catalog.py +10 -0
  322. sage/rings/valuation/value_group.py +697 -0
  323. sage/schemes/all__sagemath_pari.py +1 -0
  324. sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
  325. sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
  326. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
  327. sage_wheels/bin/gp +0 -0
  328. sage_wheels/bin/gp2c +0 -0
  329. sage_wheels/bin/gp2c-run +57 -0
  330. sage_wheels/bin/xeus-gp +0 -0
  331. sage_wheels/share/gp2c/func.dsc +18414 -0
@@ -0,0 +1,990 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ # sage.doctest: needs sage.libs.ntl
3
+ """
4
+ `p`-adic Extension Generic
5
+
6
+ A common superclass for all extensions of Qp and Zp.
7
+
8
+ AUTHORS:
9
+
10
+ - David Roe
11
+ """
12
+
13
+ #*****************************************************************************
14
+ # Copyright (C) 2007-2013 David Roe <roed.math@gmail.com>
15
+ # William Stein <wstein@gmail.com>
16
+ #
17
+ # Distributed under the terms of the GNU General Public License (GPL)
18
+ # as published by the Free Software Foundation; either version 2 of
19
+ # the License, or (at your option) any later version.
20
+ #
21
+ # http://www.gnu.org/licenses/
22
+ #*****************************************************************************
23
+
24
+ import sage.rings.abc
25
+
26
+ from .padic_generic import pAdicGeneric, ResidueLiftingMap
27
+ from .padic_base_generic import pAdicBaseGeneric
28
+ from sage.rings.number_field.number_field_base import NumberField
29
+ from sage.rings.rational_field import QQ
30
+ from sage.rings.infinity import Infinity
31
+ from sage.structure.richcmp import op_EQ
32
+ from functools import reduce
33
+ from sage.categories.morphism import Morphism
34
+ from sage.categories.map import Map
35
+ from sage.categories.sets_with_partial_maps import SetsWithPartialMaps
36
+ from sage.categories.integral_domains import IntegralDomains
37
+ from sage.categories.euclidean_domains import EuclideanDomains
38
+ from sage.categories.metric_spaces import MetricSpaces
39
+ from sage.categories.fields import Fields
40
+ from sage.categories.homset import Hom
41
+ from sage.misc.flatten import flatten
42
+ from sage.misc.cachefunc import cached_method
43
+ from sage.structure.richcmp import rich_to_bool
44
+
45
+
46
+ class pAdicExtensionGeneric(pAdicGeneric):
47
+ def __init__(self, poly, prec, print_mode, names, element_class):
48
+ """
49
+ Initialization.
50
+
51
+ EXAMPLES::
52
+
53
+ sage: R = Zp(5,5)
54
+ sage: S.<x> = R[]
55
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
56
+ sage: W.<w> = R.ext(f) # indirect doctest
57
+ """
58
+ #type checking done in factory
59
+ self._given_poly = poly
60
+ R = poly.base_ring()
61
+ # We'll deal with the different names better later.
62
+ # Using a tuple here is mostly needed for more general extensions
63
+ # (ie not eisenstein or unramified)
64
+ print_mode['unram_name'] = names[2]
65
+ print_mode['ram_name'] = names[3]
66
+ print_mode['var_name'] = names[0]
67
+ names = names[0]
68
+ pAdicGeneric.__init__(self, R, R.prime(), prec, print_mode, names, element_class)
69
+ self._populate_coercion_lists_(coerce_list=[R])
70
+
71
+ def _coerce_map_from_(self, R):
72
+ """
73
+ Finds coercion maps from R to this ring.
74
+
75
+ EXAMPLES::
76
+
77
+ sage: R = Zp(5); S.<x> = ZZ[]; f = x^5 + 25*x - 5; W.<w> = R.ext(f)
78
+ sage: L = W.fraction_field()
79
+ sage: w + L(w) # indirect doctest
80
+ 2*w + O(w^101)
81
+ sage: w + R(5,2)
82
+ w + w^5 + O(w^10)
83
+ """
84
+ # Far more functionality needs to be added here later.
85
+ if R is self.base_ring():
86
+ return True
87
+ elif isinstance(R, pAdicExtensionGeneric) and R.fraction_field() is self:
88
+ if self._implementation == 'NTL':
89
+ return True
90
+ elif R._prec_type() == 'capped-abs':
91
+ if R.absolute_e() == 1:
92
+ from sage.rings.padics.qadic_flint_CA import pAdicCoercion_CA_frac_field as coerce_map
93
+ else:
94
+ from sage.rings.padics.relative_ramified_CA import pAdicCoercion_CA_frac_field as coerce_map
95
+ elif R._prec_type() == 'capped-rel':
96
+ if R.absolute_e() == 1:
97
+ from sage.rings.padics.qadic_flint_CR import pAdicCoercion_CR_frac_field as coerce_map
98
+ else:
99
+ from sage.rings.padics.relative_ramified_CR import pAdicCoercion_CR_frac_field as coerce_map
100
+ elif R._prec_type() == 'floating-point':
101
+ if R.absolute_e() == 1:
102
+ from sage.rings.padics.qadic_flint_FP import pAdicCoercion_FP_frac_field as coerce_map
103
+ else:
104
+ from sage.rings.padics.relative_ramified_FP import pAdicCoercion_FP_frac_field as coerce_map
105
+ elif R._prec_type() == 'fixed-mod':
106
+ if R.absolute_e() == 1:
107
+ from sage.rings.padics.qadic_flint_FM import pAdicCoercion_FM_frac_field as coerce_map
108
+ else:
109
+ from sage.rings.padics.relative_ramified_FM import pAdicCoercion_FM_frac_field as coerce_map
110
+ return coerce_map(R, self)
111
+
112
+ def _extension_type(self):
113
+ """
114
+ Return the type (``Unramified``, ``Eisenstein``) of this
115
+ extension as a string, if any.
116
+
117
+ Used for printing.
118
+
119
+ EXAMPLES::
120
+
121
+ sage: K.<a> = Qq(5^3)
122
+ sage: K._extension_type()
123
+ 'Unramified'
124
+
125
+ sage: x = polygen(ZZ, 'x')
126
+ sage: L.<pi> = Qp(5).extension(x^2 - 5)
127
+ sage: L._extension_type()
128
+ 'Eisenstein'
129
+ """
130
+ return ""
131
+
132
+ def _repr_(self, do_latex=False):
133
+ """
134
+ Return a print representation of this extension.
135
+
136
+ EXAMPLES::
137
+
138
+ sage: R = Zp(7,10)
139
+ sage: R
140
+ 7-adic Ring with capped relative precision 10
141
+ sage: R1.<a> = Zq(7^3)
142
+ sage: R1
143
+ 7-adic Unramified Extension Ring in a defined by x^3 + 6*x^2 + 4
144
+ sage: R1._latex_()
145
+ '\\Bold{Z}_{7^{3}}'
146
+ sage: x = polygen(ZZ, 'x')
147
+ sage: R2.<t> = R.ext(x^2 + 7)
148
+ sage: R2 # indirect doctest
149
+ 7-adic Eisenstein Extension Ring in t defined by x^2 + 7
150
+ sage: R2._latex_()
151
+ '\\Bold{Z}_{7}[t]'
152
+
153
+ sage: K = Qp(7,10)
154
+ sage: K
155
+ 7-adic Field with capped relative precision 10
156
+ sage: K1.<a> = Qq(7^3)
157
+ sage: K1
158
+ 7-adic Unramified Extension Field in a defined by x^3 + 6*x^2 + 4
159
+ sage: K1._latex_()
160
+ '\\Bold{Q}_{7^{3}}'
161
+ sage: K2.<t> = K.ext(x^2+7)
162
+ sage: K2 # indirect doctest
163
+ 7-adic Eisenstein Extension Field in t defined by x^2 + 7
164
+ sage: K2._latex_()
165
+ '\\Bold{Q}_{7}[t]'
166
+ """
167
+ type = self._extension_type()
168
+ base = self.base_ring()
169
+ p = self.prime()
170
+ if do_latex:
171
+ if self.absolute_e() == 1:
172
+ # unramified extension
173
+ if self.is_field():
174
+ letter = "\\Bold{Q}"
175
+ else:
176
+ letter = "\\Bold{Z}"
177
+ f = self.absolute_f()
178
+ if f == 1:
179
+ subscript = str(p)
180
+ else:
181
+ subscript = "%s^{%s}" % (p,f)
182
+ return "%s_{%s}" % (letter, subscript)
183
+ else:
184
+ return "%s[%s]" % (self.base_ring()._repr_(do_latex=True), self.latex_name())
185
+ else:
186
+ if type != "":
187
+ type += " "
188
+ s = "%s-adic %sExtension %s in %s defined by %s" % (p, type, "Field" if self.is_field() else "Ring", self.variable_name(), self.defining_polynomial(exact=True))
189
+ if base.absolute_degree() > 1:
190
+ s += " over its base " + ("field" if base.is_field() else "ring")
191
+ return s
192
+
193
+ def _convert_map_from_(self, R):
194
+ """
195
+ Finds conversion maps from R to this ring.
196
+
197
+ Currently, a conversion exists if the defining polynomial is the same.
198
+
199
+ EXAMPLES::
200
+
201
+ sage: R.<a> = Zq(125)
202
+ sage: S = R.change(type='capped-abs', prec=40, print_mode='terse', print_pos=False)
203
+ sage: S(a - 15)
204
+ -15 + a + O(5^20)
205
+
206
+ We get conversions from the exact field::
207
+
208
+ sage: K = R.exact_field(); K
209
+ Number Field in a with defining polynomial x^3 + 3*x + 3
210
+ sage: R(K.gen())
211
+ a + O(5^20)
212
+
213
+ and its maximal order::
214
+
215
+ sage: OK = K.maximal_order()
216
+ sage: R(OK.gen(1))
217
+ a + O(5^20)
218
+ """
219
+ cat = None
220
+ if self._implementation == 'NTL' and R == QQ:
221
+ # Want to use DefaultConvertMap_unique
222
+ return None
223
+ if isinstance(R, pAdicExtensionGeneric) and R.prime() == self.prime() and R.defining_polynomial(exact=True) == self.defining_polynomial(exact=True):
224
+ if R.is_field() and not self.is_field():
225
+ cat = SetsWithPartialMaps()
226
+ elif R.category() is self.category():
227
+ cat = R.category()
228
+ else:
229
+ cat = EuclideanDomains() & MetricSpaces().Complete()
230
+ elif isinstance(R, sage.rings.abc.Order) and R.number_field().defining_polynomial() == self.defining_polynomial():
231
+ cat = IntegralDomains()
232
+ elif isinstance(R, NumberField) and R.defining_polynomial() == self.defining_polynomial():
233
+ if self.is_field():
234
+ cat = Fields()
235
+ else:
236
+ cat = SetsWithPartialMaps()
237
+ else:
238
+ k = self.residue_field()
239
+ if R is k:
240
+ return ResidueLiftingMap._create_(R, self)
241
+ if cat is not None:
242
+ H = Hom(R, self, cat)
243
+ return H.__make_element_class__(DefPolyConversion)(H)
244
+
245
+ def __eq__(self, other):
246
+ """
247
+ Return ``True`` if ``self == other`` and ``False`` otherwise.
248
+
249
+ We consider two `p`-adic rings or fields to be equal if they are
250
+ equal mathematically, and also have the same precision cap and
251
+ printing parameters.
252
+
253
+ EXAMPLES::
254
+
255
+ sage: R.<a> = Qq(27)
256
+ sage: S.<a> = Qq(27,print_mode='val-unit')
257
+ sage: R == S
258
+ False
259
+ sage: S.<a> = Qq(27,type='capped-rel')
260
+ sage: R == S
261
+ True
262
+ sage: R is S
263
+ True
264
+ """
265
+ if not isinstance(other, pAdicExtensionGeneric):
266
+ return False
267
+
268
+ return (self.ground_ring() == other.ground_ring() and
269
+ self.defining_polynomial() == other.defining_polynomial() and
270
+ self.precision_cap() == other.precision_cap() and
271
+ self._printer.richcmp_modes(other._printer, op_EQ))
272
+
273
+ def __ne__(self, other):
274
+ """
275
+ Test inequality.
276
+
277
+ EXAMPLES::
278
+
279
+ sage: R.<a> = Qq(27)
280
+ sage: S.<a> = Qq(27,print_mode='val-unit')
281
+ sage: R != S
282
+ True
283
+ """
284
+ return not self.__eq__(other)
285
+
286
+ def __hash__(self):
287
+ """
288
+ Return the hash of ``self``.
289
+
290
+ EXAMPLES::
291
+
292
+ sage: R.<a> = Qq(27)
293
+ sage: S.<a> = Qq(5,print_mode='val-unit')
294
+ sage: hash(R) == hash(S)
295
+ False
296
+ sage: S.<a> = Qq(27,type='capped-rel')
297
+ sage: hash(R) == hash(S)
298
+ True
299
+ """
300
+ # _printer is not hashable, hence not taken into account
301
+ return hash((self.ground_ring(), self.defining_polynomial(exact=True),
302
+ self.precision_cap()))
303
+
304
+ #def absolute_discriminant(self):
305
+ # raise NotImplementedError
306
+
307
+ #def discriminant(self):
308
+ # raise NotImplementedError
309
+
310
+ #def is_abelian(self):
311
+ # raise NotImplementedError
312
+
313
+ #def is_normal(self):
314
+ # raise NotImplementedError
315
+
316
+ def defining_polynomial(self, var=None, exact=False):
317
+ """
318
+ Return the polynomial defining this extension.
319
+
320
+ INPUT:
321
+
322
+ - ``var`` -- string (default: ``'x'``); the name of the variable
323
+
324
+ - ``exact`` -- boolean (default: ``False``); whether to return the underlying exact
325
+ defining polynomial rather than the one with coefficients in the base ring
326
+
327
+ EXAMPLES::
328
+
329
+ sage: R = Zp(5,5)
330
+ sage: S.<x> = R[]
331
+ sage: f = x^5 + 75*x^3 - 15*x^2 + 125*x - 5
332
+ sage: W.<w> = R.ext(f)
333
+ sage: W.defining_polynomial()
334
+ (1 + O(5^5))*x^5 + O(5^6)*x^4 + (3*5^2 + O(5^6))*x^3 + (2*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + O(5^6))*x^2 + (5^3 + O(5^6))*x + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + O(5^6)
335
+ sage: W.defining_polynomial(exact=True)
336
+ x^5 + 75*x^3 - 15*x^2 + 125*x - 5
337
+
338
+ sage: W.defining_polynomial(var='y', exact=True)
339
+ y^5 + 75*y^3 - 15*y^2 + 125*y - 5
340
+
341
+ .. SEEALSO::
342
+
343
+ :meth:`modulus`
344
+ :meth:`exact_field`
345
+ """
346
+ if exact:
347
+ ans = self._exact_modulus
348
+ else:
349
+ ans = self._given_poly
350
+ if var is None:
351
+ return ans
352
+ else:
353
+ return ans.change_variable_name(var)
354
+
355
+ def exact_field(self):
356
+ r"""
357
+ Return a number field with the same defining polynomial.
358
+
359
+ Note that this method always returns a field, even for a `p`-adic
360
+ ring.
361
+
362
+ EXAMPLES::
363
+
364
+ sage: R = Zp(5,5)
365
+ sage: S.<x> = R[]
366
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
367
+ sage: W.<w> = R.ext(f)
368
+ sage: W.exact_field()
369
+ Number Field in w with defining polynomial x^5 + 75*x^3 - 15*x^2 + 125*x - 5
370
+
371
+ .. SEEALSO::
372
+
373
+ :meth:`defining_polynomial`
374
+ :meth:`modulus`
375
+ """
376
+ return self.base_ring().exact_field().extension(self._exact_modulus, self.variable_name())
377
+
378
+ def exact_ring(self):
379
+ """
380
+ Return the order with the same defining polynomial.
381
+
382
+ Will raise a :exc:`ValueError` if the coefficients of the defining
383
+ polynomial are not integral.
384
+
385
+ EXAMPLES::
386
+
387
+ sage: R = Zp(5,5)
388
+ sage: S.<x> = R[]
389
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
390
+ sage: W.<w> = R.ext(f)
391
+ sage: W.exact_ring()
392
+ Order generated by w in Number Field in w with defining polynomial x^5 + 75*x^3 - 15*x^2 + 125*x - 5
393
+
394
+ sage: T = Zp(5,5)
395
+ sage: U.<z> = T[]
396
+ sage: g = 2*z^4 + 1
397
+ sage: V.<v> = T.ext(g)
398
+ sage: V.exact_ring()
399
+ Traceback (most recent call last):
400
+ ...
401
+ ValueError: each generator must be integral
402
+ """
403
+ return self.base_ring().exact_ring().extension(self.defining_polynomial(exact=True), self.variable_name())
404
+
405
+ def modulus(self, exact=False):
406
+ r"""
407
+ Return the polynomial defining this extension.
408
+
409
+ INPUT:
410
+
411
+ - ``exact`` -- boolean (default: ``False``); whether to return the underlying exact
412
+ defining polynomial rather than the one with coefficients in the base ring
413
+
414
+ EXAMPLES::
415
+
416
+ sage: R = Zp(5,5)
417
+ sage: S.<x> = R[]
418
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
419
+ sage: W.<w> = R.ext(f)
420
+ sage: W.modulus()
421
+ (1 + O(5^5))*x^5 + O(5^6)*x^4 + (3*5^2 + O(5^6))*x^3 + (2*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + O(5^6))*x^2 + (5^3 + O(5^6))*x + 4*5 + 4*5^2 + 4*5^3 + 4*5^4 + 4*5^5 + O(5^6)
422
+ sage: W.modulus(exact=True)
423
+ x^5 + 75*x^3 - 15*x^2 + 125*x - 5
424
+
425
+ .. SEEALSO::
426
+
427
+ :meth:`defining_polynomial`
428
+ :meth:`exact_field`
429
+ """
430
+ return self.defining_polynomial(exact=exact)
431
+
432
+ def ground_ring(self):
433
+ """
434
+ Return the ring of which this ring is an extension.
435
+
436
+ EXAMPLES::
437
+
438
+ sage: R = Zp(5,5)
439
+ sage: S.<x> = R[]
440
+ sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5
441
+ sage: W.<w> = R.ext(f)
442
+ sage: W.ground_ring()
443
+ 5-adic Ring with capped relative precision 5
444
+ """
445
+ return self._given_poly.base_ring()
446
+
447
+ def ground_ring_of_tower(self):
448
+ """
449
+ Return the `p`-adic base ring of which this is ultimately an
450
+ extension.
451
+
452
+ Currently this function is identical to ``ground_ring()``, since
453
+ relative extensions have not yet been implemented.
454
+
455
+ EXAMPLES::
456
+
457
+ sage: Qq(27,30,names='a').ground_ring_of_tower()
458
+ 3-adic Field with capped relative precision 30
459
+ """
460
+ if isinstance(self.ground_ring(), pAdicBaseGeneric):
461
+ return self.ground_ring()
462
+ else:
463
+ return self.ground_ring().ground_ring_of_tower()
464
+
465
+ #def is_isomorphic(self, ring):
466
+ # raise NotImplementedError
467
+
468
+ def polynomial_ring(self):
469
+ """
470
+ Return the polynomial ring of which this is a quotient.
471
+
472
+ EXAMPLES::
473
+
474
+ sage: Qq(27,30,names='a').polynomial_ring()
475
+ Univariate Polynomial Ring in x over 3-adic Field with capped relative precision 30
476
+ """
477
+ return self._given_poly.parent()
478
+
479
+ #def teichmuller(self, x, prec=None):
480
+ # if prec is None:
481
+ # prec = self.precision_cap()
482
+ # x = self(x, prec)
483
+ # if x.valuation() > 0:
484
+ # return self(0)
485
+ # q = self.residue_class_field().order()
486
+ # u = 1 / self(1 - q, prec)
487
+ # delta = u * (1 - x ** (q - 1))
488
+ # xnew = x - x*delta*(1 - q * delta)
489
+ # while x != xnew:
490
+ # x = xnew
491
+ # delta = u*(1-x**(q-1))
492
+ # xnew = x - x*delta*(1-q*delta)
493
+ # return x
494
+
495
+ def construction(self, forbid_frac_field=False):
496
+ """
497
+ Return the functorial construction of this ring, namely,
498
+ the algebraic extension of the base ring defined by the given
499
+ polynomial.
500
+
501
+ Also preserves other information that makes this ring unique
502
+ (e.g. precision, rounding, print mode).
503
+
504
+ INPUT:
505
+
506
+ - ``forbid_frac_field`` -- require a completion functor rather
507
+ than a fraction field functor. This is used in the
508
+ :meth:`sage.rings.padics.local_generic.LocalGeneric.change` method.
509
+
510
+ EXAMPLES::
511
+
512
+ sage: R.<a> = Zq(25, 8, print_mode='val-unit')
513
+ sage: c, R0 = R.construction(); R0
514
+ 5-adic Ring with capped relative precision 8
515
+ sage: c(R0)
516
+ 5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2
517
+ sage: c(R0) == R
518
+ True
519
+
520
+ For a field, by default we return a fraction field functor. ::
521
+
522
+ sage: K.<a> = Qq(25, 8)
523
+ sage: c, R = K.construction(); R
524
+ 5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2
525
+ sage: c
526
+ FractionField
527
+
528
+ If you prefer an extension functor, you can use the ``forbit_frac_field`` keyword::
529
+
530
+ sage: c, R = K.construction(forbid_frac_field=True); R
531
+ 5-adic Field with capped relative precision 8
532
+ sage: c
533
+ AlgebraicExtensionFunctor
534
+ sage: c(R) is K
535
+ True
536
+ """
537
+ from sage.categories.pushout import AlgebraicExtensionFunctor as AEF, FractionField as FF
538
+ if not forbid_frac_field and self.is_field():
539
+ return (FF(), self.integer_ring())
540
+ return (AEF([self.defining_polynomial(exact=True)],
541
+ [self.variable_name()],
542
+ precs=[self.precision_cap()],
543
+ print_mode=self._printer.dict(),
544
+ implementations=[self._implementation]),
545
+ self.base_ring())
546
+
547
+ #def hasGNB(self):
548
+ # raise NotImplementedError
549
+
550
+ def random_element(self):
551
+ """
552
+ Return a random element of ``self``.
553
+
554
+ This is done by picking a random element of the ground ring
555
+ self.degree() times, then treating those elements as
556
+ coefficients of a polynomial in self.gen().
557
+
558
+ EXAMPLES::
559
+
560
+ sage: R.<a> = Zq(125, 5)
561
+ sage: R.random_element().parent() is R
562
+ True
563
+ sage: R = Zp(5,3); S.<x> = ZZ[]; f = x^5 + 25*x^2 - 5; W.<w> = R.ext(f)
564
+ sage: W.random_element().parent() is W
565
+ True
566
+ """
567
+ return reduce(lambda x,y: x+y,
568
+ [self.ground_ring().random_element() * self.gen()**i for i in
569
+ range(self.modulus().degree())],
570
+ 0)
571
+
572
+ @cached_method(key=(lambda self, base, basis, map: (base or self.base_ring(), map)))
573
+ def free_module(self, base=None, basis=None, map=True):
574
+ """
575
+ Return a free module `V` over a specified base ring together with maps to and from `V`.
576
+
577
+ INPUT:
578
+
579
+ - ``base`` -- a subring `R` so that this ring/field is isomorphic
580
+ to a finite-rank free `R`-module `V`
581
+
582
+ - ``basis`` -- a basis for this ring/field over the base
583
+
584
+ - ``map`` -- boolean (default: ``True``); whether to return
585
+ `R`-linear maps to and from `V`
586
+
587
+ OUTPUT:
588
+
589
+ - A finite-rank free `R`-module `V`
590
+
591
+ - An `R`-module isomorphism from `V` to this ring/field
592
+ (only included if ``map`` is ``True``)
593
+
594
+ - An `R`-module isomorphism from this ring/field to `V`
595
+ (only included if ``map`` is ``True``)
596
+
597
+ EXAMPLES::
598
+
599
+ sage: R.<x> = ZZ[]
600
+ sage: K.<a> = Qq(125)
601
+ sage: L.<pi> = K.extension(x^2-5)
602
+ sage: V, from_V, to_V = K.free_module()
603
+ sage: W, from_W, to_W = L.free_module()
604
+ sage: W0, from_W0, to_W0 = L.free_module(base=Qp(5))
605
+ sage: to_V(a + O(5^7))
606
+ (O(5^7), 1 + O(5^7), O(5^7))
607
+ sage: to_W(a)
608
+ (a + O(5^20), O(5^20))
609
+ sage: to_W0(a + O(5^7))
610
+ (O(5^7), 1 + O(5^7), O(5^7), O(5^7), O(5^7), O(5^7))
611
+ sage: to_W(pi)
612
+ (O(5^21), 1 + O(5^20))
613
+ sage: to_W0(pi + O(pi^11))
614
+ (O(5^6), O(5^6), O(5^6), 1 + O(5^5), O(5^5), O(5^5))
615
+
616
+ sage: X, from_X, to_X = K.free_module(K)
617
+ sage: to_X(a)
618
+ (a + O(5^20))
619
+ """
620
+ if basis is not None:
621
+ raise NotImplementedError
622
+ B = self.base_ring()
623
+ if base is None:
624
+ base = B
625
+ A = B.base_ring()
626
+ d = self.relative_degree()
627
+ if base is B:
628
+ # May eventually want to take advantage of the fact that precision is flat
629
+ V = B**d
630
+ from_V = MapFreeModuleToOneStep
631
+ to_V = MapOneStepToFreeModule
632
+ elif base is A:
633
+ d *= B.relative_degree()
634
+ V = A**d
635
+ from_V = MapFreeModuleToTwoStep
636
+ to_V = MapTwoStepToFreeModule
637
+ elif base is self:
638
+ return super().free_module(base=base, basis=basis, map=map)
639
+ else:
640
+ raise NotImplementedError
641
+ FromV = Hom(V, self)
642
+ ToV = Hom(self, V)
643
+ from_V = FromV.__make_element_class__(from_V)(FromV)
644
+ to_V = ToV.__make_element_class__(to_V)(ToV)
645
+ return V, from_V, to_V
646
+
647
+ #def unit_group(self):
648
+ # raise NotImplementedError
649
+
650
+ #def unit_group_gens(self):
651
+ # raise NotImplementedError
652
+
653
+ #def principal_unit_group(self):
654
+ # raise NotImplementedError
655
+
656
+ #def zeta(self, n=None):
657
+ # raise NotImplementedError
658
+
659
+ #def zeta_order(self):
660
+ # raise NotImplementedError
661
+
662
+ # We could have used morphisms in the category
663
+ # FiniteDimensionalModulesWithBasis over Qp(p)
664
+ # But currently if you try to add this category
665
+ # to p-adic extensions you get errors on
666
+ # object creation. Moreover, some of the methods
667
+ # obtained from the category (such as dimension)
668
+ # don't take base ring into account, making it
669
+ # awkward to treat the same field as simultaneously
670
+ # an object in two free module categories with
671
+ # different base rings. So for now we
672
+ # just stick with Map.
673
+
674
+
675
+ class pAdicModuleIsomorphism(Map):
676
+ r"""
677
+ A base class for various isomorphisms between `p`-adic rings/fields and free modules.
678
+
679
+ EXAMPLES::
680
+
681
+ sage: K.<a> = Qq(125)
682
+ sage: V, fr, to = K.free_module()
683
+ sage: from sage.rings.padics.padic_extension_generic import pAdicModuleIsomorphism
684
+ sage: isinstance(fr, pAdicModuleIsomorphism)
685
+ True
686
+ """
687
+ def _repr_type(self):
688
+ r"""
689
+ EXAMPLES::
690
+
691
+ sage: K.<a> = Qq(125)
692
+ sage: V, fr, to = K.free_module()
693
+ sage: fr._repr_type()
694
+ 'Isomorphism'
695
+ """
696
+ return "Isomorphism"
697
+
698
+ def is_injective(self):
699
+ r"""
700
+ EXAMPLES::
701
+
702
+ sage: K.<a> = Qq(125)
703
+ sage: V, fr, to = K.free_module()
704
+ sage: fr.is_injective()
705
+ True
706
+ """
707
+ return True
708
+
709
+ def is_surjective(self):
710
+ r"""
711
+ EXAMPLES::
712
+
713
+ sage: K.<a> = Qq(125)
714
+ sage: V, fr, to = K.free_module()
715
+ sage: fr.is_surjective()
716
+ True
717
+ """
718
+ return True
719
+
720
+ def _richcmp_(self, other, op):
721
+ r"""
722
+ EXAMPLES::
723
+
724
+ sage: K.<a> = Qq(125)
725
+ sage: V, fr, to = K.free_module()
726
+ sage: fr == fr
727
+ True
728
+ """
729
+ # For maps of this type, equality depends only on the parent
730
+ if isinstance(other, pAdicModuleIsomorphism):
731
+ return rich_to_bool(op, 0)
732
+ else:
733
+ return rich_to_bool(op, 1)
734
+
735
+
736
+ class MapFreeModuleToOneStep(pAdicModuleIsomorphism):
737
+ """
738
+ The isomorphism from the underlying module of a one-step `p`-adic extension
739
+ to the extension.
740
+
741
+ EXAMPLES::
742
+
743
+ sage: K.<a> = Qq(125)
744
+ sage: V, fr, to = K.free_module()
745
+ sage: TestSuite(fr).run(skip=['_test_nonzero_equal']) # skipped since Qq(125) doesn't have dimension()
746
+ """
747
+ def _call_(self, x):
748
+ """
749
+ EXAMPLES::
750
+
751
+ sage: K.<a> = Qq(125)
752
+ sage: V, fr, to = K.free_module()
753
+ sage: v = V([1,2,3])
754
+ sage: fr(v)
755
+ (3*a^2 + 2*a + 1) + O(5^20)
756
+ """
757
+ return self.codomain()(list(x))
758
+
759
+ def _call_with_args(self, x, args=(), kwds={}):
760
+ """
761
+ EXAMPLES::
762
+
763
+ sage: K.<a> = Qq(125)
764
+ sage: V, fr, to = K.free_module()
765
+ sage: v = V([1,2,3])
766
+ sage: fr(v, 7)
767
+ (3*a^2 + 2*a + 1) + O(5^7)
768
+ """
769
+ return self.codomain()(list(x), *args, **kwds)
770
+
771
+
772
+ class MapOneStepToFreeModule(pAdicModuleIsomorphism):
773
+ """
774
+ The isomorphism from a one-step `p`-adic extension to its underlying free module.
775
+
776
+ EXAMPLES::
777
+
778
+ sage: K.<a> = Qq(125)
779
+ sage: V, fr, to = K.free_module()
780
+ sage: TestSuite(to).run()
781
+ """
782
+ def _call_(self, x):
783
+ """
784
+ EXAMPLES::
785
+
786
+ sage: R.<x> = ZZ[]
787
+ sage: K.<pi> = Qp(5).extension(x^3 - 5)
788
+ sage: V, fr, to = K.free_module()
789
+ sage: to(1 + pi^2 + O(pi^11))
790
+ (1 + O(5^4), O(5^4), 1 + O(5^3))
791
+ sage: to(1 + pi + O(pi^11))
792
+ (1 + O(5^4), 1 + O(5^4), O(5^3))
793
+ """
794
+ return self.codomain()(x._polynomial_list(pad=True))
795
+
796
+
797
+ class MapFreeModuleToTwoStep(pAdicModuleIsomorphism):
798
+ """
799
+ The isomorphism from the underlying module of a two-step `p`-adic extension
800
+ to the extension.
801
+
802
+ EXAMPLES::
803
+
804
+ sage: K.<a> = Qq(125)
805
+ sage: R.<x> = ZZ[]
806
+ sage: L.<b> = K.extension(x^2 - 5*x + 5)
807
+ sage: V, fr, to = L.free_module(base=Qp(5))
808
+ sage: TestSuite(fr).run(skip=['_test_nonzero_equal']) # skipped since L doesn't have dimension()
809
+ """
810
+ def _call_(self, x):
811
+ """
812
+ EXAMPLES::
813
+
814
+ sage: K.<a> = Qq(125)
815
+ sage: R.<x> = ZZ[]
816
+ sage: L.<pi> = K.extension(x^2 - 5)
817
+ sage: V, fr, to = L.free_module(base=Qp(5))
818
+ sage: v = V([1,2,3,4,5,6])
819
+ sage: fr(v)
820
+ (3*a^2 + 2*a + 1) + (a^2 + 4)*pi + (a^2 + a)*pi^3 + O(pi^40)
821
+ """
822
+ L = self.codomain()
823
+ U = L.base_ring()
824
+ x = list(x)
825
+ n = len(x)
826
+ d = n // L.relative_degree()
827
+ v = [U(x[i:i+d]) for i in range(0,n,d)]
828
+ return L(v)
829
+
830
+ def _call_with_args(self, x, args=(), kwds={}):
831
+ """
832
+ EXAMPLES::
833
+
834
+ sage: K.<a> = Qq(125)
835
+ sage: R.<x> = ZZ[]
836
+ sage: L.<pi> = K.extension(x^2 - 5)
837
+ sage: V, fr, to = L.free_module(base=Qp(5))
838
+ sage: v = V([1,2,3,4,5,6])
839
+ sage: fr(v, 7)
840
+ (3*a^2 + 2*a + 1) + (a^2 + 4)*pi + (a^2 + a)*pi^3 + O(pi^7)
841
+ """
842
+ return self.codomain()(self._call_(x), *args, **kwds)
843
+
844
+
845
+ class MapTwoStepToFreeModule(pAdicModuleIsomorphism):
846
+ """
847
+ The isomorphism from a two-step `p`-adic extension to its underlying free module.
848
+
849
+ EXAMPLES::
850
+
851
+ sage: K.<a> = Qq(125)
852
+ sage: R.<x> = ZZ[]
853
+ sage: L.<b> = K.extension(x^2 - 5*x + 5)
854
+ sage: V, fr, to = L.free_module(base=Qp(5))
855
+ sage: TestSuite(to).run()
856
+ """
857
+ def _call_(self, x):
858
+ """
859
+ EXAMPLES::
860
+
861
+ sage: K.<a> = Qq(25)
862
+ sage: R.<x> = ZZ[]
863
+ sage: L.<pi> = K.extension(x^3 - 5)
864
+ sage: V, fr, to = L.free_module(base=Qp(5))
865
+ sage: b = 1 + a*pi + O(pi^7)
866
+ sage: to(b)
867
+ (1 + O(5^3), O(5^3), O(5^2), 1 + O(5^2), O(5^2), O(5^2))
868
+ """
869
+ v = flatten([c._polynomial_list(pad=True) for c in x._polynomial_list(pad=True)])
870
+ return self.codomain()(v)
871
+
872
+
873
+ class DefPolyConversion(Morphism):
874
+ """
875
+ Conversion map between `p`-adic rings/fields with the same defining polynomial.
876
+
877
+ INPUT:
878
+
879
+ - ``R`` -- a `p`-adic extension ring or field
880
+ - ``S`` -- a `p`-adic extension ring or field with the same defining polynomial
881
+
882
+ EXAMPLES::
883
+
884
+ sage: R.<a> = Zq(125, print_mode='terse')
885
+ sage: S = R.change(prec = 15, type='floating-point')
886
+ sage: a - 1
887
+ 95367431640624 + a + O(5^20)
888
+ sage: S(a - 1)
889
+ 30517578124 + a + O(5^15)
890
+
891
+ ::
892
+
893
+ sage: R.<a> = Zq(125, print_mode='terse')
894
+ sage: S = R.change(prec = 15, type='floating-point')
895
+ sage: f = S.convert_map_from(R)
896
+ sage: TestSuite(f).run()
897
+ """
898
+ def _call_(self, x):
899
+ """
900
+ Use the polynomial associated to the element to do the conversion.
901
+
902
+ EXAMPLES::
903
+
904
+ sage: S.<x> = ZZ[]
905
+ sage: W.<w> = Zp(3).extension(x^4 + 9*x^2 + 3*x - 3)
906
+ sage: z = W.random_element()
907
+ sage: r = repr(W.change(print_mode='digits')(z))
908
+ sage: r[:3] == '...'
909
+ True
910
+ sage: all(l in ['0', '1', '2'] for l in r[3:])
911
+ True
912
+
913
+ TESTS:
914
+
915
+ We check that :issue:`25990` has been resolved::
916
+
917
+ sage: R.<a> = Zp(2).extension(x^3 - 2)
918
+ sage: K = R.fraction_field()
919
+ sage: u = K(1,10); u
920
+ 1 + O(a^10)
921
+ sage: R(u)
922
+ 1 + O(a^10)
923
+
924
+ sage: u += a^4 + a^5 + a^7 + a^8; u
925
+ 1 + a^4 + a^5 + a^7 + a^8 + O(a^10)
926
+ sage: R(u)
927
+ 1 + a^4 + a^5 + a^7 + a^8 + O(a^10)
928
+
929
+ sage: R(K(0))
930
+ 0
931
+ """
932
+ S = self.codomain()
933
+ Sbase = S.base_ring()
934
+ L = x.polynomial().list()
935
+ while L and L[-1].is_zero():
936
+ del L[-1]
937
+ if isinstance(x.parent(), pAdicExtensionGeneric):
938
+ absprec = x.precision_absolute()
939
+ if absprec is not Infinity:
940
+ return S([Sbase(c).lift_to_precision() for c in L], absprec)
941
+ return S([Sbase(c) for c in L])
942
+
943
+ def _call_with_args(self, x, args=(), kwds={}):
944
+ """
945
+ Use the polynomial associated to the element to do the conversion,
946
+ passing arguments along to the codomain.
947
+
948
+ EXAMPLES::
949
+
950
+ sage: S.<x> = ZZ[]
951
+ sage: W.<w> = Zp(3).extension(x^4 + 9*x^2 + 3*x - 3)
952
+ sage: z = W.random_element()
953
+ sage: r = repr(W.change(print_mode='digits')(z, absprec=8)) # indirect doctest
954
+ sage: r[:3] == '...'
955
+ True
956
+ sage: all(l in ['0', '1', '2'] for l in r[3:])
957
+ True
958
+
959
+ TESTS::
960
+
961
+ sage: R.<a> = Zp(2).extension(x^3 - 2)
962
+ sage: K = R.fraction_field()
963
+ sage: R(K(0), 10)
964
+ O(a^10)
965
+
966
+ sage: R(K(0,10), Infinity)
967
+ O(a^10)
968
+
969
+ sage: R(K(0,10), Infinity, absprec=30)
970
+ Traceback (most recent call last):
971
+ ...
972
+ TypeError: _call_with_args() got multiple values for keyword argument 'absprec'
973
+ """
974
+ S = self.codomain()
975
+ Sbase = S.base_ring()
976
+ L = x.polynomial().list()
977
+ while L and L[-1].is_zero():
978
+ del L[-1]
979
+ if isinstance(x.parent(), pAdicExtensionGeneric):
980
+ if args:
981
+ if 'absprec' in kwds:
982
+ raise TypeError("_call_with_args() got multiple values for keyword argument 'absprec'")
983
+ absprec = args[0]
984
+ args = args[1:]
985
+ else:
986
+ absprec = kwds.pop('absprec', Infinity)
987
+ absprec = min(absprec, x.precision_absolute())
988
+ if absprec is not Infinity:
989
+ return S([Sbase(c).lift_to_precision() for c in L], absprec, *args, **kwds)
990
+ return S([Sbase(c) for c in L], *args, **kwds)