Ltac bit_solve :=
  intros; apply same_bits_eq; intros; autorewrite with ints; auto with bool.

(* Specifications: *)
Lemma sign_bit_of_unsigned: forall x, testbit x (zwordsize - 1) = if zlt (unsigned x) half_modulus then false else true.
Lemma bits_signed: forall x i, 0 <= i -> Z.testbit (signed x) i = testbit x (if zlt i zwordsize then i else zwordsize - 1).
Lemma bits_le: forall x y, (forall i, 0 <= i < zwordsize -> testbit x i = true -> testbit y i = true) -> unsigned x <= unsigned y.
Lemma bits_and: forall x y i, 0 <= i < zwordsize -> testbit (and x y) i = testbit x i && testbit y i.
Lemma bits_or: forall x y i, 0 <= i < zwordsize -> testbit (or x y) i = testbit x i || testbit y i.
Lemma bits_xor: forall x y i, 0 <= i < zwordsize -> testbit (xor x y) i = xorb (testbit x i) (testbit y i).
Lemma bits_not: forall x i, 0 <= i < zwordsize -> testbit (not x) i = negb (testbit x i).
Theorem and_commut: forall x y, and x y = and y x.
Theorem and_assoc: forall x y z, and (and x y) z = and x (and y z).
Theorem and_zero: forall x, and x zero = zero.