Section EFF_INJ_SIMULATION_PLUS.
Variable measure: C1 -> nat.
Hypothesis inj_core_diagram :
forall st1 m1 st1' m1',
corestep Sem1 ge1 st1 m1 st1' m1' ->
forall st2 mu m2,
match_states st1 mu st1 m1 st2 m2 ->
exists st2', exists m2', exists mu',
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_states st1' mu' st1' m1' st2' m2' /\
SM_wd mu' /\ sm_valid mu' m1' m2' /\
((corestep_plus Sem2 ge2 st2 m2 st2' m2') \/
((measure st1' < measure st1)%nat /\ corestep_star Sem2 ge2 st2 m2 st2' m2')).
Hypothesis inj_effcore_diagram :
forall st1 m1 st1' m1' U1,
effstep Sem1 ge1 U1 st1 m1 st1' m1' ->
forall st2 mu m2
(UHyp: forall b ofs, U1 b ofs = true -> Mem.valid_block m1 b ->
vis mu b = true),
match_states st1 mu st1 m1 st2 m2 ->
exists st2', exists m2', exists mu',
intern_incr mu mu' /\
sm_inject_separated mu mu' m1 m2 /\
sm_locally_allocated mu mu' m1 m2 m1' m2' /\
match_states st1' mu' st1' m1' st2' m2' /\
exists U2,
(effstep_plus Sem2 ge2 U2 st2 m2 st2' m2' \/
((measure st1' < measure st1)%nat /\ effstep_star Sem2 ge2 U2 st2 m2 st2' m2'))
/\
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)).
End EFF_INJ_SIMULATION_PLUS.
End Eff_INJ_SIMU_DIAGRAMS.
Definition compose_sm (mu1 mu2 : SM_Injection) : SM_Injection :=
Build_SM_Injection
(locBlocksSrc mu1) (locBlocksTgt mu2)
(pubBlocksSrc mu1) (pubBlocksTgt mu2)
(compose_meminj (local_of mu1) (local_of mu2))
(extBlocksSrc mu1) (extBlocksTgt mu2)
(frgnBlocksSrc mu1) (frgnBlocksTgt mu2)
(compose_meminj (extern_of mu1) (extern_of mu2)).

Lemma compose_sm_valid: forall mu1 mu2 m1 m2 m2' m3
(SMV1: sm_valid mu1 m1 m2) (SMV2: sm_valid mu2 m2' m3),
sm_valid (compose_sm mu1 mu2) m1 m3.