let rec qsolve (a, b) =
let p, ml = poly_of (mk_sub a b) in
match ml with
| [] ->
if Q.is_zero p then None else raise Exc.Inconsistent
| m :: ml ->
let (q, x) = mono_of m in (* [p + q * x + ml = 0] *)
let b = mk_addq (Q.minus (Q.div p q))
(mk_multq (Q.minus (Q.inv q))
(mk_addl ml))
in
Some(x, b)