Section DECOMPOSITION.
Variable f: function.
Variable k: cont.
Variable e: env.
Variable m: mem.
Definition simple_side_effect (r: expr) : Prop :=
match r with
| Evalof l _ => simple l = true /\ type_is_volatile (typeof l) = true
| Eseqand r1 r2 _ => simple r1 = true
| Eseqor r1 r2 _ => simple r1 = true
| Econdition r1 r2 r3 _ => simple r1 = true
| Eassign l1 r2 _ => simple l1 = true /\ simple r2 = true
| Eassignop _ l1 r2 _ _ => simple l1 = true /\ simple r2 = true
| Epostincr _ l1 _ => simple l1 = true
| Ecomma r1 r2 _ => simple r1 = true
| Ecall r1 rl _ => simple r1 = true /\ simplelist rl = true
| Ebuiltin ef tyargs rl _ => simplelist rl = true
| Eparen r1 _ _ => simple r1 = true
| _ => False
end.
Scheme expr_ind2 := Induction for expr Sort Prop
with exprlist_ind2 := Induction for exprlist Sort Prop.
Combined Scheme expr_expr_list_ind from expr_ind2, exprlist_ind2.
Hint Constructors leftcontext leftcontextlist.
End DECOMPOSITION.
(** Simulation for expressions. *)
(** Simulation for all states *)
End STRATEGY.
(** The semantics that follows the strategy. *)
Definition entry_point : mem -> state -> val -> list val -> Prop.
Admitted.
Definition at_external : state ->
option (external_function * list val).
Admitted.
Definition after_external : option val ->
state -> mem -> option state.
Admitted.
Definition semantics (p: program) :=
let ge := globalenv p in
Semantics_gen get_mem set_mem (step ge)
entry_point at_external after_external
final_state ge.
(** This semantics is receptive to changes in events. *)
Remark deref_loc_trace:
forall ge ty m b ofs t v,
deref_loc ge ty m b ofs t v ->
match t with nil => True | ev :: nil => True | _ => False end.
Remark deref_loc_receptive:
forall ge ty m b ofs ev1 t1 v ev2,
deref_loc ge ty m b ofs (ev1 :: t1) v ->
match_traces ge (ev1 :: nil) (ev2 :: nil) ->
t1 = nil /\ exists v', deref_loc ge ty m b ofs (ev2 :: nil) v'.
Remark assign_loc_trace:
forall ge ty m b ofs t v m',
assign_loc ge ty m b ofs v t m' ->
match t with nil => True | ev :: nil => output_event ev | _ => False end.
Remark assign_loc_receptive:
forall ge ty m b ofs ev1 t1 v m' ev2,
assign_loc ge ty m b ofs v (ev1 :: t1) m' ->
match_traces ge (ev1 :: nil) (ev2 :: nil) ->
ev1 :: t1 = ev2 :: nil.
(* Lemma semantics_strongly_receptive: forall p, strongly_receptive (semantics p).  (** The main simulation result. *)

Theorem strategy_simulation:
forall p, backward_simulation (Csem.semantics p) (semantics p).