sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.22k stars 424 forks source link

Ideal.basis_is_groebner() may return wrong results #5125

Closed malb closed 15 years ago

malb commented 15 years ago

For the attached list, Ideal(gb).basis_is_groebner() returns True but the basis is not a Gröbner basis!

The code in question:

    def basis_is_groebner(self, singular=singular_default):
        self.ring()._singular_().set_ring()

        F = singular( self.gens(), "module" )
        LTF = singular( [f.lt() for f in self.gens()] , "module" )

        M = (F * LTF.syz()).reduce(self._singular_())

        for i in range(M.nrows()):
            if int(singular.eval("%s[1][%s+1]!=0"%(M.name(),i))):
                return False

        self._singular_().attrib('isSB',1)
        return True

CC: @johnperry-math

Component: commutative algebra

Issue created by migration from https://trac.sagemath.org/ticket/5125

malb commented 15 years ago

Attachment: B.sobj.gz

load("B.sobj") this file to test if the bug is fixed.

johnperry-math commented 15 years ago
comment:1

Wait-- sorry, that doesn't work either. Now things that are Groebner bases are considered not to be.

johnperry-math commented 15 years ago

Attachment: basis_is_groebner.patch.gz

now it works on B.sobj as well as on its groebner basis

johnperry-math commented 15 years ago
comment:2

There were two subtle bugs.

malb commented 15 years ago

apply after basis_is_groebner.patch

malb commented 15 years ago
comment:3

Attachment: basis_is_groebner_doctest.patch.gz

The attached patch fixes the issue for me. I've added a second patch which documents that the bug is indeed fixed. mabshoff, this patch should definitely go in for 3.3 because right now Sage gives wrong answers!

85eec1a4-3d04-4b4d-b711-d4db03337c41 commented 15 years ago
comment:4

Merged both patches in Sage 3.3.alpha4.

Cheers,

Michael