Definition removeUndefs (j l j':meminj):meminj :=
   fun b => match j b with
              None => match l b with
                         None => None | Some (b1,delta1) => j' b
                      end
            | Some(b2,delta2) => Some(b2, delta2)
            end.

(* Specifications: *)
Lemma RU_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 (removeUndefs j l j') k'.
Lemma RU_D: forall j j' (I: inject_incr j j') l, inject_incr (removeUndefs j l j') j'.
Lemma inc_RU: forall j j' (I: inject_incr j j') l, inject_incr j (removeUndefs j l j').
Lemma meminj_no_overlap_inject_incr: forall j m (NOV: Mem.meminj_no_overlap j m) k (K:inject_incr k j), Mem.meminj_no_overlap k m.
Lemma RU_no_overlap: forall m1 m2 j12 (MInj12 : Mem.inject j12 m1 m2) m1' (Fwd1: mem_forward m1 m1') j23 m3 (MInj23 : Mem.inject j23 m2 m3) j' j12' j23' n1' n2' (HeqMKI: mkInjections m1 m1' m2 j12 j23 j' = (j12',j23',n1',n2')), Mem.meminj_no_overlap (removeUndefs j12 j' j12') m1'.
Lemma RU_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 (removeUndefs j l j') k'.
Lemma RU_D: forall j j' (I: inject_incr j j') l, inject_incr (removeUndefs j l j') j'.
Lemma inc_RU: forall j j' (I: inject_incr j j') l, inject_incr j (removeUndefs j l j').
Lemma meminij_no_overlap_inject_incr: forall j m (NOV: Mem.meminj_no_overlap j m) k (K:inject_incr k j), Mem.meminj_no_overlap k m.
Lemma RU_no_overlap: forall m1 m2 j12 (MInj12 : Mem.inject j12 m1 m2) m1' (Fwd1: mem_forward m1 m1') j23 m3 (MInj23 : Mem.inject j23 m2 m3) j' j12' j23' n1' n2' (HeqMKI: mkInjections m1 m1' m2 j12 j23 j' = (j12',j23',n1',n2')), Mem.meminj_no_overlap (removeUndefs j12 j' j12') m1'.