# HG changeset patch # User paulson # Date 1525009571 -3600 # Node ID 2cab37094fc451cb49076c0950e10749f57f454b # Parent ebd179b82e20e7a6e1512a61155b6ff02372611d more defer/prefer diff -r ebd179b82e20 -r 2cab37094fc4 src/HOL/Analysis/Complex_Analysis_Basics.thy --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy Sat Apr 28 21:37:45 2018 +0100 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy Sun Apr 29 14:46:11 2018 +0100 @@ -837,15 +837,13 @@ qed } note ** = this show ?thesis - unfolding has_field_derivative_def + unfolding has_field_derivative_def proof (rule has_derivative_sequence [OF cvs _ _ x]) - show "\n. \x\s. (f n has_derivative (( * ) (f' n x))) (at x within s)" - by (metis has_field_derivative_def df) - next show "(\n. f n x) \ l" + show "(\n. f n x) \ l" by (rule tf) - next show "\e>0. \N. \n\N. \x\s. \h. cmod (f' n x * h - g' x * h) \ e * cmod h" + next show "\e. e > 0 \ \N. \n\N. \x\s. \h. cmod (f' n x * h - g' x * h) \ e * cmod h" by (blast intro: **) - qed + qed (metis has_field_derivative_def df) qed lemma has_complex_derivative_series: @@ -884,7 +882,7 @@ by (metis df has_field_derivative_def mult_commute_abs) next show " ((\n. f n x) sums l)" by (rule sf) - next show "\e>0. \N. \n\N. \x\s. \h. cmod ((\i e * cmod h" + next show "\e. e>0 \ \N. \n\N. \x\s. \h. cmod ((\i e * cmod h" by (blast intro: **) qed qed @@ -896,7 +894,7 @@ assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x)" assumes "uniformly_convergent_on s (\n x. \i s" "summable (\n. f n x0)" and x: "x \ s" - shows "summable (\n. f n x)" and "(\x. \n. f n x) field_differentiable (at x)" + shows "(\x. \n. f n x) field_differentiable (at x)" proof - from assms(4) obtain g' where A: "uniform_limit s (\n x. \ix. x \ s \ (\n. f n x) sums g x" "\x. x \ s \ (g has_field_derivative g' x) (at x within s)" by blast - from g[OF x] show "summable (\n. f n x)" by (auto simp: summable_def) from g(2)[OF x] have g': "(g has_derivative ( * ) (g' x)) (at x)" by (simp add: has_field_derivative_def s) have "((\x. \n. f n x) has_derivative ( * ) (g' x)) (at x)" @@ -915,15 +912,6 @@ by (auto simp: summable_def field_differentiable_def has_field_derivative_def) qed -lemma field_differentiable_series': - fixes f :: "nat \ 'a::{real_normed_field,banach} \ 'a" - assumes "convex s" "open s" - assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x)" - assumes "uniformly_convergent_on s (\n x. \i s" "summable (\n. f n x0)" - shows "(\x. \n. f n x) field_differentiable (at x0)" - using field_differentiable_series[OF assms, of x0] \x0 \ s\ by blast+ - subsection\Bound theorem\ lemma field_differentiable_bound: diff -r ebd179b82e20 -r 2cab37094fc4 src/HOL/Analysis/Derivative.thy --- a/src/HOL/Analysis/Derivative.thy Sat Apr 28 21:37:45 2018 +0100 +++ b/src/HOL/Analysis/Derivative.thy Sun Apr 29 14:46:11 2018 +0100 @@ -1197,13 +1197,13 @@ lemma has_derivative_inverse_basic: fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" - assumes "(f has_derivative f') (at (g y))" - and "bounded_linear g'" + assumes derf: "(f has_derivative f') (at (g y))" + and ling': "bounded_linear g'" and "g' \ f' = id" - and "continuous (at y) g" - and "open t" - and "y \ t" - and "\z\t. f (g z) = z" + and contg: "continuous (at y) g" + and "open T" + and "y \ T" + and fg: "\z. z \ T \ f (g z) = z" shows "(g has_derivative g') (at y)" proof - interpret f': bounded_linear f' @@ -1214,70 +1214,48 @@ using bounded_linear.pos_bounded[OF assms(2)] by blast have lem1: "\e>0. \d>0. \z. norm (z - y) < d \ norm (g z - g y - g'(z - y)) \ e * norm (g z - g y)" - proof (rule, rule) + proof (intro allI impI) fix e :: real assume "e > 0" with C(1) have *: "e / C > 0" by auto - obtain d0 where d0: - "0 < d0" - "\ya. norm (ya - g y) < d0 \ norm (f ya - f (g y) - f' (ya - g y)) \ e / C * norm (ya - g y)" - using assms(1) - unfolding has_derivative_at_alt - using * by blast - obtain d1 where d1: - "0 < d1" - "\x. 0 < dist x y \ dist x y < d1 \ dist (g x) (g y) < d0" - using assms(4) - unfolding continuous_at Lim_at - using d0(1) by blast - obtain d2 where d2: - "0 < d2" - "\ya. dist ya y < d2 \ ya \ t" - using assms(5) - unfolding open_dist - using assms(6) by blast + obtain d0 where "0 < d0" and d0: + "\u. norm (u - g y) < d0 \ norm (f u - f (g y) - f' (u - g y)) \ e / C * norm (u - g y)" + using derf * unfolding has_derivative_at_alt by blast + obtain d1 where "0 < d1" and d1: "\x. \0 < dist x y; dist x y < d1\ \ dist (g x) (g y) < d0" + using contg \0 < d0\ unfolding continuous_at Lim_at by blast + obtain d2 where "0 < d2" and d2: "\u. dist u y < d2 \ u \ T" + using \open T\ \y \ T\ unfolding open_dist by blast obtain d where d: "0 < d" "d < d1" "d < d2" - using real_lbound_gt_zero[OF d1(1) d2(1)] by blast - then show "\d>0. \z. norm (z - y) < d \ norm (g z - g y - g' (z - y)) \ e * norm (g z - g y)" - apply (rule_tac x=d in exI) - apply rule - defer - apply rule - apply rule - proof - + using real_lbound_gt_zero[OF \0 < d1\ \0 < d2\] by blast + show "\d>0. \z. norm (z - y) < d \ norm (g z - g y - g' (z - y)) \ e * norm (g z - g y)" + proof (intro exI allI impI conjI) fix z assume as: "norm (z - y) < d" - then have "z \ t" + then have "z \ T" using d2 d unfolding dist_norm by auto have "norm (g z - g y - g' (z - y)) \ norm (g' (f (g z) - y - f' (g z - g y)))" unfolding g'.diff f'.diff - unfolding assms(3)[unfolded o_def id_def, THEN fun_cong] - unfolding assms(7)[rule_format,OF \z\t\] - apply (subst norm_minus_cancel[symmetric]) - apply auto - done + unfolding assms(3)[unfolded o_def id_def, THEN fun_cong] fg[OF \z\T\] + by (simp add: norm_minus_commute) also have "\ \ norm (f (g z) - y - f' (g z - g y)) * C" by (rule C(2)) also have "\ \ (e / C) * norm (g z - g y) * C" - apply (rule mult_right_mono) - apply (rule d0(2)[rule_format,unfolded assms(7)[rule_format,OF \y\t\]]) - apply (cases "z = y") - defer - apply (rule d1(2)[unfolded dist_norm,rule_format]) - using as d C d0 - apply auto - done + proof - + have "norm (g z - g y) < d0" + by (metis as cancel_comm_monoid_add_class.diff_cancel d(2) \0 < d0\ d1 diff_gt_0_iff_gt diff_strict_mono dist_norm dist_self zero_less_dist_iff) + then show ?thesis + by (metis C(1) \y \ T\ d0 fg real_mult_le_cancel_iff1) + qed also have "\ \ e * norm (g z - g y)" using C by (auto simp add: field_simps) finally show "norm (g z - g y - g' (z - y)) \ e * norm (g z - g y)" by simp - qed auto + qed (use d in auto) qed have *: "(0::real) < 1 / 2" by auto - obtain d where d: - "0 < d" - "\z. norm (z - y) < d \ norm (g z - g y - g' (z - y)) \ 1 / 2 * norm (g z - g y)" + obtain d where "0 < d" and d: + "\z. norm (z - y) < d \ norm (g z - g y - g' (z - y)) \ 1/2 * norm (g z - g y)" using lem1 * by blast define B where "B = C * 2" have "B > 0" @@ -1287,51 +1265,37 @@ have "norm (g z - g y) \ norm(g' (z - y)) + norm ((g z - g y) - g'(z - y))" by (rule norm_triangle_sub) also have "\ \ norm (g' (z - y)) + 1 / 2 * norm (g z - g y)" - apply (rule add_left_mono) - using d and z - apply auto - done + by (rule add_left_mono) (use d z in auto) also have "\ \ norm (z - y) * C + 1 / 2 * norm (g z - g y)" - apply (rule add_right_mono) - using C - apply auto - done + by (rule add_right_mono) (use C in auto) finally show "norm (g z - g y) \ B * norm (z - y)" unfolding B_def by (auto simp add: field_simps) qed show ?thesis unfolding has_derivative_at_alt - apply rule - apply (rule assms) - apply rule - apply rule - proof - + proof (intro conjI assms allI impI) fix e :: real assume "e > 0" then have *: "e / B > 0" by (metis \B > 0\ divide_pos_pos) - obtain d' where d': - "0 < d'" - "\z. norm (z - y) < d' \ norm (g z - g y - g' (z - y)) \ e / B * norm (g z - g y)" + obtain d' where "0 < d'" and d': + "\z. norm (z - y) < d' \ norm (g z - g y - g' (z - y)) \ e / B * norm (g z - g y)" using lem1 * by blast obtain k where k: "0 < k" "k < d" "k < d'" - using real_lbound_gt_zero[OF d(1) d'(1)] by blast + using real_lbound_gt_zero[OF \0 < d\ \0 < d'\] by blast show "\d>0. \ya. norm (ya - y) < d \ norm (g ya - g y - g' (ya - y)) \ e * norm (ya - y)" - apply (rule_tac x=k in exI) - apply auto - proof - + proof (intro exI allI impI conjI) fix z assume as: "norm (z - y) < k" then have "norm (g z - g y - g' (z - y)) \ e / B * norm(g z - g y)" using d' k by auto also have "\ \ e * norm (z - y)" unfolding times_divide_eq_left pos_divide_le_eq[OF \B>0\] - using lem2[of z] - using k as using \e > 0\ + using lem2[of z] k as \e > 0\ by (auto simp add: field_simps) finally show "norm (g z - g y - g' (z - y)) \ e * norm (z - y)" by simp - qed(insert k, auto) + qed (use k in auto) qed qed @@ -1344,25 +1308,22 @@ and "g' \ f' = id" and "continuous (at (f x)) g" and "g (f x) = x" - and "open t" - and "f x \ t" - and "\y\t. f (g y) = y" + and "open T" + and "f x \ T" + and "\y. y \ T \ f (g y) = y" shows "(g has_derivative g') (at (f x))" - apply (rule has_derivative_inverse_basic) - using assms - apply auto - done + by (rule has_derivative_inverse_basic) (use assms in auto) text \This is the version in Dieudonne', assuming continuity of f and g.\ lemma has_derivative_inverse_dieudonne: fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" - assumes "open s" - and "open (f ` s)" - and "continuous_on s f" - and "continuous_on (f ` s) g" - and "\x\s. g (f x) = x" - and "x \ s" + assumes "open S" + and "open (f ` S)" + and "continuous_on S f" + and "continuous_on (f ` S) g" + and "\x. x \ S \ g (f x) = x" + and "x \ S" and "(f has_derivative f') (at x)" and "bounded_linear g'" and "g' \ f' = id" @@ -1377,11 +1338,11 @@ lemma has_derivative_inverse: fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" - assumes "compact s" - and "x \ s" - and "f x \ interior (f ` s)" - and "continuous_on s f" - and "\y\s. g (f y) = y" + assumes "compact S" + and "x \ S" + and fx: "f x \ interior (f ` S)" + and "continuous_on S f" + and "\y. y \ S \ g (f y) = y" and "(f has_derivative f') (at x)" and "bounded_linear g'" and "g' \ f' = id" @@ -1389,20 +1350,17 @@ proof - { fix y - assume "y \ interior (f ` s)" - then obtain x where "x \ s" and *: "y = f x" - unfolding image_iff - using interior_subset - by auto + assume "y \ interior (f ` S)" + then obtain x where "x \ S" and *: "y = f x" + by (meson imageE interior_subset subsetCE) have "f (g y) = y" - unfolding * and assms(5)[rule_format,OF \x\s\] .. + unfolding * and assms(5)[rule_format,OF \x\S\] .. } note * = this show ?thesis - apply (rule has_derivative_inverse_basic_x[OF assms(6-8)]) - apply (rule continuous_on_interior[OF _ assms(3)]) - apply (rule continuous_on_inv[OF assms(4,1)]) - apply (rule assms(2,5) assms(5)[rule_format] open_interior assms(3))+ - apply (metis *) + apply (rule has_derivative_inverse_basic_x[OF assms(6-8), where T = "interior (f ` S)"]) + apply (rule continuous_on_interior[OF _ fx]) + apply (rule continuous_on_inv) + apply (simp_all add: assms *) done qed @@ -1411,13 +1369,13 @@ lemma brouwer_surjective: fixes f :: "'n::euclidean_space \ 'n" - assumes "compact t" - and "convex t" - and "t \ {}" - and "continuous_on t f" - and "\x\s. \y\t. x + (y - f y) \ t" - and "x \ s" - shows "\y\t. f y = x" + assumes "compact T" + and "convex T" + and "T \ {}" + and "continuous_on T f" + and "\x y. \x\S; y\T\ \ x + (y - f y) \ T" + and "x \ S" + shows "\y\T. f y = x" proof - have *: "\x y. f y = x \ x + (y - f y) = y" by (auto simp add: algebra_simps) @@ -1432,10 +1390,10 @@ lemma brouwer_surjective_cball: fixes f :: "'n::euclidean_space \ 'n" - assumes "e > 0" - and "continuous_on (cball a e) f" - and "\x\s. \y\cball a e. x + (y - f y) \ cball a e" - and "x \ s" + assumes "continuous_on (cball a e) f" + and "e > 0" + and "x \ S" + and "\x y. \x\S; y\cball a e\ \ x + (y - f y) \ cball a e" shows "\y\cball a e. f y = x" apply (rule brouwer_surjective) apply (rule compact_cball convex_cball)+ @@ -1448,14 +1406,14 @@ lemma sussmann_open_mapping: fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" - assumes "open s" - and "continuous_on s f" - and "x \ s" + assumes "open S" + and "continuous_on S f" + and "x \ S" and "(f has_derivative f') (at x)" and "bounded_linear g'" "f' \ g' = id" - and "t \ s" - and "x \ interior t" - shows "f x \ interior (f ` t)" + and "T \ S" + and "x \ interior T" + shows "f x \ interior (f ` T)" proof - interpret f': bounded_linear f' using assms @@ -1473,31 +1431,17 @@ using assms(4) unfolding has_derivative_at_alt using * by blast - obtain e1 where e1: "0 < e1" "cball x e1 \ t" + obtain e1 where e1: "0 < e1" "cball x e1 \ T" using assms(8) unfolding mem_interior_cball by blast have *: "0 < e0 / B" "0 < e1 / B" using e0 e1 B by auto obtain e where e: "0 < e" "e < e0 / B" "e < e1 / B" using real_lbound_gt_zero[OF *] by blast - have "\z\cball (f x) (e / 2). \y\cball (f x) e. f (x + g' (y - f x)) = z" - apply rule - apply (rule brouwer_surjective_cball[where s="cball (f x) (e/2)"]) - prefer 3 - apply rule - apply rule - proof- - show "continuous_on (cball (f x) e) (\y. f (x + g' (y - f x)))" - unfolding g'.diff - apply (rule continuous_on_compose[of _ _ f, unfolded o_def]) - apply (rule continuous_intros linear_continuous_on[OF assms(5)])+ - apply (rule continuous_on_subset[OF assms(2)]) - apply rule - apply (unfold image_iff) - apply (erule bexE) + have lem: "\y\cball (f x) e. f (x + g' (y - f x)) = z" if "z\cball (f x) (e / 2)" for z + proof (rule brouwer_surjective_cball) + have z: "z \ S" if as: "y \cball (f x) e" "z = x + (g' y - g' (f x))" for y z proof- - fix y z - assume as: "y \cball (f x) e" "z = x + (g' y - g' (f x))" have "dist x z = norm (g' (f x) - g' y)" unfolding as(2) and dist_norm by auto also have "\ \ norm (f x - y) * B" @@ -1516,9 +1460,16 @@ finally have "z \ cball x e1" unfolding mem_cball by force - then show "z \ s" + then show "z \ S" using e1 assms(7) by auto qed + show "continuous_on (cball (f x) e) (\y. f (x + g' (y - f x)))" + unfolding g'.diff + apply (rule continuous_on_compose[of _ _ f, unfolded o_def]) + apply (rule continuous_intros linear_continuous_on[OF assms(5)])+ + apply (rule continuous_on_subset[OF assms(2)]) + using z + by blast next fix y z assume as: "y \ cball (f x) (e / 2)" "z \ cball (f x) e" @@ -1528,7 +1479,7 @@ apply (rule mult_right_mono) using as(2)[unfolded mem_cball dist_norm] and B unfolding norm_minus_commute - apply auto + apply auto done also have "\ < e0" using e and B @@ -1563,7 +1514,7 @@ finally show "y + (z - f (x + g' (z - f x))) \ cball (f x) e" unfolding mem_cball dist_norm by auto - qed (insert e, auto) note lem = this + qed (use e that in auto) show ?thesis unfolding mem_interior apply (rule_tac x="e/2" in exI) @@ -1589,13 +1540,13 @@ done also have "\ \ e1" using e B unfolding less_divide_eq by auto - finally have "x + g'(z - f x) \ t" + finally have "x + g'(z - f x) \ T" apply - apply (rule e1(2)[unfolded subset_eq,rule_format]) unfolding mem_cball dist_norm apply auto done - then show "y \ f ` t" + then show "y \ f ` T" using z by auto qed (insert e, auto) qed @@ -1750,9 +1701,9 @@ fixes f :: "'n::euclidean_space \ 'm::euclidean_space" assumes "a \ s" and "open s" - and "bounded_linear g'" + and bling: "bounded_linear g'" and "g' \ f' a = id" - and "\x. x \ s \ (f has_derivative f' x) (at x)" + and derf: "\x. x \ s \ (f has_derivative f' x) (at x)" and "\e. e > 0 \ \d>0. \x. dist a x < d \ onorm (\v. f' x v - f' a v) < e" obtains r where "r > 0" "ball a r \ s" "inj_on f (ball a r)" proof - @@ -1760,11 +1711,7 @@ using assms by auto note f'g' = assms(4)[unfolded id_def o_def,THEN cong] have "g' (f' a (\Basis)) = (\Basis)" "(\Basis) \ (0::'n)" - defer - apply (subst euclidean_eq_iff) - using f'g' - apply auto - done + using f'g' by auto then have *: "0 < onorm g'" unfolding onorm_pos_lt[OF assms(3)] by fastforce @@ -1812,17 +1759,11 @@ have *: "(\v. v - g' (f' u v)) = g' \ (\w. f' a w - f' u w)" unfolding o_def and diff using f'g' by auto + have blin: "bounded_linear (f' a)" + using \a \ s\ derf by blast show "(ph has_derivative (\v. v - g' (f' u v))) (at u within ball a d)" - unfolding ph' * - apply (simp add: comp_def) - apply (rule bounded_linear.has_derivative[OF assms(3)]) - apply (rule derivative_intros) - defer - apply (rule has_derivative_sub[where g'="\x.0",unfolded diff_0_right]) - apply (rule has_derivative_at_withinI) - using assms(5) and \u \ s\ \a \ s\ - apply (auto intro!: derivative_intros bounded_linear.has_derivative[of _ "\x. x"] has_derivative_bounded_linear) - done + unfolding ph' * comp_def + by (rule \u \ s\ derivative_eq_intros has_derivative_at_withinI [OF derf] bounded_linear.has_derivative [OF blin] bounded_linear.has_derivative [OF bling] |simp)+ have **: "bounded_linear (\x. f' u x - f' a x)" "bounded_linear (\x. f' a x - f' u x)" apply (rule_tac[!] bounded_linear_sub) apply (rule_tac[!] has_derivative_bounded_linear) @@ -1896,21 +1837,20 @@ qed qed -lemma has_derivative_sequence_lipschitz: +lemma has_derivative_sequence_Lipschitz: fixes f :: "nat \ 'a::real_normed_vector \ 'b::real_normed_vector" - assumes "convex s" - and "\n. \x\s. ((f n) has_derivative (f' n x)) (at x within s)" - and "\e>0. \N. \n\N. \x\s. \h. norm (f' n x h - g' x h) \ e * norm h" - shows "\e>0. \N. \m\N. \n\N. \x\s. \y\s. + assumes "convex S" + and "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and "\e. e > 0 \ \N. \n\N. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + and "e > 0" + shows "\N. \m\N. \n\N. \x\S. \y\S. norm ((f m x - f n x) - (f m y - f n y)) \ e * norm (x - y)" -proof (rule, rule) - fix e :: real - assume "e > 0" - then have *: "2 * (1/2* e) = e" "1/2 * e >0" - by auto - obtain N where "\n\N. \x\s. \h. norm (f' n x h - g' x h) \ 1 / 2 * e * norm h" +proof - + have *: "2 * (1/2* e) = e" "1/2 * e >0" + using \e>0\ by auto + obtain N where "\n\N. \x\S. \h. norm (f' n x h - g' x h) \ 1 / 2 * e * norm h" using assms(3) *(2) by blast - then show "\N. \m\N. \n\N. \x\s. \y\s. norm (f m x - f n x - (f m y - f n y)) \ e * norm (x - y)" + then show "\N. \m\N. \n\N. \x\S. \y\S. norm (f m x - f n x - (f m y - f n y)) \ e * norm (x - y)" apply (rule_tac x=N in exI) apply (rule has_derivative_sequence_lipschitz_lemma[where e="1/2 *e", unfolded *]) using assms \e > 0\ @@ -1920,22 +1860,22 @@ lemma has_derivative_sequence: fixes f :: "nat \ 'a::real_normed_vector \ 'b::banach" - assumes "convex s" - and "\n. \x\s. ((f n) has_derivative (f' n x)) (at x within s)" - and "\e>0. \N. \n\N. \x\s. \h. norm (f' n x h - g' x h) \ e * norm h" - and "x0 \ s" + assumes "convex S" + and "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and "\e. e > 0 \ \N. \n\N. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + and "x0 \ S" and "((\n. f n x0) \ l) sequentially" - shows "\g. \x\s. ((\n. f n x) \ g x) sequentially \ (g has_derivative g'(x)) (at x within s)" + shows "\g. \x\S. ((\n. f n x) \ g x) sequentially \ (g has_derivative g'(x)) (at x within S)" proof - - have lem1: "\e>0. \N. \m\N. \n\N. \x\s. \y\s. + have lem1: "\e. e > 0 \ \N. \m\N. \n\N. \x\S. \y\S. norm ((f m x - f n x) - (f m y - f n y)) \ e * norm (x - y)" - using assms(1,2,3) by (rule has_derivative_sequence_lipschitz) - have "\g. \x\s. ((\n. f n x) \ g x) sequentially" + using assms(1,2,3) by (rule has_derivative_sequence_Lipschitz) + have "\g. \x\S. ((\n. f n x) \ g x) sequentially" apply (rule bchoice) unfolding convergent_eq_Cauchy proof fix x - assume "x \ s" + assume "x \ S" show "Cauchy (\n. f n x)" proof (cases "x = x0") case True @@ -1945,7 +1885,7 @@ case False show ?thesis unfolding Cauchy_def - proof (rule, rule) + proof (intro allI impI) fix e :: real assume "e > 0" hence *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0" using False by auto @@ -1955,12 +1895,11 @@ using *(1) by blast obtain N where N: "\m\N. \n\N. - \xa\s. \y\s. norm (f m xa - f n xa - (f m y - f n y)) \ + \xa\S. \y\S. norm (f m xa - f n xa - (f m y - f n y)) \ e / 2 / norm (x - x0) * norm (xa - y)" using lem1 *(2) by blast show "\M. \m\M. \n\M. dist (f m x) (f n x) < e" - apply (rule_tac x="max M N" in exI) - proof rule+ + proof (intro exI allI impI) fix m n assume as: "max M N \m" "max M N\n" have "dist (f m x) (f n x) \ @@ -1968,7 +1907,7 @@ unfolding dist_norm by (rule norm_triangle_sub) also have "\ \ norm (f m x0 - f n x0) + e / 2" - using N[rule_format,OF _ _ \x\s\ \x0\s\, of m n] and as and False + using N[rule_format,OF _ _ \x\S\ \x0\S\, of m n] and as and False by auto also have "\ < e / 2 + e / 2" apply (rule add_strict_right_mono) @@ -1982,27 +1921,24 @@ qed qed qed - then obtain g where g: "\x\s. (\n. f n x) \ g x" .. - have lem2: "\e>0. \N. \n\N. \x\s. \y\s. norm ((f n x - f n y) - (g x - g y)) \ e * norm (x - y)" + then obtain g where g: "\x\S. (\n. f n x) \ g x" .. + have lem2: "\e>0. \N. \n\N. \x\S. \y\S. norm ((f n x - f n y) - (g x - g y)) \ e * norm (x - y)" proof (rule, rule) fix e :: real assume *: "e > 0" obtain N where - N: "\m\N. \n\N. \x\s. \y\s. norm (f m x - f n x - (f m y - f n y)) \ e * norm (x - y)" + N: "\m\N. \n\N. \x\S. \y\S. norm (f m x - f n x - (f m y - f n y)) \ e * norm (x - y)" using lem1 * by blast - show "\N. \n\N. \x\s. \y\s. norm (f n x - f n y - (g x - g y)) \ e * norm (x - y)" + show "\N. \n\N. \x\S. \y\S. norm (f n x - f n y - (g x - g y)) \ e * norm (x - y)" apply (rule_tac x=N in exI) proof rule+ fix n x y - assume as: "N \ n" "x \ s" "y \ s" + assume as: "N \ n" "x \ S" "y \ S" have "((\m. norm (f n x - f n y - (f m x - f m y))) \ norm (f n x - f n y - (g x - g y))) sequentially" by (intro tendsto_intros g[rule_format] as) moreover have "eventually (\m. norm (f n x - f n y - (f m x - f m y)) \ e * norm (x - y)) sequentially" unfolding eventually_sequentially - apply (rule_tac x=N in exI) - apply rule - apply rule - proof - + proof (intro exI allI impI) fix m assume "N \ m" then show "norm (f n x - f n y - (f m x - f m y)) \ e * norm (x - y)" @@ -2013,11 +1949,11 @@ by (simp add: tendsto_upperbound) qed qed - have "\x\s. ((\n. f n x) \ g x) sequentially \ (g has_derivative g' x) (at x within s)" + have "\x\S. ((\n. f n x) \ g x) sequentially \ (g has_derivative g' x) (at x within S)" unfolding has_derivative_within_alt2 proof (intro ballI conjI) fix x - assume "x \ s" + assume "x \ S" then show "((\n. f n x) \ g x) sequentially" by (simp add: g) have lem3: "\u. ((\n. f' n x u) \ g' x u) sequentially" @@ -2030,7 +1966,7 @@ proof (cases "u = 0") case True have "eventually (\n. norm (f' n x u - g' x u) \ e * norm u) sequentially" - using assms(3)[folded eventually_sequentially] and \0 < e\ and \x \ s\ + using assms(3)[folded eventually_sequentially] and \0 < e\ and \x \ S\ by (fast elim: eventually_mono) then show ?thesis using \u = 0\ and \0 < e\ by (auto elim: eventually_mono) @@ -2038,7 +1974,7 @@ case False with \0 < e\ have "0 < e / norm u" by simp then have "eventually (\n. norm (f' n x u - g' x u) \ e / norm u * norm u) sequentially" - using assms(3)[folded eventually_sequentially] and \x \ s\ + using assms(3)[folded eventually_sequentially] and \x \ S\ by (fast elim: eventually_mono) then show ?thesis using \u \ 0\ by simp @@ -2048,7 +1984,7 @@ proof fix x' y z :: 'a fix c :: real - note lin = assms(2)[rule_format,OF \x\s\,THEN has_derivative_bounded_linear] + note lin = assms(2)[rule_format,OF \x\S\,THEN has_derivative_bounded_linear] show "g' x (c *\<^sub>R x') = c *\<^sub>R g' x x'" apply (rule tendsto_unique[OF trivial_limit_sequentially]) apply (rule lem3[rule_format]) @@ -2064,9 +2000,9 @@ apply (rule lem3[rule_format])+ done obtain N where N: "\h. norm (f' N x h - g' x h) \ 1 * norm h" - using assms(3) \x \ s\ by (fast intro: zero_less_one) + using assms(3) \x \ S\ by (fast intro: zero_less_one) have "bounded_linear (f' N x)" - using assms(2) \x \ s\ by fast + using assms(2) \x \ S\ by fast from bounded_linear.bounded [OF this] obtain K where K: "\h. norm (f' N x h) \ norm h * K" .. { @@ -2082,36 +2018,36 @@ } then show "\K. \h. norm (g' x h) \ norm h * K" by fast qed - show "\e>0. eventually (\y. norm (g y - g x - g' x (y - x)) \ e * norm (y - x)) (at x within s)" + show "\e>0. eventually (\y. norm (g y - g x - g' x (y - x)) \ e * norm (y - x)) (at x within S)" proof (rule, rule) fix e :: real assume "e > 0" then have *: "e / 3 > 0" by auto - obtain N1 where N1: "\n\N1. \x\s. \h. norm (f' n x h - g' x h) \ e / 3 * norm h" + obtain N1 where N1: "\n\N1. \x\S. \h. norm (f' n x h - g' x h) \ e / 3 * norm h" using assms(3) * by blast obtain N2 where - N2: "\n\N2. \x\s. \y\s. norm (f n x - f n y - (g x - g y)) \ e / 3 * norm (x - y)" + N2: "\n\N2. \x\S. \y\S. norm (f n x - f n y - (g x - g y)) \ e / 3 * norm (x - y)" using lem2 * by blast let ?N = "max N1 N2" - have "eventually (\y. norm (f ?N y - f ?N x - f' ?N x (y - x)) \ e / 3 * norm (y - x)) (at x within s)" - using assms(2)[unfolded has_derivative_within_alt2] and \x \ s\ and * by fast - moreover have "eventually (\y. y \ s) (at x within s)" + have "eventually (\y. norm (f ?N y - f ?N x - f' ?N x (y - x)) \ e / 3 * norm (y - x)) (at x within S)" + using assms(2)[unfolded has_derivative_within_alt2] and \x \ S\ and * by fast + moreover have "eventually (\y. y \ S) (at x within S)" unfolding eventually_at by (fast intro: zero_less_one) - ultimately show "\\<^sub>F y in at x within s. norm (g y - g x - g' x (y - x)) \ e * norm (y - x)" + ultimately show "\\<^sub>F y in at x within S. norm (g y - g x - g' x (y - x)) \ e * norm (y - x)" proof (rule eventually_elim2) fix y - assume "y \ s" + assume "y \ S" assume "norm (f ?N y - f ?N x - f' ?N x (y - x)) \ e / 3 * norm (y - x)" moreover have "norm (g y - g x - (f ?N y - f ?N x)) \ e / 3 * norm (y - x)" - using N2[rule_format, OF _ \y \ s\ \x \ s\] + using N2[rule_format, OF _ \y \ S\ \x \ S\] by (simp add: norm_minus_commute) ultimately have "norm (g y - g x - f' ?N x (y - x)) \ 2 * e / 3 * norm (y - x)" using norm_triangle_le[of "g y - g x - (f ?N y - f ?N x)" "f ?N y - f ?N x - f' ?N x (y - x)" "2 * e / 3 * norm (y - x)"] by (auto simp add: algebra_simps) moreover have " norm (f' ?N x (y - x) - g' x (y - x)) \ e / 3 * norm (y - x)" - using N1 \x \ s\ by auto + using N1 \x \ S\ by auto ultimately show "norm (g y - g x - g' x (y - x)) \ e * norm (y - x)" using norm_triangle_le[of "g y - g x - f' (max N1 N2) x (y - x)" "f' (max N1 N2) x (y - x) - g' x (y - x)"] by (auto simp add: algebra_simps) @@ -2125,77 +2061,63 @@ lemma has_antiderivative_sequence: fixes f :: "nat \ 'a::real_normed_vector \ 'b::banach" - assumes "convex s" - and "\n. \x\s. ((f n) has_derivative (f' n x)) (at x within s)" - and "\e>0. \N. \n\N. \x\s. \h. norm (f' n x h - g' x h) \ e * norm h" - shows "\g. \x\s. (g has_derivative g' x) (at x within s)" -proof (cases "s = {}") + assumes "convex S" + and der: "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and no: "\e. e > 0 \ \N. \n\N. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + shows "\g. \x\S. (g has_derivative g' x) (at x within S)" +proof (cases "S = {}") case False - then obtain a where "a \ s" + then obtain a where "a \ S" by auto - have *: "\P Q. \g. \x\s. P g x \ Q g x \ \g. \x\s. Q g x" + have *: "\P Q. \g. \x\S. P g x \ Q g x \ \g. \x\S. Q g x" by auto show ?thesis apply (rule *) - apply (rule has_derivative_sequence[OF assms(1) _ assms(3), of "\n x. f n x + (f 0 a - f n a)"]) - apply (metis assms(2) has_derivative_add_const) - apply (rule \a \ s\) + apply (rule has_derivative_sequence [OF \convex S\ _ no, of "\n x. f n x + (f 0 a - f n a)"]) + apply (metis assms(2) has_derivative_add_const) + using \a \ S\ apply auto done qed auto lemma has_antiderivative_limit: fixes g' :: "'a::real_normed_vector \ 'a \ 'b::banach" - assumes "convex s" - and "\e>0. \f f'. \x\s. - (f has_derivative (f' x)) (at x within s) \ (\h. norm (f' x h - g' x h) \ e * norm h)" - shows "\g. \x\s. (g has_derivative g' x) (at x within s)" + assumes "convex S" + and "\e. e>0 \ \f f'. \x\S. + (f has_derivative (f' x)) (at x within S) \ (\h. norm (f' x h - g' x h) \ e * norm h)" + shows "\g. \x\S. (g has_derivative g' x) (at x within S)" proof - - have *: "\n. \f f'. \x\s. - (f has_derivative (f' x)) (at x within s) \ + have *: "\n. \f f'. \x\S. + (f has_derivative (f' x)) (at x within S) \ (\h. norm(f' x h - g' x h) \ inverse (real (Suc n)) * norm h)" by (simp add: assms(2)) obtain f where - *: "\x. \f'. \xa\s. (f x has_derivative f' xa) (at xa within s) \ - (\h. norm (f' xa h - g' xa h) \ inverse (real (Suc x)) * norm h)" - using *[THEN choice] .. + *: "\x. \f'. \xa\S. (f x has_derivative f' xa) (at xa within S) \ + (\h. norm (f' xa h - g' xa h) \ inverse (real (Suc x)) * norm h)" + using * by metis obtain f' where - f: "\x. \xa\s. (f x has_derivative f' x xa) (at xa within s) \ - (\h. norm (f' x xa h - g' xa h) \ inverse (real (Suc x)) * norm h)" - using *[THEN choice] .. + f': "\x. \z\S. (f x has_derivative f' x z) (at z within S) \ + (\h. norm (f' x z h - g' z h) \ inverse (real (Suc x)) * norm h)" + using * by metis show ?thesis - apply (rule has_antiderivative_sequence[OF assms(1), of f f']) - defer - apply rule - apply rule - proof - + proof (rule has_antiderivative_sequence[OF \convex S\, of f f']) fix e :: real assume "e > 0" obtain N where N: "inverse (real (Suc N)) < e" using reals_Archimedean[OF \e>0\] .. - show "\N. \n\N. \x\s. \h. norm (f' n x h - g' x h) \ e * norm h" - apply (rule_tac x=N in exI) - apply rule - apply rule - apply rule - apply rule - proof - + show "\N. \n\N. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + proof (intro exI allI ballI impI) fix n x h - assume n: "N \ n" and x: "x \ s" + assume n: "N \ n" and x: "x \ S" have *: "inverse (real (Suc n)) \ e" apply (rule order_trans[OF _ N[THEN less_imp_le]]) using n apply (auto simp add: field_simps) done show "norm (f' n x h - g' x h) \ e * norm h" - using f[rule_format,THEN conjunct2, OF x, of n, THEN spec[where x=h]] - apply (rule order_trans) - using N * - apply (cases "h = 0") - apply auto - done + by (meson "*" mult_right_mono norm_ge_zero order.trans x f') qed - qed (insert f, auto) + qed (use f' in auto) qed @@ -2203,12 +2125,12 @@ lemma has_derivative_series: fixes f :: "nat \ 'a::real_normed_vector \ 'b::banach" - assumes "convex s" - and "\n x. x \ s \ ((f n) has_derivative (f' n x)) (at x within s)" - and "\e>0. \N. \n\N. \x\s. \h. norm (sum (\i. f' i x h) {.. e * norm h" - and "x \ s" + assumes "convex S" + and "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and "\e. e>0 \ \N. \n\N. \x\S. \h. norm (sum (\i. f' i x h) {.. e * norm h" + and "x \ S" and "(\n. f n x) sums l" - shows "\g. \x\s. (\n. f n x) sums (g x) \ (g has_derivative g' x) (at x within s)" + shows "\g. \x\S. (\n. f n x) sums (g x) \ (g has_derivative g' x) (at x within S)" unfolding sums_def apply (rule has_derivative_sequence[OF assms(1) _ assms(3)]) apply (metis assms(2) has_derivative_sum) @@ -2219,20 +2141,19 @@ lemma has_field_derivative_series: fixes f :: "nat \ ('a :: {real_normed_field,banach}) \ 'a" - assumes "convex s" - assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x within s)" - assumes "uniform_limit s (\n x. \i s" "summable (\n. f n x0)" - shows "\g. \x\s. (\n. f n x) sums g x \ (g has_field_derivative g' x) (at x within s)" + assumes "convex S" + assumes "\n x. x \ S \ (f n has_field_derivative f' n x) (at x within S)" + assumes "uniform_limit S (\n x. \i S" "summable (\n. f n x0)" + shows "\g. \x\S. (\n. f n x) sums g x \ (g has_field_derivative g' x) (at x within S)" unfolding has_field_derivative_def proof (rule has_derivative_series) - show "\e>0. \N. \n\N. \x\s. \h. norm ((\i e * norm h" - proof (intro allI impI) - fix e :: real assume "e > 0" - with assms(3) obtain N where N: "\n x. n \ N \ x \ s \ norm ((\iN. \n\N. \x\S. \h. norm ((\i e * norm h" if "e > 0" for e + proof - + from that assms(3) obtain N where N: "\n x. n \ N \ x \ S \ norm ((\i N" "x \ s" + fix n :: nat and x h :: 'a assume nx: "n \ N" "x \ S" have "norm ((\iii e" by simp @@ -2240,55 +2161,55 @@ by (intro mult_right_mono) simp_all finally have "norm ((\i e * norm h" . } - thus "\N. \n\N. \x\s. \h. norm ((\i e * norm h" by blast + thus "\N. \n\N. \x\S. \h. norm ((\i e * norm h" by blast qed -qed (insert assms, auto simp: has_field_derivative_def) +qed (use assms in \auto simp: has_field_derivative_def\) lemma has_field_derivative_series': fixes f :: "nat \ ('a :: {real_normed_field,banach}) \ 'a" - assumes "convex s" - assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x within s)" - assumes "uniformly_convergent_on s (\n x. \i s" "summable (\n. f n x0)" "x \ interior s" + assumes "convex S" + assumes "\n x. x \ S \ (f n has_field_derivative f' n x) (at x within S)" + assumes "uniformly_convergent_on S (\n x. \i S" "summable (\n. f n x0)" "x \ interior S" shows "summable (\n. f n x)" "((\x. \n. f n x) has_field_derivative (\n. f' n x)) (at x)" proof - - from \x \ interior s\ have "x \ s" using interior_subset by blast + from \x \ interior S\ have "x \ S" using interior_subset by blast define g' where [abs_def]: "g' x = (\i. f' i x)" for x - from assms(3) have "uniform_limit s (\n x. \in x. \ix. x \ s \ (\n. f n x) sums g x" - "\x. x \ s \ (g has_field_derivative g' x) (at x within s)" by blast - from g(1)[OF \x \ s\] show "summable (\n. f n x)" by (simp add: sums_iff) - from g(2)[OF \x \ s\] \x \ interior s\ have "(g has_field_derivative g' x) (at x)" - by (simp add: at_within_interior[of x s]) + "\x. x \ S \ (\n. f n x) sums g x" + "\x. x \ S \ (g has_field_derivative g' x) (at x within S)" by blast + from g(1)[OF \x \ S\] show "summable (\n. f n x)" by (simp add: sums_iff) + from g(2)[OF \x \ S\] \x \ interior S\ have "(g has_field_derivative g' x) (at x)" + by (simp add: at_within_interior[of x S]) also have "(g has_field_derivative g' x) (at x) \ ((\x. \n. f n x) has_field_derivative g' x) (at x)" - using eventually_nhds_in_nhd[OF \x \ interior s\] interior_subset[of s] g(1) + using eventually_nhds_in_nhd[OF \x \ interior S\] interior_subset[of S] g(1) by (intro DERIV_cong_ev) (auto elim!: eventually_mono simp: sums_iff) finally show "((\x. \n. f n x) has_field_derivative g' x) (at x)" . qed lemma differentiable_series: fixes f :: "nat \ ('a :: {real_normed_field,banach}) \ 'a" - assumes "convex s" "open s" - assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x)" - assumes "uniformly_convergent_on s (\n x. \i s" "summable (\n. f n x0)" and x: "x \ s" + assumes "convex S" "open S" + assumes "\n x. x \ S \ (f n has_field_derivative f' n x) (at x)" + assumes "uniformly_convergent_on S (\n x. \i S" "summable (\n. f n x0)" and x: "x \ S" shows "summable (\n. f n x)" and "(\x. \n. f n x) differentiable (at x)" proof - - from assms(4) obtain g' where A: "uniform_limit s (\n x. \in x. \iopen s\ have s: "at x within s = at x" by (rule at_within_open) - have "\g. \x\s. (\n. f n x) sums g x \ (g has_field_derivative g' x) (at x within s)" - by (intro has_field_derivative_series[of s f f' g' x0] assms A has_field_derivative_at_within) - then obtain g where g: "\x. x \ s \ (\n. f n x) sums g x" - "\x. x \ s \ (g has_field_derivative g' x) (at x within s)" by blast + from x and \open S\ have S: "at x within S = at x" by (rule at_within_open) + have "\g. \x\S. (\n. f n x) sums g x \ (g has_field_derivative g' x) (at x within S)" + by (intro has_field_derivative_series[of S f f' g' x0] assms A has_field_derivative_at_within) + then obtain g where g: "\x. x \ S \ (\n. f n x) sums g x" + "\x. x \ S \ (g has_field_derivative g' x) (at x within S)" by blast from g[OF x] show "summable (\n. f n x)" by (auto simp: summable_def) from g(2)[OF x] have g': "(g has_derivative ( * ) (g' x)) (at x)" - by (simp add: has_field_derivative_def s) + by (simp add: has_field_derivative_def S) have "((\x. \n. f n x) has_derivative ( * ) (g' x)) (at x)" - by (rule has_derivative_transform_within_open[OF g' \open s\ x]) + by (rule has_derivative_transform_within_open[OF g' \open S\ x]) (insert g, auto simp: sums_iff) thus "(\x. \n. f n x) differentiable (at x)" unfolding differentiable_def by (auto simp: summable_def differentiable_def has_field_derivative_def) @@ -2296,32 +2217,32 @@ lemma differentiable_series': fixes f :: "nat \ ('a :: {real_normed_field,banach}) \ 'a" - assumes "convex s" "open s" - assumes "\n x. x \ s \ (f n has_field_derivative f' n x) (at x)" - assumes "uniformly_convergent_on s (\n x. \i s" "summable (\n. f n x0)" + assumes "convex S" "open S" + assumes "\n x. x \ S \ (f n has_field_derivative f' n x) (at x)" + assumes "uniformly_convergent_on S (\n x. \i S" "summable (\n. f n x0)" shows "(\x. \n. f n x) differentiable (at x0)" - using differentiable_series[OF assms, of x0] \x0 \ s\ by blast+ + using differentiable_series[OF assms, of x0] \x0 \ S\ by blast+ text \Considering derivative @{typ "real \ 'b::real_normed_vector"} as a vector.\ definition "vector_derivative f net = (SOME f'. (f has_vector_derivative f') net)" lemma vector_derivative_unique_within: - assumes not_bot: "at x within s \ bot" - and f': "(f has_vector_derivative f') (at x within s)" - and f'': "(f has_vector_derivative f'') (at x within s)" + assumes not_bot: "at x within S \ bot" + and f': "(f has_vector_derivative f') (at x within S)" + and f'': "(f has_vector_derivative f'') (at x within S)" shows "f' = f''" proof - have "(\x. x *\<^sub>R f') = (\x. x *\<^sub>R f'')" proof (rule frechet_derivative_unique_within) - show "\i\Basis. \e>0. \d. 0 < \d\ \ \d\ < e \ x + d *\<^sub>R i \ s" + show "\i\Basis. \e>0. \d. 0 < \d\ \ \d\ < e \ x + d *\<^sub>R i \ S" proof clarsimp fix e :: real assume "0 < e" - with islimpt_approachable_real[of x s] not_bot - obtain x' where "x' \ s" "x' \ x" "\x' - x\ < e" + with islimpt_approachable_real[of x S] not_bot + obtain x' where "x' \ S" "x' \ x" "\x' - x\ < e" by (auto simp add: trivial_limit_within) - then show "\d. d \ 0 \ \d\ < e \ x + d \ s" + then show "\d. d \ 0 \ \d\ < e \ x + d \ S" by (intro exI[of _ "x' - x"]) auto qed qed (insert f' f'', auto simp: has_vector_derivative_def) @@ -2351,8 +2272,8 @@ qed (auto simp: vector_derivative_def has_vector_derivative_def differentiable_def) lemma vector_derivative_within: - assumes not_bot: "at x within s \ bot" and y: "(f has_vector_derivative y) (at x within s)" - shows "vector_derivative f (at x within s) = y" + assumes not_bot: "at x within S \ bot" and y: "(f has_vector_derivative y) (at x within S)" + shows "vector_derivative f (at x within S) = y" using y by (intro vector_derivative_unique_within[OF not_bot vector_derivative_works[THEN iffD1] y]) (auto simp: differentiable_def has_vector_derivative_def) @@ -2381,11 +2302,11 @@ by (metis has_field_derivative_def has_real_derivative) lemma has_vector_derivative_cong_ev: - assumes *: "eventually (\x. x \ s \ f x = g x) (nhds x)" "f x = g x" - shows "(f has_vector_derivative f') (at x within s) = (g has_vector_derivative f') (at x within s)" + assumes *: "eventually (\x. x \ S \ f x = g x) (nhds x)" "f x = g x" + shows "(f has_vector_derivative f') (at x within S) = (g has_vector_derivative f') (at x within S)" unfolding has_vector_derivative_def has_derivative_def using * - apply (cases "at x within s \ bot") + apply (cases "at x within S \ bot") apply (intro refl conj_cong filterlim_cong) apply (auto simp: netlimit_within eventually_at_filter elim: eventually_mono) done