# HG changeset patch # User paulson # Date 1601934820 -3600 # Node ID 698b58513fd1021d9ad5c6549183b3313cec57c8 # Parent 075f3cbc7546d37e90393e2355f44aebe1bc586b# Parent 6cacbdb536375e631c56d17f55585952e81fb46a merged diff -r 075f3cbc7546 -r 698b58513fd1 src/HOL/Analysis/Weierstrass_Theorems.thy --- a/src/HOL/Analysis/Weierstrass_Theorems.thy Mon Oct 05 22:49:46 2020 +0200 +++ b/src/HOL/Analysis/Weierstrass_Theorems.thy Mon Oct 05 22:53:40 2020 +0100 @@ -9,7 +9,7 @@ subsection \Bernstein polynomials\ definition\<^marker>\tag important\ Bernstein :: "[nat,nat,real] \ real" where - "Bernstein n k x \ of_nat (n choose k) * x ^ k * (1 - x) ^ (n - k)" + "Bernstein n k x \ of_nat (n choose k) * x^k * (1 - x)^(n - k)" lemma Bernstein_nonneg: "\0 \ x; x \ 1\ \ 0 \ Bernstein n k x" by (simp add: Bernstein_def) @@ -22,7 +22,7 @@ by (simp add: Bernstein_def) lemma binomial_deriv1: - "(\k\n. (of_nat k * of_nat (n choose k)) * a^(k-1) * b^(n-k)) = real_of_nat n * (a+b) ^ (n-1)" + "(\k\n. (of_nat k * of_nat (n choose k)) * a^(k-1) * b^(n-k)) = real_of_nat n * (a+b)^(n-1)" apply (rule DERIV_unique [where f = "\a. (a+b)^n" and x=a]) apply (subst binomial_ring) apply (rule derivative_eq_intros sum.cong | simp add: atMost_atLeast0)+ @@ -30,8 +30,8 @@ lemma binomial_deriv2: "(\k\n. (of_nat k * of_nat (k-1) * of_nat (n choose k)) * a^(k-2) * b^(n-k)) = - of_nat n * of_nat (n-1) * (a+b::real) ^ (n-2)" - apply (rule DERIV_unique [where f = "\a. of_nat n * (a+b::real) ^ (n-1)" and x=a]) + of_nat n * of_nat (n-1) * (a+b::real)^(n-2)" + apply (rule DERIV_unique [where f = "\a. of_nat n * (a+b::real)^(n-1)" and x=a]) apply (subst binomial_deriv1 [symmetric]) apply (rule derivative_eq_intros sum.cong | simp add: Num.numeral_2_eq_2)+ done @@ -45,7 +45,7 @@ lemma sum_kk_Bernstein [simp]: "(\k\n. real k * (real k - 1) * Bernstein n k x) = real n * (real n - 1) * x\<^sup>2" proof - have "(\k\n. real k * (real k - 1) * Bernstein n k x) = - (\k\n. real k * real (k - Suc 0) * real (n choose k) * x ^ (k - 2) * (1 - x) ^ (n - k) * x\<^sup>2)" + (\k\n. real k * real (k - Suc 0) * real (n choose k) * x^(k - 2) * (1 - x)^(n - k) * x\<^sup>2)" proof (rule sum.cong [OF refl], simp) fix k assume "k \ n" @@ -54,7 +54,7 @@ then show "k = 0 \ (real k - 1) * Bernstein n k x = real (k - Suc 0) * - (real (n choose k) * (x ^ (k - 2) * ((1 - x) ^ (n - k) * x\<^sup>2)))" + (real (n choose k) * (x^(k - 2) * ((1 - x)^(n - k) * x\<^sup>2)))" by cases (auto simp add: Bernstein_def power2_eq_square algebra_simps) qed also have "... = real_of_nat n * real_of_nat (n - Suc 0) * x\<^sup>2" @@ -189,7 +189,7 @@ lemma diff: "f \ R \ g \ R \ (\x. f x - g x) \ R" unfolding diff_conv_add_uminus by (metis add minus) - lemma power: "f \ R \ (\x. f x ^ n) \ R" + lemma power: "f \ R \ (\x. f x^n) \ R" by (induct n) (auto simp: const mult) lemma sum: "\finite I; \i. i \ I \ f i \ R\ \ (\x. \i \ I. f i x) \ R" @@ -292,13 +292,11 @@ have p01: "p x \ {0..1}" if t: "x \ S" for x proof - have "0 \ p x" - using subU cardp t - apply (simp add: p_def field_split_simps sum_nonneg) - apply (rule sum_nonneg) - using pf01 by force + using subU cardp t pf01 + by (fastforce simp add: p_def field_split_simps intro: sum_nonneg) moreover have "p x \ 1" - using subU cardp t - apply (simp add: p_def field_split_simps sum_nonneg) + using subU cardp t + apply (simp add: p_def field_split_simps) apply (rule sum_bounded_above [where 'a=real and K=1, simplified]) using pf01 by force ultimately show ?thesis @@ -338,7 +336,7 @@ using \01 unfolding k_def by linarith with \01 k2\ have k\: "1 < k*\" "k*\ < 2" by (auto simp: field_split_simps) - define q where [abs_def]: "q n t = (1 - p t ^ n) ^ (k^n)" for n t + define q where [abs_def]: "q n t = (1 - p t^n)^(k^n)" for n t have qR: "q n \ R" for n by (simp add: q_def const diff power pR) have q01: "\n t. t \ S \ q n t \ {0..1}" @@ -352,10 +350,10 @@ then have "1 - (k * \ / 2)^n \ 1 - (k * p t)^n" using \k>0\ p01 t by (simp add: power_mono) also have "... \ q n t" - using Bernoulli_inequality [of "- ((p t)^n)" "k^n"] + using Bernoulli_inequality [of "- ((p t)^n)" "k^n"] apply (simp add: q_def) by (metis IntE atLeastAtMost_iff p01 power_le_one power_mult_distrib t) - finally have "1 - (k * \ / 2) ^ n \ q n t" . + finally have "1 - (k * \ / 2)^n \ q n t" . } note limitV = this { fix t and n::nat assume t: "t \ S - U" @@ -363,35 +361,30 @@ by (simp add: pt_\) with k\ have kpt: "1 < k * p t" by (blast intro: less_le_trans) - have ptn_pos: "0 < p t ^ n" + have ptn_pos: "0 < p t^n" using pt_pos [OF t] by simp - have ptn_le: "p t ^ n \ 1" + have ptn_le: "p t^n \ 1" by (meson DiffE atLeastAtMost_iff p01 power_le_one t) - have "q n t = (1/(k^n * (p t)^n)) * (1 - p t ^ n) ^ (k^n) * k^n * (p t)^n" + have "q n t = (1/(k^n * (p t)^n)) * (1 - p t^n)^(k^n) * k^n * (p t)^n" using pt_pos [OF t] \k>0\ by (simp add: q_def) - also have "... \ (1/(k * (p t))^n) * (1 - p t ^ n) ^ (k^n) * (1 + k^n * (p t)^n)" + also have "... \ (1/(k * (p t))^n) * (1 - p t^n)^(k^n) * (1 + k^n * (p t)^n)" using pt_pos [OF t] \k>0\ - apply simp - apply (simp flip: times_divide_eq_right) - apply (rule mult_left_mono [of "1::real", simplified]) - apply (simp_all add: power_mult_distrib ptn_le) - done - also have "... \ (1/(k * (p t))^n) * (1 - p t ^ n) ^ (k^n) * (1 + (p t)^n) ^ (k^n)" - apply (rule mult_left_mono [OF Bernoulli_inequality [of "p t ^ n" "k^n"]]) - using \k>0\ ptn_pos ptn_le - apply (auto simp: power_mult_distrib) - done - also have "... = (1/(k * (p t))^n) * (1 - p t ^ (2*n)) ^ (k^n)" + by (simp add: divide_simps mult_left_mono ptn_le) + also have "... \ (1/(k * (p t))^n) * (1 - p t^n)^(k^n) * (1 + (p t)^n)^(k^n)" + proof (rule mult_left_mono [OF Bernoulli_inequality]) + show "0 \ 1 / (real k * p t)^n * (1 - p t^n)^k^n" + using ptn_pos ptn_le by (auto simp: power_mult_distrib) + qed (use ptn_pos in auto) + also have "... = (1/(k * (p t))^n) * (1 - p t^(2*n))^(k^n)" using pt_pos [OF t] \k>0\ by (simp add: algebra_simps power_mult power2_eq_square flip: power_mult_distrib) also have "... \ (1/(k * (p t))^n) * 1" - apply (rule mult_left_mono [OF power_le_one]) - using pt_pos \k>0\ p01 power_le_one t apply auto - done + using pt_pos \k>0\ p01 power_le_one t + by (intro mult_left_mono [OF power_le_one]) auto also have "... \ (1 / (k*\))^n" using \k>0\ \01 power_mono pt_\ t by (fastforce simp: field_simps) - finally have "q n t \ (1 / (real k * \)) ^ n " . + finally have "q n t \ (1 / (real k * \))^n " . } note limitNonU = this define NN where "NN e = 1 + nat \max (ln e / ln (real k * \ / 2)) (- ln e / ln (real k * \))\" for e @@ -400,14 +393,14 @@ unfolding NN_def by linarith+ have NN1: "(k * \ / 2)^NN e < e" if "e>0" for e proof - - have "ln ((real k * \ / 2) ^ NN e) < ln e" - apply (subst ln_realpow) - using NN k\ that - by (force simp add: field_simps)+ - then show ?thesis + have "ln ((real k * \ / 2)^NN e) = real (NN e) * ln (real k * \ / 2)" + by (simp add: \\>0\ \0 < k\ ln_realpow) + also have "... < ln e" + using NN k\ that by (force simp add: field_simps) + finally show ?thesis by (simp add: \\>0\ \0 < k\ that) qed - have NN0: "(1/(k*\)) ^ (NN e) < e" if "e>0" for e + have NN0: "(1/(k*\))^(NN e) < e" if "e>0" for e proof - have "0 < ln (real k) + ln \" using \01(1) \0 < k\ k\(1) ln_gt_zero ln_mult by fastforce @@ -521,7 +514,7 @@ assume x: "x \ B" then have "x \ S" using B by auto - have "1 - e \ (1 - e / card subA) ^ card subA" + have "1 - e \ (1 - e / card subA)^card subA" using Bernoulli_inequality [of "-e / card subA" "card subA"] e cardp by (auto simp: field_simps) also have "... = (\w \ subA. 1 - e / card subA)" @@ -531,10 +524,7 @@ have "\i. i \ subA \ e / real (card subA) \ 1 \ 1 - e / real (card subA) < ff i x" using e \B \ S\ ff subA(1) x by (force simp: field_split_simps) then show ?thesis - apply (simp add: pff_def) - apply (rule prod_mono_strict [where f = "\x. 1 - e / card subA", simplified]) - apply (simp_all add: subA(2)) - done + using prod_mono_strict [where f = "\x. 1 - e / card subA"] subA(2) by (force simp add: pff_def) qed finally have "1 - e < pff x" . } @@ -552,13 +542,18 @@ using assms by (force simp flip: ex_in_conv intro!: two_special) next - case False with e show ?thesis - apply simp - apply (erule disjE) - apply (rule_tac [2] x="\x. 0" in bexI) - apply (rule_tac x="\x. 1" in bexI) - apply (auto simp: const) - done + case False + then consider "A={}" | "B={}" by force + then show ?thesis + proof cases + case 1 + with e show ?thesis + by (rule_tac x="\x. 1" in bexI) (auto simp: const) + next + case 2 + with e show ?thesis + by (rule_tac x="\x. 0" in bexI) (auto simp: const) + qed qed text\The special case where \<^term>\f\ is non-negative and \<^term>\e<1/3\\ @@ -570,30 +565,26 @@ define n where "n = 1 + nat \normf f / e\" define A where "A j = {x \ S. f x \ (j - 1/3)*e}" for j :: nat define B where "B j = {x \ S. f x \ (j + 1/3)*e}" for j :: nat - have ngt: "(n-1) * e \ normf f" "n\1" - using e - apply (simp_all add: n_def field_simps) - by (metis real_nat_ceiling_ge mult.commute not_less pos_less_divide_eq) - then have ge_fx: "(n-1) * e \ f x" if "x \ S" for x + have ngt: "(n-1) * e \ normf f" + using e pos_divide_le_eq real_nat_ceiling_ge[of "normf f / e"] + by (fastforce simp add: divide_simps n_def) + moreover have "n\1" + by (simp_all add: n_def) + ultimately have ge_fx: "(n-1) * e \ f x" if "x \ S" for x using f normf_upper that by fastforce + have "closed S" + by (simp add: compact compact_imp_closed) { fix j - have A: "closed (A j)" "A j \ S" - apply (simp_all add: A_def Collect_restrict) - apply (rule continuous_on_closed_Collect_le [OF f continuous_on_const]) - apply (simp add: compact compact_imp_closed) - done - have B: "closed (B j)" "B j \ S" - apply (simp_all add: B_def Collect_restrict) - apply (rule continuous_on_closed_Collect_le [OF continuous_on_const f]) - apply (simp add: compact compact_imp_closed) - done - have disj: "(A j) \ (B j) = {}" + have "closed (A j)" "A j \ S" + using \closed S\ continuous_on_closed_Collect_le [OF f continuous_on_const] + by (simp_all add: A_def Collect_restrict) + moreover have "closed (B j)" "B j \ S" + using \closed S\ continuous_on_closed_Collect_le [OF continuous_on_const f] + by (simp_all add: B_def Collect_restrict) + moreover have "(A j) \ (B j) = {}" using e by (auto simp: A_def B_def field_simps) - have "\f \ R. f ` S \ {0..1} \ (\x \ A j. f x < e/n) \ (\x \ B j. f x > 1 - e/n)" - apply (rule two) - using e A B disj ngt - apply simp_all - done + ultimately have "\f \ R. f ` S \ {0..1} \ (\x \ A j. f x < e/n) \ (\x \ B j. f x > 1 - e/n)" + using e \1 \ n\ by (auto intro: two) } then obtain xf where xfR: "\j. xf j \ R" and xf01: "\j. xf j ` S \ {0..1}" and xfA: "\x j. x \ A j \ xf j x < e/n" @@ -607,11 +598,9 @@ have A0: "A 0 = {}" using fpos e by (fastforce simp: A_def) have An: "A n = S" - using e ngt f normf_upper by (fastforce simp: A_def field_simps of_nat_diff) + using e ngt \n\1\ f normf_upper by (fastforce simp: A_def field_simps of_nat_diff) have Asub: "A j \ A i" if "i\j" for i j - using e that apply (clarsimp simp: A_def) - apply (erule order_trans, simp) - done + using e that by (force simp: A_def intro: order_trans) { fix t assume t: "t \ S" define j where "j = (LEAST j. t \ A j)" @@ -624,46 +613,31 @@ then have fj1: "f t \ (j - 1/3)*e" by (simp add: A_def) then have Anj: "t \ A i" if "ii - apply (simp add: j_def) - using not_less_Least by blast + using Aj \i not_less_Least by (fastforce simp add: j_def) have j1: "1 \ j" using A0 Aj j_def not_less_eq_eq by (fastforce simp add: j_def) then have Anj: "t \ A (j-1)" using Least_le by (fastforce simp add: j_def) then have fj2: "(j - 4/3)*e < f t" using j1 t by (simp add: A_def of_nat_diff) - have ***: "xf i t \ e/n" if "i\j" for i - using xfA [OF Ai] that by (simp add: less_eq_real_def) - { fix i - assume "i+2 \ j" - then obtain d where "i+2+d = j" - using le_Suc_ex that by blast - then have "t \ B i" - using Anj e ge_fx [OF t] \1 \ n\ fpos [OF t] t - apply (simp add: A_def B_def) - apply (clarsimp simp add: field_simps of_nat_diff not_le) - apply (rule order_trans [of _ "e * 2 + (e * (real d * 3) + e * (real i * 3))"]) - apply auto - done - then have "xf i t > 1 - e/n" - by (rule xfB) - } note **** = this have xf_le1: "\i. xf i t \ 1" using xf01 t by force - have "g t = e * (\ii=j..n. xf i t)" - using j1 jn e - apply (simp add: g_def flip: distrib_left) - apply (subst sum.union_disjoint [symmetric]) - apply (auto simp: ivl_disj_un) - done + have "g t = e * (\i\n. xf i t)" + by (simp add: g_def flip: distrib_left) + also have "... = e * (\i \ {.. {j..n}. xf i t)" + by (simp add: ivl_disj_un_one(4) jn) + also have "... = e * (\ii=j..n. xf i t)" + by (simp add: distrib_left ivl_disj_int sum.union_disjoint) also have "... \ e*j + e * ((Suc n - j)*e/n)" - apply (rule add_mono) - apply (simp_all only: mult_le_cancel_left_pos e) - apply (rule sum_bounded_above [OF xf_le1, where A = "lessThan j", simplified]) - using sum_bounded_above [of "{j..n}" "\i. xf i t", OF ***] - apply simp - done + proof (intro add_mono mult_left_mono) + show "(\i j" + by (rule sum_bounded_above [OF xf_le1, where A = "lessThan j", simplified]) + have "xf i t \ e/n" if "i\j" for i + using xfA [OF Ai] that by (simp add: less_eq_real_def) + then show "(\i = j..n. xf i t) \ real (Suc n - j) * e / real n" + using sum_bounded_above [of "{j..n}" "\i. xf i t"] + by fastforce + qed (use e in auto) also have "... \ j*e + e*(n - j + 1)*e/n " using \1 \ n\ e by (simp add: field_simps del: of_nat_Suc) also have "... \ j*e + e*e" @@ -685,18 +659,26 @@ also have "... = e * (j-1) * (1 - e/n)" by (simp add: power2_eq_square field_simps) also have "... \ e * (\i\j-2. xf i t)" - using e - apply simp - apply (rule order_trans [OF _ sum_bounded_below [OF less_imp_le [OF ****]]]) - using True - apply (simp_all add: of_nat_diff) - done + proof - + { fix i + assume "i+2 \ j" + then obtain d where "i+2+d = j" + using le_Suc_ex that by blast + then have "t \ B i" + using Anj e ge_fx [OF t] \1 \ n\ fpos [OF t] t + unfolding A_def B_def + by (auto simp add: field_simps of_nat_diff not_le intro: order_trans [of _ "e * 2 + e * d * 3 + e * i * 3"]) + then have "xf i t > 1 - e/n" + by (rule xfB) + } + moreover have "real (j - Suc 0) * (1 - e / real n) \ real (card {..j - 2}) * (1 - e / real n)" + using Suc_diff_le True by fastforce + ultimately show ?thesis + using e True by (auto intro: order_trans [OF _ sum_bounded_below [OF less_imp_le]]) + qed also have "... \ g t" - using jn e - using e xf01 t - apply (simp add: g_def zero_le_mult_iff image_subset_iff sum_nonneg) - apply (rule Groups_Big.sum_mono2, auto) - done + using jn e xf01 t + by (auto intro!: Groups_Big.sum_mono2 simp add: g_def zero_le_mult_iff image_subset_iff sum_nonneg) finally show ?thesis . qed have "\f t - g t\ < 2 * e" @@ -712,17 +694,16 @@ shows "\g \ R. \x\S. \f x - g x\ < e" proof - have "\g \ R. \x\S. \(f x + normf f) - g x\ < 2 * min (e/2) (1/4)" - apply (rule Stone_Weierstrass_special) - apply (rule Limits.continuous_on_add [OF f Topological_Spaces.continuous_on_const]) - using normf_upper [OF f] apply force - apply (simp add: e, linarith) - done + proof (rule Stone_Weierstrass_special) + show "continuous_on S (\x. f x + normf f)" + by (force intro: Limits.continuous_on_add [OF f Topological_Spaces.continuous_on_const]) + show "\x. x \ S \ 0 \ f x + normf f" + using normf_upper [OF f] by force + qed (use e in auto) then obtain g where "g \ R" "\x\S. \g x - (f x + normf f)\ < e" by force then show ?thesis - apply (rule_tac x="\x. g x - normf f" in bexI) - apply (auto simp: algebra_simps intro: diff const) - done + by (rule_tac x="\x. g x - normf f" in bexI) (auto simp: algebra_simps intro: diff const) qed @@ -730,31 +711,32 @@ assumes f: "continuous_on S f" shows "\F\UNIV \ R. LIM n sequentially. F n :> uniformly_on S f" proof - - { fix e::real - assume e: "0 < e" - then obtain N::nat where N: "0 < N" "0 < inverse N" "inverse N < e" - by (auto simp: real_arch_inverse [of e]) - { fix n :: nat and x :: 'a and g :: "'a \ real" - assume n: "N \ n" "\x\S. \f x - g x\ < 1 / (1 + real n)" - assume x: "x \ S" - have "\ real (Suc n) < inverse e" - using \N \ n\ N using less_imp_inverse_less by force - then have "1 / (1 + real n) \ e" - using e by (simp add: field_simps) - then have "\f x - g x\ < e" - using n(2) x by auto - } note * = this - have "\\<^sub>F n in sequentially. \x\S. \f x - (SOME g. g \ R \ (\x\S. \f x - g x\ < 1 / (1 + real n))) x\ < e" - apply (rule eventually_sequentiallyI [of N]) - apply (auto intro: someI2_bex [OF Stone_Weierstrass_basic [OF f]] *) - done - } then + define h where "h \ \n::nat. SOME g. g \ R \ (\x\S. \f x - g x\ < 1 / (1 + n))" show ?thesis - apply (rule_tac x="\n::nat. SOME g. g \ R \ (\x\S. \f x - g x\ < 1 / (1 + n))" in bexI) - prefer 2 apply (force intro: someI2_bex [OF Stone_Weierstrass_basic [OF f]]) - unfolding uniform_limit_iff - apply (auto simp: dist_norm abs_minus_commute) - done + proof + { fix e::real + assume e: "0 < e" + then obtain N::nat where N: "0 < N" "0 < inverse N" "inverse N < e" + by (auto simp: real_arch_inverse [of e]) + { fix n :: nat and x :: 'a and g :: "'a \ real" + assume n: "N \ n" "\x\S. \f x - g x\ < 1 / (1 + real n)" + assume x: "x \ S" + have "\ real (Suc n) < inverse e" + using \N \ n\ N using less_imp_inverse_less by force + then have "1 / (1 + real n) \ e" + using e by (simp add: field_simps) + then have "\f x - g x\ < e" + using n(2) x by auto + } + then have "\\<^sub>F n in sequentially. \x\S. \f x - h n x\ < e" + unfolding h_def + by (force intro: someI2_bex [OF Stone_Weierstrass_basic [OF f]] eventually_sequentiallyI [of N]) + } + then show "uniform_limit S h f sequentially" + unfolding uniform_limit_iff by (auto simp: dist_norm abs_minus_commute) + show "h \ UNIV \ R" + unfolding h_def by (force intro: someI2_bex [OF Stone_Weierstrass_basic [OF f]]) + qed qed text\A HOL Light formulation\ @@ -769,9 +751,7 @@ shows "\g. P(g) \ (\x \ S. \f x - g x\ < e)" proof - interpret PR: function_ring_on "Collect P" - apply unfold_locales - using assms - by auto + by unfold_locales (use assms in auto) show ?thesis using PR.Stone_Weierstrass_basic [OF \continuous_on S f\ \0 < e\] by blast @@ -832,13 +812,17 @@ lemma polynomial_function_mult [intro]: assumes f: "polynomial_function f" and g: "polynomial_function g" - shows "polynomial_function (\x. f x *\<^sub>R g x)" - using g - apply (auto simp: polynomial_function_def bounded_linear_def Real_Vector_Spaces.linear.scaleR const real_polynomial_function.mult o_def) - apply (rule mult) - using f - apply (auto simp: real_polynomial_function_eq) - done + shows "polynomial_function (\x. f x *\<^sub>R g x)" +proof - + have "real_polynomial_function (\x. h (g x))" if "bounded_linear h" for h + using g that unfolding polynomial_function_def o_def bounded_linear_def + by (auto simp: real_polynomial_function_eq) + moreover have "real_polynomial_function f" + by (simp add: f real_polynomial_function_eq) + ultimately show ?thesis + unfolding polynomial_function_def bounded_linear_def o_def + by (auto simp: linear.scaleR) +qed lemma polynomial_function_cmul [intro]: assumes f: "polynomial_function f" @@ -875,17 +859,26 @@ by (simp add: real_polynomial_function_eq) lemma real_polynomial_function_power [intro]: - "real_polynomial_function f \ real_polynomial_function (\x. f x ^ n)" + "real_polynomial_function f \ real_polynomial_function (\x. f x^n)" by (induct n) (simp_all add: const mult) lemma real_polynomial_function_compose [intro]: assumes f: "polynomial_function f" and g: "real_polynomial_function g" shows "real_polynomial_function (g o f)" using g - apply (induction g rule: real_polynomial_function.induct) - using f - apply (simp_all add: polynomial_function_def o_def const add mult) - done +proof (induction g rule: real_polynomial_function.induct) + case (linear f) + then show ?case + using f polynomial_function_def by blast +next + case (add f g) + then show ?case + using f add by (auto simp: polynomial_function_def) +next + case (mult f g) + then show ?case + using f mult by (auto simp: polynomial_function_def) +qed auto lemma polynomial_function_compose [intro]: assumes f: "polynomial_function f" and g: "polynomial_function g" @@ -908,55 +901,55 @@ lemma real_polynomial_function_imp_sum: assumes "real_polynomial_function f" - shows "\a n::nat. f = (\x. \i\n. a i * x ^ i)" + shows "\a n::nat. f = (\x. \i\n. a i * x^i)" using assms proof (induct f) case (linear f) - then show ?case - apply (clarsimp simp add: real_bounded_linear) - apply (rule_tac x="\i. if i=0 then 0 else c" in exI) - apply (rule_tac x=1 in exI) - apply (simp add: mult_ac) - done + then obtain c where f: "f = (\x. x * c)" + by (auto simp add: real_bounded_linear) + have "x * c = (\i\1. (if i = 0 then 0 else c) * x^i)" for x + by (simp add: mult_ac) + with f show ?case + by fastforce next case (const c) - show ?case - apply (rule_tac x="\i. c" in exI) - apply (rule_tac x=0 in exI) - apply (auto simp: mult_ac) - done - case (add f1 f2) - then obtain a1 n1 a2 n2 where - "f1 = (\x. \i\n1. a1 i * x ^ i)" "f2 = (\x. \i\n2. a2 i * x ^ i)" + have "c = (\i\0. c * x^i)" for x by auto then show ?case - apply (rule_tac x="\i. (if i \ n1 then a1 i else 0) + (if i \ n2 then a2 i else 0)" in exI) - apply (rule_tac x="max n1 n2" in exI) + by fastforce + case (add f1 f2) + then obtain a1 n1 a2 n2 where + "f1 = (\x. \i\n1. a1 i * x^i)" "f2 = (\x. \i\n2. a2 i * x^i)" + by auto + then have "f1 x + f2 x = (\i\max n1 n2. ((if i \ n1 then a1 i else 0) + (if i \ n2 then a2 i else 0)) * x^i)" + for x using sum_max_0 [where m=n1 and n=n2] sum_max_0 [where m=n2 and n=n1] - apply (simp add: sum.distrib algebra_simps max.commute) - done + by (simp add: sum.distrib algebra_simps max.commute) + then show ?case + by force case (mult f1 f2) then obtain a1 n1 a2 n2 where - "f1 = (\x. \i\n1. a1 i * x ^ i)" "f2 = (\x. \i\n2. a2 i * x ^ i)" + "f1 = (\x. \i\n1. a1 i * x^i)" "f2 = (\x. \i\n2. a2 i * x^i)" by auto then obtain b1 b2 where - "f1 = (\x. \i\n1. b1 i * x ^ i)" "f2 = (\x. \i\n2. b2 i * x ^ i)" + "f1 = (\x. \i\n1. b1 i * x^i)" "f2 = (\x. \i\n2. b2 i * x^i)" "b1 = (\i. if i\n1 then a1 i else 0)" "b2 = (\i. if i\n2 then a2 i else 0)" by auto + then have "f1 x * f2 x = (\i\n1 + n2. (\k\i. b1 k * b2 (i - k)) * x ^ i)" for x + using polynomial_product [of n1 b1 n2 b2] by (simp add: Set_Interval.atLeast0AtMost) then show ?case - apply (rule_tac x="\i. \k\i. b1 k * b2 (i - k)" in exI) - apply (rule_tac x="n1+n2" in exI) - using polynomial_product [of n1 b1 n2 b2] - apply (simp add: Set_Interval.atLeast0AtMost) - done + by force qed lemma real_polynomial_function_iff_sum: - "real_polynomial_function f \ (\a n::nat. f = (\x. \i\n. a i * x ^ i))" - apply (rule iffI) - apply (erule real_polynomial_function_imp_sum) - apply (auto simp: linear mult const real_polynomial_function_power real_polynomial_function_sum) - done + "real_polynomial_function f \ (\a n. f = (\x. \i\n. a i * x^i))" (is "?lhs = ?rhs") +proof + assume ?lhs then show ?rhs + by (metis real_polynomial_function_imp_sum) +next + assume ?rhs then show ?lhs + by (auto simp: linear mult const real_polynomial_function_power real_polynomial_function_sum) +qed lemma polynomial_function_iff_Basis_inner: fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" @@ -971,10 +964,9 @@ fix h :: "'b \ real" assume rp: "\b\Basis. real_polynomial_function (\x. f x \ b)" and h: "bounded_linear h" have "real_polynomial_function (h \ (\x. \b\Basis. (f x \ b) *\<^sub>R b))" - apply (rule real_polynomial_function_compose [OF _ linear [OF h]]) using rp - apply (auto simp: real_polynomial_function_eq polynomial_function_mult) - done + by (force simp: real_polynomial_function_eq polynomial_function_mult + intro!: real_polynomial_function_compose [OF _ linear [OF h]]) then show "real_polynomial_function (h \ f)" by (simp add: euclidean_representation_sum_fun) qed @@ -993,10 +985,11 @@ fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" assumes "polynomial_function f" shows "continuous (at x) f" - apply (rule euclidean_isCont) - using assms apply (simp add: polynomial_function_iff_Basis_inner) - apply (force dest: continuous_real_polymonial_function intro: isCont_scaleR) - done +proof (rule euclidean_isCont) + show "\b. b \ Basis \ isCont (\x. (f x \ b) *\<^sub>R b) x" + using assms continuous_real_polymonial_function + by (force simp: polynomial_function_iff_Basis_inner intro: isCont_scaleR) +qed lemma continuous_on_polymonial_function: fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" @@ -1024,9 +1017,7 @@ "real_polynomial_function p2" "\x. (f2 has_real_derivative p2 x) (at x)" by auto then show ?case - apply (rule_tac x="\x. p1 x + p2 x" in exI) - apply (auto intro!: derivative_eq_intros) - done + by (rule_tac x="\x. p1 x + p2 x" in exI) (auto intro!: derivative_eq_intros) case (mult f1 f2) then obtain p1 p2 where "real_polynomial_function p1" "\x. (f1 has_real_derivative p1 x) (at x)" @@ -1034,9 +1025,7 @@ by auto then show ?case using mult - apply (rule_tac x="\x. f1 x * p2 x + f2 x * p1 x" in exI) - apply (auto intro!: derivative_eq_intros) - done + by (rule_tac x="\x. f1 x * p2 x + f2 x * p1 x" in exI) (auto intro!: derivative_eq_intros) qed lemma has_vector_derivative_polynomial_function: @@ -1048,26 +1037,24 @@ assume "b \ Basis" then obtain p' where p': "real_polynomial_function p'" and pd: "\x. ((\x. p x \ b) has_real_derivative p' x) (at x)" - using assms [unfolded polynomial_function_iff_Basis_inner, rule_format] \b \ Basis\ - has_real_derivative_polynomial_function + using assms [unfolded polynomial_function_iff_Basis_inner] has_real_derivative_polynomial_function by blast - have "\q. polynomial_function q \ (\x. ((\u. (p u \ b) *\<^sub>R b) has_vector_derivative q x) (at x))" - apply (rule_tac x="\x. p' x *\<^sub>R b" in exI) - using \b \ Basis\ p' - apply (simp add: polynomial_function_iff_Basis_inner inner_Basis) - apply (auto intro: derivative_eq_intros pd) - done + have "polynomial_function (\x. p' x *\<^sub>R b)" + using \b \ Basis\ p' const [where 'a=real and c=0] + by (simp add: polynomial_function_iff_Basis_inner inner_Basis) + then have "\q. polynomial_function q \ (\x. ((\u. (p u \ b) *\<^sub>R b) has_vector_derivative q x) (at x))" + by (fastforce intro: derivative_eq_intros pd) } then obtain qf where qf: "\b. b \ Basis \ polynomial_function (qf b)" "\b x. b \ Basis \ ((\u. (p u \ b) *\<^sub>R b) has_vector_derivative qf b x) (at x)" by metis show ?thesis - apply (rule_tac p'="\x. \b\Basis. qf b x" in that) - apply (force intro: qf) - apply (subst euclidean_representation_sum_fun [of p, symmetric]) - apply (auto intro: has_vector_derivative_sum qf) - done + proof + show "\x. (p has_vector_derivative (\b\Basis. qf b x)) (at x)" + apply (subst euclidean_representation_sum_fun [of p, symmetric]) + by (auto intro: has_vector_derivative_sum qf) + qed (force intro: qf) qed lemma real_polynomial_function_separable: @@ -1075,15 +1062,14 @@ assumes "x \ y" shows "\f. real_polynomial_function f \ f x \ f y" proof - have "real_polynomial_function (\u. \b\Basis. (inner (x-u) b)^2)" - apply (rule real_polynomial_function_sum) - apply (auto simp: algebra_simps real_polynomial_function_power real_polynomial_function_diff - const linear bounded_linear_inner_left) - done - then show ?thesis - apply (intro exI conjI, assumption) - using assms - apply (force simp add: euclidean_eq_iff [of x y] sum_nonneg_eq_0_iff algebra_simps) - done + proof (rule real_polynomial_function_sum) + show "\i. i \ Basis \ real_polynomial_function (\u. ((x - u) \ i)\<^sup>2)" + by (auto simp: algebra_simps real_polynomial_function_diff const linear bounded_linear_inner_left) + qed auto + moreover have "(\b\Basis. ((x - y) \ b)\<^sup>2) \ 0" + using assms by (force simp add: euclidean_eq_iff [of x y] sum_nonneg_eq_0_iff algebra_simps) + ultimately show ?thesis + by auto qed lemma Stone_Weierstrass_real_polynomial_function: @@ -1092,13 +1078,11 @@ obtains g where "real_polynomial_function g" "\x. x \ S \ \f x - g x\ < e" proof - interpret PR: function_ring_on "Collect real_polynomial_function" - apply unfold_locales - using assms continuous_on_polymonial_function real_polynomial_function_eq - apply (auto intro: real_polynomial_function_separable) - done + proof unfold_locales + qed (use assms continuous_on_polymonial_function real_polynomial_function_eq + in \auto intro: real_polynomial_function_separable\) show ?thesis - using PR.Stone_Weierstrass_basic [OF \continuous_on S f\ \0 < e\] that - by blast + using PR.Stone_Weierstrass_basic [OF \continuous_on S f\ \0 < e\] that by blast qed theorem Stone_Weierstrass_polynomial_function: @@ -1111,40 +1095,35 @@ { fix b :: 'b assume "b \ Basis" have "\p. real_polynomial_function p \ (\x \ S. \f x \ b - p x\ < e / DIM('b))" - apply (rule exE [OF Stone_Weierstrass_real_polynomial_function [OF S _, of "\x. f x \ b" "e / card Basis"]]) - using e f - apply (auto intro: continuous_intros) - done + proof (rule Stone_Weierstrass_real_polynomial_function [OF S _, of "\x. f x \ b" "e / card Basis"]) + show "continuous_on S (\x. f x \ b)" + using f by (auto intro: continuous_intros) + qed (use e in auto) } then obtain pf where pf: "\b. b \ Basis \ real_polynomial_function (pf b) \ (\x \ S. \f x \ b - pf b x\ < e / DIM('b))" - apply (rule bchoice [rule_format, THEN exE]) - apply assumption - apply (force simp add: intro: that) - done - have "polynomial_function (\x. \b\Basis. pf b x *\<^sub>R b)" - using pf - by (simp add: polynomial_function_sum polynomial_function_mult real_polynomial_function_eq) - moreover + by metis + let ?g = "\x. \b\Basis. pf b x *\<^sub>R b" { fix x assume "x \ S" have "norm (\b\Basis. (f x \ b) *\<^sub>R b - pf b x *\<^sub>R b) \ (\b\Basis. norm ((f x \ b) *\<^sub>R b - pf b x *\<^sub>R b))" by (rule norm_sum) also have "... < of_nat DIM('b) * (e / DIM('b))" - apply (rule sum_bounded_above_strict) - apply (simp add: Real_Vector_Spaces.scaleR_diff_left [symmetric] pf \x \ S\) - apply (rule DIM_positive) - done + proof (rule sum_bounded_above_strict) + show "\i. i \ Basis \ norm ((f x \ i) *\<^sub>R i - pf i x *\<^sub>R i) < e / real DIM('b)" + by (simp add: Real_Vector_Spaces.scaleR_diff_left [symmetric] pf \x \ S\) + qed (rule DIM_positive) also have "... = e" by (simp add: field_simps) finally have "norm (\b\Basis. (f x \ b) *\<^sub>R b - pf b x *\<^sub>R b) < e" . } - ultimately - show ?thesis - apply (subst euclidean_representation_sum_fun [of f, symmetric]) - apply (rule_tac x="\x. \b\Basis. pf b x *\<^sub>R b" in exI) - apply (auto simp flip: sum_subtractf) - done + then have "\x\S. norm ((\b\Basis. (f x \ b) *\<^sub>R b) - ?g x) < e" + by (auto simp flip: sum_subtractf) + moreover + have "polynomial_function ?g" + using pf by (simp add: polynomial_function_sum polynomial_function_mult real_polynomial_function_eq) + ultimately show ?thesis + using euclidean_representation_sum_fun [of f] by (metis (no_types, lifting)) qed proposition Stone_Weierstrass_uniform_limit: @@ -1184,35 +1163,42 @@ lemma path_approx_polynomial_function: fixes g :: "real \ 'b::euclidean_space" assumes "path g" "0 < e" - shows "\p. polynomial_function p \ - pathstart p = pathstart g \ - pathfinish p = pathfinish g \ - (\t \ {0..1}. norm(p t - g t) < e)" + obtains p where "polynomial_function p" "pathstart p = pathstart g" "pathfinish p = pathfinish g" + "\t. t \ {0..1} \ norm(p t - g t) < e" proof - obtain q where poq: "polynomial_function q" and noq: "\x. x \ {0..1} \ norm (g x - q x) < e/4" using Stone_Weierstrass_polynomial_function [of "{0..1}" g "e/4"] assms by (auto simp: path_def) - have pf: "polynomial_function (\t. q t + (g 0 - q 0) + t *\<^sub>R (g 1 - q 1 - (g 0 - q 0)))" - by (force simp add: poq) - have *: "\t. t \ {0..1} \ norm (((q t - g t) + (g 0 - q 0)) + (t *\<^sub>R (g 1 - q 1) + t *\<^sub>R (q 0 - g 0))) < (e/4 + e/4) + (e/4+e/4)" - apply (intro Real_Vector_Spaces.norm_add_less) - using noq - apply (auto simp: norm_minus_commute intro: le_less_trans [OF mult_left_le_one_le noq] simp del: less_divide_eq_numeral1) - done - show ?thesis - apply (intro exI conjI) - apply (rule pf) - using * - apply (auto simp add: pathstart_def pathfinish_def algebra_simps) - done + define pf where "pf \ \t. q t + (g 0 - q 0) + t *\<^sub>R (g 1 - q 1 - (g 0 - q 0))" + show thesis + proof + show "polynomial_function pf" + by (force simp add: poq pf_def) + show "norm (pf t - g t) < e" + if "t \ {0..1}" for t + proof - + have *: "norm (((q t - g t) + (g 0 - q 0)) + (t *\<^sub>R (g 1 - q 1) + t *\<^sub>R (q 0 - g 0))) < (e/4 + e/4) + (e/4+e/4)" + proof (intro Real_Vector_Spaces.norm_add_less) + show "norm (q t - g t) < e / 4" + by (metis noq norm_minus_commute that) + show "norm (t *\<^sub>R (g 1 - q 1)) < e / 4" + using noq that le_less_trans [OF mult_left_le_one_le noq] + by auto + show "norm (t *\<^sub>R (q 0 - g 0)) < e / 4" + using noq that le_less_trans [OF mult_left_le_one_le noq] + by simp (metis norm_minus_commute order_refl zero_le_one) + qed (use noq norm_minus_commute that in auto) + then show ?thesis + by (auto simp add: algebra_simps pf_def) + qed + qed (auto simp add: path_defs pf_def) qed proposition connected_open_polynomial_connected: fixes S :: "'a::euclidean_space set" assumes S: "open S" "connected S" and "x \ S" "y \ S" - shows "\g. polynomial_function g \ path_image g \ S \ - pathstart g = x \ pathfinish g = y" + shows "\g. polynomial_function g \ path_image g \ S \ pathstart g = x \ pathfinish g = y" proof - have "path_connected S" using assms by (simp add: connected_open_path_connected) @@ -1224,23 +1210,37 @@ by (simp add: gt_ex) next case False - then have "- S \ {}" by blast - then show ?thesis - apply (rule_tac x="setdist (path_image p) (-S)" in exI) - using S p - apply (simp add: setdist_gt_0_compact_closed compact_path_image open_closed) - using setdist_le_dist [of _ "path_image p" _ "-S"] - by fastforce + show ?thesis + proof (intro exI conjI ballI) + show "\x. x \ path_image p \ ball x (setdist (path_image p) (-S)) \ S" + using setdist_le_dist [of _ "path_image p" _ "-S"] by fastforce + show "0 < setdist (path_image p) (- S)" + using S p False + by (fastforce simp add: setdist_gt_0_compact_closed compact_path_image open_closed) + qed qed then obtain e where "0 < e"and eb: "\x. x \ path_image p \ ball x e \ S" by auto - show ?thesis - using path_approx_polynomial_function [OF \path p\ \0 < e\] - apply clarify - apply (intro exI conjI, assumption) - using p - apply (fastforce simp add: dist_norm path_image_def norm_minus_commute intro: eb [THEN subsetD])+ - done + obtain pf where "polynomial_function pf" and pf: "pathstart pf = pathstart p" "pathfinish pf = pathfinish p" + and pf_e: "\t. t \ {0..1} \ norm(pf t - p t) < e" + using path_approx_polynomial_function [OF \path p\ \0 < e\] by blast + show ?thesis + proof (intro exI conjI) + show "polynomial_function pf" + by fact + show "pathstart pf = x" "pathfinish pf = y" + by (simp_all add: p pf) + show "path_image pf \ S" + unfolding path_image_def + proof clarsimp + fix x'::real + assume "0 \ x'" "x' \ 1" + then have "dist (p x') (pf x') < e" + by (metis atLeastAtMost_iff dist_commute dist_norm pf_e) + then show "pf x' \ S" + by (metis \0 \ x'\ \x' \ 1\ atLeastAtMost_iff eb imageI mem_ball path_image_def subset_iff) + qed + qed qed lemma differentiable_componentwise_within: @@ -1351,8 +1351,7 @@ with cardB have "n = card B" "dim T = n" by (auto simp: card_image) have fx: "(\i\B. (f x \ i) *\<^sub>R i) = f x" if "x \ S" for x - apply (rule orthonormal_basis_expand [OF orthB B1 _ \finite B\]) - using \f ` S \ T\ spanB that by auto + by (metis (no_types, lifting) B1 \finite B\ assms(5) image_subset_iff orthB orthonormal_basis_expand spanB sum.cong that) have cont: "continuous_on S (\x. \i\B. (f x \ i) *\<^sub>R i)" by (intro continuous_intros contf) obtain g where "polynomial_function g" @@ -1364,9 +1363,7 @@ show ?thesis proof show "polynomial_function (\x. \i\B. (g x \ i) *\<^sub>R i)" - apply (rule polynomial_function_sum) - apply (simp add: \finite B\) - using \polynomial_function g\ by auto + using \polynomial_function g\ by (force intro: \finite B\) show "(\x. \i\B. (g x \ i) *\<^sub>R i) ` S \ T" using \B \ T\ by (blast intro: subspace_sum subspace_mul \subspace T\) @@ -1374,9 +1371,7 @@ proof - have orth': "pairwise (\i j. orthogonal ((f x \ i) *\<^sub>R i - (g x \ i) *\<^sub>R i) ((f x \ j) *\<^sub>R j - (g x \ j) *\<^sub>R j)) B" - apply (rule pairwise_mono [OF orthB]) - apply (auto simp: orthogonal_def inner_diff_right inner_diff_left) - done + by (auto simp: orthogonal_def inner_diff_right inner_diff_left intro: pairwise_mono [OF orthB]) then have "(norm (\i\B. (f x \ i) *\<^sub>R i - (g x \ i) *\<^sub>R i))\<^sup>2 = (\i\B. (norm ((f x \ i) *\<^sub>R i - (g x \ i) *\<^sub>R i))\<^sup>2)" by (simp add: norm_sum_Pythagorean [OF \finite B\ orth']) diff -r 075f3cbc7546 -r 698b58513fd1 src/HOL/Complex_Analysis/Cauchy_Integral_Formula.thy --- a/src/HOL/Complex_Analysis/Cauchy_Integral_Formula.thy Mon Oct 05 22:49:46 2020 +0200 +++ b/src/HOL/Complex_Analysis/Cauchy_Integral_Formula.thy Mon Oct 05 22:53:40 2020 +0100 @@ -2206,7 +2206,7 @@ using contour_integral_nearby_ends [OF _ \path \\ pasz] S by (simp add: open_Diff) metis obtain p where polyp: "polynomial_function p" and ps: "pathstart p = pathstart \" and pf: "pathfinish p = pathfinish \" and led: "\t\{0..1}. cmod (p t - \ t) < d" - using path_approx_polynomial_function [OF \path \\ \d > 0\] by blast + using path_approx_polynomial_function [OF \path \\ \d > 0\] by metis then have ploop: "pathfinish p = pathstart p" using loop by auto have vpp: "valid_path p" using polyp valid_path_polynomial_function by blast have [simp]: "z \ path_image \" using pasz by blast @@ -2808,7 +2808,7 @@ fix z :: complex assume "z \ eball 0 (pi / (2 * norm c))" with cos_eq_zero_imp_norm_ge[of "c*z"] assms show "eval_fps (fps_cos c) z \ 0" using False by (auto simp: norm_mult field_simps) - qed (insert False assms, auto simp: field_simps tan_def) + qed (use False assms in \auto simp: field_simps tan_def\) qed simp_all end diff -r 075f3cbc7546 -r 698b58513fd1 src/HOL/Complex_Analysis/Cauchy_Integral_Theorem.thy --- a/src/HOL/Complex_Analysis/Cauchy_Integral_Theorem.thy Mon Oct 05 22:49:46 2020 +0200 +++ b/src/HOL/Complex_Analysis/Cauchy_Integral_Theorem.thy Mon Oct 05 22:53:40 2020 +0100 @@ -1366,11 +1366,7 @@ and p: "polynomial_function p" "path_image p \ S" and pi: "\f. f holomorphic_on S \ contour_integral g f = contour_integral p f" using contour_integral_nearby_ends [OF S \path g\ pag] - apply clarify - apply (drule_tac x=g in spec) - apply (simp only: assms) - apply (force simp: valid_path_polynomial_function dest: path_approx_polynomial_function) - done + by (metis cancel_comm_monoid_add_class.diff_cancel g norm_zero path_approx_polynomial_function valid_path_polynomial_function) then obtain p' where p': "polynomial_function p'" "\x. (p has_vector_derivative (p' x)) (at x)" by (blast intro: has_vector_derivative_polynomial_function that) diff -r 075f3cbc7546 -r 698b58513fd1 src/HOL/Complex_Analysis/Winding_Numbers.thy --- a/src/HOL/Complex_Analysis/Winding_Numbers.thy Mon Oct 05 22:49:46 2020 +0200 +++ b/src/HOL/Complex_Analysis/Winding_Numbers.thy Mon Oct 05 22:53:40 2020 +0100 @@ -33,7 +33,7 @@ using contour_integral_nearby_ends [of "UNIV - {z}" \] assms by (auto simp: open_delete) then obtain h where h: "polynomial_function h \ pathstart h = pathstart \ \ pathfinish h = pathfinish \ \ (\t \ {0..1}. norm(h t - \ t) < d/2)" - using path_approx_polynomial_function [OF \path \\, of "d/2"] d by auto + using path_approx_polynomial_function [OF \path \\, of "d/2"] d by (metis half_gt_zero_iff) define nn where "nn = 1/(2* pi*\) * contour_integral h (\w. 1/(w - z))" have "\n. \e > 0. \p. winding_number_prop \ z e p n" proof (rule_tac x=nn in exI, clarify) @@ -41,14 +41,15 @@ assume e: "e>0" obtain p where p: "polynomial_function p \ pathstart p = pathstart \ \ pathfinish p = pathfinish \ \ (\t\{0..1}. cmod (p t - \ t) < min e (d/2))" - using path_approx_polynomial_function [OF \path \\, of "min e (d/2)"] d \0 by auto + using path_approx_polynomial_function [OF \path \\, of "min e (d/2)"] d \0 + by (metis min_less_iff_conj zero_less_divide_iff zero_less_numeral) have "(\w. 1 / (w - z)) holomorphic_on UNIV - {z}" by (auto simp: intro!: holomorphic_intros) - then show "\p. winding_number_prop \ z e p nn" - apply (rule_tac x=p in exI) + then have "winding_number_prop \ z e p nn" using pi_eq [of h p] h p d - apply (auto simp: valid_path_polynomial_function norm_minus_commute nn_def winding_number_prop_def) - done + by (auto simp: valid_path_polynomial_function norm_minus_commute nn_def winding_number_prop_def) + then show "\p. winding_number_prop \ z e p nn" + by metis qed then show ?thesis unfolding winding_number_def by (rule someI2_ex) (blast intro: \0) @@ -845,7 +846,8 @@ obtain p where p: "polynomial_function p" "pathstart p = pathstart \" "pathfinish p = pathfinish \" and pg1: "(\t. \0 \ t; t \ 1\ \ cmod (p t - \ t) < 1)" and pge: "(\t. \0 \ t; t \ 1\ \ cmod (p t - \ t) < e)" - using path_approx_polynomial_function [OF \, of "min 1 e"] \e>0\ by force + using path_approx_polynomial_function [OF \, of "min 1 e"] \e>0\ + by (metis atLeastAtMost_iff min_less_iff_conj zero_less_one) have pip: "path_image p \ ball 0 (B + 1)" using B apply (clarsimp simp add: path_image_def dist_norm ball_def) @@ -2106,7 +2108,7 @@ then obtain g where pfg: "polynomial_function g" and "g 0 = p 0" "g 1 = p 1" and gless: "\t. t \ {0..1} \ norm(g t - p t) < min 1 d" using path_approx_polynomial_function [OF \path p\] \d > 0\ \0 < e\ - unfolding pathfinish_def pathstart_def by meson + unfolding pathfinish_def pathstart_def by blast have "winding_number (exp \ p) 0 = winding_number (exp \ g) 0" proof (rule winding_number_nearby_paths_eq [symmetric]) show "path (exp \ p)" "path (exp \ g)" @@ -2158,7 +2160,7 @@ apply (rule fundamental_theorem_of_calculus [OF zero_le_one]) by (metis has_vector_derivative_at_within has_vector_derivative_polynomial_function pfg vector_derivative_at) then show ?thesis - apply (simp add: pathfinish_def pathstart_def) + unfolding pathfinish_def pathstart_def using \g 0 = p 0\ \g 1 = p 1\ by auto qed finally show ?thesis .