Definition spolyf :
  forall (p q : list (Term A n)) (Cp : canonical A0 eqA ltM p)
    (Cq : canonical A0 eqA ltM q), list (Term A n).

(* Specifications: *)
Theorem spolyf_canonical : forall (p q : list (Term A n)) (Cp : canonical A0 eqA ltM p) (Cq : canonical A0 eqA ltM q), canonical A0 eqA ltM (spolyf p q Cp Cq).
Theorem spolyf_pO : forall (a : list (Term A n)) (Ca : canonical A0 eqA ltM a), eqP A eqA n (spolyf a a Ca Ca) (pO A n).
Theorem spolyf_com : forall (a b : list (Term A n)) (Ca : canonical A0 eqA ltM a) (Cb : canonical A0 eqA ltM b), eqP A eqA n (spolyf a b Ca Cb) (mults (A:=A) multA (n:=n) (invTerm (A:=A) invA (n:=n) (T1 A1 n)) (spolyf b a Cb Ca)).
Theorem spolyf_def : forall (a b : Term A n) (nZa : ~ zeroP (A:=A) A0 eqA (n:=n) a) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b) (p q : list (Term A n)) (Cpxa : canonical A0 eqA ltM (pX a p)) (Cpxb : canonical A0 eqA ltM (pX b q)), eqP A eqA n (spolyf (pX a p) (pX b q) Cpxa Cpxb) (minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) (ppc (A:=A) A1 (n:=n) a b) (b:=a) nZa) p) (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) (ppc (A:=A) A1 (n:=n) a b) (b:=b) nZb) q)).
Theorem eqTerm_spolyf_red2 : forall (a b c : Term A n) (nZa : ~ zeroP (A:=A) A0 eqA (n:=n) a) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b) (nZppab : ~ zeroP (A:=A) A0 eqA (n:=n) (ppc (A:=A) A1 (n:=n) a b)), divP A A0 eqA multA divA n c a -> divP A A0 eqA multA divA n c b -> forall (p q r : list (Term A n)) (Cpxa : canonical A0 eqA ltM (pX a p)) (Cpxb : canonical A0 eqA ltM (pX b q)), canonical A0 eqA ltM r -> eqP A eqA n (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) c (b:=ppc (A:=A) A1 (n:=n) a b) nZppab) (spolyf (pX a p) (pX b q) Cpxa Cpxb)) (minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (spminusf A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec c b nZb r q) (spminusf A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec c a nZa r p)).
Theorem eqTerm_spolyf_red3 : forall (a b : Term A n) (nZa : ~ zeroP (A:=A) A0 eqA (n:=n) a) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b) (p q r : list (Term A n)) (Cpxa : canonical A0 eqA ltM (pX a p)) (Cpxb : canonical A0 eqA ltM (pX b q)), canonical A0 eqA ltM r -> eqP A eqA n (spolyf (pX a p) (pX b q) Cpxa Cpxb) (minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (spminusf A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec (ppc (A:=A) A1 (n:=n) a b) b nZb r q) (spminusf A A0 A1 eqA invA minusA multA divA eqA_dec n ltM ltM_dec (ppc (A:=A) A1 (n:=n) a b) a nZa r p)).
Theorem spoly_is_minus : forall (a b : Term A n) (nZa : ~ zeroP (A:=A) A0 eqA (n:=n) a) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b) (p q : list (Term A n)) (Cpxa : canonical A0 eqA ltM (pX a p)) (Cpxb : canonical A0 eqA ltM (pX b q)), eqP A eqA n (spolyf (pX a p) (pX b q) Cpxa Cpxb) (minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) (ppc (A:=A) A1 (n:=n) a b) (b:=a) nZa) (pX a p)) (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) (ppc (A:=A) A1 (n:=n) a b) (b:=b) nZb) (pX b q))).
Theorem spoly_div_is_minus : forall (a b c : Term A n) (nZa : ~ zeroP (A:=A) A0 eqA (n:=n) a) (nZb : ~ zeroP (A:=A) A0 eqA (n:=n) b) (nZppab : ~ zeroP (A:=A) A0 eqA (n:=n) (ppc (A:=A) A1 (n:=n) a b)), divP A A0 eqA multA divA n c a -> divP A A0 eqA multA divA n c b -> forall (p q : list (Term A n)) (Cpxa : canonical A0 eqA ltM (pX a p)) (Cpxb : canonical A0 eqA ltM (pX b q)), eqP A eqA n (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) c (b:=ppc (A:=A) A1 (n:=n) a b) nZppab) (spolyf (pX a p) (pX b q) Cpxa Cpxb)) (minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) c (b:=a) nZa) (pX a p)) (mults (A:=A) multA (n:=n) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) c (b:=b) nZb) (pX b q))).