(c, d)
return 1
Compare two critical pairs c and d.

    c < d iff
        - lbp(c[0], _, Num(c[2]) < lbp(d[0], _, Num(d[2])) (this
        corresponds to um_c * f_c and um_d * f_d)
    or
        - lbp(c[0], _, Num(c[2]) >< lbp(d[0], _, Num(d[2])) and
        lbp(c[3], _, Num(c[5])) < lbp(d[3], _, Num(d[5])) (this
        corresponds to vm_c * g_c and vm_d * g_d)

    c > d otherwise
Compare two critical pairs c and d.
Compare two critical pairs c and d .
def cp_cmp(c, d):
    """
    Compare two critical pairs c and d.

    c < d iff
        - lbp(c[0], _, Num(c[2]) < lbp(d[0], _, Num(d[2])) (this
        corresponds to um_c * f_c and um_d * f_d)
    or
        - lbp(c[0], _, Num(c[2]) >< lbp(d[0], _, Num(d[2])) and
        lbp(c[3], _, Num(c[5])) < lbp(d[3], _, Num(d[5])) (this
        corresponds to vm_c * g_c and vm_d * g_d)

    c > d otherwise
    """
    zero = Polyn(c[2]).ring.zero

    c0 = lbp(c[0], zero, Num(c[2]))
    d0 = lbp(d[0], zero, Num(d[2]))

    r = lbp_cmp(c0, d0)

    if r == -1:
        return -1
    if r == 0:
        c1 = lbp(c[3], zero, Num(c[5]))
        d1 = lbp(d[3], zero, Num(d[5]))

        r = lbp_cmp(c1, d1)

        if r == -1:
            return -1
        #if r == 0:
        #    return 0
    return 1
def cp_cmp ( c , d ) : zero = Polyn ( c [ 2 ] ) . ring . zero c0 = lbp ( c [ 0 ] , zero , Num ( c [ 2 ] ) ) d0 = lbp ( d [ 0 ] , zero , Num ( d [ 2 ] ) ) r = lbp_cmp ( c0 , d0 ) if r == - 1 : return - 1 if r == 0 : c1 = lbp ( c [ 3 ] , zero , Num ( c [ 5 ] ) ) d1 = lbp ( d [ 3 ] , zero , Num ( d [ 5 ] ) ) r = lbp_cmp ( c1 , d1 ) if r == - 1 : return - 1 #if r == 0: #    return 0 return 1