End SIMPLE_EVAL.
(** Decomposition *)
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.

(* Specifications: *)
Lemma decompose_expr:
(forall a from C,
context from RV C -> safe (ExprState f (C a) k e m) ->
simple a = true
\/ exists C', exists a', a = C' a' /\ simple_side_effect a' /\ leftcontext RV from C')
/\(forall rl C,
contextlist' C -> safe (ExprState f (C rl) k e m) ->
simplelist rl = true
\/ exists C', exists a', rl = C' a' /\ simple_side_effect a' /\ leftcontextlist RV C').
Lemma decompose_topexpr:
forall a,
safe (ExprState f a k e m) ->
simple a = true
\/ exists C, exists a', a = C a' /\ simple_side_effect a' /\ leftcontext RV RV C.