Local Open Scope logic.
Record module {reptype: Type} :=  {
mf_rep: reptype;
mf_Gimport: list (ident*funspec);
mf_Gexport :  list (reptype -> ident*funspec);
mf_Gintern :  list (reptype -> ident*funspec);
mf_G' :=  map (fun f => f mf_rep)
(mf_Gexport ++ mf_Gintern);
mf_G := mf_Gimport ++ mf_G';
mf_V : varspecs;
mf_funs: list (ident * fundef);
mf_funs_correct: forall (Espec: OracleKind),
semax_func mf_V mf_G mf_funs mf_G'
}.
Definition builtins:  list (ident * globdef fundef type) :=
((___builtin_fabs,
Gfun(External (EF_builtin ___builtin_fabs
(mksignature (AST.Tfloat :: nil) (Some AST.Tfloat)))
(Tcons tdouble Tnil) tdouble)) ::
(___builtin_memcpy_aligned,
Gfun(External (EF_builtin ___builtin_memcpy_aligned
(mksignature
(AST.Tint :: AST.Tint :: AST.Tint :: AST.Tint :: nil)
None))
(Tcons (tptr tvoid)
(Tcons (tptr tvoid) (Tcons tuint (Tcons tuint Tnil)))) tvoid)) ::
(___builtin_annot_intval,
Gfun(External (EF_builtin ___builtin_annot_intval
(mksignature (AST.Tint :: AST.Tint :: nil)
(Some AST.Tint)))
(Tcons (tptr tschar) (Tcons tint Tnil)) tint)) :: nil).
Definition Gbuiltins := do_builtins builtins.
Fixpoint varspecs_sub (al bl: varspecs) : bool :=
match al, bl with
| (a,v)::al', (b,w)::bl' =>
match Pos.compare a b
with Lt => false
| Eq => if eqb_type v w then varspecs_sub al' bl' else false
| Gt => varspecs_sub al' bl
end
| nil, _ => true
| _::_, _ => false
end.
Fixpoint funspecs_sub (al bl: funspecs) : Prop :=
match al, bl with
| (a,v)::al', (b,w)::bl' =>
match Pos.compare a b
with Lt => False
| Eq => v=w /\ funspecs_sub al' bl'
| Gt => funspecs_sub al' bl
end
| nil, _ => True
| _::_, _ => False
end.

Lemma semax_func_app:
forall V1 V2 V F1 F2 F G1 G2 G G1' G2' G' (Espec: OracleKind),
semax_func V1 G1 F1 G1' ->
semax_func V2 G2 F2 G2' ->
F = F1++F2 ->
G' = G1'++G2' ->
varspecs_sub V1 V = true ->
varspecs_sub V2 V = true ->
funspecs_sub G1 G ->
funspecs_sub G2 G ->
semax_func V G F G'.