38 next assume ?r note this[unfolded has_derivative_def Lim_at] note as=conjunct2[OF this,rule_format] |
39 next assume ?r note this[unfolded has_derivative_def Lim_at] note as=conjunct2[OF this,rule_format] |
39 have *:"\<And>x xa f'. xa \<noteq> 0 \<Longrightarrow> \<bar>(f (xa + x) - f x) / xa - f'\<bar> = \<bar>(f (xa + x) - f x) - xa * f'\<bar> / \<bar>xa\<bar>" by(auto simp add:field_simps) |
40 have *:"\<And>x xa f'. xa \<noteq> 0 \<Longrightarrow> \<bar>(f (xa + x) - f x) / xa - f'\<bar> = \<bar>(f (xa + x) - f x) - xa * f'\<bar> / \<bar>xa\<bar>" by(auto simp add:field_simps) |
40 show ?l unfolding deriv_def LIM_def apply safe apply(drule as,safe) |
41 show ?l unfolding deriv_def LIM_def apply safe apply(drule as,safe) |
41 apply(rule_tac x=d in exI,safe) apply(erule_tac x="xa + x" in allE) |
42 apply(rule_tac x=d in exI,safe) apply(erule_tac x="xa + x" in allE) |
42 unfolding vector_dist_norm diff_0_right norm_scaleR |
43 unfolding vector_dist_norm diff_0_right norm_scaleR |
43 unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps *) qed |
44 unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:algebra_simps *) qed |
44 |
45 |
45 lemma FDERIV_conv_has_derivative:"FDERIV f (x::'a::{real_normed_vector,perfect_space}) :> f' = (f has_derivative f') (at x)" (is "?l = ?r") proof |
46 lemma FDERIV_conv_has_derivative:"FDERIV f (x::'a::{real_normed_vector,perfect_space}) :> f' = (f has_derivative f') (at x)" (is "?l = ?r") proof |
46 assume ?l note as = this[unfolded fderiv_def] |
47 assume ?l note as = this[unfolded fderiv_def] |
47 show ?r unfolding has_derivative_def Lim_at apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule) |
48 show ?r unfolding has_derivative_def Lim_at apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule) |
48 fix e::real assume "e>0" |
49 fix e::real assume "e>0" |
49 guess d using as[THEN conjunct2,unfolded LIM_def,rule_format,OF`e>0`] .. |
50 guess d using as[THEN conjunct2,unfolded LIM_def,rule_format,OF`e>0`] .. |
50 thus "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> |
51 thus "\<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> |
51 dist ((1 / norm (xa - netlimit (at x))) *\<^sub>R (f xa - (f (netlimit (at x)) + f' (xa - netlimit (at x))))) (0) < e" |
52 dist ((1 / norm (xa - netlimit (at x))) *\<^sub>R (f xa - (f (netlimit (at x)) + f' (xa - netlimit (at x))))) (0) < e" |
52 apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa - x" in allE) |
53 apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa - x" in allE) |
53 unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps) qed next |
54 unfolding vector_dist_norm netlimit_at[of x] by (auto simp add: diff_diff_eq) qed next |
54 assume ?r note as = this[unfolded has_derivative_def] |
55 assume ?r note as = this[unfolded has_derivative_def] |
55 show ?l unfolding fderiv_def LIM_def apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule) |
56 show ?l unfolding fderiv_def LIM_def apply-apply(rule,rule as[THEN conjunct1]) proof(rule,rule) |
56 fix e::real assume "e>0" |
57 fix e::real assume "e>0" |
57 guess d using as[THEN conjunct2,unfolded Lim_at,rule_format,OF`e>0`] .. |
58 guess d using as[THEN conjunct2,unfolded Lim_at,rule_format,OF`e>0`] .. |
58 thus "\<exists>s>0. \<forall>xa. xa \<noteq> 0 \<and> dist xa 0 < s \<longrightarrow> dist (norm (f (x + xa) - f x - f' xa) / norm xa) 0 < e" apply- |
59 thus "\<exists>s>0. \<forall>xa. xa \<noteq> 0 \<and> dist xa 0 < s \<longrightarrow> dist (norm (f (x + xa) - f x - f' xa) / norm xa) 0 < e" apply- |
59 apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa + x" in allE) |
60 apply(rule_tac x=d in exI) apply(erule conjE,rule,assumption) apply rule apply(erule_tac x="xa + x" in allE) |
60 unfolding vector_dist_norm netlimit_at[of x] by(auto simp add:group_simps) qed qed |
61 unfolding vector_dist_norm netlimit_at[of x] by (auto simp add: diff_diff_eq add.commute) qed qed |
61 |
62 |
62 subsection {* These are the only cases we'll care about, probably. *} |
63 subsection {* These are the only cases we'll care about, probably. *} |
63 |
64 |
64 lemma has_derivative_within: "(f has_derivative f') (at x within s) \<longleftrightarrow> |
65 lemma has_derivative_within: "(f has_derivative f') (at x within s) \<longleftrightarrow> |
65 bounded_linear f' \<and> ((\<lambda>y. (1 / norm(y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x within s)" |
66 bounded_linear f' \<and> ((\<lambda>y. (1 / norm(y - x)) *\<^sub>R (f y - (f x + f' (y - x)))) ---> 0) (at x within s)" |
74 lemma has_derivative_within': |
75 lemma has_derivative_within': |
75 "(f has_derivative f')(at x within s) \<longleftrightarrow> bounded_linear f' \<and> |
76 "(f has_derivative f')(at x within s) \<longleftrightarrow> bounded_linear f' \<and> |
76 (\<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. 0 < norm(x' - x) \<and> norm(x' - x) < d |
77 (\<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. 0 < norm(x' - x) \<and> norm(x' - x) < d |
77 \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)" |
78 \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)" |
78 unfolding has_derivative_within Lim_within vector_dist_norm |
79 unfolding has_derivative_within Lim_within vector_dist_norm |
79 unfolding diff_0_right norm_mul by(simp add: group_simps) |
80 unfolding diff_0_right norm_mul by (simp add: diff_diff_eq) |
80 |
81 |
81 lemma has_derivative_at': |
82 lemma has_derivative_at': |
82 "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and> |
83 "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and> |
83 (\<forall>e>0. \<exists>d>0. \<forall>x'. 0 < norm(x' - x) \<and> norm(x' - x) < d |
84 (\<forall>e>0. \<exists>d>0. \<forall>x'. 0 < norm(x' - x) \<and> norm(x' - x) < d |
84 \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)" |
85 \<longrightarrow> norm(f x' - f x - f'(x' - x)) / norm(x' - x) < e)" |
184 lemma has_derivative_add: assumes "(f has_derivative f') net" "(g has_derivative g') net" |
185 lemma has_derivative_add: assumes "(f has_derivative f') net" "(g has_derivative g') net" |
185 shows "((\<lambda>x. f(x) + g(x)) has_derivative (\<lambda>h. f'(h) + g'(h))) net" proof- |
186 shows "((\<lambda>x. f(x) + g(x)) has_derivative (\<lambda>h. f'(h) + g'(h))) net" proof- |
186 note as = assms[unfolded has_derivative_def] |
187 note as = assms[unfolded has_derivative_def] |
187 show ?thesis unfolding has_derivative_def apply(rule,rule bounded_linear_add) |
188 show ?thesis unfolding has_derivative_def apply(rule,rule bounded_linear_add) |
188 using Lim_add[OF as(1)[THEN conjunct2] as(2)[THEN conjunct2]] and as |
189 using Lim_add[OF as(1)[THEN conjunct2] as(2)[THEN conjunct2]] and as |
189 by(auto simp add:group_simps scaleR_right_diff_distrib scaleR_right_distrib) qed |
190 by (auto simp add:algebra_simps scaleR_right_diff_distrib scaleR_right_distrib) qed |
190 |
191 |
191 lemma has_derivative_add_const:"(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net" |
192 lemma has_derivative_add_const:"(f has_derivative f') net \<Longrightarrow> ((\<lambda>x. f x + c) has_derivative f') net" |
192 apply(drule has_derivative_add) apply(rule has_derivative_const) by auto |
193 apply(drule has_derivative_add) apply(rule has_derivative_const) by auto |
193 |
194 |
194 lemma has_derivative_sub: |
195 lemma has_derivative_sub: |
195 "(f has_derivative f') net \<Longrightarrow> (g has_derivative g') net \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) has_derivative (\<lambda>h. f'(h) - g'(h))) net" |
196 "(f has_derivative f') net \<Longrightarrow> (g has_derivative g') net \<Longrightarrow> ((\<lambda>x. f(x) - g(x)) has_derivative (\<lambda>h. f'(h) - g'(h))) net" |
196 apply(drule has_derivative_add) apply(drule has_derivative_neg,assumption) by(simp add:group_simps) |
197 apply(drule has_derivative_add) apply(drule has_derivative_neg,assumption) by(simp add:algebra_simps) |
197 |
198 |
198 lemma has_derivative_setsum: assumes "finite s" "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net" |
199 lemma has_derivative_setsum: assumes "finite s" "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net" |
199 shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net" |
200 shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net" |
200 apply(induct_tac s rule:finite_subset_induct[where A=s]) apply(rule assms(1)) |
201 apply(induct_tac s rule:finite_subset_induct[where A=s]) apply(rule assms(1)) |
201 proof- fix x F assume as:"finite F" "x \<notin> F" "x\<in>s" "((\<lambda>x. \<Sum>a\<in>F. f a x) has_derivative (\<lambda>h. \<Sum>a\<in>F. f' a h)) net" |
202 proof- fix x F assume as:"finite F" "x \<notin> F" "x\<in>s" "((\<lambda>x. \<Sum>a\<in>F. f a x) has_derivative (\<lambda>h. \<Sum>a\<in>F. f' a h)) net" |
389 show "norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)" proof(cases "y=x") |
390 show "norm (f y - f x - f' (y - x)) \<le> e * norm (y - x)" proof(cases "y=x") |
390 case True thus ?thesis using `bounded_linear f'` by(auto simp add: zero) next |
391 case True thus ?thesis using `bounded_linear f'` by(auto simp add: zero) next |
391 case False hence "norm (f y - (f x + f' (y - x))) < e * norm (y - x)" using as(4)[rule_format, OF `y\<in>s`] |
392 case False hence "norm (f y - (f x + f' (y - x))) < e * norm (y - x)" using as(4)[rule_format, OF `y\<in>s`] |
392 unfolding vector_dist_norm diff_0_right norm_mul using as(3) |
393 unfolding vector_dist_norm diff_0_right norm_mul using as(3) |
393 using pos_divide_less_eq[OF False[unfolded dist_nz], unfolded vector_dist_norm] |
394 using pos_divide_less_eq[OF False[unfolded dist_nz], unfolded vector_dist_norm] |
394 by(auto simp add:linear_0 linear_sub group_simps) |
395 by (auto simp add: linear_0 linear_sub) |
395 thus ?thesis by(auto simp add:group_simps) qed qed next |
396 thus ?thesis by(auto simp add:algebra_simps) qed qed next |
396 assume ?rhs thus ?lhs unfolding has_derivative_within Lim_within apply-apply(erule conjE,rule,assumption) |
397 assume ?rhs thus ?lhs unfolding has_derivative_within Lim_within apply-apply(erule conjE,rule,assumption) |
397 apply(rule,erule_tac x="e/2" in allE,rule,erule impE) defer apply(erule exE,rule_tac x=d in exI) |
398 apply(rule,erule_tac x="e/2" in allE,rule,erule impE) defer apply(erule exE,rule_tac x=d in exI) |
398 apply(erule conjE,rule,assumption,rule,rule) unfolding vector_dist_norm diff_0_right norm_scaleR |
399 apply(erule conjE,rule,assumption,rule,rule) unfolding vector_dist_norm diff_0_right norm_scaleR |
399 apply(erule_tac x=xa in ballE,erule impE) proof- |
400 apply(erule_tac x=xa in ballE,erule impE) proof- |
400 fix e d y assume "bounded_linear f'" "0 < e" "0 < d" "y \<in> s" "0 < norm (y - x) \<and> norm (y - x) < d" |
401 fix e d y assume "bounded_linear f'" "0 < e" "0 < d" "y \<in> s" "0 < norm (y - x) \<and> norm (y - x) < d" |
401 "norm (f y - f x - f' (y - x)) \<le> e / 2 * norm (y - x)" |
402 "norm (f y - f x - f' (y - x)) \<le> e / 2 * norm (y - x)" |
402 thus "\<bar>1 / norm (y - x)\<bar> * norm (f y - (f x + f' (y - x))) < e" |
403 thus "\<bar>1 / norm (y - x)\<bar> * norm (f y - (f x + f' (y - x))) < e" |
403 apply(rule_tac le_less_trans[of _ "e/2"]) by(auto intro!:mult_imp_div_pos_le simp add:group_simps) qed auto qed |
404 apply(rule_tac le_less_trans[of _ "e/2"]) by(auto intro!:mult_imp_div_pos_le simp add:algebra_simps) qed auto qed |
404 |
405 |
405 lemma has_derivative_at_alt: |
406 lemma has_derivative_at_alt: |
406 "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and> |
407 "(f has_derivative f') (at x) \<longleftrightarrow> bounded_linear f' \<and> |
407 (\<forall>e>0. \<exists>d>0. \<forall>y. norm(y - x) < d \<longrightarrow> norm(f y - f x - f'(y - x)) \<le> e * norm(y - x))" |
408 (\<forall>e>0. \<exists>d>0. \<forall>y. norm(y - x) < d \<longrightarrow> norm(f y - f x - f'(y - x)) \<le> e * norm(y - x))" |
408 using has_derivative_within_alt[where s=UNIV] unfolding within_UNIV by auto |
409 using has_derivative_within_alt[where s=UNIV] unfolding within_UNIV by auto |
433 proof(rule,rule `d>0`,rule,rule) |
434 proof(rule,rule `d>0`,rule,rule) |
434 fix y assume as:"y \<in> s" "norm (y - x) < d" |
435 fix y assume as:"y \<in> s" "norm (y - x) < d" |
435 hence 1:"norm (f y - f x - f' (y - x)) \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x))" using d1 d2 d by auto |
436 hence 1:"norm (f y - f x - f' (y - x)) \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x))" using d1 d2 d by auto |
436 |
437 |
437 have "norm (f y - f x) \<le> norm (f y - f x - f' (y - x)) + norm (f' (y - x))" |
438 have "norm (f y - f x) \<le> norm (f y - f x - f' (y - x)) + norm (f' (y - x))" |
438 using norm_triangle_sub[of "f y - f x" "f' (y - x)"] by(auto simp add:group_simps) |
439 using norm_triangle_sub[of "f y - f x" "f' (y - x)"] by(auto simp add:algebra_simps) |
439 also have "\<dots> \<le> norm (f y - f x - f' (y - x)) + B1 * norm (y - x)" apply(rule add_left_mono) using B1 by(auto simp add:group_simps) |
440 also have "\<dots> \<le> norm (f y - f x - f' (y - x)) + B1 * norm (y - x)" apply(rule add_left_mono) using B1 by(auto simp add:algebra_simps) |
440 also have "\<dots> \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x)) + B1 * norm (y - x)" apply(rule add_right_mono) using d1 d2 d as by auto |
441 also have "\<dots> \<le> min (norm (y - x)) (e / 2 / B2 * norm (y - x)) + B1 * norm (y - x)" apply(rule add_right_mono) using d1 d2 d as by auto |
441 also have "\<dots> \<le> norm (y - x) + B1 * norm (y - x)" by auto |
442 also have "\<dots> \<le> norm (y - x) + B1 * norm (y - x)" by auto |
442 also have "\<dots> = norm (y - x) * (1 + B1)" by(auto simp add:field_simps) |
443 also have "\<dots> = norm (y - x) * (1 + B1)" by(auto simp add:field_simps) |
443 finally have 3:"norm (f y - f x) \<le> norm (y - x) * (1 + B1)" by auto |
444 finally have 3:"norm (f y - f x) \<le> norm (y - x) * (1 + B1)" by auto |
444 |
445 |
451 finally have 4:"norm (g (f y) - g (f x) - g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto |
452 finally have 4:"norm (g (f y) - g (f x) - g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto |
452 |
453 |
453 interpret g': bounded_linear g' using assms(2) by auto |
454 interpret g': bounded_linear g' using assms(2) by auto |
454 interpret f': bounded_linear f' using assms(1) by auto |
455 interpret f': bounded_linear f' using assms(1) by auto |
455 have "norm (- g' (f' (y - x)) + g' (f y - f x)) = norm (g' (f y - f x - f' (y - x)))" |
456 have "norm (- g' (f' (y - x)) + g' (f y - f x)) = norm (g' (f y - f x - f' (y - x)))" |
456 by(auto simp add:group_simps f'.diff g'.diff g'.add) |
457 by(auto simp add:algebra_simps f'.diff g'.diff g'.add) |
457 also have "\<dots> \<le> B2 * norm (f y - f x - f' (y - x))" using B2 by(auto simp add:group_simps) |
458 also have "\<dots> \<le> B2 * norm (f y - f x - f' (y - x))" using B2 by(auto simp add:algebra_simps) |
458 also have "\<dots> \<le> B2 * (e / 2 / B2 * norm (y - x))" apply(rule mult_left_mono) using as d1 d2 d B2 by auto |
459 also have "\<dots> \<le> B2 * (e / 2 / B2 * norm (y - x))" apply(rule mult_left_mono) using as d1 d2 d B2 by auto |
459 also have "\<dots> \<le> e / 2 * norm (y - x)" using B2 by auto |
460 also have "\<dots> \<le> e / 2 * norm (y - x)" using B2 by auto |
460 finally have 5:"norm (- g' (f' (y - x)) + g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto |
461 finally have 5:"norm (- g' (f' (y - x)) + g' (f y - f x)) \<le> e / 2 * norm (y - x)" by auto |
461 |
462 |
462 have "norm (g (f y) - g (f x) - g' (f y - f x)) + norm (g (f y) - g (f x) - g' (f' (y - x)) - (g (f y) - g (f x) - g' (f y - f x))) \<le> e * norm (y - x)" using 5 4 by auto |
463 have "norm (g (f y) - g (f x) - g' (f y - f x)) + norm (g (f y) - g (f x) - g' (f' (y - x)) - (g (f y) - g (f x) - g' (f y - f x))) \<le> e * norm (y - x)" using 5 4 by auto |
533 guess c using assms(3)[rule_format,OF d[THEN conjunct1],of i] .. note c=this |
534 guess c using assms(3)[rule_format,OF d[THEN conjunct1],of i] .. note c=this |
534 have *:"norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R basis i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R basis i)) = norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R basis i)) + f'' (c *\<^sub>R basis i)))" |
535 have *:"norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R basis i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R basis i)) = norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R basis i)) + f'' (c *\<^sub>R basis i)))" |
535 unfolding scaleR_right_distrib by auto |
536 unfolding scaleR_right_distrib by auto |
536 also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' (basis i)) + f'' (basis i))))" |
537 also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' (basis i)) + f'' (basis i))))" |
537 unfolding f'.scaleR f''.scaleR unfolding scaleR_right_distrib scaleR_minus_right by auto |
538 unfolding f'.scaleR f''.scaleR unfolding scaleR_right_distrib scaleR_minus_right by auto |
538 also have "\<dots> = e" unfolding e_def norm_mul using c[THEN conjunct1] using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"] by(auto simp add:group_simps) |
539 also have "\<dots> = e" unfolding e_def norm_mul using c[THEN conjunct1] using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"] by (auto simp add: add.commute ab_diff_minus) |
539 finally show False using c using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R basis i"] using norm_basis[of i] unfolding vector_dist_norm |
540 finally show False using c using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R basis i"] using norm_basis[of i] unfolding vector_dist_norm |
540 unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib by auto qed qed |
541 unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib by auto qed qed |
541 |
542 |
542 lemma frechet_derivative_unique_at: fixes f::"real^'a \<Rightarrow> real^'b" |
543 lemma frechet_derivative_unique_at: fixes f::"real^'a \<Rightarrow> real^'b" |
543 shows "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f'') (at x) \<Longrightarrow> f' = f''" |
544 shows "(f has_derivative f') (at x) \<Longrightarrow> (f has_derivative f'') (at x) \<Longrightarrow> f' = f''" |
621 hence **:"((f (x - d *\<^sub>R basis j))$k \<le> (f x)$k \<and> (f (x + d *\<^sub>R basis j))$k \<le> (f x)$k) \<or> |
622 hence **:"((f (x - d *\<^sub>R basis j))$k \<le> (f x)$k \<and> (f (x + d *\<^sub>R basis j))$k \<le> (f x)$k) \<or> |
622 ((f (x - d *\<^sub>R basis j))$k \<ge> (f x)$k \<and> (f (x + d *\<^sub>R basis j))$k \<ge> (f x)$k)" using assms(2) by auto |
623 ((f (x - d *\<^sub>R basis j))$k \<ge> (f x)$k \<and> (f (x + d *\<^sub>R basis j))$k \<ge> (f x)$k)" using assms(2) by auto |
623 have ***:"\<And>y y1 y2 d dx::real. (y1\<le>y\<and>y2\<le>y) \<or> (y\<le>y1\<and>y\<le>y2) \<Longrightarrow> d < abs dx \<Longrightarrow> abs(y1 - y - - dx) \<le> d \<Longrightarrow> (abs (y2 - y - dx) \<le> d) \<Longrightarrow> False" by arith |
624 have ***:"\<And>y y1 y2 d dx::real. (y1\<le>y\<and>y2\<le>y) \<or> (y\<le>y1\<and>y\<le>y2) \<Longrightarrow> d < abs dx \<Longrightarrow> abs(y1 - y - - dx) \<le> d \<Longrightarrow> (abs (y2 - y - dx) \<le> d) \<Longrightarrow> False" by arith |
624 show False apply(rule ***[OF **, where dx="d * D $ k $ j" and d="\<bar>D $ k $ j\<bar> / 2 * \<bar>d\<bar>"]) |
625 show False apply(rule ***[OF **, where dx="d * D $ k $ j" and d="\<bar>D $ k $ j\<bar> / 2 * \<bar>d\<bar>"]) |
625 using *[of "-d"] and *[of d] and d[THEN conjunct1] and j unfolding mult_minus_left |
626 using *[of "-d"] and *[of d] and d[THEN conjunct1] and j unfolding mult_minus_left |
626 unfolding abs_mult diff_minus_eq_add scaleR.minus_left unfolding group_simps by (auto intro: mult_pos_pos) |
627 unfolding abs_mult diff_minus_eq_add scaleR.minus_left unfolding algebra_simps by (auto intro: mult_pos_pos) |
627 qed |
628 qed |
628 |
629 |
629 subsection {* In particular if we have a mapping into @{typ "real^1"}. *} |
630 subsection {* In particular if we have a mapping into @{typ "real^1"}. *} |
630 |
631 |
631 lemma differential_zero_maxmin: fixes f::"real^'a \<Rightarrow> real" |
632 lemma differential_zero_maxmin: fixes f::"real^'a \<Rightarrow> real" |
725 lemma differentiable_bound: fixes f::"real^'a \<Rightarrow> real^'b" |
726 lemma differentiable_bound: fixes f::"real^'a \<Rightarrow> real^'b" |
726 assumes "convex s" "\<forall>x\<in>s. (f has_derivative f'(x)) (at x within s)" "\<forall>x\<in>s. onorm(f' x) \<le> B" and x:"x\<in>s" and y:"y\<in>s" |
727 assumes "convex s" "\<forall>x\<in>s. (f has_derivative f'(x)) (at x within s)" "\<forall>x\<in>s. onorm(f' x) \<le> B" and x:"x\<in>s" and y:"y\<in>s" |
727 shows "norm(f x - f y) \<le> B * norm(x - y)" proof- |
728 shows "norm(f x - f y) \<le> B * norm(x - y)" proof- |
728 let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)" |
729 let ?p = "\<lambda>u. x + u *\<^sub>R (y - x)" |
729 have *:"\<And>u. u\<in>{0..1} \<Longrightarrow> x + u *\<^sub>R (y - x) \<in> s" |
730 have *:"\<And>u. u\<in>{0..1} \<Longrightarrow> x + u *\<^sub>R (y - x) \<in> s" |
730 using assms(1)[unfolded convex_alt,rule_format,OF x y] unfolding scaleR_left_diff_distrib scaleR_right_diff_distrib by(auto simp add:group_simps) |
731 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) |
731 hence 1:"continuous_on {0..1} (f \<circ> ?p)" apply- apply(rule continuous_on_intros continuous_on_vmul)+ |
732 hence 1:"continuous_on {0..1} (f \<circ> ?p)" apply- apply(rule continuous_on_intros continuous_on_vmul)+ |
732 unfolding continuous_on_eq_continuous_within apply(rule,rule differentiable_imp_continuous_within) |
733 unfolding continuous_on_eq_continuous_within apply(rule,rule differentiable_imp_continuous_within) |
733 unfolding differentiable_def apply(rule_tac x="f' xa" in exI) |
734 unfolding differentiable_def apply(rule_tac x="f' xa" in exI) |
734 apply(rule has_derivative_within_subset) apply(rule assms(2)[rule_format]) by auto |
735 apply(rule has_derivative_within_subset) apply(rule assms(2)[rule_format]) by auto |
735 have 2:"\<forall>u\<in>{0<..<1}. ((f \<circ> ?p) has_derivative f' (x + u *\<^sub>R (y - x)) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u)" proof rule case goal1 |
736 have 2:"\<forall>u\<in>{0<..<1}. ((f \<circ> ?p) has_derivative f' (x + u *\<^sub>R (y - x)) \<circ> (\<lambda>u. 0 + u *\<^sub>R (y - x))) (at u)" proof rule case goal1 |
860 |
861 |
861 lemma brouwer_surjective: fixes f::"real^'n \<Rightarrow> real^'n" |
862 lemma brouwer_surjective: fixes f::"real^'n \<Rightarrow> real^'n" |
862 assumes "compact t" "convex t" "t \<noteq> {}" "continuous_on t f" |
863 assumes "compact t" "convex t" "t \<noteq> {}" "continuous_on t f" |
863 "\<forall>x\<in>s. \<forall>y\<in>t. x + (y - f y) \<in> t" "x\<in>s" |
864 "\<forall>x\<in>s. \<forall>y\<in>t. x + (y - f y) \<in> t" "x\<in>s" |
864 shows "\<exists>y\<in>t. f y = x" proof- |
865 shows "\<exists>y\<in>t. f y = x" proof- |
865 have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y" by(auto simp add:group_simps) |
866 have *:"\<And>x y. f y = x \<longleftrightarrow> x + (y - f y) = y" by(auto simp add:algebra_simps) |
866 show ?thesis unfolding * apply(rule brouwer[OF assms(1-3), of "\<lambda>y. x + (y - f y)"]) |
867 show ?thesis unfolding * apply(rule brouwer[OF assms(1-3), of "\<lambda>y. x + (y - f y)"]) |
867 apply(rule continuous_on_intros assms)+ using assms(4-6) by auto qed |
868 apply(rule continuous_on_intros assms)+ using assms(4-6) by auto qed |
868 |
869 |
869 lemma brouwer_surjective_cball: fixes f::"real^'n \<Rightarrow> real^'n" |
870 lemma brouwer_surjective_cball: fixes f::"real^'n \<Rightarrow> real^'n" |
870 assumes "0 < e" "continuous_on (cball a e) f" |
871 assumes "0 < e" "continuous_on (cball a e) f" |
905 also have "\<dots> \<le> e * B" apply(rule mult_right_mono) using as(2)[unfolded mem_cball vector_dist_norm] and B unfolding norm_minus_commute by auto |
906 also have "\<dots> \<le> e * B" apply(rule mult_right_mono) using as(2)[unfolded mem_cball vector_dist_norm] and B unfolding norm_minus_commute by auto |
906 also have "\<dots> < e0" using e and B unfolding less_divide_eq by auto |
907 also have "\<dots> < e0" using e and B unfolding less_divide_eq by auto |
907 finally have *:"norm (x + g' (z - f x) - x) < e0" by auto |
908 finally have *:"norm (x + g' (z - f x) - x) < e0" by auto |
908 have **:"f x + f' (x + g' (z - f x) - x) = z" using assms(6)[unfolded o_def id_def,THEN cong] by auto |
909 have **:"f x + f' (x + g' (z - f x) - x) = z" using assms(6)[unfolded o_def id_def,THEN cong] by auto |
909 have "norm (f x - (y + (z - f (x + g' (z - f x))))) \<le> norm (f (x + g' (z - f x)) - z) + norm (f x - y)" |
910 have "norm (f x - (y + (z - f (x + g' (z - f x))))) \<le> norm (f (x + g' (z - f x)) - z) + norm (f x - y)" |
910 using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"] by(auto simp add:group_simps) |
911 using norm_triangle_ineq[of "f (x + g'(z - f x)) - z" "f x - y"] by(auto simp add:algebra_simps) |
911 also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)" using e0[THEN conjunct2,rule_format,OF *] unfolding group_simps ** by auto |
912 also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + norm (f x - y)" using e0[THEN conjunct2,rule_format,OF *] unfolding algebra_simps ** by auto |
912 also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + e/2" using as(1)[unfolded mem_cball vector_dist_norm] by auto |
913 also have "\<dots> \<le> 1 / (B * 2) * norm (g' (z - f x)) + e/2" using as(1)[unfolded mem_cball vector_dist_norm] by auto |
913 also have "\<dots> \<le> 1 / (B * 2) * B * norm (z - f x) + e/2" using * and B by(auto simp add:field_simps) |
914 also have "\<dots> \<le> 1 / (B * 2) * B * norm (z - f x) + e/2" using * and B by(auto simp add:field_simps) |
914 also have "\<dots> \<le> 1 / 2 * norm (z - f x) + e/2" by auto |
915 also have "\<dots> \<le> 1 / 2 * norm (z - f x) + e/2" by auto |
915 also have "\<dots> \<le> e/2 + e/2" apply(rule add_right_mono) using as(2)[unfolded mem_cball vector_dist_norm] unfolding norm_minus_commute by auto |
916 also have "\<dots> \<le> e/2 + e/2" apply(rule add_right_mono) using as(2)[unfolded mem_cball vector_dist_norm] unfolding norm_minus_commute by auto |
916 finally show "y + (z - f (x + g' (z - f x))) \<in> cball (f x) e" unfolding mem_cball vector_dist_norm by auto |
917 finally show "y + (z - f (x + g' (z - f x))) \<in> cball (f x) e" unfolding mem_cball vector_dist_norm by auto |
981 (* It's only for this we need continuity of the derivative, except of course *) |
982 (* It's only for this we need continuity of the derivative, except of course *) |
982 (* if we want the fact that the inverse derivative is also continuous. So if *) |
983 (* if we want the fact that the inverse derivative is also continuous. So if *) |
983 (* we know for some other reason that the inverse function exists, it's OK. *} |
984 (* we know for some other reason that the inverse function exists, it's OK. *} |
984 |
985 |
985 lemma bounded_linear_sub: "bounded_linear f \<Longrightarrow> bounded_linear g ==> bounded_linear (\<lambda>x. f x - g x)" |
986 lemma bounded_linear_sub: "bounded_linear f \<Longrightarrow> bounded_linear g ==> bounded_linear (\<lambda>x. f x - g x)" |
986 using bounded_linear_add[of f "\<lambda>x. - g x"] bounded_linear_minus[of g] by(auto simp add:group_simps) |
987 using bounded_linear_add[of f "\<lambda>x. - g x"] bounded_linear_minus[of g] by(auto simp add:algebra_simps) |
987 |
988 |
988 lemma has_derivative_locally_injective: fixes f::"real^'n \<Rightarrow> real^'m" |
989 lemma has_derivative_locally_injective: fixes f::"real^'n \<Rightarrow> real^'m" |
989 assumes "a \<in> s" "open s" "bounded_linear g'" "g' o f'(a) = id" |
990 assumes "a \<in> s" "open s" "bounded_linear g'" "g' o f'(a) = id" |
990 "\<forall>x\<in>s. (f has_derivative f'(x)) (at x)" |
991 "\<forall>x\<in>s. (f has_derivative f'(x)) (at x)" |
991 "\<forall>e>0. \<exists>d>0. \<forall>x. dist a x < d \<longrightarrow> onorm(\<lambda>v. f' x v - f' a v) < e" |
992 "\<forall>e>0. \<exists>d>0. \<forall>x. dist a x < d \<longrightarrow> onorm(\<lambda>v. f' x v - f' a v) < e" |
1002 guess d using real_lbound_gt_zero[OF d1[THEN conjunct1] d2[THEN conjunct1]] .. note d = this |
1003 guess d using real_lbound_gt_zero[OF d1[THEN conjunct1] d2[THEN conjunct1]] .. note d = this |
1003 show ?thesis proof show "a\<in>ball a d" using d by auto |
1004 show ?thesis proof show "a\<in>ball a d" using d by auto |
1004 show "\<forall>x\<in>ball a d. \<forall>x'\<in>ball a d. f x' = f x \<longrightarrow> x' = x" proof(intro strip) |
1005 show "\<forall>x\<in>ball a d. \<forall>x'\<in>ball a d. f x' = f x \<longrightarrow> x' = x" proof(intro strip) |
1005 fix x y assume as:"x\<in>ball a d" "y\<in>ball a d" "f x = f y" |
1006 fix x y assume as:"x\<in>ball a d" "y\<in>ball a d" "f x = f y" |
1006 def ph \<equiv> "\<lambda>w. w - g'(f w - f x)" have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))" |
1007 def ph \<equiv> "\<lambda>w. w - g'(f w - f x)" have ph':"ph = g' \<circ> (\<lambda>w. f' a w - (f w - f x))" |
1007 unfolding ph_def o_def unfolding diff using f'g' by(auto simp add:group_simps) |
1008 unfolding ph_def o_def unfolding diff using f'g' by(auto simp add:algebra_simps) |
1008 have "norm (ph x - ph y) \<le> (1/2) * norm (x - y)" |
1009 have "norm (ph x - ph y) \<le> (1/2) * norm (x - y)" |
1009 apply(rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\<lambda>x v. v - g'(f' x v)"]) |
1010 apply(rule differentiable_bound[OF convex_ball _ _ as(1-2), where f'="\<lambda>x v. v - g'(f' x v)"]) |
1010 apply(rule_tac[!] ballI) proof- fix u assume u:"u \<in> ball a d" hence "u\<in>s" using d d2 by auto |
1011 apply(rule_tac[!] ballI) proof- fix u assume u:"u \<in> ball a d" hence "u\<in>s" using d d2 by auto |
1011 have *:"(\<lambda>v. v - g' (f' u v)) = g' \<circ> (\<lambda>w. f' a w - f' u w)" unfolding o_def and diff using f'g' by auto |
1012 have *:"(\<lambda>v. v - g' (f' u v)) = g' \<circ> (\<lambda>w. f' a w - f' u w)" unfolding o_def and diff using f'g' by auto |
1012 show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)" |
1013 show "(ph has_derivative (\<lambda>v. v - g' (f' u v))) (at u within ball a d)" |
1018 apply(rule_tac[!] derivative_linear) using assms(5) `u\<in>s` `a\<in>s` by auto |
1019 apply(rule_tac[!] derivative_linear) using assms(5) `u\<in>s` `a\<in>s` by auto |
1019 have "onorm (\<lambda>v. v - g' (f' u v)) \<le> onorm g' * onorm (\<lambda>w. f' a w - f' u w)" unfolding * apply(rule onorm_compose) |
1020 have "onorm (\<lambda>v. v - g' (f' u v)) \<le> onorm g' * onorm (\<lambda>w. f' a w - f' u w)" unfolding * apply(rule onorm_compose) |
1020 unfolding linear_conv_bounded_linear by(rule assms(3) **)+ |
1021 unfolding linear_conv_bounded_linear by(rule assms(3) **)+ |
1021 also have "\<dots> \<le> onorm g' * k" apply(rule mult_left_mono) |
1022 also have "\<dots> \<le> onorm g' * k" apply(rule mult_left_mono) |
1022 using d1[THEN conjunct2,rule_format,of u] using onorm_neg[OF **(1)[unfolded linear_linear]] |
1023 using d1[THEN conjunct2,rule_format,of u] using onorm_neg[OF **(1)[unfolded linear_linear]] |
1023 using d and u and onorm_pos_le[OF assms(3)[unfolded linear_linear]] by(auto simp add:group_simps) |
1024 using d and u and onorm_pos_le[OF assms(3)[unfolded linear_linear]] by(auto simp add:algebra_simps) |
1024 also have "\<dots> \<le> 1/2" unfolding k_def by auto |
1025 also have "\<dots> \<le> 1/2" unfolding k_def by auto |
1025 finally show "onorm (\<lambda>v. v - g' (f' u v)) \<le> 1 / 2" by assumption qed |
1026 finally show "onorm (\<lambda>v. v - g' (f' u v)) \<le> 1 / 2" by assumption qed |
1026 moreover have "norm (ph y - ph x) = norm (y - x)" apply(rule arg_cong[where f=norm]) |
1027 moreover have "norm (ph y - ph x) = norm (y - x)" apply(rule arg_cong[where f=norm]) |
1027 unfolding ph_def using diff unfolding as by auto |
1028 unfolding ph_def using diff unfolding as by auto |
1028 ultimately show "x = y" unfolding norm_minus_commute by auto qed qed auto qed |
1029 ultimately show "x = y" unfolding norm_minus_commute by auto qed qed auto qed |
1037 show "norm((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm(x - y)" |
1038 show "norm((f m x - f n x) - (f m y - f n y)) \<le> 2 * e * norm(x - y)" |
1038 apply(rule differentiable_bound[where f'="\<lambda>x h. f' m x h - f' n x h", OF assms(1) _ _ as(3-4)]) apply(rule_tac[!] ballI) proof- |
1039 apply(rule differentiable_bound[where f'="\<lambda>x h. f' m x h - f' n x h", OF assms(1) _ _ as(3-4)]) apply(rule_tac[!] ballI) proof- |
1039 fix x assume "x\<in>s" show "((\<lambda>a. f m a - f n a) has_derivative (\<lambda>h. f' m x h - f' n x h)) (at x within s)" |
1040 fix x assume "x\<in>s" show "((\<lambda>a. f m a - f n a) has_derivative (\<lambda>h. f' m x h - f' n x h)) (at x within s)" |
1040 by(rule has_derivative_intros assms(2)[rule_format] `x\<in>s`)+ |
1041 by(rule has_derivative_intros assms(2)[rule_format] `x\<in>s`)+ |
1041 { fix h have "norm (f' m x h - f' n x h) \<le> norm (f' m x h - g' x h) + norm (f' n x h - g' x h)" |
1042 { fix h have "norm (f' m x h - f' n x h) \<le> norm (f' m x h - g' x h) + norm (f' n x h - g' x h)" |
1042 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:group_simps) |
1043 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) |
1043 also have "\<dots> \<le> e * norm h+ e * norm h" using assms(3)[rule_format,OF `N\<le>m` `x\<in>s`, of h] assms(3)[rule_format,OF `N\<le>n` `x\<in>s`, of h] |
1044 also have "\<dots> \<le> e * norm h+ e * norm h" using assms(3)[rule_format,OF `N\<le>m` `x\<in>s`, of h] assms(3)[rule_format,OF `N\<le>n` `x\<in>s`, of h] |
1044 by(auto simp add:field_simps) |
1045 by(auto simp add:field_simps) |
1045 finally have "norm (f' m x h - f' n x h) \<le> 2 * e * norm h" by auto } |
1046 finally have "norm (f' m x h - f' n x h) \<le> 2 * e * norm h" by auto } |
1046 thus "onorm (\<lambda>h. f' m x h - f' n x h) \<le> 2 * e" apply-apply(rule onorm(2)) apply(rule linear_compose_sub) |
1047 thus "onorm (\<lambda>h. f' m x h - f' n x h) \<le> 2 * e" apply-apply(rule onorm(2)) apply(rule linear_compose_sub) |
1047 unfolding linear_conv_bounded_linear using assms(2)[rule_format,OF `x\<in>s`, THEN derivative_linear] by auto qed qed |
1048 unfolding linear_conv_bounded_linear using assms(2)[rule_format,OF `x\<in>s`, THEN derivative_linear] by auto qed qed |
1081 show "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s. norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)" apply(rule_tac x=N in exI) proof(default+) |
1082 show "\<exists>N. \<forall>n\<ge>N. \<forall>x\<in>s. \<forall>y\<in>s. norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)" apply(rule_tac x=N in exI) proof(default+) |
1082 fix n x y assume as:"N \<le> n" "x \<in> s" "y \<in> s" |
1083 fix n x y assume as:"N \<le> n" "x \<in> s" "y \<in> s" |
1083 have "eventually (\<lambda>xa. norm (f n x - f n y - (f xa x - f xa y)) \<le> e * norm (x - y)) sequentially" |
1084 have "eventually (\<lambda>xa. norm (f n x - f n y - (f xa x - f xa y)) \<le> e * norm (x - y)) sequentially" |
1084 unfolding eventually_sequentially apply(rule_tac x=N in exI) proof(rule,rule) |
1085 unfolding eventually_sequentially apply(rule_tac x=N in exI) proof(rule,rule) |
1085 fix m assume "N\<le>m" thus "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)" |
1086 fix m assume "N\<le>m" thus "norm (f n x - f n y - (f m x - f m y)) \<le> e * norm (x - y)" |
1086 using N[rule_format, of n m x y] and as by(auto simp add:group_simps) qed |
1087 using N[rule_format, of n m x y] and as by(auto simp add:algebra_simps) qed |
1087 thus "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)" apply- |
1088 thus "norm (f n x - f n y - (g x - g y)) \<le> e * norm (x - y)" apply- |
1088 apply(rule Lim_norm_ubound[OF trivial_limit_sequentially, where f="\<lambda>m. (f n x - f n y) - (f m x - f m y)"]) |
1089 apply(rule Lim_norm_ubound[OF trivial_limit_sequentially, where f="\<lambda>m. (f n x - f n y) - (f m x - f m y)"]) |
1089 apply(rule Lim_sub Lim_const g[rule_format] as)+ by assumption qed qed |
1090 apply(rule Lim_sub Lim_const g[rule_format] as)+ by assumption qed qed |
1090 show ?thesis unfolding has_derivative_within_alt apply(rule_tac x=g in exI) |
1091 show ?thesis unfolding has_derivative_within_alt apply(rule_tac x=g in exI) |
1091 apply(rule,rule,rule g[rule_format],assumption) proof fix x assume "x\<in>s" |
1092 apply(rule,rule,rule g[rule_format],assumption) proof fix x assume "x\<in>s" |
1118 have "norm (g y - g x - (f ?N y - f ?N x)) \<le> e /3 * norm (y - x)" apply(subst norm_minus_cancel[THEN sym]) |
1119 have "norm (g y - g x - (f ?N y - f ?N x)) \<le> e /3 * norm (y - x)" apply(subst norm_minus_cancel[THEN sym]) |
1119 using N2[rule_format, OF _ `y\<in>s` `x\<in>s`, of ?N] by auto moreover |
1120 using N2[rule_format, OF _ `y\<in>s` `x\<in>s`, of ?N] by auto moreover |
1120 have "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)" using d1 and as by auto ultimately |
1121 have "norm (f ?N y - f ?N x - f' ?N x (y - x)) \<le> e / 3 * norm (y - x)" using d1 and as by auto ultimately |
1121 have "norm (g y - g x - f' ?N x (y - x)) \<le> 2 * e / 3 * norm (y - x)" |
1122 have "norm (g y - g x - f' ?N x (y - x)) \<le> 2 * e / 3 * norm (y - x)" |
1122 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)"] |
1123 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)"] |
1123 by (auto simp add:group_simps) moreover |
1124 by (auto simp add:algebra_simps) moreover |
1124 have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)" using N1 `x\<in>s` by auto |
1125 have " norm (f' ?N x (y - x) - g' x (y - x)) \<le> e / 3 * norm (y - x)" using N1 `x\<in>s` by auto |
1125 ultimately show "norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)" |
1126 ultimately show "norm (g y - g x - g' x (y - x)) \<le> e * norm (y - x)" |
1126 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:group_simps) |
1127 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) |
1127 qed qed qed qed |
1128 qed qed qed qed |
1128 |
1129 |
1129 subsection {* Can choose to line up antiderivatives if we want. *} |
1130 subsection {* Can choose to line up antiderivatives if we want. *} |
1130 |
1131 |
1131 lemma has_antiderivative_sequence: fixes f::"nat\<Rightarrow> real^'m \<Rightarrow> real^'n" |
1132 lemma has_antiderivative_sequence: fixes f::"nat\<Rightarrow> real^'m \<Rightarrow> real^'n" |
1272 |
1273 |
1273 lemma has_vector_derivative_id: "((\<lambda>x::real. x) has_vector_derivative 1) net" |
1274 lemma has_vector_derivative_id: "((\<lambda>x::real. x) has_vector_derivative 1) net" |
1274 unfolding has_vector_derivative_def using has_derivative_id by auto |
1275 unfolding has_vector_derivative_def using has_derivative_id by auto |
1275 |
1276 |
1276 lemma has_vector_derivative_cmul: "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net" |
1277 lemma has_vector_derivative_cmul: "(f has_vector_derivative f') net \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net" |
1277 unfolding has_vector_derivative_def apply(drule has_derivative_cmul) by(auto simp add:group_simps) |
1278 unfolding has_vector_derivative_def apply(drule has_derivative_cmul) by(auto simp add:algebra_simps) |
1278 |
1279 |
1279 lemma has_vector_derivative_cmul_eq: assumes "c \<noteq> 0" |
1280 lemma has_vector_derivative_cmul_eq: assumes "c \<noteq> 0" |
1280 shows "(((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net \<longleftrightarrow> (f has_vector_derivative f') net)" |
1281 shows "(((\<lambda>x. c *\<^sub>R f x) has_vector_derivative (c *\<^sub>R f')) net \<longleftrightarrow> (f has_vector_derivative f') net)" |
1281 apply rule apply(drule has_vector_derivative_cmul[where c="1/c"]) defer |
1282 apply rule apply(drule has_vector_derivative_cmul[where c="1/c"]) defer |
1282 apply(rule has_vector_derivative_cmul) using assms by auto |
1283 apply(rule has_vector_derivative_cmul) using assms by auto |