547 by (intro derivative_eq_intros) auto |
547 by (intro derivative_eq_intros) auto |
548 then have "FDERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> (\<lambda>k. f' (k *\<^sub>R h))" |
548 then have "FDERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> (\<lambda>k. f' (k *\<^sub>R h))" |
549 by (rule has_derivative_compose, simp add: deriv) |
549 by (rule has_derivative_compose, simp add: deriv) |
550 then have "DERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> f' h" |
550 then have "DERIV (\<lambda>r. f (x + r *\<^sub>R h)) 0 :> f' h" |
551 unfolding has_field_derivative_def by (simp add: f'.scaleR mult_commute_abs) |
551 unfolding has_field_derivative_def by (simp add: f'.scaleR mult_commute_abs) |
552 moreover have "0 < d / norm h" |
552 moreover have "0 < d / norm h" using d1 and `h \<noteq> 0` by simp |
553 using d1 and `h \<noteq> 0` by (simp add: divide_pos_pos) |
|
554 moreover have "\<forall>y. \<bar>0 - y\<bar> < d / norm h \<longrightarrow> f (x + 0 *\<^sub>R h) \<le> f (x + y *\<^sub>R h)" |
553 moreover have "\<forall>y. \<bar>0 - y\<bar> < d / norm h \<longrightarrow> f (x + 0 *\<^sub>R h) \<le> f (x + y *\<^sub>R h)" |
555 using `h \<noteq> 0` by (auto simp add: d2 dist_norm pos_less_divide_eq) |
554 using `h \<noteq> 0` by (auto simp add: d2 dist_norm pos_less_divide_eq) |
556 ultimately show "f' h = 0" |
555 ultimately show "f' h = 0" |
557 by (rule DERIV_local_min) |
556 by (rule DERIV_local_min) |
558 qed (simp add: f'.zero) |
557 qed (simp add: f'.zero) |
924 using bounded_linear.pos_bounded[OF assms(2)] by blast |
923 using bounded_linear.pos_bounded[OF assms(2)] by blast |
925 have lem1: "\<forall>e>0. \<exists>d>0. \<forall>z. |
924 have lem1: "\<forall>e>0. \<exists>d>0. \<forall>z. |
926 norm (z - y) < d \<longrightarrow> norm (g z - g y - g'(z - y)) \<le> e * norm (g z - g y)" |
925 norm (z - y) < d \<longrightarrow> norm (g z - g y - g'(z - y)) \<le> e * norm (g z - g y)" |
927 proof (rule, rule) |
926 proof (rule, rule) |
928 case goal1 |
927 case goal1 |
929 have *: "e / C > 0" |
928 have *: "e / C > 0" using `e > 0` C(1) by auto |
930 apply (rule divide_pos_pos) |
|
931 using `e > 0` C(1) |
|
932 apply auto |
|
933 done |
|
934 obtain d0 where d0: |
929 obtain d0 where d0: |
935 "0 < d0" |
930 "0 < d0" |
936 "\<forall>ya. norm (ya - g y) < d0 \<longrightarrow> norm (f ya - f (g y) - f' (ya - g y)) \<le> e / C * norm (ya - g y)" |
931 "\<forall>ya. norm (ya - g y) < d0 \<longrightarrow> norm (f ya - f (g y) - f' (ya - g y)) \<le> e / C * norm (ya - g y)" |
937 using assms(1) |
932 using assms(1) |
938 unfolding has_derivative_at_alt |
933 unfolding has_derivative_at_alt |
1020 apply (rule assms) |
1015 apply (rule assms) |
1021 apply rule |
1016 apply rule |
1022 apply rule |
1017 apply rule |
1023 proof - |
1018 proof - |
1024 case goal1 |
1019 case goal1 |
1025 then have *: "e / B >0" |
1020 hence *: "e / B >0" by (metis `0 < B` divide_pos_pos) |
1026 by (metis `0 < B` divide_pos_pos) |
|
1027 obtain d' where d': |
1021 obtain d' where d': |
1028 "0 < d'" |
1022 "0 < d'" |
1029 "\<forall>z. norm (z - y) < d' \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> e / B * norm (g z - g y)" |
1023 "\<forall>z. norm (z - y) < d' \<longrightarrow> norm (g z - g y - g' (z - y)) \<le> e / B * norm (g z - g y)" |
1030 using lem1 * by blast |
1024 using lem1 * by blast |
1031 obtain k where k: "0 < k" "k < d" "k < d'" |
1025 obtain k where k: "0 < k" "k < d" "k < d'" |
1178 interpret g': bounded_linear g' |
1172 interpret g': bounded_linear g' |
1179 using assms |
1173 using assms |
1180 by auto |
1174 by auto |
1181 obtain B where B: "0 < B" "\<forall>x. norm (g' x) \<le> norm x * B" |
1175 obtain B where B: "0 < B" "\<forall>x. norm (g' x) \<le> norm x * B" |
1182 using bounded_linear.pos_bounded[OF assms(5)] by blast |
1176 using bounded_linear.pos_bounded[OF assms(5)] by blast |
1183 then have *: "1 / (2 * B) > 0" |
1177 hence *: "1 / (2 * B) > 0" by auto |
1184 by (auto intro!: divide_pos_pos) |
|
1185 obtain e0 where e0: |
1178 obtain e0 where e0: |
1186 "0 < e0" |
1179 "0 < e0" |
1187 "\<forall>y. norm (y - x) < e0 \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> 1 / (2 * B) * norm (y - x)" |
1180 "\<forall>y. norm (y - x) < e0 \<longrightarrow> norm (f y - f x - f' (y - x)) \<le> 1 / (2 * B) * norm (y - x)" |
1188 using assms(4) |
1181 using assms(4) |
1189 unfolding has_derivative_at_alt |
1182 unfolding has_derivative_at_alt |
1190 using * by blast |
1183 using * by blast |
1191 obtain e1 where e1: "0 < e1" "cball x e1 \<subseteq> t" |
1184 obtain e1 where e1: "0 < e1" "cball x e1 \<subseteq> t" |
1192 using assms(8) |
1185 using assms(8) |
1193 unfolding mem_interior_cball |
1186 unfolding mem_interior_cball |
1194 by blast |
1187 by blast |
1195 have *: "0 < e0 / B" "0 < e1 / B" |
1188 have *: "0 < e0 / B" "0 < e1 / B" using e0 e1 B by auto |
1196 apply (rule_tac[!] divide_pos_pos) |
|
1197 using e0 e1 B |
|
1198 apply auto |
|
1199 done |
|
1200 obtain e where e: "0 < e" "e < e0 / B" "e < e1 / B" |
1189 obtain e where e: "0 < e" "e < e0 / B" "e < e1 / B" |
1201 using real_lbound_gt_zero[OF *] by blast |
1190 using real_lbound_gt_zero[OF *] by blast |
1202 have "\<forall>z\<in>cball (f x) (e / 2). \<exists>y\<in>cball (f x) e. f (x + g' (y - f x)) = z" |
1191 have "\<forall>z\<in>cball (f x) (e / 2). \<exists>y\<in>cball (f x) e. f (x + g' (y - f x)) = z" |
1203 apply rule |
1192 apply rule |
1204 apply (rule brouwer_surjective_cball[where s="cball (f x) (e/2)"]) |
1193 apply (rule brouwer_surjective_cball[where s="cball (f x) (e/2)"]) |
1666 show ?thesis |
1655 show ?thesis |
1667 unfolding Cauchy_def |
1656 unfolding Cauchy_def |
1668 proof (rule, rule) |
1657 proof (rule, rule) |
1669 fix e :: real |
1658 fix e :: real |
1670 assume "e > 0" |
1659 assume "e > 0" |
1671 then have *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0" |
1660 hence *: "e / 2 > 0" "e / 2 / norm (x - x0) > 0" using False by auto |
1672 using False by (auto intro!: divide_pos_pos) |
|
1673 obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x0) (f n x0) < e / 2" |
1661 obtain M where M: "\<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x0) (f n x0) < e / 2" |
1674 using LIMSEQ_imp_Cauchy[OF assms(5)] |
1662 using LIMSEQ_imp_Cauchy[OF assms(5)] |
1675 unfolding Cauchy_def |
1663 unfolding Cauchy_def |
1676 using *(1) by blast |
1664 using *(1) by blast |
1677 obtain N where N: |
1665 obtain N where N: |
1755 by (fast elim: eventually_elim1) |
1743 by (fast elim: eventually_elim1) |
1756 then show ?thesis |
1744 then show ?thesis |
1757 using `u = 0` and `0 < e` by (auto elim: eventually_elim1) |
1745 using `u = 0` and `0 < e` by (auto elim: eventually_elim1) |
1758 next |
1746 next |
1759 case False |
1747 case False |
1760 with `0 < e` have "0 < e / norm u" |
1748 with `0 < e` have "0 < e / norm u" by simp |
1761 by (simp add: divide_pos_pos) |
|
1762 then have "eventually (\<lambda>n. norm (f' n x u - g' x u) \<le> e / norm u * norm u) sequentially" |
1749 then have "eventually (\<lambda>n. norm (f' n x u - g' x u) \<le> e / norm u * norm u) sequentially" |
1763 using assms(3)[folded eventually_sequentially] and `x \<in> s` |
1750 using assms(3)[folded eventually_sequentially] and `x \<in> s` |
1764 by (fast elim: eventually_elim1) |
1751 by (fast elim: eventually_elim1) |
1765 then show ?thesis |
1752 then show ?thesis |
1766 using `u \<noteq> 0` by simp |
1753 using `u \<noteq> 0` by simp |