(** ** Relation between bitwise operations and multiplications / divisions by powers of 2 *)
(** Left shifts and multiplications by powers of 2. *)

(* Specifications: *)
Lemma Zshiftl_mul_two_p:
forall x n, 0 <= n -> Z.shiftl x n = x * two_p n.
Lemma shl_mul_two_p:
forall x y,
shl x y = mul x (repr (two_p (unsigned y))).
Theorem shl_mul:
forall x y,
shl x y = mul x (shl one y).
Theorem mul_pow2:
forall x n logn,
is_power2 n = Some logn ->
mul x n = shl x logn.
Theorem shifted_or_is_add:
forall x y n,
0 <= n < zwordsize ->
unsigned y < two_p n ->
or (shl x (repr n)) y = repr(unsigned x * two_p n + unsigned y).