Remark two_p_range:
  forall n,
  0 <= n < zwordsize ->
  0 <= two_p n <= max_unsigned.Remark Z_one_bits_zero:
  forall n i, Z_one_bits n 0 i = nil.Remark Z_one_bits_two_p:
  forall n x i,
  0 <= x < Z.of_nat n ->
  Z_one_bits n (two_p x) i = (i + x) :: nil.

(* Specifications: *)
Lemma is_power2_two_p: forall n, 0 <= n < zwordsize -> is_power2 (repr (two_p n)) = Some (repr n).
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).
Lemma Zshiftr_div_two_p: forall x n, 0 <= n -> Z.shiftr x n = x / two_p n.
Lemma shru_div_two_p: forall x y, shru x y = repr (unsigned x / two_p (unsigned y)).
Theorem divu_pow2: forall x n logn, is_power2 n = Some logn -> divu x n = shru x logn.
Lemma shr_div_two_p: forall x y, shr x y = repr (signed x / two_p (unsigned y)).
Theorem divs_pow2: forall x n logn, is_power2 n = Some logn -> divs x n = shrx x logn.
Lemma Ztestbit_mod_two_p: forall n x i, 0 <= n -> 0 <= i -> Z.testbit (x mod (two_p n)) i = if zlt i n then Z.testbit x i else false.
Lemma is_power2_two_p: forall n, 0 <= n < zwordsize -> is_power2 (repr (two_p n)) = Some (repr n).
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).
Lemma Zshiftr_div_two_p: forall x n, 0 <= n -> Z.shiftr x n = x / two_p n.
Lemma shru_div_two_p: forall x y, shru x y = repr (unsigned x / two_p (unsigned y)).
Theorem divu_pow2: forall x n logn, is_power2 n = Some logn -> divu x n = shru x logn.
Lemma shr_div_two_p: forall x y, shr x y = repr (signed x / two_p (unsigned y)).
Theorem divs_pow2: forall x n logn, is_power2 n = Some logn -> divs x n = shrx x logn.
Lemma Ztestbit_mod_two_p: forall n x i, 0 <= n -> 0 <= i -> Z.testbit (x mod (two_p n)) i = if zlt i n then Z.testbit x i else false.