Section SIMPLE_EVAL.
Variable f: function.
Variable k: cont.
Variable e: env.
Variable m: mem.
Fixpoint rval_list (vl: list val) (rl: exprlist) : exprlist :=
match vl, rl with
| v1 :: vl', Econs r1 rl' => Econs (Eval v1 (typeof r1)) (rval_list vl' rl')
| _, _ => Enil
end.
Inductive eval_simple_list': exprlist -> list val -> Prop :=
| esrl'_nil:
eval_simple_list' Enil nil
| esrl'_cons: forall r rl v vl,
eval_simple_rvalue e m r v ->
eval_simple_list' rl vl ->
eval_simple_list' (Econs r rl) (v :: vl).
Fixpoint exprlist_app (rl1 rl2: exprlist) : exprlist :=
match rl1 with
| Enil => rl2
| Econs r1 rl1' => Econs r1 (exprlist_app rl1' rl2)
end.
Inductive contextlist' : (exprlist -> expr) -> Prop :=
| contextlist'_call: forall r1 rl0 ty C,
context RV RV C ->
contextlist' (fun rl => C (Ecall r1 (exprlist_app rl0 rl) ty))
| contextlist'_builtin: forall ef tyargs rl0 ty C,
context RV RV C ->
contextlist' (fun rl => C (Ebuiltin ef tyargs (exprlist_app rl0 rl) ty)).
Hint Resolve contextlist'_head contextlist'_tail.

Lemma simple_list_can_eval:
forall rl C,
simplelist rl = true ->
contextlist' C ->
safe (ExprState f (C rl) k e m) ->
exists vl, eval_simple_list' rl vl.