(** * Effect Semantics *)
(** Effect semantics augment memory semantics with effects, in the form of a set of locations [block -> Z -> bool] associated with each internal step of the semantics. *)
Record EffectSem {C} :=
{ (** [sem] is a memory semantics. *)
sem :> @MemSem C
(** The step relation of the new semantics. *)
; effstep: (block -> Z -> bool) -> C -> mem -> C -> mem -> Prop
(** The next three fields axiomatize [effstep] and its relation to the underlying step relation of [sem]. *)
; effax1: forall M c m c' m',
effstep M c m c' m' ->
corestep sem c m c' m'
/\ Mem.unchanged_on (fun b ofs => M b ofs = false) m m'
; effax2: forall c m c' m',
corestep sem c m c' m' ->
exists M, effstep M c m c' m'
; effstep_perm: forall M c m c' m',
effstep M c m c' m' ->
forall b z, M b z = true -> Mem.perm m b z Cur Writable
}.
(* Arguments EffectSem []. *)
(** * Lemmas and auxiliary definitions *)
Section effsemlemmas.
Context {C:Type} (Sem: @EffectSem C).

Lemma effstepN_trans: forall n1 n2 U1 st1 m1 st2 m2 U2 st3 m3,
effstepN n1 U1 st1 m1 st2 m2 ->
effstepN n2 U2 st2 m2 st3 m3 ->
effstepN (n1+n2)
(fun b z => U1 b z || (U2 b z && valid_block_dec m1 b)) st1 m1 st3 m3.