Section INJINJ.

(* Specifications: *)
Lemma diagram_injinj: forall
(core_data12 : Type)
(match_core12 : core_data12 -> meminj -> C1 -> mem -> C2 -> mem -> Prop)
(core_ord12 : core_data12 -> core_data12 -> Prop)
(core_diagram12 : forall (st1 : C1) (m1 : mem) (st1' : C1) (m1' : mem),
corestep Sem1 g1 st1 m1 st1' m1' ->
forall (cd : core_data12) (st2 : C2) (j : meminj) (m2 : mem),
match_core12 cd j st1 m1 st2 m2 ->
exists st2' : C2,
exists m2' : mem,
exists cd' : core_data12,
exists j' : meminj,
inject_incr j j' /\
inject_separated j j' m1 m2 /\
match_core12 cd' j' st1' m1' st2' m2' /\
(corestep_plus Sem2 g2 st2 m2 st2' m2' \/
corestep_star Sem2 g2 st2 m2 st2' m2' /\ core_ord12 cd' cd))
(core_data23 : Type)
(match_core23 : core_data23 -> meminj -> C2 -> mem -> C3 -> mem -> Prop)
(core_ord23 : core_data23 -> core_data23 -> Prop)
(core_diagram23 : forall (st1 : C2) (m1 : mem) (st1' : C2) (m1' : mem),
corestep Sem2 g2 st1 m1 st1' m1' ->
forall (cd : core_data23) (st2 : C3)
(j : meminj) (m2 : mem),
match_core23 cd j st1 m1 st2 m2 ->
exists st2' : C3,
exists m2' : mem,
exists cd' : core_data23,
exists j' : meminj,
inject_incr j j' /\
inject_separated j j' m1 m2 /\
match_core23 cd' j' st1' m1' st2' m2' /\
(corestep_plus Sem3 g3 st2 m2
st2' m2' \/
corestep_star Sem3 g3 st2 m2
st2' m2' /\ core_ord23 cd' cd))
(MatchHyp12: forall d12 j12 c1 m1 c2 m2,  match_core12 d12 j12 c1 m1 c2 m2 ->
forall b1 b2 ofs, j12 b1 = Some (b2,ofs) -> Mem.valid_block m1 b1 /\ Mem.valid_block m2 b2)
(MatchHyp23: forall d23 j23 c2 m2 c3 m3,  match_core23 d23 j23 c2 m2 c3 m3 ->
forall b1 b2 ofs, j23 b1 = Some (b2,ofs) -> Mem.valid_block m2 b1 /\ Mem.valid_block m3 b2)
(st1 : C1)
(m1 : mem)
(st1' : C1)
(m1' : mem)
(CS1 : corestep Sem1 g1 st1 m1 st1' m1')
(d12 : core_data12)
(d23 : core_data23)
(st3 : C3)
(m3 : mem)
(st2 : C2)
(m2 : mem)
(j12 : meminj)
(j23 : meminj)
(MC12 : match_core12 d12 j12 st1 m1 st2 m2)
(MC23 : match_core23 d23 j23 st2 m2 st3 m3),
exists st3' : C3,
exists m3' : mem,
exists cd' : core_data12 * option C2 * core_data23,
exists j' : meminj,
inject_incr (compose_meminj j12 j23) j' /\
inject_separated (compose_meminj j12 j23) j' m1 m3 /\
(let (y, d2) := cd' in
let (d1, X) := y in
exists st2' : C2,
exists m2' : mem,
exists j12' : meminj,
exists j23' : meminj,
X = Some st2' /\
j' = compose_meminj j12' j23' /\
match_core12 d1 j12' st1' m1' st2' m2' /\
match_core23 d2 j23' st2' m2' st3' m3') /\
(corestep_plus Sem3 g3 st3 m3 st3' m3' \/
corestep_star Sem3 g3 st3 m3 st3' m3' /\
clos_trans (core_data12 * option C2 * core_data23)
(sem_compose_ord_eq_eq core_ord12 core_ord23 C2) cd'
(d12, Some st2, d23)).
Lemma diagram_injinj_injsep: forall
(core_data12 : Type)
(match_core12 : core_data12 -> meminj -> C1 -> mem -> C2 -> mem -> Prop)
(core_ord12 : core_data12 -> core_data12 -> Prop)
(core_diagram12 : forall (st1 : C1) (m1 : mem) (st1' : C1) (m1' : mem),
corestep Sem1 g1 st1 m1 st1' m1' ->
forall (cd : core_data12) (st2 : C2) (j : meminj) (m2 : mem),
match_core12 cd j st1 m1 st2 m2 ->
exists st2' : C2,
exists m2' : mem,
exists cd' : core_data12,
exists j' : meminj,
inject_incr j j' /\
inject_separated j j' m1 m2 /\
match_core12 cd' j' st1' m1' st2' m2' /\
(corestep_plus Sem2 g2 st2 m2 st2' m2' \/
corestep_star Sem2 g2 st2 m2 st2' m2' /\ core_ord12 cd' cd))
(core_data23 : Type)
(match_core23 : core_data23 -> meminj -> C2 -> mem -> C3 -> mem -> Prop)
(core_ord23 : core_data23 -> core_data23 -> Prop)
(core_diagram23 : forall (st1 : C2) (m1 : mem) (st1' : C2) (m1' : mem),
corestep Sem2 g2 st1 m1 st1' m1' ->
forall (cd : core_data23) (st2 : C3)
(j : meminj) (m2 : mem),
match_core23 cd j st1 m1 st2 m2 ->
exists st2' : C3,
exists m2' : mem,
exists cd' : core_data23,
exists j' : meminj,
inject_incr j j' /\
inject_separated j j' m1 m2 /\
match_core23 cd' j' st1' m1' st2' m2' /\
(corestep_plus Sem3 g3 st2 m2
st2' m2' \/
corestep_star Sem3 g3 st2 m2
st2' m2' /\ core_ord23 cd' cd))
(MatchHyp12: forall d12 j12 c1 m1 c2 m2,  match_core12 d12 j12 c1 m1 c2 m2 ->
forall b1 b2 ofs, j12 b1 = Some (b2,ofs) -> Mem.valid_block m1 b1
/\ Mem.valid_block m2 b2)
(MatchHyp23: forall d23 j23 c2 m2 c3 m3,  match_core23 d23 j23 c2 m2 c3 m3 ->
forall b1 b2 ofs, j23 b1 = Some (b2,ofs) -> Mem.valid_block m2 b1
/\ Mem.valid_block m3 b2)
(st1 : C1)
(m1 : mem)
(st1' : C1)
(m1' : mem)
(CS1 : corestep Sem1 g1 st1 m1 st1' m1')
(d12 : core_data12)
(d23 : core_data23)
(st3 : C3)
(m3 : mem)
(st2 : C2)
(m2 : mem)
(j12 : meminj)
(j23 : meminj)
(MC12 : match_core12 d12 j12 st1 m1 st2 m2)
(MC23 : match_core23 d23 j23 st2 m2 st3 m3),
exists st3' : C3,
exists m3' : mem,
exists cd' : core_data12 * option C2 * core_data23,
exists j' : meminj,
inject_incr (compose_meminj j12 j23) j' /\
inject_separated (compose_meminj j12 j23) j' m1 m3 /\
(let (y, d2) := cd' in
let (d1, X) := y in
exists st2' : C2,
exists m2' : mem,
exists j12' : meminj,
exists j23' : meminj,
X = Some st2' /\
j' = compose_meminj j12' j23' /\
match_core12 d1 j12' st1' m1' st2' m2' /\
match_core23 d2 j23' st2' m2' st3' m3' /\
inject_incr j12 j12' /\
inject_incr j23 j23' /\
inject_separated j12 j12' m1 m2 /\
inject_separated j23 j23' m2 m3) /\
(corestep_plus Sem3 g3 st3 m3 st3' m3' \/
corestep_star Sem3 g3 st3 m3 st3' m3' /\
clos_trans (core_data12 * option C2 * core_data23)
(sem_compose_ord_eq_eq core_ord12 core_ord23 C2) cd'
(d12, Some st2, d23)).
Lemma injinj: forall
(SimInj12 : Forward_simulation_inject Sem1 Sem2 g1 g2 epts12)
(SimInj23 : Forward_simulation_inject Sem2 Sem3 g2 g3 epts23),
Forward_simulation_inject Sem1 Sem3 g1 g3 epts13.