passagemath-singular 10.6.31rc3__cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (490) hide show
  1. PySingular.cpython-314-aarch64-linux-gnu.so +0 -0
  2. passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
  3. passagemath_singular-10.6.31rc3.dist-info/RECORD +490 -0
  4. passagemath_singular-10.6.31rc3.dist-info/WHEEL +6 -0
  5. passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
  6. passagemath_singular.libs/libSingular-4-6a2a8666.4.1.so +0 -0
  7. passagemath_singular.libs/libcddgmp-ac579979.so.0.1.3 +0 -0
  8. passagemath_singular.libs/libfactory-4-66e33516.4.1.so +0 -0
  9. passagemath_singular.libs/libflint-81de1160.so.21.0.0 +0 -0
  10. passagemath_singular.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
  11. passagemath_singular.libs/libgfortran-e1b7dfc8.so.5.0.0 +0 -0
  12. passagemath_singular.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
  13. passagemath_singular.libs/libgsl-e3525837.so.28.0.0 +0 -0
  14. passagemath_singular.libs/libmpfr-e0f11cf3.so.6.2.1 +0 -0
  15. passagemath_singular.libs/libntl-0043a3a2.so.44.0.1 +0 -0
  16. passagemath_singular.libs/libomalloc-0-06512335.9.6.so +0 -0
  17. passagemath_singular.libs/libopenblasp-r0-4c5b64b1.3.29.so +0 -0
  18. passagemath_singular.libs/libpolys-4-cb7246b5.4.1.so +0 -0
  19. passagemath_singular.libs/libreadline-28330744.so.8.2 +0 -0
  20. passagemath_singular.libs/libsingular_resources-4-8c425241.4.1.so +0 -0
  21. passagemath_singular.libs/libtinfo-f81c2d16.so.6.3 +0 -0
  22. sage/algebras/all__sagemath_singular.py +3 -0
  23. sage/algebras/fusion_rings/all.py +19 -0
  24. sage/algebras/fusion_rings/f_matrix.py +2448 -0
  25. sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-aarch64-linux-gnu.so +0 -0
  26. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
  27. sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
  28. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-aarch64-linux-gnu.so +0 -0
  29. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
  30. sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
  31. sage/algebras/fusion_rings/fusion_double.py +899 -0
  32. sage/algebras/fusion_rings/fusion_ring.py +1580 -0
  33. sage/algebras/fusion_rings/poly_tup_engine.cpython-314-aarch64-linux-gnu.so +0 -0
  34. sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
  35. sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
  36. sage/algebras/fusion_rings/shm_managers.cpython-314-aarch64-linux-gnu.so +0 -0
  37. sage/algebras/fusion_rings/shm_managers.pxd +24 -0
  38. sage/algebras/fusion_rings/shm_managers.pyx +780 -0
  39. sage/algebras/letterplace/all.py +1 -0
  40. sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-aarch64-linux-gnu.so +0 -0
  41. sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
  42. sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
  43. sage/algebras/letterplace/free_algebra_letterplace.cpython-314-aarch64-linux-gnu.so +0 -0
  44. sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
  45. sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
  46. sage/algebras/letterplace/letterplace_ideal.cpython-314-aarch64-linux-gnu.so +0 -0
  47. sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
  48. sage/algebras/quatalg/all.py +2 -0
  49. sage/algebras/quatalg/quaternion_algebra.py +4778 -0
  50. sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-aarch64-linux-gnu.so +0 -0
  51. sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
  52. sage/algebras/quatalg/quaternion_algebra_element.cpython-314-aarch64-linux-gnu.so +0 -0
  53. sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
  54. sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
  55. sage/all__sagemath_singular.py +11 -0
  56. sage/ext_data/all__sagemath_singular.py +1 -0
  57. sage/ext_data/singular/function_field/core.lib +98 -0
  58. sage/interfaces/all__sagemath_singular.py +1 -0
  59. sage/interfaces/singular.py +2835 -0
  60. sage/libs/all__sagemath_singular.py +1 -0
  61. sage/libs/singular/__init__.py +1 -0
  62. sage/libs/singular/decl.pxd +1168 -0
  63. sage/libs/singular/function.cpython-314-aarch64-linux-gnu.so +0 -0
  64. sage/libs/singular/function.pxd +87 -0
  65. sage/libs/singular/function.pyx +1901 -0
  66. sage/libs/singular/function_factory.py +61 -0
  67. sage/libs/singular/groebner_strategy.cpython-314-aarch64-linux-gnu.so +0 -0
  68. sage/libs/singular/groebner_strategy.pxd +22 -0
  69. sage/libs/singular/groebner_strategy.pyx +582 -0
  70. sage/libs/singular/option.cpython-314-aarch64-linux-gnu.so +0 -0
  71. sage/libs/singular/option.pyx +671 -0
  72. sage/libs/singular/polynomial.cpython-314-aarch64-linux-gnu.so +0 -0
  73. sage/libs/singular/polynomial.pxd +39 -0
  74. sage/libs/singular/polynomial.pyx +661 -0
  75. sage/libs/singular/ring.cpython-314-aarch64-linux-gnu.so +0 -0
  76. sage/libs/singular/ring.pxd +58 -0
  77. sage/libs/singular/ring.pyx +893 -0
  78. sage/libs/singular/singular.cpython-314-aarch64-linux-gnu.so +0 -0
  79. sage/libs/singular/singular.pxd +72 -0
  80. sage/libs/singular/singular.pyx +1944 -0
  81. sage/libs/singular/standard_options.py +145 -0
  82. sage/matrix/all__sagemath_singular.py +1 -0
  83. sage/matrix/matrix_mpolynomial_dense.cpython-314-aarch64-linux-gnu.so +0 -0
  84. sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
  85. sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
  86. sage/rings/all__sagemath_singular.py +1 -0
  87. sage/rings/function_field/all__sagemath_singular.py +1 -0
  88. sage/rings/function_field/derivations_polymod.py +911 -0
  89. sage/rings/function_field/element_polymod.cpython-314-aarch64-linux-gnu.so +0 -0
  90. sage/rings/function_field/element_polymod.pyx +406 -0
  91. sage/rings/function_field/function_field_polymod.py +2611 -0
  92. sage/rings/function_field/ideal_polymod.py +1775 -0
  93. sage/rings/function_field/order_polymod.py +1475 -0
  94. sage/rings/function_field/place_polymod.py +681 -0
  95. sage/rings/polynomial/all__sagemath_singular.py +1 -0
  96. sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-aarch64-linux-gnu.so +0 -0
  97. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
  98. sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
  99. sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-aarch64-linux-gnu.so +0 -0
  100. sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
  101. sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
  102. sage/rings/polynomial/plural.cpython-314-aarch64-linux-gnu.so +0 -0
  103. sage/rings/polynomial/plural.pxd +48 -0
  104. sage/rings/polynomial/plural.pyx +3171 -0
  105. sage/symbolic/all__sagemath_singular.py +1 -0
  106. sage/symbolic/comparison_impl.pxi +428 -0
  107. sage/symbolic/constants_c_impl.pxi +178 -0
  108. sage/symbolic/expression.cpython-314-aarch64-linux-gnu.so +0 -0
  109. sage/symbolic/expression.pxd +7 -0
  110. sage/symbolic/expression.pyx +14200 -0
  111. sage/symbolic/getitem_impl.pxi +202 -0
  112. sage/symbolic/pynac.pxi +572 -0
  113. sage/symbolic/pynac_constant_impl.pxi +133 -0
  114. sage/symbolic/pynac_function_impl.pxi +206 -0
  115. sage/symbolic/pynac_impl.pxi +2576 -0
  116. sage/symbolic/pynac_wrap.h +124 -0
  117. sage/symbolic/series_impl.pxi +272 -0
  118. sage/symbolic/substitution_map_impl.pxi +94 -0
  119. sage_wheels/bin/ESingular +0 -0
  120. sage_wheels/bin/Singular +0 -0
  121. sage_wheels/bin/TSingular +0 -0
  122. sage_wheels/lib/singular/MOD/cohomo.la +41 -0
  123. sage_wheels/lib/singular/MOD/cohomo.so +0 -0
  124. sage_wheels/lib/singular/MOD/customstd.la +41 -0
  125. sage_wheels/lib/singular/MOD/customstd.so +0 -0
  126. sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
  127. sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
  128. sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
  129. sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
  130. sage_wheels/lib/singular/MOD/gitfan.la +41 -0
  131. sage_wheels/lib/singular/MOD/gitfan.so +0 -0
  132. sage_wheels/lib/singular/MOD/interval.la +41 -0
  133. sage_wheels/lib/singular/MOD/interval.so +0 -0
  134. sage_wheels/lib/singular/MOD/loctriv.la +41 -0
  135. sage_wheels/lib/singular/MOD/loctriv.so +0 -0
  136. sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
  137. sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
  138. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
  139. sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
  140. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
  141. sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
  142. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
  143. sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
  144. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
  145. sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
  146. sage_wheels/lib/singular/MOD/partialgb.la +41 -0
  147. sage_wheels/lib/singular/MOD/partialgb.so +0 -0
  148. sage_wheels/lib/singular/MOD/pyobject.la +41 -0
  149. sage_wheels/lib/singular/MOD/pyobject.so +0 -0
  150. sage_wheels/lib/singular/MOD/singmathic.la +41 -0
  151. sage_wheels/lib/singular/MOD/singmathic.so +0 -0
  152. sage_wheels/lib/singular/MOD/sispasm.la +41 -0
  153. sage_wheels/lib/singular/MOD/sispasm.so +0 -0
  154. sage_wheels/lib/singular/MOD/subsets.la +41 -0
  155. sage_wheels/lib/singular/MOD/subsets.so +0 -0
  156. sage_wheels/lib/singular/MOD/systhreads.la +41 -0
  157. sage_wheels/lib/singular/MOD/systhreads.so +0 -0
  158. sage_wheels/lib/singular/MOD/syzextra.la +41 -0
  159. sage_wheels/lib/singular/MOD/syzextra.so +0 -0
  160. sage_wheels/libexec/singular/MOD/change_cost +0 -0
  161. sage_wheels/libexec/singular/MOD/singularsurf +11 -0
  162. sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
  163. sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
  164. sage_wheels/libexec/singular/MOD/solve_IP +0 -0
  165. sage_wheels/libexec/singular/MOD/surfex +16 -0
  166. sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
  167. sage_wheels/share/factory/gftables/10201 +342 -0
  168. sage_wheels/share/factory/gftables/1024 +37 -0
  169. sage_wheels/share/factory/gftables/10609 +356 -0
  170. sage_wheels/share/factory/gftables/11449 +384 -0
  171. sage_wheels/share/factory/gftables/11881 +398 -0
  172. sage_wheels/share/factory/gftables/121 +6 -0
  173. sage_wheels/share/factory/gftables/12167 +408 -0
  174. sage_wheels/share/factory/gftables/125 +7 -0
  175. sage_wheels/share/factory/gftables/12769 +428 -0
  176. sage_wheels/share/factory/gftables/128 +7 -0
  177. sage_wheels/share/factory/gftables/1331 +47 -0
  178. sage_wheels/share/factory/gftables/1369 +48 -0
  179. sage_wheels/share/factory/gftables/14641 +490 -0
  180. sage_wheels/share/factory/gftables/15625 +523 -0
  181. sage_wheels/share/factory/gftables/16 +3 -0
  182. sage_wheels/share/factory/gftables/16129 +540 -0
  183. sage_wheels/share/factory/gftables/16384 +549 -0
  184. sage_wheels/share/factory/gftables/16807 +563 -0
  185. sage_wheels/share/factory/gftables/1681 +58 -0
  186. sage_wheels/share/factory/gftables/169 +8 -0
  187. sage_wheels/share/factory/gftables/17161 +574 -0
  188. sage_wheels/share/factory/gftables/1849 +64 -0
  189. sage_wheels/share/factory/gftables/18769 +628 -0
  190. sage_wheels/share/factory/gftables/19321 +646 -0
  191. sage_wheels/share/factory/gftables/19683 +659 -0
  192. sage_wheels/share/factory/gftables/2048 +71 -0
  193. sage_wheels/share/factory/gftables/2187 +75 -0
  194. sage_wheels/share/factory/gftables/2197 +76 -0
  195. sage_wheels/share/factory/gftables/2209 +76 -0
  196. sage_wheels/share/factory/gftables/22201 +742 -0
  197. sage_wheels/share/factory/gftables/22801 +762 -0
  198. sage_wheels/share/factory/gftables/2401 +82 -0
  199. sage_wheels/share/factory/gftables/243 +11 -0
  200. sage_wheels/share/factory/gftables/24389 +815 -0
  201. sage_wheels/share/factory/gftables/24649 +824 -0
  202. sage_wheels/share/factory/gftables/25 +3 -0
  203. sage_wheels/share/factory/gftables/256 +11 -0
  204. sage_wheels/share/factory/gftables/26569 +888 -0
  205. sage_wheels/share/factory/gftables/27 +3 -0
  206. sage_wheels/share/factory/gftables/27889 +932 -0
  207. sage_wheels/share/factory/gftables/2809 +96 -0
  208. sage_wheels/share/factory/gftables/28561 +954 -0
  209. sage_wheels/share/factory/gftables/289 +12 -0
  210. sage_wheels/share/factory/gftables/29791 +995 -0
  211. sage_wheels/share/factory/gftables/29929 +1000 -0
  212. sage_wheels/share/factory/gftables/3125 +107 -0
  213. sage_wheels/share/factory/gftables/32 +4 -0
  214. sage_wheels/share/factory/gftables/32041 +1070 -0
  215. sage_wheels/share/factory/gftables/32761 +1094 -0
  216. sage_wheels/share/factory/gftables/32768 +1095 -0
  217. sage_wheels/share/factory/gftables/343 +14 -0
  218. sage_wheels/share/factory/gftables/3481 +118 -0
  219. sage_wheels/share/factory/gftables/361 +14 -0
  220. sage_wheels/share/factory/gftables/36481 +1218 -0
  221. sage_wheels/share/factory/gftables/3721 +126 -0
  222. sage_wheels/share/factory/gftables/37249 +1244 -0
  223. sage_wheels/share/factory/gftables/38809 +1296 -0
  224. sage_wheels/share/factory/gftables/39601 +1322 -0
  225. sage_wheels/share/factory/gftables/4 +3 -0
  226. sage_wheels/share/factory/gftables/4096 +139 -0
  227. sage_wheels/share/factory/gftables/44521 +1486 -0
  228. sage_wheels/share/factory/gftables/4489 +152 -0
  229. sage_wheels/share/factory/gftables/49 +4 -0
  230. sage_wheels/share/factory/gftables/4913 +166 -0
  231. sage_wheels/share/factory/gftables/49729 +1660 -0
  232. sage_wheels/share/factory/gftables/5041 +170 -0
  233. sage_wheels/share/factory/gftables/50653 +1691 -0
  234. sage_wheels/share/factory/gftables/512 +20 -0
  235. sage_wheels/share/factory/gftables/51529 +1720 -0
  236. sage_wheels/share/factory/gftables/52441 +1750 -0
  237. sage_wheels/share/factory/gftables/529 +20 -0
  238. sage_wheels/share/factory/gftables/5329 +180 -0
  239. sage_wheels/share/factory/gftables/54289 +1812 -0
  240. sage_wheels/share/factory/gftables/57121 +1906 -0
  241. sage_wheels/share/factory/gftables/58081 +1938 -0
  242. sage_wheels/share/factory/gftables/59049 +1971 -0
  243. sage_wheels/share/factory/gftables/6241 +210 -0
  244. sage_wheels/share/factory/gftables/625 +23 -0
  245. sage_wheels/share/factory/gftables/63001 +2102 -0
  246. sage_wheels/share/factory/gftables/64 +5 -0
  247. sage_wheels/share/factory/gftables/6561 +221 -0
  248. sage_wheels/share/factory/gftables/6859 +231 -0
  249. sage_wheels/share/factory/gftables/6889 +232 -0
  250. sage_wheels/share/factory/gftables/729 +27 -0
  251. sage_wheels/share/factory/gftables/7921 +266 -0
  252. sage_wheels/share/factory/gftables/8 +3 -0
  253. sage_wheels/share/factory/gftables/81 +5 -0
  254. sage_wheels/share/factory/gftables/8192 +276 -0
  255. sage_wheels/share/factory/gftables/841 +30 -0
  256. sage_wheels/share/factory/gftables/9 +3 -0
  257. sage_wheels/share/factory/gftables/9409 +316 -0
  258. sage_wheels/share/factory/gftables/961 +34 -0
  259. sage_wheels/share/info/singular.info +191898 -0
  260. sage_wheels/share/singular/LIB/GND.lib +1359 -0
  261. sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
  262. sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
  263. sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
  264. sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
  265. sage_wheels/share/singular/LIB/VecField.lib +1542 -0
  266. sage_wheels/share/singular/LIB/absfact.lib +959 -0
  267. sage_wheels/share/singular/LIB/ainvar.lib +730 -0
  268. sage_wheels/share/singular/LIB/aksaka.lib +419 -0
  269. sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
  270. sage_wheels/share/singular/LIB/algebra.lib +1193 -0
  271. sage_wheels/share/singular/LIB/all.lib +136 -0
  272. sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
  273. sage_wheels/share/singular/LIB/arnold.lib +4553 -0
  274. sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
  275. sage_wheels/share/singular/LIB/arr.lib +3486 -0
  276. sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
  277. sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
  278. sage_wheels/share/singular/LIB/bfun.lib +1964 -0
  279. sage_wheels/share/singular/LIB/bimodules.lib +774 -0
  280. sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
  281. sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
  282. sage_wheels/share/singular/LIB/central.lib +2169 -0
  283. sage_wheels/share/singular/LIB/chern.lib +4162 -0
  284. sage_wheels/share/singular/LIB/cimonom.lib +571 -0
  285. sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
  286. sage_wheels/share/singular/LIB/classify.lib +3239 -0
  287. sage_wheels/share/singular/LIB/classify2.lib +1462 -0
  288. sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
  289. sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
  290. sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
  291. sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
  292. sage_wheels/share/singular/LIB/combinat.lib +91 -0
  293. sage_wheels/share/singular/LIB/compregb.lib +276 -0
  294. sage_wheels/share/singular/LIB/control.lib +1636 -0
  295. sage_wheels/share/singular/LIB/crypto.lib +3795 -0
  296. sage_wheels/share/singular/LIB/curveInv.lib +667 -0
  297. sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
  298. sage_wheels/share/singular/LIB/customstd.lib +100 -0
  299. sage_wheels/share/singular/LIB/deRham.lib +5979 -0
  300. sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
  301. sage_wheels/share/singular/LIB/decomp.lib +1655 -0
  302. sage_wheels/share/singular/LIB/deflation.lib +872 -0
  303. sage_wheels/share/singular/LIB/deform.lib +925 -0
  304. sage_wheels/share/singular/LIB/difform.lib +3055 -0
  305. sage_wheels/share/singular/LIB/divisors.lib +750 -0
  306. sage_wheels/share/singular/LIB/dmod.lib +5817 -0
  307. sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
  308. sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
  309. sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
  310. sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
  311. sage_wheels/share/singular/LIB/dummy.lib +17 -0
  312. sage_wheels/share/singular/LIB/elim.lib +1009 -0
  313. sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
  314. sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
  315. sage_wheels/share/singular/LIB/equising.lib +2127 -0
  316. sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
  317. sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
  318. sage_wheels/share/singular/LIB/findifs.lib +778 -0
  319. sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
  320. sage_wheels/share/singular/LIB/finvar.lib +7989 -0
  321. sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
  322. sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
  323. sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
  324. sage_wheels/share/singular/LIB/freegb.lib +3853 -0
  325. sage_wheels/share/singular/LIB/general.lib +1350 -0
  326. sage_wheels/share/singular/LIB/gfan.lib +1768 -0
  327. sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
  328. sage_wheels/share/singular/LIB/gkdim.lib +99 -0
  329. sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
  330. sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
  331. sage_wheels/share/singular/LIB/goettsche.lib +909 -0
  332. sage_wheels/share/singular/LIB/graal.lib +1366 -0
  333. sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
  334. sage_wheels/share/singular/LIB/graphics.lib +360 -0
  335. sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
  336. sage_wheels/share/singular/LIB/groups.lib +1123 -0
  337. sage_wheels/share/singular/LIB/grwalk.lib +507 -0
  338. sage_wheels/share/singular/LIB/hdepth.lib +194 -0
  339. sage_wheels/share/singular/LIB/help.cnf +57 -0
  340. sage_wheels/share/singular/LIB/hess.lib +1946 -0
  341. sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
  342. sage_wheels/share/singular/LIB/hodge.lib +400 -0
  343. sage_wheels/share/singular/LIB/homolog.lib +1965 -0
  344. sage_wheels/share/singular/LIB/hyperel.lib +975 -0
  345. sage_wheels/share/singular/LIB/inout.lib +679 -0
  346. sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
  347. sage_wheels/share/singular/LIB/interval.lib +1418 -0
  348. sage_wheels/share/singular/LIB/intprog.lib +778 -0
  349. sage_wheels/share/singular/LIB/invar.lib +443 -0
  350. sage_wheels/share/singular/LIB/involut.lib +980 -0
  351. sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
  352. sage_wheels/share/singular/LIB/kskernel.lib +534 -0
  353. sage_wheels/share/singular/LIB/latex.lib +3146 -0
  354. sage_wheels/share/singular/LIB/lejeune.lib +651 -0
  355. sage_wheels/share/singular/LIB/linalg.lib +2040 -0
  356. sage_wheels/share/singular/LIB/locnormal.lib +212 -0
  357. sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
  358. sage_wheels/share/singular/LIB/makedbm.lib +294 -0
  359. sage_wheels/share/singular/LIB/mathml.lib +813 -0
  360. sage_wheels/share/singular/LIB/matrix.lib +1372 -0
  361. sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
  362. sage_wheels/share/singular/LIB/methods.lib +212 -0
  363. sage_wheels/share/singular/LIB/moddiq.lib +322 -0
  364. sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
  365. sage_wheels/share/singular/LIB/modnormal.lib +218 -0
  366. sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
  367. sage_wheels/share/singular/LIB/modquotient.lib +269 -0
  368. sage_wheels/share/singular/LIB/modstd.lib +1024 -0
  369. sage_wheels/share/singular/LIB/modular.lib +545 -0
  370. sage_wheels/share/singular/LIB/modules.lib +2561 -0
  371. sage_wheels/share/singular/LIB/modwalk.lib +609 -0
  372. sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
  373. sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
  374. sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
  375. sage_wheels/share/singular/LIB/mregular.lib +1863 -0
  376. sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
  377. sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
  378. sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
  379. sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
  380. sage_wheels/share/singular/LIB/ncall.lib +31 -0
  381. sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
  382. sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
  383. sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
  384. sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
  385. sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
  386. sage_wheels/share/singular/LIB/ncloc.lib +361 -0
  387. sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
  388. sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
  389. sage_wheels/share/singular/LIB/nctools.lib +1887 -0
  390. sage_wheels/share/singular/LIB/nets.lib +1456 -0
  391. sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
  392. sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
  393. sage_wheels/share/singular/LIB/noether.lib +1106 -0
  394. sage_wheels/share/singular/LIB/normal.lib +8700 -0
  395. sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
  396. sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
  397. sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
  398. sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
  399. sage_wheels/share/singular/LIB/olga.lib +1933 -0
  400. sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
  401. sage_wheels/share/singular/LIB/parallel.lib +319 -0
  402. sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
  403. sage_wheels/share/singular/LIB/perron.lib +202 -0
  404. sage_wheels/share/singular/LIB/pfd.lib +2223 -0
  405. sage_wheels/share/singular/LIB/phindex.lib +642 -0
  406. sage_wheels/share/singular/LIB/pointid.lib +673 -0
  407. sage_wheels/share/singular/LIB/polybori.lib +1430 -0
  408. sage_wheels/share/singular/LIB/polyclass.lib +525 -0
  409. sage_wheels/share/singular/LIB/polylib.lib +1174 -0
  410. sage_wheels/share/singular/LIB/polymake.lib +1902 -0
  411. sage_wheels/share/singular/LIB/presolve.lib +1533 -0
  412. sage_wheels/share/singular/LIB/primdec.lib +9576 -0
  413. sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
  414. sage_wheels/share/singular/LIB/primitiv.lib +401 -0
  415. sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
  416. sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
  417. sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
  418. sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
  419. sage_wheels/share/singular/LIB/random.lib +455 -0
  420. sage_wheels/share/singular/LIB/ratgb.lib +489 -0
  421. sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
  422. sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
  423. sage_wheels/share/singular/LIB/realrad.lib +1197 -0
  424. sage_wheels/share/singular/LIB/recover.lib +2628 -0
  425. sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
  426. sage_wheels/share/singular/LIB/reesclos.lib +465 -0
  427. sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
  428. sage_wheels/share/singular/LIB/resgraph.lib +789 -0
  429. sage_wheels/share/singular/LIB/resjung.lib +820 -0
  430. sage_wheels/share/singular/LIB/resolve.lib +5110 -0
  431. sage_wheels/share/singular/LIB/resources.lib +170 -0
  432. sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
  433. sage_wheels/share/singular/LIB/ring.lib +1328 -0
  434. sage_wheels/share/singular/LIB/ringgb.lib +343 -0
  435. sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
  436. sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
  437. sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
  438. sage_wheels/share/singular/LIB/rootsur.lib +886 -0
  439. sage_wheels/share/singular/LIB/rstandard.lib +607 -0
  440. sage_wheels/share/singular/LIB/rwalk.lib +336 -0
  441. sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
  442. sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
  443. sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
  444. sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
  445. sage_wheels/share/singular/LIB/schreyer.lib +321 -0
  446. sage_wheels/share/singular/LIB/schubert.lib +2551 -0
  447. sage_wheels/share/singular/LIB/sets.lib +524 -0
  448. sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
  449. sage_wheels/share/singular/LIB/signcond.lib +437 -0
  450. sage_wheels/share/singular/LIB/sing.lib +1094 -0
  451. sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
  452. sage_wheels/share/singular/LIB/solve.lib +2243 -0
  453. sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
  454. sage_wheels/share/singular/LIB/spectrum.lib +62 -0
  455. sage_wheels/share/singular/LIB/sresext.lib +757 -0
  456. sage_wheels/share/singular/LIB/ssi.lib +143 -0
  457. sage_wheels/share/singular/LIB/standard.lib +2769 -0
  458. sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
  459. sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
  460. sage_wheels/share/singular/LIB/stratify.lib +1070 -0
  461. sage_wheels/share/singular/LIB/surf.lib +506 -0
  462. sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
  463. sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
  464. sage_wheels/share/singular/LIB/surfex.lib +1462 -0
  465. sage_wheels/share/singular/LIB/swalk.lib +877 -0
  466. sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
  467. sage_wheels/share/singular/LIB/systhreads.lib +74 -0
  468. sage_wheels/share/singular/LIB/tasks.lib +1324 -0
  469. sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
  470. sage_wheels/share/singular/LIB/teachstd.lib +858 -0
  471. sage_wheels/share/singular/LIB/template.lib +116 -0
  472. sage_wheels/share/singular/LIB/toric.lib +1119 -0
  473. sage_wheels/share/singular/LIB/transformation.lib +116 -0
  474. sage_wheels/share/singular/LIB/triang.lib +1197 -0
  475. sage_wheels/share/singular/LIB/tropical.lib +8741 -0
  476. sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
  477. sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
  478. sage_wheels/share/singular/LIB/tst.lib +1108 -0
  479. sage_wheels/share/singular/LIB/weierstr.lib +241 -0
  480. sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
  481. sage_wheels/share/singular/emacs/.emacs-general +184 -0
  482. sage_wheels/share/singular/emacs/.emacs-singular +234 -0
  483. sage_wheels/share/singular/emacs/COPYING +44 -0
  484. sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
  485. sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
  486. sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
  487. sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
  488. sage_wheels/share/singular/emacs/singular.el +4273 -0
  489. sage_wheels/share/singular/emacs/singular.xpm +39 -0
  490. sage_wheels/share/singular/singular.idx +5002 -0
