Local Open Scope logic.
Instance CompSpecs : compspecs.
Definition ThirtyTwoByte (q:SixteenByte * SixteenByte) (v:val) : mpred :=
match q with (q1, q2) =>
@data_at CompSpecs Tsh (Tarray tuchar 32 noattr) ((SixteenByte2ValList q1) ++ (SixteenByte2ValList q2)) v
end.
Definition QByte (q:QuadByte) (v:val) : mpred :=
data_at Tsh (Tarray tuchar 4 noattr) (QuadByte2ValList q) v.
Definition QuadChunks2ValList (l: list QuadByte) : list val :=
List.fold_right (fun q vals => QuadByte2ValList q ++ vals) nil l.
Definition flatten16 (B:SixteenByte) : list QuadByte :=
match B with (q0, q1, q2, q3) => [q0; q1; q2; q3] end.
destruct B as (((q0, q1), q2), q3). simpl.
rewrite SixteenByte2ValList_char, app_nil_r. trivial.
Qed.
destruct q as (((q0, q1), q2), q3). simpl. reflexivity. Qed.
destruct q as (((q0, q1), q2), q3). simpl. reflexivity. Qed.
destruct C as (((q0, q1), q2), q3). unfold SixteenByte2ValList.
repeat rewrite Zlength_map.  simpl.
repeat rewrite Zlength_app. repeat rewrite <- QuadByteByteList_ZLength.
reflexivity. Qed.
Definition SByte (q:SixteenByte) (v:val) : mpred :=
@data_at CompSpecs Tsh (Tarray tuchar 16 noattr) (SixteenByte2ValList q) v.

Lemma Select_SplitSelect16Q_Zlength Q i front back:
(front, back) = SplitSelect16Q Q i -> 0<= i < 4 ->
Zlength front = i /\ Zlength back = 3-i.