Section WF_STATES.
Variable rao: function -> code -> ptrofs -> Prop.
Variable ge: genv.
Inductive wf_frame: stackframe -> Prop :=
| wf_stackframe_intro: forall fb sp ra c f
(CODE: Genv.find_funct_ptr ge fb = Some (Internal f))
(LEAF: is_leaf_function f = false)
(TAIL: is_tail c f.(fn_code)),
wf_frame (Stackframe fb sp ra c).
Inductive wf_state: state -> Prop :=
| wf_normal_state: forall s fb sp c rs m f
(STACK: Forall wf_frame s)
(CODE: Genv.find_funct_ptr ge fb = Some (Internal f))
(TAIL: is_tail c f.(fn_code)),
wf_state (State s fb sp c rs m)
| wf_call_state: forall s fb rs m
(STACK: Forall wf_frame s),
wf_state (Callstate s fb rs m)
| wf_return_state: forall s rs m
(STACK: Forall wf_frame s),
wf_state (Returnstate s rs m).
End WF_STATES.

Lemma wf_initial:
forall p S, initial_state p S -> wf_state (Genv.globalenv p) S.