(** * 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 effstep_plus_trans' : forall U U1 c1 c2 c3 U2 m1 m2 m3,
effstep_plus U1 c1 m1 c2 m2 -> effstep_plus U2 c2 m2 c3 m3 ->
U = (fun b z => U1 b z || (U2 b z && valid_block_dec m1 b)) ->
effstep_plus U c1 m1 c3 m3.