(** * Correspondence between global environments *)
(** Global environments match if the memory injection [f] leaves unchanged the references to global symbols and functions. *)
Inductive match_globalenvs (f: meminj) (bound: block): Prop :=
| mk_match_globalenvs
(DOMAIN: forall b,
Plt b bound ->
((exists id, Genv.find_symbol ge id = Some b)
\/ (exists gv, Genv.find_var_info (Genv.globalenv prog) b = Some gv)
\/ (exists fptr, Genv.find_funct_ptr (Genv.globalenv prog) b = Some fptr)) ->
f b = Some(b, 0))
(IMAGE: forall b1 b2 delta gv,
Genv.find_var_info ge b2 = Some gv ->
f b1 = Some(b2, delta) -> Plt b2 bound -> b1 = b2)
(SYMBOLS: forall id b, Genv.find_symbol ge id = Some b -> Plt b bound)
(FUNCTIONS: forall b fd, Genv.find_funct_ptr ge b = Some fd -> Plt b bound)
(VARINFOS: forall b gv, Genv.find_var_info ge b = Some gv -> Plt b bound).

(* Specifications: *)
(*NOTE (GS): This lemma should be added to Globalenvs.v*)
Lemma find_var_info_inversion:
forall (prog: Csharpminor.program) b v,
Genv.find_var_info (Genv.globalenv prog) b = Some v ->
exists id, In (id, Gvar v) (prog_defs prog).