Require Export sha.pure_lemmas.
Require Export sha.general_lemmas.
Require Export sha.vst_lemmas.
Export ListNotations.
Local Open Scope logic.
Global Opaque K256.
Transparent peq.
Fixpoint loops (s: statement) : list statement :=
match s with
| Ssequence a b => loops a ++ loops b
| Sloop _ _ => [s]
| Sifthenelse _ a b => loops a ++ loops b
| _ => nil
end.
Fixpoint sequence (cs: list statement) s :=
match cs with
| nil => s
| c::cs' => Ssequence c (sequence cs' s)
end.
Fixpoint rsequence (cs: list statement) s :=
match cs with
| nil => s
| c::cs' => Ssequence (rsequence cs' s) c
end.
Fixpoint sequenceN (n: nat) (s: statement) : list statement :=
match n, s with
| S n', Ssequence a s' => a::sequenceN n' s'
| _, _ => nil
end.
Local Open Scope nat.
(*** Application of Omega stuff ***)
Global Opaque WORD.
Definition bitlength (hashed: list int) (data: list byte) : Z :=
((Zlength hashed * WORD + Zlength data) * 8)%Z.
Definition update_abs (incr: list byte) (a: list byte) (a': list byte) :=
a' = a ++ incr.

Lemma array_at_memory_block:
forall {cs: compspecs} sh t gfs lo hi v p n,
sizeof (nested_field_array_type t gfs lo hi) = n ->
lo <= hi ->
array_at sh t gfs lo hi v p |--
memory_block sh n (field_address0 t (ArraySubsc lo :: gfs) p).