Ltac Esimpl3 :=
  repeat match goal with
  | |- context [(?P1 ++ ?P2)@?l] => rewrite (Padd_ok P1 P2 l)
  | |- context [(?P1 -- ?P2)@?l] => rewrite (Psub_ok P1 P2 l)
  end;try Esimpl2;try reflexivity;try apply ring_add_comm.Fixpoint Ppow_pos (res P:Pol) (p:positive){struct p} : Pol :=
  match p with
  | xH => subst_l (Pmul P res)
  | xO p => Ppow_pos (Ppow_pos res P p) P p
  | xI p => subst_l (Pmul P (Ppow_pos (Ppow_pos res P p) P p))
  end.Definition Ppow_N P n :=
  match n with
  | N0 => P1
  | Npos p => Ppow_pos P1 P p
  end.Fixpoint pow_pos_gen (R:Type)(m:R->R->R)(x:R) (i:positive) {struct i}: R :=
  match i with
  | xH => x
  | xO i => let p := pow_pos_gen m x i in m p p
  | xI i => let p := pow_pos_gen m x i in m x (m p p)
  end.

Lemma Ppow_pos_ok : forall l, (forall P, subst_l P@l == P@l) -> forall res P p, (Ppow_pos res P p)@l == (pow_pos_gen Pmul P p)@l * res@l.