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.

(* Specifications: *)
Lemma mkInjectionsN_0: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), match N with O => (n1 = n1' /\ n2 = n2' /\ j' = j /\ k' = k) | S n => (n1 + (Pos.of_nat N) = n1')%positive /\ (n2 + (Pos.of_nat N) = n2')%positive end.
Lemma mkInjectionsN_1: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), forall b1 b2 ofs2 (Jb: j b1 = Some(b2,ofs2)), (b1 < n1)%positive -> j' b1 = Some (b2,ofs2).
Lemma mkInjectionsN_2: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), forall b2 b3 ofs3 (Jb: k b2 = Some(b3,ofs3)), (b2 < n2)%positive -> k' b2 = Some (b3,ofs3).
Lemma mkInjectionsN_3: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b1 b2 ofs2, j' b1 = Some(b2,ofs2) -> (j b1 = Some (b2,ofs2)) \/ (b1 = n1 /\ b2 = n2 /\ ofs2 = 0) \/ (exists m, (b1 = n1 + m /\ b2=n2 + m)%positive /\ ofs2=0).
Lemma mkInjectionsN_3V: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HJ: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b1 < n1 /\ b2 < n2)%positive) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) b1 b2 ofs2, j' b1 = Some(b2,ofs2) -> (j b1 = Some (b2,ofs2) /\ (b1 < n1 /\ b2 < n2)%positive) \/ (b1 = n1 /\ b2=n2 /\ ofs2=0 /\ (b1 < n1' /\ b2<n2')%positive) \/ (exists m, (b1 = n1 + m)%positive /\ (b2=n2 + m)%positive /\ ofs2=0 /\ (b1 < n1' /\ b2<n2')%positive).
Lemma mkInjectionsN_4: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b2 b3 ofs3, k' b2 = Some(b3,ofs3) -> k b2 = Some (b3,ofs3) \/ (b2 = n2 /\ l n1 = Some(b3,ofs3)) \/ (exists m, (b2 = n2 + m)%positive /\ l ((n1+m)%positive) = Some(b3,ofs3)).
Lemma mkInjectionsN_4Val: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) b2 b3 ofs3, k' b2 = Some(b3,ofs3) -> (k b2 = Some (b3,ofs3) /\ (b2 < n2)%positive) \/ (b2 = n2 /\ l n1 = Some(b3, ofs3) /\ (b2 < n2')%positive) \/ (exists m, (b2 = n2 + m)%positive /\ l ((n1+m)%positive) = Some(b3,ofs3) /\ (b2 < n2')%positive).
Lemma mkInjectionsN_5: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HJ1: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b1 < n1)%positive) (HJ2: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b2 < n2)%positive) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) (HL: forall b1 b3 ofs3, l b1 = Some(b3,ofs3) -> (b1 < n1')%positive) b2 (HB: (b2 < n2')%positive), k' b2 = None -> ((b2 < n2)%positive /\ k b2 = None) \/ (b2 = n2 /\ l n1 = None) \/ (exists m, b2 = (n2+m)%positive /\ l ((n1+m)%positive) = None).
Lemma mkInjectionsN_6: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b (J': j' b = None), j b = None.
Lemma mkInjectionsN_7: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b (HB: (b < n1')%positive), ((n1 <= b)%positive -> j' b <> None) /\ ((b < n1)%positive -> j' b = j b).
Lemma mkInjectionsN_8: forall j' k' l n1' n2' M N j k n1 n2 (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (Hj: forall b, j b = None -> (b < M \/ n1' <= b)%positive) b, j' b = None -> (b < M \/ n1' <= b)%positive.
Lemma mkInjectionsN_9: forall M j' k' l n1' n2' N j k n1 n2 (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (Hj: forall b, j b = None -> (b < n1' -> b < M)%positive) b, j' b = None -> (b < n1' -> b < M)%positive.
Lemma mkInjectionsN_0: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), match N with O => (n1 = n1' /\ n2 = n2' /\ j' = j /\ k' = k) | S n => (n1 + (Pos.of_nat N) = n1')%positive /\ (n2 + (Pos.of_nat N) = n2')%positive end.
Lemma mkInjectionsN_1: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), forall b1 b2 ofs2 (Jb: j b1 = Some(b2,ofs2)), (b1 < n1)%positive -> j' b1 = Some (b2,ofs2).
Lemma mkInjectionsN_2: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')), forall b2 b3 ofs3 (Jb: k b2 = Some(b3,ofs3)), (b2 < n2)%positive -> k' b2 = Some (b3,ofs3).
Lemma mkInjectionsN_3: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b1 b2 ofs2, j' b1 = Some(b2,ofs2) -> (j b1 = Some (b2,ofs2)) \/ (b1 = n1 /\ b2 = n2 /\ ofs2 = 0) \/ (exists m, (b1 = n1 + m /\ b2=n2 + m)%positive /\ ofs2=0).
Lemma mkInjectionsN_3V: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HJ: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b1 < n1 /\ b2 < n2)%positive) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) b1 b2 ofs2, j' b1 = Some(b2,ofs2) -> (j b1 = Some (b2,ofs2) /\ (b1 < n1 /\ b2 < n2)%positive) \/ (b1 = n1 /\ b2=n2 /\ ofs2=0 /\ (b1 < n1' /\ b2<n2')%positive) \/ (exists m, (b1 = n1 + m)%positive /\ (b2=n2 + m)%positive /\ ofs2=0 /\ (b1 < n1' /\ b2<n2')%positive).
Lemma mkInjectionsN_4: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b2 b3 ofs3, k' b2 = Some(b3,ofs3) -> k b2 = Some (b3,ofs3) \/ (b2 = n2 /\ l n1 = Some(b3,ofs3)) \/ (exists m, (b2 = n2 + m)%positive /\ l ((n1+m)%positive) = Some(b3,ofs3)).
Lemma mkInjectionsN_4Val: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) b2 b3 ofs3, k' b2 = Some(b3,ofs3) -> (k b2 = Some (b3,ofs3) /\ (b2 < n2)%positive) \/ (b2 = n2 /\ l n1 = Some(b3, ofs3) /\ (b2 < n2')%positive) \/ (exists m, (b2 = n2 + m)%positive /\ l ((n1+m)%positive) = Some(b3,ofs3) /\ (b2 < n2')%positive).
Lemma mkInjectionsN_5: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (HJ1: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b1 < n1)%positive) (HJ2: forall b1 b2 ofs2, j b1 = Some(b2,ofs2) -> (b2 < n2)%positive) (HK: forall b2 b3 ofs3, k b2 = Some(b3,ofs3) -> (b2 < n2)%positive) (HL: forall b1 b3 ofs3, l b1 = Some(b3,ofs3) -> (b1 < n1')%positive) b2 (HB: (b2 < n2')%positive), k' b2 = None -> ((b2 < n2)%positive /\ k b2 = None) \/ (b2 = n2 /\ l n1 = None) \/ (exists m, b2 = (n2+m)%positive /\ l ((n1+m)%positive) = None).
Lemma mkInjectionsN_6: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b (J': j' b = None), j b = None.
Lemma mkInjectionsN_7: forall N n1 n2 j k l j' k' n1' n2' (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) b (HB: (b < n1')%positive), ((n1 <= b)%positive -> j' b <> None) /\ ((b < n1)%positive -> j' b = j b).
Lemma mkInjectionsN_8: forall j' k' l n1' n2' M N j k n1 n2 (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (Hj: forall b, j b = None -> (b < M \/ n1' <= b)%positive) b, j' b = None -> (b < M \/ n1' <= b)%positive.
Lemma mkInjectionsN_9: forall M j' k' l n1' n2' N j k n1 n2 (HI: mkInjectionsN N n1 n2 j k l = (j',k',n1',n2')) (Hj: forall b, j b = None -> (b < n1' -> b < M)%positive) b, j' b = None -> (b < n1' -> b < M)%positive.