(** * 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_split: forall U c m c' m',
effstep_plus U c m c' m' ->
exists c'', exists m'', exists U1, exists U2,
effstep Sem U1 c m c'' m'' /\
effstep_star U2 c'' m'' c' m' /\
U = (fun b z => U1 b z || (U2 b z && valid_block_dec m b)).