| author | wenzelm | 
| Sat, 24 Feb 2024 11:27:04 +0100 | |
| changeset 79718 | fba02e281b44 | 
| parent 78890 | d8045bc0544e | 
| child 79772 | 817d33f8aa7f | 
| 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 = {}"
 | 
| 76796 | 36 | by auto | 
| 69544 
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}"
 | 
| 76796 | 39 | by auto | 
| 69544 
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}"
 | 
| 76796 | 42 | by auto | 
| 69544 
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"
 | 
| 76796 | 199 | by (smt (verit, best) Diff_empty ball_eq_empty cball_diff_sphere centre_in_ball centre_in_cball sphere_empty) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 200 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 201 | 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 | 202 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 203 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 204 | lemma cball_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 205 | fixes x :: "'a::metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 206 |   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 | 207 | by simp | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 208 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 209 | 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 | 210 | 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 | 211 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 212 | 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 | 213 | using ball_divide_subset one_le_numeral by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 214 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 215 | lemma cball_divide_subset: "d \<ge> 1 \<Longrightarrow> cball x (e/d) \<subseteq> cball x e" | 
| 76796 | 216 | by (smt (verit, best) cball_empty div_by_1 frac_le subset_cball zero_le_divide_iff) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 217 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 218 | 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 | 219 | using cball_divide_subset one_le_numeral by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 220 | |
| 71192 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 221 | lemma cball_scale: | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 222 | assumes "a \<noteq> 0" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 223 | 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 | 224 | proof - | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 225 | 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 | 226 | proof safe | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 227 | fix x | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 228 | assume x: "x \<in> cball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 229 | 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 | 230 | by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 231 | 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 | 232 | by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 233 | 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 | 234 | using that x by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 235 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 236 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 237 | 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 | 238 | unfolding image_image using assms by simp | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 239 | 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 | 240 | using assms by (intro image_mono 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 241 | 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 | 242 | using assms by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 243 | 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 | 244 | 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 | 245 | by (intro 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 246 | ultimately show ?thesis by blast | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 247 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 248 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 249 | lemma ball_scale: | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 250 | assumes "a \<noteq> 0" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 251 | 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 | 252 | proof - | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 253 | 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 | 254 | proof safe | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 255 | fix x | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 256 | assume x: "x \<in> ball c r" | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 257 | 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 | 258 | by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 259 | 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 | 260 | by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 261 | 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 | 262 | using that x by (auto simp: dist_norm) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 263 | qed | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 264 | |
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 265 | 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 | 266 | unfolding image_image using assms by simp | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 267 | 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 | 268 | using assms by (intro image_mono 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 269 | 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 | 270 | using assms by (simp add: algebra_simps) | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 271 | 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 | 272 | 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 | 273 | by (intro 1) auto | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 274 | ultimately show ?thesis by blast | 
| 
a8ccea88b725
Flattened dependency tree of HOL-Analysis
 Manuel Eberl <eberlm@in.tum.de> parents: 
71174diff
changeset | 275 | qed | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 276 | |
| 77223 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 277 | lemma frequently_atE: | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 278 | fixes x :: "'a :: metric_space" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 279 | assumes "frequently P (at x within s)" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 280 | shows "\<exists>f. filterlim f (at x within s) sequentially \<and> (\<forall>n. P (f n))" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 281 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 282 |   have "\<exists>y. y \<in> s \<inter> (ball x (1 / real (Suc n)) - {x}) \<and> P y" for n
 | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 283 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 284 | have "\<exists>z\<in>s. z \<noteq> x \<and> dist z x < (1 / real (Suc n)) \<and> P z" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 285 | by (metis assms divide_pos_pos frequently_at of_nat_0_less_iff zero_less_Suc zero_less_one) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 286 | then show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 287 | by (auto simp: dist_commute conj_commute) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 288 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 289 |   then obtain f where f: "\<And>n. f n \<in> s \<inter> (ball x (1 / real (Suc n)) - {x}) \<and> P (f n)"
 | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 290 | by metis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 291 | have "filterlim f (nhds x) sequentially" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 292 | unfolding tendsto_iff | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 293 | proof clarify | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 294 | fix e :: real | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 295 | assume e: "e > 0" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 296 | then obtain n where n: "Suc n > 1 / e" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 297 | by (meson le_nat_floor lessI not_le) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 298 | have "dist (f k) x < e" if "k \<ge> n" for k | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 299 | proof - | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 300 | have "dist (f k) x < 1 / real (Suc k)" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 301 | using f[of k] by (auto simp: dist_commute) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 302 | also have "\<dots> \<le> 1 / real (Suc n)" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 303 | using that by (intro divide_left_mono) auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 304 | also have "\<dots> < e" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 305 | using n e by (simp add: field_simps) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 306 | finally show ?thesis . | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 307 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 308 | thus "\<forall>\<^sub>F k in sequentially. dist (f k) x < e" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 309 | unfolding eventually_at_top_linorder by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 310 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 311 | moreover have "f n \<noteq> x" for n | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 312 | using f[of n] by auto | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 313 | ultimately have "filterlim f (at x within s) sequentially" | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 314 | using f by (auto simp: filterlim_at) | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 315 | with f show ?thesis | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 316 | by blast | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 317 | qed | 
| 
607e1e345e8f
Lots of new material chiefly about complex analysis
 paulson <lp15@cam.ac.uk> parents: 
77179diff
changeset | 318 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 319 | subsection \<open>Limit Points\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 320 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 321 | lemma islimpt_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 322 | fixes x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 323 | 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 | 324 | 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 | 325 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 326 | 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 | 327 | for x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 328 | unfolding islimpt_approachable | 
| 72225 | 329 | 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"] | 
| 330 | by auto | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 331 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 332 | 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 | 333 | for x :: "'a::metric_space" | 
| 76796 | 334 | by (metis islimpt_def islimpt_eq_acc_point mem_Collect_eq) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 335 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 336 | 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 | 337 | 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 | 338 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 339 | 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 | 340 | for x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 341 | 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 | 342 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 343 | lemma islimpt_eq_infinite_ball: "x islimpt S \<longleftrightarrow> (\<forall>e>0. infinite(S \<inter> ball x e))" | 
| 76796 | 344 | unfolding islimpt_eq_acc_point | 
| 345 | by (metis open_ball Int_commute Int_mono finite_subset open_contains_ball_eq subset_eq) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 346 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 347 | lemma islimpt_eq_infinite_cball: "x islimpt S \<longleftrightarrow> (\<forall>e>0. infinite(S \<inter> cball x e))" | 
| 76796 | 348 | unfolding islimpt_eq_infinite_ball | 
| 349 | by (metis open_ball ball_subset_cball centre_in_ball finite_Int inf.absorb_iff2 inf_assoc open_contains_cball_eq) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 350 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 351 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 352 | subsection \<open>Perfect Metric Spaces\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 353 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 354 | 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 | 355 |   for x :: "'a::{perfect_space,metric_space}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 356 | 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 | 357 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 358 | lemma cball_eq_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 359 |   fixes x :: "'a::{metric_space,perfect_space}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 360 |   shows "cball x e = {x} \<longleftrightarrow> e = 0"
 | 
| 76796 | 361 | by (smt (verit, best) open_ball ball_eq_empty ball_subset_cball cball_empty cball_trivial | 
| 362 | not_open_singleton subset_singleton_iff) | |
| 363 | ||
| 364 | ||
| 365 | subsection \<open>Finite and discrete\<close> | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 366 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 367 | lemma finite_ball_include: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 368 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 369 | assumes "finite S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 370 | 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 | 371 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 372 | proof induction | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 373 | case (insert x S) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 374 | 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 | 375 | 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 | 376 | 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 | 377 | 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 | 378 | 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 | 379 | ultimately show ?case by auto | 
| 
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 finite_set_avoid: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 383 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 384 | assumes "finite S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 385 | 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 | 386 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 387 | proof induction | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 388 | case (insert x S) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 389 | 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 | 390 | by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 391 | show ?case | 
| 76796 | 392 | by (smt (verit, del_insts) dist_pos_lt insert.IH insert_iff) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 393 | qed (auto intro: zero_less_one) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 394 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 395 | lemma discrete_imp_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 396 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 397 | assumes e: "0 < e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 398 | 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 | 399 | shows "closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 400 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 401 | 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 | 402 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 403 | from e have e2: "e/2 > 0" by arith | 
| 76796 | 404 | from C[OF e2] obtain y where y: "y \<in> S" "y \<noteq> x" "dist y x < e/2" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 405 | by blast | 
| 70960 | 406 | 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 | 407 | by simp | 
| 70960 | 408 | from d y C[OF mp] show ?thesis | 
| 409 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 410 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 411 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 412 | 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 | 413 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 414 | |
| 77140 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 415 | lemma discrete_imp_not_islimpt: | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 416 | assumes e: "0 < e" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 417 | and d: "\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> dist y x < e \<Longrightarrow> y = x" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 418 | shows "\<not> x islimpt S" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 419 | proof | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 420 | assume "x islimpt S" | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 421 |   hence "x islimpt S - {x}"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 422 | by (meson islimpt_punctured) | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 423 |   moreover from assms have "closed (S - {x})"
 | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 424 | by (intro discrete_imp_closed) auto | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 425 | ultimately show False | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 426 | unfolding closed_limpt by blast | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 427 | qed | 
| 
9a60c1759543
Lots more new material thanks to Manuel Eberl
 paulson <lp15@cam.ac.uk> parents: 
76796diff
changeset | 428 | |
| 69544 
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 | subsection \<open>Interior\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 431 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 432 | 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 | 433 | 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 | 434 | by (simp add: open_subset_interior) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 435 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 436 | 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 | 437 | 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 | 438 | subset_trans) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 439 | |
| 78037 
37894dff0111
More material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
77490diff
changeset | 440 | lemma ball_iff_cball: "(\<exists>r>0. ball x r \<subseteq> U) \<longleftrightarrow> (\<exists>r>0. cball x r \<subseteq> U)" | 
| 
37894dff0111
More material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
77490diff
changeset | 441 | by (meson mem_interior mem_interior_cball) | 
| 
37894dff0111
More material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
77490diff
changeset | 442 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 443 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 444 | subsection \<open>Frontier\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 445 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 446 | lemma frontier_straddle: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 447 | fixes a :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 448 | 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 | 449 | unfolding frontier_def closure_interior | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 450 | 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 | 451 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 452 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 453 | subsection \<open>Limits\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 454 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 455 | 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 | 456 | 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 | 457 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 458 | 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 | 459 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 460 | 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 | 461 | (\<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 | 462 | 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 | 463 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 464 | 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 | 465 | (\<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 | 466 | by (auto simp: tendsto_iff eventually_at) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 467 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 468 | corollary Lim_withinI [intro?]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 469 | 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 | 470 | shows "(f \<longlongrightarrow> l) (at a within S)" | 
| 76796 | 471 | unfolding Lim_within by (smt (verit, ccfv_SIG) assms zero_less_dist_iff) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 472 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 473 | 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 | 474 | (\<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 | 475 | by (auto simp: tendsto_iff eventually_at) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 476 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 477 | lemma Lim_transform_within_set: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 478 | 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 | 479 | 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 | 480 | \<Longrightarrow> (f \<longlongrightarrow> l) (at a within T)" | 
| 76796 | 481 | by (simp add: eventually_at Lim_within) (smt (verit, best)) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 482 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 483 | text \<open>Another limit point characterization.\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 484 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 485 | lemma limpt_sequential_inj: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 486 | fixes x :: "'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 487 | shows "x islimpt S \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 488 |          (\<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 | 489 | (is "?lhs = ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 490 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 491 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 492 | 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 | 493 | by (force simp: islimpt_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 494 | 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 | 495 | by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 496 | 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 | 497 | have [simp]: "f 0 = y 1" | 
| 76796 | 498 | and fSuc: "f(Suc n) = y (min (inverse(2 ^ (Suc n))) (dist (f n) x))" for n | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 499 | by (simp_all add: f_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 500 | 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 | 501 | proof (induction n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 502 | case 0 show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 503 | by (simp add: y) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 504 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 505 | case (Suc n) then show ?case | 
| 76796 | 506 | by (smt (verit, best) fSuc dist_pos_lt inverse_positive_iff_positive y zero_less_power) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 507 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 508 | show ?rhs | 
| 76796 | 509 | proof (intro exI conjI allI) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 510 |     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 | 511 | using f by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 512 | 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 | 513 | using that | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 514 | proof (induction n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 515 | case 0 then show ?case by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 516 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 517 | case (Suc n) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 518 | 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 | 519 | then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 520 | proof cases | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 521 | assume "m < n" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 522 | have "dist (f(Suc n)) x = dist (y (min (inverse(2 ^ (Suc n))) (dist (f n) x))) x" | 
| 76796 | 523 | by (simp add: fSuc) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 524 | also have "\<dots> < dist (f n) x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 525 | 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 | 526 | also have "\<dots> < dist (f m) x" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 527 | 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 | 528 | finally show ?thesis . | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 529 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 530 | assume "m = n" then show ?case | 
| 76796 | 531 | by (smt (verit, best) dist_pos_lt f fSuc y) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 532 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 533 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 534 | then show "inj f" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 535 | by (metis less_irrefl linorder_injI) | 
| 76796 | 536 | have "\<And>e n. \<lbrakk>0 < e; nat \<lceil>1 / e\<rceil> \<le> n\<rbrakk> \<Longrightarrow> dist (f n) x < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 537 | apply (rule less_trans [OF f [THEN conjunct2, THEN conjunct2]]) | 
| 76796 | 538 | by (simp add: divide_simps order_le_less_trans) | 
| 539 | then show "f \<longlonglongrightarrow> x" | |
| 540 | using lim_sequentially by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 541 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 542 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 543 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 544 | then show ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 545 | 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 | 546 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 547 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 548 | lemma Lim_dist_ubound: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 549 | assumes "\<not>(trivial_limit net)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 550 | and "(f \<longlongrightarrow> l) net" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 551 | 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 | 552 | shows "dist a l \<le> e" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 553 | 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 | 554 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 555 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 556 | subsection \<open>Continuity\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 557 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 558 | 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 | 559 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 560 | proposition continuous_within_eps_delta: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 561 | "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 | 562 | unfolding continuous_within and Lim_within by fastforce | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 563 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 564 | corollary continuous_at_eps_delta: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 565 | "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 | 566 | 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 | 567 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 568 | lemma continuous_at_right_real_increasing: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 569 | fixes f :: "real \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 570 | 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 | 571 | 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 | 572 | apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le) | 
| 76796 | 573 | apply (intro all_cong ex_cong) | 
| 574 | by (smt (verit, best) nondecF) | |
| 69613 
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 | lemma continuous_at_left_real_increasing: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 577 | assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)" | 
| 76796 | 578 | shows "(continuous (at_left (a :: real)) f) \<longleftrightarrow> (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 579 | apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le) | 
| 76796 | 580 | apply (intro all_cong ex_cong) | 
| 581 | by (smt (verit) nondecF) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 582 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 583 | text\<open>Versions in terms of open balls.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 584 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 585 | lemma continuous_within_ball: | 
| 76796 | 586 | "continuous (at x within S) f \<longleftrightarrow> | 
| 587 | (\<forall>e > 0. \<exists>d > 0. f ` (ball x d \<inter> S) \<subseteq> ball (f x) e)" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 588 | (is "?lhs = ?rhs") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 589 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 590 | assume ?lhs | 
| 
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 | fix e :: real | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 593 | assume "e > 0" | 
| 76796 | 594 | then obtain d where "d>0" and d: "\<forall>y\<in>S. 0 < dist y x \<and> dist y x < d \<longrightarrow> dist (f y) (f x) < e" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 595 | using \<open>?lhs\<close>[unfolded continuous_within Lim_within] by auto | 
| 76796 | 596 |     { fix y
 | 
| 597 | assume "y \<in> f ` (ball x d \<inter> S)" then have "y \<in> ball (f x) e" | |
| 598 | using d \<open>e > 0\<close> by (auto simp: dist_commute) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 599 | } | 
| 76796 | 600 | then have "\<exists>d>0. f ` (ball x d \<inter> S) \<subseteq> ball (f x) e" | 
| 601 | using \<open>d > 0\<close> by blast | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 602 | } | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 603 | then show ?rhs by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 604 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 605 | assume ?rhs | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 606 | then show ?lhs | 
| 76796 | 607 | apply (simp add: continuous_within Lim_within ball_def subset_eq) | 
| 608 | by (metis (mono_tags, lifting) Int_iff dist_commute mem_Collect_eq) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 609 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 610 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 611 | lemma continuous_at_ball: | 
| 76796 | 612 | "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" | 
| 613 | apply (simp add: continuous_at Lim_at subset_eq Ball_def Bex_def image_iff) | |
| 614 | by (smt (verit, ccfv_threshold) dist_commute dist_self) | |
| 615 | ||
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 616 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 617 | 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 | 618 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 619 | lemma continuous_on_iff: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 620 | "continuous_on s f \<longleftrightarrow> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 621 | (\<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 | 622 | unfolding continuous_on_def Lim_within | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 623 | by (metis dist_pos_lt dist_self) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 624 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 625 | lemma continuous_within_E: | 
| 76796 | 626 | assumes "continuous (at x within S) f" "e>0" | 
| 627 | obtains d where "d>0" "\<And>x'. \<lbrakk>x'\<in> S; dist x' x \<le> d\<rbrakk> \<Longrightarrow> dist (f x') (f x) < e" | |
| 628 | using assms unfolding continuous_within_eps_delta | |
| 629 | by (metis dense order_le_less_trans) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 630 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 631 | lemma continuous_onI [intro?]: | 
| 76796 | 632 | 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" | 
| 633 | shows "continuous_on S f" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 634 | apply (simp add: continuous_on_iff, clarify) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 635 | 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 | 636 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 637 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 638 | text\<open>Some simple consequential lemmas.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 639 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 640 | lemma continuous_onE: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 641 | assumes "continuous_on s f" "x\<in>s" "e>0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 642 | 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 | 643 | using assms | 
| 76796 | 644 | unfolding continuous_on_iff by (metis dense order_le_less_trans) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 645 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 646 | text\<open>The usual transformation theorems.\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 647 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 648 | lemma continuous_transform_within: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 649 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 650 | assumes "continuous (at x within s) f" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 651 | and "0 < d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 652 | and "x \<in> s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 653 | 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 | 654 | shows "continuous (at x within s) g" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 655 | using assms | 
| 76796 | 656 | unfolding continuous_within by (force intro: Lim_transform_within) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 657 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 658 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 659 | subsection \<open>Closure and Limit Characterization\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 660 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 661 | lemma closure_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 662 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 663 | shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)" | 
| 76796 | 664 | using dist_self by (force simp: closure_def islimpt_approachable) | 
| 69544 
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_le: | 
| 
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 \<le> e)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 669 | unfolding closure_approachable | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 670 | using dense by force | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 671 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 672 | lemma closure_approachableD: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 673 | assumes "x \<in> closure S" "e>0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 674 | 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 | 675 | 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 | 676 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 677 | lemma closed_approachable: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 678 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 679 | 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 | 680 | by (metis closure_closed closure_approachable) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 681 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 682 | lemma closure_contains_Inf: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 683 | fixes S :: "real set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 684 |   assumes "S \<noteq> {}" "bdd_below S"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 685 | shows "Inf S \<in> closure S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 686 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 687 | 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 | 688 | using cInf_lower[of _ S] assms by metis | 
| 76796 | 689 |   { fix e :: real
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 690 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 691 | 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 | 692 | with assms obtain x where "x \<in> S" "x < Inf S + e" | 
| 76796 | 693 | using cInf_lessD by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 694 | with * have "\<exists>x\<in>S. dist x (Inf S) < e" | 
| 76796 | 695 | using dist_real_def by force | 
| 69544 
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 | 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 | 698 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 699 | |
| 70617 | 700 | lemma closure_contains_Sup: | 
| 701 | fixes S :: "real set" | |
| 702 |   assumes "S \<noteq> {}" "bdd_above S"
 | |
| 703 | shows "Sup S \<in> closure S" | |
| 704 | proof - | |
| 705 | have *: "\<forall>x\<in>S. x \<le> Sup S" | |
| 706 | using cSup_upper[of _ S] assms by metis | |
| 707 |   {
 | |
| 708 | fix e :: real | |
| 709 | assume "e > 0" | |
| 710 | then have "Sup S - e < Sup S" by simp | |
| 711 | with assms obtain x where "x \<in> S" "Sup S - e < x" | |
| 76796 | 712 | using less_cSupE by blast | 
| 70617 | 713 | with * have "\<exists>x\<in>S. dist x (Sup S) < e" | 
| 76796 | 714 | using dist_real_def by force | 
| 70617 | 715 | } | 
| 716 | then show ?thesis unfolding closure_approachable by auto | |
| 717 | qed | |
| 718 | ||
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 719 | lemma not_trivial_limit_within_ball: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 720 |   "\<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 | 721 | (is "?lhs \<longleftrightarrow> ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 722 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 723 | show ?rhs if ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 724 | proof - | 
| 76796 | 725 |     { fix e :: real
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 726 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 727 |       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 | 728 |         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 | 729 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 730 |       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 | 731 | 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 | 732 |       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 | 733 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 734 | then show ?thesis by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 735 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 736 | show ?lhs if ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 737 | proof - | 
| 76796 | 738 |     { fix e :: real
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 739 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 740 |       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 | 741 | using \<open>?rhs\<close> by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 742 |       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 | 743 | 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 | 744 |       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 | 745 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 746 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 747 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 748 |       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 | 749 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 750 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 751 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 752 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 753 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 754 | subsection \<open>Boundedness\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 755 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 756 | (* FIXME: This has to be unified with BSEQ!! *) | 
| 70136 | 757 | 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 | 758 | 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 | 759 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 760 | 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 | 761 | 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 | 762 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 763 | 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 | 764 | unfolding bounded_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 765 | 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 | 766 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 767 | 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 | 768 | unfolding bounded_any_center [where a=0] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 769 | by (simp add: dist_norm) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 770 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 771 | 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 | 772 | 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 | 773 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 774 | 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 | 775 | by (simp add: bounded_iff) | 
| 
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 boundedI: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 778 | 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 | 779 | shows "bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 780 | using assms bounded_iff by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 781 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 782 | lemma bounded_empty [simp]: "bounded {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 783 | by (simp add: bounded_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 784 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 785 | 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 | 786 | by (metis bounded_def subset_eq) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 787 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 788 | 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 | 789 | by (metis bounded_subset interior_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 790 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 791 | lemma bounded_closure[intro]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 792 | assumes "bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 793 | shows "bounded (closure S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 794 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 795 | 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 | 796 | unfolding bounded_def by auto | 
| 76796 | 797 |   { fix y
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 798 | assume "y \<in> closure S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 799 | 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 | 800 | unfolding closure_sequential by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 801 | 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 | 802 | 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 | 803 | by (simp add: f(1)) | 
| 72225 | 804 | then have "dist x y \<le> a" | 
| 805 | 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 | 806 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 807 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 808 | unfolding bounded_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 809 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 810 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 811 | 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 | 812 | 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 | 813 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 814 | lemma bounded_cball[simp,intro]: "bounded (cball x e)" | 
| 72225 | 815 | 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 | 816 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 817 | 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 | 818 | 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 | 819 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 820 | 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 | 821 | 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 | 822 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 823 | 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 | 824 | 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 | 825 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 826 | lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)" | 
| 72225 | 827 | by auto | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 828 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 829 | 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 | 830 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 831 |   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 | 832 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 833 |   then have "bounded {x}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 834 | unfolding bounded_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 835 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 836 | by (metis insert_is_Un bounded_Un) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 837 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 838 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 839 | 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 | 840 | by (meson bounded_ball bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 841 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 842 | lemma bounded_subset_ballD: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 843 | 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 | 844 | proof - | 
| 70960 | 845 | 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 | 846 | 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 | 847 | then show ?thesis | 
| 70960 | 848 | 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 | 849 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 850 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 851 | 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 | 852 | by (induct set: finite) simp_all | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 853 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 854 | 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 | 855 | 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 | 856 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 857 | 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 | 858 | by (metis Diff_subset bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 859 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 860 | lemma bounded_dist_comp: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 861 | assumes "bounded (f ` S)" "bounded (g ` S)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 862 | 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 | 863 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 864 | 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 | 865 | 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 | 866 | 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 | 867 | using *[OF that] | 
| 70960 | 868 | by metric | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 869 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 870 | by (auto intro!: boundedI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 871 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 872 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 873 | lemma bounded_Times: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 874 | assumes "bounded s" "bounded t" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 875 | shows "bounded (s \<times> t)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 876 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 877 | 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 | 878 | using assms [unfolded bounded_def] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 879 | 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 | 880 | 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 | 881 | 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 | 882 | qed | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 883 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 884 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 885 | subsection \<open>Compactness\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 886 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 887 | lemma compact_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 888 | assumes "compact U" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 889 | shows "bounded U" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 890 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 891 | 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 | 892 | using assms by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 893 | 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 | 894 | by (metis compactE_image) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 895 | 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 | 896 | by (simp add: bounded_UN) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 897 | 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 | 898 | by (rule bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 899 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 900 | |
| 77490 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 901 | lemma continuous_on_compact_bound: | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 902 | assumes "compact A" "continuous_on A f" | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 903 | obtains B where "B \<ge> 0" "\<And>x. x \<in> A \<Longrightarrow> norm (f x) \<le> B" | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 904 | proof - | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 905 | have "compact (f ` A)" by (metis assms compact_continuous_image) | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 906 | then obtain B where "\<forall>x\<in>A. norm (f x) \<le> B" | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 907 | by (auto dest!: compact_imp_bounded simp: bounded_iff) | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 908 | hence "max B 0 \<ge> 0" and "\<forall>x\<in>A. norm (f x) \<le> max B 0" by auto | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 909 | thus ?thesis using that by blast | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 910 | qed | 
| 
2c86ea8961b5
Some new lemmas. Some tidying up
 paulson <lp15@cam.ac.uk> parents: 
77273diff
changeset | 911 | |
| 69544 
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 | |
| 77273 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 933 | text \<open> | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 934 | If \<open>A\<close> is a compact subset of an open set \<open>B\<close> in a metric space, then there exists an \<open>\<epsilon> > 0\<close> | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 935 | such that the Minkowski sum of \<open>A\<close> with an open ball of radius \<open>\<epsilon>\<close> is also a subset of \<open>B\<close>. | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 936 | \<close> | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 937 | lemma compact_subset_open_imp_ball_epsilon_subset: | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 938 | assumes "compact A" "open B" "A \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 939 | obtains e where "e > 0" "(\<Union>x\<in>A. ball x e) \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 940 | proof - | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 941 | have "\<forall>x\<in>A. \<exists>e. e > 0 \<and> ball x e \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 942 | using assms unfolding open_contains_ball by blast | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 943 | then obtain e where e: "\<And>x. x \<in> A \<Longrightarrow> e x > 0" "\<And>x. x \<in> A \<Longrightarrow> ball x (e x) \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 944 | by metis | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 945 | define C where "C = e ` A" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 946 | obtain X where X: "X \<subseteq> A" "finite X" "A \<subseteq> (\<Union>c\<in>X. ball c (e c / 2))" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 947 | using assms(1) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 948 | proof (rule compactE_image) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 949 | show "open (ball x (e x / 2))" if "x \<in> A" for x | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 950 | by simp | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 951 | show "A \<subseteq> (\<Union>c\<in>A. ball c (e c / 2))" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 952 | using e by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 953 | qed auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 954 | |
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 955 | define e' where "e' = Min (insert 1 ((\<lambda>x. e x / 2) ` X))" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 956 | have "e' > 0" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 957 | unfolding e'_def using e X by (subst Min_gr_iff) auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 958 | have e': "e' \<le> e x / 2" if "x \<in> X" for x | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 959 | using that X unfolding e'_def by (intro Min.coboundedI) auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 960 | |
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 961 | show ?thesis | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 962 | proof | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 963 | show "e' > 0" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 964 | by fact | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 965 | next | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 966 | show "(\<Union>x\<in>A. ball x e') \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 967 | proof clarify | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 968 | fix x y assume xy: "x \<in> A" "y \<in> ball x e'" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 969 | from xy(1) X obtain z where z: "z \<in> X" "x \<in> ball z (e z / 2)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 970 | by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 971 | have "dist y z \<le> dist x y + dist z x" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 972 | by (metis dist_commute dist_triangle) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 973 | also have "dist z x < e z / 2" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 974 | using xy z by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 975 | also have "dist x y < e'" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 976 | using xy by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 977 | also have "\<dots> \<le> e z / 2" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 978 | using z by (intro e') auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 979 | finally have "y \<in> ball z (e z)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 980 | by (simp add: dist_commute) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 981 | also have "\<dots> \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 982 | using z X by (intro e) auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 983 | finally show "y \<in> B" . | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 984 | qed | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 985 | qed | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 986 | qed | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 987 | |
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 988 | lemma compact_subset_open_imp_cball_epsilon_subset: | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 989 | assumes "compact A" "open B" "A \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 990 | obtains e where "e > 0" "(\<Union>x\<in>A. cball x e) \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 991 | proof - | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 992 | obtain e where "e > 0" and e: "(\<Union>x\<in>A. ball x e) \<subseteq> B" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 993 | using compact_subset_open_imp_ball_epsilon_subset [OF assms] by blast | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 994 | then have "(\<Union>x\<in>A. cball x (e / 2)) \<subseteq> (\<Union>x\<in>A. ball x e)" | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 995 | by auto | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 996 | with \<open>0 < e\<close> that show ?thesis | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 997 | by (metis e half_gt_zero_iff order_trans) | 
| 
f82317de6f28
A bit more tidying and some new material
 paulson <lp15@cam.ac.uk> parents: 
77223diff
changeset | 998 | qed | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 999 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1000 | subsubsection\<open>Totally bounded\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1001 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1002 | proposition seq_compact_imp_totally_bounded: | 
| 72225 | 1003 | assumes "seq_compact S" | 
| 1004 | 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 | 1005 | proof - | 
| 72225 | 1006 |   { 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)"
 | 
| 1007 | 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 | 1008 | 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 | 1009 | proof (rule dependent_wellorder_choice) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1010 | fix n x assume "\<And>y. y < n \<Longrightarrow> ?Q x y (x y)" | 
| 72225 | 1011 |       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 | 1012 |         using *[of "x ` {0 ..< n}"] by (auto simp: subset_eq)
 | 
| 72225 | 1013 |       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 | 1014 | unfolding subset_eq by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1015 | show "\<exists>r. ?Q x n r" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1016 | using z by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1017 | qed simp | 
| 72225 | 1018 | 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 | 1019 | by blast | 
| 72225 | 1020 | 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 | 1021 | using assms by (metis seq_compact_def) | 
| 72225 | 1022 | then have "Cauchy (x \<circ> r)" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1023 | using LIMSEQ_imp_Cauchy by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1024 | 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" | 
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1025 | unfolding Cauchy_def using \<open>e > 0\<close> by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1026 | then have False | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1027 | 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 | 1028 | then show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1029 | by metis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1030 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1031 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1032 | subsubsection\<open>Heine-Borel theorem\<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1033 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1034 | proposition seq_compact_imp_Heine_Borel: | 
| 72225 | 1035 | fixes S :: "'a :: metric_space set" | 
| 1036 | assumes "seq_compact S" | |
| 1037 | shows "compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1038 | proof - | 
| 72225 | 1039 | from seq_compact_imp_totally_bounded[OF \<open>seq_compact S\<close>] | 
| 1040 | 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 | 1041 | unfolding choice_iff' .. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1042 |   define K where "K = (\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
 | 
| 72225 | 1043 | have "countably_compact S" | 
| 1044 | using \<open>seq_compact S\<close> by (rule seq_compact_imp_countably_compact) | |
| 1045 | then show "compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1046 | proof (rule countably_compact_imp_compact) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1047 | show "countable K" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1048 | unfolding K_def using f | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1049 | 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 | 1050 | intro!: countable_image countable_SIGMA countable_UN) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1051 | 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 | 1052 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1053 | fix T x | 
| 72225 | 1054 | 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 | 1055 | 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 | 1056 | by auto | 
| 72225 | 1057 | 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 | 1058 | by auto | 
| 72225 | 1059 | 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 | 1060 | by auto | 
| 72225 | 1061 | 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 | 1062 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1063 | 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 | 1064 | by (auto simp: K_def) | 
| 72225 | 1065 | 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 | 1066 | proof (rule bexI[rotated], safe) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1067 | fix y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1068 | assume "y \<in> ball k r" | 
| 72225 | 1069 | 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 | 1070 | 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 | 1071 | 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 | 1072 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1073 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1074 | 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 | 1075 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1076 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1077 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1078 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1079 | proposition compact_eq_seq_compact_metric: | 
| 72225 | 1080 | "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 | 1081 | 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 | 1082 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1083 | 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 | 1084 | "compact (S :: 'a::metric_space set) \<longleftrightarrow> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1085 | (\<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 | 1086 | 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 | 1087 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1088 | 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 | 1089 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1090 | proposition compact_eq_Bolzano_Weierstrass: | 
| 72225 | 1091 | fixes S :: "'a::metric_space set" | 
| 1092 | shows "compact S \<longleftrightarrow> (\<forall>T. infinite T \<and> T \<subseteq> S \<longrightarrow> (\<exists>x \<in> S. x islimpt T))" | |
| 78475 | 1093 | by (meson Bolzano_Weierstrass_imp_seq_compact Heine_Borel_imp_Bolzano_Weierstrass seq_compact_imp_Heine_Borel) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1094 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1095 | proposition Bolzano_Weierstrass_imp_bounded: | 
| 72225 | 1096 | "(\<And>T. \<lbrakk>infinite T; T \<subseteq> S\<rbrakk> \<Longrightarrow> (\<exists>x \<in> S. x islimpt T)) \<Longrightarrow> bounded S" | 
| 1097 | 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 | 1098 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1099 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1100 | subsection \<open>Banach fixed point theorem\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1101 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1102 | 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 | 1103 |   assumes s: "complete s" "s \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1104 | and c: "0 \<le> c" "c < 1" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1105 | and f: "f ` s \<subseteq> s" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1106 | 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 | 1107 | shows "\<exists>!x\<in>s. f x = x" | 
| 
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 have "1 - c > 0" by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1110 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1111 | 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 | 1112 | define z where "z n = (f ^^ n) z0" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1113 | 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 | 1114 | by (induct n) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1115 | define d where "d = dist (z 0) (z 1)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1116 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1117 | have fzn: "f (z n) = z (Suc n)" for n | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1118 | by (simp add: z_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1119 | 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 | 1120 | proof (induct n) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1121 | case 0 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1122 | then show ?case | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1123 | by (simp add: d_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1124 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1125 | case (Suc m) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1126 | 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 | 1127 | 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 | 1128 | then show ?case | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1129 | 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 | 1130 | by (simp add: fzn mult_le_cancel_left) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1131 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1132 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1133 | 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 | 1134 | proof (induct n) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1135 | case 0 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1136 | show ?case by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1137 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1138 | case (Suc k) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1139 | 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 | 1140 | (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 | 1141 | by (simp add: dist_triangle) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1142 | 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 | 1143 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1144 | 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 | 1145 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1146 | 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 | 1147 | by (simp add: power_add field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1148 | 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 | 1149 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1150 | finally show ?case by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1151 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1152 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1153 | 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 | 1154 | proof (cases "d = 0") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1155 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1156 | 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 | 1157 | by (simp add: mult_le_0_iff) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1158 | 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 | 1159 | by (simp add: z_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1160 | with \<open>e > 0\<close> show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1161 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1162 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1163 | 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 | 1164 | by (metis d_def less_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1165 | 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 | 1166 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1167 | 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 | 1168 | 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 | 1169 | 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 | 1170 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1171 | 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 | 1172 | 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 | 1173 | 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 | 1174 | 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 | 1175 | 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 | 1176 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1177 | 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 | 1178 | 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 | 1179 | 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 | 1180 | 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 | 1181 | using mult_right_mono[OF * order_less_imp_le[OF **]] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1182 | by (simp add: mult.assoc) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1183 | 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 | 1184 | 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 | 1185 | 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 | 1186 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1187 | 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 | 1188 | 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 | 1189 | finally show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1190 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1191 | 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 | 1192 | proof (cases "n = m") | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1193 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1194 | with \<open>e > 0\<close> show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1195 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1196 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1197 | 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 | 1198 | by (auto simp: dist_commute nat_neq_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1199 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1200 | then show ?thesis by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1201 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1202 | then have "Cauchy z" | 
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1203 | by (metis metric_CauchyI) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1204 | 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 | 1205 | 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 | 1206 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1207 | define e where "e = dist (f x) x" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1208 | have "e = 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1209 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1210 | assume "e \<noteq> 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1211 | then have "e > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1212 | 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 | 1213 | by (metis dist_eq_0_iff dist_nz e_def) | 
| 72225 | 1214 | 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 | 1215 | using x[unfolded lim_sequentially, THEN spec[where x="e/2"]] by auto | 
| 72225 | 1216 | 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 | 1217 | 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 | 1218 | unfolding mult_le_cancel_right2 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1219 | using zero_le_dist[of "z N" x] and c | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1220 | 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 | 1221 | 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 | 1222 | 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 | 1223 | 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 | 1224 | using c | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1225 | by auto | 
| 72225 | 1226 | also have "\<dots> < e/2" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1227 | using N' and c using * by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1228 | finally show False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1229 | unfolding fzn | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1230 | 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 | 1231 | unfolding e_def | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1232 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1233 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1234 | then have "f x = x" by (auto simp: e_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1235 | 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 | 1236 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1237 | 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 | 1238 | 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 | 1239 | 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 | 1240 | by (simp add: mult_le_cancel_right1) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1241 | then show ?thesis by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1242 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1243 | ultimately show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1244 | using \<open>x\<in>s\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1245 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1246 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1247 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1248 | subsection \<open>Edelstein fixed point theorem\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1249 | |
| 72225 | 1250 | theorem Edelstein_fix: | 
| 1251 | fixes S :: "'a::metric_space set" | |
| 1252 |   assumes S: "compact S" "S \<noteq> {}"
 | |
| 1253 | and gs: "(g ` S) \<subseteq> S" | |
| 1254 | and dist: "\<forall>x\<in>S. \<forall>y\<in>S. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y" | |
| 1255 | shows "\<exists>!x\<in>S. g x = x" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1256 | proof - | 
| 72225 | 1257 | let ?D = "(\<lambda>x. (x, x)) ` S" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1258 |   have D: "compact ?D" "?D \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1259 | by (rule compact_continuous_image) | 
| 72225 | 1260 | (auto intro!: S continuous_Pair continuous_ident simp: continuous_on_eq_continuous_within) | 
| 1261 | ||
| 1262 | 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 | 1263 | using dist by fastforce | 
| 72225 | 1264 | then have "continuous_on S g" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1265 | by (auto simp: continuous_on_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1266 | 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 | 1267 | unfolding continuous_on_eq_continuous_within | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1268 | by (intro continuous_dist ballI continuous_within_compose) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1269 | (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 | 1270 | |
| 72225 | 1271 | 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 | 1272 | using continuous_attains_inf[OF D cont] by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1273 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1274 | have "g a = a" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1275 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1276 | assume "g a \<noteq> a" | 
| 72225 | 1277 | 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 | 1278 | by (intro dist[rule_format]) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1279 | moreover have "dist (g a) a \<le> dist (g (g a)) (g a)" | 
| 72225 | 1280 | 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 | 1281 | ultimately show False by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1282 | qed | 
| 72225 | 1283 | moreover have "\<And>x. x \<in> S \<Longrightarrow> g x = x \<Longrightarrow> x = a" | 
| 1284 | using dist[THEN bspec[where x=a]] \<open>g a = a\<close> and \<open>a\<in>S\<close> by auto | |
| 1285 | ultimately show "\<exists>!x\<in>S. g x = x" | |
| 1286 | using \<open>a \<in> S\<close> by blast | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1287 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1288 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1289 | subsection \<open>The diameter of a set\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1290 | |
| 70136 | 1291 | 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 | 1292 |   "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 | 1293 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1294 | lemma diameter_empty [simp]: "diameter{} = 0"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1295 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1296 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1297 | lemma diameter_singleton [simp]: "diameter{x} = 0"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1298 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1299 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1300 | lemma diameter_le: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1301 |   assumes "S \<noteq> {} \<or> 0 \<le> d"
 | 
| 72225 | 1302 | and no: "\<And>x y. \<lbrakk>x \<in> S; y \<in> S\<rbrakk> \<Longrightarrow> norm(x - y) \<le> d" | 
| 1303 | shows "diameter S \<le> d" | |
| 1304 | using assms | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1305 | by (auto simp: dist_norm diameter_def intro: cSUP_least) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1306 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1307 | lemma diameter_bounded_bound: | 
| 72225 | 1308 | fixes S :: "'a :: metric_space set" | 
| 1309 | assumes S: "bounded S" "x \<in> S" "y \<in> S" | |
| 1310 | shows "dist x y \<le> diameter S" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1311 | proof - | 
| 72225 | 1312 | 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 | 1313 | unfolding bounded_def by auto | 
| 72225 | 1314 | have "bdd_above (case_prod dist ` (S\<times>S))" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1315 | proof (intro bdd_aboveI, safe) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1316 | fix a b | 
| 72225 | 1317 | assume "a \<in> S" "b \<in> S" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1318 | 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 | 1319 | show "dist a b \<le> 2 * d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1320 | by (simp add: dist_commute) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1321 | qed | 
| 72225 | 1322 | moreover have "(x,y) \<in> S\<times>S" using S by auto | 
| 1323 | 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 | 1324 | by (rule cSUP_upper2) simp | 
| 72225 | 1325 | with \<open>x \<in> S\<close> show ?thesis | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1326 | by (auto simp: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1327 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1328 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1329 | lemma diameter_lower_bounded: | 
| 72225 | 1330 | fixes S :: "'a :: metric_space set" | 
| 1331 | assumes S: "bounded S" | |
| 1332 | and d: "0 < d" "d < diameter S" | |
| 1333 | 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 | 1334 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1335 | assume contr: "\<not> ?thesis" | 
| 72225 | 1336 |   moreover have "S \<noteq> {}"
 | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1337 | using d by (auto simp: diameter_def) | 
| 72225 | 1338 | ultimately have "diameter S \<le> d" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1339 | by (auto simp: not_less diameter_def intro!: cSUP_least) | 
| 72225 | 1340 | 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 | 1341 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1342 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1343 | lemma diameter_bounded: | 
| 72225 | 1344 | assumes "bounded S" | 
| 1345 | shows "\<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> diameter S" | |
| 1346 | and "\<forall>d>0. d < diameter S \<longrightarrow> (\<exists>x\<in>S. \<exists>y\<in>S. dist x y > d)" | |
| 1347 | 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 | 1348 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1349 | |
| 72225 | 1350 | lemma bounded_two_points: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>x\<in>S. \<forall>y\<in>S. dist x y \<le> e)" | 
| 1351 | by (meson bounded_def diameter_bounded(1)) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1352 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1353 | lemma diameter_compact_attained: | 
| 72225 | 1354 | assumes "compact S" | 
| 1355 |     and "S \<noteq> {}"
 | |
| 1356 | 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 | 1357 | proof - | 
| 72225 | 1358 | have b: "bounded S" using assms(1) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1359 | by (rule compact_imp_bounded) | 
| 72225 | 1360 | then obtain x y where xys: "x\<in>S" "y\<in>S" | 
| 1361 | 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 | 1362 | using compact_sup_maxdistance[OF assms] by auto | 
| 72225 | 1363 | then have "diameter S \<le> dist x y" | 
| 76796 | 1364 | unfolding diameter_def by (force intro!: cSUP_least) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1365 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1366 | by (metis b diameter_bounded_bound order_antisym xys) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1367 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1368 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1369 | lemma diameter_ge_0: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1370 | assumes "bounded S" shows "0 \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1371 | 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 | 1372 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1373 | lemma diameter_subset: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1374 | assumes "S \<subseteq> T" "bounded T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1375 | shows "diameter S \<le> diameter T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1376 | proof (cases "S = {} \<or> T = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1377 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1378 | with assms show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1379 | by (force simp: diameter_ge_0) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1380 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1381 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1382 | 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 | 1383 | 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 | 1384 | with False \<open>S \<subseteq> T\<close> show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1385 | apply (simp add: diameter_def) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1386 | apply (rule cSUP_subset_mono, auto) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1387 | done | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1388 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1389 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1390 | lemma diameter_closure: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1391 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1392 | shows "diameter(closure S) = diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1393 | proof (rule order_antisym) | 
| 76796 | 1394 | have "False" if d_less_d: "diameter S < diameter (closure S)" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1395 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1396 | define d where "d = diameter(closure S) - diameter(S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1397 | have "d > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1398 | using that by (simp add: d_def) | 
| 76796 | 1399 | then have dle: "diameter(closure(S)) - d / 2 < diameter(closure(S))" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1400 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1401 | 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 | 1402 | by (simp add: d_def field_split_simps) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1403 | have bocl: "bounded (closure S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1404 | using assms by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1405 | moreover have "0 \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1406 | using assms diameter_ge_0 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1407 | ultimately obtain x y where "x \<in> closure S" "y \<in> closure S" and xy: "diameter(closure(S)) - d / 2 < dist x y" | 
| 76796 | 1408 | by (smt (verit) dle d_less_d d_def dd diameter_lower_bounded) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1409 | then obtain x' y' where x'y': "x' \<in> S" "dist x' x < d/4" "y' \<in> S" "dist y' y < d/4" | 
| 76796 | 1410 | by (metis \<open>0 < d\<close> zero_less_divide_iff zero_less_numeral closure_approachable) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1411 | then have "dist x' y' \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1412 | using assms diameter_bounded_bound by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1413 | with x'y' have "dist x y \<le> d / 4 + diameter S + d / 4" | 
| 76796 | 1414 | by (meson add_mono dist_triangle dist_triangle3 less_eq_real_def order_trans) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1415 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1416 | using xy d_def by linarith | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1417 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1418 | then show "diameter (closure S) \<le> diameter S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1419 | by fastforce | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1420 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1421 | show "diameter S \<le> diameter (closure S)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1422 | by (simp add: assms bounded_closure closure_subset diameter_subset) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1423 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1424 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1425 | proposition Lebesgue_number_lemma: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1426 |   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 | 1427 | 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 | 1428 | proof (cases "S = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1429 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1430 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1431 |     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 | 1432 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1433 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1434 |   { fix x assume "x \<in> S"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1435 | 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 | 1436 | using \<open>S \<subseteq> \<Union>\<C>\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1437 | 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 | 1438 | 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 | 1439 | 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 | 1440 | using C by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1441 | } | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1442 | 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 | 1443 | by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1444 | 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 | 1445 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1446 | 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 | 1447 | by (rule compactE [OF \<open>compact S\<close>]) auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1448 | 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 | 1449 | by (meson finite_subset_image) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1450 |   then have "S0 \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1451 | using False \<open>S \<subseteq> \<Union>\<T>\<close> by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1452 | define \<delta> where "\<delta> = Inf (r ` S0)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1453 | have "\<delta> > 0" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1454 |     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 | 1455 | show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1456 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1457 | show "0 < \<delta>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1458 | by (simp add: \<open>0 < \<delta>\<close>) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1459 | 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 | 1460 |     proof (cases "T = {}")
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1461 | case True | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1462 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1463 |         using \<open>\<C> \<noteq> {}\<close> by blast
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1464 | next | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1465 | case False | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1466 | then obtain y where "y \<in> T" by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1467 | then have "y \<in> S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1468 | using \<open>T \<subseteq> S\<close> by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1469 | 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 | 1470 | 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 | 1471 | have "ball y \<delta> \<subseteq> ball y (r x)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1472 |         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 | 1473 | also have "... \<subseteq> ball x (2*r x)" | 
| 70960 | 1474 | using x by metric | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1475 | 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 | 1476 | 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 | 1477 | have "bounded T" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1478 | 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 | 1479 | then have "T \<subseteq> ball y \<delta>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1480 | 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 | 1481 | then show ?thesis | 
| 76796 | 1482 | by (meson \<open>C \<in> \<C>\<close> \<open>ball y \<delta> \<subseteq> C\<close> subset_eq) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1483 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1484 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1485 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1486 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1487 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1488 | 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 | 1489 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1490 | text \<open> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1491 | 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 | 1492 | 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 | 1493 | \<close> | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1494 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1495 | class heine_borel = metric_space + | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1496 | assumes bounded_imp_convergent_subsequence: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1497 | "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 | 1498 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1499 | proposition bounded_closed_imp_seq_compact: | 
| 72225 | 1500 | fixes S::"'a::heine_borel set" | 
| 1501 | assumes "bounded S" | |
| 1502 | and "closed S" | |
| 1503 | shows "seq_compact S" | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1504 | proof (unfold seq_compact_def, clarify) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1505 | fix f :: "nat \<Rightarrow> 'a" | 
| 72225 | 1506 | assume f: "\<forall>n. f n \<in> S" | 
| 1507 | 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 | 1508 | by (auto intro: bounded_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1509 | 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 | 1510 | using bounded_imp_convergent_subsequence [OF \<open>bounded (range f)\<close>] by auto | 
| 72225 | 1511 | 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 | 1512 | by simp | 
| 78475 | 1513 | show "\<exists>l\<in>S. \<exists>r. strict_mono r \<and> (f \<circ> r) \<longlonglongrightarrow> l" | 
| 1514 | using assms(2) closed_sequentially fr l r by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1515 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1516 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1517 | lemma compact_eq_bounded_closed: | 
| 72225 | 1518 | fixes S :: "'a::heine_borel set" | 
| 1519 | shows "compact S \<longleftrightarrow> bounded S \<and> closed S" | |
| 1520 | using bounded_closed_imp_seq_compact compact_eq_seq_compact_metric compact_imp_bounded compact_imp_closed | |
| 1521 | by auto | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1522 | |
| 73885 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1523 | lemma bounded_infinite_imp_islimpt: | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1524 | fixes S :: "'a::heine_borel set" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1525 | assumes "T \<subseteq> S" "bounded S" "infinite T" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1526 | obtains x where "x islimpt S" | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1527 | by (meson assms closed_limpt compact_eq_Bolzano_Weierstrass compact_eq_bounded_closed islimpt_subset) | 
| 
26171a89466a
A few useful lemmas about derivatives, colinearity and other topics
 paulson <lp15@cam.ac.uk> parents: 
72569diff
changeset | 1528 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1529 | lemma compact_Inter: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1530 | fixes \<F> :: "'a :: heine_borel set set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1531 |   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 | 1532 | shows "compact(\<Inter> \<F>)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1533 | using assms | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1534 | 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 | 1535 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1536 | lemma compact_closure [simp]: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1537 | fixes S :: "'a::heine_borel set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1538 | shows "compact(closure S) \<longleftrightarrow> bounded S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1539 | 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 | 1540 | |
| 70136 | 1541 | instance\<^marker>\<open>tag important\<close> real :: heine_borel | 
| 1542 | proof | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1543 | fix f :: "nat \<Rightarrow> real" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1544 | assume f: "bounded (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1545 | 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 | 1546 | unfolding comp_def by (metis seq_monosub) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1547 | then have "Bseq (f \<circ> r)" | 
| 76796 | 1548 | unfolding Bseq_eq_bounded by (metis f BseqI' bounded_iff comp_apply rangeI) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1549 | 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 | 1550 | 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 | 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 compact_lemma_general: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1554 | fixes f :: "nat \<Rightarrow> 'a" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1555 | 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 | 1556 |   fixes unproj:: "('b \<Rightarrow> 'c) \<Rightarrow> 'a"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1557 | assumes finite_basis: "finite basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1558 | 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 | 1559 | 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 | 1560 | 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 | 1561 | 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 | 1562 | 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 | 1563 | proof safe | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1564 | fix d :: "'b set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1565 | assume d: "d \<subseteq> basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1566 | with finite_basis have "finite d" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1567 | by (blast intro: finite_subset) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1568 | 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 | 1569 | (\<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 | 1570 | proof (induct d) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1571 | case empty | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1572 | then show ?case | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1573 | unfolding strict_mono_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1574 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1575 | case (insert k d) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1576 | have k[intro]: "k \<in> basis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1577 | using insert by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1578 | 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 | 1579 | using k | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1580 | by (rule bounded_proj) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1581 | obtain l1::"'a" and r1 where r1: "strict_mono r1" | 
| 76796 | 1582 | and lr1: "\<forall>e > 0. \<forall>\<^sub>F n in sequentially. \<forall>i\<in>d. dist (f (r1 n) proj i) (l1 proj i) < e" | 
| 1583 | using insert by auto | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1584 | 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 | 1585 | by simp | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1586 | 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 | 1587 | by (metis (lifting) bounded_subset f' image_subsetI s') | 
| 76796 | 1588 | then obtain l2 r2 where r2: "strict_mono r2" and lr2: "(\<lambda>i. f (r1 (r2 i)) proj k) \<longlonglongrightarrow> l2" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1589 | 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 | 1590 | by (auto simp: o_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1591 | define r where "r = r1 \<circ> r2" | 
| 76796 | 1592 | have r: "strict_mono r" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1593 | 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 | 1594 | moreover | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1595 | define l where "l = unproj (\<lambda>i. if i = k then l2 else l1 proj i)" | 
| 76796 | 1596 |     { fix e::real
 | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1597 | assume "e > 0" | 
| 76796 | 1598 | from lr1 \<open>e > 0\<close> have N1: "\<forall>\<^sub>F n in sequentially. \<forall>i\<in>d. dist (f (r1 n) proj i) (l1 proj i) < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1599 | by blast | 
| 76796 | 1600 | from lr2 \<open>e > 0\<close> have N2: "\<forall>\<^sub>F n in sequentially. dist (f (r1 (r2 n)) proj k) l2 < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1601 | by (rule tendstoD) | 
| 76796 | 1602 | from r2 N1 have N1': "\<forall>\<^sub>F n in sequentially. \<forall>i\<in>d. dist (f (r1 (r2 n)) proj i) (l1 proj i) < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1603 | by (rule eventually_subseq) | 
| 76796 | 1604 | have "\<forall>\<^sub>F n in sequentially. \<forall>i\<in>insert k d. dist (f (r n) proj i) (l proj i) < e" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1605 | using N1' N2 | 
| 76796 | 1606 | by eventually_elim (use insert.prems in \<open>auto simp: l_def r_def o_def proj_unproj\<close>) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1607 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1608 | ultimately show ?case by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1609 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1610 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1611 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1612 | 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 | 1613 | unfolding bounded_def | 
| 73932 
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
 desharna parents: 
72569diff
changeset | 1614 | by (metis (erased, opaque_lifting) dist_fst_le image_iff order_trans) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1615 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1616 | 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 | 1617 | unfolding bounded_def | 
| 73932 
fd21b4a93043
added opaque_combs and renamed hide_lams to opaque_lifting
 desharna parents: 
72569diff
changeset | 1618 | by (metis (no_types, opaque_lifting) dist_snd_le image_iff order.trans) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1619 | |
| 70136 | 1620 | instance\<^marker>\<open>tag important\<close> prod :: (heine_borel, heine_borel) heine_borel | 
| 1621 | proof | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1622 | fix f :: "nat \<Rightarrow> 'a \<times> 'b" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1623 | assume f: "bounded (range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1624 | then have "bounded (fst ` range f)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1625 | by (rule bounded_fst) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1626 | 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 | 1627 | by (simp add: image_comp) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1628 | 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 | 1629 | 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 | 1630 | 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 | 1631 | by (auto simp: image_comp intro: bounded_snd bounded_subset) | 
| 76796 | 1632 | obtain l2 r2 where r2: "strict_mono r2" and l2: "(\<lambda>n. snd (f (r1 (r2 n)))) \<longlonglongrightarrow> l2" | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1633 | using bounded_imp_convergent_subsequence [OF s2] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1634 | unfolding o_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1635 | 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 | 1636 | 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 | 1637 | 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 | 1638 | 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 | 1639 | have r: "strict_mono (r1 \<circ> r2)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1640 | 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 | 1641 | 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 | 1642 | using l r by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1643 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1644 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1645 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1646 | subsection \<open>Completeness\<close> | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1647 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1648 | proposition (in metric_space) completeI: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1649 | 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 | 1650 | shows "complete s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1651 | using assms unfolding complete_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1652 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1653 | proposition (in metric_space) completeE: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1654 | 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 | 1655 | 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 | 1656 | using assms unfolding complete_def by fast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1657 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1658 | (* TODO: generalize to uniform spaces *) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1659 | lemma compact_imp_complete: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1660 | fixes s :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1661 | assumes "compact s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1662 | shows "complete s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1663 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1664 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1665 | fix f | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1666 | 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 | 1667 | 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 | 1668 | using assms unfolding compact_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1669 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1670 | note lr' = seq_suble [OF lr(2)] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1671 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1672 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1673 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1674 | 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" | 
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1675 | unfolding Cauchy_def using \<open>e > 0\<close> by (meson half_gt_zero) | 
| 76796 | 1676 | then obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" | 
| 1677 | by (metis dist_self lim_sequentially lr(3)) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1678 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1679 | fix n :: nat | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1680 | assume n: "n \<ge> max N M" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1681 | 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 | 1682 | using n M by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1683 | moreover have "r n \<ge> N" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1684 | using lr'[of n] n by auto | 
| 72225 | 1685 | 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 | 1686 | using N and n by auto | 
| 70960 | 1687 | ultimately have "dist (f n) l < e" using n M | 
| 1688 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1689 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1690 | 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 | 1691 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1692 | 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 | 1693 | unfolding lim_sequentially by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1694 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1695 | 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 | 1696 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1697 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1698 | proposition compact_eq_totally_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1699 | "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 | 1700 | (is "_ \<longleftrightarrow> ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1701 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1702 | assume assms: "?rhs" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1703 | 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 | 1704 | by (auto simp: choice_iff') | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1705 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1706 | show "compact s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1707 | proof cases | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1708 |     assume "s = {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1709 | 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 | 1710 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1711 |     assume "s \<noteq> {}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1712 | show ?thesis | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1713 | unfolding compact_def | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1714 | proof safe | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1715 | fix f :: "nat \<Rightarrow> 'a" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1716 | 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 | 1717 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1718 | 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 | 1719 | 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 | 1720 |       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 | 1721 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1722 | fix n U | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1723 |         assume "infinite {n. f n \<in> U}"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1724 |         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 | 1725 | 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 | 1726 | then obtain a where | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1727 | "a \<in> k (e n)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1728 |           "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 | 1729 |         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 | 1730 | 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 | 1731 | from someI_ex[OF this] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1732 |         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 | 1733 | unfolding B_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1734 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1735 | note B = this | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1736 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1737 | 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 | 1738 |       {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1739 | fix n | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1740 |         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 | 1741 | 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 | 1742 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1743 | 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 | 1744 | using B by (simp add: F_def) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1745 | 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 | 1746 | 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 | 1747 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1748 | 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 | 1749 | 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 | 1750 | fix k i | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1751 |         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 | 1752 |           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 | 1753 | from infinite_imp_nonempty[OF this] | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1754 | 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 | 1755 | 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 | 1756 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1757 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1758 | 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 | 1759 | have "strict_mono t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1760 | 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 | 1761 | 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 | 1762 | using f by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1763 | moreover | 
| 72225 | 1764 | have t: "(f \<circ> t) n \<in> F n" for n | 
| 1765 | 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 | 1766 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1767 | have "Cauchy (f \<circ> t)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1768 | 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 | 1769 | fix r :: real and N n m | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1770 | 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 | 1771 | then have "(f \<circ> t) n \<in> F (Suc N)" "(f \<circ> t) m \<in> F (Suc N)" "2 * e N < r" | 
| 71174 | 1772 | 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 | 1773 | 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 | 1774 | by (auto simp: subset_eq) | 
| 70960 | 1775 | with \<open>2 * e N < r\<close> show "dist ((f \<circ> t) m) ((f \<circ> t) n) < r" | 
| 1776 | by metric | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1777 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1778 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1779 | 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 | 1780 | using assms unfolding complete_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1781 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1782 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1783 | 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 | 1784 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1785 | lemma cauchy_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1786 | assumes "Cauchy s" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1787 | shows "bounded (range s)" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1788 | proof - | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1789 | from assms obtain N :: nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" | 
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1790 | by (meson Cauchy_def zero_less_one) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1791 | 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 | 1792 | moreover | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1793 |   have "bounded (s ` {0..N})"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1794 |     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 | 1795 |   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 | 1796 | 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 | 1797 | ultimately show "?thesis" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1798 | 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 | 1799 | 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 | 1800 | apply (erule_tac x=y in allE) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1801 | 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 | 1802 | done | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1803 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1804 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1805 | instance heine_borel < complete_space | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1806 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1807 | 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 | 1808 | then show "convergent f" | 
| 76796 | 1809 | unfolding convergent_def | 
| 1810 | using Cauchy_converges_subseq cauchy_imp_bounded bounded_imp_convergent_subsequence by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1811 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1812 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1813 | 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 | 1814 | proof (rule completeI) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1815 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | 
| 76796 | 1816 | then show "\<exists>l\<in>UNIV. f \<longlonglongrightarrow> l" | 
| 1817 | using Cauchy_convergent convergent_def by blast | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1818 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1819 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1820 | lemma complete_imp_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1821 | fixes S :: "'a::metric_space set" | 
| 76796 | 1822 | shows "complete S \<Longrightarrow> closed S" | 
| 1823 | by (metis LIMSEQ_imp_Cauchy LIMSEQ_unique closed_sequential_limits completeE) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1824 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1825 | lemma complete_Int_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1826 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1827 | assumes "complete S" and "closed t" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1828 | shows "complete (S \<inter> t)" | 
| 76796 | 1829 | by (metis Int_iff assms closed_sequentially completeE completeI) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1830 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1831 | lemma complete_closed_subset: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1832 | fixes S :: "'a::metric_space set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1833 | 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 | 1834 | shows "complete S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1835 | 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 | 1836 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1837 | lemma complete_eq_closed: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1838 |   fixes S :: "('a::complete_space) set"
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1839 | shows "complete S \<longleftrightarrow> closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1840 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1841 | assume "closed S" then show "complete S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1842 | 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 | 1843 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1844 | assume "complete S" then show "closed S" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1845 | by (rule complete_imp_closed) | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1846 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1847 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1848 | lemma convergent_eq_Cauchy: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1849 | fixes S :: "nat \<Rightarrow> 'a::complete_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1850 | 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 | 1851 | unfolding Cauchy_convergent_iff convergent_def .. | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1852 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1853 | lemma convergent_imp_bounded: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1854 | fixes S :: "nat \<Rightarrow> 'a::metric_space" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1855 | 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 | 1856 | 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 | 1857 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1858 | lemma frontier_subset_compact: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1859 | fixes S :: "'a::heine_borel set" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1860 | 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 | 1861 | 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 | 1862 | by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 1863 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1864 | lemma banach_fix_type: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1865 | fixes f::"'a::complete_space\<Rightarrow>'a" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1866 | assumes c:"0 \<le> c" "c < 1" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1867 | 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 | 1868 | shows "\<exists>!x. (f x = x)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1869 | 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 | 1870 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1871 | |
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1872 | subsection \<open>Cauchy continuity\<close> | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1873 | |
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1874 | definition Cauchy_continuous_on where | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1875 | "Cauchy_continuous_on \<equiv> \<lambda>S f. \<forall>\<sigma>. Cauchy \<sigma> \<longrightarrow> range \<sigma> \<subseteq> S \<longrightarrow> Cauchy (f \<circ> \<sigma>)" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1876 | |
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1877 | lemma continuous_closed_imp_Cauchy_continuous: | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1878 |   fixes S :: "('a::complete_space) set"
 | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1879 | shows "\<lbrakk>continuous_on S f; closed S\<rbrakk> \<Longrightarrow> Cauchy_continuous_on S f" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1880 | unfolding Cauchy_continuous_on_def | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1881 | by (metis LIMSEQ_imp_Cauchy completeE complete_eq_closed continuous_on_sequentially range_subsetD) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1882 | |
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1883 | lemma uniformly_continuous_imp_Cauchy_continuous: | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1884 | fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1885 | shows "uniformly_continuous_on S f \<Longrightarrow> Cauchy_continuous_on S f" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1886 | by (simp add: uniformly_continuous_on_def Cauchy_continuous_on_def Cauchy_def image_subset_iff) metis | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1887 | |
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1888 | lemma Cauchy_continuous_on_imp_continuous: | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1889 | fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1890 | assumes "Cauchy_continuous_on S f" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1891 | shows "continuous_on S f" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1892 | proof - | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1893 | have False if x: "\<forall>n. \<exists>x'\<in>S. dist x' x < inverse(Suc n) \<and> \<not> dist (f x') (f x) < \<epsilon>" "\<epsilon>>0" "x \<in> S" for x and \<epsilon>::real | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1894 | proof - | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1895 | obtain \<rho> where \<rho>: "\<forall>n. \<rho> n \<in> S" and dx: "\<forall>n. dist (\<rho> n) x < inverse(Suc n)" and dfx: "\<forall>n. \<not> dist (f (\<rho> n)) (f x) < \<epsilon>" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1896 | using x by metis | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1897 | define \<sigma> where "\<sigma> \<equiv> \<lambda>n. if even n then \<rho> n else x" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1898 | with \<rho> \<open>x \<in> S\<close> have "range \<sigma> \<subseteq> S" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1899 | by auto | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1900 | have "\<sigma> \<longlonglongrightarrow> x" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1901 | unfolding tendsto_iff | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1902 | proof (intro strip) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1903 | fix e :: real | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1904 | assume "e>0" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1905 | then obtain N where "inverse (Suc N) < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1906 | using reals_Archimedean by blast | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1907 | then have "\<forall>n. N \<le> n \<longrightarrow> dist (\<rho> n) x < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1908 | by (smt (verit, ccfv_SIG) dx inverse_Suc inverse_less_iff_less inverse_positive_iff_positive of_nat_Suc of_nat_mono) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1909 | with \<open>e>0\<close> show "\<forall>\<^sub>F n in sequentially. dist (\<sigma> n) x < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1910 | by (auto simp add: eventually_sequentially \<sigma>_def) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1911 | qed | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1912 | then have "Cauchy \<sigma>" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1913 | by (intro LIMSEQ_imp_Cauchy) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1914 | then have Cf: "Cauchy (f \<circ> \<sigma>)" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1915 | by (meson Cauchy_continuous_on_def \<open>range \<sigma> \<subseteq> S\<close> assms) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1916 | have "(f \<circ> \<sigma>) \<longlonglongrightarrow> f x" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1917 | unfolding tendsto_iff | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1918 | proof (intro strip) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1919 | fix e :: real | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1920 | assume "e>0" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1921 | then obtain N where N: "\<forall>m\<ge>N. \<forall>n\<ge>N. dist ((f \<circ> \<sigma>) m) ((f \<circ> \<sigma>) n) < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1922 | using Cf unfolding Cauchy_def by presburger | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1923 | moreover have "(f \<circ> \<sigma>) (Suc(N+N)) = f x" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1924 | by (simp add: \<sigma>_def) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1925 | ultimately have "\<forall>n\<ge>N. dist ((f \<circ> \<sigma>) n) (f x) < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1926 | by (metis add_Suc le_add2) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1927 | then show "\<forall>\<^sub>F n in sequentially. dist ((f \<circ> \<sigma>) n) (f x) < e" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1928 | using eventually_sequentially by blast | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1929 | qed | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1930 | moreover have "\<And>n. \<not> dist (f (\<sigma> (2*n))) (f x) < \<epsilon>" | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1931 | using dfx by (simp add: \<sigma>_def) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1932 | ultimately show False | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1933 | using \<open>\<epsilon>>0\<close> by (fastforce simp: mult_2 nat_le_iff_add tendsto_iff eventually_sequentially) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1934 | qed | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1935 | then show ?thesis | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1936 | unfolding continuous_on_iff by (meson inverse_Suc) | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1937 | qed | 
| 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 1938 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1939 | |
| 70136 | 1940 | 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 | 1941 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1942 | 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 | 1943 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1944 | lemma closed_imp_fip: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1945 | fixes S :: "'a::heine_borel set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1946 | assumes "closed S" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1947 | and T: "T \<in> \<F>" "bounded T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1948 | and clof: "\<And>T. T \<in> \<F> \<Longrightarrow> closed T" | 
| 76796 | 1949 |       and "\<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> S \<inter> \<Inter>\<F>' \<noteq> {}"
 | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1950 |     shows "S \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1951 | proof - | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1952 | have "compact (S \<inter> T)" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1953 | 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 | 1954 |   then have "(S \<inter> T) \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 76796 | 1955 | by (smt (verit, best) Inf_insert Int_assoc assms compact_imp_fip finite_insert insert_subset) | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1956 | then show ?thesis by blast | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1957 | qed | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1958 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1959 | lemma closed_imp_fip_compact: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1960 | fixes S :: "'a::heine_borel set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1961 | shows | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1962 | "\<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 | 1963 |      \<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 | 1964 |         \<Longrightarrow> S \<inter> \<Inter>\<F> \<noteq> {}"
 | 
| 76796 | 1965 | by (metis closed_imp_fip compact_eq_bounded_closed equals0I finite.emptyI order.refl) | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1966 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1967 | lemma closed_fip_Heine_Borel: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1968 | fixes \<F> :: "'a::heine_borel set set" | 
| 76796 | 1969 | assumes "T \<in> \<F>" "bounded T" | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1970 | and "\<And>T. T \<in> \<F> \<Longrightarrow> closed T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1971 |       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 | 1972 |     shows "\<Inter>\<F> \<noteq> {}"
 | 
| 76796 | 1973 | using closed_imp_fip [OF closed_UNIV] assms by auto | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1974 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1975 | lemma compact_fip_Heine_Borel: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1976 | fixes \<F> :: "'a::heine_borel set set" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1977 | assumes clof: "\<And>T. T \<in> \<F> \<Longrightarrow> compact T" | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1978 |       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 | 1979 |     shows "\<Inter>\<F> \<noteq> {}"
 | 
| 76796 | 1980 | by (metis InterI clof closed_fip_Heine_Borel compact_eq_bounded_closed equals0D none) | 
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1981 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1982 | lemma compact_sequence_with_limit: | 
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1983 | fixes f :: "nat \<Rightarrow> 'a::heine_borel" | 
| 76796 | 1984 | shows "f \<longlonglongrightarrow> l \<Longrightarrow> compact (insert l (range f))" | 
| 1985 | by (simp add: closed_limpt compact_eq_bounded_closed convergent_imp_bounded islimpt_insert sequence_unique_limpt) | |
| 69615 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1986 | |
| 
e502cd4d7062
moved material from Connected.thy to more appropriate places
 immler parents: 
69613diff
changeset | 1987 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 1988 | subsection \<open>Properties of Balls and Spheres\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1989 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1990 | lemma compact_cball[simp]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1991 | fixes x :: "'a::heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1992 | shows "compact (cball x e)" | 
| 76796 | 1993 | using compact_eq_bounded_closed bounded_cball closed_cball by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1994 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1995 | lemma compact_frontier_bounded[intro]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1996 | fixes S :: "'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1997 | shows "bounded S \<Longrightarrow> compact (frontier S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 1998 | unfolding frontier_def | 
| 76796 | 1999 | using compact_eq_bounded_closed by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2000 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2001 | lemma compact_frontier[intro]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2002 | fixes S :: "'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2003 | shows "compact S \<Longrightarrow> compact (frontier S)" | 
| 76796 | 2004 | using compact_eq_bounded_closed compact_frontier_bounded by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2005 | |
| 77179 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2006 | lemma no_limpt_imp_countable: | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2007 |   assumes "\<And>z. \<not>z islimpt (X :: 'a :: {real_normed_vector, heine_borel} set)"
 | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2008 | shows "countable X" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2009 | proof - | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2010 | have "countable (\<Union>n. cball 0 (real n) \<inter> X)" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2011 | proof (intro countable_UN[OF _ countable_finite]) | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2012 | fix n :: nat | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2013 | show "finite (cball 0 (real n) \<inter> X)" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2014 | using assms by (intro finite_not_islimpt_in_compact) auto | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2015 | qed auto | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2016 | also have "(\<Union>n. cball 0 (real n)) = (UNIV :: 'a set)" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2017 | proof safe | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2018 | fix z :: 'a | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2019 | have "norm z \<ge> 0" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2020 | by simp | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2021 | hence "real (nat \<lceil>norm z\<rceil>) \<ge> norm z" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2022 | by linarith | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2023 | thus "z \<in> (\<Union>n. cball 0 (real n))" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2024 | by auto | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2025 | qed auto | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2026 | hence "(\<Union>n. cball 0 (real n) \<inter> X) = X" | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2027 | by blast | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2028 | finally show "countable X" . | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2029 | qed | 
| 
6d2ca97a8f46
More of Manuel's material, and some changes
 paulson <lp15@cam.ac.uk> parents: 
77140diff
changeset | 2030 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2031 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2032 | subsection \<open>Distance from a Set\<close> | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2033 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2034 | lemma distance_attains_sup: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2035 |   assumes "compact s" "s \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2036 | 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 | 2037 | proof (rule continuous_attains_sup [OF assms]) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2038 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2039 | fix x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2040 | assume "x\<in>s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2041 | 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 | 2042 | by (intro tendsto_dist tendsto_const tendsto_ident_at) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2043 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2044 | then show "continuous_on s (dist a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2045 | unfolding continuous_on .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2046 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2047 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2048 | 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 | 2049 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2050 | lemma distance_attains_inf: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2051 | fixes a :: "'a::heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2052 |   assumes "closed s" and "s \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2053 | 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 | 2054 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2055 | 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 | 2056 | let ?B = "s \<inter> cball a (dist b a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2057 |   have "?B \<noteq> {}" using \<open>b \<in> s\<close>
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2058 | by (auto simp: dist_commute) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2059 | moreover have "continuous_on ?B (dist a)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2060 | 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 | 2061 | moreover have "compact ?B" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2062 | 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 | 2063 | 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 | 2064 | by (metis continuous_attains_inf) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2065 | with that show ?thesis by fastforce | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2066 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2067 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2068 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2069 | subsection \<open>Infimum Distance\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2070 | |
| 70136 | 2071 | 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 | 2072 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2073 | 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 | 2074 | by (auto intro!: zero_le_dist) | 
| 
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 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 | 2077 | by (simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2078 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2079 | lemma infdist_nonneg: "0 \<le> infdist x A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2080 | by (auto simp: infdist_def intro: cINF_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2081 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2082 | 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 | 2083 | by (auto intro: cINF_lower simp add: infdist_def) | 
| 
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_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 | 2086 | by (auto intro!: cINF_lower2 simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2087 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2088 | 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 | 2089 | by (auto intro!: antisym infdist_nonneg infdist_le2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2090 | |
| 70724 | 2091 | lemma infdist_Un_min: | 
| 2092 |   assumes "A \<noteq> {}" "B \<noteq> {}"
 | |
| 2093 | shows "infdist x (A \<union> B) = min (infdist x A) (infdist x B)" | |
| 2094 | using assms by (simp add: infdist_def cINF_union inf_real_def) | |
| 2095 | ||
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2096 | 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 | 2097 | proof (cases "A = {}")
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2098 | case True | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2099 | then show ?thesis by (simp add: infdist_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2100 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2101 | case False | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2102 | then obtain a where "a \<in> A" by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2103 |   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 | 2104 | proof (rule cInf_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2105 |     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 | 2106 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2107 | fix d | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2108 |     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 | 2109 | 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 | 2110 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2111 | show "infdist x A \<le> d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2112 |       unfolding infdist_notempty[OF \<open>A \<noteq> {}\<close>]
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2113 | proof (rule cINF_lower2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2114 | show "a \<in> A" by fact | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2115 | show "dist x a \<le> d" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2116 | unfolding d by (rule dist_triangle) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2117 | qed simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2118 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2119 | also have "\<dots> = dist x y + infdist y A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2120 | proof (rule cInf_eq, safe) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2121 | fix a | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2122 | assume "a \<in> A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2123 | 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 | 2124 | by (auto intro: infdist_le) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2125 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2126 | fix i | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2127 |     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 | 2128 | 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 | 2129 |       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 | 2130 | by (intro cINF_greatest) (auto simp: field_simps) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2131 | 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 | 2132 | by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2133 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2134 | finally show ?thesis by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2135 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2136 | |
| 70724 | 2137 | lemma infdist_triangle_abs: "\<bar>infdist x A - infdist y A\<bar> \<le> dist x y" | 
| 2138 | by (metis (full_types) abs_diff_le_iff diff_le_eq dist_commute infdist_triangle) | |
| 2139 | ||
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2140 | lemma in_closure_iff_infdist_zero: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2141 |   assumes "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2142 | 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 | 2143 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2144 | assume "x \<in> closure A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2145 | show "infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2146 | proof (rule ccontr) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2147 | assume "infdist x A \<noteq> 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2148 | 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 | 2149 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2150 |     then have "ball x (infdist x A) \<inter> closure A = {}"
 | 
| 76796 | 2151 | by (smt (verit, best) \<open>x \<in> closure A\<close> closure_approachableD infdist_le) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2152 | then have "x \<notin> closure A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2153 | 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 | 2154 | 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 | 2155 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2156 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2157 | assume x: "infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2158 | then obtain a where "a \<in> A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2159 | by atomize_elim (metis all_not_in_conv assms) | 
| 76796 | 2160 | have False if "e > 0" "\<not> (\<exists>y\<in>A. dist y x < e)" for e | 
| 2161 | proof - | |
| 2162 | have "infdist x A \<ge> e" using \<open>a \<in> A\<close> | |
| 2163 | unfolding infdist_def using that | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2164 | by (force simp: dist_commute intro: cINF_greatest) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2165 | 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 | 2166 | qed | 
| 76796 | 2167 | then show "x \<in> closure A" | 
| 2168 | using closure_approachable by blast | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2169 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2170 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2171 | lemma in_closed_iff_infdist_zero: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2172 |   assumes "closed A" "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2173 | shows "x \<in> A \<longleftrightarrow> infdist x A = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2174 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2175 | have "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | 
| 76796 | 2176 |     by (simp add: \<open>A \<noteq> {}\<close> in_closure_iff_infdist_zero)
 | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2177 | with assms show ?thesis by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2178 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2179 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2180 | lemma infdist_pos_not_in_closed: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2181 |   assumes "closed S" "S \<noteq> {}" "x \<notin> S"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2182 | shows "infdist x S > 0" | 
| 76796 | 2183 | by (smt (verit, best) assms in_closed_iff_infdist_zero infdist_nonneg) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2184 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2185 | lemma | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2186 | infdist_attains_inf: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2187 | fixes X::"'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2188 | assumes "closed X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2189 |   assumes "X \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2190 | 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 | 2191 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2192 | have "bdd_below (dist y ` X)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2193 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2194 | from distance_attains_inf[OF assms, of y] | 
| 76796 | 2195 | obtain x where "x \<in> X" "\<And>z. z \<in> X \<Longrightarrow> dist y x \<le> dist y z" by auto | 
| 2196 | then have "infdist y X = dist y x" | |
| 2197 | by (metis antisym assms(2) cINF_greatest infdist_def infdist_le) | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2198 | with \<open>x \<in> X\<close> show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2199 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2200 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2201 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2202 | 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 | 2203 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2204 | instance metric_space \<subseteq> t4_space | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2205 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2206 |   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 | 2207 |   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 | 2208 |   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 | 2209 | proof (cases) | 
| 76796 | 2210 | case 1 then show ?thesis by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2211 | next | 
| 76796 | 2212 | case 2 then show ?thesis by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2213 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2214 | case 3 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2215 | 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 | 2216 | have A: "open U" unfolding U_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2217 | 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 | 2218 | 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 | 2219 | 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 | 2220 | 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 | 2221 | have C: "open V" unfolding V_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2222 | 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 | 2223 | 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 | 2224 | 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 | 2225 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2226 |     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 | 2227 | proof auto | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2228 | 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 | 2229 | have "2 * dist x y \<le> 2 * dist x z + 2 * dist y z" | 
| 70960 | 2230 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2231 | also have "... < infdist x T + infdist y S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2232 | using H by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2233 | 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 | 2234 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2235 | then show False | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2236 | 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 | 2237 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2238 |     then have E: "U \<inter> V = {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2239 | unfolding U_def V_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2240 | show ?thesis | 
| 76796 | 2241 | using A B C D E by blast | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2242 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2243 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2244 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2245 | lemma tendsto_infdist [tendsto_intros]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2246 | assumes f: "(f \<longlongrightarrow> l) F" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2247 | 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 | 2248 | proof (rule tendstoI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2249 | fix e ::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2250 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2251 | from tendstoD[OF f this] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2252 | 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 | 2253 | proof (eventually_elim) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2254 | fix x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2255 | 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 | 2256 | 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 | 2257 | by (simp add: dist_commute dist_real_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2258 | also assume "dist (f x) l < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2259 | 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 | 2260 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2261 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2262 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2263 | lemma continuous_infdist[continuous_intros]: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2264 | assumes "continuous F f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2265 | shows "continuous F (\<lambda>x. infdist (f x) A)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2266 | using assms unfolding continuous_def by (rule tendsto_infdist) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2267 | |
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2268 | 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 | 2269 | assumes "continuous_on S f" | 
| 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 2270 | 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 | 2271 | 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 | 2272 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2273 | lemma compact_infdist_le: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2274 | fixes A::"'a::heine_borel set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2275 |   assumes "A \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2276 | assumes "compact A" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2277 | assumes "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2278 |   shows "compact {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2279 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2280 |   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 | 2281 | continuous_infdist[OF continuous_ident, of _ UNIV A] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2282 |   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 | 2283 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2284 | 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 | 2285 | by (auto simp: compact_eq_bounded_closed bounded_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2286 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2287 | fix y | 
| 70960 | 2288 | assume "infdist y A \<le> e" | 
| 2289 | moreover | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2290 |     from infdist_attains_inf[OF \<open>closed A\<close> \<open>A \<noteq> {}\<close>, of y]
 | 
| 70960 | 2291 | obtain z where "z \<in> A" "infdist y A = dist y z" by blast | 
| 2292 | ultimately | |
| 2293 | 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 | 2294 | } then | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2295 |   have "bounded {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2296 | 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 | 2297 |   ultimately show "compact {x. infdist x A \<le> e}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2298 | by (simp add: compact_eq_bounded_closed) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2299 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2300 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2301 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2302 | subsection \<open>Separation between Points and Sets\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2303 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2304 | proposition separate_point_closed: | 
| 76796 | 2305 | fixes S :: "'a::heine_borel set" | 
| 2306 | assumes "closed S" and "a \<notin> S" | |
| 2307 | shows "\<exists>d>0. \<forall>x\<in>S. d \<le> dist a x" | |
| 2308 | by (metis assms distance_attains_inf empty_iff gt_ex zero_less_dist_iff) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2309 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2310 | proposition separate_compact_closed: | 
| 76796 | 2311 | fixes S T :: "'a::heine_borel set" | 
| 2312 | assumes "compact S" | |
| 2313 |     and T: "closed T" "S \<inter> T = {}"
 | |
| 2314 | shows "\<exists>d>0. \<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2315 | proof cases | 
| 76796 | 2316 |   assume "S \<noteq> {} \<and> T \<noteq> {}"
 | 
| 2317 |   then have "S \<noteq> {}" "T \<noteq> {}" by auto
 | |
| 2318 | let ?inf = "\<lambda>x. infdist x T" | |
| 2319 | have "continuous_on S ?inf" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2320 | by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_ident) | 
| 76796 | 2321 | then obtain x where x: "x \<in> S" "\<forall>y\<in>S. ?inf x \<le> ?inf y" | 
| 2322 |     using continuous_attains_inf[OF \<open>compact S\<close> \<open>S \<noteq> {}\<close>] by auto
 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2323 | then have "0 < ?inf x" | 
| 76796 | 2324 |     using T \<open>T \<noteq> {}\<close> in_closed_iff_infdist_zero by (auto simp: less_le infdist_nonneg)
 | 
| 2325 | moreover have "\<forall>x'\<in>S. \<forall>y\<in>T. ?inf x \<le> dist x' y" | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2326 | using x by (auto intro: order_trans infdist_le) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2327 | ultimately show ?thesis by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2328 | qed (auto intro!: exI[of _ 1]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2329 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2330 | proposition separate_closed_compact: | 
| 76796 | 2331 | fixes S T :: "'a::heine_borel set" | 
| 2332 | assumes S: "closed S" | |
| 2333 | and T: "compact T" | |
| 2334 |     and dis: "S \<inter> T = {}"
 | |
| 2335 | shows "\<exists>d>0. \<forall>x\<in>S. \<forall>y\<in>T. d \<le> dist x y" | |
| 2336 | by (metis separate_compact_closed[OF T S] dis dist_commute inf_commute) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2337 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2338 | proposition compact_in_open_separated: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2339 | fixes A::"'a::heine_borel set" | 
| 76796 | 2340 |   assumes A: "A \<noteq> {}" "compact A"
 | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2341 | assumes "open B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2342 | assumes "A \<subseteq> B" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2343 |   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 | 2344 | proof atomize_elim | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2345 |   have "closed (- B)" "compact A" "- B \<inter> A = {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2346 | 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 | 2347 | from separate_closed_compact[OF this] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2348 | 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 | 2349 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2350 | define d where "d = d' / 2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2351 | hence "d>0" "d < d'" using d' by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2352 | 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 | 2353 | by force | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2354 |   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 | 2355 | proof (rule ccontr) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2356 |     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 | 2357 | 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 | 2358 | by auto | 
| 76796 | 2359 | then show False | 
| 2360 | by (metis A compact_eq_bounded_closed infdist_attains_inf x d linorder_not_less) | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2361 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2362 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2363 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2364 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2365 | subsection \<open>Uniform Continuity\<close> | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2366 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2367 | lemma uniformly_continuous_onE: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2368 | 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 | 2369 | 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" | 
| 76796 | 2370 | using assms | 
| 2371 | by (auto simp: uniformly_continuous_on_def) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2372 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2373 | lemma uniformly_continuous_on_sequentially: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2374 | "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 | 2375 | (\<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 | 2376 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2377 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2378 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2379 | fix x y | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2380 | 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 | 2381 | 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 | 2382 | 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 | 2383 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2384 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2385 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2386 | 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" | 
| 76796 | 2387 | by (metis \<open>?lhs\<close> uniformly_continuous_onE) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2388 | 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 | 2389 | 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 | 2390 | then have "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" | 
| 76796 | 2391 | using d x y by blast | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2392 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2393 | 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 | 2394 | 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 | 2395 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2396 | then show ?rhs by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2397 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2398 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2399 |   {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2400 | assume "\<not> ?lhs" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2401 | 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 | 2402 | unfolding uniformly_continuous_on_def by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2403 | then obtain fa where fa: | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2404 | "\<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 | 2405 | 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"] | 
| 76796 | 2406 | by (auto simp: Bex_def dist_commute) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2407 | 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 | 2408 | 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 | 2409 | 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 | 2410 | 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 | 2411 | 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 | 2412 | 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 | 2413 | by auto | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2414 |     {
 | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2415 | fix e :: real | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2416 | assume "e > 0" | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2417 | 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 | 2418 | unfolding real_arch_inverse[of e] by auto | 
| 76796 | 2419 | then have "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" | 
| 2420 | by (smt (verit, ccfv_SIG) inverse_le_imp_le nat_le_real_less of_nat_le_0_iff xy0) | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2421 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2422 | 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 | 2423 | 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 | 2424 | 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 | 2425 | 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 | 2426 | } | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2427 | then show ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2428 | unfolding uniformly_continuous_on_def by blast | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2429 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2430 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2431 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2432 | 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 | 2433 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2434 | 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 | 2435 | 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 | 2436 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2437 | lemma Heine_Borel_lemma: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2438 | 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 | 2439 | 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 | 2440 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2441 | 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 | 2442 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2443 | 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 | 2444 | using neg by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2445 | 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 | 2446 | by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2447 | 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 | 2448 | using \<open>compact S\<close> compact_def that by metis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2449 | then obtain G where "l \<in> G" "G \<in> \<G>" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2450 | using Ssub by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2451 | 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 | 2452 | using opn open_dist by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2453 | 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 | 2454 | using to_l apply (simp add: lim_sequentially) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2455 | 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 | 2456 | obtain N2 where N2: "of_nat N2 > 2/e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2457 | using reals_Archimedean2 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2458 | 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 | 2459 | 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 | 2460 | 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 | 2461 | by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2462 | also have "... \<le> 1 / real (Suc (max N1 N2))" | 
| 76796 | 2463 | by (meson Suc_le_mono \<open>strict_mono r\<close> inverse_of_nat_le nat.discI seq_suble) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2464 | also have "... \<le> 1 / real (Suc N2)" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2465 | by (simp add: field_simps) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2466 | also have "... < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2467 | using N2 \<open>0 < e\<close> by (simp add: field_simps) | 
| 72225 | 2468 | 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 | 2469 | 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 | 2470 | using N1 max.cobounded1 by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2471 | ultimately have "dist x l < e" | 
| 70960 | 2472 | by metric | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2473 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2474 | using e \<open>x \<notin> G\<close> by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2475 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2476 | then show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2477 | by (meson that) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2478 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2479 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2480 | lemma compact_uniformly_equicontinuous: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2481 | assumes "compact S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2482 | 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 | 2483 | \<Longrightarrow> \<exists>d. 0 < d \<and> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2484 | (\<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 | 2485 | and "0 < e" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2486 | obtains d where "0 < d" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2487 | "\<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 | 2488 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2489 | 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 | 2490 | 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 | 2491 | using cont by metis | 
| 72225 | 2492 | 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 | 2493 | have Ssub: "S \<subseteq> \<Union> ?\<G>" | 
| 76796 | 2494 | using \<open>0 < e\<close> d_pos by auto | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2495 | 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 | 2496 | 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 | 2497 | 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 | 2498 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2499 | 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 | 2500 | using k that | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2501 | 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 | 2502 | 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 | 2503 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2504 | 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 | 2505 | 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 | 2506 | moreover | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2507 | have "dist (f w) (f u) < e/2" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2508 | 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 | 2509 | ultimately show ?thesis | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2510 | using dist_triangle_half_r by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2511 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2512 | ultimately show ?thesis using that by blast | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2513 | qed | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2514 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2515 | corollary compact_uniformly_continuous: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2516 | fixes f :: "'a :: metric_space \<Rightarrow> 'b :: metric_space" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2517 | assumes f: "continuous_on S f" and S: "compact S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2518 | shows "uniformly_continuous_on S f" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2519 | using f | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2520 | unfolding continuous_on_iff uniformly_continuous_on_def | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2521 |     by (force intro: compact_uniformly_equicontinuous [OF S, of "{f}"])
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2522 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2523 | |
| 70136 | 2524 | 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 | 2525 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2526 | lemma continuous_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2527 | "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2528 | (\<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 | 2529 | \<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 | 2530 | (is "?lhs = ?rhs") | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2531 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2532 | assume ?lhs then show ?rhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2533 | 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 | 2534 | next | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2535 | assume R [rule_format]: ?rhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2536 | show ?lhs | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2537 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2538 | fix x and e::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2539 | assume "0 < e" and x: "x \<in> closure S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2540 | obtain \<delta>::real where "\<delta> > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2541 | 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 | 2542 | 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 | 2543 | 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 | 2544 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2545 | obtain \<delta>'::real where "\<delta>' > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2546 | 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 | 2547 | 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 | 2548 | 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 | 2549 | using closure_approachable y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2550 | 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 | 2551 | have "dist (f z) (f y) < e/2" | 
| 70960 | 2552 | 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 | 2553 | moreover have "dist (f z) (f x) < e/2" | 
| 70960 | 2554 | 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 | 2555 | ultimately show ?thesis | 
| 70960 | 2556 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2557 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2558 | 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 | 2559 | 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 | 2560 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2561 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2562 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2563 | lemma continuous_on_closure_sequentially: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2564 | fixes f :: "'a::metric_space \<Rightarrow> 'b :: metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2565 | shows | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2566 | "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2567 | (\<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 | 2568 | (is "?lhs = ?rhs") | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2569 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2570 | have "continuous_on (closure S) f \<longleftrightarrow> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2571 | (\<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 | 2572 | 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 | 2573 | also have "... = ?rhs" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2574 | by (force simp: continuous_within_sequentially) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2575 | finally show ?thesis . | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2576 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2577 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2578 | lemma uniformly_continuous_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2579 | fixes f :: "'a::metric_space \<Rightarrow> 'b::metric_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2580 | assumes ucont: "uniformly_continuous_on S f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2581 | and cont: "continuous_on (closure S) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2582 | shows "uniformly_continuous_on (closure S) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2583 | unfolding uniformly_continuous_on_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2584 | proof (intro allI impI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2585 | fix e::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2586 | assume "0 < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2587 | then obtain d::real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2588 | where "d>0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2589 | 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 | 2590 | 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 | 2591 | 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 | 2592 | 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 | 2593 | fix x y | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2594 | 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 | 2595 | obtain d1::real where "d1 > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2596 | 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 | 2597 | 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 | 2598 | 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 | 2599 | using closure_approachable [of x S] | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2600 | 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 | 2601 | obtain d2::real where "d2 > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2602 | 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 | 2603 | using cont [unfolded continuous_on_iff, rule_format, of "y" "e/3"] \<open>0 < e\<close> y by auto | 
| 70960 | 2604 | obtain y' where "y' \<in> S" and y': "dist y' y < min d2 (d / 3)" | 
| 2605 | using closure_approachable [of y S] | |
| 2606 | by (metis \<open>0 < d2\<close> \<open>0 < d\<close> divide_pos_pos min_less_iff_conj y zero_less_numeral) | |
| 2607 | have "dist x' x < d/3" using x' by auto | |
| 2608 | then have "dist x' y' < d" | |
| 2609 | using dyx y' by metric | |
| 2610 | then have "dist (f x') (f y') < e/3" | |
| 2611 | by (rule d [OF \<open>y' \<in> S\<close> \<open>x' \<in> S\<close>]) | |
| 2612 | moreover have "dist (f x') (f x) < e/3" using \<open>x' \<in> S\<close> closure_subset x' d1 | |
| 2613 | by (simp add: closure_def) | |
| 2614 | moreover have "dist (f y') (f y) < e/3" using \<open>y' \<in> S\<close> closure_subset y' d2 | |
| 2615 | by (simp add: closure_def) | |
| 2616 | 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 | 2617 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2618 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2619 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2620 | lemma uniformly_continuous_on_extension_at_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2621 | fixes f::"'a::metric_space \<Rightarrow> 'b::complete_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2622 | assumes uc: "uniformly_continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2623 | assumes "x \<in> closure X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2624 | 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 | 2625 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2626 | 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 | 2627 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2628 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2629 | 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 | 2630 | 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 | 2631 | by atomize_elim (simp only: convergent_eq_Cauchy) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2632 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2633 | have "(f \<longlongrightarrow> l) (at x within X)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2634 | proof (safe intro!: Lim_within_LIMSEQ) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2635 | fix xs' | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2636 | 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 | 2637 | and xs': "xs' \<longlonglongrightarrow> x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2638 | 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 | 2639 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2640 | 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 | 2641 | 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 | 2642 | by atomize_elim (simp only: convergent_eq_Cauchy) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2643 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2644 | show "(\<lambda>n. f (xs' n)) \<longlonglongrightarrow> l" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2645 | proof (rule tendstoI) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2646 | fix e::real assume "e > 0" | 
| 72225 | 2647 | define e' where "e' \<equiv> e/2" | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2648 | 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 | 2649 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2650 | 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 | 2651 | by (simp add: \<open>0 < e'\<close> l tendstoD) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2652 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2653 | 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 | 2654 | 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 | 2655 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2656 | 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 | 2657 | 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 | 2658 | ultimately | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2659 | 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 | 2660 | proof eventually_elim | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2661 | case (elim n) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2662 | have "dist (f (xs' n)) l \<le> dist (f (xs n)) (f (xs' n)) + dist (f (xs n)) l" | 
| 70960 | 2663 | by metric | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2664 | 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 | 2665 | 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 | 2666 | 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 | 2667 | 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 | 2668 | finally show ?case by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2669 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2670 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2671 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2672 | thus ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2673 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2674 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2675 | lemma uniformly_continuous_on_extension_on_closure: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2676 | fixes f::"'a::metric_space \<Rightarrow> 'b::complete_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2677 | assumes uc: "uniformly_continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2678 | 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 | 2679 | "\<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 | 2680 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2681 | from uc have cont_f: "continuous_on X f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2682 | by (simp add: uniformly_continuous_imp_continuous) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2683 | obtain y where y: "(f \<longlongrightarrow> y x) (at x within X)" if "x \<in> closure X" for x | 
| 76796 | 2684 | using uniformly_continuous_on_extension_at_closure[OF assms] by meson | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2685 | 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 | 2686 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2687 | have "uniformly_continuous_on (closure X) ?g" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2688 | unfolding uniformly_continuous_on_def | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2689 | proof safe | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2690 | fix e::real assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2691 | define e' where "e' \<equiv> e / 3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2692 | 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 | 2693 | 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 | 2694 | 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 | 2695 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2696 | define d' where "d' = d / 3" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2697 | 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 | 2698 | 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 | 2699 | 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 | 2700 | 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 | 2701 | 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 | 2702 | 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 | 2703 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2704 | 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 | 2705 | 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 | 2706 | 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 | 2707 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2708 | 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 | 2709 | using that not_eventuallyD | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2710 | 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 | 2711 | 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 | 2712 | using x x' | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2713 | 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 | 2714 | 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 | 2715 | "\<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 | 2716 | 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 | 2717 | ultimately | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2718 | 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 | 2719 | proof eventually_elim | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2720 | case (elim n) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2721 | have "dist (?g x') (?g x) \<le> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2722 | 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 | 2723 | 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 | 2724 | also | 
| 70960 | 2725 | from \<open>dist (xs' n) x' < d'\<close> \<open>dist x' x < d'\<close> \<open>dist (xs n) x < d'\<close> | 
| 2726 | 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 | 2727 | 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 | 2728 | by (rule d) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2729 | 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 | 2730 | 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 | 2731 | finally show ?case by (simp add: e'_def) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2732 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2733 | 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 | 2734 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2735 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2736 | 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 | 2737 | moreover | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2738 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2739 | fix Y h x | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2740 | 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 | 2741 | 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 | 2742 |     {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2743 | assume "x \<notin> X" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2744 | have "x \<in> closure X" using Y by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2745 | 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 | 2746 | by (auto simp: closure_sequential) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2747 | 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 | 2748 | have hx: "(\<lambda>x. f (xs x)) \<longlonglongrightarrow> h x" | 
| 69712 | 2749 | by (auto simp: subsetD extension) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2750 | 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 | 2751 | 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 | 2752 | 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 | 2753 | 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 | 2754 | } then | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2755 | have "h x = ?g x" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2756 | using extension by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2757 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2758 | ultimately show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2759 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2760 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2761 | lemma bounded_uniformly_continuous_image: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2762 | fixes f :: "'a :: heine_borel \<Rightarrow> 'b :: heine_borel" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2763 | assumes "uniformly_continuous_on S f" "bounded S" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2764 | shows "bounded(f ` S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2765 | 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 | 2766 | |
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2767 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2768 | 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 | 2769 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2770 | lemma openin_contains_ball: | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2771 | "openin (top_of_set T) S \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2772 | 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 | 2773 | (is "?lhs = ?rhs") | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2774 | proof | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2775 | assume ?lhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2776 | then show ?rhs | 
| 76796 | 2777 | by (metis IntD2 Int_commute Int_lower1 Int_mono inf.idem openE openin_open) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2778 | next | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2779 | assume ?rhs | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2780 | then show ?lhs | 
| 76796 | 2781 | by (smt (verit) open_ball Int_commute Int_iff centre_in_ball in_mono openin_open_Int openin_subopen) | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2782 | qed | 
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2783 | |
| 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2784 | lemma openin_contains_cball: | 
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2785 | "openin (top_of_set T) S \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2786 | 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 | 2787 | (is "?lhs = ?rhs") | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2788 | proof | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2789 | assume ?lhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2790 | then show ?rhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2791 | 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 | 2792 | next | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2793 | assume ?rhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2794 | then show ?lhs | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2795 | by (force simp add: openin_contains_ball) | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 2796 | qed | 
| 69544 
5aa5a8d6e5b5
split off theorems involving classes below metric_space and real_normed_vector
 immler parents: diff
changeset | 2797 | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2798 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2799 | subsection \<open>Closed Nest\<close> | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2800 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2801 | 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 | 2802 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2803 | lemma bounded_closed_nest: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2804 |   fixes S :: "nat \<Rightarrow> ('a::heine_borel) set"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2805 | assumes "\<And>n. closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2806 |       and "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2807 | 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 | 2808 | and "bounded (S 0)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2809 | obtains a where "\<And>n. a \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2810 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2811 | 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 | 2812 | 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 | 2813 | from assms(4,1) have "seq_compact (S 0)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2814 | by (simp add: bounded_closed_imp_seq_compact) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2815 | 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 | 2816 | 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 | 2817 | have "\<forall>n. l \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2818 | proof | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2819 | fix n :: nat | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2820 | have "closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2821 | using assms(1) by simp | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2822 | 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 | 2823 | 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 | 2824 | 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 | 2825 | using assms(3) by (fast intro!: le_add2) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2826 | 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 | 2827 | using lr(3) by (rule LIMSEQ_ignore_initial_segment) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2828 | ultimately show "l \<in> S n" | 
| 78475 | 2829 | by (metis closed_sequentially) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2830 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2831 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2832 | using that by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2833 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2834 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2835 | 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 | 2836 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2837 | lemma decreasing_closed_nest: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2838 |   fixes S :: "nat \<Rightarrow> ('a::complete_space) set"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2839 | assumes "\<And>n. closed (S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2840 |           "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2841 | "\<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 | 2842 | "\<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 | 2843 | obtains a where "\<And>n. a \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2844 | proof - | 
| 76796 | 2845 | obtain t where t: "\<forall>n. t n \<in> S n" | 
| 2846 | by (meson assms(2) equals0I) | |
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2847 |   {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2848 | fix e :: real | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2849 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2850 | 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 | 2851 | using assms(4) by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2852 |     {
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2853 | fix m n :: nat | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2854 | assume "N \<le> m \<and> N \<le> n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2855 | 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 | 2856 | 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 | 2857 | then have "dist (t m) (t n) < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2858 | using N by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2859 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2860 | 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 | 2861 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2862 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2863 | then have "Cauchy t" | 
| 78131 
1cadc477f644
Even more material from the HOL Light metric space library
 paulson <lp15@cam.ac.uk> parents: 
78037diff
changeset | 2864 | by (metis metric_CauchyI) | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2865 | then obtain l where l:"(t \<longlongrightarrow> l) sequentially" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2866 | using complete_UNIV unfolding complete_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2867 |   { fix n :: nat
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2868 |     { fix e :: real
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2869 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2870 | 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 | 2871 | using l[unfolded lim_sequentially] by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2872 | have "t (max n N) \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2873 | by (meson assms(3) contra_subsetD max.cobounded1 t) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2874 | 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 | 2875 | using N max.cobounded2 by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2876 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2877 | then have "l \<in> S n" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2878 | 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 | 2879 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2880 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2881 | using that by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2882 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2883 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2884 | 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 | 2885 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2886 | lemma decreasing_closed_nest_sing: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2887 | fixes S :: "nat \<Rightarrow> 'a::complete_space set" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2888 | assumes "\<And>n. closed(S n)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2889 |           "\<And>n. S n \<noteq> {}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2890 | "\<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 | 2891 | "\<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 | 2892 |   shows "\<exists>a. \<Inter>(range S) = {a}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2893 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2894 | 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 | 2895 | 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 | 2896 |   { fix b
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2897 | assume b: "b \<in> \<Inter>(range S)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2898 |     { fix e :: real
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2899 | assume "e > 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2900 | then have "dist a b < e" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2901 | using assms(4) and b and a by blast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2902 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2903 | then have "dist a b = 0" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2904 | 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 | 2905 | } | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2906 |   with a have "\<Inter>(range S) = {a}"
 | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2907 | unfolding image_def by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2908 | then show ?thesis .. | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2909 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2910 | |
| 70136 | 2911 | 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 | 2912 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2913 | lemma continuous_within_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2914 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2915 | assumes "continuous (at x within s) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2916 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2917 | 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 | 2918 | proof - | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2919 | 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 | 2920 | 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 | 2921 | have "(f \<longlongrightarrow> f x) (at x within s)" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2922 | using assms(1) by (simp add: continuous_within) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2923 | 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 | 2924 | 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 | 2925 | unfolding tendsto_def by fast | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2926 | 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 | 2927 | 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 | 2928 | then show ?thesis | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2929 | 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 | 2930 | qed | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2931 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2932 | lemma continuous_at_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2933 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2934 | assumes "continuous (at x) f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2935 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2936 | 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 | 2937 | 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 | 2938 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2939 | lemma continuous_on_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2940 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2941 | assumes "continuous_on s f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2942 | and "x \<in> s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2943 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2944 | 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 | 2945 | 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 | 2946 | 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 | 2947 | using assms(3) | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2948 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2949 | |
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2950 | lemma continuous_on_open_avoid: | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2951 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2952 | assumes "continuous_on s f" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2953 | and "open s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2954 | and "x \<in> s" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2955 | and "f x \<noteq> a" | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2956 | 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 | 2957 | 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 | 2958 | 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 | 2959 | by auto | 
| 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 2960 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2961 | subsection \<open>Consequences for Real Numbers\<close> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2962 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2963 | lemma closed_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2964 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2965 |   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 | 2966 | by (metis closure_contains_Inf closure_closed) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2967 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2968 | lemma closed_subset_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2969 | fixes A C :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2970 |   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 | 2971 | by (metis closure_contains_Inf closure_minimal subset_eq) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2972 | |
| 70617 | 2973 | lemma closed_contains_Sup: | 
| 2974 | fixes S :: "real set" | |
| 2975 |   shows "S \<noteq> {} \<Longrightarrow> bdd_above S \<Longrightarrow> closed S \<Longrightarrow> Sup S \<in> S"
 | |
| 2976 | by (subst closure_closed[symmetric], assumption, rule closure_contains_Sup) | |
| 2977 | ||
| 2978 | lemma closed_subset_contains_Sup: | |
| 2979 | fixes A C :: "real set" | |
| 2980 |   shows "closed C \<Longrightarrow> A \<subseteq> C \<Longrightarrow> A \<noteq> {} \<Longrightarrow> bdd_above A \<Longrightarrow> Sup A \<in> C"
 | |
| 2981 | by (metis closure_contains_Sup closure_minimal subset_eq) | |
| 2982 | ||
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2983 | lemma atLeastAtMost_subset_contains_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2984 | fixes A :: "real set" and a b :: real | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2985 |   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 | 2986 | by (rule closed_subset_contains_Inf) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2987 | (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 | 2988 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2989 | 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 | 2990 | by (simp add: bounded_iff) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2991 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2992 | 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 | 2993 | 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 | 2994 | (metis abs_le_D1 abs_minus_commute diff_le_eq) | 
| 
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 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 | 2997 | 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 | 2998 | (metis abs_le_D1 add.commute diff_le_eq) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 2999 | |
| 78890 
d8045bc0544e
Added Kronecker's approximation theorem. Requires adding Real_Asymp to HOL-Analysis. Funny syntax issue in Probability/Projective_Family
 paulson <lp15@cam.ac.uk> parents: 
78475diff
changeset | 3000 | lemma bounded_norm_le_SUP_norm: | 
| 
d8045bc0544e
Added Kronecker's approximation theorem. Requires adding Real_Asymp to HOL-Analysis. Funny syntax issue in Probability/Projective_Family
 paulson <lp15@cam.ac.uk> parents: 
78475diff
changeset | 3001 | "bounded (range f) \<Longrightarrow> norm (f x) \<le> (SUP x. norm (f x))" | 
| 
d8045bc0544e
Added Kronecker's approximation theorem. Requires adding Real_Asymp to HOL-Analysis. Funny syntax issue in Probability/Projective_Family
 paulson <lp15@cam.ac.uk> parents: 
78475diff
changeset | 3002 | by (auto intro!: cSUP_upper bounded_imp_bdd_above simp: bounded_norm_comp) | 
| 
d8045bc0544e
Added Kronecker's approximation theorem. Requires adding Real_Asymp to HOL-Analysis. Funny syntax issue in Probability/Projective_Family
 paulson <lp15@cam.ac.uk> parents: 
78475diff
changeset | 3003 | |
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3004 | lemma bounded_has_Sup: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3005 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3006 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3007 |     and "S \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3008 | shows "\<forall>x\<in>S. x \<le> Sup S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3009 | 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 | 3010 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3011 | 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 | 3012 | using assms by (metis cSup_least) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3013 | qed (metis cSup_upper assms(1) bounded_imp_bdd_above) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3014 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3015 | lemma Sup_insert: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3016 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3017 |   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 | 3018 | 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 | 3019 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3020 | lemma bounded_has_Inf: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3021 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3022 | assumes "bounded S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3023 |     and "S \<noteq> {}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3024 | shows "\<forall>x\<in>S. x \<ge> Inf S" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3025 | 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 | 3026 | proof | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3027 | 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 | 3028 | using assms by (metis cInf_greatest) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3029 | qed (metis cInf_lower assms(1) bounded_imp_bdd_below) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3030 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3031 | lemma Inf_insert: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3032 | fixes S :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3033 |   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 | 3034 | 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 | 3035 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3036 | lemma open_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3037 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3038 | 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 | 3039 | unfolding open_dist dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3040 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3041 | lemma islimpt_approachable_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3042 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3043 | 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 | 3044 | unfolding islimpt_approachable dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3045 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3046 | lemma closed_real: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3047 | fixes s :: "real set" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3048 | 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 | 3049 | unfolding closed_limpt islimpt_approachable dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3050 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3051 | lemma continuous_at_real_range: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3052 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3053 | 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)" | 
| 76796 | 3054 | by (metis (mono_tags, opaque_lifting) LIM_eq continuous_within norm_eq_zero real_norm_def right_minus_eq) | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3055 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3056 | lemma continuous_on_real_range: | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3057 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3058 | shows "continuous_on s f \<longleftrightarrow> | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3059 | (\<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 | 3060 | unfolding continuous_on_iff dist_norm by simp | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3061 | |
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3062 | lemma continuous_on_closed_Collect_le: | 
| 69618 | 3063 | fixes f g :: "'a::topological_space \<Rightarrow> real" | 
| 69613 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3064 | 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 | 3065 |   shows "closed {x \<in> s. f x \<le> g x}"
 | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3066 | proof - | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3067 |   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 | 3068 | using closed_real_atLeast continuous_on_diff [OF g f] | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3069 | by (simp add: continuous_on_closed_vimage [OF s]) | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3070 |   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 | 3071 | by auto | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3072 | finally show ?thesis . | 
| 
1331e57b54c6
moved material from Connected.thy to more appropriate places
 immler parents: 
69611diff
changeset | 3073 | qed | 
| 69611 
42cc3609fedf
moved some material from Connected.thy to more appropriate places
 immler parents: 
69544diff
changeset | 3074 | |
| 69618 | 3075 | lemma continuous_le_on_closure: | 
| 3076 | fixes a::real | |
| 3077 | assumes f: "continuous_on (closure s) f" | |
| 3078 | and x: "x \<in> closure(s)" | |
| 3079 | and xlo: "\<And>x. x \<in> s ==> f(x) \<le> a" | |
| 3080 | shows "f(x) \<le> a" | |
| 3081 |   using image_closure_subset [OF f, where T=" {x. x \<le> a}" ] assms
 | |
| 3082 | continuous_on_closed_Collect_le[of "UNIV" "\<lambda>x. x" "\<lambda>x. a"] | |
| 3083 | by auto | |
| 3084 | ||
| 3085 | lemma continuous_ge_on_closure: | |
| 3086 | fixes a::real | |
| 3087 | assumes f: "continuous_on (closure s) f" | |
| 3088 | and x: "x \<in> closure(s)" | |
| 3089 | and xlo: "\<And>x. x \<in> s ==> f(x) \<ge> a" | |
| 3090 | shows "f(x) \<ge> a" | |
| 3091 |   using image_closure_subset [OF f, where T=" {x. a \<le> x}"] assms
 | |
| 3092 | continuous_on_closed_Collect_le[of "UNIV" "\<lambda>x. a" "\<lambda>x. x"] | |
| 3093 | by auto | |
| 3094 | ||
| 3095 | ||
| 3096 | subsection\<open>The infimum of the distance between two sets\<close> | |
| 3097 | ||
| 70136 | 3098 | definition\<^marker>\<open>tag important\<close> setdist :: "'a::metric_space set \<Rightarrow> 'a set \<Rightarrow> real" where | 
| 69618 | 3099 | "setdist s t \<equiv> | 
| 3100 |        (if s = {} \<or> t = {} then 0
 | |
| 3101 |         else Inf {dist x y| x y. x \<in> s \<and> y \<in> t})"
 | |
| 3102 | ||
| 3103 | lemma setdist_empty1 [simp]: "setdist {} t = 0"
 | |
| 3104 | by (simp add: setdist_def) | |
| 3105 | ||
| 3106 | lemma setdist_empty2 [simp]: "setdist t {} = 0"
 | |
| 3107 | by (simp add: setdist_def) | |
| 3108 | ||
| 3109 | lemma setdist_pos_le [simp]: "0 \<le> setdist s t" | |
| 3110 | by (auto simp: setdist_def ex_in_conv [symmetric] intro: cInf_greatest) | |
| 3111 | ||
| 3112 | lemma le_setdistI: | |
| 3113 |   assumes "s \<noteq> {}" "t \<noteq> {}" "\<And>x y. \<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> d \<le> dist x y"
 | |
| 3114 | shows "d \<le> setdist s t" | |
| 3115 | using assms | |
| 3116 | by (auto simp: setdist_def Set.ex_in_conv [symmetric] intro: cInf_greatest) | |
| 3117 | ||
| 3118 | lemma setdist_le_dist: "\<lbrakk>x \<in> s; y \<in> t\<rbrakk> \<Longrightarrow> setdist s t \<le> dist x y" | |
| 3119 | unfolding setdist_def | |
| 3120 | by (auto intro!: bdd_belowI [where m=0] cInf_lower) | |
| 3121 | ||
| 3122 | lemma le_setdist_iff: | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3123 | "d \<le> setdist S T \<longleftrightarrow> | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3124 |         (\<forall>x \<in> S. \<forall>y \<in> T. d \<le> dist x y) \<and> (S = {} \<or> T = {} \<longrightarrow> d \<le> 0)"
 | 
| 76796 | 3125 | by (smt (verit) le_setdistI setdist_def setdist_le_dist) | 
| 69618 | 3126 | |
| 3127 | lemma setdist_ltE: | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3128 |   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 | 3129 | obtains x y where "x \<in> S" "y \<in> T" "dist x y < b" | 
| 69618 | 3130 | using assms | 
| 3131 | by (auto simp: not_le [symmetric] le_setdist_iff) | |
| 3132 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3133 | lemma setdist_refl: "setdist S S = 0" | 
| 76796 | 3134 | by (metis dist_eq_0_iff ex_in_conv order_antisym setdist_def setdist_le_dist setdist_pos_le) | 
| 69618 | 3135 | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3136 | lemma setdist_sym: "setdist S T = setdist T S" | 
| 69618 | 3137 | by (force simp: setdist_def dist_commute intro!: arg_cong [where f=Inf]) | 
| 3138 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3139 | 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 | 3140 | proof (cases "S = {} \<or> T = {}")
 | 
| 69618 | 3141 | case True then show ?thesis | 
| 3142 | using setdist_pos_le by fastforce | |
| 3143 | next | |
| 3144 | case False | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3145 |   then have "\<And>x. x \<in> S \<Longrightarrow> setdist S T - dist x a \<le> setdist {a} T"
 | 
| 76796 | 3146 | using dist_self dist_triangle3 empty_not_insert le_setdist_iff setdist_le_dist singleton_iff | 
| 3147 | by (smt (verit, best) dist_self dist_triangle3 empty_not_insert le_setdist_iff setdist_le_dist singleton_iff) | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3148 |   then have "setdist S T - setdist {a} T \<le> setdist S {a}"
 | 
| 69618 | 3149 | using False by (fastforce intro: le_setdistI) | 
| 3150 | then show ?thesis | |
| 3151 | by (simp add: algebra_simps) | |
| 3152 | qed | |
| 3153 | ||
| 3154 | lemma setdist_singletons [simp]: "setdist {x} {y} = dist x y"
 | |
| 3155 | by (simp add: setdist_def) | |
| 3156 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3157 | lemma setdist_Lipschitz: "\<bar>setdist {x} S - setdist {y} S\<bar> \<le> dist x y"
 | 
| 69618 | 3158 | apply (subst setdist_singletons [symmetric]) | 
| 3159 | by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym) | |
| 3160 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3161 | lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3162 | by (force simp: continuous_at_eps_delta dist_real_def intro: le_less_trans [OF setdist_Lipschitz]) | 
| 3163 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3164 | lemma continuous_on_setdist [continuous_intros]: "continuous_on T (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3165 | by (metis continuous_at_setdist continuous_at_imp_continuous_on) | 
| 3166 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3167 | lemma uniformly_continuous_on_setdist: "uniformly_continuous_on T (\<lambda>y. (setdist {y} S))"
 | 
| 69618 | 3168 | by (force simp: uniformly_continuous_on_def dist_real_def intro: le_less_trans [OF setdist_Lipschitz]) | 
| 3169 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3170 | lemma setdist_subset_right: "\<lbrakk>T \<noteq> {}; T \<subseteq> u\<rbrakk> \<Longrightarrow> setdist S u \<le> setdist S T"
 | 
| 76796 | 3171 | by (smt (verit, best) in_mono le_setdist_iff) | 
| 69618 | 3172 | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3173 | lemma setdist_subset_left: "\<lbrakk>S \<noteq> {}; S \<subseteq> T\<rbrakk> \<Longrightarrow> setdist T u \<le> setdist S u"
 | 
| 69618 | 3174 | by (metis setdist_subset_right setdist_sym) | 
| 3175 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3176 | 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 | 3177 | proof (cases "S = {} \<or> T = {}")
 | 
| 69618 | 3178 | case True then show ?thesis by force | 
| 3179 | next | |
| 3180 | case False | |
| 3181 |   { fix y
 | |
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3182 | assume "y \<in> T" | 
| 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3183 | have "continuous_on (closure S) (\<lambda>a. dist a y)" | 
| 69618 | 3184 | 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 | 3185 | 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 | 3186 | by (fast intro: setdist_le_dist \<open>y \<in> T\<close> continuous_ge_on_closure) | 
| 76796 | 3187 | } then | 
| 69618 | 3188 | show ?thesis | 
| 76796 | 3189 | by (metis False antisym closure_eq_empty closure_subset le_setdist_iff setdist_subset_left) | 
| 69618 | 3190 | qed | 
| 3191 | ||
| 72228 
aa7cb84983e9
minor tidying, also s->S and t->T
 paulson <lp15@cam.ac.uk> parents: 
72225diff
changeset | 3192 | 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 | 3193 | by (metis setdist_closure_1 setdist_sym) | 
| 69618 | 3194 | |
| 3195 | lemma setdist_eq_0I: "\<lbrakk>x \<in> S; x \<in> T\<rbrakk> \<Longrightarrow> setdist S T = 0" | |
| 3196 | by (metis antisym dist_self setdist_le_dist setdist_pos_le) | |
| 3197 | ||
| 3198 | lemma setdist_unique: | |
| 3199 | "\<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> | |
| 3200 | \<Longrightarrow> setdist S T = dist a b" | |
| 3201 | by (force simp add: setdist_le_dist le_setdist_iff intro: antisym) | |
| 3202 | ||
| 3203 | lemma setdist_le_sing: "x \<in> S ==> setdist S T \<le> setdist {x} T"
 | |
| 3204 | using setdist_subset_left by auto | |
| 3205 | ||
| 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 | 3206 | 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 | 3207 | 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 | 3208 | |
| 
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 | 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 | 3210 | 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 | 3211 |   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 | 3212 | 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 | 3213 | 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 | 3214 |     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 | 3215 | 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 | 3216 | proof - | 
| 76796 | 3217 |       have "\<And>b'. b' \<in> B \<Longrightarrow> Inf {dist x y |x y. x \<in> A \<and> y \<in> B} \<le> dist x b'"
 | 
| 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 | 3218 | by (metis (mono_tags, lifting) ex_in_conv setdist_def setdist_le_dist that(3)) | 
| 76796 | 3219 | then show ?thesis | 
| 3220 | by (smt (verit) cINF_greatest ex_in_conv \<open>b \<in> B\<close>) | |
| 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 | 3221 | 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 | 3222 |     then show "Inf {dist x y |x y. x \<in> A \<and> y \<in> B} \<le> (INF x\<in>A. Inf (dist x ` B))"
 | 
| 76796 | 3223 | by (metis (mono_tags, lifting) cINF_greatest emptyE that) | 
| 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 | 3224 | 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 | 3225 | 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 | 3226 | 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 | 3227 |     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 | 3228 | 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 | 3229 | 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 | 3230 | 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 | 3231 | 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 | 3232 | 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 | 3233 | 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 | 3234 | 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 | 3235 | 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 | 3236 | |
| 70724 | 3237 | lemma infdist_mono: | 
| 3238 |   assumes "A \<subseteq> B" "A \<noteq> {}"
 | |
| 3239 | shows "infdist x B \<le> infdist x A" | |
| 3240 | by (simp add: assms infdist_eq_setdist setdist_subset_right) | |
| 3241 | ||
| 76796 | 3242 | lemma infdist_singleton [simp]: "infdist x {y} = dist x y"
 | 
| 70724 | 3243 | by (simp add: infdist_eq_setdist) | 
| 3244 | ||
| 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 | 3245 | 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 | 3246 |   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 | 3247 | 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 | 3248 | 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 | 3249 | 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 | 3250 | 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 | 3251 | 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 | 3252 | 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 | 3253 | 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 | 3254 | 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 | 3255 | 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 | 3256 | 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 | 3257 | 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 | 3258 | 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 | 3259 |       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 | 3260 | 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 | 3261 | 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 | 3262 | show "(INF y\<in>B. infdist y A) \<le> infdist y A" | 
| 76796 | 3263 | by (meson \<open>y \<in> B\<close> bdd_belowI2 cInf_lower image_eqI infdist_nonneg) | 
| 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 | 3264 | 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 | 3265 | 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 | 3266 |         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 | 3267 | 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 | 3268 | 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 | 3269 | 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 | 3270 | 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 | 3271 | |
| 70723 
4e39d87c9737
imported new material mostly due to Sébastien Gouëzel
 paulson <lp15@cam.ac.uk> parents: 
70617diff
changeset | 3272 | end |