Section ALLOC.
Variable m1: mem.
Variables lo hi: Z.
Variable m2: mem.
Variable b: Values.block.
Hypothesis ALLOC: Mem.alloc m1 lo hi = (m2, b).
Transparent Mem.alloc.
Opaque Mem.alloc.
End ALLOC.
Definition gvar_info_eq {V1 V2} (v1: option (globvar V1)) (v2: option (globvar V2)) :=
match v1, v2 with
None, None => True
| Some i1, Some i2 => gvar_init i1 = gvar_init i2 /\
gvar_readonly i1 = gvar_readonly i2 /\ gvar_volatile i1 = gvar_volatile i2
| _, _ => False
end.
Definition gvar_infos_eq {F1 V1 F2 V2}
(g1 : Genv.t F1 V1) (g2 : Genv.t F2 V2) :=
forall b, gvar_info_eq (Genv.find_var_info g1 b) (Genv.find_var_info g2 b).
destruct v; simpl; intuition. Qed.

Lemma gvar_infos_eqD2 {F1 V1 F2 V2} (ge1 : Genv.t F1 V1) (ge2 : Genv.t F2 V2)
(G: gvar_infos_eq ge1 ge2) b v2 (Hb: Genv.find_var_info ge2 b = Some v2):
exists v1, Genv.find_var_info ge1 b = Some v1 /\ gvar_init v1 = gvar_init v2 /\
gvar_readonly v1 = gvar_readonly v2 /\ gvar_volatile v1 = gvar_volatile v2.