(** ** Properties of addition *)

(* Specifications: *)
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_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.
Corollary unsigned_add_either:
forall x y,
unsigned (add x y) = unsigned x + unsigned y
\/ unsigned (add x y) = unsigned x + unsigned y - modulus.
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_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.
Corollary unsigned_add_either:
forall x y,
unsigned (add x y) = unsigned x + unsigned y
\/ unsigned (add x y) = unsigned x + unsigned y - modulus.