Module SetOfPairsOfPositiveOrderedType <: OrderedType.
Definition t:= (positive * positive).
Definition eq (t1 t2 : t) :=
Pos.eq (fstpp(t1)) (fstpp(t2)) /\ Pos.eq (sndpp(t1)) (sndpp(t2)).
Include IsEq.
Definition eqb (t1 t2 : t) :=
Pos.eqb (fstpp(t1)) (fstpp(t2)) && Pos.eqb (sndpp(t1)) (sndpp(t2)).
Include HasEqBool2Dec.
Definition lt (t1 t2 : t) :=
let ft1 := fstpp(t1) in
let ft2 := fstpp(t2) in
let st1 := sndpp(t1) in
let st2 := sndpp(t2) in
if Pos.eqb ft1 ft2 then Pos.lt st1 st2
else Pos.lt ft1 ft2.
#[global]
Instance lt_compat : Proper (eq==>eq==>iff) lt.
#[global]
Instance lt_strorder : StrictOrder lt.
Definition compare t1 t2 :=
let ft1 := fstpp(t1) in
let ft2 := fstpp(t2) in
let st1 := sndpp(t1) in
let st2 := sndpp(t2) in
match (Pos.compare ft1 ft2) with
| Lt => Lt
| Eq => Pos.compare st1 st2
| Gt => Gt
end.

Lemma compare_spec : forall t1 t2, CompSpec eq lt t1 t2 (compare t1 t2).