Section effsemlemmas.
Context {C:Type} (Sem: @EffectSem C).
Fixpoint effstepN (n:nat) : (block -> Z -> bool) -> C -> mem -> C -> mem -> Prop :=
match n with
| O => fun U c m c' m' => (c,m) = (c',m') /\ U = (fun b z => false)
| S k => fun U c1 m1 c3 m3 => exists c2, exists m2, exists U1, exists U2,
effstep Sem U1 c1 m1 c2 m2 /\
effstepN k U2 c2 m2 c3 m3 /\
U = (fun b z => U1 b z || (U2 b z && valid_block_dec m1 b))
end.
End effsemlemmas.
Definition EmptyEffect: Values.block -> Z -> bool := fun b z => false.
Definition FreeEffect m lo hi (sp b:Values.block) (ofs:Z): bool :=
if valid_block_dec m b
then eq_block b sp && zle lo ofs && zlt ofs hi
else false.
Definition FreelistEffect
m (L: list (Values.block * Z * Z)) (b:Values.block) (ofs:Z): bool :=
List.fold_right (fun X E b z => match X with (bb,lo,hi) =>
E b z || FreeEffect m lo hi bb b z
end)
EmptyEffect L b ofs.
Definition StoreEffect (tv:val)(vl : list memval) (b:Values.block) (z:Z):bool :=
match tv with Vptr bb ofs => eq_block bb b &&
zle (Ptrofs.unsigned ofs) z && zlt z (Ptrofs.unsigned ofs + Z.of_nat (length vl))
| _ => false
end.

Lemma storev_curWR ch m vaddr v m' (ST:Mem.storev ch m vaddr v = Some m')
b z (EFF : StoreEffect vaddr (encode_val ch v) b z = true):
Mem.perm m b z Cur Writable.