Dear sage-devel,
Consider the following example, sent to me by Theo de Jong (Mainz):
sage: R.<x,y> = PolynomialRing(QQ, order='lex')
sage: I = R.ideal([x^2 + y^3 - 2*y^2, x*y^2 - 3*x*y + x, y^4 - 3*y^3 + y^2])
sage: f = x^2*y + x*y^2
sage: f.reduce(I)
3*x*y - x - y^4 + 2*y^3
This remainder r is incorrect, because (according to the documentation) "No term in r is divisible by any of the leading monomials of I", while we clearly see y^4.
The basis is a Groebner basis, and reduction with respect to the list of polynomials gives the correct result:
sage: I.basis_is_groebner()
True
sage: G = I.gens()
sage: f.reduce(G)
3*x*y - x - y^3 + y^2
The problem seems to be that tail reduction is (unintentionally) turned off in case the ordering is lex and reduction is done w.r.t. an ideal, as previously reported here:
https://trac.sagemath.org/ticket/27508As suggested by Dima Pasechnik, a workaround is to use the Singular notation 'lp' instead of 'lex'.
Evidently, the problem lies in the communication between SageMath and (lib)Singular.
Possible solutions (some with patches) are mentioned in the trac ticket (and the required changes seem relatively minor), but apparently have not been implemented yet.
Having to work around this bug in an educational setting is frustrating. Is there a hero on sage-devel able and willing to work on a fix?
Best regards,
Ricardo