Module SortBodyProof := Mergesort.Sort(BodyProofOrder).
Definition Gprog_of_proof (p: semax_body_proof) :=
match p with
| @mk_body _ G _ _ _ _ _ => G
| @mk_external _ _ _ _ _ _ _ _ _ _ => nil
end.
Fixpoint delete_dups' id f (al: funspecs) : funspecs :=
match al with
| (id',f')::al' => if ident_eq id id' then delete_dups' id f al'
else (id,f)::delete_dups' id' f' al'
| nil => (id,f)::nil
end.
Definition delete_dups (al: funspecs) : funspecs :=
match al with
| (id,f)::al' => delete_dups' id f al'
| nil => nil
end.
Definition merge_Gprogs_of (module: list semax_body_proof) :=
delete_dups
(SortFunspec.sort
(List.fold_right (fun m G => Gprog_of_proof m ++ G) (nil: funspecs) module)).

Lemma semax_body_cenv_sub {CS CS'} (CSUB: cspecs_sub CS CS') V G f spec
(COMPLETE : Forall (fun it : ident * type => complete_type (@cenv_cs CS) (snd it) = true) (fn_vars f)):
@semax_body V G CS f spec -> @semax_body V G CS' f spec.