# HG changeset patch # User paulson # Date 1526837854 -3600 # Node ID 0764ee22a4d19baa90a7d892da38385b197ef34b # Parent 88dd06301dd30f5fcf0435db1256749bc10bc5e8 tidy up of Derivative diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Cauchy_Integral_Theorem.thy --- a/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Cauchy_Integral_Theorem.thy Sun May 20 18:37:34 2018 +0100 @@ -1154,7 +1154,7 @@ vector_derivative (shiftpath (1 - a) (shiftpath a g)) (at x within {0..1})" apply (rule vector_derivative_at_within_ivl [OF has_vector_derivative_transform_within_open - [where f = "(shiftpath (1 - a) (shiftpath a g))" and s = "{0<..<1}-s"]]) + [where f = "(shiftpath (1 - a) (shiftpath a g))" and S = "{0<..<1}-s"]]) using s g assms x apply (auto simp: finite_imp_closed open_Diff shiftpath_shiftpath vector_derivative_within_interior vector_derivative_works [symmetric]) @@ -4453,7 +4453,7 @@ case True then show ?thesis apply (simp add: continuous_within) apply (rule Lim_transform_away_within [of _ "z+1" _ "\w::complex. (f w - f z)/(w - z)"]) - using has_field_derivative_at_within DERIV_within_iff f' + using has_field_derivative_at_within has_field_derivative_iff f' apply (fastforce simp add:)+ done next @@ -5554,7 +5554,7 @@ apply (rule w) done show ?thes2 - apply (simp add: DERIV_within_iff del: power_Suc) + apply (simp add: has_field_derivative_iff del: power_Suc) apply (rule Lim_transform_within [OF tendsto_mult_left [OF *] \0 < d\ ]) apply (simp add: \k \ 0\ **) done diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Complex_Analysis_Basics.thy --- a/src/HOL/Analysis/Complex_Analysis_Basics.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Complex_Analysis_Basics.thy Sun May 20 18:37:34 2018 +0100 @@ -17,7 +17,7 @@ lemma has_derivative_mult_right: fixes c:: "'a :: real_normed_algebra" shows "((( * ) c) has_derivative (( * ) c)) F" -by (rule has_derivative_mult_right [OF has_derivative_id]) +by (rule has_derivative_mult_right [OF has_derivative_ident]) lemma has_derivative_of_real[derivative_intros, simp]: "(f has_derivative f') F \ ((\x. of_real (f x)) has_derivative (\x. of_real (f' x))) F" @@ -382,7 +382,7 @@ lemma holomorphic_on_Un [holomorphic_intros]: assumes "f holomorphic_on A" "f holomorphic_on B" "open A" "open B" shows "f holomorphic_on (A \ B)" - using assms by (auto simp: holomorphic_on_def at_within_open[of _ A] + using assms by (auto simp: holomorphic_on_def at_within_open[of _ A] at_within_open[of _ B] at_within_open[of _ "A \ B"] open_Un) lemma holomorphic_on_If_Un [holomorphic_intros]: @@ -839,10 +839,10 @@ show ?thesis unfolding has_field_derivative_def proof (rule has_derivative_sequence [OF cvs _ _ x]) - show "(\n. f n x) \ l" - by (rule tf) - 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: **) + show "(\n. f n x) \ l" + by (rule tf) + next show "\e. e > 0 \ \\<^sub>F n in sequentially. \x\s. \h. cmod (f' n x * h - g' x * h) \ e * cmod h" + unfolding eventually_sequentially by (blast intro: **) qed (metis has_field_derivative_def df) qed @@ -882,8 +882,8 @@ by (metis df has_field_derivative_def mult_commute_abs) next show " ((\n. f n x) sums l)" by (rule sf) - next show "\e. e>0 \ \N. \n\N. \x\s. \h. cmod ((\i e * cmod h" - by (blast intro: **) + next show "\e. e>0 \ \\<^sub>F n in sequentially. \x\s. \h. cmod ((\i e * cmod h" + unfolding eventually_sequentially by (blast intro: **) qed qed @@ -922,10 +922,8 @@ and "x \ s" "y \ s" shows "norm(f x - f y) \ B * norm(x - y)" apply (rule differentiable_bound [OF cvs]) - apply (rule ballI, erule df [unfolded has_field_derivative_def]) - apply (rule ballI, rule onorm_le, simp add: norm_mult mult_right_mono dn) - apply fact - apply fact + apply (erule df [unfolded has_field_derivative_def]) + apply (rule onorm_le, simp_all add: norm_mult mult_right_mono assms) done subsection\Inverse function theorem for complex derivatives\ diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Conformal_Mappings.thy --- a/src/HOL/Analysis/Conformal_Mappings.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Conformal_Mappings.thy Sun May 20 18:37:34 2018 +0100 @@ -864,7 +864,7 @@ proof - define h where [abs_def]: "h z = (z - \)^2 * f z" for z have h0: "(h has_field_derivative 0) (at \)" - apply (simp add: h_def Derivative.DERIV_within_iff) + apply (simp add: h_def has_field_derivative_iff) apply (rule Lim_transform_within [OF that, of 1]) apply (auto simp: divide_simps power2_eq_square) done @@ -879,7 +879,7 @@ case False then have "f field_differentiable at z within S" using holomorphic_onD [OF holf, of z] \z \ S\ - unfolding field_differentiable_def DERIV_within_iff + unfolding field_differentiable_def has_field_derivative_iff by (force intro: exI [where x="dist \ z"] elim: Lim_transform_within_set [unfolded eventually_at]) then show ?thesis by (simp add: h_def power2_eq_square derivative_intros) @@ -1719,7 +1719,7 @@ have "cnj \ f \ cnj field_differentiable at x within S \ {z. Im z < 0}" if "x \ S" "Im x < 0" "f field_differentiable at (cnj x) within S \ {z. 0 < Im z}" for x using that - apply (simp add: field_differentiable_def Derivative.DERIV_within_iff Lim_within dist_norm, clarify) + apply (simp add: field_differentiable_def has_field_derivative_iff Lim_within dist_norm, clarify) apply (rule_tac x="cnj f'" in exI) apply (elim all_forward ex_forward conj_forward imp_forward asm_rl, clarify) apply (drule_tac x="cnj xa" in bspec) diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Derivative.thy --- a/src/HOL/Analysis/Derivative.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Derivative.thy Sun May 20 18:37:34 2018 +0100 @@ -1,6 +1,6 @@ (* Title: HOL/Analysis/Derivative.thy Author: John Harrison - Author: Robert Himmelmann, TU Muenchen (translation from HOL Light) + Author: Robert Himmelmann, TU Muenchen (translation from HOL Light); tidied by LCP *) section \Multivariate calculus in Euclidean space\ @@ -15,18 +15,6 @@ subsection \Derivatives\ -subsubsection \Combining theorems\ - -lemmas has_derivative_id = has_derivative_ident -lemmas has_derivative_neg = has_derivative_minus -lemmas has_derivative_sub = has_derivative_diff -lemmas scaleR_right_has_derivative = has_derivative_scaleR_right -lemmas scaleR_left_has_derivative = has_derivative_scaleR_left -lemmas inner_right_has_derivative = has_derivative_inner_right -lemmas inner_left_has_derivative = has_derivative_inner_left -lemmas mult_right_has_derivative = has_derivative_mult_right -lemmas mult_left_has_derivative = has_derivative_mult_left - lemma has_derivative_add_const: "(f has_derivative f') net \ ((\x. f x + c) has_derivative f') net" by (intro derivative_eq_intros) auto @@ -34,20 +22,6 @@ subsection \Derivative with composed bilinear function\ -lemma has_derivative_bilinear_within: - assumes "(f has_derivative f') (at x within s)" - and "(g has_derivative g') (at x within s)" - and "bounded_bilinear h" - shows "((\x. h (f x) (g x)) has_derivative (\d. h (f x) (g' d) + h (f' d) (g x))) (at x within s)" - using bounded_bilinear.FDERIV[OF assms(3,1,2)] . - -lemma has_derivative_bilinear_at: - assumes "(f has_derivative f') (at x)" - and "(g has_derivative g') (at x)" - and "bounded_bilinear h" - shows "((\x. h (f x) (g x)) has_derivative (\d. h (f x) (g' d) + h (f' d) (g x))) (at x)" - using has_derivative_bilinear_within[of f f' x UNIV g g' h] assms by simp - text \More explicit epsilon-delta forms.\ lemma has_derivative_within': @@ -56,15 +30,14 @@ (\e>0. \d>0. \x'\s. 0 < norm (x' - x) \ norm (x' - x) < d \ norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)" unfolding has_derivative_within Lim_within dist_norm - unfolding diff_0_right by (simp add: diff_diff_eq) lemma has_derivative_at': - "(f has_derivative f') (at x) \ bounded_linear f' \ - (\e>0. \d>0. \x'. 0 < norm (x' - x) \ norm (x' - x) < d \ - norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)" - using has_derivative_within' [of f f' x UNIV] - by simp + "(f has_derivative f') (at x) + \ bounded_linear f' \ + (\e>0. \d>0. \x'. 0 < norm (x' - x) \ norm (x' - x) < d \ + norm (f x' - f x - f'(x' - x)) / norm (x' - x) < e)" + using has_derivative_within' [of f f' x UNIV] by simp lemma has_derivative_at_withinI: "(f has_derivative f') (at x) \ (f has_derivative f') (at x within s)" @@ -80,7 +53,7 @@ fixes f :: "real \ real" and y :: "real" shows "(f has_derivative (( * ) y)) (at x within ({x <..} \ I)) \ - ((\t. (f x - f t) / (x - t)) \ y) (at x within ({x <..} \ I))" + ((\t. (f x - f t) / (x - t)) \ y) (at x within ({x <..} \ I))" proof - have "((\t. (f t - (f x + y * (t - x))) / \t - x\) \ 0) (at x within ({x<..} \ I)) \ ((\t. (f t - f x) / (t - x) - y) \ 0) (at x within ({x<..} \ I))" @@ -95,8 +68,6 @@ subsubsection \Caratheodory characterization\ -lemmas DERIV_within_iff = has_field_derivative_iff - lemma DERIV_caratheodory_within: "(f has_field_derivative l) (at x within S) \ (\g. (\z. f z - f x = g z * (z - x)) \ continuous (at x within S) g \ g x = l)" @@ -108,7 +79,7 @@ let ?g = "(%z. if z = x then l else (f z - f x) / (z-x))" show "\z. f z - f x = ?g z * (z-x)" by simp show "continuous (at x within S) ?g" using \?lhs\ - by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within) + by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within) show "?g x = l" by simp qed next @@ -116,7 +87,7 @@ then obtain g where "(\z. f z - f x = g z * (z-x))" and "continuous (at x within S) g" and "g x = l" by blast thus ?lhs - by (auto simp add: continuous_within DERIV_within_iff cong: Lim_cong_within) + by (auto simp add: continuous_within has_field_derivative_iff cong: Lim_cong_within) qed subsection \Differentiability\ @@ -173,7 +144,7 @@ lemma differentiable_on_mult [simp, derivative_intros]: fixes f :: "'M::real_normed_vector \ 'a::real_normed_algebra" shows "\f differentiable_on S; g differentiable_on S\ \ (\z. f z * g z) differentiable_on S" - apply (simp add: differentiable_on_def differentiable_def) + unfolding differentiable_on_def differentiable_def using differentiable_def differentiable_mult by blast lemma differentiable_on_compose: @@ -211,9 +182,9 @@ by (blast intro: differentiable_scaleR) lemma has_derivative_sqnorm_at [derivative_intros, simp]: - "((\x. (norm x)\<^sup>2) has_derivative (\x. 2 *\<^sub>R (a \ x))) (at a)" -using has_derivative_bilinear_at [of id id a id id "(\)"] -by (auto simp: inner_commute dot_square_norm bounded_bilinear_inner) + "((\x. (norm x)\<^sup>2) has_derivative (\x. 2 *\<^sub>R (a \ x))) (at a)" + using bounded_bilinear.FDERIV [of "(\)" id id a _ id id] + by (auto simp: inner_commute dot_square_norm bounded_bilinear_inner) lemma differentiable_sqnorm_at [derivative_intros, simp]: fixes a :: "'a :: {real_normed_vector,real_inner}" @@ -378,29 +349,24 @@ lemma frechet_derivative_unique_within: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" - assumes "(f has_derivative f') (at x within S)" - and "(f has_derivative f'') (at x within S)" - and "\i\Basis. \e>0. \d. 0 < \d\ \ \d\ < e \ (x + d *\<^sub>R i) \ S" + assumes 1: "(f has_derivative f') (at x within S)" + and 2: "(f has_derivative f'') (at x within S)" + and S: "\i e. \i\Basis; e>0\ \ \d. 0 < \d\ \ \d\ < e \ (x + d *\<^sub>R i) \ S" shows "f' = f''" proof - note as = assms(1,2)[unfolded has_derivative_def] then interpret f': bounded_linear f' by auto from as interpret f'': bounded_linear f'' by auto have "x islimpt S" unfolding islimpt_approachable - proof (rule, rule) + proof (intro allI impI) fix e :: real assume "e > 0" obtain d where "0 < \d\" and "\d\ < e" and "x + d *\<^sub>R (SOME i. i \ Basis) \ S" using assms(3) SOME_Basis \e>0\ by blast then show "\x'\S. x' \ x \ dist x' x < e" - apply (rule_tac x="x + d *\<^sub>R (SOME i. i \ Basis)" in bexI) - unfolding dist_norm - apply (auto simp: SOME_Basis nonzero_Basis) - done - qed + by (rule_tac x="x + d *\<^sub>R (SOME i. i \ Basis)" in bexI) (auto simp: dist_norm SOME_Basis nonzero_Basis) qed then have *: "netlimit (at x within S) = x" - apply (auto intro!: netlimit_within) - by (metis trivial_limit_within) + by (simp add: Lim_ident_at trivial_limit_within) show ?thesis proof (rule linear_eq_stdbasis) show "linear f'" "linear f''" @@ -450,81 +416,65 @@ lemma frechet_derivative_unique_within_closed_interval: fixes f::"'a::euclidean_space \ 'b::real_normed_vector" - assumes "\i\Basis. a\i < b\i" - and "x \ cbox a b" + assumes ab: "\i. i\Basis \ a\i < b\i" + and x: "x \ cbox a b" and "(f has_derivative f' ) (at x within cbox a b)" and "(f has_derivative f'') (at x within cbox a b)" shows "f' = f''" - apply(rule frechet_derivative_unique_within) - apply(rule assms(3,4))+ -proof (rule, rule, rule) +proof (rule frechet_derivative_unique_within) fix e :: real fix i :: 'a assume "e > 0" and i: "i \ Basis" then show "\d. 0 < \d\ \ \d\ < e \ x + d *\<^sub>R i \ cbox a b" proof (cases "x\i = a\i") case True - then show ?thesis - apply (rule_tac x="(min (b\i - a\i) e) / 2" in exI) - using assms(1)[THEN bspec[where x=i]] and \e>0\ and assms(2) - unfolding mem_box - using i - apply (auto simp add: field_simps inner_simps inner_Basis) - done + with ab[of i] \e>0\ x i show ?thesis + by (rule_tac x="(min (b\i - a\i) e) / 2" in exI) + (auto simp add: mem_box field_simps inner_simps inner_Basis) next - note * = assms(2)[unfolded mem_box, THEN bspec, OF i] case False moreover have "a \ i < x \ i" - using False * by auto + using False i mem_box(2) x by force moreover { have "a \ i * 2 + min (x \ i - a \ i) e \ a\i *2 + x\i - a\i" by auto also have "\ = a\i + x\i" by auto also have "\ \ 2 * (x\i)" - using * by auto + using \a \ i < x \ i\ by auto finally have "a \ i * 2 + min (x \ i - a \ i) e \ x \ i * 2" by auto } moreover have "min (x \ i - a \ i) e \ 0" - using * and \e>0\ by auto + by (simp add: \0 < e\ \a \ i < x \ i\ less_eq_real_def) then have "x \ i * 2 \ b \ i * 2 + min (x \ i - a \ i) e" - using * by auto + using i mem_box(2) x by force ultimately show ?thesis - apply (rule_tac x="- (min (x\i - a\i) e) / 2" in exI) - using assms(1)[THEN bspec, OF i] and \e>0\ and assms(2) - unfolding mem_box - using i - apply (auto simp add: field_simps inner_simps inner_Basis) - done + using ab[of i] \e>0\ x i + by (rule_tac x="- (min (x\i - a\i) e) / 2" in exI) + (auto simp add: mem_box field_simps inner_simps inner_Basis) qed -qed +qed (use assms in auto) lemma frechet_derivative_unique_within_open_interval: fixes f::"'a::euclidean_space \ 'b::real_normed_vector" - assumes "x \ box a b" - and "(f has_derivative f' ) (at x within box a b)" - and "(f has_derivative f'') (at x within box a b)" + assumes x: "x \ box a b" + and f: "(f has_derivative f' ) (at x within box a b)" "(f has_derivative f'') (at x within box a b)" shows "f' = f''" proof - - from assms(1) have *: "at x within box a b = at x" - by (metis at_within_interior interior_open open_box) - from assms(2,3) [unfolded *] show "f' = f''" - by (rule has_derivative_unique) + have "at x within box a b = at x" + by (metis x at_within_interior interior_open open_box) + with f show "f' = f''" + by (simp add: has_derivative_unique) qed lemma frechet_derivative_at: "(f has_derivative f') (at x) \ f' = frechet_derivative f (at x)" - apply (rule has_derivative_unique[of f]) - apply assumption - unfolding frechet_derivative_works[symmetric] - using differentiable_def - apply auto - done + using differentiable_def frechet_derivative_works has_derivative_unique by blast lemma frechet_derivative_within_cbox: fixes f :: "'a::euclidean_space \ 'b::real_normed_vector" - assumes "\i\Basis. a\i < b\i" + assumes "\i. i\Basis \ a\i < b\i" and "x \ cbox a b" and "(f has_derivative f') (at x within cbox a b)" shows "frechet_derivative f (at x within cbox a b) = f'" @@ -547,7 +497,7 @@ using deriv by (rule has_derivative_bounded_linear) show "f' h = 0" proof (cases "h = 0") - assume "h \ 0" + case False from min obtain d where d1: "0 < d" and d2: "\y\ball x d. f x \ f y" unfolding eventually_at by (force simp: dist_commute) have "FDERIV (\r. x + r *\<^sub>R h) 0 :> (\r. r *\<^sub>R h)" @@ -561,7 +511,7 @@ using \h \ 0\ by (auto simp add: d2 dist_norm pos_less_divide_eq) ultimately show "f' h = 0" by (rule DERIV_local_min) - qed (simp add: f'.zero) + qed simp qed lemma has_derivative_local_max: @@ -574,21 +524,21 @@ lemma differential_zero_maxmin: fixes f::"'a::real_normed_vector \ real" - assumes "x \ s" - and "open s" + assumes "x \ S" + and "open S" and deriv: "(f has_derivative f') (at x)" - and mono: "(\y\s. f y \ f x) \ (\y\s. f x \ f y)" + and mono: "(\y\S. f y \ f x) \ (\y\S. f x \ f y)" shows "f' = (\v. 0)" using mono proof - assume "\y\s. f y \ f x" - with \x \ s\ and \open s\ have "eventually (\y. f y \ f x) (at x)" + assume "\y\S. f y \ f x" + with \x \ S\ and \open S\ have "eventually (\y. f y \ f x) (at x)" unfolding eventually_at_topological by auto with deriv show ?thesis by (rule has_derivative_local_max) next - assume "\y\s. f x \ f y" - with \x \ s\ and \open s\ have "eventually (\y. f x \ f y) (at x)" + assume "\y\S. f x \ f y" + with \x \ S\ and \open S\ have "eventually (\y. f x \ f y) (at x)" unfolding eventually_at_topological by auto with deriv show ?thesis by (rule has_derivative_local_min) @@ -613,28 +563,24 @@ unfolding fun_eq_iff by simp qed -lemma rolle: +theorem Rolle: fixes f :: "real \ real" assumes "a < b" - and "f a = f b" - and "continuous_on {a .. b} f" - and "\x\{a <..< b}. (f has_derivative f' x) (at x)" + and fab: "f a = f b" + and contf: "continuous_on {a..b} f" + and derf: "\x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" shows "\x\{a <..< b}. f' x = (\v. 0)" proof - have "\x\box a b. (\y\box a b. f x \ f y) \ (\y\box a b. f y \ f x)" proof - - have "(a + b) / 2 \ {a .. b}" + have "(a + b) / 2 \ {a..b}" using assms(1) by auto - then have *: "{a .. b} \ {}" + then have *: "{a..b} \ {}" by auto - obtain d where d: - "d \cbox a b" - "\y\cbox a b. f y \ f d" - using continuous_attains_sup[OF compact_Icc * assms(3)] by auto - obtain c where c: - "c \ cbox a b" - "\y\cbox a b. f c \ f y" - using continuous_attains_inf[OF compact_Icc * assms(3)] by auto + obtain d where d: "d \cbox a b" "\y\cbox a b. f y \ f d" + using continuous_attains_sup[OF compact_Icc * contf] by auto + obtain c where c: "c \ cbox a b" "\y\cbox a b. f c \ f y" + using continuous_attains_inf[OF compact_Icc * contf] by auto show ?thesis proof (cases "d \ box a b \ c \ box a b") case True @@ -644,16 +590,11 @@ define e where "e = (a + b) /2" case False then have "f d = f c" - using d c assms(2) by auto - then have "\x. x \ {a..b} \ f x = f d" - using c d + using d c fab by auto + with c d have "\x. x \ {a..b} \ f x = f d" by force then show ?thesis - apply (rule_tac x=e in bexI) - unfolding e_def - using assms(1) - apply auto - done + by (rule_tac x=e in bexI) (auto simp: e_def \a < b\) qed qed then obtain x where x: "x \ {a <..< b}" "(\y\{a <..< b}. f x \ f y) \ (\y\{a <..< b}. f y \ f x)" @@ -673,18 +614,18 @@ lemma mvt: fixes f :: "real \ real" assumes "a < b" - and "continuous_on {a..b} f" - assumes "\x\{a<..x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" shows "\x\{a<..x\{a <..< b}. (\xa. f' x xa - (f b - f a) / (b - a) * xa) = (\v. 0)" - proof (intro rolle[OF assms(1), of "\x. f x - (f b - f a) / (b - a) * x"] ballI) + proof (intro Rolle[OF \a < b\, of "\x. f x - (f b - f a) / (b - a) * x"] ballI) fix x - assume x: "x \ {a <..< b}" + assume x: "a < x" "x < b" show "((\x. f x - (f b - f a) / (b - a) * x) has_derivative (\xa. f' x xa - (f b - f a) / (b - a) * xa)) (at x)" - by (intro derivative_intros assms(3)[rule_format,OF x]) - qed (insert assms(1,2), auto intro!: continuous_intros simp: field_simps) + by (intro derivative_intros derf[OF x]) + qed (use assms in \auto intro!: continuous_intros simp: field_simps\) then obtain x where "x \ {a <..< b}" "(\xa. f' x xa - (f b - f a) / (b - a) * xa) = (\v. 0)" .. @@ -697,50 +638,33 @@ lemma mvt_simple: fixes f :: "real \ real" assumes "a < b" - and "\x\{a..b}. (f has_derivative f' x) (at x within {a..b})" + and derf: "\x. \a \ x; x \ b\ \ (f has_derivative f' x) (at x)" shows "\x\{a<..x\{a<.. {a <..< b}" - show "(f has_derivative f' x) (at x)" - unfolding at_within_open[OF x open_greaterThanLessThan,symmetric] - apply (rule has_derivative_within_subset) - apply (rule assms(2)[rule_format]) - using x - apply auto - done - qed -qed (rule assms(1)) + show "(f has_derivative f' x) (at x)" if "a < x" "x < b" for x + by (metis derf not_less order.asym that) +qed (rule assms) lemma mvt_very_simple: fixes f :: "real \ real" assumes "a \ b" - and "\x\{a .. b}. (f has_derivative f' x) (at x within {a .. b})" - shows "\x\{a .. b}. f b - f a = f' x (b - a)" + and derf: "\x. \a \ x; x \ b\ \ (f has_derivative f' x) (at x)" + shows "\x\{a..b}. f b - f a = f' x (b - a)" proof (cases "a = b") interpret bounded_linear "f' b" using assms(2) assms(1) by auto case True then show ?thesis - apply (rule_tac x=a in bexI) - using assms(2)[THEN bspec[where x=a]] - unfolding has_derivative_def - unfolding True - using zero - apply auto - done + by force next case False then show ?thesis - using mvt_simple[OF _ assms(2)] - using assms(1) - by auto + using mvt_simple[OF _ derf] + by (metis \a \ b\ atLeastAtMost_iff dual_order.order_iff_strict greaterThanLessThan_iff) qed text \A nice generalization (see Havin's proof of 5.19 from Rudin's book).\ @@ -748,19 +672,16 @@ lemma mvt_general: fixes f :: "real \ 'a::real_inner" assumes "a < b" - and "continuous_on {a .. b} f" - and "\x\{a<..x. \a < x; x < b\ \ (f has_derivative f' x) (at x)" shows "\x\{a<.. norm (f' x (b - a))" proof - have "\x\{a<.. f b - (f b - f a) \ f a = (f b - f a) \ f' x (b - a)" - apply (rule mvt) - apply (rule assms(1)) - apply (intro continuous_intros assms(2)) - using assms(3) - apply (fast intro: has_derivative_inner_right) + apply (rule mvt [OF \a < b\]) + apply (intro continuous_intros contf) + using derf apply (blast intro: has_derivative_inner_right) done - then obtain x where x: - "x \ {a<.. {a<.. f b - (f b - f a) \ f a = (f b - f a) \ f' x (b - a)" .. show ?thesis proof (cases "f a = f b") @@ -779,21 +700,18 @@ next case True then show ?thesis - using assms(1) - apply (rule_tac x="(a + b) /2" in bexI) - apply auto - done + using \a < b\ by (rule_tac x="(a + b) /2" in bexI) auto qed qed subsection \More general bound theorems\ -lemma differentiable_bound_general: +proposition differentiable_bound_general: fixes f :: "real \ 'a::real_normed_vector" assumes "a < b" - and f_cont: "continuous_on {a .. b} f" - and phi_cont: "continuous_on {a .. b} \" + and f_cont: "continuous_on {a..b} f" + and phi_cont: "continuous_on {a..b} \" and f': "\x. a < x \ x < b \ (f has_vector_derivative f' x) (at x)" and phi': "\x. a < x \ x < b \ (\ has_vector_derivative \' x) (at x)" and bnd: "\x. a < x \ x < b \ norm (f' x) \ \' x" @@ -813,7 +731,7 @@ with \e > 0\ have "e2 > 0" by simp let ?le = "\x1. norm (f x1 - f a) \ \ x1 - \ a + e * (x1 - a) + e" define A where "A = {x2. a \ x2 \ x2 \ b \ (\x1\{a ..< x2}. ?le x1)}" - have A_subset: "A \ {a .. b}" by (auto simp: A_def) + have A_subset: "A \ {a..b}" by (auto simp: A_def) { fix x2 assume a: "a \ x2" "x2 \ b" and le: "\x1\{a..x1. norm (f x1 - f a)) \ norm (f x2 - f a)) (at x2 within {a <..x. x > a) (at x2 within {a <..a \ y\ \y \ b\ by (auto simp: A_def) hence "A = {a .. y}" - using A_subset - by (auto simp: subset_iff y_def cSup_upper intro: A_ivl) + using A_subset by (auto simp: subset_iff y_def cSup_upper intro: A_ivl) from le_cont[OF \a \ y\ \y \ b\ y_all_le] have le_y: "?le y" . - { - assume "a \ y" with \a \ y\ have "a < y" by simp - have "y = b" - proof (rule ccontr) - assume "y \ b" - hence "y < b" using \y \ b\ by simp - let ?F = "at y within {y.. has_vector_derivative \' y) ?F" - using \a < y\ \y < b\ - by (auto simp add: at_within_open[of _ "{a<..\<^sub>F x1 in ?F. norm (f x1 - f y - (x1 - y) *\<^sub>R f' y) \ e2 * \x1 - y\" - "\\<^sub>F x1 in ?F. norm (\ x1 - \ y - (x1 - y) *\<^sub>R \' y) \ e2 * \x1 - y\" - using \e2 > 0\ - by (auto simp: has_derivative_within_alt2 has_vector_derivative_def) - moreover - have "\\<^sub>F x1 in ?F. y \ x1" "\\<^sub>F x1 in ?F. x1 < b" - by (auto simp: eventually_at_filter) - ultimately - have "\\<^sub>F x1 in ?F. norm (f x1 - f y) \ (\ x1 - \ y) + e * \x1 - y\" - (is "\\<^sub>F x1 in ?F. ?le' x1") - proof eventually_elim - case (elim x1) - from norm_triangle_ineq2[THEN order_trans, OF elim(1)] - have "norm (f x1 - f y) \ norm (f' y) * \x1 - y\ + e2 * \x1 - y\" - by (simp add: ac_simps) - also have "norm (f' y) \ \' y" using bnd \a < y\ \y < b\ by simp - also - from elim have "\' y * \x1 - y\ \ \ x1 - \ y + e2 * \x1 - y\" - by (simp add: ac_simps) - finally - have "norm (f x1 - f y) \ \ x1 - \ y + e2 * \x1 - y\ + e2 * \x1 - y\" - by (auto simp: mult_right_mono) - thus ?case by (simp add: e2_def) - qed - moreover have "?le' y" by simp - ultimately obtain S - where S: "open S" "y \ S" "\x. x\S \ x \ {y.. ?le' x" - unfolding eventually_at_topological - by metis - from \open S\ obtain d where d: "\x. dist x y < d \ x \ S" "d > 0" - by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \y \ S\]) - define d' where "d' = min ((y + b)/2) (y + (d/2))" - have "d' \ A" - unfolding A_def - proof safe - show "a \ d'" using \a < y\ \0 < d\ \y < b\ by (simp add: d'_def) - show "d' \ b" using \y < b\ by (simp add: d'_def min_def) - fix x1 - assume x1: "x1 \ {a..x1 \ {a.. y_all_le by auto - } moreover { - assume "x1 \ y" - hence x1': "x1 \ S" "x1 \ {y.. norm (f x1 - f y) + norm (f y - f a)" - by (rule order_trans[OF _ norm_triangle_ineq]) simp - also note S(3)[OF x1'] - also note le_y - finally have "?le x1" - using \x1 \ y\ by (auto simp: algebra_simps) - } ultimately show "?le x1" by arith - qed - hence "d' \ y" - unfolding y_def - by (rule cSup_upper) simp - thus False using \d > 0\ \y < b\ - by (simp add: d'_def min_def split: if_split_asm) - qed - } moreover { - assume "a = y" + have "y = b" + proof (cases "a = y") + case True with \a < b\ have "y < b" by simp with \a = y\ f_cont phi_cont \e2 > 0\ have 1: "\\<^sub>F x in at y within {y..b}. dist (f x) (f y) < e2" @@ -966,8 +810,7 @@ finally show "?le x1" . qed from this[unfolded eventually_at_topological] \?le y\ - obtain S - where S: "open S" "y \ S" "\x. x\S \ x \ {y..b} \ ?le x" + obtain S where S: "open S" "y \ S" "\x. x\S \ x \ {y..b} \ ?le x" by metis from \open S\ obtain d where d: "\x. dist x y < d \ x \ S" "d > 0" by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \y \ S\]) @@ -987,81 +830,140 @@ hence "d' \ y" unfolding y_def by (rule cSup_upper) simp - hence "y = b" using \d > 0\ \y < b\ + then show "y = b" using \d > 0\ \y < b\ by (simp add: d'_def) - } ultimately have "y = b" - by auto + next + case False + with \a \ y\ have "a < y" by simp + show "y = b" + proof (rule ccontr) + assume "y \ b" + hence "y < b" using \y \ b\ by simp + let ?F = "at y within {y.. has_vector_derivative \' y) ?F" + using \a < y\ \y < b\ + by (auto simp add: at_within_open[of _ "{a<..\<^sub>F x1 in ?F. norm (f x1 - f y - (x1 - y) *\<^sub>R f' y) \ e2 * \x1 - y\" + "\\<^sub>F x1 in ?F. norm (\ x1 - \ y - (x1 - y) *\<^sub>R \' y) \ e2 * \x1 - y\" + using \e2 > 0\ + by (auto simp: has_derivative_within_alt2 has_vector_derivative_def) + moreover + have "\\<^sub>F x1 in ?F. y \ x1" "\\<^sub>F x1 in ?F. x1 < b" + by (auto simp: eventually_at_filter) + ultimately + have "\\<^sub>F x1 in ?F. norm (f x1 - f y) \ (\ x1 - \ y) + e * \x1 - y\" + (is "\\<^sub>F x1 in ?F. ?le' x1") + proof eventually_elim + case (elim x1) + from norm_triangle_ineq2[THEN order_trans, OF elim(1)] + have "norm (f x1 - f y) \ norm (f' y) * \x1 - y\ + e2 * \x1 - y\" + by (simp add: ac_simps) + also have "norm (f' y) \ \' y" using bnd \a < y\ \y < b\ by simp + also have "\' y * \x1 - y\ \ \ x1 - \ y + e2 * \x1 - y\" + using elim by (simp add: ac_simps) + finally + have "norm (f x1 - f y) \ \ x1 - \ y + e2 * \x1 - y\ + e2 * \x1 - y\" + by (auto simp: mult_right_mono) + thus ?case by (simp add: e2_def) + qed + moreover have "?le' y" by simp + ultimately obtain S + where S: "open S" "y \ S" "\x. x\S \ x \ {y.. ?le' x" + unfolding eventually_at_topological + by metis + from \open S\ obtain d where d: "\x. dist x y < d \ x \ S" "d > 0" + by (force simp: dist_commute open_dist ball_def dest!: bspec[OF _ \y \ S\]) + define d' where "d' = min ((y + b)/2) (y + (d/2))" + have "d' \ A" + unfolding A_def + proof safe + show "a \ d'" using \a < y\ \0 < d\ \y < b\ by (simp add: d'_def) + show "d' \ b" using \y < b\ by (simp add: d'_def min_def) + fix x1 + assume x1: "x1 \ {a..y \ A\ local.leI x1 by auto + next + case False + hence x1': "x1 \ S" "x1 \ {y.. norm (f x1 - f y) + norm (f y - f a)" + by (rule order_trans[OF _ norm_triangle_ineq]) simp + also note S(3)[OF x1'] + also note le_y + finally show "?le x1" + using False by (auto simp: algebra_simps) + qed + qed + hence "d' \ y" + unfolding y_def by (rule cSup_upper) simp + thus False using \d > 0\ \y < b\ + by (simp add: d'_def min_def split: if_split_asm) + qed + qed with le_y have "norm (f b - f a) \ \ b - \ a + e * (b - a + 1)" by (simp add: algebra_simps) } note * = this - { + show ?thesis + proof (rule field_le_epsilon) fix e::real assume "e > 0" - hence "norm (f b - f a) \ \ b - \ a + e" + then show "norm (f b - f a) \ \ b - \ a + e" using *[of "e / (b - a + 1)"] \a < b\ by simp - } thus ?thesis - by (rule field_le_epsilon) + qed qed lemma differentiable_bound: fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" - assumes "convex s" - and "\x\s. (f has_derivative f' x) (at x within s)" - and "\x\s. onorm (f' x) \ B" - and x: "x \ s" - and y: "y \ s" + assumes "convex S" + and derf: "\x. x\S \ (f has_derivative f' x) (at x within S)" + and B: "\x. x \ S \ onorm (f' x) \ B" + and x: "x \ S" + and y: "y \ S" shows "norm (f x - f y) \ B * norm (x - y)" proof - let ?p = "\u. x + u *\<^sub>R (y - x)" let ?\ = "\h. h * B * norm (x - y)" - have *: "\u. u\{0..1} \ x + u *\<^sub>R (y - x) \ s" - using assms(1)[unfolded convex_alt,rule_format,OF x y] - unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib - by (auto simp add: algebra_simps) - have 0: "continuous_on (?p ` {0..1}) f" - using * + have *: "x + u *\<^sub>R (y - x) \ S" if "u \ {0..1}" for u + proof - + have "u *\<^sub>R y = u *\<^sub>R (y - x) + u *\<^sub>R x" + by (simp add: scale_right_diff_distrib) + then show "x + u *\<^sub>R (y - x) \ S" + using that \convex S\ unfolding convex_alt by (metis (no_types) atLeastAtMost_iff linordered_field_class.sign_simps(2) pth_c(3) scaleR_collapse x y) + qed + have "\z. z \ (\u. x + u *\<^sub>R (y - x)) ` {0..1} \ + (f has_derivative f' z) (at z within (\u. x + u *\<^sub>R (y - x)) ` {0..1})" + by (auto intro: * has_derivative_within_subset [OF derf]) + then have "continuous_on (?p ` {0..1}) f" unfolding continuous_on_eq_continuous_within - apply - - apply rule - apply (rule differentiable_imp_continuous_within) - unfolding differentiable_def - apply (rule_tac x="f' xa" in exI) - apply (rule has_derivative_within_subset) - apply (rule assms(2)[rule_format]) - apply auto - done - from * have 1: "continuous_on {0 .. 1} (f \ ?p)" - by (intro continuous_intros 0)+ + by (meson has_derivative_continuous) + with * have 1: "continuous_on {0 .. 1} (f \ ?p)" + by (intro continuous_intros)+ { fix u::real assume u: "u \{0 <..< 1}" let ?u = "?p u" interpret linear "(f' ?u)" - using u by (auto intro!: has_derivative_linear assms(2)[rule_format] *) + using u by (auto intro!: has_derivative_linear derf *) have "(f \ ?p has_derivative (f' ?u) \ (\u. 0 + u *\<^sub>R (y - x))) (at u within box 0 1)" - apply (rule diff_chain_within) - apply (rule derivative_intros)+ - apply (rule has_derivative_within_subset) - apply (rule assms(2)[rule_format]) - using u * - apply auto - done + by (intro derivative_intros has_derivative_within_subset [OF derf]) (use u * in auto) hence "((f \ ?p) has_vector_derivative f' ?u (y - x)) (at u)" by (simp add: has_derivative_within_open[OF u open_greaterThanLessThan] scaleR has_vector_derivative_def o_def) } note 2 = this - { - have "continuous_on {0..1} ?\" - by (rule continuous_intros)+ - } note 3 = this - { - fix u::real assume u: "u \{0 <..< 1}" - have "(?\ has_vector_derivative B * norm (x - y)) (at u)" - by (auto simp: has_vector_derivative_def intro!: derivative_eq_intros) - } note 4 = this + have 3: "continuous_on {0..1} ?\" + by (rule continuous_intros)+ + have 4: "(?\ has_vector_derivative B * norm (x - y)) (at u)" for u + by (auto simp: has_vector_derivative_def intro!: derivative_eq_intros) { fix u::real assume u: "u \{0 <..< 1}" let ?u = "?p u" interpret bounded_linear "(f' ?u)" - using u by (auto intro!: has_derivative_bounded_linear assms(2)[rule_format] *) + using u by (auto intro!: has_derivative_bounded_linear derf *) have "norm (f' ?u (y - x)) \ onorm (f' ?u) * norm (y - x)" by (rule onorm) (rule bounded_linear) also have "onorm (f' ?u) \ B" @@ -1083,7 +985,7 @@ fixes f::"'a::real_normed_vector \ 'b::real_normed_vector" assumes "\t. t \ {0..1} \ x0 + t *\<^sub>R a \ G" assumes f': "\x. x \ G \ (f has_derivative f' x) (at x within G)" - assumes B: "\x\{0..1}. onorm (f' (x0 + x *\<^sub>R a)) \ B" + assumes B: "\x. x \ {0..1} \ onorm (f' (x0 + x *\<^sub>R a)) \ B" shows "norm (f (x0 + a) - f x0) \ norm a * B" proof - let ?G = "(\x. x0 + x *\<^sub>R a) ` {0..1}" @@ -1095,14 +997,14 @@ ultimately show ?thesis using has_derivative_subset[OF f' \?G \ G\] B differentiable_bound[of "(\x. x0 + x *\<^sub>R a) ` {0..1}" f f' B "x0 + a" x0] - by (auto simp: ac_simps) + by (force simp: ac_simps) qed lemma differentiable_bound_linearization: fixes f::"'a::real_normed_vector \ 'b::real_normed_vector" - assumes "\t. t \ {0..1} \ a + t *\<^sub>R (b - a) \ S" + assumes S: "\t. t \ {0..1} \ a + t *\<^sub>R (b - a) \ S" assumes f'[derivative_intros]: "\x. x \ S \ (f has_derivative f' x) (at x within S)" - assumes B: "\x\S. onorm (f' x - f' x0) \ B" + assumes B: "\x. x \ S \ onorm (f' x - f' x0) \ B" assumes "x0 \ S" shows "norm (f b - f a - f' x0 (b - a)) \ norm (b - a) * B" proof - @@ -1111,9 +1013,9 @@ unfolding g_def using assms by (auto intro!: derivative_eq_intros bounded_linear.has_derivative[OF has_derivative_bounded_linear, OF f']) - from B have B: "\x\{0..1}. onorm (\i. f' (a + x *\<^sub>R (b - a)) i - f' x0 i) \ B" - using assms by (auto simp: fun_diff_def) - from differentiable_bound_segment[OF assms(1) g B] \x0 \ S\ + from B have "\x\{0..1}. onorm (\i. f' (a + x *\<^sub>R (b - a)) i - f' x0 i) \ B" + using assms by (auto simp: fun_diff_def) + with differentiable_bound_segment[OF S g] \x0 \ S\ show ?thesis by (simp add: g_def field_simps linear_diff[OF has_derivative_linear[OF f']]) qed @@ -1122,7 +1024,7 @@ fixes f::"real \ 'b::real_normed_vector" assumes f': "\x. x \ S \ (f has_vector_derivative f' x) (at x within S)" assumes "closed_segment a b \ S" - assumes B: "\x\S. norm (f' x - f' x0) \ B" + assumes B: "\x. x \ S \ norm (f' x - f' x0) \ B" assumes "x0 \ S" shows "norm (f b - f a - (b - a) *\<^sub>R f' x0) \ norm (b - a) * B" using assms @@ -1346,20 +1248,14 @@ and "x \ S" and fx: "f x \ interior (f ` S)" and "continuous_on S f" - and "\y. y \ S \ g (f y) = y" + and gf: "\y. y \ S \ g (f y) = y" and "(f has_derivative f') (at x)" and "bounded_linear g'" and "g' \ f' = id" shows "(g has_derivative g') (at (f x))" proof - - { - fix y - 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\] .. - } note * = this + have *: "\y. y \ interior (f ` S) \ f (g y) = y" + by (metis gf image_iff interior_subset subsetCE) show ?thesis apply (rule has_derivative_inverse_basic_x[OF assms(6-8), where T = "interior (f ` S)"]) apply (rule continuous_on_interior[OF _ fx]) @@ -1386,8 +1282,8 @@ show ?thesis unfolding * apply (rule brouwer[OF assms(1-3), of "\y. x + (y - f y)"]) - apply (rule continuous_intros assms)+ - using assms(4-6) + apply (intro continuous_intros) + using assms apply auto done qed @@ -1411,34 +1307,28 @@ lemma sussmann_open_mapping: fixes f :: "'a::real_normed_vector \ 'b::euclidean_space" assumes "open S" - and "continuous_on S f" + and contf: "continuous_on S f" and "x \ S" - and "(f has_derivative f') (at x)" + and derf: "(f has_derivative f') (at x)" and "bounded_linear g'" "f' \ g' = id" and "T \ S" - and "x \ interior T" + and x: "x \ interior T" shows "f x \ interior (f ` T)" proof - interpret f': bounded_linear f' - using assms - unfolding has_derivative_def - by auto + using assms unfolding has_derivative_def by auto interpret g': bounded_linear g' - using assms - by auto + using assms by auto obtain B where B: "0 < B" "\x. norm (g' x) \ norm x * B" using bounded_linear.pos_bounded[OF assms(5)] by blast hence *: "1 / (2 * B) > 0" by auto obtain e0 where e0: "0 < e0" "\y. norm (y - x) < e0 \ norm (f y - f x - f' (y - x)) \ 1 / (2 * B) * norm (y - x)" - using assms(4) - unfolding has_derivative_at_alt + using derf unfolding has_derivative_at_alt using * by blast obtain e1 where e1: "0 < e1" "cball x e1 \ T" - using assms(8) - unfolding mem_interior_cball - by blast + using mem_interior_cball x 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 @@ -1449,83 +1339,59 @@ 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" - unfolding g'.diff[symmetric] - using B - by auto + by (metis B(2) g'.diff) also have "\ \ e * B" - using as(1)[unfolded mem_cball dist_norm] - using B - by auto + by (metis B(1) dist_norm mem_cball real_mult_le_cancel_iff1 that(1)) also have "\ \ e1" - using e - unfolding less_divide_eq - using B - by auto + using B(1) e(3) pos_less_divide_eq by fastforce finally have "z \ cball x e1" - unfolding mem_cball by force 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 + proof (rule continuous_on_compose2 [OF _ _ order_refl, of _ _ f]) + show "continuous_on ((\y. x + (g' y - g' (f x))) ` cball (f x) e) f" + by (rule continuous_on_subset[OF contf]) (use z in blast) + show "continuous_on (cball (f x) e) (\y. x + (g' y - g' (f x)))" + by (intro continuous_intros linear_continuous_on[OF \bounded_linear g'\]) + qed next fix y z - assume as: "y \ cball (f x) (e / 2)" "z \ cball (f x) e" + assume y: "y \ cball (f x) (e / 2)" and z: "z \ cball (f x) e" have "norm (g' (z - f x)) \ norm (z - f x) * B" using B by auto also have "\ \ e * B" - apply (rule mult_right_mono) - using as(2)[unfolded mem_cball dist_norm] and B - unfolding norm_minus_commute - apply auto - done + by (metis B(1) z dist_norm mem_cball norm_minus_commute real_mult_le_cancel_iff1) also have "\ < e0" - using e and B - unfolding less_divide_eq - by auto + using B(1) e(2) pos_less_divide_eq by blast finally have *: "norm (x + g' (z - f x) - x) < e0" by auto have **: "f x + f' (x + g' (z - f x) - x) = z" using assms(6)[unfolded o_def id_def,THEN cong] by auto have "norm (f x - (y + (z - f (x + g' (z - f x))))) \ - norm (f (x + g' (z - f x)) - z) + norm (f x - y)" + norm (f (x + g' (z - f x)) - z) + norm (f x - y)" using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"] by (auto simp add: algebra_simps) also have "\ \ 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)" using e0(2)[rule_format, OF *] by (simp only: algebra_simps **) auto also have "\ \ 1 / (B * 2) * norm (g' (z - f x)) + e/2" - using as(1)[unfolded mem_cball dist_norm] - by auto + using y by (auto simp: dist_norm) also have "\ \ 1 / (B * 2) * B * norm (z - f x) + e/2" - using * and B - by (auto simp add: field_simps) + using * B by (auto simp add: field_simps) also have "\ \ 1 / 2 * norm (z - f x) + e/2" by auto also have "\ \ e/2 + e/2" - apply (rule add_right_mono) - using as(2)[unfolded mem_cball dist_norm] - unfolding norm_minus_commute - apply auto - done + using B(1) \norm (z - f x) * B \ e * B\ by auto finally show "y + (z - f (x + g' (z - f x))) \ cball (f x) e" - unfolding mem_cball dist_norm - by auto + by (auto simp: dist_norm) qed (use e that in auto) show ?thesis unfolding mem_interior - apply (rule_tac x="e/2" in exI) - apply rule - apply (rule divide_pos_pos) - prefer 3 - proof + proof (intro exI conjI subsetI) fix y assume "y \ ball (f x) (e / 2)" then have *: "y \ cball (f x) (e / 2)" @@ -1536,23 +1402,14 @@ using B by (auto simp add: field_simps) also have "\ \ e * B" - apply (rule mult_right_mono) - using z(1) - unfolding mem_cball dist_norm norm_minus_commute - using B - apply auto - done + by (metis B(1) dist_norm mem_cball norm_minus_commute real_mult_le_cancel_iff1 z(1)) also have "\ \ e1" using e B unfolding less_divide_eq by auto 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 + by (metis add_diff_cancel diff_diff_add dist_norm e1(2) mem_cball norm_minus_commute subset_eq) then show "y \ f ` T" using z by auto - qed (insert e, auto) + qed (use e in auto) qed text \Hence the following eccentric variant of the inverse function theorem. @@ -1562,30 +1419,25 @@ lemma has_derivative_inverse_strong: fixes f :: "'n::euclidean_space \ 'n" - assumes "open s" - and "x \ s" - and "continuous_on s f" - and "\x\s. g (f x) = x" - and "(f has_derivative f') (at x)" - and "f' \ g' = id" + assumes "open S" + and "x \ S" + and contf: "continuous_on S f" + and gf: "\x. x \ S \ g (f x) = x" + and derf: "(f has_derivative f') (at x)" + and id: "f' \ g' = id" shows "(g has_derivative g') (at (f x))" proof - have linf: "bounded_linear f'" - using assms(5) unfolding has_derivative_def by auto + using derf unfolding has_derivative_def by auto then have ling: "bounded_linear g'" unfolding linear_conv_bounded_linear[symmetric] - apply - - apply (rule right_inverse_linear) - using assms(6) - apply auto - done + using id right_inverse_linear by blast moreover have "g' \ f' = id" - using assms(6) linf ling + using id linf ling unfolding linear_conv_bounded_linear[symmetric] using linear_inverse_left by auto - moreover have *:"\t\s. x \ interior t \ f x \ interior (f ` t)" - apply clarify + moreover have *: "\T. \T \ S; x \ interior T\ \ f x \ interior (f ` T)" apply (rule sussmann_open_mapping) apply (rule assms ling)+ apply auto @@ -1595,44 +1447,30 @@ proof (rule, rule) fix e :: real assume "e > 0" - then have "f x \ interior (f ` (ball x e \ s))" - using *[rule_format,of "ball x e \ s"] \x \ s\ + then have "f x \ interior (f ` (ball x e \ S))" + using *[rule_format,of "ball x e \ S"] \x \ S\ by (auto simp add: interior_open[OF open_ball] interior_open[OF assms(1)]) - then obtain d where d: "0 < d" "ball (f x) d \ f ` (ball x e \ s)" + then obtain d where d: "0 < d" "ball (f x) d \ f ` (ball x e \ S)" unfolding mem_interior by blast show "\d>0. \y. 0 < dist y (f x) \ dist y (f x) < d \ dist (g y) (g (f x)) < e" - apply (rule_tac x=d in exI) - apply rule - apply (rule d(1)) - apply rule - apply rule - proof - + proof (intro exI allI impI conjI) fix y assume "0 < dist y (f x) \ dist y (f x) < d" - then have "g y \ g ` f ` (ball x e \ s)" - using d(2)[unfolded subset_eq,THEN bspec[where x=y]] - by (auto simp add: dist_commute) - then have "g y \ ball x e \ s" - using assms(4) by auto + then have "g y \ g ` f ` (ball x e \ S)" + by (metis d(2) dist_commute mem_ball rev_image_eqI subset_iff) then show "dist (g y) (g (f x)) < e" - using assms(4)[rule_format,OF \x \ s\] - by (auto simp add: dist_commute) - qed + using gf[OF \x \ S\] + by (simp add: assms(4) dist_commute image_iff) + qed (use d in auto) qed - moreover have "f x \ interior (f ` s)" + moreover have "f x \ interior (f ` S)" apply (rule sussmann_open_mapping) apply (rule assms ling)+ - using interior_open[OF assms(1)] and \x \ s\ + using interior_open[OF assms(1)] and \x \ S\ apply auto done - moreover have "f (g y) = y" if "y \ interior (f ` s)" for y - proof - - from that have "y \ f ` s" - using interior_subset by auto - then obtain z where "z \ s" "y = f z" unfolding image_iff .. - then show ?thesis - using assms(4) by auto - qed + moreover have "f (g y) = y" if "y \ interior (f ` S)" for y + by (metis gf imageE interiorE set_mp that) ultimately show ?thesis using assms by (metis has_derivative_inverse_basic_x open_interior) qed @@ -1641,10 +1479,10 @@ lemma has_derivative_inverse_strong_x: fixes f :: "'a::euclidean_space \ 'a" - assumes "open s" - and "g y \ s" - and "continuous_on s f" - and "\x\s. g (f x) = x" + assumes "open S" + and "g y \ S" + and "continuous_on S f" + and "\x. x \ S \ g (f x) = x" and "(f has_derivative f') (at (g y))" and "f' \ g' = id" and "f (g y) = y" @@ -1657,21 +1495,18 @@ lemma has_derivative_inverse_on: fixes f :: "'n::euclidean_space \ 'n" - assumes "open s" - and "\x\s. (f has_derivative f'(x)) (at x)" - and "\x\s. g (f x) = x" + assumes "open S" + and derf: "\x. x \ S \ (f has_derivative f'(x)) (at x)" + and "\x. x \ S \ g (f x) = x" and "f' x \ g' x = id" - and "x \ s" + and "x \ S" shows "(g has_derivative g'(x)) (at (f x))" - apply (rule has_derivative_inverse_strong[where g'="g' x" and f=f]) - apply (rule assms)+ - unfolding continuous_on_eq_continuous_at[OF assms(1)] - apply rule - apply (rule differentiable_imp_continuous_within) - unfolding differentiable_def - using assms - apply auto - done +proof (rule has_derivative_inverse_strong[where g'="g' x" and f=f]) + show "continuous_on S f" + unfolding continuous_on_eq_continuous_at[OF \open S\] + using derf has_derivative_continuous by blast +qed (use assms in auto) + text \Invertible derivative continous at a point implies local injectivity. It's only for this we need continuity of the derivative, @@ -1681,13 +1516,13 @@ proposition has_derivative_locally_injective: fixes f :: "'n::euclidean_space \ 'm::euclidean_space" - assumes "a \ s" - and "open s" + assumes "a \ S" + and "open S" and bling: "bounded_linear g'" and "g' \ f' a = id" - and derf: "\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)" + obtains r where "r > 0" "ball a r \ S" "inj_on f (ball a r)" proof - interpret bounded_linear g' using assms by auto @@ -1704,21 +1539,17 @@ "0 < d1" "\x. dist a x < d1 \ onorm (\v. f' x v - f' a v) < k" using assms(6) * by blast - from \open s\ obtain d2 where "d2 > 0" "ball a d2 \ s" - using \a\s\ .. - obtain d2 where "d2 > 0" "ball a d2 \ s" - using assms(2,1) .. - obtain d2 where d2: "0 < d2" "ball a d2 \ s" - using assms(2) - unfolding open_contains_ball - using \a\s\ by blast + from \open S\ obtain d2 where "d2 > 0" "ball a d2 \ S" + using \a\S\ .. + obtain d2 where d2: "0 < d2" "ball a d2 \ S" + using \0 < d2\ \ball a d2 \ S\ by blast obtain d where d: "0 < d" "d < d1" "d < d2" using real_lbound_gt_zero[OF d1(1) d2(1)] by blast show ?thesis proof show "0 < d" by (fact d) - show "ball a d \ s" - using \d < d2\ \ball a d2 \ s\ by auto + show "ball a d \ S" + using \d < d2\ \ball a d2 \ S\ by auto show "inj_on f (ball a d)" unfolding inj_on_def proof (intro strip) @@ -1726,55 +1557,36 @@ assume as: "x \ ball a d" "y \ ball a d" "f x = f y" define ph where [abs_def]: "ph w = w - g' (f w - f x)" for w have ph':"ph = g' \ (\w. f' a w - (f w - f x))" - unfolding ph_def o_def - unfolding diff - using f'g' - by (auto simp: algebra_simps) + unfolding ph_def o_def by (simp add: diff f'g') have "norm (ph x - ph y) \ (1 / 2) * norm (x - y)" - apply (rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\x v. v - g'(f' x v)"]) - apply (rule_tac[!] ballI) - proof - + proof (rule differentiable_bound[OF convex_ball _ _ as(1-2)]) fix u assume u: "u \ ball a d" - then have "u \ s" + then have "u \ S" using d d2 by auto 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 + using \a \ S\ derf by blast show "(ph has_derivative (\v. v - g' (f' u v))) (at u within ball a d)" 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)+ + 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) - using assms(5) \u \ s\ \a \ s\ - apply auto - done - have "onorm (\v. v - g' (f' u v)) \ onorm g' * onorm (\w. f' a w - f' u w)" - unfolding * - apply (rule onorm_compose) - apply (rule assms(3) **)+ - done + using \u \ S\ blin bounded_linear_sub derf by auto + then have "onorm (\v. v - g' (f' u v)) \ onorm g' * onorm (\w. f' a w - f' u w)" + by (simp add: "*" bounded_linear_axioms onorm_compose) also have "\ \ onorm g' * k" apply (rule mult_left_mono) using d1(2)[of u] - using onorm_neg[where f="\x. f' u x - f' a x"] - using d and u and onorm_pos_le[OF assms(3)] - apply (auto simp: algebra_simps) + using onorm_neg[where f="\x. f' u x - f' a x"] d u onorm_pos_le[OF bling] apply (auto simp: algebra_simps) done also have "\ \ 1 / 2" unfolding k_def by auto finally show "onorm (\v. v - g' (f' u v)) \ 1 / 2" . qed moreover have "norm (ph y - ph x) = norm (y - x)" - apply (rule arg_cong[where f=norm]) - unfolding ph_def - using diff - unfolding as - apply auto - done + by (simp add: as(3) ph_def) ultimately show "x = y" unfolding norm_minus_commute by auto qed @@ -1786,32 +1598,28 @@ lemma has_derivative_sequence_lipschitz_lemma: 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 "\n\N. \x\s. \h. norm (f' n x h - g' x h) \ e * norm h" + assumes "convex S" + and derf: "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and nle: "\n x h. \n\N; x \ S\ \ norm (f' n x h - g' x h) \ e * norm h" and "0 \ e" - shows "\m\N. \n\N. \x\s. \y\s. norm ((f m x - f n x) - (f m y - f n y)) \ 2 * e * norm (x - y)" -proof rule+ + shows "\m\N. \n\N. \x\S. \y\S. norm ((f m x - f n x) - (f m y - f n y)) \ 2 * e * norm (x - y)" +proof clarify fix m n x y - assume as: "N \ m" "N \ n" "x \ s" "y \ s" + assume as: "N \ m" "N \ n" "x \ S" "y \ S" show "norm ((f m x - f n x) - (f m y - f n y)) \ 2 * e * norm (x - y)" - apply (rule differentiable_bound[where f'="\x h. f' m x h - f' n x h", OF assms(1) _ _ as(3-4)]) - apply (rule_tac[!] ballI) - proof - + proof (rule differentiable_bound[where f'="\x h. f' m x h - f' n x h", OF \convex S\ _ _ as(3-4)]) fix x - assume "x \ s" - show "((\a. f m a - f n a) has_derivative (\h. f' m x h - f' n x h)) (at x within s)" - by (rule derivative_intros assms(2)[rule_format] \x\s\)+ + assume "x \ S" + show "((\a. f m a - f n a) has_derivative (\h. f' m x h - f' n x h)) (at x within S)" + by (rule derivative_intros derf \x\S\)+ show "onorm (\h. f' m x h - f' n x h) \ 2 * e" proof (rule onorm_bound) fix h have "norm (f' m x h - f' n x h) \ norm (f' m x h - g' x h) + norm (f' n x h - g' x h)" using norm_triangle_ineq[of "f' m x h - g' x h" "- f' n x h + g' x h"] - unfolding norm_minus_commute - by (auto simp add: algebra_simps) + by (auto simp add: algebra_simps norm_minus_commute) also have "\ \ e * norm h + e * norm h" - using assms(3)[rule_format,OF \N \ m\ \x \ s\, of h] - using assms(3)[rule_format,OF \N \ n\ \x \ s\, of h] + using nle[OF \N \ m\ \x \ S\, of h] nle[OF \N \ n\ \x \ S\, of h] by (auto simp add: field_simps) finally show "norm (f' m x h - f' n x h) \ 2 * e * norm h" by auto @@ -1823,18 +1631,20 @@ fixes f :: "nat \ 'a::real_normed_vector \ 'b::real_normed_vector" 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 nle: "\e. e > 0 \ \\<^sub>F n in sequentially. \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 - - 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 + have *: "2 * (e/2) = e" + using \e > 0\ by auto + obtain N where "\n\N. \x\S. \h. norm (f' n x h - g' x h) \ (e/2) * norm h" + using nle \e > 0\ + unfolding eventually_sequentially + by (metis less_divide_eq_numeral1(1) mult_zero_left) 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 *]) + apply (rule has_derivative_sequence_lipschitz_lemma[where e="e/2", unfolded *]) using assms \e > 0\ apply auto done @@ -1843,60 +1653,51 @@ lemma has_derivative_sequence: 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. e > 0 \ \N. \n\N. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + and derf: "\n x. x \ S \ ((f n) has_derivative (f' n x)) (at x within S)" + and nle: "\e. e > 0 \ \\<^sub>F n in sequentially. \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)" + and lim: "((\n. f n x0) \ l) sequentially" + shows "\g. \x\S. (\n. f n x) \ g x \ (g has_derivative g'(x)) (at x within S)" proof - 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" - apply (rule bchoice) - unfolding convergent_eq_Cauchy - proof + proof (intro ballI bchoice) fix x assume "x \ S" - show "Cauchy (\n. f n x)" + show "\y. (\n. f n x) \ y" + unfolding convergent_eq_Cauchy proof (cases "x = x0") case True - then show ?thesis - using LIMSEQ_imp_Cauchy[OF assms(5)] by auto + then show "Cauchy (\n. f n x)" + using LIMSEQ_imp_Cauchy[OF lim] by auto next case False - show ?thesis + show "Cauchy (\n. f n x)" unfolding Cauchy_def proof (intro allI impI) fix e :: real assume "e > 0" hence *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0" using False by auto obtain M where M: "\m\M. \n\M. dist (f m x0) (f n x0) < e / 2" - using LIMSEQ_imp_Cauchy[OF assms(5)] - unfolding Cauchy_def - using *(1) by blast + using LIMSEQ_imp_Cauchy[OF lim] * unfolding Cauchy_def 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)) \ - e / 2 / norm (x - x0) * norm (xa - y)" + \u\S. \y\S. norm (f m u - f n u - (f m y - f n y)) \ + e / 2 / norm (x - x0) * norm (u - y)" using lem1 *(2) by blast show "\M. \m\M. \n\M. dist (f m x) (f n x) < e" 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) \ - norm (f m x0 - f n x0) + norm (f m x - f n x - (f m x0 - f n x0))" + have "dist (f m x) (f n x) \ norm (f m x0 - f n x0) + norm (f m x - f n x - (f m x0 - f n x0))" 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 - by auto + using N \x\S\ \x0\S\ as False by fastforce also have "\ < e / 2 + e / 2" - apply (rule add_strict_right_mono) - using as and M[rule_format] - unfolding dist_norm - apply auto - done + by (rule add_strict_right_mono) (use as M in \auto simp: dist_norm\) finally show "dist (f m x) (f n x) < e" by auto qed @@ -1904,16 +1705,13 @@ 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)" - proof (rule, rule) - fix e :: real - assume *: "e > 0" + have lem2: "\N. \n\N. \x\S. \y\S. norm ((f n x - f n y) - (g x - g y)) \ e * norm (x - y)" if "e > 0" for e + proof - 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)" - using lem1 * by blast + using lem1 \e > 0\ 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)" - apply (rule_tac x=N in exI) - proof rule+ + proof (intro exI ballI allI impI) fix n x y 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" @@ -1924,8 +1722,7 @@ fix m assume "N \ m" then show "norm (f n x - f n y - (f m x - f m y)) \ e * norm (x - y)" - using N[rule_format, of n m x y] and as - by (auto simp add: algebra_simps) + using N as by (auto simp add: algebra_simps) qed ultimately show "norm (f n x - f n y - (g x - g y)) \ e * norm (x - y)" by (simp add: tendsto_upperbound) @@ -1933,31 +1730,28 @@ qed 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) + proof (intro ballI conjI allI impI) fix x assume "x \ S" - then show "((\n. f n x) \ g x) sequentially" + then show "(\n. f n x) \ g x" by (simp add: g) - have lem3: "\u. ((\n. f' n x u) \ g' x u) sequentially" + have tog': "(\n. f' n x u) \ g' x u" for u unfolding filterlim_def le_nhds_metric_le eventually_filtermap dist_norm proof (intro allI impI) - fix u fix e :: real assume "e > 0" show "eventually (\n. norm (f' n x u - g' x u) \ e) sequentially" 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\ - by (fast elim: eventually_mono) + using nle \0 < e\ \x \ S\ by (fast elim: eventually_mono) then show ?thesis - using \u = 0\ and \0 < e\ by (auto elim: eventually_mono) + using \u = 0\ \0 < e\ by (auto elim: eventually_mono) next 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\ - by (fast elim: eventually_mono) + using nle \x \ S\ by (fast elim: eventually_mono) then show ?thesis using \u \ 0\ by simp qed @@ -1968,23 +1762,20 @@ fix c :: real 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]) + apply (rule tendsto_unique[OF trivial_limit_sequentially tog']) unfolding lin[THEN bounded_linear.linear, THEN linear_cmul] - apply (intro tendsto_intros) - apply (rule lem3[rule_format]) + apply (intro tendsto_intros tog') done show "g' x (y + z) = g' x y + g' x z" - apply (rule tendsto_unique[OF trivial_limit_sequentially]) - apply (rule lem3[rule_format]) + apply (rule tendsto_unique[OF trivial_limit_sequentially tog']) unfolding lin[THEN bounded_linear.linear, THEN linear_add] apply (rule tendsto_add) - apply (rule lem3[rule_format])+ + apply (rule tog')+ 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 nle \x \ S\ unfolding eventually_sequentially by (fast intro: zero_less_one) have "bounded_linear (f' N x)" - using assms(2) \x \ S\ by fast + using derf \x \ S\ by fast from bounded_linear.bounded [OF this] obtain K where K: "\h. norm (f' N x h) \ norm h * K" .. { @@ -2000,20 +1791,19 @@ } 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)" - proof (rule, rule) - fix e :: real - assume "e > 0" - then have *: "e / 3 > 0" - by auto + show "eventually (\y. norm (g y - g x - g' x (y - x)) \ e * norm (y - x)) (at x within S)" + if "e > 0" for e + proof - + have *: "e / 3 > 0" + using that by auto 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 + using nle * unfolding eventually_sequentially 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[rule_format]: "\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 + using derf[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)" @@ -2022,7 +1812,7 @@ 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[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)"] @@ -2045,7 +1835,8 @@ fixes f :: "nat \ 'a::real_normed_vector \ 'b::banach" 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" + and no: "\e. e > 0 \ \\<^sub>F n in sequentially. + \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 @@ -2058,7 +1849,7 @@ 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 + apply auto done qed auto @@ -2087,14 +1878,14 @@ 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" + show "\\<^sub>F n in sequentially. \x\S. \h. norm (f' n x h - g' x h) \ e * norm h" + unfolding eventually_sequentially proof (intro exI allI ballI impI) fix n x h 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) + using n apply (auto simp add: field_simps) done show "norm (f' n x h - g' x h) \ e * norm h" by (meson "*" mult_right_mono norm_ge_zero order.trans x f') @@ -2109,7 +1900,7 @@ 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. e>0 \ \N. \n\N. \x\S. \h. norm (sum (\i. f' i x h) {.. e * norm h" + and "\e. e>0 \ \\<^sub>F n in sequentially. \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)" @@ -2130,7 +1921,9 @@ 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 "\N. \n\N. \x\S. \h. norm ((\i e * norm h" if "e > 0" for e + show "\\<^sub>F n in sequentially. + \x\S. \h. norm ((\i e * norm h" if "e > 0" for e + unfolding eventually_sequentially proof - from that assms(3) obtain N where N: "\n x. n \ N \ x \ S \ norm ((\ix. 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" - proof clarsimp - fix e :: real assume "0 < e" - with islimpt_approachable_real[of x S] not_bot + proof (rule frechet_derivative_unique_within, simp_all) + show "\d. d \ 0 \ \d\ < e \ x + d \ S" if "0 < e" for e + proof - + from that obtain x' where "x' \ S" "x' \ x" "\x' - x\ < e" + using islimpt_approachable_real[of x S] not_bot by (auto simp add: trivial_limit_within) - then show "\d. d \ 0 \ \d\ < e \ x + d \ S" - by (intro exI[of _ "x' - x"]) auto + then show ?thesis + using eq_iff_diff_eq_0 by fastforce qed - qed (insert f' f'', auto simp: has_vector_derivative_def) + qed (use f' f'' in \auto simp: has_vector_derivative_def\) then show ?thesis unfolding fun_eq_iff by (metis scaleR_one) qed @@ -2416,59 +2209,59 @@ lemma vector_derivative_within_closed_interval: fixes f::"real \ 'a::euclidean_space" - assumes "a < b" and "x \ {a .. b}" - assumes "(f has_vector_derivative f') (at x within {a .. b})" - shows "vector_derivative f (at x within {a .. b}) = f'" + assumes "a < b" and "x \ {a..b}" + assumes "(f has_vector_derivative f') (at x within {a..b})" + shows "vector_derivative f (at x within {a..b}) = f'" using assms vector_derivative_within_cbox by fastforce lemma has_vector_derivative_within_subset: - "(f has_vector_derivative f') (at x within s) \ t \ s \ (f has_vector_derivative f') (at x within t)" + "(f has_vector_derivative f') (at x within S) \ T \ S \ (f has_vector_derivative f') (at x within T)" by (auto simp: has_vector_derivative_def intro: has_derivative_within_subset) lemma has_vector_derivative_at_within: - "(f has_vector_derivative f') (at x) \ (f has_vector_derivative f') (at x within s)" + "(f has_vector_derivative f') (at x) \ (f has_vector_derivative f') (at x within S)" unfolding has_vector_derivative_def by (rule has_derivative_at_withinI) lemma has_vector_derivative_weaken: - fixes x D and f g s t - assumes f: "(f has_vector_derivative D) (at x within t)" - and "x \ s" "s \ t" - and "\x. x \ s \ f x = g x" - shows "(g has_vector_derivative D) (at x within s)" + fixes x D and f g S T + assumes f: "(f has_vector_derivative D) (at x within T)" + and "x \ S" "S \ T" + and "\x. x \ S \ f x = g x" + shows "(g has_vector_derivative D) (at x within S)" proof - - have "(f has_vector_derivative D) (at x within s) \ (g has_vector_derivative D) (at x within s)" + have "(f has_vector_derivative D) (at x within S) \ (g has_vector_derivative D) (at x within S)" unfolding has_vector_derivative_def has_derivative_iff_norm using assms by (intro conj_cong Lim_cong_within refl) auto then show ?thesis - using has_vector_derivative_within_subset[OF f \s \ t\] by simp + using has_vector_derivative_within_subset[OF f \S \ T\] by simp qed lemma has_vector_derivative_transform_within: - assumes "(f has_vector_derivative f') (at x within s)" + assumes "(f has_vector_derivative f') (at x within S)" and "0 < d" - and "x \ s" - and "\x'. \x'\s; dist x' x < d\ \ f x' = g x'" - shows "(g has_vector_derivative f') (at x within s)" + and "x \ S" + and "\x'. \x'\S; dist x' x < d\ \ f x' = g x'" + shows "(g has_vector_derivative f') (at x within S)" using assms unfolding has_vector_derivative_def by (rule has_derivative_transform_within) lemma has_vector_derivative_transform_within_open: assumes "(f has_vector_derivative f') (at x)" - and "open s" - and "x \ s" - and "\y. y\s \ f y = g y" + and "open S" + and "x \ S" + and "\y. y\S \ f y = g y" shows "(g has_vector_derivative f') (at x)" using assms unfolding has_vector_derivative_def by (rule has_derivative_transform_within_open) lemma has_vector_derivative_transform: - assumes "x \ s" "\x. x \ s \ g x = f x" - assumes f': "(f has_vector_derivative f') (at x within s)" - shows "(g has_vector_derivative f') (at x within s)" + assumes "x \ S" "\x. x \ S \ g x = f x" + assumes f': "(f has_vector_derivative f') (at x within S)" + shows "(g has_vector_derivative f') (at x within S)" using assms unfolding has_vector_derivative_def by (rule has_derivative_transform) @@ -2477,23 +2270,13 @@ assumes "(f has_vector_derivative f') (at x)" and "(g has_vector_derivative g') (at (f x))" shows "((g \ f) has_vector_derivative (f' *\<^sub>R g')) (at x)" - using assms(2) - unfolding has_vector_derivative_def - apply - - apply (drule diff_chain_at[OF assms(1)[unfolded has_vector_derivative_def]]) - apply (simp only: o_def real_scaleR_def scaleR_scaleR) - done + using assms has_vector_derivative_at_within has_vector_derivative_def vector_derivative_diff_chain_within by blast lemma vector_diff_chain_within: assumes "(f has_vector_derivative f') (at x within s)" and "(g has_vector_derivative g') (at (f x) within f ` s)" shows "((g \ f) has_vector_derivative (f' *\<^sub>R g')) (at x within s)" - using assms(2) - unfolding has_vector_derivative_def - apply - - apply (drule diff_chain_within[OF assms(1)[unfolded has_vector_derivative_def]]) - apply (simp only: o_def real_scaleR_def scaleR_scaleR) - done + using assms has_vector_derivative_def vector_derivative_diff_chain_within by blast lemma vector_derivative_const_at [simp]: "vector_derivative (\x. c) (at a) = 0" by (simp add: vector_derivative_at) @@ -2518,11 +2301,11 @@ by (auto simp: o_def mult.commute has_vector_derivative_def) lemma vector_derivative_chain_within: - assumes "at x within s \ bot" "f differentiable (at x within s)" - "(g has_derivative g') (at (f x) within f ` s)" - shows "vector_derivative (g \ f) (at x within s) = - g' (vector_derivative f (at x within s)) " - apply (rule vector_derivative_within [OF \at x within s \ bot\]) + assumes "at x within S \ bot" "f differentiable (at x within S)" + "(g has_derivative g') (at (f x) within f ` S)" + shows "vector_derivative (g \ f) (at x within S) = + g' (vector_derivative f (at x within S)) " + apply (rule vector_derivative_within [OF \at x within S \ bot\]) apply (rule vector_derivative_diff_chain_within) using assms(2-3) vector_derivative_works by auto @@ -2543,26 +2326,22 @@ by (simp add: field_differentiable_def DERIV_deriv_iff_has_field_derivative) lemma field_differentiable_imp_continuous_at: - "f field_differentiable (at x within s) \ continuous (at x within s) f" + "f field_differentiable (at x within S) \ continuous (at x within S) f" by (metis DERIV_continuous field_differentiable_def) lemma field_differentiable_within_subset: - "\f field_differentiable (at x within s); t \ s\ - \ f field_differentiable (at x within t)" + "\f field_differentiable (at x within S); T \ S\ \ f field_differentiable (at x within T)" by (metis DERIV_subset field_differentiable_def) lemma field_differentiable_at_within: "\f field_differentiable (at x)\ - \ f field_differentiable (at x within s)" + \ f field_differentiable (at x within S)" unfolding field_differentiable_def by (metis DERIV_subset top_greatest) lemma field_differentiable_linear [simp,derivative_intros]: "(( * ) c) field_differentiable F" -proof - - show ?thesis - unfolding field_differentiable_def has_field_derivative_def mult_commute_abs - by (force intro: has_derivative_mult_right) -qed + unfolding field_differentiable_def has_field_derivative_def mult_commute_abs + by (force intro: has_derivative_mult_right) lemma field_differentiable_const [simp,derivative_intros]: "(\z. c) field_differentiable F" unfolding field_differentiable_def has_field_derivative_def @@ -2602,45 +2381,45 @@ by (metis field_differentiable_diff) lemma field_differentiable_inverse [derivative_intros]: - assumes "f field_differentiable (at a within s)" "f a \ 0" - shows "(\z. inverse (f z)) field_differentiable (at a within s)" + assumes "f field_differentiable (at a within S)" "f a \ 0" + shows "(\z. inverse (f z)) field_differentiable (at a within S)" using assms unfolding field_differentiable_def by (metis DERIV_inverse_fun) lemma field_differentiable_mult [derivative_intros]: - assumes "f field_differentiable (at a within s)" - "g field_differentiable (at a within s)" - shows "(\z. f z * g z) field_differentiable (at a within s)" + assumes "f field_differentiable (at a within S)" + "g field_differentiable (at a within S)" + shows "(\z. f z * g z) field_differentiable (at a within S)" using assms unfolding field_differentiable_def - by (metis DERIV_mult [of f _ a s g]) + by (metis DERIV_mult [of f _ a S g]) lemma field_differentiable_divide [derivative_intros]: - assumes "f field_differentiable (at a within s)" - "g field_differentiable (at a within s)" + assumes "f field_differentiable (at a within S)" + "g field_differentiable (at a within S)" "g a \ 0" - shows "(\z. f z / g z) field_differentiable (at a within s)" + shows "(\z. f z / g z) field_differentiable (at a within S)" using assms unfolding field_differentiable_def - by (metis DERIV_divide [of f _ a s g]) + by (metis DERIV_divide [of f _ a S g]) lemma field_differentiable_power [derivative_intros]: - assumes "f field_differentiable (at a within s)" - shows "(\z. f z ^ n) field_differentiable (at a within s)" + assumes "f field_differentiable (at a within S)" + shows "(\z. f z ^ n) field_differentiable (at a within S)" using assms unfolding field_differentiable_def by (metis DERIV_power) lemma field_differentiable_transform_within: "0 < d \ - x \ s \ - (\x'. x' \ s \ dist x' x < d \ f x' = g x') \ - f field_differentiable (at x within s) - \ g field_differentiable (at x within s)" + x \ S \ + (\x'. x' \ S \ dist x' x < d \ f x' = g x') \ + f field_differentiable (at x within S) + \ g field_differentiable (at x within S)" unfolding field_differentiable_def has_field_derivative_def by (blast intro: has_derivative_transform_within) lemma field_differentiable_compose_within: - assumes "f field_differentiable (at a within s)" - "g field_differentiable (at (f a) within f`s)" - shows "(g o f) field_differentiable (at a within s)" + assumes "f field_differentiable (at a within S)" + "g field_differentiable (at (f a) within f`S)" + shows "(g o f) field_differentiable (at a within S)" using assms unfolding field_differentiable_def by (metis DERIV_image_chain) @@ -2650,7 +2429,7 @@ by (metis field_differentiable_at_within field_differentiable_compose_within) lemma field_differentiable_within_open: - "\a \ s; open s\ \ f field_differentiable at a within s \ + "\a \ S; open S\ \ f field_differentiable at a within S \ f field_differentiable at a" unfolding field_differentiable_def by (metis at_within_open) @@ -2692,9 +2471,7 @@ unfolding * by (rule tendsto_norm_zero_cancel) (auto intro!: tendsto_eq_intros) - moreover - - have "\\<^sub>F x in at t within T. x \ t" + moreover have "\\<^sub>F x in at t within T. x \ t" by (simp add: eventually_at_filter) then have "\\<^sub>F x in at t within T. ((x - t) / \x - t\) *\<^sub>R ((\n. ?e n x) - A) = (exp ((x - t) *\<^sub>R A) - 1 - (x - t) *\<^sub>R A) /\<^sub>R norm (x - t)" @@ -2721,9 +2498,7 @@ by (simp add: divide_simps) qed - ultimately - - have "((\y. (exp ((y - t) *\<^sub>R A) - 1 - (y - t) *\<^sub>R A) /\<^sub>R norm (y - t)) \ 0) (at t within T)" + ultimately have "((\y. (exp ((y - t) *\<^sub>R A) - 1 - (y - t) *\<^sub>R A) /\<^sub>R norm (y - t)) \ 0) (at t within T)" by (rule Lim_transform_eventually[rotated]) from tendsto_mult_right_zero[OF this, where c="exp (t *\<^sub>R A)"] show "((\y. (exp (y *\<^sub>R A) - exp (t *\<^sub>R A) - (y - t) *\<^sub>R (exp (t *\<^sub>R A) * A)) /\<^sub>R norm (y - t)) \ 0) @@ -2756,7 +2531,7 @@ also have "\ \ closure (interior A \ {c<..})" by (intro open_Int_closure_subset) auto finally have "at c within ?A' \ bot" by (subst at_within_eq_bot_iff) auto moreover from deriv have "((\y. (f y - f c) / (y - c)) \ f') (at c within ?A')" - unfolding DERIV_within_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le) + unfolding has_field_derivative_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le) moreover from eventually_at_right_real[OF xc] have "eventually (\y. (f y - f c) / (y - c) \ (f x - f c) / (x - c)) (at_right c)" proof eventually_elim @@ -2778,7 +2553,7 @@ also have "\ \ closure (interior A \ {.. bot" by (subst at_within_eq_bot_iff) auto moreover from deriv have "((\y. (f y - f c) / (y - c)) \ f') (at c within ?A')" - unfolding DERIV_within_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le) + unfolding has_field_derivative_iff using interior_subset[of A] by (blast intro: tendsto_mono at_le) moreover from eventually_at_left_real[OF xc] have "eventually (\y. (f y - f c) / (y - c) \ (f x - f c) / (x - c)) (at_left c)" proof eventually_elim @@ -2816,8 +2591,7 @@ lemma eventually_at_Pair_within_TimesI2: fixes x::"'a::metric_space" - assumes "\\<^sub>F y' in at y within Y. P y'" - assumes "P y" + assumes "\\<^sub>F y' in at y within Y. P y'" "P y" shows "\\<^sub>F (x', y') in at (x, y) within X \ Y. P y'" proof - from assms[unfolded eventually_at_topological] @@ -2907,12 +2681,12 @@ have "\ \ ball y d \ Y" using \y \ Y\ \0 < d\ dy y' by (intro \convex ?S\[unfolded convex_contains_segment, rule_format, of y y']) - (auto simp: dist_commute mem_ball) + (auto simp: dist_commute) finally have "y + t *\<^sub>R (y' - y) \ ?S" . } note seg = this - have "\x\ball y d \ Y. onorm (blinfun_apply (fy x' x) - blinfun_apply (fy x' y)) \ e + e" - by (safe intro!: onorm less_imp_le \x' \ X\ dx) (auto simp: mem_ball dist_commute \0 < d\ \y \ Y\) + have "\x. x \ ball y d \ Y \ onorm (blinfun_apply (fy x' x) - blinfun_apply (fy x' y)) \ e + e" + by (safe intro!: onorm less_imp_le \x' \ X\ dx) (auto simp: dist_commute \0 < d\ \y \ Y\) with seg has_derivative_within_subset[OF assms(2)[OF \x' \ X\]] show "norm (f x' y' - f x' y - (fy x' y) (y' - y)) \ norm (y' - y) * (e + e)" by (rule differentiable_bound_linearization[where S="?S"]) @@ -2923,10 +2697,10 @@ from fx[unfolded has_derivative_within, THEN conjunct2, THEN tendstoD, OF \0 < e\] have "\\<^sub>F x' in at x within X. ?le x'" by eventually_elim - (auto simp: dist_norm divide_simps blinfun.bilinear_simps field_simps fx.zero split: if_split_asm) + (auto simp: dist_norm divide_simps blinfun.bilinear_simps field_simps split: if_split_asm) then have "\\<^sub>F (x', y') in at (x, y) within X \ Y. ?le x'" by (rule eventually_at_Pair_within_TimesI1) - (simp add: blinfun.bilinear_simps fx.zero) + (simp add: blinfun.bilinear_simps) moreover have "\\<^sub>F (x', y') in at (x, y) within X \ Y. norm ((x', y') - (x, y)) \ 0" unfolding norm_eq_zero right_minus_eq by (auto simp: eventually_at intro!: zero_less_one) @@ -2996,11 +2770,11 @@ subsection \Differentiable case distinction\ lemma has_derivative_within_If_eq: - "((\x. if P x then f x else g x) has_derivative f') (at x within s) = + "((\x. if P x then f x else g x) has_derivative f') (at x within S) = (bounded_linear f' \ ((\y.(if P y then (f y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x) else (g y - ((if P x then f x else g x) + f' (y - x)))/\<^sub>R norm (y - x))) - \ 0) (at x within s))" + \ 0) (at x within S))" (is "_ = (_ \ (?if \ 0) _)") proof - have "(\y. (1 / norm (y - x)) *\<^sub>R @@ -3011,41 +2785,41 @@ qed lemma has_derivative_If_within_closures: - assumes f': "x \ s \ (closure s \ closure t) \ - (f has_derivative f' x) (at x within s \ (closure s \ closure t))" - assumes g': "x \ t \ (closure s \ closure t) \ - (g has_derivative g' x) (at x within t \ (closure s \ closure t))" - assumes connect: "x \ closure s \ x \ closure t \ f x = g x" - assumes connect': "x \ closure s \ x \ closure t \ f' x = g' x" - assumes x_in: "x \ s \ t" - shows "((\x. if x \ s then f x else g x) has_derivative - (if x \ s then f' x else g' x)) (at x within (s \ t))" + assumes f': "x \ S \ (closure S \ closure T) \ + (f has_derivative f' x) (at x within S \ (closure S \ closure T))" + assumes g': "x \ T \ (closure S \ closure T) \ + (g has_derivative g' x) (at x within T \ (closure S \ closure T))" + assumes connect: "x \ closure S \ x \ closure T \ f x = g x" + assumes connect': "x \ closure S \ x \ closure T \ f' x = g' x" + assumes x_in: "x \ S \ T" + shows "((\x. if x \ S then f x else g x) has_derivative + (if x \ S then f' x else g' x)) (at x within (S \ T))" proof - - from f' x_in interpret f': bounded_linear "if x \ s then f' x else (\x. 0)" + from f' x_in interpret f': bounded_linear "if x \ S then f' x else (\x. 0)" by (auto simp add: has_derivative_within) - from g' interpret g': bounded_linear "if x \ t then g' x else (\x. 0)" + from g' interpret g': bounded_linear "if x \ T then g' x else (\x. 0)" by (auto simp add: has_derivative_within) - have bl: "bounded_linear (if x \ s then f' x else g' x)" + have bl: "bounded_linear (if x \ S then f' x else g' x)" using f'.scaleR f'.bounded f'.add g'.scaleR g'.bounded g'.add x_in by (unfold_locales; force) show ?thesis - using f' g' closure_subset[of t] closure_subset[of s] + using f' g' closure_subset[of T] closure_subset[of S] unfolding has_derivative_within_If_eq by (intro conjI bl tendsto_If_within_closures x_in) (auto simp: has_derivative_within inverse_eq_divide connect connect' set_mp) qed lemma has_vector_derivative_If_within_closures: - assumes x_in: "x \ s \ t" - assumes "u = s \ t" - assumes f': "x \ s \ (closure s \ closure t) \ - (f has_vector_derivative f' x) (at x within s \ (closure s \ closure t))" - assumes g': "x \ t \ (closure s \ closure t) \ - (g has_vector_derivative g' x) (at x within t \ (closure s \ closure t))" - assumes connect: "x \ closure s \ x \ closure t \ f x = g x" - assumes connect': "x \ closure s \ x \ closure t \ f' x = g' x" - shows "((\x. if x \ s then f x else g x) has_vector_derivative - (if x \ s then f' x else g' x)) (at x within u)" + assumes x_in: "x \ S \ T" + assumes "u = S \ T" + assumes f': "x \ S \ (closure S \ closure T) \ + (f has_vector_derivative f' x) (at x within S \ (closure S \ closure T))" + assumes g': "x \ T \ (closure S \ closure T) \ + (g has_vector_derivative g' x) (at x within T \ (closure S \ closure T))" + assumes connect: "x \ closure S \ x \ closure T \ f x = g x" + assumes connect': "x \ closure S \ x \ closure T \ f' x = g' x" + shows "((\x. if x \ S then f x else g x) has_vector_derivative + (if x \ S then f' x else g' x)) (at x within u)" unfolding has_vector_derivative_def assms using x_in apply (intro has_derivative_If_within_closures[where diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Henstock_Kurzweil_Integration.thy --- a/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Henstock_Kurzweil_Integration.thy Sun May 20 18:37:34 2018 +0100 @@ -5089,9 +5089,9 @@ using B' [of a b] B' [of c d] norm_triangle_half_r by blast qed qed (use \B > 0\ in auto)} - then show ?thesis - by force -qed + then show ?thesis + by force + qed finally show ?thesis . qed @@ -6496,7 +6496,7 @@ unfolding has_vector_derivative_def[symmetric] using that \x \ X0\ by (intro has_derivative_within_subset[OF fx]) auto - have "\x \ X0 \ U. onorm (blinfun_apply (fx x t) - (fx x0 t)) \ e" + have "\x. x \ X0 \ U \ onorm (blinfun_apply (fx x t) - (fx x0 t)) \ e" using fx_bound t by (auto simp add: norm_blinfun_def fun_diff_def blinfun.bilinear_simps[symmetric]) from differentiable_bound_linearization[OF seg deriv this] X0 diff -r 88dd06301dd3 -r 0764ee22a4d1 src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Sat May 19 20:42:34 2018 +0200 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Sun May 20 18:37:34 2018 +0100 @@ -250,8 +250,8 @@ lemma homeomorphic_closed_intervals_real: fixes a::real and b and c::real and d assumes "a