Definition Delta_types V G {C: compspecs} (tys : list type) : tycontext :=
  make_tycontext
    (params_of_types
       1 ((Tfunction (type_of_params (params_of_types 2 tys)) Tvoid cc_default) :: tys))
    nil nil Tvoid V G nil.

(* Specifications: *)
Lemma semax_prog_typecheck_aux_types: forall vs G {C: compspecs} (prog: program) b (typed_args : list (val * type)), list_norepet (prog_defs_names prog) -> match_globvars (prog_vars prog) vs = true -> match_fdecs (prog_funct prog) G -> Forall (fun x => tc_val (snd x) (fst x)) typed_args -> typecheck_environ (Delta_types vs G (map snd typed_args)) (construct_rho (filter_genv (globalenv prog)) empty_env (PTree.set 1 (Vptr b Ptrofs.zero) (temp_bindings 2 (map fst typed_args)))).
Lemma semax_prog_entry_point {CS: compspecs} V G prog b id_fun id_arg arg A (P Q: forall ts : list Type, (dependent_type_functor_rec ts (AssertTT A)) mpred) NEP NEQ h: @semax_prog CS prog V G -> Genv.find_symbol (globalenv prog) id_fun = Some b -> find_id id_fun G = Some (mk_funspec ((id_arg, Tpointer Tvoid noattr) :: nil, tptr Tvoid) cc_default A P Q NEP NEQ) -> is_pointer_or_null arg -> (* initial environment *) let rho0 : environ := construct_rho (filter_genv (globalenv prog)) empty_env (PTree.set 1 (Vptr b Ptrofs.zero) (PTree.set id_arg arg (PTree.empty val))) in (* initial environment without the function => to check jm |= P a *) let rho1 : environ := construct_rho (filter_genv (globalenv prog)) empty_env ((* PTree.set 1 (Vptr b Ptrofs.zero) *) (PTree.set id_arg arg (PTree.empty val))) in { q : corestate | (forall jm, Val.inject (Mem.flat_inj (nextblock (m_dry jm))) arg arg -> exists jm', semantics.initial_core (juicy_core_sem (cl_core_sem (globalenv prog))) h jm q jm' (Vptr b Ptrofs.zero) (arg :: nil)) /\ forall (jm : juicy_mem) ts a, app_pred (P ts a rho1) (m_phi jm) -> (* (forall rho, app_pred (! (Q ts a rho >=> !!False)) (m_phi jm)) ->*) app_pred (funassert (Delta_types V G (Tpointer Tvoid noattr::nil)) rho0) (m_phi jm) -> forall z, app_pred (ext_compat z) (m_phi jm) -> jsafeN (@OK_spec Espec) (globalenv prog) (level jm) z q jm }.