(** Simplification of fractions using [Zgcd]. This version can compute within Coq. *)
Definition Qred (q:Q) :=
let (q1,q2) := Qfactor_twos q in
let (r1,r2) := snd (Zggcd q1 (Zpos q2)) in r1#(Z2P r2).

Lemma Qred_complete : forall p q,  p==q -> Qred p = Qred q.
Add Morphism Qred : Qred_comp.