(** ** Bit-level reasoning over type [int] *)

Definition testbit (x: int) (i: Z) : bool := Z.testbit (unsigned x) i.

(* Specifications: *)
Lemma testbit_repr: forall x i, 0 <= i < zwordsize -> testbit (repr x) i = Z.testbit x i.
Lemma same_bits_eq: forall x y, (forall i, 0 <= i < zwordsize -> testbit x i = testbit y i) -> x = y.
Lemma bits_above: forall x i, i >= zwordsize -> testbit x i = false.
Lemma bits_zero: forall i, testbit zero i = false.
Lemma testbit_repr: forall x i, 0 <= i < zwordsize -> testbit (repr x) i = Z.testbit x i.
Lemma same_bits_eq: forall x y, (forall i, 0 <= i < zwordsize -> testbit x i = testbit y i) -> x = y.
Lemma bits_above: forall x i, i >= zwordsize -> testbit x i = false.
Lemma bits_zero: forall i, testbit zero i = false.