(** Centered modulo *)
Definition cmod (x d : Z) : Z :=
  (x + d / 2) mod d - (d / 2).

(* Specifications: *)
Lemma cmod_mod (x d : Z) : cmod (x mod d) d = cmod x d.
Lemma cmod_small (x d : Z) : - (d / 2) <= x < d / 2 -> cmod x d = x.
Lemma to_Z_cmodwB (x : int) : to_Z x = cmod (φ x%uint63) wB.
Lemma of_Z_spec (z : Z) : to_Z (of_Z z) = cmod z wB.
Lemma of_Z_cmod (z : Z) : of_Z (cmod z wB) = of_Z z.
Lemma is_int (z : Z) : to_Z min_int <= z <= to_Z max_int -> z = to_Z (of_Z z).
Lemma of_pos_spec (p : positive) : to_Z (of_pos p) = cmod (Zpos p) wB.
Lemma add_spec (x y : int) : to_Z (x + y)%sint63 = cmod (to_Z x + to_Z y) wB.
Lemma sub_spec (x y : int) : to_Z (x - y)%sint63 = cmod (to_Z x - to_Z y) wB.
Lemma mul_spec (x y : int) : to_Z (x * y)%sint63 = cmod (to_Z x * to_Z y) wB.
Lemma succ_spec (x : int) : to_Z (succ x)%sint63 = cmod (to_Z x + 1) wB.
Lemma pred_spec (x : int) : to_Z (pred x)%sint63 = cmod (to_Z x - 1) wB.
Lemma opp_spec (x : int) : to_Z (- x)%sint63 = cmod (- to_Z x) wB.
Lemma to_Z_add (x y : int) : to_Z min_int <= to_Z x + to_Z y <= to_Z max_int -> to_Z (x + y) = to_Z x + to_Z y.
Lemma to_Z_sub (x y : int) : to_Z min_int <= to_Z x - to_Z y <= to_Z max_int -> to_Z (x - y) = to_Z x - to_Z y.
Lemma to_Z_mul (x y : int) : to_Z min_int <= to_Z x * to_Z y <= to_Z max_int -> to_Z (x * y) = to_Z x * to_Z y.
Lemma to_Z_succ (x : int) : x <> max_int -> to_Z (succ x) = to_Z x + 1.
Lemma to_Z_pred (x : int) : x <> min_int -> to_Z (pred x) = to_Z x - 1.
Lemma to_Z_opp (x : int) : x <> min_int -> to_Z (- x) = - to_Z x.
Lemma add_of_Z (x y : int) : (x + y)%sint63 = of_Z (to_Z x + to_Z y).
Lemma sub_of_Z (x y : int) : (x - y)%sint63 = of_Z (to_Z x - to_Z y).
Lemma mul_of_Z (x y : int) : (x * y)%sint63 = of_Z (to_Z x * to_Z y).
Lemma succ_of_Z (x : int) : (succ x)%sint63 = of_Z (to_Z x + 1).
Lemma pred_of_Z (x : int) : (pred x)%sint63 = of_Z (to_Z x - 1).
Lemma opp_of_Z (x : int) : (- x)%sint63 = of_Z (- to_Z x).
Lemma eqbP x y : reflect (to_Z x = to_Z y) (x =? y)%sint63.
Lemma ltbP x y : reflect (to_Z x < to_Z y) (x <? y)%sint63.