End Extensions.
(** *Injection Phases*)
Section Injection.
Record fsim_properties_inj: Type :=
{  Injindex: Type;
Injorder: Injindex -> Injindex -> Prop;
Injmatch_states: Injindex -> meminj -> state L1 -> state L2 -> Prop;
Injfsim_order_wf: well_founded Injorder;
Injfsim_match_meminj: forall i f s1 s2, Injmatch_states i f s1 s2 ->  Mem.inject f (get_mem1 s1) (get_mem2 s2);
Injfsim_match_full: forall i f s1 s2, Injmatch_states i f s1 s2 ->  injection_full f (get_mem1 s1);
(*    fsim_match_initial_states: forall s1 m1 f m2, initial_state L1 (s1,m1) -> Mem.inject f m1 m2 -> exists i, exists s2, initial_state L2 (s2,m2) /\ match_states i f (s1,m1) (s2,m2);*)
Injfsim_match_initial_states:
forall s1, initial_state L1 s1 ->
exists i f s2, initial_state L2 s2 /\ Injmatch_states i f s1 s2;
Injfsim_match_final_states:
forall i s1 s2 r f,
Injmatch_states i f s1 s2 -> final_state L1 s1 r -> (final_state L2 s2 r);
Injfsim_simulation:
forall s1 t s1' f, Step L1 s1 t s1' ->
forall i s2, Injmatch_states i f s1 s2 ->
exists i', exists s2' f' t',
(Plus L2 s2 t' s2' \/ (Star L2 s2 t' s2' /\ Injorder i' i))
/\ Injmatch_states i' f' s1' s2' /\
Values.inject_incr f f' /\
inject_trace f' t t';
Injfsim_public_preserved:
forall id, Senv.public_symbol (symbolenv L2) id = Senv.public_symbol (symbolenv L1) id
}.
(** An alternate form of the simulation diagram *)

Lemma Injfsim_simulation':
forall (SIM:fsim_properties_inj),
forall i s1 t s1' f,
Step L1 s1 t s1' ->
forall s2, Injmatch_states SIM i f s1 s2 ->
(exists i', exists s2' f' t',
Plus L2 s2 t' s2' /\
Injmatch_states SIM i' f' s1' s2'
/\ inject_incr f f' /\ inject_trace f' t t')
\/ (exists i' f', Injorder SIM i' i /\ t = E0 /\ Injmatch_states SIM i' f' s1' s2
/\ inject_incr f f').