(*Inserts the new injection entries into extern component, but not into foreign*)
Definition insert_as_extern (mu: SM_Injection) (j: meminj) (DomJ TgtJ:block->bool)
          : SM_Injection:=
  match mu with
    Build_SM_Injection locBSrc locBTgt pSrc pTgt local extBSrc extBTgt fSrc fTgt extern =>
    Build_SM_Injection locBSrc locBTgt pSrc pTgt local
      (fun b => orb (extBSrc b) (DomJ b))
      (fun b => orb (extBTgt b) (TgtJ b))
      fSrc
      fTgt
      (join extern (fun b => match local b with Some _ => None
                                              | None => j b end))
  end.Definition convertL (nu12: SM_Injection) (j12':meminj) FreshSrc FreshMid:=
  insert_as_extern nu12 j12' FreshSrc FreshMid.Definition convertR (nu23: SM_Injection) (j23':meminj) FreshMid FreshTgt:=
  insert_as_extern nu23 j23' FreshMid FreshTgt.

Lemma convertR_DomSrc: forall nu23 j23' FreshMid FreshTgt, DomSrc (convertR nu23 j23' FreshMid FreshTgt) = (fun b => orb (DomSrc nu23 b) (FreshMid b)).