Ltac destr_mfactor R S := match goal with
| H : context [MFactor ?P _] |- context [MFactor ?P ?M] =>
specialize (H M); destruct MFactor as (R,S)
end.

Lemma PNSubst_ok n P1 M1 P2 l P3 :
PNSubst P1 M1 P2 n = Some P3 -> M1@@l == P2@l -> P1@l == P3@l.