| author | wenzelm | 
| Tue, 31 Mar 2015 17:34:52 +0200 | |
| changeset 59880 | 30687c3f2b10 | 
| parent 59815 | cce82e360c2f | 
| child 60017 | b785d6d06430 | 
| permissions | -rw-r--r-- | 
| 33714 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 1 | (* title: HOL/Library/Topology_Euclidian_Space.thy | 
| 33175 | 2 | Author: Amine Chaieb, University of Cambridge | 
| 3 | Author: Robert Himmelmann, TU Muenchen | |
| 44075 | 4 | Author: Brian Huffman, Portland State University | 
| 33175 | 5 | *) | 
| 6 | ||
| 58877 | 7 | section {* Elementary topology in Euclidean space. *}
 | 
| 33175 | 8 | |
| 9 | theory Topology_Euclidean_Space | |
| 50087 | 10 | imports | 
| 50938 | 11 | Complex_Main | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 12 | "~~/src/HOL/Library/Countable_Set" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 13 | "~~/src/HOL/Library/FuncSet" | 
| 50938 | 14 | Linear_Algebra | 
| 50087 | 15 | Norm_Arith | 
| 16 | begin | |
| 17 | ||
| 50972 | 18 | lemma dist_0_norm: | 
| 19 | fixes x :: "'a::real_normed_vector" | |
| 20 | shows "dist 0 x = norm x" | |
| 21 | unfolding dist_norm by simp | |
| 22 | ||
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 23 | lemma dist_double: "dist x y < d / 2 \<Longrightarrow> dist x z < d / 2 \<Longrightarrow> dist y z < d" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 24 | using dist_triangle[of y z x] by (simp add: dist_commute) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 25 | |
| 50972 | 26 | (* LEGACY *) | 
| 53640 | 27 | lemma lim_subseq: "subseq r \<Longrightarrow> s ----> l \<Longrightarrow> (s \<circ> r) ----> l" | 
| 50972 | 28 | by (rule LIMSEQ_subseq_LIMSEQ) | 
| 29 | ||
| 53282 | 30 | lemma countable_PiE: | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 31 | "finite I \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> countable (F i)) \<Longrightarrow> countable (PiE I F)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 32 | by (induct I arbitrary: F rule: finite_induct) (auto simp: PiE_insert_eq) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 33 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 34 | lemma Lim_within_open: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 35 | fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 36 | shows "a \<in> S \<Longrightarrow> open S \<Longrightarrow> (f ---> l)(at a within S) \<longleftrightarrow> (f ---> l)(at a)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 37 | by (fact tendsto_within_open) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 38 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 39 | lemma continuous_on_union: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 40 | "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 41 | by (fact continuous_on_closed_Un) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 42 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 43 | lemma continuous_on_cases: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 44 | "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t g \<Longrightarrow> | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 45 | \<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x \<Longrightarrow> | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 46 | continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)" | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 47 | by (rule continuous_on_If) auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 48 | |
| 53255 | 49 | |
| 50087 | 50 | subsection {* Topological Basis *}
 | 
| 51 | ||
| 52 | context topological_space | |
| 53 | begin | |
| 54 | ||
| 53291 | 55 | definition "topological_basis B \<longleftrightarrow> | 
| 56 | (\<forall>b\<in>B. open b) \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x))" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 57 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 58 | lemma topological_basis: | 
| 53291 | 59 | "topological_basis B \<longleftrightarrow> (\<forall>x. open x \<longleftrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x))" | 
| 50998 | 60 | unfolding topological_basis_def | 
| 61 | apply safe | |
| 62 | apply fastforce | |
| 63 | apply fastforce | |
| 64 | apply (erule_tac x="x" in allE) | |
| 65 | apply simp | |
| 66 |    apply (rule_tac x="{x}" in exI)
 | |
| 67 | apply auto | |
| 68 | done | |
| 69 | ||
| 50087 | 70 | lemma topological_basis_iff: | 
| 71 | assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'" | |
| 72 | shows "topological_basis B \<longleftrightarrow> (\<forall>O'. open O' \<longrightarrow> (\<forall>x\<in>O'. \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'))" | |
| 73 | (is "_ \<longleftrightarrow> ?rhs") | |
| 74 | proof safe | |
| 75 | fix O' and x::'a | |
| 76 | assume H: "topological_basis B" "open O'" "x \<in> O'" | |
| 53282 | 77 | then have "(\<exists>B'\<subseteq>B. \<Union>B' = O')" by (simp add: topological_basis_def) | 
| 50087 | 78 | then obtain B' where "B' \<subseteq> B" "O' = \<Union>B'" by auto | 
| 53282 | 79 | then show "\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" using H by auto | 
| 50087 | 80 | next | 
| 81 | assume H: ?rhs | |
| 53282 | 82 | show "topological_basis B" | 
| 83 | using assms unfolding topological_basis_def | |
| 50087 | 84 | proof safe | 
| 53640 | 85 | fix O' :: "'a set" | 
| 53282 | 86 | assume "open O'" | 
| 50087 | 87 | with H obtain f where "\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'" | 
| 88 | by (force intro: bchoice simp: Bex_def) | |
| 53282 | 89 | then show "\<exists>B'\<subseteq>B. \<Union>B' = O'" | 
| 50087 | 90 |       by (auto intro: exI[where x="{f x |x. x \<in> O'}"])
 | 
| 91 | qed | |
| 92 | qed | |
| 93 | ||
| 94 | lemma topological_basisI: | |
| 95 | assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'" | |
| 53282 | 96 | and "\<And>O' x. open O' \<Longrightarrow> x \<in> O' \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" | 
| 50087 | 97 | shows "topological_basis B" | 
| 98 | using assms by (subst topological_basis_iff) auto | |
| 99 | ||
| 100 | lemma topological_basisE: | |
| 101 | fixes O' | |
| 102 | assumes "topological_basis B" | |
| 53282 | 103 | and "open O'" | 
| 104 | and "x \<in> O'" | |
| 50087 | 105 | obtains B' where "B' \<in> B" "x \<in> B'" "B' \<subseteq> O'" | 
| 106 | proof atomize_elim | |
| 53282 | 107 | from assms have "\<And>B'. B'\<in>B \<Longrightarrow> open B'" | 
| 108 | by (simp add: topological_basis_def) | |
| 50087 | 109 | with topological_basis_iff assms | 
| 53282 | 110 | show "\<exists>B'. B' \<in> B \<and> x \<in> B' \<and> B' \<subseteq> O'" | 
| 111 | using assms by (simp add: Bex_def) | |
| 50087 | 112 | qed | 
| 113 | ||
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 114 | lemma topological_basis_open: | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 115 | assumes "topological_basis B" | 
| 53282 | 116 | and "X \<in> B" | 
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 117 | shows "open X" | 
| 53282 | 118 | using assms by (simp add: topological_basis_def) | 
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 119 | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 120 | lemma topological_basis_imp_subbasis: | 
| 53255 | 121 | assumes B: "topological_basis B" | 
| 122 | shows "open = generate_topology B" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 123 | proof (intro ext iffI) | 
| 53255 | 124 | fix S :: "'a set" | 
| 125 | assume "open S" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 126 | with B obtain B' where "B' \<subseteq> B" "S = \<Union>B'" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 127 | unfolding topological_basis_def by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 128 | then show "generate_topology B S" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 129 | by (auto intro: generate_topology.intros dest: topological_basis_open) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 130 | next | 
| 53255 | 131 | fix S :: "'a set" | 
| 132 | assume "generate_topology B S" | |
| 133 | then show "open S" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 134 | by induct (auto dest: topological_basis_open[OF B]) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 135 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 136 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 137 | lemma basis_dense: | 
| 53640 | 138 | fixes B :: "'a set set" | 
| 139 | and f :: "'a set \<Rightarrow> 'a" | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 140 | assumes "topological_basis B" | 
| 53255 | 141 |     and choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
 | 
| 55522 | 142 |   shows "\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X)"
 | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 143 | proof (intro allI impI) | 
| 53640 | 144 | fix X :: "'a set" | 
| 145 |   assume "open X" and "X \<noteq> {}"
 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 146 |   from topological_basisE[OF `topological_basis B` `open X` choosefrom_basis[OF `X \<noteq> {}`]]
 | 
| 55522 | 147 | obtain B' where "B' \<in> B" "f X \<in> B'" "B' \<subseteq> X" . | 
| 53255 | 148 | then show "\<exists>B'\<in>B. f B' \<in> X" | 
| 149 | by (auto intro!: choosefrom_basis) | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 150 | qed | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 151 | |
| 50087 | 152 | end | 
| 153 | ||
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 154 | lemma topological_basis_prod: | 
| 53255 | 155 | assumes A: "topological_basis A" | 
| 156 | and B: "topological_basis B" | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 157 | shows "topological_basis ((\<lambda>(a, b). a \<times> b) ` (A \<times> B))" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 158 | unfolding topological_basis_def | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 159 | proof (safe, simp_all del: ex_simps add: subset_image_iff ex_simps(1)[symmetric]) | 
| 53255 | 160 |   fix S :: "('a \<times> 'b) set"
 | 
| 161 | assume "open S" | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 162 | then show "\<exists>X\<subseteq>A \<times> B. (\<Union>(a,b)\<in>X. a \<times> b) = S" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 163 |   proof (safe intro!: exI[of _ "{x\<in>A \<times> B. fst x \<times> snd x \<subseteq> S}"])
 | 
| 53255 | 164 | fix x y | 
| 165 | assume "(x, y) \<in> S" | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 166 | from open_prod_elim[OF `open S` this] | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 167 | obtain a b where a: "open a""x \<in> a" and b: "open b" "y \<in> b" and "a \<times> b \<subseteq> S" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 168 | by (metis mem_Sigma_iff) | 
| 55522 | 169 | moreover | 
| 170 | from A a obtain A0 where "A0 \<in> A" "x \<in> A0" "A0 \<subseteq> a" | |
| 171 | by (rule topological_basisE) | |
| 172 | moreover | |
| 173 | from B b obtain B0 where "B0 \<in> B" "y \<in> B0" "B0 \<subseteq> b" | |
| 174 | by (rule topological_basisE) | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 175 |     ultimately show "(x, y) \<in> (\<Union>(a, b)\<in>{X \<in> A \<times> B. fst X \<times> snd X \<subseteq> S}. a \<times> b)"
 | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 176 | by (intro UN_I[of "(A0, B0)"]) auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 177 | qed auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 178 | qed (metis A B topological_basis_open open_Times) | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 179 | |
| 53255 | 180 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 181 | subsection {* Countable Basis *}
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 182 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 183 | locale countable_basis = | 
| 53640 | 184 | fixes B :: "'a::topological_space set set" | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 185 | assumes is_basis: "topological_basis B" | 
| 53282 | 186 | and countable_basis: "countable B" | 
| 33175 | 187 | begin | 
| 188 | ||
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 189 | lemma open_countable_basis_ex: | 
| 50087 | 190 | assumes "open X" | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 191 | shows "\<exists>B' \<subseteq> B. X = Union B'" | 
| 53255 | 192 | using assms countable_basis is_basis | 
| 193 | unfolding topological_basis_def by blast | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 194 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 195 | lemma open_countable_basisE: | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 196 | assumes "open X" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 197 | obtains B' where "B' \<subseteq> B" "X = Union B'" | 
| 53255 | 198 | using assms open_countable_basis_ex | 
| 199 | by (atomize_elim) simp | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 200 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 201 | lemma countable_dense_exists: | 
| 53291 | 202 |   "\<exists>D::'a set. countable D \<and> (\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d \<in> D. d \<in> X))"
 | 
| 50087 | 203 | proof - | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 204 | let ?f = "(\<lambda>B'. SOME x. x \<in> B')" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 205 | have "countable (?f ` B)" using countable_basis by simp | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 206 | with basis_dense[OF is_basis, of ?f] show ?thesis | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 207 | by (intro exI[where x="?f ` B"]) (metis (mono_tags) all_not_in_conv imageI someI) | 
| 50087 | 208 | qed | 
| 209 | ||
| 210 | lemma countable_dense_setE: | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 211 | obtains D :: "'a set" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 212 |   where "countable D" "\<And>X. open X \<Longrightarrow> X \<noteq> {} \<Longrightarrow> \<exists>d \<in> D. d \<in> X"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 213 | using countable_dense_exists by blast | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 214 | |
| 50087 | 215 | end | 
| 216 | ||
| 50883 | 217 | lemma (in first_countable_topology) first_countable_basisE: | 
| 218 | obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 219 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)" | |
| 220 | using first_countable_basis[of x] | |
| 51473 | 221 | apply atomize_elim | 
| 222 | apply (elim exE) | |
| 223 | apply (rule_tac x="range A" in exI) | |
| 224 | apply auto | |
| 225 | done | |
| 50883 | 226 | |
| 51105 | 227 | lemma (in first_countable_topology) first_countable_basis_Int_stableE: | 
| 228 | obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 229 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)" | |
| 230 | "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A" | |
| 231 | proof atomize_elim | |
| 55522 | 232 | obtain A' where A': | 
| 233 | "countable A'" | |
| 234 | "\<And>a. a \<in> A' \<Longrightarrow> x \<in> a" | |
| 235 | "\<And>a. a \<in> A' \<Longrightarrow> open a" | |
| 236 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A'. a \<subseteq> S" | |
| 237 | by (rule first_countable_basisE) blast | |
| 51105 | 238 | def A \<equiv> "(\<lambda>N. \<Inter>((\<lambda>n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)" | 
| 53255 | 239 | then show "\<exists>A. countable A \<and> (\<forall>a. a \<in> A \<longrightarrow> x \<in> a) \<and> (\<forall>a. a \<in> A \<longrightarrow> open a) \<and> | 
| 51105 | 240 | (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)) \<and> (\<forall>a b. a \<in> A \<longrightarrow> b \<in> A \<longrightarrow> a \<inter> b \<in> A)" | 
| 241 | proof (safe intro!: exI[where x=A]) | |
| 53255 | 242 | show "countable A" | 
| 243 | unfolding A_def by (intro countable_image countable_Collect_finite) | |
| 244 | fix a | |
| 245 | assume "a \<in> A" | |
| 246 | then show "x \<in> a" "open a" | |
| 247 | using A'(4)[OF open_UNIV] by (auto simp: A_def intro: A' from_nat_into) | |
| 51105 | 248 | next | 
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 249 | let ?int = "\<lambda>N. \<Inter>(from_nat_into A' ` N)" | 
| 53255 | 250 | fix a b | 
| 251 | assume "a \<in> A" "b \<in> A" | |
| 252 | then obtain N M where "a = ?int N" "b = ?int M" "finite (N \<union> M)" | |
| 253 | by (auto simp: A_def) | |
| 254 | then show "a \<inter> b \<in> A" | |
| 255 | by (auto simp: A_def intro!: image_eqI[where x="N \<union> M"]) | |
| 51105 | 256 | next | 
| 53255 | 257 | fix S | 
| 258 | assume "open S" "x \<in> S" | |
| 259 | then obtain a where a: "a\<in>A'" "a \<subseteq> S" using A' by blast | |
| 260 | then show "\<exists>a\<in>A. a \<subseteq> S" using a A' | |
| 51105 | 261 |       by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"])
 | 
| 262 | qed | |
| 263 | qed | |
| 264 | ||
| 51473 | 265 | lemma (in topological_space) first_countableI: | 
| 53255 | 266 | assumes "countable A" | 
| 267 | and 1: "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 268 | and 2: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A. a \<subseteq> S" | |
| 51473 | 269 | shows "\<exists>A::nat \<Rightarrow> 'a set. (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))" | 
| 270 | proof (safe intro!: exI[of _ "from_nat_into A"]) | |
| 53255 | 271 | fix i | 
| 51473 | 272 |   have "A \<noteq> {}" using 2[of UNIV] by auto
 | 
| 53255 | 273 | show "x \<in> from_nat_into A i" "open (from_nat_into A i)" | 
| 274 |     using range_from_nat_into_subset[OF `A \<noteq> {}`] 1 by auto
 | |
| 275 | next | |
| 276 | fix S | |
| 277 | assume "open S" "x\<in>S" from 2[OF this] | |
| 278 | show "\<exists>i. from_nat_into A i \<subseteq> S" | |
| 279 | using subset_range_from_nat_into[OF `countable A`] by auto | |
| 51473 | 280 | qed | 
| 51350 | 281 | |
| 50883 | 282 | instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology | 
| 283 | proof | |
| 284 | fix x :: "'a \<times> 'b" | |
| 55522 | 285 | obtain A where A: | 
| 286 | "countable A" | |
| 287 | "\<And>a. a \<in> A \<Longrightarrow> fst x \<in> a" | |
| 288 | "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 289 | "\<And>S. open S \<Longrightarrow> fst x \<in> S \<Longrightarrow> \<exists>a\<in>A. a \<subseteq> S" | |
| 290 | by (rule first_countable_basisE[of "fst x"]) blast | |
| 291 | obtain B where B: | |
| 292 | "countable B" | |
| 293 | "\<And>a. a \<in> B \<Longrightarrow> snd x \<in> a" | |
| 294 | "\<And>a. a \<in> B \<Longrightarrow> open a" | |
| 295 | "\<And>S. open S \<Longrightarrow> snd x \<in> S \<Longrightarrow> \<exists>a\<in>B. a \<subseteq> S" | |
| 296 | by (rule first_countable_basisE[of "snd x"]) blast | |
| 53282 | 297 |   show "\<exists>A::nat \<Rightarrow> ('a \<times> 'b) set.
 | 
| 298 | (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))" | |
| 51473 | 299 | proof (rule first_countableI[of "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"], safe) | 
| 53255 | 300 | fix a b | 
| 301 | assume x: "a \<in> A" "b \<in> B" | |
| 53640 | 302 | with A(2, 3)[of a] B(2, 3)[of b] show "x \<in> a \<times> b" and "open (a \<times> b)" | 
| 303 | unfolding mem_Times_iff | |
| 304 | by (auto intro: open_Times) | |
| 50883 | 305 | next | 
| 53255 | 306 | fix S | 
| 307 | assume "open S" "x \<in> S" | |
| 55522 | 308 | then obtain a' b' where a'b': "open a'" "open b'" "x \<in> a' \<times> b'" "a' \<times> b' \<subseteq> S" | 
| 309 | by (rule open_prod_elim) | |
| 310 | moreover | |
| 311 | from a'b' A(4)[of a'] B(4)[of b'] | |
| 312 | obtain a b where "a \<in> A" "a \<subseteq> a'" "b \<in> B" "b \<subseteq> b'" | |
| 313 | by auto | |
| 314 | ultimately | |
| 315 | show "\<exists>a\<in>(\<lambda>(a, b). a \<times> b) ` (A \<times> B). a \<subseteq> S" | |
| 50883 | 316 | by (auto intro!: bexI[of _ "a \<times> b"] bexI[of _ a] bexI[of _ b]) | 
| 317 | qed (simp add: A B) | |
| 318 | qed | |
| 319 | ||
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50526diff
changeset | 320 | class second_countable_topology = topological_space + | 
| 53282 | 321 | assumes ex_countable_subbasis: | 
| 322 | "\<exists>B::'a::topological_space set set. countable B \<and> open = generate_topology B" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 323 | begin | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 324 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 325 | lemma ex_countable_basis: "\<exists>B::'a set set. countable B \<and> topological_basis B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 326 | proof - | 
| 53255 | 327 | from ex_countable_subbasis obtain B where B: "countable B" "open = generate_topology B" | 
| 328 | by blast | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 329 |   let ?B = "Inter ` {b. finite b \<and> b \<subseteq> B }"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 330 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 331 | show ?thesis | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 332 | proof (intro exI conjI) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 333 | show "countable ?B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 334 | by (intro countable_image countable_Collect_finite_subset B) | 
| 53255 | 335 |     {
 | 
| 336 | fix S | |
| 337 | assume "open S" | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 338 |       then have "\<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. (\<Union>b\<in>B'. \<Inter>b) = S"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 339 | unfolding B | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 340 | proof induct | 
| 53255 | 341 | case UNIV | 
| 342 |         show ?case by (intro exI[of _ "{{}}"]) simp
 | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 343 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 344 | case (Int a b) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 345 | then obtain x y where x: "a = UNION x Inter" "\<And>i. i \<in> x \<Longrightarrow> finite i \<and> i \<subseteq> B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 346 | and y: "b = UNION y Inter" "\<And>i. i \<in> y \<Longrightarrow> finite i \<and> i \<subseteq> B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 347 | by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 348 | show ?case | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 349 | unfolding x y Int_UN_distrib2 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 350 |           by (intro exI[of _ "{i \<union> j| i j.  i \<in> x \<and> j \<in> y}"]) (auto dest: x(2) y(2))
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 351 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 352 | case (UN K) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 353 |         then have "\<forall>k\<in>K. \<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. UNION B' Inter = k" by auto
 | 
| 55522 | 354 | then obtain k where | 
| 355 |             "\<forall>ka\<in>K. k ka \<subseteq> {b. finite b \<and> b \<subseteq> B} \<and> UNION (k ka) Inter = ka"
 | |
| 356 | unfolding bchoice_iff .. | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 357 |         then show "\<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. UNION B' Inter = \<Union>K"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 358 | by (intro exI[of _ "UNION K k"]) auto | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 359 | next | 
| 53255 | 360 | case (Basis S) | 
| 361 | then show ?case | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 362 |           by (intro exI[of _ "{{S}}"]) auto
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 363 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 364 |       then have "(\<exists>B'\<subseteq>Inter ` {b. finite b \<and> b \<subseteq> B}. \<Union>B' = S)"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 365 | unfolding subset_image_iff by blast } | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 366 | then show "topological_basis ?B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 367 | unfolding topological_space_class.topological_basis_def | 
| 53282 | 368 | by (safe intro!: topological_space_class.open_Inter) | 
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 369 | (simp_all add: B generate_topology.Basis subset_eq) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 370 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 371 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 372 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 373 | end | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 374 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 375 | sublocale second_countable_topology < | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 376 | countable_basis "SOME B. countable B \<and> topological_basis B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 377 | using someI_ex[OF ex_countable_basis] | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 378 | by unfold_locales safe | 
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 379 | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 380 | instance prod :: (second_countable_topology, second_countable_topology) second_countable_topology | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 381 | proof | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 382 | obtain A :: "'a set set" where "countable A" "topological_basis A" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 383 | using ex_countable_basis by auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 384 | moreover | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 385 | obtain B :: "'b set set" where "countable B" "topological_basis B" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 386 | using ex_countable_basis by auto | 
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 387 |   ultimately show "\<exists>B::('a \<times> 'b) set set. countable B \<and> open = generate_topology B"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 388 | by (auto intro!: exI[of _ "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"] topological_basis_prod | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 389 | topological_basis_imp_subbasis) | 
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 390 | qed | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 391 | |
| 50883 | 392 | instance second_countable_topology \<subseteq> first_countable_topology | 
| 393 | proof | |
| 394 | fix x :: 'a | |
| 395 | def B \<equiv> "SOME B::'a set set. countable B \<and> topological_basis B" | |
| 396 | then have B: "countable B" "topological_basis B" | |
| 397 | using countable_basis is_basis | |
| 398 | by (auto simp: countable_basis is_basis) | |
| 53282 | 399 | then show "\<exists>A::nat \<Rightarrow> 'a set. | 
| 400 | (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))" | |
| 51473 | 401 |     by (intro first_countableI[of "{b\<in>B. x \<in> b}"])
 | 
| 402 | (fastforce simp: topological_space_class.topological_basis_def)+ | |
| 50883 | 403 | qed | 
| 404 | ||
| 53255 | 405 | |
| 50087 | 406 | subsection {* Polish spaces *}
 | 
| 407 | ||
| 408 | text {* Textbooks define Polish spaces as completely metrizable.
 | |
| 409 | We assume the topology to be complete for a given metric. *} | |
| 410 | ||
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50526diff
changeset | 411 | class polish_space = complete_space + second_countable_topology | 
| 50087 | 412 | |
| 44517 | 413 | subsection {* General notion of a topology as a value *}
 | 
| 33175 | 414 | |
| 53255 | 415 | definition "istopology L \<longleftrightarrow> | 
| 416 |   L {} \<and> (\<forall>S T. L S \<longrightarrow> L T \<longrightarrow> L (S \<inter> T)) \<and> (\<forall>K. Ball K L \<longrightarrow> L (\<Union> K))"
 | |
| 417 | ||
| 49834 | 418 | typedef 'a topology = "{L::('a set) \<Rightarrow> bool. istopology L}"
 | 
| 33175 | 419 | morphisms "openin" "topology" | 
| 420 | unfolding istopology_def by blast | |
| 421 | ||
| 422 | lemma istopology_open_in[intro]: "istopology(openin U)" | |
| 423 | using openin[of U] by blast | |
| 424 | ||
| 425 | lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U" | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 426 | using topology_inverse[unfolded mem_Collect_eq] . | 
| 33175 | 427 | |
| 428 | lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U" | |
| 429 | using topology_inverse[of U] istopology_open_in[of "topology U"] by auto | |
| 430 | ||
| 431 | lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)" | |
| 53255 | 432 | proof | 
| 433 | assume "T1 = T2" | |
| 434 | then show "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp | |
| 435 | next | |
| 436 | assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" | |
| 437 | then have "openin T1 = openin T2" by (simp add: fun_eq_iff) | |
| 438 | then have "topology (openin T1) = topology (openin T2)" by simp | |
| 439 | then show "T1 = T2" unfolding openin_inverse . | |
| 33175 | 440 | qed | 
| 441 | ||
| 442 | text{* Infer the "universe" from union of all sets in the topology. *}
 | |
| 443 | ||
| 53640 | 444 | definition "topspace T = \<Union>{S. openin T S}"
 | 
| 33175 | 445 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 446 | subsubsection {* Main properties of open sets *}
 | 
| 33175 | 447 | |
| 448 | lemma openin_clauses: | |
| 449 | fixes U :: "'a topology" | |
| 53282 | 450 | shows | 
| 451 |     "openin U {}"
 | |
| 452 | "\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)" | |
| 453 | "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)" | |
| 454 | using openin[of U] unfolding istopology_def mem_Collect_eq by fast+ | |
| 33175 | 455 | |
| 456 | lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U" | |
| 457 | unfolding topspace_def by blast | |
| 53255 | 458 | |
| 459 | lemma openin_empty[simp]: "openin U {}"
 | |
| 460 | by (simp add: openin_clauses) | |
| 33175 | 461 | |
| 462 | lemma openin_Int[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<inter> T)" | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 463 | using openin_clauses by simp | 
| 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 464 | |
| 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 465 | lemma openin_Union[intro]: "(\<forall>S \<in>K. openin U S) \<Longrightarrow> openin U (\<Union> K)" | 
| 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 466 | using openin_clauses by simp | 
| 33175 | 467 | |
| 468 | lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)" | |
| 469 |   using openin_Union[of "{S,T}" U] by auto
 | |
| 470 | ||
| 53255 | 471 | lemma openin_topspace[intro, simp]: "openin U (topspace U)" | 
| 472 | by (simp add: openin_Union topspace_def) | |
| 33175 | 473 | |
| 49711 | 474 | lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)" | 
| 475 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 36584 | 476 | proof | 
| 49711 | 477 | assume ?lhs | 
| 478 | then show ?rhs by auto | |
| 36584 | 479 | next | 
| 480 | assume H: ?rhs | |
| 481 |   let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
 | |
| 482 | have "openin U ?t" by (simp add: openin_Union) | |
| 483 | also have "?t = S" using H by auto | |
| 484 | finally show "openin U S" . | |
| 33175 | 485 | qed | 
| 486 | ||
| 49711 | 487 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 488 | subsubsection {* Closed sets *}
 | 
| 33175 | 489 | |
| 490 | definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)" | |
| 491 | ||
| 53255 | 492 | lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" | 
| 493 | by (metis closedin_def) | |
| 494 | ||
| 495 | lemma closedin_empty[simp]: "closedin U {}"
 | |
| 496 | by (simp add: closedin_def) | |
| 497 | ||
| 498 | lemma closedin_topspace[intro, simp]: "closedin U (topspace U)" | |
| 499 | by (simp add: closedin_def) | |
| 500 | ||
| 33175 | 501 | lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)" | 
| 502 | by (auto simp add: Diff_Un closedin_def) | |
| 503 | ||
| 53255 | 504 | lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}"
 | 
| 505 | by auto | |
| 506 | ||
| 507 | lemma closedin_Inter[intro]: | |
| 508 |   assumes Ke: "K \<noteq> {}"
 | |
| 509 | and Kc: "\<forall>S \<in>K. closedin U S" | |
| 510 | shows "closedin U (\<Inter> K)" | |
| 511 | using Ke Kc unfolding closedin_def Diff_Inter by auto | |
| 33175 | 512 | |
| 513 | lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)" | |
| 514 |   using closedin_Inter[of "{S,T}" U] by auto
 | |
| 515 | ||
| 53255 | 516 | lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" | 
| 517 | by blast | |
| 518 | ||
| 33175 | 519 | lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)" | 
| 520 | apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2) | |
| 521 | apply (metis openin_subset subset_eq) | |
| 522 | done | |
| 523 | ||
| 53255 | 524 | lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))" | 
| 33175 | 525 | by (simp add: openin_closedin_eq) | 
| 526 | ||
| 53255 | 527 | lemma openin_diff[intro]: | 
| 528 | assumes oS: "openin U S" | |
| 529 | and cT: "closedin U T" | |
| 530 | shows "openin U (S - T)" | |
| 531 | proof - | |
| 33175 | 532 | have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S] oS cT | 
| 533 | by (auto simp add: topspace_def openin_subset) | |
| 53282 | 534 | then show ?thesis using oS cT | 
| 535 | by (auto simp add: closedin_def) | |
| 33175 | 536 | qed | 
| 537 | ||
| 53255 | 538 | lemma closedin_diff[intro]: | 
| 539 | assumes oS: "closedin U S" | |
| 540 | and cT: "openin U T" | |
| 541 | shows "closedin U (S - T)" | |
| 542 | proof - | |
| 543 | have "S - T = S \<inter> (topspace U - T)" | |
| 53282 | 544 | using closedin_subset[of U S] oS cT by (auto simp add: topspace_def) | 
| 53255 | 545 | then show ?thesis | 
| 546 | using oS cT by (auto simp add: openin_closedin_eq) | |
| 547 | qed | |
| 548 | ||
| 33175 | 549 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 550 | subsubsection {* Subspace topology *}
 | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 551 | |
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 552 | definition "subtopology U V = topology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)" | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 553 | |
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 554 | lemma istopology_subtopology: "istopology (\<lambda>T. \<exists>S. T = S \<inter> V \<and> openin U S)" | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 555 | (is "istopology ?L") | 
| 53255 | 556 | proof - | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 557 |   have "?L {}" by blast
 | 
| 53255 | 558 |   {
 | 
| 559 | fix A B | |
| 560 | assume A: "?L A" and B: "?L B" | |
| 561 | from A B obtain Sa and Sb where Sa: "openin U Sa" "A = Sa \<inter> V" and Sb: "openin U Sb" "B = Sb \<inter> V" | |
| 562 | by blast | |
| 563 | have "A \<inter> B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)" | |
| 564 | using Sa Sb by blast+ | |
| 565 | then have "?L (A \<inter> B)" by blast | |
| 566 | } | |
| 33175 | 567 | moreover | 
| 53255 | 568 |   {
 | 
| 53282 | 569 | fix K | 
| 570 | assume K: "K \<subseteq> Collect ?L" | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 571 | have th0: "Collect ?L = (\<lambda>S. S \<inter> V) ` Collect (openin U)" | 
| 55775 | 572 | by blast | 
| 33175 | 573 | from K[unfolded th0 subset_image_iff] | 
| 53255 | 574 | obtain Sk where Sk: "Sk \<subseteq> Collect (openin U)" "K = (\<lambda>S. S \<inter> V) ` Sk" | 
| 575 | by blast | |
| 576 | have "\<Union>K = (\<Union>Sk) \<inter> V" | |
| 577 | using Sk by auto | |
| 578 | moreover have "openin U (\<Union> Sk)" | |
| 579 | using Sk by (auto simp add: subset_eq) | |
| 580 | ultimately have "?L (\<Union>K)" by blast | |
| 581 | } | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 582 | ultimately show ?thesis | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 583 | unfolding subset_eq mem_Collect_eq istopology_def by blast | 
| 33175 | 584 | qed | 
| 585 | ||
| 53255 | 586 | lemma openin_subtopology: "openin (subtopology U V) S \<longleftrightarrow> (\<exists>T. openin U T \<and> S = T \<inter> V)" | 
| 33175 | 587 | unfolding subtopology_def topology_inverse'[OF istopology_subtopology] | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 588 | by auto | 
| 33175 | 589 | |
| 53255 | 590 | lemma topspace_subtopology: "topspace (subtopology U V) = topspace U \<inter> V" | 
| 33175 | 591 | by (auto simp add: topspace_def openin_subtopology) | 
| 592 | ||
| 53255 | 593 | lemma closedin_subtopology: "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)" | 
| 33175 | 594 | unfolding closedin_def topspace_subtopology | 
| 55775 | 595 | by (auto simp add: openin_subtopology) | 
| 33175 | 596 | |
| 597 | lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U" | |
| 598 | unfolding openin_subtopology | |
| 55775 | 599 | by auto (metis IntD1 in_mono openin_subset) | 
| 49711 | 600 | |
| 601 | lemma subtopology_superset: | |
| 602 | assumes UV: "topspace U \<subseteq> V" | |
| 33175 | 603 | shows "subtopology U V = U" | 
| 53255 | 604 | proof - | 
| 605 |   {
 | |
| 606 | fix S | |
| 607 |     {
 | |
| 608 | fix T | |
| 609 | assume T: "openin U T" "S = T \<inter> V" | |
| 610 | from T openin_subset[OF T(1)] UV have eq: "S = T" | |
| 611 | by blast | |
| 612 | have "openin U S" | |
| 613 | unfolding eq using T by blast | |
| 614 | } | |
| 33175 | 615 | moreover | 
| 53255 | 616 |     {
 | 
| 617 | assume S: "openin U S" | |
| 618 | then have "\<exists>T. openin U T \<and> S = T \<inter> V" | |
| 619 | using openin_subset[OF S] UV by auto | |
| 620 | } | |
| 621 | ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" | |
| 622 | by blast | |
| 623 | } | |
| 624 | then show ?thesis | |
| 625 | unfolding topology_eq openin_subtopology by blast | |
| 33175 | 626 | qed | 
| 627 | ||
| 628 | lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U" | |
| 629 | by (simp add: subtopology_superset) | |
| 630 | ||
| 631 | lemma subtopology_UNIV[simp]: "subtopology U UNIV = U" | |
| 632 | by (simp add: subtopology_superset) | |
| 633 | ||
| 53255 | 634 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 635 | subsubsection {* The standard Euclidean topology *}
 | 
| 33175 | 636 | |
| 53255 | 637 | definition euclidean :: "'a::topological_space topology" | 
| 638 | where "euclidean = topology open" | |
| 33175 | 639 | |
| 640 | lemma open_openin: "open S \<longleftrightarrow> openin euclidean S" | |
| 641 | unfolding euclidean_def | |
| 642 | apply (rule cong[where x=S and y=S]) | |
| 643 | apply (rule topology_inverse[symmetric]) | |
| 644 | apply (auto simp add: istopology_def) | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 645 | done | 
| 33175 | 646 | |
| 647 | lemma topspace_euclidean: "topspace euclidean = UNIV" | |
| 648 | apply (simp add: topspace_def) | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 649 | apply (rule set_eqI) | 
| 53255 | 650 | apply (auto simp add: open_openin[symmetric]) | 
| 651 | done | |
| 33175 | 652 | |
| 653 | lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S" | |
| 654 | by (simp add: topspace_euclidean topspace_subtopology) | |
| 655 | ||
| 656 | lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S" | |
| 657 | by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV) | |
| 658 | ||
| 659 | lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)" | |
| 660 | by (simp add: open_openin openin_subopen[symmetric]) | |
| 661 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 662 | text {* Basic "localization" results are handy for connectedness. *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 663 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 664 | lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 665 | by (auto simp add: openin_subtopology open_openin[symmetric]) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 666 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 667 | lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 668 | by (auto simp add: openin_open) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 669 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 670 | lemma open_openin_trans[trans]: | 
| 53255 | 671 | "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T" | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 672 | by (metis Int_absorb1 openin_open_Int) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 673 | |
| 53255 | 674 | lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S" | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 675 | by (auto simp add: openin_open) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 676 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 677 | lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 678 | by (simp add: closedin_subtopology closed_closedin Int_ac) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 679 | |
| 53291 | 680 | lemma closedin_closed_Int: "closed S \<Longrightarrow> closedin (subtopology euclidean U) (U \<inter> S)" | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 681 | by (metis closedin_closed) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 682 | |
| 53282 | 683 | lemma closed_closedin_trans: | 
| 684 | "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T" | |
| 55775 | 685 | by (metis closedin_closed inf.absorb2) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 686 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 687 | lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 688 | by (auto simp add: closedin_closed) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 689 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 690 | lemma openin_euclidean_subtopology_iff: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 691 | fixes S U :: "'a::metric_space set" | 
| 53255 | 692 | shows "openin (subtopology euclidean U) S \<longleftrightarrow> | 
| 693 | S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)" | |
| 694 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 695 | proof | 
| 53255 | 696 | assume ?lhs | 
| 53282 | 697 | then show ?rhs | 
| 698 | unfolding openin_open open_dist by blast | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 699 | next | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 700 |   def T \<equiv> "{x. \<exists>a\<in>S. \<exists>d>0. (\<forall>y\<in>U. dist y a < d \<longrightarrow> y \<in> S) \<and> dist x a < d}"
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 701 | have 1: "\<forall>x\<in>T. \<exists>e>0. \<forall>y. dist y x < e \<longrightarrow> y \<in> T" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 702 | unfolding T_def | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 703 | apply clarsimp | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 704 | apply (rule_tac x="d - dist x a" in exI) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 705 | apply (clarsimp simp add: less_diff_eq) | 
| 55775 | 706 | by (metis dist_commute dist_triangle_lt) | 
| 53282 | 707 | assume ?rhs then have 2: "S = U \<inter> T" | 
| 55775 | 708 | unfolding T_def | 
| 709 | by auto (metis dist_self) | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 710 | from 1 2 show ?lhs | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 711 | unfolding openin_open open_dist by fast | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 712 | qed | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 713 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 714 | text {* These "transitivity" results are handy too *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 715 | |
| 53255 | 716 | lemma openin_trans[trans]: | 
| 717 | "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T \<Longrightarrow> | |
| 718 | openin (subtopology euclidean U) S" | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 719 | unfolding open_openin openin_open by blast | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 720 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 721 | lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 722 | by (auto simp add: openin_open intro: openin_trans) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 723 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 724 | lemma closedin_trans[trans]: | 
| 53255 | 725 | "closedin (subtopology euclidean T) S \<Longrightarrow> closedin (subtopology euclidean U) T \<Longrightarrow> | 
| 726 | closedin (subtopology euclidean U) S" | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 727 | by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 728 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 729 | lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 730 | by (auto simp add: closedin_closed intro: closedin_trans) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 731 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 732 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 733 | subsection {* Open and closed balls *}
 | 
| 33175 | 734 | |
| 53255 | 735 | definition ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" | 
| 736 |   where "ball x e = {y. dist x y < e}"
 | |
| 737 | ||
| 738 | definition cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" | |
| 739 |   where "cball x e = {y. dist x y \<le> e}"
 | |
| 33175 | 740 | |
| 45776 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 741 | lemma mem_ball [simp]: "y \<in> ball x e \<longleftrightarrow> dist x y < e" | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 742 | by (simp add: ball_def) | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 743 | |
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 744 | lemma mem_cball [simp]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e" | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 745 | by (simp add: cball_def) | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 746 | |
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 747 | lemma mem_ball_0: | 
| 33175 | 748 | fixes x :: "'a::real_normed_vector" | 
| 749 | shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e" | |
| 750 | by (simp add: dist_norm) | |
| 751 | ||
| 45776 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 752 | lemma mem_cball_0: | 
| 33175 | 753 | fixes x :: "'a::real_normed_vector" | 
| 754 | shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e" | |
| 755 | by (simp add: dist_norm) | |
| 756 | ||
| 45776 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 757 | lemma centre_in_ball: "x \<in> ball x e \<longleftrightarrow> 0 < e" | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 758 | by simp | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 759 | |
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 760 | lemma centre_in_cball: "x \<in> cball x e \<longleftrightarrow> 0 \<le> e" | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 761 | by simp | 
| 
714100f5fda4
remove mem_(c)ball_0 and centre_in_(c)ball from simpset, as rules mem_(c)ball always match instead
 huffman parents: 
45548diff
changeset | 762 | |
| 53255 | 763 | lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" | 
| 764 | by (simp add: subset_eq) | |
| 765 | ||
| 53282 | 766 | lemma subset_ball[intro]: "d \<le> e \<Longrightarrow> ball x d \<subseteq> ball x e" | 
| 53255 | 767 | by (simp add: subset_eq) | 
| 768 | ||
| 53282 | 769 | lemma subset_cball[intro]: "d \<le> e \<Longrightarrow> cball x d \<subseteq> cball x e" | 
| 53255 | 770 | by (simp add: subset_eq) | 
| 771 | ||
| 33175 | 772 | lemma ball_max_Un: "ball a (max r s) = ball a r \<union> ball a s" | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 773 | by (simp add: set_eq_iff) arith | 
| 33175 | 774 | |
| 775 | lemma ball_min_Int: "ball a (min r s) = ball a r \<inter> ball a s" | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 776 | by (simp add: set_eq_iff) | 
| 33175 | 777 | |
| 53255 | 778 | lemma diff_less_iff: | 
| 779 | "(a::real) - b > 0 \<longleftrightarrow> a > b" | |
| 33175 | 780 | "(a::real) - b < 0 \<longleftrightarrow> a < b" | 
| 53255 | 781 | "a - b < c \<longleftrightarrow> a < c + b" "a - b > c \<longleftrightarrow> a > c + b" | 
| 782 | by arith+ | |
| 783 | ||
| 784 | lemma diff_le_iff: | |
| 785 | "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" | |
| 786 | "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b" | |
| 787 | "a - b \<le> c \<longleftrightarrow> a \<le> c + b" | |
| 788 | "a - b \<ge> c \<longleftrightarrow> a \<ge> c + b" | |
| 789 | by arith+ | |
| 33175 | 790 | |
| 54070 | 791 | lemma open_ball [intro, simp]: "open (ball x e)" | 
| 792 | proof - | |
| 793 |   have "open (dist x -` {..<e})"
 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 794 | by (intro open_vimage open_lessThan continuous_intros) | 
| 54070 | 795 |   also have "dist x -` {..<e} = ball x e"
 | 
| 796 | by auto | |
| 797 | finally show ?thesis . | |
| 798 | qed | |
| 33175 | 799 | |
| 800 | lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)" | |
| 801 | unfolding open_dist subset_eq mem_ball Ball_def dist_commute .. | |
| 802 | ||
| 33714 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 803 | lemma openE[elim?]: | 
| 53282 | 804 | assumes "open S" "x\<in>S" | 
| 33714 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 805 | obtains e where "e>0" "ball x e \<subseteq> S" | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 806 | using assms unfolding open_contains_ball by auto | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 807 | |
| 33175 | 808 | lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | 
| 809 | by (metis open_contains_ball subset_eq centre_in_ball) | |
| 810 | ||
| 811 | lemma ball_eq_empty[simp]: "ball x e = {} \<longleftrightarrow> e \<le> 0"
 | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 812 | unfolding mem_ball set_eq_iff | 
| 33175 | 813 | apply (simp add: not_less) | 
| 52624 | 814 | apply (metis zero_le_dist order_trans dist_self) | 
| 815 | done | |
| 33175 | 816 | |
| 53291 | 817 | lemma ball_empty[intro]: "e \<le> 0 \<Longrightarrow> ball x e = {}" by simp
 | 
| 33175 | 818 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 819 | lemma euclidean_dist_l2: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 820 | fixes x y :: "'a :: euclidean_space" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 821 | shows "dist x y = setL2 (\<lambda>i. dist (x \<bullet> i) (y \<bullet> i)) Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 822 | unfolding dist_norm norm_eq_sqrt_inner setL2_def | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 823 | by (subst euclidean_inner) (simp add: power2_eq_square inner_diff_left) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 824 | |
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 825 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 826 | subsection {* Boxes *}
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 827 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 828 | abbreviation One :: "'a::euclidean_space" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 829 | where "One \<equiv> \<Sum>Basis" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 830 | |
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 831 | definition (in euclidean_space) eucl_less (infix "<e" 50) | 
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 832 | where "eucl_less a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)" | 
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 833 | |
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 834 | definition box_eucl_less: "box a b = {x. a <e x \<and> x <e b}"
 | 
| 56188 | 835 | definition "cbox a b = {x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i}"
 | 
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 836 | |
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 837 | lemma box_def: "box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i}"
 | 
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 838 | and in_box_eucl_less: "x \<in> box a b \<longleftrightarrow> a <e x \<and> x <e b" | 
| 56188 | 839 | and mem_box: "x \<in> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i)" | 
| 840 | "x \<in> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i)" | |
| 841 | by (auto simp: box_eucl_less eucl_less_def cbox_def) | |
| 842 | ||
| 843 | lemma mem_box_real[simp]: | |
| 844 | "(x::real) \<in> box a b \<longleftrightarrow> a < x \<and> x < b" | |
| 845 | "(x::real) \<in> cbox a b \<longleftrightarrow> a \<le> x \<and> x \<le> b" | |
| 846 | by (auto simp: mem_box) | |
| 847 | ||
| 848 | lemma box_real[simp]: | |
| 849 | fixes a b:: real | |
| 850 |   shows "box a b = {a <..< b}" "cbox a b = {a .. b}"
 | |
| 851 | by auto | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 852 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 853 | lemma box_Int_box: | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 854 | fixes a :: "'a::euclidean_space" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 855 | shows "box a b \<inter> box c d = | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 856 | box (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 857 | unfolding set_eq_iff and Int_iff and mem_box by auto | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 858 | |
| 50087 | 859 | lemma rational_boxes: | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 860 | fixes x :: "'a\<Colon>euclidean_space" | 
| 53291 | 861 | assumes "e > 0" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 862 | shows "\<exists>a b. (\<forall>i\<in>Basis. a \<bullet> i \<in> \<rat> \<and> b \<bullet> i \<in> \<rat> ) \<and> x \<in> box a b \<and> box a b \<subseteq> ball x e" | 
| 50087 | 863 | proof - | 
| 864 |   def e' \<equiv> "e / (2 * sqrt (real (DIM ('a))))"
 | |
| 53291 | 865 | then have e: "e' > 0" | 
| 56541 | 866 | using assms by (auto simp: DIM_positive) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 867 | have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> y < x \<bullet> i \<and> x \<bullet> i - y < e'" (is "\<forall>i. ?th i") | 
| 50087 | 868 | proof | 
| 53255 | 869 | fix i | 
| 870 | from Rats_dense_in_real[of "x \<bullet> i - e'" "x \<bullet> i"] e | |
| 871 | show "?th i" by auto | |
| 50087 | 872 | qed | 
| 55522 | 873 | from choice[OF this] obtain a where | 
| 874 | a: "\<forall>xa. a xa \<in> \<rat> \<and> a xa < x \<bullet> xa \<and> x \<bullet> xa - a xa < e'" .. | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 875 | have "\<forall>i. \<exists>y. y \<in> \<rat> \<and> x \<bullet> i < y \<and> y - x \<bullet> i < e'" (is "\<forall>i. ?th i") | 
| 50087 | 876 | proof | 
| 53255 | 877 | fix i | 
| 878 | from Rats_dense_in_real[of "x \<bullet> i" "x \<bullet> i + e'"] e | |
| 879 | show "?th i" by auto | |
| 50087 | 880 | qed | 
| 55522 | 881 | from choice[OF this] obtain b where | 
| 882 | b: "\<forall>xa. b xa \<in> \<rat> \<and> x \<bullet> xa < b xa \<and> b xa - x \<bullet> xa < e'" .. | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 883 | let ?a = "\<Sum>i\<in>Basis. a i *\<^sub>R i" and ?b = "\<Sum>i\<in>Basis. b i *\<^sub>R i" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 884 | show ?thesis | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 885 | proof (rule exI[of _ ?a], rule exI[of _ ?b], safe) | 
| 53255 | 886 | fix y :: 'a | 
| 887 | assume *: "y \<in> box ?a ?b" | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
52625diff
changeset | 888 | have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)" | 
| 50087 | 889 | unfolding setL2_def[symmetric] by (rule euclidean_dist_l2) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 890 |     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
 | 
| 50087 | 891 | proof (rule real_sqrt_less_mono, rule setsum_strict_mono) | 
| 53255 | 892 | fix i :: "'a" | 
| 893 | assume i: "i \<in> Basis" | |
| 894 | have "a i < y\<bullet>i \<and> y\<bullet>i < b i" | |
| 895 | using * i by (auto simp: box_def) | |
| 896 | moreover have "a i < x\<bullet>i" "x\<bullet>i - a i < e'" | |
| 897 | using a by auto | |
| 898 | moreover have "x\<bullet>i < b i" "b i - x\<bullet>i < e'" | |
| 899 | using b by auto | |
| 900 | ultimately have "\<bar>x\<bullet>i - y\<bullet>i\<bar> < 2 * e'" | |
| 901 | by auto | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 902 |       then have "dist (x \<bullet> i) (y \<bullet> i) < e/sqrt (real (DIM('a)))"
 | 
| 50087 | 903 | unfolding e'_def by (auto simp: dist_real_def) | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
52625diff
changeset | 904 |       then have "(dist (x \<bullet> i) (y \<bullet> i))\<^sup>2 < (e/sqrt (real (DIM('a))))\<^sup>2"
 | 
| 50087 | 905 | by (rule power_strict_mono) auto | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
52625diff
changeset | 906 |       then show "(dist (x \<bullet> i) (y \<bullet> i))\<^sup>2 < e\<^sup>2 / real DIM('a)"
 | 
| 50087 | 907 | by (simp add: power_divide) | 
| 908 | qed auto | |
| 53255 | 909 | also have "\<dots> = e" | 
| 910 | using `0 < e` by (simp add: real_eq_of_nat) | |
| 911 | finally show "y \<in> ball x e" | |
| 912 | by (auto simp: ball_def) | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 913 | qed (insert a b, auto simp: box_def) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 914 | qed | 
| 51103 | 915 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 916 | lemma open_UNION_box: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 917 | fixes M :: "'a\<Colon>euclidean_space set" | 
| 53282 | 918 | assumes "open M" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 919 | defines "a' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. fst (f i) *\<^sub>R i)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 920 | defines "b' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. snd (f i) *\<^sub>R i)" | 
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
52625diff
changeset | 921 |   defines "I \<equiv> {f\<in>Basis \<rightarrow>\<^sub>E \<rat> \<times> \<rat>. box (a' f) (b' f) \<subseteq> M}"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 922 | shows "M = (\<Union>f\<in>I. box (a' f) (b' f))" | 
| 52624 | 923 | proof - | 
| 924 |   {
 | |
| 925 | fix x assume "x \<in> M" | |
| 926 | obtain e where e: "e > 0" "ball x e \<subseteq> M" | |
| 927 | using openE[OF `open M` `x \<in> M`] by auto | |
| 53282 | 928 | moreover obtain a b where ab: | 
| 929 | "x \<in> box a b" | |
| 930 | "\<forall>i \<in> Basis. a \<bullet> i \<in> \<rat>" | |
| 931 | "\<forall>i\<in>Basis. b \<bullet> i \<in> \<rat>" | |
| 932 | "box a b \<subseteq> ball x e" | |
| 52624 | 933 | using rational_boxes[OF e(1)] by metis | 
| 934 | ultimately have "x \<in> (\<Union>f\<in>I. box (a' f) (b' f))" | |
| 935 | by (intro UN_I[of "\<lambda>i\<in>Basis. (a \<bullet> i, b \<bullet> i)"]) | |
| 936 | (auto simp: euclidean_representation I_def a'_def b'_def) | |
| 937 | } | |
| 938 | then show ?thesis by (auto simp: I_def) | |
| 939 | qed | |
| 940 | ||
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 941 | lemma box_eq_empty: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 942 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 943 |   shows "(box a b = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i))" (is ?th1)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 944 |     and "(cbox a b = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i < a\<bullet>i))" (is ?th2)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 945 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 946 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 947 | fix i x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 948 | assume i: "i\<in>Basis" and as:"b\<bullet>i \<le> a\<bullet>i" and x:"x\<in>box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 949 | then have "a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 950 | unfolding mem_box by (auto simp: box_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 951 | then have "a\<bullet>i < b\<bullet>i" by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 952 | then have False using as by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 953 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 954 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 955 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 956 | assume as: "\<forall>i\<in>Basis. \<not> (b\<bullet>i \<le> a\<bullet>i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 957 | let ?x = "(1/2) *\<^sub>R (a + b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 958 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 959 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 960 | assume i: "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 961 | have "a\<bullet>i < b\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 962 | using as[THEN bspec[where x=i]] i by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 963 | then have "a\<bullet>i < ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i < b\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 964 | by (auto simp: inner_add_left) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 965 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 966 |     then have "box a b \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 967 | using mem_box(1)[of "?x" a b] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 968 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 969 | ultimately show ?th1 by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 970 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 971 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 972 | fix i x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 973 | assume i: "i \<in> Basis" and as:"b\<bullet>i < a\<bullet>i" and x:"x\<in>cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 974 | then have "a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 975 | unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 976 | then have "a\<bullet>i \<le> b\<bullet>i" by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 977 | then have False using as by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 978 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 979 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 980 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 981 | assume as:"\<forall>i\<in>Basis. \<not> (b\<bullet>i < a\<bullet>i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 982 | let ?x = "(1/2) *\<^sub>R (a + b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 983 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 984 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 985 | assume i:"i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 986 | have "a\<bullet>i \<le> b\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 987 | using as[THEN bspec[where x=i]] i by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 988 | then have "a\<bullet>i \<le> ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i \<le> b\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 989 | by (auto simp: inner_add_left) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 990 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 991 |     then have "cbox a b \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 992 | using mem_box(2)[of "?x" a b] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 993 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 994 | ultimately show ?th2 by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 995 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 996 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 997 | lemma box_ne_empty: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 998 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 999 |   shows "cbox a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i)"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1000 |   and "box a b \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1001 | unfolding box_eq_empty[of a b] by fastforce+ | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1002 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1003 | lemma | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1004 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1005 |   shows cbox_sing: "cbox a a = {a}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1006 |     and box_sing: "box a a = {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1007 | unfolding set_eq_iff mem_box eq_iff [symmetric] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1008 | by (auto intro!: euclidean_eqI[where 'a='a]) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1009 | (metis all_not_in_conv nonempty_Basis) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1010 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1011 | lemma subset_box_imp: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1012 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1013 | shows "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1014 | and "(\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i) \<Longrightarrow> cbox c d \<subseteq> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1015 | and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1016 | and "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> box c d \<subseteq> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1017 | unfolding subset_eq[unfolded Ball_def] unfolding mem_box | 
| 58757 | 1018 | by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+ | 
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1019 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1020 | lemma box_subset_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1021 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1022 | shows "box a b \<subseteq> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1023 | unfolding subset_eq [unfolded Ball_def] mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1024 | by (fast intro: less_imp_le) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1025 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1026 | lemma subset_box: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1027 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1028 | shows "cbox c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i \<le> d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th1) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1029 | and "cbox c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i \<le> d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i)" (is ?th2) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1030 | and "box c d \<subseteq> cbox a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th3) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1031 | and "box c d \<subseteq> box a b \<longleftrightarrow> (\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i) --> (\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i)" (is ?th4) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1032 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1033 | show ?th1 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1034 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1035 | by (auto intro: order_trans) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1036 | show ?th2 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1037 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1038 | by (auto intro: le_less_trans less_le_trans order_trans less_imp_le) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1039 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1040 | assume as: "box c d \<subseteq> cbox a b" "\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1041 |     then have "box c d \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1042 | unfolding box_eq_empty by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1043 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1044 | assume i: "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1045 | (** TODO combine the following two parts as done in the HOL_light version. **) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1046 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1047 | let ?x = "(\<Sum>j\<in>Basis. (if j=i then ((min (a\<bullet>j) (d\<bullet>j))+c\<bullet>j)/2 else (c\<bullet>j+d\<bullet>j)/2) *\<^sub>R j)::'a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1048 | assume as2: "a\<bullet>i > c\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1049 |       {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1050 | fix j :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1051 | assume j: "j \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1052 | then have "c \<bullet> j < ?x \<bullet> j \<and> ?x \<bullet> j < d \<bullet> j" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1053 | apply (cases "j = i") | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1054 | using as(2)[THEN bspec[where x=j]] i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1055 | apply (auto simp add: as2) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1056 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1057 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1058 | then have "?x\<in>box c d" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1059 | using i unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1060 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1061 | have "?x \<notin> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1062 | unfolding mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1063 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1064 | apply (rule_tac x=i in bexI) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1065 | using as(2)[THEN bspec[where x=i]] and as2 i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1066 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1067 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1068 | ultimately have False using as by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1069 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1070 | then have "a\<bullet>i \<le> c\<bullet>i" by (rule ccontr) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1071 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1072 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1073 | let ?x = "(\<Sum>j\<in>Basis. (if j=i then ((max (b\<bullet>j) (c\<bullet>j))+d\<bullet>j)/2 else (c\<bullet>j+d\<bullet>j)/2) *\<^sub>R j)::'a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1074 | assume as2: "b\<bullet>i < d\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1075 |       {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1076 | fix j :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1077 | assume "j\<in>Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1078 | then have "d \<bullet> j > ?x \<bullet> j \<and> ?x \<bullet> j > c \<bullet> j" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1079 | apply (cases "j = i") | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1080 | using as(2)[THEN bspec[where x=j]] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1081 | apply (auto simp add: as2) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1082 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1083 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1084 | then have "?x\<in>box c d" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1085 | unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1086 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1087 | have "?x\<notin>cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1088 | unfolding mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1089 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1090 | apply (rule_tac x=i in bexI) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1091 | using as(2)[THEN bspec[where x=i]] and as2 using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1092 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1093 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1094 | ultimately have False using as by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1095 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1096 | then have "b\<bullet>i \<ge> d\<bullet>i" by (rule ccontr) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1097 | ultimately | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1098 | have "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i" by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1099 | } note part1 = this | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1100 | show ?th3 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1101 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1102 | apply (rule, rule, rule, rule) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1103 | apply (rule part1) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1104 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1105 | prefer 4 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1106 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1107 | apply (erule_tac x=xa in allE, erule_tac x=xa in allE, fastforce)+ | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1108 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1109 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1110 | assume as: "box c d \<subseteq> box a b" "\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1111 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1112 | assume i:"i\<in>Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1113 | from as(1) have "box c d \<subseteq> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1114 | using box_subset_cbox[of a b] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1115 | then have "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1116 | using part1 and as(2) using i by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1117 | } note * = this | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1118 | show ?th4 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1119 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1120 | apply (rule, rule, rule, rule) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1121 | apply (rule *) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1122 | unfolding subset_eq and Ball_def and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1123 | prefer 4 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1124 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1125 | apply (erule_tac x=xa in allE, simp)+ | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1126 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1127 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1128 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1129 | lemma inter_interval: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1130 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1131 | shows "cbox a b \<inter> cbox c d = | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1132 | cbox (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1133 | unfolding set_eq_iff and Int_iff and mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1134 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1135 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1136 | lemma disjoint_interval: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1137 | fixes a::"'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1138 |   shows "cbox a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i < a\<bullet>i \<or> d\<bullet>i < c\<bullet>i \<or> b\<bullet>i < c\<bullet>i \<or> d\<bullet>i < a\<bullet>i))" (is ?th1)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1139 |     and "cbox a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i < a\<bullet>i \<or> d\<bullet>i \<le> c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th2)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1140 |     and "box a b \<inter> cbox c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i \<le> a\<bullet>i \<or> d\<bullet>i < c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th3)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1141 |     and "box a b \<inter> box c d = {} \<longleftrightarrow> (\<exists>i\<in>Basis. (b\<bullet>i \<le> a\<bullet>i \<or> d\<bullet>i \<le> c\<bullet>i \<or> b\<bullet>i \<le> c\<bullet>i \<or> d\<bullet>i \<le> a\<bullet>i))" (is ?th4)
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1142 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1143 | let ?z = "(\<Sum>i\<in>Basis. (((max (a\<bullet>i) (c\<bullet>i)) + (min (b\<bullet>i) (d\<bullet>i))) / 2) *\<^sub>R i)::'a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1144 | have **: "\<And>P Q. (\<And>i :: 'a. i \<in> Basis \<Longrightarrow> Q ?z i \<Longrightarrow> P i) \<Longrightarrow> | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1145 | (\<And>i x :: 'a. i \<in> Basis \<Longrightarrow> P i \<Longrightarrow> Q x i) \<Longrightarrow> (\<forall>x. \<exists>i\<in>Basis. Q x i) \<longleftrightarrow> (\<exists>i\<in>Basis. P i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1146 | by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1147 | note * = set_eq_iff Int_iff empty_iff mem_box ball_conj_distrib[symmetric] eq_False ball_simps(10) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1148 | show ?th1 unfolding * by (intro **) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1149 | show ?th2 unfolding * by (intro **) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1150 | show ?th3 unfolding * by (intro **) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1151 | show ?th4 unfolding * by (intro **) auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1152 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1153 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1154 | lemma UN_box_eq_UNIV: "(\<Union>i::nat. box (- (real i *\<^sub>R One)) (real i *\<^sub>R One)) = UNIV" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1155 | proof - | 
| 58757 | 1156 |   {
 | 
| 1157 | fix x b :: 'a | |
| 1158 | assume [simp]: "b \<in> Basis" | |
| 59587 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1159 | have "\<bar>x \<bullet> b\<bar> \<le> real (ceiling \<bar>x \<bullet> b\<bar>)" | 
| 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1160 | by (rule real_of_int_ceiling_ge) | 
| 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1161 | also have "\<dots> \<le> real (ceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)))" | 
| 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1162 | by (auto intro!: ceiling_mono) | 
| 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1163 | also have "\<dots> < real (ceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)) + 1)" | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1164 | by simp | 
| 59587 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1165 | finally have "\<bar>x \<bullet> b\<bar> < real (ceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)) + 1)" . } | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1166 | then have "\<And>x::'a. \<exists>n::nat. \<forall>b\<in>Basis. \<bar>x \<bullet> b\<bar> < real n" | 
| 59587 
8ea7b22525cb
Removed the obsolete functions "natfloor" and "natceiling"
 nipkow parents: 
58877diff
changeset | 1167 | by (metis order.strict_trans reals_Archimedean2) | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1168 | moreover have "\<And>x b::'a. \<And>n::nat. \<bar>x \<bullet> b\<bar> < real n \<longleftrightarrow> - real n < x \<bullet> b \<and> x \<bullet> b < real n" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1169 | by auto | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1170 | ultimately show ?thesis | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1171 | by (auto simp: box_def inner_setsum_left inner_Basis setsum.If_cases) | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1172 | qed | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1173 | |
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1174 | text {* Intervals in general, including infinite and mixtures of open and closed. *}
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1175 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1176 | definition "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1177 | (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i\<in>Basis. ((a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i) \<or> (b\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> a\<bullet>i))) \<longrightarrow> x \<in> s)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1178 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1179 | lemma is_interval_cbox: "is_interval (cbox a (b::'a::euclidean_space))" (is ?th1) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1180 | and is_interval_box: "is_interval (box a b)" (is ?th2) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1181 | unfolding is_interval_def mem_box Ball_def atLeastAtMost_iff | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1182 | by (meson order_trans le_less_trans less_le_trans less_trans)+ | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1183 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1184 | lemma is_interval_empty: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1185 |  "is_interval {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1186 | unfolding is_interval_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1187 | by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1188 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1189 | lemma is_interval_univ: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1190 | "is_interval UNIV" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1191 | unfolding is_interval_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1192 | by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1193 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1194 | lemma mem_is_intervalI: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1195 | assumes "is_interval s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1196 | assumes "a \<in> s" "b \<in> s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1197 | assumes "\<And>i. i \<in> Basis \<Longrightarrow> a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i \<or> b \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> a \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1198 | shows "x \<in> s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1199 | by (rule assms(1)[simplified is_interval_def, rule_format, OF assms(2,3,4)]) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1200 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1201 | lemma interval_subst: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1202 | fixes S::"'a::euclidean_space set" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1203 | assumes "is_interval S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1204 | assumes "x \<in> S" "y j \<in> S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1205 | assumes "j \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1206 | shows "(\<Sum>i\<in>Basis. (if i = j then y i \<bullet> i else x \<bullet> i) *\<^sub>R i) \<in> S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1207 | by (rule mem_is_intervalI[OF assms(1,2)]) (auto simp: assms) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1208 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1209 | lemma mem_box_componentwiseI: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1210 | fixes S::"'a::euclidean_space set" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1211 | assumes "is_interval S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1212 | assumes "\<And>i. i \<in> Basis \<Longrightarrow> x \<bullet> i \<in> ((\<lambda>x. x \<bullet> i) ` S)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1213 | shows "x \<in> S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1214 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1215 | from assms have "\<forall>i \<in> Basis. \<exists>s \<in> S. x \<bullet> i = s \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1216 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1217 | with finite_Basis obtain s and bs::"'a list" where | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1218 | s: "\<And>i. i \<in> Basis \<Longrightarrow> x \<bullet> i = s i \<bullet> i" "\<And>i. i \<in> Basis \<Longrightarrow> s i \<in> S" and | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1219 | bs: "set bs = Basis" "distinct bs" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1220 | by (metis finite_distinct_list) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1221 | from nonempty_Basis s obtain j where j: "j \<in> Basis" "s j \<in> S" by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1222 | def y \<equiv> "rec_list | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1223 | (s j) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1224 | (\<lambda>j _ Y. (\<Sum>i\<in>Basis. (if i = j then s i \<bullet> i else Y \<bullet> i) *\<^sub>R i))" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1225 | have "x = (\<Sum>i\<in>Basis. (if i \<in> set bs then s i \<bullet> i else s j \<bullet> i) *\<^sub>R i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1226 | using bs by (auto simp add: s(1)[symmetric] euclidean_representation) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1227 | also have [symmetric]: "y bs = \<dots>" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1228 | using bs(2) bs(1)[THEN equalityD1] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1229 | by (induct bs) (auto simp: y_def euclidean_representation intro!: euclidean_eqI[where 'a='a]) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1230 | also have "y bs \<in> S" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1231 | using bs(1)[THEN equalityD1] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1232 | apply (induct bs) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1233 | apply (auto simp: y_def j) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1234 | apply (rule interval_subst[OF assms(1)]) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1235 | apply (auto simp: s) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1236 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1237 | finally show ?thesis . | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1238 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 1239 | |
| 33175 | 1240 | |
| 1241 | subsection{* Connectedness *}
 | |
| 1242 | ||
| 1243 | lemma connected_local: | |
| 53255 | 1244 | "connected S \<longleftrightarrow> | 
| 1245 | \<not> (\<exists>e1 e2. | |
| 1246 | openin (subtopology euclidean S) e1 \<and> | |
| 1247 | openin (subtopology euclidean S) e2 \<and> | |
| 1248 | S \<subseteq> e1 \<union> e2 \<and> | |
| 1249 |       e1 \<inter> e2 = {} \<and>
 | |
| 1250 |       e1 \<noteq> {} \<and>
 | |
| 1251 |       e2 \<noteq> {})"
 | |
| 53282 | 1252 | unfolding connected_def openin_open | 
| 59765 
26d1c71784f1
tweaked a few slow or very ugly proofs
 paulson <lp15@cam.ac.uk> parents: 
59587diff
changeset | 1253 | by safe blast+ | 
| 33175 | 1254 | |
| 34105 | 1255 | lemma exists_diff: | 
| 1256 | fixes P :: "'a set \<Rightarrow> bool" | |
| 1257 | shows "(\<exists>S. P(- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs") | |
| 53255 | 1258 | proof - | 
| 1259 |   {
 | |
| 1260 | assume "?lhs" | |
| 1261 | then have ?rhs by blast | |
| 1262 | } | |
| 33175 | 1263 | moreover | 
| 53255 | 1264 |   {
 | 
| 1265 | fix S | |
| 1266 | assume H: "P S" | |
| 34105 | 1267 | have "S = - (- S)" by auto | 
| 53255 | 1268 | with H have "P (- (- S))" by metis | 
| 1269 | } | |
| 33175 | 1270 | ultimately show ?thesis by metis | 
| 1271 | qed | |
| 1272 | ||
| 1273 | lemma connected_clopen: "connected S \<longleftrightarrow> | |
| 53255 | 1274 | (\<forall>T. openin (subtopology euclidean S) T \<and> | 
| 1275 |      closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
 | |
| 1276 | proof - | |
| 1277 | have "\<not> connected S \<longleftrightarrow> | |
| 1278 |     (\<exists>e1 e2. open e1 \<and> open (- e2) \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
 | |
| 33175 | 1279 | unfolding connected_def openin_open closedin_closed | 
| 55775 | 1280 | by (metis double_complement) | 
| 53282 | 1281 | then have th0: "connected S \<longleftrightarrow> | 
| 53255 | 1282 |     \<not> (\<exists>e2 e1. closed e2 \<and> open e1 \<and> S \<subseteq> e1 \<union> (- e2) \<and> e1 \<inter> (- e2) \<inter> S = {} \<and> e1 \<inter> S \<noteq> {} \<and> (- e2) \<inter> S \<noteq> {})"
 | 
| 52624 | 1283 | (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") | 
| 1284 | apply (simp add: closed_def) | |
| 1285 | apply metis | |
| 1286 | done | |
| 33175 | 1287 |   have th1: "?rhs \<longleftrightarrow> \<not> (\<exists>t' t. closed t'\<and>t = S\<inter>t' \<and> t\<noteq>{} \<and> t\<noteq>S \<and> (\<exists>t'. open t' \<and> t = S \<inter> t'))"
 | 
| 1288 | (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)") | |
| 1289 | unfolding connected_def openin_open closedin_closed by auto | |
| 53255 | 1290 |   {
 | 
| 1291 | fix e2 | |
| 1292 |     {
 | |
| 1293 | fix e1 | |
| 53282 | 1294 |       have "?P e2 e1 \<longleftrightarrow> (\<exists>t. closed e2 \<and> t = S\<inter>e2 \<and> open e1 \<and> t = S\<inter>e1 \<and> t\<noteq>{} \<and> t \<noteq> S)"
 | 
| 53255 | 1295 | by auto | 
| 1296 | } | |
| 1297 | then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" | |
| 1298 | by metis | |
| 1299 | } | |
| 1300 | then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" | |
| 1301 | by blast | |
| 1302 | then show ?thesis | |
| 1303 | unfolding th0 th1 by simp | |
| 33175 | 1304 | qed | 
| 1305 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1306 | |
| 33175 | 1307 | subsection{* Limit points *}
 | 
| 1308 | ||
| 53282 | 1309 | definition (in topological_space) islimpt:: "'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "islimpt" 60) | 
| 53255 | 1310 | where "x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))" | 
| 33175 | 1311 | |
| 1312 | lemma islimptI: | |
| 1313 | assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x" | |
| 1314 | shows "x islimpt S" | |
| 1315 | using assms unfolding islimpt_def by auto | |
| 1316 | ||
| 1317 | lemma islimptE: | |
| 1318 | assumes "x islimpt S" and "x \<in> T" and "open T" | |
| 1319 | obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x" | |
| 1320 | using assms unfolding islimpt_def by auto | |
| 1321 | ||
| 44584 | 1322 | lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)" | 
| 1323 | unfolding islimpt_def eventually_at_topological by auto | |
| 1324 | ||
| 53255 | 1325 | lemma islimpt_subset: "x islimpt S \<Longrightarrow> S \<subseteq> T \<Longrightarrow> x islimpt T" | 
| 44584 | 1326 | unfolding islimpt_def by fast | 
| 33175 | 1327 | |
| 1328 | lemma islimpt_approachable: | |
| 1329 | fixes x :: "'a::metric_space" | |
| 1330 | shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)" | |
| 44584 | 1331 | unfolding islimpt_iff_eventually eventually_at by fast | 
| 33175 | 1332 | |
| 1333 | lemma islimpt_approachable_le: | |
| 1334 | fixes x :: "'a::metric_space" | |
| 53640 | 1335 | shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x \<le> e)" | 
| 33175 | 1336 | unfolding islimpt_approachable | 
| 44584 | 1337 | using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x", | 
| 1338 | THEN arg_cong [where f=Not]] | |
| 1339 | by (simp add: Bex_def conj_commute conj_left_commute) | |
| 33175 | 1340 | |
| 44571 | 1341 | lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
 | 
| 1342 |   unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
 | |
| 1343 | ||
| 51351 | 1344 | lemma islimpt_punctured: "x islimpt S = x islimpt (S-{x})"
 | 
| 1345 | unfolding islimpt_def by blast | |
| 1346 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1347 | text {* A perfect space has no isolated points. *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1348 | |
| 44571 | 1349 | lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV" | 
| 1350 | unfolding islimpt_UNIV_iff by (rule not_open_singleton) | |
| 33175 | 1351 | |
| 1352 | lemma perfect_choose_dist: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1353 |   fixes x :: "'a::{perfect_space, metric_space}"
 | 
| 33175 | 1354 | shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r" | 
| 53255 | 1355 | using islimpt_UNIV [of x] | 
| 1356 | by (simp add: islimpt_approachable) | |
| 33175 | 1357 | |
| 1358 | lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)" | |
| 1359 | unfolding closed_def | |
| 1360 | apply (subst open_subopen) | |
| 34105 | 1361 | apply (simp add: islimpt_def subset_eq) | 
| 52624 | 1362 | apply (metis ComplE ComplI) | 
| 1363 | done | |
| 33175 | 1364 | |
| 1365 | lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
 | |
| 1366 | unfolding islimpt_def by auto | |
| 1367 | ||
| 1368 | lemma finite_set_avoid: | |
| 1369 | fixes a :: "'a::metric_space" | |
| 53255 | 1370 | assumes fS: "finite S" | 
| 53640 | 1371 | shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d \<le> dist a x" | 
| 53255 | 1372 | proof (induct rule: finite_induct[OF fS]) | 
| 1373 | case 1 | |
| 1374 | then show ?case by (auto intro: zero_less_one) | |
| 33175 | 1375 | next | 
| 1376 | case (2 x F) | |
| 53255 | 1377 | from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" | 
| 1378 | by blast | |
| 1379 | show ?case | |
| 1380 | proof (cases "x = a") | |
| 1381 | case True | |
| 1382 | then show ?thesis using d by auto | |
| 1383 | next | |
| 1384 | case False | |
| 33175 | 1385 | let ?d = "min d (dist a x)" | 
| 53255 | 1386 | have dp: "?d > 0" | 
| 1387 | using False d(1) using dist_nz by auto | |
| 1388 | from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" | |
| 1389 | by auto | |
| 1390 | with dp False show ?thesis | |
| 1391 | by (auto intro!: exI[where x="?d"]) | |
| 1392 | qed | |
| 33175 | 1393 | qed | 
| 1394 | ||
| 1395 | lemma islimpt_Un: "x islimpt (S \<union> T) \<longleftrightarrow> x islimpt S \<or> x islimpt T" | |
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 1396 | by (simp add: islimpt_iff_eventually eventually_conj_iff) | 
| 33175 | 1397 | |
| 1398 | lemma discrete_imp_closed: | |
| 1399 | fixes S :: "'a::metric_space set" | |
| 53255 | 1400 | assumes e: "0 < e" | 
| 1401 | and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x" | |
| 33175 | 1402 | shows "closed S" | 
| 53255 | 1403 | proof - | 
| 1404 |   {
 | |
| 1405 | fix x | |
| 1406 | assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e" | |
| 33175 | 1407 | from e have e2: "e/2 > 0" by arith | 
| 53282 | 1408 | from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y \<noteq> x" "dist y x < e/2" | 
| 53255 | 1409 | by blast | 
| 33175 | 1410 | let ?m = "min (e/2) (dist x y) " | 
| 53255 | 1411 | from e2 y(2) have mp: "?m > 0" | 
| 53291 | 1412 | by (simp add: dist_nz[symmetric]) | 
| 53282 | 1413 | from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z \<noteq> x" "dist z x < ?m" | 
| 53255 | 1414 | by blast | 
| 33175 | 1415 | have th: "dist z y < e" using z y | 
| 1416 | by (intro dist_triangle_lt [where z=x], simp) | |
| 1417 | from d[rule_format, OF y(1) z(1) th] y z | |
| 1418 | have False by (auto simp add: dist_commute)} | |
| 53255 | 1419 | then show ?thesis | 
| 1420 | by (metis islimpt_approachable closed_limpt [where 'a='a]) | |
| 33175 | 1421 | qed | 
| 1422 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1423 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1424 | subsection {* Interior of a Set *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1425 | |
| 44519 | 1426 | definition "interior S = \<Union>{T. open T \<and> T \<subseteq> S}"
 | 
| 1427 | ||
| 1428 | lemma interiorI [intro?]: | |
| 1429 | assumes "open T" and "x \<in> T" and "T \<subseteq> S" | |
| 1430 | shows "x \<in> interior S" | |
| 1431 | using assms unfolding interior_def by fast | |
| 1432 | ||
| 1433 | lemma interiorE [elim?]: | |
| 1434 | assumes "x \<in> interior S" | |
| 1435 | obtains T where "open T" and "x \<in> T" and "T \<subseteq> S" | |
| 1436 | using assms unfolding interior_def by fast | |
| 1437 | ||
| 1438 | lemma open_interior [simp, intro]: "open (interior S)" | |
| 1439 | by (simp add: interior_def open_Union) | |
| 1440 | ||
| 1441 | lemma interior_subset: "interior S \<subseteq> S" | |
| 1442 | by (auto simp add: interior_def) | |
| 1443 | ||
| 1444 | lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> interior S" | |
| 1445 | by (auto simp add: interior_def) | |
| 1446 | ||
| 1447 | lemma interior_open: "open S \<Longrightarrow> interior S = S" | |
| 1448 | by (intro equalityI interior_subset interior_maximal subset_refl) | |
| 33175 | 1449 | |
| 1450 | lemma interior_eq: "interior S = S \<longleftrightarrow> open S" | |
| 44519 | 1451 | by (metis open_interior interior_open) | 
| 1452 | ||
| 1453 | lemma open_subset_interior: "open S \<Longrightarrow> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T" | |
| 33175 | 1454 | by (metis interior_maximal interior_subset subset_trans) | 
| 1455 | ||
| 44519 | 1456 | lemma interior_empty [simp]: "interior {} = {}"
 | 
| 1457 | using open_empty by (rule interior_open) | |
| 1458 | ||
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1459 | lemma interior_UNIV [simp]: "interior UNIV = UNIV" | 
| 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1460 | using open_UNIV by (rule interior_open) | 
| 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1461 | |
| 44519 | 1462 | lemma interior_interior [simp]: "interior (interior S) = interior S" | 
| 1463 | using open_interior by (rule interior_open) | |
| 1464 | ||
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1465 | lemma interior_mono: "S \<subseteq> T \<Longrightarrow> interior S \<subseteq> interior T" | 
| 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1466 | by (auto simp add: interior_def) | 
| 44519 | 1467 | |
| 1468 | lemma interior_unique: | |
| 1469 | assumes "T \<subseteq> S" and "open T" | |
| 1470 | assumes "\<And>T'. T' \<subseteq> S \<Longrightarrow> open T' \<Longrightarrow> T' \<subseteq> T" | |
| 1471 | shows "interior S = T" | |
| 1472 | by (intro equalityI assms interior_subset open_interior interior_maximal) | |
| 1473 | ||
| 1474 | lemma interior_inter [simp]: "interior (S \<inter> T) = interior S \<inter> interior T" | |
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1475 | by (intro equalityI Int_mono Int_greatest interior_mono Int_lower1 | 
| 44519 | 1476 | Int_lower2 interior_maximal interior_subset open_Int open_interior) | 
| 1477 | ||
| 1478 | lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | |
| 1479 | using open_contains_ball_eq [where S="interior S"] | |
| 1480 | by (simp add: open_subset_interior) | |
| 33175 | 1481 | |
| 1482 | lemma interior_limit_point [intro]: | |
| 1483 | fixes x :: "'a::perfect_space" | |
| 53255 | 1484 | assumes x: "x \<in> interior S" | 
| 1485 | shows "x islimpt S" | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1486 | using x islimpt_UNIV [of x] | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1487 | unfolding interior_def islimpt_def | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1488 | apply (clarsimp, rename_tac T T') | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1489 | apply (drule_tac x="T \<inter> T'" in spec) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1490 | apply (auto simp add: open_Int) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1491 | done | 
| 33175 | 1492 | |
| 1493 | lemma interior_closed_Un_empty_interior: | |
| 53255 | 1494 | assumes cS: "closed S" | 
| 1495 |     and iT: "interior T = {}"
 | |
| 44519 | 1496 | shows "interior (S \<union> T) = interior S" | 
| 33175 | 1497 | proof | 
| 44519 | 1498 | show "interior S \<subseteq> interior (S \<union> T)" | 
| 53255 | 1499 | by (rule interior_mono) (rule Un_upper1) | 
| 33175 | 1500 | show "interior (S \<union> T) \<subseteq> interior S" | 
| 1501 | proof | |
| 53255 | 1502 | fix x | 
| 1503 | assume "x \<in> interior (S \<union> T)" | |
| 44519 | 1504 | then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" .. | 
| 33175 | 1505 | show "x \<in> interior S" | 
| 1506 | proof (rule ccontr) | |
| 1507 | assume "x \<notin> interior S" | |
| 1508 | with `x \<in> R` `open R` obtain y where "y \<in> R - S" | |
| 44519 | 1509 | unfolding interior_def by fast | 
| 53282 | 1510 | from `open R` `closed S` have "open (R - S)" | 
| 1511 | by (rule open_Diff) | |
| 1512 | from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" | |
| 1513 | by fast | |
| 1514 |       from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}` show False
 | |
| 1515 | unfolding interior_def by fast | |
| 33175 | 1516 | qed | 
| 1517 | qed | |
| 1518 | qed | |
| 1519 | ||
| 44365 | 1520 | lemma interior_Times: "interior (A \<times> B) = interior A \<times> interior B" | 
| 1521 | proof (rule interior_unique) | |
| 1522 | show "interior A \<times> interior B \<subseteq> A \<times> B" | |
| 1523 | by (intro Sigma_mono interior_subset) | |
| 1524 | show "open (interior A \<times> interior B)" | |
| 1525 | by (intro open_Times open_interior) | |
| 53255 | 1526 | fix T | 
| 1527 | assume "T \<subseteq> A \<times> B" and "open T" | |
| 1528 | then show "T \<subseteq> interior A \<times> interior B" | |
| 53282 | 1529 | proof safe | 
| 53255 | 1530 | fix x y | 
| 1531 | assume "(x, y) \<in> T" | |
| 44519 | 1532 | then obtain C D where "open C" "open D" "C \<times> D \<subseteq> T" "x \<in> C" "y \<in> D" | 
| 1533 | using `open T` unfolding open_prod_def by fast | |
| 53255 | 1534 | then have "open C" "open D" "C \<subseteq> A" "D \<subseteq> B" "x \<in> C" "y \<in> D" | 
| 44519 | 1535 | using `T \<subseteq> A \<times> B` by auto | 
| 53255 | 1536 | then show "x \<in> interior A" and "y \<in> interior B" | 
| 44519 | 1537 | by (auto intro: interiorI) | 
| 1538 | qed | |
| 44365 | 1539 | qed | 
| 1540 | ||
| 33175 | 1541 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1542 | subsection {* Closure of a Set *}
 | 
| 33175 | 1543 | |
| 1544 | definition "closure S = S \<union> {x | x. x islimpt S}"
 | |
| 1545 | ||
| 44518 | 1546 | lemma interior_closure: "interior S = - (closure (- S))" | 
| 1547 | unfolding interior_def closure_def islimpt_def by auto | |
| 1548 | ||
| 34105 | 1549 | lemma closure_interior: "closure S = - interior (- S)" | 
| 44518 | 1550 | unfolding interior_closure by simp | 
| 33175 | 1551 | |
| 1552 | lemma closed_closure[simp, intro]: "closed (closure S)" | |
| 44518 | 1553 | unfolding closure_interior by (simp add: closed_Compl) | 
| 1554 | ||
| 1555 | lemma closure_subset: "S \<subseteq> closure S" | |
| 1556 | unfolding closure_def by simp | |
| 33175 | 1557 | |
| 1558 | lemma closure_hull: "closure S = closed hull S" | |
| 44519 | 1559 | unfolding hull_def closure_interior interior_def by auto | 
| 33175 | 1560 | |
| 1561 | lemma closure_eq: "closure S = S \<longleftrightarrow> closed S" | |
| 44519 | 1562 | unfolding closure_hull using closed_Inter by (rule hull_eq) | 
| 1563 | ||
| 1564 | lemma closure_closed [simp]: "closed S \<Longrightarrow> closure S = S" | |
| 1565 | unfolding closure_eq . | |
| 1566 | ||
| 1567 | lemma closure_closure [simp]: "closure (closure S) = closure S" | |
| 44518 | 1568 | unfolding closure_hull by (rule hull_hull) | 
| 33175 | 1569 | |
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1570 | lemma closure_mono: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T" | 
| 44518 | 1571 | unfolding closure_hull by (rule hull_mono) | 
| 33175 | 1572 | |
| 44519 | 1573 | lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T" | 
| 44518 | 1574 | unfolding closure_hull by (rule hull_minimal) | 
| 33175 | 1575 | |
| 44519 | 1576 | lemma closure_unique: | 
| 53255 | 1577 | assumes "S \<subseteq> T" | 
| 1578 | and "closed T" | |
| 1579 | and "\<And>T'. S \<subseteq> T' \<Longrightarrow> closed T' \<Longrightarrow> T \<subseteq> T'" | |
| 44519 | 1580 | shows "closure S = T" | 
| 1581 | using assms unfolding closure_hull by (rule hull_unique) | |
| 1582 | ||
| 1583 | lemma closure_empty [simp]: "closure {} = {}"
 | |
| 44518 | 1584 | using closed_empty by (rule closure_closed) | 
| 33175 | 1585 | |
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1586 | lemma closure_UNIV [simp]: "closure UNIV = UNIV" | 
| 44518 | 1587 | using closed_UNIV by (rule closure_closed) | 
| 1588 | ||
| 1589 | lemma closure_union [simp]: "closure (S \<union> T) = closure S \<union> closure T" | |
| 1590 | unfolding closure_interior by simp | |
| 33175 | 1591 | |
| 1592 | lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
 | |
| 1593 | using closure_empty closure_subset[of S] | |
| 1594 | by blast | |
| 1595 | ||
| 1596 | lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S" | |
| 1597 | using closure_eq[of S] closure_subset[of S] | |
| 1598 | by simp | |
| 1599 | ||
| 1600 | lemma open_inter_closure_eq_empty: | |
| 1601 |   "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
 | |
| 34105 | 1602 | using open_subset_interior[of S "- T"] | 
| 1603 | using interior_subset[of "- T"] | |
| 33175 | 1604 | unfolding closure_interior | 
| 1605 | by auto | |
| 1606 | ||
| 1607 | lemma open_inter_closure_subset: | |
| 1608 | "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)" | |
| 1609 | proof | |
| 1610 | fix x | |
| 1611 | assume as: "open S" "x \<in> S \<inter> closure T" | |
| 53255 | 1612 |   {
 | 
| 53282 | 1613 | assume *: "x islimpt T" | 
| 33175 | 1614 | have "x islimpt (S \<inter> T)" | 
| 1615 | proof (rule islimptI) | |
| 1616 | fix A | |
| 1617 | assume "x \<in> A" "open A" | |
| 1618 | with as have "x \<in> A \<inter> S" "open (A \<inter> S)" | |
| 1619 | by (simp_all add: open_Int) | |
| 1620 | with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x" | |
| 1621 | by (rule islimptE) | |
| 53255 | 1622 | then have "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x" | 
| 33175 | 1623 | by simp_all | 
| 53255 | 1624 | then show "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" .. | 
| 33175 | 1625 | qed | 
| 1626 | } | |
| 1627 | then show "x \<in> closure (S \<inter> T)" using as | |
| 1628 | unfolding closure_def | |
| 1629 | by blast | |
| 1630 | qed | |
| 1631 | ||
| 44519 | 1632 | lemma closure_complement: "closure (- S) = - interior S" | 
| 44518 | 1633 | unfolding closure_interior by simp | 
| 33175 | 1634 | |
| 44519 | 1635 | lemma interior_complement: "interior (- S) = - closure S" | 
| 44518 | 1636 | unfolding closure_interior by simp | 
| 33175 | 1637 | |
| 44365 | 1638 | lemma closure_Times: "closure (A \<times> B) = closure A \<times> closure B" | 
| 44519 | 1639 | proof (rule closure_unique) | 
| 44365 | 1640 | show "A \<times> B \<subseteq> closure A \<times> closure B" | 
| 1641 | by (intro Sigma_mono closure_subset) | |
| 1642 | show "closed (closure A \<times> closure B)" | |
| 1643 | by (intro closed_Times closed_closure) | |
| 53282 | 1644 | fix T | 
| 1645 | assume "A \<times> B \<subseteq> T" and "closed T" | |
| 1646 | then show "closure A \<times> closure B \<subseteq> T" | |
| 44365 | 1647 | apply (simp add: closed_def open_prod_def, clarify) | 
| 1648 | apply (rule ccontr) | |
| 1649 | apply (drule_tac x="(a, b)" in bspec, simp, clarify, rename_tac C D) | |
| 1650 | apply (simp add: closure_interior interior_def) | |
| 1651 | apply (drule_tac x=C in spec) | |
| 1652 | apply (drule_tac x=D in spec) | |
| 1653 | apply auto | |
| 1654 | done | |
| 1655 | qed | |
| 1656 | ||
| 51351 | 1657 | lemma islimpt_in_closure: "(x islimpt S) = (x:closure(S-{x}))"
 | 
| 1658 | unfolding closure_def using islimpt_punctured by blast | |
| 1659 | ||
| 1660 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1661 | subsection {* Frontier (aka boundary) *}
 | 
| 33175 | 1662 | |
| 1663 | definition "frontier S = closure S - interior S" | |
| 1664 | ||
| 53255 | 1665 | lemma frontier_closed: "closed (frontier S)" | 
| 33175 | 1666 | by (simp add: frontier_def closed_Diff) | 
| 1667 | ||
| 34105 | 1668 | lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))" | 
| 33175 | 1669 | by (auto simp add: frontier_def interior_closure) | 
| 1670 | ||
| 1671 | lemma frontier_straddle: | |
| 1672 | fixes a :: "'a::metric_space" | |
| 44909 | 1673 | 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))" | 
| 1674 | unfolding frontier_def closure_interior | |
| 1675 | by (auto simp add: mem_interior subset_eq ball_def) | |
| 33175 | 1676 | |
| 1677 | lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S" | |
| 1678 | by (metis frontier_def closure_closed Diff_subset) | |
| 1679 | ||
| 34964 | 1680 | lemma frontier_empty[simp]: "frontier {} = {}"
 | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 1681 | by (simp add: frontier_def) | 
| 33175 | 1682 | |
| 1683 | lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S" | |
| 58757 | 1684 | proof - | 
| 53255 | 1685 |   {
 | 
| 1686 | assume "frontier S \<subseteq> S" | |
| 1687 | then have "closure S \<subseteq> S" | |
| 1688 | using interior_subset unfolding frontier_def by auto | |
| 1689 | then have "closed S" | |
| 1690 | using closure_subset_eq by auto | |
| 33175 | 1691 | } | 
| 53255 | 1692 | then show ?thesis using frontier_subset_closed[of S] .. | 
| 33175 | 1693 | qed | 
| 1694 | ||
| 58757 | 1695 | lemma frontier_complement: "frontier (- S) = frontier S" | 
| 33175 | 1696 | by (auto simp add: frontier_def closure_complement interior_complement) | 
| 1697 | ||
| 1698 | lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
 | |
| 34105 | 1699 | using frontier_complement frontier_subset_eq[of "- S"] | 
| 1700 | unfolding open_closed by auto | |
| 33175 | 1701 | |
| 58757 | 1702 | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1703 | subsection {* Filters and the ``eventually true'' quantifier *}
 | 
| 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1704 | |
| 52624 | 1705 | definition indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter" | 
| 1706 | (infixr "indirection" 70) | |
| 1707 |   where "a indirection v = at a within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
 | |
| 33175 | 1708 | |
| 36437 | 1709 | text {* Identify Trivial limits, where we can't approach arbitrarily closely. *}
 | 
| 33175 | 1710 | |
| 52624 | 1711 | lemma trivial_limit_within: "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S" | 
| 33175 | 1712 | proof | 
| 1713 | assume "trivial_limit (at a within S)" | |
| 53255 | 1714 | then show "\<not> a islimpt S" | 
| 33175 | 1715 | unfolding trivial_limit_def | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1716 | unfolding eventually_at_topological | 
| 33175 | 1717 | unfolding islimpt_def | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 1718 | apply (clarsimp simp add: set_eq_iff) | 
| 33175 | 1719 | apply (rename_tac T, rule_tac x=T in exI) | 
| 36358 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1720 | apply (clarsimp, drule_tac x=y in bspec, simp_all) | 
| 33175 | 1721 | done | 
| 1722 | next | |
| 1723 | assume "\<not> a islimpt S" | |
| 53255 | 1724 | then show "trivial_limit (at a within S)" | 
| 55775 | 1725 | unfolding trivial_limit_def eventually_at_topological islimpt_def | 
| 1726 | by metis | |
| 33175 | 1727 | qed | 
| 1728 | ||
| 1729 | lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV" | |
| 45031 | 1730 | using trivial_limit_within [of a UNIV] by simp | 
| 33175 | 1731 | |
| 1732 | lemma trivial_limit_at: | |
| 1733 | fixes a :: "'a::perfect_space" | |
| 1734 | shows "\<not> trivial_limit (at a)" | |
| 44571 | 1735 | by (rule at_neq_bot) | 
| 33175 | 1736 | |
| 1737 | lemma trivial_limit_at_infinity: | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1738 |   "\<not> trivial_limit (at_infinity :: ('a::{real_normed_vector,perfect_space}) filter)"
 | 
| 36358 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1739 | unfolding trivial_limit_def eventually_at_infinity | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1740 | apply clarsimp | 
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1741 | apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1742 | apply (rule_tac x="scaleR (b / norm x) x" in exI, simp) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1743 | apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def]) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1744 | apply (drule_tac x=UNIV in spec, simp) | 
| 33175 | 1745 | done | 
| 1746 | ||
| 53640 | 1747 | lemma not_trivial_limit_within: "\<not> trivial_limit (at x within S) = (x \<in> closure (S - {x}))"
 | 
| 1748 | using islimpt_in_closure | |
| 1749 | by (metis trivial_limit_within) | |
| 51351 | 1750 | |
| 36437 | 1751 | text {* Some property holds "sufficiently close" to the limit point. *}
 | 
| 33175 | 1752 | |
| 51530 
609914f0934a
rename eventually_at / _within, to distinguish them from the lemmas in the HOL image
 hoelzl parents: 
51518diff
changeset | 1753 | lemma eventually_at2: | 
| 33175 | 1754 | "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)" | 
| 53255 | 1755 | unfolding eventually_at dist_nz by auto | 
| 1756 | ||
| 1757 | lemma eventually_happens: "eventually P net \<Longrightarrow> trivial_limit net \<or> (\<exists>x. P x)" | |
| 36358 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1758 | unfolding trivial_limit_def | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1759 | by (auto elim: eventually_rev_mp) | 
| 33175 | 1760 | |
| 1761 | lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net" | |
| 45031 | 1762 | by simp | 
| 33175 | 1763 | |
| 1764 | lemma trivial_limit_eq: "trivial_limit net \<longleftrightarrow> (\<forall>P. eventually P net)" | |
| 44342 
8321948340ea
redefine constant 'trivial_limit' as an abbreviation
 huffman parents: 
44286diff
changeset | 1765 | by (simp add: filter_eq_iff) | 
| 33175 | 1766 | |
| 1767 | text{* Combining theorems for "eventually" *}
 | |
| 1768 | ||
| 1769 | lemma eventually_rev_mono: | |
| 1770 | "eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net" | |
| 53255 | 1771 | using eventually_mono [of P Q] by fast | 
| 33175 | 1772 | |
| 53282 | 1773 | lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> \<not> trivial_limit net \<Longrightarrow> \<not> eventually (\<lambda>x. P x) net" | 
| 33175 | 1774 | by (simp add: eventually_False) | 
| 1775 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1776 | |
| 36437 | 1777 | subsection {* Limits *}
 | 
| 33175 | 1778 | |
| 1779 | lemma Lim: | |
| 53255 | 1780 | "(f ---> l) net \<longleftrightarrow> | 
| 33175 | 1781 | trivial_limit net \<or> | 
| 1782 | (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)" | |
| 1783 | unfolding tendsto_iff trivial_limit_eq by auto | |
| 1784 | ||
| 1785 | text{* Show that they yield usual definitions in the various cases. *}
 | |
| 1786 | ||
| 1787 | lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow> | |
| 53640 | 1788 | (\<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)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1789 | by (auto simp add: tendsto_iff eventually_at_le dist_nz) | 
| 33175 | 1790 | |
| 1791 | lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow> | |
| 53640 | 1792 | (\<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)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1793 | by (auto simp add: tendsto_iff eventually_at dist_nz) | 
| 33175 | 1794 | |
| 1795 | lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow> | |
| 53640 | 1796 | (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> dist (f x) l < e)" | 
| 51530 
609914f0934a
rename eventually_at / _within, to distinguish them from the lemmas in the HOL image
 hoelzl parents: 
51518diff
changeset | 1797 | by (auto simp add: tendsto_iff eventually_at2) | 
| 33175 | 1798 | |
| 1799 | lemma Lim_at_infinity: | |
| 53640 | 1800 | "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x \<ge> b \<longrightarrow> dist (f x) l < e)" | 
| 33175 | 1801 | by (auto simp add: tendsto_iff eventually_at_infinity) | 
| 1802 | ||
| 1803 | lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net" | |
| 1804 | by (rule topological_tendstoI, auto elim: eventually_rev_mono) | |
| 1805 | ||
| 1806 | text{* The expected monotonicity property. *}
 | |
| 1807 | ||
| 53255 | 1808 | lemma Lim_Un: | 
| 1809 | assumes "(f ---> l) (at x within S)" "(f ---> l) (at x within T)" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1810 | shows "(f ---> l) (at x within (S \<union> T))" | 
| 53860 | 1811 | using assms unfolding at_within_union by (rule filterlim_sup) | 
| 33175 | 1812 | |
| 1813 | lemma Lim_Un_univ: | |
| 53282 | 1814 | "(f ---> l) (at x within S) \<Longrightarrow> (f ---> l) (at x within T) \<Longrightarrow> | 
| 53255 | 1815 | S \<union> T = UNIV \<Longrightarrow> (f ---> l) (at x)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1816 | by (metis Lim_Un) | 
| 33175 | 1817 | |
| 1818 | text{* Interrelations between restricted and unrestricted limits. *}
 | |
| 1819 | ||
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1820 | lemma Lim_at_within: (* FIXME: rename *) | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1821 | "(f ---> l) (at x) \<Longrightarrow> (f ---> l) (at x within S)" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1822 | by (metis order_refl filterlim_mono subset_UNIV at_le) | 
| 33175 | 1823 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1824 | lemma eventually_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1825 | assumes "x \<in> interior S" | 
| 53255 | 1826 | shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" | 
| 1827 | (is "?lhs = ?rhs") | |
| 1828 | proof | |
| 44519 | 1829 | from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" .. | 
| 53255 | 1830 |   {
 | 
| 1831 | assume "?lhs" | |
| 53640 | 1832 | then obtain A where "open A" and "x \<in> A" and "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1833 | unfolding eventually_at_topological | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1834 | by auto | 
| 53640 | 1835 | with T have "open (A \<inter> T)" and "x \<in> A \<inter> T" and "\<forall>y \<in> A \<inter> T. y \<noteq> x \<longrightarrow> P y" | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1836 | by auto | 
| 53255 | 1837 | then show "?rhs" | 
| 51471 | 1838 | unfolding eventually_at_topological by auto | 
| 53255 | 1839 | next | 
| 1840 | assume "?rhs" | |
| 1841 | then show "?lhs" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1842 | by (auto elim: eventually_elim1 simp: eventually_at_filter) | 
| 52624 | 1843 | } | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1844 | qed | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1845 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1846 | lemma at_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1847 | "x \<in> interior S \<Longrightarrow> at x within S = at x" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1848 | unfolding filter_eq_iff by (intro allI eventually_within_interior) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1849 | |
| 43338 | 1850 | lemma Lim_within_LIMSEQ: | 
| 53862 | 1851 | fixes a :: "'a::first_countable_topology" | 
| 43338 | 1852 | assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" | 
| 1853 | shows "(X ---> L) (at a within T)" | |
| 44584 | 1854 | using assms unfolding tendsto_def [where l=L] | 
| 1855 | by (simp add: sequentially_imp_eventually_within) | |
| 43338 | 1856 | |
| 1857 | lemma Lim_right_bound: | |
| 51773 | 1858 |   fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder, no_top} \<Rightarrow>
 | 
| 1859 |     'b::{linorder_topology, conditionally_complete_linorder}"
 | |
| 43338 | 1860 | assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b" | 
| 53255 | 1861 | and bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a" | 
| 43338 | 1862 |   shows "(f ---> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
 | 
| 53640 | 1863 | proof (cases "{x<..} \<inter> I = {}")
 | 
| 1864 | case True | |
| 53859 | 1865 | then show ?thesis by simp | 
| 43338 | 1866 | next | 
| 53640 | 1867 | case False | 
| 43338 | 1868 | show ?thesis | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1869 | proof (rule order_tendstoI) | 
| 53282 | 1870 | fix a | 
| 1871 |     assume a: "a < Inf (f ` ({x<..} \<inter> I))"
 | |
| 53255 | 1872 |     {
 | 
| 1873 | fix y | |
| 1874 |       assume "y \<in> {x<..} \<inter> I"
 | |
| 53640 | 1875 |       with False bnd have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
 | 
| 56166 | 1876 | by (auto intro!: cInf_lower bdd_belowI2 simp del: Inf_image_eq) | 
| 53255 | 1877 | with a have "a < f y" | 
| 1878 | by (blast intro: less_le_trans) | |
| 1879 | } | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1880 |     then show "eventually (\<lambda>x. a < f x) (at x within ({x<..} \<inter> I))"
 | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1881 | by (auto simp: eventually_at_filter intro: exI[of _ 1] zero_less_one) | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1882 | next | 
| 53255 | 1883 | fix a | 
| 1884 |     assume "Inf (f ` ({x<..} \<inter> I)) < a"
 | |
| 53640 | 1885 | from cInf_lessD[OF _ this] False obtain y where y: "x < y" "y \<in> I" "f y < a" | 
| 53255 | 1886 | by auto | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1887 | then have "eventually (\<lambda>x. x \<in> I \<longrightarrow> f x < a) (at_right x)" | 
| 57275 
0ddb5b755cdc
moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
 hoelzl parents: 
56742diff
changeset | 1888 | unfolding eventually_at_right[OF `x < y`] by (metis less_imp_le le_less_trans mono) | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1889 |     then show "eventually (\<lambda>x. f x < a) (at x within ({x<..} \<inter> I))"
 | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1890 | unfolding eventually_at_filter by eventually_elim simp | 
| 43338 | 1891 | qed | 
| 1892 | qed | |
| 1893 | ||
| 33175 | 1894 | text{* Another limit point characterization. *}
 | 
| 1895 | ||
| 1896 | lemma islimpt_sequential: | |
| 50883 | 1897 | fixes x :: "'a::first_countable_topology" | 
| 1898 |   shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S - {x}) \<and> (f ---> x) sequentially)"
 | |
| 33175 | 1899 | (is "?lhs = ?rhs") | 
| 1900 | proof | |
| 1901 | assume ?lhs | |
| 55522 | 1902 | from countable_basis_at_decseq[of x] obtain A where A: | 
| 1903 | "\<And>i. open (A i)" | |
| 1904 | "\<And>i. x \<in> A i" | |
| 1905 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 1906 | by blast | |
| 50883 | 1907 | def f \<equiv> "\<lambda>n. SOME y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y" | 
| 53255 | 1908 |   {
 | 
| 1909 | fix n | |
| 50883 | 1910 | from `?lhs` have "\<exists>y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y" | 
| 1911 | unfolding islimpt_def using A(1,2)[of n] by auto | |
| 1912 | then have "f n \<in> S \<and> f n \<in> A n \<and> x \<noteq> f n" | |
| 1913 | unfolding f_def by (rule someI_ex) | |
| 53255 | 1914 | then have "f n \<in> S" "f n \<in> A n" "x \<noteq> f n" by auto | 
| 1915 | } | |
| 50883 | 1916 |   then have "\<forall>n. f n \<in> S - {x}" by auto
 | 
| 1917 | moreover have "(\<lambda>n. f n) ----> x" | |
| 1918 | proof (rule topological_tendstoI) | |
| 53255 | 1919 | fix S | 
| 1920 | assume "open S" "x \<in> S" | |
| 50883 | 1921 | from A(3)[OF this] `\<And>n. f n \<in> A n` | 
| 53255 | 1922 | show "eventually (\<lambda>x. f x \<in> S) sequentially" | 
| 1923 | by (auto elim!: eventually_elim1) | |
| 44584 | 1924 | qed | 
| 1925 | ultimately show ?rhs by fast | |
| 33175 | 1926 | next | 
| 1927 | assume ?rhs | |
| 53255 | 1928 |   then obtain f :: "nat \<Rightarrow> 'a" where f: "\<And>n. f n \<in> S - {x}" and lim: "f ----> x"
 | 
| 1929 | by auto | |
| 50883 | 1930 | show ?lhs | 
| 1931 | unfolding islimpt_def | |
| 1932 | proof safe | |
| 53255 | 1933 | fix T | 
| 1934 | assume "open T" "x \<in> T" | |
| 50883 | 1935 | from lim[THEN topological_tendstoD, OF this] f | 
| 1936 | show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> x" | |
| 1937 | unfolding eventually_sequentially by auto | |
| 1938 | qed | |
| 33175 | 1939 | qed | 
| 1940 | ||
| 1941 | lemma Lim_null: | |
| 1942 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 44125 | 1943 | shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net" | 
| 33175 | 1944 | by (simp add: Lim dist_norm) | 
| 1945 | ||
| 1946 | lemma Lim_null_comparison: | |
| 1947 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1948 | assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net" | |
| 1949 | shows "(f ---> 0) net" | |
| 53282 | 1950 | using assms(2) | 
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1951 | proof (rule metric_tendsto_imp_tendsto) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1952 | show "eventually (\<lambda>x. dist (f x) 0 \<le> dist (g x) 0) net" | 
| 53255 | 1953 | using assms(1) by (rule eventually_elim1) (simp add: dist_norm) | 
| 33175 | 1954 | qed | 
| 1955 | ||
| 1956 | lemma Lim_transform_bound: | |
| 1957 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 53255 | 1958 | and g :: "'a \<Rightarrow> 'c::real_normed_vector" | 
| 53640 | 1959 | assumes "eventually (\<lambda>n. norm (f n) \<le> norm (g n)) net" | 
| 53255 | 1960 | and "(g ---> 0) net" | 
| 33175 | 1961 | shows "(f ---> 0) net" | 
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1962 | using assms(1) tendsto_norm_zero [OF assms(2)] | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1963 | by (rule Lim_null_comparison) | 
| 33175 | 1964 | |
| 1965 | text{* Deducing things about the limit from the elements. *}
 | |
| 1966 | ||
| 1967 | lemma Lim_in_closed_set: | |
| 53255 | 1968 | assumes "closed S" | 
| 1969 | and "eventually (\<lambda>x. f(x) \<in> S) net" | |
| 53640 | 1970 | and "\<not> trivial_limit net" "(f ---> l) net" | 
| 33175 | 1971 | shows "l \<in> S" | 
| 1972 | proof (rule ccontr) | |
| 1973 | assume "l \<notin> S" | |
| 1974 | with `closed S` have "open (- S)" "l \<in> - S" | |
| 1975 | by (simp_all add: open_Compl) | |
| 1976 | with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net" | |
| 1977 | by (rule topological_tendstoD) | |
| 1978 | with assms(2) have "eventually (\<lambda>x. False) net" | |
| 1979 | by (rule eventually_elim2) simp | |
| 1980 | with assms(3) show "False" | |
| 1981 | by (simp add: eventually_False) | |
| 1982 | qed | |
| 1983 | ||
| 1984 | text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *}
 | |
| 1985 | ||
| 1986 | lemma Lim_dist_ubound: | |
| 53255 | 1987 | assumes "\<not>(trivial_limit net)" | 
| 1988 | and "(f ---> l) net" | |
| 53640 | 1989 | and "eventually (\<lambda>x. dist a (f x) \<le> e) net" | 
| 1990 | shows "dist a l \<le> e" | |
| 56290 | 1991 | using assms by (fast intro: tendsto_le tendsto_intros) | 
| 33175 | 1992 | |
| 1993 | lemma Lim_norm_ubound: | |
| 1994 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 53255 | 1995 | assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) \<le> e) net" | 
| 1996 | shows "norm(l) \<le> e" | |
| 56290 | 1997 | using assms by (fast intro: tendsto_le tendsto_intros) | 
| 33175 | 1998 | |
| 1999 | lemma Lim_norm_lbound: | |
| 2000 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 53640 | 2001 | assumes "\<not> trivial_limit net" | 
| 2002 | and "(f ---> l) net" | |
| 2003 | and "eventually (\<lambda>x. e \<le> norm (f x)) net" | |
| 33175 | 2004 | shows "e \<le> norm l" | 
| 56290 | 2005 | using assms by (fast intro: tendsto_le tendsto_intros) | 
| 33175 | 2006 | |
| 2007 | text{* Limit under bilinear function *}
 | |
| 2008 | ||
| 2009 | lemma Lim_bilinear: | |
| 53282 | 2010 | assumes "(f ---> l) net" | 
| 2011 | and "(g ---> m) net" | |
| 2012 | and "bounded_bilinear h" | |
| 33175 | 2013 | shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net" | 
| 52624 | 2014 | using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net` | 
| 2015 | by (rule bounded_bilinear.tendsto) | |
| 33175 | 2016 | |
| 2017 | text{* These are special for limits out of the same vector space. *}
 | |
| 2018 | ||
| 2019 | lemma Lim_within_id: "(id ---> a) (at a within s)" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 2020 | unfolding id_def by (rule tendsto_ident_at) | 
| 33175 | 2021 | |
| 2022 | lemma Lim_at_id: "(id ---> a) (at a)" | |
| 45031 | 2023 | unfolding id_def by (rule tendsto_ident_at) | 
| 33175 | 2024 | |
| 2025 | lemma Lim_at_zero: | |
| 2026 | fixes a :: "'a::real_normed_vector" | |
| 53291 | 2027 | and l :: "'b::topological_space" | 
| 53282 | 2028 | shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" | 
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 2029 | using LIM_offset_zero LIM_offset_zero_cancel .. | 
| 33175 | 2030 | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 2031 | text{* It's also sometimes useful to extract the limit point from the filter. *}
 | 
| 33175 | 2032 | |
| 52624 | 2033 | abbreviation netlimit :: "'a::t2_space filter \<Rightarrow> 'a" | 
| 2034 | where "netlimit F \<equiv> Lim F (\<lambda>x. x)" | |
| 33175 | 2035 | |
| 53282 | 2036 | lemma netlimit_within: "\<not> trivial_limit (at a within S) \<Longrightarrow> netlimit (at a within S) = a" | 
| 51365 | 2037 | by (rule tendsto_Lim) (auto intro: tendsto_intros) | 
| 33175 | 2038 | |
| 2039 | lemma netlimit_at: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 2040 |   fixes a :: "'a::{perfect_space,t2_space}"
 | 
| 33175 | 2041 | shows "netlimit (at a) = a" | 
| 45031 | 2042 | using netlimit_within [of a UNIV] by simp | 
| 33175 | 2043 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2044 | lemma lim_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2045 | "x \<in> interior S \<Longrightarrow> (f ---> l) (at x within S) \<longleftrightarrow> (f ---> l) (at x)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 2046 | by (metis at_within_interior) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2047 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2048 | lemma netlimit_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2049 |   fixes x :: "'a::{t2_space,perfect_space}"
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2050 | assumes "x \<in> interior S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2051 | shows "netlimit (at x within S) = x" | 
| 52624 | 2052 | using assms by (metis at_within_interior netlimit_at) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2053 | |
| 33175 | 2054 | text{* Transformation of limit. *}
 | 
| 2055 | ||
| 2056 | lemma Lim_transform: | |
| 2057 | fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector" | |
| 2058 | assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net" | |
| 2059 | shows "(g ---> l) net" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 2060 | using tendsto_diff [OF assms(2) assms(1)] by simp | 
| 33175 | 2061 | |
| 2062 | lemma Lim_transform_eventually: | |
| 36667 | 2063 | "eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net \<Longrightarrow> (g ---> l) net" | 
| 33175 | 2064 | apply (rule topological_tendstoI) | 
| 2065 | apply (drule (2) topological_tendstoD) | |
| 2066 | apply (erule (1) eventually_elim2, simp) | |
| 2067 | done | |
| 2068 | ||
| 2069 | lemma Lim_transform_within: | |
| 53282 | 2070 | assumes "0 < d" | 
| 2071 | and "\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | |
| 2072 | and "(f ---> l) (at x within S)" | |
| 36667 | 2073 | shows "(g ---> l) (at x within S)" | 
| 2074 | proof (rule Lim_transform_eventually) | |
| 2075 | show "eventually (\<lambda>x. f x = g x) (at x within S)" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 2076 | using assms(1,2) by (auto simp: dist_nz eventually_at) | 
| 36667 | 2077 | show "(f ---> l) (at x within S)" by fact | 
| 2078 | qed | |
| 33175 | 2079 | |
| 2080 | lemma Lim_transform_at: | |
| 53282 | 2081 | assumes "0 < d" | 
| 2082 | and "\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | |
| 2083 | and "(f ---> l) (at x)" | |
| 36667 | 2084 | shows "(g ---> l) (at x)" | 
| 53282 | 2085 | using _ assms(3) | 
| 36667 | 2086 | proof (rule Lim_transform_eventually) | 
| 2087 | show "eventually (\<lambda>x. f x = g x) (at x)" | |
| 51530 
609914f0934a
rename eventually_at / _within, to distinguish them from the lemmas in the HOL image
 hoelzl parents: 
51518diff
changeset | 2088 | unfolding eventually_at2 | 
| 36667 | 2089 | using assms(1,2) by auto | 
| 2090 | qed | |
| 33175 | 2091 | |
| 2092 | text{* Common case assuming being away from some crucial point like 0. *}
 | |
| 2093 | ||
| 2094 | lemma Lim_transform_away_within: | |
| 36669 | 2095 | fixes a b :: "'a::t1_space" | 
| 53282 | 2096 | assumes "a \<noteq> b" | 
| 2097 | and "\<forall>x\<in>S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" | |
| 2098 | and "(f ---> l) (at a within S)" | |
| 33175 | 2099 | shows "(g ---> l) (at a within S)" | 
| 36669 | 2100 | proof (rule Lim_transform_eventually) | 
| 2101 | show "(f ---> l) (at a within S)" by fact | |
| 2102 | show "eventually (\<lambda>x. f x = g x) (at a within S)" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 2103 | unfolding eventually_at_topological | 
| 36669 | 2104 |     by (rule exI [where x="- {b}"], simp add: open_Compl assms)
 | 
| 33175 | 2105 | qed | 
| 2106 | ||
| 2107 | lemma Lim_transform_away_at: | |
| 36669 | 2108 | fixes a b :: "'a::t1_space" | 
| 52624 | 2109 | assumes ab: "a\<noteq>b" | 
| 2110 | and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" | |
| 2111 | and fl: "(f ---> l) (at a)" | |
| 33175 | 2112 | shows "(g ---> l) (at a)" | 
| 52624 | 2113 | using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl by simp | 
| 33175 | 2114 | |
| 2115 | text{* Alternatively, within an open set. *}
 | |
| 2116 | ||
| 2117 | lemma Lim_transform_within_open: | |
| 53282 | 2118 | assumes "open S" and "a \<in> S" | 
| 2119 | and "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x" | |
| 2120 | and "(f ---> l) (at a)" | |
| 33175 | 2121 | shows "(g ---> l) (at a)" | 
| 36667 | 2122 | proof (rule Lim_transform_eventually) | 
| 2123 | show "eventually (\<lambda>x. f x = g x) (at a)" | |
| 2124 | unfolding eventually_at_topological | |
| 2125 | using assms(1,2,3) by auto | |
| 2126 | show "(f ---> l) (at a)" by fact | |
| 33175 | 2127 | qed | 
| 2128 | ||
| 2129 | text{* A congruence rule allowing us to transform limits assuming not at point. *}
 | |
| 2130 | ||
| 2131 | (* FIXME: Only one congruence rule for tendsto can be used at a time! *) | |
| 2132 | ||
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 2133 | lemma Lim_cong_within(*[cong add]*): | 
| 53282 | 2134 | assumes "a = b" | 
| 2135 | and "x = y" | |
| 2136 | and "S = T" | |
| 2137 | and "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x" | |
| 43338 | 2138 | shows "(f ---> x) (at a within S) \<longleftrightarrow> (g ---> y) (at b within T)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 2139 | unfolding tendsto_def eventually_at_topological | 
| 36667 | 2140 | using assms by simp | 
| 2141 | ||
| 2142 | lemma Lim_cong_at(*[cong add]*): | |
| 43338 | 2143 | assumes "a = b" "x = y" | 
| 53282 | 2144 | and "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x" | 
| 43338 | 2145 | shows "((\<lambda>x. f x) ---> x) (at a) \<longleftrightarrow> ((g ---> y) (at a))" | 
| 36667 | 2146 | unfolding tendsto_def eventually_at_topological | 
| 2147 | using assms by simp | |
| 33175 | 2148 | |
| 2149 | text{* Useful lemmas on closure and set of possible sequential limits.*}
 | |
| 2150 | ||
| 2151 | lemma closure_sequential: | |
| 50883 | 2152 | fixes l :: "'a::first_countable_topology" | 
| 53291 | 2153 | shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" | 
| 2154 | (is "?lhs = ?rhs") | |
| 33175 | 2155 | proof | 
| 53282 | 2156 | assume "?lhs" | 
| 2157 | moreover | |
| 2158 |   {
 | |
| 2159 | assume "l \<in> S" | |
| 2160 | then have "?rhs" using tendsto_const[of l sequentially] by auto | |
| 52624 | 2161 | } | 
| 2162 | moreover | |
| 53282 | 2163 |   {
 | 
| 2164 | assume "l islimpt S" | |
| 2165 | then have "?rhs" unfolding islimpt_sequential by auto | |
| 52624 | 2166 | } | 
| 2167 | ultimately show "?rhs" | |
| 2168 | unfolding closure_def by auto | |
| 33175 | 2169 | next | 
| 2170 | assume "?rhs" | |
| 53282 | 2171 | then show "?lhs" unfolding closure_def islimpt_sequential by auto | 
| 33175 | 2172 | qed | 
| 2173 | ||
| 2174 | lemma closed_sequential_limits: | |
| 50883 | 2175 | fixes S :: "'a::first_countable_topology set" | 
| 33175 | 2176 | shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)" | 
| 55775 | 2177 | by (metis closure_sequential closure_subset_eq subset_iff) | 
| 33175 | 2178 | |
| 2179 | lemma closure_approachable: | |
| 2180 | fixes S :: "'a::metric_space set" | |
| 2181 | shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)" | |
| 2182 | apply (auto simp add: closure_def islimpt_approachable) | |
| 52624 | 2183 | apply (metis dist_self) | 
| 2184 | done | |
| 33175 | 2185 | |
| 2186 | lemma closed_approachable: | |
| 2187 | fixes S :: "'a::metric_space set" | |
| 53291 | 2188 | shows "closed S \<Longrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S" | 
| 33175 | 2189 | by (metis closure_closed closure_approachable) | 
| 2190 | ||
| 51351 | 2191 | lemma closure_contains_Inf: | 
| 2192 | fixes S :: "real set" | |
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2193 |   assumes "S \<noteq> {}" "bdd_below S"
 | 
| 51351 | 2194 | shows "Inf S \<in> closure S" | 
| 52624 | 2195 | proof - | 
| 51351 | 2196 | have *: "\<forall>x\<in>S. Inf S \<le> x" | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2197 | using cInf_lower[of _ S] assms by metis | 
| 52624 | 2198 |   {
 | 
| 53282 | 2199 | fix e :: real | 
| 2200 | assume "e > 0" | |
| 52624 | 2201 | then have "Inf S < Inf S + e" by simp | 
| 2202 | with assms obtain x where "x \<in> S" "x < Inf S + e" | |
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2203 | by (subst (asm) cInf_less_iff) auto | 
| 52624 | 2204 | with * have "\<exists>x\<in>S. dist x (Inf S) < e" | 
| 2205 | by (intro bexI[of _ x]) (auto simp add: dist_real_def) | |
| 2206 | } | |
| 2207 | then show ?thesis unfolding closure_approachable by auto | |
| 51351 | 2208 | qed | 
| 2209 | ||
| 2210 | lemma closed_contains_Inf: | |
| 2211 | fixes S :: "real set" | |
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2212 |   shows "S \<noteq> {} \<Longrightarrow> bdd_below S \<Longrightarrow> closed S \<Longrightarrow> Inf S \<in> S"
 | 
| 51351 | 2213 | by (metis closure_contains_Inf closure_closed assms) | 
| 2214 | ||
| 2215 | lemma not_trivial_limit_within_ball: | |
| 53640 | 2216 |   "\<not> trivial_limit (at x within S) \<longleftrightarrow> (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
 | 
| 51351 | 2217 | (is "?lhs = ?rhs") | 
| 2218 | proof - | |
| 53282 | 2219 |   {
 | 
| 2220 | assume "?lhs" | |
| 2221 |     {
 | |
| 2222 | fix e :: real | |
| 2223 | assume "e > 0" | |
| 53640 | 2224 |       then obtain y where "y \<in> S - {x}" and "dist y x < e"
 | 
| 51351 | 2225 |         using `?lhs` not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
 | 
| 2226 | by auto | |
| 53640 | 2227 |       then have "y \<in> S \<inter> ball x e - {x}"
 | 
| 51351 | 2228 | unfolding ball_def by (simp add: dist_commute) | 
| 53640 | 2229 |       then have "S \<inter> ball x e - {x} \<noteq> {}" by blast
 | 
| 52624 | 2230 | } | 
| 2231 | then have "?rhs" by auto | |
| 51351 | 2232 | } | 
| 2233 | moreover | |
| 53282 | 2234 |   {
 | 
| 2235 | assume "?rhs" | |
| 2236 |     {
 | |
| 2237 | fix e :: real | |
| 2238 | assume "e > 0" | |
| 53640 | 2239 |       then obtain y where "y \<in> S \<inter> ball x e - {x}"
 | 
| 53282 | 2240 | using `?rhs` by blast | 
| 53640 | 2241 |       then have "y \<in> S - {x}" and "dist y x < e"
 | 
| 2242 | unfolding ball_def by (simp_all add: dist_commute) | |
| 2243 |       then have "\<exists>y \<in> S - {x}. dist y x < e"
 | |
| 53282 | 2244 | by auto | 
| 51351 | 2245 | } | 
| 2246 | then have "?lhs" | |
| 53282 | 2247 |       using not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
 | 
| 2248 | by auto | |
| 51351 | 2249 | } | 
| 2250 | ultimately show ?thesis by auto | |
| 2251 | qed | |
| 2252 | ||
| 52624 | 2253 | |
| 50087 | 2254 | subsection {* Infimum Distance *}
 | 
| 2255 | ||
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2256 | definition "infdist x A = (if A = {} then 0 else INF a:A. dist x a)"
 | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2257 | |
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2258 | lemma bdd_below_infdist[intro, simp]: "bdd_below (dist x`A)" | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2259 | by (auto intro!: zero_le_dist) | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2260 | |
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2261 | lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = (INF a:A. dist x a)"
 | 
| 50087 | 2262 | by (simp add: infdist_def) | 
| 2263 | ||
| 52624 | 2264 | lemma infdist_nonneg: "0 \<le> infdist x A" | 
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2265 | by (auto simp add: infdist_def intro: cINF_greatest) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2266 | |
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2267 | lemma infdist_le: "a \<in> A \<Longrightarrow> infdist x A \<le> dist x a" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2268 | by (auto intro: cINF_lower simp add: infdist_def) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2269 | |
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2270 | lemma infdist_le2: "a \<in> A \<Longrightarrow> dist x a \<le> d \<Longrightarrow> infdist x A \<le> d" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2271 | by (auto intro!: cINF_lower2 simp add: infdist_def) | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2272 | |
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2273 | lemma infdist_zero[simp]: "a \<in> A \<Longrightarrow> infdist a A = 0" | 
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2274 | by (auto intro!: antisym infdist_nonneg infdist_le2) | 
| 50087 | 2275 | |
| 52624 | 2276 | lemma infdist_triangle: "infdist x A \<le> infdist y A + dist x y" | 
| 53640 | 2277 | proof (cases "A = {}")
 | 
| 2278 | case True | |
| 53282 | 2279 | then show ?thesis by (simp add: infdist_def) | 
| 50087 | 2280 | next | 
| 53640 | 2281 | case False | 
| 52624 | 2282 | then obtain a where "a \<in> A" by auto | 
| 50087 | 2283 |   have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
 | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2284 | proof (rule cInf_greatest) | 
| 53282 | 2285 |     from `A \<noteq> {}` show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}"
 | 
| 2286 | by simp | |
| 2287 | fix d | |
| 2288 |     assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
 | |
| 2289 | then obtain a where d: "d = dist x y + dist y a" "a \<in> A" | |
| 2290 | by auto | |
| 50087 | 2291 | show "infdist x A \<le> d" | 
| 2292 |       unfolding infdist_notempty[OF `A \<noteq> {}`]
 | |
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2293 | proof (rule cINF_lower2) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2294 | show "a \<in> A" by fact | 
| 53282 | 2295 | show "dist x a \<le> d" | 
| 2296 | unfolding d by (rule dist_triangle) | |
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2297 | qed simp | 
| 50087 | 2298 | qed | 
| 2299 | also have "\<dots> = dist x y + infdist y A" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2300 | proof (rule cInf_eq, safe) | 
| 53282 | 2301 | fix a | 
| 2302 | assume "a \<in> A" | |
| 2303 | then show "dist x y + infdist y A \<le> dist x y + dist y a" | |
| 2304 | by (auto intro: infdist_le) | |
| 50087 | 2305 | next | 
| 53282 | 2306 | fix i | 
| 2307 |     assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
 | |
| 2308 | then have "i - dist x y \<le> infdist y A" | |
| 2309 |       unfolding infdist_notempty[OF `A \<noteq> {}`] using `a \<in> A`
 | |
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2310 | by (intro cINF_greatest) (auto simp: field_simps) | 
| 53282 | 2311 | then show "i \<le> dist x y + infdist y A" | 
| 2312 | by simp | |
| 50087 | 2313 | qed | 
| 2314 | finally show ?thesis by simp | |
| 2315 | qed | |
| 2316 | ||
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2317 | lemma in_closure_iff_infdist_zero: | 
| 50087 | 2318 |   assumes "A \<noteq> {}"
 | 
| 2319 | shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | |
| 2320 | proof | |
| 2321 | assume "x \<in> closure A" | |
| 2322 | show "infdist x A = 0" | |
| 2323 | proof (rule ccontr) | |
| 2324 | assume "infdist x A \<noteq> 0" | |
| 53282 | 2325 | with infdist_nonneg[of x A] have "infdist x A > 0" | 
| 2326 | by auto | |
| 2327 |     then have "ball x (infdist x A) \<inter> closure A = {}"
 | |
| 52624 | 2328 | apply auto | 
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 2329 | apply (metis `x \<in> closure A` closure_approachable dist_commute infdist_le not_less) | 
| 52624 | 2330 | done | 
| 53282 | 2331 | then have "x \<notin> closure A" | 
| 52624 | 2332 | by (metis `0 < infdist x A` centre_in_ball disjoint_iff_not_equal) | 
| 53282 | 2333 | then show False using `x \<in> closure A` by simp | 
| 50087 | 2334 | qed | 
| 2335 | next | |
| 2336 | assume x: "infdist x A = 0" | |
| 53282 | 2337 | then obtain a where "a \<in> A" | 
| 2338 | by atomize_elim (metis all_not_in_conv assms) | |
| 2339 | show "x \<in> closure A" | |
| 2340 | unfolding closure_approachable | |
| 2341 | apply safe | |
| 2342 | proof (rule ccontr) | |
| 2343 | fix e :: real | |
| 2344 | assume "e > 0" | |
| 50087 | 2345 | assume "\<not> (\<exists>y\<in>A. dist y x < e)" | 
| 53282 | 2346 | then have "infdist x A \<ge> e" using `a \<in> A` | 
| 50087 | 2347 | unfolding infdist_def | 
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 2348 | by (force simp: dist_commute intro: cINF_greatest) | 
| 53282 | 2349 | with x `e > 0` show False by auto | 
| 50087 | 2350 | qed | 
| 2351 | qed | |
| 2352 | ||
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2353 | lemma in_closed_iff_infdist_zero: | 
| 50087 | 2354 |   assumes "closed A" "A \<noteq> {}"
 | 
| 2355 | shows "x \<in> A \<longleftrightarrow> infdist x A = 0" | |
| 2356 | proof - | |
| 2357 | have "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | |
| 2358 | by (rule in_closure_iff_infdist_zero) fact | |
| 2359 | with assms show ?thesis by simp | |
| 2360 | qed | |
| 2361 | ||
| 2362 | lemma tendsto_infdist [tendsto_intros]: | |
| 2363 | assumes f: "(f ---> l) F" | |
| 2364 | shows "((\<lambda>x. infdist (f x) A) ---> infdist l A) F" | |
| 2365 | proof (rule tendstoI) | |
| 53282 | 2366 | fix e ::real | 
| 2367 | assume "e > 0" | |
| 50087 | 2368 | from tendstoD[OF f this] | 
| 2369 | show "eventually (\<lambda>x. dist (infdist (f x) A) (infdist l A) < e) F" | |
| 2370 | proof (eventually_elim) | |
| 2371 | fix x | |
| 2372 | from infdist_triangle[of l A "f x"] infdist_triangle[of "f x" A l] | |
| 2373 | have "dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l" | |
| 2374 | by (simp add: dist_commute dist_real_def) | |
| 2375 | also assume "dist (f x) l < e" | |
| 2376 | finally show "dist (infdist (f x) A) (infdist l A) < e" . | |
| 2377 | qed | |
| 2378 | qed | |
| 2379 | ||
| 33175 | 2380 | text{* Some other lemmas about sequences. *}
 | 
| 2381 | ||
| 53597 | 2382 | lemma sequentially_offset: (* TODO: move to Topological_Spaces.thy *) | 
| 36441 | 2383 | assumes "eventually (\<lambda>i. P i) sequentially" | 
| 2384 | shows "eventually (\<lambda>i. P (i + k)) sequentially" | |
| 53597 | 2385 | using assms by (rule eventually_sequentially_seg [THEN iffD2]) | 
| 2386 | ||
| 2387 | lemma seq_offset_neg: (* TODO: move to Topological_Spaces.thy *) | |
| 53291 | 2388 | "(f ---> l) sequentially \<Longrightarrow> ((\<lambda>i. f(i - k)) ---> l) sequentially" | 
| 53597 | 2389 | apply (erule filterlim_compose) | 
| 2390 | apply (simp add: filterlim_def le_sequentially eventually_filtermap eventually_sequentially) | |
| 52624 | 2391 | apply arith | 
| 2392 | done | |
| 33175 | 2393 | |
| 2394 | lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially" | |
| 53597 | 2395 | using LIMSEQ_inverse_real_of_nat by (rule LIMSEQ_imp_Suc) (* TODO: move to Limits.thy *) | 
| 33175 | 2396 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2397 | subsection {* More properties of closed balls *}
 | 
| 33175 | 2398 | |
| 54070 | 2399 | lemma closed_vimage: (* TODO: move to Topological_Spaces.thy *) | 
| 2400 | assumes "closed s" and "continuous_on UNIV f" | |
| 2401 | shows "closed (vimage f s)" | |
| 2402 | using assms unfolding continuous_on_closed_vimage [OF closed_UNIV] | |
| 2403 | by simp | |
| 2404 | ||
| 33175 | 2405 | lemma closed_cball: "closed (cball x e)" | 
| 54070 | 2406 | proof - | 
| 2407 |   have "closed (dist x -` {..e})"
 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 2408 | by (intro closed_vimage closed_atMost continuous_intros) | 
| 54070 | 2409 |   also have "dist x -` {..e} = cball x e"
 | 
| 2410 | by auto | |
| 2411 | finally show ?thesis . | |
| 2412 | qed | |
| 33175 | 2413 | |
| 2414 | lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)" | |
| 52624 | 2415 | proof - | 
| 2416 |   {
 | |
| 2417 | fix x and e::real | |
| 2418 | assume "x\<in>S" "e>0" "ball x e \<subseteq> S" | |
| 53282 | 2419 | then have "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto) | 
| 52624 | 2420 | } | 
| 2421 | moreover | |
| 2422 |   {
 | |
| 2423 | fix x and e::real | |
| 2424 | assume "x\<in>S" "e>0" "cball x e \<subseteq> S" | |
| 53282 | 2425 | then have "\<exists>d>0. ball x d \<subseteq> S" | 
| 52624 | 2426 | unfolding subset_eq | 
| 2427 | apply(rule_tac x="e/2" in exI) | |
| 2428 | apply auto | |
| 2429 | done | |
| 2430 | } | |
| 2431 | ultimately show ?thesis | |
| 2432 | unfolding open_contains_ball by auto | |
| 33175 | 2433 | qed | 
| 2434 | ||
| 53291 | 2435 | lemma open_contains_cball_eq: "open S \<Longrightarrow> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))" | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 2436 | by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball) | 
| 33175 | 2437 | |
| 2438 | lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)" | |
| 2439 | apply (simp add: interior_def, safe) | |
| 2440 | apply (force simp add: open_contains_cball) | |
| 2441 | apply (rule_tac x="ball x e" in exI) | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 2442 | apply (simp add: subset_trans [OF ball_subset_cball]) | 
| 33175 | 2443 | done | 
| 2444 | ||
| 2445 | lemma islimpt_ball: | |
| 2446 |   fixes x y :: "'a::{real_normed_vector,perfect_space}"
 | |
| 53291 | 2447 | shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" | 
| 2448 | (is "?lhs = ?rhs") | |
| 33175 | 2449 | proof | 
| 2450 | assume "?lhs" | |
| 53282 | 2451 |   {
 | 
| 2452 | assume "e \<le> 0" | |
| 2453 |     then have *:"ball x e = {}"
 | |
| 2454 | using ball_eq_empty[of x e] by auto | |
| 2455 | have False using `?lhs` | |
| 2456 | unfolding * using islimpt_EMPTY[of y] by auto | |
| 33175 | 2457 | } | 
| 53282 | 2458 | then have "e > 0" by (metis not_less) | 
| 33175 | 2459 | moreover | 
| 52624 | 2460 | have "y \<in> cball x e" | 
| 2461 | using closed_cball[of x e] islimpt_subset[of y "ball x e" "cball x e"] | |
| 2462 | ball_subset_cball[of x e] `?lhs` | |
| 2463 | unfolding closed_limpt by auto | |
| 33175 | 2464 | ultimately show "?rhs" by auto | 
| 2465 | next | |
| 53282 | 2466 | assume "?rhs" | 
| 53640 | 2467 | then have "e > 0" by auto | 
| 53282 | 2468 |   {
 | 
| 2469 | fix d :: real | |
| 2470 | assume "d > 0" | |
| 33175 | 2471 | have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | 
| 53282 | 2472 | proof (cases "d \<le> dist x y") | 
| 2473 | case True | |
| 2474 | then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2475 | proof (cases "x = y") | |
| 2476 | case True | |
| 2477 | then have False | |
| 2478 | using `d \<le> dist x y` `d>0` by auto | |
| 2479 | then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2480 | by auto | |
| 33175 | 2481 | next | 
| 2482 | case False | |
| 53282 | 2483 | have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) = | 
| 2484 | norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))" | |
| 53291 | 2485 | unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[symmetric] | 
| 53282 | 2486 | by auto | 
| 33175 | 2487 | also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)" | 
| 53291 | 2488 | using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", symmetric, of "y - x"] | 
| 33175 | 2489 | unfolding scaleR_minus_left scaleR_one | 
| 2490 | by (auto simp add: norm_minus_commute) | |
| 2491 | also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>" | |
| 2492 | unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]] | |
| 53282 | 2493 | unfolding distrib_right using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] | 
| 2494 | by auto | |
| 2495 | also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` | |
| 2496 | by (auto simp add: dist_norm) | |
| 2497 | finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` | |
| 2498 | by auto | |
| 33175 | 2499 | moreover | 
| 2500 | have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0" | |
| 53282 | 2501 | using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff | 
| 2502 | by (auto simp add: dist_commute) | |
| 33175 | 2503 | moreover | 
| 53282 | 2504 | have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" | 
| 2505 | unfolding dist_norm | |
| 2506 | apply simp | |
| 2507 | unfolding norm_minus_cancel | |
| 2508 | using `d > 0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y] | |
| 2509 | unfolding dist_norm | |
| 2510 | apply auto | |
| 2511 | done | |
| 2512 | ultimately show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2513 | apply (rule_tac x = "y - (d / (2*dist y x)) *\<^sub>R (y - x)" in bexI) | |
| 2514 | apply auto | |
| 2515 | done | |
| 33175 | 2516 | qed | 
| 2517 | next | |
| 53282 | 2518 | case False | 
| 2519 | then have "d > dist x y" by auto | |
| 2520 | show "\<exists>x' \<in> ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2521 | proof (cases "x = y") | |
| 33175 | 2522 | case True | 
| 2523 | obtain z where **: "z \<noteq> y" "dist z y < min e d" | |
| 2524 | using perfect_choose_dist[of "min e d" y] | |
| 2525 | using `d > 0` `e>0` by auto | |
| 2526 | show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2527 | unfolding `x = y` | |
| 2528 | using `z \<noteq> y` ** | |
| 53282 | 2529 | apply (rule_tac x=z in bexI) | 
| 2530 | apply (auto simp add: dist_commute) | |
| 2531 | done | |
| 33175 | 2532 | next | 
| 53282 | 2533 | case False | 
| 2534 | then show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 2535 | using `d>0` `d > dist x y` `?rhs` | |
| 2536 | apply (rule_tac x=x in bexI) | |
| 2537 | apply auto | |
| 2538 | done | |
| 33175 | 2539 | qed | 
| 53282 | 2540 | qed | 
| 2541 | } | |
| 2542 | then show "?lhs" | |
| 2543 | unfolding mem_cball islimpt_approachable mem_ball by auto | |
| 33175 | 2544 | qed | 
| 2545 | ||
| 2546 | lemma closure_ball_lemma: | |
| 2547 | fixes x y :: "'a::real_normed_vector" | |
| 53282 | 2548 | assumes "x \<noteq> y" | 
| 2549 | shows "y islimpt ball x (dist x y)" | |
| 33175 | 2550 | proof (rule islimptI) | 
| 53282 | 2551 | fix T | 
| 2552 | assume "y \<in> T" "open T" | |
| 33175 | 2553 | then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T" | 
| 2554 | unfolding open_dist by fast | |
| 2555 | (* choose point between x and y, within distance r of y. *) | |
| 2556 | def k \<equiv> "min 1 (r / (2 * dist x y))" | |
| 2557 | def z \<equiv> "y + scaleR k (x - y)" | |
| 2558 | have z_def2: "z = x + scaleR (1 - k) (y - x)" | |
| 2559 | unfolding z_def by (simp add: algebra_simps) | |
| 2560 | have "dist z y < r" | |
| 2561 | unfolding z_def k_def using `0 < r` | |
| 2562 | by (simp add: dist_norm min_def) | |
| 53282 | 2563 | then have "z \<in> T" | 
| 2564 | using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp | |
| 33175 | 2565 | have "dist x z < dist x y" | 
| 2566 | unfolding z_def2 dist_norm | |
| 2567 | apply (simp add: norm_minus_commute) | |
| 2568 | apply (simp only: dist_norm [symmetric]) | |
| 2569 | apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp) | |
| 2570 | apply (rule mult_strict_right_mono) | |
| 56541 | 2571 | apply (simp add: k_def zero_less_dist_iff `0 < r` `x \<noteq> y`) | 
| 33175 | 2572 | apply (simp add: zero_less_dist_iff `x \<noteq> y`) | 
| 2573 | done | |
| 53282 | 2574 | then have "z \<in> ball x (dist x y)" | 
| 2575 | by simp | |
| 33175 | 2576 | have "z \<noteq> y" | 
| 2577 | unfolding z_def k_def using `x \<noteq> y` `0 < r` | |
| 2578 | by (simp add: min_def) | |
| 2579 | show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y" | |
| 2580 | using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y` | |
| 2581 | by fast | |
| 2582 | qed | |
| 2583 | ||
| 2584 | lemma closure_ball: | |
| 2585 | fixes x :: "'a::real_normed_vector" | |
| 2586 | shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e" | |
| 52624 | 2587 | apply (rule equalityI) | 
| 2588 | apply (rule closure_minimal) | |
| 2589 | apply (rule ball_subset_cball) | |
| 2590 | apply (rule closed_cball) | |
| 2591 | apply (rule subsetI, rename_tac y) | |
| 2592 | apply (simp add: le_less [where 'a=real]) | |
| 2593 | apply (erule disjE) | |
| 2594 | apply (rule subsetD [OF closure_subset], simp) | |
| 2595 | apply (simp add: closure_def) | |
| 2596 | apply clarify | |
| 2597 | apply (rule closure_ball_lemma) | |
| 2598 | apply (simp add: zero_less_dist_iff) | |
| 2599 | done | |
| 33175 | 2600 | |
| 2601 | (* In a trivial vector space, this fails for e = 0. *) | |
| 2602 | lemma interior_cball: | |
| 2603 |   fixes x :: "'a::{real_normed_vector, perfect_space}"
 | |
| 2604 | shows "interior (cball x e) = ball x e" | |
| 53640 | 2605 | proof (cases "e \<ge> 0") | 
| 33175 | 2606 | case False note cs = this | 
| 53282 | 2607 |   from cs have "ball x e = {}"
 | 
| 2608 | using ball_empty[of e x] by auto | |
| 2609 | moreover | |
| 2610 |   {
 | |
| 2611 | fix y | |
| 2612 | assume "y \<in> cball x e" | |
| 2613 | then have False | |
| 2614 | unfolding mem_cball using dist_nz[of x y] cs by auto | |
| 2615 | } | |
| 2616 |   then have "cball x e = {}" by auto
 | |
| 2617 |   then have "interior (cball x e) = {}"
 | |
| 2618 | using interior_empty by auto | |
| 33175 | 2619 | ultimately show ?thesis by blast | 
| 2620 | next | |
| 2621 | case True note cs = this | |
| 53282 | 2622 | have "ball x e \<subseteq> cball x e" | 
| 2623 | using ball_subset_cball by auto | |
| 2624 | moreover | |
| 2625 |   {
 | |
| 2626 | fix S y | |
| 2627 | assume as: "S \<subseteq> cball x e" "open S" "y\<in>S" | |
| 2628 | then obtain d where "d>0" and d: "\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" | |
| 2629 | unfolding open_dist by blast | |
| 33175 | 2630 | then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d" | 
| 2631 | using perfect_choose_dist [of d] by auto | |
| 53282 | 2632 | have "xa \<in> S" | 
| 2633 | using d[THEN spec[where x = xa]] | |
| 2634 | using xa by (auto simp add: dist_commute) | |
| 2635 | then have xa_cball: "xa \<in> cball x e" | |
| 2636 | using as(1) by auto | |
| 2637 | then have "y \<in> ball x e" | |
| 2638 | proof (cases "x = y") | |
| 33175 | 2639 | case True | 
| 53282 | 2640 | then have "e > 0" | 
| 2641 | using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] | |
| 52624 | 2642 | by (auto simp add: dist_commute) | 
| 53282 | 2643 | then show "y \<in> ball x e" | 
| 2644 | using `x = y ` by simp | |
| 33175 | 2645 | next | 
| 2646 | case False | |
| 53282 | 2647 | have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" | 
| 2648 | unfolding dist_norm | |
| 33175 | 2649 | using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto | 
| 53282 | 2650 | then have *: "y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" | 
| 52624 | 2651 | using d as(1)[unfolded subset_eq] by blast | 
| 33175 | 2652 | have "y - x \<noteq> 0" using `x \<noteq> y` by auto | 
| 56541 | 2653 | hence **:"d / (2 * norm (y - x)) > 0" | 
| 2654 | unfolding zero_less_norm_iff[symmetric] using `d>0` by auto | |
| 53282 | 2655 | have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x = | 
| 2656 | norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)" | |
| 33175 | 2657 | by (auto simp add: dist_norm algebra_simps) | 
| 2658 | also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))" | |
| 2659 | by (auto simp add: algebra_simps) | |
| 2660 | also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)" | |
| 2661 | using ** by auto | |
| 53282 | 2662 | also have "\<dots> = (dist y x) + d/2" | 
| 2663 | using ** by (auto simp add: distrib_right dist_norm) | |
| 2664 | finally have "e \<ge> dist x y +d/2" | |
| 2665 | using *[unfolded mem_cball] by (auto simp add: dist_commute) | |
| 2666 | then show "y \<in> ball x e" | |
| 2667 | unfolding mem_ball using `d>0` by auto | |
| 52624 | 2668 | qed | 
| 2669 | } | |
| 53282 | 2670 | then have "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" | 
| 2671 | by auto | |
| 52624 | 2672 | ultimately show ?thesis | 
| 53640 | 2673 | using interior_unique[of "ball x e" "cball x e"] | 
| 2674 | using open_ball[of x e] | |
| 2675 | by auto | |
| 33175 | 2676 | qed | 
| 2677 | ||
| 2678 | lemma frontier_ball: | |
| 2679 | fixes a :: "'a::real_normed_vector" | |
| 53291 | 2680 |   shows "0 < e \<Longrightarrow> frontier(ball a e) = {x. dist a x = e}"
 | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 2681 | apply (simp add: frontier_def closure_ball interior_open order_less_imp_le) | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 2682 | apply (simp add: set_eq_iff) | 
| 52624 | 2683 | apply arith | 
| 2684 | done | |
| 33175 | 2685 | |
| 2686 | lemma frontier_cball: | |
| 2687 |   fixes a :: "'a::{real_normed_vector, perfect_space}"
 | |
| 53640 | 2688 |   shows "frontier (cball a e) = {x. dist a x = e}"
 | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 2689 | apply (simp add: frontier_def interior_cball closed_cball order_less_imp_le) | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 2690 | apply (simp add: set_eq_iff) | 
| 52624 | 2691 | apply arith | 
| 2692 | done | |
| 33175 | 2693 | |
| 53640 | 2694 | lemma cball_eq_empty: "cball x e = {} \<longleftrightarrow> e < 0"
 | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 2695 | apply (simp add: set_eq_iff not_le) | 
| 52624 | 2696 | apply (metis zero_le_dist dist_self order_less_le_trans) | 
| 2697 | done | |
| 2698 | ||
| 53282 | 2699 | lemma cball_empty: "e < 0 \<Longrightarrow> cball x e = {}"
 | 
| 52624 | 2700 | by (simp add: cball_eq_empty) | 
| 33175 | 2701 | |
| 2702 | lemma cball_eq_sing: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 2703 |   fixes x :: "'a::{metric_space,perfect_space}"
 | 
| 53640 | 2704 |   shows "cball x e = {x} \<longleftrightarrow> e = 0"
 | 
| 33175 | 2705 | proof (rule linorder_cases) | 
| 2706 | assume e: "0 < e" | |
| 2707 | obtain a where "a \<noteq> x" "dist a x < e" | |
| 2708 | using perfect_choose_dist [OF e] by auto | |
| 53282 | 2709 | then have "a \<noteq> x" "dist x a \<le> e" | 
| 2710 | by (auto simp add: dist_commute) | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 2711 | with e show ?thesis by (auto simp add: set_eq_iff) | 
| 33175 | 2712 | qed auto | 
| 2713 | ||
| 2714 | lemma cball_sing: | |
| 2715 | fixes x :: "'a::metric_space" | |
| 53291 | 2716 |   shows "e = 0 \<Longrightarrow> cball x e = {x}"
 | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 2717 | by (auto simp add: set_eq_iff) | 
| 33175 | 2718 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2719 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2720 | subsection {* Boundedness *}
 | 
| 33175 | 2721 | |
| 2722 | (* FIXME: This has to be unified with BSEQ!! *) | |
| 52624 | 2723 | definition (in metric_space) bounded :: "'a set \<Rightarrow> bool" | 
| 2724 | where "bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)" | |
| 33175 | 2725 | |
| 50998 | 2726 | lemma bounded_subset_cball: "bounded S \<longleftrightarrow> (\<exists>e x. S \<subseteq> cball x e)" | 
| 2727 | unfolding bounded_def subset_eq by auto | |
| 2728 | ||
| 33175 | 2729 | lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)" | 
| 52624 | 2730 | unfolding bounded_def | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 2731 | by auto (metis add.commute add_le_cancel_right dist_commute dist_triangle_le) | 
| 33175 | 2732 | |
| 2733 | lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)" | |
| 52624 | 2734 | unfolding bounded_any_center [where a=0] | 
| 2735 | by (simp add: dist_norm) | |
| 33175 | 2736 | |
| 53282 | 2737 | lemma bounded_realI: | 
| 2738 | assumes "\<forall>x\<in>s. abs (x::real) \<le> B" | |
| 2739 | shows "bounded s" | |
| 2740 | unfolding bounded_def dist_real_def | |
| 55775 | 2741 | by (metis abs_minus_commute assms diff_0_right) | 
| 50104 | 2742 | |
| 50948 | 2743 | lemma bounded_empty [simp]: "bounded {}"
 | 
| 2744 | by (simp add: bounded_def) | |
| 2745 | ||
| 53291 | 2746 | lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T \<Longrightarrow> bounded S" | 
| 33175 | 2747 | by (metis bounded_def subset_eq) | 
| 2748 | ||
| 53291 | 2749 | lemma bounded_interior[intro]: "bounded S \<Longrightarrow> bounded(interior S)" | 
| 33175 | 2750 | by (metis bounded_subset interior_subset) | 
| 2751 | ||
| 52624 | 2752 | lemma bounded_closure[intro]: | 
| 2753 | assumes "bounded S" | |
| 2754 | shows "bounded (closure S)" | |
| 2755 | proof - | |
| 2756 | from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" | |
| 2757 | unfolding bounded_def by auto | |
| 2758 |   {
 | |
| 2759 | fix y | |
| 2760 | assume "y \<in> closure S" | |
| 33175 | 2761 | then obtain f where f: "\<forall>n. f n \<in> S" "(f ---> y) sequentially" | 
| 2762 | unfolding closure_sequential by auto | |
| 2763 | have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp | |
| 53282 | 2764 | then have "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially" | 
| 33175 | 2765 | by (rule eventually_mono, simp add: f(1)) | 
| 2766 | have "dist x y \<le> a" | |
| 2767 | apply (rule Lim_dist_ubound [of sequentially f]) | |
| 2768 | apply (rule trivial_limit_sequentially) | |
| 2769 | apply (rule f(2)) | |
| 2770 | apply fact | |
| 2771 | done | |
| 2772 | } | |
| 53282 | 2773 | then show ?thesis | 
| 2774 | unfolding bounded_def by auto | |
| 33175 | 2775 | qed | 
| 2776 | ||
| 2777 | lemma bounded_cball[simp,intro]: "bounded (cball x e)" | |
| 2778 | apply (simp add: bounded_def) | |
| 2779 | apply (rule_tac x=x in exI) | |
| 2780 | apply (rule_tac x=e in exI) | |
| 2781 | apply auto | |
| 2782 | done | |
| 2783 | ||
| 53640 | 2784 | lemma bounded_ball[simp,intro]: "bounded (ball x e)" | 
| 33175 | 2785 | by (metis ball_subset_cball bounded_cball bounded_subset) | 
| 2786 | ||
| 2787 | lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T" | |
| 2788 | apply (auto simp add: bounded_def) | |
| 55775 | 2789 | by (metis Un_iff add_le_cancel_left dist_triangle le_max_iff_disj max.order_iff) | 
| 33175 | 2790 | |
| 53640 | 2791 | lemma bounded_Union[intro]: "finite F \<Longrightarrow> \<forall>S\<in>F. bounded S \<Longrightarrow> bounded (\<Union>F)" | 
| 52624 | 2792 | by (induct rule: finite_induct[of F]) auto | 
| 33175 | 2793 | |
| 50955 | 2794 | lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)" | 
| 52624 | 2795 | by (induct set: finite) auto | 
| 50955 | 2796 | |
| 50948 | 2797 | lemma bounded_insert [simp]: "bounded (insert x S) \<longleftrightarrow> bounded S" | 
| 2798 | proof - | |
| 53640 | 2799 |   have "\<forall>y\<in>{x}. dist x y \<le> 0"
 | 
| 2800 | by simp | |
| 2801 |   then have "bounded {x}"
 | |
| 2802 | unfolding bounded_def by fast | |
| 2803 | then show ?thesis | |
| 2804 | by (metis insert_is_Un bounded_Un) | |
| 50948 | 2805 | qed | 
| 2806 | ||
| 2807 | lemma finite_imp_bounded [intro]: "finite S \<Longrightarrow> bounded S" | |
| 52624 | 2808 | by (induct set: finite) simp_all | 
| 50948 | 2809 | |
| 53640 | 2810 | lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x \<le> b)" | 
| 33175 | 2811 | apply (simp add: bounded_iff) | 
| 53640 | 2812 | apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x \<le> y \<longrightarrow> x \<le> 1 + abs y)") | 
| 52624 | 2813 | apply metis | 
| 2814 | apply arith | |
| 2815 | done | |
| 33175 | 2816 | |
| 53640 | 2817 | lemma Bseq_eq_bounded: | 
| 2818 | fixes f :: "nat \<Rightarrow> 'a::real_normed_vector" | |
| 2819 | shows "Bseq f \<longleftrightarrow> bounded (range f)" | |
| 50972 | 2820 | unfolding Bseq_def bounded_pos by auto | 
| 2821 | ||
| 33175 | 2822 | lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)" | 
| 2823 | by (metis Int_lower1 Int_lower2 bounded_subset) | |
| 2824 | ||
| 53291 | 2825 | lemma bounded_diff[intro]: "bounded S \<Longrightarrow> bounded (S - T)" | 
| 52624 | 2826 | by (metis Diff_subset bounded_subset) | 
| 33175 | 2827 | |
| 2828 | lemma not_bounded_UNIV[simp, intro]: | |
| 2829 |   "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
 | |
| 53640 | 2830 | proof (auto simp add: bounded_pos not_le) | 
| 33175 | 2831 | obtain x :: 'a where "x \<noteq> 0" | 
| 2832 | using perfect_choose_dist [OF zero_less_one] by fast | |
| 53640 | 2833 | fix b :: real | 
| 2834 | assume b: "b >0" | |
| 2835 | have b1: "b +1 \<ge> 0" | |
| 2836 | using b by simp | |
| 33175 | 2837 | with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))" | 
| 2838 | by (simp add: norm_sgn) | |
| 2839 | then show "\<exists>x::'a. b < norm x" .. | |
| 2840 | qed | |
| 2841 | ||
| 2842 | lemma bounded_linear_image: | |
| 53291 | 2843 | assumes "bounded S" | 
| 2844 | and "bounded_linear f" | |
| 2845 | shows "bounded (f ` S)" | |
| 52624 | 2846 | proof - | 
| 53640 | 2847 | from assms(1) obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b" | 
| 52624 | 2848 | unfolding bounded_pos by auto | 
| 53640 | 2849 | from assms(2) obtain B where B: "B > 0" "\<forall>x. norm (f x) \<le> B * norm x" | 
| 57514 
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
 haftmann parents: 
57512diff
changeset | 2850 | using bounded_linear.pos_bounded by (auto simp add: ac_simps) | 
| 52624 | 2851 |   {
 | 
| 53282 | 2852 | fix x | 
| 53640 | 2853 | assume "x \<in> S" | 
| 2854 | then have "norm x \<le> b" | |
| 2855 | using b by auto | |
| 2856 | then have "norm (f x) \<le> B * b" | |
| 2857 | using B(2) | |
| 52624 | 2858 | apply (erule_tac x=x in allE) | 
| 2859 | apply (metis B(1) B(2) order_trans mult_le_cancel_left_pos) | |
| 2860 | done | |
| 33175 | 2861 | } | 
| 53282 | 2862 | then show ?thesis | 
| 2863 | unfolding bounded_pos | |
| 52624 | 2864 | apply (rule_tac x="b*B" in exI) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 2865 | using b B by (auto simp add: mult.commute) | 
| 33175 | 2866 | qed | 
| 2867 | ||
| 2868 | lemma bounded_scaling: | |
| 2869 | fixes S :: "'a::real_normed_vector set" | |
| 2870 | shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)" | |
| 53291 | 2871 | apply (rule bounded_linear_image) | 
| 2872 | apply assumption | |
| 44282 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 huffman parents: 
44252diff
changeset | 2873 | apply (rule bounded_linear_scaleR_right) | 
| 33175 | 2874 | done | 
| 2875 | ||
| 2876 | lemma bounded_translation: | |
| 2877 | fixes S :: "'a::real_normed_vector set" | |
| 52624 | 2878 | assumes "bounded S" | 
| 2879 | shows "bounded ((\<lambda>x. a + x) ` S)" | |
| 53282 | 2880 | proof - | 
| 53640 | 2881 | from assms obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b" | 
| 52624 | 2882 | unfolding bounded_pos by auto | 
| 2883 |   {
 | |
| 2884 | fix x | |
| 53640 | 2885 | assume "x \<in> S" | 
| 53282 | 2886 | then have "norm (a + x) \<le> b + norm a" | 
| 52624 | 2887 | using norm_triangle_ineq[of a x] b by auto | 
| 33175 | 2888 | } | 
| 53282 | 2889 | then show ?thesis | 
| 52624 | 2890 | unfolding bounded_pos | 
| 2891 | using norm_ge_zero[of a] b(1) and add_strict_increasing[of b 0 "norm a"] | |
| 48048 
87b94fb75198
remove stray reference to no-longer-existing theorem 'add'
 huffman parents: 
47108diff
changeset | 2892 | by (auto intro!: exI[of _ "b + norm a"]) | 
| 33175 | 2893 | qed | 
| 2894 | ||
| 2895 | ||
| 2896 | text{* Some theorems on sups and infs using the notion "bounded". *}
 | |
| 2897 | ||
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2898 | lemma bounded_real: "bounded (S::real set) \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. \<bar>x\<bar> \<le> a)" | 
| 33175 | 2899 | by (simp add: bounded_iff) | 
| 2900 | ||
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2901 | lemma bounded_imp_bdd_above: "bounded S \<Longrightarrow> bdd_above (S :: real set)" | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2902 | by (auto simp: bounded_def bdd_above_def dist_real_def) | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2903 | (metis abs_le_D1 abs_minus_commute diff_le_eq) | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2904 | |
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2905 | lemma bounded_imp_bdd_below: "bounded S \<Longrightarrow> bdd_below (S :: real set)" | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2906 | by (auto simp: bounded_def bdd_below_def dist_real_def) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 2907 | (metis abs_le_D1 add.commute diff_le_eq) | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2908 | |
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2909 | (* TODO: remove the following lemmas about Inf and Sup, is now in conditionally complete lattice *) | 
| 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2910 | |
| 33270 | 2911 | lemma bounded_has_Sup: | 
| 2912 | fixes S :: "real set" | |
| 53640 | 2913 | assumes "bounded S" | 
| 2914 |     and "S \<noteq> {}"
 | |
| 53282 | 2915 | shows "\<forall>x\<in>S. x \<le> Sup S" | 
| 2916 | and "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" | |
| 33270 | 2917 | proof | 
| 53282 | 2918 | show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" | 
| 2919 | using assms by (metis cSup_least) | |
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2920 | qed (metis cSup_upper assms(1) bounded_imp_bdd_above) | 
| 33270 | 2921 | |
| 2922 | lemma Sup_insert: | |
| 2923 | fixes S :: "real set" | |
| 53291 | 2924 |   shows "bounded S \<Longrightarrow> Sup (insert x S) = (if S = {} then x else max x (Sup S))"
 | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2925 | by (auto simp: bounded_imp_bdd_above sup_max cSup_insert_If) | 
| 33270 | 2926 | |
| 2927 | lemma Sup_insert_finite: | |
| 2928 | fixes S :: "real set" | |
| 53291 | 2929 |   shows "finite S \<Longrightarrow> Sup (insert x S) = (if S = {} then x else max x (Sup S))"
 | 
| 33270 | 2930 | apply (rule Sup_insert) | 
| 2931 | apply (rule finite_imp_bounded) | |
| 52624 | 2932 | apply simp | 
| 2933 | done | |
| 33270 | 2934 | |
| 2935 | lemma bounded_has_Inf: | |
| 2936 | fixes S :: "real set" | |
| 53640 | 2937 | assumes "bounded S" | 
| 2938 |     and "S \<noteq> {}"
 | |
| 53282 | 2939 | shows "\<forall>x\<in>S. x \<ge> Inf S" | 
| 2940 | and "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b" | |
| 33175 | 2941 | proof | 
| 53640 | 2942 | show "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b" | 
| 53282 | 2943 | using assms by (metis cInf_greatest) | 
| 54258 
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
 hoelzl parents: 
54230diff
changeset | 2944 | qed (metis cInf_lower assms(1) bounded_imp_bdd_below) | 
| 33270 | 2945 | |
| 2946 | lemma Inf_insert: | |
| 2947 | fixes S :: "real set" | |
| 53291 | 2948 |   shows "bounded S \<Longrightarrow> Inf (insert x S) = (if S = {} then x else min x (Inf S))"
 | 
| 54259 
71c701dc5bf9
add SUP and INF for conditionally complete lattices
 hoelzl parents: 
54258diff
changeset | 2949 | by (auto simp: bounded_imp_bdd_below inf_min cInf_insert_If) | 
| 50944 | 2950 | |
| 33270 | 2951 | lemma Inf_insert_finite: | 
| 2952 | fixes S :: "real set" | |
| 53291 | 2953 |   shows "finite S \<Longrightarrow> Inf (insert x S) = (if S = {} then x else min x (Inf S))"
 | 
| 53282 | 2954 | apply (rule Inf_insert) | 
| 2955 | apply (rule finite_imp_bounded) | |
| 2956 | apply simp | |
| 2957 | done | |
| 33270 | 2958 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2959 | subsection {* Compactness *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2960 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2961 | subsubsection {* Bolzano-Weierstrass property *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2962 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2963 | lemma heine_borel_imp_bolzano_weierstrass: | 
| 53640 | 2964 | assumes "compact s" | 
| 2965 | and "infinite t" | |
| 2966 | and "t \<subseteq> s" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2967 | shows "\<exists>x \<in> s. x islimpt t" | 
| 53291 | 2968 | proof (rule ccontr) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2969 | assume "\<not> (\<exists>x \<in> s. x islimpt t)" | 
| 53640 | 2970 | then obtain f where f: "\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)" | 
| 52624 | 2971 | unfolding islimpt_def | 
| 53282 | 2972 | using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] | 
| 2973 | by auto | |
| 53640 | 2974 |   obtain g where g: "g \<subseteq> {t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
 | 
| 52624 | 2975 |     using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]]
 | 
| 2976 | using f by auto | |
| 53640 | 2977 | from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" | 
| 2978 | by auto | |
| 52624 | 2979 |   {
 | 
| 2980 | fix x y | |
| 53640 | 2981 | assume "x \<in> t" "y \<in> t" "f x = f y" | 
| 53282 | 2982 | then have "x \<in> f x" "y \<in> f x \<longrightarrow> y = x" | 
| 53640 | 2983 | using f[THEN bspec[where x=x]] and `t \<subseteq> s` by auto | 
| 53282 | 2984 | then have "x = y" | 
| 53640 | 2985 | using `f x = f y` and f[THEN bspec[where x=y]] and `y \<in> t` and `t \<subseteq> s` | 
| 2986 | by auto | |
| 52624 | 2987 | } | 
| 53282 | 2988 | then have "inj_on f t" | 
| 52624 | 2989 | unfolding inj_on_def by simp | 
| 53282 | 2990 | then have "infinite (f ` t)" | 
| 52624 | 2991 | using assms(2) using finite_imageD by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2992 | moreover | 
| 52624 | 2993 |   {
 | 
| 2994 | fix x | |
| 53640 | 2995 | assume "x \<in> t" "f x \<notin> g" | 
| 2996 | from g(3) assms(3) `x \<in> t` obtain h where "h \<in> g" and "x \<in> h" | |
| 2997 | by auto | |
| 2998 | then obtain y where "y \<in> s" "h = f y" | |
| 52624 | 2999 | using g'[THEN bspec[where x=h]] by auto | 
| 53282 | 3000 | then have "y = x" | 
| 53640 | 3001 | using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] | 
| 3002 | by auto | |
| 53282 | 3003 | then have False | 
| 53640 | 3004 | using `f x \<notin> g` `h \<in> g` unfolding `h = f y` | 
| 3005 | by auto | |
| 52624 | 3006 | } | 
| 53282 | 3007 | then have "f ` t \<subseteq> g" by auto | 
| 52624 | 3008 | ultimately show False | 
| 3009 | using g(2) using finite_subset by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3010 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3011 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3012 | lemma acc_point_range_imp_convergent_subsequence: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3013 | fixes l :: "'a :: first_countable_topology" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3014 | assumes l: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> range f)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3015 | shows "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3016 | proof - | 
| 55522 | 3017 | from countable_basis_at_decseq[of l] | 
| 3018 | obtain A where A: | |
| 3019 | "\<And>i. open (A i)" | |
| 3020 | "\<And>i. l \<in> A i" | |
| 3021 | "\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 3022 | by blast | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3023 | def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)" | 
| 52624 | 3024 |   {
 | 
| 3025 | fix n i | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3026 |     have "infinite (A (Suc n) \<inter> range f - f`{.. i})"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3027 | using l A by auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3028 |     then have "\<exists>x. x \<in> A (Suc n) \<inter> range f - f`{.. i}"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3029 | unfolding ex_in_conv by (intro notI) simp | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3030 |     then have "\<exists>j. f j \<in> A (Suc n) \<and> j \<notin> {.. i}"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3031 | by auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3032 | then have "\<exists>a. i < a \<and> f a \<in> A (Suc n)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3033 | by (auto simp: not_le) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3034 | then have "i < s n i" "f (s n i) \<in> A (Suc n)" | 
| 52624 | 3035 | unfolding s_def by (auto intro: someI2_ex) | 
| 3036 | } | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3037 | note s = this | 
| 55415 | 3038 | def r \<equiv> "rec_nat (s 0 0) s" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3039 | have "subseq r" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3040 | by (auto simp: r_def s subseq_Suc_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3041 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3042 | have "(\<lambda>n. f (r n)) ----> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3043 | proof (rule topological_tendstoI) | 
| 53282 | 3044 | fix S | 
| 3045 | assume "open S" "l \<in> S" | |
| 53640 | 3046 | with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" | 
| 3047 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3048 | moreover | 
| 52624 | 3049 |     {
 | 
| 3050 | fix i | |
| 53282 | 3051 | assume "Suc 0 \<le> i" | 
| 3052 | then have "f (r i) \<in> A i" | |
| 52624 | 3053 | by (cases i) (simp_all add: r_def s) | 
| 3054 | } | |
| 3055 | then have "eventually (\<lambda>i. f (r i) \<in> A i) sequentially" | |
| 3056 | by (auto simp: eventually_sequentially) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3057 | ultimately show "eventually (\<lambda>i. f (r i) \<in> S) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3058 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3059 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3060 | ultimately show "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3061 | by (auto simp: convergent_def comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3062 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3063 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3064 | lemma sequence_infinite_lemma: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3065 | fixes f :: "nat \<Rightarrow> 'a::t1_space" | 
| 53282 | 3066 | assumes "\<forall>n. f n \<noteq> l" | 
| 3067 | and "(f ---> l) sequentially" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3068 | shows "infinite (range f)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3069 | proof | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3070 | assume "finite (range f)" | 
| 53640 | 3071 | then have "closed (range f)" | 
| 3072 | by (rule finite_imp_closed) | |
| 3073 | then have "open (- range f)" | |
| 3074 | by (rule open_Compl) | |
| 3075 | from assms(1) have "l \<in> - range f" | |
| 3076 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3077 | from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially" | 
| 53640 | 3078 | using `open (- range f)` `l \<in> - range f` | 
| 3079 | by (rule topological_tendstoD) | |
| 3080 | then show False | |
| 3081 | unfolding eventually_sequentially | |
| 3082 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3083 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3084 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3085 | lemma closure_insert: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3086 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3087 | shows "closure (insert x s) = insert x (closure s)" | 
| 52624 | 3088 | apply (rule closure_unique) | 
| 3089 | apply (rule insert_mono [OF closure_subset]) | |
| 3090 | apply (rule closed_insert [OF closed_closure]) | |
| 3091 | apply (simp add: closure_minimal) | |
| 3092 | done | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3093 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3094 | lemma islimpt_insert: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3095 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3096 | shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3097 | proof | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3098 | assume *: "x islimpt (insert a s)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3099 | show "x islimpt s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3100 | proof (rule islimptI) | 
| 53282 | 3101 | fix t | 
| 3102 | assume t: "x \<in> t" "open t" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3103 | show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3104 | proof (cases "x = a") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3105 | case True | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3106 | obtain y where "y \<in> insert a s" "y \<in> t" "y \<noteq> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3107 | using * t by (rule islimptE) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3108 | with `x = a` show ?thesis by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3109 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3110 | case False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3111 |       with t have t': "x \<in> t - {a}" "open (t - {a})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3112 | by (simp_all add: open_Diff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3113 |       obtain y where "y \<in> insert a s" "y \<in> t - {a}" "y \<noteq> x"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3114 | using * t' by (rule islimptE) | 
| 53282 | 3115 | then show ?thesis by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3116 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3117 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3118 | next | 
| 53282 | 3119 | assume "x islimpt s" | 
| 3120 | then show "x islimpt (insert a s)" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3121 | by (rule islimpt_subset) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3122 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3123 | |
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 3124 | lemma islimpt_finite: | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 3125 | fixes x :: "'a::t1_space" | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 3126 | shows "finite s \<Longrightarrow> \<not> x islimpt s" | 
| 52624 | 3127 | by (induct set: finite) (simp_all add: islimpt_insert) | 
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 3128 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3129 | lemma islimpt_union_finite: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3130 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3131 | shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t" | 
| 52624 | 3132 | by (simp add: islimpt_Un islimpt_finite) | 
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 3133 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3134 | lemma islimpt_eq_acc_point: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3135 | fixes l :: "'a :: t1_space" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3136 | shows "l islimpt S \<longleftrightarrow> (\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S))" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3137 | proof (safe intro!: islimptI) | 
| 53282 | 3138 | fix U | 
| 3139 | assume "l islimpt S" "l \<in> U" "open U" "finite (U \<inter> S)" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3140 |   then have "l islimpt S" "l \<in> (U - (U \<inter> S - {l}))" "open (U - (U \<inter> S - {l}))"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3141 | by (auto intro: finite_imp_closed) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3142 | then show False | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3143 | by (rule islimptE) auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3144 | next | 
| 53282 | 3145 | fix T | 
| 3146 | assume *: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)" "l \<in> T" "open T" | |
| 3147 |   then have "infinite (T \<inter> S - {l})"
 | |
| 3148 | by auto | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3149 |   then have "\<exists>x. x \<in> (T \<inter> S - {l})"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3150 | unfolding ex_in_conv by (intro notI) simp | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3151 | then show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> l" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3152 | by auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3153 | qed | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3154 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3155 | lemma islimpt_range_imp_convergent_subsequence: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3156 |   fixes l :: "'a :: {t1_space, first_countable_topology}"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3157 | assumes l: "l islimpt (range f)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3158 | shows "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3159 | using l unfolding islimpt_eq_acc_point | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3160 | by (rule acc_point_range_imp_convergent_subsequence) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3161 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3162 | lemma sequence_unique_limpt: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3163 | fixes f :: "nat \<Rightarrow> 'a::t2_space" | 
| 53282 | 3164 | assumes "(f ---> l) sequentially" | 
| 3165 | and "l' islimpt (range f)" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3166 | shows "l' = l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3167 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3168 | assume "l' \<noteq> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3169 |   obtain s t where "open s" "open t" "l' \<in> s" "l \<in> t" "s \<inter> t = {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3170 | using hausdorff [OF `l' \<noteq> l`] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3171 | have "eventually (\<lambda>n. f n \<in> t) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3172 | using assms(1) `open t` `l \<in> t` by (rule topological_tendstoD) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3173 | then obtain N where "\<forall>n\<ge>N. f n \<in> t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3174 | unfolding eventually_sequentially by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3175 | |
| 53282 | 3176 |   have "UNIV = {..<N} \<union> {N..}"
 | 
| 3177 | by auto | |
| 3178 |   then have "l' islimpt (f ` ({..<N} \<union> {N..}))"
 | |
| 3179 | using assms(2) by simp | |
| 3180 |   then have "l' islimpt (f ` {..<N} \<union> f ` {N..})"
 | |
| 3181 | by (simp add: image_Un) | |
| 3182 |   then have "l' islimpt (f ` {N..})"
 | |
| 3183 | by (simp add: islimpt_union_finite) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3184 |   then obtain y where "y \<in> f ` {N..}" "y \<in> s" "y \<noteq> l'"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3185 | using `l' \<in> s` `open s` by (rule islimptE) | 
| 53282 | 3186 | then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'" | 
| 3187 | by auto | |
| 3188 | with `\<forall>n\<ge>N. f n \<in> t` have "f n \<in> s \<inter> t" | |
| 3189 | by simp | |
| 3190 |   with `s \<inter> t = {}` show False
 | |
| 3191 | by simp | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3192 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3193 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3194 | lemma bolzano_weierstrass_imp_closed: | 
| 53640 | 3195 |   fixes s :: "'a::{first_countable_topology,t2_space} set"
 | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3196 | assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3197 | shows "closed s" | 
| 52624 | 3198 | proof - | 
| 3199 |   {
 | |
| 3200 | fix x l | |
| 3201 | assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially" | |
| 53282 | 3202 | then have "l \<in> s" | 
| 52624 | 3203 | proof (cases "\<forall>n. x n \<noteq> l") | 
| 3204 | case False | |
| 53282 | 3205 | then show "l\<in>s" using as(1) by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3206 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3207 | case True note cas = this | 
| 52624 | 3208 | with as(2) have "infinite (range x)" | 
| 3209 | using sequence_infinite_lemma[of x l] by auto | |
| 3210 | then obtain l' where "l'\<in>s" "l' islimpt (range x)" | |
| 3211 | using assms[THEN spec[where x="range x"]] as(1) by auto | |
| 53282 | 3212 | then show "l\<in>s" using sequence_unique_limpt[of x l l'] | 
| 52624 | 3213 | using as cas by auto | 
| 3214 | qed | |
| 3215 | } | |
| 53282 | 3216 | then show ?thesis | 
| 3217 | unfolding closed_sequential_limits by fast | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3218 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3219 | |
| 50944 | 3220 | lemma compact_imp_bounded: | 
| 52624 | 3221 | assumes "compact U" | 
| 3222 | shows "bounded U" | |
| 50944 | 3223 | proof - | 
| 52624 | 3224 | have "compact U" "\<forall>x\<in>U. open (ball x 1)" "U \<subseteq> (\<Union>x\<in>U. ball x 1)" | 
| 3225 | using assms by auto | |
| 50944 | 3226 | then obtain D where D: "D \<subseteq> U" "finite D" "U \<subseteq> (\<Union>x\<in>D. ball x 1)" | 
| 52624 | 3227 | by (rule compactE_image) | 
| 50955 | 3228 | from `finite D` have "bounded (\<Union>x\<in>D. ball x 1)" | 
| 3229 | by (simp add: bounded_UN) | |
| 53282 | 3230 | then show "bounded U" using `U \<subseteq> (\<Union>x\<in>D. ball x 1)` | 
| 50955 | 3231 | by (rule bounded_subset) | 
| 50944 | 3232 | qed | 
| 3233 | ||
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3234 | text{* In particular, some common special cases. *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3235 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3236 | lemma compact_union [intro]: | 
| 53291 | 3237 | assumes "compact s" | 
| 3238 | and "compact t" | |
| 53282 | 3239 | shows " compact (s \<union> t)" | 
| 50898 | 3240 | proof (rule compactI) | 
| 52624 | 3241 | fix f | 
| 3242 | assume *: "Ball f open" "s \<union> t \<subseteq> \<Union>f" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3243 | from * `compact s` obtain s' where "s' \<subseteq> f \<and> finite s' \<and> s \<subseteq> \<Union>s'" | 
| 56073 
29e308b56d23
enhanced simplifier solver for preconditions of rewrite rule, can now deal with conjunctions
 nipkow parents: 
55927diff
changeset | 3244 | unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) | 
| 52624 | 3245 | moreover | 
| 3246 | from * `compact t` obtain t' where "t' \<subseteq> f \<and> finite t' \<and> t \<subseteq> \<Union>t'" | |
| 56073 
29e308b56d23
enhanced simplifier solver for preconditions of rewrite rule, can now deal with conjunctions
 nipkow parents: 
55927diff
changeset | 3247 | unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3248 | ultimately show "\<exists>f'\<subseteq>f. finite f' \<and> s \<union> t \<subseteq> \<Union>f'" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3249 | by (auto intro!: exI[of _ "s' \<union> t'"]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3250 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3251 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3252 | lemma compact_Union [intro]: "finite S \<Longrightarrow> (\<And>T. T \<in> S \<Longrightarrow> compact T) \<Longrightarrow> compact (\<Union>S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3253 | by (induct set: finite) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3254 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3255 | lemma compact_UN [intro]: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3256 | "finite A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> compact (B x)) \<Longrightarrow> compact (\<Union>x\<in>A. B x)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3257 | unfolding SUP_def by (rule compact_Union) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3258 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3259 | lemma closed_inter_compact [intro]: | 
| 53282 | 3260 | assumes "closed s" | 
| 3261 | and "compact t" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3262 | shows "compact (s \<inter> t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3263 | using compact_inter_closed [of t s] assms | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3264 | by (simp add: Int_commute) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3265 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3266 | lemma compact_inter [intro]: | 
| 50898 | 3267 | fixes s t :: "'a :: t2_space set" | 
| 53282 | 3268 | assumes "compact s" | 
| 3269 | and "compact t" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3270 | shows "compact (s \<inter> t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3271 | using assms by (intro compact_inter_closed compact_imp_closed) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3272 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3273 | lemma compact_sing [simp]: "compact {a}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3274 | unfolding compact_eq_heine_borel by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3275 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3276 | lemma compact_insert [simp]: | 
| 53282 | 3277 | assumes "compact s" | 
| 3278 | shows "compact (insert x s)" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3279 | proof - | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3280 |   have "compact ({x} \<union> s)"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3281 | using compact_sing assms by (rule compact_union) | 
| 53282 | 3282 | then show ?thesis by simp | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3283 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3284 | |
| 52624 | 3285 | lemma finite_imp_compact: "finite s \<Longrightarrow> compact s" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3286 | by (induct set: finite) simp_all | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3287 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3288 | lemma open_delete: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3289 | fixes s :: "'a::t1_space set" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3290 |   shows "open s \<Longrightarrow> open (s - {x})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3291 | by (simp add: open_Diff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3292 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3293 | text{*Compactness expressed with filters*}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3294 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3295 | lemma closure_iff_nhds_not_empty: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3296 |   "x \<in> closure X \<longleftrightarrow> (\<forall>A. \<forall>S\<subseteq>A. open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3297 | proof safe | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3298 | assume x: "x \<in> closure X" | 
| 53282 | 3299 | fix S A | 
| 3300 |   assume "open S" "x \<in> S" "X \<inter> A = {}" "S \<subseteq> A"
 | |
| 3301 | then have "x \<notin> closure (-S)" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3302 | by (auto simp: closure_complement subset_eq[symmetric] intro: interiorI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3303 | with x have "x \<in> closure X - closure (-S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3304 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3305 | also have "\<dots> \<subseteq> closure (X \<inter> S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3306 | using `open S` open_inter_closure_subset[of S X] by (simp add: closed_Compl ac_simps) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3307 |   finally have "X \<inter> S \<noteq> {}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3308 |   then show False using `X \<inter> A = {}` `S \<subseteq> A` by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3309 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3310 |   assume "\<forall>A S. S \<subseteq> A \<longrightarrow> open S \<longrightarrow> x \<in> S \<longrightarrow> X \<inter> A \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3311 | from this[THEN spec, of "- X", THEN spec, of "- closure X"] | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3312 | show "x \<in> closure X" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3313 | by (simp add: closure_subset open_Compl) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3314 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3315 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3316 | lemma compact_filter: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3317 | "compact U \<longleftrightarrow> (\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot))" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3318 | proof (intro allI iffI impI compact_fip[THEN iffD2] notI) | 
| 53282 | 3319 | fix F | 
| 3320 | assume "compact U" | |
| 3321 | assume F: "F \<noteq> bot" "eventually (\<lambda>x. x \<in> U) F" | |
| 3322 |   then have "U \<noteq> {}"
 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3323 | by (auto simp: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3324 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3325 |   def Z \<equiv> "closure ` {A. eventually (\<lambda>x. x \<in> A) F}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3326 | then have "\<forall>z\<in>Z. closed z" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3327 | by auto | 
| 53282 | 3328 | moreover | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3329 | have ev_Z: "\<And>z. z \<in> Z \<Longrightarrow> eventually (\<lambda>x. x \<in> z) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3330 | unfolding Z_def by (auto elim: eventually_elim1 intro: set_mp[OF closure_subset]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3331 |   have "(\<forall>B \<subseteq> Z. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3332 | proof (intro allI impI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3333 | fix B assume "finite B" "B \<subseteq> Z" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3334 | with `finite B` ev_Z have "eventually (\<lambda>x. \<forall>b\<in>B. x \<in> b) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3335 | by (auto intro!: eventually_Ball_finite) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3336 | with F(2) have "eventually (\<lambda>x. x \<in> U \<inter> (\<Inter>B)) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3337 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3338 |     with F show "U \<inter> \<Inter>B \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3339 | by (intro notI) (simp add: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3340 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3341 |   ultimately have "U \<inter> \<Inter>Z \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3342 | using `compact U` unfolding compact_fip by blast | 
| 53282 | 3343 | then obtain x where "x \<in> U" and x: "\<And>z. z \<in> Z \<Longrightarrow> x \<in> z" | 
| 3344 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3345 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3346 | have "\<And>P. eventually P (inf (nhds x) F) \<Longrightarrow> P \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3347 | unfolding eventually_inf eventually_nhds | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3348 | proof safe | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3349 | fix P Q R S | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3350 | assume "eventually R F" "open S" "x \<in> S" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3351 |     with open_inter_closure_eq_empty[of S "{x. R x}"] x[of "closure {x. R x}"]
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3352 |     have "S \<inter> {x. R x} \<noteq> {}" by (auto simp: Z_def)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3353 | moreover assume "Ball S Q" "\<forall>x. Q x \<and> R x \<longrightarrow> bot x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3354 | ultimately show False by (auto simp: set_eq_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3355 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3356 | with `x \<in> U` show "\<exists>x\<in>U. inf (nhds x) F \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3357 | by (metis eventually_bot) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3358 | next | 
| 53282 | 3359 | fix A | 
| 3360 |   assume A: "\<forall>a\<in>A. closed a" "\<forall>B\<subseteq>A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" "U \<inter> \<Inter>A = {}"
 | |
| 57276 | 3361 | def F \<equiv> "INF a:insert U A. principal a" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3362 | have "F \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3363 | unfolding F_def | 
| 57276 | 3364 | proof (rule INF_filter_not_bot) | 
| 3365 | fix X assume "X \<subseteq> insert U A" "finite X" | |
| 3366 |     moreover with A(2)[THEN spec, of "X - {U}"] have "U \<inter> \<Inter>(X - {U}) \<noteq> {}"
 | |
| 53282 | 3367 | by auto | 
| 57276 | 3368 | ultimately show "(INF a:X. principal a) \<noteq> bot" | 
| 3369 | by (auto simp add: INF_principal_finite principal_eq_bot_iff) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3370 | qed | 
| 57276 | 3371 | moreover | 
| 3372 | have "F \<le> principal U" | |
| 3373 | unfolding F_def by auto | |
| 3374 | then have "eventually (\<lambda>x. x \<in> U) F" | |
| 3375 | by (auto simp: le_filter_def eventually_principal) | |
| 53282 | 3376 | moreover | 
| 3377 | assume "\<forall>F. F \<noteq> bot \<longrightarrow> eventually (\<lambda>x. x \<in> U) F \<longrightarrow> (\<exists>x\<in>U. inf (nhds x) F \<noteq> bot)" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3378 | ultimately obtain x where "x \<in> U" and x: "inf (nhds x) F \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3379 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3380 | |
| 57276 | 3381 |   { fix V assume "V \<in> A"
 | 
| 3382 | then have "F \<le> principal V" | |
| 3383 | unfolding F_def by (intro INF_lower2[of V]) auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3384 | then have V: "eventually (\<lambda>x. x \<in> V) F" | 
| 57276 | 3385 | by (auto simp: le_filter_def eventually_principal) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3386 | have "x \<in> closure V" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3387 | unfolding closure_iff_nhds_not_empty | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3388 | proof (intro impI allI) | 
| 53282 | 3389 | fix S A | 
| 3390 | assume "open S" "x \<in> S" "S \<subseteq> A" | |
| 3391 | then have "eventually (\<lambda>x. x \<in> A) (nhds x)" | |
| 3392 | by (auto simp: eventually_nhds) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3393 | with V have "eventually (\<lambda>x. x \<in> V \<inter> A) (inf (nhds x) F)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3394 | by (auto simp: eventually_inf) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3395 |       with x show "V \<inter> A \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3396 | by (auto simp del: Int_iff simp add: trivial_limit_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3397 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3398 | then have "x \<in> V" | 
| 53282 | 3399 | using `V \<in> A` A(1) by simp | 
| 3400 | } | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3401 | with `x\<in>U` have "x \<in> U \<inter> \<Inter>A" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3402 |   with `U \<inter> \<Inter>A = {}` show False by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3403 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3404 | |
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3405 | definition "countably_compact U \<longleftrightarrow> | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3406 | (\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T))" | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3407 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3408 | lemma countably_compactE: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3409 | assumes "countably_compact s" and "\<forall>t\<in>C. open t" and "s \<subseteq> \<Union>C" "countable C" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3410 | obtains C' where "C' \<subseteq> C" and "finite C'" and "s \<subseteq> \<Union>C'" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3411 | using assms unfolding countably_compact_def by metis | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3412 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3413 | lemma countably_compactI: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3414 | assumes "\<And>C. \<forall>t\<in>C. open t \<Longrightarrow> s \<subseteq> \<Union>C \<Longrightarrow> countable C \<Longrightarrow> (\<exists>C'\<subseteq>C. finite C' \<and> s \<subseteq> \<Union>C')" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3415 | shows "countably_compact s" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3416 | using assms unfolding countably_compact_def by metis | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3417 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3418 | lemma compact_imp_countably_compact: "compact U \<Longrightarrow> countably_compact U" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3419 | by (auto simp: compact_eq_heine_borel countably_compact_def) | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3420 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3421 | lemma countably_compact_imp_compact: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3422 | assumes "countably_compact U" | 
| 53282 | 3423 | and ccover: "countable B" "\<forall>b\<in>B. open b" | 
| 3424 | and basis: "\<And>T x. open T \<Longrightarrow> x \<in> T \<Longrightarrow> x \<in> U \<Longrightarrow> \<exists>b\<in>B. x \<in> b \<and> b \<inter> U \<subseteq> T" | |
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3425 | shows "compact U" | 
| 53282 | 3426 | using `countably_compact U` | 
| 3427 | unfolding compact_eq_heine_borel countably_compact_def | |
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3428 | proof safe | 
| 53282 | 3429 | fix A | 
| 3430 | assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3431 | assume *: "\<forall>A. countable A \<longrightarrow> (\<forall>a\<in>A. open a) \<longrightarrow> U \<subseteq> \<Union>A \<longrightarrow> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)" | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3432 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3433 |   moreover def C \<equiv> "{b\<in>B. \<exists>a\<in>A. b \<inter> U \<subseteq> a}"
 | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3434 | ultimately have "countable C" "\<forall>a\<in>C. open a" | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3435 | unfolding C_def using ccover by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3436 | moreover | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3437 | have "\<Union>A \<inter> U \<subseteq> \<Union>C" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3438 | proof safe | 
| 53282 | 3439 | fix x a | 
| 3440 | assume "x \<in> U" "x \<in> a" "a \<in> A" | |
| 3441 | with basis[of a x] A obtain b where "b \<in> B" "x \<in> b" "b \<inter> U \<subseteq> a" | |
| 3442 | by blast | |
| 3443 | with `a \<in> A` show "x \<in> \<Union>C" | |
| 3444 | unfolding C_def by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3445 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3446 | then have "U \<subseteq> \<Union>C" using `U \<subseteq> \<Union>A` by auto | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 3447 | ultimately obtain T where T: "T\<subseteq>C" "finite T" "U \<subseteq> \<Union>T" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3448 | using * by metis | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 3449 | then have "\<forall>t\<in>T. \<exists>a\<in>A. t \<inter> U \<subseteq> a" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3450 | by (auto simp: C_def) | 
| 55522 | 3451 | then obtain f where "\<forall>t\<in>T. f t \<in> A \<and> t \<inter> U \<subseteq> f t" | 
| 3452 | unfolding bchoice_iff Bex_def .. | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 3453 | with T show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3454 | unfolding C_def by (intro exI[of _ "f`T"]) fastforce | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3455 | qed | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3456 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3457 | lemma countably_compact_imp_compact_second_countable: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3458 | "countably_compact U \<Longrightarrow> compact (U :: 'a :: second_countable_topology set)" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3459 | proof (rule countably_compact_imp_compact) | 
| 53282 | 3460 | fix T and x :: 'a | 
| 3461 | assume "open T" "x \<in> T" | |
| 55522 | 3462 | from topological_basisE[OF is_basis this] obtain b where | 
| 3463 | "b \<in> (SOME B. countable B \<and> topological_basis B)" "x \<in> b" "b \<subseteq> T" . | |
| 53282 | 3464 | then show "\<exists>b\<in>SOME B. countable B \<and> topological_basis B. x \<in> b \<and> b \<inter> U \<subseteq> T" | 
| 55522 | 3465 | by blast | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3466 | qed (insert countable_basis topological_basis_open[OF is_basis], auto) | 
| 36437 | 3467 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3468 | lemma countably_compact_eq_compact: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3469 | "countably_compact U \<longleftrightarrow> compact (U :: 'a :: second_countable_topology set)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3470 | using countably_compact_imp_compact_second_countable compact_imp_countably_compact by blast | 
| 53282 | 3471 | |
| 36437 | 3472 | subsubsection{* Sequential compactness *}
 | 
| 33175 | 3473 | |
| 53282 | 3474 | definition seq_compact :: "'a::topological_space set \<Rightarrow> bool" | 
| 3475 | where "seq_compact S \<longleftrightarrow> | |
| 53640 | 3476 | (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially))" | 
| 33175 | 3477 | |
| 54070 | 3478 | lemma seq_compactI: | 
| 3479 | assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | |
| 3480 | shows "seq_compact S" | |
| 3481 | unfolding seq_compact_def using assms by fast | |
| 3482 | ||
| 3483 | lemma seq_compactE: | |
| 3484 | assumes "seq_compact S" "\<forall>n. f n \<in> S" | |
| 3485 | obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) ---> l) sequentially" | |
| 3486 | using assms unfolding seq_compact_def by fast | |
| 3487 | ||
| 3488 | lemma closed_sequentially: (* TODO: move upwards *) | |
| 3489 | assumes "closed s" and "\<forall>n. f n \<in> s" and "f ----> l" | |
| 3490 | shows "l \<in> s" | |
| 3491 | proof (rule ccontr) | |
| 3492 | assume "l \<notin> s" | |
| 3493 | with `closed s` and `f ----> l` have "eventually (\<lambda>n. f n \<in> - s) sequentially" | |
| 3494 | by (fast intro: topological_tendstoD) | |
| 3495 | with `\<forall>n. f n \<in> s` show "False" | |
| 3496 | by simp | |
| 3497 | qed | |
| 3498 | ||
| 3499 | lemma seq_compact_inter_closed: | |
| 3500 | assumes "seq_compact s" and "closed t" | |
| 3501 | shows "seq_compact (s \<inter> t)" | |
| 3502 | proof (rule seq_compactI) | |
| 3503 | fix f assume "\<forall>n::nat. f n \<in> s \<inter> t" | |
| 3504 | hence "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t" | |
| 3505 | by simp_all | |
| 3506 | from `seq_compact s` and `\<forall>n. f n \<in> s` | |
| 3507 | obtain l r where "l \<in> s" and r: "subseq r" and l: "(f \<circ> r) ----> l" | |
| 3508 | by (rule seq_compactE) | |
| 3509 | from `\<forall>n. f n \<in> t` have "\<forall>n. (f \<circ> r) n \<in> t" | |
| 3510 | by simp | |
| 3511 | from `closed t` and this and l have "l \<in> t" | |
| 3512 | by (rule closed_sequentially) | |
| 3513 | with `l \<in> s` and r and l show "\<exists>l\<in>s \<inter> t. \<exists>r. subseq r \<and> (f \<circ> r) ----> l" | |
| 3514 | by fast | |
| 3515 | qed | |
| 3516 | ||
| 3517 | lemma seq_compact_closed_subset: | |
| 3518 | assumes "closed s" and "s \<subseteq> t" and "seq_compact t" | |
| 3519 | shows "seq_compact s" | |
| 3520 | using assms seq_compact_inter_closed [of t s] by (simp add: Int_absorb1) | |
| 3521 | ||
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3522 | lemma seq_compact_imp_countably_compact: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3523 | fixes U :: "'a :: first_countable_topology set" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3524 | assumes "seq_compact U" | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3525 | shows "countably_compact U" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3526 | proof (safe intro!: countably_compactI) | 
| 52624 | 3527 | fix A | 
| 3528 | assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" "countable A" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3529 | have subseq: "\<And>X. range X \<subseteq> U \<Longrightarrow> \<exists>r x. x \<in> U \<and> subseq r \<and> (X \<circ> r) ----> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3530 | using `seq_compact U` by (fastforce simp: seq_compact_def subset_eq) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3531 | show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3532 | proof cases | 
| 52624 | 3533 | assume "finite A" | 
| 3534 | with A show ?thesis by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3535 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3536 | assume "infinite A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3537 |     then have "A \<noteq> {}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3538 | show ?thesis | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3539 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3540 | assume "\<not> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)" | 
| 53282 | 3541 | then have "\<forall>T. \<exists>x. T \<subseteq> A \<and> finite T \<longrightarrow> (x \<in> U - \<Union>T)" | 
| 3542 | by auto | |
| 3543 | then obtain X' where T: "\<And>T. T \<subseteq> A \<Longrightarrow> finite T \<Longrightarrow> X' T \<in> U - \<Union>T" | |
| 3544 | by metis | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3545 |       def X \<equiv> "\<lambda>n. X' (from_nat_into A ` {.. n})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3546 | have X: "\<And>n. X n \<in> U - (\<Union>i\<le>n. from_nat_into A i)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3547 |         using `A \<noteq> {}` unfolding X_def SUP_def by (intro T) (auto intro: from_nat_into)
 | 
| 53282 | 3548 | then have "range X \<subseteq> U" | 
| 3549 | by auto | |
| 3550 | with subseq[of X] obtain r x where "x \<in> U" and r: "subseq r" "(X \<circ> r) ----> x" | |
| 3551 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3552 | from `x\<in>U` `U \<subseteq> \<Union>A` from_nat_into_surj[OF `countable A`] | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3553 | obtain n where "x \<in> from_nat_into A n" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3554 |       with r(2) A(1) from_nat_into[OF `A \<noteq> {}`, of n]
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3555 | have "eventually (\<lambda>i. X (r i) \<in> from_nat_into A n) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3556 | unfolding tendsto_def by (auto simp: comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3557 | then obtain N where "\<And>i. N \<le> i \<Longrightarrow> X (r i) \<in> from_nat_into A n" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3558 | by (auto simp: eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3559 | moreover from X have "\<And>i. n \<le> r i \<Longrightarrow> X (r i) \<notin> from_nat_into A n" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3560 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3561 | moreover from `subseq r`[THEN seq_suble, of "max n N"] have "\<exists>i. n \<le> r i \<and> N \<le> i" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3562 | by (auto intro!: exI[of _ "max n N"]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3563 | ultimately show False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3564 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3565 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3566 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3567 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3568 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3569 | lemma compact_imp_seq_compact: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3570 | fixes U :: "'a :: first_countable_topology set" | 
| 53282 | 3571 | assumes "compact U" | 
| 3572 | shows "seq_compact U" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3573 | unfolding seq_compact_def | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3574 | proof safe | 
| 52624 | 3575 | fix X :: "nat \<Rightarrow> 'a" | 
| 3576 | assume "\<forall>n. X n \<in> U" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3577 | then have "eventually (\<lambda>x. x \<in> U) (filtermap X sequentially)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3578 | by (auto simp: eventually_filtermap) | 
| 52624 | 3579 | moreover | 
| 3580 | have "filtermap X sequentially \<noteq> bot" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3581 | by (simp add: trivial_limit_def eventually_filtermap) | 
| 52624 | 3582 | ultimately | 
| 3583 | obtain x where "x \<in> U" and x: "inf (nhds x) (filtermap X sequentially) \<noteq> bot" (is "?F \<noteq> _") | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3584 | using `compact U` by (auto simp: compact_filter) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3585 | |
| 55522 | 3586 | from countable_basis_at_decseq[of x] | 
| 3587 | obtain A where A: | |
| 3588 | "\<And>i. open (A i)" | |
| 3589 | "\<And>i. x \<in> A i" | |
| 3590 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially" | |
| 3591 | by blast | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3592 | def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> X j \<in> A (Suc n)" | 
| 52624 | 3593 |   {
 | 
| 3594 | fix n i | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3595 | have "\<exists>a. i < a \<and> X a \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3596 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3597 | assume "\<not> (\<exists>a>i. X a \<in> A (Suc n))" | 
| 53282 | 3598 | then have "\<And>a. Suc i \<le> a \<Longrightarrow> X a \<notin> A (Suc n)" | 
| 3599 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3600 | then have "eventually (\<lambda>x. x \<notin> A (Suc n)) (filtermap X sequentially)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3601 | by (auto simp: eventually_filtermap eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3602 | moreover have "eventually (\<lambda>x. x \<in> A (Suc n)) (nhds x)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3603 | using A(1,2)[of "Suc n"] by (auto simp: eventually_nhds) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3604 | ultimately have "eventually (\<lambda>x. False) ?F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3605 | by (auto simp add: eventually_inf) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3606 | with x show False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3607 | by (simp add: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3608 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3609 | then have "i < s n i" "X (s n i) \<in> A (Suc n)" | 
| 52624 | 3610 | unfolding s_def by (auto intro: someI2_ex) | 
| 3611 | } | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3612 | note s = this | 
| 55415 | 3613 | def r \<equiv> "rec_nat (s 0 0) s" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3614 | have "subseq r" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3615 | by (auto simp: r_def s subseq_Suc_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3616 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3617 | have "(\<lambda>n. X (r n)) ----> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3618 | proof (rule topological_tendstoI) | 
| 52624 | 3619 | fix S | 
| 3620 | assume "open S" "x \<in> S" | |
| 53282 | 3621 | with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" | 
| 3622 | by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3623 | moreover | 
| 52624 | 3624 |     {
 | 
| 3625 | fix i | |
| 3626 | assume "Suc 0 \<le> i" | |
| 3627 | then have "X (r i) \<in> A i" | |
| 3628 | by (cases i) (simp_all add: r_def s) | |
| 3629 | } | |
| 3630 | then have "eventually (\<lambda>i. X (r i) \<in> A i) sequentially" | |
| 3631 | by (auto simp: eventually_sequentially) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3632 | ultimately show "eventually (\<lambda>i. X (r i) \<in> S) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3633 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3634 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3635 | ultimately show "\<exists>x \<in> U. \<exists>r. subseq r \<and> (X \<circ> r) ----> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3636 | using `x \<in> U` by (auto simp: convergent_def comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3637 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3638 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3639 | lemma countably_compact_imp_acc_point: | 
| 53291 | 3640 | assumes "countably_compact s" | 
| 3641 | and "countable t" | |
| 3642 | and "infinite t" | |
| 3643 | and "t \<subseteq> s" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3644 | shows "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3645 | proof (rule ccontr) | 
| 53282 | 3646 |   def C \<equiv> "(\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<subseteq> t }"
 | 
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3647 | note `countably_compact s` | 
| 53282 | 3648 | moreover have "\<forall>t\<in>C. open t" | 
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3649 | by (auto simp: C_def) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3650 | moreover | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3651 | assume "\<not> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t))" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3652 | then have s: "\<And>x. x \<in> s \<Longrightarrow> \<exists>U. x\<in>U \<and> open U \<and> finite (U \<inter> t)" by metis | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3653 | have "s \<subseteq> \<Union>C" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3654 | using `t \<subseteq> s` | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3655 | unfolding C_def Union_image_eq | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3656 | apply (safe dest!: s) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3657 | apply (rule_tac a="U \<inter> t" in UN_I) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3658 | apply (auto intro!: interiorI simp add: finite_subset) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3659 | done | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3660 | moreover | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3661 | from `countable t` have "countable C" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3662 | unfolding C_def by (auto intro: countable_Collect_finite_subset) | 
| 55522 | 3663 | ultimately | 
| 3664 | obtain D where "D \<subseteq> C" "finite D" "s \<subseteq> \<Union>D" | |
| 3665 | by (rule countably_compactE) | |
| 53282 | 3666 |   then obtain E where E: "E \<subseteq> {F. finite F \<and> F \<subseteq> t }" "finite E"
 | 
| 3667 | and s: "s \<subseteq> (\<Union>F\<in>E. interior (F \<union> (- t)))" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3668 | by (metis (lifting) Union_image_eq finite_subset_image C_def) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3669 | from s `t \<subseteq> s` have "t \<subseteq> \<Union>E" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3670 | using interior_subset by blast | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3671 | moreover have "finite (\<Union>E)" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3672 | using E by auto | 
| 53282 | 3673 | ultimately show False using `infinite t` | 
| 3674 | by (auto simp: finite_subset) | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3675 | qed | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3676 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3677 | lemma countable_acc_point_imp_seq_compact: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3678 | fixes s :: "'a::first_countable_topology set" | 
| 53291 | 3679 | assumes "\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s \<longrightarrow> | 
| 3680 | (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t))" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3681 | shows "seq_compact s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3682 | proof - | 
| 52624 | 3683 |   {
 | 
| 3684 | fix f :: "nat \<Rightarrow> 'a" | |
| 3685 | assume f: "\<forall>n. f n \<in> s" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3686 | have "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3687 | proof (cases "finite (range f)") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3688 | case True | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3689 |       obtain l where "infinite {n. f n = f l}"
 | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3690 | using pigeonhole_infinite[OF _ True] by auto | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3691 | then obtain r where "subseq r" and fr: "\<forall>n. f (r n) = f l" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3692 | using infinite_enumerate by blast | 
| 53282 | 3693 | then have "subseq r \<and> (f \<circ> r) ----> f l" | 
| 58729 
e8ecc79aee43
add tendsto_const and tendsto_ident_at as simp and intro rules
 hoelzl parents: 
58184diff
changeset | 3694 | by (simp add: fr o_def) | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3695 | with f show "\<exists>l\<in>s. \<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 3696 | by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3697 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3698 | case False | 
| 53282 | 3699 | with f assms have "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> range f)" | 
| 3700 | by auto | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3701 | then obtain l where "l \<in> s" "\<forall>U. l\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> range f)" .. | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3702 | from this(2) have "\<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3703 | using acc_point_range_imp_convergent_subsequence[of l f] by auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3704 | with `l \<in> s` show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" .. | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3705 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3706 | } | 
| 53282 | 3707 | then show ?thesis | 
| 3708 | unfolding seq_compact_def by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3709 | qed | 
| 44075 | 3710 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3711 | lemma seq_compact_eq_countably_compact: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3712 | fixes U :: "'a :: first_countable_topology set" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3713 | shows "seq_compact U \<longleftrightarrow> countably_compact U" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3714 | using | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3715 | countable_acc_point_imp_seq_compact | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3716 | countably_compact_imp_acc_point | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3717 | seq_compact_imp_countably_compact | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3718 | by metis | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3719 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3720 | lemma seq_compact_eq_acc_point: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3721 | fixes s :: "'a :: first_countable_topology set" | 
| 53291 | 3722 | shows "seq_compact s \<longleftrightarrow> | 
| 3723 | (\<forall>t. infinite t \<and> countable t \<and> t \<subseteq> s --> (\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> t)))" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3724 | using | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3725 | countable_acc_point_imp_seq_compact[of s] | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3726 | countably_compact_imp_acc_point[of s] | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3727 | seq_compact_imp_countably_compact[of s] | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3728 | by metis | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3729 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3730 | lemma seq_compact_eq_compact: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3731 | fixes U :: "'a :: second_countable_topology set" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3732 | shows "seq_compact U \<longleftrightarrow> compact U" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3733 | using seq_compact_eq_countably_compact countably_compact_eq_compact by blast | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3734 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3735 | lemma bolzano_weierstrass_imp_seq_compact: | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3736 |   fixes s :: "'a::{t1_space, first_countable_topology} set"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3737 | shows "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t) \<Longrightarrow> seq_compact s" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3738 | by (rule countable_acc_point_imp_seq_compact) (metis islimpt_eq_acc_point) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3739 | |
| 58184 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3740 | subsubsection{* Totally bounded *}
 | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3741 | |
| 53282 | 3742 | lemma cauchy_def: "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)" | 
| 52624 | 3743 | unfolding Cauchy_def by metis | 
| 3744 | ||
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3745 | lemma seq_compact_imp_totally_bounded: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3746 | assumes "seq_compact s" | 
| 58184 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3747 | shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>x\<in>k. ball x e)" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3748 | proof - | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3749 |   { 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)"
 | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3750 | let ?Q = "\<lambda>x n r. r \<in> s \<and> (\<forall>m < (n::nat). \<not> (dist (x m) r < e))" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3751 | have "\<exists>x. \<forall>n::nat. ?Q x n (x n)" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3752 | proof (rule dependent_wellorder_choice) | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3753 | fix n x assume "\<And>y. y < n \<Longrightarrow> ?Q x y (x y)" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3754 |       then have "\<not> s \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)"
 | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3755 |         using *[of "x ` {0 ..< n}"] by (auto simp: subset_eq)
 | 
| 52624 | 3756 |       then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)"
 | 
| 3757 | unfolding subset_eq by auto | |
| 58184 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3758 | show "\<exists>r. ?Q x n r" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3759 | using z by auto | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3760 | qed simp | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3761 | 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)" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3762 | by blast | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3763 | then obtain l r where "l \<in> s" and r:"subseq r" and "((x \<circ> r) ---> l) sequentially" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3764 | using assms by (metis seq_compact_def) | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3765 | from this(3) have "Cauchy (x \<circ> r)" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3766 | using LIMSEQ_imp_Cauchy by auto | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3767 | 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" | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3768 | unfolding cauchy_def using `e > 0` by blast | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3769 | then have False | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3770 | using x[of "r N" "r (N+1)"] r by (auto simp: subseq_def) } | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3771 | then show ?thesis | 
| 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3772 | by metis | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3773 | qed | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3774 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3775 | subsubsection{* Heine-Borel theorem *}
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3776 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3777 | lemma seq_compact_imp_heine_borel: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3778 | fixes s :: "'a :: metric_space set" | 
| 53282 | 3779 | assumes "seq_compact s" | 
| 3780 | shows "compact s" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3781 | proof - | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3782 | from seq_compact_imp_totally_bounded[OF `seq_compact s`] | 
| 58184 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 3783 | 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)" | 
| 55522 | 3784 | unfolding choice_iff' .. | 
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3785 |   def K \<equiv> "(\<lambda>(x, r). ball x r) ` ((\<Union>e \<in> \<rat> \<inter> {0 <..}. f e) \<times> \<rat>)"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3786 | have "countably_compact s" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3787 | using `seq_compact s` by (rule seq_compact_imp_countably_compact) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3788 | then show "compact s" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3789 | proof (rule countably_compact_imp_compact) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3790 | show "countable K" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3791 | unfolding K_def using f | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3792 | by (auto intro: countable_finite countable_subset countable_rat | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3793 | intro!: countable_image countable_SIGMA countable_UN) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3794 | show "\<forall>b\<in>K. open b" by (auto simp: K_def) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3795 | next | 
| 53282 | 3796 | fix T x | 
| 3797 | assume T: "open T" "x \<in> T" and x: "x \<in> s" | |
| 3798 | from openE[OF T] obtain e where "0 < e" "ball x e \<subseteq> T" | |
| 3799 | by auto | |
| 3800 | then have "0 < e / 2" "ball x (e / 2) \<subseteq> T" | |
| 3801 | by auto | |
| 3802 | from Rats_dense_in_real[OF `0 < e / 2`] obtain r where "r \<in> \<rat>" "0 < r" "r < e / 2" | |
| 3803 | by auto | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3804 | from f[rule_format, of r] `0 < r` `x \<in> s` obtain k where "k \<in> f r" "x \<in> ball k r" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3805 | unfolding Union_image_eq by auto | 
| 53282 | 3806 | from `r \<in> \<rat>` `0 < r` `k \<in> f r` have "ball k r \<in> K" | 
| 3807 | by (auto simp: K_def) | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3808 | then show "\<exists>b\<in>K. x \<in> b \<and> b \<inter> s \<subseteq> T" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3809 | proof (rule bexI[rotated], safe) | 
| 53282 | 3810 | fix y | 
| 3811 | assume "y \<in> ball k r" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3812 | with `r < e / 2` `x \<in> ball k r` have "dist x y < e" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3813 | by (intro dist_double[where x = k and d=e]) (auto simp: dist_commute) | 
| 53282 | 3814 | with `ball x e \<subseteq> T` show "y \<in> T" | 
| 3815 | by auto | |
| 3816 | next | |
| 3817 | show "x \<in> ball k r" by fact | |
| 3818 | qed | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3819 | qed | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3820 | qed | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3821 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3822 | lemma compact_eq_seq_compact_metric: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3823 | "compact (s :: 'a::metric_space set) \<longleftrightarrow> seq_compact s" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3824 | using compact_imp_seq_compact seq_compact_imp_heine_borel by blast | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3825 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3826 | lemma compact_def: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3827 | "compact (S :: 'a::metric_space set) \<longleftrightarrow> | 
| 53640 | 3828 | (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> (f \<circ> r) ----> l))" | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3829 | unfolding compact_eq_seq_compact_metric seq_compact_def by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3830 | |
| 50944 | 3831 | subsubsection {* Complete the chain of compactness variants *}
 | 
| 3832 | ||
| 3833 | lemma compact_eq_bolzano_weierstrass: | |
| 3834 | fixes s :: "'a::metric_space set" | |
| 53282 | 3835 | shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" | 
| 3836 | (is "?lhs = ?rhs") | |
| 50944 | 3837 | proof | 
| 52624 | 3838 | assume ?lhs | 
| 53282 | 3839 | then show ?rhs | 
| 3840 | using heine_borel_imp_bolzano_weierstrass[of s] by auto | |
| 50944 | 3841 | next | 
| 52624 | 3842 | assume ?rhs | 
| 53282 | 3843 | then show ?lhs | 
| 50944 | 3844 | unfolding compact_eq_seq_compact_metric by (rule bolzano_weierstrass_imp_seq_compact) | 
| 3845 | qed | |
| 3846 | ||
| 3847 | lemma bolzano_weierstrass_imp_bounded: | |
| 53282 | 3848 | "\<forall>t. infinite t \<and> t \<subseteq> s \<longrightarrow> (\<exists>x \<in> s. x islimpt t) \<Longrightarrow> bounded s" | 
| 50944 | 3849 | using compact_imp_bounded unfolding compact_eq_bolzano_weierstrass . | 
| 3850 | ||
| 54070 | 3851 | subsection {* Metric spaces with the Heine-Borel property *}
 | 
| 3852 | ||
| 33175 | 3853 | text {*
 | 
| 3854 | A metric space (or topological vector space) is said to have the | |
| 3855 | Heine-Borel property if every closed and bounded subset is compact. | |
| 3856 | *} | |
| 3857 | ||
| 44207 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 3858 | class heine_borel = metric_space + | 
| 33175 | 3859 | assumes bounded_imp_convergent_subsequence: | 
| 50998 | 3860 | "bounded (range f) \<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | 
| 33175 | 3861 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3862 | lemma bounded_closed_imp_seq_compact: | 
| 33175 | 3863 | fixes s::"'a::heine_borel set" | 
| 53282 | 3864 | assumes "bounded s" | 
| 3865 | and "closed s" | |
| 3866 | shows "seq_compact s" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3867 | proof (unfold seq_compact_def, clarify) | 
| 53282 | 3868 | fix f :: "nat \<Rightarrow> 'a" | 
| 3869 | assume f: "\<forall>n. f n \<in> s" | |
| 3870 | with `bounded s` have "bounded (range f)" | |
| 3871 | by (auto intro: bounded_subset) | |
| 33175 | 3872 | obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially" | 
| 50998 | 3873 | using bounded_imp_convergent_subsequence [OF `bounded (range f)`] by auto | 
| 53282 | 3874 | from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" | 
| 3875 | by simp | |
| 33175 | 3876 | have "l \<in> s" using `closed s` fr l | 
| 54070 | 3877 | by (rule closed_sequentially) | 
| 33175 | 3878 | show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | 
| 3879 | using `l \<in> s` r l by blast | |
| 3880 | qed | |
| 3881 | ||
| 50944 | 3882 | lemma compact_eq_bounded_closed: | 
| 3883 | fixes s :: "'a::heine_borel set" | |
| 53291 | 3884 | shows "compact s \<longleftrightarrow> bounded s \<and> closed s" | 
| 3885 | (is "?lhs = ?rhs") | |
| 50944 | 3886 | proof | 
| 52624 | 3887 | assume ?lhs | 
| 53282 | 3888 | then show ?rhs | 
| 52624 | 3889 | using compact_imp_closed compact_imp_bounded | 
| 3890 | by blast | |
| 50944 | 3891 | next | 
| 52624 | 3892 | assume ?rhs | 
| 53282 | 3893 | then show ?lhs | 
| 52624 | 3894 | using bounded_closed_imp_seq_compact[of s] | 
| 3895 | unfolding compact_eq_seq_compact_metric | |
| 3896 | by auto | |
| 50944 | 3897 | qed | 
| 3898 | ||
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 3899 | (* TODO: is this lemma necessary? *) | 
| 50972 | 3900 | lemma bounded_increasing_convergent: | 
| 3901 | fixes s :: "nat \<Rightarrow> real" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 3902 |   shows "bounded {s n| n. True} \<Longrightarrow> \<forall>n. s n \<le> s (Suc n) \<Longrightarrow> \<exists>l. s ----> l"
 | 
| 50972 | 3903 | using Bseq_mono_convergent[of s] incseq_Suc_iff[of s] | 
| 3904 | by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def) | |
| 33175 | 3905 | |
| 3906 | instance real :: heine_borel | |
| 3907 | proof | |
| 50998 | 3908 | fix f :: "nat \<Rightarrow> real" | 
| 3909 | assume f: "bounded (range f)" | |
| 50972 | 3910 | obtain r where r: "subseq r" "monoseq (f \<circ> r)" | 
| 3911 | unfolding comp_def by (metis seq_monosub) | |
| 3912 | then have "Bseq (f \<circ> r)" | |
| 50998 | 3913 | unfolding Bseq_eq_bounded using f by (auto intro: bounded_subset) | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 3914 | with r show "\<exists>l r. subseq r \<and> (f \<circ> r) ----> l" | 
| 50972 | 3915 | using Bseq_monoseq_convergent[of "f \<circ> r"] by (auto simp: convergent_def) | 
| 33175 | 3916 | qed | 
| 3917 | ||
| 3918 | lemma compact_lemma: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3919 | fixes f :: "nat \<Rightarrow> 'a::euclidean_space" | 
| 50998 | 3920 | assumes "bounded (range f)" | 
| 53291 | 3921 | shows "\<forall>d\<subseteq>Basis. \<exists>l::'a. \<exists> r. | 
| 3922 | subseq r \<and> (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3923 | proof safe | 
| 52624 | 3924 | fix d :: "'a set" | 
| 53282 | 3925 | assume d: "d \<subseteq> Basis" | 
| 3926 | with finite_Basis have "finite d" | |
| 3927 | by (blast intro: finite_subset) | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3928 | from this d show "\<exists>l::'a. \<exists>r. subseq r \<and> | 
| 52624 | 3929 | (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)" | 
| 3930 | proof (induct d) | |
| 3931 | case empty | |
| 53282 | 3932 | then show ?case | 
| 3933 | unfolding subseq_def by auto | |
| 52624 | 3934 | next | 
| 3935 | case (insert k d) | |
| 53282 | 3936 | have k[intro]: "k \<in> Basis" | 
| 3937 | using insert by auto | |
| 3938 | have s': "bounded ((\<lambda>x. x \<bullet> k) ` range f)" | |
| 3939 | using `bounded (range f)` | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3940 | by (auto intro!: bounded_linear_image bounded_linear_inner_left) | 
| 53282 | 3941 | obtain l1::"'a" and r1 where r1: "subseq r1" | 
| 3942 | and lr1: "\<forall>e > 0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) \<bullet> i) (l1 \<bullet> i) < e) sequentially" | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3943 | using insert(3) using insert(4) by auto | 
| 53282 | 3944 | have f': "\<forall>n. f (r1 n) \<bullet> k \<in> (\<lambda>x. x \<bullet> k) ` range f" | 
| 3945 | by simp | |
| 50998 | 3946 | have "bounded (range (\<lambda>i. f (r1 i) \<bullet> k))" | 
| 3947 | by (metis (lifting) bounded_subset f' image_subsetI s') | |
| 3948 | then obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) \<bullet> k) ---> l2) sequentially" | |
| 53282 | 3949 | using bounded_imp_convergent_subsequence[of "\<lambda>i. f (r1 i) \<bullet> k"] | 
| 3950 | by (auto simp: o_def) | |
| 3951 | def r \<equiv> "r1 \<circ> r2" | |
| 3952 | have r:"subseq r" | |
| 33175 | 3953 | using r1 and r2 unfolding r_def o_def subseq_def by auto | 
| 3954 | moreover | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3955 | def l \<equiv> "(\<Sum>i\<in>Basis. (if i = k then l2 else l1\<bullet>i) *\<^sub>R i)::'a" | 
| 52624 | 3956 |     {
 | 
| 3957 | fix e::real | |
| 53282 | 3958 | assume "e > 0" | 
| 3959 | from lr1 `e > 0` have N1: "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) \<bullet> i) (l1 \<bullet> i) < e) sequentially" | |
| 52624 | 3960 | by blast | 
| 53282 | 3961 | from lr2 `e > 0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) \<bullet> k) l2 < e) sequentially" | 
| 52624 | 3962 | by (rule tendstoD) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3963 | from r2 N1 have N1': "eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 (r2 n)) \<bullet> i) (l1 \<bullet> i) < e) sequentially" | 
| 33175 | 3964 | by (rule eventually_subseq) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3965 | have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially" | 
| 53282 | 3966 | using N1' N2 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3967 | by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def) | 
| 33175 | 3968 | } | 
| 3969 | ultimately show ?case by auto | |
| 3970 | qed | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3971 | qed | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3972 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3973 | instance euclidean_space \<subseteq> heine_borel | 
| 33175 | 3974 | proof | 
| 50998 | 3975 | fix f :: "nat \<Rightarrow> 'a" | 
| 3976 | assume f: "bounded (range f)" | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3977 | then obtain l::'a and r where r: "subseq r" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3978 | and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially" | 
| 50998 | 3979 | using compact_lemma [OF f] by blast | 
| 52624 | 3980 |   {
 | 
| 3981 | fix e::real | |
| 53282 | 3982 | assume "e > 0" | 
| 56541 | 3983 |     hence "e / real_of_nat DIM('a) > 0" by (simp add: DIM_positive)
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3984 |     with l have "eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))) sequentially"
 | 
| 33175 | 3985 | by simp | 
| 3986 | moreover | |
| 52624 | 3987 |     {
 | 
| 3988 | fix n | |
| 3989 |       assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3990 | have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))" | 
| 52624 | 3991 | apply (subst euclidean_dist_l2) | 
| 3992 | using zero_le_dist | |
| 53282 | 3993 | apply (rule setL2_le_setsum) | 
| 3994 | done | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3995 |       also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
 | 
| 52624 | 3996 | apply (rule setsum_strict_mono) | 
| 3997 | using n | |
| 53282 | 3998 | apply auto | 
| 3999 | done | |
| 4000 | finally have "dist (f (r n)) l < e" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4001 | by auto | 
| 33175 | 4002 | } | 
| 4003 | ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially" | |
| 4004 | by (rule eventually_elim1) | |
| 4005 | } | |
| 53282 | 4006 | then have *: "((f \<circ> r) ---> l) sequentially" | 
| 52624 | 4007 | unfolding o_def tendsto_iff by simp | 
| 4008 | with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | |
| 4009 | by auto | |
| 33175 | 4010 | qed | 
| 4011 | ||
| 4012 | lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)" | |
| 52624 | 4013 | unfolding bounded_def | 
| 55775 | 4014 | by (metis (erased, hide_lams) dist_fst_le image_iff order_trans) | 
| 33175 | 4015 | |
| 4016 | lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)" | |
| 52624 | 4017 | unfolding bounded_def | 
| 55775 | 4018 | by (metis (no_types, hide_lams) dist_snd_le image_iff order.trans) | 
| 33175 | 4019 | |
| 37678 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 haftmann parents: 
37649diff
changeset | 4020 | instance prod :: (heine_borel, heine_borel) heine_borel | 
| 33175 | 4021 | proof | 
| 50998 | 4022 | fix f :: "nat \<Rightarrow> 'a \<times> 'b" | 
| 4023 | assume f: "bounded (range f)" | |
| 56154 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
56073diff
changeset | 4024 | then have "bounded (fst ` range f)" | 
| 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
56073diff
changeset | 4025 | by (rule bounded_fst) | 
| 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
56073diff
changeset | 4026 | then have s1: "bounded (range (fst \<circ> f))" | 
| 
f0a927235162
more complete set of lemmas wrt. image and composition
 haftmann parents: 
56073diff
changeset | 4027 | by (simp add: image_comp) | 
| 50998 | 4028 | obtain l1 r1 where r1: "subseq r1" and l1: "(\<lambda>n. fst (f (r1 n))) ----> l1" | 
| 4029 | using bounded_imp_convergent_subsequence [OF s1] unfolding o_def by fast | |
| 4030 | from f have s2: "bounded (range (snd \<circ> f \<circ> r1))" | |
| 4031 | by (auto simp add: image_comp intro: bounded_snd bounded_subset) | |
| 53282 | 4032 | obtain l2 r2 where r2: "subseq r2" and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially" | 
| 50998 | 4033 | using bounded_imp_convergent_subsequence [OF s2] | 
| 33175 | 4034 | unfolding o_def by fast | 
| 4035 | have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially" | |
| 50972 | 4036 | using LIMSEQ_subseq_LIMSEQ [OF l1 r2] unfolding o_def . | 
| 33175 | 4037 | have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially" | 
| 4038 | using tendsto_Pair [OF l1' l2] unfolding o_def by simp | |
| 4039 | have r: "subseq (r1 \<circ> r2)" | |
| 4040 | using r1 r2 unfolding subseq_def by simp | |
| 4041 | show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | |
| 4042 | using l r by fast | |
| 4043 | qed | |
| 4044 | ||
| 54070 | 4045 | subsubsection {* Completeness *}
 | 
| 33175 | 4046 | |
| 52624 | 4047 | definition complete :: "'a::metric_space set \<Rightarrow> bool" | 
| 4048 | where "complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f \<longrightarrow> (\<exists>l\<in>s. f ----> l))" | |
| 4049 | ||
| 54070 | 4050 | lemma completeI: | 
| 4051 | assumes "\<And>f. \<forall>n. f n \<in> s \<Longrightarrow> Cauchy f \<Longrightarrow> \<exists>l\<in>s. f ----> l" | |
| 4052 | shows "complete s" | |
| 4053 | using assms unfolding complete_def by fast | |
| 4054 | ||
| 4055 | lemma completeE: | |
| 4056 | assumes "complete s" and "\<forall>n. f n \<in> s" and "Cauchy f" | |
| 4057 | obtains l where "l \<in> s" and "f ----> l" | |
| 4058 | using assms unfolding complete_def by fast | |
| 4059 | ||
| 52624 | 4060 | lemma compact_imp_complete: | 
| 4061 | assumes "compact s" | |
| 4062 | shows "complete s" | |
| 4063 | proof - | |
| 4064 |   {
 | |
| 4065 | fix f | |
| 4066 | assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f" | |
| 50971 | 4067 | from as(1) obtain l r where lr: "l\<in>s" "subseq r" "(f \<circ> r) ----> l" | 
| 4068 | using assms unfolding compact_def by blast | |
| 4069 | ||
| 4070 | note lr' = seq_suble [OF lr(2)] | |
| 52624 | 4071 |     {
 | 
| 53282 | 4072 | fix e :: real | 
| 4073 | assume "e > 0" | |
| 52624 | 4074 | 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" | 
| 4075 | unfolding cauchy_def | |
| 53282 | 4076 | using `e > 0` | 
| 4077 | apply (erule_tac x="e/2" in allE) | |
| 52624 | 4078 | apply auto | 
| 4079 | done | |
| 4080 | from lr(3)[unfolded LIMSEQ_def, THEN spec[where x="e/2"]] | |
| 53282 | 4081 | obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" | 
| 4082 | using `e > 0` by auto | |
| 52624 | 4083 |       {
 | 
| 53282 | 4084 | fix n :: nat | 
| 4085 | assume n: "n \<ge> max N M" | |
| 4086 | have "dist ((f \<circ> r) n) l < e/2" | |
| 4087 | using n M by auto | |
| 4088 | moreover have "r n \<ge> N" | |
| 4089 | using lr'[of n] n by auto | |
| 4090 | then have "dist (f n) ((f \<circ> r) n) < e / 2" | |
| 4091 | using N and n by auto | |
| 52624 | 4092 | ultimately have "dist (f n) l < e" | 
| 53282 | 4093 | using dist_triangle_half_r[of "f (r n)" "f n" e l] | 
| 4094 | by (auto simp add: dist_commute) | |
| 52624 | 4095 | } | 
| 53282 | 4096 | then have "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast | 
| 52624 | 4097 | } | 
| 53282 | 4098 | then have "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` | 
| 52624 | 4099 | unfolding LIMSEQ_def by auto | 
| 4100 | } | |
| 53282 | 4101 | then show ?thesis unfolding complete_def by auto | 
| 50971 | 4102 | qed | 
| 4103 | ||
| 4104 | lemma nat_approx_posE: | |
| 4105 | fixes e::real | |
| 4106 | assumes "0 < e" | |
| 53282 | 4107 | obtains n :: nat where "1 / (Suc n) < e" | 
| 50971 | 4108 | proof atomize_elim | 
| 4109 | have " 1 / real (Suc (nat (ceiling (1/e)))) < 1 / (ceiling (1/e))" | |
| 56544 | 4110 | by (rule divide_strict_left_mono) (auto simp: `0 < e`) | 
| 50971 | 4111 | also have "1 / (ceiling (1/e)) \<le> 1 / (1/e)" | 
| 56541 | 4112 | by (rule divide_left_mono) (auto simp: `0 < e`) | 
| 50971 | 4113 | also have "\<dots> = e" by simp | 
| 4114 | finally show "\<exists>n. 1 / real (Suc n) < e" .. | |
| 4115 | qed | |
| 4116 | ||
| 4117 | lemma compact_eq_totally_bounded: | |
| 58184 
db1381d811ab
cleanup Wfrec; introduce dependent_wf/wellorder_choice
 hoelzl parents: 
57865diff
changeset | 4118 | "compact s \<longleftrightarrow> complete s \<and> (\<forall>e>0. \<exists>k. finite k \<and> s \<subseteq> (\<Union>x\<in>k. ball x e))" | 
| 50971 | 4119 | (is "_ \<longleftrightarrow> ?rhs") | 
| 4120 | proof | |
| 4121 | assume assms: "?rhs" | |
| 4122 | 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)" | |
| 4123 | by (auto simp: choice_iff') | |
| 4124 | ||
| 4125 | show "compact s" | |
| 4126 | proof cases | |
| 53282 | 4127 |     assume "s = {}"
 | 
| 4128 | then show "compact s" by (simp add: compact_def) | |
| 50971 | 4129 | next | 
| 4130 |     assume "s \<noteq> {}"
 | |
| 4131 | show ?thesis | |
| 4132 | unfolding compact_def | |
| 4133 | proof safe | |
| 53282 | 4134 | fix f :: "nat \<Rightarrow> 'a" | 
| 4135 | assume f: "\<forall>n. f n \<in> s" | |
| 4136 | ||
| 50971 | 4137 | def e \<equiv> "\<lambda>n. 1 / (2 * Suc n)" | 
| 4138 | then have [simp]: "\<And>n. 0 < e n" by auto | |
| 4139 |       def B \<equiv> "\<lambda>n U. SOME b. infinite {n. f n \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
 | |
| 53282 | 4140 |       {
 | 
| 4141 | fix n U | |
| 4142 |         assume "infinite {n. f n \<in> U}"
 | |
| 50971 | 4143 |         then have "\<exists>b\<in>k (e n). infinite {i\<in>{n. f n \<in> U}. f i \<in> ball b (e n)}"
 | 
| 4144 | using k f by (intro pigeonhole_infinite_rel) (auto simp: subset_eq) | |
| 55522 | 4145 | then obtain a where | 
| 4146 | "a \<in> k (e n)" | |
| 4147 |           "infinite {i \<in> {n. f n \<in> U}. f i \<in> ball a (e n)}" ..
 | |
| 50971 | 4148 |         then have "\<exists>b. infinite {i. f i \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
 | 
| 4149 | by (intro exI[of _ "ball a (e n) \<inter> U"] exI[of _ a]) (auto simp: ac_simps) | |
| 4150 | from someI_ex[OF this] | |
| 4151 |         have "infinite {i. f i \<in> B n U}" "\<exists>x. B n U \<subseteq> ball x (e n) \<inter> U"
 | |
| 53282 | 4152 | unfolding B_def by auto | 
| 4153 | } | |
| 50971 | 4154 | note B = this | 
| 4155 | ||
| 55415 | 4156 | def F \<equiv> "rec_nat (B 0 UNIV) B" | 
| 53282 | 4157 |       {
 | 
| 4158 | fix n | |
| 4159 |         have "infinite {i. f i \<in> F n}"
 | |
| 4160 | by (induct n) (auto simp: F_def B) | |
| 4161 | } | |
| 50971 | 4162 | then have F: "\<And>n. \<exists>x. F (Suc n) \<subseteq> ball x (e n) \<inter> F n" | 
| 4163 | using B by (simp add: F_def) | |
| 4164 | then have F_dec: "\<And>m n. m \<le> n \<Longrightarrow> F n \<subseteq> F m" | |
| 4165 | using decseq_SucI[of F] by (auto simp: decseq_def) | |
| 4166 | ||
| 4167 | obtain sel where sel: "\<And>k i. i < sel k i" "\<And>k i. f (sel k i) \<in> F k" | |
| 4168 | proof (atomize_elim, unfold all_conj_distrib[symmetric], intro choice allI) | |
| 4169 | fix k i | |
| 4170 |         have "infinite ({n. f n \<in> F k} - {.. i})"
 | |
| 4171 |           using `infinite {n. f n \<in> F k}` by auto
 | |
| 4172 | from infinite_imp_nonempty[OF this] | |
| 4173 | show "\<exists>x>i. f x \<in> F k" | |
| 4174 | by (simp add: set_eq_iff not_le conj_commute) | |
| 4175 | qed | |
| 4176 | ||
| 55415 | 4177 | def t \<equiv> "rec_nat (sel 0 0) (\<lambda>n i. sel (Suc n) i)" | 
| 50971 | 4178 | have "subseq t" | 
| 4179 | unfolding subseq_Suc_iff by (simp add: t_def sel) | |
| 4180 | moreover have "\<forall>i. (f \<circ> t) i \<in> s" | |
| 4181 | using f by auto | |
| 4182 | moreover | |
| 53282 | 4183 |       {
 | 
| 4184 | fix n | |
| 4185 | have "(f \<circ> t) n \<in> F n" | |
| 4186 | by (cases n) (simp_all add: t_def sel) | |
| 4187 | } | |
| 50971 | 4188 | note t = this | 
| 4189 | ||
| 4190 | have "Cauchy (f \<circ> t)" | |
| 4191 | proof (safe intro!: metric_CauchyI exI elim!: nat_approx_posE) | |
| 53282 | 4192 | fix r :: real and N n m | 
| 4193 | assume "1 / Suc N < r" "Suc N \<le> n" "Suc N \<le> m" | |
| 50971 | 4194 | then have "(f \<circ> t) n \<in> F (Suc N)" "(f \<circ> t) m \<in> F (Suc N)" "2 * e N < r" | 
| 4195 | using F_dec t by (auto simp: e_def field_simps real_of_nat_Suc) | |
| 4196 | with F[of N] obtain x where "dist x ((f \<circ> t) n) < e N" "dist x ((f \<circ> t) m) < e N" | |
| 4197 | by (auto simp: subset_eq) | |
| 4198 | with dist_triangle[of "(f \<circ> t) m" "(f \<circ> t) n" x] `2 * e N < r` | |
| 4199 | show "dist ((f \<circ> t) m) ((f \<circ> t) n) < r" | |
| 4200 | by (simp add: dist_commute) | |
| 4201 | qed | |
| 4202 | ||
| 4203 | ultimately show "\<exists>l\<in>s. \<exists>r. subseq r \<and> (f \<circ> r) ----> l" | |
| 4204 | using assms unfolding complete_def by blast | |
| 4205 | qed | |
| 4206 | qed | |
| 4207 | qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded) | |
| 33175 | 4208 | |
| 4209 | lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs") | |
| 53282 | 4210 | proof - | 
| 4211 |   {
 | |
| 4212 | assume ?rhs | |
| 4213 |     {
 | |
| 4214 | fix e::real | |
| 33175 | 4215 | assume "e>0" | 
| 4216 | with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2" | |
| 4217 | by (erule_tac x="e/2" in allE) auto | |
| 53282 | 4218 |       {
 | 
| 4219 | fix n m | |
| 33175 | 4220 | assume nm:"N \<le> m \<and> N \<le> n" | 
| 53282 | 4221 | then have "dist (s m) (s n) < e" using N | 
| 33175 | 4222 | using dist_triangle_half_l[of "s m" "s N" "e" "s n"] | 
| 4223 | by blast | |
| 4224 | } | |
| 53282 | 4225 | then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e" | 
| 33175 | 4226 | by blast | 
| 4227 | } | |
| 53282 | 4228 | then have ?lhs | 
| 33175 | 4229 | unfolding cauchy_def | 
| 4230 | by blast | |
| 4231 | } | |
| 53282 | 4232 | then show ?thesis | 
| 33175 | 4233 | unfolding cauchy_def | 
| 4234 | using dist_triangle_half_l | |
| 4235 | by blast | |
| 4236 | qed | |
| 4237 | ||
| 53282 | 4238 | lemma cauchy_imp_bounded: | 
| 4239 | assumes "Cauchy s" | |
| 4240 | shows "bounded (range s)" | |
| 4241 | proof - | |
| 4242 | from assms obtain N :: nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" | |
| 52624 | 4243 | unfolding cauchy_def | 
| 4244 | apply (erule_tac x= 1 in allE) | |
| 4245 | apply auto | |
| 4246 | done | |
| 53282 | 4247 | then have N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto | 
| 33175 | 4248 | moreover | 
| 52624 | 4249 |   have "bounded (s ` {0..N})"
 | 
| 4250 |     using finite_imp_bounded[of "s ` {1..N}"] by auto
 | |
| 33175 | 4251 |   then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
 | 
| 4252 | unfolding bounded_any_center [where a="s N"] by auto | |
| 4253 | ultimately show "?thesis" | |
| 4254 | unfolding bounded_any_center [where a="s N"] | |
| 52624 | 4255 | apply (rule_tac x="max a 1" in exI) | 
| 4256 | apply auto | |
| 4257 | apply (erule_tac x=y in allE) | |
| 4258 | apply (erule_tac x=y in ballE) | |
| 4259 | apply auto | |
| 4260 | done | |
| 33175 | 4261 | qed | 
| 4262 | ||
| 4263 | instance heine_borel < complete_space | |
| 4264 | proof | |
| 4265 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | |
| 53282 | 4266 | then have "bounded (range f)" | 
| 34104 | 4267 | by (rule cauchy_imp_bounded) | 
| 53282 | 4268 | then have "compact (closure (range f))" | 
| 50971 | 4269 | unfolding compact_eq_bounded_closed by auto | 
| 53282 | 4270 | then have "complete (closure (range f))" | 
| 50971 | 4271 | by (rule compact_imp_complete) | 
| 33175 | 4272 | moreover have "\<forall>n. f n \<in> closure (range f)" | 
| 4273 | using closure_subset [of "range f"] by auto | |
| 4274 | ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially" | |
| 4275 | using `Cauchy f` unfolding complete_def by auto | |
| 4276 | then show "convergent f" | |
| 36660 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 huffman parents: 
36659diff
changeset | 4277 | unfolding convergent_def by auto | 
| 33175 | 4278 | qed | 
| 4279 | ||
| 44632 | 4280 | instance euclidean_space \<subseteq> banach .. | 
| 4281 | ||
| 54070 | 4282 | lemma complete_UNIV: "complete (UNIV :: ('a::complete_space) set)"
 | 
| 4283 | proof (rule completeI) | |
| 4284 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | |
| 53282 | 4285 | then have "convergent f" by (rule Cauchy_convergent) | 
| 54070 | 4286 | then show "\<exists>l\<in>UNIV. f ----> l" unfolding convergent_def by simp | 
| 53282 | 4287 | qed | 
| 4288 | ||
| 4289 | lemma complete_imp_closed: | |
| 4290 | assumes "complete s" | |
| 4291 | shows "closed s" | |
| 54070 | 4292 | proof (unfold closed_sequential_limits, clarify) | 
| 4293 | fix f x assume "\<forall>n. f n \<in> s" and "f ----> x" | |
| 4294 | from `f ----> x` have "Cauchy f" | |
| 4295 | by (rule LIMSEQ_imp_Cauchy) | |
| 4296 | with `complete s` and `\<forall>n. f n \<in> s` obtain l where "l \<in> s" and "f ----> l" | |
| 4297 | by (rule completeE) | |
| 4298 | from `f ----> x` and `f ----> l` have "x = l" | |
| 4299 | by (rule LIMSEQ_unique) | |
| 4300 | with `l \<in> s` show "x \<in> s" | |
| 4301 | by simp | |
| 4302 | qed | |
| 4303 | ||
| 4304 | lemma complete_inter_closed: | |
| 4305 | assumes "complete s" and "closed t" | |
| 4306 | shows "complete (s \<inter> t)" | |
| 4307 | proof (rule completeI) | |
| 4308 | fix f assume "\<forall>n. f n \<in> s \<inter> t" and "Cauchy f" | |
| 4309 | then have "\<forall>n. f n \<in> s" and "\<forall>n. f n \<in> t" | |
| 4310 | by simp_all | |
| 4311 | from `complete s` obtain l where "l \<in> s" and "f ----> l" | |
| 4312 | using `\<forall>n. f n \<in> s` and `Cauchy f` by (rule completeE) | |
| 4313 | from `closed t` and `\<forall>n. f n \<in> t` and `f ----> l` have "l \<in> t" | |
| 4314 | by (rule closed_sequentially) | |
| 4315 | with `l \<in> s` and `f ----> l` show "\<exists>l\<in>s \<inter> t. f ----> l" | |
| 4316 | by fast | |
| 4317 | qed | |
| 4318 | ||
| 4319 | lemma complete_closed_subset: | |
| 4320 | assumes "closed s" and "s \<subseteq> t" and "complete t" | |
| 4321 | shows "complete s" | |
| 4322 | using assms complete_inter_closed [of t s] by (simp add: Int_absorb1) | |
| 33175 | 4323 | |
| 4324 | lemma complete_eq_closed: | |
| 54070 | 4325 |   fixes s :: "('a::complete_space) set"
 | 
| 4326 | shows "complete s \<longleftrightarrow> closed s" | |
| 33175 | 4327 | proof | 
| 54070 | 4328 | assume "closed s" then show "complete s" | 
| 4329 | using subset_UNIV complete_UNIV by (rule complete_closed_subset) | |
| 33175 | 4330 | next | 
| 54070 | 4331 | assume "complete s" then show "closed s" | 
| 4332 | by (rule complete_imp_closed) | |
| 33175 | 4333 | qed | 
| 4334 | ||
| 4335 | lemma convergent_eq_cauchy: | |
| 4336 | fixes s :: "nat \<Rightarrow> 'a::complete_space" | |
| 44632 | 4337 | shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s" | 
| 4338 | unfolding Cauchy_convergent_iff convergent_def .. | |
| 33175 | 4339 | |
| 4340 | lemma convergent_imp_bounded: | |
| 4341 | fixes s :: "nat \<Rightarrow> 'a::metric_space" | |
| 44632 | 4342 | shows "(s ---> l) sequentially \<Longrightarrow> bounded (range s)" | 
| 50939 
ae7cd20ed118
replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
 hoelzl parents: 
50938diff
changeset | 4343 | by (intro cauchy_imp_bounded LIMSEQ_imp_Cauchy) | 
| 33175 | 4344 | |
| 4345 | lemma compact_cball[simp]: | |
| 4346 | fixes x :: "'a::heine_borel" | |
| 54070 | 4347 | shows "compact (cball x e)" | 
| 33175 | 4348 | using compact_eq_bounded_closed bounded_cball closed_cball | 
| 4349 | by blast | |
| 4350 | ||
| 4351 | lemma compact_frontier_bounded[intro]: | |
| 4352 | fixes s :: "'a::heine_borel set" | |
| 54070 | 4353 | shows "bounded s \<Longrightarrow> compact (frontier s)" | 
| 33175 | 4354 | unfolding frontier_def | 
| 4355 | using compact_eq_bounded_closed | |
| 4356 | by blast | |
| 4357 | ||
| 4358 | lemma compact_frontier[intro]: | |
| 4359 | fixes s :: "'a::heine_borel set" | |
| 53291 | 4360 | shows "compact s \<Longrightarrow> compact (frontier s)" | 
| 33175 | 4361 | using compact_eq_bounded_closed compact_frontier_bounded | 
| 4362 | by blast | |
| 4363 | ||
| 4364 | lemma frontier_subset_compact: | |
| 4365 | fixes s :: "'a::heine_borel set" | |
| 53291 | 4366 | shows "compact s \<Longrightarrow> frontier s \<subseteq> s" | 
| 33175 | 4367 | using frontier_subset_closed compact_eq_bounded_closed | 
| 4368 | by blast | |
| 4369 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4370 | subsection {* Bounded closed nest property (proof does not use Heine-Borel) *}
 | 
| 33175 | 4371 | |
| 4372 | lemma bounded_closed_nest: | |
| 54070 | 4373 |   fixes s :: "nat \<Rightarrow> ('a::heine_borel) set"
 | 
| 4374 | assumes "\<forall>n. closed (s n)" | |
| 4375 |     and "\<forall>n. s n \<noteq> {}"
 | |
| 4376 | and "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m" | |
| 4377 | and "bounded (s 0)" | |
| 4378 | shows "\<exists>a. \<forall>n. a \<in> s n" | |
| 52624 | 4379 | proof - | 
| 54070 | 4380 | from assms(2) obtain x where x: "\<forall>n. x n \<in> s n" | 
| 4381 | using choice[of "\<lambda>n x. x \<in> s n"] by auto | |
| 4382 | from assms(4,1) have "seq_compact (s 0)" | |
| 4383 | by (simp add: bounded_closed_imp_seq_compact) | |
| 4384 | then obtain l r where lr: "l \<in> s 0" "subseq r" "(x \<circ> r) ----> l" | |
| 4385 | using x and assms(3) unfolding seq_compact_def by blast | |
| 4386 | have "\<forall>n. l \<in> s n" | |
| 4387 | proof | |
| 53282 | 4388 | fix n :: nat | 
| 54070 | 4389 | have "closed (s n)" | 
| 4390 | using assms(1) by simp | |
| 4391 | moreover have "\<forall>i. (x \<circ> r) i \<in> s i" | |
| 4392 | using x and assms(3) and lr(2) [THEN seq_suble] by auto | |
| 4393 | then have "\<forall>i. (x \<circ> r) (i + n) \<in> s n" | |
| 4394 | using assms(3) by (fast intro!: le_add2) | |
| 4395 | moreover have "(\<lambda>i. (x \<circ> r) (i + n)) ----> l" | |
| 4396 | using lr(3) by (rule LIMSEQ_ignore_initial_segment) | |
| 4397 | ultimately show "l \<in> s n" | |
| 4398 | by (rule closed_sequentially) | |
| 4399 | qed | |
| 4400 | then show ?thesis .. | |
| 33175 | 4401 | qed | 
| 4402 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4403 | text {* Decreasing case does not even need compactness, just completeness. *}
 | 
| 33175 | 4404 | |
| 4405 | lemma decreasing_closed_nest: | |
| 54070 | 4406 |   fixes s :: "nat \<Rightarrow> ('a::complete_space) set"
 | 
| 53282 | 4407 | assumes | 
| 54070 | 4408 | "\<forall>n. closed (s n)" | 
| 4409 |     "\<forall>n. s n \<noteq> {}"
 | |
| 4410 | "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m" | |
| 4411 | "\<forall>e>0. \<exists>n. \<forall>x\<in>s n. \<forall>y\<in>s n. dist x y < e" | |
| 4412 | shows "\<exists>a. \<forall>n. a \<in> s n" | |
| 4413 | proof - | |
| 4414 | have "\<forall>n. \<exists>x. x \<in> s n" | |
| 53282 | 4415 | using assms(2) by auto | 
| 4416 | then have "\<exists>t. \<forall>n. t n \<in> s n" | |
| 54070 | 4417 | using choice[of "\<lambda>n x. x \<in> s n"] by auto | 
| 33175 | 4418 | then obtain t where t: "\<forall>n. t n \<in> s n" by auto | 
| 53282 | 4419 |   {
 | 
| 4420 | fix e :: real | |
| 4421 | assume "e > 0" | |
| 4422 | then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" | |
| 4423 | using assms(4) by auto | |
| 4424 |     {
 | |
| 4425 | fix m n :: nat | |
| 4426 | assume "N \<le> m \<and> N \<le> n" | |
| 4427 | then have "t m \<in> s N" "t n \<in> s N" | |
| 4428 | using assms(3) t unfolding subset_eq t by blast+ | |
| 4429 | then have "dist (t m) (t n) < e" | |
| 4430 | using N by auto | |
| 33175 | 4431 | } | 
| 53282 | 4432 | then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" | 
| 4433 | by auto | |
| 33175 | 4434 | } | 
| 53282 | 4435 | then have "Cauchy t" | 
| 4436 | unfolding cauchy_def by auto | |
| 4437 | then obtain l where l:"(t ---> l) sequentially" | |
| 54070 | 4438 | using complete_UNIV unfolding complete_def by auto | 
| 53282 | 4439 |   {
 | 
| 4440 | fix n :: nat | |
| 4441 |     {
 | |
| 4442 | fix e :: real | |
| 4443 | assume "e > 0" | |
| 4444 | then obtain N :: nat where N: "\<forall>n\<ge>N. dist (t n) l < e" | |
| 4445 | using l[unfolded LIMSEQ_def] by auto | |
| 4446 | have "t (max n N) \<in> s n" | |
| 4447 | using assms(3) | |
| 4448 | unfolding subset_eq | |
| 4449 | apply (erule_tac x=n in allE) | |
| 4450 | apply (erule_tac x="max n N" in allE) | |
| 4451 | using t | |
| 4452 | apply auto | |
| 4453 | done | |
| 4454 | then have "\<exists>y\<in>s n. dist y l < e" | |
| 4455 | apply (rule_tac x="t (max n N)" in bexI) | |
| 4456 | using N | |
| 4457 | apply auto | |
| 4458 | done | |
| 33175 | 4459 | } | 
| 53282 | 4460 | then have "l \<in> s n" | 
| 4461 | using closed_approachable[of "s n" l] assms(1) by auto | |
| 33175 | 4462 | } | 
| 4463 | then show ?thesis by auto | |
| 4464 | qed | |
| 4465 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4466 | text {* Strengthen it to the intersection actually being a singleton. *}
 | 
| 33175 | 4467 | |
| 4468 | lemma decreasing_closed_nest_sing: | |
| 44632 | 4469 | fixes s :: "nat \<Rightarrow> 'a::complete_space set" | 
| 53282 | 4470 | assumes | 
| 4471 | "\<forall>n. closed(s n)" | |
| 4472 |     "\<forall>n. s n \<noteq> {}"
 | |
| 54070 | 4473 | "\<forall>m n. m \<le> n \<longrightarrow> s n \<subseteq> s m" | 
| 53282 | 4474 | "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e" | 
| 34104 | 4475 |   shows "\<exists>a. \<Inter>(range s) = {a}"
 | 
| 53282 | 4476 | proof - | 
| 4477 | obtain a where a: "\<forall>n. a \<in> s n" | |
| 4478 | using decreasing_closed_nest[of s] using assms by auto | |
| 4479 |   {
 | |
| 4480 | fix b | |
| 4481 | assume b: "b \<in> \<Inter>(range s)" | |
| 4482 |     {
 | |
| 4483 | fix e :: real | |
| 4484 | assume "e > 0" | |
| 4485 | then have "dist a b < e" | |
| 4486 | using assms(4) and b and a by blast | |
| 33175 | 4487 | } | 
| 53282 | 4488 | then have "dist a b = 0" | 
| 4489 | by (metis dist_eq_0_iff dist_nz less_le) | |
| 33175 | 4490 | } | 
| 53282 | 4491 |   with a have "\<Inter>(range s) = {a}"
 | 
| 4492 | unfolding image_def by auto | |
| 4493 | then show ?thesis .. | |
| 33175 | 4494 | qed | 
| 4495 | ||
| 4496 | text{* Cauchy-type criteria for uniform convergence. *}
 | |
| 4497 | ||
| 53282 | 4498 | lemma uniformly_convergent_eq_cauchy: | 
| 4499 | fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::complete_space" | |
| 4500 | shows | |
| 53291 | 4501 | "(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e) \<longleftrightarrow> | 
| 4502 | (\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x \<longrightarrow> dist (s m x) (s n x) < e)" | |
| 53282 | 4503 | (is "?lhs = ?rhs") | 
| 4504 | proof | |
| 33175 | 4505 | assume ?lhs | 
| 53282 | 4506 | then obtain l where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e" | 
| 4507 | by auto | |
| 4508 |   {
 | |
| 4509 | fix e :: real | |
| 4510 | assume "e > 0" | |
| 4511 | then obtain N :: nat where N: "\<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e / 2" | |
| 4512 | using l[THEN spec[where x="e/2"]] by auto | |
| 4513 |     {
 | |
| 4514 | fix n m :: nat and x :: "'b" | |
| 4515 | assume "N \<le> m \<and> N \<le> n \<and> P x" | |
| 4516 | then have "dist (s m x) (s n x) < e" | |
| 33175 | 4517 | using N[THEN spec[where x=m], THEN spec[where x=x]] | 
| 4518 | using N[THEN spec[where x=n], THEN spec[where x=x]] | |
| 53282 | 4519 | using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto | 
| 4520 | } | |
| 4521 | then have "\<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x --> dist (s m x) (s n x) < e" by auto | |
| 4522 | } | |
| 4523 | then show ?rhs by auto | |
| 33175 | 4524 | next | 
| 4525 | assume ?rhs | |
| 53282 | 4526 | then have "\<forall>x. P x \<longrightarrow> Cauchy (\<lambda>n. s n x)" | 
| 4527 | unfolding cauchy_def | |
| 4528 | apply auto | |
| 4529 | apply (erule_tac x=e in allE) | |
| 4530 | apply auto | |
| 4531 | done | |
| 4532 | then obtain l where l: "\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" | |
| 53291 | 4533 | unfolding convergent_eq_cauchy[symmetric] | 
| 53282 | 4534 | using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] | 
| 4535 | by auto | |
| 4536 |   {
 | |
| 4537 | fix e :: real | |
| 4538 | assume "e > 0" | |
| 33175 | 4539 | then obtain N where N:"\<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x \<longrightarrow> dist (s m x) (s n x) < e/2" | 
| 4540 | using `?rhs`[THEN spec[where x="e/2"]] by auto | |
| 53282 | 4541 |     {
 | 
| 4542 | fix x | |
| 4543 | assume "P x" | |
| 33175 | 4544 | then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2" | 
| 53282 | 4545 | using l[THEN spec[where x=x], unfolded LIMSEQ_def] and `e > 0` | 
| 4546 | by (auto elim!: allE[where x="e/2"]) | |
| 4547 | fix n :: nat | |
| 4548 | assume "n \<ge> N" | |
| 4549 | then have "dist(s n x)(l x) < e" | |
| 4550 | using `P x`and N[THEN spec[where x=n], THEN spec[where x="N+M"], THEN spec[where x=x]] | |
| 4551 | using M[THEN spec[where x="N+M"]] and dist_triangle_half_l[of "s n x" "s (N+M) x" e "l x"] | |
| 4552 | by (auto simp add: dist_commute) | |
| 4553 | } | |
| 4554 | then have "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" | |
| 4555 | by auto | |
| 4556 | } | |
| 4557 | then show ?lhs by auto | |
| 33175 | 4558 | qed | 
| 4559 | ||
| 4560 | lemma uniformly_cauchy_imp_uniformly_convergent: | |
| 51102 | 4561 | fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::complete_space" | 
| 33175 | 4562 | assumes "\<forall>e>0.\<exists>N. \<forall>m (n::nat) x. N \<le> m \<and> N \<le> n \<and> P x --> dist(s m x)(s n x) < e" | 
| 53291 | 4563 | and "\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n \<longrightarrow> dist(s n x)(l x) < e)" | 
| 4564 | shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" | |
| 53282 | 4565 | proof - | 
| 33175 | 4566 | obtain l' where l:"\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l' x) < e" | 
| 53291 | 4567 | using assms(1) unfolding uniformly_convergent_eq_cauchy[symmetric] by auto | 
| 33175 | 4568 | moreover | 
| 53282 | 4569 |   {
 | 
| 4570 | fix x | |
| 4571 | assume "P x" | |
| 4572 | then have "l x = l' x" | |
| 4573 | using tendsto_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"] | |
| 4574 | using l and assms(2) unfolding LIMSEQ_def by blast | |
| 4575 | } | |
| 33175 | 4576 | ultimately show ?thesis by auto | 
| 4577 | qed | |
| 4578 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4579 | |
| 36437 | 4580 | subsection {* Continuity *}
 | 
| 4581 | ||
| 33175 | 4582 | text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
 | 
| 4583 | ||
| 4584 | lemma continuous_within_eps_delta: | |
| 4585 | "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)" | |
| 4586 | unfolding continuous_within and Lim_within | |
| 53282 | 4587 | apply auto | 
| 55775 | 4588 | apply (metis dist_nz dist_self) | 
| 4589 | apply blast | |
| 53282 | 4590 | done | 
| 4591 | ||
| 4592 | lemma continuous_at_eps_delta: | |
| 4593 | "continuous (at x) f \<longleftrightarrow> (\<forall>e > 0. \<exists>d > 0. \<forall>x'. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" | |
| 45031 | 4594 | using continuous_within_eps_delta [of x UNIV f] by simp | 
| 33175 | 4595 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4596 | lemma continuous_at_right_real_increasing: | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4597 | fixes f :: "real \<Rightarrow> real" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4598 | assumes nondecF: "\<And>x y. x \<le> y \<Longrightarrow> f x \<le> f y" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4599 | shows "continuous (at_right a) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f (a + d) - f a < e)" | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4600 | apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4601 | apply (intro all_cong ex_cong) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4602 | apply safe | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4603 | apply (erule_tac x="a + d" in allE) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4604 | apply simp | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4605 | apply (simp add: nondecF field_simps) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4606 | apply (drule nondecF) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4607 | apply simp | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4608 | done | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4609 | |
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4610 | lemma continuous_at_left_real_increasing: | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4611 | assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4612 | shows "(continuous (at_left (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)" | 
| 57448 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4613 | apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4614 | apply (intro all_cong ex_cong) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4615 | apply safe | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4616 | apply (erule_tac x="a - d" in allE) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4617 | apply simp | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4618 | apply (simp add: nondecF field_simps) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4619 | apply (cut_tac x="a - d" and y="x" in nondecF) | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4620 | apply simp_all | 
| 
159e45728ceb
more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
 hoelzl parents: 
57447diff
changeset | 4621 | done | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 4622 | |
| 33175 | 4623 | text{* Versions in terms of open balls. *}
 | 
| 4624 | ||
| 4625 | lemma continuous_within_ball: | |
| 53282 | 4626 | "continuous (at x within s) f \<longleftrightarrow> | 
| 4627 | (\<forall>e > 0. \<exists>d > 0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" | |
| 4628 | (is "?lhs = ?rhs") | |
| 33175 | 4629 | proof | 
| 4630 | assume ?lhs | |
| 53282 | 4631 |   {
 | 
| 4632 | fix e :: real | |
| 4633 | assume "e > 0" | |
| 33175 | 4634 | then obtain d where d: "d>0" "\<forall>xa\<in>s. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e" | 
| 4635 | using `?lhs`[unfolded continuous_within Lim_within] by auto | |
| 53282 | 4636 |     {
 | 
| 4637 | fix y | |
| 4638 | assume "y \<in> f ` (ball x d \<inter> s)" | |
| 4639 | then have "y \<in> ball (f x) e" | |
| 4640 | using d(2) | |
| 53291 | 4641 | unfolding dist_nz[symmetric] | 
| 53282 | 4642 | apply (auto simp add: dist_commute) | 
| 4643 | apply (erule_tac x=xa in ballE) | |
| 4644 | apply auto | |
| 4645 | using `e > 0` | |
| 4646 | apply auto | |
| 4647 | done | |
| 33175 | 4648 | } | 
| 53282 | 4649 | then have "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e" | 
| 4650 | using `d > 0` | |
| 4651 | unfolding subset_eq ball_def by (auto simp add: dist_commute) | |
| 4652 | } | |
| 4653 | then show ?rhs by auto | |
| 33175 | 4654 | next | 
| 53282 | 4655 | assume ?rhs | 
| 4656 | then show ?lhs | |
| 4657 | unfolding continuous_within Lim_within ball_def subset_eq | |
| 4658 | apply (auto simp add: dist_commute) | |
| 4659 | apply (erule_tac x=e in allE) | |
| 4660 | apply auto | |
| 4661 | done | |
| 33175 | 4662 | qed | 
| 4663 | ||
| 4664 | lemma continuous_at_ball: | |
| 4665 | "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") | |
| 4666 | proof | |
| 53282 | 4667 | assume ?lhs | 
| 4668 | then show ?rhs | |
| 4669 | unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | |
| 4670 | apply auto | |
| 4671 | apply (erule_tac x=e in allE) | |
| 4672 | apply auto | |
| 4673 | apply (rule_tac x=d in exI) | |
| 4674 | apply auto | |
| 4675 | apply (erule_tac x=xa in allE) | |
| 4676 | apply (auto simp add: dist_commute dist_nz) | |
| 53291 | 4677 | unfolding dist_nz[symmetric] | 
| 53282 | 4678 | apply auto | 
| 4679 | done | |
| 33175 | 4680 | next | 
| 53282 | 4681 | assume ?rhs | 
| 4682 | then show ?lhs | |
| 4683 | unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | |
| 4684 | apply auto | |
| 4685 | apply (erule_tac x=e in allE) | |
| 4686 | apply auto | |
| 4687 | apply (rule_tac x=d in exI) | |
| 4688 | apply auto | |
| 4689 | apply (erule_tac x="f xa" in allE) | |
| 4690 | apply (auto simp add: dist_commute dist_nz) | |
| 4691 | done | |
| 33175 | 4692 | qed | 
| 4693 | ||
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4694 | text{* Define setwise continuity in terms of limits within the set. *}
 | 
| 33175 | 4695 | |
| 36359 | 4696 | lemma continuous_on_iff: | 
| 4697 | "continuous_on s f \<longleftrightarrow> | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4698 | (\<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)" | 
| 53282 | 4699 | unfolding continuous_on_def Lim_within | 
| 55775 | 4700 | by (metis dist_pos_lt dist_self) | 
| 53282 | 4701 | |
| 4702 | definition uniformly_continuous_on :: "'a set \<Rightarrow> ('a::metric_space \<Rightarrow> 'b::metric_space) \<Rightarrow> bool"
 | |
| 4703 | where "uniformly_continuous_on s f \<longleftrightarrow> | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4704 | (\<forall>e>0. \<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)" | 
| 35172 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 4705 | |
| 33175 | 4706 | text{* Some simple consequential lemmas. *}
 | 
| 4707 | ||
| 4708 | lemma uniformly_continuous_imp_continuous: | |
| 53282 | 4709 | "uniformly_continuous_on s f \<Longrightarrow> continuous_on s f" | 
| 36359 | 4710 | unfolding uniformly_continuous_on_def continuous_on_iff by blast | 
| 33175 | 4711 | |
| 4712 | lemma continuous_at_imp_continuous_within: | |
| 53282 | 4713 | "continuous (at x) f \<Longrightarrow> continuous (at x within s) f" | 
| 33175 | 4714 | unfolding continuous_within continuous_at using Lim_at_within by auto | 
| 4715 | ||
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4716 | lemma Lim_trivial_limit: "trivial_limit net \<Longrightarrow> (f ---> l) net" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 4717 | by simp | 
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4718 | |
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4719 | lemmas continuous_on = continuous_on_def -- "legacy theorem name" | 
| 33175 | 4720 | |
| 4721 | lemma continuous_within_subset: | |
| 53282 | 4722 | "continuous (at x within s) f \<Longrightarrow> t \<subseteq> s \<Longrightarrow> continuous (at x within t) f" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 4723 | unfolding continuous_within by(metis tendsto_within_subset) | 
| 33175 | 4724 | |
| 4725 | lemma continuous_on_interior: | |
| 53282 | 4726 | "continuous_on s f \<Longrightarrow> x \<in> interior s \<Longrightarrow> continuous (at x) f" | 
| 55775 | 4727 | by (metis continuous_on_eq_continuous_at continuous_on_subset interiorE) | 
| 33175 | 4728 | |
| 4729 | lemma continuous_on_eq: | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4730 | "(\<forall>x \<in> s. f x = g x) \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on s g" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 4731 | unfolding continuous_on_def tendsto_def eventually_at_topological | 
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 4732 | by simp | 
| 33175 | 4733 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4734 | text {* Characterization of various kinds of continuity in terms of sequences. *}
 | 
| 33175 | 4735 | |
| 4736 | lemma continuous_within_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4737 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 33175 | 4738 | shows "continuous (at a within s) f \<longleftrightarrow> | 
| 53282 | 4739 | (\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially | 
| 53640 | 4740 | \<longrightarrow> ((f \<circ> x) ---> f a) sequentially)" | 
| 53282 | 4741 | (is "?lhs = ?rhs") | 
| 33175 | 4742 | proof | 
| 4743 | assume ?lhs | |
| 53282 | 4744 |   {
 | 
| 4745 | fix x :: "nat \<Rightarrow> 'a" | |
| 4746 | assume x: "\<forall>n. x n \<in> s" "\<forall>e>0. eventually (\<lambda>n. dist (x n) a < e) sequentially" | |
| 4747 | fix T :: "'b set" | |
| 4748 | assume "open T" and "f a \<in> T" | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4749 | with `?lhs` obtain d where "d>0" and d:"\<forall>x\<in>s. 0 < dist x a \<and> dist x a < d \<longrightarrow> f x \<in> T" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 4750 | unfolding continuous_within tendsto_def eventually_at by (auto simp: dist_nz) | 
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4751 | have "eventually (\<lambda>n. dist (x n) a < d) sequentially" | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4752 | using x(2) `d>0` by simp | 
| 53282 | 4753 | then have "eventually (\<lambda>n. (f \<circ> x) n \<in> T) sequentially" | 
| 46887 | 4754 | proof eventually_elim | 
| 53282 | 4755 | case (elim n) | 
| 4756 | then show ?case | |
| 53291 | 4757 | using d x(1) `f a \<in> T` unfolding dist_nz[symmetric] by auto | 
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4758 | qed | 
| 33175 | 4759 | } | 
| 53282 | 4760 | then show ?rhs | 
| 4761 | unfolding tendsto_iff tendsto_def by simp | |
| 33175 | 4762 | next | 
| 53282 | 4763 | assume ?rhs | 
| 4764 | then show ?lhs | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4765 | unfolding continuous_within tendsto_def [where l="f a"] | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4766 | by (simp add: sequentially_imp_eventually_within) | 
| 33175 | 4767 | qed | 
| 4768 | ||
| 4769 | lemma continuous_at_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4770 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 53291 | 4771 | shows "continuous (at a) f \<longleftrightarrow> | 
| 53640 | 4772 | (\<forall>x. (x ---> a) sequentially --> ((f \<circ> x) ---> f a) sequentially)" | 
| 45031 | 4773 | using continuous_within_sequentially[of a UNIV f] by simp | 
| 33175 | 4774 | |
| 4775 | lemma continuous_on_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 4776 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 36359 | 4777 | shows "continuous_on s f \<longleftrightarrow> | 
| 4778 | (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially | |
| 53640 | 4779 | --> ((f \<circ> x) ---> f a) sequentially)" | 
| 53291 | 4780 | (is "?lhs = ?rhs") | 
| 33175 | 4781 | proof | 
| 53282 | 4782 | assume ?rhs | 
| 4783 | then show ?lhs | |
| 4784 | using continuous_within_sequentially[of _ s f] | |
| 4785 | unfolding continuous_on_eq_continuous_within | |
| 4786 | by auto | |
| 33175 | 4787 | next | 
| 53282 | 4788 | assume ?lhs | 
| 4789 | then show ?rhs | |
| 4790 | unfolding continuous_on_eq_continuous_within | |
| 4791 | using continuous_within_sequentially[of _ s f] | |
| 4792 | by auto | |
| 33175 | 4793 | qed | 
| 4794 | ||
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4795 | lemma uniformly_continuous_on_sequentially: | 
| 36441 | 4796 | "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> | 
| 4797 | ((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially | |
| 4798 | \<longrightarrow> ((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially)" (is "?lhs = ?rhs") | |
| 33175 | 4799 | proof | 
| 4800 | assume ?lhs | |
| 53282 | 4801 |   {
 | 
| 4802 | fix x y | |
| 4803 | assume x: "\<forall>n. x n \<in> s" | |
| 4804 | and y: "\<forall>n. y n \<in> s" | |
| 4805 | and xy: "((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially" | |
| 4806 |     {
 | |
| 4807 | fix e :: real | |
| 4808 | assume "e > 0" | |
| 4809 | 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" | |
| 33175 | 4810 | using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto | 
| 53282 | 4811 | obtain N where N: "\<forall>n\<ge>N. dist (x n) (y n) < d" | 
| 4812 | using xy[unfolded LIMSEQ_def dist_norm] and `d>0` by auto | |
| 4813 |       {
 | |
| 4814 | fix n | |
| 4815 | assume "n\<ge>N" | |
| 4816 | then have "dist (f (x n)) (f (y n)) < e" | |
| 4817 | using N[THEN spec[where x=n]] | |
| 4818 | using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] | |
| 4819 | using x and y | |
| 4820 | unfolding dist_commute | |
| 4821 | by simp | |
| 4822 | } | |
| 4823 | then have "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" | |
| 4824 | by auto | |
| 4825 | } | |
| 4826 | then have "((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially" | |
| 4827 | unfolding LIMSEQ_def and dist_real_def by auto | |
| 4828 | } | |
| 4829 | then show ?rhs by auto | |
| 33175 | 4830 | next | 
| 4831 | assume ?rhs | |
| 53282 | 4832 |   {
 | 
| 4833 | assume "\<not> ?lhs" | |
| 4834 | 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" | |
| 4835 | unfolding uniformly_continuous_on_def by auto | |
| 4836 | then obtain fa where fa: | |
| 4837 | "\<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" | |
| 4838 | 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"] | |
| 4839 | unfolding Bex_def | |
| 33175 | 4840 | by (auto simp add: dist_commute) | 
| 4841 | def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))" | |
| 4842 | def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))" | |
| 53282 | 4843 | have xyn: "\<forall>n. x n \<in> s \<and> y n \<in> s" | 
| 4844 | and xy0: "\<forall>n. dist (x n) (y n) < inverse (real n + 1)" | |
| 4845 | and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e" | |
| 4846 | unfolding x_def and y_def using fa | |
| 4847 | by auto | |
| 4848 |     {
 | |
| 4849 | fix e :: real | |
| 4850 | assume "e > 0" | |
| 4851 | then obtain N :: nat where "N \<noteq> 0" and N: "0 < inverse (real N) \<and> inverse (real N) < e" | |
| 4852 | unfolding real_arch_inv[of e] by auto | |
| 4853 |       {
 | |
| 4854 | fix n :: nat | |
| 4855 | assume "n \<ge> N" | |
| 4856 | then have "inverse (real n + 1) < inverse (real N)" | |
| 4857 | using real_of_nat_ge_zero and `N\<noteq>0` by auto | |
| 33175 | 4858 | also have "\<dots> < e" using N by auto | 
| 4859 | finally have "inverse (real n + 1) < e" by auto | |
| 53282 | 4860 | then have "dist (x n) (y n) < e" | 
| 4861 | using xy0[THEN spec[where x=n]] by auto | |
| 4862 | } | |
| 4863 | then have "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto | |
| 4864 | } | |
| 4865 | then have "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" | |
| 4866 | using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn | |
| 4867 | unfolding LIMSEQ_def dist_real_def by auto | |
| 4868 | then have False using fxy and `e>0` by auto | |
| 4869 | } | |
| 4870 | then show ?lhs | |
| 4871 | unfolding uniformly_continuous_on_def by blast | |
| 33175 | 4872 | qed | 
| 4873 | ||
| 4874 | text{* The usual transformation theorems. *}
 | |
| 4875 | ||
| 4876 | lemma continuous_transform_within: | |
| 36667 | 4877 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 53282 | 4878 | assumes "0 < d" | 
| 4879 | and "x \<in> s" | |
| 4880 | and "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'" | |
| 4881 | and "continuous (at x within s) f" | |
| 33175 | 4882 | shows "continuous (at x within s) g" | 
| 53282 | 4883 | unfolding continuous_within | 
| 36667 | 4884 | proof (rule Lim_transform_within) | 
| 4885 | show "0 < d" by fact | |
| 4886 | show "\<forall>x'\<in>s. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | |
| 4887 | using assms(3) by auto | |
| 4888 | have "f x = g x" | |
| 4889 | using assms(1,2,3) by auto | |
| 53282 | 4890 | then show "(f ---> g x) (at x within s)" | 
| 36667 | 4891 | using assms(4) unfolding continuous_within by simp | 
| 33175 | 4892 | qed | 
| 4893 | ||
| 4894 | lemma continuous_transform_at: | |
| 36667 | 4895 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 53282 | 4896 | assumes "0 < d" | 
| 4897 | and "\<forall>x'. dist x' x < d --> f x' = g x'" | |
| 4898 | and "continuous (at x) f" | |
| 33175 | 4899 | shows "continuous (at x) g" | 
| 45031 | 4900 | using continuous_transform_within [of d x UNIV f g] assms by simp | 
| 33175 | 4901 | |
| 53282 | 4902 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4903 | subsubsection {* Structural rules for pointwise continuity *}
 | 
| 33175 | 4904 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 4905 | lemmas continuous_within_id = continuous_ident | 
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 4906 | |
| 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 4907 | lemmas continuous_at_id = isCont_ident | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4908 | |
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 4909 | lemma continuous_infdist[continuous_intros]: | 
| 50087 | 4910 | assumes "continuous F f" | 
| 4911 | shows "continuous F (\<lambda>x. infdist (f x) A)" | |
| 4912 | using assms unfolding continuous_def by (rule tendsto_infdist) | |
| 4913 | ||
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 4914 | lemma continuous_infnorm[continuous_intros]: | 
| 53282 | 4915 | "continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))" | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4916 | unfolding continuous_def by (rule tendsto_infnorm) | 
| 33175 | 4917 | |
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 4918 | lemma continuous_inner[continuous_intros]: | 
| 53282 | 4919 | assumes "continuous F f" | 
| 4920 | and "continuous F g" | |
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4921 | shows "continuous F (\<lambda>x. inner (f x) (g x))" | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4922 | using assms unfolding continuous_def by (rule tendsto_inner) | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4923 | |
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 4924 | lemmas continuous_at_inverse = isCont_inverse | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4925 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4926 | subsubsection {* Structural rules for setwise continuity *}
 | 
| 33175 | 4927 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4928 | lemma continuous_on_infnorm[continuous_intros]: | 
| 53282 | 4929 | "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. infnorm (f x))" | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4930 | unfolding continuous_on by (fast intro: tendsto_infnorm) | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4931 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4932 | lemma continuous_on_inner[continuous_intros]: | 
| 44531 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 4933 | fixes g :: "'a::topological_space \<Rightarrow> 'b::real_inner" | 
| 53282 | 4934 | assumes "continuous_on s f" | 
| 4935 | and "continuous_on s g" | |
| 44531 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 4936 | shows "continuous_on s (\<lambda>x. inner (f x) (g x))" | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 4937 | using bounded_bilinear_inner assms | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 4938 | by (rule bounded_bilinear.continuous_on) | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 4939 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4940 | subsubsection {* Structural rules for uniform continuity *}
 | 
| 33175 | 4941 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4942 | lemma uniformly_continuous_on_id[continuous_intros]: | 
| 53282 | 4943 | "uniformly_continuous_on s (\<lambda>x. x)" | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4944 | unfolding uniformly_continuous_on_def by auto | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4945 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4946 | lemma uniformly_continuous_on_const[continuous_intros]: | 
| 53282 | 4947 | "uniformly_continuous_on s (\<lambda>x. c)" | 
| 33175 | 4948 | unfolding uniformly_continuous_on_def by simp | 
| 4949 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4950 | lemma uniformly_continuous_on_dist[continuous_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4951 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::metric_space" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4952 | assumes "uniformly_continuous_on s f" | 
| 53282 | 4953 | and "uniformly_continuous_on s g" | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4954 | shows "uniformly_continuous_on s (\<lambda>x. dist (f x) (g x))" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4955 | proof - | 
| 53282 | 4956 |   {
 | 
| 4957 | fix a b c d :: 'b | |
| 4958 | have "\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d" | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4959 | using dist_triangle2 [of a b c] dist_triangle2 [of b c d] | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4960 | using dist_triangle3 [of c d a] dist_triangle [of a d b] | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4961 | by arith | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4962 | } note le = this | 
| 53282 | 4963 |   {
 | 
| 4964 | fix x y | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4965 | assume f: "(\<lambda>n. dist (f (x n)) (f (y n))) ----> 0" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4966 | assume g: "(\<lambda>n. dist (g (x n)) (g (y n))) ----> 0" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4967 | have "(\<lambda>n. \<bar>dist (f (x n)) (g (x n)) - dist (f (y n)) (g (y n))\<bar>) ----> 0" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4968 | by (rule Lim_transform_bound [OF _ tendsto_add_zero [OF f g]], | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4969 | simp add: le) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4970 | } | 
| 53282 | 4971 | then show ?thesis | 
| 4972 | using assms unfolding uniformly_continuous_on_sequentially | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4973 | unfolding dist_real_def by simp | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4974 | qed | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4975 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4976 | lemma uniformly_continuous_on_norm[continuous_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4977 | assumes "uniformly_continuous_on s f" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4978 | shows "uniformly_continuous_on s (\<lambda>x. norm (f x))" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4979 | unfolding norm_conv_dist using assms | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4980 | by (intro uniformly_continuous_on_dist uniformly_continuous_on_const) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4981 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4982 | lemma (in bounded_linear) uniformly_continuous_on[continuous_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4983 | assumes "uniformly_continuous_on s g" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4984 | shows "uniformly_continuous_on s (\<lambda>x. f (g x))" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4985 | using assms unfolding uniformly_continuous_on_sequentially | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4986 | unfolding dist_norm tendsto_norm_zero_iff diff[symmetric] | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4987 | by (auto intro: tendsto_zero) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4988 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 4989 | lemma uniformly_continuous_on_cmul[continuous_intros]: | 
| 36441 | 4990 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | 
| 33175 | 4991 | assumes "uniformly_continuous_on s f" | 
| 4992 | shows "uniformly_continuous_on s (\<lambda>x. c *\<^sub>R f(x))" | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4993 | using bounded_linear_scaleR_right assms | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 4994 | by (rule bounded_linear.uniformly_continuous_on) | 
| 33175 | 4995 | |
| 4996 | lemma dist_minus: | |
| 4997 | fixes x y :: "'a::real_normed_vector" | |
| 4998 | shows "dist (- x) (- y) = dist x y" | |
| 4999 | unfolding dist_norm minus_diff_minus norm_minus_cancel .. | |
| 5000 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 5001 | lemma uniformly_continuous_on_minus[continuous_intros]: | 
| 33175 | 5002 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5003 | shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. - f x)" | 
| 33175 | 5004 | unfolding uniformly_continuous_on_def dist_minus . | 
| 5005 | ||
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 5006 | lemma uniformly_continuous_on_add[continuous_intros]: | 
| 36441 | 5007 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5008 | assumes "uniformly_continuous_on s f" | 
| 53282 | 5009 | and "uniformly_continuous_on s g" | 
| 33175 | 5010 | shows "uniformly_continuous_on s (\<lambda>x. f x + g x)" | 
| 53282 | 5011 | using assms | 
| 5012 | unfolding uniformly_continuous_on_sequentially | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5013 | unfolding dist_norm tendsto_norm_zero_iff add_diff_add | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5014 | by (auto intro: tendsto_add_zero) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5015 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 5016 | lemma uniformly_continuous_on_diff[continuous_intros]: | 
| 36441 | 5017 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | 
| 53282 | 5018 | assumes "uniformly_continuous_on s f" | 
| 5019 | and "uniformly_continuous_on s g" | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 5020 | shows "uniformly_continuous_on s (\<lambda>x. f x - g x)" | 
| 54230 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
54070diff
changeset | 5021 | using assms uniformly_continuous_on_add [of s f "- g"] | 
| 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
54070diff
changeset | 5022 | by (simp add: fun_Compl_def uniformly_continuous_on_minus) | 
| 33175 | 5023 | |
| 5024 | text{* Continuity of all kinds is preserved under composition. *}
 | |
| 5025 | ||
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 5026 | lemmas continuous_at_compose = isCont_o | 
| 33175 | 5027 | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 5028 | lemma uniformly_continuous_on_compose[continuous_intros]: | 
| 33175 | 5029 | assumes "uniformly_continuous_on s f" "uniformly_continuous_on (f ` s) g" | 
| 53640 | 5030 | shows "uniformly_continuous_on s (g \<circ> f)" | 
| 5031 | proof - | |
| 53282 | 5032 |   {
 | 
| 5033 | fix e :: real | |
| 5034 | assume "e > 0" | |
| 5035 | then obtain d where "d > 0" | |
| 5036 | and d: "\<forall>x\<in>f ` s. \<forall>x'\<in>f ` s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" | |
| 5037 | using assms(2) unfolding uniformly_continuous_on_def by auto | |
| 5038 | obtain d' where "d'>0" "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d' \<longrightarrow> dist (f x') (f x) < d" | |
| 5039 | using `d > 0` using assms(1) unfolding uniformly_continuous_on_def by auto | |
| 5040 | then have "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist ((g \<circ> f) x') ((g \<circ> f) x) < e" | |
| 5041 | using `d>0` using d by auto | |
| 5042 | } | |
| 5043 | then show ?thesis | |
| 5044 | using assms unfolding uniformly_continuous_on_def by auto | |
| 33175 | 5045 | qed | 
| 5046 | ||
| 5047 | text{* Continuity in terms of open preimages. *}
 | |
| 5048 | ||
| 5049 | lemma continuous_at_open: | |
| 53282 | 5050 | "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))" | 
| 5051 | unfolding continuous_within_topological [of x UNIV f] | |
| 5052 | unfolding imp_conjL | |
| 5053 | by (intro all_cong imp_cong ex_cong conj_cong refl) auto | |
| 33175 | 5054 | |
| 51351 | 5055 | lemma continuous_imp_tendsto: | 
| 53282 | 5056 | assumes "continuous (at x0) f" | 
| 5057 | and "x ----> x0" | |
| 51351 | 5058 | shows "(f \<circ> x) ----> (f x0)" | 
| 5059 | proof (rule topological_tendstoI) | |
| 5060 | fix S | |
| 5061 | assume "open S" "f x0 \<in> S" | |
| 5062 | then obtain T where T_def: "open T" "x0 \<in> T" "\<forall>x\<in>T. f x \<in> S" | |
| 5063 | using assms continuous_at_open by metis | |
| 5064 | then have "eventually (\<lambda>n. x n \<in> T) sequentially" | |
| 5065 | using assms T_def by (auto simp: tendsto_def) | |
| 5066 | then show "eventually (\<lambda>n. (f \<circ> x) n \<in> S) sequentially" | |
| 5067 | using T_def by (auto elim!: eventually_elim1) | |
| 5068 | qed | |
| 5069 | ||
| 33175 | 5070 | lemma continuous_on_open: | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 5071 | "continuous_on s f \<longleftrightarrow> | 
| 53282 | 5072 | (\<forall>t. openin (subtopology euclidean (f ` s)) t \<longrightarrow> | 
| 5073 |       openin (subtopology euclidean s) {x \<in> s. f x \<in> t})"
 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 5074 | unfolding continuous_on_open_invariant openin_open Int_def vimage_def Int_commute | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 5075 | by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) | 
| 36441 | 5076 | |
| 5077 | text {* Similarly in terms of closed sets. *}
 | |
| 33175 | 5078 | |
| 5079 | lemma continuous_on_closed: | |
| 53282 | 5080 | "continuous_on s f \<longleftrightarrow> | 
| 5081 | (\<forall>t. closedin (subtopology euclidean (f ` s)) t \<longrightarrow> | |
| 5082 |       closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})"
 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 5083 | unfolding continuous_on_closed_invariant closedin_closed Int_def vimage_def Int_commute | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 5084 | by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) | 
| 33175 | 5085 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5086 | text {* Half-global and completely global cases. *}
 | 
| 33175 | 5087 | |
| 5088 | lemma continuous_open_in_preimage: | |
| 5089 | assumes "continuous_on s f" "open t" | |
| 5090 |   shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | |
| 53282 | 5091 | proof - | 
| 5092 | have *: "\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" | |
| 5093 | by auto | |
| 33175 | 5094 | have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" | 
| 5095 | using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto | |
| 53282 | 5096 | then show ?thesis | 
| 5097 | using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] | |
| 5098 | using * by auto | |
| 33175 | 5099 | qed | 
| 5100 | ||
| 5101 | lemma continuous_closed_in_preimage: | |
| 53291 | 5102 | assumes "continuous_on s f" and "closed t" | 
| 33175 | 5103 |   shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | 
| 53282 | 5104 | proof - | 
| 5105 | have *: "\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" | |
| 5106 | by auto | |
| 33175 | 5107 | have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" | 
| 53282 | 5108 | using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute | 
| 5109 | by auto | |
| 5110 | then show ?thesis | |
| 5111 | using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] | |
| 5112 | using * by auto | |
| 33175 | 5113 | qed | 
| 5114 | ||
| 5115 | lemma continuous_open_preimage: | |
| 53291 | 5116 | assumes "continuous_on s f" | 
| 5117 | and "open s" | |
| 5118 | and "open t" | |
| 33175 | 5119 |   shows "open {x \<in> s. f x \<in> t}"
 | 
| 5120 | proof- | |
| 5121 |   obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | |
| 5122 | using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto | |
| 53282 | 5123 | then show ?thesis | 
| 5124 | using open_Int[of s T, OF assms(2)] by auto | |
| 33175 | 5125 | qed | 
| 5126 | ||
| 5127 | lemma continuous_closed_preimage: | |
| 53291 | 5128 | assumes "continuous_on s f" | 
| 5129 | and "closed s" | |
| 5130 | and "closed t" | |
| 33175 | 5131 |   shows "closed {x \<in> s. f x \<in> t}"
 | 
| 5132 | proof- | |
| 53282 | 5133 |   obtain T where "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | 
| 5134 | using continuous_closed_in_preimage[OF assms(1,3)] | |
| 5135 | unfolding closedin_closed by auto | |
| 5136 | then show ?thesis using closed_Int[of s T, OF assms(2)] by auto | |
| 33175 | 5137 | qed | 
| 5138 | ||
| 5139 | lemma continuous_open_preimage_univ: | |
| 53282 | 5140 |   "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
 | 
| 33175 | 5141 | using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto | 
| 5142 | ||
| 5143 | lemma continuous_closed_preimage_univ: | |
| 53291 | 5144 |   "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s \<Longrightarrow> closed {x. f x \<in> s}"
 | 
| 33175 | 5145 | using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto | 
| 5146 | ||
| 53282 | 5147 | lemma continuous_open_vimage: "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)" | 
| 33175 | 5148 | unfolding vimage_def by (rule continuous_open_preimage_univ) | 
| 5149 | ||
| 53282 | 5150 | lemma continuous_closed_vimage: "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)" | 
| 33175 | 5151 | unfolding vimage_def by (rule continuous_closed_preimage_univ) | 
| 5152 | ||
| 36441 | 5153 | lemma interior_image_subset: | 
| 53291 | 5154 | assumes "\<forall>x. continuous (at x) f" | 
| 5155 | and "inj f" | |
| 35172 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 5156 | shows "interior (f ` s) \<subseteq> f ` (interior s)" | 
| 44519 | 5157 | proof | 
| 5158 | fix x assume "x \<in> interior (f ` s)" | |
| 5159 | then obtain T where as: "open T" "x \<in> T" "T \<subseteq> f ` s" .. | |
| 53282 | 5160 | then have "x \<in> f ` s" by auto | 
| 44519 | 5161 | then obtain y where y: "y \<in> s" "x = f y" by auto | 
| 5162 | have "open (vimage f T)" | |
| 5163 | using assms(1) `open T` by (rule continuous_open_vimage) | |
| 5164 | moreover have "y \<in> vimage f T" | |
| 5165 | using `x = f y` `x \<in> T` by simp | |
| 5166 | moreover have "vimage f T \<subseteq> s" | |
| 5167 | using `T \<subseteq> image f s` `inj f` unfolding inj_on_def subset_eq by auto | |
| 5168 | ultimately have "y \<in> interior s" .. | |
| 5169 | with `x = f y` show "x \<in> f ` interior s" .. | |
| 5170 | qed | |
| 35172 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 5171 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5172 | text {* Equality of continuous functions on closure and related results. *}
 | 
| 33175 | 5173 | |
| 5174 | lemma continuous_closed_in_preimage_constant: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5175 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 53291 | 5176 |   shows "continuous_on s f \<Longrightarrow> closedin (subtopology euclidean s) {x \<in> s. f x = a}"
 | 
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5177 |   using continuous_closed_in_preimage[of s f "{a}"] by auto
 | 
| 33175 | 5178 | |
| 5179 | lemma continuous_closed_preimage_constant: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5180 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 53291 | 5181 |   shows "continuous_on s f \<Longrightarrow> closed s \<Longrightarrow> closed {x \<in> s. f x = a}"
 | 
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5182 |   using continuous_closed_preimage[of s f "{a}"] by auto
 | 
| 33175 | 5183 | |
| 5184 | lemma continuous_constant_on_closure: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5185 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 33175 | 5186 | assumes "continuous_on (closure s) f" | 
| 53282 | 5187 | and "\<forall>x \<in> s. f x = a" | 
| 33175 | 5188 | shows "\<forall>x \<in> (closure s). f x = a" | 
| 5189 | using continuous_closed_preimage_constant[of "closure s" f a] | |
| 53282 | 5190 |       assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset
 | 
| 5191 | unfolding subset_eq | |
| 5192 | by auto | |
| 33175 | 5193 | |
| 5194 | lemma image_closure_subset: | |
| 53291 | 5195 | assumes "continuous_on (closure s) f" | 
| 5196 | and "closed t" | |
| 5197 | and "(f ` s) \<subseteq> t" | |
| 33175 | 5198 | shows "f ` (closure s) \<subseteq> t" | 
| 53282 | 5199 | proof - | 
| 5200 |   have "s \<subseteq> {x \<in> closure s. f x \<in> t}"
 | |
| 5201 | using assms(3) closure_subset by auto | |
| 33175 | 5202 |   moreover have "closed {x \<in> closure s. f x \<in> t}"
 | 
| 5203 | using continuous_closed_preimage[OF assms(1)] and assms(2) by auto | |
| 5204 |   ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
 | |
| 5205 |     using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
 | |
| 53282 | 5206 | then show ?thesis by auto | 
| 33175 | 5207 | qed | 
| 5208 | ||
| 5209 | lemma continuous_on_closure_norm_le: | |
| 5210 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | |
| 53282 | 5211 | assumes "continuous_on (closure s) f" | 
| 5212 | and "\<forall>y \<in> s. norm(f y) \<le> b" | |
| 5213 | and "x \<in> (closure s)" | |
| 53291 | 5214 | shows "norm (f x) \<le> b" | 
| 53282 | 5215 | proof - | 
| 5216 | have *: "f ` s \<subseteq> cball 0 b" | |
| 53291 | 5217 | using assms(2)[unfolded mem_cball_0[symmetric]] by auto | 
| 33175 | 5218 | show ?thesis | 
| 5219 | using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3) | |
| 53282 | 5220 | unfolding subset_eq | 
| 5221 | apply (erule_tac x="f x" in ballE) | |
| 5222 | apply (auto simp add: dist_norm) | |
| 5223 | done | |
| 33175 | 5224 | qed | 
| 5225 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5226 | text {* Making a continuous function avoid some value in a neighbourhood. *}
 | 
| 33175 | 5227 | |
| 5228 | lemma continuous_within_avoid: | |
| 50898 | 5229 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 53282 | 5230 | assumes "continuous (at x within s) f" | 
| 5231 | and "f x \<noteq> a" | |
| 33175 | 5232 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a" | 
| 53291 | 5233 | proof - | 
| 50898 | 5234 | obtain U where "open U" and "f x \<in> U" and "a \<notin> U" | 
| 5235 | using t1_space [OF `f x \<noteq> a`] by fast | |
| 5236 | have "(f ---> f x) (at x within s)" | |
| 5237 | using assms(1) by (simp add: continuous_within) | |
| 53282 | 5238 | then have "eventually (\<lambda>y. f y \<in> U) (at x within s)" | 
| 50898 | 5239 | using `open U` and `f x \<in> U` | 
| 5240 | unfolding tendsto_def by fast | |
| 53282 | 5241 | then have "eventually (\<lambda>y. f y \<noteq> a) (at x within s)" | 
| 50898 | 5242 | using `a \<notin> U` by (fast elim: eventually_mono [rotated]) | 
| 53282 | 5243 | then show ?thesis | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 5244 | using `f x \<noteq> a` by (auto simp: dist_commute zero_less_dist_iff eventually_at) | 
| 33175 | 5245 | qed | 
| 5246 | ||
| 5247 | lemma continuous_at_avoid: | |
| 50898 | 5248 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 53282 | 5249 | assumes "continuous (at x) f" | 
| 5250 | and "f x \<noteq> a" | |
| 33175 | 5251 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 45031 | 5252 | using assms continuous_within_avoid[of x UNIV f a] by simp | 
| 33175 | 5253 | |
| 5254 | lemma continuous_on_avoid: | |
| 50898 | 5255 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 53282 | 5256 | assumes "continuous_on s f" | 
| 5257 | and "x \<in> s" | |
| 5258 | and "f x \<noteq> a" | |
| 33175 | 5259 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 53282 | 5260 | using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], | 
| 5261 | OF assms(2)] continuous_within_avoid[of x s f a] | |
| 5262 | using assms(3) | |
| 5263 | by auto | |
| 33175 | 5264 | |
| 5265 | lemma continuous_on_open_avoid: | |
| 50898 | 5266 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 53291 | 5267 | assumes "continuous_on s f" | 
| 5268 | and "open s" | |
| 5269 | and "x \<in> s" | |
| 5270 | and "f x \<noteq> a" | |
| 33175 | 5271 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 53282 | 5272 | using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)] | 
| 5273 | using continuous_at_avoid[of x f a] assms(4) | |
| 5274 | by auto | |
| 33175 | 5275 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5276 | text {* Proving a function is constant by proving open-ness of level set. *}
 | 
| 33175 | 5277 | |
| 5278 | lemma continuous_levelset_open_in_cases: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5279 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 5280 | shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> | 
| 33175 | 5281 |         openin (subtopology euclidean s) {x \<in> s. f x = a}
 | 
| 53282 | 5282 | \<Longrightarrow> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)" | 
| 5283 | unfolding connected_clopen | |
| 5284 | using continuous_closed_in_preimage_constant by auto | |
| 33175 | 5285 | |
| 5286 | lemma continuous_levelset_open_in: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5287 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 5288 | shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> | 
| 33175 | 5289 |         openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
 | 
| 53291 | 5290 | (\<exists>x \<in> s. f x = a) \<Longrightarrow> (\<forall>x \<in> s. f x = a)" | 
| 53282 | 5291 | using continuous_levelset_open_in_cases[of s f ] | 
| 5292 | by meson | |
| 33175 | 5293 | |
| 5294 | lemma continuous_levelset_open: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 5295 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 53282 | 5296 | assumes "connected s" | 
| 5297 | and "continuous_on s f" | |
| 5298 |     and "open {x \<in> s. f x = a}"
 | |
| 5299 | and "\<exists>x \<in> s. f x = a" | |
| 33175 | 5300 | shows "\<forall>x \<in> s. f x = a" | 
| 53282 | 5301 | using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] | 
| 5302 | using assms (3,4) | |
| 5303 | by fast | |
| 33175 | 5304 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5305 | text {* Some arithmetical combinations (more to prove). *}
 | 
| 33175 | 5306 | |
| 5307 | lemma open_scaling[intro]: | |
| 5308 | fixes s :: "'a::real_normed_vector set" | |
| 53291 | 5309 | assumes "c \<noteq> 0" | 
| 5310 | and "open s" | |
| 33175 | 5311 | shows "open((\<lambda>x. c *\<^sub>R x) ` s)" | 
| 53282 | 5312 | proof - | 
| 5313 |   {
 | |
| 5314 | fix x | |
| 5315 | assume "x \<in> s" | |
| 5316 | then obtain e where "e>0" | |
| 5317 | and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> s" using assms(2)[unfolded open_dist, THEN bspec[where x=x]] | |
| 5318 | by auto | |
| 5319 | have "e * abs c > 0" | |
| 56544 | 5320 | using assms(1)[unfolded zero_less_abs_iff[symmetric]] `e>0` by auto | 
| 33175 | 5321 | moreover | 
| 53282 | 5322 |     {
 | 
| 5323 | fix y | |
| 5324 | assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>" | |
| 5325 | then have "norm ((1 / c) *\<^sub>R y - x) < e" | |
| 5326 | unfolding dist_norm | |
| 33175 | 5327 | using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1) | 
| 53291 | 5328 | assms(1)[unfolded zero_less_abs_iff[symmetric]] by (simp del:zero_less_abs_iff) | 
| 53282 | 5329 | then have "y \<in> op *\<^sub>R c ` s" | 
| 5330 | using rev_image_eqI[of "(1 / c) *\<^sub>R y" s y "op *\<^sub>R c"] | |
| 5331 | using e[THEN spec[where x="(1 / c) *\<^sub>R y"]] | |
| 5332 | using assms(1) | |
| 5333 | unfolding dist_norm scaleR_scaleR | |
| 5334 | by auto | |
| 5335 | } | |
| 5336 | ultimately have "\<exists>e>0. \<forall>x'. dist x' (c *\<^sub>R x) < e \<longrightarrow> x' \<in> op *\<^sub>R c ` s" | |
| 5337 | apply (rule_tac x="e * abs c" in exI) | |
| 5338 | apply auto | |
| 5339 | done | |
| 5340 | } | |
| 5341 | then show ?thesis unfolding open_dist by auto | |
| 33175 | 5342 | qed | 
| 5343 | ||
| 5344 | lemma minus_image_eq_vimage: | |
| 5345 | fixes A :: "'a::ab_group_add set" | |
| 5346 | shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A" | |
| 5347 | by (auto intro!: image_eqI [where f="\<lambda>x. - x"]) | |
| 5348 | ||
| 5349 | lemma open_negations: | |
| 5350 | fixes s :: "'a::real_normed_vector set" | |
| 54489 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
54263diff
changeset | 5351 | shows "open s \<Longrightarrow> open ((\<lambda>x. - x) ` s)" | 
| 
03ff4d1e6784
eliminiated neg_numeral in favour of - (numeral _)
 haftmann parents: 
54263diff
changeset | 5352 | using open_scaling [of "- 1" s] by simp | 
| 33175 | 5353 | |
| 5354 | lemma open_translation: | |
| 5355 | fixes s :: "'a::real_normed_vector set" | |
| 53291 | 5356 | assumes "open s" | 
| 5357 | shows "open((\<lambda>x. a + x) ` s)" | |
| 53282 | 5358 | proof - | 
| 5359 |   {
 | |
| 5360 | fix x | |
| 5361 | have "continuous (at x) (\<lambda>x. x - a)" | |
| 5362 | by (intro continuous_diff continuous_at_id continuous_const) | |
| 5363 | } | |
| 5364 |   moreover have "{x. x - a \<in> s} = op + a ` s"
 | |
| 5365 | by force | |
| 5366 | ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] | |
| 5367 | using assms by auto | |
| 33175 | 5368 | qed | 
| 5369 | ||
| 5370 | lemma open_affinity: | |
| 5371 | fixes s :: "'a::real_normed_vector set" | |
| 5372 | assumes "open s" "c \<noteq> 0" | |
| 5373 | shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 53282 | 5374 | proof - | 
| 5375 | have *: "(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" | |
| 5376 | unfolding o_def .. | |
| 5377 | have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" | |
| 5378 | by auto | |
| 5379 | then show ?thesis | |
| 5380 | using assms open_translation[of "op *\<^sub>R c ` s" a] | |
| 5381 | unfolding * | |
| 5382 | by auto | |
| 33175 | 5383 | qed | 
| 5384 | ||
| 5385 | lemma interior_translation: | |
| 5386 | fixes s :: "'a::real_normed_vector set" | |
| 5387 | shows "interior ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (interior s)" | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 5388 | proof (rule set_eqI, rule) | 
| 53282 | 5389 | fix x | 
| 5390 | assume "x \<in> interior (op + a ` s)" | |
| 5391 | then obtain e where "e > 0" and e: "ball x e \<subseteq> op + a ` s" | |
| 5392 | unfolding mem_interior by auto | |
| 5393 | then have "ball (x - a) e \<subseteq> s" | |
| 5394 | unfolding subset_eq Ball_def mem_ball dist_norm | |
| 59815 
cce82e360c2f
explicit commutative additive inverse operation;
 haftmann parents: 
59765diff
changeset | 5395 | by (auto simp add: diff_diff_eq) | 
| 53282 | 5396 | then show "x \<in> op + a ` interior s" | 
| 5397 | unfolding image_iff | |
| 5398 | apply (rule_tac x="x - a" in bexI) | |
| 5399 | unfolding mem_interior | |
| 5400 | using `e > 0` | |
| 5401 | apply auto | |
| 5402 | done | |
| 33175 | 5403 | next | 
| 53282 | 5404 | fix x | 
| 5405 | assume "x \<in> op + a ` interior s" | |
| 5406 | then obtain y e where "e > 0" and e: "ball y e \<subseteq> s" and y: "x = a + y" | |
| 5407 | unfolding image_iff Bex_def mem_interior by auto | |
| 5408 |   {
 | |
| 5409 | fix z | |
| 5410 | have *: "a + y - z = y + a - z" by auto | |
| 5411 | assume "z \<in> ball x e" | |
| 5412 | then have "z - a \<in> s" | |
| 5413 | using e[unfolded subset_eq, THEN bspec[where x="z - a"]] | |
| 5414 | unfolding mem_ball dist_norm y group_add_class.diff_diff_eq2 * | |
| 5415 | by auto | |
| 5416 | then have "z \<in> op + a ` s" | |
| 5417 | unfolding image_iff by (auto intro!: bexI[where x="z - a"]) | |
| 5418 | } | |
| 5419 | then have "ball x e \<subseteq> op + a ` s" | |
| 5420 | unfolding subset_eq by auto | |
| 5421 | then show "x \<in> interior (op + a ` s)" | |
| 5422 | unfolding mem_interior using `e > 0` by auto | |
| 33175 | 5423 | qed | 
| 5424 | ||
| 36437 | 5425 | text {* Topological properties of linear functions. *}
 | 
| 5426 | ||
| 5427 | lemma linear_lim_0: | |
| 53282 | 5428 | assumes "bounded_linear f" | 
| 5429 | shows "(f ---> 0) (at (0))" | |
| 5430 | proof - | |
| 36437 | 5431 | interpret f: bounded_linear f by fact | 
| 5432 | have "(f ---> f 0) (at 0)" | |
| 5433 | using tendsto_ident_at by (rule f.tendsto) | |
| 53282 | 5434 | then show ?thesis unfolding f.zero . | 
| 36437 | 5435 | qed | 
| 5436 | ||
| 5437 | lemma linear_continuous_at: | |
| 53282 | 5438 | assumes "bounded_linear f" | 
| 5439 | shows "continuous (at a) f" | |
| 36437 | 5440 | unfolding continuous_at using assms | 
| 5441 | apply (rule bounded_linear.tendsto) | |
| 5442 | apply (rule tendsto_ident_at) | |
| 5443 | done | |
| 5444 | ||
| 5445 | lemma linear_continuous_within: | |
| 53291 | 5446 | "bounded_linear f \<Longrightarrow> continuous (at x within s) f" | 
| 36437 | 5447 | using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto | 
| 5448 | ||
| 5449 | lemma linear_continuous_on: | |
| 53291 | 5450 | "bounded_linear f \<Longrightarrow> continuous_on s f" | 
| 36437 | 5451 | using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto | 
| 5452 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5453 | text {* Also bilinear functions, in composition form. *}
 | 
| 36437 | 5454 | |
| 5455 | lemma bilinear_continuous_at_compose: | |
| 53282 | 5456 | "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h \<Longrightarrow> | 
| 5457 | continuous (at x) (\<lambda>x. h (f x) (g x))" | |
| 5458 | unfolding continuous_at | |
| 5459 | using Lim_bilinear[of f "f x" "(at x)" g "g x" h] | |
| 5460 | by auto | |
| 36437 | 5461 | |
| 5462 | lemma bilinear_continuous_within_compose: | |
| 53282 | 5463 | "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h \<Longrightarrow> | 
| 5464 | continuous (at x within s) (\<lambda>x. h (f x) (g x))" | |
| 5465 | unfolding continuous_within | |
| 5466 | using Lim_bilinear[of f "f x"] | |
| 5467 | by auto | |
| 36437 | 5468 | |
| 5469 | lemma bilinear_continuous_on_compose: | |
| 53282 | 5470 | "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h \<Longrightarrow> | 
| 5471 | continuous_on s (\<lambda>x. h (f x) (g x))" | |
| 36441 | 5472 | unfolding continuous_on_def | 
| 5473 | by (fast elim: bounded_bilinear.tendsto) | |
| 36437 | 5474 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5475 | text {* Preservation of compactness and connectedness under continuous function. *}
 | 
| 33175 | 5476 | |
| 50898 | 5477 | lemma compact_eq_openin_cover: | 
| 5478 | "compact S \<longleftrightarrow> | |
| 5479 | (\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow> | |
| 5480 | (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))" | |
| 5481 | proof safe | |
| 5482 | fix C | |
| 5483 | assume "compact S" and "\<forall>c\<in>C. openin (subtopology euclidean S) c" and "S \<subseteq> \<Union>C" | |
| 53282 | 5484 |   then have "\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c" and "S \<subseteq> \<Union>{T. open T \<and> S \<inter> T \<in> C}"
 | 
| 50898 | 5485 | unfolding openin_open by force+ | 
| 5486 |   with `compact S` obtain D where "D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}" and "finite D" and "S \<subseteq> \<Union>D"
 | |
| 5487 | by (rule compactE) | |
| 53282 | 5488 | then have "image (\<lambda>T. S \<inter> T) D \<subseteq> C \<and> finite (image (\<lambda>T. S \<inter> T) D) \<and> S \<subseteq> \<Union>(image (\<lambda>T. S \<inter> T) D)" | 
| 50898 | 5489 | by auto | 
| 53282 | 5490 | then show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" .. | 
| 50898 | 5491 | next | 
| 5492 | assume 1: "\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow> | |
| 5493 | (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D)" | |
| 5494 | show "compact S" | |
| 5495 | proof (rule compactI) | |
| 5496 | fix C | |
| 5497 | let ?C = "image (\<lambda>T. S \<inter> T) C" | |
| 5498 | assume "\<forall>t\<in>C. open t" and "S \<subseteq> \<Union>C" | |
| 53282 | 5499 | then have "(\<forall>c\<in>?C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>?C" | 
| 50898 | 5500 | unfolding openin_open by auto | 
| 5501 | with 1 obtain D where "D \<subseteq> ?C" and "finite D" and "S \<subseteq> \<Union>D" | |
| 5502 | by metis | |
| 5503 | let ?D = "inv_into C (\<lambda>T. S \<inter> T) ` D" | |
| 5504 | have "?D \<subseteq> C \<and> finite ?D \<and> S \<subseteq> \<Union>?D" | |
| 5505 | proof (intro conjI) | |
| 5506 | from `D \<subseteq> ?C` show "?D \<subseteq> C" | |
| 5507 | by (fast intro: inv_into_into) | |
| 5508 | from `finite D` show "finite ?D" | |
| 5509 | by (rule finite_imageI) | |
| 5510 | from `S \<subseteq> \<Union>D` show "S \<subseteq> \<Union>?D" | |
| 5511 | apply (rule subset_trans) | |
| 5512 | apply clarsimp | |
| 5513 | apply (frule subsetD [OF `D \<subseteq> ?C`, THEN f_inv_into_f]) | |
| 5514 | apply (erule rev_bexI, fast) | |
| 5515 | done | |
| 5516 | qed | |
| 53282 | 5517 | then show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" .. | 
| 50898 | 5518 | qed | 
| 5519 | qed | |
| 5520 | ||
| 33175 | 5521 | lemma connected_continuous_image: | 
| 53291 | 5522 | assumes "continuous_on s f" | 
| 5523 | and "connected s" | |
| 33175 | 5524 | shows "connected(f ` s)" | 
| 53282 | 5525 | proof - | 
| 5526 |   {
 | |
| 5527 | fix T | |
| 53291 | 5528 | assume as: | 
| 5529 |       "T \<noteq> {}"
 | |
| 5530 | "T \<noteq> f ` s" | |
| 5531 | "openin (subtopology euclidean (f ` s)) T" | |
| 5532 | "closedin (subtopology euclidean (f ` s)) T" | |
| 33175 | 5533 |     have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
 | 
| 5534 | using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]] | |
| 5535 | using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]] | |
| 5536 |       using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
 | |
| 53282 | 5537 | then have False using as(1,2) | 
| 5538 | using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto | |
| 5539 | } | |
| 5540 | then show ?thesis | |
| 5541 | unfolding connected_clopen by auto | |
| 33175 | 5542 | qed | 
| 5543 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5544 | text {* Continuity implies uniform continuity on a compact domain. *}
 | 
| 53282 | 5545 | |
| 33175 | 5546 | lemma compact_uniformly_continuous: | 
| 53291 | 5547 | assumes f: "continuous_on s f" | 
| 5548 | and s: "compact s" | |
| 33175 | 5549 | shows "uniformly_continuous_on s f" | 
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5550 | unfolding uniformly_continuous_on_def | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5551 | proof (cases, safe) | 
| 53282 | 5552 | fix e :: real | 
| 5553 |   assume "0 < e" "s \<noteq> {}"
 | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5554 |   def [simp]: R \<equiv> "{(y, d). y \<in> s \<and> 0 < d \<and> ball y d \<inter> s \<subseteq> {x \<in> s. f x \<in> ball (f y) (e/2) } }"
 | 
| 50944 | 5555 | let ?b = "(\<lambda>(y, d). ball y (d/2))" | 
| 5556 | have "(\<forall>r\<in>R. open (?b r))" "s \<subseteq> (\<Union>r\<in>R. ?b r)" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5557 | proof safe | 
| 53282 | 5558 | fix y | 
| 5559 | assume "y \<in> s" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5560 | from continuous_open_in_preimage[OF f open_ball] | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5561 |     obtain T where "open T" and T: "{x \<in> s. f x \<in> ball (f y) (e/2)} = T \<inter> s"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5562 | unfolding openin_subtopology open_openin by metis | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5563 | then obtain d where "ball y d \<subseteq> T" "0 < d" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5564 | using `0 < e` `y \<in> s` by (auto elim!: openE) | 
| 50944 | 5565 | with T `y \<in> s` show "y \<in> (\<Union>r\<in>R. ?b r)" | 
| 5566 | by (intro UN_I[of "(y, d)"]) auto | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5567 | qed auto | 
| 50944 | 5568 | with s obtain D where D: "finite D" "D \<subseteq> R" "s \<subseteq> (\<Union>(y, d)\<in>D. ball y (d/2))" | 
| 5569 | by (rule compactE_image) | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5570 |   with `s \<noteq> {}` have [simp]: "\<And>x. x < Min (snd ` D) \<longleftrightarrow> (\<forall>(y, d)\<in>D. x < d)"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5571 | by (subst Min_gr_iff) auto | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5572 | show "\<exists>d>0. \<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f x') (f x) < e" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5573 | proof (rule, safe) | 
| 53282 | 5574 | fix x x' | 
| 5575 | assume in_s: "x' \<in> s" "x \<in> s" | |
| 50943 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5576 | with D obtain y d where x: "x \<in> ball y (d/2)" "(y, d) \<in> D" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5577 | by blast | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5578 | moreover assume "dist x x' < Min (snd`D) / 2" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5579 | ultimately have "dist y x' < d" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5580 | by (intro dist_double[where x=x and d=d]) (auto simp: dist_commute) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5581 | with D x in_s show "dist (f x) (f x') < e" | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5582 | by (intro dist_double[where x="f y" and d=e]) (auto simp: dist_commute subset_eq) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5583 | qed (insert D, auto) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 5584 | qed auto | 
| 33175 | 5585 | |
| 36437 | 5586 | text {* A uniformly convergent limit of continuous functions is continuous. *}
 | 
| 33175 | 5587 | |
| 5588 | lemma continuous_uniform_limit: | |
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5589 | fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::metric_space" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5590 | assumes "\<not> trivial_limit F" | 
| 53282 | 5591 | and "eventually (\<lambda>n. continuous_on s (f n)) F" | 
| 5592 | and "\<forall>e>0. eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e) F" | |
| 33175 | 5593 | shows "continuous_on s g" | 
| 53282 | 5594 | proof - | 
| 5595 |   {
 | |
| 5596 | fix x and e :: real | |
| 5597 | assume "x\<in>s" "e>0" | |
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5598 | have "eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e / 3) F" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5599 | using `e>0` assms(3)[THEN spec[where x="e/3"]] by auto | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5600 | from eventually_happens [OF eventually_conj [OF this assms(2)]] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5601 | obtain n where n:"\<forall>x\<in>s. dist (f n x) (g x) < e / 3" "continuous_on s (f n)" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5602 | using assms(1) by blast | 
| 33175 | 5603 | have "e / 3 > 0" using `e>0` by auto | 
| 5604 | then obtain d where "d>0" and d:"\<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (f n x') (f n x) < e / 3" | |
| 36359 | 5605 | using n(2)[unfolded continuous_on_iff, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast | 
| 53282 | 5606 |     {
 | 
| 5607 | fix y | |
| 5608 | assume "y \<in> s" and "dist y x < d" | |
| 5609 | then have "dist (f n y) (f n x) < e / 3" | |
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5610 | by (rule d [rule_format]) | 
| 53282 | 5611 | then have "dist (f n y) (g x) < 2 * e / 3" | 
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5612 | using dist_triangle [of "f n y" "g x" "f n x"] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5613 | using n(1)[THEN bspec[where x=x], OF `x\<in>s`] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5614 | by auto | 
| 53282 | 5615 | then have "dist (g y) (g x) < e" | 
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5616 | using n(1)[THEN bspec[where x=y], OF `y\<in>s`] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 5617 | using dist_triangle3 [of "g y" "g x" "f n y"] | 
| 53282 | 5618 | by auto | 
| 5619 | } | |
| 5620 | then have "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" | |
| 5621 | using `d>0` by auto | |
| 5622 | } | |
| 5623 | then show ?thesis | |
| 5624 | unfolding continuous_on_iff by auto | |
| 33175 | 5625 | qed | 
| 5626 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5627 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5628 | subsection {* Topological stuff lifted from and dropped to R *}
 | 
| 33175 | 5629 | |
| 5630 | lemma open_real: | |
| 53282 | 5631 | fixes s :: "real set" | 
| 5632 | shows "open s \<longleftrightarrow> (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" | |
| 33175 | 5633 | unfolding open_dist dist_norm by simp | 
| 5634 | ||
| 5635 | lemma islimpt_approachable_real: | |
| 5636 | fixes s :: "real set" | |
| 5637 | shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)" | |
| 5638 | unfolding islimpt_approachable dist_norm by simp | |
| 5639 | ||
| 5640 | lemma closed_real: | |
| 5641 | fixes s :: "real set" | |
| 53282 | 5642 | shows "closed s \<longleftrightarrow> (\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e) \<longrightarrow> x \<in> s)" | 
| 33175 | 5643 | unfolding closed_limpt islimpt_approachable dist_norm by simp | 
| 5644 | ||
| 5645 | lemma continuous_at_real_range: | |
| 5646 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | |
| 53282 | 5647 | shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)" | 
| 5648 | unfolding continuous_at | |
| 5649 | unfolding Lim_at | |
| 53291 | 5650 | unfolding dist_nz[symmetric] | 
| 53282 | 5651 | unfolding dist_norm | 
| 5652 | apply auto | |
| 5653 | apply (erule_tac x=e in allE) | |
| 5654 | apply auto | |
| 5655 | apply (rule_tac x=d in exI) | |
| 5656 | apply auto | |
| 5657 | apply (erule_tac x=x' in allE) | |
| 5658 | apply auto | |
| 5659 | apply (erule_tac x=e in allE) | |
| 5660 | apply auto | |
| 5661 | done | |
| 33175 | 5662 | |
| 5663 | lemma continuous_on_real_range: | |
| 5664 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | |
| 53282 | 5665 | shows "continuous_on s f \<longleftrightarrow> | 
| 5666 | (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d \<longrightarrow> abs(f x' - f x) < e))" | |
| 36359 | 5667 | unfolding continuous_on_iff dist_norm by simp | 
| 33175 | 5668 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5669 | text {* Hence some handy theorems on distance, diameter etc. of/from a set. *}
 | 
| 33175 | 5670 | |
| 5671 | lemma distance_attains_sup: | |
| 5672 |   assumes "compact s" "s \<noteq> {}"
 | |
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5673 | shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a y \<le> dist a x" | 
| 33175 | 5674 | proof (rule continuous_attains_sup [OF assms]) | 
| 53282 | 5675 |   {
 | 
| 5676 | fix x | |
| 5677 | assume "x\<in>s" | |
| 33175 | 5678 | have "(dist a ---> dist a x) (at x within s)" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 5679 | by (intro tendsto_dist tendsto_const tendsto_ident_at) | 
| 33175 | 5680 | } | 
| 53282 | 5681 | then show "continuous_on s (dist a)" | 
| 33175 | 5682 | unfolding continuous_on .. | 
| 5683 | qed | |
| 5684 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5685 | text {* For \emph{minimal} distance, we only need closure, not compactness. *}
 | 
| 33175 | 5686 | |
| 5687 | lemma distance_attains_inf: | |
| 5688 | fixes a :: "'a::heine_borel" | |
| 53291 | 5689 | assumes "closed s" | 
| 5690 |     and "s \<noteq> {}"
 | |
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5691 | shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a x \<le> dist a y" | 
| 53282 | 5692 | proof - | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5693 | from assms(2) obtain b where "b \<in> s" by auto | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5694 | let ?B = "s \<inter> cball a (dist b a)" | 
| 53282 | 5695 |   have "?B \<noteq> {}" using `b \<in> s`
 | 
| 5696 | by (auto simp add: dist_commute) | |
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5697 | moreover have "continuous_on ?B (dist a)" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5698 | by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_at_id continuous_const) | 
| 33175 | 5699 | moreover have "compact ?B" | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5700 | by (intro closed_inter_compact `closed s` compact_cball) | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5701 | ultimately obtain x where "x \<in> ?B" "\<forall>y\<in>?B. dist a x \<le> dist a y" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 5702 | by (metis continuous_attains_inf) | 
| 53282 | 5703 | then show ?thesis by fastforce | 
| 33175 | 5704 | qed | 
| 5705 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5706 | |
| 36437 | 5707 | subsection {* Pasted sets *}
 | 
| 33175 | 5708 | |
| 5709 | lemma bounded_Times: | |
| 53282 | 5710 | assumes "bounded s" "bounded t" | 
| 5711 | shows "bounded (s \<times> t)" | |
| 5712 | proof - | |
| 33175 | 5713 | obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b" | 
| 5714 | using assms [unfolded bounded_def] by auto | |
| 53015 
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
 wenzelm parents: 
52625diff
changeset | 5715 | then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<^sup>2 + b\<^sup>2)" | 
| 33175 | 5716 | by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono) | 
| 53282 | 5717 | then show ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto | 
| 33175 | 5718 | qed | 
| 5719 | ||
| 5720 | lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B" | |
| 53282 | 5721 | by (induct x) simp | 
| 33175 | 5722 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 5723 | lemma seq_compact_Times: "seq_compact s \<Longrightarrow> seq_compact t \<Longrightarrow> seq_compact (s \<times> t)" | 
| 53282 | 5724 | unfolding seq_compact_def | 
| 5725 | apply clarify | |
| 5726 | apply (drule_tac x="fst \<circ> f" in spec) | |
| 5727 | apply (drule mp, simp add: mem_Times_iff) | |
| 5728 | apply (clarify, rename_tac l1 r1) | |
| 5729 | apply (drule_tac x="snd \<circ> f \<circ> r1" in spec) | |
| 5730 | apply (drule mp, simp add: mem_Times_iff) | |
| 5731 | apply (clarify, rename_tac l2 r2) | |
| 5732 | apply (rule_tac x="(l1, l2)" in rev_bexI, simp) | |
| 5733 | apply (rule_tac x="r1 \<circ> r2" in exI) | |
| 5734 | apply (rule conjI, simp add: subseq_def) | |
| 5735 | apply (drule_tac f=r2 in LIMSEQ_subseq_LIMSEQ, assumption) | |
| 5736 | apply (drule (1) tendsto_Pair) back | |
| 5737 | apply (simp add: o_def) | |
| 5738 | done | |
| 5739 | ||
| 5740 | lemma compact_Times: | |
| 51349 | 5741 | assumes "compact s" "compact t" | 
| 5742 | shows "compact (s \<times> t)" | |
| 5743 | proof (rule compactI) | |
| 53282 | 5744 | fix C | 
| 5745 | assume C: "\<forall>t\<in>C. open t" "s \<times> t \<subseteq> \<Union>C" | |
| 51349 | 5746 | have "\<forall>x\<in>s. \<exists>a. open a \<and> x \<in> a \<and> (\<exists>d\<subseteq>C. finite d \<and> a \<times> t \<subseteq> \<Union>d)" | 
| 5747 | proof | |
| 53282 | 5748 | fix x | 
| 5749 | assume "x \<in> s" | |
| 51349 | 5750 | have "\<forall>y\<in>t. \<exists>a b c. c \<in> C \<and> open a \<and> open b \<and> x \<in> a \<and> y \<in> b \<and> a \<times> b \<subseteq> c" (is "\<forall>y\<in>t. ?P y") | 
| 53282 | 5751 | proof | 
| 5752 | fix y | |
| 5753 | assume "y \<in> t" | |
| 51349 | 5754 | with `x \<in> s` C obtain c where "c \<in> C" "(x, y) \<in> c" "open c" by auto | 
| 5755 | then show "?P y" by (auto elim!: open_prod_elim) | |
| 5756 | qed | |
| 5757 | then obtain a b c where b: "\<And>y. y \<in> t \<Longrightarrow> open (b y)" | |
| 5758 | and c: "\<And>y. y \<in> t \<Longrightarrow> c y \<in> C \<and> open (a y) \<and> open (b y) \<and> x \<in> a y \<and> y \<in> b y \<and> a y \<times> b y \<subseteq> c y" | |
| 5759 | by metis | |
| 5760 | then have "\<forall>y\<in>t. open (b y)" "t \<subseteq> (\<Union>y\<in>t. b y)" by auto | |
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 5761 | from compactE_image[OF `compact t` this] obtain D where D: "D \<subseteq> t" "finite D" "t \<subseteq> (\<Union>y\<in>D. b y)" | 
| 51349 | 5762 | by auto | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 5763 | moreover from D c have "(\<Inter>y\<in>D. a y) \<times> t \<subseteq> (\<Union>y\<in>D. c y)" | 
| 51349 | 5764 | by (fastforce simp: subset_eq) | 
| 5765 | ultimately show "\<exists>a. open a \<and> x \<in> a \<and> (\<exists>d\<subseteq>C. finite d \<and> a \<times> t \<subseteq> \<Union>d)" | |
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 5766 | using c by (intro exI[of _ "c`D"] exI[of _ "\<Inter>(a`D)"] conjI) (auto intro!: open_INT) | 
| 51349 | 5767 | qed | 
| 5768 | then obtain a d where a: "\<forall>x\<in>s. open (a x)" "s \<subseteq> (\<Union>x\<in>s. a x)" | |
| 5769 | and d: "\<And>x. x \<in> s \<Longrightarrow> d x \<subseteq> C \<and> finite (d x) \<and> a x \<times> t \<subseteq> \<Union>d x" | |
| 5770 | unfolding subset_eq UN_iff by metis | |
| 53282 | 5771 | moreover | 
| 5772 | from compactE_image[OF `compact s` a] | |
| 5773 | obtain e where e: "e \<subseteq> s" "finite e" and s: "s \<subseteq> (\<Union>x\<in>e. a x)" | |
| 5774 | by auto | |
| 51349 | 5775 | moreover | 
| 53282 | 5776 |   {
 | 
| 5777 | from s have "s \<times> t \<subseteq> (\<Union>x\<in>e. a x \<times> t)" | |
| 5778 | by auto | |
| 5779 | also have "\<dots> \<subseteq> (\<Union>x\<in>e. \<Union>d x)" | |
| 5780 | using d `e \<subseteq> s` by (intro UN_mono) auto | |
| 5781 | finally have "s \<times> t \<subseteq> (\<Union>x\<in>e. \<Union>d x)" . | |
| 5782 | } | |
| 51349 | 5783 | ultimately show "\<exists>C'\<subseteq>C. finite C' \<and> s \<times> t \<subseteq> \<Union>C'" | 
| 5784 | by (intro exI[of _ "(\<Union>x\<in>e. d x)"]) (auto simp add: subset_eq) | |
| 5785 | qed | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 5786 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5787 | text{* Hence some useful properties follow quite easily. *}
 | 
| 33175 | 5788 | |
| 5789 | lemma compact_scaling: | |
| 5790 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5791 | assumes "compact s" | 
| 5792 | shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 5793 | proof - | |
| 33175 | 5794 | let ?f = "\<lambda>x. scaleR c x" | 
| 53282 | 5795 | have *: "bounded_linear ?f" by (rule bounded_linear_scaleR_right) | 
| 5796 | show ?thesis | |
| 5797 | using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f] | |
| 5798 | using linear_continuous_at[OF *] assms | |
| 5799 | by auto | |
| 33175 | 5800 | qed | 
| 5801 | ||
| 5802 | lemma compact_negations: | |
| 5803 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5804 | assumes "compact s" | 
| 53291 | 5805 | shows "compact ((\<lambda>x. - x) ` s)" | 
| 33175 | 5806 | using compact_scaling [OF assms, of "- 1"] by auto | 
| 5807 | ||
| 5808 | lemma compact_sums: | |
| 5809 | fixes s t :: "'a::real_normed_vector set" | |
| 53291 | 5810 | assumes "compact s" | 
| 5811 | and "compact t" | |
| 53282 | 5812 |   shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
 | 
| 5813 | proof - | |
| 5814 |   have *: "{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
 | |
| 5815 | apply auto | |
| 5816 | unfolding image_iff | |
| 5817 | apply (rule_tac x="(xa, y)" in bexI) | |
| 5818 | apply auto | |
| 5819 | done | |
| 33175 | 5820 | have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)" | 
| 5821 | unfolding continuous_on by (rule ballI) (intro tendsto_intros) | |
| 53282 | 5822 | then show ?thesis | 
| 5823 | unfolding * using compact_continuous_image compact_Times [OF assms] by auto | |
| 33175 | 5824 | qed | 
| 5825 | ||
| 5826 | lemma compact_differences: | |
| 5827 | fixes s t :: "'a::real_normed_vector set" | |
| 53291 | 5828 | assumes "compact s" | 
| 5829 | and "compact t" | |
| 5830 |   shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 33175 | 5831 | proof- | 
| 5832 |   have "{x - y | x y. x\<in>s \<and> y \<in> t} =  {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
 | |
| 53282 | 5833 | apply auto | 
| 5834 | apply (rule_tac x= xa in exI) | |
| 5835 | apply auto | |
| 5836 | done | |
| 5837 | then show ?thesis | |
| 5838 | using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto | |
| 33175 | 5839 | qed | 
| 5840 | ||
| 5841 | lemma compact_translation: | |
| 5842 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5843 | assumes "compact s" | 
| 5844 | shows "compact ((\<lambda>x. a + x) ` s)" | |
| 5845 | proof - | |
| 5846 |   have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s"
 | |
| 5847 | by auto | |
| 5848 | then show ?thesis | |
| 5849 | using compact_sums[OF assms compact_sing[of a]] by auto | |
| 33175 | 5850 | qed | 
| 5851 | ||
| 5852 | lemma compact_affinity: | |
| 5853 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5854 | assumes "compact s" | 
| 5855 | shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 5856 | proof - | |
| 5857 | have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" | |
| 5858 | by auto | |
| 5859 | then show ?thesis | |
| 5860 | using compact_translation[OF compact_scaling[OF assms], of a c] by auto | |
| 33175 | 5861 | qed | 
| 5862 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5863 | text {* Hence we get the following. *}
 | 
| 33175 | 5864 | |
| 5865 | lemma compact_sup_maxdistance: | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5866 | fixes s :: "'a::metric_space set" | 
| 53291 | 5867 | assumes "compact s" | 
| 5868 |     and "s \<noteq> {}"
 | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5869 | shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y" | 
| 53282 | 5870 | proof - | 
| 5871 | have "compact (s \<times> s)" | |
| 5872 | using `compact s` by (intro compact_Times) | |
| 5873 |   moreover have "s \<times> s \<noteq> {}"
 | |
| 5874 |     using `s \<noteq> {}` by auto
 | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5875 | moreover have "continuous_on (s \<times> s) (\<lambda>x. dist (fst x) (snd x))" | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 5876 | by (intro continuous_at_imp_continuous_on ballI continuous_intros) | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5877 | ultimately show ?thesis | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5878 | using continuous_attains_sup[of "s \<times> s" "\<lambda>x. dist (fst x) (snd x)"] by auto | 
| 33175 | 5879 | qed | 
| 5880 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5881 | text {* We can state this in terms of diameter of a set. *}
 | 
| 33175 | 5882 | |
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5883 | definition diameter :: "'a::metric_space set \<Rightarrow> real" where | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5884 |   "diameter S = (if S = {} then 0 else SUP (x,y):S\<times>S. dist x y)"
 | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5885 | |
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5886 | lemma diameter_bounded_bound: | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5887 | fixes s :: "'a :: metric_space set" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5888 | assumes s: "bounded s" "x \<in> s" "y \<in> s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5889 | shows "dist x y \<le> diameter s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5890 | proof - | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5891 | from s obtain z d where z: "\<And>x. x \<in> s \<Longrightarrow> dist z x \<le> d" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5892 | unfolding bounded_def by auto | 
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5893 | have "bdd_above (split dist ` (s\<times>s))" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5894 | proof (intro bdd_aboveI, safe) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5895 | fix a b | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5896 | assume "a \<in> s" "b \<in> s" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5897 | with z[of a] z[of b] dist_triangle[of a b z] | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5898 | show "dist a b \<le> 2 * d" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5899 | by (simp add: dist_commute) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5900 | qed | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5901 | moreover have "(x,y) \<in> s\<times>s" using s by auto | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5902 | ultimately have "dist x y \<le> (SUP (x,y):s\<times>s. dist x y)" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5903 | by (rule cSUP_upper2) simp | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5904 | with `x \<in> s` show ?thesis | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5905 | by (auto simp add: diameter_def) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5906 | qed | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5907 | |
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5908 | lemma diameter_lower_bounded: | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5909 | fixes s :: "'a :: metric_space set" | 
| 53282 | 5910 | assumes s: "bounded s" | 
| 5911 | and d: "0 < d" "d < diameter s" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5912 | shows "\<exists>x\<in>s. \<exists>y\<in>s. d < dist x y" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5913 | proof (rule ccontr) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5914 | assume contr: "\<not> ?thesis" | 
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5915 |   moreover have "s \<noteq> {}"
 | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5916 | using d by (auto simp add: diameter_def) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5917 | ultimately have "diameter s \<le> d" | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5918 | by (auto simp: not_less diameter_def intro!: cSUP_least) | 
| 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5919 | with `d < diameter s` show False by auto | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5920 | qed | 
| 33175 | 5921 | |
| 5922 | lemma diameter_bounded: | |
| 5923 | assumes "bounded s" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5924 | shows "\<forall>x\<in>s. \<forall>y\<in>s. dist x y \<le> diameter s" | 
| 53291 | 5925 | and "\<forall>d>0. d < diameter s \<longrightarrow> (\<exists>x\<in>s. \<exists>y\<in>s. dist x y > d)" | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5926 | using diameter_bounded_bound[of s] diameter_lower_bounded[of s] assms | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5927 | by auto | 
| 33175 | 5928 | |
| 5929 | lemma diameter_compact_attained: | |
| 53291 | 5930 | assumes "compact s" | 
| 5931 |     and "s \<noteq> {}"
 | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5932 | shows "\<exists>x\<in>s. \<exists>y\<in>s. dist x y = diameter s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5933 | proof - | 
| 53282 | 5934 | have b: "bounded s" using assms(1) | 
| 5935 | by (rule compact_imp_bounded) | |
| 53291 | 5936 | then obtain x y where xys: "x\<in>s" "y\<in>s" | 
| 5937 | and xy: "\<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 5938 | using compact_sup_maxdistance[OF assms] by auto | 
| 53282 | 5939 | then have "diameter s \<le> dist x y" | 
| 5940 | unfolding diameter_def | |
| 5941 | apply clarsimp | |
| 54260 
6a967667fd45
use INF and SUP on conditionally complete lattices in multivariate analysis
 hoelzl parents: 
54259diff
changeset | 5942 | apply (rule cSUP_least) | 
| 53282 | 5943 | apply fast+ | 
| 5944 | done | |
| 5945 | then show ?thesis | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 5946 | by (metis b diameter_bounded_bound order_antisym xys) | 
| 33175 | 5947 | qed | 
| 5948 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5949 | text {* Related results with closure as the conclusion. *}
 | 
| 33175 | 5950 | |
| 5951 | lemma closed_scaling: | |
| 5952 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5953 | assumes "closed s" | 
| 5954 | shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 53813 | 5955 | proof (cases "c = 0") | 
| 5956 | case True then show ?thesis | |
| 5957 | by (auto simp add: image_constant_conv) | |
| 33175 | 5958 | next | 
| 5959 | case False | |
| 53813 | 5960 | from assms have "closed ((\<lambda>x. inverse c *\<^sub>R x) -` s)" | 
| 5961 | by (simp add: continuous_closed_vimage) | |
| 5962 | also have "(\<lambda>x. inverse c *\<^sub>R x) -` s = (\<lambda>x. c *\<^sub>R x) ` s" | |
| 5963 | using `c \<noteq> 0` by (auto elim: image_eqI [rotated]) | |
| 5964 | finally show ?thesis . | |
| 33175 | 5965 | qed | 
| 5966 | ||
| 5967 | lemma closed_negations: | |
| 5968 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5969 | assumes "closed s" | 
| 5970 | shows "closed ((\<lambda>x. -x) ` s)" | |
| 33175 | 5971 | using closed_scaling[OF assms, of "- 1"] by simp | 
| 5972 | ||
| 5973 | lemma compact_closed_sums: | |
| 5974 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 5975 | assumes "compact s" and "closed t" | 
| 5976 |   shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 5977 | proof - | |
| 33175 | 5978 |   let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 5979 |   {
 | 
| 5980 | fix x l | |
| 5981 | assume as: "\<forall>n. x n \<in> ?S" "(x ---> l) sequentially" | |
| 5982 | from as(1) obtain f where f: "\<forall>n. x n = fst (f n) + snd (f n)" "\<forall>n. fst (f n) \<in> s" "\<forall>n. snd (f n) \<in> t" | |
| 33175 | 5983 | using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto | 
| 53282 | 5984 | obtain l' r where "l'\<in>s" and r: "subseq r" and lr: "(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially" | 
| 33175 | 5985 | using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto | 
| 5986 | have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially" | |
| 53282 | 5987 | using tendsto_diff[OF LIMSEQ_subseq_LIMSEQ[OF as(2) r] lr] and f(1) | 
| 5988 | unfolding o_def | |
| 5989 | by auto | |
| 5990 | then have "l - l' \<in> t" | |
| 53291 | 5991 | using assms(2)[unfolded closed_sequential_limits, | 
| 5992 | THEN spec[where x="\<lambda> n. snd (f (r n))"], | |
| 5993 | THEN spec[where x="l - l'"]] | |
| 53282 | 5994 | using f(3) | 
| 5995 | by auto | |
| 5996 | then have "l \<in> ?S" | |
| 5997 | using `l' \<in> s` | |
| 5998 | apply auto | |
| 5999 | apply (rule_tac x=l' in exI) | |
| 6000 | apply (rule_tac x="l - l'" in exI) | |
| 6001 | apply auto | |
| 6002 | done | |
| 33175 | 6003 | } | 
| 53282 | 6004 | then show ?thesis | 
| 6005 | unfolding closed_sequential_limits by fast | |
| 33175 | 6006 | qed | 
| 6007 | ||
| 6008 | lemma closed_compact_sums: | |
| 6009 | fixes s t :: "'a::real_normed_vector set" | |
| 53291 | 6010 | assumes "closed s" | 
| 6011 | and "compact t" | |
| 33175 | 6012 |   shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 6013 | proof - | 
| 6014 |   have "{x + y |x y. x \<in> t \<and> y \<in> s} = {x + y |x y. x \<in> s \<and> y \<in> t}"
 | |
| 6015 | apply auto | |
| 6016 | apply (rule_tac x=y in exI) | |
| 6017 | apply auto | |
| 6018 | apply (rule_tac x=y in exI) | |
| 6019 | apply auto | |
| 6020 | done | |
| 6021 | then show ?thesis | |
| 6022 | using compact_closed_sums[OF assms(2,1)] by simp | |
| 33175 | 6023 | qed | 
| 6024 | ||
| 6025 | lemma compact_closed_differences: | |
| 6026 | fixes s t :: "'a::real_normed_vector set" | |
| 53291 | 6027 | assumes "compact s" | 
| 6028 | and "closed t" | |
| 33175 | 6029 |   shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 6030 | proof - | 
| 33175 | 6031 |   have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} =  {x - y |x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 6032 | apply auto | 
| 6033 | apply (rule_tac x=xa in exI) | |
| 6034 | apply auto | |
| 6035 | apply (rule_tac x=xa in exI) | |
| 6036 | apply auto | |
| 6037 | done | |
| 6038 | then show ?thesis | |
| 6039 | using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto | |
| 33175 | 6040 | qed | 
| 6041 | ||
| 6042 | lemma closed_compact_differences: | |
| 6043 | fixes s t :: "'a::real_normed_vector set" | |
| 53291 | 6044 | assumes "closed s" | 
| 6045 | and "compact t" | |
| 33175 | 6046 |   shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 6047 | proof - | 
| 33175 | 6048 |   have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
 | 
| 53282 | 6049 | apply auto | 
| 6050 | apply (rule_tac x=xa in exI) | |
| 6051 | apply auto | |
| 6052 | apply (rule_tac x=xa in exI) | |
| 6053 | apply auto | |
| 6054 | done | |
| 6055 | then show ?thesis | |
| 6056 | using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp | |
| 33175 | 6057 | qed | 
| 6058 | ||
| 6059 | lemma closed_translation: | |
| 6060 | fixes a :: "'a::real_normed_vector" | |
| 53282 | 6061 | assumes "closed s" | 
| 6062 | shows "closed ((\<lambda>x. a + x) ` s)" | |
| 6063 | proof - | |
| 33175 | 6064 |   have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
 | 
| 53282 | 6065 | then show ?thesis | 
| 6066 | using compact_closed_sums[OF compact_sing[of a] assms] by auto | |
| 33175 | 6067 | qed | 
| 6068 | ||
| 34105 | 6069 | lemma translation_Compl: | 
| 6070 | fixes a :: "'a::ab_group_add" | |
| 6071 | shows "(\<lambda>x. a + x) ` (- t) = - ((\<lambda>x. a + x) ` t)" | |
| 53282 | 6072 | apply (auto simp add: image_iff) | 
| 6073 | apply (rule_tac x="x - a" in bexI) | |
| 6074 | apply auto | |
| 6075 | done | |
| 34105 | 6076 | |
| 33175 | 6077 | lemma translation_UNIV: | 
| 53282 | 6078 | fixes a :: "'a::ab_group_add" | 
| 6079 | shows "range (\<lambda>x. a + x) = UNIV" | |
| 6080 | apply (auto simp add: image_iff) | |
| 6081 | apply (rule_tac x="x - a" in exI) | |
| 6082 | apply auto | |
| 6083 | done | |
| 33175 | 6084 | |
| 6085 | lemma translation_diff: | |
| 6086 | fixes a :: "'a::ab_group_add" | |
| 6087 | shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)" | |
| 6088 | by auto | |
| 6089 | ||
| 6090 | lemma closure_translation: | |
| 6091 | fixes a :: "'a::real_normed_vector" | |
| 6092 | shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)" | |
| 53282 | 6093 | proof - | 
| 6094 | have *: "op + a ` (- s) = - op + a ` s" | |
| 6095 | apply auto | |
| 6096 | unfolding image_iff | |
| 6097 | apply (rule_tac x="x - a" in bexI) | |
| 6098 | apply auto | |
| 6099 | done | |
| 6100 | show ?thesis | |
| 6101 | unfolding closure_interior translation_Compl | |
| 6102 | using interior_translation[of a "- s"] | |
| 6103 | unfolding * | |
| 6104 | by auto | |
| 33175 | 6105 | qed | 
| 6106 | ||
| 6107 | lemma frontier_translation: | |
| 6108 | fixes a :: "'a::real_normed_vector" | |
| 6109 | shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)" | |
| 53282 | 6110 | unfolding frontier_def translation_diff interior_translation closure_translation | 
| 6111 | by auto | |
| 33175 | 6112 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6113 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6114 | subsection {* Separation between points and sets *}
 | 
| 33175 | 6115 | |
| 6116 | lemma separate_point_closed: | |
| 6117 | fixes s :: "'a::heine_borel set" | |
| 53291 | 6118 | assumes "closed s" | 
| 6119 | and "a \<notin> s" | |
| 53282 | 6120 | shows "\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x" | 
| 6121 | proof (cases "s = {}")
 | |
| 33175 | 6122 | case True | 
| 53282 | 6123 | then show ?thesis by(auto intro!: exI[where x=1]) | 
| 33175 | 6124 | next | 
| 6125 | case False | |
| 53282 | 6126 | from assms obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" | 
| 6127 |     using `s \<noteq> {}` distance_attains_inf [of s a] by blast
 | |
| 6128 | with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` | |
| 6129 | by blast | |
| 33175 | 6130 | qed | 
| 6131 | ||
| 6132 | lemma separate_compact_closed: | |
| 50949 | 6133 | fixes s t :: "'a::heine_borel set" | 
| 53282 | 6134 | assumes "compact s" | 
| 6135 |     and t: "closed t" "s \<inter> t = {}"
 | |
| 33175 | 6136 | shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6137 | proof cases | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6138 |   assume "s \<noteq> {} \<and> t \<noteq> {}"
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6139 |   then have "s \<noteq> {}" "t \<noteq> {}" by auto
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6140 | let ?inf = "\<lambda>x. infdist x t" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6141 | have "continuous_on s ?inf" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6142 | by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_at_id) | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6143 | then obtain x where x: "x \<in> s" "\<forall>y\<in>s. ?inf x \<le> ?inf y" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6144 |     using continuous_attains_inf[OF `compact s` `s \<noteq> {}`] by auto
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6145 | then have "0 < ?inf x" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6146 |     using t `t \<noteq> {}` in_closed_iff_infdist_zero by (auto simp: less_le infdist_nonneg)
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6147 | moreover have "\<forall>x'\<in>s. \<forall>y\<in>t. ?inf x \<le> dist x' y" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6148 | using x by (auto intro: order_trans infdist_le) | 
| 53282 | 6149 | ultimately show ?thesis by auto | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 6150 | qed (auto intro!: exI[of _ 1]) | 
| 33175 | 6151 | |
| 6152 | lemma separate_closed_compact: | |
| 50949 | 6153 | fixes s t :: "'a::heine_borel set" | 
| 53282 | 6154 | assumes "closed s" | 
| 6155 | and "compact t" | |
| 6156 |     and "s \<inter> t = {}"
 | |
| 33175 | 6157 | shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" | 
| 53282 | 6158 | proof - | 
| 6159 |   have *: "t \<inter> s = {}"
 | |
| 6160 | using assms(3) by auto | |
| 6161 | show ?thesis | |
| 6162 | using separate_compact_closed[OF assms(2,1) *] | |
| 6163 | apply auto | |
| 6164 | apply (rule_tac x=d in exI) | |
| 6165 | apply auto | |
| 6166 | apply (erule_tac x=y in ballE) | |
| 6167 | apply (auto simp add: dist_commute) | |
| 6168 | done | |
| 33175 | 6169 | qed | 
| 6170 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6171 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6172 | subsection {* Closure of halfspaces and hyperplanes *}
 | 
| 33175 | 6173 | |
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6174 | lemma isCont_open_vimage: | 
| 53282 | 6175 | assumes "\<And>x. isCont f x" | 
| 6176 | and "open s" | |
| 6177 | shows "open (f -` s)" | |
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6178 | proof - | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6179 | from assms(1) have "continuous_on UNIV f" | 
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 6180 | unfolding isCont_def continuous_on_def by simp | 
| 53282 | 6181 |   then have "open {x \<in> UNIV. f x \<in> s}"
 | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6182 | using open_UNIV `open s` by (rule continuous_open_preimage) | 
| 53282 | 6183 | then show "open (f -` s)" | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6184 | by (simp add: vimage_def) | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6185 | qed | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6186 | |
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6187 | lemma isCont_closed_vimage: | 
| 53282 | 6188 | assumes "\<And>x. isCont f x" | 
| 6189 | and "closed s" | |
| 6190 | shows "closed (f -` s)" | |
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6191 | using assms unfolding closed_def vimage_Compl [symmetric] | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6192 | by (rule isCont_open_vimage) | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6193 | |
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6194 | lemma open_Collect_less: | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 6195 | fixes f g :: "'a::t2_space \<Rightarrow> real" | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6196 | assumes f: "\<And>x. isCont f x" | 
| 53282 | 6197 | and g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6198 |   shows "open {x. f x < g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6199 | proof - | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6200 |   have "open ((\<lambda>x. g x - f x) -` {0<..})"
 | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6201 | using isCont_diff [OF g f] open_real_greaterThan | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6202 | by (rule isCont_open_vimage) | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6203 |   also have "((\<lambda>x. g x - f x) -` {0<..}) = {x. f x < g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6204 | by auto | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6205 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6206 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6207 | |
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6208 | lemma closed_Collect_le: | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 6209 | fixes f g :: "'a::t2_space \<Rightarrow> real" | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6210 | assumes f: "\<And>x. isCont f x" | 
| 53282 | 6211 | and g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6212 |   shows "closed {x. f x \<le> g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6213 | proof - | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6214 |   have "closed ((\<lambda>x. g x - f x) -` {0..})"
 | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6215 | using isCont_diff [OF g f] closed_real_atLeast | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6216 | by (rule isCont_closed_vimage) | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6217 |   also have "((\<lambda>x. g x - f x) -` {0..}) = {x. f x \<le> g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6218 | by auto | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6219 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6220 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6221 | |
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6222 | lemma closed_Collect_eq: | 
| 51478 
270b21f3ae0a
move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
 hoelzl parents: 
51475diff
changeset | 6223 | fixes f g :: "'a::t2_space \<Rightarrow> 'b::t2_space" | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6224 | assumes f: "\<And>x. isCont f x" | 
| 53282 | 6225 | and g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6226 |   shows "closed {x. f x = g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6227 | proof - | 
| 44216 | 6228 |   have "open {(x::'b, y::'b). x \<noteq> y}"
 | 
| 6229 | unfolding open_prod_def by (auto dest!: hausdorff) | |
| 53282 | 6230 |   then have "closed {(x::'b, y::'b). x = y}"
 | 
| 44216 | 6231 | unfolding closed_def split_def Collect_neg_eq . | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6232 | with isCont_Pair [OF f g] | 
| 44216 | 6233 |   have "closed ((\<lambda>x. (f x, g x)) -` {(x, y). x = y})"
 | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 6234 | by (rule isCont_closed_vimage) | 
| 44216 | 6235 |   also have "\<dots> = {x. f x = g x}" by auto
 | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6236 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6237 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 6238 | |
| 33175 | 6239 | lemma continuous_at_inner: "continuous (at x) (inner a)" | 
| 6240 | unfolding continuous_at by (intro tendsto_intros) | |
| 6241 | ||
| 6242 | lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
 | |
| 44233 | 6243 | by (simp add: closed_Collect_le) | 
| 33175 | 6244 | |
| 6245 | lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
 | |
| 44233 | 6246 | by (simp add: closed_Collect_le) | 
| 33175 | 6247 | |
| 6248 | lemma closed_hyperplane: "closed {x. inner a x = b}"
 | |
| 44233 | 6249 | by (simp add: closed_Collect_eq) | 
| 33175 | 6250 | |
| 53282 | 6251 | lemma closed_halfspace_component_le: "closed {x::'a::euclidean_space. x\<bullet>i \<le> a}"
 | 
| 44233 | 6252 | by (simp add: closed_Collect_le) | 
| 33175 | 6253 | |
| 53282 | 6254 | lemma closed_halfspace_component_ge: "closed {x::'a::euclidean_space. x\<bullet>i \<ge> a}"
 | 
| 44233 | 6255 | by (simp add: closed_Collect_le) | 
| 33175 | 6256 | |
| 53813 | 6257 | lemma closed_interval_left: | 
| 6258 | fixes b :: "'a::euclidean_space" | |
| 6259 |   shows "closed {x::'a. \<forall>i\<in>Basis. x\<bullet>i \<le> b\<bullet>i}"
 | |
| 6260 | by (simp add: Collect_ball_eq closed_INT closed_Collect_le) | |
| 6261 | ||
| 6262 | lemma closed_interval_right: | |
| 6263 | fixes a :: "'a::euclidean_space" | |
| 6264 |   shows "closed {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i}"
 | |
| 6265 | by (simp add: Collect_ball_eq closed_INT closed_Collect_le) | |
| 6266 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6267 | text {* Openness of halfspaces. *}
 | 
| 33175 | 6268 | |
| 6269 | lemma open_halfspace_lt: "open {x. inner a x < b}"
 | |
| 44233 | 6270 | by (simp add: open_Collect_less) | 
| 33175 | 6271 | |
| 6272 | lemma open_halfspace_gt: "open {x. inner a x > b}"
 | |
| 44233 | 6273 | by (simp add: open_Collect_less) | 
| 33175 | 6274 | |
| 53282 | 6275 | lemma open_halfspace_component_lt: "open {x::'a::euclidean_space. x\<bullet>i < a}"
 | 
| 44233 | 6276 | by (simp add: open_Collect_less) | 
| 33175 | 6277 | |
| 53282 | 6278 | lemma open_halfspace_component_gt: "open {x::'a::euclidean_space. x\<bullet>i > a}"
 | 
| 44233 | 6279 | by (simp add: open_Collect_less) | 
| 33175 | 6280 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6281 | text {* This gives a simple derivation of limit component bounds. *}
 | 
| 33175 | 6282 | |
| 53282 | 6283 | lemma Lim_component_le: | 
| 6284 | fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | |
| 6285 | assumes "(f ---> l) net" | |
| 6286 | and "\<not> (trivial_limit net)" | |
| 6287 | and "eventually (\<lambda>x. f(x)\<bullet>i \<le> b) net" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6288 | shows "l\<bullet>i \<le> b" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6289 | by (rule tendsto_le[OF assms(2) tendsto_const tendsto_inner[OF assms(1) tendsto_const] assms(3)]) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 6290 | |
| 53282 | 6291 | lemma Lim_component_ge: | 
| 6292 | fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | |
| 6293 | assumes "(f ---> l) net" | |
| 6294 | and "\<not> (trivial_limit net)" | |
| 6295 | and "eventually (\<lambda>x. b \<le> (f x)\<bullet>i) net" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6296 | shows "b \<le> l\<bullet>i" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6297 | by (rule tendsto_le[OF assms(2) tendsto_inner[OF assms(1) tendsto_const] tendsto_const assms(3)]) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 6298 | |
| 53282 | 6299 | lemma Lim_component_eq: | 
| 6300 | fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | |
| 53640 | 6301 | assumes net: "(f ---> l) net" "\<not> trivial_limit net" | 
| 53282 | 6302 | and ev:"eventually (\<lambda>x. f(x)\<bullet>i = b) net" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6303 | shows "l\<bullet>i = b" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 6304 | using ev[unfolded order_eq_iff eventually_conj_iff] | 
| 53282 | 6305 | using Lim_component_ge[OF net, of b i] | 
| 6306 | using Lim_component_le[OF net, of i b] | |
| 6307 | by auto | |
| 6308 | ||
| 6309 | text {* Limits relative to a union. *}
 | |
| 33175 | 6310 | |
| 6311 | lemma eventually_within_Un: | |
| 53282 | 6312 | "eventually P (at x within (s \<union> t)) \<longleftrightarrow> | 
| 6313 | eventually P (at x within s) \<and> eventually P (at x within t)" | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 6314 | unfolding eventually_at_filter | 
| 33175 | 6315 | by (auto elim!: eventually_rev_mp) | 
| 6316 | ||
| 6317 | lemma Lim_within_union: | |
| 51641 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 6318 | "(f ---> l) (at x within (s \<union> t)) \<longleftrightarrow> | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 6319 | (f ---> l) (at x within s) \<and> (f ---> l) (at x within t)" | 
| 33175 | 6320 | unfolding tendsto_def | 
| 6321 | by (auto simp add: eventually_within_Un) | |
| 6322 | ||
| 36442 | 6323 | lemma Lim_topological: | 
| 53282 | 6324 | "(f ---> l) net \<longleftrightarrow> | 
| 6325 | trivial_limit net \<or> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)" | |
| 36442 | 6326 | unfolding tendsto_def trivial_limit_eq by auto | 
| 6327 | ||
| 53282 | 6328 | text{* Some more convenient intermediate-value theorem formulations. *}
 | 
| 33175 | 6329 | |
| 6330 | lemma connected_ivt_hyperplane: | |
| 53291 | 6331 | assumes "connected s" | 
| 6332 | and "x \<in> s" | |
| 6333 | and "y \<in> s" | |
| 6334 | and "inner a x \<le> b" | |
| 6335 | and "b \<le> inner a y" | |
| 33175 | 6336 | shows "\<exists>z \<in> s. inner a z = b" | 
| 53282 | 6337 | proof (rule ccontr) | 
| 33175 | 6338 | assume as:"\<not> (\<exists>z\<in>s. inner a z = b)" | 
| 6339 |   let ?A = "{x. inner a x < b}"
 | |
| 6340 |   let ?B = "{x. inner a x > b}"
 | |
| 53282 | 6341 | have "open ?A" "open ?B" | 
| 6342 | using open_halfspace_lt and open_halfspace_gt by auto | |
| 53291 | 6343 | moreover | 
| 6344 |   have "?A \<inter> ?B = {}" by auto
 | |
| 6345 | moreover | |
| 6346 | have "s \<subseteq> ?A \<union> ?B" using as by auto | |
| 6347 | ultimately | |
| 6348 | show False | |
| 53282 | 6349 | using assms(1)[unfolded connected_def not_ex, | 
| 6350 | THEN spec[where x="?A"], THEN spec[where x="?B"]] | |
| 6351 | using assms(2-5) | |
| 52625 | 6352 | by auto | 
| 6353 | qed | |
| 6354 | ||
| 6355 | lemma connected_ivt_component: | |
| 6356 | fixes x::"'a::euclidean_space" | |
| 6357 | shows "connected s \<Longrightarrow> | |
| 6358 | x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> | |
| 6359 | x\<bullet>k \<le> a \<Longrightarrow> a \<le> y\<bullet>k \<Longrightarrow> (\<exists>z\<in>s. z\<bullet>k = a)" | |
| 6360 | using connected_ivt_hyperplane[of s x y "k::'a" a] | |
| 6361 | by (auto simp: inner_commute) | |
| 33175 | 6362 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6363 | |
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6364 | subsection {* Intervals *}
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6365 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6366 | lemma open_box[intro]: "open (box a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6367 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6368 |   have "open (\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<bullet> i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6369 | by (auto intro!: continuous_open_vimage continuous_inner continuous_at_id continuous_const) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6370 |   also have "(\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<bullet> i}) = box a b"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6371 | by (auto simp add: box_def inner_commute) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6372 | finally show ?thesis . | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6373 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6374 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6375 | instance euclidean_space \<subseteq> second_countable_topology | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6376 | proof | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6377 | def a \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. fst (f i) *\<^sub>R i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6378 | then have a: "\<And>f. (\<Sum>i\<in>Basis. fst (f i) *\<^sub>R i) = a f" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6379 | by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6380 | def b \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. snd (f i) *\<^sub>R i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6381 | then have b: "\<And>f. (\<Sum>i\<in>Basis. snd (f i) *\<^sub>R i) = b f" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6382 | by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6383 | def B \<equiv> "(\<lambda>f. box (a f) (b f)) ` (Basis \<rightarrow>\<^sub>E (\<rat> \<times> \<rat>))" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6384 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6385 | have "Ball B open" by (simp add: B_def open_box) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6386 | moreover have "(\<forall>A. open A \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union>B' = A))" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6387 | proof safe | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6388 | fix A::"'a set" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6389 | assume "open A" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6390 | show "\<exists>B'\<subseteq>B. \<Union>B' = A" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6391 |       apply (rule exI[of _ "{b\<in>B. b \<subseteq> A}"])
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6392 | apply (subst (3) open_UNION_box[OF `open A`]) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6393 | apply (auto simp add: a b B_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6394 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6395 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6396 | ultimately | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6397 | have "topological_basis B" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6398 | unfolding topological_basis_def by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6399 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6400 | have "countable B" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6401 | unfolding B_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6402 | by (intro countable_image countable_PiE finite_Basis countable_SIGMA countable_rat) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6403 | ultimately show "\<exists>B::'a set set. countable B \<and> open = generate_topology B" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6404 | by (blast intro: topological_basis_imp_subbasis) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6405 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6406 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6407 | instance euclidean_space \<subseteq> polish_space .. | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6408 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6409 | lemma closed_cbox[intro]: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6410 | fixes a b :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6411 | shows "closed (cbox a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6412 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6413 |   have "closed (\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6414 | by (intro closed_INT ballI continuous_closed_vimage allI | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6415 | linear_continuous_at closed_real_atLeastAtMost finite_Basis bounded_linear_inner_left) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6416 |   also have "(\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i}) = cbox a b"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6417 | by (auto simp add: cbox_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6418 | finally show "closed (cbox a b)" . | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6419 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6420 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6421 | lemma interior_cbox [intro]: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6422 | fixes a b :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6423 | shows "interior (cbox a b) = box a b" (is "?L = ?R") | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6424 | proof(rule subset_antisym) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6425 | show "?R \<subseteq> ?L" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6426 | using box_subset_cbox open_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6427 | by (rule interior_maximal) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6428 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6429 | fix x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6430 | assume "x \<in> interior (cbox a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6431 | then obtain s where s: "open s" "x \<in> s" "s \<subseteq> cbox a b" .. | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6432 | then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6433 | unfolding open_dist and subset_eq by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6434 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6435 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6436 | assume i: "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6437 | have "dist (x - (e / 2) *\<^sub>R i) x < e" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6438 | and "dist (x + (e / 2) *\<^sub>R i) x < e" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6439 | unfolding dist_norm | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6440 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6441 | unfolding norm_minus_cancel | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6442 | using norm_Basis[OF i] `e>0` | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6443 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6444 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6445 | then have "a \<bullet> i \<le> (x - (e / 2) *\<^sub>R i) \<bullet> i" and "(x + (e / 2) *\<^sub>R i) \<bullet> i \<le> b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6446 | using e[THEN spec[where x="x - (e/2) *\<^sub>R i"]] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6447 | and e[THEN spec[where x="x + (e/2) *\<^sub>R i"]] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6448 | unfolding mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6449 | using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6450 | by blast+ | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6451 | then have "a \<bullet> i < x \<bullet> i" and "x \<bullet> i < b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6452 | using `e>0` i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6453 | by (auto simp: inner_diff_left inner_Basis inner_add_left) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6454 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6455 | then have "x \<in> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6456 | unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6457 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6458 | then show "?L \<subseteq> ?R" .. | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6459 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6460 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6461 | lemma bounded_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6462 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6463 | shows "bounded (cbox a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6464 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6465 | let ?b = "\<Sum>i\<in>Basis. \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6466 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6467 | fix x :: "'a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6468 | assume x: "\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6469 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6470 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6471 | assume "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6472 | then have "\<bar>x\<bullet>i\<bar> \<le> \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6473 | using x[THEN bspec[where x=i]] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6474 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6475 | then have "(\<Sum>i\<in>Basis. \<bar>x \<bullet> i\<bar>) \<le> ?b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6476 | apply - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6477 | apply (rule setsum_mono) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6478 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6479 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6480 | then have "norm x \<le> ?b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6481 | using norm_le_l1[of x] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6482 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6483 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6484 | unfolding cbox_def bounded_iff by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6485 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6486 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6487 | lemma bounded_box: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6488 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6489 | shows "bounded (box a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6490 | using bounded_cbox[of a b] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6491 | using box_subset_cbox[of a b] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6492 | using bounded_subset[of "cbox a b" "box a b"] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6493 | by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6494 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6495 | lemma not_interval_univ: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6496 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6497 | shows "cbox a b \<noteq> UNIV" "box a b \<noteq> UNIV" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6498 | using bounded_box[of a b] bounded_cbox[of a b] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6499 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6500 | lemma compact_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6501 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6502 | shows "compact (cbox a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6503 | using bounded_closed_imp_seq_compact[of "cbox a b"] using bounded_cbox[of a b] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6504 | by (auto simp: compact_eq_seq_compact_metric) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6505 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6506 | lemma box_midpoint: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6507 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6508 |   assumes "box a b \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6509 | shows "((1/2) *\<^sub>R (a + b)) \<in> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6510 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6511 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6512 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6513 | assume "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6514 | then have "a \<bullet> i < ((1 / 2) *\<^sub>R (a + b)) \<bullet> i \<and> ((1 / 2) *\<^sub>R (a + b)) \<bullet> i < b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6515 | using assms[unfolded box_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6516 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6517 | then show ?thesis unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6518 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6519 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6520 | lemma open_cbox_convex: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6521 | fixes x :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6522 | assumes x: "x \<in> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6523 | and y: "y \<in> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6524 | and e: "0 < e" "e \<le> 1" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6525 | shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6526 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6527 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6528 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6529 | assume i: "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6530 | have "a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6531 | unfolding left_diff_distrib by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6532 | also have "\<dots> < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6533 | apply (rule add_less_le_mono) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6534 | using e unfolding mult_less_cancel_left and mult_le_cancel_left | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6535 | apply simp_all | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6536 | using x unfolding mem_box using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6537 | apply simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6538 | using y unfolding mem_box using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6539 | apply simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6540 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6541 | finally have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6542 | unfolding inner_simps by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6543 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6544 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6545 | have "b \<bullet> i = e * (b\<bullet>i) + (1 - e) * (b\<bullet>i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6546 | unfolding left_diff_distrib by simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6547 | also have "\<dots> > e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6548 | apply (rule add_less_le_mono) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6549 | using e unfolding mult_less_cancel_left and mult_le_cancel_left | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6550 | apply simp_all | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6551 | using x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6552 | unfolding mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6553 | using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6554 | apply simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6555 | using y | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6556 | unfolding mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6557 | using i | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6558 | apply simp | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6559 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6560 | finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6561 | unfolding inner_simps by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6562 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6563 | ultimately have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i \<and> (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6564 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6565 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6566 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6567 | unfolding mem_box by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6568 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6569 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6570 | lemma closure_box: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6571 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6572 |    assumes "box a b \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6573 | shows "closure (box a b) = cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6574 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6575 | have ab: "a <e b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6576 | using assms by (simp add: eucl_less_def box_ne_empty) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6577 | let ?c = "(1 / 2) *\<^sub>R (a + b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6578 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6579 | fix x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6580 | assume as:"x \<in> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6581 | def f \<equiv> "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6582 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6583 | fix n | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6584 | assume fn: "f n <e b \<longrightarrow> a <e f n \<longrightarrow> f n = x" and xc: "x \<noteq> ?c" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6585 | have *: "0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6586 | unfolding inverse_le_1_iff by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6587 | have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x = | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6588 | x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6589 | by (auto simp add: algebra_simps) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6590 | then have "f n <e b" and "a <e f n" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6591 | using open_cbox_convex[OF box_midpoint[OF assms] as *] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6592 | unfolding f_def by (auto simp: box_def eucl_less_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6593 | then have False | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6594 | using fn unfolding f_def using xc by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6595 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6596 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6597 |     {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6598 | assume "\<not> (f ---> x) sequentially" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6599 |       {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6600 | fix e :: real | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6601 | assume "e > 0" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6602 | then have "\<exists>N::nat. inverse (real (N + 1)) < e" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6603 | using real_arch_inv[of e] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6604 | apply (auto simp add: Suc_pred') | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6605 | apply (rule_tac x="n - 1" in exI) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6606 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6607 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6608 | then obtain N :: nat where "inverse (real (N + 1)) < e" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6609 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6610 | then have "\<forall>n\<ge>N. inverse (real n + 1) < e" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6611 | apply auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6612 | apply (metis Suc_le_mono le_SucE less_imp_inverse_less nat_le_real_less order_less_trans | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6613 | real_of_nat_Suc real_of_nat_Suc_gt_zero) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6614 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6615 | then have "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6616 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6617 | then have "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6618 | unfolding LIMSEQ_def by(auto simp add: dist_norm) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6619 | then have "(f ---> x) sequentially" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6620 | unfolding f_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6621 | using tendsto_add[OF tendsto_const, of "\<lambda>n::nat. (inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b) - x)" 0 sequentially x] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6622 | using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6623 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6624 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6625 | ultimately have "x \<in> closure (box a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6626 | using as and box_midpoint[OF assms] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6627 | unfolding closure_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6628 | unfolding islimpt_sequential | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6629 | by (cases "x=?c") (auto simp: in_box_eucl_less) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6630 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6631 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6632 | using closure_minimal[OF box_subset_cbox, of a b] by blast | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6633 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6634 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6635 | lemma bounded_subset_box_symmetric: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6636 |   fixes s::"('a::euclidean_space) set"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6637 | assumes "bounded s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6638 | shows "\<exists>a. s \<subseteq> box (-a) a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6639 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6640 | obtain b where "b>0" and b: "\<forall>x\<in>s. norm x \<le> b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6641 | using assms[unfolded bounded_pos] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6642 | def a \<equiv> "(\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)::'a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6643 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6644 | fix x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6645 | assume "x \<in> s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6646 | fix i :: 'a | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6647 | assume i: "i \<in> Basis" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6648 | then have "(-a)\<bullet>i < x\<bullet>i" and "x\<bullet>i < a\<bullet>i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6649 | using b[THEN bspec[where x=x], OF `x\<in>s`] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6650 | using Basis_le_norm[OF i, of x] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6651 | unfolding inner_simps and a_def | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6652 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6653 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6654 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6655 | by (auto intro: exI[where x=a] simp add: box_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6656 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6657 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6658 | lemma bounded_subset_open_interval: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6659 |   fixes s :: "('a::euclidean_space) set"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6660 | shows "bounded s \<Longrightarrow> (\<exists>a b. s \<subseteq> box a b)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6661 | by (auto dest!: bounded_subset_box_symmetric) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6662 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6663 | lemma bounded_subset_cbox_symmetric: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6664 |   fixes s :: "('a::euclidean_space) set"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6665 | assumes "bounded s" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6666 | shows "\<exists>a. s \<subseteq> cbox (-a) a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6667 | proof - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6668 | obtain a where "s \<subseteq> box (-a) a" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6669 | using bounded_subset_box_symmetric[OF assms] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6670 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6671 | using box_subset_cbox[of "-a" a] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6672 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6673 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6674 | lemma bounded_subset_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6675 |   fixes s :: "('a::euclidean_space) set"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6676 | shows "bounded s \<Longrightarrow> \<exists>a b. s \<subseteq> cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6677 | using bounded_subset_cbox_symmetric[of s] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6678 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6679 | lemma frontier_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6680 | fixes a b :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6681 | shows "frontier (cbox a b) = cbox a b - box a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6682 | unfolding frontier_def unfolding interior_cbox and closure_closed[OF closed_cbox] .. | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6683 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6684 | lemma frontier_box: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6685 | fixes a b :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6686 |   shows "frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6687 | proof (cases "box a b = {}")
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6688 | case True | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6689 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6690 | using frontier_empty by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6691 | next | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6692 | case False | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6693 | then show ?thesis | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6694 | unfolding frontier_def and closure_box[OF False] and interior_open[OF open_box] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6695 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6696 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6697 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6698 | lemma inter_interval_mixed_eq_empty: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6699 | fixes a :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6700 |    assumes "box c d \<noteq> {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6701 |   shows "box a b \<inter> cbox c d = {} \<longleftrightarrow> box a b \<inter> box c d = {}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6702 | unfolding closure_box[OF assms, symmetric] | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6703 | unfolding open_inter_closure_eq_empty[OF open_box] .. | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6704 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6705 | lemma diameter_cbox: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6706 | fixes a b::"'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6707 | shows "(\<forall>i \<in> Basis. a \<bullet> i \<le> b \<bullet> i) \<Longrightarrow> diameter (cbox a b) = dist a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6708 | by (force simp add: diameter_def SUP_def simp del: Sup_image_eq intro!: cSup_eq_maximum setL2_mono | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6709 | simp: euclidean_dist_l2[where 'a='a] cbox_def dist_norm) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6710 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6711 | lemma eucl_less_eq_halfspaces: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6712 | fixes a :: "'a\<Colon>euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6713 |   shows "{x. x <e a} = (\<Inter>i\<in>Basis. {x. x \<bullet> i < a \<bullet> i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6714 |     "{x. a <e x} = (\<Inter>i\<in>Basis. {x. a \<bullet> i < x \<bullet> i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6715 | by (auto simp: eucl_less_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6716 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6717 | lemma eucl_le_eq_halfspaces: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6718 | fixes a :: "'a\<Colon>euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6719 |   shows "{x. \<forall>i\<in>Basis. x \<bullet> i \<le> a \<bullet> i} = (\<Inter>i\<in>Basis. {x. x \<bullet> i \<le> a \<bullet> i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6720 |     "{x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i} = (\<Inter>i\<in>Basis. {x. a \<bullet> i \<le> x \<bullet> i})"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6721 | by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6722 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6723 | lemma open_Collect_eucl_less[simp, intro]: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6724 | fixes a :: "'a\<Colon>euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6725 |   shows "open {x. x <e a}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6726 |     "open {x. a <e x}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6727 | by (auto simp: eucl_less_eq_halfspaces open_halfspace_component_lt open_halfspace_component_gt) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6728 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6729 | lemma closed_Collect_eucl_le[simp, intro]: | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6730 | fixes a :: "'a\<Colon>euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6731 |   shows "closed {x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6732 |     "closed {x. \<forall>i\<in>Basis. x \<bullet> i \<le> a \<bullet> i}"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6733 | unfolding eucl_le_eq_halfspaces | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6734 | by (simp_all add: closed_INT closed_Collect_le) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6735 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6736 | lemma image_affinity_cbox: fixes m::real | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6737 | fixes a b c :: "'a::euclidean_space" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6738 | shows "(\<lambda>x. m *\<^sub>R x + c) ` cbox a b = | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6739 |     (if cbox a b = {} then {}
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6740 | else (if 0 \<le> m then cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6741 | else cbox (m *\<^sub>R b + c) (m *\<^sub>R a + c)))" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6742 | proof (cases "m = 0") | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6743 | case True | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6744 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6745 | fix x | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6746 | assume "\<forall>i\<in>Basis. x \<bullet> i \<le> c \<bullet> i" "\<forall>i\<in>Basis. c \<bullet> i \<le> x \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6747 | then have "x = c" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6748 | apply - | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6749 | apply (subst euclidean_eq_iff) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6750 | apply (auto intro: order_antisym) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6751 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6752 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6753 | moreover have "c \<in> cbox (m *\<^sub>R a + c) (m *\<^sub>R b + c)" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6754 | unfolding True by (auto simp add: cbox_sing) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6755 | ultimately show ?thesis using True by (auto simp: cbox_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6756 | next | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6757 | case False | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6758 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6759 | fix y | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6760 | assume "\<forall>i\<in>Basis. a \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> b \<bullet> i" "m > 0" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6761 | then have "\<forall>i\<in>Basis. (m *\<^sub>R a + c) \<bullet> i \<le> (m *\<^sub>R y + c) \<bullet> i" and "\<forall>i\<in>Basis. (m *\<^sub>R y + c) \<bullet> i \<le> (m *\<^sub>R b + c) \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6762 | by (auto simp: inner_distrib) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6763 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6764 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6765 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6766 | fix y | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6767 | assume "\<forall>i\<in>Basis. a \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> b \<bullet> i" "m < 0" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6768 | then have "\<forall>i\<in>Basis. (m *\<^sub>R b + c) \<bullet> i \<le> (m *\<^sub>R y + c) \<bullet> i" and "\<forall>i\<in>Basis. (m *\<^sub>R y + c) \<bullet> i \<le> (m *\<^sub>R a + c) \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6769 | by (auto simp add: mult_left_mono_neg inner_distrib) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6770 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6771 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6772 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6773 | fix y | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6774 | assume "m > 0" and "\<forall>i\<in>Basis. (m *\<^sub>R a + c) \<bullet> i \<le> y \<bullet> i" and "\<forall>i\<in>Basis. y \<bullet> i \<le> (m *\<^sub>R b + c) \<bullet> i" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6775 | then have "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6776 | unfolding image_iff Bex_def mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6777 | apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 6778 | apply (auto simp add: pos_le_divide_eq pos_divide_le_eq mult.commute diff_le_iff inner_distrib inner_diff_left) | 
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6779 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6780 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6781 | moreover | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6782 |   {
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6783 | fix y | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6784 | assume "\<forall>i\<in>Basis. (m *\<^sub>R b + c) \<bullet> i \<le> y \<bullet> i" "\<forall>i\<in>Basis. y \<bullet> i \<le> (m *\<^sub>R a + c) \<bullet> i" "m < 0" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6785 | then have "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` cbox a b" | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6786 | unfolding image_iff Bex_def mem_box | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6787 | apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 6788 | apply (auto simp add: neg_le_divide_eq neg_divide_le_eq mult.commute diff_le_iff inner_distrib inner_diff_left) | 
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6789 | done | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6790 | } | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6791 | ultimately show ?thesis using False by (auto simp: cbox_def) | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6792 | qed | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6793 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6794 | lemma image_smult_cbox:"(\<lambda>x. m *\<^sub>R (x::_::euclidean_space)) ` cbox a b = | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6795 |   (if cbox a b = {} then {} else if 0 \<le> m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))"
 | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6796 | using image_affinity_cbox[of m 0 a b] by auto | 
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6797 | |
| 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 6798 | |
| 36437 | 6799 | subsection {* Homeomorphisms *}
 | 
| 33175 | 6800 | |
| 52625 | 6801 | definition "homeomorphism s t f g \<longleftrightarrow> | 
| 6802 | (\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and> | |
| 6803 | (\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g" | |
| 33175 | 6804 | |
| 53640 | 6805 | definition homeomorphic :: "'a::topological_space set \<Rightarrow> 'b::topological_space set \<Rightarrow> bool" | 
| 53282 | 6806 | (infixr "homeomorphic" 60) | 
| 6807 | where "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)" | |
| 33175 | 6808 | |
| 6809 | lemma homeomorphic_refl: "s homeomorphic s" | |
| 6810 | unfolding homeomorphic_def | |
| 6811 | unfolding homeomorphism_def | |
| 6812 | using continuous_on_id | |
| 53282 | 6813 | apply (rule_tac x = "(\<lambda>x. x)" in exI) | 
| 6814 | apply (rule_tac x = "(\<lambda>x. x)" in exI) | |
| 52625 | 6815 | apply blast | 
| 6816 | done | |
| 6817 | ||
| 6818 | lemma homeomorphic_sym: "s homeomorphic t \<longleftrightarrow> t homeomorphic s" | |
| 6819 | unfolding homeomorphic_def | |
| 6820 | unfolding homeomorphism_def | |
| 53282 | 6821 | by blast | 
| 33175 | 6822 | |
| 6823 | lemma homeomorphic_trans: | |
| 53282 | 6824 | assumes "s homeomorphic t" | 
| 6825 | and "t homeomorphic u" | |
| 52625 | 6826 | shows "s homeomorphic u" | 
| 53282 | 6827 | proof - | 
| 6828 | obtain f1 g1 where fg1: "\<forall>x\<in>s. g1 (f1 x) = x" "f1 ` s = t" | |
| 6829 | "continuous_on s f1" "\<forall>y\<in>t. f1 (g1 y) = y" "g1 ` t = s" "continuous_on t g1" | |
| 33175 | 6830 | using assms(1) unfolding homeomorphic_def homeomorphism_def by auto | 
| 53282 | 6831 | obtain f2 g2 where fg2: "\<forall>x\<in>t. g2 (f2 x) = x" "f2 ` t = u" "continuous_on t f2" | 
| 6832 | "\<forall>y\<in>u. f2 (g2 y) = y" "g2 ` u = t" "continuous_on u g2" | |
| 33175 | 6833 | using assms(2) unfolding homeomorphic_def homeomorphism_def by auto | 
| 52625 | 6834 |   {
 | 
| 6835 | fix x | |
| 6836 | assume "x\<in>s" | |
| 53282 | 6837 | then have "(g1 \<circ> g2) ((f2 \<circ> f1) x) = x" | 
| 52625 | 6838 | using fg1(1)[THEN bspec[where x=x]] and fg2(1)[THEN bspec[where x="f1 x"]] and fg1(2) | 
| 6839 | by auto | |
| 6840 | } | |
| 6841 | moreover have "(f2 \<circ> f1) ` s = u" | |
| 6842 | using fg1(2) fg2(2) by auto | |
| 6843 | moreover have "continuous_on s (f2 \<circ> f1)" | |
| 6844 | using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto | |
| 53282 | 6845 | moreover | 
| 6846 |   {
 | |
| 52625 | 6847 | fix y | 
| 6848 | assume "y\<in>u" | |
| 53282 | 6849 | then have "(f2 \<circ> f1) ((g1 \<circ> g2) y) = y" | 
| 52625 | 6850 | using fg2(4)[THEN bspec[where x=y]] and fg1(4)[THEN bspec[where x="g2 y"]] and fg2(5) | 
| 6851 | by auto | |
| 6852 | } | |
| 33175 | 6853 | moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto | 
| 52625 | 6854 | moreover have "continuous_on u (g1 \<circ> g2)" | 
| 6855 | using continuous_on_compose[OF fg2(6)] and fg1(6) | |
| 6856 | unfolding fg2(5) | |
| 6857 | by auto | |
| 6858 | ultimately show ?thesis | |
| 6859 | unfolding homeomorphic_def homeomorphism_def | |
| 6860 | apply (rule_tac x="f2 \<circ> f1" in exI) | |
| 6861 | apply (rule_tac x="g1 \<circ> g2" in exI) | |
| 6862 | apply auto | |
| 6863 | done | |
| 33175 | 6864 | qed | 
| 6865 | ||
| 6866 | lemma homeomorphic_minimal: | |
| 52625 | 6867 | "s homeomorphic t \<longleftrightarrow> | 
| 33175 | 6868 | (\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and> | 
| 6869 | (\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and> | |
| 6870 | continuous_on s f \<and> continuous_on t g)" | |
| 52625 | 6871 | unfolding homeomorphic_def homeomorphism_def | 
| 6872 | apply auto | |
| 6873 | apply (rule_tac x=f in exI) | |
| 6874 | apply (rule_tac x=g in exI) | |
| 6875 | apply auto | |
| 6876 | apply (rule_tac x=f in exI) | |
| 6877 | apply (rule_tac x=g in exI) | |
| 6878 | apply auto | |
| 6879 | unfolding image_iff | |
| 6880 | apply (erule_tac x="g x" in ballE) | |
| 6881 | apply (erule_tac x="x" in ballE) | |
| 6882 | apply auto | |
| 6883 | apply (rule_tac x="g x" in bexI) | |
| 6884 | apply auto | |
| 6885 | apply (erule_tac x="f x" in ballE) | |
| 6886 | apply (erule_tac x="x" in ballE) | |
| 6887 | apply auto | |
| 6888 | apply (rule_tac x="f x" in bexI) | |
| 6889 | apply auto | |
| 6890 | done | |
| 33175 | 6891 | |
| 36437 | 6892 | text {* Relatively weak hypotheses if a set is compact. *}
 | 
| 33175 | 6893 | |
| 6894 | lemma homeomorphism_compact: | |
| 50898 | 6895 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 33175 | 6896 | assumes "compact s" "continuous_on s f" "f ` s = t" "inj_on f s" | 
| 6897 | shows "\<exists>g. homeomorphism s t f g" | |
| 53282 | 6898 | proof - | 
| 33175 | 6899 | def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x" | 
| 52625 | 6900 | have g: "\<forall>x\<in>s. g (f x) = x" | 
| 6901 | using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto | |
| 6902 |   {
 | |
| 53282 | 6903 | fix y | 
| 6904 | assume "y \<in> t" | |
| 6905 | then obtain x where x:"f x = y" "x\<in>s" | |
| 6906 | using assms(3) by auto | |
| 6907 | then have "g (f x) = x" using g by auto | |
| 53291 | 6908 | then have "f (g y) = y" unfolding x(1)[symmetric] by auto | 
| 52625 | 6909 | } | 
| 53282 | 6910 | then have g':"\<forall>x\<in>t. f (g x) = x" by auto | 
| 33175 | 6911 | moreover | 
| 52625 | 6912 |   {
 | 
| 6913 | fix x | |
| 6914 | have "x\<in>s \<Longrightarrow> x \<in> g ` t" | |
| 6915 | using g[THEN bspec[where x=x]] | |
| 6916 | unfolding image_iff | |
| 6917 | using assms(3) | |
| 6918 | by (auto intro!: bexI[where x="f x"]) | |
| 33175 | 6919 | moreover | 
| 52625 | 6920 |     {
 | 
| 6921 | assume "x\<in>g ` t" | |
| 33175 | 6922 | then obtain y where y:"y\<in>t" "g y = x" by auto | 
| 52625 | 6923 | then obtain x' where x':"x'\<in>s" "f x' = y" | 
| 6924 | using assms(3) by auto | |
| 53282 | 6925 | then have "x \<in> s" | 
| 52625 | 6926 | unfolding g_def | 
| 6927 | using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"] | |
| 53291 | 6928 | unfolding y(2)[symmetric] and g_def | 
| 52625 | 6929 | by auto | 
| 6930 | } | |
| 6931 | ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" .. | |
| 6932 | } | |
| 53282 | 6933 | then have "g ` t = s" by auto | 
| 52625 | 6934 | ultimately show ?thesis | 
| 6935 | unfolding homeomorphism_def homeomorphic_def | |
| 6936 | apply (rule_tac x=g in exI) | |
| 6937 | using g and assms(3) and continuous_on_inv[OF assms(2,1), of g, unfolded assms(3)] and assms(2) | |
| 6938 | apply auto | |
| 6939 | done | |
| 33175 | 6940 | qed | 
| 6941 | ||
| 6942 | lemma homeomorphic_compact: | |
| 50898 | 6943 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 53282 | 6944 | shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s \<Longrightarrow> s homeomorphic t" | 
| 37486 
b993fac7985b
beta-eta was too much, because it transformed SOME x. P x into Eps P, which caused problems later;
 blanchet parents: 
37452diff
changeset | 6945 | unfolding homeomorphic_def by (metis homeomorphism_compact) | 
| 33175 | 6946 | |
| 53282 | 6947 | text{* Preservation of topological properties. *}
 | 
| 33175 | 6948 | |
| 52625 | 6949 | lemma homeomorphic_compactness: "s homeomorphic t \<Longrightarrow> (compact s \<longleftrightarrow> compact t)" | 
| 6950 | unfolding homeomorphic_def homeomorphism_def | |
| 6951 | by (metis compact_continuous_image) | |
| 33175 | 6952 | |
| 53282 | 6953 | text{* Results on translation, scaling etc. *}
 | 
| 33175 | 6954 | |
| 6955 | lemma homeomorphic_scaling: | |
| 6956 | fixes s :: "'a::real_normed_vector set" | |
| 53282 | 6957 | assumes "c \<noteq> 0" | 
| 6958 | shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 33175 | 6959 | unfolding homeomorphic_minimal | 
| 52625 | 6960 | apply (rule_tac x="\<lambda>x. c *\<^sub>R x" in exI) | 
| 6961 | apply (rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI) | |
| 6962 | using assms | |
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 6963 | apply (auto simp add: continuous_intros) | 
| 52625 | 6964 | done | 
| 33175 | 6965 | |
| 6966 | lemma homeomorphic_translation: | |
| 6967 | fixes s :: "'a::real_normed_vector set" | |
| 6968 | shows "s homeomorphic ((\<lambda>x. a + x) ` s)" | |
| 6969 | unfolding homeomorphic_minimal | |
| 52625 | 6970 | apply (rule_tac x="\<lambda>x. a + x" in exI) | 
| 6971 | apply (rule_tac x="\<lambda>x. -a + x" in exI) | |
| 54230 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
54070diff
changeset | 6972 | using continuous_on_add [OF continuous_on_const continuous_on_id, of s a] | 
| 
b1d955791529
more simplification rules on unary and binary minus
 haftmann parents: 
54070diff
changeset | 6973 | continuous_on_add [OF continuous_on_const continuous_on_id, of "plus a ` s" "- a"] | 
| 52625 | 6974 | apply auto | 
| 6975 | done | |
| 33175 | 6976 | |
| 6977 | lemma homeomorphic_affinity: | |
| 6978 | fixes s :: "'a::real_normed_vector set" | |
| 52625 | 6979 | assumes "c \<noteq> 0" | 
| 6980 | shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 53282 | 6981 | proof - | 
| 52625 | 6982 | have *: "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto | 
| 33175 | 6983 | show ?thesis | 
| 6984 | using homeomorphic_trans | |
| 6985 | using homeomorphic_scaling[OF assms, of s] | |
| 52625 | 6986 | using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] | 
| 6987 | unfolding * | |
| 6988 | by auto | |
| 33175 | 6989 | qed | 
| 6990 | ||
| 6991 | lemma homeomorphic_balls: | |
| 50898 | 6992 | fixes a b ::"'a::real_normed_vector" | 
| 33175 | 6993 | assumes "0 < d" "0 < e" | 
| 6994 | shows "(ball a d) homeomorphic (ball b e)" (is ?th) | |
| 53282 | 6995 | and "(cball a d) homeomorphic (cball b e)" (is ?cth) | 
| 6996 | proof - | |
| 33175 | 6997 | show ?th unfolding homeomorphic_minimal | 
| 6998 | apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) | |
| 6999 | apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) | |
| 51364 | 7000 | using assms | 
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 7001 | apply (auto intro!: continuous_intros | 
| 52625 | 7002 | simp: dist_commute dist_norm pos_divide_less_eq mult_strict_left_mono) | 
| 51364 | 7003 | done | 
| 33175 | 7004 | show ?cth unfolding homeomorphic_minimal | 
| 7005 | apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) | |
| 7006 | apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) | |
| 51364 | 7007 | using assms | 
| 56371 
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
 hoelzl parents: 
56290diff
changeset | 7008 | apply (auto intro!: continuous_intros | 
| 52625 | 7009 | simp: dist_commute dist_norm pos_divide_le_eq mult_strict_left_mono) | 
| 51364 | 7010 | done | 
| 33175 | 7011 | qed | 
| 7012 | ||
| 7013 | text{* "Isometry" (up to constant bounds) of injective linear map etc.           *}
 | |
| 7014 | ||
| 7015 | lemma cauchy_isometric: | |
| 53640 | 7016 | assumes e: "e > 0" | 
| 52625 | 7017 | and s: "subspace s" | 
| 7018 | and f: "bounded_linear f" | |
| 53640 | 7019 | and normf: "\<forall>x\<in>s. norm (f x) \<ge> e * norm x" | 
| 7020 | and xs: "\<forall>n. x n \<in> s" | |
| 7021 | and cf: "Cauchy (f \<circ> x)" | |
| 33175 | 7022 | shows "Cauchy x" | 
| 52625 | 7023 | proof - | 
| 33175 | 7024 | interpret f: bounded_linear f by fact | 
| 52625 | 7025 |   {
 | 
| 53291 | 7026 | fix d :: real | 
| 7027 | assume "d > 0" | |
| 33175 | 7028 | then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d" | 
| 56544 | 7029 | using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] e | 
| 52625 | 7030 | by auto | 
| 7031 |     {
 | |
| 7032 | fix n | |
| 7033 | assume "n\<ge>N" | |
| 45270 
d5b5c9259afd
fix bug in cancel_factor simprocs so they will work on goals like 'x * y < x * z' where the common term is already on the left
 huffman parents: 
45051diff
changeset | 7034 | have "e * norm (x n - x N) \<le> norm (f (x n - x N))" | 
| 52625 | 7035 | using subspace_sub[OF s, of "x n" "x N"] | 
| 7036 | using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]] | |
| 7037 | using normf[THEN bspec[where x="x n - x N"]] | |
| 7038 | by auto | |
| 45270 
d5b5c9259afd
fix bug in cancel_factor simprocs so they will work on goals like 'x * y < x * z' where the common term is already on the left
 huffman parents: 
45051diff
changeset | 7039 | also have "norm (f (x n - x N)) < e * d" | 
| 53291 | 7040 | using `N \<le> n` N unfolding f.diff[symmetric] by auto | 
| 52625 | 7041 | finally have "norm (x n - x N) < d" using `e>0` by simp | 
| 7042 | } | |
| 53282 | 7043 | then have "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto | 
| 52625 | 7044 | } | 
| 53282 | 7045 | then show ?thesis unfolding cauchy and dist_norm by auto | 
| 33175 | 7046 | qed | 
| 7047 | ||
| 7048 | lemma complete_isometric_image: | |
| 52625 | 7049 | assumes "0 < e" | 
| 7050 | and s: "subspace s" | |
| 7051 | and f: "bounded_linear f" | |
| 7052 | and normf: "\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" | |
| 7053 | and cs: "complete s" | |
| 53291 | 7054 | shows "complete (f ` s)" | 
| 52625 | 7055 | proof - | 
| 7056 |   {
 | |
| 7057 | fix g | |
| 7058 | assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g" | |
| 53282 | 7059 | then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)" | 
| 53640 | 7060 | using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] | 
| 7061 | by auto | |
| 7062 | then have x:"\<forall>n. x n \<in> s" "\<forall>n. g n = f (x n)" | |
| 7063 | by auto | |
| 7064 | then have "f \<circ> x = g" | |
| 7065 | unfolding fun_eq_iff | |
| 7066 | by auto | |
| 33175 | 7067 | then obtain l where "l\<in>s" and l:"(x ---> l) sequentially" | 
| 7068 | using cs[unfolded complete_def, THEN spec[where x="x"]] | |
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 7069 | using cauchy_isometric[OF `0 < e` s f normf] and cfg and x(1) | 
| 53640 | 7070 | by auto | 
| 53282 | 7071 | then have "\<exists>l\<in>f ` s. (g ---> l) sequentially" | 
| 33175 | 7072 | using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l] | 
| 53640 | 7073 | unfolding `f \<circ> x = g` | 
| 7074 | by auto | |
| 52625 | 7075 | } | 
| 53640 | 7076 | then show ?thesis | 
| 7077 | unfolding complete_def by auto | |
| 33175 | 7078 | qed | 
| 7079 | ||
| 52625 | 7080 | lemma injective_imp_isometric: | 
| 7081 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" | |
| 7082 | assumes s: "closed s" "subspace s" | |
| 53640 | 7083 | and f: "bounded_linear f" "\<forall>x\<in>s. f x = 0 \<longrightarrow> x = 0" | 
| 7084 | shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm x" | |
| 52625 | 7085 | proof (cases "s \<subseteq> {0::'a}")
 | 
| 33175 | 7086 | case True | 
| 52625 | 7087 |   {
 | 
| 7088 | fix x | |
| 7089 | assume "x \<in> s" | |
| 53282 | 7090 | then have "x = 0" using True by auto | 
| 7091 | then have "norm x \<le> norm (f x)" by auto | |
| 52625 | 7092 | } | 
| 53282 | 7093 | then show ?thesis by (auto intro!: exI[where x=1]) | 
| 33175 | 7094 | next | 
| 7095 | interpret f: bounded_linear f by fact | |
| 7096 | case False | |
| 53640 | 7097 | then obtain a where a: "a \<noteq> 0" "a \<in> s" | 
| 7098 | by auto | |
| 7099 |   from False have "s \<noteq> {}"
 | |
| 7100 | by auto | |
| 33175 | 7101 |   let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 7102 |   let ?S' = "{x::'a. x\<in>s \<and> norm x = norm a}"
 | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 7103 |   let ?S'' = "{x::'a. norm x = norm a}"
 | 
| 33175 | 7104 | |
| 52625 | 7105 | have "?S'' = frontier(cball 0 (norm a))" | 
| 7106 | unfolding frontier_cball and dist_norm by auto | |
| 53282 | 7107 | then have "compact ?S''" | 
| 52625 | 7108 | using compact_frontier[OF compact_cball, of 0 "norm a"] by auto | 
| 33175 | 7109 | moreover have "?S' = s \<inter> ?S''" by auto | 
| 52625 | 7110 | ultimately have "compact ?S'" | 
| 7111 | using closed_inter_compact[of s ?S''] using s(1) by auto | |
| 33175 | 7112 | moreover have *:"f ` ?S' = ?S" by auto | 
| 52625 | 7113 | ultimately have "compact ?S" | 
| 7114 | using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto | |
| 53282 | 7115 | then have "closed ?S" using compact_imp_closed by auto | 
| 33175 | 7116 |   moreover have "?S \<noteq> {}" using a by auto
 | 
| 52625 | 7117 | ultimately obtain b' where "b'\<in>?S" "\<forall>y\<in>?S. norm b' \<le> norm y" | 
| 7118 | using distance_attains_inf[of ?S 0] unfolding dist_0_norm by auto | |
| 53282 | 7119 | then obtain b where "b\<in>s" | 
| 7120 | and ba: "norm b = norm a" | |
| 7121 |     and b: "\<forall>x\<in>{x \<in> s. norm x = norm a}. norm (f b) \<le> norm (f x)"
 | |
| 53291 | 7122 | unfolding *[symmetric] unfolding image_iff by auto | 
| 33175 | 7123 | |
| 7124 | let ?e = "norm (f b) / norm b" | |
| 7125 | have "norm b > 0" using ba and a and norm_ge_zero by auto | |
| 52625 | 7126 | moreover have "norm (f b) > 0" | 
| 7127 | using f(2)[THEN bspec[where x=b], OF `b\<in>s`] | |
| 7128 | using `norm b >0` | |
| 7129 | unfolding zero_less_norm_iff | |
| 7130 | by auto | |
| 56541 | 7131 | ultimately have "0 < norm (f b) / norm b" by simp | 
| 33175 | 7132 | moreover | 
| 52625 | 7133 |   {
 | 
| 7134 | fix x | |
| 7135 | assume "x\<in>s" | |
| 53282 | 7136 | then have "norm (f b) / norm b * norm x \<le> norm (f x)" | 
| 52625 | 7137 | proof (cases "x=0") | 
| 7138 | case True | |
| 53282 | 7139 | then show "norm (f b) / norm b * norm x \<le> norm (f x)" by auto | 
| 33175 | 7140 | next | 
| 7141 | case False | |
| 53282 | 7142 | then have *: "0 < norm a / norm x" | 
| 52625 | 7143 | using `a\<noteq>0` | 
| 56541 | 7144 | unfolding zero_less_norm_iff[symmetric] by simp | 
| 52625 | 7145 | have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" | 
| 7146 | using s[unfolded subspace_def] by auto | |
| 53282 | 7147 |       then have "(norm a / norm x) *\<^sub>R x \<in> {x \<in> s. norm x = norm a}"
 | 
| 52625 | 7148 | using `x\<in>s` and `x\<noteq>0` by auto | 
| 53282 | 7149 | then show "norm (f b) / norm b * norm x \<le> norm (f x)" | 
| 52625 | 7150 | using b[THEN bspec[where x="(norm a / norm x) *\<^sub>R x"]] | 
| 33175 | 7151 | unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0` | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 7152 | by (auto simp add: mult.commute pos_le_divide_eq pos_divide_le_eq) | 
| 52625 | 7153 | qed | 
| 7154 | } | |
| 7155 | ultimately show ?thesis by auto | |
| 33175 | 7156 | qed | 
| 7157 | ||
| 7158 | lemma closed_injective_image_subspace: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 7159 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" | 
| 53282 | 7160 | assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 \<longrightarrow> x = 0" "closed s" | 
| 33175 | 7161 | shows "closed(f ` s)" | 
| 53282 | 7162 | proof - | 
| 7163 | obtain e where "e > 0" and e: "\<forall>x\<in>s. e * norm x \<le> norm (f x)" | |
| 52625 | 7164 | using injective_imp_isometric[OF assms(4,1,2,3)] by auto | 
| 7165 | show ?thesis | |
| 7166 | using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4) | |
| 53291 | 7167 | unfolding complete_eq_closed[symmetric] by auto | 
| 33175 | 7168 | qed | 
| 7169 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7170 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7171 | subsection {* Some properties of a canonical subspace *}
 | 
| 33175 | 7172 | |
| 7173 | lemma subspace_substandard: | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7174 |   "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7175 | unfolding subspace_def by (auto simp: inner_add_left) | 
| 33175 | 7176 | |
| 7177 | lemma closed_substandard: | |
| 52625 | 7178 |   "closed {x::'a::euclidean_space. \<forall>i\<in>Basis. P i --> x\<bullet>i = 0}" (is "closed ?A")
 | 
| 7179 | proof - | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7180 |   let ?D = "{i\<in>Basis. P i}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7181 |   have "closed (\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0})"
 | 
| 44457 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 huffman parents: 
44365diff
changeset | 7182 | by (simp add: closed_INT closed_Collect_eq) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7183 |   also have "(\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0}) = ?A"
 | 
| 44457 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 huffman parents: 
44365diff
changeset | 7184 | by auto | 
| 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 huffman parents: 
44365diff
changeset | 7185 | finally show "closed ?A" . | 
| 33175 | 7186 | qed | 
| 7187 | ||
| 52625 | 7188 | lemma dim_substandard: | 
| 7189 | assumes d: "d \<subseteq> Basis" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7190 |   shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _")
 | 
| 53813 | 7191 | proof (rule dim_unique) | 
| 7192 | show "d \<subseteq> ?A" | |
| 7193 | using d by (auto simp: inner_Basis) | |
| 7194 | show "independent d" | |
| 7195 | using independent_mono [OF independent_Basis d] . | |
| 7196 | show "?A \<subseteq> span d" | |
| 7197 | proof (clarify) | |
| 7198 | fix x assume x: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0" | |
| 7199 | have "finite d" | |
| 7200 | using finite_subset [OF d finite_Basis] . | |
| 7201 | then have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) \<in> span d" | |
| 7202 | by (simp add: span_setsum span_clauses) | |
| 7203 | also have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i)" | |
| 57418 | 7204 | by (rule setsum.mono_neutral_cong_left [OF finite_Basis d]) (auto simp add: x) | 
| 53813 | 7205 | finally show "x \<in> span d" | 
| 7206 | unfolding euclidean_representation . | |
| 7207 | qed | |
| 7208 | qed simp | |
| 33175 | 7209 | |
| 53282 | 7210 | text{* Hence closure and completeness of all subspaces. *}
 | 
| 7211 | ||
| 7212 | lemma ex_card: | |
| 7213 | assumes "n \<le> card A" | |
| 7214 | shows "\<exists>S\<subseteq>A. card S = n" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7215 | proof cases | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7216 | assume "finite A" | 
| 55522 | 7217 |   from ex_bij_betw_nat_finite[OF this] obtain f where f: "bij_betw f {0..<card A} A" ..
 | 
| 53374 
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
 wenzelm parents: 
53291diff
changeset | 7218 |   moreover from f `n \<le> card A` have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7219 | by (auto simp: bij_betw_def intro: subset_inj_on) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7220 |   ultimately have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7221 | by (auto simp: bij_betw_def card_image) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7222 | then show ?thesis by blast | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7223 | next | 
| 52625 | 7224 | assume "\<not> finite A" | 
| 7225 | with `n \<le> card A` show ?thesis by force | |
| 7226 | qed | |
| 7227 | ||
| 7228 | lemma closed_subspace: | |
| 53291 | 7229 | fixes s :: "'a::euclidean_space set" | 
| 52625 | 7230 | assumes "subspace s" | 
| 7231 | shows "closed s" | |
| 7232 | proof - | |
| 7233 | have "dim s \<le> card (Basis :: 'a set)" | |
| 7234 | using dim_subset_UNIV by auto | |
| 7235 | with ex_card[OF this] obtain d :: "'a set" where t: "card d = dim s" and d: "d \<subseteq> Basis" | |
| 7236 | by auto | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7237 |   let ?t = "{x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7238 |   have "\<exists>f. linear f \<and> f ` {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s \<and>
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7239 |       inj_on f {x::'a. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7240 | using dim_substandard[of d] t d assms | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 7241 | by (intro subspace_isomorphism[OF subspace_substandard[of "\<lambda>i. i \<notin> d"]]) (auto simp: inner_Basis) | 
| 55522 | 7242 | then obtain f where f: | 
| 7243 | "linear f" | |
| 7244 |       "f ` {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} = s"
 | |
| 7245 |       "inj_on f {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0}"
 | |
| 7246 | by blast | |
| 52625 | 7247 | interpret f: bounded_linear f | 
| 7248 | using f unfolding linear_conv_bounded_linear by auto | |
| 7249 |   {
 | |
| 7250 | fix x | |
| 7251 | have "x\<in>?t \<Longrightarrow> f x = 0 \<Longrightarrow> x = 0" | |
| 7252 | using f.zero d f(3)[THEN inj_onD, of x 0] by auto | |
| 7253 | } | |
| 33175 | 7254 | moreover have "closed ?t" using closed_substandard . | 
| 7255 | moreover have "subspace ?t" using subspace_substandard . | |
| 52625 | 7256 | ultimately show ?thesis | 
| 7257 | using closed_injective_image_subspace[of ?t f] | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 7258 | unfolding f(2) using f(1) unfolding linear_conv_bounded_linear by auto | 
| 33175 | 7259 | qed | 
| 7260 | ||
| 7261 | lemma complete_subspace: | |
| 52625 | 7262 |   fixes s :: "('a::euclidean_space) set"
 | 
| 7263 | shows "subspace s \<Longrightarrow> complete s" | |
| 7264 | using complete_eq_closed closed_subspace by auto | |
| 33175 | 7265 | |
| 7266 | lemma dim_closure: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 7267 |   fixes s :: "('a::euclidean_space) set"
 | 
| 33175 | 7268 | shows "dim(closure s) = dim s" (is "?dc = ?d") | 
| 52625 | 7269 | proof - | 
| 33175 | 7270 | have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s] | 
| 7271 | using closed_subspace[OF subspace_span, of s] | |
| 52625 | 7272 | using dim_subset[of "closure s" "span s"] | 
| 7273 | unfolding dim_span | |
| 7274 | by auto | |
| 53282 | 7275 | then show ?thesis using dim_subset[OF closure_subset, of s] | 
| 52625 | 7276 | by auto | 
| 33175 | 7277 | qed | 
| 7278 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7279 | |
| 36437 | 7280 | subsection {* Affine transformations of intervals *}
 | 
| 33175 | 7281 | |
| 7282 | lemma real_affinity_le: | |
| 53291 | 7283 | "0 < (m::'a::linordered_field) \<Longrightarrow> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))" | 
| 57865 | 7284 | by (simp add: field_simps) | 
| 33175 | 7285 | |
| 7286 | lemma real_le_affinity: | |
| 53291 | 7287 | "0 < (m::'a::linordered_field) \<Longrightarrow> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)" | 
| 57865 | 7288 | by (simp add: field_simps) | 
| 33175 | 7289 | |
| 7290 | lemma real_affinity_lt: | |
| 53291 | 7291 | "0 < (m::'a::linordered_field) \<Longrightarrow> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))" | 
| 57865 | 7292 | by (simp add: field_simps) | 
| 33175 | 7293 | |
| 7294 | lemma real_lt_affinity: | |
| 53291 | 7295 | "0 < (m::'a::linordered_field) \<Longrightarrow> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)" | 
| 57865 | 7296 | by (simp add: field_simps) | 
| 33175 | 7297 | |
| 7298 | lemma real_affinity_eq: | |
| 53291 | 7299 | "(m::'a::linordered_field) \<noteq> 0 \<Longrightarrow> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))" | 
| 57865 | 7300 | by (simp add: field_simps) | 
| 33175 | 7301 | |
| 7302 | lemma real_eq_affinity: | |
| 53291 | 7303 | "(m::'a::linordered_field) \<noteq> 0 \<Longrightarrow> (y = m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) = x)" | 
| 57865 | 7304 | by (simp add: field_simps) | 
| 33175 | 7305 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7306 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7307 | subsection {* Banach fixed point theorem (not really topological...) *}
 | 
| 33175 | 7308 | |
| 7309 | lemma banach_fix: | |
| 53282 | 7310 |   assumes s: "complete s" "s \<noteq> {}"
 | 
| 7311 | and c: "0 \<le> c" "c < 1" | |
| 7312 | and f: "(f ` s) \<subseteq> s" | |
| 53291 | 7313 | and lipschitz: "\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y" | 
| 7314 | shows "\<exists>!x\<in>s. f x = x" | |
| 53282 | 7315 | proof - | 
| 33175 | 7316 | have "1 - c > 0" using c by auto | 
| 7317 | ||
| 7318 | from s(2) obtain z0 where "z0 \<in> s" by auto | |
| 7319 | def z \<equiv> "\<lambda>n. (f ^^ n) z0" | |
| 53282 | 7320 |   {
 | 
| 7321 | fix n :: nat | |
| 33175 | 7322 | have "z n \<in> s" unfolding z_def | 
| 52625 | 7323 | proof (induct n) | 
| 7324 | case 0 | |
| 53282 | 7325 | then show ?case using `z0 \<in> s` by auto | 
| 52625 | 7326 | next | 
| 7327 | case Suc | |
| 53282 | 7328 | then show ?case using f by auto qed | 
| 52625 | 7329 | } note z_in_s = this | 
| 33175 | 7330 | |
| 7331 | def d \<equiv> "dist (z 0) (z 1)" | |
| 7332 | ||
| 7333 | have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto | |
| 52625 | 7334 |   {
 | 
| 53282 | 7335 | fix n :: nat | 
| 33175 | 7336 | have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d" | 
| 52625 | 7337 | proof (induct n) | 
| 53282 | 7338 | case 0 | 
| 7339 | then show ?case | |
| 52625 | 7340 | unfolding d_def by auto | 
| 33175 | 7341 | next | 
| 7342 | case (Suc m) | |
| 53282 | 7343 | then have "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d" | 
| 52625 | 7344 | using `0 \<le> c` | 
| 7345 | using mult_left_mono[of "dist (z m) (z (Suc m))" "c ^ m * d" c] | |
| 7346 | by auto | |
| 53282 | 7347 | then show ?case | 
| 52625 | 7348 | using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s] | 
| 7349 | unfolding fzn and mult_le_cancel_left | |
| 7350 | by auto | |
| 33175 | 7351 | qed | 
| 7352 | } note cf_z = this | |
| 7353 | ||
| 52625 | 7354 |   {
 | 
| 53282 | 7355 | fix n m :: nat | 
| 33175 | 7356 | have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)" | 
| 52625 | 7357 | proof (induct n) | 
| 53282 | 7358 | case 0 | 
| 7359 | show ?case by auto | |
| 33175 | 7360 | next | 
| 7361 | case (Suc k) | |
| 52625 | 7362 | have "(1 - c) * dist (z m) (z (m + Suc k)) \<le> | 
| 7363 | (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))" | |
| 7364 | using dist_triangle and c by (auto simp add: dist_triangle) | |
| 33175 | 7365 | also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)" | 
| 7366 | using cf_z[of "m + k"] and c by auto | |
| 7367 | also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d" | |
| 36350 | 7368 | using Suc by (auto simp add: field_simps) | 
| 33175 | 7369 | also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)" | 
| 36350 | 7370 | unfolding power_add by (auto simp add: field_simps) | 
| 33175 | 7371 | also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)" | 
| 36350 | 7372 | using c by (auto simp add: field_simps) | 
| 33175 | 7373 | finally show ?case by auto | 
| 7374 | qed | |
| 7375 | } note cf_z2 = this | |
| 52625 | 7376 |   {
 | 
| 53282 | 7377 | fix e :: real | 
| 7378 | assume "e > 0" | |
| 7379 | then have "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e" | |
| 52625 | 7380 | proof (cases "d = 0") | 
| 33175 | 7381 | case True | 
| 41863 | 7382 | have *: "\<And>x. ((1 - c) * x \<le> 0) = (x \<le> 0)" using `1 - c > 0` | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 7383 | by (metis mult_zero_left mult.commute real_mult_le_cancel_iff1) | 
| 41863 | 7384 | from True have "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def | 
| 7385 | by (simp add: *) | |
| 53282 | 7386 | then show ?thesis using `e>0` by auto | 
| 33175 | 7387 | next | 
| 52625 | 7388 | case False | 
| 53282 | 7389 | then have "d>0" unfolding d_def using zero_le_dist[of "z 0" "z 1"] | 
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 7390 | by (metis False d_def less_le) | 
| 56541 | 7391 | hence "0 < e * (1 - c) / d" | 
| 56544 | 7392 | using `e>0` and `1-c>0` by auto | 
| 52625 | 7393 | then obtain N where N:"c ^ N < e * (1 - c) / d" | 
| 7394 | using real_arch_pow_inv[of "e * (1 - c) / d" c] and c by auto | |
| 7395 |       {
 | |
| 7396 | fix m n::nat | |
| 7397 | assume "m>n" and as:"m\<ge>N" "n\<ge>N" | |
| 7398 | have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c | |
| 7399 | using power_decreasing[OF `n\<ge>N`, of c] by auto | |
| 7400 | have "1 - c ^ (m - n) > 0" | |
| 7401 | using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto | |
| 56541 | 7402 | hence **: "d * (1 - c ^ (m - n)) / (1 - c) > 0" | 
| 56544 | 7403 | using `d>0` `0 < 1 - c` by auto | 
| 33175 | 7404 | |
| 7405 | have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)" | |
| 52625 | 7406 | using cf_z2[of n "m - n"] and `m>n` | 
| 7407 | unfolding pos_le_divide_eq[OF `1-c>0`] | |
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 7408 | by (auto simp add: mult.commute dist_commute) | 
| 33175 | 7409 | also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 7410 | using mult_right_mono[OF * order_less_imp_le[OF **]] | |
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 7411 | unfolding mult.assoc by auto | 
| 33175 | 7412 | also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 57512 
cc97b347b301
reduced name variants for assoc and commute on plus and mult
 haftmann parents: 
57448diff
changeset | 7413 | using mult_strict_right_mono[OF N **] unfolding mult.assoc by auto | 
| 53282 | 7414 | also have "\<dots> = e * (1 - c ^ (m - n))" | 
| 7415 | using c and `d>0` and `1 - c > 0` by auto | |
| 7416 | also have "\<dots> \<le> e" using c and `1 - c ^ (m - n) > 0` and `e>0` | |
| 7417 | using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto | |
| 33175 | 7418 | finally have "dist (z m) (z n) < e" by auto | 
| 7419 | } note * = this | |
| 52625 | 7420 |       {
 | 
| 53282 | 7421 | fix m n :: nat | 
| 7422 | assume as: "N \<le> m" "N \<le> n" | |
| 7423 | then have "dist (z n) (z m) < e" | |
| 52625 | 7424 | proof (cases "n = m") | 
| 7425 | case True | |
| 53282 | 7426 | then show ?thesis using `e>0` by auto | 
| 33175 | 7427 | next | 
| 52625 | 7428 | case False | 
| 53282 | 7429 | then show ?thesis using as and *[of n m] *[of m n] | 
| 52625 | 7430 | unfolding nat_neq_iff by (auto simp add: dist_commute) | 
| 7431 | qed | |
| 7432 | } | |
| 53282 | 7433 | then show ?thesis by auto | 
| 33175 | 7434 | qed | 
| 7435 | } | |
| 53282 | 7436 | then have "Cauchy z" | 
| 7437 | unfolding cauchy_def by auto | |
| 52625 | 7438 | then obtain x where "x\<in>s" and x:"(z ---> x) sequentially" | 
| 7439 | using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto | |
| 33175 | 7440 | |
| 7441 | def e \<equiv> "dist (f x) x" | |
| 52625 | 7442 | have "e = 0" | 
| 7443 | proof (rule ccontr) | |
| 7444 | assume "e \<noteq> 0" | |
| 53282 | 7445 | then have "e > 0" | 
| 7446 | unfolding e_def using zero_le_dist[of "f x" x] | |
| 33175 | 7447 | by (metis dist_eq_0_iff dist_nz e_def) | 
| 7448 | then obtain N where N:"\<forall>n\<ge>N. dist (z n) x < e / 2" | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 7449 | using x[unfolded LIMSEQ_def, THEN spec[where x="e/2"]] by auto | 
| 53282 | 7450 | then have N':"dist (z N) x < e / 2" by auto | 
| 7451 | ||
| 7452 | have *: "c * dist (z N) x \<le> dist (z N) x" | |
| 52625 | 7453 | unfolding mult_le_cancel_right2 | 
| 33175 | 7454 | using zero_le_dist[of "z N" x] and c | 
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 7455 | by (metis dist_eq_0_iff dist_nz order_less_asym less_le) | 
| 52625 | 7456 | have "dist (f (z N)) (f x) \<le> c * dist (z N) x" | 
| 7457 | using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]] | |
| 7458 | using z_in_s[of N] `x\<in>s` | |
| 7459 | using c | |
| 7460 | by auto | |
| 7461 | also have "\<dots> < e / 2" | |
| 7462 | using N' and c using * by auto | |
| 7463 | finally show False | |
| 7464 | unfolding fzn | |
| 33175 | 7465 | using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x] | 
| 52625 | 7466 | unfolding e_def | 
| 7467 | by auto | |
| 33175 | 7468 | qed | 
| 53282 | 7469 | then have "f x = x" unfolding e_def by auto | 
| 33175 | 7470 | moreover | 
| 52625 | 7471 |   {
 | 
| 7472 | fix y | |
| 7473 | assume "f y = y" "y\<in>s" | |
| 53282 | 7474 | then have "dist x y \<le> c * dist x y" | 
| 52625 | 7475 | using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]] | 
| 7476 | using `x\<in>s` and `f x = x` | |
| 7477 | by auto | |
| 53282 | 7478 | then have "dist x y = 0" | 
| 52625 | 7479 | unfolding mult_le_cancel_right1 | 
| 7480 | using c and zero_le_dist[of x y] | |
| 7481 | by auto | |
| 53282 | 7482 | then have "y = x" by auto | 
| 33175 | 7483 | } | 
| 34999 
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
 hoelzl parents: 
34964diff
changeset | 7484 | ultimately show ?thesis using `x\<in>s` by blast+ | 
| 33175 | 7485 | qed | 
| 7486 | ||
| 53282 | 7487 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 7488 | subsection {* Edelstein fixed point theorem *}
 | 
| 33175 | 7489 | |
| 7490 | lemma edelstein_fix: | |
| 50970 
3e5b67f85bf9
generalized theorem edelstein_fix to class metric_space
 huffman parents: 
50955diff
changeset | 7491 | fixes s :: "'a::metric_space set" | 
| 52625 | 7492 |   assumes s: "compact s" "s \<noteq> {}"
 | 
| 7493 | and gs: "(g ` s) \<subseteq> s" | |
| 7494 | and dist: "\<forall>x\<in>s. \<forall>y\<in>s. x \<noteq> y \<longrightarrow> dist (g x) (g y) < dist x y" | |
| 51347 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7495 | shows "\<exists>!x\<in>s. g x = x" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7496 | proof - | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7497 | let ?D = "(\<lambda>x. (x, x)) ` s" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7498 |   have D: "compact ?D" "?D \<noteq> {}"
 | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7499 | by (rule compact_continuous_image) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7500 | (auto intro!: s continuous_Pair continuous_within_id simp: continuous_on_eq_continuous_within) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7501 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7502 | 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" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7503 | using dist by fastforce | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7504 | then have "continuous_on s g" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7505 | unfolding continuous_on_iff by auto | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7506 | then have cont: "continuous_on ?D (\<lambda>x. dist ((g \<circ> fst) x) (snd x))" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7507 | unfolding continuous_on_eq_continuous_within | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7508 | by (intro continuous_dist ballI continuous_within_compose) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7509 | (auto intro!: continuous_fst continuous_snd continuous_within_id simp: image_image) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7510 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7511 | obtain a where "a \<in> s" and le: "\<And>x. x \<in> s \<Longrightarrow> dist (g a) a \<le> dist (g x) x" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7512 | using continuous_attains_inf[OF D cont] by auto | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7513 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7514 | have "g a = a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7515 | proof (rule ccontr) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7516 | assume "g a \<noteq> a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7517 | with `a \<in> s` gs have "dist (g (g a)) (g a) < dist (g a) a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7518 | by (intro dist[rule_format]) auto | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7519 | moreover have "dist (g a) a \<le> dist (g (g a)) (g a)" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7520 | using `a \<in> s` gs by (intro le) auto | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7521 | ultimately show False by auto | 
| 33175 | 7522 | qed | 
| 51347 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7523 | moreover have "\<And>x. x \<in> s \<Longrightarrow> g x = x \<Longrightarrow> x = a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7524 | using dist[THEN bspec[where x=a]] `g a = a` and `a\<in>s` by auto | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 7525 | ultimately show "\<exists>!x\<in>s. g x = x" using `a \<in> s` by blast | 
| 33175 | 7526 | qed | 
| 7527 | ||
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 7528 | no_notation | 
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 7529 | eucl_less (infix "<e" 50) | 
| 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54489diff
changeset | 7530 | |
| 33175 | 7531 | end |