src/HOL/Computational_Algebra/Fundamental_Theorem_Algebra.thy
 author haftmann Mon Jun 05 15:59:41 2017 +0200 (2017-06-05) changeset 66010 2f7d39285a1a parent 65486 d801126a14cb child 66447 a1f5c5c26fa6 permissions -rw-r--r--
executable domain membership checks
 wenzelm@65435 ` 1` ```(* Title: HOL/Computational_Algebra/Fundamental_Theorem_Algebra.thy ``` wenzelm@65435 ` 2` ``` Author: Amine Chaieb, TU Muenchen ``` wenzelm@65435 ` 3` ```*) ``` chaieb@26123 ` 4` wenzelm@60424 ` 5` ```section \Fundamental Theorem of Algebra\ ``` chaieb@26123 ` 6` chaieb@26123 ` 7` ```theory Fundamental_Theorem_Algebra ``` wenzelm@51537 ` 8` ```imports Polynomial Complex_Main ``` chaieb@26123 ` 9` ```begin ``` chaieb@26123 ` 10` wenzelm@60424 ` 11` ```subsection \More lemmas about module of complex numbers\ ``` chaieb@26123 ` 12` wenzelm@60424 ` 13` ```text \The triangle inequality for cmod\ ``` wenzelm@60424 ` 14` chaieb@26123 ` 15` ```lemma complex_mod_triangle_sub: "cmod w \ cmod (w + z) + norm z" ``` chaieb@26123 ` 16` ``` using complex_mod_triangle_ineq2[of "w + z" "-z"] by auto ``` chaieb@26123 ` 17` wenzelm@60424 ` 18` wenzelm@60424 ` 19` ```subsection \Basic lemmas about polynomials\ ``` chaieb@26123 ` 20` chaieb@26123 ` 21` ```lemma poly_bound_exists: ``` wenzelm@56778 ` 22` ``` fixes p :: "'a::{comm_semiring_0,real_normed_div_algebra} poly" ``` wenzelm@56778 ` 23` ``` shows "\m. m > 0 \ (\z. norm z \ r \ norm (poly p z) \ m)" ``` wenzelm@56778 ` 24` ```proof (induct p) ``` wenzelm@56778 ` 25` ``` case 0 ``` wenzelm@56778 ` 26` ``` then show ?case by (rule exI[where x=1]) simp ``` chaieb@26123 ` 27` ```next ``` huffman@29464 ` 28` ``` case (pCons c cs) ``` lp15@55735 ` 29` ``` from pCons.hyps obtain m where m: "\z. norm z \ r \ norm (poly cs z) \ m" ``` chaieb@26123 ` 30` ``` by blast ``` lp15@55735 ` 31` ``` let ?k = " 1 + norm c + \r * m\" ``` wenzelm@56795 ` 32` ``` have kp: "?k > 0" ``` wenzelm@56795 ` 33` ``` using abs_ge_zero[of "r*m"] norm_ge_zero[of c] by arith ``` wenzelm@60424 ` 34` ``` have "norm (poly (pCons c cs) z) \ ?k" if H: "norm z \ r" for z ``` wenzelm@60424 ` 35` ``` proof - ``` wenzelm@56778 ` 36` ``` from m H have th: "norm (poly cs z) \ m" ``` wenzelm@56778 ` 37` ``` by blast ``` wenzelm@56795 ` 38` ``` from H have rp: "r \ 0" ``` wenzelm@56795 ` 39` ``` using norm_ge_zero[of z] by arith ``` wenzelm@56795 ` 40` ``` have "norm (poly (pCons c cs) z) \ norm c + norm (z * poly cs z)" ``` huffman@27514 ` 41` ``` using norm_triangle_ineq[of c "z* poly cs z"] by simp ``` wenzelm@56778 ` 42` ``` also have "\ \ norm c + r * m" ``` wenzelm@56778 ` 43` ``` using mult_mono[OF H th rp norm_ge_zero[of "poly cs z"]] ``` lp15@55735 ` 44` ``` by (simp add: norm_mult) ``` wenzelm@56778 ` 45` ``` also have "\ \ ?k" ``` wenzelm@56778 ` 46` ``` by simp ``` wenzelm@60424 ` 47` ``` finally show ?thesis . ``` wenzelm@60424 ` 48` ``` qed ``` chaieb@26123 ` 49` ``` with kp show ?case by blast ``` chaieb@26123 ` 50` ```qed ``` chaieb@26123 ` 51` chaieb@26123 ` 52` wenzelm@60424 ` 53` ```text \Offsetting the variable in a polynomial gives another of same degree\ ``` huffman@29464 ` 54` haftmann@52380 ` 55` ```definition offset_poly :: "'a::comm_semiring_0 poly \ 'a \ 'a poly" ``` wenzelm@56778 ` 56` ``` where "offset_poly p h = fold_coeffs (\a q. smult h q + pCons a q) p 0" ``` huffman@29464 ` 57` huffman@29464 ` 58` ```lemma offset_poly_0: "offset_poly 0 h = 0" ``` haftmann@52380 ` 59` ``` by (simp add: offset_poly_def) ``` huffman@29464 ` 60` huffman@29464 ` 61` ```lemma offset_poly_pCons: ``` huffman@29464 ` 62` ``` "offset_poly (pCons a p) h = ``` huffman@29464 ` 63` ``` smult h (offset_poly p h) + pCons a (offset_poly p h)" ``` haftmann@52380 ` 64` ``` by (cases "p = 0 \ a = 0") (auto simp add: offset_poly_def) ``` huffman@29464 ` 65` huffman@29464 ` 66` ```lemma offset_poly_single: "offset_poly [:a:] h = [:a:]" ``` wenzelm@56778 ` 67` ``` by (simp add: offset_poly_pCons offset_poly_0) ``` huffman@29464 ` 68` huffman@29464 ` 69` ```lemma poly_offset_poly: "poly (offset_poly p h) x = poly p (h + x)" ``` wenzelm@56778 ` 70` ``` apply (induct p) ``` wenzelm@56778 ` 71` ``` apply (simp add: offset_poly_0) ``` wenzelm@56778 ` 72` ``` apply (simp add: offset_poly_pCons algebra_simps) ``` wenzelm@56778 ` 73` ``` done ``` huffman@29464 ` 74` huffman@29464 ` 75` ```lemma offset_poly_eq_0_lemma: "smult c p + pCons a p = 0 \ p = 0" ``` wenzelm@56778 ` 76` ``` by (induct p arbitrary: a) (simp, force) ``` chaieb@26123 ` 77` huffman@29464 ` 78` ```lemma offset_poly_eq_0_iff: "offset_poly p h = 0 \ p = 0" ``` wenzelm@56778 ` 79` ``` apply (safe intro!: offset_poly_0) ``` wenzelm@56795 ` 80` ``` apply (induct p) ``` wenzelm@56795 ` 81` ``` apply simp ``` wenzelm@56778 ` 82` ``` apply (simp add: offset_poly_pCons) ``` wenzelm@56778 ` 83` ``` apply (frule offset_poly_eq_0_lemma, simp) ``` wenzelm@56778 ` 84` ``` done ``` huffman@29464 ` 85` huffman@29464 ` 86` ```lemma degree_offset_poly: "degree (offset_poly p h) = degree p" ``` wenzelm@56778 ` 87` ``` apply (induct p) ``` wenzelm@56778 ` 88` ``` apply (simp add: offset_poly_0) ``` wenzelm@56778 ` 89` ``` apply (case_tac "p = 0") ``` wenzelm@56778 ` 90` ``` apply (simp add: offset_poly_0 offset_poly_pCons) ``` wenzelm@56778 ` 91` ``` apply (simp add: offset_poly_pCons) ``` wenzelm@56778 ` 92` ``` apply (subst degree_add_eq_right) ``` wenzelm@56778 ` 93` ``` apply (rule le_less_trans [OF degree_smult_le]) ``` wenzelm@56778 ` 94` ``` apply (simp add: offset_poly_eq_0_iff) ``` wenzelm@56778 ` 95` ``` apply (simp add: offset_poly_eq_0_iff) ``` wenzelm@56778 ` 96` ``` done ``` huffman@29464 ` 97` wenzelm@56778 ` 98` ```definition "psize p = (if p = 0 then 0 else Suc (degree p))" ``` huffman@29464 ` 99` huffman@29538 ` 100` ```lemma psize_eq_0_iff [simp]: "psize p = 0 \ p = 0" ``` huffman@29538 ` 101` ``` unfolding psize_def by simp ``` huffman@29464 ` 102` wenzelm@56778 ` 103` ```lemma poly_offset: ``` wenzelm@56778 ` 104` ``` fixes p :: "'a::comm_ring_1 poly" ``` wenzelm@56778 ` 105` ``` shows "\q. psize q = psize p \ (\x. poly q x = poly p (a + x))" ``` huffman@29464 ` 106` ```proof (intro exI conjI) ``` huffman@29538 ` 107` ``` show "psize (offset_poly p a) = psize p" ``` huffman@29538 ` 108` ``` unfolding psize_def ``` huffman@29464 ` 109` ``` by (simp add: offset_poly_eq_0_iff degree_offset_poly) ``` huffman@29464 ` 110` ``` show "\x. poly (offset_poly p a) x = poly p (a + x)" ``` huffman@29464 ` 111` ``` by (simp add: poly_offset_poly) ``` chaieb@26123 ` 112` ```qed ``` chaieb@26123 ` 113` wenzelm@60424 ` 114` ```text \An alternative useful formulation of completeness of the reals\ ``` wenzelm@56778 ` 115` ```lemma real_sup_exists: ``` wenzelm@56778 ` 116` ``` assumes ex: "\x. P x" ``` wenzelm@56778 ` 117` ``` and bz: "\z. \x. P x \ x < z" ``` wenzelm@56778 ` 118` ``` shows "\s::real. \y. (\x. P x \ y < x) \ y < s" ``` hoelzl@54263 ` 119` ```proof ``` hoelzl@54263 ` 120` ``` from bz have "bdd_above (Collect P)" ``` hoelzl@54263 ` 121` ``` by (force intro: less_imp_le) ``` hoelzl@54263 ` 122` ``` then show "\y. (\x. P x \ y < x) \ y < Sup (Collect P)" ``` hoelzl@54263 ` 123` ``` using ex bz by (subst less_cSup_iff) auto ``` chaieb@26123 ` 124` ```qed ``` chaieb@26123 ` 125` wenzelm@60424 ` 126` wenzelm@60424 ` 127` ```subsection \Fundamental theorem of algebra\ ``` wenzelm@60424 ` 128` wenzelm@60424 ` 129` ```lemma unimodular_reduce_norm: ``` chaieb@26123 ` 130` ``` assumes md: "cmod z = 1" ``` wenzelm@63589 ` 131` ``` shows "cmod (z + 1) < 1 \ cmod (z - 1) < 1 \ cmod (z + \) < 1 \ cmod (z - \) < 1" ``` wenzelm@56778 ` 132` ```proof - ``` wenzelm@56778 ` 133` ``` obtain x y where z: "z = Complex x y " ``` wenzelm@56778 ` 134` ``` by (cases z) auto ``` wenzelm@56778 ` 135` ``` from md z have xy: "x\<^sup>2 + y\<^sup>2 = 1" ``` wenzelm@56778 ` 136` ``` by (simp add: cmod_def) ``` wenzelm@63589 ` 137` ``` have False if "cmod (z + 1) \ 1" "cmod (z - 1) \ 1" "cmod (z + \) \ 1" "cmod (z - \) \ 1" ``` wenzelm@60557 ` 138` ``` proof - ``` wenzelm@60557 ` 139` ``` from that z xy have "2 * x \ 1" "2 * x \ -1" "2 * y \ 1" "2 * y \ -1" ``` nipkow@29667 ` 140` ``` by (simp_all add: cmod_def power2_eq_square algebra_simps) ``` wenzelm@61945 ` 141` ``` then have "\2 * x\ \ 1" "\2 * y\ \ 1" ``` wenzelm@56778 ` 142` ``` by simp_all ``` wenzelm@61945 ` 143` ``` then have "\2 * x\\<^sup>2 \ 1\<^sup>2" "\2 * y\\<^sup>2 \ 1\<^sup>2" ``` chaieb@26123 ` 144` ``` by - (rule power_mono, simp, simp)+ ``` wenzelm@56778 ` 145` ``` then have th0: "4 * x\<^sup>2 \ 1" "4 * y\<^sup>2 \ 1" ``` wenzelm@51541 ` 146` ``` by (simp_all add: power_mult_distrib) ``` wenzelm@60557 ` 147` ``` from add_mono[OF th0] xy show ?thesis ``` wenzelm@60557 ` 148` ``` by simp ``` wenzelm@60557 ` 149` ``` qed ``` wenzelm@56778 ` 150` ``` then show ?thesis ``` wenzelm@56778 ` 151` ``` unfolding linorder_not_le[symmetric] by blast ``` chaieb@26123 ` 152` ```qed ``` chaieb@26123 ` 153` wenzelm@61585 ` 154` ```text \Hence we can always reduce modulus of \1 + b z^n\ if nonzero\ ``` chaieb@26123 ` 155` ```lemma reduce_poly_simple: ``` wenzelm@56778 ` 156` ``` assumes b: "b \ 0" ``` wenzelm@56778 ` 157` ``` and n: "n \ 0" ``` chaieb@26123 ` 158` ``` shows "\z. cmod (1 + b * z^n) < 1" ``` wenzelm@56778 ` 159` ``` using n ``` wenzelm@56778 ` 160` ```proof (induct n rule: nat_less_induct) ``` chaieb@26123 ` 161` ``` fix n ``` wenzelm@56778 ` 162` ``` assume IH: "\m 0 \ (\z. cmod (1 + b * z ^ m) < 1)" ``` wenzelm@56778 ` 163` ``` assume n: "n \ 0" ``` chaieb@26123 ` 164` ``` let ?P = "\z n. cmod (1 + b * z ^ n) < 1" ``` wenzelm@60457 ` 165` ``` show "\z. ?P z n" ``` wenzelm@60457 ` 166` ``` proof cases ``` wenzelm@60457 ` 167` ``` assume "even n" ``` wenzelm@56778 ` 168` ``` then have "\m. n = 2 * m" ``` wenzelm@56778 ` 169` ``` by presburger ``` wenzelm@56778 ` 170` ``` then obtain m where m: "n = 2 * m" ``` wenzelm@56778 ` 171` ``` by blast ``` wenzelm@56778 ` 172` ``` from n m have "m \ 0" "m < n" ``` wenzelm@56778 ` 173` ``` by presburger+ ``` wenzelm@56778 ` 174` ``` with IH[rule_format, of m] obtain z where z: "?P z m" ``` wenzelm@56778 ` 175` ``` by blast ``` wenzelm@56795 ` 176` ``` from z have "?P (csqrt z) n" ``` wenzelm@60457 ` 177` ``` by (simp add: m power_mult) ``` wenzelm@60457 ` 178` ``` then show ?thesis .. ``` wenzelm@60457 ` 179` ``` next ``` wenzelm@60457 ` 180` ``` assume "odd n" ``` wenzelm@60457 ` 181` ``` then have "\m. n = Suc (2 * m)" ``` wenzelm@56778 ` 182` ``` by presburger+ ``` wenzelm@56795 ` 183` ``` then obtain m where m: "n = Suc (2 * m)" ``` wenzelm@56778 ` 184` ``` by blast ``` wenzelm@60457 ` 185` ``` have th0: "cmod (complex_of_real (cmod b) / b) = 1" ``` wenzelm@60457 ` 186` ``` using b by (simp add: norm_divide) ``` wenzelm@60457 ` 187` ``` from unimodular_reduce_norm[OF th0] \odd n\ ``` chaieb@26123 ` 188` ``` have "\v. cmod (complex_of_real (cmod b) / b + v^n) < 1" ``` wenzelm@56795 ` 189` ``` apply (cases "cmod (complex_of_real (cmod b) / b + 1) < 1") ``` wenzelm@56795 ` 190` ``` apply (rule_tac x="1" in exI) ``` wenzelm@56795 ` 191` ``` apply simp ``` wenzelm@56795 ` 192` ``` apply (cases "cmod (complex_of_real (cmod b) / b - 1) < 1") ``` wenzelm@56795 ` 193` ``` apply (rule_tac x="-1" in exI) ``` wenzelm@56795 ` 194` ``` apply simp ``` wenzelm@63589 ` 195` ``` apply (cases "cmod (complex_of_real (cmod b) / b + \) < 1") ``` wenzelm@56795 ` 196` ``` apply (cases "even m") ``` wenzelm@63589 ` 197` ``` apply (rule_tac x="\" in exI) ``` wenzelm@56795 ` 198` ``` apply (simp add: m power_mult) ``` wenzelm@63589 ` 199` ``` apply (rule_tac x="- \" in exI) ``` wenzelm@56795 ` 200` ``` apply (simp add: m power_mult) ``` wenzelm@56795 ` 201` ``` apply (cases "even m") ``` wenzelm@63589 ` 202` ``` apply (rule_tac x="- \" in exI) ``` wenzelm@56795 ` 203` ``` apply (simp add: m power_mult) ``` haftmann@54489 ` 204` ``` apply (auto simp add: m power_mult) ``` wenzelm@63589 ` 205` ``` apply (rule_tac x="\" in exI) ``` haftmann@54489 ` 206` ``` apply (auto simp add: m power_mult) ``` chaieb@26123 ` 207` ``` done ``` wenzelm@56778 ` 208` ``` then obtain v where v: "cmod (complex_of_real (cmod b) / b + v^n) < 1" ``` wenzelm@56778 ` 209` ``` by blast ``` chaieb@26123 ` 210` ``` let ?w = "v / complex_of_real (root n (cmod b))" ``` wenzelm@60457 ` 211` ``` from odd_real_root_pow[OF \odd n\, of "cmod b"] ``` huffman@30488 ` 212` ``` have th1: "?w ^ n = v^n / complex_of_real (cmod b)" ``` hoelzl@56889 ` 213` ``` by (simp add: power_divide of_real_power[symmetric]) ``` wenzelm@56778 ` 214` ``` have th2:"cmod (complex_of_real (cmod b) / b) = 1" ``` wenzelm@56778 ` 215` ``` using b by (simp add: norm_divide) ``` wenzelm@56778 ` 216` ``` then have th3: "cmod (complex_of_real (cmod b) / b) \ 0" ``` wenzelm@56778 ` 217` ``` by simp ``` chaieb@26123 ` 218` ``` have th4: "cmod (complex_of_real (cmod b) / b) * ``` wenzelm@56778 ` 219` ``` cmod (1 + b * (v ^ n / complex_of_real (cmod b))) < ``` wenzelm@56778 ` 220` ``` cmod (complex_of_real (cmod b) / b) * 1" ``` webertj@49962 ` 221` ``` apply (simp only: norm_mult[symmetric] distrib_left) ``` wenzelm@56778 ` 222` ``` using b v ``` wenzelm@56778 ` 223` ``` apply (simp add: th2) ``` wenzelm@56778 ` 224` ``` done ``` haftmann@59555 ` 225` ``` from mult_left_less_imp_less[OF th4 th3] ``` huffman@30488 ` 226` ``` have "?P ?w n" unfolding th1 . ``` wenzelm@60457 ` 227` ``` then show ?thesis .. ``` wenzelm@60457 ` 228` ``` qed ``` chaieb@26123 ` 229` ```qed ``` chaieb@26123 ` 230` wenzelm@60424 ` 231` ```text \Bolzano-Weierstrass type property for closed disc in complex plane.\ ``` chaieb@26123 ` 232` wenzelm@56778 ` 233` ```lemma metric_bound_lemma: "cmod (x - y) \ \Re x - Re y\ + \Im x - Im y\" ``` wenzelm@56795 ` 234` ``` using real_sqrt_sum_squares_triangle_ineq[of "Re x - Re y" 0 0 "Im x - Im y"] ``` chaieb@26123 ` 235` ``` unfolding cmod_def by simp ``` chaieb@26123 ` 236` chaieb@26123 ` 237` ```lemma bolzano_weierstrass_complex_disc: ``` chaieb@26123 ` 238` ``` assumes r: "\n. cmod (s n) \ r" ``` chaieb@26123 ` 239` ``` shows "\f z. subseq f \ (\e >0. \N. \n \ N. cmod (s (f n) - z) < e)" ``` wenzelm@60424 ` 240` ```proof - ``` wenzelm@56778 ` 241` ``` from seq_monosub[of "Re \ s"] ``` lp15@55358 ` 242` ``` obtain f where f: "subseq f" "monoseq (\n. Re (s (f n)))" ``` chaieb@26123 ` 243` ``` unfolding o_def by blast ``` wenzelm@56778 ` 244` ``` from seq_monosub[of "Im \ s \ f"] ``` wenzelm@56778 ` 245` ``` obtain g where g: "subseq g" "monoseq (\n. Im (s (f (g n))))" ``` wenzelm@56778 ` 246` ``` unfolding o_def by blast ``` wenzelm@56778 ` 247` ``` let ?h = "f \ g" ``` wenzelm@56778 ` 248` ``` from r[rule_format, of 0] have rp: "r \ 0" ``` wenzelm@56778 ` 249` ``` using norm_ge_zero[of "s 0"] by arith ``` wenzelm@56778 ` 250` ``` have th: "\n. r + 1 \ \Re (s n)\" ``` chaieb@26123 ` 251` ``` proof ``` chaieb@26123 ` 252` ``` fix n ``` wenzelm@56778 ` 253` ``` from abs_Re_le_cmod[of "s n"] r[rule_format, of n] ``` wenzelm@56778 ` 254` ``` show "\Re (s n)\ \ r + 1" by arith ``` chaieb@26123 ` 255` ``` qed ``` wenzelm@56778 ` 256` ``` have conv1: "convergent (\n. Re (s (f n)))" ``` chaieb@26123 ` 257` ``` apply (rule Bseq_monoseq_convergent) ``` chaieb@26123 ` 258` ``` apply (simp add: Bseq_def) ``` lp15@55358 ` 259` ``` apply (metis gt_ex le_less_linear less_trans order.trans th) ``` wenzelm@56778 ` 260` ``` apply (rule f(2)) ``` wenzelm@56778 ` 261` ``` done ``` wenzelm@56778 ` 262` ``` have th: "\n. r + 1 \ \Im (s n)\" ``` chaieb@26123 ` 263` ``` proof ``` chaieb@26123 ` 264` ``` fix n ``` wenzelm@56778 ` 265` ``` from abs_Im_le_cmod[of "s n"] r[rule_format, of n] ``` wenzelm@56778 ` 266` ``` show "\Im (s n)\ \ r + 1" ``` wenzelm@56778 ` 267` ``` by arith ``` chaieb@26123 ` 268` ``` qed ``` chaieb@26123 ` 269` chaieb@26123 ` 270` ``` have conv2: "convergent (\n. Im (s (f (g n))))" ``` chaieb@26123 ` 271` ``` apply (rule Bseq_monoseq_convergent) ``` chaieb@26123 ` 272` ``` apply (simp add: Bseq_def) ``` lp15@55358 ` 273` ``` apply (metis gt_ex le_less_linear less_trans order.trans th) ``` wenzelm@56778 ` 274` ``` apply (rule g(2)) ``` wenzelm@56778 ` 275` ``` done ``` chaieb@26123 ` 276` huffman@30488 ` 277` ``` from conv1[unfolded convergent_def] obtain x where "LIMSEQ (\n. Re (s (f n))) x" ``` huffman@30488 ` 278` ``` by blast ``` wenzelm@56795 ` 279` ``` then have x: "\r>0. \n0. \n\n0. \Re (s (f n)) - x\ < r" ``` huffman@31337 ` 280` ``` unfolding LIMSEQ_iff real_norm_def . ``` chaieb@26123 ` 281` huffman@30488 ` 282` ``` from conv2[unfolded convergent_def] obtain y where "LIMSEQ (\n. Im (s (f (g n)))) y" ``` huffman@30488 ` 283` ``` by blast ``` wenzelm@56795 ` 284` ``` then have y: "\r>0. \n0. \n\n0. \Im (s (f (g n))) - y\ < r" ``` huffman@31337 ` 285` ``` unfolding LIMSEQ_iff real_norm_def . ``` chaieb@26123 ` 286` ``` let ?w = "Complex x y" ``` wenzelm@56778 ` 287` ``` from f(1) g(1) have hs: "subseq ?h" ``` wenzelm@56778 ` 288` ``` unfolding subseq_def by auto ``` wenzelm@60557 ` 289` ``` have "\N. \n\N. cmod (s (?h n) - ?w) < e" if "e > 0" for e ``` wenzelm@60557 ` 290` ``` proof - ``` wenzelm@60557 ` 291` ``` from that have e2: "e/2 > 0" ``` wenzelm@56795 ` 292` ``` by simp ``` chaieb@26123 ` 293` ``` from x[rule_format, OF e2] y[rule_format, OF e2] ``` wenzelm@56778 ` 294` ``` obtain N1 N2 where N1: "\n\N1. \Re (s (f n)) - x\ < e / 2" ``` wenzelm@56795 ` 295` ``` and N2: "\n\N2. \Im (s (f (g n))) - y\ < e / 2" ``` wenzelm@56795 ` 296` ``` by blast ``` wenzelm@60557 ` 297` ``` have "cmod (s (?h n) - ?w) < e" if "n \ N1 + N2" for n ``` wenzelm@60557 ` 298` ``` proof - ``` wenzelm@60557 ` 299` ``` from that have nN1: "g n \ N1" and nN2: "n \ N2" ``` wenzelm@56778 ` 300` ``` using seq_suble[OF g(1), of n] by arith+ ``` chaieb@26123 ` 301` ``` from add_strict_mono[OF N1[rule_format, OF nN1] N2[rule_format, OF nN2]] ``` wenzelm@60557 ` 302` ``` show ?thesis ``` wenzelm@56778 ` 303` ``` using metric_bound_lemma[of "s (f (g n))" ?w] by simp ``` wenzelm@60557 ` 304` ``` qed ``` wenzelm@60557 ` 305` ``` then show ?thesis by blast ``` wenzelm@60557 ` 306` ``` qed ``` wenzelm@56778 ` 307` ``` with hs show ?thesis by blast ``` chaieb@26123 ` 308` ```qed ``` chaieb@26123 ` 309` wenzelm@60424 ` 310` ```text \Polynomial is continuous.\ ``` chaieb@26123 ` 311` chaieb@26123 ` 312` ```lemma poly_cont: ``` wenzelm@56778 ` 313` ``` fixes p :: "'a::{comm_semiring_0,real_normed_div_algebra} poly" ``` huffman@30488 ` 314` ``` assumes ep: "e > 0" ``` lp15@55735 ` 315` ``` shows "\d >0. \w. 0 < norm (w - z) \ norm (w - z) < d \ norm (poly p w - poly p z) < e" ``` wenzelm@56778 ` 316` ```proof - ``` wenzelm@63060 ` 317` ``` obtain q where q: "degree q = degree p" "poly q x = poly p (z + x)" for x ``` huffman@29464 ` 318` ``` proof ``` huffman@29464 ` 319` ``` show "degree (offset_poly p z) = degree p" ``` huffman@29464 ` 320` ``` by (rule degree_offset_poly) ``` huffman@29464 ` 321` ``` show "\x. poly (offset_poly p z) x = poly p (z + x)" ``` huffman@29464 ` 322` ``` by (rule poly_offset_poly) ``` huffman@29464 ` 323` ``` qed ``` wenzelm@56778 ` 324` ``` have th: "\w. poly q (w - z) = poly p w" ``` wenzelm@56778 ` 325` ``` using q(2)[of "w - z" for w] by simp ``` chaieb@26123 ` 326` ``` show ?thesis unfolding th[symmetric] ``` wenzelm@56778 ` 327` ``` proof (induct q) ``` wenzelm@56778 ` 328` ``` case 0 ``` wenzelm@56778 ` 329` ``` then show ?case ``` wenzelm@56778 ` 330` ``` using ep by auto ``` chaieb@26123 ` 331` ``` next ``` huffman@29464 ` 332` ``` case (pCons c cs) ``` huffman@30488 ` 333` ``` from poly_bound_exists[of 1 "cs"] ``` wenzelm@63060 ` 334` ``` obtain m where m: "m > 0" "norm z \ 1 \ norm (poly cs z) \ m" for z ``` wenzelm@56778 ` 335` ``` by blast ``` wenzelm@56778 ` 336` ``` from ep m(1) have em0: "e/m > 0" ``` wenzelm@56778 ` 337` ``` by (simp add: field_simps) ``` wenzelm@56778 ` 338` ``` have one0: "1 > (0::real)" ``` wenzelm@56778 ` 339` ``` by arith ``` huffman@30488 ` 340` ``` from real_lbound_gt_zero[OF one0 em0] ``` wenzelm@56778 ` 341` ``` obtain d where d: "d > 0" "d < 1" "d < e / m" ``` wenzelm@56778 ` 342` ``` by blast ``` wenzelm@56778 ` 343` ``` from d(1,3) m(1) have dm: "d * m > 0" "d * m < e" ``` nipkow@56544 ` 344` ``` by (simp_all add: field_simps) ``` huffman@30488 ` 345` ``` show ?case ``` wenzelm@56778 ` 346` ``` proof (rule ex_forward[OF real_lbound_gt_zero[OF one0 em0]], clarsimp simp add: norm_mult) ``` wenzelm@56778 ` 347` ``` fix d w ``` wenzelm@56778 ` 348` ``` assume H: "d > 0" "d < 1" "d < e/m" "w \ z" "norm (w - z) < d" ``` wenzelm@56778 ` 349` ``` then have d1: "norm (w-z) \ 1" "d \ 0" ``` wenzelm@56778 ` 350` ``` by simp_all ``` wenzelm@56778 ` 351` ``` from H(3) m(1) have dme: "d*m < e" ``` wenzelm@56778 ` 352` ``` by (simp add: field_simps) ``` wenzelm@56778 ` 353` ``` from H have th: "norm (w - z) \ d" ``` wenzelm@56778 ` 354` ``` by simp ``` wenzelm@56778 ` 355` ``` from mult_mono[OF th m(2)[OF d1(1)] d1(2) norm_ge_zero] dme ``` wenzelm@56778 ` 356` ``` show "norm (w - z) * norm (poly cs (w - z)) < e" ``` wenzelm@56778 ` 357` ``` by simp ``` chaieb@26123 ` 358` ``` qed ``` wenzelm@56778 ` 359` ``` qed ``` chaieb@26123 ` 360` ```qed ``` chaieb@26123 ` 361` wenzelm@60424 ` 362` ```text \Hence a polynomial attains minimum on a closed disc ``` wenzelm@60424 ` 363` ``` in the complex plane.\ ``` wenzelm@56778 ` 364` ```lemma poly_minimum_modulus_disc: "\z. \w. cmod w \ r \ cmod (poly p z) \ cmod (poly p w)" ``` wenzelm@56778 ` 365` ```proof - ``` wenzelm@60424 ` 366` ``` show ?thesis ``` wenzelm@60424 ` 367` ``` proof (cases "r \ 0") ``` wenzelm@60424 ` 368` ``` case False ``` wenzelm@60424 ` 369` ``` then show ?thesis ``` wenzelm@56778 ` 370` ``` by (metis norm_ge_zero order.trans) ``` wenzelm@60424 ` 371` ``` next ``` wenzelm@60424 ` 372` ``` case True ``` wenzelm@60424 ` 373` ``` then have "cmod 0 \ r \ cmod (poly p 0) = - (- cmod (poly p 0))" ``` wenzelm@56778 ` 374` ``` by simp ``` wenzelm@56778 ` 375` ``` then have mth1: "\x z. cmod z \ r \ cmod (poly p z) = - x" ``` wenzelm@56778 ` 376` ``` by blast ``` wenzelm@60557 ` 377` ``` have False if "cmod z \ r" "cmod (poly p z) = - x" "\ x < 1" for x z ``` wenzelm@60557 ` 378` ``` proof - ``` wenzelm@60557 ` 379` ``` from that have "- x < 0 " ``` wenzelm@56778 ` 380` ``` by arith ``` wenzelm@60557 ` 381` ``` with that(2) norm_ge_zero[of "poly p z"] show ?thesis ``` wenzelm@56778 ` 382` ``` by simp ``` wenzelm@60557 ` 383` ``` qed ``` wenzelm@56778 ` 384` ``` then have mth2: "\z. \x. (\z. cmod z \ r \ cmod (poly p z) = - x) \ x < z" ``` wenzelm@56778 ` 385` ``` by blast ``` huffman@30488 ` 386` ``` from real_sup_exists[OF mth1 mth2] obtain s where ``` wenzelm@60557 ` 387` ``` s: "\y. (\x. (\z. cmod z \ r \ cmod (poly p z) = - x) \ y < x) \ y < s" ``` wenzelm@60557 ` 388` ``` by blast ``` wenzelm@56778 ` 389` ``` let ?m = "- s" ``` wenzelm@60557 ` 390` ``` have s1[unfolded minus_minus]: ``` wenzelm@60557 ` 391` ``` "(\z x. cmod z \ r \ - (- cmod (poly p z)) < y) \ ?m < y" for y ``` wenzelm@60557 ` 392` ``` using s[rule_format, of "-y"] ``` wenzelm@60557 ` 393` ``` unfolding minus_less_iff[of y] equation_minus_iff by blast ``` huffman@30488 ` 394` ``` from s1[of ?m] have s1m: "\z x. cmod z \ r \ cmod (poly p z) \ ?m" ``` chaieb@26123 ` 395` ``` by auto ``` wenzelm@60557 ` 396` ``` have "\z. cmod z \ r \ cmod (poly p z) < - s + 1 / real (Suc n)" for n ``` wenzelm@60557 ` 397` ``` using s1[rule_format, of "?m + 1/real (Suc n)"] by simp ``` wenzelm@56778 ` 398` ``` then have th: "\n. \z. cmod z \ r \ cmod (poly p z) < - s + 1 / real (Suc n)" .. ``` huffman@30488 ` 399` ``` from choice[OF th] obtain g where ``` wenzelm@56778 ` 400` ``` g: "\n. cmod (g n) \ r" "\n. cmod (poly p (g n)) e>0. \N. \n\N. cmod (g (f n) - z) < e" ``` huffman@30488 ` 404` ``` by blast ``` wenzelm@56778 ` 405` ``` { ``` wenzelm@56778 ` 406` ``` fix w ``` chaieb@26123 ` 407` ``` assume wr: "cmod w \ r" ``` chaieb@26123 ` 408` ``` let ?e = "\cmod (poly p z) - ?m\" ``` wenzelm@56778 ` 409` ``` { ``` wenzelm@56778 ` 410` ``` assume e: "?e > 0" ``` wenzelm@56795 ` 411` ``` then have e2: "?e/2 > 0" ``` wenzelm@56795 ` 412` ``` by simp ``` wenzelm@32960 ` 413` ``` from poly_cont[OF e2, of z p] obtain d where ``` wenzelm@56778 ` 414` ``` d: "d > 0" "\w. 0 cmod(w - z) < d \ cmod(poly p w - poly p z) < ?e/2" ``` wenzelm@56778 ` 415` ``` by blast ``` wenzelm@60557 ` 416` ``` have th1: "cmod(poly p w - poly p z) < ?e / 2" if w: "cmod (w - z) < d" for w ``` wenzelm@60557 ` 417` ``` using d(2)[rule_format, of w] w e by (cases "w = z") simp_all ``` wenzelm@56778 ` 418` ``` from fz(2) d(1) obtain N1 where N1: "\n\N1. cmod (g (f n) - z) < d" ``` wenzelm@56778 ` 419` ``` by blast ``` wenzelm@56778 ` 420` ``` from reals_Archimedean2[of "2/?e"] obtain N2 :: nat where N2: "2/?e < real N2" ``` wenzelm@56778 ` 421` ``` by blast ``` wenzelm@56778 ` 422` ``` have th2: "cmod (poly p (g (f (N1 + N2))) - poly p z) < ?e/2" ``` wenzelm@32960 ` 423` ``` using N1[rule_format, of "N1 + N2"] th1 by simp ``` wenzelm@60424 ` 424` ``` have th0: "a < e2 \ \b - m\ < e2 \ 2 * e2 \ \b - m\ + a \ False" ``` wenzelm@60424 ` 425` ``` for a b e2 m :: real ``` wenzelm@60424 ` 426` ``` by arith ``` wenzelm@60424 ` 427` ``` have ath: "m \ x \ x < m + e \ \x - m\ < e" for m x e :: real ``` wenzelm@56778 ` 428` ``` by arith ``` wenzelm@56778 ` 429` ``` from s1m[OF g(1)[rule_format]] have th31: "?m \ cmod(poly p (g (f (N1 + N2))))" . ``` wenzelm@56795 ` 430` ``` from seq_suble[OF fz(1), of "N1 + N2"] ``` wenzelm@56778 ` 431` ``` have th00: "real (Suc (N1 + N2)) \ real (Suc (f (N1 + N2)))" ``` wenzelm@56778 ` 432` ``` by simp ``` wenzelm@56778 ` 433` ``` have th000: "0 \ (1::real)" "(1::real) \ 1" "real (Suc (N1 + N2)) > 0" ``` wenzelm@56778 ` 434` ``` using N2 by auto ``` wenzelm@56778 ` 435` ``` from frac_le[OF th000 th00] ``` wenzelm@56795 ` 436` ``` have th00: "?m + 1 / real (Suc (f (N1 + N2))) \ ?m + 1 / real (Suc (N1 + N2))" ``` wenzelm@56778 ` 437` ``` by simp ``` wenzelm@56778 ` 438` ``` from g(2)[rule_format, of "f (N1 + N2)"] ``` wenzelm@56778 ` 439` ``` have th01:"cmod (poly p (g (f (N1 + N2)))) < - s + 1 / real (Suc (f (N1 + N2)))" . ``` wenzelm@56778 ` 440` ``` from order_less_le_trans[OF th01 th00] ``` wenzelm@56795 ` 441` ``` have th32: "cmod (poly p (g (f (N1 + N2)))) < ?m + (1/ real(Suc (N1 + N2)))" . ``` wenzelm@56778 ` 442` ``` from N2 have "2/?e < real (Suc (N1 + N2))" ``` wenzelm@56778 ` 443` ``` by arith ``` wenzelm@56778 ` 444` ``` with e2 less_imp_inverse_less[of "2/?e" "real (Suc (N1 + N2))"] ``` wenzelm@56778 ` 445` ``` have "?e/2 > 1/ real (Suc (N1 + N2))" ``` wenzelm@56778 ` 446` ``` by (simp add: inverse_eq_divide) ``` wenzelm@60424 ` 447` ``` with ath[OF th31 th32] have thc1: "\cmod (poly p (g (f (N1 + N2)))) - ?m\ < ?e/2" ``` wenzelm@56778 ` 448` ``` by arith ``` wenzelm@60424 ` 449` ``` have ath2: "\a - b\ \ c \ \b - m\ \ \a - m\ + c" for a b c m :: real ``` wenzelm@56778 ` 450` ``` by arith ``` wenzelm@56778 ` 451` ``` have th22: "\cmod (poly p (g (f (N1 + N2)))) - cmod (poly p z)\ \ ``` wenzelm@56778 ` 452` ``` cmod (poly p (g (f (N1 + N2))) - poly p z)" ``` wenzelm@56778 ` 453` ``` by (simp add: norm_triangle_ineq3) ``` wenzelm@56778 ` 454` ``` from ath2[OF th22, of ?m] ``` wenzelm@56778 ` 455` ``` have thc2: "2 * (?e/2) \ ``` wenzelm@56778 ` 456` ``` \cmod(poly p (g (f (N1 + N2)))) - ?m\ + cmod (poly p (g (f (N1 + N2))) - poly p z)" ``` wenzelm@56778 ` 457` ``` by simp ``` wenzelm@56778 ` 458` ``` from th0[OF th2 thc1 thc2] have False . ``` wenzelm@56778 ` 459` ``` } ``` wenzelm@56778 ` 460` ``` then have "?e = 0" ``` wenzelm@56778 ` 461` ``` by auto ``` wenzelm@56778 ` 462` ``` then have "cmod (poly p z) = ?m" ``` wenzelm@56778 ` 463` ``` by simp ``` wenzelm@56778 ` 464` ``` with s1m[OF wr] have "cmod (poly p z) \ cmod (poly p w)" ``` wenzelm@56778 ` 465` ``` by simp ``` wenzelm@56778 ` 466` ``` } ``` wenzelm@60424 ` 467` ``` then show ?thesis by blast ``` wenzelm@60424 ` 468` ``` qed ``` chaieb@26123 ` 469` ```qed ``` chaieb@26123 ` 470` wenzelm@60424 ` 471` ```text \Nonzero polynomial in z goes to infinity as z does.\ ``` chaieb@26123 ` 472` chaieb@26123 ` 473` ```lemma poly_infinity: ``` wenzelm@56778 ` 474` ``` fixes p:: "'a::{comm_semiring_0,real_normed_div_algebra} poly" ``` huffman@29464 ` 475` ``` assumes ex: "p \ 0" ``` lp15@55735 ` 476` ``` shows "\r. \z. r \ norm z \ d \ norm (poly (pCons a p) z)" ``` wenzelm@56778 ` 477` ``` using ex ``` wenzelm@56778 ` 478` ```proof (induct p arbitrary: a d) ``` wenzelm@56795 ` 479` ``` case 0 ``` wenzelm@56795 ` 480` ``` then show ?case by simp ``` wenzelm@56795 ` 481` ```next ``` huffman@30488 ` 482` ``` case (pCons c cs a d) ``` wenzelm@56795 ` 483` ``` show ?case ``` wenzelm@56795 ` 484` ``` proof (cases "cs = 0") ``` wenzelm@56795 ` 485` ``` case False ``` wenzelm@56778 ` 486` ``` with pCons.hyps obtain r where r: "\z. r \ norm z \ d + norm a \ norm (poly (pCons c cs) z)" ``` wenzelm@56778 ` 487` ``` by blast ``` chaieb@26123 ` 488` ``` let ?r = "1 + \r\" ``` wenzelm@60557 ` 489` ``` have "d \ norm (poly (pCons a (pCons c cs)) z)" if "1 + \r\ \ norm z" for z ``` wenzelm@60557 ` 490` ``` proof - ``` wenzelm@56795 ` 491` ``` have r0: "r \ norm z" ``` wenzelm@60557 ` 492` ``` using that by arith ``` wenzelm@56778 ` 493` ``` from r[rule_format, OF r0] have th0: "d + norm a \ 1 * norm(poly (pCons c cs) z)" ``` wenzelm@56778 ` 494` ``` by arith ``` wenzelm@60557 ` 495` ``` from that have z1: "norm z \ 1" ``` wenzelm@56778 ` 496` ``` by arith ``` huffman@29464 ` 497` ``` from order_trans[OF th0 mult_right_mono[OF z1 norm_ge_zero[of "poly (pCons c cs) z"]]] ``` lp15@55735 ` 498` ``` have th1: "d \ norm(z * poly (pCons c cs) z) - norm a" ``` wenzelm@32960 ` 499` ``` unfolding norm_mult by (simp add: algebra_simps) ``` lp15@55735 ` 500` ``` from norm_diff_ineq[of "z * poly (pCons c cs) z" a] ``` wenzelm@56795 ` 501` ``` have th2: "norm (z * poly (pCons c cs) z) - norm a \ norm (poly (pCons a (pCons c cs)) z)" ``` wenzelm@51541 ` 502` ``` by (simp add: algebra_simps) ``` wenzelm@60557 ` 503` ``` from th1 th2 show ?thesis ``` wenzelm@56795 ` 504` ``` by arith ``` wenzelm@60557 ` 505` ``` qed ``` wenzelm@56795 ` 506` ``` then show ?thesis by blast ``` wenzelm@56795 ` 507` ``` next ``` wenzelm@56795 ` 508` ``` case True ``` wenzelm@56778 ` 509` ``` with pCons.prems have c0: "c \ 0" ``` wenzelm@56778 ` 510` ``` by simp ``` wenzelm@60424 ` 511` ``` have "d \ norm (poly (pCons a (pCons c cs)) z)" ``` wenzelm@60424 ` 512` ``` if h: "(\d\ + norm a) / norm c \ norm z" for z :: 'a ``` wenzelm@60424 ` 513` ``` proof - ``` wenzelm@56778 ` 514` ``` from c0 have "norm c > 0" ``` wenzelm@56778 ` 515` ``` by simp ``` blanchet@56403 ` 516` ``` from h c0 have th0: "\d\ + norm a \ norm (z * c)" ``` wenzelm@32960 ` 517` ``` by (simp add: field_simps norm_mult) ``` wenzelm@56778 ` 518` ``` have ath: "\mzh mazh ma. mzh \ mazh + ma \ \d\ + ma \ mzh \ d \ mazh" ``` wenzelm@56778 ` 519` ``` by arith ``` wenzelm@56778 ` 520` ``` from norm_diff_ineq[of "z * c" a] have th1: "norm (z * c) \ norm (a + z * c) + norm a" ``` wenzelm@32960 ` 521` ``` by (simp add: algebra_simps) ``` wenzelm@60424 ` 522` ``` from ath[OF th1 th0] show ?thesis ``` wenzelm@56795 ` 523` ``` using True by simp ``` wenzelm@60424 ` 524` ``` qed ``` wenzelm@56795 ` 525` ``` then show ?thesis by blast ``` wenzelm@56795 ` 526` ``` qed ``` wenzelm@56795 ` 527` ```qed ``` chaieb@26123 ` 528` wenzelm@60424 ` 529` ```text \Hence polynomial's modulus attains its minimum somewhere.\ ``` wenzelm@56778 ` 530` ```lemma poly_minimum_modulus: "\z.\w. cmod (poly p z) \ cmod (poly p w)" ``` wenzelm@56778 ` 531` ```proof (induct p) ``` wenzelm@56778 ` 532` ``` case 0 ``` wenzelm@56778 ` 533` ``` then show ?case by simp ``` wenzelm@56778 ` 534` ```next ``` huffman@30488 ` 535` ``` case (pCons c cs) ``` wenzelm@56778 ` 536` ``` show ?case ``` wenzelm@56778 ` 537` ``` proof (cases "cs = 0") ``` wenzelm@56778 ` 538` ``` case False ``` wenzelm@56778 ` 539` ``` from poly_infinity[OF False, of "cmod (poly (pCons c cs) 0)" c] ``` wenzelm@63060 ` 540` ``` obtain r where r: "cmod (poly (pCons c cs) 0) \ cmod (poly (pCons c cs) z)" ``` wenzelm@63060 ` 541` ``` if "r \ cmod z" for z ``` wenzelm@56778 ` 542` ``` by blast ``` wenzelm@56778 ` 543` ``` have ath: "\z r. r \ cmod z \ cmod z \ \r\" ``` wenzelm@56778 ` 544` ``` by arith ``` huffman@30488 ` 545` ``` from poly_minimum_modulus_disc[of "\r\" "pCons c cs"] ``` wenzelm@63060 ` 546` ``` obtain v where v: "cmod (poly (pCons c cs) v) \ cmod (poly (pCons c cs) w)" ``` wenzelm@63060 ` 547` ``` if "cmod w \ \r\" for w ``` wenzelm@56778 ` 548` ``` by blast ``` wenzelm@60424 ` 549` ``` have "cmod (poly (pCons c cs) v) \ cmod (poly (pCons c cs) z)" if z: "r \ cmod z" for z ``` wenzelm@60424 ` 550` ``` using v[of 0] r[OF z] by simp ``` wenzelm@60424 ` 551` ``` with v ath[of r] show ?thesis ``` wenzelm@56778 ` 552` ``` by blast ``` wenzelm@56778 ` 553` ``` next ``` wenzelm@56778 ` 554` ``` case True ``` wenzelm@60424 ` 555` ``` with pCons.hyps show ?thesis ``` wenzelm@60424 ` 556` ``` by simp ``` wenzelm@56778 ` 557` ``` qed ``` wenzelm@56778 ` 558` ```qed ``` chaieb@26123 ` 559` wenzelm@60424 ` 560` ```text \Constant function (non-syntactic characterization).\ ``` wenzelm@56795 ` 561` ```definition "constant f \ (\x y. f x = f y)" ``` chaieb@26123 ` 562` wenzelm@56778 ` 563` ```lemma nonconstant_length: "\ constant (poly p) \ psize p \ 2" ``` wenzelm@56778 ` 564` ``` by (induct p) (auto simp: constant_def psize_def) ``` huffman@30488 ` 565` wenzelm@56795 ` 566` ```lemma poly_replicate_append: "poly (monom 1 n * p) (x::'a::comm_ring_1) = x^n * poly p x" ``` huffman@29464 ` 567` ``` by (simp add: poly_monom) ``` chaieb@26123 ` 568` wenzelm@60424 ` 569` ```text \Decomposition of polynomial, skipping zero coefficients after the first.\ ``` chaieb@26123 ` 570` chaieb@26123 ` 571` ```lemma poly_decompose_lemma: ``` wenzelm@56778 ` 572` ``` assumes nz: "\ (\z. z \ 0 \ poly p z = (0::'a::idom))" ``` wenzelm@56795 ` 573` ``` shows "\k a q. a \ 0 \ Suc (psize q + k) = psize p \ (\z. poly p z = z^k * poly (pCons a q) z)" ``` wenzelm@56778 ` 574` ``` unfolding psize_def ``` wenzelm@56778 ` 575` ``` using nz ``` wenzelm@56778 ` 576` ```proof (induct p) ``` wenzelm@56778 ` 577` ``` case 0 ``` wenzelm@56778 ` 578` ``` then show ?case by simp ``` chaieb@26123 ` 579` ```next ``` huffman@29464 ` 580` ``` case (pCons c cs) ``` wenzelm@56778 ` 581` ``` show ?case ``` wenzelm@56778 ` 582` ``` proof (cases "c = 0") ``` wenzelm@56778 ` 583` ``` case True ``` wenzelm@56778 ` 584` ``` from pCons.hyps pCons.prems True show ?thesis ``` wenzelm@60424 ` 585` ``` apply auto ``` chaieb@26123 ` 586` ``` apply (rule_tac x="k+1" in exI) ``` wenzelm@60557 ` 587` ``` apply (rule_tac x="a" in exI) ``` wenzelm@60557 ` 588` ``` apply clarsimp ``` chaieb@26123 ` 589` ``` apply (rule_tac x="q" in exI) ``` wenzelm@56778 ` 590` ``` apply auto ``` wenzelm@56778 ` 591` ``` done ``` wenzelm@56778 ` 592` ``` next ``` wenzelm@56778 ` 593` ``` case False ``` wenzelm@56778 ` 594` ``` show ?thesis ``` chaieb@26123 ` 595` ``` apply (rule exI[where x=0]) ``` wenzelm@60424 ` 596` ``` apply (rule exI[where x=c]) ``` wenzelm@60424 ` 597` ``` apply (auto simp: False) ``` wenzelm@56778 ` 598` ``` done ``` wenzelm@56778 ` 599` ``` qed ``` chaieb@26123 ` 600` ```qed ``` chaieb@26123 ` 601` chaieb@26123 ` 602` ```lemma poly_decompose: ``` wenzelm@56776 ` 603` ``` assumes nc: "\ constant (poly p)" ``` wenzelm@56778 ` 604` ``` shows "\k a q. a \ (0::'a::idom) \ k \ 0 \ ``` huffman@30488 ` 605` ``` psize q + k + 1 = psize p \ ``` huffman@29464 ` 606` ``` (\z. poly p z = poly p 0 + z^k * poly (pCons a q) z)" ``` wenzelm@56776 ` 607` ``` using nc ``` wenzelm@56776 ` 608` ```proof (induct p) ``` wenzelm@56776 ` 609` ``` case 0 ``` wenzelm@56776 ` 610` ``` then show ?case ``` wenzelm@56776 ` 611` ``` by (simp add: constant_def) ``` chaieb@26123 ` 612` ```next ``` huffman@29464 ` 613` ``` case (pCons c cs) ``` wenzelm@60557 ` 614` ``` have "\ (\z. z \ 0 \ poly cs z = 0)" ``` wenzelm@60557 ` 615` ``` proof ``` wenzelm@60424 ` 616` ``` assume "\z. z \ 0 \ poly cs z = 0" ``` wenzelm@60424 ` 617` ``` then have "poly (pCons c cs) x = poly (pCons c cs) y" for x y ``` wenzelm@60424 ` 618` ``` by (cases "x = 0") auto ``` wenzelm@60557 ` 619` ``` with pCons.prems show False ``` wenzelm@56778 ` 620` ``` by (auto simp add: constant_def) ``` wenzelm@60557 ` 621` ``` qed ``` wenzelm@60557 ` 622` ``` from poly_decompose_lemma[OF this] ``` huffman@30488 ` 623` ``` show ?case ``` huffman@29464 ` 624` ``` apply clarsimp ``` chaieb@26123 ` 625` ``` apply (rule_tac x="k+1" in exI) ``` chaieb@26123 ` 626` ``` apply (rule_tac x="a" in exI) ``` chaieb@26123 ` 627` ``` apply simp ``` chaieb@26123 ` 628` ``` apply (rule_tac x="q" in exI) ``` huffman@29538 ` 629` ``` apply (auto simp add: psize_def split: if_splits) ``` chaieb@26123 ` 630` ``` done ``` chaieb@26123 ` 631` ```qed ``` chaieb@26123 ` 632` wenzelm@60424 ` 633` ```text \Fundamental theorem of algebra\ ``` chaieb@26123 ` 634` chaieb@26123 ` 635` ```lemma fundamental_theorem_of_algebra: ``` wenzelm@56776 ` 636` ``` assumes nc: "\ constant (poly p)" ``` chaieb@26123 ` 637` ``` shows "\z::complex. poly p z = 0" ``` wenzelm@56776 ` 638` ``` using nc ``` wenzelm@56776 ` 639` ```proof (induct "psize p" arbitrary: p rule: less_induct) ``` berghofe@34915 ` 640` ``` case less ``` chaieb@26123 ` 641` ``` let ?p = "poly p" ``` chaieb@26123 ` 642` ``` let ?ths = "\z. ?p z = 0" ``` chaieb@26123 ` 643` berghofe@34915 ` 644` ``` from nonconstant_length[OF less(2)] have n2: "psize p \ 2" . ``` wenzelm@56776 ` 645` ``` from poly_minimum_modulus obtain c where c: "\w. cmod (?p c) \ cmod (?p w)" ``` wenzelm@56776 ` 646` ``` by blast ``` wenzelm@56778 ` 647` wenzelm@56778 ` 648` ``` show ?ths ``` wenzelm@56778 ` 649` ``` proof (cases "?p c = 0") ``` wenzelm@56778 ` 650` ``` case True ``` wenzelm@56778 ` 651` ``` then show ?thesis by blast ``` wenzelm@56778 ` 652` ``` next ``` wenzelm@56778 ` 653` ``` case False ``` wenzelm@56778 ` 654` ``` from poly_offset[of p c] obtain q where q: "psize q = psize p" "\x. poly q x = ?p (c + x)" ``` wenzelm@56778 ` 655` ``` by blast ``` wenzelm@60424 ` 656` ``` have False if h: "constant (poly q)" ``` wenzelm@60424 ` 657` ``` proof - ``` wenzelm@56795 ` 658` ``` from q(2) have th: "\x. poly q (x - c) = ?p x" ``` wenzelm@56795 ` 659` ``` by auto ``` wenzelm@60424 ` 660` ``` have "?p x = ?p y" for x y ``` wenzelm@60424 ` 661` ``` proof - ``` wenzelm@56795 ` 662` ``` from th have "?p x = poly q (x - c)" ``` wenzelm@56795 ` 663` ``` by auto ``` wenzelm@32960 ` 664` ``` also have "\ = poly q (y - c)" ``` wenzelm@32960 ` 665` ``` using h unfolding constant_def by blast ``` wenzelm@56795 ` 666` ``` also have "\ = ?p y" ``` wenzelm@56795 ` 667` ``` using th by auto ``` wenzelm@60424 ` 668` ``` finally show ?thesis . ``` wenzelm@60424 ` 669` ``` qed ``` wenzelm@60424 ` 670` ``` with less(2) show ?thesis ``` wenzelm@56778 ` 671` ``` unfolding constant_def by blast ``` wenzelm@60424 ` 672` ``` qed ``` wenzelm@56778 ` 673` ``` then have qnc: "\ constant (poly q)" ``` wenzelm@56778 ` 674` ``` by blast ``` wenzelm@56778 ` 675` ``` from q(2) have pqc0: "?p c = poly q 0" ``` wenzelm@56778 ` 676` ``` by simp ``` wenzelm@56778 ` 677` ``` from c pqc0 have cq0: "\w. cmod (poly q 0) \ cmod (?p w)" ``` wenzelm@56778 ` 678` ``` by simp ``` chaieb@26123 ` 679` ``` let ?a0 = "poly q 0" ``` wenzelm@60424 ` 680` ``` from False pqc0 have a00: "?a0 \ 0" ``` wenzelm@56778 ` 681` ``` by simp ``` wenzelm@56778 ` 682` ``` from a00 have qr: "\z. poly q z = poly (smult (inverse ?a0) q) z * ?a0" ``` huffman@29464 ` 683` ``` by simp ``` huffman@29464 ` 684` ``` let ?r = "smult (inverse ?a0) q" ``` huffman@29538 ` 685` ``` have lgqr: "psize q = psize ?r" ``` wenzelm@56778 ` 686` ``` using a00 ``` wenzelm@56778 ` 687` ``` unfolding psize_def degree_def ``` haftmann@52380 ` 688` ``` by (simp add: poly_eq_iff) ``` wenzelm@60424 ` 689` ``` have False if h: "\x y. poly ?r x = poly ?r y" ``` wenzelm@60424 ` 690` ``` proof - ``` wenzelm@60557 ` 691` ``` have "poly q x = poly q y" for x y ``` wenzelm@60557 ` 692` ``` proof - ``` wenzelm@56778 ` 693` ``` from qr[rule_format, of x] have "poly q x = poly ?r x * ?a0" ``` wenzelm@56778 ` 694` ``` by auto ``` wenzelm@56778 ` 695` ``` also have "\ = poly ?r y * ?a0" ``` wenzelm@56778 ` 696` ``` using h by simp ``` wenzelm@56778 ` 697` ``` also have "\ = poly q y" ``` wenzelm@56778 ` 698` ``` using qr[rule_format, of y] by simp ``` wenzelm@60557 ` 699` ``` finally show ?thesis . ``` wenzelm@60557 ` 700` ``` qed ``` wenzelm@60424 ` 701` ``` with qnc show ?thesis ``` wenzelm@56795 ` 702` ``` unfolding constant_def by blast ``` wenzelm@60424 ` 703` ``` qed ``` wenzelm@56778 ` 704` ``` then have rnc: "\ constant (poly ?r)" ``` wenzelm@56778 ` 705` ``` unfolding constant_def by blast ``` wenzelm@56778 ` 706` ``` from qr[rule_format, of 0] a00 have r01: "poly ?r 0 = 1" ``` wenzelm@56778 ` 707` ``` by auto ``` wenzelm@60424 ` 708` ``` have mrmq_eq: "cmod (poly ?r w) < 1 \ cmod (poly q w) < cmod ?a0" for w ``` wenzelm@60424 ` 709` ``` proof - ``` chaieb@26123 ` 710` ``` have "cmod (poly ?r w) < 1 \ cmod (poly q w / ?a0) < 1" ``` haftmann@57514 ` 711` ``` using qr[rule_format, of w] a00 by (simp add: divide_inverse ac_simps) ``` chaieb@26123 ` 712` ``` also have "\ \ cmod (poly q w) < cmod ?a0" ``` wenzelm@32960 ` 713` ``` using a00 unfolding norm_divide by (simp add: field_simps) ``` wenzelm@60424 ` 714` ``` finally show ?thesis . ``` wenzelm@60424 ` 715` ``` qed ``` huffman@30488 ` 716` ``` from poly_decompose[OF rnc] obtain k a s where ``` wenzelm@56778 ` 717` ``` kas: "a \ 0" "k \ 0" "psize s + k + 1 = psize ?r" ``` wenzelm@56778 ` 718` ``` "\z. poly ?r z = poly ?r 0 + z^k* poly (pCons a s) z" by blast ``` wenzelm@60424 ` 719` ``` have "\w. cmod (poly ?r w) < 1" ``` wenzelm@60424 ` 720` ``` proof (cases "psize p = k + 1") ``` wenzelm@60424 ` 721` ``` case True ``` wenzelm@56778 ` 722` ``` with kas(3) lgqr[symmetric] q(1) have s0: "s = 0" ``` wenzelm@56778 ` 723` ``` by auto ``` wenzelm@60424 ` 724` ``` have hth[symmetric]: "cmod (poly ?r w) = cmod (1 + a * w ^ k)" for w ``` wenzelm@60424 ` 725` ``` using kas(4)[rule_format, of w] s0 r01 by (simp add: algebra_simps) ``` wenzelm@60424 ` 726` ``` from reduce_poly_simple[OF kas(1,2)] show ?thesis ``` wenzelm@56778 ` 727` ``` unfolding hth by blast ``` wenzelm@60424 ` 728` ``` next ``` wenzelm@60424 ` 729` ``` case False note kn = this ``` wenzelm@56778 ` 730` ``` from kn kas(3) q(1) lgqr have k1n: "k + 1 < psize p" ``` wenzelm@56778 ` 731` ``` by simp ``` huffman@30488 ` 732` ``` have th01: "\ constant (poly (pCons 1 (monom a (k - 1))))" ``` wenzelm@32960 ` 733` ``` unfolding constant_def poly_pCons poly_monom ``` wenzelm@56795 ` 734` ``` using kas(1) ``` wenzelm@56795 ` 735` ``` apply simp ``` wenzelm@56778 ` 736` ``` apply (rule exI[where x=0]) ``` wenzelm@56778 ` 737` ``` apply (rule exI[where x=1]) ``` wenzelm@56778 ` 738` ``` apply simp ``` wenzelm@56778 ` 739` ``` done ``` wenzelm@56778 ` 740` ``` from kas(1) kas(2) have th02: "k + 1 = psize (pCons 1 (monom a (k - 1)))" ``` wenzelm@32960 ` 741` ``` by (simp add: psize_def degree_monom_eq) ``` berghofe@34915 ` 742` ``` from less(1) [OF k1n [simplified th02] th01] ``` chaieb@26123 ` 743` ``` obtain w where w: "1 + w^k * a = 0" ``` wenzelm@32960 ` 744` ``` unfolding poly_pCons poly_monom ``` wenzelm@56778 ` 745` ``` using kas(2) by (cases k) (auto simp add: algebra_simps) ``` huffman@30488 ` 746` ``` from poly_bound_exists[of "cmod w" s] obtain m where ``` wenzelm@32960 ` 747` ``` m: "m > 0" "\z. cmod z \ cmod w \ cmod (poly s z) \ m" by blast ``` wenzelm@56795 ` 748` ``` have w0: "w \ 0" ``` wenzelm@56795 ` 749` ``` using kas(2) w by (auto simp add: power_0_left) ``` wenzelm@56778 ` 750` ``` from w have "(1 + w ^ k * a) - 1 = 0 - 1" ``` wenzelm@56778 ` 751` ``` by simp ``` wenzelm@56778 ` 752` ``` then have wm1: "w^k * a = - 1" ``` wenzelm@56778 ` 753` ``` by simp ``` huffman@30488 ` 754` ``` have inv0: "0 < inverse (cmod w ^ (k + 1) * m)" ``` wenzelm@32960 ` 755` ``` using norm_ge_zero[of w] w0 m(1) ``` wenzelm@56778 ` 756` ``` by (simp add: inverse_eq_divide zero_less_mult_iff) ``` lp15@55358 ` 757` ``` with real_lbound_gt_zero[OF zero_less_one] obtain t where ``` wenzelm@32960 ` 758` ``` t: "t > 0" "t < 1" "t < inverse (cmod w ^ (k + 1) * m)" by blast ``` chaieb@26123 ` 759` ``` let ?ct = "complex_of_real t" ``` chaieb@26123 ` 760` ``` let ?w = "?ct * w" ``` wenzelm@56778 ` 761` ``` have "1 + ?w^k * (a + ?w * poly s ?w) = 1 + ?ct^k * (w^k * a) + ?w^k * ?w * poly s ?w" ``` wenzelm@56778 ` 762` ``` using kas(1) by (simp add: algebra_simps power_mult_distrib) ``` chaieb@26123 ` 763` ``` also have "\ = complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w" ``` wenzelm@56778 ` 764` ``` unfolding wm1 by simp ``` wenzelm@56778 ` 765` ``` finally have "cmod (1 + ?w^k * (a + ?w * poly s ?w)) = ``` wenzelm@56778 ` 766` ``` cmod (complex_of_real (1 - t^k) + ?w^k * ?w * poly s ?w)" ``` lp15@55358 ` 767` ``` by metis ``` huffman@30488 ` 768` ``` with norm_triangle_ineq[of "complex_of_real (1 - t^k)" "?w^k * ?w * poly s ?w"] ``` wenzelm@56778 ` 769` ``` have th11: "cmod (1 + ?w^k * (a + ?w * poly s ?w)) \ \1 - t^k\ + cmod (?w^k * ?w * poly s ?w)" ``` wenzelm@56778 ` 770` ``` unfolding norm_of_real by simp ``` wenzelm@56778 ` 771` ``` have ath: "\x t::real. 0 \ x \ x < t \ t \ 1 \ \1 - t\ + x < 1" ``` wenzelm@56778 ` 772` ``` by arith ``` wenzelm@56778 ` 773` ``` have "t * cmod w \ 1 * cmod w" ``` wenzelm@56778 ` 774` ``` apply (rule mult_mono) ``` wenzelm@56778 ` 775` ``` using t(1,2) ``` wenzelm@56778 ` 776` ``` apply auto ``` wenzelm@56778 ` 777` ``` done ``` wenzelm@56778 ` 778` ``` then have tw: "cmod ?w \ cmod w" ``` wenzelm@56778 ` 779` ``` using t(1) by (simp add: norm_mult) ``` wenzelm@56778 ` 780` ``` from t inv0 have "t * (cmod w ^ (k + 1) * m) < 1" ``` wenzelm@57862 ` 781` ``` by (simp add: field_simps) ``` wenzelm@56778 ` 782` ``` with zero_less_power[OF t(1), of k] have th30: "t^k * (t* (cmod w ^ (k + 1) * m)) < t^k * 1" ``` haftmann@59557 ` 783` ``` by simp ``` wenzelm@56778 ` 784` ``` have "cmod (?w^k * ?w * poly s ?w) = t^k * (t* (cmod w ^ (k + 1) * cmod (poly s ?w)))" ``` wenzelm@56778 ` 785` ``` using w0 t(1) ``` wenzelm@51541 ` 786` ``` by (simp add: algebra_simps power_mult_distrib norm_power norm_mult) ``` chaieb@26123 ` 787` ``` then have "cmod (?w^k * ?w * poly s ?w) \ t^k * (t* (cmod w ^ (k + 1) * m))" ``` wenzelm@32960 ` 788` ``` using t(1,2) m(2)[rule_format, OF tw] w0 ``` lp15@55358 ` 789` ``` by auto ``` wenzelm@56778 ` 790` ``` with th30 have th120: "cmod (?w^k * ?w * poly s ?w) < t^k" ``` wenzelm@56778 ` 791` ``` by simp ``` huffman@30488 ` 792` ``` from power_strict_mono[OF t(2), of k] t(1) kas(2) have th121: "t^k \ 1" ``` wenzelm@32960 ` 793` ``` by auto ``` huffman@27514 ` 794` ``` from ath[OF norm_ge_zero[of "?w^k * ?w * poly s ?w"] th120 th121] ``` huffman@30488 ` 795` ``` have th12: "\1 - t^k\ + cmod (?w^k * ?w * poly s ?w) < 1" . ``` wenzelm@56778 ` 796` ``` from th11 th12 have "cmod (1 + ?w^k * (a + ?w * poly s ?w)) < 1" ``` wenzelm@56778 ` 797` ``` by arith ``` huffman@30488 ` 798` ``` then have "cmod (poly ?r ?w) < 1" ``` wenzelm@32960 ` 799` ``` unfolding kas(4)[rule_format, of ?w] r01 by simp ``` wenzelm@60424 ` 800` ``` then show ?thesis ``` wenzelm@56778 ` 801` ``` by blast ``` wenzelm@60424 ` 802` ``` qed ``` wenzelm@60424 ` 803` ``` with cq0 q(2) show ?thesis ``` wenzelm@56778 ` 804` ``` unfolding mrmq_eq not_less[symmetric] by auto ``` wenzelm@56778 ` 805` ``` qed ``` chaieb@26123 ` 806` ```qed ``` chaieb@26123 ` 807` wenzelm@60424 ` 808` ```text \Alternative version with a syntactic notion of constant polynomial.\ ``` chaieb@26123 ` 809` chaieb@26123 ` 810` ```lemma fundamental_theorem_of_algebra_alt: ``` wenzelm@56778 ` 811` ``` assumes nc: "\ (\a l. a \ 0 \ l = 0 \ p = pCons a l)" ``` chaieb@26123 ` 812` ``` shows "\z. poly p z = (0::complex)" ``` wenzelm@56778 ` 813` ``` using nc ``` wenzelm@56778 ` 814` ```proof (induct p) ``` wenzelm@56778 ` 815` ``` case 0 ``` wenzelm@56778 ` 816` ``` then show ?case by simp ``` wenzelm@56778 ` 817` ```next ``` huffman@29464 ` 818` ``` case (pCons c cs) ``` wenzelm@56778 ` 819` ``` show ?case ``` wenzelm@56778 ` 820` ``` proof (cases "c = 0") ``` wenzelm@56778 ` 821` ``` case True ``` wenzelm@56778 ` 822` ``` then show ?thesis by auto ``` wenzelm@56778 ` 823` ``` next ``` wenzelm@56778 ` 824` ``` case False ``` wenzelm@60557 ` 825` ``` have "\ constant (poly (pCons c cs))" ``` wenzelm@60557 ` 826` ``` proof ``` wenzelm@56778 ` 827` ``` assume nc: "constant (poly (pCons c cs))" ``` huffman@30488 ` 828` ``` from nc[unfolded constant_def, rule_format, of 0] ``` huffman@30488 ` 829` ``` have "\w. w \ 0 \ poly cs w = 0" by auto ``` wenzelm@56778 ` 830` ``` then have "cs = 0" ``` wenzelm@56778 ` 831` ``` proof (induct cs) ``` wenzelm@56778 ` 832` ``` case 0 ``` wenzelm@56778 ` 833` ``` then show ?case by simp ``` wenzelm@56778 ` 834` ``` next ``` wenzelm@56778 ` 835` ``` case (pCons d ds) ``` wenzelm@56778 ` 836` ``` show ?case ``` wenzelm@56778 ` 837` ``` proof (cases "d = 0") ``` wenzelm@56778 ` 838` ``` case True ``` wenzelm@60424 ` 839` ``` then show ?thesis ``` wenzelm@60424 ` 840` ``` using pCons.prems pCons.hyps by simp ``` wenzelm@56778 ` 841` ``` next ``` wenzelm@56778 ` 842` ``` case False ``` wenzelm@56778 ` 843` ``` from poly_bound_exists[of 1 ds] obtain m where ``` wenzelm@56778 ` 844` ``` m: "m > 0" "\z. \z. cmod z \ 1 \ cmod (poly ds z) \ m" by blast ``` wenzelm@56795 ` 845` ``` have dm: "cmod d / m > 0" ``` wenzelm@56795 ` 846` ``` using False m(1) by (simp add: field_simps) ``` wenzelm@60424 ` 847` ``` from real_lbound_gt_zero[OF dm zero_less_one] ``` wenzelm@60424 ` 848` ``` obtain x where x: "x > 0" "x < cmod d / m" "x < 1" ``` wenzelm@60424 ` 849` ``` by blast ``` wenzelm@56778 ` 850` ``` let ?x = "complex_of_real x" ``` wenzelm@60424 ` 851` ``` from x have cx: "?x \ 0" "cmod ?x \ 1" ``` wenzelm@56795 ` 852` ``` by simp_all ``` wenzelm@56778 ` 853` ``` from pCons.prems[rule_format, OF cx(1)] ``` wenzelm@56795 ` 854` ``` have cth: "cmod (?x*poly ds ?x) = cmod d" ``` wenzelm@56795 ` 855` ``` by (simp add: eq_diff_eq[symmetric]) ``` wenzelm@56778 ` 856` ``` from m(2)[rule_format, OF cx(2)] x(1) ``` wenzelm@56778 ` 857` ``` have th0: "cmod (?x*poly ds ?x) \ x*m" ``` wenzelm@56778 ` 858` ``` by (simp add: norm_mult) ``` wenzelm@56795 ` 859` ``` from x(2) m(1) have "x * m < cmod d" ``` wenzelm@56795 ` 860` ``` by (simp add: field_simps) ``` wenzelm@56795 ` 861` ``` with th0 have "cmod (?x*poly ds ?x) \ cmod d" ``` wenzelm@56795 ` 862` ``` by auto ``` wenzelm@56795 ` 863` ``` with cth show ?thesis ``` wenzelm@56795 ` 864` ``` by blast ``` wenzelm@56778 ` 865` ``` qed ``` wenzelm@56778 ` 866` ``` qed ``` wenzelm@60557 ` 867` ``` then show False ``` wenzelm@60557 ` 868` ``` using pCons.prems False by blast ``` wenzelm@60557 ` 869` ``` qed ``` wenzelm@60557 ` 870` ``` then show ?thesis ``` wenzelm@60557 ` 871` ``` by (rule fundamental_theorem_of_algebra) ``` wenzelm@56778 ` 872` ``` qed ``` wenzelm@56778 ` 873` ```qed ``` chaieb@26123 ` 874` huffman@29464 ` 875` wenzelm@60424 ` 876` ```subsection \Nullstellensatz, degrees and divisibility of polynomials\ ``` chaieb@26123 ` 877` chaieb@26123 ` 878` ```lemma nullstellensatz_lemma: ``` huffman@29464 ` 879` ``` fixes p :: "complex poly" ``` chaieb@26123 ` 880` ``` assumes "\x. poly p x = 0 \ poly q x = 0" ``` wenzelm@56776 ` 881` ``` and "degree p = n" ``` wenzelm@56776 ` 882` ``` and "n \ 0" ``` huffman@29464 ` 883` ``` shows "p dvd (q ^ n)" ``` wenzelm@56776 ` 884` ``` using assms ``` wenzelm@56776 ` 885` ```proof (induct n arbitrary: p q rule: nat_less_induct) ``` wenzelm@56776 ` 886` ``` fix n :: nat ``` wenzelm@56776 ` 887` ``` fix p q :: "complex poly" ``` chaieb@26123 ` 888` ``` assume IH: "\mp q. ``` chaieb@26123 ` 889` ``` (\x. poly p x = (0::complex) \ poly q x = 0) \ ``` huffman@29464 ` 890` ``` degree p = m \ m \ 0 \ p dvd (q ^ m)" ``` huffman@30488 ` 891` ``` and pq0: "\x. poly p x = 0 \ poly q x = 0" ``` wenzelm@56778 ` 892` ``` and dpn: "degree p = n" ``` wenzelm@56778 ` 893` ``` and n0: "n \ 0" ``` huffman@29464 ` 894` ``` from dpn n0 have pne: "p \ 0" by auto ``` wenzelm@60557 ` 895` ``` show "p dvd (q ^ n)" ``` wenzelm@60557 ` 896` ``` proof (cases "\a. poly p a = 0") ``` wenzelm@60557 ` 897` ``` case True ``` wenzelm@60557 ` 898` ``` then obtain a where a: "poly p a = 0" .. ``` wenzelm@60557 ` 899` ``` have ?thesis if oa: "order a p \ 0" ``` wenzelm@60424 ` 900` ``` proof - ``` chaieb@26123 ` 901` ``` let ?op = "order a p" ``` wenzelm@56778 ` 902` ``` from pne have ap: "([:- a, 1:] ^ ?op) dvd p" "\ [:- a, 1:] ^ (Suc ?op) dvd p" ``` wenzelm@56778 ` 903` ``` using order by blast+ ``` huffman@29464 ` 904` ``` note oop = order_degree[OF pne, unfolded dpn] ``` wenzelm@60424 ` 905` ``` show ?thesis ``` wenzelm@60424 ` 906` ``` proof (cases "q = 0") ``` wenzelm@60424 ` 907` ``` case True ``` wenzelm@60424 ` 908` ``` with n0 show ?thesis by (simp add: power_0_left) ``` wenzelm@60424 ` 909` ``` next ``` wenzelm@60424 ` 910` ``` case False ``` wenzelm@32960 ` 911` ``` from pq0[rule_format, OF a, unfolded poly_eq_0_iff_dvd] ``` wenzelm@32960 ` 912` ``` obtain r where r: "q = [:- a, 1:] * r" by (rule dvdE) ``` wenzelm@56778 ` 913` ``` from ap(1) obtain s where s: "p = [:- a, 1:] ^ ?op * s" ``` wenzelm@56778 ` 914` ``` by (rule dvdE) ``` wenzelm@60424 ` 915` ``` have sne: "s \ 0" ``` wenzelm@60424 ` 916` ``` using s pne by auto ``` wenzelm@60424 ` 917` ``` show ?thesis ``` wenzelm@60424 ` 918` ``` proof (cases "degree s = 0") ``` wenzelm@60424 ` 919` ``` case True ``` wenzelm@60424 ` 920` ``` then obtain k where kpn: "s = [:k:]" ``` wenzelm@51541 ` 921` ``` by (cases s) (auto split: if_splits) ``` huffman@29464 ` 922` ``` from sne kpn have k: "k \ 0" by simp ``` wenzelm@32960 ` 923` ``` let ?w = "([:1/k:] * ([:-a,1:] ^ (n - ?op))) * (r ^ n)" ``` lp15@55358 ` 924` ``` have "q ^ n = p * ?w" ``` wenzelm@56795 ` 925` ``` apply (subst r) ``` wenzelm@56795 ` 926` ``` apply (subst s) ``` wenzelm@56795 ` 927` ``` apply (subst kpn) ``` wenzelm@56778 ` 928` ``` using k oop [of a] ``` wenzelm@56795 ` 929` ``` apply (subst power_mult_distrib) ``` wenzelm@56795 ` 930` ``` apply simp ``` wenzelm@56795 ` 931` ``` apply (subst power_add [symmetric]) ``` wenzelm@56795 ` 932` ``` apply simp ``` huffman@29464 ` 933` ``` done ``` wenzelm@60424 ` 934` ``` then show ?thesis ``` wenzelm@56795 ` 935` ``` unfolding dvd_def by blast ``` wenzelm@60424 ` 936` ``` next ``` wenzelm@60424 ` 937` ``` case False ``` wenzelm@60424 ` 938` ``` with sne dpn s oa have dsn: "degree s < n" ``` wenzelm@60557 ` 939` ``` apply auto ``` wenzelm@60557 ` 940` ``` apply (erule ssubst) ``` wenzelm@60557 ` 941` ``` apply (simp add: degree_mult_eq degree_linear_power) ``` wenzelm@60557 ` 942` ``` done ``` wenzelm@60557 ` 943` ``` have "poly r x = 0" if h: "poly s x = 0" for x ``` wenzelm@60557 ` 944` ``` proof - ``` wenzelm@60557 ` 945` ``` have xa: "x \ a" ``` wenzelm@60557 ` 946` ``` proof ``` wenzelm@60557 ` 947` ``` assume "x = a" ``` wenzelm@60557 ` 948` ``` from h[unfolded this poly_eq_0_iff_dvd] obtain u where u: "s = [:- a, 1:] * u" ``` wenzelm@60557 ` 949` ``` by (rule dvdE) ``` wenzelm@60557 ` 950` ``` have "p = [:- a, 1:] ^ (Suc ?op) * u" ``` wenzelm@60557 ` 951` ``` apply (subst s) ``` wenzelm@60557 ` 952` ``` apply (subst u) ``` wenzelm@60557 ` 953` ``` apply (simp only: power_Suc ac_simps) ``` wenzelm@60557 ` 954` ``` done ``` wenzelm@60557 ` 955` ``` with ap(2)[unfolded dvd_def] show False ``` wenzelm@56795 ` 956` ``` by blast ``` wenzelm@60557 ` 957` ``` qed ``` wenzelm@60557 ` 958` ``` from h have "poly p x = 0" ``` wenzelm@60557 ` 959` ``` by (subst s) simp ``` wenzelm@60557 ` 960` ``` with pq0 have "poly q x = 0" ``` wenzelm@56795 ` 961` ``` by blast ``` wenzelm@60557 ` 962` ``` with r xa show ?thesis ``` wenzelm@60557 ` 963` ``` by auto ``` wenzelm@60557 ` 964` ``` qed ``` wenzelm@60557 ` 965` ``` with IH[rule_format, OF dsn, of s r] False have "s dvd (r ^ (degree s))" ``` wenzelm@60557 ` 966` ``` by blast ``` wenzelm@60557 ` 967` ``` then obtain u where u: "r ^ (degree s) = s * u" .. ``` wenzelm@60557 ` 968` ``` then have u': "\x. poly s x * poly u x = poly r x ^ degree s" ``` wenzelm@60557 ` 969` ``` by (simp only: poly_mult[symmetric] poly_power[symmetric]) ``` wenzelm@60557 ` 970` ``` let ?w = "(u * ([:-a,1:] ^ (n - ?op))) * (r ^ (n - degree s))" ``` wenzelm@60557 ` 971` ``` from oop[of a] dsn have "q ^ n = p * ?w" ``` wenzelm@60557 ` 972` ``` apply - ``` wenzelm@60557 ` 973` ``` apply (subst s) ``` wenzelm@60557 ` 974` ``` apply (subst r) ``` wenzelm@60557 ` 975` ``` apply (simp only: power_mult_distrib) ``` wenzelm@60557 ` 976` ``` apply (subst mult.assoc [where b=s]) ``` wenzelm@60557 ` 977` ``` apply (subst mult.assoc [where a=u]) ``` wenzelm@60557 ` 978` ``` apply (subst mult.assoc [where b=u, symmetric]) ``` wenzelm@60557 ` 979` ``` apply (subst u [symmetric]) ``` wenzelm@60557 ` 980` ``` apply (simp add: ac_simps power_add [symmetric]) ``` wenzelm@60557 ` 981` ``` done ``` wenzelm@60557 ` 982` ``` then show ?thesis ``` wenzelm@60557 ` 983` ``` unfolding dvd_def by blast ``` wenzelm@60424 ` 984` ``` qed ``` wenzelm@60424 ` 985` ``` qed ``` wenzelm@60424 ` 986` ``` qed ``` wenzelm@60557 ` 987` ``` then show ?thesis ``` wenzelm@60557 ` 988` ``` using a order_root pne by blast ``` wenzelm@60557 ` 989` ``` next ``` wenzelm@60557 ` 990` ``` case False ``` wenzelm@60557 ` 991` ``` with fundamental_theorem_of_algebra_alt[of p] ``` wenzelm@56778 ` 992` ``` obtain c where ccs: "c \ 0" "p = pCons c 0" ``` wenzelm@56778 ` 993` ``` by blast ``` wenzelm@60557 ` 994` ``` then have pp: "poly p x = c" for x ``` wenzelm@56778 ` 995` ``` by simp ``` huffman@29464 ` 996` ``` let ?w = "[:1/c:] * (q ^ n)" ``` wenzelm@56778 ` 997` ``` from ccs have "(q ^ n) = (p * ?w)" ``` wenzelm@56778 ` 998` ``` by simp ``` wenzelm@60557 ` 999` ``` then show ?thesis ``` wenzelm@56778 ` 1000` ``` unfolding dvd_def by blast ``` wenzelm@60557 ` 1001` ``` qed ``` chaieb@26123 ` 1002` ```qed ``` chaieb@26123 ` 1003` chaieb@26123 ` 1004` ```lemma nullstellensatz_univariate: ``` huffman@30488 ` 1005` ``` "(\x. poly p x = (0::complex) \ poly q x = 0) \ ``` huffman@29464 ` 1006` ``` p dvd (q ^ (degree p)) \ (p = 0 \ q = 0)" ``` wenzelm@56776 ` 1007` ```proof - ``` wenzelm@60457 ` 1008` ``` consider "p = 0" | "p \ 0" "degree p = 0" | n where "p \ 0" "degree p = Suc n" ``` wenzelm@60457 ` 1009` ``` by (cases "degree p") auto ``` wenzelm@60457 ` 1010` ``` then show ?thesis ``` wenzelm@60457 ` 1011` ``` proof cases ``` wenzelm@60567 ` 1012` ``` case p: 1 ``` wenzelm@56778 ` 1013` ``` then have eq: "(\x. poly p x = (0::complex) \ poly q x = 0) \ q = 0" ``` haftmann@52380 ` 1014` ``` by (auto simp add: poly_all_0_iff_0) ``` wenzelm@56778 ` 1015` ``` { ``` wenzelm@56778 ` 1016` ``` assume "p dvd (q ^ (degree p))" ``` huffman@29464 ` 1017` ``` then obtain r where r: "q ^ (degree p) = p * r" .. ``` wenzelm@60567 ` 1018` ``` from r p have False by simp ``` wenzelm@56778 ` 1019` ``` } ``` wenzelm@60567 ` 1020` ``` with eq p show ?thesis by blast ``` wenzelm@60424 ` 1021` ``` next ``` wenzelm@60567 ` 1022` ``` case dp: 2 ``` wenzelm@60457 ` 1023` ``` then obtain k where k: "p = [:k:]" "k \ 0" ``` wenzelm@60457 ` 1024` ``` by (cases p) (simp split: if_splits) ``` wenzelm@60457 ` 1025` ``` then have th1: "\x. poly p x \ 0" ``` wenzelm@60457 ` 1026` ``` by simp ``` wenzelm@60567 ` 1027` ``` from k dp(2) have "q ^ (degree p) = p * [:1/k:]" ``` haftmann@65486 ` 1028` ``` by simp ``` wenzelm@60457 ` 1029` ``` then have th2: "p dvd (q ^ (degree p))" .. ``` wenzelm@60567 ` 1030` ``` from dp(1) th1 th2 show ?thesis ``` wenzelm@60457 ` 1031` ``` by blast ``` wenzelm@60457 ` 1032` ``` next ``` wenzelm@60567 ` 1033` ``` case dp: 3 ``` wenzelm@60557 ` 1034` ``` have False if dvd: "p dvd (q ^ (Suc n))" and h: "poly p x = 0" "poly q x \ 0" for x ``` wenzelm@60557 ` 1035` ``` proof - ``` wenzelm@60557 ` 1036` ``` from dvd obtain u where u: "q ^ (Suc n) = p * u" .. ``` wenzelm@60557 ` 1037` ``` from h have "poly (q ^ (Suc n)) x \ 0" ``` wenzelm@56778 ` 1038` ``` by simp ``` wenzelm@60557 ` 1039` ``` with u h(1) show ?thesis ``` wenzelm@60457 ` 1040` ``` by (simp only: poly_mult) simp ``` wenzelm@60557 ` 1041` ``` qed ``` wenzelm@60567 ` 1042` ``` with dp nullstellensatz_lemma[of p q "degree p"] show ?thesis ``` wenzelm@60567 ` 1043` ``` by auto ``` wenzelm@60424 ` 1044` ``` qed ``` chaieb@26123 ` 1045` ```qed ``` chaieb@26123 ` 1046` wenzelm@60424 ` 1047` ```text \Useful lemma\ ``` huffman@29464 ` 1048` ```lemma constant_degree: ``` huffman@29464 ` 1049` ``` fixes p :: "'a::{idom,ring_char_0} poly" ``` huffman@29464 ` 1050` ``` shows "constant (poly p) \ degree p = 0" (is "?lhs = ?rhs") ``` chaieb@26123 ` 1051` ```proof ``` wenzelm@60557 ` 1052` ``` show ?rhs if ?lhs ``` wenzelm@60557 ` 1053` ``` proof - ``` wenzelm@60557 ` 1054` ``` from that[unfolded constant_def, rule_format, of _ "0"] ``` wenzelm@60557 ` 1055` ``` have th: "poly p = poly [:poly p 0:]" ``` wenzelm@60557 ` 1056` ``` by auto ``` wenzelm@60557 ` 1057` ``` then have "p = [:poly p 0:]" ``` wenzelm@60557 ` 1058` ``` by (simp add: poly_eq_poly_eq_iff) ``` wenzelm@60557 ` 1059` ``` then have "degree p = degree [:poly p 0:]" ``` wenzelm@60557 ` 1060` ``` by simp ``` wenzelm@60557 ` 1061` ``` then show ?thesis ``` wenzelm@60557 ` 1062` ``` by simp ``` wenzelm@60557 ` 1063` ``` qed ``` wenzelm@60557 ` 1064` ``` show ?lhs if ?rhs ``` wenzelm@60557 ` 1065` ``` proof - ``` wenzelm@60557 ` 1066` ``` from that obtain k where "p = [:k:]" ``` wenzelm@60557 ` 1067` ``` by (cases p) (simp split: if_splits) ``` wenzelm@60557 ` 1068` ``` then show ?thesis ``` wenzelm@60557 ` 1069` ``` unfolding constant_def by auto ``` wenzelm@60557 ` 1070` ``` qed ``` chaieb@26123 ` 1071` ```qed ``` chaieb@26123 ` 1072` wenzelm@60424 ` 1073` ```text \Arithmetic operations on multivariate polynomials.\ ``` chaieb@26123 ` 1074` huffman@30488 ` 1075` ```lemma mpoly_base_conv: ``` wenzelm@56778 ` 1076` ``` fixes x :: "'a::comm_ring_1" ``` lp15@55735 ` 1077` ``` shows "0 = poly 0 x" "c = poly [:c:] x" "x = poly [:0,1:] x" ``` lp15@55735 ` 1078` ``` by simp_all ``` chaieb@26123 ` 1079` huffman@30488 ` 1080` ```lemma mpoly_norm_conv: ``` wenzelm@56778 ` 1081` ``` fixes x :: "'a::comm_ring_1" ``` wenzelm@56776 ` 1082` ``` shows "poly [:0:] x = poly 0 x" "poly [:poly 0 y:] x = poly 0 x" ``` wenzelm@56776 ` 1083` ``` by simp_all ``` chaieb@26123 ` 1084` huffman@30488 ` 1085` ```lemma mpoly_sub_conv: ``` wenzelm@56778 ` 1086` ``` fixes x :: "'a::comm_ring_1" ``` lp15@55735 ` 1087` ``` shows "poly p x - poly q x = poly p x + -1 * poly q x" ``` haftmann@54230 ` 1088` ``` by simp ``` chaieb@26123 ` 1089` wenzelm@56778 ` 1090` ```lemma poly_pad_rule: "poly p x = 0 \ poly (pCons 0 p) x = 0" ``` wenzelm@56778 ` 1091` ``` by simp ``` chaieb@26123 ` 1092` lp15@55735 ` 1093` ```lemma poly_cancel_eq_conv: ``` wenzelm@56778 ` 1094` ``` fixes x :: "'a::field" ``` wenzelm@56795 ` 1095` ``` shows "x = 0 \ a \ 0 \ y = 0 \ a * y - b * x = 0" ``` lp15@55735 ` 1096` ``` by auto ``` chaieb@26123 ` 1097` huffman@30488 ` 1098` ```lemma poly_divides_pad_rule: ``` wenzelm@56778 ` 1099` ``` fixes p:: "('a::comm_ring_1) poly" ``` huffman@29464 ` 1100` ``` assumes pq: "p dvd q" ``` wenzelm@56778 ` 1101` ``` shows "p dvd (pCons 0 q)" ``` wenzelm@56778 ` 1102` ```proof - ``` huffman@29464 ` 1103` ``` have "pCons 0 q = q * [:0,1:]" by simp ``` huffman@29464 ` 1104` ``` then have "q dvd (pCons 0 q)" .. ``` huffman@29464 ` 1105` ``` with pq show ?thesis by (rule dvd_trans) ``` chaieb@26123 ` 1106` ```qed ``` chaieb@26123 ` 1107` huffman@30488 ` 1108` ```lemma poly_divides_conv0: ``` wenzelm@56778 ` 1109` ``` fixes p:: "'a::field poly" ``` wenzelm@56776 ` 1110` ``` assumes lgpq: "degree q < degree p" ``` wenzelm@56776 ` 1111` ``` and lq: "p \ 0" ``` wenzelm@56776 ` 1112` ``` shows "p dvd q \ q = 0" (is "?lhs \ ?rhs") ``` wenzelm@56776 ` 1113` ```proof ``` wenzelm@60557 ` 1114` ``` assume ?rhs ``` wenzelm@56776 ` 1115` ``` then have "q = p * 0" by simp ``` wenzelm@56776 ` 1116` ``` then show ?lhs .. ``` wenzelm@56776 ` 1117` ```next ``` wenzelm@56776 ` 1118` ``` assume l: ?lhs ``` wenzelm@56778 ` 1119` ``` show ?rhs ``` wenzelm@56778 ` 1120` ``` proof (cases "q = 0") ``` wenzelm@56778 ` 1121` ``` case True ``` wenzelm@56778 ` 1122` ``` then show ?thesis by simp ``` wenzelm@56778 ` 1123` ``` next ``` wenzelm@56776 ` 1124` ``` assume q0: "q \ 0" ``` wenzelm@56776 ` 1125` ``` from l q0 have "degree p \ degree q" ``` wenzelm@56776 ` 1126` ``` by (rule dvd_imp_degree_le) ``` wenzelm@56778 ` 1127` ``` with lgpq show ?thesis by simp ``` wenzelm@56778 ` 1128` ``` qed ``` chaieb@26123 ` 1129` ```qed ``` chaieb@26123 ` 1130` huffman@30488 ` 1131` ```lemma poly_divides_conv1: ``` wenzelm@56778 ` 1132` ``` fixes p :: "'a::field poly" ``` wenzelm@56776 ` 1133` ``` assumes a0: "a \ 0" ``` wenzelm@56776 ` 1134` ``` and pp': "p dvd p'" ``` wenzelm@56776 ` 1135` ``` and qrp': "smult a q - p' = r" ``` wenzelm@56776 ` 1136` ``` shows "p dvd q \ p dvd r" (is "?lhs \ ?rhs") ``` wenzelm@56776 ` 1137` ```proof ``` huffman@29464 ` 1138` ``` from pp' obtain t where t: "p' = p * t" .. ``` wenzelm@60557 ` 1139` ``` show ?rhs if ?lhs ``` wenzelm@60557 ` 1140` ``` proof - ``` wenzelm@60557 ` 1141` ``` from that obtain u where u: "q = p * u" .. ``` wenzelm@56776 ` 1142` ``` have "r = p * (smult a u - t)" ``` wenzelm@56776 ` 1143` ``` using u qrp' [symmetric] t by (simp add: algebra_simps) ``` wenzelm@60557 ` 1144` ``` then show ?thesis .. ``` wenzelm@60557 ` 1145` ``` qed ``` wenzelm@60557 ` 1146` ``` show ?lhs if ?rhs ``` wenzelm@60557 ` 1147` ``` proof - ``` wenzelm@60557 ` 1148` ``` from that obtain u where u: "r = p * u" .. ``` huffman@29464 ` 1149` ``` from u [symmetric] t qrp' [symmetric] a0 ``` wenzelm@60557 ` 1150` ``` have "q = p * smult (1/a) (u + t)" ``` wenzelm@60557 ` 1151` ``` by (simp add: algebra_simps) ``` wenzelm@60557 ` 1152` ``` then show ?thesis .. ``` wenzelm@60557 ` 1153` ``` qed ``` chaieb@26123 ` 1154` ```qed ``` chaieb@26123 ` 1155` chaieb@26123 ` 1156` ```lemma basic_cqe_conv1: ``` lp15@55358 ` 1157` ``` "(\x. poly p x = 0 \ poly 0 x \ 0) \ False" ``` lp15@55358 ` 1158` ``` "(\x. poly 0 x \ 0) \ False" ``` wenzelm@56776 ` 1159` ``` "(\x. poly [:c:] x \ 0) \ c \ 0" ``` lp15@55358 ` 1160` ``` "(\x. poly 0 x = 0) \ True" ``` wenzelm@56776 ` 1161` ``` "(\x. poly [:c:] x = 0) \ c = 0" ``` wenzelm@56776 ` 1162` ``` by simp_all ``` chaieb@26123 ` 1163` huffman@30488 ` 1164` ```lemma basic_cqe_conv2: ``` wenzelm@56795 ` 1165` ``` assumes l: "p \ 0" ``` wenzelm@56795 ` 1166` ``` shows "\x. poly (pCons a (pCons b p)) x = (0::complex)" ``` wenzelm@56776 ` 1167` ```proof - ``` wenzelm@60424 ` 1168` ``` have False if "h \ 0" "t = 0" and "pCons a (pCons b p) = pCons h t" for h t ``` wenzelm@60449 ` 1169` ``` using l that by simp ``` wenzelm@56776 ` 1170` ``` then have th: "\ (\ h t. h \ 0 \ t = 0 \ pCons a (pCons b p) = pCons h t)" ``` chaieb@26123 ` 1171` ``` by blast ``` wenzelm@56776 ` 1172` ``` from fundamental_theorem_of_algebra_alt[OF th] show ?thesis ``` wenzelm@56776 ` 1173` ``` by auto ``` chaieb@26123 ` 1174` ```qed ``` chaieb@26123 ` 1175` wenzelm@56776 ` 1176` ```lemma basic_cqe_conv_2b: "(\x. poly p x \ (0::complex)) \ p \ 0" ``` wenzelm@56776 ` 1177` ``` by (metis poly_all_0_iff_0) ``` chaieb@26123 ` 1178` chaieb@26123 ` 1179` ```lemma basic_cqe_conv3: ``` huffman@29464 ` 1180` ``` fixes p q :: "complex poly" ``` huffman@30488 ` 1181` ``` assumes l: "p \ 0" ``` wenzelm@56795 ` 1182` ``` shows "(\x. poly (pCons a p) x = 0 \ poly q x \ 0) \ \ (pCons a p) dvd (q ^ psize p)" ``` lp15@55358 ` 1183` ```proof - ``` wenzelm@56776 ` 1184` ``` from l have dp: "degree (pCons a p) = psize p" ``` wenzelm@56776 ` 1185` ``` by (simp add: psize_def) ``` huffman@29464 ` 1186` ``` from nullstellensatz_univariate[of "pCons a p" q] l ``` lp15@55358 ` 1187` ``` show ?thesis ``` lp15@55358 ` 1188` ``` by (metis dp pCons_eq_0_iff) ``` chaieb@26123 ` 1189` ```qed ``` chaieb@26123 ` 1190` chaieb@26123 ` 1191` ```lemma basic_cqe_conv4: ``` huffman@29464 ` 1192` ``` fixes p q :: "complex poly" ``` lp15@55358 ` 1193` ``` assumes h: "\x. poly (q ^ n) x = poly r x" ``` lp15@55358 ` 1194` ``` shows "p dvd (q ^ n) \ p dvd r" ``` wenzelm@56776 ` 1195` ```proof - ``` wenzelm@56776 ` 1196` ``` from h have "poly (q ^ n) = poly r" ``` wenzelm@56776 ` 1197` ``` by auto ``` wenzelm@56776 ` 1198` ``` then have "(q ^ n) = r" ``` wenzelm@56776 ` 1199` ``` by (simp add: poly_eq_poly_eq_iff) ``` wenzelm@56776 ` 1200` ``` then show "p dvd (q ^ n) \ p dvd r" ``` wenzelm@56776 ` 1201` ``` by simp ``` chaieb@26123 ` 1202` ```qed ``` chaieb@26123 ` 1203` lp15@55735 ` 1204` ```lemma poly_const_conv: ``` wenzelm@56778 ` 1205` ``` fixes x :: "'a::comm_ring_1" ``` wenzelm@56776 ` 1206` ``` shows "poly [:c:] x = y \ c = y" ``` wenzelm@56776 ` 1207` ``` by simp ``` chaieb@26123 ` 1208` huffman@29464 ` 1209` ```end ```