Hint Rewrite bits_shl bits_shru bits_shr: ints.

(* Specifications: *)
Theorem shl_zero: forall x, shl x zero = x.
Lemma bitwise_binop_shl:
forall f f' x y n,
(forall x y i, 0 <= i < zwordsize -> testbit (f x y) i = f' (testbit x i) (testbit y i)) ->
f' false false = false ->
f (shl x n) (shl y n) = shl (f x y) n.
Theorem and_shl:
forall x y n,
and (shl x n) (shl y n) = shl (and x y) n.
Theorem or_shl:
forall x y n,
or (shl x n) (shl y n) = shl (or x y) n.
Theorem xor_shl:
forall x y n,
xor (shl x n) (shl y n) = shl (xor x y) n.
Lemma ltu_inv:
forall x y, ltu x y = true -> 0 <= unsigned x < unsigned y.
Lemma ltu_iwordsize_inv:
forall x, ltu x iwordsize = true -> 0 <= unsigned x < zwordsize.
Theorem shl_shl:
forall x y z,
ltu y iwordsize = true ->
ltu z iwordsize = true ->
ltu (add y z) iwordsize = true ->
shl (shl x y) z = shl x (add y z).
Theorem sub_ltu:
forall x y,
ltu x y = true ->
0 <= unsigned y - unsigned x <= unsigned y.
Theorem shru_zero: forall x, shru x zero = x.
Lemma bitwise_binop_shru:
forall f f' x y n,
(forall x y i, 0 <= i < zwordsize -> testbit (f x y) i = f' (testbit x i) (testbit y i)) ->
f' false false = false ->
f (shru x n) (shru y n) = shru (f x y) n.
Theorem and_shru:
forall x y n,
and (shru x n) (shru y n) = shru (and x y) n.
Theorem or_shru:
forall x y n,
or (shru x n) (shru y n) = shru (or x y) n.
Theorem xor_shru:
forall x y n,
xor (shru x n) (shru y n) = shru (xor x y) n.
Theorem shru_shru:
forall x y z,
ltu y iwordsize = true ->
ltu z iwordsize = true ->
ltu (add y z) iwordsize = true ->
shru (shru x y) z = shru x (add y z).
Theorem shr_zero: forall x, shr x zero = x.
Lemma bitwise_binop_shr:
forall f f' x y n,
(forall x y i, 0 <= i < zwordsize -> testbit (f x y) i = f' (testbit x i) (testbit y i)) ->
f (shr x n) (shr y n) = shr (f x y) n.
Theorem and_shr:
forall x y n,
and (shr x n) (shr y n) = shr (and x y) n.
Theorem or_shr:
forall x y n,
or (shr x n) (shr y n) = shr (or x y) n.
Theorem xor_shr:
forall x y n,
xor (shr x n) (shr y n) = shr (xor x y) n.
Theorem shr_shr:
forall x y z,
ltu y iwordsize = true ->
ltu z iwordsize = true ->
ltu (add y z) iwordsize = true ->
shr (shr x y) z = shr x (add y z).
Theorem and_shr_shru:
forall x y z,
and (shr x z) (shru y z) = shru (and x y) z.
Theorem shr_and_shru_and:
forall x y z,
shru (shl z y) y = z ->
and (shr x y) z = and (shru x y) z.
Theorem shru_lt_zero:
forall x,
shru x (repr (zwordsize - 1)) = if lt x zero then one else zero.
Theorem shr_lt_zero:
forall x,
shr x (repr (zwordsize - 1)) = if lt x zero then mone else zero.