| author | wenzelm | 
| Fri, 07 May 2021 12:43:03 +0200 | |
| changeset 73640 | f4778e08dcd7 | 
| parent 72569 | d56e4eeae967 | 
| child 73885 | 26171a89466a | 
| child 73932 | fd21b4a93043 | 
| permissions | -rw-r--r-- | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1 | (* Author: L C Paulson, University of Cambridge | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2 | Author: Amine Chaieb, University of Cambridge | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 3 | Author: Robert Himmelmann, TU Muenchen | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 4 | Author: Brian Huffman, Portland State University | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 5 | *) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 6 | |
| 71198 | 7 | section \<open>Elementary Metric Spaces\<close> | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 8 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 9 | theory Elementary_Metric_Spaces | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 10 | imports | 
| 69616 
d18dc9c5c456
split off theory combining Elementary_Topology and Abstract_Topology
 immler parents: 
69615diff
changeset | 11 | Abstract_Topology_2 | 
| 70951 
678b2abe9f7d
decision procedure for metric spaces, implemented by Maximilian Schäffeler
 immler parents: 
70817diff
changeset | 12 | Metric_Arith | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 13 | begin | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 14 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 15 | subsection \<open>Open and closed balls\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 16 | |
| 70136 | 17 | definition\<^marker>\<open>tag important\<close> ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 18 |   where "ball x e = {y. dist x y < e}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 19 | |
| 70136 | 20 | definition\<^marker>\<open>tag important\<close> cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 21 |   where "cball x e = {y. dist x y \<le> e}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 22 | |
| 70136 | 23 | definition\<^marker>\<open>tag important\<close> sphere :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 24 |   where "sphere x e = {y. dist x y = e}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 25 | |
| 70951 
678b2abe9f7d
decision procedure for metric spaces, implemented by Maximilian Schäffeler
 immler parents: 
