End SOUNDNESS.
(** Properties of well-typed states that are used in [Stackingproof]. *)

(* Specifications: *)
Lemma wt_state_getstack:
forall s f sp sl ofs ty rd c rs m,
wt_state (State s f sp (Lgetstack sl ofs ty rd :: c) rs m) ->
slot_valid f sl ofs ty = true.
Lemma wt_state_setstack:
forall s f sp sl ofs ty r c rs m,
wt_state (State s f sp (Lsetstack r sl ofs ty :: c) rs m) ->
slot_valid f sl ofs ty = true /\ slot_writable sl = true.
Lemma wt_state_tailcall:
forall s f sp sg ros c rs m,
wt_state (State s f sp (Ltailcall sg ros :: c) rs m) ->
size_arguments sg = 0.
Lemma wt_state_builtin:
forall s f sp ef args res c rs m,
wt_state (State s f sp (Lbuiltin ef args res :: c) rs m) ->
forallb (loc_valid f) (params_of_builtin_args args) = true.
Lemma wt_callstate_wt_regs:
forall s f rs m,
wt_state (Callstate s f rs m) ->
forall r, Val.has_type (rs (R r)) (mreg_type r).
Lemma wt_callstate_agree:
forall s f rs m,
wt_state (Callstate s f rs m) ->
agree_callee_save rs (parent_locset s) /\ agree_outgoing_arguments (funsig f) rs (parent_locset s).
Lemma wt_returnstate_agree:
forall s rs m,
wt_state (Returnstate s rs m) ->
agree_callee_save rs (parent_locset s) /\ outgoing_undef rs.