def spoly(p1, p2, ring):
 LM1 = p1.LM
 LM2 = p2.LM
 LCM12 = ring.monomial_lcm(LM1, LM2)
 m1 = ring.monomial_div(LCM12, LM1)
 m2 = ring.monomial_div(LCM12, LM2)
 s1 = p1.mul_monom(m1)
 s2 = p2.mul_monom(m2)
 s = (s1 - s2)
 return s

def spoly ( p1 , p2 , ring ) : LM1 = p1 . LM LM2 = p2 . LM LCM12 = ring . monomial_lcm ( LM1 , LM2 ) m1 = ring . monomial_div ( LCM12 , LM1 ) m2 = ring . monomial_div ( LCM12 , LM2 ) s1 = p1 . mul_monom ( m1 ) s2 = p2 . mul_monom ( m2 ) s = ( s1 - s2 ) return s
compute lcm(lm .