Definition tcret_proof retsig (A: rmaps.TypeTree)
(Q: forall ts : list Type,
functors.MixVariantFunctor._functor
(rmaps.dependent_type_functor_rec ts (AssertTT A)) mpred)  :=
(forall gx ts x (ret : option val),
(Q ts x (make_ext_rval gx ret)
&& !!step_lemmas.has_opttyp ret (opttyp_of_type retsig)
|-- !!tc_option_val retsig ret)).
Inductive semax_body_proof :=
| mk_body: forall {Vprog: varspecs} {Gprog: funspecs} {cs: compspecs}
{f: function} {id: ident} {fspec: funspec},
@semax_body Vprog Gprog cs f (id,fspec) -> semax_body_proof
| mk_external: forall (id: ident) retsig {Espec: OracleKind} {ids: list ident} {ef: external_function}
{A} {P Q: forall ts : list Type,
functors.MixVariantFunctor._functor
(rmaps.dependent_type_functor_rec ts (AssertTT A)) mpred},
tcret_proof retsig A Q ->
@semax_external Espec ids ef A P Q -> semax_body_proof.

Lemma sub_option_get' {A: Type} (s t: PTree.t A) B (f:A -> option B):
Forall (fun x => PTree.get (fst x) t = Some (snd x)) (PTree.elements s) ->
forall i, sub_option (match PTree.get i s with Some x => f x | _ => None end)
(match PTree.get i t with Some x => f x | _ => None end).