#[global]
Instance Op_xorb : BinOp xorb :=
  { TBOp x y := andb (orb x y) (negb (eqb x y)); TBOpInj := xorb_eq }.#[global]
Instance Op_eqb : BinOp eqb :=
  { TBOp := eqb; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_negb : UnOp negb :=
  { TUOp := negb ; TUOpInj _ := eq_refl}.#[global]
Instance Op_eq_bool : BinRel (@eq bool) :=
  {TR := @eq bool ; TRInj b1 b2 := iff_refl (b1 = b2) }.#[global]
Instance Op_true : CstOp true :=
  { TCst := true ; TCstInj := eq_refl }.#[global]
Instance Op_false : CstOp false :=
  { TCst := false ; TCstInj := eq_refl }.(** Comparison over Z *)

#[global]
Instance Op_Zeqb : BinOp Z.eqb :=
  { TBOp := Z.eqb ; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Zleb : BinOp Z.leb :=
  { TBOp := Z.leb; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Zgeb : BinOp Z.geb :=
  { TBOp := Z.geb; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Zltb : BinOp Z.ltb :=
  { TBOp := Z.ltb ; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Zgtb : BinOp Z.gtb :=
  { TBOp := Z.gtb; TBOpInj _ _ := eq_refl }.(** Comparison over N *)

#[global]
Instance Op_Neqb : BinOp N.eqb :=
  { TBOp := Z.eqb; TBOpInj n m := ltac:(now destruct n, m) }.#[global]
Instance Op_Nleb : BinOp N.leb :=
  { TBOp := Z.leb; TBOpInj n m := ltac:(now destruct n, m) }.#[global]
Instance Op_Nltb : BinOp N.ltb :=
  { TBOp := Z.ltb; TBOpInj n m := ltac:(now destruct n, m) }.(** Comparison over positive *)

#[global]
Instance Op_Pos_eqb : BinOp Pos.eqb :=
  { TBOp := Z.eqb; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Pos_leb : BinOp Pos.leb :=
  { TBOp := Z.leb; TBOpInj _ _ := eq_refl }.#[global]
Instance Op_Pos_ltb : BinOp Pos.ltb :=
  { TBOp := Z.ltb; TBOpInj _ _ := eq_refl }.

Lemma Z_of_nat_eqb_iff n m : (n =? m)%nat = (Z.of_nat n =? Z.of_nat m).