End safety_preservation_lemmas.
(** ** Termination preservation *)
Section termination_preservation.
Context  {F V TF TV C D Z data : Type}
{source : CoreSemantics (Genv.t F V) C mem}
{target : CoreSemantics (Genv.t TF TV) D mem}
{match_state : data -> meminj -> C -> mem -> D -> mem -> Prop}
{ord : data -> data -> Prop}
{geS : Genv.t F V}
{geT : (Genv.t TF TV)}
{entry_points : list (val*val*signature)}
(sim : Forward_simulation_inject source target geS geT entry_points data match_state ord)
(c : C)
(d : D)
(m : mem)
(tm: mem)
(P : val -> mem -> Prop)
(P_good : forall j v tv m tm, val_inject j v tv -> Mem.inject j m tm -> P v m -> P tv tm)
(SRC_DET : corestep_fun source)
(TGT_DET : corestep_fun target)
(source_safe : forall n, safeN source geS P n c m)
.

Lemma termination_preservation:
forall cd j c' m' rv1,
match_state cd j c m d tm ->
corestep_star source geS c m c' m' ->
halted source c' = Some rv1 ->
exists d' tm' rv2,
corestep_star target geT d tm d' tm'
/\ halted target d' = Some rv2.