70817diff
changeset | 26 | lemma mem_ball [simp, metric_unfold]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 27 | by (simp add: ball_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 28 | |
| 70951 
678b2abe9f7d
decision procedure for metric spaces, implemented by Maximilian Schäffeler
 immler parents: 
70817diff
changeset | 29 | lemma mem_cball [simp, metric_unfold]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 30 | by (simp add: cball_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 31 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 32 | lemma mem_sphere [simp]: "y \<in> sphere x e \<longleftrightarrow> dist x y = e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 33 | by (simp add: sphere_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 34 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 35 | lemma ball_trivial [simp]: "ball x 0 = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 36 | by (simp add: ball_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 37 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 38 | lemma cball_trivial [simp]: "cball x 0 = {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 39 | by (simp add: cball_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 40 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 41 | lemma sphere_trivial [simp]: "sphere x 0 = {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 42 | by (simp add: sphere_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 43 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 44 | lemma disjoint_ballI: "dist x y \<ge> r+s \<Longrightarrow> ball x r \<inter> ball y s = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 45 | using dist_triangle_less_add not_le by fastforce | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 46 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 47 | lemma disjoint_cballI: "dist x y > r + s \<Longrightarrow> cball x r \<inter> cball y s = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 48 | by (metis add_mono disjoint_iff_not_equal dist_triangle2 dual_order.trans leD mem_cball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 49 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 50 | lemma sphere_empty [simp]: "r < 0 \<Longrightarrow> sphere a r = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 51 | for a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 52 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 53 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 54 | lemma centre_in_ball [simp]: "x \<in> ball x e \<longleftrightarrow> 0 < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 55 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 56 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 57 | lemma centre_in_cball [simp]: "x \<in> cball x e \<longleftrightarrow> 0 \<le> e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 58 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 59 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 60 | lemma ball_subset_cball [simp, intro]: "ball x e \<subseteq> cball x e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 61 | by (simp add: subset_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 62 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 63 | lemma mem_ball_imp_mem_cball: "x \<in> ball y e \<Longrightarrow> x \<in> cball y e" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 64 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 65 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 66 | lemma sphere_cball [simp,intro]: "sphere z r \<subseteq> cball z r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 67 | by force | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 68 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 69 | lemma cball_diff_sphere: "cball a r - sphere a r = ball a r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 70 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 71 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 72 | lemma subset_ball[intro]: "d \<le> e \<Longrightarrow> ball x d \<subseteq> ball x e" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 73 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 74 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 75 | lemma subset_cball[intro]: "d \<le> e \<Longrightarrow> cball x d \<subseteq> cball x e" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 76 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 77 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 78 | lemma mem_ball_leI: "x \<in> ball y e \<Longrightarrow> e \<le> f \<Longrightarrow> x \<in> ball y f" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 79 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 80 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 81 | lemma mem_cball_leI: "x \<in> cball y e \<Longrightarrow> e \<le> f \<Longrightarrow> x \<in> cball y f" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 82 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 83 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 84 | lemma cball_trans: "y \<in> cball z b \<Longrightarrow> x \<in> cball y a \<Longrightarrow> x \<in> cball z (b + a)" | 
| 70960 | 85 | by metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 86 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 87 | lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 88 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 89 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 90 | lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 91 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 92 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 93 | lemma cball_max_Un: "cball a (max r s) = cball a r \<union> cball a s" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 94 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 95 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 96 | lemma cball_min_Int: "cball a (min r s) = cball a r \<inter> cball a s" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 97 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 98 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 99 | lemma cball_diff_eq_sphere: "cball a r - ball a r = sphere a r" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 100 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 101 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 102 | lemma open_ball [intro, simp]: "open (ball x e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 103 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 104 |   have "open (dist x -` {..<e})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 105 | by (intro open_vimage open_lessThan continuous_intros) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 106 |   also have "dist x -` {..<e} = ball x e"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 107 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 108 | finally show ?thesis . | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 109 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 110 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 111 | lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)" | 
| 71633 | 112 | by (simp add: open_dist subset_eq Ball_def dist_commute) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 113 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 114 | lemma openI [intro?]: "(\<And>x. x\<in>S \<Longrightarrow> \<exists>e>0. ball x e \<subseteq> S) \<Longrightarrow> open S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 115 | by (auto simp: open_contains_ball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 116 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 117 | lemma openE[elim?]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 118 | assumes "open S" "x\<in>S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 119 | obtains e where "e>0" "ball x e \<subseteq> S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 120 | using assms unfolding open_contains_ball by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 121 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 122 | lemma open_contains_ball_eq: "open S \<Longrightarrow> x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 123 | by (metis open_contains_ball subset_eq centre_in_ball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 124 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 125 | lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 126 | unfolding mem_ball set_eq_iff | 
| 70960 | 127 | by (simp add: not_less) metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 128 | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 129 | lemma ball_empty: "e \<le> 0 \<Longrightarrow> ball x e = {}" 
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 130 | by simp | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 131 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 132 | lemma closed_cball [iff]: "closed (cball x e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 133 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 134 |   have "closed (dist x -` {..e})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 135 | by (intro closed_vimage closed_atMost continuous_intros) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 136 |   also have "dist x -` {..e} = cball x e"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 137 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 138 | finally show ?thesis . | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 139 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 140 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 141 | lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 142 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 143 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 144 | fix x and e::real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 145 | assume "x\<in>S" "e>0" "ball x e \<subseteq> S" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 146 | then have "\<exists>d>0. cball x d \<subseteq> S" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 147 | unfolding subset_eq by (rule_tac x="e/2" in exI, auto) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 148 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 149 | moreover | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 150 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 151 | fix x and e::real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 152 | assume "x\<in>S" "e>0" "cball x e \<subseteq> S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 153 | then have "\<exists>d>0. ball x d \<subseteq> S" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 154 | using mem_ball_imp_mem_cball by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 155 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 156 | ultimately show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 157 | unfolding open_contains_ball by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 158 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 159 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 160 | lemma open_contains_cball_eq: "open S \<Longrightarrow> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 161 | by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 162 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 163 | lemma eventually_nhds_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>x. x \<in> ball z d) (nhds z)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 164 | by (rule eventually_nhds_in_open) simp_all | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 165 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 166 | lemma eventually_at_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>t. t \<in> ball z d \<and> t \<in> A) (at z within A)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 167 | unfolding eventually_at by (intro exI[of _ d]) (simp_all add: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 168 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 169 | lemma eventually_at_ball': "d > 0 \<Longrightarrow> eventually (\<lambda>t. t \<in> ball z d \<and> t \<noteq> z \<and> t \<in> A) (at z within A)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 170 | unfolding eventually_at by (intro exI[of _ d]) (simp_all add: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 171 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 172 | lemma at_within_ball: "e > 0 \<Longrightarrow> dist x y < e \<Longrightarrow> at y within ball x e = at y" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 173 | by (subst at_within_open) auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 174 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 175 | lemma atLeastAtMost_eq_cball: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 176 | fixes a b::real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 177 |   shows "{a .. b} = cball ((a + b)/2) ((b - a)/2)"
 | 
| 71174 | 178 | by (auto simp: dist_real_def field_simps) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 179 | |
| 71028 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 180 | lemma cball_eq_atLeastAtMost: | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 181 | fixes a b::real | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 182 |   shows "cball a b = {a - b .. a + b}"
 | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 183 | by (auto simp: dist_real_def) | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 184 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 185 | lemma greaterThanLessThan_eq_ball: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 186 | fixes a b::real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 187 |   shows "{a <..< b} = ball ((a + b)/2) ((b - a)/2)"
 | 
| 71174 | 188 | by (auto simp: dist_real_def field_simps) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 189 | |
| 71028 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 190 | lemma ball_eq_greaterThanLessThan: | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 191 | fixes a b::real | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 192 |   shows "ball a b = {a - b <..< a + b}"
 | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 193 | by (auto simp: dist_real_def) | 
| 
c2465b429e6e
Line_Segment is independent of Convex_Euclidean_Space
 immler parents: 
70960diff
changeset | 194 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 195 | lemma interior_ball [simp]: "interior (ball x e) = ball x e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 196 | by (simp add: interior_open) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 197 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 198 | lemma cball_eq_empty [simp]: "cball x e = {} \<longleftrightarrow> e < 0"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 199 | apply (simp add: set_eq_iff not_le) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 200 | apply (metis zero_le_dist dist_self order_less_le_trans) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 201 | done | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 202 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 203 | lemma cball_empty [simp]: "e < 0 \<Longrightarrow> cball x e = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 204 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 205 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 206 | lemma cball_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 207 | fixes x :: "'a::metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 208 |   shows "e = 0 \<Longrightarrow> cball x e = {x}"
 | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 209 | by simp | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 210 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 211 | lemma ball_divide_subset: "d \<ge> 1 \<Longrightarrow> ball x (e/d) \<subseteq> ball x e" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 212 | by (metis ball_eq_empty div_by_1 frac_le linear subset_ball zero_less_one) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 213 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 214 | lemma ball_divide_subset_numeral: "ball x (e / numeral w) \<subseteq> ball x e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 215 | using ball_divide_subset one_le_numeral by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 216 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 217 | lemma cball_divide_subset: "d \<ge> 1 \<Longrightarrow> cball x (e/d) \<subseteq> cball x e" | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 218 | apply (cases "e < 0", simp add: field_split_simps) | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 219 | by (metis div_by_1 frac_le less_numeral_extra(1) not_le order_refl subset_cball) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 220 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 221 | lemma cball_divide_subset_numeral: "cball x (e / numeral w) \<subseteq> cball x e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 222 | using cball_divide_subset one_le_numeral by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 223 | |
| 71192 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 224 | lemma cball_scale: | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 225 | assumes "a \<noteq> 0" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 226 | shows "(\<lambda>x. a *\<^sub>R x) ` cball c r = cball (a *\<^sub>R c :: 'a :: real_normed_vector) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 227 | proof - | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 228 | have 1: "(\<lambda>x. a *\<^sub>R x) ` cball c r \<subseteq> cball (a *\<^sub>R c) (\<bar>a\<bar> * r)" if "a \<noteq> 0" for a r and c :: 'a | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 229 | proof safe | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 230 | fix x | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 231 | assume x: "x \<in> cball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 232 | have "dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 233 | by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 234 | also have "a *\<^sub>R c - a *\<^sub>R x = a *\<^sub>R (c - x)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 235 | by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 236 | finally show "a *\<^sub>R x \<in> cball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 237 | using that x by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 238 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 239 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 240 | have "cball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (\<lambda>x. a *\<^sub>R x) ` (\<lambda>x. inverse a *\<^sub>R x) ` cball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 241 | unfolding image_image using assms by simp | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 242 | also have "\<dots> \<subseteq> (\<lambda>x. a *\<^sub>R x) ` cball (inverse a *\<^sub>R (a *\<^sub>R c)) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 243 | using assms by (intro image_mono 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 244 | also have "\<dots> = (\<lambda>x. a *\<^sub>R x) ` cball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 245 | using assms by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 246 | finally have "cball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (\<lambda>x. a *\<^sub>R x) ` cball c r" . | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 247 | moreover from assms have "(\<lambda>x. a *\<^sub>R x) ` cball c r \<subseteq> cball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 248 | by (intro 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 249 | ultimately show ?thesis by blast | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 250 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 251 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 252 | lemma ball_scale: | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 253 | assumes "a \<noteq> 0" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 254 | shows "(\<lambda>x. a *\<^sub>R x) ` ball c r = ball (a *\<^sub>R c :: 'a :: real_normed_vector) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 255 | proof - | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 256 | have 1: "(\<lambda>x. a *\<^sub>R x) ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)" if "a \<noteq> 0" for a r and c :: 'a | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 257 | proof safe | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 258 | fix x | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 259 | assume x: "x \<in> ball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 260 | have "dist (a *\<^sub>R c) (a *\<^sub>R x) = norm (a *\<^sub>R c - a *\<^sub>R x)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 261 | by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 262 | also have "a *\<^sub>R c - a *\<^sub>R x = a *\<^sub>R (c - x)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 263 | by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 264 | finally show "a *\<^sub>R x \<in> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 265 | using that x by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 266 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 267 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 268 | have "ball (a *\<^sub>R c) (\<bar>a\<bar> * r) = (\<lambda>x. a *\<^sub>R x) ` (\<lambda>x. inverse a *\<^sub>R x) ` ball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 269 | unfolding image_image using assms by simp | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 270 | also have "\<dots> \<subseteq> (\<lambda>x. a *\<^sub>R x) ` ball (inverse a *\<^sub>R (a *\<^sub>R c)) (\<bar>inverse a\<bar> * (\<bar>a\<bar> * r))" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 271 | using assms by (intro image_mono 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 272 | also have "\<dots> = (\<lambda>x. a *\<^sub>R x) ` ball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 273 | using assms by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 274 | finally have "ball (a *\<^sub>R c) (\<bar>a\<bar> * r) \<subseteq> (\<lambda>x. a *\<^sub>R x) ` ball c r" . | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 275 | moreover from assms have "(\<lambda>x. a *\<^sub>R x) ` ball c r \<subseteq> ball (a *\<^sub>R c) (\<bar>a\<bar> * r)" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 276 | by (intro 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 277 | ultimately show ?thesis by blast | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 278 | qed | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 279 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 280 | subsection \<open>Limit Points\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 281 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 282 | lemma islimpt_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 283 | fixes x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 284 | shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 285 | unfolding islimpt_iff_eventually eventually_at by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 286 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 287 | lemma islimpt_approachable_le: "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 288 | for x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 289 | unfolding islimpt_approachable | 
| 72225 | 290 | using approachable_lt_le2 [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x" and Q="\<lambda>x. True"] | 
| 291 | by auto | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 292 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 293 | lemma limpt_of_limpts: "x islimpt {y. y islimpt S} \<Longrightarrow> x islimpt S"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 294 | for x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 295 | apply (clarsimp simp add: islimpt_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 296 | apply (drule_tac x="e/2" in spec) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 297 | apply (auto simp: simp del: less_divide_eq_numeral1) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 298 | apply (drule_tac x="dist x' x" in spec) | 
| 71174 | 299 | apply (auto simp del: less_divide_eq_numeral1) | 
| 70960 | 300 | apply metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 301 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 302 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 303 | lemma closed_limpts:  "closed {x::'a::metric_space. x islimpt S}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 304 | using closed_limpt limpt_of_limpts by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 305 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 306 | lemma limpt_of_closure: "x islimpt closure S \<longleftrightarrow> x islimpt S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 307 | for x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 308 | by (auto simp: closure_def islimpt_Un dest: limpt_of_limpts) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 309 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 310 | lemma islimpt_eq_infinite_ball: "x islimpt S \<longleftrightarrow> (\<forall>e>0. infinite(S \<inter> ball x e))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 311 | apply (simp add: islimpt_eq_acc_point, safe) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 312 | apply (metis Int_commute open_ball centre_in_ball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 313 | by (metis open_contains_ball Int_mono finite_subset inf_commute subset_refl) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 314 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 315 | lemma islimpt_eq_infinite_cball: "x islimpt S \<longleftrightarrow> (\<forall>e>0. infinite(S \<inter> cball x e))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 316 | apply (simp add: islimpt_eq_infinite_ball, safe) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 317 | apply (meson Int_mono ball_subset_cball finite_subset order_refl) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 318 | by (metis open_ball centre_in_ball finite_Int inf.absorb_iff2 inf_assoc open_contains_cball_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 319 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 320 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 321 | subsection \<open>Perfect Metric Spaces\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 322 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 323 | lemma perfect_choose_dist: "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 324 |   for x :: "'a::{perfect_space,metric_space}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 325 | using islimpt_UNIV [of x] by (simp add: islimpt_approachable) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 326 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 327 | lemma cball_eq_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 328 |   fixes x :: "'a::{metric_space,perfect_space}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 329 |   shows "cball x e = {x} \<longleftrightarrow> e = 0"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 330 | proof (rule linorder_cases) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 331 | assume e: "0 < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 332 | obtain a where "a \<noteq> x" "dist a x < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 333 | using perfect_choose_dist [OF e] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 334 | then have "a \<noteq> x" "dist x a \<le> e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 335 | by (auto simp: dist_commute) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 336 | with e show ?thesis by (auto simp: set_eq_iff) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 337 | qed auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 338 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 339 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 340 | subsection \<open>?\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 341 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 342 | lemma finite_ball_include: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 343 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 344 | assumes "finite S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 345 | shows "\<exists>e>0. S \<subseteq> ball a e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 346 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 347 | proof induction | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 348 | case (insert x S) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 349 | then obtain e0 where "e0>0" and e0:"S \<subseteq> ball a e0" by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 350 | define e where "e = max e0 (2 * dist a x)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 351 | have "e>0" unfolding e_def using \<open>e0>0\<close> by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 352 | moreover have "insert x S \<subseteq> ball a e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 353 | using e0 \<open>e>0\<close> unfolding e_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 354 | ultimately show ?case by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 355 | qed (auto intro: zero_less_one) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 356 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 357 | lemma finite_set_avoid: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 358 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 359 | assumes "finite S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 360 | shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d \<le> dist a x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 361 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 362 | proof induction | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 363 | case (insert x S) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 364 | then obtain d where "d > 0" and d: "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> d \<le> dist a x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 365 | by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 366 | show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 367 | proof (cases "x = a") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 368 | case True | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 369 | with \<open>d > 0 \<close>d show ?thesis by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 370 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 371 | case False | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 372 | let ?d = "min d (dist a x)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 373 | from False \<open>d > 0\<close> have dp: "?d > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 374 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 375 | from d have d': "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> ?d \<le> dist a x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 376 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 377 | with dp False show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 378 | by (metis insert_iff le_less min_less_iff_conj not_less) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 379 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 380 | qed (auto intro: zero_less_one) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 381 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 382 | lemma discrete_imp_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 383 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 384 | assumes e: "0 < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 385 | and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 386 | shows "closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 387 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 388 | have False if C: "\<And>e. e>0 \<Longrightarrow> \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" for x | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 389 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 390 | from e have e2: "e/2 > 0" by arith | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 391 | from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y \<noteq> x" "dist y x < e/2" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 392 | by blast | 
| 70960 | 393 | from e2 y(2) have mp: "min (e/2) (dist x y) > 0" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 394 | by simp | 
| 70960 | 395 | from d y C[OF mp] show ?thesis | 
| 396 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 397 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 398 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 399 | by (metis islimpt_approachable closed_limpt [where 'a='a]) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 400 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 401 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 402 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 403 | subsection \<open>Interior\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 404 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 405 | lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 406 | using open_contains_ball_eq [where S="interior S"] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 407 | by (simp add: open_subset_interior) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 408 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 409 | lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 410 | by (meson ball_subset_cball interior_subset mem_interior open_contains_cball open_interior | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 411 | subset_trans) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 412 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 413 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 414 | subsection \<open>Frontier\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 415 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 416 | lemma frontier_straddle: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 417 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 418 | shows "a \<in> frontier S \<longleftrightarrow> (\<forall>e>0. (\<exists>x\<in>S. dist a x < e) \<and> (\<exists>x. x \<notin> S \<and> dist a x < e))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 419 | unfolding frontier_def closure_interior | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 420 | by (auto simp: mem_interior subset_eq ball_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 421 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 422 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 423 | subsection \<open>Limits\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 424 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 425 | proposition Lim: "(f \<longlongrightarrow> l) net \<longleftrightarrow> trivial_limit net \<or> (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 426 | by (auto simp: tendsto_iff trivial_limit_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 427 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 428 | text \<open>Show that they yield usual definitions in the various cases.\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 429 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 430 | proposition Lim_within_le: "(f \<longlongrightarrow> l)(at a within S) \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 431 | (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a \<le> d \<longrightarrow> dist (f x) l < e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 432 | by (auto simp: tendsto_iff eventually_at_le) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 433 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 434 | proposition Lim_within: "(f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 435 | (\<forall>e >0. \<exists>d>0. \<forall>x \<in> S. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 436 | by (auto simp: tendsto_iff eventually_at) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 437 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 438 | corollary Lim_withinI [intro?]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 439 | assumes "\<And>e. e > 0 \<Longrightarrow> \<exists>d>0. \<forall>x \<in> S. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l \<le> e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 440 | shows "(f \<longlongrightarrow> l) (at a within S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 441 | apply (simp add: Lim_within, clarify) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 442 | apply (rule ex_forward [OF assms [OF half_gt_zero]], auto) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 443 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 444 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 445 | proposition Lim_at: "(f \<longlongrightarrow> l) (at a) \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 446 | (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 447 | by (auto simp: tendsto_iff eventually_at) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 448 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 449 | lemma Lim_transform_within_set: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 450 | fixes a :: "'a::metric_space" and l :: "'b::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 451 | shows "\<lbrakk>(f \<longlongrightarrow> l) (at a within S); eventually (\<lambda>x. x \<in> S \<longleftrightarrow> x \<in> T) (at a)\<rbrakk> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 452 | \<Longrightarrow> (f \<longlongrightarrow> l) (at a within T)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 453 | apply (clarsimp simp: eventually_at Lim_within) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 454 | apply (drule_tac x=e in spec, clarify) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 455 | apply (rename_tac k) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 456 | apply (rule_tac x="min d k" in exI, simp) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 457 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 458 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 459 | text \<open>Another limit point characterization.\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 460 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 461 | lemma limpt_sequential_inj: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 462 | fixes x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 463 | shows "x islimpt S \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 464 |          (\<exists>f. (\<forall>n::nat. f n \<in> S - {x}) \<and> inj f \<and> (f \<longlongrightarrow> x) sequentially)"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 465 | (is "?lhs = ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 466 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 467 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 468 | then have "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 469 | by (force simp: islimpt_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 470 | then obtain y where y: "\<And>e. e>0 \<Longrightarrow> y e \<in> S \<and> y e \<noteq> x \<and> dist (y e) x < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 471 | by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 472 | define f where "f \<equiv> rec_nat (y 1) (\<lambda>n fn. y (min (inverse(2 ^ (Suc n))) (dist fn x)))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 473 | have [simp]: "f 0 = y 1" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 474 | "f(Suc n) = y (min (inverse(2 ^ (Suc n))) (dist (f n) x))" for n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 475 | by (simp_all add: f_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 476 | have f: "f n \<in> S \<and> (f n \<noteq> x) \<and> dist (f n) x < inverse(2 ^ n)" for n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 477 | proof (induction n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 478 | case 0 show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 479 | by (simp add: y) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 480 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 481 | case (Suc n) then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 482 | apply (auto simp: y) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 483 | by (metis half_gt_zero_iff inverse_positive_iff_positive less_divide_eq_numeral1(1) min_less_iff_conj y zero_less_dist_iff zero_less_numeral zero_less_power) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 484 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 485 | show ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 486 | proof (rule_tac x=f in exI, intro conjI allI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 487 |     show "\<And>n. f n \<in> S - {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 488 | using f by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 489 | have "dist (f n) x < dist (f m) x" if "m < n" for m n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 490 | using that | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 491 | proof (induction n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 492 | case 0 then show ?case by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 493 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 494 | case (Suc n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 495 | then consider "m < n" | "m = n" using less_Suc_eq by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 496 | then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 497 | proof cases | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 498 | assume "m < n" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 499 | have "dist (f(Suc n)) x = dist (y (min (inverse(2 ^ (Suc n))) (dist (f n) x))) x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 500 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 501 | also have "\<dots> < dist (f n) x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 502 | by (metis dist_pos_lt f min.strict_order_iff min_less_iff_conj y) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 503 | also have "\<dots> < dist (f m) x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 504 | using Suc.IH \<open>m < n\<close> by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 505 | finally show ?thesis . | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 506 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 507 | assume "m = n" then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 508 | by simp (metis dist_pos_lt f half_gt_zero_iff inverse_positive_iff_positive min_less_iff_conj y zero_less_numeral zero_less_power) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 509 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 510 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 511 | then show "inj f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 512 | by (metis less_irrefl linorder_injI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 513 | show "f \<longlonglongrightarrow> x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 514 | apply (rule tendstoI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 515 | apply (rule_tac c="nat (ceiling(1/e))" in eventually_sequentiallyI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 516 | apply (rule less_trans [OF f [THEN conjunct2, THEN conjunct2]]) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 517 | apply (simp add: field_simps) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 518 | by (meson le_less_trans mult_less_cancel_left not_le of_nat_less_two_power) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 519 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 520 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 521 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 522 | then show ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 523 | by (fastforce simp add: islimpt_approachable lim_sequentially) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 524 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 525 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 526 | lemma Lim_dist_ubound: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 527 | assumes "\<not>(trivial_limit net)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 528 | and "(f \<longlongrightarrow> l) net" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 529 | and "eventually (\<lambda>x. dist a (f x) \<le> e) net" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 530 | shows "dist a l \<le> e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 531 | using assms by (fast intro: tendsto_le tendsto_intros) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 532 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 533 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 534 | subsection \<open>Continuity\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 535 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 536 | text\<open>Derive the epsilon-delta forms, which we often use as "definitions"\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 537 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 538 | proposition continuous_within_eps_delta: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 539 | "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'\<in> s. dist x' x < d --> dist (f x') (f x) < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 540 | unfolding continuous_within and Lim_within by fastforce | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 541 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 542 | corollary continuous_at_eps_delta: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 543 | "continuous (at x) f \<longleftrightarrow> (\<forall>e > 0. \<exists>d > 0. \<forall>x'. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 544 | using continuous_within_eps_delta [of x UNIV f] by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 545 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 546 | lemma continuous_at_right_real_increasing: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 547 | fixes f :: "real \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 548 | assumes nondecF: "\<And>x y. x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 549 | shows "continuous (at_right a) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 550 | apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 551 | apply (intro all_cong ex_cong, safe) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 552 | apply (erule_tac x="a + d" in allE, simp) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 553 | apply (simp add: nondecF field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 554 | apply (drule nondecF, simp) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 555 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 556 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 557 | lemma continuous_at_left_real_increasing: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 558 | assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 559 | shows "(continuous (at_left (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 560 | apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 561 | apply (intro all_cong ex_cong, safe) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 562 | apply (erule_tac x="a - d" in allE, simp) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 563 | apply (simp add: nondecF field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 564 | apply (cut_tac x="a - d" and y=x in nondecF, simp_all) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 565 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 566 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 567 | text\<open>Versions in terms of open balls.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 568 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 569 | lemma continuous_within_ball: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 570 | "continuous (at x within s) f \<longleftrightarrow> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 571 | (\<forall>e > 0. \<exists>d > 0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 572 | (is "?lhs = ?rhs") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 573 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 574 | assume ?lhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 575 |   {
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 576 | fix e :: real | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 577 | assume "e > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 578 | then obtain d where d: "d>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 579 | using \<open>?lhs\<close>[unfolded continuous_within Lim_within] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 580 |     {
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 581 | fix y | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 582 | assume "y \<in> f ` (ball x d \<inter> s)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 583 | then have "y \<in> ball (f x) e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 584 | using d(2) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 585 | using \<open>e > 0\<close> | 
| 70960 | 586 | by (auto simp: dist_commute) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 587 | } | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 588 | then have "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 589 | using \<open>d > 0\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 590 | unfolding subset_eq ball_def by (auto simp: dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 591 | } | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 592 | then show ?rhs by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 593 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 594 | assume ?rhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 595 | then show ?lhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 596 | unfolding continuous_within Lim_within ball_def subset_eq | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 597 | apply (auto simp: dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 598 | apply (erule_tac x=e in allE, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 599 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 600 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 601 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 602 | lemma continuous_at_ball: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 603 | "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 604 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 605 | assume ?lhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 606 | then show ?rhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 607 | unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | 
| 72225 | 608 | by (metis dist_commute dist_pos_lt dist_self) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 609 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 610 | assume ?rhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 611 | then show ?lhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 612 | unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | 
| 72225 | 613 | by (metis dist_commute) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 614 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 615 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 616 | text\<open>Define setwise continuity in terms of limits within the set.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 617 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 618 | lemma continuous_on_iff: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 619 | "continuous_on s f \<longleftrightarrow> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 620 | (\<forall>x\<in>s. \<forall>e>0. \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 621 | unfolding continuous_on_def Lim_within | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 622 | by (metis dist_pos_lt dist_self) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 623 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 624 | lemma continuous_within_E: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 625 | assumes "continuous (at x within s) f" "e>0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 626 | obtains d where "d>0" "\<And>x'. \<lbrakk>x'\<in> s; dist x' x \<le> d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 627 | using assms apply (simp add: continuous_within_eps_delta) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 628 | apply (drule spec [of _ e], clarify) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 629 | apply (rule_tac d="d/2" in that, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 630 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 631 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 632 | lemma continuous_onI [intro?]: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 633 | assumes "\<And>x e. \<lbrakk>e > 0; x \<in> s\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) \<le> e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 634 | shows "continuous_on s f" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 635 | apply (simp add: continuous_on_iff, clarify) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 636 | apply (rule ex_forward [OF assms [OF half_gt_zero]], auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 637 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 638 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 639 | text\<open>Some simple consequential lemmas.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 640 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 641 | lemma continuous_onE: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 642 | assumes "continuous_on s f" "x\<in>s" "e>0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 643 | obtains d where "d>0" "\<And>x'. \<lbrakk>x' \<in> s; dist x' x \<le> d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 644 | using assms | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 645 | apply (simp add: continuous_on_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 646 | apply (elim ballE allE) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 647 | apply (auto intro: that [where d="d/2" for d]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 648 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 649 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 650 | text\<open>The usual transformation theorems.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 651 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 652 | lemma continuous_transform_within: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 653 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 654 | assumes "continuous (at x within s) f" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 655 | and "0 < d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 656 | and "x \<in> s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 657 | and "\<And>x'. \<lbrakk>x' \<in> s; dist x' x < d\<rbrakk> \<Longrightarrow> f x' = g x'" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 658 | shows "continuous (at x within s) g" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 659 | using assms | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 660 | unfolding continuous_within | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 661 | by (force intro: Lim_transform_within) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 662 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 663 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 664 | subsection \<open>Closure and Limit Characterization\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 665 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 666 | lemma closure_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 667 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 668 | shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 669 | apply (auto simp: closure_def islimpt_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 670 | apply (metis dist_self) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 671 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 672 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 673 | lemma closure_approachable_le: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 674 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 675 | shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 676 | unfolding closure_approachable | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 677 | using dense by force | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 678 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 679 | lemma closure_approachableD: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 680 | assumes "x \<in> closure S" "e>0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 681 | shows "\<exists>y\<in>S. dist x y < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 682 | using assms unfolding closure_approachable by (auto simp: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 683 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 684 | lemma closed_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 685 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 686 | shows "closed S \<Longrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 687 | by (metis closure_closed closure_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 688 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 689 | lemma closure_contains_Inf: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 690 | fixes S :: "real set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 691 |   assumes "S \<noteq> {}" "bdd_below S"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 692 | shows "Inf S \<in> closure S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 693 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 694 | have *: "\<forall>x\<in>S. Inf S \<le> x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 695 | using cInf_lower[of _ S] assms by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 696 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 697 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 698 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 699 | then have "Inf S < Inf S + e" by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 700 | with assms obtain x where "x \<in> S" "x < Inf S + e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 701 | by (subst (asm) cInf_less_iff) auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 702 | with * have "\<exists>x\<in>S. dist x (Inf S) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 703 | by (intro bexI[of _ x]) (auto simp: dist_real_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 704 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 705 | then show ?thesis unfolding closure_approachable by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 706 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 707 | |
| 70617 | 708 | lemma closure_contains_Sup: | 
| 709 | fixes S :: "real set" | |
| 710 |   assumes "S \<noteq> {}" "bdd_above S"
 | |
| 711 | shows "Sup S \<in> closure S" | |
| 712 | proof - | |
| 713 | have *: "\<forall>x\<in>S. x \<le> Sup S" | |
| 714 | using cSup_upper[of _ S] assms by metis | |
| 715 |   {
 | |
| 716 | fix e :: real | |
| 717 | assume "e > 0" | |
| 718 | then have "Sup S - e < Sup S" by simp | |
| 719 | with assms obtain x where "x \<in> S" "Sup S - e < x" | |
| 720 | by (subst (asm) less_cSup_iff) auto | |
| 721 | with * have "\<exists>x\<in>S. dist x (Sup S) < e" | |
| 722 | by (intro bexI[of _ x]) (auto simp: dist_real_def) | |
| 723 | } | |
| 724 | then show ?thesis unfolding closure_approachable by auto | |
| 725 | qed | |
| 726 | ||
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 727 | lemma not_trivial_limit_within_ball: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 728 |   "\<not> trivial_limit (at x within S) \<longleftrightarrow> (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 729 | (is "?lhs \<longleftrightarrow> ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 730 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 731 | show ?rhs if ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 732 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 733 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 734 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 735 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 736 |       then obtain y where "y \<in> S - {x}" and "dist y x < e"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 737 |         using \<open>?lhs\<close> not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 738 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 739 |       then have "y \<in> S \<inter> ball x e - {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 740 | unfolding ball_def by (simp add: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 741 |       then have "S \<inter> ball x e - {x} \<noteq> {}" by blast
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 742 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 743 | then show ?thesis by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 744 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 745 | show ?lhs if ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 746 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 747 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 748 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 749 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 750 |       then obtain y where "y \<in> S \<inter> ball x e - {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 751 | using \<open>?rhs\<close> by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 752 |       then have "y \<in> S - {x}" and "dist y x < e"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 753 | unfolding ball_def by (simp_all add: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 754 |       then have "\<exists>y \<in> S - {x}. dist y x < e"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 755 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 756 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 757 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 758 |       using not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 759 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 760 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 761 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 762 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 763 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 764 | subsection \<open>Boundedness\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 765 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 766 | (* FIXME: This has to be unified with BSEQ!! *) | 
| 70136 | 767 | definition\<^marker>\<open>tag important\<close> (in metric_space) bounded :: "'a set \<Rightarrow> bool" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 768 | where "bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 769 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 770 | lemma bounded_subset_cball: "bounded S \<longleftrightarrow> (\<exists>e x. S \<subseteq> cball x e \<and> 0 \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 771 | unfolding bounded_def subset_eq by auto (meson order_trans zero_le_dist) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 772 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 773 | lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 774 | unfolding bounded_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 775 | by auto (metis add.commute add_le_cancel_right dist_commute dist_triangle_le) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 776 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 777 | lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 778 | unfolding bounded_any_center [where a=0] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 779 | by (simp add: dist_norm) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 780 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 781 | lemma bdd_above_norm: "bdd_above (norm ` X) \<longleftrightarrow> bounded X" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 782 | by (simp add: bounded_iff bdd_above_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 783 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 784 | lemma bounded_norm_comp: "bounded ((\<lambda>x. norm (f x)) ` S) = bounded (f ` S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 785 | by (simp add: bounded_iff) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 786 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 787 | lemma boundedI: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 788 | assumes "\<And>x. x \<in> S \<Longrightarrow> norm x \<le> B" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 789 | shows "bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 790 | using assms bounded_iff by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 791 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 792 | lemma bounded_empty [simp]: "bounded {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 793 | by (simp add: bounded_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 794 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 795 | lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T \<Longrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 796 | by (metis bounded_def subset_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 797 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 798 | lemma bounded_interior[intro]: "bounded S \<Longrightarrow> bounded(interior S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 799 | by (metis bounded_subset interior_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 800 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 801 | lemma bounded_closure[intro]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 802 | assumes "bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 803 | shows "bounded (closure S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 804 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 805 | from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 806 | unfolding bounded_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 807 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 808 | fix y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 809 | assume "y \<in> closure S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 810 | then obtain f where f: "\<forall>n. f n \<in> S" "(f \<longlongrightarrow> y) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 811 | unfolding closure_sequential by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 812 | have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 813 | then have "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 814 | by (simp add: f(1)) | 
| 72225 | 815 | then have "dist x y \<le> a" | 
| 816 | using Lim_dist_ubound f(2) trivial_limit_sequentially by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 817 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 818 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 819 | unfolding bounded_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 820 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 821 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 822 | lemma bounded_closure_image: "bounded (f ` closure S) \<Longrightarrow> bounded (f ` S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 823 | by (simp add: bounded_subset closure_subset image_mono) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 824 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 825 | lemma bounded_cball[simp,intro]: "bounded (cball x e)" | 
| 72225 | 826 | unfolding bounded_def using mem_cball by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 827 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 828 | lemma bounded_ball[simp,intro]: "bounded (ball x e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 829 | by (metis ball_subset_cball bounded_cball bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 830 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 831 | lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 832 | by (auto simp: bounded_def) (metis Un_iff bounded_any_center le_max_iff_disj) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 833 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 834 | lemma bounded_Union[intro]: "finite F \<Longrightarrow> \<forall>S\<in>F. bounded S \<Longrightarrow> bounded (\<Union>F)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 835 | by (induct rule: finite_induct[of F]) auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 836 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 837 | lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)" | 
| 72225 | 838 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 839 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 840 | lemma bounded_insert [simp]: "bounded (insert x S) \<longleftrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 841 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 842 |   have "\<forall>y\<in>{x}. dist x y \<le> 0"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 843 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 844 |   then have "bounded {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 845 | unfolding bounded_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 846 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 847 | by (metis insert_is_Un bounded_Un) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 848 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 849 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 850 | lemma bounded_subset_ballI: "S \<subseteq> ball x r \<Longrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 851 | by (meson bounded_ball bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 852 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 853 | lemma bounded_subset_ballD: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 854 | assumes "bounded S" shows "\<exists>r. 0 < r \<and> S \<subseteq> ball x r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 855 | proof - | 
| 70960 | 856 | obtain e::real and y where "S \<subseteq> cball y e" "0 \<le> e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 857 | using assms by (auto simp: bounded_subset_cball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 858 | then show ?thesis | 
| 70960 | 859 | by (intro exI[where x="dist x y + e + 1"]) metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 860 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 861 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 862 | lemma finite_imp_bounded [intro]: "finite S \<Longrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 863 | by (induct set: finite) simp_all | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 864 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 865 | lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 866 | by (metis Int_lower1 Int_lower2 bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 867 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 868 | lemma bounded_diff[intro]: "bounded S \<Longrightarrow> bounded (S - T)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 869 | by (metis Diff_subset bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 870 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 871 | lemma bounded_dist_comp: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 872 | assumes "bounded (f ` S)" "bounded (g ` S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 873 | shows "bounded ((\<lambda>x. dist (f x) (g x)) ` S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 874 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 875 | from assms obtain M1 M2 where *: "dist (f x) undefined \<le> M1" "dist undefined (g x) \<le> M2" if "x \<in> S" for x | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 876 | by (auto simp: bounded_any_center[of _ undefined] dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 877 | have "dist (f x) (g x) \<le> M1 + M2" if "x \<in> S" for x | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 878 | using *[OF that] | 
| 70960 | 879 | by metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 880 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 881 | by (auto intro!: boundedI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 882 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 883 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 884 | lemma bounded_Times: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 885 | assumes "bounded s" "bounded t" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 886 | shows "bounded (s \<times> t)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 887 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 888 | obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 889 | using assms [unfolded bounded_def] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 890 | then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<^sup>2 + b\<^sup>2)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 891 | by (auto simp: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 892 | then show ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 893 | qed | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 894 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 895 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 896 | subsection \<open>Compactness\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 897 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 898 | lemma compact_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 899 | assumes "compact U" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 900 | shows "bounded U" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 901 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 902 | have "compact U" "\<forall>x\<in>U. open (ball x 1)" "U \<subseteq> (\<Union>x\<in>U. ball x 1)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 903 | using assms by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 904 | then obtain D where D: "D \<subseteq> U" "finite D" "U \<subseteq> (\<Union>x\<in>D. ball x 1)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 905 | by (metis compactE_image) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 906 | from \<open>finite D\<close> have "bounded (\<Union>x\<in>D. ball x 1)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 907 | by (simp add: bounded_UN) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 908 | then show "bounded U" using \<open>U \<subseteq> (\<Union>x\<in>D. ball x 1)\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 909 | by (rule bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 910 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 911 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 912 | lemma closure_Int_ball_not_empty: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 913 | assumes "S \<subseteq> closure T" "x \<in> S" "r > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 914 |   shows "T \<inter> ball x r \<noteq> {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 915 | using assms centre_in_ball closure_iff_nhds_not_empty by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 916 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 917 | lemma compact_sup_maxdistance: | 
| 72225 | 918 | fixes S :: "'a::metric_space set" | 
| 919 | assumes "compact S" | |
| 920 |     and "S \<noteq> {}"
 | |
| 921 | shows "\<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 922 | proof - | 
| 72225 | 923 | have "compact (S \<times> S)" | 
| 924 | using \<open>compact S\<close> by (intro compact_Times) | |
| 925 |   moreover have "S \<times> S \<noteq> {}"
 | |
| 926 |     using \<open>S \<noteq> {}\<close> by auto
 | |
| 927 | moreover have "continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 928 | by (intro continuous_at_imp_continuous_on ballI continuous_intros) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 929 | ultimately show ?thesis | 
| 72225 | 930 | using continuous_attains_sup[of "S \<times> S" "\<lambda>x. dist (fst x) (snd x)"] by auto | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 931 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 932 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 933 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 934 | subsubsection\<open>Totally bounded\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 935 | |
| 72225 | 936 | lemma cauchy_def: "Cauchy S \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N \<longrightarrow> dist (S m) (S n) < e)" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 937 | unfolding Cauchy_def by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 938 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 939 | proposition seq_compact_imp_totally_bounded: | 
| 72225 | 940 | assumes "seq_compact S" | 
| 941 | shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> S \<and> S \<subseteq> (\<Union>x\<in>k. ball x e)" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 942 | proof - | 
| 72225 | 943 |   { fix e::real assume "e > 0" assume *: "\<And>k. finite k \<Longrightarrow> k \<subseteq> S \<Longrightarrow> \<not> S \<subseteq> (\<Union>x\<in>k. ball x e)"
 | 
| 944 | let ?Q = "\<lambda>x n r. r \<in> S \<and> (\<forall>m < (n::nat). \<not> (dist (x m) r < e))" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 945 | have "\<exists>x. \<forall>n::nat. ?Q x n (x n)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 946 | proof (rule dependent_wellorder_choice) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 947 | fix n x assume "\<And>y. y < n \<Longrightarrow> ?Q x y (x y)" | 
| 72225 | 948 |       then have "\<not> S \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)"
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 949 |         using *[of "x ` {0 ..< n}"] by (auto simp: subset_eq)
 | 
| 72225 | 950 |       then obtain z where z:"z\<in>S" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)"
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 951 | unfolding subset_eq by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 952 | show "\<exists>r. ?Q x n r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 953 | using z by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 954 | qed simp | 
| 72225 | 955 | then obtain x where "\<forall>n::nat. x n \<in> S" and x:"\<And>n m. m < n \<Longrightarrow> \<not> (dist (x m) (x n) < e)" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 956 | by blast | 
| 72225 | 957 | then obtain l r where "l \<in> S" and r:"strict_mono r" and "((x \<circ> r) \<longlongrightarrow> l) sequentially" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 958 | using assms by (metis seq_compact_def) | 
| 72225 | 959 | then have "Cauchy (x \<circ> r)" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 960 | using LIMSEQ_imp_Cauchy by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 961 | then obtain N::nat where "\<And>m n. N \<le> m \<Longrightarrow> N \<le> n \<Longrightarrow> dist ((x \<circ> r) m) ((x \<circ> r) n) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 962 | unfolding cauchy_def using \<open>e > 0\<close> by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 963 | then have False | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 964 | using x[of "r N" "r (N+1)"] r by (auto simp: strict_mono_def) } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 965 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 966 | by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 967 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 968 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 969 | subsubsection\<open>Heine-Borel theorem\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 970 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 971 | proposition seq_compact_imp_Heine_Borel: | 
| 72225 | 972 | fixes S :: "'a :: metric_space set" | 
| 973 | assumes "seq_compact S" | |
| 974 | shows "compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 975 | proof - | 
| 72225 | 976 | from seq_compact_imp_totally_bounded[OF \<open>seq_compact S\<close>] | 
| 977 | obtain f where f: "\<forall>e>0. finite (f e) \<and> f e \<subseteq> S \<and> S \<subseteq> (\<Union>x\<in>f e. ball x e)" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 978 | unfolding choice_iff' .. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 979 |   define K where "K = (\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
 | 
| 72225 | 980 | have "countably_compact S" | 
| 981 | using \<open>seq_compact S\<close> by (rule seq_compact_imp_countably_compact) | |
| 982 | then show "compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 983 | proof (rule countably_compact_imp_compact) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 984 | show "countable K" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 985 | unfolding K_def using f | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 986 | by (auto intro: countable_finite countable_subset countable_rat | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 987 | intro!: countable_image countable_SIGMA countable_UN) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 988 | show "\<forall>b\<in>K. open b" by (auto simp: K_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 989 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 990 | fix T x | 
| 72225 | 991 | assume T: "open T" "x \<in> T" and x: "x \<in> S" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 992 | from openE[OF T] obtain e where "0 < e" "ball x e \<subseteq> T" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 993 | by auto | 
| 72225 | 994 | then have "0 < e/2" "ball x (e/2) \<subseteq> T" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 995 | by auto | 
| 72225 | 996 | from Rats_dense_in_real[OF \<open>0 < e/2\<close>] obtain r where "r \<in> \<rat>" "0 < r" "r < e/2" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 997 | by auto | 
| 72225 | 998 | from f[rule_format, of r] \<open>0 < r\<close> \<open>x \<in> S\<close> obtain k where "k \<in> f r" "x \<in> ball k r" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 999 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1000 | from \<open>r \<in> \<rat>\<close> \<open>0 < r\<close> \<open>k \<in> f r\<close> have "ball k r \<in> K" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1001 | by (auto simp: K_def) | 
| 72225 | 1002 | then show "\<exists>b\<in>K. x \<in> b \<and> b \<inter> S \<subseteq> T" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1003 | proof (rule bexI[rotated], safe) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1004 | fix y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1005 | assume "y \<in> ball k r" | 
| 72225 | 1006 | with \<open>r < e/2\<close> \<open>x \<in> ball k r\<close> have "dist x y < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1007 | by (intro dist_triangle_half_r [of k _ e]) (auto simp: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1008 | with \<open>ball x e \<subseteq> T\<close> show "y \<in> T" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1009 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1010 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1011 | show "x \<in> ball k r" by fact | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1012 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1013 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1014 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1015 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1016 | proposition compact_eq_seq_compact_metric: | 
| 72225 | 1017 | "compact (S :: 'a::metric_space set) \<longleftrightarrow> seq_compact S" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1018 | using compact_imp_seq_compact seq_compact_imp_Heine_Borel by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1019 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1020 | proposition compact_def: \<comment> \<open>this is the definition of compactness in HOL Light\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1021 | "compact (S :: 'a::metric_space set) \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1022 | (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1023 | unfolding compact_eq_seq_compact_metric seq_compact_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1024 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1025 | subsubsection \<open>Complete the chain of compactness variants\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1026 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1027 | proposition compact_eq_Bolzano_Weierstrass: | 
| 72225 | 1028 | fixes S :: "'a::metric_space set" | 
| 1029 | shows "compact S \<longleftrightarrow> (\<forall>T. infinite T \<and> T \<subseteq> S \<longrightarrow> (\<exists>x \<in> S. x islimpt T))" | |
| 1030 | using Bolzano_Weierstrass_imp_seq_compact Heine_Borel_imp_Bolzano_Weierstrass compact_eq_seq_compact_metric | |
| 1031 | by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1032 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1033 | proposition Bolzano_Weierstrass_imp_bounded: | 
| 72225 | 1034 | "(\<And>T. \<lbrakk>infinite T; T \<subseteq> S\<rbrakk> \<Longrightarrow> (\<exists>x \<in> S. x islimpt T)) \<Longrightarrow> bounded S" | 
| 1035 | using compact_imp_bounded unfolding compact_eq_Bolzano_Weierstrass by metis | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1036 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1037 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1038 | subsection \<open>Banach fixed point theorem\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1039 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1040 | theorem banach_fix:\<comment> \<open>TODO: rename to \<open>Banach_fix\<close>\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1041 |   assumes s: "complete s" "s \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1042 | and c: "0 \<le> c" "c < 1" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1043 | and f: "f ` s \<subseteq> s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1044 | and lipschitz: "\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1045 | shows "\<exists>!x\<in>s. f x = x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1046 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1047 | from c have "1 - c > 0" by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1048 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1049 | from s(2) obtain z0 where z0: "z0 \<in> s" by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1050 | define z where "z n = (f ^^ n) z0" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1051 | with f z0 have z_in_s: "z n \<in> s" for n :: nat | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1052 | by (induct n) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1053 | define d where "d = dist (z 0) (z 1)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1054 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1055 | have fzn: "f (z n) = z (Suc n)" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1056 | by (simp add: z_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1057 | have cf_z: "dist (z n) (z (Suc n)) \<le> (c ^ n) * d" for n :: nat | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1058 | proof (induct n) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1059 | case 0 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1060 | then show ?case | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1061 | by (simp add: d_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1062 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1063 | case (Suc m) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1064 | with \<open>0 \<le> c\<close> have "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1065 | using mult_left_mono[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1066 | then show ?case | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1067 | using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1068 | by (simp add: fzn mult_le_cancel_left) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1069 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1070 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1071 | have cf_z2: "(1 - c) * dist (z m) (z (m + n)) \<le> (c ^ m) * d * (1 - c ^ n)" for n m :: nat | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1072 | proof (induct n) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1073 | case 0 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1074 | show ?case by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1075 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1076 | case (Suc k) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1077 | from c have "(1 - c) * dist (z m) (z (m + Suc k)) \<le> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1078 | (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1079 | by (simp add: dist_triangle) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1080 | also from c cf_z[of "m + k"] have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1081 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1082 | also from Suc have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1083 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1084 | also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1085 | by (simp add: power_add field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1086 | also from c have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1087 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1088 | finally show ?case by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1089 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1090 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1091 | have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e" if "e > 0" for e | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1092 | proof (cases "d = 0") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1093 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1094 | from \<open>1 - c > 0\<close> have "(1 - c) * x \<le> 0 \<longleftrightarrow> x \<le> 0" for x | 
| 72569 
d56e4eeae967
mult_le_cancel_iff1, mult_le_cancel_iff2, mult_less_iff1 generalised from the real_ versions
 paulson <lp15@cam.ac.uk> parents: 
72228diff
changeset | 1095 | by (simp add: mult_le_0_iff) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1096 | with c cf_z2[of 0] True have "z n = z0" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1097 | by (simp add: z_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1098 | with \<open>e > 0\<close> show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1099 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1100 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1101 | with zero_le_dist[of "z 0" "z 1"] have "d > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1102 | by (metis d_def less_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1103 | with \<open>1 - c > 0\<close> \<open>e > 0\<close> have "0 < e * (1 - c) / d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1104 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1105 | with c obtain N where N: "c ^ N < e * (1 - c) / d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1106 | using real_arch_pow_inv[of "e * (1 - c) / d" c] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1107 | have *: "dist (z m) (z n) < e" if "m > n" and as: "m \<ge> N" "n \<ge> N" for m n :: nat | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1108 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1109 | from c \<open>n \<ge> N\<close> have *: "c ^ n \<le> c ^ N" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1110 | using power_decreasing[OF \<open>n\<ge>N\<close>, of c] by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1111 | from c \<open>m > n\<close> have "1 - c ^ (m - n) > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1112 | using power_strict_mono[of c 1 "m - n"] by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1113 | with \<open>d > 0\<close> \<open>0 < 1 - c\<close> have **: "d * (1 - c ^ (m - n)) / (1 - c) > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1114 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1115 | from cf_z2[of n "m - n"] \<open>m > n\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1116 | have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1117 | by (simp add: pos_le_divide_eq[OF \<open>1 - c > 0\<close>] mult.commute dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1118 | also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1119 | using mult_right_mono[OF * order_less_imp_le[OF **]] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1120 | by (simp add: mult.assoc) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1121 | also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1122 | using mult_strict_right_mono[OF N **] by (auto simp: mult.assoc) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1123 | also from c \<open>d > 0\<close> \<open>1 - c > 0\<close> have "\<dots> = e * (1 - c ^ (m - n))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1124 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1125 | also from c \<open>1 - c ^ (m - n) > 0\<close> \<open>e > 0\<close> have "\<dots> \<le> e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1126 | using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1127 | finally show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1128 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1129 | have "dist (z n) (z m) < e" if "N \<le> m" "N \<le> n" for m n :: nat | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1130 | proof (cases "n = m") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1131 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1132 | with \<open>e > 0\<close> show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1133 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1134 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1135 | with *[of n m] *[of m n] and that show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1136 | by (auto simp: dist_commute nat_neq_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1137 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1138 | then show ?thesis by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1139 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1140 | then have "Cauchy z" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1141 | by (simp add: cauchy_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1142 | then obtain x where "x\<in>s" and x:"(z \<longlongrightarrow> x) sequentially" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1143 | using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1144 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1145 | define e where "e = dist (f x) x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1146 | have "e = 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1147 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1148 | assume "e \<noteq> 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1149 | then have "e > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1150 | unfolding e_def using zero_le_dist[of "f x" x] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1151 | by (metis dist_eq_0_iff dist_nz e_def) | 
| 72225 | 1152 | then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e/2" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1153 | using x[unfolded lim_sequentially, THEN spec[where x="e/2"]] by auto | 
| 72225 | 1154 | then have N':"dist (z N) x < e/2" by auto | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1155 | have *: "c * dist (z N) x \<le> dist (z N) x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1156 | unfolding mult_le_cancel_right2 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1157 | using zero_le_dist[of "z N" x] and c | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1158 | by (metis dist_eq_0_iff dist_nz order_less_asym less_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1159 | have "dist (f (z N)) (f x) \<le> c * dist (z N) x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1160 | using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1161 | using z_in_s[of N] \<open>x\<in>s\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1162 | using c | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1163 | by auto | 
| 72225 | 1164 | also have "\<dots> < e/2" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1165 | using N' and c using * by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1166 | finally show False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1167 | unfolding fzn | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1168 | using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1169 | unfolding e_def | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1170 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1171 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1172 | then have "f x = x" by (auto simp: e_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1173 | moreover have "y = x" if "f y = y" "y \<in> s" for y | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1174 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1175 | from \<open>x \<in> s\<close> \<open>f x = x\<close> that have "dist x y \<le> c * dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1176 | using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]] by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1177 | with c and zero_le_dist[of x y] have "dist x y = 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1178 | by (simp add: mult_le_cancel_right1) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1179 | then show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1180 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1181 | ultimately show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1182 | using \<open>x\<in>s\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1183 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1184 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1185 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1186 | subsection \<open>Edelstein fixed point theorem\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1187 | |
| 72225 | 1188 | theorem Edelstein_fix: | 
| 1189 | fixes S :: "'a::metric_space set" | |
| 1190 |   assumes S: "compact S" "S \<noteq> {}"
 | |
| 1191 | and gs: "(g ` S) \<subseteq> S" | |
| 1192 | and dist: "\<forall>x\<in>S. \<forall>y\<in>S. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y" | |
| 1193 | shows "\<exists>!x\<in>S. g x = x" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1194 | proof - | 
| 72225 | 1195 | let ?D = "(\<lambda>x. (x, x)) ` S" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1196 |   have D: "compact ?D" "?D \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1197 | by (rule compact_continuous_image) | 
| 72225 | 1198 | (auto intro!: S continuous_Pair continuous_ident simp: continuous_on_eq_continuous_within) | 
| 1199 | ||
| 1200 | have "\<And>x y e. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> 0 < e \<Longrightarrow> dist y x < e \<Longrightarrow> dist (g y) (g x) < e" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1201 | using dist by fastforce | 
| 72225 | 1202 | then have "continuous_on S g" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1203 | by (auto simp: continuous_on_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1204 | then have cont: "continuous_on ?D (\<lambda>x. dist ((g \<circ> fst) x) (snd x))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1205 | unfolding continuous_on_eq_continuous_within | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1206 | by (intro continuous_dist ballI continuous_within_compose) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1207 | (auto intro!: continuous_fst continuous_snd continuous_ident simp: image_image) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1208 | |
| 72225 | 1209 | obtain a where "a \<in> S" and le: "\<And>x. x \<in> S \<Longrightarrow> dist (g a) a \<le> dist (g x) x" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1210 | using continuous_attains_inf[OF D cont] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1211 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1212 | have "g a = a" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1213 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1214 | assume "g a \<noteq> a" | 
| 72225 | 1215 | with \<open>a \<in> S\<close> gs have "dist (g (g a)) (g a) < dist (g a) a" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1216 | by (intro dist[rule_format]) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1217 | moreover have "dist (g a) a \<le> dist (g (g a)) (g a)" | 
| 72225 | 1218 | using \<open>a \<in> S\<close> gs by (intro le) auto | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1219 | ultimately show False by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1220 | qed | 
| 72225 | 1221 | moreover have "\<And>x. x \<in> S \<Longrightarrow> g x = x \<Longrightarrow> x = a" | 
| 1222 | using dist[THEN bspec[where x=a]] \<open>g a = a\<close> and \<open>a\<in>S\<close> by auto | |
| 1223 | ultimately show "\<exists>!x\<in>S. g x = x" | |
| 1224 | using \<open>a \<in> S\<close> by blast | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1225 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1226 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1227 | subsection \<open>The diameter of a set\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1228 | |
| 70136 | 1229 | definition\<^marker>\<open>tag important\<close> diameter :: "'a::metric_space set \<Rightarrow> real" where | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1230 |   "diameter S = (if S = {} then 0 else SUP (x,y)\<in>S\<times>S. dist x y)"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1231 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1232 | lemma diameter_empty [simp]: "diameter{} = 0"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1233 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1234 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1235 | lemma diameter_singleton [simp]: "diameter{x} = 0"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1236 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1237 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1238 | lemma diameter_le: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1239 |   assumes "S \<noteq> {} \<or> 0 \<le> d"
 | 
| 72225 | 1240 | and no: "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> norm(x - y) \<le> d" | 
| 1241 | shows "diameter S \<le> d" | |
| 1242 | using assms | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1243 | by (auto simp: dist_norm diameter_def intro: cSUP_least) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1244 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1245 | lemma diameter_bounded_bound: | 
| 72225 | 1246 | fixes S :: "'a :: metric_space set" | 
| 1247 | assumes S: "bounded S" "x \<in> S" "y \<in> S" | |
| 1248 | shows "dist x y \<le> diameter S" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1249 | proof - | 
| 72225 | 1250 | from S obtain z d where z: "\<And>x. x \<in> S \<Longrightarrow> dist z x \<le> d" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1251 | unfolding bounded_def by auto | 
| 72225 | 1252 | have "bdd_above (case_prod dist ` (S\<times>S))" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1253 | proof (intro bdd_aboveI, safe) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1254 | fix a b | 
| 72225 | 1255 | assume "a \<in> S" "b \<in> S" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1256 | with z[of a] z[of b] dist_triangle[of a b z] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1257 | show "dist a b \<le> 2 * d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1258 | by (simp add: dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1259 | qed | 
| 72225 | 1260 | moreover have "(x,y) \<in> S\<times>S" using S by auto | 
| 1261 | ultimately have "dist x y \<le> (SUP (x,y)\<in>S\<times>S. dist x y)" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1262 | by (rule cSUP_upper2) simp | 
| 72225 | 1263 | with \<open>x \<in> S\<close> show ?thesis | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1264 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1265 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1266 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1267 | lemma diameter_lower_bounded: | 
| 72225 | 1268 | fixes S :: "'a :: metric_space set" | 
| 1269 | assumes S: "bounded S" | |
| 1270 | and d: "0 < d" "d < diameter S" | |
| 1271 | shows "\<exists>x\<in>S. \<exists>y\<in>S. d < dist x y" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1272 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1273 | assume contr: "\<not> ?thesis" | 
| 72225 | 1274 |   moreover have "S \<noteq> {}"
 | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1275 | using d by (auto simp: diameter_def) | 
| 72225 | 1276 | ultimately have "diameter S \<le> d" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1277 | by (auto simp: not_less diameter_def intro!: cSUP_least) | 
| 72225 | 1278 | with \<open>d < diameter S\<close> show False by auto | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1279 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1280 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1281 | lemma diameter_bounded: | 
| 72225 | 1282 | assumes "bounded S" | 
| 1283 | shows "\<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> diameter S" | |
| 1284 | and "\<forall>d>0. d < diameter S \<longrightarrow> (\<exists>x\<in>S. \<exists>y\<in>S. dist x y > d)" | |
| 1285 | using diameter_bounded_bound[of S] diameter_lower_bounded[of S] assms | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1286 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1287 | |
| 72225 | 1288 | lemma bounded_two_points: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> e)" | 
| 1289 | by (meson bounded_def diameter_bounded(1)) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1290 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1291 | lemma diameter_compact_attained: | 
| 72225 | 1292 | assumes "compact S" | 
| 1293 |     and "S \<noteq> {}"
 | |
| 1294 | shows "\<exists>x\<in>S. \<exists>y\<in>S. dist x y = diameter S" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1295 | proof - | 
| 72225 | 1296 | have b: "bounded S" using assms(1) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1297 | by (rule compact_imp_bounded) | 
| 72225 | 1298 | then obtain x y where xys: "x\<in>S" "y\<in>S" | 
| 1299 | and xy: "\<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1300 | using compact_sup_maxdistance[OF assms] by auto | 
| 72225 | 1301 | then have "diameter S \<le> dist x y" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1302 | unfolding diameter_def | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1303 | apply clarsimp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1304 | apply (rule cSUP_least, fast+) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1305 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1306 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1307 | by (metis b diameter_bounded_bound order_antisym xys) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1308 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1309 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1310 | lemma diameter_ge_0: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1311 | assumes "bounded S" shows "0 \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1312 | by (metis all_not_in_conv assms diameter_bounded_bound diameter_empty dist_self order_refl) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1313 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1314 | lemma diameter_subset: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1315 | assumes "S \<subseteq> T" "bounded T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1316 | shows "diameter S \<le> diameter T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1317 | proof (cases "S = {} \<or> T = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1318 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1319 | with assms show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1320 | by (force simp: diameter_ge_0) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1321 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1322 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1323 | then have "bdd_above ((\<lambda>x. case x of (x, xa) \<Rightarrow> dist x xa) ` (T \<times> T))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1324 | using \<open>bounded T\<close> diameter_bounded_bound by (force simp: bdd_above_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1325 | with False \<open>S \<subseteq> T\<close> show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1326 | apply (simp add: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1327 | apply (rule cSUP_subset_mono, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1328 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1329 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1330 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1331 | lemma diameter_closure: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1332 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1333 | shows "diameter(closure S) = diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1334 | proof (rule order_antisym) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1335 | have "False" if "diameter S < diameter (closure S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1336 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1337 | define d where "d = diameter(closure S) - diameter(S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1338 | have "d > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1339 | using that by (simp add: d_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1340 | then have "diameter(closure(S)) - d / 2 < diameter(closure(S))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1341 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1342 | have dd: "diameter (closure S) - d / 2 = (diameter(closure(S)) + diameter(S)) / 2" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 1343 | by (simp add: d_def field_split_simps) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1344 | have bocl: "bounded (closure S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1345 | using assms by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1346 | moreover have "0 \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1347 | using assms diameter_ge_0 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1348 | ultimately obtain x y where "x \<in> closure S" "y \<in> closure S" and xy: "diameter(closure(S)) - d / 2 < dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1349 | using diameter_bounded(2) [OF bocl, rule_format, of "diameter(closure(S)) - d / 2"] \<open>d > 0\<close> d_def by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1350 | then obtain x' y' where x'y': "x' \<in> S" "dist x' x < d/4" "y' \<in> S" "dist y' y < d/4" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1351 | using closure_approachable | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1352 | by (metis \<open>0 < d\<close> zero_less_divide_iff zero_less_numeral) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1353 | then have "dist x' y' \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1354 | using assms diameter_bounded_bound by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1355 | with x'y' have "dist x y \<le> d / 4 + diameter S + d / 4" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1356 | by (meson add_mono_thms_linordered_semiring(1) dist_triangle dist_triangle3 less_eq_real_def order_trans) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1357 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1358 | using xy d_def by linarith | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1359 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1360 | then show "diameter (closure S) \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1361 | by fastforce | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1362 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1363 | show "diameter S \<le> diameter (closure S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1364 | by (simp add: assms bounded_closure closure_subset diameter_subset) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1365 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1366 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1367 | proposition Lebesgue_number_lemma: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1368 |   assumes "compact S" "\<C> \<noteq> {}" "S \<subseteq> \<Union>\<C>" and ope: "\<And>B. B \<in> \<C> \<Longrightarrow> open B"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1369 | obtains \<delta> where "0 < \<delta>" "\<And>T. \<lbrakk>T \<subseteq> S; diameter T < \<delta>\<rbrakk> \<Longrightarrow> \<exists>B \<in> \<C>. T \<subseteq> B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1370 | proof (cases "S = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1371 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1372 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1373 |     by (metis \<open>\<C> \<noteq> {}\<close> zero_less_one empty_subsetI equals0I subset_trans that)
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1374 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1375 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1376 |   { fix x assume "x \<in> S"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1377 | then obtain C where C: "x \<in> C" "C \<in> \<C>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1378 | using \<open>S \<subseteq> \<Union>\<C>\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1379 | then obtain r where r: "r>0" "ball x (2*r) \<subseteq> C" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1380 | by (metis mult.commute mult_2_right not_le ope openE field_sum_of_halves zero_le_numeral zero_less_mult_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1381 | then have "\<exists>r C. r > 0 \<and> ball x (2*r) \<subseteq> C \<and> C \<in> \<C>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1382 | using C by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1383 | } | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1384 | then obtain r where r: "\<And>x. x \<in> S \<Longrightarrow> r x > 0 \<and> (\<exists>C \<in> \<C>. ball x (2*r x) \<subseteq> C)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1385 | by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1386 | then have "S \<subseteq> (\<Union>x \<in> S. ball x (r x))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1387 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1388 | then obtain \<T> where "finite \<T>" "S \<subseteq> \<Union>\<T>" and \<T>: "\<T> \<subseteq> (\<lambda>x. ball x (r x)) ` S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1389 | by (rule compactE [OF \<open>compact S\<close>]) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1390 | then obtain S0 where "S0 \<subseteq> S" "finite S0" and S0: "\<T> = (\<lambda>x. ball x (r x)) ` S0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1391 | by (meson finite_subset_image) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1392 |   then have "S0 \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1393 | using False \<open>S \<subseteq> \<Union>\<T>\<close> by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1394 | define \<delta> where "\<delta> = Inf (r ` S0)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1395 | have "\<delta> > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1396 |     using \<open>finite S0\<close> \<open>S0 \<subseteq> S\<close> \<open>S0 \<noteq> {}\<close> r by (auto simp: \<delta>_def finite_less_Inf_iff)
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1397 | show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1398 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1399 | show "0 < \<delta>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1400 | by (simp add: \<open>0 < \<delta>\<close>) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1401 | show "\<exists>B \<in> \<C>. T \<subseteq> B" if "T \<subseteq> S" and dia: "diameter T < \<delta>" for T | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1402 |     proof (cases "T = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1403 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1404 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1405 |         using \<open>\<C> \<noteq> {}\<close> by blast
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1406 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1407 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1408 | then obtain y where "y \<in> T" by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1409 | then have "y \<in> S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1410 | using \<open>T \<subseteq> S\<close> by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1411 | then obtain x where "x \<in> S0" and x: "y \<in> ball x (r x)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1412 | using \<open>S \<subseteq> \<Union>\<T>\<close> S0 that by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1413 | have "ball y \<delta> \<subseteq> ball y (r x)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1414 |         by (metis \<delta>_def \<open>S0 \<noteq> {}\<close> \<open>finite S0\<close> \<open>x \<in> S0\<close> empty_is_image finite_imageI finite_less_Inf_iff imageI less_irrefl not_le subset_ball)
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1415 | also have "... \<subseteq> ball x (2*r x)" | 
| 70960 | 1416 | using x by metric | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1417 | finally obtain C where "C \<in> \<C>" "ball y \<delta> \<subseteq> C" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1418 | by (meson r \<open>S0 \<subseteq> S\<close> \<open>x \<in> S0\<close> dual_order.trans subsetCE) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1419 | have "bounded T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1420 | using \<open>compact S\<close> bounded_subset compact_imp_bounded \<open>T \<subseteq> S\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1421 | then have "T \<subseteq> ball y \<delta>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1422 | using \<open>y \<in> T\<close> dia diameter_bounded_bound by fastforce | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1423 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1424 | apply (rule_tac x=C in bexI) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1425 | using \<open>ball y \<delta> \<subseteq> C\<close> \<open>C \<in> \<C>\<close> by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1426 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1427 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1428 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1429 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1430 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1431 | subsection \<open>Metric spaces with the Heine-Borel property\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1432 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1433 | text \<open> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1434 | A metric space (or topological vector space) is said to have the | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1435 | Heine-Borel property if every closed and bounded subset is compact. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1436 | \<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1437 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1438 | class heine_borel = metric_space + | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1439 | assumes bounded_imp_convergent_subsequence: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1440 | "bounded (range f) \<Longrightarrow> \<exists>l r. strict_mono (r::nat\<Rightarrow>nat) \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1441 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1442 | proposition bounded_closed_imp_seq_compact: | 
| 72225 | 1443 | fixes S::"'a::heine_borel set" | 
| 1444 | assumes "bounded S" | |
| 1445 | and "closed S" | |
| 1446 | shows "seq_compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1447 | proof (unfold seq_compact_def, clarify) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1448 | fix f :: "nat \<Rightarrow> 'a" | 
| 72225 | 1449 | assume f: "\<forall>n. f n \<in> S" | 
| 1450 | with \<open>bounded S\<close> have "bounded (range f)" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1451 | by (auto intro: bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1452 | obtain l r where r: "strict_mono (r :: nat \<Rightarrow> nat)" and l: "((f \<circ> r) \<longlongrightarrow> l) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1453 | using bounded_imp_convergent_subsequence [OF \<open>bounded (range f)\<close>] by auto | 
| 72225 | 1454 | from f have fr: "\<forall>n. (f \<circ> r) n \<in> S" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1455 | by simp | 
| 72225 | 1456 | have "l \<in> S" using \<open>closed S\<close> fr l | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1457 | by (rule closed_sequentially) | 
| 72225 | 1458 | show "\<exists>l\<in>S. \<exists>r. strict_mono r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially" | 
| 1459 | using \<open>l \<in> S\<close> r l by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1460 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1461 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1462 | lemma compact_eq_bounded_closed: | 
| 72225 | 1463 | fixes S :: "'a::heine_borel set" | 
| 1464 | shows "compact S \<longleftrightarrow> bounded S \<and> closed S" | |
| 1465 | using bounded_closed_imp_seq_compact compact_eq_seq_compact_metric compact_imp_bounded compact_imp_closed | |
| 1466 | by auto | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1467 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1468 | lemma compact_Inter: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1469 | fixes \<F> :: "'a :: heine_borel set set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1470 |   assumes com: "\<And>S. S \<in> \<F> \<Longrightarrow> compact S" and "\<F> \<noteq> {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1471 | shows "compact(\<Inter> \<F>)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1472 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1473 | by (meson Inf_lower all_not_in_conv bounded_subset closed_Inter compact_eq_bounded_closed) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1474 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1475 | lemma compact_closure [simp]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1476 | fixes S :: "'a::heine_borel set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1477 | shows "compact(closure S) \<longleftrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1478 | by (meson bounded_closure bounded_subset closed_closure closure_subset compact_eq_bounded_closed) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1479 | |
| 70136 | 1480 | instance\<^marker>\<open>tag important\<close> real :: heine_borel | 
| 1481 | proof | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1482 | fix f :: "nat \<Rightarrow> real" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1483 | assume f: "bounded (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1484 | obtain r :: "nat \<Rightarrow> nat" where r: "strict_mono r" "monoseq (f \<circ> r)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1485 | unfolding comp_def by (metis seq_monosub) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1486 | then have "Bseq (f \<circ> r)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1487 | unfolding Bseq_eq_bounded using f | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1488 | by (metis BseqI' bounded_iff comp_apply rangeI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1489 | with r show "\<exists>l r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1490 | using Bseq_monoseq_convergent[of "f \<circ> r"] by (auto simp: convergent_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1491 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1492 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1493 | lemma compact_lemma_general: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1494 | fixes f :: "nat \<Rightarrow> 'a" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1495 | fixes proj::"'a \<Rightarrow> 'b \<Rightarrow> 'c::heine_borel" (infixl "proj" 60) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1496 |   fixes unproj:: "('b \<Rightarrow> 'c) \<Rightarrow> 'a"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1497 | assumes finite_basis: "finite basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1498 | assumes bounded_proj: "\<And>k. k \<in> basis \<Longrightarrow> bounded ((\<lambda>x. x proj k) ` range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1499 | assumes proj_unproj: "\<And>e k. k \<in> basis \<Longrightarrow> (unproj e) proj k = e k" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1500 | assumes unproj_proj: "\<And>x. unproj (\<lambda>k. x proj k) = x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1501 | shows "\<forall>d\<subseteq>basis. \<exists>l::'a. \<exists> r::nat\<Rightarrow>nat. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1502 | strict_mono r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) proj i) (l proj i) < e) sequentially)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1503 | proof safe | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1504 | fix d :: "'b set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1505 | assume d: "d \<subseteq> basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1506 | with finite_basis have "finite d" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1507 | by (blast intro: finite_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1508 | from this d show "\<exists>l::'a. \<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1509 | (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) proj i) (l proj i) < e) sequentially)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1510 | proof (induct d) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1511 | case empty | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1512 | then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1513 | unfolding strict_mono_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1514 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1515 | case (insert k d) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1516 | have k[intro]: "k \<in> basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1517 | using insert by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1518 | have s': "bounded ((\<lambda>x. x proj k) ` range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1519 | using k | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1520 | by (rule bounded_proj) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1521 | obtain l1::"'a" and r1 where r1: "strict_mono r1" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1522 | and lr1: "\<forall>e > 0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) proj i) (l1 proj i) < e) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1523 | using insert(3) using insert(4) by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1524 | have f': "\<forall>n. f (r1 n) proj k \<in> (\<lambda>x. x proj k) ` range f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1525 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1526 | have "bounded (range (\<lambda>i. f (r1 i) proj k))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1527 | by (metis (lifting) bounded_subset f' image_subsetI s') | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1528 | then obtain l2 r2 where r2:"strict_mono r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) proj k) \<longlongrightarrow> l2) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1529 | using bounded_imp_convergent_subsequence[of "\<lambda>i. f (r1 i) proj k"] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1530 | by (auto simp: o_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1531 | define r where "r = r1 \<circ> r2" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1532 | have r:"strict_mono r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1533 | using r1 and r2 unfolding r_def o_def strict_mono_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1534 | moreover | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1535 | define l where "l = unproj (\<lambda>i. if i = k then l2 else l1 proj i)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1536 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1537 | fix e::real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1538 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1539 | from lr1 \<open>e > 0\<close> have N1: "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) proj i) (l1 proj i) < e) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1540 | by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1541 | from lr2 \<open>e > 0\<close> have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) proj k) l2 < e) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1542 | by (rule tendstoD) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1543 | from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) proj i) (l1 proj i) < e) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1544 | by (rule eventually_subseq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1545 | have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) proj i) (l proj i) < e) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1546 | using N1' N2 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1547 | by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def proj_unproj) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1548 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1549 | ultimately show ?case by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1550 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1551 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1552 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1553 | lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1554 | unfolding bounded_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1555 | by (metis (erased, hide_lams) dist_fst_le image_iff order_trans) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1556 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1557 | lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1558 | unfolding bounded_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1559 | by (metis (no_types, hide_lams) dist_snd_le image_iff order.trans) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1560 | |
| 70136 | 1561 | instance\<^marker>\<open>tag important\<close> prod :: (heine_borel, heine_borel) heine_borel | 
| 1562 | proof | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1563 | fix f :: "nat \<Rightarrow> 'a \<times> 'b" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1564 | assume f: "bounded (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1565 | then have "bounded (fst ` range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1566 | by (rule bounded_fst) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1567 | then have s1: "bounded (range (fst \<circ> f))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1568 | by (simp add: image_comp) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1569 | obtain l1 r1 where r1: "strict_mono r1" and l1: "(\<lambda>n. fst (f (r1 n))) \<longlonglongrightarrow> l1" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1570 | using bounded_imp_convergent_subsequence [OF s1] unfolding o_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1571 | from f have s2: "bounded (range (snd \<circ> f \<circ> r1))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1572 | by (auto simp: image_comp intro: bounded_snd bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1573 | obtain l2 r2 where r2: "strict_mono r2" and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) \<longlongrightarrow> l2) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1574 | using bounded_imp_convergent_subsequence [OF s2] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1575 | unfolding o_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1576 | have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) \<longlongrightarrow> l1) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1577 | using LIMSEQ_subseq_LIMSEQ [OF l1 r2] unfolding o_def . | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1578 | have l: "((f \<circ> (r1 \<circ> r2)) \<longlongrightarrow> (l1, l2)) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1579 | using tendsto_Pair [OF l1' l2] unfolding o_def by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1580 | have r: "strict_mono (r1 \<circ> r2)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1581 | using r1 r2 unfolding strict_mono_def by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1582 | show "\<exists>l r. strict_mono r \<and> ((f \<circ> r) \<longlongrightarrow> l) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1583 | using l r by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1584 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1585 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1586 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1587 | subsection \<open>Completeness\<close> | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1588 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1589 | proposition (in metric_space) completeI: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1590 | assumes "\<And>f. \<forall>n. f n \<in> s \<Longrightarrow> Cauchy f \<Longrightarrow> \<exists>l\<in>s. f \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1591 | shows "complete s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1592 | using assms unfolding complete_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1593 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1594 | proposition (in metric_space) completeE: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1595 | assumes "complete s" and "\<forall>n. f n \<in> s" and "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1596 | obtains l where "l \<in> s" and "f \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1597 | using assms unfolding complete_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1598 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1599 | (* TODO: generalize to uniform spaces *) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1600 | lemma compact_imp_complete: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1601 | fixes s :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1602 | assumes "compact s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1603 | shows "complete s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1604 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1605 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1606 | fix f | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1607 | assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1608 | from as(1) obtain l r where lr: "l\<in>s" "strict_mono r" "(f \<circ> r) \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1609 | using assms unfolding compact_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1610 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1611 | note lr' = seq_suble [OF lr(2)] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1612 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1613 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1614 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1615 | from as(2) obtain N where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (f m) (f n) < e/2" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1616 | unfolding cauchy_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1617 | using \<open>e > 0\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1618 | apply (erule_tac x="e/2" in allE, auto) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1619 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1620 | from lr(3)[unfolded lim_sequentially, THEN spec[where x="e/2"]] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1621 | obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1622 | using \<open>e > 0\<close> by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1623 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1624 | fix n :: nat | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1625 | assume n: "n \<ge> max N M" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1626 | have "dist ((f \<circ> r) n) l < e/2" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1627 | using n M by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1628 | moreover have "r n \<ge> N" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1629 | using lr'[of n] n by auto | 
| 72225 | 1630 | then have "dist (f n) ((f \<circ> r) n) < e/2" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1631 | using N and n by auto | 
| 70960 | 1632 | ultimately have "dist (f n) l < e" using n M | 
| 1633 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1634 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1635 | then have "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1636 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1637 | then have "\<exists>l\<in>s. (f \<longlongrightarrow> l) sequentially" using \<open>l\<in>s\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1638 | unfolding lim_sequentially by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1639 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1640 | then show ?thesis unfolding complete_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1641 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1642 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1643 | proposition compact_eq_totally_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1644 | "compact s \<longleftrightarrow> complete s \<and> (\<forall>e>0. \<exists>k. finite k \<and> s \<subseteq> (\<Union>x\<in>k. ball x e))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1645 | (is "_ \<longleftrightarrow> ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1646 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1647 | assume assms: "?rhs" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1648 | then obtain k where k: "\<And>e. 0 < e \<Longrightarrow> finite (k e)" "\<And>e. 0 < e \<Longrightarrow> s \<subseteq> (\<Union>x\<in>k e. ball x e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1649 | by (auto simp: choice_iff') | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1650 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1651 | show "compact s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1652 | proof cases | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1653 |     assume "s = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1654 | then show "compact s" by (simp add: compact_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1655 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1656 |     assume "s \<noteq> {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1657 | show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1658 | unfolding compact_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1659 | proof safe | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1660 | fix f :: "nat \<Rightarrow> 'a" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1661 | assume f: "\<forall>n. f n \<in> s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1662 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1663 | define e where "e n = 1 / (2 * Suc n)" for n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1664 | then have [simp]: "\<And>n. 0 < e n" by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1665 |       define B where "B n U = (SOME b. infinite {n. f n \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U))" for n U
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1666 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1667 | fix n U | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1668 |         assume "infinite {n. f n \<in> U}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1669 |         then have "\<exists>b\<in>k (e n). infinite {i\<in>{n. f n \<in> U}. f i \<in> ball b (e n)}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1670 | using k f by (intro pigeonhole_infinite_rel) (auto simp: subset_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1671 | then obtain a where | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1672 | "a \<in> k (e n)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1673 |           "infinite {i \<in> {n. f n \<in> U}. f i \<in> ball a (e n)}" ..
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1674 |         then have "\<exists>b. infinite {i. f i \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1675 | by (intro exI[of _ "ball a (e n) \<inter> U"] exI[of _ a]) (auto simp: ac_simps) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1676 | from someI_ex[OF this] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1677 |         have "infinite {i. f i \<in> B n U}" "\<exists>x. B n U \<subseteq> ball x (e n) \<inter> U"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1678 | unfolding B_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1679 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1680 | note B = this | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1681 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1682 | define F where "F = rec_nat (B 0 UNIV) B" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1683 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1684 | fix n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1685 |         have "infinite {i. f i \<in> F n}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1686 | by (induct n) (auto simp: F_def B) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1687 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1688 | then have F: "\<And>n. \<exists>x. F (Suc n) \<subseteq> ball x (e n) \<inter> F n" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1689 | using B by (simp add: F_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1690 | then have F_dec: "\<And>m n. m \<le> n \<Longrightarrow> F n \<subseteq> F m" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1691 | using decseq_SucI[of F] by (auto simp: decseq_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1692 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1693 | obtain sel where sel: "\<And>k i. i < sel k i" "\<And>k i. f (sel k i) \<in> F k" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1694 | proof (atomize_elim, unfold all_conj_distrib[symmetric], intro choice allI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1695 | fix k i | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1696 |         have "infinite ({n. f n \<in> F k} - {.. i})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1697 |           using \<open>infinite {n. f n \<in> F k}\<close> by auto
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1698 | from infinite_imp_nonempty[OF this] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1699 | show "\<exists>x>i. f x \<in> F k" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1700 | by (simp add: set_eq_iff not_le conj_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1701 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1702 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1703 | define t where "t = rec_nat (sel 0 0) (\<lambda>n i. sel (Suc n) i)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1704 | have "strict_mono t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1705 | unfolding strict_mono_Suc_iff by (simp add: t_def sel) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1706 | moreover have "\<forall>i. (f \<circ> t) i \<in> s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1707 | using f by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1708 | moreover | 
| 72225 | 1709 | have t: "(f \<circ> t) n \<in> F n" for n | 
| 1710 | by (cases n) (simp_all add: t_def sel) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1711 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1712 | have "Cauchy (f \<circ> t)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1713 | proof (safe intro!: metric_CauchyI exI elim!: nat_approx_posE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1714 | fix r :: real and N n m | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1715 | assume "1 / Suc N < r" "Suc N \<le> n" "Suc N \<le> m" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1716 | then have "(f \<circ> t) n \<in> F (Suc N)" "(f \<circ> t) m \<in> F (Suc N)" "2 * e N < r" | 
| 71174 | 1717 | using F_dec t by (auto simp: e_def field_simps) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1718 | with F[of N] obtain x where "dist x ((f \<circ> t) n) < e N" "dist x ((f \<circ> t) m) < e N" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1719 | by (auto simp: subset_eq) | 
| 70960 | 1720 | with \<open>2 * e N < r\<close> show "dist ((f \<circ> t) m) ((f \<circ> t) n) < r" | 
| 1721 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1722 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1723 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1724 | ultimately show "\<exists>l\<in>s. \<exists>r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1725 | using assms unfolding complete_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1726 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1727 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1728 | qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1729 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1730 | lemma cauchy_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1731 | assumes "Cauchy s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1732 | shows "bounded (range s)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1733 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1734 | from assms obtain N :: nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1735 | unfolding cauchy_def by force | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1736 | then have N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1737 | moreover | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1738 |   have "bounded (s ` {0..N})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1739 |     using finite_imp_bounded[of "s ` {1..N}"] by auto
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1740 |   then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1741 | unfolding bounded_any_center [where a="s N"] by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1742 | ultimately show "?thesis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1743 | unfolding bounded_any_center [where a="s N"] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1744 | apply (rule_tac x="max a 1" in exI, auto) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1745 | apply (erule_tac x=y in allE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1746 | apply (erule_tac x=y in ballE, auto) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1747 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1748 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1749 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1750 | instance heine_borel < complete_space | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1751 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1752 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1753 | then have "bounded (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1754 | by (rule cauchy_imp_bounded) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1755 | then have "compact (closure (range f))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1756 | unfolding compact_eq_bounded_closed by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1757 | then have "complete (closure (range f))" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1758 | by (rule compact_imp_complete) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1759 | moreover have "\<forall>n. f n \<in> closure (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1760 | using closure_subset [of "range f"] by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1761 | ultimately have "\<exists>l\<in>closure (range f). (f \<longlongrightarrow> l) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1762 | using \<open>Cauchy f\<close> unfolding complete_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1763 | then show "convergent f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1764 | unfolding convergent_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1765 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1766 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1767 | lemma complete_UNIV: "complete (UNIV :: ('a::complete_space) set)"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1768 | proof (rule completeI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1769 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1770 | then have "convergent f" by (rule Cauchy_convergent) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1771 | then show "\<exists>l\<in>UNIV. f \<longlonglongrightarrow> l" unfolding convergent_def by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1772 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1773 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1774 | lemma complete_imp_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1775 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1776 | assumes "complete S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1777 | shows "closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1778 | proof (unfold closed_sequential_limits, clarify) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1779 | fix f x assume "\<forall>n. f n \<in> S" and "f \<longlonglongrightarrow> x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1780 | from \<open>f \<longlonglongrightarrow> x\<close> have "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1781 | by (rule LIMSEQ_imp_Cauchy) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1782 | with \<open>complete S\<close> and \<open>\<forall>n. f n \<in> S\<close> obtain l where "l \<in> S" and "f \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1783 | by (rule completeE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1784 | from \<open>f \<longlonglongrightarrow> x\<close> and \<open>f \<longlonglongrightarrow> l\<close> have "x = l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1785 | by (rule LIMSEQ_unique) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1786 | with \<open>l \<in> S\<close> show "x \<in> S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1787 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1788 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1789 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1790 | lemma complete_Int_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1791 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1792 | assumes "complete S" and "closed t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1793 | shows "complete (S \<inter> t)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1794 | proof (rule completeI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1795 | fix f assume "\<forall>n. f n \<in> S \<inter> t" and "Cauchy f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1796 | then have "\<forall>n. f n \<in> S" and "\<forall>n. f n \<in> t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1797 | by simp_all | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1798 | from \<open>complete S\<close> obtain l where "l \<in> S" and "f \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1799 | using \<open>\<forall>n. f n \<in> S\<close> and \<open>Cauchy f\<close> by (rule completeE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1800 | from \<open>closed t\<close> and \<open>\<forall>n. f n \<in> t\<close> and \<open>f \<longlonglongrightarrow> l\<close> have "l \<in> t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1801 | by (rule closed_sequentially) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1802 | with \<open>l \<in> S\<close> and \<open>f \<longlonglongrightarrow> l\<close> show "\<exists>l\<in>S \<inter> t. f \<longlonglongrightarrow> l" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1803 | by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1804 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1805 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1806 | lemma complete_closed_subset: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1807 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1808 | assumes "closed S" and "S \<subseteq> t" and "complete t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1809 | shows "complete S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1810 | using assms complete_Int_closed [of t S] by (simp add: Int_absorb1) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1811 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1812 | lemma complete_eq_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1813 |   fixes S :: "('a::complete_space) set"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1814 | shows "complete S \<longleftrightarrow> closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1815 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1816 | assume "closed S" then show "complete S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1817 | using subset_UNIV complete_UNIV by (rule complete_closed_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1818 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1819 | assume "complete S" then show "closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1820 | by (rule complete_imp_closed) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1821 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1822 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1823 | lemma convergent_eq_Cauchy: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1824 | fixes S :: "nat \<Rightarrow> 'a::complete_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1825 | shows "(\<exists>l. (S \<longlongrightarrow> l) sequentially) \<longleftrightarrow> Cauchy S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1826 | unfolding Cauchy_convergent_iff convergent_def .. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1827 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1828 | lemma convergent_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1829 | fixes S :: "nat \<Rightarrow> 'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1830 | shows "(S \<longlongrightarrow> l) sequentially \<Longrightarrow> bounded (range S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1831 | by (intro cauchy_imp_bounded LIMSEQ_imp_Cauchy) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1832 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1833 | lemma frontier_subset_compact: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1834 | fixes S :: "'a::heine_borel set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1835 | shows "compact S \<Longrightarrow> frontier S \<subseteq> S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1836 | using frontier_subset_closed compact_eq_bounded_closed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1837 | by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1838 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1839 | lemma continuous_closed_imp_Cauchy_continuous: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1840 |   fixes S :: "('a::complete_space) set"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1841 | shows "\<lbrakk>continuous_on S f; closed S; Cauchy \<sigma>; \<And>n. (\<sigma> n) \<in> S\<rbrakk> \<Longrightarrow> Cauchy(f \<circ> \<sigma>)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1842 | apply (simp add: complete_eq_closed [symmetric] continuous_on_sequentially) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1843 | by (meson LIMSEQ_imp_Cauchy complete_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1844 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1845 | lemma banach_fix_type: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1846 | fixes f::"'a::complete_space\<Rightarrow>'a" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1847 | assumes c:"0 \<le> c" "c < 1" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1848 | and lipschitz:"\<forall>x. \<forall>y. dist (f x) (f y) \<le> c * dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1849 | shows "\<exists>!x. (f x = x)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1850 | using assms banach_fix[OF complete_UNIV UNIV_not_empty assms(1,2) subset_UNIV, of f] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1851 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1852 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1853 | |
| 70136 | 1854 | subsection\<^marker>\<open>tag unimportant\<close>\<open> Finite intersection property\<close> | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1855 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1856 | text\<open>Also developed in HOL's toplogical spaces theory, but the Heine-Borel type class isn't available there.\<close> | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1857 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1858 | lemma closed_imp_fip: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1859 | fixes S :: "'a::heine_borel set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1860 | assumes "closed S" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1861 | and T: "T \<in> \<F>" "bounded T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1862 | and clof: "\<And>T. T \<in> \<F> \<Longrightarrow> closed T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1863 |       and none: "\<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> S \<inter> \<Inter>\<F>' \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1864 |     shows "S \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1865 | proof - | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1866 | have "compact (S \<inter> T)" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1867 | using \<open>closed S\<close> clof compact_eq_bounded_closed T by blast | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1868 |   then have "(S \<inter> T) \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1869 | apply (rule compact_imp_fip) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1870 | apply (simp add: clof) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1871 | by (metis Int_assoc complete_lattice_class.Inf_insert finite_insert insert_subset none \<open>T \<in> \<F>\<close>) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1872 | then show ?thesis by blast | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1873 | qed | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1874 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1875 | lemma closed_imp_fip_compact: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1876 | fixes S :: "'a::heine_borel set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1877 | shows | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1878 | "\<lbrakk>closed S; \<And>T. T \<in> \<F> \<Longrightarrow> compact T; | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1879 |      \<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> S \<inter> \<Inter>\<F>' \<noteq> {}\<rbrakk>
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1880 |         \<Longrightarrow> S \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1881 | by (metis Inf_greatest closed_imp_fip compact_eq_bounded_closed empty_subsetI finite.emptyI inf.orderE) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1882 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1883 | lemma closed_fip_Heine_Borel: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1884 | fixes \<F> :: "'a::heine_borel set set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1885 | assumes "closed S" "T \<in> \<F>" "bounded T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1886 | and "\<And>T. T \<in> \<F> \<Longrightarrow> closed T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1887 |       and "\<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> \<Inter>\<F>' \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1888 |     shows "\<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1889 | proof - | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1890 |   have "UNIV \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1891 | using assms closed_imp_fip [OF closed_UNIV] by auto | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1892 | then show ?thesis by simp | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1893 | qed | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1894 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1895 | lemma compact_fip_Heine_Borel: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1896 | fixes \<F> :: "'a::heine_borel set set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1897 | assumes clof: "\<And>T. T \<in> \<F> \<Longrightarrow> compact T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1898 |       and none: "\<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> \<Inter>\<F>' \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1899 |     shows "\<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1900 | by (metis InterI all_not_in_conv clof closed_fip_Heine_Borel compact_eq_bounded_closed none) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1901 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1902 | lemma compact_sequence_with_limit: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1903 | fixes f :: "nat \<Rightarrow> 'a::heine_borel" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1904 | shows "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> compact (insert l (range f))" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1905 | apply (simp add: compact_eq_bounded_closed, auto) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1906 | apply (simp add: convergent_imp_bounded) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1907 | by (simp add: closed_limpt islimpt_insert sequence_unique_limpt) | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1908 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1909 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1910 | subsection \<open>Properties of Balls and Spheres\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1911 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1912 | lemma compact_cball[simp]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1913 | fixes x :: "'a::heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1914 | shows "compact (cball x e)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1915 | using compact_eq_bounded_closed bounded_cball closed_cball | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1916 | by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1917 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1918 | lemma compact_frontier_bounded[intro]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1919 | fixes S :: "'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1920 | shows "bounded S \<Longrightarrow> compact (frontier S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1921 | unfolding frontier_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1922 | using compact_eq_bounded_closed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1923 | by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1924 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1925 | lemma compact_frontier[intro]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1926 | fixes S :: "'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1927 | shows "compact S \<Longrightarrow> compact (frontier S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1928 | using compact_eq_bounded_closed compact_frontier_bounded | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1929 | by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1930 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1931 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1932 | subsection \<open>Distance from a Set\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1933 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1934 | lemma distance_attains_sup: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1935 |   assumes "compact s" "s \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1936 | shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a y \<le> dist a x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1937 | proof (rule continuous_attains_sup [OF assms]) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1938 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1939 | fix x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1940 | assume "x\<in>s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1941 | have "(dist a \<longlongrightarrow> dist a x) (at x within s)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1942 | by (intro tendsto_dist tendsto_const tendsto_ident_at) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1943 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1944 | then show "continuous_on s (dist a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1945 | unfolding continuous_on .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1946 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1947 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1948 | text \<open>For \emph{minimal} distance, we only need closure, not compactness.\<close>
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1949 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1950 | lemma distance_attains_inf: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1951 | fixes a :: "'a::heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1952 |   assumes "closed s" and "s \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1953 | obtains x where "x\<in>s" "\<And>y. y \<in> s \<Longrightarrow> dist a x \<le> dist a y" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1954 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1955 | from assms obtain b where "b \<in> s" by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1956 | let ?B = "s \<inter> cball a (dist b a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1957 |   have "?B \<noteq> {}" using \<open>b \<in> s\<close>
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1958 | by (auto simp: dist_commute) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1959 | moreover have "continuous_on ?B (dist a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1960 | by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_ident continuous_const) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1961 | moreover have "compact ?B" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1962 | by (intro closed_Int_compact \<open>closed s\<close> compact_cball) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1963 | ultimately obtain x where "x \<in> ?B" "\<forall>y\<in>?B. dist a x \<le> dist a y" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1964 | by (metis continuous_attains_inf) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1965 | with that show ?thesis by fastforce | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1966 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1967 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1968 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1969 | subsection \<open>Infimum Distance\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1970 | |
| 70136 | 1971 | definition\<^marker>\<open>tag important\<close> "infdist x A = (if A = {} then 0 else INF a\<in>A. dist x a)"
 | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1972 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1973 | lemma bdd_below_image_dist[intro, simp]: "bdd_below (dist x ` A)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1974 | by (auto intro!: zero_le_dist) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1975 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1976 | lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = (INF a\<in>A. dist x a)"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1977 | by (simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1978 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1979 | lemma infdist_nonneg: "0 \<le> infdist x A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1980 | by (auto simp: infdist_def intro: cINF_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1981 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1982 | lemma infdist_le: "a \<in> A \<Longrightarrow> infdist x A \<le> dist x a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1983 | by (auto intro: cINF_lower simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1984 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1985 | lemma infdist_le2: "a \<in> A \<Longrightarrow> dist x a \<le> d \<Longrightarrow> infdist x A \<le> d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1986 | by (auto intro!: cINF_lower2 simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1987 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1988 | lemma infdist_zero[simp]: "a \<in> A \<Longrightarrow> infdist a A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1989 | by (auto intro!: antisym infdist_nonneg infdist_le2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1990 | |
| 70724 | 1991 | lemma infdist_Un_min: | 
| 1992 |   assumes "A \<noteq> {}" "B \<noteq> {}"
 | |
| 1993 | shows "infdist x (A \<union> B) = min (infdist x A) (infdist x B)" | |
| 1994 | using assms by (simp add: infdist_def cINF_union inf_real_def) | |
| 1995 | ||
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1996 | lemma infdist_triangle: "infdist x A \<le> infdist y A + dist x y" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1997 | proof (cases "A = {}")
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1998 | case True | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1999 | then show ?thesis by (simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2000 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2001 | case False | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2002 | then obtain a where "a \<in> A" by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2003 |   have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2004 | proof (rule cInf_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2005 |     from \<open>A \<noteq> {}\<close> show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2006 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2007 | fix d | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2008 |     assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2009 | then obtain a where d: "d = dist x y + dist y a" "a \<in> A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2010 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2011 | show "infdist x A \<le> d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2012 |       unfolding infdist_notempty[OF \<open>A \<noteq> {}\<close>]
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2013 | proof (rule cINF_lower2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2014 | show "a \<in> A" by fact | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2015 | show "dist x a \<le> d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2016 | unfolding d by (rule dist_triangle) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2017 | qed simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2018 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2019 | also have "\<dots> = dist x y + infdist y A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2020 | proof (rule cInf_eq, safe) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2021 | fix a | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2022 | assume "a \<in> A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2023 | then show "dist x y + infdist y A \<le> dist x y + dist y a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2024 | by (auto intro: infdist_le) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2025 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2026 | fix i | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2027 |     assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2028 | then have "i - dist x y \<le> infdist y A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2029 |       unfolding infdist_notempty[OF \<open>A \<noteq> {}\<close>] using \<open>a \<in> A\<close>
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2030 | by (intro cINF_greatest) (auto simp: field_simps) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2031 | then show "i \<le> dist x y + infdist y A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2032 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2033 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2034 | finally show ?thesis by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2035 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2036 | |
| 70724 | 2037 | lemma infdist_triangle_abs: "\<bar>infdist x A - infdist y A\<bar> \<le> dist x y" | 
| 2038 | by (metis (full_types) abs_diff_le_iff diff_le_eq dist_commute infdist_triangle) | |
| 2039 | ||
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2040 | lemma in_closure_iff_infdist_zero: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2041 |   assumes "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2042 | shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2043 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2044 | assume "x \<in> closure A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2045 | show "infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2046 | proof (rule ccontr) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2047 | assume "infdist x A \<noteq> 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2048 | with infdist_nonneg[of x A] have "infdist x A > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2049 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2050 |     then have "ball x (infdist x A) \<inter> closure A = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2051 | apply auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2052 | apply (metis \<open>x \<in> closure A\<close> closure_approachable dist_commute infdist_le not_less) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2053 | done | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2054 | then have "x \<notin> closure A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2055 | by (metis \<open>0 < infdist x A\<close> centre_in_ball disjoint_iff_not_equal) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2056 | then show False using \<open>x \<in> closure A\<close> by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2057 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2058 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2059 | assume x: "infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2060 | then obtain a where "a \<in> A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2061 | by atomize_elim (metis all_not_in_conv assms) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2062 | show "x \<in> closure A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2063 | unfolding closure_approachable | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2064 | apply safe | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2065 | proof (rule ccontr) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2066 | fix e :: real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2067 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2068 | assume "\<not> (\<exists>y\<in>A. dist y x < e)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2069 | then have "infdist x A \<ge> e" using \<open>a \<in> A\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2070 | unfolding infdist_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2071 | by (force simp: dist_commute intro: cINF_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2072 | with x \<open>e > 0\<close> show False by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2073 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2074 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2075 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2076 | lemma in_closed_iff_infdist_zero: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2077 |   assumes "closed A" "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2078 | shows "x \<in> A \<longleftrightarrow> infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2079 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2080 | have "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2081 | by (rule in_closure_iff_infdist_zero) fact | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2082 | with assms show ?thesis by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2083 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2084 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2085 | lemma infdist_pos_not_in_closed: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2086 |   assumes "closed S" "S \<noteq> {}" "x \<notin> S"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2087 | shows "infdist x S > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2088 | using in_closed_iff_infdist_zero[OF assms(1) assms(2), of x] assms(3) infdist_nonneg le_less by fastforce | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2089 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2090 | lemma | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2091 | infdist_attains_inf: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2092 | fixes X::"'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2093 | assumes "closed X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2094 |   assumes "X \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2095 | obtains x where "x \<in> X" "infdist y X = dist y x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2096 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2097 | have "bdd_below (dist y ` X)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2098 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2099 | from distance_attains_inf[OF assms, of y] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2100 | obtain x where INF: "x \<in> X" "\<And>z. z \<in> X \<Longrightarrow> dist y x \<le> dist y z" by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2101 | have "infdist y X = dist y x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2102 | by (auto simp: infdist_def assms | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2103 | intro!: antisym cINF_lower[OF _ \<open>x \<in> X\<close>] cINF_greatest[OF assms(2) INF(2)]) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2104 | with \<open>x \<in> X\<close> show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2105 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2106 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2107 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2108 | text \<open>Every metric space is a T4 space:\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2109 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2110 | instance metric_space \<subseteq> t4_space | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2111 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2112 |   fix S T::"'a set" assume H: "closed S" "closed T" "S \<inter> T = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2113 |   consider "S = {}" | "T = {}" | "S \<noteq> {} \<and> T \<noteq> {}" by auto
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2114 |   then show "\<exists>U V. open U \<and> open V \<and> S \<subseteq> U \<and> T \<subseteq> V \<and> U \<inter> V = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2115 | proof (cases) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2116 | case 1 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2117 | show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2118 |       apply (rule exI[of _ "{}"], rule exI[of _ UNIV]) using 1 by auto
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2119 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2120 | case 2 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2121 | show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2122 |       apply (rule exI[of _ UNIV], rule exI[of _ "{}"]) using 2 by auto
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2123 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2124 | case 3 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2125 | define U where "U = (\<Union>x\<in>S. ball x ((infdist x T)/2))" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2126 | have A: "open U" unfolding U_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2127 | have "infdist x T > 0" if "x \<in> S" for x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2128 | using H that 3 by (auto intro!: infdist_pos_not_in_closed) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2129 | then have B: "S \<subseteq> U" unfolding U_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2130 | define V where "V = (\<Union>x\<in>T. ball x ((infdist x S)/2))" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2131 | have C: "open V" unfolding V_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2132 | have "infdist x S > 0" if "x \<in> T" for x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2133 | using H that 3 by (auto intro!: infdist_pos_not_in_closed) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2134 | then have D: "T \<subseteq> V" unfolding V_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2135 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2136 |     have "(ball x ((infdist x T)/2)) \<inter> (ball y ((infdist y S)/2)) = {}" if "x \<in> S" "y \<in> T" for x y
 | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2137 | proof auto | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2138 | fix z assume H: "dist x z * 2 < infdist x T" "dist y z * 2 < infdist y S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2139 | have "2 * dist x y \<le> 2 * dist x z + 2 * dist y z" | 
| 70960 | 2140 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2141 | also have "... < infdist x T + infdist y S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2142 | using H by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2143 | finally have "dist x y < infdist x T \<or> dist x y < infdist y S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2144 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2145 | then show False | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2146 | using infdist_le[OF \<open>x \<in> S\<close>, of y] infdist_le[OF \<open>y \<in> T\<close>, of x] by (auto simp add: dist_commute) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2147 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2148 |     then have E: "U \<inter> V = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2149 | unfolding U_def V_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2150 | show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2151 | apply (rule exI[of _ U], rule exI[of _ V]) using A B C D E by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2152 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2153 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2154 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2155 | lemma tendsto_infdist [tendsto_intros]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2156 | assumes f: "(f \<longlongrightarrow> l) F" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2157 | shows "((\<lambda>x. infdist (f x) A) \<longlongrightarrow> infdist l A) F" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2158 | proof (rule tendstoI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2159 | fix e ::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2160 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2161 | from tendstoD[OF f this] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2162 | show "eventually (\<lambda>x. dist (infdist (f x) A) (infdist l A) < e) F" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2163 | proof (eventually_elim) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2164 | fix x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2165 | from infdist_triangle[of l A "f x"] infdist_triangle[of "f x" A l] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2166 | have "dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2167 | by (simp add: dist_commute dist_real_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2168 | also assume "dist (f x) l < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2169 | finally show "dist (infdist (f x) A) (infdist l A) < e" . | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2170 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2171 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2172 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2173 | lemma continuous_infdist[continuous_intros]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2174 | assumes "continuous F f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2175 | shows "continuous F (\<lambda>x. infdist (f x) A)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2176 | using assms unfolding continuous_def by (rule tendsto_infdist) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2177 | |
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2178 | lemma continuous_on_infdist [continuous_intros]: | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2179 | assumes "continuous_on S f" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2180 | shows "continuous_on S (\<lambda>x. infdist (f x) A)" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2181 | using assms unfolding continuous_on by (auto intro: tendsto_infdist) | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2182 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2183 | lemma compact_infdist_le: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2184 | fixes A::"'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2185 |   assumes "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2186 | assumes "compact A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2187 | assumes "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2188 |   shows "compact {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2189 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2190 |   from continuous_closed_vimage[of "{0..e}" "\<lambda>x. infdist x A"]
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2191 | continuous_infdist[OF continuous_ident, of _ UNIV A] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2192 |   have "closed {x. infdist x A \<le> e}" by (auto simp: vimage_def infdist_nonneg)
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2193 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2194 | from assms obtain x0 b where b: "\<And>x. x \<in> A \<Longrightarrow> dist x0 x \<le> b" "closed A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2195 | by (auto simp: compact_eq_bounded_closed bounded_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2196 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2197 | fix y | 
| 70960 | 2198 | assume "infdist y A \<le> e" | 
| 2199 | moreover | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2200 |     from infdist_attains_inf[OF \<open>closed A\<close> \<open>A \<noteq> {}\<close>, of y]
 | 
| 70960 | 2201 | obtain z where "z \<in> A" "infdist y A = dist y z" by blast | 
| 2202 | ultimately | |
| 2203 | have "dist x0 y \<le> b + e" using b by metric | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2204 | } then | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2205 |   have "bounded {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2206 | by (auto simp: bounded_any_center[where a=x0] intro!: exI[where x="b + e"]) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2207 |   ultimately show "compact {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2208 | by (simp add: compact_eq_bounded_closed) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2209 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2210 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2211 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2212 | subsection \<open>Separation between Points and Sets\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2213 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2214 | proposition separate_point_closed: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2215 | fixes s :: "'a::heine_borel set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2216 | assumes "closed s" and "a \<notin> s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2217 | shows "\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2218 | proof (cases "s = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2219 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2220 | then show ?thesis by(auto intro!: exI[where x=1]) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2221 | next | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2222 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2223 | from assms obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2224 |     using \<open>s \<noteq> {}\<close> by (blast intro: distance_attains_inf [of s a])
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2225 | with \<open>x\<in>s\<close> show ?thesis using dist_pos_lt[of a x] and\<open>a \<notin> s\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2226 | by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2227 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2228 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2229 | proposition separate_compact_closed: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2230 | fixes s t :: "'a::heine_borel set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2231 | assumes "compact s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2232 |     and t: "closed t" "s \<inter> t = {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2233 | shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2234 | proof cases | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2235 |   assume "s \<noteq> {} \<and> t \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2236 |   then have "s \<noteq> {}" "t \<noteq> {}" by auto
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2237 | let ?inf = "\<lambda>x. infdist x t" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2238 | have "continuous_on s ?inf" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2239 | by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_ident) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2240 | then obtain x where x: "x \<in> s" "\<forall>y\<in>s. ?inf x \<le> ?inf y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2241 |     using continuous_attains_inf[OF \<open>compact s\<close> \<open>s \<noteq> {}\<close>] by auto
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2242 | then have "0 < ?inf x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2243 |     using t \<open>t \<noteq> {}\<close> in_closed_iff_infdist_zero by (auto simp: less_le infdist_nonneg)
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2244 | moreover have "\<forall>x'\<in>s. \<forall>y\<in>t. ?inf x \<le> dist x' y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2245 | using x by (auto intro: order_trans infdist_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2246 | ultimately show ?thesis by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2247 | qed (auto intro!: exI[of _ 1]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2248 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2249 | proposition separate_closed_compact: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2250 | fixes s t :: "'a::heine_borel set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2251 | assumes "closed s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2252 | and "compact t" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2253 |     and "s \<inter> t = {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2254 | shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2255 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2256 |   have *: "t \<inter> s = {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2257 | using assms(3) by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2258 | show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2259 | using separate_compact_closed[OF assms(2,1) *] by (force simp: dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2260 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2261 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2262 | proposition compact_in_open_separated: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2263 | fixes A::"'a::heine_borel set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2264 |   assumes "A \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2265 | assumes "compact A" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2266 | assumes "open B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2267 | assumes "A \<subseteq> B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2268 |   obtains e where "e > 0" "{x. infdist x A \<le> e} \<subseteq> B"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2269 | proof atomize_elim | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2270 |   have "closed (- B)" "compact A" "- B \<inter> A = {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2271 | using assms by (auto simp: open_Diff compact_eq_bounded_closed) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2272 | from separate_closed_compact[OF this] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2273 | obtain d'::real where d': "d'>0" "\<And>x y. x \<notin> B \<Longrightarrow> y \<in> A \<Longrightarrow> d' \<le> dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2274 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2275 | define d where "d = d' / 2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2276 | hence "d>0" "d < d'" using d' by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2277 | with d' have d: "\<And>x y. x \<notin> B \<Longrightarrow> y \<in> A \<Longrightarrow> d < dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2278 | by force | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2279 |   show "\<exists>e>0. {x. infdist x A \<le> e} \<subseteq> B"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2280 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2281 |     assume "\<nexists>e. 0 < e \<and> {x. infdist x A \<le> e} \<subseteq> B"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2282 | with \<open>d > 0\<close> obtain x where x: "infdist x A \<le> d" "x \<notin> B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2283 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2284 |     from assms have "closed A" "A \<noteq> {}" by (auto simp: compact_eq_bounded_closed)
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2285 | from infdist_attains_inf[OF this] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2286 | obtain y where y: "y \<in> A" "infdist x A = dist x y" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2287 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2288 | have "dist x y \<le> d" using x y by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2289 | also have "\<dots> < dist x y" using y d x by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2290 | finally show False by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2291 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2292 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2293 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2294 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2295 | subsection \<open>Uniform Continuity\<close> | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2296 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2297 | lemma uniformly_continuous_onE: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2298 | assumes "uniformly_continuous_on s f" "0 < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2299 | obtains d where "d>0" "\<And>x x'. \<lbrakk>x\<in>s; x'\<in>s; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2300 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2301 | by (auto simp: uniformly_continuous_on_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2302 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2303 | lemma uniformly_continuous_on_sequentially: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2304 | "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2305 | (\<lambda>n. dist (x n) (y n)) \<longlonglongrightarrow> 0 \<longrightarrow> (\<lambda>n. dist (f(x n)) (f(y n))) \<longlonglongrightarrow> 0)" (is "?lhs = ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2306 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2307 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2308 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2309 | fix x y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2310 | assume x: "\<forall>n. x n \<in> s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2311 | and y: "\<forall>n. y n \<in> s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2312 | and xy: "((\<lambda>n. dist (x n) (y n)) \<longlongrightarrow> 0) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2313 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2314 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2315 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2316 | then obtain d where "d > 0" and d: "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2317 | using \<open>?lhs\<close>[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2318 | obtain N where N: "\<forall>n\<ge>N. dist (x n) (y n) < d" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2319 | using xy[unfolded lim_sequentially dist_norm] and \<open>d>0\<close> by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2320 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2321 | fix n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2322 | assume "n\<ge>N" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2323 | then have "dist (f (x n)) (f (y n)) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2324 | using N[THEN spec[where x=n]] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2325 | using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2326 | using x and y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2327 | by (simp add: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2328 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2329 | then have "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2330 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2331 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2332 | then have "((\<lambda>n. dist (f(x n)) (f(y n))) \<longlongrightarrow> 0) sequentially" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2333 | unfolding lim_sequentially and dist_real_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2334 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2335 | then show ?rhs by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2336 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2337 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2338 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2339 | assume "\<not> ?lhs" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2340 | then obtain e where "e > 0" "\<forall>d>0. \<exists>x\<in>s. \<exists>x'\<in>s. dist x' x < d \<and> \<not> dist (f x') (f x) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2341 | unfolding uniformly_continuous_on_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2342 | then obtain fa where fa: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2343 | "\<forall>x. 0 < x \<longrightarrow> fst (fa x) \<in> s \<and> snd (fa x) \<in> s \<and> dist (fst (fa x)) (snd (fa x)) < x \<and> \<not> dist (f (fst (fa x))) (f (snd (fa x))) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2344 | using choice[of "\<lambda>d x. d>0 \<longrightarrow> fst x \<in> s \<and> snd x \<in> s \<and> dist (snd x) (fst x) < d \<and> \<not> dist (f (snd x)) (f (fst x)) < e"] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2345 | unfolding Bex_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2346 | by (auto simp: dist_commute) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2347 | define x where "x n = fst (fa (inverse (real n + 1)))" for n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2348 | define y where "y n = snd (fa (inverse (real n + 1)))" for n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2349 | have xyn: "\<forall>n. x n \<in> s \<and> y n \<in> s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2350 | and xy0: "\<forall>n. dist (x n) (y n) < inverse (real n + 1)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2351 | and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2352 | unfolding x_def and y_def using fa | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2353 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2354 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2355 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2356 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2357 | then obtain N :: nat where "N \<noteq> 0" and N: "0 < inverse (real N) \<and> inverse (real N) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2358 | unfolding real_arch_inverse[of e] by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2359 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2360 | fix n :: nat | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2361 | assume "n \<ge> N" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2362 | then have "inverse (real n + 1) < inverse (real N)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2363 | using of_nat_0_le_iff and \<open>N\<noteq>0\<close> by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2364 | also have "\<dots> < e" using N by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2365 | finally have "inverse (real n + 1) < e" by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2366 | then have "dist (x n) (y n) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2367 | using xy0[THEN spec[where x=n]] by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2368 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2369 | then have "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2370 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2371 | then have "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2372 | using \<open>?rhs\<close>[THEN spec[where x=x], THEN spec[where x=y]] and xyn | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2373 | unfolding lim_sequentially dist_real_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2374 | then have False using fxy and \<open>e>0\<close> by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2375 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2376 | then show ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2377 | unfolding uniformly_continuous_on_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2378 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2379 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2380 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2381 | subsection \<open>Continuity on a Compact Domain Implies Uniform Continuity\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2382 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2383 | text\<open>From the proof of the Heine-Borel theorem: Lemma 2 in section 3.7, page 69 of | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2384 | J. C. Burkill and H. Burkill. A Second Course in Mathematical Analysis (CUP, 2002)\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2385 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2386 | lemma Heine_Borel_lemma: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2387 | assumes "compact S" and Ssub: "S \<subseteq> \<Union>\<G>" and opn: "\<And>G. G \<in> \<G> \<Longrightarrow> open G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2388 | obtains e where "0 < e" "\<And>x. x \<in> S \<Longrightarrow> \<exists>G \<in> \<G>. ball x e \<subseteq> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2389 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2390 | have False if neg: "\<And>e. 0 < e \<Longrightarrow> \<exists>x \<in> S. \<forall>G \<in> \<G>. \<not> ball x e \<subseteq> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2391 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2392 | have "\<exists>x \<in> S. \<forall>G \<in> \<G>. \<not> ball x (1 / Suc n) \<subseteq> G" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2393 | using neg by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2394 | then obtain f where "\<And>n. f n \<in> S" and fG: "\<And>G n. G \<in> \<G> \<Longrightarrow> \<not> ball (f n) (1 / Suc n) \<subseteq> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2395 | by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2396 | then obtain l r where "l \<in> S" "strict_mono r" and to_l: "(f \<circ> r) \<longlonglongrightarrow> l" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2397 | using \<open>compact S\<close> compact_def that by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2398 | then obtain G where "l \<in> G" "G \<in> \<G>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2399 | using Ssub by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2400 | then obtain e where "0 < e" and e: "\<And>z. dist z l < e \<Longrightarrow> z \<in> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2401 | using opn open_dist by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2402 | obtain N1 where N1: "\<And>n. n \<ge> N1 \<Longrightarrow> dist (f (r n)) l < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2403 | using to_l apply (simp add: lim_sequentially) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2404 | using \<open>0 < e\<close> half_gt_zero that by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2405 | obtain N2 where N2: "of_nat N2 > 2/e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2406 | using reals_Archimedean2 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2407 | obtain x where "x \<in> ball (f (r (max N1 N2))) (1 / real (Suc (r (max N1 N2))))" and "x \<notin> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2408 | using fG [OF \<open>G \<in> \<G>\<close>, of "r (max N1 N2)"] by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2409 | then have "dist (f (r (max N1 N2))) x < 1 / real (Suc (r (max N1 N2)))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2410 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2411 | also have "... \<le> 1 / real (Suc (max N1 N2))" | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70724diff
changeset | 2412 | apply (simp add: field_split_simps del: max.bounded_iff) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2413 | using \<open>strict_mono r\<close> seq_suble by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2414 | also have "... \<le> 1 / real (Suc N2)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2415 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2416 | also have "... < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2417 | using N2 \<open>0 < e\<close> by (simp add: field_simps) | 
| 72225 | 2418 | finally have "dist (f (r (max N1 N2))) x < e/2" . | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2419 | moreover have "dist (f (r (max N1 N2))) l < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2420 | using N1 max.cobounded1 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2421 | ultimately have "dist x l < e" | 
| 70960 | 2422 | by metric | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2423 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2424 | using e \<open>x \<notin> G\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2425 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2426 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2427 | by (meson that) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2428 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2429 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2430 | lemma compact_uniformly_equicontinuous: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2431 | assumes "compact S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2432 | and cont: "\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2433 | \<Longrightarrow> \<exists>d. 0 < d \<and> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2434 | (\<forall>f \<in> \<F>. \<forall>x' \<in> S. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2435 | and "0 < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2436 | obtains d where "0 < d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2437 | "\<And>f x x'. \<lbrakk>f \<in> \<F>; x \<in> S; x' \<in> S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2438 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2439 | obtain d where d_pos: "\<And>x e. \<lbrakk>x \<in> S; 0 < e\<rbrakk> \<Longrightarrow> 0 < d x e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2440 | and d_dist : "\<And>x x' e f. \<lbrakk>dist x' x < d x e; x \<in> S; x' \<in> S; 0 < e; f \<in> \<F>\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2441 | using cont by metis | 
| 72225 | 2442 | let ?\<G> = "((\<lambda>x. ball x (d x (e/2))) ` S)" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2443 | have Ssub: "S \<subseteq> \<Union> ?\<G>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2444 | by clarsimp (metis d_pos \<open>0 < e\<close> dist_self half_gt_zero_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2445 | then obtain k where "0 < k" and k: "\<And>x. x \<in> S \<Longrightarrow> \<exists>G \<in> ?\<G>. ball x k \<subseteq> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2446 | by (rule Heine_Borel_lemma [OF \<open>compact S\<close>]) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2447 | moreover have "dist (f v) (f u) < e" if "f \<in> \<F>" "u \<in> S" "v \<in> S" "dist v u < k" for f u v | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2448 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2449 | obtain G where "G \<in> ?\<G>" "u \<in> G" "v \<in> G" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2450 | using k that | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2451 | by (metis \<open>dist v u < k\<close> \<open>u \<in> S\<close> \<open>0 < k\<close> centre_in_ball subsetD dist_commute mem_ball) | 
| 72225 | 2452 | then obtain w where w: "dist w u < d w (e/2)" "dist w v < d w (e/2)" "w \<in> S" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2453 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2454 | with that d_dist have "dist (f w) (f v) < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2455 | by (metis \<open>0 < e\<close> dist_commute half_gt_zero) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2456 | moreover | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2457 | have "dist (f w) (f u) < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2458 | using that d_dist w by (metis \<open>0 < e\<close> dist_commute divide_pos_pos zero_less_numeral) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2459 | ultimately show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2460 | using dist_triangle_half_r by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2461 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2462 | ultimately show ?thesis using that by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2463 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2464 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2465 | corollary compact_uniformly_continuous: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2466 | fixes f :: "'a :: metric_space \<Rightarrow> 'b :: metric_space" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2467 | assumes f: "continuous_on S f" and S: "compact S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2468 | shows "uniformly_continuous_on S f" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2469 | using f | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2470 | unfolding continuous_on_iff uniformly_continuous_on_def | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2471 |     by (force intro: compact_uniformly_equicontinuous [OF S, of "{f}"])
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2472 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2473 | |
| 70136 | 2474 | subsection\<^marker>\<open>tag unimportant\<close>\<open> Theorems relating continuity and uniform continuity to closures\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2475 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2476 | lemma continuous_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2477 | "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2478 | (\<forall>x e. x \<in> closure S \<and> 0 < e | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2479 | \<longrightarrow> (\<exists>d. 0 < d \<and> (\<forall>y. y \<in> S \<and> dist y x < d \<longrightarrow> dist (f y) (f x) < e)))" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2480 | (is "?lhs = ?rhs") | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2481 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2482 | assume ?lhs then show ?rhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2483 | unfolding continuous_on_iff by (metis Un_iff closure_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2484 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2485 | assume R [rule_format]: ?rhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2486 | show ?lhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2487 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2488 | fix x and e::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2489 | assume "0 < e" and x: "x \<in> closure S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2490 | obtain \<delta>::real where "\<delta> > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2491 | and \<delta>: "\<And>y. \<lbrakk>y \<in> S; dist y x < \<delta>\<rbrakk> \<Longrightarrow> dist (f y) (f x) < e/2" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2492 | using R [of x "e/2"] \<open>0 < e\<close> x by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2493 | have "dist (f y) (f x) \<le> e" if y: "y \<in> closure S" and dyx: "dist y x < \<delta>/2" for y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2494 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2495 | obtain \<delta>'::real where "\<delta>' > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2496 | and \<delta>': "\<And>z. \<lbrakk>z \<in> S; dist z y < \<delta>'\<rbrakk> \<Longrightarrow> dist (f z) (f y) < e/2" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2497 | using R [of y "e/2"] \<open>0 < e\<close> y by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2498 | obtain z where "z \<in> S" and z: "dist z y < min \<delta>' \<delta> / 2" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2499 | using closure_approachable y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2500 | by (metis \<open>0 < \<delta>'\<close> \<open>0 < \<delta>\<close> divide_pos_pos min_less_iff_conj zero_less_numeral) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2501 | have "dist (f z) (f y) < e/2" | 
| 70960 | 2502 | using \<delta>' [OF \<open>z \<in> S\<close>] z \<open>0 < \<delta>'\<close> by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2503 | moreover have "dist (f z) (f x) < e/2" | 
| 70960 | 2504 | using \<delta>[OF \<open>z \<in> S\<close>] z dyx by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2505 | ultimately show ?thesis | 
| 70960 | 2506 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2507 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2508 | then show "\<exists>d>0. \<forall>x'\<in>closure S. dist x' x < d \<longrightarrow> dist (f x') (f x) \<le> e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2509 | by (rule_tac x="\<delta>/2" in exI) (simp add: \<open>\<delta> > 0\<close>) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2510 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2511 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2512 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2513 | lemma continuous_on_closure_sequentially: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2514 | fixes f :: "'a::metric_space \<Rightarrow> 'b :: metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2515 | shows | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2516 | "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2517 | (\<forall>x a. a \<in> closure S \<and> (\<forall>n. x n \<in> S) \<and> x \<longlonglongrightarrow> a \<longrightarrow> (f \<circ> x) \<longlonglongrightarrow> f a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2518 | (is "?lhs = ?rhs") | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2519 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2520 | have "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2521 | (\<forall>x \<in> closure S. continuous (at x within S) f)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2522 | by (force simp: continuous_on_closure continuous_within_eps_delta) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2523 | also have "... = ?rhs" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2524 | by (force simp: continuous_within_sequentially) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2525 | finally show ?thesis . | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2526 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2527 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2528 | lemma uniformly_continuous_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2529 | fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2530 | assumes ucont: "uniformly_continuous_on S f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2531 | and cont: "continuous_on (closure S) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2532 | shows "uniformly_continuous_on (closure S) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2533 | unfolding uniformly_continuous_on_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2534 | proof (intro allI impI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2535 | fix e::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2536 | assume "0 < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2537 | then obtain d::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2538 | where "d>0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2539 | and d: "\<And>x x'. \<lbrakk>x\<in>S; x'\<in>S; dist x' x < d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e/3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2540 | using ucont [unfolded uniformly_continuous_on_def, rule_format, of "e/3"] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2541 | show "\<exists>d>0. \<forall>x\<in>closure S. \<forall>x'\<in>closure S. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2542 | proof (rule exI [where x="d/3"], clarsimp simp: \<open>d > 0\<close>) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2543 | fix x y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2544 | assume x: "x \<in> closure S" and y: "y \<in> closure S" and dyx: "dist y x * 3 < d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2545 | obtain d1::real where "d1 > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2546 | and d1: "\<And>w. \<lbrakk>w \<in> closure S; dist w x < d1\<rbrakk> \<Longrightarrow> dist (f w) (f x) < e/3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2547 | using cont [unfolded continuous_on_iff, rule_format, of "x" "e/3"] \<open>0 < e\<close> x by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2548 | obtain x' where "x' \<in> S" and x': "dist x' x < min d1 (d / 3)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2549 | using closure_approachable [of x S] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2550 | by (metis \<open>0 < d1\<close> \<open>0 < d\<close> divide_pos_pos min_less_iff_conj x zero_less_numeral) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2551 | obtain d2::real where "d2 > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2552 | and d2: "\<forall>w \<in> closure S. dist w y < d2 \<longrightarrow> dist (f w) (f y) < e/3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2553 | using cont [unfolded continuous_on_iff, rule_format, of "y" "e/3"] \<open>0 < e\<close> y by auto | 
| 70960 | 2554 | obtain y' where "y' \<in> S" and y': "dist y' y < min d2 (d / 3)" | 
| 2555 | using closure_approachable [of y S] | |
| 2556 | by (metis \<open>0 < d2\<close> \<open>0 < d\<close> divide_pos_pos min_less_iff_conj y zero_less_numeral) | |
| 2557 | have "dist x' x < d/3" using x' by auto | |
| 2558 | then have "dist x' y' < d" | |
| 2559 | using dyx y' by metric | |
| 2560 | then have "dist (f x') (f y') < e/3" | |
| 2561 | by (rule d [OF \<open>y' \<in> S\<close> \<open>x' \<in> S\<close>]) | |
| 2562 | moreover have "dist (f x') (f x) < e/3" using \<open>x' \<in> S\<close> closure_subset x' d1 | |
| 2563 | by (simp add: closure_def) | |
| 2564 | moreover have "dist (f y') (f y) < e/3" using \<open>y' \<in> S\<close> closure_subset y' d2 | |
| 2565 | by (simp add: closure_def) | |
| 2566 | ultimately show "dist (f y) (f x) < e" by metric | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2567 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2568 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2569 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2570 | lemma uniformly_continuous_on_extension_at_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2571 | fixes f::"'a::metric_space \<Rightarrow> 'b::complete_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2572 | assumes uc: "uniformly_continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2573 | assumes "x \<in> closure X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2574 | obtains l where "(f \<longlongrightarrow> l) (at x within X)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2575 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2576 | from assms obtain xs where xs: "xs \<longlonglongrightarrow> x" "\<And>n. xs n \<in> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2577 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2578 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2579 | from uniformly_continuous_on_Cauchy[OF uc LIMSEQ_imp_Cauchy, OF xs] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2580 | obtain l where l: "(\<lambda>n. f (xs n)) \<longlonglongrightarrow> l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2581 | by atomize_elim (simp only: convergent_eq_Cauchy) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2582 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2583 | have "(f \<longlongrightarrow> l) (at x within X)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2584 | proof (safe intro!: Lim_within_LIMSEQ) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2585 | fix xs' | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2586 | assume "\<forall>n. xs' n \<noteq> x \<and> xs' n \<in> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2587 | and xs': "xs' \<longlonglongrightarrow> x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2588 | then have "xs' n \<noteq> x" "xs' n \<in> X" for n by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2589 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2590 | from uniformly_continuous_on_Cauchy[OF uc LIMSEQ_imp_Cauchy, OF \<open>xs' \<longlonglongrightarrow> x\<close> \<open>xs' _ \<in> X\<close>] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2591 | obtain l' where l': "(\<lambda>n. f (xs' n)) \<longlonglongrightarrow> l'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2592 | by atomize_elim (simp only: convergent_eq_Cauchy) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2593 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2594 | show "(\<lambda>n. f (xs' n)) \<longlonglongrightarrow> l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2595 | proof (rule tendstoI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2596 | fix e::real assume "e > 0" | 
| 72225 | 2597 | define e' where "e' \<equiv> e/2" | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2598 | have "e' > 0" using \<open>e > 0\<close> by (simp add: e'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2599 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2600 | have "\<forall>\<^sub>F n in sequentially. dist (f (xs n)) l < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2601 | by (simp add: \<open>0 < e'\<close> l tendstoD) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2602 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2603 | from uc[unfolded uniformly_continuous_on_def, rule_format, OF \<open>e' > 0\<close>] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2604 | obtain d where d: "d > 0" "\<And>x x'. x \<in> X \<Longrightarrow> x' \<in> X \<Longrightarrow> dist x x' < d \<Longrightarrow> dist (f x) (f x') < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2605 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2606 | have "\<forall>\<^sub>F n in sequentially. dist (xs n) (xs' n) < d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2607 | by (auto intro!: \<open>0 < d\<close> order_tendstoD tendsto_eq_intros xs xs') | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2608 | ultimately | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2609 | show "\<forall>\<^sub>F n in sequentially. dist (f (xs' n)) l < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2610 | proof eventually_elim | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2611 | case (elim n) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2612 | have "dist (f (xs' n)) l \<le> dist (f (xs n)) (f (xs' n)) + dist (f (xs n)) l" | 
| 70960 | 2613 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2614 | also have "dist (f (xs n)) (f (xs' n)) < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2615 | by (auto intro!: d xs \<open>xs' _ \<in> _\<close> elim) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2616 | also note \<open>dist (f (xs n)) l < e'\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2617 | also have "e' + e' = e" by (simp add: e'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2618 | finally show ?case by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2619 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2620 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2621 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2622 | thus ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2623 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2624 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2625 | lemma uniformly_continuous_on_extension_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2626 | fixes f::"'a::metric_space \<Rightarrow> 'b::complete_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2627 | assumes uc: "uniformly_continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2628 | obtains g where "uniformly_continuous_on (closure X) g" "\<And>x. x \<in> X \<Longrightarrow> f x = g x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2629 | "\<And>Y h x. X \<subseteq> Y \<Longrightarrow> Y \<subseteq> closure X \<Longrightarrow> continuous_on Y h \<Longrightarrow> (\<And>x. x \<in> X \<Longrightarrow> f x = h x) \<Longrightarrow> x \<in> Y \<Longrightarrow> h x = g x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2630 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2631 | from uc have cont_f: "continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2632 | by (simp add: uniformly_continuous_imp_continuous) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2633 | obtain y where y: "(f \<longlongrightarrow> y x) (at x within X)" if "x \<in> closure X" for x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2634 | apply atomize_elim | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2635 | apply (rule choice) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2636 | using uniformly_continuous_on_extension_at_closure[OF assms] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2637 | by metis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2638 | let ?g = "\<lambda>x. if x \<in> X then f x else y x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2639 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2640 | have "uniformly_continuous_on (closure X) ?g" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2641 | unfolding uniformly_continuous_on_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2642 | proof safe | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2643 | fix e::real assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2644 | define e' where "e' \<equiv> e / 3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2645 | have "e' > 0" using \<open>e > 0\<close> by (simp add: e'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2646 | from uc[unfolded uniformly_continuous_on_def, rule_format, OF \<open>0 < e'\<close>] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2647 | obtain d where "d > 0" and d: "\<And>x x'. x \<in> X \<Longrightarrow> x' \<in> X \<Longrightarrow> dist x' x < d \<Longrightarrow> dist (f x') (f x) < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2648 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2649 | define d' where "d' = d / 3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2650 | have "d' > 0" using \<open>d > 0\<close> by (simp add: d'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2651 | show "\<exists>d>0. \<forall>x\<in>closure X. \<forall>x'\<in>closure X. dist x' x < d \<longrightarrow> dist (?g x') (?g x) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2652 | proof (safe intro!: exI[where x=d'] \<open>d' > 0\<close>) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2653 | fix x x' assume x: "x \<in> closure X" and x': "x' \<in> closure X" and dist: "dist x' x < d'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2654 | then obtain xs xs' where xs: "xs \<longlonglongrightarrow> x" "\<And>n. xs n \<in> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2655 | and xs': "xs' \<longlonglongrightarrow> x'" "\<And>n. xs' n \<in> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2656 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2657 | have "\<forall>\<^sub>F n in sequentially. dist (xs' n) x' < d'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2658 | and "\<forall>\<^sub>F n in sequentially. dist (xs n) x < d'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2659 | by (auto intro!: \<open>0 < d'\<close> order_tendstoD tendsto_eq_intros xs xs') | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2660 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2661 | have "(\<lambda>x. f (xs x)) \<longlonglongrightarrow> y x" if "x \<in> closure X" "x \<notin> X" "xs \<longlonglongrightarrow> x" "\<And>n. xs n \<in> X" for xs x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2662 | using that not_eventuallyD | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2663 | by (force intro!: filterlim_compose[OF y[OF \<open>x \<in> closure X\<close>]] simp: filterlim_at) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2664 | then have "(\<lambda>x. f (xs' x)) \<longlonglongrightarrow> ?g x'" "(\<lambda>x. f (xs x)) \<longlonglongrightarrow> ?g x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2665 | using x x' | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2666 | by (auto intro!: continuous_on_tendsto_compose[OF cont_f] simp: xs' xs) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2667 | then have "\<forall>\<^sub>F n in sequentially. dist (f (xs' n)) (?g x') < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2668 | "\<forall>\<^sub>F n in sequentially. dist (f (xs n)) (?g x) < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2669 | by (auto intro!: \<open>0 < e'\<close> order_tendstoD tendsto_eq_intros) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2670 | ultimately | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2671 | have "\<forall>\<^sub>F n in sequentially. dist (?g x') (?g x) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2672 | proof eventually_elim | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2673 | case (elim n) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2674 | have "dist (?g x') (?g x) \<le> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2675 | dist (f (xs' n)) (?g x') + dist (f (xs' n)) (f (xs n)) + dist (f (xs n)) (?g x)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2676 | by (metis add.commute add_le_cancel_left dist_commute dist_triangle dist_triangle_le) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2677 | also | 
| 70960 | 2678 | from \<open>dist (xs' n) x' < d'\<close> \<open>dist x' x < d'\<close> \<open>dist (xs n) x < d'\<close> | 
| 2679 | have "dist (xs' n) (xs n) < d" unfolding d'_def by metric | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2680 | with \<open>xs _ \<in> X\<close> \<open>xs' _ \<in> X\<close> have "dist (f (xs' n)) (f (xs n)) < e'" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2681 | by (rule d) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2682 | also note \<open>dist (f (xs' n)) (?g x') < e'\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2683 | also note \<open>dist (f (xs n)) (?g x) < e'\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2684 | finally show ?case by (simp add: e'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2685 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2686 | then show "dist (?g x') (?g x) < e" by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2687 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2688 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2689 | moreover have "f x = ?g x" if "x \<in> X" for x using that by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2690 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2691 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2692 | fix Y h x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2693 | assume Y: "x \<in> Y" "X \<subseteq> Y" "Y \<subseteq> closure X" and cont_h: "continuous_on Y h" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2694 | and extension: "(\<And>x. x \<in> X \<Longrightarrow> f x = h x)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2695 |     {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2696 | assume "x \<notin> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2697 | have "x \<in> closure X" using Y by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2698 | then obtain xs where xs: "xs \<longlonglongrightarrow> x" "\<And>n. xs n \<in> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2699 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2700 | from continuous_on_tendsto_compose[OF cont_h xs(1)] xs(2) Y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2701 | have hx: "(\<lambda>x. f (xs x)) \<longlonglongrightarrow> h x" | 
| 69712 | 2702 | by (auto simp: subsetD extension) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2703 | then have "(\<lambda>x. f (xs x)) \<longlonglongrightarrow> y x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2704 | using \<open>x \<notin> X\<close> not_eventuallyD xs(2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2705 | by (force intro!: filterlim_compose[OF y[OF \<open>x \<in> closure X\<close>]] simp: filterlim_at xs) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2706 | with hx have "h x = y x" by (rule LIMSEQ_unique) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2707 | } then | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2708 | have "h x = ?g x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2709 | using extension by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2710 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2711 | ultimately show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2712 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2713 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2714 | lemma bounded_uniformly_continuous_image: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2715 | fixes f :: "'a :: heine_borel \<Rightarrow> 'b :: heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2716 | assumes "uniformly_continuous_on S f" "bounded S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2717 | shows "bounded(f ` S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2718 | by (metis (no_types, lifting) assms bounded_closure_image compact_closure compact_continuous_image compact_eq_bounded_closed image_cong uniformly_continuous_imp_continuous uniformly_continuous_on_extension_on_closure) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2719 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2720 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2721 | subsection \<open>With Abstract Topology (TODO: move and remove dependency?)\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2722 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2723 | lemma openin_contains_ball: | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2724 | "openin (top_of_set T) S \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2725 | S \<subseteq> T \<and> (\<forall>x \<in> S. \<exists>e. 0 < e \<and> ball x e \<inter> T \<subseteq> S)" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2726 | (is "?lhs = ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2727 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2728 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2729 | then show ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2730 | apply (simp add: openin_open) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2731 | apply (metis Int_commute Int_mono inf.cobounded2 open_contains_ball order_refl subsetCE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2732 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2733 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2734 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2735 | then show ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2736 | apply (simp add: openin_euclidean_subtopology_iff) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2737 | by (metis (no_types) Int_iff dist_commute inf.absorb_iff2 mem_ball) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2738 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2739 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2740 | lemma openin_contains_cball: | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2741 | "openin (top_of_set T) S \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2742 | S \<subseteq> T \<and> (\<forall>x \<in> S. \<exists>e. 0 < e \<and> cball x e \<inter> T \<subseteq> S)" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2743 | (is "?lhs = ?rhs") | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2744 | proof | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2745 | assume ?lhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2746 | then show ?rhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2747 | by (force simp add: openin_contains_ball intro: exI [where x="_/2"]) | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2748 | next | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2749 | assume ?rhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2750 | then show ?lhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2751 | by (force simp add: openin_contains_ball) | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2752 | qed | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2753 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2754 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2755 | subsection \<open>Closed Nest\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2756 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2757 | text \<open>Bounded closed nest property (proof does not use Heine-Borel)\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2758 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2759 | lemma bounded_closed_nest: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2760 |   fixes S :: "nat \<Rightarrow> ('a::heine_borel) set"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2761 | assumes "\<And>n. closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2762 |       and "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2763 | and "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2764 | and "bounded (S 0)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2765 | obtains a where "\<And>n. a \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2766 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2767 | from assms(2) obtain x where x: "\<forall>n. x n \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2768 | using choice[of "\<lambda>n x. x \<in> S n"] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2769 | from assms(4,1) have "seq_compact (S 0)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2770 | by (simp add: bounded_closed_imp_seq_compact) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2771 | then obtain l r where lr: "l \<in> S 0" "strict_mono r" "(x \<circ> r) \<longlonglongrightarrow> l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2772 | using x and assms(3) unfolding seq_compact_def by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2773 | have "\<forall>n. l \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2774 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2775 | fix n :: nat | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2776 | have "closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2777 | using assms(1) by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2778 | moreover have "\<forall>i. (x \<circ> r) i \<in> S i" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2779 | using x and assms(3) and lr(2) [THEN seq_suble] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2780 | then have "\<forall>i. (x \<circ> r) (i + n) \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2781 | using assms(3) by (fast intro!: le_add2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2782 | moreover have "(\<lambda>i. (x \<circ> r) (i + n)) \<longlonglongrightarrow> l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2783 | using lr(3) by (rule LIMSEQ_ignore_initial_segment) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2784 | ultimately show "l \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2785 | by (rule closed_sequentially) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2786 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2787 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2788 | using that by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2789 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2790 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2791 | text \<open>Decreasing case does not even need compactness, just completeness.\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2792 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2793 | lemma decreasing_closed_nest: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2794 |   fixes S :: "nat \<Rightarrow> ('a::complete_space) set"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2795 | assumes "\<And>n. closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2796 |           "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2797 | "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2798 | "\<And>e. e>0 \<Longrightarrow> \<exists>n. \<forall>x\<in>S n. \<forall>y\<in>S n. dist x y < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2799 | obtains a where "\<And>n. a \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2800 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2801 | have "\<forall>n. \<exists>x. x \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2802 | using assms(2) by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2803 | then have "\<exists>t. \<forall>n. t n \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2804 | using choice[of "\<lambda>n x. x \<in> S n"] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2805 | then obtain t where t: "\<forall>n. t n \<in> S n" by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2806 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2807 | fix e :: real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2808 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2809 | then obtain N where N: "\<forall>x\<in>S N. \<forall>y\<in>S N. dist x y < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2810 | using assms(4) by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2811 |     {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2812 | fix m n :: nat | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2813 | assume "N \<le> m \<and> N \<le> n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2814 | then have "t m \<in> S N" "t n \<in> S N" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2815 | using assms(3) t unfolding subset_eq t by blast+ | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2816 | then have "dist (t m) (t n) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2817 | using N by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2818 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2819 | then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2820 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2821 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2822 | then have "Cauchy t" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2823 | unfolding cauchy_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2824 | then obtain l where l:"(t \<longlongrightarrow> l) sequentially" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2825 | using complete_UNIV unfolding complete_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2826 |   { fix n :: nat
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2827 |     { fix e :: real
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2828 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2829 | then obtain N :: nat where N: "\<forall>n\<ge>N. dist (t n) l < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2830 | using l[unfolded lim_sequentially] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2831 | have "t (max n N) \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2832 | by (meson assms(3) contra_subsetD max.cobounded1 t) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2833 | then have "\<exists>y\<in>S n. dist y l < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2834 | using N max.cobounded2 by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2835 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2836 | then have "l \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2837 | using closed_approachable[of "S n" l] assms(1) by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2838 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2839 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2840 | using that by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2841 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2842 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2843 | text \<open>Strengthen it to the intersection actually being a singleton.\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2844 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2845 | lemma decreasing_closed_nest_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2846 | fixes S :: "nat \<Rightarrow> 'a::complete_space set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2847 | assumes "\<And>n. closed(S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2848 |           "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2849 | "\<And>m n. m \<le> n \<Longrightarrow> S n \<subseteq> S m" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2850 | "\<And>e. e>0 \<Longrightarrow> \<exists>n. \<forall>x \<in> (S n). \<forall> y\<in>(S n). dist x y < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2851 |   shows "\<exists>a. \<Inter>(range S) = {a}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2852 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2853 | obtain a where a: "\<forall>n. a \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2854 | using decreasing_closed_nest[of S] using assms by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2855 |   { fix b
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2856 | assume b: "b \<in> \<Inter>(range S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2857 |     { fix e :: real
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2858 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2859 | then have "dist a b < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2860 | using assms(4) and b and a by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2861 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2862 | then have "dist a b = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2863 | by (metis dist_eq_0_iff dist_nz less_le) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2864 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2865 |   with a have "\<Inter>(range S) = {a}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2866 | unfolding image_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2867 | then show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2868 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2869 | |
| 70136 | 2870 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Making a continuous function avoid some value in a neighbourhood\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2871 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2872 | lemma continuous_within_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2873 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2874 | assumes "continuous (at x within s) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2875 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2876 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2877 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2878 | obtain U where "open U" and "f x \<in> U" and "a \<notin> U" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2879 | using t1_space [OF \<open>f x \<noteq> a\<close>] by fast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2880 | have "(f \<longlongrightarrow> f x) (at x within s)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2881 | using assms(1) by (simp add: continuous_within) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2882 | then have "eventually (\<lambda>y. f y \<in> U) (at x within s)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2883 | using \<open>open U\<close> and \<open>f x \<in> U\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2884 | unfolding tendsto_def by fast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2885 | then have "eventually (\<lambda>y. f y \<noteq> a) (at x within s)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2886 | using \<open>a \<notin> U\<close> by (fast elim: eventually_mono) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2887 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2888 | using \<open>f x \<noteq> a\<close> by (auto simp: dist_commute eventually_at) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2889 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2890 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2891 | lemma continuous_at_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2892 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2893 | assumes "continuous (at x) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2894 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2895 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2896 | using assms continuous_within_avoid[of x UNIV f a] by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2897 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2898 | lemma continuous_on_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2899 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2900 | assumes "continuous_on s f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2901 | and "x \<in> s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2902 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2903 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2904 | using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2905 | OF assms(2)] continuous_within_avoid[of x s f a] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2906 | using assms(3) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2907 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2908 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2909 | lemma continuous_on_open_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2910 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2911 | assumes "continuous_on s f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2912 | and "open s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2913 | and "x \<in> s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2914 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2915 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2916 | using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2917 | using continuous_at_avoid[of x f a] assms(4) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2918 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2919 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2920 | subsection \<open>Consequences for Real Numbers\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2921 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2922 | lemma closed_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2923 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2924 |   shows "S \<noteq> {} \<Longrightarrow> bdd_below S \<Longrightarrow> closed S \<Longrightarrow> Inf S \<in> S"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2925 | by (metis closure_contains_Inf closure_closed) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2926 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2927 | lemma closed_subset_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2928 | fixes A C :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2929 |   shows "closed C \<Longrightarrow> A \<subseteq> C \<Longrightarrow> A \<noteq> {} \<Longrightarrow> bdd_below A \<Longrightarrow> Inf A \<in> C"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2930 | by (metis closure_contains_Inf closure_minimal subset_eq) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2931 | |
| 70617 | 2932 | lemma closed_contains_Sup: | 
| 2933 | fixes S :: "real set" | |
| 2934 |   shows "S \<noteq> {} \<Longrightarrow> bdd_above S \<Longrightarrow> closed S \<Longrightarrow> Sup S \<in> S"
 | |
| 2935 | by (subst closure_closed[symmetric], assumption, rule closure_contains_Sup) | |
| 2936 | ||
| 2937 | lemma closed_subset_contains_Sup: | |
| 2938 | fixes A C :: "real set" | |
| 2939 |   shows "closed C \<Longrightarrow> A \<subseteq> C \<Longrightarrow> A \<noteq> {} \<Longrightarrow> bdd_above A \<Longrightarrow> Sup A \<in> C"
 | |
| 2940 | by (metis closure_contains_Sup closure_minimal subset_eq) | |
| 2941 | ||
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2942 | lemma atLeastAtMost_subset_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2943 | fixes A :: "real set" and a b :: real | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2944 |   shows "A \<noteq> {} \<Longrightarrow> a \<le> b \<Longrightarrow> A \<subseteq> {a..b} \<Longrightarrow> Inf A \<in> {a..b}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2945 | by (rule closed_subset_contains_Inf) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2946 | (auto intro: closed_real_atLeastAtMost intro!: bdd_belowI[of A a]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2947 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2948 | lemma bounded_real: "bounded (S::real set) \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. \<bar>x\<bar> \<le> a)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2949 | by (simp add: bounded_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2950 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2951 | lemma bounded_imp_bdd_above: "bounded S \<Longrightarrow> bdd_above (S :: real set)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2952 | by (auto simp: bounded_def bdd_above_def dist_real_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2953 | (metis abs_le_D1 abs_minus_commute diff_le_eq) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2954 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2955 | lemma bounded_imp_bdd_below: "bounded S \<Longrightarrow> bdd_below (S :: real set)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2956 | by (auto simp: bounded_def bdd_below_def dist_real_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2957 | (metis abs_le_D1 add.commute diff_le_eq) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2958 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2959 | lemma bounded_has_Sup: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2960 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2961 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2962 |     and "S \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2963 | shows "\<forall>x\<in>S. x \<le> Sup S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2964 | and "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2965 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2966 | show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2967 | using assms by (metis cSup_least) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2968 | qed (metis cSup_upper assms(1) bounded_imp_bdd_above) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2969 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2970 | lemma Sup_insert: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2971 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2972 |   shows "bounded S \<Longrightarrow> Sup (insert x S) = (if S = {} then x else max x (Sup S))"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2973 | by (auto simp: bounded_imp_bdd_above sup_max cSup_insert_If) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2974 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2975 | lemma bounded_has_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2976 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2977 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2978 |     and "S \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2979 | shows "\<forall>x\<in>S. x \<ge> Inf S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2980 | and "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2981 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2982 | show "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2983 | using assms by (metis cInf_greatest) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2984 | qed (metis cInf_lower assms(1) bounded_imp_bdd_below) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2985 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2986 | lemma Inf_insert: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2987 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2988 |   shows "bounded S \<Longrightarrow> Inf (insert x S) = (if S = {} then x else min x (Inf S))"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2989 | by (auto simp: bounded_imp_bdd_below inf_min cInf_insert_If) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2990 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2991 | lemma open_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2992 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2993 | shows "open s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. \<bar>x' - x\<bar> < e --> x' \<in> s)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2994 | unfolding open_dist dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2995 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2996 | lemma islimpt_approachable_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2997 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2998 | shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2999 | unfolding islimpt_approachable dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3000 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3001 | lemma closed_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3002 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3003 | shows "closed s \<longleftrightarrow> (\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> \<bar>x' - x\<bar> < e) \<longrightarrow> x \<in> s)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3004 | unfolding closed_limpt islimpt_approachable dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3005 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3006 | lemma continuous_at_real_range: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3007 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3008 | shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'. norm(x' - x) < d --> \<bar>f x' - f x\<bar> < e)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3009 | unfolding continuous_at | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3010 | unfolding Lim_at | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3011 | unfolding dist_norm | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3012 | apply auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3013 | apply (erule_tac x=e in allE, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3014 | apply (rule_tac x=d in exI, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3015 | apply (erule_tac x=x' in allE, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3016 | apply (erule_tac x=e in allE, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3017 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3018 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3019 | lemma continuous_on_real_range: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3020 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3021 | shows "continuous_on s f \<longleftrightarrow> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3022 | (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e))" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3023 | unfolding continuous_on_iff dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3024 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3025 | lemma continuous_on_closed_Collect_le: | 
| 69618 | 3026 | fixes f g :: "'a::topological_space \<Rightarrow> real" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3027 | assumes f: "continuous_on s f" and g: "continuous_on s g" and s: "closed s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3028 |   shows "closed {x \<in> s. f x \<le> g x}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3029 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3030 |   have "closed ((\<lambda>x. g x - f x) -` {0..} \<inter> s)"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3031 | using closed_real_atLeast continuous_on_diff [OF g f] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3032 | by (simp add: continuous_on_closed_vimage [OF s]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3033 |   also have "((\<lambda>x. g x - f x) -` {0..} \<inter> s) = {x\<in>s. f x \<le> g x}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3034 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3035 | finally show ?thesis . | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3036 | qed | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 3037 | |
| 69618 | 3038 | lemma continuous_le_on_closure: | 
| 3039 | fixes a::real | |
| 3040 | assumes f: "continuous_on (closure s) f" | |
| 3041 | and x: "x \<in> closure(s)" | |
| 3042 | and xlo: "\<And>x. x \<in> s ==> f(x) \<le> a" | |
| 3043 | shows "f(x) \<le> a" | |
| 3044 |   using image_closure_subset [OF f, where T=" {x. x \<le> a}" ] assms
 | |
| 3045 | continuous_on_closed_Collect_le[of "UNIV" "\<lambda>x. x" "\<lambda>x. a"] | |
| 3046 | by auto | |
| 3047 | ||
| 3048 | lemma continuous_ge_on_closure: | |
| 3049 | fixes a::real | |
| 3050 | assumes f: "continuous_on (closure s) f" | |
| 3051 | and x: "x \<in> closure(s)" | |
| 3052 | and xlo: "\<And>x. x \<in> s ==> f(x) \<ge> a" | |
| 3053 | shows "f(x) \<ge> a" | |
| 3054 |   using image_closure_subset [OF f, where T=" {x. a \<le> x}"] assms
 | |
| 3055 | continuous_on_closed_Collect_le[of "UNIV" "\<lambda>x. a" "\<lambda>x. x"] | |
| 3056 | by auto | |
| 3057 | ||
| 3058 | ||
| 3059 | subsection\<open>The infimum of the distance between two sets\<close> | |
| 3060 | ||
| 70136 | 3061 | definition\<^marker>\<open>tag important\<close> setdist :: "'a::metric_space set \<Rightarrow> 'a set \<Rightarrow> real" where | 
| 69618 | 3062 | "setdist s t \<equiv> | 
| 3063 |        (if s = {} \<or> t = {} then 0
 | |
| 3064 |         else Inf {dist x y| x y. x \<in> s \<and> y \<in> t})"
 | |
| 3065 | ||
| 3066 | lemma setdist_empty1 [simp]: "setdist {} t = 0"
 | |
| 3067 | by (simp add: setdist_def) | |
| 3068 | ||
| 3069 | lemma setdist_empty2 [simp]: "setdist t {} = 0"
 | |
| 3070 | by (simp add: setdist_def) | |
| 3071 | ||
| 3072 | lemma setdist_pos_le [simp]: "0 \<le> setdist s t" | |
| 3073 | by (auto simp: setdist_def ex_in_conv [symmetric] intro: cInf_greatest) | |
| 3074 | ||
| 3075 | lemma le_setdistI: | |
| 3076 |   assumes "s \<noteq> {}" "t \<noteq> {}" "\<And>x y. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> d \<le> dist x y"
 | |
| 3077 | shows "d \<le> setdist s t" | |
| 3078 | using assms | |
| 3079 | by (auto simp: setdist_def Set.ex_in_conv [symmetric] intro: cInf_greatest) | |
| 3080 | ||
| 3081 | lemma setdist_le_dist: "\<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y" | |
| 3082 | unfolding setdist_def | |
| 3083 | by (auto intro!: bdd_belowI [where m=0] cInf_lower) | |
| 3084 | ||
| 3085 | lemma le_setdist_iff: | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3086 | "d \<le> setdist S T \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3087 |         (\<forall>x \<in> S. \<forall>y \<in> T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)"
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3088 |   apply (cases "S = {} \<or> T = {}")
 | 
| 69618 | 3089 | apply (force simp add: setdist_def) | 
| 3090 | apply (intro iffI conjI) | |
| 3091 | using setdist_le_dist apply fastforce | |
| 3092 | apply (auto simp: intro: le_setdistI) | |
| 3093 | done | |
| 3094 | ||
| 3095 | lemma setdist_ltE: | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3096 |   assumes "setdist S T < b" "S \<noteq> {}" "T \<noteq> {}"
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3097 | obtains x y where "x \<in> S" "y \<in> T" "dist x y < b" | 
| 69618 | 3098 | using assms | 
| 3099 | by (auto simp: not_le [symmetric] le_setdist_iff) | |
| 3100 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3101 | lemma setdist_refl: "setdist S S = 0" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3102 |   apply (cases "S = {}")
 | 
| 69618 | 3103 | apply (force simp add: setdist_def) | 
| 3104 | apply (rule antisym [OF _ setdist_pos_le]) | |
| 3105 | apply (metis all_not_in_conv dist_self setdist_le_dist) | |
| 3106 | done | |
| 3107 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3108 | lemma setdist_sym: "setdist S T = setdist T S" | 
| 69618 | 3109 | by (force simp: setdist_def dist_commute intro!: arg_cong [where f=Inf]) | 
| 3110 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3111 | lemma setdist_triangle: "setdist S T \<le> setdist S {a} + setdist {a} T"
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3112 | proof (cases "S = {} \<or> T = {}")
 | 
| 69618 | 3113 | case True then show ?thesis | 
| 3114 | using setdist_pos_le by fastforce | |
| 3115 | next | |
| 3116 | case False | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3117 |   then have "\<And>x. x \<in> S \<Longrightarrow> setdist S T - dist x a \<le> setdist {a} T"
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3118 | apply (intro le_setdistI) | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3119 | apply (simp_all add: algebra_simps) | 
| 69618 | 3120 | apply (metis dist_commute dist_triangle3 order_trans [OF setdist_le_dist]) | 
| 3121 | done | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3122 |   then have "setdist S T - setdist {a} T \<le> setdist S {a}"
 | 
| 69618 | 3123 | using False by (fastforce intro: le_setdistI) | 
| 3124 | then show ?thesis | |
| 3125 | by (simp add: algebra_simps) | |
| 3126 | qed | |
| 3127 | ||
| 3128 | lemma setdist_singletons [simp]: "setdist {x} {y} = dist x y"
 | |
| 3129 | by (simp add: setdist_def) | |
| 3130 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3131 | lemma setdist_Lipschitz: "\<bar>setdist {x} S - setdist {y} S\<bar> \<le> dist x y"
 | 
| 69618 | 3132 | apply (subst setdist_singletons [symmetric]) | 
| 3133 | by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym) | |
| 3134 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3135 | lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3136 | by (force simp: continuous_at_eps_delta dist_real_def intro: le_less_trans [OF setdist_Lipschitz]) | 
| 3137 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3138 | lemma continuous_on_setdist [continuous_intros]: "continuous_on T (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3139 | by (metis continuous_at_setdist continuous_at_imp_continuous_on) | 
| 3140 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3141 | lemma uniformly_continuous_on_setdist: "uniformly_continuous_on T (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3142 | by (force simp: uniformly_continuous_on_def dist_real_def intro: le_less_trans [OF setdist_Lipschitz]) | 
| 3143 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3144 | lemma setdist_subset_right: "\<lbrakk>T \<noteq> {}; T \<subseteq> u\<rbrakk> \<Longrightarrow> setdist S u \<le> setdist S T"
 | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3145 |   apply (cases "S = {} \<or> u = {}", force)
 | 
| 69618 | 3146 | apply (auto simp: setdist_def intro!: bdd_belowI [where m=0] cInf_superset_mono) | 
| 3147 | done | |
| 3148 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3149 | lemma setdist_subset_left: "\<lbrakk>S \<noteq> {}; S \<subseteq> T\<rbrakk> \<Longrightarrow> setdist T u \<le> setdist S u"
 | 
| 69618 | 3150 | by (metis setdist_subset_right setdist_sym) | 
| 3151 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3152 | lemma setdist_closure_1 [simp]: "setdist (closure S) T = setdist S T" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3153 | proof (cases "S = {} \<or> T = {}")
 | 
| 69618 | 3154 | case True then show ?thesis by force | 
| 3155 | next | |
| 3156 | case False | |
| 3157 |   { fix y
 | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3158 | assume "y \<in> T" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3159 | have "continuous_on (closure S) (\<lambda>a. dist a y)" | 
| 69618 | 3160 | by (auto simp: continuous_intros dist_norm) | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3161 | then have *: "\<And>x. x \<in> closure S \<Longrightarrow> setdist S T \<le> dist x y" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3162 | by (fast intro: setdist_le_dist \<open>y \<in> T\<close> continuous_ge_on_closure) | 
| 69618 | 3163 | } note * = this | 
| 3164 | show ?thesis | |
| 3165 | apply (rule antisym) | |
| 3166 | using False closure_subset apply (blast intro: setdist_subset_left) | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3167 | using False * apply (force intro!: le_setdistI) | 
| 69618 | 3168 | done | 
| 3169 | qed | |
| 3170 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3171 | lemma setdist_closure_2 [simp]: "setdist T (closure S) = setdist T S" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3172 | by (metis setdist_closure_1 setdist_sym) | 
| 69618 | 3173 | |
| 3174 | lemma setdist_eq_0I: "\<lbrakk>x \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> setdist S T = 0" | |
| 3175 | by (metis antisym dist_self setdist_le_dist setdist_pos_le) | |
| 3176 | ||
| 3177 | lemma setdist_unique: | |
| 3178 | "\<lbrakk>a \<in> S; b \<in> T; \<And>x y. x \<in> S \<and> y \<in> T ==> dist a b \<le> dist x y\<rbrakk> | |
| 3179 | \<Longrightarrow> setdist S T = dist a b" | |
| 3180 | by (force simp add: setdist_le_dist le_setdist_iff intro: antisym) | |
| 3181 | ||
| 3182 | lemma setdist_le_sing: "x \<in> S ==> setdist S T \<le> setdist {x} T"
 | |
| 3183 | using setdist_subset_left by auto | |
| 3184 | ||
| 69918 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3185 | lemma infdist_eq_setdist: "infdist x A = setdist {x} A"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3186 | by (simp add: infdist_def setdist_def Setcompr_eq_image) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3187 | |
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3188 | lemma setdist_eq_infdist: "setdist A B = (if A = {} then 0 else INF a\<in>A. infdist a B)"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3189 | proof - | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3190 |   have "Inf {dist x y |x y. x \<in> A \<and> y \<in> B} = (INF x\<in>A. Inf (dist x ` B))"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3191 | if "b \<in> B" "a \<in> A" for a b | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3192 | proof (rule order_antisym) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3193 |     have "Inf {dist x y |x y. x \<in> A \<and> y \<in> B} \<le> Inf (dist x ` B)"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3194 | if "b \<in> B" "a \<in> A" "x \<in> A" for x | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3195 | proof - | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3196 |       have *: "\<And>b'. b' \<in> B \<Longrightarrow> Inf {dist x y |x y. x \<in> A \<and> y \<in> B} \<le> dist x b'"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3197 | by (metis (mono_tags, lifting) ex_in_conv setdist_def setdist_le_dist that(3)) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3198 | show ?thesis | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3199 | using that by (subst conditionally_complete_lattice_class.le_cInf_iff) (auto simp: *)+ | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3200 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3201 |     then show "Inf {dist x y |x y. x \<in> A \<and> y \<in> B} \<le> (INF x\<in>A. Inf (dist x ` B))"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3202 | using that | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3203 | by (subst conditionally_complete_lattice_class.le_cInf_iff) (auto simp: bdd_below_def) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3204 | next | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3205 | have *: "\<And>x y. \<lbrakk>b \<in> B; a \<in> A; x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. Inf (dist a ` B) \<le> dist x y" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3206 | by (meson bdd_below_image_dist cINF_lower) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3207 |     show "(INF x\<in>A. Inf (dist x ` B)) \<le> Inf {dist x y |x y. x \<in> A \<and> y \<in> B}"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3208 | proof (rule conditionally_complete_lattice_class.cInf_mono) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3209 | show "bdd_below ((\<lambda>x. Inf (dist x ` B)) ` A)" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3210 | by (metis (no_types, lifting) bdd_belowI2 ex_in_conv infdist_def infdist_nonneg that(1)) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3211 | qed (use that in \<open>auto simp: *\<close>) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3212 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3213 | then show ?thesis | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3214 | by (auto simp: setdist_def infdist_def) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3215 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3216 | |
| 70724 | 3217 | lemma infdist_mono: | 
| 3218 |   assumes "A \<subseteq> B" "A \<noteq> {}"
 | |
| 3219 | shows "infdist x B \<le> infdist x A" | |
| 3220 | by (simp add: assms infdist_eq_setdist setdist_subset_right) | |
| 3221 | ||
| 3222 | lemma infdist_singleton [simp]: | |
| 3223 |   "infdist x {y} = dist x y"
 | |
| 3224 | by (simp add: infdist_eq_setdist) | |
| 3225 | ||
| 69918 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3226 | proposition setdist_attains_inf: | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3227 |   assumes "compact B" "B \<noteq> {}"
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3228 | obtains y where "y \<in> B" "setdist A B = infdist y A" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3229 | proof (cases "A = {}")
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3230 | case True | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3231 | then show thesis | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3232 | by (metis assms diameter_compact_attained infdist_def setdist_def that) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3233 | next | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3234 | case False | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3235 | obtain y where "y \<in> B" and min: "\<And>y'. y' \<in> B \<Longrightarrow> infdist y A \<le> infdist y' A" | 
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 3236 | by (metis continuous_attains_inf [OF assms continuous_on_infdist] continuous_on_id) | 
| 69918 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3237 | show thesis | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3238 | proof | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3239 | have "setdist A B = (INF y\<in>B. infdist y A)" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3240 |       by (metis \<open>B \<noteq> {}\<close> setdist_eq_infdist setdist_sym)
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3241 | also have "\<dots> = infdist y A" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3242 | proof (rule order_antisym) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3243 | show "(INF y\<in>B. infdist y A) \<le> infdist y A" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3244 | proof (rule cInf_lower) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3245 | show "infdist y A \<in> (\<lambda>y. infdist y A) ` B" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3246 | using \<open>y \<in> B\<close> by blast | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3247 | show "bdd_below ((\<lambda>y. infdist y A) ` B)" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3248 | by (meson bdd_belowI2 infdist_nonneg) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3249 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3250 | next | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3251 | show "infdist y A \<le> (INF y\<in>B. infdist y A)" | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3252 |         by (simp add: \<open>B \<noteq> {}\<close> cINF_greatest min)
 | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3253 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3254 | finally show "setdist A B = infdist y A" . | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3255 | qed (fact \<open>y \<in> B\<close>) | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3256 | qed | 
| 
eddcc7c726f3
new material;' strengthened material; moved proofs out of Function_Topology in order to lessen its dependencies
 paulson <lp15@cam.ac.uk> parents: 
69712diff
changeset | 3257 | |
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 3258 | end |