Definition asZ (x : bool) : Z := if x then 1 else 0.
Definition convertByteBits bits (b : byte) : Prop :=
exists (b0 b1 b2 b3 b4 b5 b6 b7 : bool),
bits = [b0; b1; b2; b3; b4; b5; b6; b7] /\
Byte.unsigned b =  (1 * (asZ b0) + 2 * (asZ b1) + 4 * (asZ b2) + 8 * (asZ b3)
+ 16 * (asZ b4) + 32 * (asZ b5) + 64 * (asZ b6) + 128 * (asZ b7)).

Lemma testbit_b2z_nonzero:
forall i, i<>0 -> forall b, Z.testbit (Z.b2z b) i = false.