189 assumes "finite s" and "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net" |
186 assumes "finite s" and "\<forall>a\<in>s. ((f a) has_derivative (f' a)) net" |
190 shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net" |
187 shows "((\<lambda>x. setsum (\<lambda>a. f a x) s) has_derivative (\<lambda>h. setsum (\<lambda>a. f' a h) s)) net" |
191 using assms by (induct, simp_all add: has_derivative_const has_derivative_add) |
188 using assms by (induct, simp_all add: has_derivative_const has_derivative_add) |
192 text {* Somewhat different results for derivative of scalar multiplier. *} |
189 text {* Somewhat different results for derivative of scalar multiplier. *} |
193 |
190 |
194 (** move **) |
|
195 lemma linear_vmul_component: (* TODO: delete *) |
|
196 assumes lf: "linear f" |
|
197 shows "linear (\<lambda>x. f x $$ k *\<^sub>R v)" |
|
198 using lf |
|
199 by (auto simp add: linear_def algebra_simps) |
|
200 |
|
201 lemmas has_derivative_intros = |
191 lemmas has_derivative_intros = |
202 has_derivative_id has_derivative_const |
192 has_derivative_id has_derivative_const |
203 has_derivative_add has_derivative_sub has_derivative_neg |
193 has_derivative_add has_derivative_sub has_derivative_neg |
204 has_derivative_add_const |
194 has_derivative_add_const |
205 scaleR_left_has_derivative scaleR_right_has_derivative |
195 scaleR_left_has_derivative scaleR_right_has_derivative |
206 inner_left_has_derivative inner_right_has_derivative |
196 inner_left_has_derivative inner_right_has_derivative |
207 euclidean_component_has_derivative |
|
208 |
197 |
209 subsubsection {* Limit transformation for derivatives *} |
198 subsubsection {* Limit transformation for derivatives *} |
210 |
199 |
211 lemma has_derivative_transform_within: |
200 lemma has_derivative_transform_within: |
212 assumes "0 < d" "x \<in> s" "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'" "(f has_derivative f') (at x within s)" |
201 assumes "0 < d" "x \<in> s" "\<forall>x'\<in>s. dist x' x < d \<longrightarrow> f x' = g x'" "(f has_derivative f') (at x within s)" |
529 |
518 |
530 lemma frechet_derivative_unique_within: |
519 lemma frechet_derivative_unique_within: |
531 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
520 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::real_normed_vector" |
532 assumes "(f has_derivative f') (at x within s)" |
521 assumes "(f has_derivative f') (at x within s)" |
533 assumes "(f has_derivative f'') (at x within s)" |
522 assumes "(f has_derivative f'') (at x within s)" |
534 assumes "(\<forall>i<DIM('a). \<forall>e>0. \<exists>d. 0 < abs(d) \<and> abs(d) < e \<and> (x + d *\<^sub>R basis i) \<in> s)" |
523 assumes "(\<forall>i\<in>Basis. \<forall>e>0. \<exists>d. 0 < abs(d) \<and> abs(d) < e \<and> (x + d *\<^sub>R i) \<in> s)" |
535 shows "f' = f''" |
524 shows "f' = f''" |
536 proof- |
525 proof- |
537 note as = assms(1,2)[unfolded has_derivative_def] |
526 note as = assms(1,2)[unfolded has_derivative_def] |
538 then interpret f': bounded_linear f' by auto |
527 then interpret f': bounded_linear f' by auto |
539 from as interpret f'': bounded_linear f'' by auto |
528 from as interpret f'': bounded_linear f'' by auto |
540 have "x islimpt s" unfolding islimpt_approachable |
529 have "x islimpt s" unfolding islimpt_approachable |
541 proof(rule,rule) |
530 proof(rule,rule) |
542 fix e::real assume "0<e" guess d |
531 fix e::real assume "0<e" guess d |
543 using assms(3)[rule_format,OF DIM_positive `e>0`] .. |
532 using assms(3)[rule_format,OF SOME_Basis `e>0`] .. |
544 thus "\<exists>x'\<in>s. x' \<noteq> x \<and> dist x' x < e" |
533 thus "\<exists>x'\<in>s. x' \<noteq> x \<and> dist x' x < e" |
545 apply(rule_tac x="x + d *\<^sub>R basis 0" in bexI) |
534 apply(rule_tac x="x + d *\<^sub>R (SOME i. i \<in> Basis)" in bexI) |
546 unfolding dist_norm by auto |
535 unfolding dist_norm by (auto simp: SOME_Basis nonzero_Basis) |
547 qed |
536 qed |
548 hence *:"netlimit (at x within s) = x" apply-apply(rule netlimit_within) |
537 hence *:"netlimit (at x within s) = x" apply-apply(rule netlimit_within) |
549 unfolding trivial_limit_within by simp |
538 unfolding trivial_limit_within by simp |
550 show ?thesis apply(rule linear_eq_stdbasis) |
539 show ?thesis apply(rule linear_eq_stdbasis) |
551 unfolding linear_conv_bounded_linear |
540 unfolding linear_conv_bounded_linear |
552 apply(rule as(1,2)[THEN conjunct1])+ |
541 apply(rule as(1,2)[THEN conjunct1])+ |
553 proof(rule,rule,rule ccontr) |
542 proof(rule,rule ccontr) |
554 fix i assume i:"i<DIM('a)" def e \<equiv> "norm (f' (basis i) - f'' (basis i))" |
543 fix i :: 'a assume i:"i \<in> Basis" def e \<equiv> "norm (f' i - f'' i)" |
555 assume "f' (basis i) \<noteq> f'' (basis i)" |
544 assume "f' i \<noteq> f'' i" |
556 hence "e>0" unfolding e_def by auto |
545 hence "e>0" unfolding e_def by auto |
557 guess d using tendsto_diff [OF as(1,2)[THEN conjunct2], unfolded * Lim_within,rule_format,OF `e>0`] .. note d=this |
546 guess d using tendsto_diff [OF as(1,2)[THEN conjunct2], unfolded * Lim_within,rule_format,OF `e>0`] .. note d=this |
558 guess c using assms(3)[rule_format,OF i d[THEN conjunct1]] .. note c=this |
547 guess c using assms(3)[rule_format,OF i d[THEN conjunct1]] .. note c=this |
559 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)))" |
548 have *:"norm (- ((1 / \<bar>c\<bar>) *\<^sub>R f' (c *\<^sub>R i)) + (1 / \<bar>c\<bar>) *\<^sub>R f'' (c *\<^sub>R i)) = norm ((1 / abs c) *\<^sub>R (- (f' (c *\<^sub>R i)) + f'' (c *\<^sub>R i)))" |
560 unfolding scaleR_right_distrib by auto |
549 unfolding scaleR_right_distrib by auto |
561 also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' (basis i)) + f'' (basis i))))" |
550 also have "\<dots> = norm ((1 / abs c) *\<^sub>R (c *\<^sub>R (- (f' i) + f'' i)))" |
562 unfolding f'.scaleR f''.scaleR |
551 unfolding f'.scaleR f''.scaleR |
563 unfolding scaleR_right_distrib scaleR_minus_right by auto |
552 unfolding scaleR_right_distrib scaleR_minus_right by auto |
564 also have "\<dots> = e" unfolding e_def using c[THEN conjunct1] |
553 also have "\<dots> = e" unfolding e_def using c[THEN conjunct1] |
565 using norm_minus_cancel[of "f' (basis i) - f'' (basis i)"] |
554 using norm_minus_cancel[of "f' i - f'' i"] |
566 by (auto simp add: add.commute ab_diff_minus) |
555 by (auto simp add: add.commute ab_diff_minus) |
567 finally show False using c |
556 finally show False using c |
568 using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R basis i"] |
557 using d[THEN conjunct2,rule_format,of "x + c *\<^sub>R i"] |
569 unfolding dist_norm |
558 unfolding dist_norm |
570 unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff |
559 unfolding f'.scaleR f''.scaleR f'.add f''.add f'.diff f''.diff |
571 scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib |
560 scaleR_scaleR scaleR_right_diff_distrib scaleR_right_distrib |
572 using i by auto |
561 using i by auto |
573 qed |
562 qed |
582 unfolding isCont_def LIM_def |
571 unfolding isCont_def LIM_def |
583 unfolding continuous_at Lim_at unfolding dist_nz by auto |
572 unfolding continuous_at Lim_at unfolding dist_nz by auto |
584 |
573 |
585 lemma frechet_derivative_unique_within_closed_interval: |
574 lemma frechet_derivative_unique_within_closed_interval: |
586 fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector" |
575 fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector" |
587 assumes "\<forall>i<DIM('a). a$$i < b$$i" "x \<in> {a..b}" (is "x\<in>?I") |
576 assumes "\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i" "x \<in> {a..b}" (is "x\<in>?I") |
588 assumes "(f has_derivative f' ) (at x within {a..b})" |
577 assumes "(f has_derivative f' ) (at x within {a..b})" |
589 assumes "(f has_derivative f'') (at x within {a..b})" |
578 assumes "(f has_derivative f'') (at x within {a..b})" |
590 shows "f' = f''" |
579 shows "f' = f''" |
591 apply(rule frechet_derivative_unique_within) |
580 apply(rule frechet_derivative_unique_within) |
592 apply(rule assms(3,4))+ |
581 apply(rule assms(3,4))+ |
593 proof(rule,rule,rule,rule) |
582 proof(rule,rule,rule) |
594 fix e::real and i assume "e>0" and i:"i<DIM('a)" |
583 fix e::real and i :: 'a assume "e>0" and i:"i\<in>Basis" |
595 thus "\<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> x + d *\<^sub>R basis i \<in> {a..b}" |
584 thus "\<exists>d. 0 < \<bar>d\<bar> \<and> \<bar>d\<bar> < e \<and> x + d *\<^sub>R i \<in> {a..b}" |
596 proof(cases "x$$i=a$$i") |
585 proof(cases "x\<bullet>i=a\<bullet>i") |
597 case True thus ?thesis |
586 case True thus ?thesis |
598 apply(rule_tac x="(min (b$$i - a$$i) e) / 2" in exI) |
587 apply(rule_tac x="(min (b\<bullet>i - a\<bullet>i) e) / 2" in exI) |
599 using assms(1)[THEN spec[where x=i]] and `e>0` and assms(2) |
588 using assms(1)[THEN bspec[where x=i]] and `e>0` and assms(2) |
600 unfolding mem_interval euclidean_simps |
589 unfolding mem_interval |
601 using i by (auto simp add: field_simps) |
590 using i by (auto simp add: field_simps inner_simps inner_Basis) |
602 next note * = assms(2)[unfolded mem_interval,THEN spec[where x=i]] |
591 next |
603 case False moreover have "a $$ i < x $$ i" using False * by auto |
592 note * = assms(2)[unfolded mem_interval, THEN bspec, OF i] |
|
593 case False moreover have "a \<bullet> i < x \<bullet> i" using False * by auto |
604 moreover { |
594 moreover { |
605 have "a $$ i * 2 + min (x $$ i - a $$ i) e \<le> a$$i *2 + x$$i - a$$i" |
595 have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> a\<bullet>i *2 + x\<bullet>i - a\<bullet>i" |
606 by auto |
596 by auto |
607 also have "\<dots> = a$$i + x$$i" by auto |
597 also have "\<dots> = a\<bullet>i + x\<bullet>i" by auto |
608 also have "\<dots> \<le> 2 * x$$i" using * by auto |
598 also have "\<dots> \<le> 2 * (x\<bullet>i)" using * by auto |
609 finally have "a $$ i * 2 + min (x $$ i - a $$ i) e \<le> x $$ i * 2" by auto |
599 finally have "a \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e \<le> x \<bullet> i * 2" by auto |
610 } |
600 } |
611 moreover have "min (x $$ i - a $$ i) e \<ge> 0" using * and `e>0` by auto |
601 moreover have "min (x \<bullet> i - a \<bullet> i) e \<ge> 0" using * and `e>0` by auto |
612 hence "x $$ i * 2 \<le> b $$ i * 2 + min (x $$ i - a $$ i) e" using * by auto |
602 hence "x \<bullet> i * 2 \<le> b \<bullet> i * 2 + min (x \<bullet> i - a \<bullet> i) e" using * by auto |
613 ultimately show ?thesis |
603 ultimately show ?thesis |
614 apply(rule_tac x="- (min (x$$i - a$$i) e) / 2" in exI) |
604 apply(rule_tac x="- (min (x\<bullet>i - a\<bullet>i) e) / 2" in exI) |
615 using assms(1)[THEN spec[where x=i]] and `e>0` and assms(2) |
605 using assms(1)[THEN bspec, OF i] and `e>0` and assms(2) |
616 unfolding mem_interval euclidean_simps |
606 unfolding mem_interval |
617 using i by (auto simp add: field_simps) |
607 using i by (auto simp add: field_simps inner_simps inner_Basis) |
618 qed |
608 qed |
619 qed |
609 qed |
620 |
610 |
621 lemma frechet_derivative_unique_within_open_interval: |
611 lemma frechet_derivative_unique_within_open_interval: |
622 fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector" |
612 fixes f::"'a::ordered_euclidean_space \<Rightarrow> 'b::real_normed_vector" |
648 subsection {* The traditional Rolle theorem in one dimension. *} |
638 subsection {* The traditional Rolle theorem in one dimension. *} |
649 |
639 |
650 lemma linear_componentwise: |
640 lemma linear_componentwise: |
651 fixes f:: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
641 fixes f:: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
652 assumes lf: "linear f" |
642 assumes lf: "linear f" |
653 shows "(f x) $$ j = (\<Sum>i<DIM('a). (x$$i) * (f (basis i)$$j))" (is "?lhs = ?rhs") |
643 shows "(f x) \<bullet> j = (\<Sum>i\<in>Basis. (x\<bullet>i) * (f i\<bullet>j))" (is "?lhs = ?rhs") |
654 proof - |
644 proof - |
655 have fA: "finite {..<DIM('a)}" by simp |
645 have fA: "finite Basis" by simp |
656 have "?rhs = (\<Sum>i<DIM('a). x$$i *\<^sub>R f (basis i))$$j" |
646 have "?rhs = (\<Sum>i\<in>Basis. (x\<bullet>i) *\<^sub>R (f i))\<bullet>j" |
657 by simp |
647 by (simp add: inner_setsum_left) |
658 then show ?thesis |
648 then show ?thesis |
659 unfolding linear_setsum_mul[OF lf fA, symmetric] |
649 unfolding linear_setsum_mul[OF lf fA, symmetric] |
660 unfolding euclidean_representation[symmetric] .. |
650 unfolding euclidean_representation .. |
661 qed |
651 qed |
662 |
652 |
663 text {* We do not introduce @{text jacobian}, which is defined on matrices, instead we use |
653 text {* We do not introduce @{text jacobian}, which is defined on matrices, instead we use |
664 the unfolding of it. *} |
654 the unfolding of it. *} |
665 |
655 |
666 lemma jacobian_works: |
656 lemma jacobian_works: |
667 "(f::('a::euclidean_space) \<Rightarrow> ('b::euclidean_space)) differentiable net \<longleftrightarrow> |
657 "(f::('a::euclidean_space) \<Rightarrow> ('b::euclidean_space)) differentiable net \<longleftrightarrow> |
668 (f has_derivative (\<lambda>h. \<chi>\<chi> i. |
658 (f has_derivative (\<lambda>h. \<Sum>i\<in>Basis. |
669 \<Sum>j<DIM('a). frechet_derivative f net (basis j) $$ i * h $$ j)) net" |
659 (\<Sum>j\<in>Basis. frechet_derivative f net (j) \<bullet> i * (h \<bullet> j)) *\<^sub>R i)) net" |
670 (is "?differentiable \<longleftrightarrow> (f has_derivative (\<lambda>h. \<chi>\<chi> i. ?SUM h i)) net") |
660 (is "?differentiable \<longleftrightarrow> (f has_derivative (\<lambda>h. \<Sum>i\<in>Basis. ?SUM h i *\<^sub>R i)) net") |
671 proof |
661 proof |
672 assume *: ?differentiable |
662 assume *: ?differentiable |
673 { fix h i |
663 { fix h i |
674 have "?SUM h i = frechet_derivative f net h $$ i" using * |
664 have "?SUM h i = frechet_derivative f net h \<bullet> i" using * |
675 by (auto intro!: setsum_cong |
665 by (auto intro!: setsum_cong |
676 simp: linear_componentwise[of _ h i] linear_frechet_derivative) } |
666 simp: linear_componentwise[of _ h i] linear_frechet_derivative) } |
677 thus "(f has_derivative (\<lambda>h. \<chi>\<chi> i. ?SUM h i)) net" |
667 with * show "(f has_derivative (\<lambda>h. \<Sum>i\<in>Basis. ?SUM h i *\<^sub>R i)) net" |
678 using * by (simp add: frechet_derivative_works) |
668 by (simp add: frechet_derivative_works euclidean_representation) |
679 qed (auto intro!: differentiableI) |
669 qed (auto intro!: differentiableI) |
680 |
670 |
681 lemma differential_zero_maxmin_component: |
671 lemma differential_zero_maxmin_component: |
682 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
672 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" |
683 assumes k: "k < DIM('b)" |
673 assumes k: "k \<in> Basis" |
684 and ball: "0 < e" "((\<forall>y \<in> ball x e. (f y)$$k \<le> (f x)$$k) \<or> (\<forall>y\<in>ball x e. (f x)$$k \<le> (f y)$$k))" |
674 and ball: "0 < e" "((\<forall>y \<in> ball x e. (f y)\<bullet>k \<le> (f x)\<bullet>k) \<or> (\<forall>y\<in>ball x e. (f x)\<bullet>k \<le> (f y)\<bullet>k))" |
685 and diff: "f differentiable (at x)" |
675 and diff: "f differentiable (at x)" |
686 shows "(\<chi>\<chi> j. frechet_derivative f (at x) (basis j) $$ k) = (0::'a)" (is "?D k = 0") |
676 shows "(\<Sum>j\<in>Basis. (frechet_derivative f (at x) j \<bullet> k) *\<^sub>R j) = (0::'a)" (is "?D k = 0") |
687 proof (rule ccontr) |
677 proof (rule ccontr) |
688 assume "?D k \<noteq> 0" |
678 assume "?D k \<noteq> 0" |
689 then obtain j where j: "?D k $$ j \<noteq> 0" "j < DIM('a)" |
679 then obtain j where j: "?D k \<bullet> j \<noteq> 0" "j \<in> Basis" |
690 unfolding euclidean_lambda_beta euclidean_eq[of _ "0::'a"] by auto |
680 unfolding euclidean_eq_iff[of _ "0::'a"] by auto |
691 hence *: "\<bar>?D k $$ j\<bar> / 2 > 0" by auto |
681 hence *: "\<bar>?D k \<bullet> j\<bar> / 2 > 0" by auto |
692 note as = diff[unfolded jacobian_works has_derivative_at_alt] |
682 note as = diff[unfolded jacobian_works has_derivative_at_alt] |
693 guess e' using as[THEN conjunct2, rule_format, OF *] .. note e' = this |
683 guess e' using as[THEN conjunct2, rule_format, OF *] .. note e' = this |
694 guess d using real_lbound_gt_zero[OF ball(1) e'[THEN conjunct1]] .. note d = this |
684 guess d using real_lbound_gt_zero[OF ball(1) e'[THEN conjunct1]] .. note d = this |
695 { fix c assume "abs c \<le> d" |
685 { fix c assume "abs c \<le> d" |
696 hence *:"norm (x + c *\<^sub>R basis j - x) < e'" using norm_basis[of j] d by auto |
686 hence *:"norm (x + c *\<^sub>R j - x) < e'" using norm_Basis[OF j(2)] d by auto |
697 let ?v = "(\<chi>\<chi> i. \<Sum>l<DIM('a). ?D i $$ l * (c *\<^sub>R basis j :: 'a) $$ l)" |
687 let ?v = "(\<Sum>i\<in>Basis. (\<Sum>l\<in>Basis. ?D i \<bullet> l * ((c *\<^sub>R j :: 'a) \<bullet> l)) *\<^sub>R i)" |
698 have if_dist: "\<And> P a b c. a * (if P then b else c) = (if P then a * b else a * c)" by auto |
688 have if_dist: "\<And> P a b c. a * (if P then b else c) = (if P then a * b else a * c)" by auto |
699 have "\<bar>(f (x + c *\<^sub>R basis j) - f x - ?v) $$ k\<bar> \<le> |
689 have "\<bar>(f (x + c *\<^sub>R j) - f x - ?v) \<bullet> k\<bar> \<le> |
700 norm (f (x + c *\<^sub>R basis j) - f x - ?v)" by (rule component_le_norm) |
690 norm (f (x + c *\<^sub>R j) - f x - ?v)" by (rule Basis_le_norm[OF k]) |
701 also have "\<dots> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>" |
691 also have "\<dots> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>" |
702 using e'[THEN conjunct2, rule_format, OF *] and norm_basis[of j] by fastforce |
692 using e'[THEN conjunct2, rule_format, OF *] and norm_Basis[OF j(2)] j |
703 finally have "\<bar>(f (x + c *\<^sub>R basis j) - f x - ?v) $$ k\<bar> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>" by simp |
693 by simp |
704 hence "\<bar>f (x + c *\<^sub>R basis j) $$ k - f x $$ k - c * ?D k $$ j\<bar> \<le> \<bar>?D k $$ j\<bar> / 2 * \<bar>c\<bar>" |
694 finally have "\<bar>(f (x + c *\<^sub>R j) - f x - ?v) \<bullet> k\<bar> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>" by simp |
705 unfolding euclidean_simps euclidean_lambda_beta using j k |
695 hence "\<bar>f (x + c *\<^sub>R j) \<bullet> k - f x \<bullet> k - c * (?D k \<bullet> j)\<bar> \<le> \<bar>?D k \<bullet> j\<bar> / 2 * \<bar>c\<bar>" |
706 by (simp add: if_dist setsum_cases field_simps) } note * = this |
696 using j k |
707 have "x + d *\<^sub>R basis j \<in> ball x e" "x - d *\<^sub>R basis j \<in> ball x e" |
697 by (simp add: inner_simps field_simps inner_Basis setsum_cases if_dist) } |
708 unfolding mem_ball dist_norm using norm_basis[of j] d by auto |
698 note * = this |
709 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> |
699 have "x + d *\<^sub>R j \<in> ball x e" "x - d *\<^sub>R j \<in> ball x e" |
710 ((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 ball by auto |
700 unfolding mem_ball dist_norm using norm_Basis[OF j(2)] d by auto |
|
701 hence **:"((f (x - d *\<^sub>R j))\<bullet>k \<le> (f x)\<bullet>k \<and> (f (x + d *\<^sub>R j))\<bullet>k \<le> (f x)\<bullet>k) \<or> |
|
702 ((f (x - d *\<^sub>R j))\<bullet>k \<ge> (f x)\<bullet>k \<and> (f (x + d *\<^sub>R j))\<bullet>k \<ge> (f x)\<bullet>k)" using ball by auto |
711 have ***: "\<And>y y1 y2 d dx::real. |
703 have ***: "\<And>y y1 y2 d dx::real. |
712 (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 |
704 (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 |
713 show False apply(rule ***[OF **, where dx="d * ?D k $$ j" and d="\<bar>?D k $$ j\<bar> / 2 * \<bar>d\<bar>"]) |
705 show False apply(rule ***[OF **, where dx="d * (?D k \<bullet> j)" and d="\<bar>?D k \<bullet> j\<bar> / 2 * \<bar>d\<bar>"]) |
714 using *[of "-d"] and *[of d] and d[THEN conjunct1] and j |
706 using *[of "-d"] and *[of d] and d[THEN conjunct1] and j |
715 unfolding mult_minus_left |
707 unfolding mult_minus_left |
716 unfolding abs_mult diff_minus_eq_add scaleR_minus_left |
708 unfolding abs_mult diff_minus_eq_add scaleR_minus_left |
717 unfolding algebra_simps by (auto intro: mult_pos_pos) |
709 unfolding algebra_simps by (auto intro: mult_pos_pos) |
718 qed |
710 qed |
726 and mono: "(\<forall>y\<in>s. f y \<le> f x) \<or> (\<forall>y\<in>s. f x \<le> f y)" |
718 and mono: "(\<forall>y\<in>s. f y \<le> f x) \<or> (\<forall>y\<in>s. f x \<le> f y)" |
727 shows "f' = (\<lambda>v. 0)" |
719 shows "f' = (\<lambda>v. 0)" |
728 proof - |
720 proof - |
729 obtain e where e:"e>0" "ball x e \<subseteq> s" |
721 obtain e where e:"e>0" "ball x e \<subseteq> s" |
730 using `open s`[unfolded open_contains_ball] and `x \<in> s` by auto |
722 using `open s`[unfolded open_contains_ball] and `x \<in> s` by auto |
731 with differential_zero_maxmin_component[where 'b=real, of 0 e x f, simplified] |
723 with differential_zero_maxmin_component[where 'b=real, of 1 e x f] mono deriv |
732 have "(\<chi>\<chi> j. frechet_derivative f (at x) (basis j)) = (0::'a)" |
724 have "(\<Sum>j\<in>Basis. frechet_derivative f (at x) j *\<^sub>R j) = (0::'a)" |
733 unfolding differentiable_def using mono deriv by auto |
725 by (auto simp: Basis_real_def differentiable_def) |
734 with frechet_derivative_at[OF deriv, symmetric] |
726 with frechet_derivative_at[OF deriv, symmetric] |
735 have "\<forall>i<DIM('a). f' (basis i) = 0" |
727 have "\<forall>i\<in>Basis. f' i = 0" |
736 by (simp add: euclidean_eq[of _ "0::'a"]) |
728 by (simp add: euclidean_eq_iff[of _ "0::'a"] inner_setsum_left_Basis) |
737 with derivative_is_linear[OF deriv, THEN linear_componentwise, of _ 0] |
729 with derivative_is_linear[OF deriv, THEN linear_componentwise, of _ 1] |
738 show ?thesis by (simp add: fun_eq_iff) |
730 show ?thesis by (simp add: fun_eq_iff) |
739 qed |
731 qed |
740 |
732 |
741 lemma rolle: fixes f::"real\<Rightarrow>real" |
733 lemma rolle: fixes f::"real\<Rightarrow>real" |
742 assumes "a < b" and "f a = f b" and "continuous_on {a..b} f" |
734 assumes "a < b" and "f a = f b" and "continuous_on {a..b} f" |