Definition spec_fraction_encoding (a b : Z) : Q := Qmult a (Qinv b).Definition spec_positive_fraction_encoding (a b : Z) 
  (Ha : (0 < a)%Z) (Hb : (0 < b)%Z) :=
  Qpositive_mult (Z_to_Qpositive a Ha) (Qpositive_inv (Z_to_Qpositive b Hb)).Definition spec_positive_fraction_encoding1 (a b : Z) :=
  Q_tail (Qmult a (Qinv b)).Definition spec_positive_fraction_encoding2 (a b : Z) :=
  Qpositive_mult (Q_tail a) (Qpositive_inv (Q_tail b)).

(* Specifications: *)
Lemma spec_coding : forall m n : nat, Qpositive_c (S m) (S n) (S m + S n) = spec_positive_fraction_encoding1 (m + 1) (n + 1).
Lemma spec_positive_fraction_encoding1_positive_fraction_encoding : forall (m n : Z) (Hm : (0 < m)%Z) (Hn : (0 < n)%Z), spec_positive_fraction_encoding m n Hm Hn = spec_positive_fraction_encoding1 m n.
Lemma spec_positive_fraction_encoding1_positive_fraction_encoding2 : forall (m n : Z) (Hm : (0 < m)%Z) (Hn : (0 < n)%Z), spec_positive_fraction_encoding m n Hm Hn = spec_positive_fraction_encoding2 m n.
Lemma coding : forall (m n : Z) (Hm : (0 < m)%Z) (Hn : (0 < n)%Z), positive_fraction_encoding m n Hm Hn = spec_positive_fraction_encoding m n Hm Hn.
Lemma coding_Q : forall (m n : Z) (Hdenom : n <> 0%Z), fraction_encoding m n Hdenom = spec_fraction_encoding m n.