Section Preduce.
Load "hCoefStructure".
Load "hOrderStructure".
Load "hSpminus".
Inductive inPolySet : list (Term A n) -> list (poly A0 eqA ltM) -> Prop :=
| incons :
forall (a : Term A n) (p : list (Term A n))
(H : canonical A0 eqA ltM (pX a p)) (P : list (poly A0 eqA ltM)),
inPolySet (pX a p)
(exist (fun l0 : list (Term A n) => canonical A0 eqA ltM l0)
(pX a p) H :: P)
| inskip :
forall (a : poly A0 eqA ltM) (p : list (Term A n))
(P : list (poly A0 eqA ltM)), inPolySet p P -> inPolySet p (a :: P).
Hint Resolve incons inskip.
intros p L H'; elim H'; auto.
Qed.
Hint Resolve inPolySet_imp_canonical.
intros Q p H'; elim H'; auto.
intros a p0 H'0 H'1; red in |- *; intros H'2; inversion H'2.
Qed.
intros Q H'; red in |- *; intros H'0.
lapply (not_nil_in_polySet_elm Q (pO A n));
[ intros H'3; apply H'3 || elim H'3 | idtac ]; auto.
Qed.
intros p L H'; elim H'; auto.
intros a p0 H'0 H'1; exists a; exists p0; auto.
Qed.
Inductive reduce (Q : list (poly A0 eqA ltM)) :
list (Term A n) -> list (Term A n) -> Prop :=
| reducetop :
forall (a b : Term A n) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b)
(p q r : list (Term A n)),
inPolySet (pX b q) Q ->
divP A A0 eqA multA divA n a b ->
eqP A eqA n
(spminusf A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec a
b nZb p q) r -> reduce Q (pX a p) r
| reduceskip :
forall (a b : Term A n) (p q : list (Term A n)),
reduce Q p q ->
eqTerm (A:=A) eqA (n:=n) a b -> reduce Q (pX a p) (pX b q).
Hint Resolve reduceskip.
intros Q p; red in |- *; intros H'; inversion H'; auto.
Qed.

Theorem reduce_in_pO :
forall (Q : list (poly A0 eqA ltM)) (p : list (Term A n)),
inPolySet p Q -> reduce Q p (pO A n).