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_extern_incr:
forall mu12 mu12' mu23 mu23'
(inc12: extern_incr mu12 mu12')
(inc23: extern_incr mu23 mu23')
(FRG': forall b1 b2 d1, foreign_of mu12' b1 = Some(b2,d1) ->
exists b3 d2, foreign_of mu23' b2 = Some(b3,d2))
(WD12': SM_wd mu12') (WD23': SM_wd mu23'),
extern_incr (compose_sm mu12 mu23) (compose_sm mu12' mu23').