Inductive wt_state: state -> Prop :=
| wt_regular_state: forall s f sp c rs m
(WTSTK: wt_callstack s )
(WTF: wt_function f = true)
(WTC: wt_code f c = true)
(WTRS: wt_locset rs),
wt_state (State s f sp c rs m)
| wt_call_state: forall s fd rs m
(WTSTK: wt_callstack s)
(WTFD: wt_fundef fd)
(WTRS: wt_locset rs)
(AGCS: agree_callee_save rs (parent_locset s))
(AGARGS: agree_outgoing_arguments (funsig fd) rs (parent_locset s)),
wt_state (Callstate s fd rs m)
| wt_return_state: forall s rs m
(WTSTK: wt_callstack s)
(WTRS: wt_locset rs)
(AGCS: agree_callee_save rs (parent_locset s))
(UOUT: outgoing_undef rs),
wt_state (Returnstate s rs m).
(** Preservation of state typing by transitions *)
Section SOUNDNESS.
Variable prog: program.
Let ge := Genv.globalenv prog.
Hypothesis wt_prog:
forall i fd, In (i, Gfun fd) prog.(prog_defs) -> wt_fundef fd.

Lemma wt_find_function:
forall ros rs f, find_function ge ros rs = Some f -> wt_fundef f.