equal
deleted
inserted
replaced
558 unfolding constant_def psize_def |
558 unfolding constant_def psize_def |
559 apply (induct p, auto) |
559 apply (induct p, auto) |
560 done |
560 done |
561 |
561 |
562 lemma poly_replicate_append: |
562 lemma poly_replicate_append: |
563 "poly (monom 1 n * p) (x::'a::{recpower, comm_ring_1}) = x^n * poly p x" |
563 "poly (monom 1 n * p) (x::'a::{comm_ring_1}) = x^n * poly p x" |
564 by (simp add: poly_monom) |
564 by (simp add: poly_monom) |
565 |
565 |
566 text {* Decomposition of polynomial, skipping zero coefficients |
566 text {* Decomposition of polynomial, skipping zero coefficients |
567 after the first. *} |
567 after the first. *} |
568 |
568 |
569 lemma poly_decompose_lemma: |
569 lemma poly_decompose_lemma: |
570 assumes nz: "\<not>(\<forall>z. z\<noteq>0 \<longrightarrow> poly p z = (0::'a::{recpower,idom}))" |
570 assumes nz: "\<not>(\<forall>z. z\<noteq>0 \<longrightarrow> poly p z = (0::'a::{idom}))" |
571 shows "\<exists>k a q. a\<noteq>0 \<and> Suc (psize q + k) = psize p \<and> |
571 shows "\<exists>k a q. a\<noteq>0 \<and> Suc (psize q + k) = psize p \<and> |
572 (\<forall>z. poly p z = z^k * poly (pCons a q) z)" |
572 (\<forall>z. poly p z = z^k * poly (pCons a q) z)" |
573 unfolding psize_def |
573 unfolding psize_def |
574 using nz |
574 using nz |
575 proof(induct p) |
575 proof(induct p) |
593 ultimately show ?case by blast |
593 ultimately show ?case by blast |
594 qed |
594 qed |
595 |
595 |
596 lemma poly_decompose: |
596 lemma poly_decompose: |
597 assumes nc: "~constant(poly p)" |
597 assumes nc: "~constant(poly p)" |
598 shows "\<exists>k a q. a\<noteq>(0::'a::{recpower,idom}) \<and> k\<noteq>0 \<and> |
598 shows "\<exists>k a q. a\<noteq>(0::'a::{idom}) \<and> k\<noteq>0 \<and> |
599 psize q + k + 1 = psize p \<and> |
599 psize q + k + 1 = psize p \<and> |
600 (\<forall>z. poly p z = poly p 0 + z^k * poly (pCons a q) z)" |
600 (\<forall>z. poly p z = poly p 0 + z^k * poly (pCons a q) z)" |
601 using nc |
601 using nc |
602 proof(induct p) |
602 proof(induct p) |
603 case 0 thus ?case by (simp add: constant_def) |
603 case 0 thus ?case by (simp add: constant_def) |