Definition replace_locals (mu:SM_Injection) pSrc' pTgt': 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 extBSrc extBTgt fSrc fTgt extern
  end.

Lemma replace_locals_shared: forall mu pubSrc' pubTgt', shared_of (replace_locals mu pubSrc' pubTgt') = join (foreign_of mu) (fun b => if pubSrc' b then local_of mu b else None).