def buchberger(l):
"calculates a (non minimal) Groebner basis"
l=interred(l)
#for making sure, that every polynomial has a different leading term
#needed for addGenerator
g=GroebnerStrategy()
for p in l:
g.addGenerator(p)
while g.npairs()>0:
g.cleanTopByChainCriterion()
p=g.nextSpoly()
p=g.nf(p)
if not p.isZero():
g.addGenerator(p)
return list(g)
The criteria are handled by the addGenerator-method for
immediately applicable criteria and by the function cleanTopByChainCriterion for the chain criterion.