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.

Theorem step_type_preservation:
forall S1 t S2, step ge S1 t S2 -> wt_state S1 -> wt_state S2.