Definition eqm := eqmod modulus.

(* Specifications: *)
Lemma eqm_refl: forall x, eqm x x.
Lemma eqm_refl2: forall x y, x = y -> eqm x y.
Lemma eqm_sym: forall x y, eqm x y -> eqm y x.
Lemma eqm_trans: forall x y z, eqm x y -> eqm y z -> eqm x z.
Lemma eqm_small_eq: forall x y, eqm x y -> 0 <= x < modulus -> 0 <= y < modulus -> x = y.
Lemma eqm_add: forall a b c d, eqm a b -> eqm c d -> eqm (a + c) (b + d).
Lemma eqm_neg: forall x y, eqm x y -> eqm (-x) (-y).
Lemma eqm_sub: forall a b c d, eqm a b -> eqm c d -> eqm (a - c) (b - d).
Lemma eqm_mult: forall a b c d, eqm a c -> eqm b d -> eqm (a * b) (c * d).
Lemma eqm_samerepr: forall x y, eqm x y -> repr x = repr y.
Lemma eqm_unsigned_repr: forall z, eqm z (unsigned (repr z)).
Lemma eqm_unsigned_repr_l: forall a b, eqm a b -> eqm (unsigned (repr a)) b.
Lemma eqm_unsigned_repr_r: forall a b, eqm a b -> eqm a (unsigned (repr b)).
Lemma eqm_signed_unsigned: forall x, eqm (signed x) (unsigned x).
Theorem unsigned_range: forall i, 0 <= unsigned i < modulus.
Theorem unsigned_range_2: forall i, 0 <= unsigned i <= max_unsigned.
Theorem signed_range: forall i, min_signed <= signed i <= max_signed.
Theorem repr_unsigned: forall i, repr (unsigned i) = i.
Lemma repr_signed: forall i, repr (signed i) = i.
Lemma eqm_repr_eq: forall x y, eqm x (unsigned y) -> repr x = y.
Theorem unsigned_repr: forall z, 0 <= z <= max_unsigned -> unsigned (repr z) = z.
Theorem signed_repr: forall z, min_signed <= z <= max_signed -> signed (repr z) = z.
Theorem signed_eq_unsigned: forall x, unsigned x <= max_signed -> signed x = unsigned x.
Theorem signed_positive: forall x, signed x >= 0 <-> unsigned x <= max_signed.
Theorem unsigned_zero: unsigned zero = 0.
Theorem unsigned_one: unsigned one = 1.
Theorem unsigned_mone: unsigned mone = modulus - 1.
Theorem signed_zero: signed zero = 0.
Theorem signed_one: zwordsize > 1 -> signed one = 1.
Theorem signed_mone: signed mone = -1.
Theorem one_not_zero: one <> zero.
Theorem unsigned_repr_wordsize: unsigned iwordsize = zwordsize.
Theorem eq_sym: forall x y, eq x y = eq y x.
Theorem eq_spec: forall (x y: int), if eq x y then x = y else x <> y.
Theorem eq_true: forall x, eq x x = true.
Theorem eq_false: forall x y, x <> y -> eq x y = false.
Theorem eq_signed: forall x y, eq x y = if zeq (signed x) (signed y) then true else false.
Theorem add_unsigned: forall x y, add x y = repr (unsigned x + unsigned y).
Theorem add_signed: forall x y, add x y = repr (signed x + signed y).
Theorem add_commut: forall x y, add x y = add y x.
Theorem add_zero: forall x, add x zero = x.
Theorem add_zero_l: forall x, add zero x = x.
Theorem add_assoc: forall x y z, add (add x y) z = add x (add y z).
Theorem add_permut: forall x y z, add x (add y z) = add y (add x z).
Theorem add_neg_zero: forall x, add x (neg x) = zero.
Theorem unsigned_add_carry: forall x y, unsigned (add x y) = unsigned x + unsigned y - unsigned (add_carry x y zero) * modulus.