(** * 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_perm U c1 m1 c2 m2 (Step: effstep_plus U c1 m1 c2 m2):
forall b z, U b z = true -> Mem.perm m1 b z Cur Writable.