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.

(* Specifications: *)
Lemma Mphi_ok P M l :
let (Q,R) := MFactor P M in
P@l == Q@l + M@@l * R@l.
Lemma POneSubst_ok P1 M1 P2 P3 l :
POneSubst P1 M1 P2 = Some P3 -> M1@@l == P2@l ->
P1@l == P3@l.
Lemma PNSubst1_ok n P1 M1 P2 l :
M1@@l == P2@l -> P1@l == (PNSubst1 P1 M1 P2 n)@l.
Lemma PNSubst_ok n P1 M1 P2 l P3 :
PNSubst P1 M1 P2 n = Some P3 -> M1@@l == P2@l -> P1@l == P3@l.