(* Lemma set_locals_lessdef: forall e1 e2, env_lessdef e1 e2 -> forall il, env_lessdef (set_locals il e1) (set_locals il e2). Lemma set_locals_inject: forall j e1 e2, env_inject j e1 e2 -> forall il, env_inject j (set_locals il e1) (set_locals il e2).  Lemma lessdef_inject: forall v j (Hv: forall b1, getBlocks (v::nil) b1 = true -> j b1 = Some(b1,0)) v' (LD: Val.lessdef v v'), val_inject j v v'. (* Lemma inject_lessdef: forall v j (Hv: forall b1, getBlocks (v::nil) b1 = true -> j b1 = Some(b1,0)) v' (INJ: val_inject j v v'), Val.lessdef v v'. *)
(** Semantic preservation for expressions. *)
(*NEW*)
Definition sp_preserved (j:meminj) (sp sp':val) :=
exists b i b', sp = Vptr b i /\ sp' = Vptr b' i /\
j b = Some(b',0).

(* Specifications: *)
Lemma sel_expr_inject:
forall sp e m a v,
Cminor.eval_expr ge sp e m a v ->
forall j e' le m',
env_inject j e e' -> Mem.inject j m m' ->
forall (PG: meminj_preserves_globals ge j)
(GD: genvs_domain_eq ge tge)
(NoRepet: list_norepet (map fst (prog_defs prog)))
sp' (SP: sp_preserved j sp sp'),
exists v', CminorSel.eval_expr tge sp' e' m' le (sel_expr hf a) v' /\
val_inject j v v'.
(*Lenb: these conditions are modified*)
(*Lenb: these conditions are new here*)
(* Lemma sel_expr_correct: forall sp e m a v, Cminor.eval_expr ge sp e m a v -> forall e' le m', env_lessdef e e' -> Mem.extends m m' -> exists v', eval_expr tge sp e' m' le (sel_expr hf a) v' /\ Val.lessdef v v'. *)
Lemma sel_exprlist_inject:
forall sp e m a v,
Cminor.eval_exprlist ge sp e m a v ->
forall j e' le m',
env_inject j e e' -> Mem.inject j m m' ->
forall (PG: meminj_preserves_globals ge j)
(GD: genvs_domain_eq ge tge)
(NoRepet: list_norepet (map fst (prog_defs prog)))
sp' (SP: sp_preserved j sp sp'),
exists v', CminorSel.eval_exprlist tge sp' e' m' le (sel_exprlist hf a) v' /\
val_list_inject j v v'.