@@ -0,0 +1,1430 @@
1
+ ////////////////////////////////////////////////////////////////
2
+ version="version polybori.lib 4.2.0.1 Jan_2021 "; // $Id: 5a92555dd3c87c374acf03b67adeeaf992dbec07 $
3
+ category="Miscellaneous";
4
+
5
+ // summary description of the library
6
+
7
+ info="
8
+ LIBRARY: polybori.lib A Singular Library Interface for PolyBoRi
9
+ AUTHORS: Maximilian Kammermeier: Max0791@gmx.de
10
+ Susanne Scherer: sscherer90@yahoo.de
11
+
12
+ SEE ALSO: Libraries, pyobject, User defined types
13
+
14
+
15
+ @*
16
+
17
+ OVERVIEW: A library for using @code{PolyBoRi} in the SINGULAR interface, with
18
+ procedures that convert structures (polynomials, rings, ideals) in both
19
+ directions. Therefore, it is possible to compute boolean groebner basis
20
+ via @ref{boolean_std}. Polynomials can be converted to zero-supressed decision
21
+ diagrams (zdd) and vice versa.
22
+
23
+ For usability it defines the @code{PolyBoRi} types @code{bideal}, @code{bpoly},
24
+ and @code{bring} which are equivalent to Singular's @code{ideal}, @code{poly},
25
+ and @code{ring}, as well as @code{bset} which corresponds to the type @code{zdd}
26
+ introduced here. In addition @code{bvar(i)} constructs the Boolean variable corresponding
27
+ to @code{var(i)} from current @code{ring};
28
+
29
+ For convenience, the corresponding types can be converted explicitly or implicitly
30
+ while assigning.
31
+ Also several SINGULAR operators were overloaded: @code{bring} comes with @code{nvars},
32
+ @code{bpoly} implements @code{lead}, @code{leadmonom} and @code{leadcoef}.
33
+ Objects of this type may be added and multiplied, too.
34
+ Finally, @code{bideal} yields @code{std} and @code{size} as well as addition and element access.
35
+
36
+
37
+ Hence, by using these types @code{PolyBoRi} functionality
38
+ can be carried out seamlessly in SINGULAR:
39
+
40
+ @code{> LIB \"polybori.lib\";} @*
41
+ @code{> ring r0=2,x(1..4),lp;} @*
42
+ @code{> def x=bvar; // enforce Boolean variables} @*
43
+
44
+ @code{> bpoly f1=x(1)+x(4);} @*
45
+ @code{> bpoly f2=x(1)+x(3)*x(1);} @*
46
+ @code{> bideal bI=list(f1,f2);} @*
47
+
48
+ @code{> std(bI);} @*
49
+ @code{_[1] = x(1) + x(4)} @*
50
+ @code{_[2] = x(3)*x(4) + x(4)} @*
51
+
52
+
53
+ NOTE:
54
+ @texinfo
55
+ For using this library SINGULAR's @code{python} interface must be available
56
+ on your system.
57
+ Please @code{./configure --with-python} when building SINGULAR for this purpose.
58
+
59
+ There are prebuilt binary packages for @code{PolyBoRi} available
60
+ from @uref{http://polybori.sf.net/}.
61
+
62
+ For building your own @code{PolyBoRi} please ensure that you have @code{scons} and a
63
+ development version of the boost libraries installed on you system.
64
+ Then you may execute the following commands in a @code{bash}-style shell
65
+ to build @code{PolyBoRi} available to @code{python}:
66
+
67
+ @code{PBDIR=/path/to/custom/polybori} @*
68
+ @code{wget http://downloads.sf.net/project/polybori/polybori/\\}@*
69
+ @code{0.8.2/polybori-0.8.2.tar.gz} @*
70
+ @code{tar -xvzf polybori-0.8.2.tar.gz} @*
71
+ @code{cd polybori-0.8.2} @*
72
+ @code{scons install PREFIX=$PBDIR PYINSTALLPREFIX=$PBDIR/python} @*
73
+ @code{export PYTHONPATH=$PBDIR/python:$PYTHONPATH} @*
74
+ @end texinfo
75
+
76
+ REFERENCES:
77
+ @texinfo
78
+ See @uref{http://polybori.sf.net} for details about @code{PolyBoRi}.
79
+ @end texinfo
80
+
81
+ PROCEDURES:
82
+ boolean_std(bideal); Singular ideal of boolean groebner basis of I
83
+
84
+ boolean_poly_ring(ring); convert ring
85
+ boolean_constant(int[, bring]); convert constant
86
+ boolean_poly(poly[, int, bring]) convert polynomial
87
+ direct_boolean_poly(poly[, bring]); convert polynomial direct
88
+ recursive_boolean_poly(poly[, bring]); convert polynomial recursively
89
+ boolean_ideal(ideal[, bring]); convert ideal
90
+ boolean_set(zdd[, bring]); convert zdd
91
+
92
+
93
+ from_boolean_constant(bpoly); convert boolean constant
94
+ from_boolean_poly(bpoly[, int]); convert boolean polynomial
95
+ direct_from_boolean_poly(bpoly); convert boolean polynomial direct
96
+ recursive_from_boolean_poly(bpoly); convert boolean polynomial recursively
97
+ from_boolean_ideal(bpoly); convert to ideal
98
+ from_boolean_set(bset); convert to zdd
99
+
100
+
101
+ bvar(i); return i-th Boolean variable
102
+ poly2zdd(poly); return zdd of a given polynomial
103
+ zdd2poly(zdd); return polynomial representation of a given zdd
104
+ disp_zdd(zdd); return string with a visualization of a given
105
+
106
+ KEYWORDS: library, polybori.lib; polybori; polybori.lib; library; pyobject; newstruct; zdd
107
+
108
+ ";
109
+
110
+ ///////////////////////////////////////////////////////////////////////
111
+ // initialization of datatypes and constant structures
112
+
113
+ static proc mod_init()
114
+ {
115
+ if (typeof(Pyobject)!="package")
116
+ {
117
+ LIB("pyobject.so");
118
+ }
119
+ if (typeof(zdd_one)=="?unknown type?")
120
+ {
121
+ python_import("polybori");
122
+
123
+ // install new types
124
+
125
+ newstruct("zdd","int idx,def thenBranch,def elseBranch");
126
+ newstruct("bpoly","pyobject boolpoly");
127
+ newstruct("bideal","pyobject pylist");
128
+ newstruct("bring", "pyobject pyring");
129
+ newstruct("bset", "pyobject pyset");
130
+
131
+ // install type operations
132
+
133
+ system("install", "zdd", "==", zdd_check,2);
134
+ system("install", "bpoly", "==", bpoly_check,2);
135
+ system("install", "bpoly", "*", bpoly_mult,2);
136
+ system("install", "bpoly", "+", bpoly_add,2);
137
+ system("install", "zdd", "print", print_zdd, 1);
138
+ system("install", "bpoly", "print", print_bpoly,1);
139
+ system("install", "bideal", "print", print_bideal,1);
140
+ system("install", "bideal", "size", size_bideal,1);
141
+ system("install", "bpoly", "lead", lead_bpoly, 1);
142
+ system("install", "bpoly", "leadmonom",lead_monom_bpoly, 1);
143
+ system("install", "bpoly", "leadcoef", lead_coef_bpoly, 1);
144
+ system("install", "bideal", "[", op_getitem, 2);
145
+ system("install", "bideal", "+", bideal_add, 2);
146
+ system("install", "bideal", "std", boolean_std, 4);
147
+
148
+ // install type conversions
149
+
150
+ // implemented typecasts (both directions)
151
+ // SINGULAR BOOLEAN OBJECTS
152
+ // ring bring
153
+ // poly bpoly
154
+ // zdd bset
155
+ // ideal bideal
156
+ //
157
+ // furthermore, it is possible to switch between poly <-> zdd and bpoly <-> bset
158
+
159
+ system("install", "bring", "=", ring2bring, 1);
160
+ system("install", "bring", "nvars", nvars_bring, 1);
161
+
162
+ system("install", "pyobject", "poly", from_boolean_poly, 1);
163
+ system("install", "pyobject", "size", size_pyobject, 1);
164
+
165
+ system("install", "pyobject", "bideal", pyobject2bideal,1);
166
+ system("install", "bideal", "pyobject", bideal2pyobject,1);
167
+
168
+ system("install", "bideal", "ideal", bideal2ideal, 4);
169
+ system("install", "bideal", "=", type2bideal, 1);
170
+
171
+
172
+
173
+ system("install", "zdd", "poly", zdd2poly, 1);
174
+ system("install", "zdd", "=", poly2zdd, 1);
175
+
176
+ system("install", "zdd", "pyobject", boolean_set, 1);
177
+ system("install", "pyobject", "zdd", from_boolean_set, 1);
178
+
179
+ system("install", "bset", "zdd", bset2zdd, 1);
180
+ system("install", "zdd", "bset", zdd2bset, 1);
181
+
182
+ system("install", "bpoly", "bset", bpoly2bset, 1);
183
+ system("install", "bset", "bpoly", bset2bpoly, 1);
184
+
185
+ system("install", "pyobject", "bpoly", pyobject2bpoly,1);
186
+ system("install", "bpoly", "pyobject", bpoly2pyobject,1);
187
+
188
+ system("install", "bpoly", "poly", bpoly2poly,1);
189
+ system("install", "bpoly", "bideal", bpoly2bideal,1);
190
+ system("install", "bpoly", "=", poly2bpoly,1);
191
+
192
+
193
+
194
+ // initialize constant zdds
195
+
196
+ zdd zdd_one;
197
+ zdd_one.idx=0;
198
+ zdd_one.thenBranch=int(1);
199
+ zdd_one.elseBranch=int(0);
200
+ zdd zdd_zero;
201
+ zdd_zero.idx=0;
202
+ zdd_zero.thenBranch=int(0);
203
+ zdd_zero.elseBranch=int(0);
204
+ export(zdd_one);
205
+ export(zdd_zero);
206
+
207
+ python_run("def if_then_else_idx(idx,b,c): return b.set().change(idx).union(c)");
208
+ python_run("_SINGULAR_RINGS = dict()");
209
+ python_run("_SINGULAR_RINGS_ACCESSED = 0");
210
+ python_run("def _SINGULAR_DECACHE_RING(arg): val = arg(); return 0 if val is None else val");
211
+ }
212
+ }
213
+
214
+ ///////////////////////////////////////////////////////////////////////
215
+ // computes the leading term of a bpoly
216
+
217
+ proc lead_bpoly(bpoly pp)
218
+ {
219
+ pyobject zero=0;
220
+ bpoly zero2;
221
+ zero2.boolpoly=zero;
222
+ if (pp==zero2)
223
+ {
224
+ return(0);
225
+ }
226
+ else
227
+ {
228
+ pyobject ppb=pp.boolpoly."lead"();
229
+ return(ppb);
230
+ }
231
+ }
232
+
233
+ ///////////////////////////////////////////////////////////////////////
234
+ // computes the leading monomial of a bpoly
235
+
236
+ proc lead_monom_bpoly(bpoly pp)
237
+ {
238
+ if (pp.boolpoly == 0) { return(0); }
239
+
240
+ pyobject ppb=pp.boolpoly."lead"();
241
+ return(ppb);
242
+ }
243
+
244
+ ///////////////////////////////////////////////////////////////////////
245
+ // computes the leading coefficient of a bpoly
246
+
247
+ proc lead_coef_bpoly(bpoly pp)
248
+ {
249
+ if (int(pp.is_zero())) { return(0); }
250
+ return(1);
251
+ }
252
+
253
+ ///////////////////////////////////////////////////////////////////////
254
+ // converts a Singular ring into a Boolean ring
255
+
256
+ proc ring2bring(def r)
257
+ {
258
+ bring rb;
259
+ rb.pyring = boolean_poly_ring(r);
260
+ return(rb);
261
+ }
262
+ ///////////////////////////////////////////////////////////////////////
263
+ // Generate an ideal from one constructor
264
+ proc bpoly2bideal(bpoly bp)
265
+ {
266
+ pyobject obj = list(bp);
267
+ bideal bI = obj;
268
+ return (bI);
269
+ }
270
+
271
+ ///////////////////////////////////////////////////////////////////////
272
+ // get number of variables of a Boolean ring
273
+
274
+ proc nvars_bring(bring rb)
275
+ {
276
+ return (int(rb.pyring.n_variables()));
277
+ }
278
+
279
+ ///////////////////////////////////////////////////////////////////////
280
+ // get variable of Boolean ring corresponding to current basering
281
+
282
+ proc bvar(int i)
283
+ "USAGE: bvar(i); int i
284
+ RETURN: i-th variable of Boolean ring corresponding to current basering
285
+ SEE ALSO: boolean_poly_ring, var
286
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
287
+ EXAMPLE: example bvar; shows an example"
288
+ {
289
+ bpoly re = var(i);
290
+ return (re);
291
+ }
292
+ example
293
+ { "EXAMPLE:"; echo=2;
294
+ ring r = 2,(x,y,z),Dp;
295
+ bvar(1); // -> x
296
+ }
297
+
298
+ ///////////////////////////////////////////////////////////////////////
299
+ // Internal functions for caching converted ring
300
+ ///////////////////////////////////////////////////////////////////////
301
+
302
+
303
+ // Mark cache as accessed and clear garbage every 100 accesses
304
+ static proc bring_mark_cache(list #)
305
+ {
306
+ if (int(python_eval("_SINGULAR_RINGS_ACCESSED >= 100"))) {
307
+ python_run("_SINGULAR_RINGS_ACCESSED = 0");
308
+ def erased = python_eval("[_k for (_k,_v) in _SINGULAR_RINGS.items() if _v() is None]");
309
+ erased = python_eval("(lambda _keys: [_SINGULAR_RINGS.pop(_k) for _k in _keys])")(erased);
310
+ }
311
+ python_run("_SINGULAR_RINGS_ACCESSED += 1");
312
+ }
313
+
314
+ // look up whether we cached this conversion before
315
+ static proc bring_from_cache(def r)
316
+ {
317
+ bring_mark_cache();
318
+ def result1 = python_eval("_SINGULAR_RINGS.get('" + string(r) + "', (lambda: None))");
319
+ def result = python_eval("_SINGULAR_DECACHE_RING")(result1);
320
+ return (result);
321
+ }
322
+
323
+ // insert computed result into cache
324
+ static proc bring_to_cache(def r, pyobject newring)
325
+ {
326
+ def value = WeakRingRef(newring);
327
+ python_eval("_SINGULAR_RINGS")."__setitem__"(string(r), value);
328
+ }
329
+
330
+ ///////////////////////////////////////////////////////////////////////
331
+ // converts a Singular ring into a python ring
332
+
333
+ proc boolean_poly_ring(def r)
334
+ {
335
+ def cached = bring_from_cache(r);
336
+ if (int(cached != int(0))) { return (cached); }
337
+
338
+ def rl = ringlist(r);
339
+ list blocks;
340
+ string ordering;
341
+ pyobject orders = python_eval("dict(lp=OrderCode.lp)");
342
+ if (size(rl[3]) >2)
343
+ {
344
+ orders.update(python_eval("dict(Dp=OrderCode.block_dlex)"));
345
+ }
346
+ else
347
+ {
348
+ orders.update(python_eval("dict(Dp=OrderCode.dlex)"));
349
+ }
350
+
351
+ int i;
352
+ int counter=0;
353
+ for (i=1; i<=size(ring_list(r)[3]); i++)
354
+ {
355
+ if (rl[3][i][1]<>"C")
356
+ {
357
+ ordering=rl[3][i][1];
358
+ if (counter) { blocks = blocks + list(counter) };
359
+ counter = counter + size(rl[3][i][2]);
360
+ }
361
+ }
362
+ if(int(orders.has_key(ordering)==0))
363
+ {
364
+ "// Warning: Unsupported ordering, using 'lp`!";
365
+ }
366
+
367
+ def result = Ring(nvars(r), orders.get(ordering, 0), rl[2], blocks);
368
+ bring_to_cache(r, result);
369
+ return (result);
370
+ }
371
+
372
+ ///////////////////////////////////////////////////////////////////////
373
+ // returns ith entry of a bideal
374
+
375
+ proc op_getitem(bideal arg, def idx)
376
+ {
377
+ if (typeof(idx) == "int") { return (arg.pylist[idx-1]); }
378
+
379
+ bideal re = (python_eval("lambda ll, idx: [ll[i] for i in idx]")(arg.pylist, idx-1));
380
+ return (re);
381
+ }
382
+
383
+ ///////////////////////////////////////////////////////////////////////
384
+ // concatenate generators of bideals
385
+
386
+ proc bideal_add(bideal arg1, bideal arg2)
387
+ {
388
+ pyobject tmp = python_eval("lambda x, y: list(sorted(set(x).union(set(y))))");
389
+ bideal re = tmp(arg1.pylist,arg2.pylist);
390
+ return (re);
391
+ }
392
+
393
+ ///////////////////////////////////////////////////////////////////////
394
+ // checks the equality of two bpolys
395
+
396
+ proc bpoly_check(bpoly pb1,bpoly pb2)
397
+ {
398
+ return(pb1.boolpoly==pb2.boolpoly);
399
+ }
400
+
401
+ ///////////////////////////////////////////////////////////////////////
402
+ // computes the multiplication of two bpolys
403
+
404
+ proc bpoly_mult(bpoly pb1,bpoly pb2)
405
+ {
406
+ bpoly bpol;
407
+ bpol.boolpoly=pb1.boolpoly*pb2.boolpoly;
408
+ return(bpol);
409
+ }
410
+
411
+ ///////////////////////////////////////////////////////////////////////
412
+ // computes the addition of two bpolys
413
+
414
+ proc bpoly_add(bpoly pb1, bpoly pb2)
415
+ {
416
+ bpoly bpol;
417
+ bpol.boolpoly=pb1.boolpoly+pb2.boolpoly;
418
+ return(bpol);
419
+ }
420
+
421
+ ///////////////////////////////////////////////////////////////////////
422
+ // convert bpoly to pyobject
423
+
424
+ proc bpoly2pyobject(bpoly pb)
425
+ {
426
+ return(pb.boolpoly);
427
+ }
428
+
429
+ ///////////////////////////////////////////////////////////////////////
430
+ // convert bideal to pyobject
431
+
432
+ proc bideal2pyobject(bideal Ib)
433
+ {
434
+ return(Ib.pylist);
435
+ }
436
+
437
+ ///////////////////////////////////////////////////////////////////////
438
+ // convert poly to bpoly
439
+
440
+ proc poly2bpoly(poly p)
441
+ {
442
+ bpoly bpol;
443
+ bpol.boolpoly=boolean_poly(p);
444
+ return(bpol);
445
+ }
446
+
447
+ ///////////////////////////////////////////////////////////////////////
448
+ // convert zdd to bset
449
+
450
+ proc zdd2bset(zdd ss)
451
+ {
452
+ bset bs;
453
+ bs.pyset=boolean_set(ss);
454
+ return(bs);
455
+ }
456
+
457
+ ///////////////////////////////////////////////////////////////////////
458
+ // convert bpoly to bset
459
+
460
+ proc bpoly2bset(bpoly ss)
461
+ {
462
+ bset bs;
463
+ bs.pyset=ss.boolpoly.set();
464
+ return(bs);
465
+ }
466
+
467
+ ///////////////////////////////////////////////////////////////////////
468
+ // convert bset to zdd
469
+
470
+ proc bset2zdd(bset ss)
471
+ {
472
+ zdd bs;
473
+ bs=from_boolean_set(ss.pyset);
474
+ return(bs);
475
+ }
476
+
477
+ ///////////////////////////////////////////////////////////////////////
478
+ // convert bset to bpoly
479
+
480
+ proc bset2bpoly(bset ss)
481
+ {
482
+ bpoly pb;
483
+ pb.boolpoly=python_eval("Polynomial")(ss.pyset);
484
+ return(pb);
485
+ }
486
+
487
+ ///////////////////////////////////////////////////////////////////////
488
+ // convert type (ideal or list) to bideal
489
+
490
+ proc type2bideal(def I)
491
+ {
492
+ if (typeof(I) == "ideal") { return (boolean_ideal(I)); }
493
+
494
+ bideal bid;
495
+ pyobject pylist;
496
+
497
+ if (typeof(I) == "list")
498
+ {
499
+ pylist = python_eval("list()");
500
+ int i; int nlen=size(I); bpoly elt;
501
+ for (i=1; i <= nlen; i++) {
502
+ elt = I[i];
503
+ pylist.append(pyobject(elt));
504
+ }
505
+ }
506
+ else { pylist = I; }
507
+ bid.pylist = pylist;
508
+ return (bid);
509
+ }
510
+
511
+ ///////////////////////////////////////////////////////////////////////
512
+ // convert bpoly to poly
513
+
514
+ proc bpoly2poly(bpoly pb)
515
+ {
516
+ poly h=poly(pb.boolpoly);
517
+ return(h);
518
+ }
519
+
520
+
521
+ ///////////////////////////////////////////////////////////////////////
522
+ // convert bideal to ideal
523
+
524
+ proc bideal2ideal(bideal Ib)
525
+ {
526
+ ideal I;
527
+ I=from_boolean_ideal(Ib);
528
+ return(I);
529
+ }
530
+
531
+ ///////////////////////////////////////////////////////////////////////
532
+ // convert pyobject to bpoly
533
+
534
+ proc pyobject2bpoly(pyobject pb)
535
+ {
536
+ bpoly bpol;
537
+ bpol.boolpoly=pb;
538
+ return(bpol);
539
+ }
540
+
541
+ ///////////////////////////////////////////////////////////////////////
542
+ // convert pyobject to bideal
543
+
544
+ proc pyobject2bideal(pyobject Ib)
545
+ {
546
+ bideal bid;
547
+ bid.pylist=Ib;
548
+ return(bid);
549
+ }
550
+
551
+ ///////////////////////////////////////////////////////////////////////
552
+ // print bpoly
553
+
554
+ proc print_bpoly(bpoly pb)
555
+ {
556
+ pb.boolpoly;
557
+ }
558
+
559
+ ///////////////////////////////////////////////////////////////////////
560
+ // print bideal
561
+
562
+ proc print_bideal(bideal Ib)
563
+ {
564
+ int nlen = size(Ib);
565
+ for (int i = 1; i <= nlen; i++)
566
+ {
567
+ "_[" + string(i)+"] = " + string(Ib[i]);
568
+ }
569
+ }
570
+
571
+ ///////////////////////////////////////////////////////////////////////
572
+ // get size of pyobject
573
+
574
+ proc size_pyobject(pyobject obj)
575
+ {
576
+ return (int(python_eval("len")(obj)));
577
+ }
578
+
579
+ ///////////////////////////////////////////////////////////////////////
580
+ // get size of bideal
581
+
582
+ proc size_bideal(bideal Ib)
583
+ {
584
+ return (size(Ib.pylist));
585
+ }
586
+
587
+
588
+ ///////////////////////////////////////////////////////////////////////
589
+ // print zdd
590
+
591
+ proc print_zdd(zdd ss)
592
+ {
593
+ "zdd: ";
594
+ disp_zdd(ss);
595
+ }
596
+
597
+ ///////////////////////////////////////////////////////////////////////
598
+ // check equality
599
+
600
+ proc zdd_check(zdd zdd1,zdd zdd2)
601
+ "USAGE: zdd_check(zdd1,zdd2); zdd zdd1, zdd zdd2
602
+ RETURN: 0 or 1 "
603
+ {
604
+ if (zdd1.idx != zdd2.idx) { return (int(0)); }
605
+
606
+ if (zdd1.idx == 0) { return (int(zdd1.thenBranch == zdd2.thenBranch)); }
607
+
608
+ return (zdd_check(zdd1.thenBranch,zdd2.thenBranch)*zdd_check(zdd1.elseBranch,zdd2.elseBranch));
609
+ }
610
+
611
+ ///////////////////////////////////////////////////////////////////////
612
+
613
+ proc boolean_set(zdd ss,list #)
614
+ "USAGE: boolean_set(ss[, rb]); ss zdd, rb boolean ring
615
+ RETURN: default: boolean set ss in the representation of a Polybori boolean set
616
+ in the ring rb==boolean_poly_ring(basering); optional input: boolean ring rb
617
+ SEE ALSO: boolean_ideal, boolean_std
618
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
619
+ EXAMPLE: example boolean_set; shows an example"
620
+ {
621
+ pyobject rb;
622
+ rb=check_additional_ring(#);
623
+ pyobject newthen,newelse,unbek,outp;
624
+ if (ss.idx==0)
625
+ {
626
+ if (zdd_check(ss,zdd_one)==1) { return (boolean_constant(1,rb)); }
627
+ return (boolean_constant(0,rb));
628
+ }
629
+ newthen=(boolean_set(ss.thenBranch,rb));
630
+ newelse=(boolean_set(ss.elseBranch,rb));
631
+ outp=if_then_else_idx(ss.idx-1,newthen,newelse);
632
+ return (outp);
633
+ }
634
+
635
+ example
636
+ { "EXAMPLE:"; echo=2;
637
+ ring rs=0,(x,y,z),Dp;
638
+ poly ps=(x+1)*(y+1)*(z+1);
639
+ zdd fz=ps;
640
+ boolean_set(fz);
641
+
642
+ poly g=x*y*z+1;
643
+ zdd gz=g;
644
+ boolean_set(gz);
645
+
646
+ ring R=0,(x(1..4)),Dp;
647
+ def Rb=boolean_poly_ring(R);
648
+ poly h=(x(1)+1)*(x(2)+1)*(x(3)+1)*(x(4)+1);
649
+ zdd hz=h;
650
+ boolean_set(hz);
651
+ }
652
+
653
+ ///////////////////////////////////////////////////////////////////////
654
+
655
+ proc from_boolean_set(def s)
656
+ "USAGE: from_boolean_set(sb); sb boolean set
657
+ RETURN: Boolean set sb in the representation of a zdd
658
+ SEE ALSO: boolean_ideal, boolean_std
659
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
660
+ EXAMPLE: example from_boolean_set; shows an example"
661
+ {
662
+ bpoly bp = s;
663
+ pyobject sb = bp;
664
+ def rb=boolean_poly_ring(basering);
665
+ zdd result;
666
+ def nav=sb.navigation();
667
+ int ind=int(nav.value());
668
+ def navout_then=nav.then_branch();
669
+ def navout_else=nav.else_branch();
670
+ def pb=Polynomial(sb);
671
+
672
+ if (int(nav.constant()))
673
+ {
674
+ if (pb==1) { return(zdd_one); }
675
+ return(zdd_zero);
676
+ }
677
+
678
+ result.idx=ind+1;
679
+ pyobject one=1;
680
+ def substpoly=one*rb.variable(ind);
681
+
682
+ if (int(navout_then.constant()))
683
+ {
684
+ result.thenBranch=zdd_one;
685
+ }
686
+ else
687
+ {
688
+ result.thenBranch=from_boolean_set(BooleSet(navout_then,rb));
689
+ }
690
+ if (int(navout_else.constant()))
691
+ {
692
+ if (subst(from_boolean_poly(pb),from_boolean_poly(substpoly),0)==1)
693
+ {
694
+ result.elseBranch=zdd_one;
695
+ }
696
+ else
697
+ {
698
+ result.elseBranch=zdd_zero;
699
+ }
700
+ }
701
+ else
702
+ {
703
+ result.elseBranch=from_boolean_set(BooleSet(navout_else,rb));
704
+ }
705
+ return(result);
706
+ }
707
+
708
+ example
709
+ { "EXAMPLE:"; echo=2;
710
+ ring r=0,(x,y,z),Dp;
711
+ poly f=(x+1)*(y+1)*(z+1);
712
+ bpoly fb=f;
713
+ bset fs=fb;
714
+ from_boolean_set(fs);
715
+
716
+ poly g=x*y*z+1;
717
+ bpoly gb=g;
718
+ bset gs=gb;
719
+ from_boolean_set(gs);
720
+
721
+ ring R=0,(x(1..4)),Dp;
722
+ poly h=(x(1)+1)*(x(2)+1)*(x(3)+1)*(x(4)+1);
723
+ pyobject hb=boolean_poly(h);
724
+ def hs=hb.set();
725
+ from_boolean_set(hs);
726
+ }
727
+
728
+ //////////////////////////////////////////////////////////////////////
729
+
730
+ proc direct_from_boolean_poly(def p)
731
+ "USAGE: from_boolean_poly(pb); pb boolean polynomial
732
+ RETURN: polynomial in Singular
733
+ SEE ALSO: from_boolean_ideal, boolean_ideal, boolean_poly, boolean_poly_ring,
734
+ boolean_std
735
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
736
+ EXAMPLE: example from_boolean_poly; shows an example"
737
+ {
738
+ pyobject pb = p;
739
+ poly result = 0;
740
+ def terms = python_eval("list")(pb.terms());
741
+ int nlen = size(terms);
742
+ for (int i = 0; i < nlen; i++)
743
+ {
744
+ result=from_boolean_poly_update(result,terms[i]);
745
+ }
746
+ return (result);
747
+ }
748
+
749
+ example
750
+ { "EXAMPLE:"; echo=2;
751
+ ring r=0,(x,y,z),Dp;
752
+ pyobject rb=boolean_poly_ring(r);
753
+ poly f=x^2+2*y^3+3*z^3;
754
+ bpoly pp=f;
755
+ direct_from_boolean_poly(pp);
756
+
757
+ poly g=0;
758
+ bpoly pp=g;
759
+ direct_from_boolean_poly(pp);
760
+ }
761
+
762
+ ///////////////////////////////////////////////////////////////////////
763
+ // one iteration in direct_from_boolean_poly
764
+
765
+ static proc from_boolean_poly_update(poly ps, pyobject pb)
766
+ "USAGE: from_boolean_poly_update(ps,pb); ps polynomial, pb boolean polynomial,
767
+ RETURN: update of the Singular polynomial in from_boolean_poly in one iteration
768
+ SEE ALSO: from_boolean_poly
769
+ {
770
+ pyobject current = pb."variables"();
771
+ pyobject vars = python_eval("list")(current);
772
+ int j, index;
773
+ poly term = 1;
774
+ pyobject currentvar;
775
+ int tlen = size(vars);
776
+ for (j = 0; j < tlen; j++)
777
+ {
778
+ currentvar = vars[j];
779
+ index = int(currentvar.index());
780
+ term = term * var(index+1);
781
+ }
782
+ return(ps + term);
783
+ }
784
+
785
+ ///////////////////////////////////////////////////////////////////////
786
+ // return 1, iff int is 1 modulo 2 and 0 else
787
+
788
+ static proc coeff_check(int const)
789
+ "USAGE: coeff_check(const); const int
790
+ RETURN: 1 iff the coefficient equals 1 modulo 2 and 0 else
791
+ NOTE: helps to handle leading coefficients of rings in arbitrary characteristic
792
+ SEE ALSO: recursive_boolean_poly, boolean_poly
793
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
794
+ EXAMPLE: example coeff_check; shows an example"
795
+ {
796
+ if (char(basering)==2) { return (const); }
797
+
798
+ return ((const%2)*(const%2));
799
+ }
800
+ example
801
+ { "EXAMPLE:"; echo = 2;
802
+ ring R1=5,x(1..4),lp;
803
+ poly f=3*x(1)+x(2)^2;
804
+ coeff_check(int(leadcoef(f)));
805
+ }
806
+
807
+ ///////////////////////////////////////////////////////////////////////
808
+
809
+ static proc check_additional_ring(list #)
810
+ "USAGE: check_additional_ring(#);
811
+ NOTE: Help function to check whether an additional ring exists and if it is a
812
+ bring or a ring in python."
813
+ {
814
+ pyobject rb;
815
+ bring rbhelp;
816
+ if (size(#)==0)
817
+ {
818
+ rb=boolean_poly_ring(basering);
819
+ }
820
+ else
821
+ {
822
+ if (typeof(#[1])=="bring")
823
+ {
824
+ rbhelp=#[1];
825
+ rb=rbhelp.pyring;
826
+ }
827
+ else
828
+ {
829
+ rb=#[1];
830
+ }
831
+ }
832
+ return(rb);
833
+ }
834
+ ///////////////////////////////////////////////////////////////////////
835
+
836
+ proc boolean_constant(int const, list #)
837
+ "USAGE: boolean_constant(const[, rb]); const constant and rb boolean ring
838
+ RETURN: default: constant const in the representation of the boolean ring
839
+ rb==boolean_poly_ring(basering); optional input: rb=boolean ring rb
840
+ SEE ALSO: boolean_ideal, boolean_std
841
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
842
+ EXAMPLE: example boolean_constant; shows an example"
843
+ {
844
+ pyobject rb = check_additional_ring(#);
845
+ if (coeff_check(const)==0) { return (rb.zero()); }
846
+
847
+ return (rb.one());
848
+ }
849
+
850
+ example
851
+ { "EXAMPLE:"; echo = 2;
852
+ ring r=7,(x,y),Dp;
853
+ pyobject rb=boolean_poly_ring(r);
854
+ boolean_constant(int(3));
855
+ typeof(boolean_constant(int(3)));
856
+ boolean_constant(int(0));
857
+ typeof(boolean_constant(int(0)));
858
+ }
859
+
860
+ ///////////////////////////////////////////////////////////////////////
861
+
862
+ proc boolean_poly(poly ps, list #)
863
+ "USAGE: boolean_poly(ps[, dir, rb]); ps polynomial, dir integer zero or one, rb
864
+ boolean ring
865
+ RETURN: default: polynomial ps in the representation of the boolean ring
866
+ rb==boolean_poly_ring(basering); optional input: boolean ring rb
867
+ NOTE: via the optional input dir, one can choose the computation method (either
868
+ direct[dir==0] or recursive[dir==1]). default: recursive
869
+ SEE ALSO: boolean_ideal, boolean_std
870
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
871
+ EXAMPLE: example boolean_poly; shows an example"
872
+ {
873
+ if (size(#)==0)
874
+ {
875
+ return(recursive_boolean_poly(ps));
876
+ }
877
+ if (size(#)==1)
878
+ {
879
+ if (typeof(#[1])=="int")
880
+ {
881
+ if (#[1]==0) { return(direct_boolean_poly(ps)); }
882
+
883
+ return(recursive_boolean_poly(ps));
884
+ }
885
+ return(direct_boolean_poly(ps,#[1]));
886
+ }
887
+ if (#[1]==0) { return(direct_boolean_poly(ps,#[2])); }
888
+
889
+ return(recursive_boolean_poly(ps,#[2]));
890
+ }
891
+ example
892
+ { "EXAMPLE:"; echo = 2;
893
+ ring r=0,x(1..5),Dp;
894
+ poly f=x(2)*(x(3)-x(1))+x(4)*x(5);
895
+ bring rb=r;
896
+ boolean_poly(f);
897
+ boolean_poly(f,0);
898
+ boolean_poly(f,0,boolean_poly_ring(r));
899
+ boolean_poly(f,0,rb);
900
+
901
+
902
+ poly g=0;
903
+ boolean_poly(g);
904
+
905
+ poly g=1;
906
+ boolean_poly(g);
907
+ }
908
+
909
+ ///////////////////////////////////////////////////////////////////////
910
+
911
+ proc from_boolean_poly(def p, list #)
912
+ "USAGE: from_boolean_poly(ps[, dir]); ps polynomial, dir integer zero or one
913
+ RETURN: default: polynomial ps in the representation of the boolean ring
914
+ NOTE: via the optional input dir, one can choose the computation method (either
915
+ direct[dir==0] or recursive[dir==1]). default: direct
916
+ SEE ALSO: boolean_ideal, boolean_std
917
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
918
+ EXAMPLE: example from_boolean_poly; shows an example"
919
+ {
920
+ pyobject pb = pyobject(p);
921
+
922
+ if (size(#)==0) { return(direct_from_boolean_poly(pb)); }
923
+ if (#[1]==0) { return(direct_from_boolean_poly(pb)); }
924
+
925
+ return(recursive_from_boolean_poly(pb));
926
+ }
927
+
928
+ example
929
+ { "EXAMPLE:"; echo = 2;
930
+ ring r=0,(x,y,z),Dp;
931
+ def rb=boolean_poly_ring(r);
932
+ poly f=x^2+2*y+5*z^4;
933
+ bpoly pp=f;
934
+ from_boolean_poly(pp);
935
+ from_boolean_poly(pp,1);
936
+
937
+ ring r2=5,(x,y,z),Dp;
938
+ def rb2=boolean_poly_ring(r2);
939
+ poly f2=x+y+z;
940
+ bpoly pp2=f2;
941
+ from_boolean_poly(pp);
942
+ from_boolean_poly(pp,1);
943
+ }
944
+
945
+ ///////////////////////////////////////////////////////////////////////
946
+
947
+ proc direct_boolean_poly(poly ps, list #)
948
+ "USAGE: boolean_poly(ps[, rb]); ps polynomial, rb boolean ring
949
+ RETURN: default: polynomial ps in the representation of the boolean ring
950
+ rb==boolean_poly_ring(basering); optional input: boolean ring rb
951
+ SEE ALSO: boolean_ideal, boolean_std
952
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
953
+ EXAMPLE: example boolean_poly; shows an example"
954
+ {
955
+ pyobject resultbool,rb;
956
+ rb=check_additional_ring(#);
957
+
958
+ int nmax= size(ps);
959
+ resultbool = Polynomial(rb.zero());
960
+ for (int i = 1; i <= nmax; i++)
961
+ {
962
+ if ( coeff_check(int(leadcoef(ps[i]))) == 1 )
963
+ {
964
+ resultbool=boolean_poly_update(resultbool,ps[i],rb);
965
+ }
966
+ }
967
+ return (resultbool);
968
+ }
969
+
970
+ example
971
+ { "EXAMPLE:"; echo = 2;
972
+ ring r0=2,x(1..4),lp;
973
+ bring rb=r0;
974
+ poly f=x(1)^2+2*x(2)*(x(3))-x(4)^3;
975
+ direct_boolean_poly(f);
976
+ direct_boolean_poly(f,rb);
977
+
978
+ ring r1=0,x,Dp;
979
+ poly f=x3+2x+1;
980
+ direct_boolean_poly(f);
981
+
982
+ ring r2=32003,(x,y,z),Dp;
983
+ poly f=xyz+20*x^2*y-3*xz+15;
984
+ direct_boolean_poly(f);
985
+ }
986
+
987
+ ///////////////////////////////////////////////////////////////////////
988
+ // one iteration in direct_boolean_poly
989
+
990
+ static proc boolean_poly_update(def pb, poly ps, pyobject rb)
991
+ "USAGE: boolean_poly_update(pb,ps,rb); pb boolean polynomial, ps polynomial,
992
+ rb boolean ring
993
+ RETURN: update of the boolean polynomial in boolean_poly in one iteration
994
+ SEE ALSO: boolean_poly
995
+ {
996
+ intvec current = leadexp(ps);
997
+ int j;
998
+ pyobject term, var_rb;
999
+ term = python_eval("Monomial")(rb);
1000
+ for (j = 1; j <= size(current); j=j+1)
1001
+ {
1002
+ var_rb = rb.variable(j-1);
1003
+ if (current[j] > 0) { term = term * var_rb; }
1004
+ }
1005
+ return (pb + term);
1006
+ }
1007
+
1008
+ ///////////////////////////////////////////////////////////////////////
1009
+
1010
+ proc recursive_boolean_poly(poly ps, list #)
1011
+ "USAGE: boolean_poly(ps[, rb]); ps polynomial, rb boolean ring
1012
+ RETURN: default: polynomial ps in the representation of the boolean ring
1013
+ rb==boolean_poly_ring(basering); optional input: rb boolean ring
1014
+ SEE ALSO: boolean_ideal, boolean_std
1015
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1016
+ EXAMPLE: example recursive_boolean_poly; shows an example"
1017
+ {
1018
+ pyobject rb;
1019
+ if (size(#)==0)
1020
+ {
1021
+ #[1]=boolean_poly_ring(basering);
1022
+ #[2]=0;
1023
+ }
1024
+ if (size(#)==1)
1025
+ {
1026
+ #[2]=0;
1027
+ }
1028
+ rb=check_additional_ring(#[1]);
1029
+ if (#[2]==int(rb.n_variables()))
1030
+ {
1031
+ return (boolean_constant(int(leadcoef(ps)),rb));
1032
+ }
1033
+ else
1034
+ {
1035
+ def xsu=var(#[2]+1);
1036
+ poly p0=subst(ps,xsu,0);
1037
+ poly p1=subst(ps-p0,xsu,1);
1038
+ def ahelp=recursive_boolean_poly(p1,rb,#[2]+1);
1039
+ def bhelp=recursive_boolean_poly(p0,rb,#[2]+1);
1040
+ return (rb.variable(#[2])*ahelp+bhelp);
1041
+ }
1042
+ }
1043
+
1044
+ example
1045
+ { "EXAMPLE:"; echo = 2;
1046
+ ring r0=2,x(1..4),lp;
1047
+ poly f=x(1)^2+2*x(2)*(x(3))-x(4)^3;
1048
+ recursive_boolean_poly(f);
1049
+
1050
+ ring r1=0,x,Dp;
1051
+ poly f=x3+2x+1;
1052
+ recursive_boolean_poly(f);
1053
+
1054
+ ring r2=32003,(x,y,z),Dp;
1055
+ def br2=boolean_poly_ring(r2);
1056
+ bring bbr2=r2;
1057
+ poly f=xyz+20*x^2*y-3*xz+15;
1058
+ recursive_boolean_poly(f,br2);
1059
+ recursive_boolean_poly(f,bbr2);
1060
+ }
1061
+
1062
+ ///////////////////////////////////////////////////////////////////////
1063
+
1064
+ proc boolean_ideal(ideal Is, list #)
1065
+ "USAGE: boolean_ideal(Is[, rb]); Is Ideal, rb boolean ring
1066
+ RETURN: default: ideal Is in the representation of the boolean ring
1067
+ rb==boolean_poly_ring(basering); optional input: rb boolean ring
1068
+ SEE ALSO: boolean_std
1069
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1070
+ EXAMPLE: example boolean_ideal; shows an example"
1071
+ {
1072
+ pyobject rb;
1073
+ rb=check_additional_ring(#);
1074
+ int len=size(Is);
1075
+ pyobject Ib = python_eval("list()");
1076
+ for (int i=1; i<=len; i++)
1077
+ {
1078
+ Ib.append(boolean_poly(Is[i],rb));
1079
+ }
1080
+ bideal re;
1081
+ re.pylist = Ib;
1082
+
1083
+ return(re);
1084
+ }
1085
+
1086
+ example
1087
+ { "EXAMPLE:"; echo = 2;
1088
+ ring r0=2,x(1..4),lp;
1089
+ poly f1=x(1)^2+2*x(2)*(x(3))-x(4)^3;
1090
+ poly f2=x(1)^2-x(3)*x(1);
1091
+ poly f3=x(2)+5-2*x(1);
1092
+ poly f4=x(1)*x(2)-x(3);
1093
+ ideal I=f1,f2,f3,f4;
1094
+ boolean_ideal(I);
1095
+
1096
+ ring r1=0,x,Dp;
1097
+ poly f1=x3+2*x+1;
1098
+ poly f2=x10-x5+2x;
1099
+ poly f3=19;
1100
+ ideal I=f1,f2,f3;
1101
+ boolean_ideal(I);
1102
+
1103
+ ring r2=32003,(x,y,z),Dp;
1104
+ bring bbr2=r2;
1105
+ poly f1=xyz+20*x^2*y-3*xz+15;
1106
+ poly f2=32002*xy+z2;
1107
+ poly f3=19;
1108
+ ideal I=f1,f2,f3;
1109
+ boolean_ideal(I);
1110
+ boolean_ideal(I,bbr2);
1111
+ }
1112
+
1113
+ ////////////////////////////////////////////////////////////////
1114
+
1115
+ proc from_boolean_ideal(bideal I)
1116
+ "USAGE: from_boolean_ideal(I); I boolean ideal
1117
+ RETURN: ideal in Singular
1118
+ SEE ALSO: from_boolean_poly, boolean_ideal, boolean_poly, boolean_std,
1119
+ boolean_poly_ring
1120
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1121
+ EXAMPLE: example from_boolean_ideal; shows an example"
1122
+ {
1123
+ ideal re;
1124
+ int i;
1125
+ int nlen = size(I);
1126
+ for (i = 1; i <= nlen; i++)
1127
+ {
1128
+ re[i] = from_boolean_poly(I[i]);
1129
+ }
1130
+ return (re);
1131
+ }
1132
+
1133
+ example
1134
+ { "EXAMPLE:"; echo=2;
1135
+ ring rs=0,(x,y,z),Dp;
1136
+ def rb3=boolean_poly_ring(rs);
1137
+ poly f1=x+y;
1138
+ poly f2=x+z;
1139
+ bpoly pp =f1;
1140
+ bpoly p = f2;
1141
+ bideal Ib;
1142
+ list K=(p,pp);
1143
+ Ib=K;
1144
+ from_boolean_ideal(Ib);
1145
+
1146
+ ring rs2=5,(x,y,z),Dp;
1147
+ def rb4=boolean_poly_ring(rs2);
1148
+ poly p1=x+y;
1149
+ poly p2=x+z;
1150
+ poly p3=y+z;
1151
+ bpoly p = p1;
1152
+ bpoly pp = p2;
1153
+ bpoly ppp = p3;
1154
+ bideal Ib;
1155
+ list K=(p,pp,ppp);
1156
+ Ib=K;
1157
+ from_boolean_ideal(Ib);
1158
+ }
1159
+
1160
+ ///////////////////////////////////////////////////////////////////////
1161
+
1162
+ proc boolean_std(bideal Is)
1163
+ "USAGE: boolean_std(Is); Is ideal
1164
+ RETURN: Singular ideal of the boolean groebner basis of Is
1165
+ SEE ALSO: from_boolean_poly, boolean_ideal, boolean_poly, from_boolean_ideal,
1166
+ boolean_poly_ring
1167
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1168
+ EXAMPLE: example boolean_std; shows an example"
1169
+ {
1170
+ pyobject Ib = Is;
1171
+
1172
+ def redIb=groebner_basis(Ib);
1173
+ bideal result = redIb;
1174
+ return(result);
1175
+ }
1176
+
1177
+ example
1178
+ { "EXAMPLE:"; echo = 2;
1179
+ ring r0=2,x(1..4),lp;
1180
+ poly f1=x(1)^2+2*x(2)*(x(3))-x(4)^3;
1181
+ poly f2=x(1)^2-x(3)*x(1);
1182
+ poly f3=x(2)+5-2*x(1);
1183
+ poly f4=x(1)*x(2)-x(3);
1184
+ ideal I=f1,f2,f3,f4;
1185
+
1186
+ boolean_std(I); // implicitly add x(i)^2-x(i)
1187
+
1188
+ bideal bI=I; // alternative syntax
1189
+ bideal re = std(bI); // Continue PolyBoRi computations
1190
+ std(re[1..2]);
1191
+
1192
+ ring r1=0,x,Dp;
1193
+ poly f1=x3+2*x+1;
1194
+ poly f2=x10-x5+2x;
1195
+ poly f3=19;
1196
+ ideal I=f1,f2,f3;
1197
+ boolean_std(I);
1198
+
1199
+ ring r2=32003,(x,y,z),Dp;
1200
+ poly f1=xz+y+20*x^2*y;
1201
+ poly f2=32002*xy+xz2+y;
1202
+ ideal I=f1,f2;
1203
+ boolean_std(I);
1204
+
1205
+ ring r2=32003,(x,y,z),Dp;
1206
+ poly f1=xyz+20*x^2*y-3*xz+15;
1207
+ poly f2=32002*xy+z2;
1208
+ poly f3=19*x5y;
1209
+ ideal I=f1,f2,f3;
1210
+ boolean_std(I);
1211
+ }
1212
+
1213
+ /////////////////////////////////////////////////////////////////////////
1214
+
1215
+ proc from_boolean_constant(def p)
1216
+ "USAGE: from_boolean_constant(pb); pb pyobject
1217
+ RETURN: constant polynomial
1218
+ SEE ALSO: boolean_ideal, boolean_std
1219
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1220
+ EXAMPLE: example from_boolean_constant; shows an example"
1221
+ {
1222
+ pyobject pb = p;
1223
+ if (pb==0) { return (poly(0)); }
1224
+
1225
+ return (poly(1));
1226
+ }
1227
+
1228
+ example
1229
+ { "EXAMPLE:"; echo = 2;
1230
+ ring rs=0,(x,y,z),Dp;
1231
+ def rsb=boolean_poly_ring(rs);
1232
+ poly f=(x+y)*x+z;
1233
+ bpoly pp=f;
1234
+ from_boolean_constant(0);
1235
+ from_boolean_constant(1);
1236
+ from_boolean_constant(pp);
1237
+ }
1238
+
1239
+ ///////////////////////////////////////////////////////////////////////
1240
+
1241
+ proc recursive_from_boolean_poly(def p)
1242
+ "USAGE: recursive_from_boolean_poly(pb); pb boolean polynomial
1243
+ RETURN: polynomial in Singular
1244
+ SEE ALSO: from_boolean_poly, boolean_ideal, boolean_poly, from_boolean_ideal,
1245
+ boolean_poly_ring
1246
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1247
+ EXAMPLE: example recursive_from_boolean_poly; shows an example"
1248
+ {
1249
+ pyobject pb = p;
1250
+
1251
+ if (pb==0) { return(0); }
1252
+ if (pb==1) { return(1); }
1253
+
1254
+ int idx = int(pb.navigation().value());
1255
+ def p0=Polynomial(pb.set().subset0(idx));
1256
+ def p1 = Polynomial(pb.set().subset1(idx));
1257
+
1258
+ return (var(idx+1)*recursive_from_boolean_poly(p1)+recursive_from_boolean_poly(p0));
1259
+ }
1260
+
1261
+ example
1262
+ { "EXAMPLE:"; echo = 2;
1263
+ ring rs=0,(x,y,z),Dp;
1264
+ def rsb=boolean_poly_ring(rs);
1265
+ poly f=(x+y)*x+z;
1266
+ bpoly pp=f;
1267
+ recursive_from_boolean_poly(pp);
1268
+
1269
+ ring rs2=2,(x,y,z),Dp;
1270
+ def rsb2=boolean_poly_ring(rs2);
1271
+ poly f2=(x+y)*x+x;
1272
+ bpoly pp2=f2;
1273
+ recursive_from_boolean_poly(pp);
1274
+ }
1275
+
1276
+ /////////////////////////////////////////////////////////////////////////
1277
+
1278
+ proc poly2zdd(poly ps)
1279
+ "USAGE: poly2zdd(poly ps); polynomial ps
1280
+ RETURN: polynomial ps in zdd representation
1281
+ SEE ALSO: boolean_poly, from_boolean_set
1282
+ KEYWORDS: PolyBoRi, zero-supressed decision diagram
1283
+ EXAMPLE: example poly2zdd; shows an example"
1284
+ {
1285
+ pyobject pp=boolean_poly(ps);
1286
+ pyobject pset = pp.set();
1287
+ zdd result = from_boolean_set(pset);
1288
+ return(result);
1289
+ }
1290
+
1291
+ example
1292
+ { "EXAMPLE:"; echo = 2;
1293
+ ring r=0,x(1..5),Dp;
1294
+ poly f=(x(1)+1)*(x(2)+1)*(x(3)+1)*x(4)*x(5);
1295
+ poly2zdd(f);
1296
+
1297
+ poly g=x(3);
1298
+ poly2zdd(g);
1299
+ }
1300
+
1301
+ /////////////////////////////////////////////////////////////////////////
1302
+
1303
+ proc zdd2poly(zdd ss)
1304
+ "USAGE: zdd2poly(ss); zero-supressed decision diagram ss
1305
+ RETURN: zdd ss in polynomial representation
1306
+ SEE ALSO:from_boolean_poly, boolean_set
1307
+ KEYWORDS: PolyBoRi, Boolean Groebner Basis
1308
+ EXAMPLE: example poly2zdd; shows an example"
1309
+ {
1310
+ def ps=boolean_set(ss);
1311
+ return(from_boolean_poly(Polynomial(ps)));
1312
+ }
1313
+
1314
+ example
1315
+ { "EXAMPLE:"; echo = 2;
1316
+ ring r=0,x(1..5),Dp;
1317
+ poly f=(x(1)+1)*(x(2)+1)*(x(3)+1)*x(4)*x(5);
1318
+ zdd2poly(poly2zdd(f));
1319
+
1320
+ poly g=x(3);
1321
+ zdd2poly(poly2zdd(g));
1322
+
1323
+ poly g=0;
1324
+ zdd2poly(poly2zdd(0));
1325
+
1326
+ poly g=1;
1327
+ zdd2poly(poly2zdd(01));
1328
+ }
1329
+
1330
+ /////////////////////////////////////////////////////////////////////////
1331
+
1332
+ proc disp_zdd(zdd ss, list #)
1333
+ "USAGE: disp_zdd(ss); zero-supressed decision diagram ss
1334
+ RETURN: string containing visualization of ss
1335
+ NOTE: the resulting string is the visualization of the polynomial that corresponds
1336
+ to ss, but with a additional structure that comes from the zdd. Every reached else-
1337
+ Branch induces a new line in the string.
1338
+ SEE ALSO:zdd2poly, poly2zdd
1339
+ KEYWORDS: Polybori, Boolean Groebner Basis
1340
+ EXAMPLE: example disp_zdd; shows an example"
1341
+ {
1342
+ int dist,i;
1343
+ string str,space;
1344
+ if (size(#)==0)
1345
+ {
1346
+ dist=1;
1347
+ str=" ";
1348
+ }
1349
+ else
1350
+ {
1351
+ dist=#[1];
1352
+ str=#[2];
1353
+ }
1354
+ for (i=1;i<=dist+3;i++)
1355
+ {
1356
+ space=space+" ";
1357
+ }
1358
+ if (ss.idx==0)
1359
+ {
1360
+ if (size(space)>5)
1361
+ {
1362
+ return(str);
1363
+ }
1364
+ else
1365
+ {
1366
+ if (ss==zdd_one)
1367
+ {
1368
+ return (1);
1369
+ }
1370
+ else
1371
+ {
1372
+ return (0);
1373
+ }
1374
+ }
1375
+ }
1376
+ else
1377
+ {
1378
+ str=str,"x",string(ss.idx);
1379
+ if (ss.thenBranch.idx!=0)
1380
+ {
1381
+ str=str,"(";
1382
+ str=disp_zdd(ss.thenBranch,dist+3,str);
1383
+ str=str,")";
1384
+ }
1385
+ if ((ss.elseBranch.idx!=0)||(ss.elseBranch==zdd_one))
1386
+ {
1387
+ if (ss.elseBranch==zdd_one)
1388
+ {
1389
+ str=str+"+1";
1390
+ }
1391
+ else
1392
+ {
1393
+ str=str,"+"+newline+space;
1394
+ str=disp_zdd(ss.elseBranch,dist+3,str);
1395
+ }
1396
+ }
1397
+ return(str);
1398
+ }
1399
+ }
1400
+
1401
+ example
1402
+ { "EXAMPLE:"; echo = 2;
1403
+ ring r1=0,(x,y,z),Dp;
1404
+ poly f1=xyz+xy+xz+yz+y+z+x+1;
1405
+ zdd s1=f1;
1406
+ disp_zdd(s1);
1407
+
1408
+ ring r2=0,x(1..6),Dp;
1409
+ poly f2=x(1)+x(2)+x(3)+x(5)^2+x(6);
1410
+ zdd s2=f2;
1411
+ disp_zdd(s2);
1412
+
1413
+ ring r4=0,x(1..6),Dp;
1414
+ poly f2=x(1)+1;
1415
+ zdd s2=f2;
1416
+ disp_zdd(s2);
1417
+
1418
+ ring r2=0,x(1..6),Dp;
1419
+ poly f2=x(1)*x(2)*(x(3)-x(5)^2*x(6))+3*x(4)*x(5)-3;
1420
+ zdd s2=f2;
1421
+ disp_zdd(s2);
1422
+
1423
+ poly f4=0;
1424
+ zdd s4=f4;
1425
+ disp_zdd(s4);
1426
+
1427
+ poly f5=1;
1428
+ zdd s5=f5;
1429
+ disp_zdd(s5);
1430
+ }