Definition call_setup2
(cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(bl: list expr) (vl : list val)
(Qactuals : PTree.t _)
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qpre_temp : PTree.t _) GV':=
call_setup1 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals /\
Pre nil witness = PROPx Ppre (LOCALx Qpre (SEPx Rpre)) /\
local2ptree Qpre = (Qpre_temp, PTree.empty _, nil, GV') /\
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R))
|-- !! Forall (check_one_temp_spec Qactuals) (PTree.elements Qpre_temp) /\
check_gvars_spec GV GV' /\
fold_right_sepcon R |-- fold_right_sepcon Rpre * fold_right_sepcon Frame.

(* Specifications: *)
Lemma call_setup2_i:
forall  (cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(bl: list expr) (vl : list val)
(Qactuals : PTree.t _)
(SETUP1: call_setup1 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals)
(witness': functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qpre_temp : PTree.t _) GV',
Pre nil witness' = PROPx Ppre (LOCALx Qpre (SEPx Rpre)) ->
local2ptree Qpre = (Qpre_temp, PTree.empty _, nil, GV') ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R))
|-- !! Forall (check_one_temp_spec Qactuals) (PTree.elements Qpre_temp) ->
check_gvars_spec GV GV' ->
fold_right_sepcon R |-- fold_right_sepcon Rpre * fold_right_sepcon Frame ->
call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals
witness' Frame Ppre Qpre Rpre Qpre_temp GV'.
Lemma actual_value_not_Vundef:
forall (cs: compspecs) (Qtemp: PTree.t val) (Qvar: PTree.t (type * val))
Delta P Q R tl bl vl GV
(PTREE : local2ptree Q = (Qtemp, Qvar, nil, GV))
(TC : ENTAIL Delta, PROPx P (LOCALx Q (SEPx R))
|-- tc_exprlist Delta tl bl)
(MSUBST : force_list (map (msubst_eval_expr Delta Qtemp Qvar GV)
(explicit_cast_exprlist tl bl)) = Some vl),
local (tc_environ Delta) && |> PROPx P (LOCALx Q (SEPx R)) = local (tc_environ Delta) && |> (PROPx P (LOCALx Q (SEPx R)) && !! Forall (fun v : val => v <> Vundef) vl).
Lemma in_gvars_sub:
forall rho G G', Forall (fun x : globals => In x G) G' ->
fold_right `(and) `(True) (map locald_denote (map gvars G)) rho ->
fold_right `(and) `(True) (map locald_denote (map gvars G')) rho.
Lemma semax_call_aux55:
forall (cs: compspecs) (Qtemp: PTree.t val) (Qvar: PTree.t (type * val)) GV (a: expr)
Delta P Q R fs argsig retty (*cc*)
(A : rmaps.TypeTree)
(Pre
Post : forall ts : list Type,
functors.MixVariantFunctor._functor
(rmaps.dependent_type_functor_rec
ts (AssertTT A)) mpred) (* NEPre NEPost *)
witness Frame bl Ppre Qpre Rpre Qactuals Qpre_temp GV' vl
(PTREE : local2ptree Q = (Qtemp, Qvar, nil, GV))
(TC0 : ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |-- tc_expr Delta a)
(TC1 : ENTAIL Delta, PROPx P (LOCALx Q (SEPx R))
|-- tc_exprlist Delta (argtypes argsig) bl)
(MSUBST : force_list (map (msubst_eval_expr Delta Qtemp Qvar GV)
(explicit_cast_exprlist (argtypes argsig) bl)) = Some vl)
(PTREE'' : pTree_from_elements (combine (var_names argsig) vl) = Qactuals)
(PRE1 : Pre nil witness = PROPx Ppre (LOCALx Qpre (SEPx Rpre)))
(PTREE' : local2ptree Qpre = (Qpre_temp, PTree.empty _, nil, GV'))
(CHECKTEMP : Forall (check_one_temp_spec Qactuals) (PTree.elements Qpre_temp))
(CHECKG: check_gvars_spec GV GV')
(FRAME : fold_right_sepcon R
|-- fold_right_sepcon Rpre * fold_right_sepcon Frame)
(PPRE : fold_right_and True Ppre)
(LEN : length (argtypes argsig) = length bl),
ENTAIL Delta,
(EX v : val,
lift0 (func_ptr fs (* (mk_funspec (argsig, retty) cc A Pre Post NEPre NEPost) *) v) &&
local (` (eq v) (eval_expr a))) && |>PROPx P (LOCALx Q (SEPx R))
|-- |> (tc_expr Delta a && tc_exprlist Delta (argtypes argsig) bl) &&
(|> @liftx (Tarrow environ (LiftEnviron mpred)) (Pre nil witness)
(make_args' (argsig, retty) (eval_exprlist (argtypes argsig) bl)) *
` (func_ptr' fs (* (mk_funspec (argsig, retty) cc A Pre Post NEPre NEPost) *) )
(eval_expr a) * |>PROPx P (LOCALx Q (SEPx Frame))).
Lemma tc_exprlist_len : forall {cs : compspecs} Delta argsig bl,
tc_exprlist Delta (argtypes argsig) bl |-- !!(length (argtypes argsig) = length bl).
Lemma semax_call_id00_wow:
forall
(cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(bl: list expr)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qactuals Qpre_temp : PTree.t _) GV'
(vl : list val)
(SETUP: call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals
witness Frame Ppre Qpre Rpre Qpre_temp GV')
Espec
(Post2: environ -> mpred)
(B: Type)
(Ppost: B -> list Prop)
(Rpost: B -> list mpred)
(RETTY: retty = Tvoid)
(POST1: Post nil witness = (EX vret:B, PROPx (Ppost vret) (LOCALx nil (SEPx (Rpost vret)))))
(POST2: Post2 = EX vret:B, PROPx (P++ Ppost vret ) (LOCALx Q
(SEPx (Rpost vret ++ Frame))))
(PPRE: fold_right_and True Ppre),
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R')))
(Scall None a bl)
(normal_ret_assert Post2).
Lemma semax_call_id1_wow:
forall
(cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(bl: list expr)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qactuals Qpre_temp : PTree.t _) GV'
(vl : list val)
(SETUP: call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals
witness Frame Ppre Qpre Rpre Qpre_temp GV')
ret (Post2: environ -> mpred)  (Qnew: list localdef)
(B: Type) (Ppost: B -> list Prop) (F: B -> val) (Rpost: B -> list mpred) Espec
(TYret: typeof_temp Delta ret = Some retty)
(OKretty: check_retty retty)
(POST1: Post nil witness = EX vret:B, PROPx (Ppost vret)
(LOCALx (temp ret_temp (F vret) :: nil)
(SEPx (Rpost vret))))
(DELETE: remove_localdef_temp ret Q = Qnew)
(H0: Post2 = EX vret:B, PROPx (P++ Ppost vret) (LOCALx (temp ret (F vret) :: Qnew)
(SEPx (Rpost vret ++ Frame))))
(PPRE: fold_right_and True Ppre),
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R')))
(Scall (Some ret) a bl)
(normal_ret_assert Post2).
Lemma semax_call_id1_x_wow:
forall  (cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty' cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(bl: list expr)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qactuals Qpre_temp : PTree.t _) GV'
(vl : list val)
(SETUP: call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty' cc A Pre Post NEPre NEPost bl vl Qactuals
witness Frame Ppre Qpre Rpre Qpre_temp GV')
retty  Espec ret ret'
(Post2: environ -> mpred)
(Qnew: list localdef)
(B: Type)
(Ppost: B -> list Prop)
(F: B -> val)
(Rpost: B -> list mpred)
(TYret: typeof_temp Delta ret = Some retty)
(RETinit: (temp_types Delta) ! ret' = Some retty')
(OKretty: check_retty retty)
(OKretty': check_retty retty')
(NEUTRAL: is_neutral_cast retty' retty = true)
(NEret: ret <> ret')
(POST1: Post nil witness = EX vret:B, PROPx (Ppost vret)
(LOCALx (temp ret_temp (F vret) :: nil)
(SEPx (Rpost vret))))
(DELETE: remove_localdef_temp ret Q = Qnew)
(DELETE' : remove_localdef_temp ret' Q = Q)
(H0: Post2 = EX vret:B, PROPx (P++ Ppost vret)
(LOCALx (temp ret (F vret) :: Qnew)
(SEPx (Rpost vret ++ Frame))))
(PPRE: fold_right_and True Ppre),
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R')))
(Ssequence (Scall (Some ret') a bl)
(Sset ret (Ecast (Etempvar ret' retty') retty)))
(normal_ret_assert Post2).
Lemma semax_call_id1_y_wow:
forall  (cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty' cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(bl: list expr)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qactuals Qpre_temp : PTree.t _) GV'
(vl : list val)
(SETUP: call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty' cc A Pre Post NEPre NEPost bl vl Qactuals
witness Frame Ppre Qpre Rpre Qpre_temp GV')
Espec ret ret' (retty: type)
(Post2: environ -> mpred)
(Qnew: list localdef)
(B: Type)
(Ppost: B -> list Prop)
(F: B -> val)
(Rpost: B -> list mpred)
(TYret: typeof_temp Delta ret = Some retty)
(RETinit: (temp_types Delta) ! ret' = Some retty')
(OKretty: check_retty retty)
(OKretty': check_retty retty')
(NEUTRAL: is_neutral_cast retty' retty = true)
(NEret: ret <> ret')
(POST1: Post nil witness = EX vret:B, PROPx (Ppost vret)
(LOCALx (temp ret_temp (F vret) :: nil)
(SEPx (Rpost vret))))
(DELETE: remove_localdef_temp ret Q = Qnew)
(DELETE' : remove_localdef_temp ret' Q = Q)
(H0: Post2 = EX vret:B, PROPx (P++ Ppost vret)
(LOCALx (temp ret (F vret) :: Qnew)
(SEPx (Rpost vret ++ Frame))))
(PPRE: fold_right_and True Ppre),
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R')))
(Ssequence (Scall (Some ret') a bl)
(Sset ret (Etempvar ret' retty')))
(normal_ret_assert Post2).
Lemma semax_call_id01_wow:
forall
(cs: compspecs) Qtemp Qvar GV a Delta P Q R R'
fs argsig retty cc (A: rmaps.TypeTree)  Pre Post NEPre NEPost
(witness: functors.MixVariantFunctor._functor (rmaps.dependent_type_functor_rec nil A) mpred)
(Frame: list mpred)
(bl: list expr)
(Ppre: list Prop) (Qpre : list localdef) (Rpre: list mpred)
(Qactuals Qpre_temp : PTree.t _) GV'
(vl : list val)
(SETUP: call_setup2 cs Qtemp Qvar GV a Delta P Q R R' fs argsig retty cc A Pre Post NEPre NEPost bl vl Qactuals
witness Frame Ppre Qpre Rpre Qpre_temp GV')
Espec
(Post2: environ -> mpred)
(B: Type)
(Ppost: B -> list Prop)
(F: B -> val)
(Rpost: B -> list mpred)
(_: check_retty retty)
(POST1: Post nil witness = EX vret:B, PROPx (Ppost vret)
(LOCALx (temp ret_temp (F vret) :: nil)
(SEPx (Rpost vret))))
(POST2: Post2 = EX vret:B, PROPx (P++ Ppost vret) (LOCALx Q
(SEPx (Rpost vret ++ Frame))))
(PPRE: fold_right_and True Ppre),
@semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R')))
(Scall None a bl)
(normal_ret_assert Post2).