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