let rec eq_poly = function
p1, p2 -> if is_null_poly (p1)
then is_null_poly (p2)
else
if is_null_poly (p2)
then is_null_poly (p1)
else
let
(a1, q1) = inv_cons_poly (p1)
and
(a2, q2) = inv_cons_poly (p2)
in
eq_rat (a1, a2) & eq_poly (q1, q2)