(** Connections between [add] and bitwise logical operations. *)

(* Specifications: *)
Lemma Z_add_is_or:
forall i, 0 <= i ->
forall x y,
(forall j, 0 <= j <= i -> Z.testbit x j && Z.testbit y j = false) ->
Z.testbit (x + y) i = Z.testbit x i || Z.testbit y i.
Theorem add_is_or:
forall x y,
and x y = zero ->
add x y = or x y.
Theorem xor_is_or:
forall x y, and x y = zero -> xor x y = or x y.
Theorem add_is_xor:
forall x y,
and x y = zero ->
add x y = xor x y.
Theorem add_and:
forall x y z,
and y z = zero ->
add (and x y) (and x z) = and x (or y z).