(** ** Completeness proof *)

(* Specifications: *)
Lemma type_ros_complete:
forall te ros e,
S.satisf te e ->
match ros with inl r => te r = Tptr | inr s => True end ->
exists e', type_ros e ros = OK e' /\ S.satisf te e'.
Lemma check_successor_complete:
forall s, valid_successor f s -> check_successor s = OK tt.
Lemma type_expect_complete:
forall e ty, type_expect e ty ty = OK e.
Lemma type_builtin_arg_complete:
forall te a e,
S.satisf te e ->
exists e', type_builtin_arg e a (type_of_builtin_arg te a) = OK e' /\ S.satisf te e'.
Lemma type_builtin_args_complete:
forall te al e,
S.satisf te e ->
exists e', type_builtin_args e al (List.map (type_of_builtin_arg te) al) = OK e' /\ S.satisf te e'.
Lemma type_builtin_res_complete:
forall te a e,
S.satisf te e ->
exists e', type_builtin_res e a (type_of_builtin_res te a) = OK e' /\ S.satisf te e'.
Lemma type_instr_complete:
forall te e i,
S.satisf te e ->
wt_instr f te i ->
exists e', type_instr e i = OK e' /\ S.satisf te e'.
Lemma type_code_complete:
forall te e,
(forall pc instr, f.(fn_code)!pc = Some instr -> wt_instr f te instr) ->
S.satisf te e ->
exists e', type_code e = OK e' /\ S.satisf te e'.
Theorem type_function_complete:
forall te, wt_function f te -> exists te, type_function = OK te.