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