Proof (same_bits_eqmod wordsize).
Remark two_power_nat_infinity:
forall x, 0 <= x -> exists n, x < two_power_nat n.

(* Specifications: *)
Lemma equal_same_bits:
forall x y,
(forall i, 0 <= i -> Z.testbit x i = Z.testbit y i) ->
x = y.
Lemma Z_one_complement:
forall i, 0 <= i ->
forall x, Z.testbit (-x-1) i = negb (Z.testbit x i).
Lemma Ztestbit_above:
forall n x i,
0 <= x < two_power_nat n ->
i >= Z.of_nat n ->
Z.testbit x i = false.
Lemma Ztestbit_above_neg:
forall n x i,
-two_power_nat n <= x < 0 ->
i >= Z.of_nat n ->
Z.testbit x i = true.
Lemma Zsign_bit:
forall n x,
0 <= x < two_power_nat (S n) ->
Z.testbit x (Z.of_nat n) = if zlt x (two_power_nat n) then false else true.
Lemma Zshiftin_ind:
forall (P: Z -> Prop),
P 0 ->
(forall b x, 0 <= x -> P x -> P (Zshiftin b x)) ->
forall x, 0 <= x -> P x.
Lemma Zshiftin_pos_ind:
forall (P: Z -> Prop),
P 1 ->
(forall b x, 0 < x -> P x -> P (Zshiftin b x)) ->
forall x, 0 < x -> P x.
Lemma Ztestbit_le:
forall x y,
0 <= y ->
(forall i, 0 <= i -> Z.testbit x i = true -> Z.testbit y i = true) ->
x <= y.
Lemma equal_same_bits:
forall x y,
(forall i, 0 <= i -> Z.testbit x i = Z.testbit y i) ->
x = y.
Lemma Z_one_complement:
forall i, 0 <= i ->
forall x, Z.testbit (-x-1) i = negb (Z.testbit x i).
Lemma Ztestbit_above:
forall n x i,
0 <= x < two_power_nat n ->
i >= Z.of_nat n ->
Z.testbit x i = false.
Lemma Ztestbit_above_neg:
forall n x i,
-two_power_nat n <= x < 0 ->
i >= Z.of_nat n ->
Z.testbit x i = true.
Lemma Zsign_bit:
forall n x,
0 <= x < two_power_nat (S n) ->
Z.testbit x (Z.of_nat n) = if zlt x (two_power_nat n) then false else true.
Lemma Zshiftin_ind:
forall (P: Z -> Prop),
P 0 ->
(forall b x, 0 <= x -> P x -> P (Zshiftin b x)) ->
forall x, 0 <= x -> P x.
Lemma Zshiftin_pos_ind:
forall (P: Z -> Prop),
P 1 ->
(forall b x, 0 < x -> P x -> P (Zshiftin b x)) ->
forall x, 0 < x -> P x.
Lemma Ztestbit_le:
forall x y,
0 <= y ->
(forall i, 0 <= i -> Z.testbit x i = true -> Z.testbit y i = true) ->
x <= y.