Module CSHL_Defs := DerivedDefs(CSHL_Def).
(***************** SEMAX_LEMMAS ****************)
(* THIS RULE FROM semax_switch *)

(* THESE RULES FROM semax_call *)
(* Parameter func_ptr : funspec -> val ->mpred. Axiom corable_func_ptr: forall f v, corable (func_ptr f v). Axiom func_ptr_isptr: forall spec f, func_ptr spec f |-- !! isptr f.  Axiom approx_func_ptr: forall (A: Type) fsig0 cc (P Q: A -> environ -> mpred) (v: val) (n: nat), compcert_rmaps.RML.R.approx n (func_ptr (NDmk_funspec fsig0 cc A P Q) v) = compcert_rmaps.RML.R.approx n (func_ptr (NDmk_funspec fsig0 cc A (fun a rho => compcert_rmaps.RML.R.approx n (P a rho)) (fun a rho => compcert_rmaps.RML.R.approx n (Q a rho))) v).  Axiom func_ptr_def : func_ptr = fun f v => EX b : block, !!(v = Vptr b Ptrofs.zero) && seplog.func_at f (b, 0).*)(* Axiom semax_call : forall {CS: compspecs} {Espec: OracleKind}, forall Delta A P Q NEP NEQ ts x (F: environ -> mpred) ret argsig retsig cc a bl, Cop.classify_fun (typeof a) = Cop.fun_case_f (type_of_params argsig) retsig cc -> (retsig = Tvoid -> ret = None) -> tc_fn_return Delta ret retsig -> @semax CS Espec Delta ((|>((tc_expr Delta a) && (tc_exprlist Delta (snd (split argsig)) bl)))  && (`(func_ptr (mk_funspec  (argsig,retsig) cc A P Q NEP NEQ)) (eval_expr a) && |>(F * `(P ts x: environ -> mpred) (make_args' (argsig,retsig) (eval_exprlist (snd (split argsig)) bl))))) (Scall ret a bl) (normal_ret_assert (EX old:val, substopt ret (`old) F * maybe_retval (Q ts x) retsig ret)).*)
Axiom semax_call :
forall {CS: compspecs} {Espec: OracleKind},
forall Delta A P Q NEP NEQ ts x (F: environ -> mpred) ret argsig retsig cc a bl,
Cop.classify_fun (typeof a) =
Cop.fun_case_f (type_of_params argsig) retsig cc ->
(retsig = Tvoid -> ret = None) ->
tc_fn_return Delta ret retsig ->
@semax CS Espec Delta
((((tc_expr Delta a) && (tc_exprlist Delta (snd (split argsig)) bl)))  &&
(`(func_ptr (mk_funspec  (argsig,retsig) cc A P Q NEP NEQ)) (eval_expr a) &&
|>(F * `(P ts x: environ -> mpred) (make_args' (argsig,retsig) (eval_exprlist (snd (split argsig)) bl)))))
(Scall ret a bl)
(normal_ret_assert
(EX old:val, substopt ret (`old) F * maybe_retval (Q ts x) retsig ret)).