(* ----------------------------- *)
(* Relating bits to bytes *)

(* Specifications: *)
Lemma bitsToBytes_app : forall (l m : Blist),
InBlocks 8 l ->
bitsToBytes (l ++ m) = bitsToBytes l ++ bitsToBytes m.
Lemma bitsToBytes_len_gen : forall (l : Blist) (n : nat),
length l = (n * 8)%nat ->
length (bitsToBytes l) = n.
Lemma bitsToBytes_len : forall (l : Blist),
length l = 512%nat ->
Zlength (bitsToBytes l) = 64%Z.
Lemma bits_bytes_bits_id : forall (l : Blist),
InBlocks 8 l ->
bytesToBits (bitsToBytes l) = l.
Lemma bytes_bits_lists_append:
forall (l1 : Blist) (l2 : list byte) (m1 : Blist) (m2 : list byte),
bytes_bits_lists l1 l2
-> bytes_bits_lists m1 m2
-> bytes_bits_lists (l1 ++ m1) (l2 ++ m2).
Lemma bytesToBits_nil_inv l: nil = bytesToBits l -> l = nil.
Lemma bytesToBits_injective: forall b1 b2, bytesToBits b1 = bytesToBits b2 ->
b1=b2.
Lemma bitsToBytes_injective8 b1 b2 (B: bitsToBytes b1 = bitsToBytes b2)
(L1: PeanoNat.Nat.divide 8 (length b1))
(L2: PeanoNat.Nat.divide 8 (length b2)): b1 = b2.
Lemma bitsToByte_cons: forall bits h t, (h::t) = bitsToBytes bits ->
exists b0, exists b1, exists b2, exists b3,
exists b4, exists b5, exists b6, exists b7, exists xs,
bits = b0 :: b1 :: b2 :: b3 :: b4 :: b5 :: b6 :: b7 :: xs /\
h = bitsToByte [b0; b1; b2; b3; b4; b5; b6; b7] /\
t = bitsToBytes xs.