Interreduction

The interred-function gives back a system generating the same ideal, where no two leading terms coincide. Also, using the parameter completely ensures that no leading term divides the terms in the tails of the other generators. Even more, it is easier than the Buchberger algorithm, because no critical pairs have to be handled (actually the GroebnerStrategy applies some criteria, when adding a generator, which produces some overhead). The algorithm works by passing the generators sorted to the strategy. If a generator is (lead) rewriteable, it is rewriteable by generators with smaller leading terms. So it will be rewritten by this procedure. The algorithm stops, when no generator is lead rewriteable any more (completely =False) or rewriteable (completely =True).
def interred(l,completely=False):
    """Computes a new generating system (g1, ...,gn), spanning the same ideal modulo field
    equations. The system is interreduced: For i!=j: gi.lead() does not divide any term of
    gj
    """
    l=[Polynomial(p) for p in l if not p==0]
    l_old=None
    l=tuple(l)
    while l_old!=l:
        l_old=l
        l=sorted(l,key=Polynomial.lead)
        g=GroebnerStrategy()
        if completely:
            g.optRedTail=True
        for p in l:
            p=g.nf(p)
            if not p.isZero():
                g.addGenerator(p)
        l=tuple(g)
    return l



2010-09-14