(G, ring)
return reduction(H)
Compute reduced Groebner basis, from BeckerWeispfenning93, p. 216

    Selects a subset of generators, that already generate the ideal
    and computes a reduced Groebner basis for them.
Compute reduced Groebner basis, from BeckerWeispfenning93, p. 216
Compute reduced Groebner basis from BeckerWeispfenning93 p . 216
def red_groebner(G, ring):
    """
    Compute reduced Groebner basis, from BeckerWeispfenning93, p. 216

    Selects a subset of generators, that already generate the ideal
    and computes a reduced Groebner basis for them.
    """
    def reduction(P):
        """
        The actual reduction algorithm.
        """
        Q = []
        for i, p in enumerate(P):
            h = p.rem(P[:i] + P[i + 1:])
            if h:
                Q.append(h)

        return [p.monic() for p in Q]

    F = G
    H = []

    while F:
        f0 = F.pop()

        if not any(monomial_divides(f.LM, f0.LM) for f in F + H):
            H.append(f0)

    # Becker, Weispfenning, p. 217: H is Groebner basis of the ideal generated by G.
    return reduction(H)
def red_groebner ( G , ring ) : def reduction ( P ) : """
        The actual reduction algorithm.
        """ Q = [ ] for i , p in enumerate ( P ) : h = p . rem ( P [ : i ] + P [ i + 1 : ] ) if h : Q . append ( h ) return [ p . monic ( ) for p in Q ] F = G H = [ ] while F : f0 = F . pop ( ) if not any ( monomial_divides ( f . LM , f0 . LM ) for f in F + H ) : H . append ( f0 ) # Becker, Weispfenning, p. 217: H is Groebner basis of the ideal generated by G. return reduction ( H )