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