(** In many cases, the context for [match_program_gen] is the source program or
  source compilation unit itself.  We provide a specialized definition for this case. *)

Definition match_program {F1 V1 F2 V2: Type} {LF: Linker F1} {LV: Linker V1}
                         (match_fundef: program F1 V1 -> F1 -> F2 -> Prop)
                         (match_varinfo: V1 -> V2 -> Prop)
                         (p1: program F1 V1) (p2: program F2 V2) : Prop :=
  match_program_gen match_fundef match_varinfo p1 p1 p2.

Lemma link_match_globdef: forall ctx1 ctx2 ctx g1 tg1 g2 tg2 g, linkorder ctx1 ctx -> linkorder ctx2 ctx -> link g1 g2 = Some g -> match_globdef match_fundef match_varinfo ctx1 g1 tg1 -> match_globdef match_fundef match_varinfo ctx2 g2 tg2 -> exists tg, link tg1 tg2 = Some tg /\ match_globdef match_fundef match_varinfo ctx g tg.