proposition: 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))).
proof: Proof. Proof using plusA os cs. intros a b c nZa nZb nZppab H' H'0 p q Cpxa Cpxb. cut (canonical A0 eqA ltM p); [ intros Op | apply canonical_imp_canonical with (a := a) ]; auto. cut (canonical A0 eqA ltM q); [ intros Oq | apply canonical_imp_canonical with (a := b) ]; auto. cut (~ zeroP (A:=A) A0 eqA (n:=n) c); [ intros Z2 | idtac ]. cut (divP A A0 eqA multA divA n c (ppc (A:=A) A1 (n:=n) a b)); [ intros div1 | idtac ]. apply (eqp_trans _ _ _ _ _ _ _ _ _ cs n) with (y := 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) (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)))). apply mults_comp with (1 := cs); auto. apply spoly_is_minus; auto. apply (eqp_trans _ _ _ _ _ _ _ _ _ cs n) with (y := 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:=ppc (A:=A) A1 (n:=n) a b) nZppab) (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) c (b:=ppc (A:=A) A1 (n:=n) a b) nZppab) (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)))). apply mults_dist_minuspf with (1 := cs); auto. apply (eqp_trans _ _ _ _ _ _ _ _ _ cs n) with (y := minuspf A A0 A1 eqA invA minusA multA eqA_dec n ltM ltM_dec (mults (A:=A) multA (n:=n) (multTerm (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) (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) (multTerm (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) (divTerm (A:=A) (A0:=A0) (eqA:=eqA) divA (n:=n) (ppc (A:=A) A1 (n:=n) a b) (b:=b) nZb)) (pX b q))). apply minuspf_comp with (1 := cs); auto; apply (eqp_sym _ _ _ _ _ _ _ _ _ cs n); auto. apply minuspf_comp with (1 := cs); auto. apply mults_comp with (1 := cs); auto. apply (eqTerm_sym _ _ _ _ _ _ _ _ _ cs n); apply divTerm_compo with (1 := cs); auto. apply mults_comp with (1 := cs); auto. apply (eqTerm_sym _ _ _ _ _ _ _ _ _ cs n); apply divTerm_compo with (1 := cs); auto. case ppc_is_ppcm with (1 := cs) (a := a) (b := b); auto. apply (divP_inv1 _ A0 eqA multA divA n) with (b := a); auto. Qed.