Fixpoint mkInjectionsN (N:nat)(n1 n2:block)(j k l: meminj)
:  meminj * meminj * block * block :=
match N with O => (j,k,n1,n2)
| S M => mkInjectionsN M (Pos.succ n1) (Pos.succ n2)
(fun b => if eq_block b n1
then Some (n2,0)
else j b)
(fun b => if eq_block b n2 then l n1 else k b)
l
end.
Definition mkInjections (m1 m1' m2:mem) (j k l: meminj)
:  meminj * meminj * block * block :=
if plt (Mem.nextblock m1) (Mem.nextblock m1')
then mkInjectionsN (Pos.to_nat (Mem.nextblock m1') - Pos.to_nat(Mem.nextblock m1))
(Mem.nextblock m1)
(Mem.nextblock m2) j k l
else (j,k,Mem.nextblock m1,Mem.nextblock m2).

Lemma mkInjections_composememinj: forall m1 m1' m2 j k l j' k' n1' n2'
(HI: mkInjections m1 m1' m2 j k l = (j',k',n1',n2'))
(InjIncr: inject_incr (compose_meminj j k) l) m3
(InjSep: inject_separated (compose_meminj j k) l m1 m3)
(VBj1: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> Mem.valid_block m1 b1)
(VBj2: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> Mem.valid_block m2 b2)
(VBk2: forall b1 b2 ofs2, k b1 = Some(b2,ofs2) -> Mem.valid_block m2 b1)
(VBL1': forall b1 b3 ofs3, l b1 = Some (b3, ofs3) -> (b1 < n1')%positive),
l = compose_meminj j' k'.