Notation Z2P := Z.to_pos (only parsing).Notation Z2P_correct := Z2Pos.id (only parsing).(** Simplification of fractions using [Z.gcd].
  This version can compute within Coq. *)

Definition Qred (q:Q) :=
  let (q1,q2) := q in
  let (r1,r2) := snd (Z.ggcd q1 (Zpos q2))
  in r1#(Z.to_pos r2).

(* Specifications: *)
Lemma Qred_correct : forall q, (Qred q) == q.
Lemma Qred_complete : forall p q, p==q -> Qred p = Qred q.
Lemma Qred_eq_iff q q' : Qred q = Qred q' <-> q == q'.