@@ -64,7 +64,7 @@ def _run_msolve(ideal, options):
64
64
65
65
return msolve_out .stdout
66
66
67
- def groebner_basis_degrevlex (ideal ):
67
+ def groebner_basis_degrevlex (ideal , proof = True ):
68
68
r"""
69
69
Compute a degrevlex Gröbner basis using msolve
70
70
@@ -85,25 +85,27 @@ def groebner_basis_degrevlex(ideal):
85
85
[c^4 + 38*c^3 - 6*c^2 - 6*c, 30*c^3 + 32*c^2 + b - 14*c,
86
86
a + 2*b + 2*c - 1]
87
87
88
- TESTS::
89
-
90
- sage: R.<foo, bar> = PolynomialRing(GF(536870909), 2)
91
- sage: I = Ideal([ foo^2 - 1, bar^2 - 1 ])
92
- sage: I.groebner_basis(algorithm='msolve') # optional - msolve
93
- [bar^2 - 1, foo^2 - 1]
88
+ Gröbner bases over the rationals require `proof=False`::
94
89
95
90
sage: R.<x, y> = PolynomialRing(QQ, 2)
96
91
sage: I = Ideal([ x*y - 1, (x-2)^2 + (y-1)^2 - 1])
97
92
sage: I.groebner_basis(algorithm='msolve') # optional - msolve
98
93
Traceback (most recent call last):
99
94
...
100
- NotImplementedError: unsupported base field: Rational Field
95
+ ValueError: msolve relies on heuristics; please use proof=False
96
+ sage: I.groebner_basis(algorithm='msolve', proof=False) # optional - msolve
97
+ [x*y - 1, x^2 + y^2 - 4*x - 2*y + 4, y^3 - 2*y^2 + x + 4*y - 4]
98
+
99
+ TESTS::
100
+
101
+ sage: R.<foo, bar> = PolynomialRing(GF(536870909), 2)
102
+ sage: I = Ideal([ foo^2 - 1, bar^2 - 1 ])
103
+ sage: I.groebner_basis(algorithm='msolve') # optional - msolve
104
+ [bar^2 - 1, foo^2 - 1]
101
105
"""
102
106
103
- base = ideal .base_ring ()
104
- if not (isinstance (base , FiniteField ) and base .is_prime_field () and
105
- base .characteristic () < 2 ** 31 ):
106
- raise NotImplementedError (f"unsupported base field: { base } " )
107
+ if ideal .base_ring () is QQ and sage .structure .proof .proof .get_flag (proof , "polynomial" ):
108
+ raise ValueError ("msolve relies on heuristics; please use proof=False" )
107
109
108
110
drlpolring = ideal .ring ().change_ring (order = 'degrevlex' )
109
111
msolve_out = _run_msolve (ideal , ["-g" , "2" ])
0 commit comments