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.

(* Specifications: *)
Lemma mkmult_pow_ok p r x : mkmult_pow r x p == r * x^p.
Lemma mkpow_ok p x : mkpow x p == x^p.
Lemma mkopp_pow_ok p x : mkopp_pow x p == - x^p.
Lemma Pphi_dev_ok : forall P fv, Pphi_dev fv P == P@fv.
Lemma ring_rw_correct : forall n lH l, interp_PElist l lH -> forall lmp, mk_monpol_list lH = lmp -> forall pe npe, norm_subst n lmp pe = npe -> PEeval l pe == Pphi_dev l npe.