Fixpoint mkmult_pow (r x:R) (p: positive) {struct p} : R :=
match p with
| xH => r*x
| xO p => mkmult_pow (mkmult_pow r x p) x p
| xI p => mkmult_pow (mkmult_pow (r*x) x p) x p
end.
Definition mkpow x p :=
match p with
| xH => x
| xO p => mkmult_pow x x (Pos.pred_double p)
| xI p => mkmult_pow x x (xO p)
end.
Definition mkopp_pow x p :=
match p with
| xH => -x
| xO p => mkmult_pow (-x) x (Pos.pred_double p)
| xI p => mkmult_pow (-x) x (xO p)
end.
Definition Pphi_dev := Pphi_avoid mkpow mkopp_pow mkmult_pow.

Lemma Pphi_dev_ok : forall P fv, Pphi_dev fv P == P@fv.