(*From Cminorgenproof*)
Remark val_inject_function_pointer:
forall v fd j tv,
Genv.find_funct ge v = Some fd ->
globalfunction_ptr_inject j ->
val_inject j v tv ->
tv = v.
(** * Matching between environments *)
(** In this section, we define a matching relation between a Clight local environment and a Csharpminor local environment. *)
(*LENB: added parameter j - first, let's try an attempt where all offsets are 0*)
Record match_env (j:meminj) (e: Clight.env) (te: Csharpminor.env) : Prop :=
mk_match_env {
me_local:
forall id b ty,
e!id = Some (b, ty) -> exists b',
j b = Some(b',0) /\ te!id = Some(b', sizeof ty);
me_local_inv:
forall id b sz,
te!id = Some (b, sz) -> exists b' ty,
j b' = Some(b,0) /\e!id = Some(b', ty)
}.

(* Specifications: *)
Lemma match_env_inject_incr: forall j e te
(MENV : match_env j e te) j'
(INC: inject_incr j j'),
match_env j' e te.
Lemma match_env_restrictD: forall j X e te
(MENV : match_env (restrict j X) e te),
match_env j e te.
Lemma match_env_globals:
forall j e te id,
match_env j e te ->
e!id = None ->
te!id = None.