(*
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'.
Proof. intros.
  inv INJ; try econstructor.
  rewrite (Hv b1) in H. inv H.
    rewrite Int.add_zero. constructor.
  rewrite getBlocks_char. exists ofs1; left. reflexivity.
Qed.
*)
(** 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', (*Lenb: these conditions are modified*) env_inject j e e' -> Mem.inject j m m' -> (*Lenb: these conditions are new here*) 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'.
Lemma sel_exprlist_inject: forall sp e m a v, Cminor.eval_exprlist ge sp e m a v -> forall j e' le m', (*Lenb: these conditions are modified*) env_inject j e e' -> Mem.inject j m m' -> (*Lenb: these conditions are new here*) 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'.