Section PRESERVATION.
Variable prog: Csyntax.program.
Variable tprog: Clight.program.
Hypothesis TRANSL: match_prog prog tprog.
Let ge := Csem.globalenv prog.
Let tge := Clight.globalenv tprog.
(** Invariance properties. *)
Proof (Genv.find_symbol_match (proj1 TRANSL)).
Proof (Genv.senv_match (proj1 TRANSL)).
(** Properties of smart constructors. *)
(** Translation of simple expressions. *)
Proof (proj1 tr_simple_nil).
Proof (proj2 tr_simple_nil).
(** Translation of [deref_loc] and [assign_loc] operations. *)
Remark deref_loc_translated:
forall ty m b ofs t v,
Csem.deref_loc ge ty m b ofs t v ->
match chunk_for_volatile_type ty with
| None => t = E0 /\ Clight.deref_loc ty m b ofs v
| Some chunk => volatile_load tge chunk m b ofs t v
end.
Remark assign_loc_translated:
forall ty m b ofs v t m',
Csem.assign_loc ge ty m b ofs v t m' ->
match chunk_for_volatile_type ty with
| None => t = E0 /\ Clight.assign_loc tge ty m b ofs v m'
| Some chunk => volatile_store tge chunk m b ofs v t m'
end.
(** Evaluation of simple expressions and of their translation *)
(** Commutation between the translation of expressions and left contexts. *)
Scheme leftcontext_ind2 := Minimality for leftcontext Sort Prop
with leftcontextlist_ind2 := Minimality for leftcontextlist Sort Prop.
Combined Scheme leftcontext_leftcontextlist_ind from leftcontext_ind2, leftcontextlist_ind2.
(** Semantics of smart constructors *)
Remark sem_cast_deterministic:
forall v ty ty' m1 v1 m2 v2,
sem_cast v ty ty' m1 = Some v1 ->
sem_cast v ty ty' m2 = Some v2 ->
v1 = v2.
Fixpoint Kseqlist (sl: list statement) (k: cont) :=
match sl with
| nil => k
| s :: l => Kseq s (Kseqlist l k)
end.
Remark Kseqlist_app:
forall sl1 sl2 k,
Kseqlist (sl1 ++ sl2) k = Kseqlist sl1 (Kseqlist sl2 k).

Lemma step_tr_rvalof:
forall ty m b ofs t v e le a sl a' tmp f k,
Csem.deref_loc ge ty m b ofs t v ->
eval_lvalue tge e le m a b ofs ->
tr_rvalof ty a sl a' tmp ->
typeof a = ty ->
exists le',
star step1 tge (State f Sskip (Kseqlist sl k) e le m)
t (State f Sskip k e le' m)
/\ eval_expr tge e le' m a' v
/\ typeof a' = typeof a
/\ forall x, ~In x tmp -> le'!x = le!x.