(*temporarily added:*) SM_wd mu' /\ sm_valid mu' m1' 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 -> SM_Injection -> 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) (mu : SM_Injection) (m2 : mem), match_core23 cd mu st1 m1 st2 m2 -> exists (st2' : C3) (m2' : mem) (cd' : core_data23) (mu' : SM_Injection), intern_incr mu mu' /\ sm_inject_separated mu mu' m1 m2 /\ sm_locally_allocated mu mu' m1 m2 m1' m2' /\ match_core23 cd' mu' st1' m1' st2' m2' /\ (*temporarily added:*) SM_wd mu' /\ sm_valid mu' m1' m2' /\ (corestep_plus Sem3 g3 st2 m2 st2' m2' \/ corestep_star Sem3 g3 st2 m2 st2' m2' /\ core_ord23 cd' cd)) (match_sm_wd12 : forall (d : core_data12) (mu : SM_Injection) (c1 : C1) (m1 : mem) (c2 : C2) (m2 : mem), match_core12 d mu c1 m1 c2 m2 -> SM_wd mu) (match_validblock12 : forall (d : core_data12) (j : SM_Injection) (c1 : C1) (m1 : mem) (c2 : C2) (m2 : mem), match_core12 d j c1 m1 c2 m2 -> sm_valid j m1 m2) (match_sm_wd23 : forall (d : core_data23) (mu : SM_Injection) (c1 : C2) (m1 : mem) (c2 : C3) (m2 : mem), match_core23 d mu c1 m1 c2 m2 -> SM_wd mu) (match_validblock23 : forall (d : core_data23) (j : SM_Injection) (c1 : C2) (m1 : mem) (c2 : C3) (m2 : mem), match_core23 d j c1 m1 c2 m2 -> sm_valid j m1 m2) (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) (mu12 : SM_Injection) (mu23 : SM_Injection) (INV : locBlocksTgt mu12 = locBlocksSrc mu23 /\ extBlocksTgt mu12 = extBlocksSrc mu23 /\ (forall b : block, pubBlocksTgt mu12 b = true -> pubBlocksSrc mu23 b = true) /\ (forall b : block, frgnBlocksTgt mu12 b = true -> frgnBlocksSrc mu23 b = true)) (MC12 : match_core12 d12 mu12 st1 m1 st2 m2) (MC23 : match_core23 d23 mu23 st2 m2 st3 m3), exists (st2' : C3) (m2' : mem) (cd' : core_data12 * option C2 * core_data23) (mu' : SM_Injection), intern_incr (compose_sm mu12 mu23) mu' /\ sm_inject_separated (compose_sm mu12 mu23) mu' m1 m3 /\ sm_locally_allocated (compose_sm mu12 mu23) mu' m1 m3 m1' m2' /\ (let (y, d2) := cd' in let (d1, X) := y in exists (c0 : C2) (m0 : mem) (mu1 mu2 : SM_Injection), X = Some c0 /\ mu' = compose_sm mu1 mu2 /\ (locBlocksTgt mu1 = locBlocksSrc mu2 /\ extBlocksTgt mu1 = extBlocksSrc mu2 /\ (forall b : block, pubBlocksTgt mu1 b = true -> pubBlocksSrc mu2 b = true) /\ (forall b : block, frgnBlocksTgt mu1 b = true -> frgnBlocksSrc mu2 b = true)) /\ match_core12 d1 mu1 st1' m1' c0 m0 /\ match_core23 d2 mu2 c0 m0 st2' m2') /\ (*temporarily added:*) SM_wd mu' /\ sm_valid mu' m1' m2' /\ (corestep_plus Sem3 g3 st3 m3 st2' m2' \/ corestep_star Sem3 g3 st3 m3 st2' m2' /\ clos_trans (core_data12 * option C2 * core_data23) (sem_compose_ord_eq_eq core_ord12 core_ord23 C2) cd' (d12, Some st2, d23)).  (*Not used - proof that the first preliminary version of effcore_diagram is transitive*)
(*not used - proof that the second preliminary version of effcore_diagram is transitive*)
Goal (*Lemma effdiagram_strong_injinj:*) forall
(core_data12 : Type)
(match_core12 : core_data12 -> SM_Injection -> C1 -> mem -> C2 -> mem -> Prop)
(core_ord12 : core_data12 -> core_data12 -> Prop)
(eff_diagram12 : forall (st1 : C1) (m1 : mem) (st1' : C1) (m1' : mem)
(U1 : block -> Z -> bool),
effstep Sem1 g1 U1 st1 m1 st1' m1' ->
forall (cd : core_data12) (st2 : C2) (mu : SM_Injection)
(m2 : mem),
(forall b ofs, U1 b ofs = true -> vis mu b = true) ->
match_core12 cd mu st1 m1 st2 m2 ->
exists
(st2' : C2) (m2' : mem) (cd' : core_data12) (mu' : SM_Injection),
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_core12 cd' mu' st1' m1' st2' m2' /\
(exists U2 : block -> Z -> bool,
(effstep_plus Sem2 g2 U2 st2 m2 st2' m2' \/
(effstep_star Sem2 g2 U2 st2 m2 st2' m2' /\
core_ord12 cd' cd))
(*/\ (forall b ofs, U2 b ofs = true -> Mem.valid_block m2 b)*)
/\ (forall b ofs, U2 b ofs = true ->
(Mem.valid_block m2 b /\
(locBlocksTgt mu b = false ->
exists b1 delta1, foreign_of mu b1 = Some(b,delta1) /\
U1 b1 (ofs-delta1) = true)))) )
(core_data23 : Type)
(match_core23 : core_data23 -> SM_Injection -> C2 -> mem -> C3 -> mem -> Prop)
(core_ord23 : core_data23 -> core_data23 -> Prop)
(eff_diagram23 : forall (st1 : C2) (m1 : mem) (st1' : C2) (m1' : mem)
(U1 : block -> Z -> bool),
effstep Sem2 g2 U1 st1 m1 st1' m1' ->
forall (cd : core_data23) (st2 : C3) (mu : SM_Injection)
(m2 : mem),
(forall b ofs, U1 b ofs = true -> vis mu b = true) ->
match_core23 cd mu st1 m1 st2 m2 ->
exists
(st2' : C3) (m2' : mem) (cd' : core_data23) (mu' : SM_Injection),
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_core23 cd' mu' st1' m1' st2' m2' /\
(exists U2 : block -> Z -> bool,
(effstep_plus Sem3 g3 U2 st2 m2 st2' m2' \/
(effstep_star Sem3 g3 U2 st2 m2 st2' m2' /\
core_ord23 cd' cd))
/\ (forall b ofs, U2 b ofs = true ->
(Mem.valid_block m2 b /\
(locBlocksTgt mu b = false->
exists b1 delta1, foreign_of mu b1 = Some(b,delta1) /\
U1 b1 (ofs-delta1) = true)))))
(match_sm_wd12 : forall (d : core_data12) (mu : SM_Injection) (c1 : C1)
(m1 : mem) (c2 : C2) (m2 : mem),
match_core12 d mu c1 m1 c2 m2 -> SM_wd mu)
(match_validblock12 : forall (d : core_data12) (j : SM_Injection) (c1 : C1)
(m1 : mem) (c2 : C2) (m2 : mem),
match_core12 d j c1 m1 c2 m2 -> sm_valid j m1 m2)
(match_sm_wd23 : forall (d : core_data23) (mu : SM_Injection) (c1 : C2)
(m1 : mem) (c2 : C3) (m2 : mem),
match_core23 d mu c1 m1 c2 m2 -> SM_wd mu)
(match_validblock23 : forall (d : core_data23) (j : SM_Injection) (c1 : C2)
(m1 : mem) (c2 : C3) (m2 : mem),
match_core23 d j c1 m1 c2 m2 -> sm_valid j m1 m2)
(st1 : C1)
(m1 : mem)
(st1' : C1)
(m1' : mem)
U1
(CS1 : effstep Sem1 g1 U1 st1 m1 st1' m1')
(d12 : core_data12)
(d23 : core_data23)
(st3 : C3)
(m3 : mem)
(st2 : C2)
(m2 : mem)
(mu12 : SM_Injection)
(mu23 : SM_Injection)
(INV : locBlocksTgt mu12 = locBlocksSrc mu23 /\
extBlocksTgt mu12 = extBlocksSrc mu23 /\
(forall b : block,
pubBlocksTgt mu12 b = true -> pubBlocksSrc mu23 b = true) /\
(forall b : block,
frgnBlocksTgt mu12 b = true -> frgnBlocksSrc mu23 b = true))
(MC12 : match_core12 d12 mu12 st1 m1 st2 m2)
(MC23 : match_core23 d23 mu23 st2 m2 st3 m3)
(UHyp : forall b ofs, U1 b ofs = true -> vis (compose_sm mu12 mu23) b = true),
exists
(st2' : C3) (m2' : mem) (cd' : core_data12 * option C2 * core_data23) (mu' : SM_Injection),
intern_incr (compose_sm mu12 mu23) mu' /\
sm_inject_separated (compose_sm mu12 mu23) mu' m1 m3 /\
sm_locally_allocated (compose_sm mu12 mu23) mu' m1 m3 m1' m2' /\
(let (y, d2) := cd' in
let (d1, X) := y in
exists
(c0 : C2) (m0 : mem) (mu1 mu2 : SM_Injection),
X = Some c0 /\
mu' = compose_sm mu1 mu2 /\
(locBlocksTgt mu1 = locBlocksSrc mu2/\
extBlocksTgt mu1 = extBlocksSrc mu2/\
(forall b : block,
pubBlocksTgt mu1 b = true -> pubBlocksSrc mu2 b = true) /\
(forall b : block,
frgnBlocksTgt mu1 b = true -> frgnBlocksSrc mu2 b = true)) /\
match_core12 d1 mu1 st1' m1' c0 m0 /\ match_core23 d2 mu2 c0 m0 st2' m2') /\
(exists U3 : block -> Z -> bool,
(effstep_plus Sem3 g3 U3 st3 m3 st2' m2' \/
effstep_star Sem3 g3 U3 st3 m3 st2' m2' /\
clos_trans
(core_data12 * option C2 * core_data23)
(sem_compose_ord_eq_eq core_ord12 core_ord23 C2) cd'
(d12, Some st2, d23))
/\ (forall b ofs, U3 b ofs = true ->
(Mem.valid_block m3 b /\
(locBlocksTgt (compose_sm mu12 mu23) b = false ->
exists (b1 : block) (delta1 : Z),
foreign_of (compose_sm mu12 mu23) b1 = Some (b, delta1) /\
U1 b1 (ofs - delta1) = true)))).

Lemma effcore_diagram_trans: forall
(core_data12 : Type)
(match_core12 : core_data12 -> SM_Injection -> C1 -> mem -> C2 -> mem -> Prop)
(core_ord12 : core_data12 -> core_data12 -> Prop)
(eff_diagram12 : forall (st1 : C1) (m1 : mem) (st1' : C1) (m1' : mem)
(U1 : block -> Z -> bool),
effstep Sem1 g1 U1 st1 m1 st1' m1' ->
forall (cd : core_data12) (st2 : C2) (mu : SM_Injection)
(m2 : mem),
(forall b ofs, U1 b ofs = true -> Mem.valid_block m1 b ->
vis mu b = true) ->
match_core12 cd mu st1 m1 st2 m2 ->
exists
(st2' : C2) (m2' : mem) (cd' : core_data12) (mu' : SM_Injection),
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_core12 cd' mu' st1' m1' st2' m2' /\
(exists U2 : block -> Z -> bool,
(effstep_plus Sem2 g2 U2 st2 m2 st2' m2' \/
(effstep_star Sem2 g2 U2 st2 m2 st2' m2' /\
core_ord12 cd' cd))
/\ (forall b ofs, U2 b ofs = true ->
(Mem.valid_block m2 b /\
(locBlocksTgt mu b = false ->
exists b1 delta1, foreign_of mu b1 = Some(b,delta1) /\
U1 b1 (ofs-delta1) = true /\
Mem.perm m1 b1 (ofs-delta1) Max Nonempty)))) )
(core_data23 : Type)
(match_core23 : core_data23 -> SM_Injection -> C2 -> mem -> C3 -> mem -> Prop)
(core_ord23 : core_data23 -> core_data23 -> Prop)
(eff_diagram23 : forall (st1 : C2) (m1 : mem) (st1' : C2) (m1' : mem)
(U1 : block -> Z -> bool),
effstep Sem2 g2 U1 st1 m1 st1' m1' ->
forall (cd : core_data23) (st2 : C3) (mu : SM_Injection)
(m2 : mem),
(forall b ofs, U1 b ofs = true -> Mem.valid_block m1 b ->
vis mu b = true) ->
match_core23 cd mu st1 m1 st2 m2 ->
exists
(st2' : C3) (m2' : mem) (cd' : core_data23) (mu' : SM_Injection),
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_core23 cd' mu' st1' m1' st2' m2' /\
(exists U2 : block -> Z -> bool,
(effstep_plus Sem3 g3 U2 st2 m2 st2' m2' \/
(effstep_star Sem3 g3 U2 st2 m2 st2' m2' /\
core_ord23 cd' cd))
/\ (forall b ofs, U2 b ofs = true ->
(Mem.valid_block m2 b /\
(locBlocksTgt mu b = false->
exists b1 delta1, foreign_of mu b1 = Some(b,delta1) /\
U1 b1 (ofs-delta1) = true /\
Mem.perm m1 b1 (ofs-delta1) Max Nonempty)))))
(match_sm_wd12 : forall (d : core_data12) (mu : SM_Injection) (c1 : C1)
(m1 : mem) (c2 : C2) (m2 : mem),
match_core12 d mu c1 m1 c2 m2 -> SM_wd mu)
(match_validblock12 : forall (d : core_data12) (j : SM_Injection) (c1 : C1)
(m1 : mem) (c2 : C2) (m2 : mem),
match_core12 d j c1 m1 c2 m2 -> sm_valid j m1 m2)
(match_sm_wd23 : forall (d : core_data23) (mu : SM_Injection) (c1 : C2)
(m1 : mem) (c2 : C3) (m2 : mem),
match_core23 d mu c1 m1 c2 m2 -> SM_wd mu)
(match_validblock23 : forall (d : core_data23) (j : SM_Injection) (c1 : C2)
(m1 : mem) (c2 : C3) (m2 : mem),
match_core23 d j c1 m1 c2 m2 -> sm_valid j m1 m2)
(st1 : C1)
(m1 : mem)
(st1' : C1)
(m1' : mem)
U1
(CS1 : effstep Sem1 g1 U1 st1 m1 st1' m1')
(d12 : core_data12)
(d23 : core_data23)
(st3 : C3)
(m3 : mem)
(st2 : C2)
(m2 : mem)
(mu12 : SM_Injection)
(mu23 : SM_Injection)
(INV : locBlocksTgt mu12 = locBlocksSrc mu23 /\
extBlocksTgt mu12 = extBlocksSrc mu23 /\
(forall b : block,
pubBlocksTgt mu12 b = true -> pubBlocksSrc mu23 b = true) /\
(forall b : block,
frgnBlocksTgt mu12 b = true -> frgnBlocksSrc mu23 b = true))
(MC12 : match_core12 d12 mu12 st1 m1 st2 m2)
(MC23 : match_core23 d23 mu23 st2 m2 st3 m3)
(UHyp : forall b ofs, U1 b ofs = true -> Mem.valid_block m1 b ->
vis (compose_sm mu12 mu23) b = true),
exists
(st2' : C3) (m2' : mem) (cd' : core_data12 * option C2 * core_data23) (mu' : SM_Injection),
intern_incr (compose_sm mu12 mu23) mu' /\
sm_inject_separated (compose_sm mu12 mu23) mu' m1 m3 /\
sm_locally_allocated (compose_sm mu12 mu23) mu' m1 m3 m1' m2' /\
(let (y, d2) := cd' in
let (d1, X) := y in
exists
(c0 : C2) (m0 : mem) (mu1 mu2 : SM_Injection),
X = Some c0 /\
mu' = compose_sm mu1 mu2 /\
(locBlocksTgt mu1 = locBlocksSrc mu2/\
extBlocksTgt mu1 = extBlocksSrc mu2/\
(forall b : block,
pubBlocksTgt mu1 b = true -> pubBlocksSrc mu2 b = true) /\
(forall b : block,
frgnBlocksTgt mu1 b = true -> frgnBlocksSrc mu2 b = true)) /\
match_core12 d1 mu1 st1' m1' c0 m0 /\ match_core23 d2 mu2 c0 m0 st2' m2') /\
(exists U3 : block -> Z -> bool,
(effstep_plus Sem3 g3 U3 st3 m3 st2' m2' \/
effstep_star Sem3 g3 U3 st3 m3 st2' m2' /\
clos_trans
(core_data12 * option C2 * core_data23)
(sem_compose_ord_eq_eq core_ord12 core_ord23 C2) cd'
(d12, Some st2, d23))
/\ (forall b ofs, U3 b ofs = true ->
(Mem.valid_block m3 b /\
(locBlocksTgt (compose_sm mu12 mu23) b = false ->
exists (b1 : block) (delta1 : Z),
foreign_of (compose_sm mu12 mu23) b1 = Some (b, delta1) /\
U1 b1 (ofs - delta1) = true /\
Mem.perm m1 b1 (ofs-delta1) Max Nonempty)))).