End Make.
(** * Specialization to integers of size 8, 32, and 64 bits *)
Module Wordsize_32.
Definition wordsize := 32%nat.
Remark wordsize_not_zero: wordsize <> 0%nat.
Module Wordsize_8.
Definition wordsize := 8%nat.
Remark wordsize_not_zero: wordsize <> 0%nat.

(* Specifications: *)
Lemma bits_shru':
forall x y i,
0 <= i < zwordsize ->
testbit (shru' x y) i =
if zlt (i + Int.unsigned y) zwordsize then testbit x (i + Int.unsigned y) else false.
Lemma bits_shr':
forall x y i,
0 <= i < zwordsize ->
testbit (shr' x y) i =
testbit x (if zlt (i + Int.unsigned y) zwordsize then i + Int.unsigned y else zwordsize - 1).
Lemma shl'_mul_two_p:
forall x y,
shl' x y = mul x (repr (two_p (Int.unsigned y))).
Lemma shl'_one_two_p:
forall y, shl' one y = repr (two_p (Int.unsigned y)).
Theorem shl'_mul:
forall x y,
shl' x y = mul x (shl' one y).
Theorem shl'_zero:
forall x, shl' x Int.zero = x.
Theorem shru'_zero :
forall x, shru' x Int.zero = x.
Theorem shr'_zero :
forall x, shr' x Int.zero = x.
Theorem shrx'_zero:
forall x, shrx' x Int.zero = x.
Theorem shrx'_carry:
forall x y,
Int.ltu y (Int.repr 63) = true ->
shrx' x y = add (shr' x y) (shr_carry' x y).
Theorem shrx'_shr_2:
forall x y,
Int.ltu y (Int.repr 63) = true ->
shrx' x y = shr' (add x (shru' (shr' x (Int.repr 63)) (Int.sub (Int.repr 64) y))) y.
Lemma bits_shru':
forall x y i,
0 <= i < zwordsize ->
testbit (shru' x y) i =
if zlt (i + Int.unsigned y) zwordsize then testbit x (i + Int.unsigned y) else false.
Lemma bits_shr':
forall x y i,
0 <= i < zwordsize ->
testbit (shr' x y) i =
testbit x (if zlt (i + Int.unsigned y) zwordsize then i + Int.unsigned y else zwordsize - 1).
Lemma shl'_mul_two_p:
forall x y,
shl' x y = mul x (repr (two_p (Int.unsigned y))).
Lemma shl'_one_two_p:
forall y, shl' one y = repr (two_p (Int.unsigned y)).
Theorem shl'_mul:
forall x y,
shl' x y = mul x (shl' one y).
Theorem shl'_zero:
forall x, shl' x Int.zero = x.
Theorem shru'_zero :
forall x, shru' x Int.zero = x.
Theorem shr'_zero :
forall x, shr' x Int.zero = x.
Theorem shrx'_zero:
forall x, shrx' x Int.zero = x.
Theorem shrx'_carry:
forall x y,
Int.ltu y (Int.repr 63) = true ->
shrx' x y = add (shr' x y) (shr_carry' x y).
Theorem shrx'_shr_2:
forall x y,
Int.ltu y (Int.repr 63) = true ->
shrx' x y = shr' (add x (shru' (shr' x (Int.repr 63)) (Int.sub (Int.repr 64) y))) y.