Add Zify InjTyp Inj_comparison_Z.
Definition ZcompareZ (x y : Z) :=
Z_of_comparison (Z.compare x y).
#[global]
Program Instance BinOp_Zcompare : BinOp Z.compare :=
{ TBOp := ZcompareZ }.
Add Zify BinOp BinOp_Zcompare.
#[global]
Instance Op_eq_comparison : BinRel (@eq comparison) :=
{TR := @eq Z ; TRInj := ltac:(intros [] []; simpl ; intuition congruence) }.
Add Zify BinRel Op_eq_comparison.
#[global]
Instance Op_Eq : CstOp Eq :=
{ TCst := 0 ; TCstInj := eq_refl }.
Add Zify CstOp Op_Eq.
#[global]
Instance Op_Lt : CstOp Lt :=
{ TCst := -1 ; TCstInj := eq_refl }.
Add Zify CstOp Op_Lt.
#[global]
Instance Op_Gt : CstOp Gt :=
{ TCst := 1 ; TCstInj := eq_refl }.
Add Zify CstOp Op_Gt.

Lemma Zcompare_spec : forall x y,
(x = y -> ZcompareZ x y = 0)
/\
(x > y -> ZcompareZ x y = 1)
/\
(x < y  -> ZcompareZ x y = -1).