1 (* Author: John Harrison and Valentina Bruno |
1 (* Author: John Harrison and Valentina Bruno |
2 Ported from "hol_light/Multivariate/complexes.ml" by L C Paulson |
2 Ported from "hol_light/Multivariate/complexes.ml" by L C Paulson |
3 *) |
3 *) |
4 |
4 |
5 section \<open>polynomial functions: extremal behaviour and root counts\<close> |
5 section%important \<open>polynomial functions: extremal behaviour and root counts\<close> |
6 |
6 |
7 theory Poly_Roots |
7 theory Poly_Roots |
8 imports Complex_Main |
8 imports Complex_Main |
9 begin |
9 begin |
10 |
10 |
11 subsection\<open>Basics about polynomial functions: extremal behaviour and root counts\<close> |
11 subsection%important\<open>Basics about polynomial functions: extremal behaviour and root counts\<close> |
12 |
12 |
13 lemma sub_polyfun: |
13 lemma%important sub_polyfun: |
14 fixes x :: "'a::{comm_ring,monoid_mult}" |
14 fixes x :: "'a::{comm_ring,monoid_mult}" |
15 shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
15 shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
16 (x - y) * (\<Sum>j<n. \<Sum>k= Suc j..n. a k * y^(k - Suc j) * x^j)" |
16 (x - y) * (\<Sum>j<n. \<Sum>k= Suc j..n. a k * y^(k - Suc j) * x^j)" |
17 proof - |
17 proof%unimportant - |
18 have "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
18 have "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
19 (\<Sum>i\<le>n. a i * (x^i - y^i))" |
19 (\<Sum>i\<le>n. a i * (x^i - y^i))" |
20 by (simp add: algebra_simps sum_subtractf [symmetric]) |
20 by (simp add: algebra_simps sum_subtractf [symmetric]) |
21 also have "... = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))" |
21 also have "... = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))" |
22 by (simp add: power_diff_sumr2 ac_simps) |
22 by (simp add: power_diff_sumr2 ac_simps) |
25 also have "... = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - Suc j) * x^j))" |
25 also have "... = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - Suc j) * x^j))" |
26 by (simp add: nested_sum_swap') |
26 by (simp add: nested_sum_swap') |
27 finally show ?thesis . |
27 finally show ?thesis . |
28 qed |
28 qed |
29 |
29 |
30 lemma sub_polyfun_alt: |
30 lemma%unimportant sub_polyfun_alt: |
31 fixes x :: "'a::{comm_ring,monoid_mult}" |
31 fixes x :: "'a::{comm_ring,monoid_mult}" |
32 shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
32 shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = |
33 (x - y) * (\<Sum>j<n. \<Sum>k<n-j. a (j+k+1) * y^k * x^j)" |
33 (x - y) * (\<Sum>j<n. \<Sum>k<n-j. a (j+k+1) * y^k * x^j)" |
34 proof - |
34 proof - |
35 { fix j |
35 { fix j |
38 by (rule sum.reindex_bij_witness[where i="\<lambda>i. i + Suc j" and j="\<lambda>i. i - Suc j"]) auto } |
38 by (rule sum.reindex_bij_witness[where i="\<lambda>i. i + Suc j" and j="\<lambda>i. i - Suc j"]) auto } |
39 then show ?thesis |
39 then show ?thesis |
40 by (simp add: sub_polyfun) |
40 by (simp add: sub_polyfun) |
41 qed |
41 qed |
42 |
42 |
43 lemma polyfun_linear_factor: |
43 lemma%unimportant polyfun_linear_factor: |
44 fixes a :: "'a::{comm_ring,monoid_mult}" |
44 fixes a :: "'a::{comm_ring,monoid_mult}" |
45 shows "\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) = |
45 shows "\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) = |
46 (z-a) * (\<Sum>i<n. b i * z^i) + (\<Sum>i\<le>n. c i * a^i)" |
46 (z-a) * (\<Sum>i<n. b i * z^i) + (\<Sum>i\<le>n. c i * a^i)" |
47 proof - |
47 proof - |
48 { fix z |
48 { fix z |
55 by (simp add: algebra_simps) } |
55 by (simp add: algebra_simps) } |
56 then show ?thesis |
56 then show ?thesis |
57 by (intro exI allI) |
57 by (intro exI allI) |
58 qed |
58 qed |
59 |
59 |
60 lemma polyfun_linear_factor_root: |
60 lemma%important polyfun_linear_factor_root: |
61 fixes a :: "'a::{comm_ring,monoid_mult}" |
61 fixes a :: "'a::{comm_ring,monoid_mult}" |
62 assumes "(\<Sum>i\<le>n. c i * a^i) = 0" |
62 assumes "(\<Sum>i\<le>n. c i * a^i) = 0" |
63 shows "\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) = (z-a) * (\<Sum>i<n. b i * z^i)" |
63 shows "\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z^i) = (z-a) * (\<Sum>i<n. b i * z^i)" |
64 using polyfun_linear_factor [of c n a] assms |
64 using%unimportant polyfun_linear_factor [of c n a] assms |
65 by simp |
65 by%unimportant simp |
66 |
66 |
67 lemma adhoc_norm_triangle: "a + norm(y) \<le> b ==> norm(x) \<le> a ==> norm(x + y) \<le> b" |
67 lemma%unimportant adhoc_norm_triangle: "a + norm(y) \<le> b ==> norm(x) \<le> a ==> norm(x + y) \<le> b" |
68 by (metis norm_triangle_mono order.trans order_refl) |
68 by (metis norm_triangle_mono order.trans order_refl) |
69 |
69 |
70 lemma polyfun_extremal_lemma: |
70 lemma%important polyfun_extremal_lemma: |
71 fixes c :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
71 fixes c :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
72 assumes "e > 0" |
72 assumes "e > 0" |
73 shows "\<exists>M. \<forall>z. M \<le> norm z \<longrightarrow> norm(\<Sum>i\<le>n. c i * z^i) \<le> e * norm(z) ^ Suc n" |
73 shows "\<exists>M. \<forall>z. M \<le> norm z \<longrightarrow> norm(\<Sum>i\<le>n. c i * z^i) \<le> e * norm(z) ^ Suc n" |
74 proof (induction n) |
74 proof%unimportant (induction n) |
75 case 0 |
75 case 0 |
76 show ?case |
76 show ?case |
77 by (rule exI [where x="norm (c 0) / e"]) (auto simp: mult.commute pos_divide_le_eq assms) |
77 by (rule exI [where x="norm (c 0) / e"]) (auto simp: mult.commute pos_divide_le_eq assms) |
78 next |
78 next |
79 case (Suc n) |
79 case (Suc n) |
100 then show "norm (\<Sum>i\<le>Suc n. c i * z^i) \<le> e * norm z ^ Suc (Suc n)" using M norm1 |
100 then show "norm (\<Sum>i\<le>Suc n. c i * z^i) \<le> e * norm z ^ Suc (Suc n)" using M norm1 |
101 by (drule_tac x=z in spec) (auto simp: intro!: adhoc_norm_triangle) |
101 by (drule_tac x=z in spec) (auto simp: intro!: adhoc_norm_triangle) |
102 qed |
102 qed |
103 qed |
103 qed |
104 |
104 |
105 lemma norm_lemma_xy: assumes "\<bar>b\<bar> + 1 \<le> norm(y) - a" "norm(x) \<le> a" shows "b \<le> norm(x + y)" |
105 lemma%unimportant norm_lemma_xy: assumes "\<bar>b\<bar> + 1 \<le> norm(y) - a" "norm(x) \<le> a" shows "b \<le> norm(x + y)" |
106 proof - |
106 proof - |
107 have "b \<le> norm y - norm x" |
107 have "b \<le> norm y - norm x" |
108 using assms by linarith |
108 using assms by linarith |
109 then show ?thesis |
109 then show ?thesis |
110 by (metis (no_types) add.commute norm_diff_ineq order_trans) |
110 by (metis (no_types) add.commute norm_diff_ineq order_trans) |
111 qed |
111 qed |
112 |
112 |
113 lemma polyfun_extremal: |
113 lemma%important polyfun_extremal: |
114 fixes c :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
114 fixes c :: "nat \<Rightarrow> 'a::real_normed_div_algebra" |
115 assumes "\<exists>k. k \<noteq> 0 \<and> k \<le> n \<and> c k \<noteq> 0" |
115 assumes "\<exists>k. k \<noteq> 0 \<and> k \<le> n \<and> c k \<noteq> 0" |
116 shows "eventually (\<lambda>z. norm(\<Sum>i\<le>n. c i * z^i) \<ge> B) at_infinity" |
116 shows "eventually (\<lambda>z. norm(\<Sum>i\<le>n. c i * z^i) \<ge> B) at_infinity" |
117 using assms |
117 using assms |
118 proof (induction n) |
118 proof%unimportant (induction n) |
119 case 0 then show ?case |
119 case 0 then show ?case |
120 by simp |
120 by simp |
121 next |
121 next |
122 case (Suc n) |
122 case (Suc n) |
123 show ?case |
123 show ?case |
147 done |
147 done |
148 qed |
148 qed |
149 qed |
149 qed |
150 qed |
150 qed |
151 |
151 |
152 lemma polyfun_rootbound: |
152 lemma%important polyfun_rootbound: |
153 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
153 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
154 assumes "\<exists>k. k \<le> n \<and> c k \<noteq> 0" |
154 assumes "\<exists>k. k \<le> n \<and> c k \<noteq> 0" |
155 shows "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<and> card {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<le> n" |
155 shows "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<and> card {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<le> n" |
156 using assms |
156 using assms |
157 proof (induction n arbitrary: c) |
157 proof%unimportant (induction n arbitrary: c) |
158 case (Suc n) show ?case |
158 case (Suc n) show ?case |
159 proof (cases "{z. (\<Sum>i\<le>Suc n. c i * z^i) = 0} = {}") |
159 proof (cases "{z. (\<Sum>i\<le>Suc n. c i * z^i) = 0} = {}") |
160 case False |
160 case False |
161 then obtain a where a: "(\<Sum>i\<le>Suc n. c i * a^i) = 0" |
161 then obtain a where a: "(\<Sum>i\<le>Suc n. c i * a^i) = 0" |
162 by auto |
162 by auto |
180 then show ?thesis using Suc.IH [of b] ins_ab |
180 then show ?thesis using Suc.IH [of b] ins_ab |
181 by (auto simp: card_insert_if) |
181 by (auto simp: card_insert_if) |
182 qed simp |
182 qed simp |
183 qed simp |
183 qed simp |
184 |
184 |
185 corollary |
185 corollary%important (*FIX ME needs name *) |
186 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
186 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
187 assumes "\<exists>k. k \<le> n \<and> c k \<noteq> 0" |
187 assumes "\<exists>k. k \<le> n \<and> c k \<noteq> 0" |
188 shows polyfun_rootbound_finite: "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0}" |
188 shows polyfun_rootbound_finite: "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0}" |
189 and polyfun_rootbound_card: "card {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<le> n" |
189 and polyfun_rootbound_card: "card {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<le> n" |
190 using polyfun_rootbound [OF assms] by auto |
190 using polyfun_rootbound [OF assms] by auto |
191 |
191 |
192 lemma polyfun_finite_roots: |
192 lemma%important polyfun_finite_roots: |
193 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
193 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
194 shows "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<longleftrightarrow> (\<exists>k. k \<le> n \<and> c k \<noteq> 0)" |
194 shows "finite {z. (\<Sum>i\<le>n. c i * z^i) = 0} \<longleftrightarrow> (\<exists>k. k \<le> n \<and> c k \<noteq> 0)" |
195 proof (cases " \<exists>k\<le>n. c k \<noteq> 0") |
195 proof%unimportant (cases " \<exists>k\<le>n. c k \<noteq> 0") |
196 case True then show ?thesis |
196 case True then show ?thesis |
197 by (blast intro: polyfun_rootbound_finite) |
197 by (blast intro: polyfun_rootbound_finite) |
198 next |
198 next |
199 case False then show ?thesis |
199 case False then show ?thesis |
200 by (auto simp: infinite_UNIV_char_0) |
200 by (auto simp: infinite_UNIV_char_0) |
201 qed |
201 qed |
202 |
202 |
203 lemma polyfun_eq_0: |
203 lemma%unimportant polyfun_eq_0: |
204 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
204 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
205 shows "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = 0) \<longleftrightarrow> (\<forall>k. k \<le> n \<longrightarrow> c k = 0)" |
205 shows "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = 0) \<longleftrightarrow> (\<forall>k. k \<le> n \<longrightarrow> c k = 0)" |
206 proof (cases "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = 0)") |
206 proof (cases "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = 0)") |
207 case True |
207 case True |
208 then have "~ finite {z. (\<Sum>i\<le>n. c i * z^i) = 0}" |
208 then have "~ finite {z. (\<Sum>i\<le>n. c i * z^i) = 0}" |
213 case False |
213 case False |
214 then show ?thesis |
214 then show ?thesis |
215 by auto |
215 by auto |
216 qed |
216 qed |
217 |
217 |
218 lemma polyfun_eq_const: |
218 lemma%important polyfun_eq_const: |
219 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
219 fixes c :: "nat \<Rightarrow> 'a::{comm_ring,real_normed_div_algebra}" |
220 shows "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = k) \<longleftrightarrow> c 0 = k \<and> (\<forall>k. k \<noteq> 0 \<and> k \<le> n \<longrightarrow> c k = 0)" |
220 shows "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = k) \<longleftrightarrow> c 0 = k \<and> (\<forall>k. k \<noteq> 0 \<and> k \<le> n \<longrightarrow> c k = 0)" |
221 proof - |
221 proof%unimportant - |
222 {fix z |
222 {fix z |
223 have "(\<Sum>i\<le>n. c i * z^i) = (\<Sum>i\<le>n. (if i = 0 then c 0 - k else c i) * z^i) + k" |
223 have "(\<Sum>i\<le>n. c i * z^i) = (\<Sum>i\<le>n. (if i = 0 then c 0 - k else c i) * z^i) + k" |
224 by (induct n) auto |
224 by (induct n) auto |
225 } then |
225 } then |
226 have "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = k) \<longleftrightarrow> (\<forall>z. (\<Sum>i\<le>n. (if i = 0 then c 0 - k else c i) * z^i) = 0)" |
226 have "(\<forall>z. (\<Sum>i\<le>n. c i * z^i) = k) \<longleftrightarrow> (\<forall>z. (\<Sum>i\<le>n. (if i = 0 then c 0 - k else c i) * z^i) = 0)" |