Definition mks :
  forall p : list (Term A n), canonical A0 eqA ltM p -> poly A0 eqA ltM.Definition selectdivf :
  forall a : Term A n,
  ~ zeroP (A:=A) A0 eqA (n:=n) a ->
  forall Q : list (poly A0 eqA ltM),
  {q : list (Term A n) |
  exists b : Term A n,
    (exists p : list (Term A n),
       divP A A0 eqA multA divA n a b /\
       inPolySet A A0 eqA n ltM q Q /\ q = pX b p)} +
  {(forall (b : Term A n) (q : list (Term A n)),
    inPolySet A A0 eqA n ltM (pX b q) Q -> ~ divP A A0 eqA multA divA n a b)}.Definition selectpolyf :
  forall (Q : list (poly A0 eqA ltM)) (r : list (Term A n)),
  canonical A0 eqA ltM r ->
  {q : list (Term A n) |
  reduce A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q r q} +
  {irreducible A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q r}.Definition Reducef :
  forall (Q : list (poly A0 eqA ltM)) (p : poly A0 eqA ltM),
  {q : poly A0 eqA ltM |
  reducestar Q (s2p A A0 eqA n ltM p) (s2p A A0 eqA n ltM q)}.

(* Specifications: *)
Theorem reduce0_reducestar : forall (Q : list (poly A0 eqA ltM)) (p : list (Term A n)), canonical A0 eqA ltM p -> exists t : list (Term A n), reducestar Q p t.
Theorem reducestar_trans : forall (Q : list (poly A0 eqA ltM)) (x y z : list (Term A n)), canonical A0 eqA ltM x -> reduceplus A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q x y -> reducestar Q y z -> reducestar Q x z.
Theorem reducestar_reduceplus : forall (Q : list (poly A0 eqA ltM)) (p q : list (Term A n)), reducestar Q p q -> reduceplus A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q p q.
Theorem reducestar_irreducible : forall (Q : list (poly A0 eqA ltM)) (p q : list (Term A n)), reducestar Q p q -> irreducible A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q q.
Theorem reducestar_inv : forall (Q : list (poly A0 eqA ltM)) (p q : list (Term A n)), reducestar Q p q -> canonical A0 eqA ltM p -> eqP A eqA n p q /\ irreducible A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q p \/ (exists r : list (Term A n), reduce A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec Q p r /\ reducestar Q r q).
Lemma pO_reducestar : forall (Q : list (poly A0 eqA ltM)) (p : list (Term A n)), reducestar Q (pO A n) p -> p = pO A n.
Theorem reducestar_pO_is_pO : forall (Q : list (poly A0 eqA ltM)) (p q : list (Term A n)), canonical A0 eqA ltM p -> reducestar Q (pO A n) (pO A n).
Theorem reducestar_in_pO : forall (Q : list (poly A0 eqA ltM)) (a : Term A n) (p : list (Term A n)), inPolySet A A0 eqA n ltM p Q -> ~ zeroP (A:=A) A0 eqA (n:=n) a -> reducestar Q (mults (A:=A) multA (n:=n) a p) (pO A n).