(** An RTL register environment matches a CminorSel local environment and let-environment if the value of every local or let-bound variable in the CminorSel environments is identical to the value of the corresponding pseudo-register in the RTL register environment. *)
Record match_env
(map: mapping) (e: env) (le: letenv) (rs: regset) : Prop :=
mk_match_env {
me_vars:
(forall id v,
e!id = Some v -> exists r, map.(map_vars)!id = Some r /\ Val.lessdef v rs#r);
me_letvars:
Val.lessdef_list le rs##(map.(map_letvars))
}.

Lemma match_env_find_letvar:
forall map e le rs idx v r,
match_env map e le rs ->
List.nth_error le idx = Some v ->
List.nth_error map.(map_letvars) idx = Some r ->
Val.lessdef v rs#r.