Add Zify BinRel Op_eq.
Notation cmodwB x :=
((x + 4611686018427387904) mod 9223372036854775808 - 4611686018427387904)%Z.
#[global]
Instance Op_add : BinOp add :=
{| TBOp := fun x y => cmodwB (x + y); TBOpInj := add_spec |}%Z.
Add Zify BinOp Op_add.
#[global]
Instance Op_sub : BinOp sub :=
{| TBOp := fun x y => cmodwB (x - y); TBOpInj := sub_spec |}%Z.
Add Zify BinOp Op_sub.
#[global]
Instance Op_opp : UnOp Uint63.opp :=
{| TUOp := fun x => cmodwB (- x); TUOpInj := (sub_spec 0) |}%Z.
Add Zify UnOp Op_opp.
#[global]
Instance Op_succ : UnOp succ :=
{| TUOp := fun x => cmodwB (x + 1); TUOpInj := succ_spec |}%Z.
Add Zify UnOp Op_succ.
#[global]
Instance Op_pred : UnOp Uint63.pred :=
{| TUOp := fun x => cmodwB (x - 1); TUOpInj := pred_spec |}%Z.
Add Zify UnOp Op_pred.
#[global]
Instance Op_mul : BinOp mul :=
{| TBOp := fun x y => cmodwB (x * y); TBOpInj := mul_spec |}%Z.
Add Zify BinOp Op_mul.
#[global]
Instance Op_mod : BinOp PrimInt63.mods :=
{| TBOp := Z.rem ; TBOpInj := mod_spec |}.
Add Zify BinOp Op_mod.
#[global]
Instance Op_asr : BinOp asr :=
{| TBOp := fun x y => x / 2^ y ; TBOpInj := asr_spec |}%Z.
Add Zify BinOp Op_asr.
Definition quots (x d : Z) : Z :=
if ((x =? -4611686018427387904)%Z && (d =? -1)%Z)%bool then
-4611686018427387904
else
Z.quot x d.

(* Specifications: *)
Lemma div_quots (x y : int) : to_Z (x / y) = quots (to_Z x) (to_Z y).
#[global]
Instance Op_div : BinOp div :=
{| TBOp := quots ; TBOpInj := div_quots |}.