| author | wenzelm | 
| Thu, 30 May 2013 22:30:38 +0200 | |
| changeset 52264 | cdba0c3cb4c2 | 
| parent 52141 | eff000cab70f | 
| child 52624 | 8a7b59a81088 | 
| 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 | ||
| 7 | header {* Elementary topology in Euclidean space. *}
 | |
| 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" | 
| 50087 | 13 | "~~/src/HOL/Library/Glbs" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 14 | "~~/src/HOL/Library/FuncSet" | 
| 50938 | 15 | Linear_Algebra | 
| 50087 | 16 | Norm_Arith | 
| 17 | begin | |
| 18 | ||
| 50972 | 19 | lemma dist_0_norm: | 
| 20 | fixes x :: "'a::real_normed_vector" | |
| 21 | shows "dist 0 x = norm x" | |
| 22 | unfolding dist_norm by simp | |
| 23 | ||
| 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 | 24 | 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 | 25 | 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 | 26 | |
| 50972 | 27 | (* LEGACY *) | 
| 28 | lemma lim_subseq: "subseq r \<Longrightarrow> s ----> l \<Longrightarrow> (s o r) ----> l" | |
| 29 | by (rule LIMSEQ_subseq_LIMSEQ) | |
| 30 | ||
| 51342 | 31 | lemmas real_isGlb_unique = isGlb_unique[where 'a=real] | 
| 50942 | 32 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 33 | lemma countable_PiE: | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 34 | "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 | 35 | 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 | 36 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 37 | lemma Lim_within_open: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 38 | 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 | 39 | 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 | 40 | by (fact tendsto_within_open) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 41 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 42 | lemma continuous_on_union: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 43 | "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 | 44 | by (fact continuous_on_closed_Un) | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 45 | |
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 46 | lemma continuous_on_cases: | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 47 | "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 | 48 | \<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 | 49 | 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 | 50 | by (rule continuous_on_If) auto | 
| 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 51 | |
| 50087 | 52 | subsection {* Topological Basis *}
 | 
| 53 | ||
| 54 | context topological_space | |
| 55 | begin | |
| 56 | ||
| 57 | definition "topological_basis B = | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 58 | ((\<forall>b\<in>B. open b) \<and> (\<forall>x. open x \<longrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x)))" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 59 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 60 | lemma topological_basis: | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 61 | "topological_basis B = (\<forall>x. open x \<longleftrightarrow> (\<exists>B'. B' \<subseteq> B \<and> \<Union>B' = x))" | 
| 50998 | 62 | unfolding topological_basis_def | 
| 63 | apply safe | |
| 64 | apply fastforce | |
| 65 | apply fastforce | |
| 66 | apply (erule_tac x="x" in allE) | |
| 67 | apply simp | |
| 68 |    apply (rule_tac x="{x}" in exI)
 | |
| 69 | apply auto | |
| 70 | done | |
| 71 | ||
| 50087 | 72 | lemma topological_basis_iff: | 
| 73 | assumes "\<And>B'. B' \<in> B \<Longrightarrow> open B'" | |
| 74 | 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'))" | |
| 75 | (is "_ \<longleftrightarrow> ?rhs") | |
| 76 | proof safe | |
| 77 | fix O' and x::'a | |
| 78 | assume H: "topological_basis B" "open O'" "x \<in> O'" | |
| 79 | hence "(\<exists>B'\<subseteq>B. \<Union>B' = O')" by (simp add: topological_basis_def) | |
| 80 | then obtain B' where "B' \<subseteq> B" "O' = \<Union>B'" by auto | |
| 81 | thus "\<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" using H by auto | |
| 82 | next | |
| 83 | assume H: ?rhs | |
| 84 | show "topological_basis B" using assms unfolding topological_basis_def | |
| 85 | proof safe | |
| 86 | fix O'::"'a set" assume "open O'" | |
| 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) | |
| 89 | thus "\<exists>B'\<subseteq>B. \<Union>B' = O'" | |
| 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'" | |
| 96 | assumes "\<And>O' x. open O' \<Longrightarrow> x \<in> O' \<Longrightarrow> \<exists>B'\<in>B. x \<in> B' \<and> B' \<subseteq> O'" | |
| 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" | |
| 103 | assumes "open O'" | |
| 104 | assumes "x \<in> O'" | |
| 105 | obtains B' where "B' \<in> B" "x \<in> B'" "B' \<subseteq> O'" | |
| 106 | proof atomize_elim | |
| 107 | from assms have "\<And>B'. B'\<in>B \<Longrightarrow> open B'" by (simp add: topological_basis_def) | |
| 108 | with topological_basis_iff assms | |
| 109 | show "\<exists>B'. B' \<in> B \<and> x \<in> B' \<and> B' \<subseteq> O'" using assms by (simp add: Bex_def) | |
| 110 | qed | |
| 111 | ||
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 112 | lemma topological_basis_open: | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 113 | assumes "topological_basis B" | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 114 | assumes "X \<in> B" | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 115 | shows "open X" | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 116 | using assms | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 117 | by (simp add: topological_basis_def) | 
| 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 118 | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 119 | lemma topological_basis_imp_subbasis: | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 120 | assumes B: "topological_basis B" shows "open = generate_topology B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 121 | proof (intro ext iffI) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 122 | fix S :: "'a set" assume "open S" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 123 | 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 | 124 | unfolding topological_basis_def by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 125 | then show "generate_topology B S" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 126 | 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 | 127 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 128 | fix S :: "'a set" assume "generate_topology B S" then show "open S" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 129 | 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 | 130 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 131 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 132 | lemma basis_dense: | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 133 | fixes B::"'a set set" and f::"'a set \<Rightarrow> 'a" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 134 | assumes "topological_basis B" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 135 |   assumes choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 136 |   shows "(\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X))"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 137 | proof (intro allI impI) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 138 |   fix X::"'a set" assume "open X" "X \<noteq> {}"
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 139 |   from topological_basisE[OF `topological_basis B` `open X` choosefrom_basis[OF `X \<noteq> {}`]]
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 140 | guess B' . note B' = this | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 141 | thus "\<exists>B'\<in>B. f B' \<in> X" by (auto intro!: choosefrom_basis) | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 142 | qed | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 143 | |
| 50087 | 144 | end | 
| 145 | ||
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 146 | lemma topological_basis_prod: | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 147 | assumes A: "topological_basis A" and B: "topological_basis B" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 148 | 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 | 149 | unfolding topological_basis_def | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 150 | proof (safe, simp_all del: ex_simps add: subset_image_iff ex_simps(1)[symmetric]) | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 151 |   fix S :: "('a \<times> 'b) set" assume "open S"
 | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 152 | 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 | 153 |   proof (safe intro!: exI[of _ "{x\<in>A \<times> B. fst x \<times> snd x \<subseteq> S}"])
 | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 154 | fix x y assume "(x, y) \<in> S" | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 155 | from open_prod_elim[OF `open S` this] | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 156 | 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 | 157 | by (metis mem_Sigma_iff) | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 158 | moreover from topological_basisE[OF A a] guess A0 . | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 159 | moreover from topological_basisE[OF B b] guess B0 . | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 160 |     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 | 161 | by (intro UN_I[of "(A0, B0)"]) auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 162 | qed auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 163 | qed (metis A B topological_basis_open open_Times) | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 164 | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 165 | subsection {* Countable Basis *}
 | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 166 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 167 | locale countable_basis = | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 168 | fixes B::"'a::topological_space set set" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 169 | assumes is_basis: "topological_basis B" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 170 | assumes countable_basis: "countable B" | 
| 33175 | 171 | begin | 
| 172 | ||
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 173 | lemma open_countable_basis_ex: | 
| 50087 | 174 | assumes "open X" | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 175 | shows "\<exists>B' \<subseteq> B. X = Union B'" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 176 | using assms countable_basis is_basis unfolding topological_basis_def by blast | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 177 | |
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 178 | lemma open_countable_basisE: | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 179 | assumes "open X" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 180 | obtains B' where "B' \<subseteq> B" "X = Union B'" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 181 | using assms open_countable_basis_ex by (atomize_elim) simp | 
| 
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 | lemma countable_dense_exists: | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 184 |   shows "\<exists>D::'a set. countable D \<and> (\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>d \<in> D. d \<in> X))"
 | 
| 50087 | 185 | proof - | 
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 186 | let ?f = "(\<lambda>B'. SOME x. x \<in> B')" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 187 | have "countable (?f ` B)" using countable_basis by simp | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 188 | with basis_dense[OF is_basis, of ?f] show ?thesis | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 189 | by (intro exI[where x="?f ` B"]) (metis (mono_tags) all_not_in_conv imageI someI) | 
| 50087 | 190 | qed | 
| 191 | ||
| 192 | lemma countable_dense_setE: | |
| 50245 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 193 | obtains D :: "'a set" | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 194 |   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 | 195 | using countable_dense_exists by blast | 
| 
dea9363887a6
based countable topological basis on Countable_Set
 immler parents: 
50105diff
changeset | 196 | |
| 50087 | 197 | end | 
| 198 | ||
| 50883 | 199 | lemma (in first_countable_topology) first_countable_basisE: | 
| 200 | obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 201 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)" | |
| 202 | using first_countable_basis[of x] | |
| 51473 | 203 | apply atomize_elim | 
| 204 | apply (elim exE) | |
| 205 | apply (rule_tac x="range A" in exI) | |
| 206 | apply auto | |
| 207 | done | |
| 50883 | 208 | |
| 51105 | 209 | lemma (in first_countable_topology) first_countable_basis_Int_stableE: | 
| 210 | obtains A where "countable A" "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 211 | "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>a\<in>A. a \<subseteq> S)" | |
| 212 | "\<And>a b. a \<in> A \<Longrightarrow> b \<in> A \<Longrightarrow> a \<inter> b \<in> A" | |
| 213 | proof atomize_elim | |
| 214 | from first_countable_basisE[of x] guess A' . note A' = this | |
| 215 | def A \<equiv> "(\<lambda>N. \<Inter>((\<lambda>n. from_nat_into A' n) ` N)) ` (Collect finite::nat set set)" | |
| 216 | thus "\<exists>A. countable A \<and> (\<forall>a. a \<in> A \<longrightarrow> x \<in> a) \<and> (\<forall>a. a \<in> A \<longrightarrow> open a) \<and> | |
| 217 | (\<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)" | |
| 218 | proof (safe intro!: exI[where x=A]) | |
| 219 | show "countable A" unfolding A_def by (intro countable_image countable_Collect_finite) | |
| 220 | fix a assume "a \<in> A" | |
| 221 | thus "x \<in> a" "open a" using A'(4)[OF open_UNIV] by (auto simp: A_def intro: A' from_nat_into) | |
| 222 | next | |
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 223 | let ?int = "\<lambda>N. \<Inter>(from_nat_into A' ` N)" | 
| 51105 | 224 | fix a b assume "a \<in> A" "b \<in> A" | 
| 225 | then obtain N M where "a = ?int N" "b = ?int M" "finite (N \<union> M)" by (auto simp: A_def) | |
| 226 | thus "a \<inter> b \<in> A" by (auto simp: A_def intro!: image_eqI[where x="N \<union> M"]) | |
| 227 | next | |
| 228 | fix S assume "open S" "x \<in> S" then obtain a where a: "a\<in>A'" "a \<subseteq> S" using A' by blast | |
| 229 | thus "\<exists>a\<in>A. a \<subseteq> S" using a A' | |
| 230 |       by (intro bexI[where x=a]) (auto simp: A_def intro: image_eqI[where x="{to_nat_on A' a}"])
 | |
| 231 | qed | |
| 232 | qed | |
| 233 | ||
| 51473 | 234 | lemma (in topological_space) first_countableI: | 
| 235 | assumes "countable A" and 1: "\<And>a. a \<in> A \<Longrightarrow> x \<in> a" "\<And>a. a \<in> A \<Longrightarrow> open a" | |
| 236 | and 2: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>a\<in>A. a \<subseteq> S" | |
| 237 | 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))" | |
| 238 | proof (safe intro!: exI[of _ "from_nat_into A"]) | |
| 239 |   have "A \<noteq> {}" using 2[of UNIV] by auto
 | |
| 240 |   { fix i show "x \<in> from_nat_into A i" "open (from_nat_into A i)"
 | |
| 241 |       using range_from_nat_into_subset[OF `A \<noteq> {}`] 1 by auto }
 | |
| 242 |   { fix S assume "open S" "x\<in>S" from 2[OF this] show "\<exists>i. from_nat_into A i \<subseteq> S"
 | |
| 243 | using subset_range_from_nat_into[OF `countable A`] by auto } | |
| 244 | qed | |
| 51350 | 245 | |
| 50883 | 246 | instance prod :: (first_countable_topology, first_countable_topology) first_countable_topology | 
| 247 | proof | |
| 248 | fix x :: "'a \<times> 'b" | |
| 249 | from first_countable_basisE[of "fst x"] guess A :: "'a set set" . note A = this | |
| 250 | from first_countable_basisE[of "snd x"] guess B :: "'b set set" . note B = this | |
| 51473 | 251 |   show "\<exists>A::nat \<Rightarrow> ('a \<times> 'b) 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))"
 | 
| 252 | proof (rule first_countableI[of "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"], safe) | |
| 50883 | 253 | fix a b assume x: "a \<in> A" "b \<in> B" | 
| 254 | with A(2, 3)[of a] B(2, 3)[of b] show "x \<in> a \<times> b" "open (a \<times> b)" | |
| 255 | unfolding mem_Times_iff by (auto intro: open_Times) | |
| 256 | next | |
| 257 | fix S assume "open S" "x \<in> S" | |
| 258 | from open_prod_elim[OF this] guess a' b' . | |
| 259 | moreover with A(4)[of a'] B(4)[of b'] | |
| 260 | obtain a b where "a \<in> A" "a \<subseteq> a'" "b \<in> B" "b \<subseteq> b'" by auto | |
| 261 | ultimately show "\<exists>a\<in>(\<lambda>(a, b). a \<times> b) ` (A \<times> B). a \<subseteq> S" | |
| 262 | by (auto intro!: bexI[of _ "a \<times> b"] bexI[of _ a] bexI[of _ b]) | |
| 263 | qed (simp add: A B) | |
| 264 | qed | |
| 265 | ||
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50526diff
changeset | 266 | class second_countable_topology = topological_space + | 
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 267 | assumes ex_countable_subbasis: "\<exists>B::'a::topological_space 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 | 268 | begin | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 269 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 270 | 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 | 271 | proof - | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 272 | from ex_countable_subbasis obtain B where B: "countable B" "open = generate_topology B" by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 273 |   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 | 274 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 275 | show ?thesis | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 276 | proof (intro exI conjI) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 277 | show "countable ?B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 278 | by (intro countable_image countable_Collect_finite_subset B) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 279 |     { fix S assume "open S"
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 280 |       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 | 281 | unfolding B | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 282 | proof induct | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 283 |         case UNIV show ?case by (intro exI[of _ "{{}}"]) simp
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 284 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 285 | case (Int a b) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 286 | 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 | 287 | 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 | 288 | by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 289 | show ?case | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 290 | unfolding x y Int_UN_distrib2 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 291 |           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 | 292 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 293 | case (UN K) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 294 |         then have "\<forall>k\<in>K. \<exists>B'\<subseteq>{b. finite b \<and> b \<subseteq> B}. UNION B' Inter = k" by auto
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 295 | then guess k unfolding bchoice_iff .. | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 296 |         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 | 297 | 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 | 298 | next | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 299 | case (Basis S) then show ?case | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 300 |           by (intro exI[of _ "{{S}}"]) auto
 | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 301 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 302 |       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 | 303 | unfolding subset_image_iff by blast } | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 304 | then show "topological_basis ?B" | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 305 | unfolding topological_space_class.topological_basis_def | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 306 | by (safe intro!: topological_space_class.open_Inter) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 307 | (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 | 308 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 309 | qed | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 310 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 311 | end | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 312 | |
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 313 | sublocale second_countable_topology < | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 314 | 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 | 315 | 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 | 316 | by unfold_locales safe | 
| 50094 
84ddcf5364b4
allow arbitrary enumerations of basis in locale for generation of borel sets
 immler parents: 
50087diff
changeset | 317 | |
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 318 | 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 | 319 | proof | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 320 | 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 | 321 | using ex_countable_basis by auto | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 322 | moreover | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 323 | 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 | 324 | 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 | 325 |   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 | 326 | 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 | 327 | topological_basis_imp_subbasis) | 
| 50882 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 328 | qed | 
| 
a382bf90867e
move prod instantiation of second_countable_topology to its definition
 hoelzl parents: 
50881diff
changeset | 329 | |
| 50883 | 330 | instance second_countable_topology \<subseteq> first_countable_topology | 
| 331 | proof | |
| 332 | fix x :: 'a | |
| 333 | def B \<equiv> "SOME B::'a set set. countable B \<and> topological_basis B" | |
| 334 | then have B: "countable B" "topological_basis B" | |
| 335 | using countable_basis is_basis | |
| 336 | by (auto simp: countable_basis is_basis) | |
| 51473 | 337 | then show "\<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))" | 
| 338 |     by (intro first_countableI[of "{b\<in>B. x \<in> b}"])
 | |
| 339 | (fastforce simp: topological_space_class.topological_basis_def)+ | |
| 50883 | 340 | qed | 
| 341 | ||
| 50087 | 342 | subsection {* Polish spaces *}
 | 
| 343 | ||
| 344 | text {* Textbooks define Polish spaces as completely metrizable.
 | |
| 345 | We assume the topology to be complete for a given metric. *} | |
| 346 | ||
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50526diff
changeset | 347 | class polish_space = complete_space + second_countable_topology | 
| 50087 | 348 | |
| 44517 | 349 | subsection {* General notion of a topology as a value *}
 | 
| 33175 | 350 | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 351 | definition "istopology L \<longleftrightarrow> 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))"
 | 
| 49834 | 352 | typedef 'a topology = "{L::('a set) \<Rightarrow> bool. istopology L}"
 | 
| 33175 | 353 | morphisms "openin" "topology" | 
| 354 | unfolding istopology_def by blast | |
| 355 | ||
| 356 | lemma istopology_open_in[intro]: "istopology(openin U)" | |
| 357 | using openin[of U] by blast | |
| 358 | ||
| 359 | lemma topology_inverse': "istopology U \<Longrightarrow> openin (topology U) = U" | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 360 | using topology_inverse[unfolded mem_Collect_eq] . | 
| 33175 | 361 | |
| 362 | lemma topology_inverse_iff: "istopology U \<longleftrightarrow> openin (topology U) = U" | |
| 363 | using topology_inverse[of U] istopology_open_in[of "topology U"] by auto | |
| 364 | ||
| 365 | lemma topology_eq: "T1 = T2 \<longleftrightarrow> (\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S)" | |
| 366 | proof- | |
| 49711 | 367 |   { assume "T1=T2"
 | 
| 368 | hence "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S" by simp } | |
| 33175 | 369 | moreover | 
| 49711 | 370 |   { assume H: "\<forall>S. openin T1 S \<longleftrightarrow> openin T2 S"
 | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 371 | hence "openin T1 = openin T2" by (simp add: fun_eq_iff) | 
| 33175 | 372 | hence "topology (openin T1) = topology (openin T2)" by simp | 
| 49711 | 373 | hence "T1 = T2" unfolding openin_inverse . | 
| 374 | } | |
| 33175 | 375 | ultimately show ?thesis by blast | 
| 376 | qed | |
| 377 | ||
| 378 | text{* Infer the "universe" from union of all sets in the topology. *}
 | |
| 379 | ||
| 380 | definition "topspace T =  \<Union>{S. openin T S}"
 | |
| 381 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 382 | subsubsection {* Main properties of open sets *}
 | 
| 33175 | 383 | |
| 384 | lemma openin_clauses: | |
| 385 | fixes U :: "'a topology" | |
| 386 |   shows "openin U {}"
 | |
| 387 | "\<And>S T. openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S\<inter>T)" | |
| 388 | "\<And>K. (\<forall>S \<in> K. openin U S) \<Longrightarrow> openin U (\<Union>K)" | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 389 | using openin[of U] unfolding istopology_def mem_Collect_eq | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 390 | by fast+ | 
| 33175 | 391 | |
| 392 | lemma openin_subset[intro]: "openin U S \<Longrightarrow> S \<subseteq> topspace U" | |
| 393 | unfolding topspace_def by blast | |
| 394 | lemma openin_empty[simp]: "openin U {}" by (simp add: openin_clauses)
 | |
| 395 | ||
| 396 | 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 | 397 | using openin_clauses by simp | 
| 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 398 | |
| 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 399 | 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 | 400 | using openin_clauses by simp | 
| 33175 | 401 | |
| 402 | lemma openin_Un[intro]: "openin U S \<Longrightarrow> openin U T \<Longrightarrow> openin U (S \<union> T)" | |
| 403 |   using openin_Union[of "{S,T}" U] by auto
 | |
| 404 | ||
| 405 | lemma openin_topspace[intro, simp]: "openin U (topspace U)" by (simp add: openin_Union topspace_def) | |
| 406 | ||
| 49711 | 407 | lemma openin_subopen: "openin U S \<longleftrightarrow> (\<forall>x \<in> S. \<exists>T. openin U T \<and> x \<in> T \<and> T \<subseteq> S)" | 
| 408 | (is "?lhs \<longleftrightarrow> ?rhs") | |
| 36584 | 409 | proof | 
| 49711 | 410 | assume ?lhs | 
| 411 | then show ?rhs by auto | |
| 36584 | 412 | next | 
| 413 | assume H: ?rhs | |
| 414 |   let ?t = "\<Union>{T. openin U T \<and> T \<subseteq> S}"
 | |
| 415 | have "openin U ?t" by (simp add: openin_Union) | |
| 416 | also have "?t = S" using H by auto | |
| 417 | finally show "openin U S" . | |
| 33175 | 418 | qed | 
| 419 | ||
| 49711 | 420 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 421 | subsubsection {* Closed sets *}
 | 
| 33175 | 422 | |
| 423 | definition "closedin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> openin U (topspace U - S)" | |
| 424 | ||
| 425 | lemma closedin_subset: "closedin U S \<Longrightarrow> S \<subseteq> topspace U" by (metis closedin_def) | |
| 426 | lemma closedin_empty[simp]: "closedin U {}" by (simp add: closedin_def)
 | |
| 427 | lemma closedin_topspace[intro,simp]: | |
| 428 | "closedin U (topspace U)" by (simp add: closedin_def) | |
| 429 | lemma closedin_Un[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<union> T)" | |
| 430 | by (auto simp add: Diff_Un closedin_def) | |
| 431 | ||
| 432 | lemma Diff_Inter[intro]: "A - \<Inter>S = \<Union> {A - s|s. s\<in>S}" by auto
 | |
| 433 | lemma closedin_Inter[intro]: assumes Ke: "K \<noteq> {}" and Kc: "\<forall>S \<in>K. closedin U S"
 | |
| 434 | shows "closedin U (\<Inter> K)" using Ke Kc unfolding closedin_def Diff_Inter by auto | |
| 435 | ||
| 436 | lemma closedin_Int[intro]: "closedin U S \<Longrightarrow> closedin U T \<Longrightarrow> closedin U (S \<inter> T)" | |
| 437 |   using closedin_Inter[of "{S,T}" U] by auto
 | |
| 438 | ||
| 439 | lemma Diff_Diff_Int: "A - (A - B) = A \<inter> B" by blast | |
| 440 | lemma openin_closedin_eq: "openin U S \<longleftrightarrow> S \<subseteq> topspace U \<and> closedin U (topspace U - S)" | |
| 441 | apply (auto simp add: closedin_def Diff_Diff_Int inf_absorb2) | |
| 442 | apply (metis openin_subset subset_eq) | |
| 443 | done | |
| 444 | ||
| 445 | lemma openin_closedin: "S \<subseteq> topspace U \<Longrightarrow> (openin U S \<longleftrightarrow> closedin U (topspace U - S))" | |
| 446 | by (simp add: openin_closedin_eq) | |
| 447 | ||
| 448 | lemma openin_diff[intro]: assumes oS: "openin U S" and cT: "closedin U T" shows "openin U (S - T)" | |
| 449 | proof- | |
| 450 | have "S - T = S \<inter> (topspace U - T)" using openin_subset[of U S] oS cT | |
| 451 | by (auto simp add: topspace_def openin_subset) | |
| 452 | then show ?thesis using oS cT by (auto simp add: closedin_def) | |
| 453 | qed | |
| 454 | ||
| 455 | lemma closedin_diff[intro]: assumes oS: "closedin U S" and cT: "openin U T" shows "closedin U (S - T)" | |
| 456 | proof- | |
| 457 | have "S - T = S \<inter> (topspace U - T)" using closedin_subset[of U S] oS cT | |
| 458 | by (auto simp add: topspace_def ) | |
| 459 | then show ?thesis using oS cT by (auto simp add: openin_closedin_eq) | |
| 460 | qed | |
| 461 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 462 | subsubsection {* Subspace topology *}
 | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 463 | |
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 464 | 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 | 465 | |
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 466 | 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 | 467 | (is "istopology ?L") | 
| 33175 | 468 | proof- | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 469 |   have "?L {}" by blast
 | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 470 |   {fix A B assume A: "?L A" and B: "?L B"
 | 
| 33175 | 471 | 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" by blast | 
| 472 | have "A\<inter>B = (Sa \<inter> Sb) \<inter> V" "openin U (Sa \<inter> Sb)" using Sa Sb by blast+ | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 473 | then have "?L (A \<inter> B)" by blast} | 
| 33175 | 474 | moreover | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 475 |   {fix K assume K: "K \<subseteq> Collect ?L"
 | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 476 | have th0: "Collect ?L = (\<lambda>S. S \<inter> V) ` Collect (openin U)" | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 477 | apply (rule set_eqI) | 
| 33175 | 478 | apply (simp add: Ball_def image_iff) | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 479 | by metis | 
| 33175 | 480 | from K[unfolded th0 subset_image_iff] | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 481 | obtain Sk where Sk: "Sk \<subseteq> Collect (openin U)" "K = (\<lambda>S. S \<inter> V) ` Sk" by blast | 
| 33175 | 482 | have "\<Union>K = (\<Union>Sk) \<inter> V" using Sk by auto | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 483 | moreover have "openin U (\<Union> Sk)" using Sk by (auto simp add: subset_eq) | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 484 | ultimately have "?L (\<Union>K)" by blast} | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 485 | ultimately show ?thesis | 
| 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 486 | unfolding subset_eq mem_Collect_eq istopology_def by blast | 
| 33175 | 487 | qed | 
| 488 | ||
| 489 | lemma openin_subtopology: | |
| 490 | "openin (subtopology U V) S \<longleftrightarrow> (\<exists> T. (openin U T) \<and> (S = T \<inter> V))" | |
| 491 | unfolding subtopology_def topology_inverse'[OF istopology_subtopology] | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 492 | by auto | 
| 33175 | 493 | |
| 494 | lemma topspace_subtopology: "topspace(subtopology U V) = topspace U \<inter> V" | |
| 495 | by (auto simp add: topspace_def openin_subtopology) | |
| 496 | ||
| 497 | lemma closedin_subtopology: | |
| 498 | "closedin (subtopology U V) S \<longleftrightarrow> (\<exists>T. closedin U T \<and> S = T \<inter> V)" | |
| 499 | unfolding closedin_def topspace_subtopology | |
| 500 | apply (simp add: openin_subtopology) | |
| 501 | apply (rule iffI) | |
| 502 | apply clarify | |
| 503 | apply (rule_tac x="topspace U - T" in exI) | |
| 504 | by auto | |
| 505 | ||
| 506 | lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U" | |
| 507 | unfolding openin_subtopology | |
| 508 | apply (rule iffI, clarify) | |
| 509 | apply (frule openin_subset[of U]) apply blast | |
| 510 | apply (rule exI[where x="topspace U"]) | |
| 49711 | 511 | apply auto | 
| 512 | done | |
| 513 | ||
| 514 | lemma subtopology_superset: | |
| 515 | assumes UV: "topspace U \<subseteq> V" | |
| 33175 | 516 | shows "subtopology U V = U" | 
| 517 | proof- | |
| 518 |   {fix S
 | |
| 519 |     {fix T assume T: "openin U T" "S = T \<inter> V"
 | |
| 520 | from T openin_subset[OF T(1)] UV have eq: "S = T" by blast | |
| 521 | have "openin U S" unfolding eq using T by blast} | |
| 522 | moreover | |
| 523 |     {assume S: "openin U S"
 | |
| 524 | hence "\<exists>T. openin U T \<and> S = T \<inter> V" | |
| 525 | using openin_subset[OF S] UV by auto} | |
| 526 | ultimately have "(\<exists>T. openin U T \<and> S = T \<inter> V) \<longleftrightarrow> openin U S" by blast} | |
| 527 | then show ?thesis unfolding topology_eq openin_subtopology by blast | |
| 528 | qed | |
| 529 | ||
| 530 | lemma subtopology_topspace[simp]: "subtopology U (topspace U) = U" | |
| 531 | by (simp add: subtopology_superset) | |
| 532 | ||
| 533 | lemma subtopology_UNIV[simp]: "subtopology U UNIV = U" | |
| 534 | by (simp add: subtopology_superset) | |
| 535 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 536 | subsubsection {* The standard Euclidean topology *}
 | 
| 33175 | 537 | |
| 538 | definition | |
| 539 | euclidean :: "'a::topological_space topology" where | |
| 540 | "euclidean = topology open" | |
| 541 | ||
| 542 | lemma open_openin: "open S \<longleftrightarrow> openin euclidean S" | |
| 543 | unfolding euclidean_def | |
| 544 | apply (rule cong[where x=S and y=S]) | |
| 545 | apply (rule topology_inverse[symmetric]) | |
| 546 | apply (auto simp add: istopology_def) | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 547 | done | 
| 33175 | 548 | |
| 549 | lemma topspace_euclidean: "topspace euclidean = UNIV" | |
| 550 | 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 | 551 | apply (rule set_eqI) | 
| 33175 | 552 | by (auto simp add: open_openin[symmetric]) | 
| 553 | ||
| 554 | lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S" | |
| 555 | by (simp add: topspace_euclidean topspace_subtopology) | |
| 556 | ||
| 557 | lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S" | |
| 558 | by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV) | |
| 559 | ||
| 560 | lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)" | |
| 561 | by (simp add: open_openin openin_subopen[symmetric]) | |
| 562 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 563 | text {* Basic "localization" results are handy for connectedness. *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 564 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 565 | 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 | 566 | by (auto simp add: openin_subtopology open_openin[symmetric]) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 567 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 568 | 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 | 569 | by (auto simp add: openin_open) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 570 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 571 | lemma open_openin_trans[trans]: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 572 | "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 573 | by (metis Int_absorb1 openin_open_Int) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 574 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 575 | lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 576 | by (auto simp add: openin_open) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 577 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 578 | 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 | 579 | by (simp add: closedin_subtopology closed_closedin Int_ac) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 580 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 581 | lemma closedin_closed_Int: "closed S ==> closedin (subtopology euclidean U) (U \<inter> S)" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 582 | by (metis closedin_closed) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 583 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 584 | lemma closed_closedin_trans: "closed S \<Longrightarrow> closed T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> closedin (subtopology euclidean S) T" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 585 | apply (subgoal_tac "S \<inter> T = T" ) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 586 | apply auto | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 587 | apply (frule closedin_closed_Int[of T S]) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 588 | by simp | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 589 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 590 | 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 | 591 | by (auto simp add: closedin_closed) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 592 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 593 | lemma openin_euclidean_subtopology_iff: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 594 | fixes S U :: "'a::metric_space set" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 595 | shows "openin (subtopology euclidean U) S | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 596 | \<longleftrightarrow> S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)" (is "?lhs \<longleftrightarrow> ?rhs") | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 597 | proof | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 598 | assume ?lhs thus ?rhs unfolding openin_open open_dist by blast | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 599 | next | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 600 |   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 | 601 | 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 | 602 | unfolding T_def | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 603 | apply clarsimp | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 604 | apply (rule_tac x="d - dist x a" in exI) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 605 | apply (clarsimp simp add: less_diff_eq) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 606 | apply (erule rev_bexI) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 607 | apply (rule_tac x=d in exI, clarify) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 608 | apply (erule le_less_trans [OF dist_triangle]) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 609 | done | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 610 | assume ?rhs hence 2: "S = U \<inter> T" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 611 | unfolding T_def | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 612 | apply auto | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 613 | apply (drule (1) bspec, erule rev_bexI) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 614 | apply auto | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 615 | done | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 616 | from 1 2 show ?lhs | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 617 | unfolding openin_open open_dist by fast | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 618 | qed | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 619 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 620 | text {* These "transitivity" results are handy too *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 621 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 622 | lemma openin_trans[trans]: "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 623 | \<Longrightarrow> openin (subtopology euclidean U) S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 624 | unfolding open_openin openin_open by blast | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 625 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 626 | 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 | 627 | by (auto simp add: openin_open intro: openin_trans) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 628 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 629 | lemma closedin_trans[trans]: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 630 | "closedin (subtopology euclidean T) S \<Longrightarrow> | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 631 | closedin (subtopology euclidean U) T | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 632 | ==> closedin (subtopology euclidean U) S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 633 | by (auto simp add: closedin_closed closed_closedin closed_Inter Int_assoc) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 634 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 635 | 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 | 636 | by (auto simp add: closedin_closed intro: closedin_trans) | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 637 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 638 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 639 | subsection {* Open and closed balls *}
 | 
| 33175 | 640 | |
| 641 | definition | |
| 642 | ball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where | |
| 643 |   "ball x e = {y. dist x y < e}"
 | |
| 644 | ||
| 645 | definition | |
| 646 | cball :: "'a::metric_space \<Rightarrow> real \<Rightarrow> 'a set" where | |
| 647 |   "cball x e = {y. dist x y \<le> e}"
 | |
| 648 | ||
| 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 | 649 | 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 | 650 | 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 | 651 | |
| 
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 | 652 | 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 | 653 | 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 | 654 | |
| 
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 | 655 | lemma mem_ball_0: | 
| 33175 | 656 | fixes x :: "'a::real_normed_vector" | 
| 657 | shows "x \<in> ball 0 e \<longleftrightarrow> norm x < e" | |
| 658 | by (simp add: dist_norm) | |
| 659 | ||
| 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 | 660 | lemma mem_cball_0: | 
| 33175 | 661 | fixes x :: "'a::real_normed_vector" | 
| 662 | shows "x \<in> cball 0 e \<longleftrightarrow> norm x \<le> e" | |
| 663 | by (simp add: dist_norm) | |
| 664 | ||
| 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 | 665 | 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 | 666 | 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 | 667 | |
| 
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 | 668 | 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 | 669 | 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 | 670 | |
| 33175 | 671 | lemma ball_subset_cball[simp,intro]: "ball x e \<subseteq> cball x e" by (simp add: subset_eq) | 
| 672 | lemma subset_ball[intro]: "d <= e ==> ball x d \<subseteq> ball x e" by (simp add: subset_eq) | |
| 673 | lemma subset_cball[intro]: "d <= e ==> cball x d \<subseteq> cball x e" by (simp add: subset_eq) | |
| 674 | 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 | 675 | by (simp add: set_eq_iff) arith | 
| 33175 | 676 | |
| 677 | 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 | 678 | by (simp add: set_eq_iff) | 
| 33175 | 679 | |
| 680 | lemma diff_less_iff: "(a::real) - b > 0 \<longleftrightarrow> a > b" | |
| 681 | "(a::real) - b < 0 \<longleftrightarrow> a < b" | |
| 682 | "a - b < c \<longleftrightarrow> a < c +b" "a - b > c \<longleftrightarrow> a > c +b" by arith+ | |
| 683 | lemma diff_le_iff: "(a::real) - b \<ge> 0 \<longleftrightarrow> a \<ge> b" "(a::real) - b \<le> 0 \<longleftrightarrow> a \<le> b" | |
| 684 | "a - b \<le> c \<longleftrightarrow> a \<le> c +b" "a - b \<ge> c \<longleftrightarrow> a \<ge> c +b" by arith+ | |
| 685 | ||
| 686 | lemma open_ball[intro, simp]: "open (ball x e)" | |
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 687 | unfolding open_dist ball_def mem_Collect_eq Ball_def | 
| 33175 | 688 | unfolding dist_commute | 
| 689 | apply clarify | |
| 690 | apply (rule_tac x="e - dist xa x" in exI) | |
| 691 | using dist_triangle_alt[where z=x] | |
| 692 | apply (clarsimp simp add: diff_less_iff) | |
| 693 | apply atomize | |
| 694 | apply (erule_tac x="y" in allE) | |
| 695 | apply (erule_tac x="xa" in allE) | |
| 696 | by arith | |
| 697 | ||
| 698 | lemma open_contains_ball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. ball x e \<subseteq> S)" | |
| 699 | unfolding open_dist subset_eq mem_ball Ball_def dist_commute .. | |
| 700 | ||
| 33714 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 701 | lemma openE[elim?]: | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 702 | assumes "open S" "x\<in>S" | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 703 | obtains e where "e>0" "ball x e \<subseteq> S" | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 704 | using assms unfolding open_contains_ball by auto | 
| 
eb2574ac4173
Added new lemmas to Euclidean Space by Robert Himmelmann
 hoelzl parents: 
33324diff
changeset | 705 | |
| 33175 | 706 | lemma open_contains_ball_eq: "open S \<Longrightarrow> \<forall>x. x\<in>S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | 
| 707 | by (metis open_contains_ball subset_eq centre_in_ball) | |
| 708 | ||
| 709 | 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 | 710 | unfolding mem_ball set_eq_iff | 
| 33175 | 711 | apply (simp add: not_less) | 
| 712 | by (metis zero_le_dist order_trans dist_self) | |
| 713 | ||
| 714 | lemma ball_empty[intro]: "e \<le> 0 ==> ball x e = {}" by simp
 | |
| 715 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 716 | 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 | 717 | 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 | 718 | 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 | 719 | 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 | 720 | 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 | 721 | |
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 722 | definition "box a b = {x. \<forall>i\<in>Basis. a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<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 | 723 | |
| 50087 | 724 | 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 | 725 | fixes x :: "'a\<Colon>euclidean_space" | 
| 50087 | 726 | assumes "0 < 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 | 727 | 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 | 728 | proof - | 
| 729 |   def e' \<equiv> "e / (2 * sqrt (real (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 | 730 | then have e: "0 < e'" using assms by (auto intro!: divide_pos_pos simp: DIM_positive) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 731 | 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 | 732 | 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 | 733 | fix i from Rats_dense_in_real[of "x \<bullet> i - e'" "x \<bullet> i"] e show "?th i" by auto | 
| 50087 | 734 | qed | 
| 735 | from choice[OF this] guess a .. note a = this | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 736 | 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 | 737 | 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 | 738 | fix i from Rats_dense_in_real[of "x \<bullet> i" "x \<bullet> i + e'"] e show "?th i" by auto | 
| 50087 | 739 | qed | 
| 740 | from choice[OF this] guess b .. note b = this | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 741 | 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 | 742 | 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 | 743 | proof (rule exI[of _ ?a], rule exI[of _ ?b], safe) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 744 | fix y :: 'a assume *: "y \<in> box ?a ?b" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 745 | have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<twosuperior>)" | 
| 50087 | 746 | 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 | 747 |     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
 | 
| 50087 | 748 | proof (rule real_sqrt_less_mono, rule setsum_strict_mono) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 749 | fix i :: "'a" assume i: "i \<in> Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 750 | have "a i < y\<bullet>i \<and> y\<bullet>i < b i" using * i by (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 | 751 | moreover have "a i < x\<bullet>i" "x\<bullet>i - a i < e'" using a by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 752 | moreover have "x\<bullet>i < b i" "b i - x\<bullet>i < e'" using b by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 753 | ultimately have "\<bar>x\<bullet>i - y\<bullet>i\<bar> < 2 * e'" by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 754 |       then have "dist (x \<bullet> i) (y \<bullet> i) < e/sqrt (real (DIM('a)))"
 | 
| 50087 | 755 | unfolding e'_def by (auto simp: dist_real_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 | 756 |       then have "(dist (x \<bullet> i) (y \<bullet> i))\<twosuperior> < (e/sqrt (real (DIM('a))))\<twosuperior>"
 | 
| 50087 | 757 | by (rule power_strict_mono) 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 | 758 |       then show "(dist (x \<bullet> i) (y \<bullet> i))\<twosuperior> < e\<twosuperior> / real DIM('a)"
 | 
| 50087 | 759 | by (simp add: power_divide) | 
| 760 | qed 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 | 761 | also have "\<dots> = e" using `0 < e` by (simp add: real_eq_of_nat) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 762 | finally show "y \<in> ball x e" by (auto simp: ball_def) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 763 | 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 | 764 | qed | 
| 51103 | 765 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 766 | 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 | 767 | fixes M :: "'a\<Colon>euclidean_space set" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 768 | assumes "open M" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 769 | 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 | 770 | defines "b' \<equiv> \<lambda>f :: 'a \<Rightarrow> real \<times> real. (\<Sum>(i::'a)\<in>Basis. snd (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 | 771 |   defines "I \<equiv> {f\<in>Basis \<rightarrow>\<^isub>E \<rat> \<times> \<rat>. box (a' f) (b' f) \<subseteq> M}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 772 | shows "M = (\<Union>f\<in>I. box (a' f) (b' f))" | 
| 50087 | 773 | proof safe | 
| 774 | fix x assume "x \<in> M" | |
| 775 | obtain e where e: "e > 0" "ball x e \<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 | 776 | using openE[OF `open M` `x \<in> M`] by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 777 | moreover then obtain a b where ab: "x \<in> box a b" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 778 | "\<forall>i \<in> Basis. a \<bullet> i \<in> \<rat>" "\<forall>i\<in>Basis. b \<bullet> i \<in> \<rat>" "box a b \<subseteq> ball x e" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 779 | using rational_boxes[OF e(1)] by metis | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 780 | ultimately show "x \<in> (\<Union>f\<in>I. box (a' f) (b' f))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 781 | by (intro UN_I[of "\<lambda>i\<in>Basis. (a \<bullet> i, b \<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 | 782 | (auto simp: euclidean_representation I_def a'_def b'_def) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 783 | qed (auto simp: I_def) | 
| 33175 | 784 | |
| 785 | subsection{* Connectedness *}
 | |
| 786 | ||
| 787 | lemma connected_local: | |
| 788 | "connected S \<longleftrightarrow> ~(\<exists>e1 e2. | |
| 789 | openin (subtopology euclidean S) e1 \<and> | |
| 790 | openin (subtopology euclidean S) e2 \<and> | |
| 791 | S \<subseteq> e1 \<union> e2 \<and> | |
| 792 |                  e1 \<inter> e2 = {} \<and>
 | |
| 793 |                  ~(e1 = {}) \<and>
 | |
| 794 |                  ~(e2 = {}))"
 | |
| 795 | unfolding connected_def openin_open by (safe, blast+) | |
| 796 | ||
| 34105 | 797 | lemma exists_diff: | 
| 798 | fixes P :: "'a set \<Rightarrow> bool" | |
| 799 | shows "(\<exists>S. P(- S)) \<longleftrightarrow> (\<exists>S. P S)" (is "?lhs \<longleftrightarrow> ?rhs") | |
| 33175 | 800 | proof- | 
| 801 |   {assume "?lhs" hence ?rhs by blast }
 | |
| 802 | moreover | |
| 803 |   {fix S assume H: "P S"
 | |
| 34105 | 804 | have "S = - (- S)" by auto | 
| 805 | with H have "P (- (- S))" by metis } | |
| 33175 | 806 | ultimately show ?thesis by metis | 
| 807 | qed | |
| 808 | ||
| 809 | lemma connected_clopen: "connected S \<longleftrightarrow> | |
| 810 | (\<forall>T. openin (subtopology euclidean S) T \<and> | |
| 811 |             closedin (subtopology euclidean S) T \<longrightarrow> T = {} \<or> T = S)" (is "?lhs \<longleftrightarrow> ?rhs")
 | |
| 812 | proof- | |
| 34105 | 813 |   have " \<not> connected S \<longleftrightarrow> (\<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 | 814 | unfolding connected_def openin_open closedin_closed | 
| 815 | apply (subst exists_diff) by blast | |
| 34105 | 816 |   hence th0: "connected S \<longleftrightarrow> \<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> {})"
 | 
| 817 | (is " _ \<longleftrightarrow> \<not> (\<exists>e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis | |
| 33175 | 818 | |
| 819 |   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'))"
 | |
| 820 | (is "_ \<longleftrightarrow> \<not> (\<exists>t' t. ?Q t' t)") | |
| 821 | unfolding connected_def openin_open closedin_closed by auto | |
| 822 |   {fix e2
 | |
| 823 |     {fix e1 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)"
 | |
| 824 | by auto} | |
| 825 | then have "(\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by metis} | |
| 826 | then have "\<forall>e2. (\<exists>e1. ?P e2 e1) \<longleftrightarrow> (\<exists>t. ?Q e2 t)" by blast | |
| 827 | then show ?thesis unfolding th0 th1 by simp | |
| 828 | qed | |
| 829 | ||
| 830 | lemma connected_empty[simp, intro]: "connected {}"
 | |
| 831 | by (simp add: connected_def) | |
| 832 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 833 | |
| 33175 | 834 | subsection{* Limit points *}
 | 
| 835 | ||
| 44207 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 836 | definition (in topological_space) | 
| 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 837 | islimpt:: "'a \<Rightarrow> 'a set \<Rightarrow> bool" (infixr "islimpt" 60) where | 
| 33175 | 838 | "x islimpt S \<longleftrightarrow> (\<forall>T. x\<in>T \<longrightarrow> open T \<longrightarrow> (\<exists>y\<in>S. y\<in>T \<and> y\<noteq>x))" | 
| 839 | ||
| 840 | lemma islimptI: | |
| 841 | assumes "\<And>T. x \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>y\<in>S. y \<in> T \<and> y \<noteq> x" | |
| 842 | shows "x islimpt S" | |
| 843 | using assms unfolding islimpt_def by auto | |
| 844 | ||
| 845 | lemma islimptE: | |
| 846 | assumes "x islimpt S" and "x \<in> T" and "open T" | |
| 847 | obtains y where "y \<in> S" and "y \<in> T" and "y \<noteq> x" | |
| 848 | using assms unfolding islimpt_def by auto | |
| 849 | ||
| 44584 | 850 | lemma islimpt_iff_eventually: "x islimpt S \<longleftrightarrow> \<not> eventually (\<lambda>y. y \<notin> S) (at x)" | 
| 851 | unfolding islimpt_def eventually_at_topological by auto | |
| 852 | ||
| 853 | lemma islimpt_subset: "\<lbrakk>x islimpt S; S \<subseteq> T\<rbrakk> \<Longrightarrow> x islimpt T" | |
| 854 | unfolding islimpt_def by fast | |
| 33175 | 855 | |
| 856 | lemma islimpt_approachable: | |
| 857 | fixes x :: "'a::metric_space" | |
| 858 | shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e)" | |
| 44584 | 859 | unfolding islimpt_iff_eventually eventually_at by fast | 
| 33175 | 860 | |
| 861 | lemma islimpt_approachable_le: | |
| 862 | fixes x :: "'a::metric_space" | |
| 863 | shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)" | |
| 864 | unfolding islimpt_approachable | |
| 44584 | 865 | using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x", | 
| 866 | THEN arg_cong [where f=Not]] | |
| 867 | by (simp add: Bex_def conj_commute conj_left_commute) | |
| 33175 | 868 | |
| 44571 | 869 | lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
 | 
| 870 |   unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
 | |
| 871 | ||
| 51351 | 872 | lemma islimpt_punctured: "x islimpt S = x islimpt (S-{x})"
 | 
| 873 | unfolding islimpt_def by blast | |
| 874 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 875 | text {* A perfect space has no isolated points. *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 876 | |
| 44571 | 877 | lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV" | 
| 878 | unfolding islimpt_UNIV_iff by (rule not_open_singleton) | |
| 33175 | 879 | |
| 880 | lemma perfect_choose_dist: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 881 |   fixes x :: "'a::{perfect_space, metric_space}"
 | 
| 33175 | 882 | shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r" | 
| 883 | using islimpt_UNIV [of x] | |
| 884 | by (simp add: islimpt_approachable) | |
| 885 | ||
| 886 | lemma closed_limpt: "closed S \<longleftrightarrow> (\<forall>x. x islimpt S \<longrightarrow> x \<in> S)" | |
| 887 | unfolding closed_def | |
| 888 | apply (subst open_subopen) | |
| 34105 | 889 | apply (simp add: islimpt_def subset_eq) | 
| 44170 
510ac30f44c0
make Multivariate_Analysis work with separate set type
 huffman parents: 
44167diff
changeset | 890 | by (metis ComplE ComplI) | 
| 33175 | 891 | |
| 892 | lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}"
 | |
| 893 | unfolding islimpt_def by auto | |
| 894 | ||
| 895 | lemma finite_set_avoid: | |
| 896 | fixes a :: "'a::metric_space" | |
| 897 | assumes fS: "finite S" shows "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x" | |
| 898 | proof(induct rule: finite_induct[OF fS]) | |
| 41863 | 899 | case 1 thus ?case by (auto intro: zero_less_one) | 
| 33175 | 900 | next | 
| 901 | case (2 x F) | |
| 902 | from 2 obtain d where d: "d >0" "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> d \<le> dist a x" by blast | |
| 903 |   {assume "x = a" hence ?case using d by auto  }
 | |
| 904 | moreover | |
| 905 |   {assume xa: "x\<noteq>a"
 | |
| 906 | let ?d = "min d (dist a x)" | |
| 907 | have dp: "?d > 0" using xa d(1) using dist_nz by auto | |
| 908 | from d have d': "\<forall>x\<in>F. x\<noteq>a \<longrightarrow> ?d \<le> dist a x" by auto | |
| 909 | with dp xa have ?case by(auto intro!: exI[where x="?d"]) } | |
| 910 | ultimately show ?case by blast | |
| 911 | qed | |
| 912 | ||
| 913 | 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 | 914 | by (simp add: islimpt_iff_eventually eventually_conj_iff) | 
| 33175 | 915 | |
| 916 | lemma discrete_imp_closed: | |
| 917 | fixes S :: "'a::metric_space set" | |
| 918 | assumes e: "0 < e" and d: "\<forall>x \<in> S. \<forall>y \<in> S. dist y x < e \<longrightarrow> y = x" | |
| 919 | shows "closed S" | |
| 920 | proof- | |
| 921 |   {fix x assume C: "\<forall>e>0. \<exists>x'\<in>S. x' \<noteq> x \<and> dist x' x < e"
 | |
| 922 | from e have e2: "e/2 > 0" by arith | |
| 923 | from C[rule_format, OF e2] obtain y where y: "y \<in> S" "y\<noteq>x" "dist y x < e/2" by blast | |
| 924 | let ?m = "min (e/2) (dist x y) " | |
| 925 | from e2 y(2) have mp: "?m > 0" by (simp add: dist_nz[THEN sym]) | |
| 926 | from C[rule_format, OF mp] obtain z where z: "z \<in> S" "z\<noteq>x" "dist z x < ?m" by blast | |
| 927 | have th: "dist z y < e" using z y | |
| 928 | by (intro dist_triangle_lt [where z=x], simp) | |
| 929 | from d[rule_format, OF y(1) z(1) th] y z | |
| 930 | have False by (auto simp add: dist_commute)} | |
| 931 | then show ?thesis by (metis islimpt_approachable closed_limpt [where 'a='a]) | |
| 932 | qed | |
| 933 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 934 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 935 | subsection {* Interior of a Set *}
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 936 | |
| 44519 | 937 | definition "interior S = \<Union>{T. open T \<and> T \<subseteq> S}"
 | 
| 938 | ||
| 939 | lemma interiorI [intro?]: | |
| 940 | assumes "open T" and "x \<in> T" and "T \<subseteq> S" | |
| 941 | shows "x \<in> interior S" | |
| 942 | using assms unfolding interior_def by fast | |
| 943 | ||
| 944 | lemma interiorE [elim?]: | |
| 945 | assumes "x \<in> interior S" | |
| 946 | obtains T where "open T" and "x \<in> T" and "T \<subseteq> S" | |
| 947 | using assms unfolding interior_def by fast | |
| 948 | ||
| 949 | lemma open_interior [simp, intro]: "open (interior S)" | |
| 950 | by (simp add: interior_def open_Union) | |
| 951 | ||
| 952 | lemma interior_subset: "interior S \<subseteq> S" | |
| 953 | by (auto simp add: interior_def) | |
| 954 | ||
| 955 | lemma interior_maximal: "T \<subseteq> S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> interior S" | |
| 956 | by (auto simp add: interior_def) | |
| 957 | ||
| 958 | lemma interior_open: "open S \<Longrightarrow> interior S = S" | |
| 959 | by (intro equalityI interior_subset interior_maximal subset_refl) | |
| 33175 | 960 | |
| 961 | lemma interior_eq: "interior S = S \<longleftrightarrow> open S" | |
| 44519 | 962 | by (metis open_interior interior_open) | 
| 963 | ||
| 964 | lemma open_subset_interior: "open S \<Longrightarrow> S \<subseteq> interior T \<longleftrightarrow> S \<subseteq> T" | |
| 33175 | 965 | by (metis interior_maximal interior_subset subset_trans) | 
| 966 | ||
| 44519 | 967 | lemma interior_empty [simp]: "interior {} = {}"
 | 
| 968 | using open_empty by (rule interior_open) | |
| 969 | ||
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 970 | lemma interior_UNIV [simp]: "interior UNIV = UNIV" | 
| 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 971 | using open_UNIV by (rule interior_open) | 
| 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 972 | |
| 44519 | 973 | lemma interior_interior [simp]: "interior (interior S) = interior S" | 
| 974 | using open_interior by (rule interior_open) | |
| 975 | ||
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 976 | 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 | 977 | by (auto simp add: interior_def) | 
| 44519 | 978 | |
| 979 | lemma interior_unique: | |
| 980 | assumes "T \<subseteq> S" and "open T" | |
| 981 | assumes "\<And>T'. T' \<subseteq> S \<Longrightarrow> open T' \<Longrightarrow> T' \<subseteq> T" | |
| 982 | shows "interior S = T" | |
| 983 | by (intro equalityI assms interior_subset open_interior interior_maximal) | |
| 984 | ||
| 985 | 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 | 986 | by (intro equalityI Int_mono Int_greatest interior_mono Int_lower1 | 
| 44519 | 987 | Int_lower2 interior_maximal interior_subset open_Int open_interior) | 
| 988 | ||
| 989 | lemma mem_interior: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. ball x e \<subseteq> S)" | |
| 990 | using open_contains_ball_eq [where S="interior S"] | |
| 991 | by (simp add: open_subset_interior) | |
| 33175 | 992 | |
| 993 | lemma interior_limit_point [intro]: | |
| 994 | fixes x :: "'a::perfect_space" | |
| 995 | assumes x: "x \<in> interior S" shows "x islimpt S" | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 996 | using x islimpt_UNIV [of x] | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 997 | unfolding interior_def islimpt_def | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 998 | apply (clarsimp, rename_tac T T') | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 999 | apply (drule_tac x="T \<inter> T'" in spec) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1000 | apply (auto simp add: open_Int) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1001 | done | 
| 33175 | 1002 | |
| 1003 | lemma interior_closed_Un_empty_interior: | |
| 1004 |   assumes cS: "closed S" and iT: "interior T = {}"
 | |
| 44519 | 1005 | shows "interior (S \<union> T) = interior S" | 
| 33175 | 1006 | proof | 
| 44519 | 1007 | show "interior S \<subseteq> interior (S \<union> T)" | 
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1008 | by (rule interior_mono, rule Un_upper1) | 
| 33175 | 1009 | next | 
| 1010 | show "interior (S \<union> T) \<subseteq> interior S" | |
| 1011 | proof | |
| 1012 | fix x assume "x \<in> interior (S \<union> T)" | |
| 44519 | 1013 | then obtain R where "open R" "x \<in> R" "R \<subseteq> S \<union> T" .. | 
| 33175 | 1014 | show "x \<in> interior S" | 
| 1015 | proof (rule ccontr) | |
| 1016 | assume "x \<notin> interior S" | |
| 1017 | with `x \<in> R` `open R` obtain y where "y \<in> R - S" | |
| 44519 | 1018 | unfolding interior_def by fast | 
| 33175 | 1019 | from `open R` `closed S` have "open (R - S)" by (rule open_Diff) | 
| 1020 | from `R \<subseteq> S \<union> T` have "R - S \<subseteq> T" by fast | |
| 1021 |       from `y \<in> R - S` `open (R - S)` `R - S \<subseteq> T` `interior T = {}`
 | |
| 1022 | show "False" unfolding interior_def by fast | |
| 1023 | qed | |
| 1024 | qed | |
| 1025 | qed | |
| 1026 | ||
| 44365 | 1027 | lemma interior_Times: "interior (A \<times> B) = interior A \<times> interior B" | 
| 1028 | proof (rule interior_unique) | |
| 1029 | show "interior A \<times> interior B \<subseteq> A \<times> B" | |
| 1030 | by (intro Sigma_mono interior_subset) | |
| 1031 | show "open (interior A \<times> interior B)" | |
| 1032 | by (intro open_Times open_interior) | |
| 44519 | 1033 | fix T assume "T \<subseteq> A \<times> B" and "open T" thus "T \<subseteq> interior A \<times> interior B" | 
| 1034 | proof (safe) | |
| 1035 | fix x y assume "(x, y) \<in> T" | |
| 1036 | then obtain C D where "open C" "open D" "C \<times> D \<subseteq> T" "x \<in> C" "y \<in> D" | |
| 1037 | using `open T` unfolding open_prod_def by fast | |
| 1038 | hence "open C" "open D" "C \<subseteq> A" "D \<subseteq> B" "x \<in> C" "y \<in> D" | |
| 1039 | using `T \<subseteq> A \<times> B` by auto | |
| 1040 | thus "x \<in> interior A" and "y \<in> interior B" | |
| 1041 | by (auto intro: interiorI) | |
| 1042 | qed | |
| 44365 | 1043 | qed | 
| 1044 | ||
| 33175 | 1045 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1046 | subsection {* Closure of a Set *}
 | 
| 33175 | 1047 | |
| 1048 | definition "closure S = S \<union> {x | x. x islimpt S}"
 | |
| 1049 | ||
| 44518 | 1050 | lemma interior_closure: "interior S = - (closure (- S))" | 
| 1051 | unfolding interior_def closure_def islimpt_def by auto | |
| 1052 | ||
| 34105 | 1053 | lemma closure_interior: "closure S = - interior (- S)" | 
| 44518 | 1054 | unfolding interior_closure by simp | 
| 33175 | 1055 | |
| 1056 | lemma closed_closure[simp, intro]: "closed (closure S)" | |
| 44518 | 1057 | unfolding closure_interior by (simp add: closed_Compl) | 
| 1058 | ||
| 1059 | lemma closure_subset: "S \<subseteq> closure S" | |
| 1060 | unfolding closure_def by simp | |
| 33175 | 1061 | |
| 1062 | lemma closure_hull: "closure S = closed hull S" | |
| 44519 | 1063 | unfolding hull_def closure_interior interior_def by auto | 
| 33175 | 1064 | |
| 1065 | lemma closure_eq: "closure S = S \<longleftrightarrow> closed S" | |
| 44519 | 1066 | unfolding closure_hull using closed_Inter by (rule hull_eq) | 
| 1067 | ||
| 1068 | lemma closure_closed [simp]: "closed S \<Longrightarrow> closure S = S" | |
| 1069 | unfolding closure_eq . | |
| 1070 | ||
| 1071 | lemma closure_closure [simp]: "closure (closure S) = closure S" | |
| 44518 | 1072 | unfolding closure_hull by (rule hull_hull) | 
| 33175 | 1073 | |
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1074 | lemma closure_mono: "S \<subseteq> T \<Longrightarrow> closure S \<subseteq> closure T" | 
| 44518 | 1075 | unfolding closure_hull by (rule hull_mono) | 
| 33175 | 1076 | |
| 44519 | 1077 | lemma closure_minimal: "S \<subseteq> T \<Longrightarrow> closed T \<Longrightarrow> closure S \<subseteq> T" | 
| 44518 | 1078 | unfolding closure_hull by (rule hull_minimal) | 
| 33175 | 1079 | |
| 44519 | 1080 | lemma closure_unique: | 
| 1081 | assumes "S \<subseteq> T" and "closed T" | |
| 1082 | assumes "\<And>T'. S \<subseteq> T' \<Longrightarrow> closed T' \<Longrightarrow> T \<subseteq> T'" | |
| 1083 | shows "closure S = T" | |
| 1084 | using assms unfolding closure_hull by (rule hull_unique) | |
| 1085 | ||
| 1086 | lemma closure_empty [simp]: "closure {} = {}"
 | |
| 44518 | 1087 | using closed_empty by (rule closure_closed) | 
| 33175 | 1088 | |
| 44522 
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
 huffman parents: 
44519diff
changeset | 1089 | lemma closure_UNIV [simp]: "closure UNIV = UNIV" | 
| 44518 | 1090 | using closed_UNIV by (rule closure_closed) | 
| 1091 | ||
| 1092 | lemma closure_union [simp]: "closure (S \<union> T) = closure S \<union> closure T" | |
| 1093 | unfolding closure_interior by simp | |
| 33175 | 1094 | |
| 1095 | lemma closure_eq_empty: "closure S = {} \<longleftrightarrow> S = {}"
 | |
| 1096 | using closure_empty closure_subset[of S] | |
| 1097 | by blast | |
| 1098 | ||
| 1099 | lemma closure_subset_eq: "closure S \<subseteq> S \<longleftrightarrow> closed S" | |
| 1100 | using closure_eq[of S] closure_subset[of S] | |
| 1101 | by simp | |
| 1102 | ||
| 1103 | lemma open_inter_closure_eq_empty: | |
| 1104 |   "open S \<Longrightarrow> (S \<inter> closure T) = {} \<longleftrightarrow> S \<inter> T = {}"
 | |
| 34105 | 1105 | using open_subset_interior[of S "- T"] | 
| 1106 | using interior_subset[of "- T"] | |
| 33175 | 1107 | unfolding closure_interior | 
| 1108 | by auto | |
| 1109 | ||
| 1110 | lemma open_inter_closure_subset: | |
| 1111 | "open S \<Longrightarrow> (S \<inter> (closure T)) \<subseteq> closure(S \<inter> T)" | |
| 1112 | proof | |
| 1113 | fix x | |
| 1114 | assume as: "open S" "x \<in> S \<inter> closure T" | |
| 1115 |   { assume *:"x islimpt T"
 | |
| 1116 | have "x islimpt (S \<inter> T)" | |
| 1117 | proof (rule islimptI) | |
| 1118 | fix A | |
| 1119 | assume "x \<in> A" "open A" | |
| 1120 | with as have "x \<in> A \<inter> S" "open (A \<inter> S)" | |
| 1121 | by (simp_all add: open_Int) | |
| 1122 | with * obtain y where "y \<in> T" "y \<in> A \<inter> S" "y \<noteq> x" | |
| 1123 | by (rule islimptE) | |
| 1124 | hence "y \<in> S \<inter> T" "y \<in> A \<and> y \<noteq> x" | |
| 1125 | by simp_all | |
| 1126 | thus "\<exists>y\<in>(S \<inter> T). y \<in> A \<and> y \<noteq> x" .. | |
| 1127 | qed | |
| 1128 | } | |
| 1129 | then show "x \<in> closure (S \<inter> T)" using as | |
| 1130 | unfolding closure_def | |
| 1131 | by blast | |
| 1132 | qed | |
| 1133 | ||
| 44519 | 1134 | lemma closure_complement: "closure (- S) = - interior S" | 
| 44518 | 1135 | unfolding closure_interior by simp | 
| 33175 | 1136 | |
| 44519 | 1137 | lemma interior_complement: "interior (- S) = - closure S" | 
| 44518 | 1138 | unfolding closure_interior by simp | 
| 33175 | 1139 | |
| 44365 | 1140 | lemma closure_Times: "closure (A \<times> B) = closure A \<times> closure B" | 
| 44519 | 1141 | proof (rule closure_unique) | 
| 44365 | 1142 | show "A \<times> B \<subseteq> closure A \<times> closure B" | 
| 1143 | by (intro Sigma_mono closure_subset) | |
| 1144 | show "closed (closure A \<times> closure B)" | |
| 1145 | by (intro closed_Times closed_closure) | |
| 44519 | 1146 | fix T assume "A \<times> B \<subseteq> T" and "closed T" thus "closure A \<times> closure B \<subseteq> T" | 
| 44365 | 1147 | apply (simp add: closed_def open_prod_def, clarify) | 
| 1148 | apply (rule ccontr) | |
| 1149 | apply (drule_tac x="(a, b)" in bspec, simp, clarify, rename_tac C D) | |
| 1150 | apply (simp add: closure_interior interior_def) | |
| 1151 | apply (drule_tac x=C in spec) | |
| 1152 | apply (drule_tac x=D in spec) | |
| 1153 | apply auto | |
| 1154 | done | |
| 1155 | qed | |
| 1156 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1157 | |
| 51351 | 1158 | lemma islimpt_in_closure: "(x islimpt S) = (x:closure(S-{x}))"
 | 
| 1159 | unfolding closure_def using islimpt_punctured by blast | |
| 1160 | ||
| 1161 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1162 | subsection {* Frontier (aka boundary) *}
 | 
| 33175 | 1163 | |
| 1164 | definition "frontier S = closure S - interior S" | |
| 1165 | ||
| 1166 | lemma frontier_closed: "closed(frontier S)" | |
| 1167 | by (simp add: frontier_def closed_Diff) | |
| 1168 | ||
| 34105 | 1169 | lemma frontier_closures: "frontier S = (closure S) \<inter> (closure(- S))" | 
| 33175 | 1170 | by (auto simp add: frontier_def interior_closure) | 
| 1171 | ||
| 1172 | lemma frontier_straddle: | |
| 1173 | fixes a :: "'a::metric_space" | |
| 44909 | 1174 | 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))" | 
| 1175 | unfolding frontier_def closure_interior | |
| 1176 | by (auto simp add: mem_interior subset_eq ball_def) | |
| 33175 | 1177 | |
| 1178 | lemma frontier_subset_closed: "closed S \<Longrightarrow> frontier S \<subseteq> S" | |
| 1179 | by (metis frontier_def closure_closed Diff_subset) | |
| 1180 | ||
| 34964 | 1181 | lemma frontier_empty[simp]: "frontier {} = {}"
 | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 1182 | by (simp add: frontier_def) | 
| 33175 | 1183 | |
| 1184 | lemma frontier_subset_eq: "frontier S \<subseteq> S \<longleftrightarrow> closed S" | |
| 1185 | proof- | |
| 1186 |   { assume "frontier S \<subseteq> S"
 | |
| 1187 | hence "closure S \<subseteq> S" using interior_subset unfolding frontier_def by auto | |
| 1188 | hence "closed S" using closure_subset_eq by auto | |
| 1189 | } | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 1190 | thus ?thesis using frontier_subset_closed[of S] .. | 
| 33175 | 1191 | qed | 
| 1192 | ||
| 34105 | 1193 | lemma frontier_complement: "frontier(- S) = frontier S" | 
| 33175 | 1194 | by (auto simp add: frontier_def closure_complement interior_complement) | 
| 1195 | ||
| 1196 | lemma frontier_disjoint_eq: "frontier S \<inter> S = {} \<longleftrightarrow> open S"
 | |
| 34105 | 1197 | using frontier_complement frontier_subset_eq[of "- S"] | 
| 1198 | unfolding open_closed by auto | |
| 33175 | 1199 | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1200 | subsection {* Filters and the ``eventually true'' quantifier *}
 | 
| 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1201 | |
| 33175 | 1202 | definition | 
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1203 | indirection :: "'a::real_normed_vector \<Rightarrow> 'a \<Rightarrow> 'a filter" | 
| 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1204 | (infixr "indirection" 70) where | 
| 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 | 1205 |   "a indirection v = at a within {b. \<exists>c\<ge>0. b - a = scaleR c v}"
 | 
| 33175 | 1206 | |
| 36437 | 1207 | text {* Identify Trivial limits, where we can't approach arbitrarily closely. *}
 | 
| 33175 | 1208 | |
| 1209 | lemma trivial_limit_within: | |
| 1210 | shows "trivial_limit (at a within S) \<longleftrightarrow> \<not> a islimpt S" | |
| 1211 | proof | |
| 1212 | assume "trivial_limit (at a within S)" | |
| 1213 | thus "\<not> a islimpt S" | |
| 1214 | 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 | 1215 | unfolding eventually_at_topological | 
| 33175 | 1216 | 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 | 1217 | apply (clarsimp simp add: set_eq_iff) | 
| 33175 | 1218 | 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 | 1219 | apply (clarsimp, drule_tac x=y in bspec, simp_all) | 
| 33175 | 1220 | done | 
| 1221 | next | |
| 1222 | assume "\<not> a islimpt S" | |
| 1223 | thus "trivial_limit (at a within S)" | |
| 1224 | 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 | 1225 | unfolding eventually_at_topological | 
| 33175 | 1226 | unfolding islimpt_def | 
| 36358 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1227 | apply clarsimp | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1228 | apply (rule_tac x=T in exI) | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1229 | apply auto | 
| 33175 | 1230 | done | 
| 1231 | qed | |
| 1232 | ||
| 1233 | lemma trivial_limit_at_iff: "trivial_limit (at a) \<longleftrightarrow> \<not> a islimpt UNIV" | |
| 45031 | 1234 | using trivial_limit_within [of a UNIV] by simp | 
| 33175 | 1235 | |
| 1236 | lemma trivial_limit_at: | |
| 1237 | fixes a :: "'a::perfect_space" | |
| 1238 | shows "\<not> trivial_limit (at a)" | |
| 44571 | 1239 | by (rule at_neq_bot) | 
| 33175 | 1240 | |
| 1241 | lemma trivial_limit_at_infinity: | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1242 |   "\<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 | 1243 | unfolding trivial_limit_def eventually_at_infinity | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1244 | apply clarsimp | 
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1245 | apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1246 | apply (rule_tac x="scaleR (b / norm x) x" in exI, simp) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1247 | apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def]) | 
| 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1248 | apply (drule_tac x=UNIV in spec, simp) | 
| 33175 | 1249 | done | 
| 1250 | ||
| 51351 | 1251 | lemma not_trivial_limit_within: "~trivial_limit (at x within S) = (x:closure(S-{x}))"
 | 
| 1252 | using islimpt_in_closure by (metis trivial_limit_within) | |
| 1253 | ||
| 36437 | 1254 | text {* Some property holds "sufficiently close" to the limit point. *}
 | 
| 33175 | 1255 | |
| 51530 
609914f0934a
rename eventually_at / _within, to distinguish them from the lemmas in the HOL image
 hoelzl parents: 
51518diff
changeset | 1256 | lemma eventually_at2: | 
| 33175 | 1257 | "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)" | 
| 1258 | unfolding eventually_at dist_nz by auto | |
| 1259 | ||
| 1260 | lemma eventually_happens: "eventually P net ==> trivial_limit net \<or> (\<exists>x. P x)" | |
| 36358 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1261 | unfolding trivial_limit_def | 
| 
246493d61204
define nets directly as filters, instead of as filter bases
 huffman parents: 
36336diff
changeset | 1262 | by (auto elim: eventually_rev_mp) | 
| 33175 | 1263 | |
| 1264 | lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net" | |
| 45031 | 1265 | by simp | 
| 33175 | 1266 | |
| 1267 | 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 | 1268 | by (simp add: filter_eq_iff) | 
| 33175 | 1269 | |
| 1270 | text{* Combining theorems for "eventually" *}
 | |
| 1271 | ||
| 1272 | lemma eventually_rev_mono: | |
| 1273 | "eventually P net \<Longrightarrow> (\<forall>x. P x \<longrightarrow> Q x) \<Longrightarrow> eventually Q net" | |
| 1274 | using eventually_mono [of P Q] by fast | |
| 1275 | ||
| 1276 | lemma not_eventually: "(\<forall>x. \<not> P x ) \<Longrightarrow> ~(trivial_limit net) ==> ~(eventually (\<lambda>x. P x) net)" | |
| 1277 | by (simp add: eventually_False) | |
| 1278 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1279 | |
| 36437 | 1280 | subsection {* Limits *}
 | 
| 33175 | 1281 | |
| 1282 | lemma Lim: | |
| 1283 | "(f ---> l) net \<longleftrightarrow> | |
| 1284 | trivial_limit net \<or> | |
| 1285 | (\<forall>e>0. eventually (\<lambda>x. dist (f x) l < e) net)" | |
| 1286 | unfolding tendsto_iff trivial_limit_eq by auto | |
| 1287 | ||
| 1288 | text{* Show that they yield usual definitions in the various cases. *}
 | |
| 1289 | ||
| 1290 | lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow> | |
| 1291 | (\<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 | 1292 | by (auto simp add: tendsto_iff eventually_at_le dist_nz) | 
| 33175 | 1293 | |
| 1294 | lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow> | |
| 1295 | (\<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 | 1296 | by (auto simp add: tendsto_iff eventually_at dist_nz) | 
| 33175 | 1297 | |
| 1298 | lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow> | |
| 1299 | (\<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 | 1300 | by (auto simp add: tendsto_iff eventually_at2) | 
| 33175 | 1301 | |
| 1302 | lemma Lim_at_infinity: | |
| 1303 | "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)" | |
| 1304 | by (auto simp add: tendsto_iff eventually_at_infinity) | |
| 1305 | ||
| 1306 | lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net" | |
| 1307 | by (rule topological_tendstoI, auto elim: eventually_rev_mono) | |
| 1308 | ||
| 1309 | text{* The expected monotonicity property. *}
 | |
| 1310 | ||
| 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 | 1311 | lemma Lim_within_empty: "(f ---> l) (at x within {})"
 | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1312 | unfolding tendsto_def eventually_at_filter by simp | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1313 | |
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1314 | lemma Lim_Un: assumes "(f ---> l) (at x within S)" "(f ---> l) (at x within T)" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1315 | shows "(f ---> l) (at x within (S \<union> T))" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1316 | using assms unfolding tendsto_def eventually_at_filter | 
| 33175 | 1317 | apply clarify | 
| 1318 | apply (drule spec, drule (1) mp, drule (1) mp) | |
| 1319 | apply (drule spec, drule (1) mp, drule (1) mp) | |
| 1320 | apply (auto elim: eventually_elim2) | |
| 1321 | done | |
| 1322 | ||
| 1323 | lemma Lim_Un_univ: | |
| 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 | 1324 | "(f ---> l) (at x within S) \<Longrightarrow> (f ---> l) (at x within T) \<Longrightarrow> S \<union> T = UNIV | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1325 | ==> (f ---> l) (at x)" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1326 | by (metis Lim_Un) | 
| 33175 | 1327 | |
| 1328 | text{* Interrelations between restricted and unrestricted limits. *}
 | |
| 1329 | ||
| 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 | 1330 | |
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1331 | 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 | 1332 | "(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 | 1333 | by (metis order_refl filterlim_mono subset_UNIV at_le) | 
| 33175 | 1334 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1335 | lemma eventually_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1336 | assumes "x \<in> interior S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1337 | shows "eventually P (at x within S) \<longleftrightarrow> eventually P (at x)" (is "?lhs = ?rhs") | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1338 | proof- | 
| 44519 | 1339 | from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" .. | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1340 |   { assume "?lhs"
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1341 | then obtain A where "open A" "x \<in> A" "\<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 | 1342 | unfolding eventually_at_topological | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1343 | by auto | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1344 | with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1345 | by auto | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1346 | then have "?rhs" | 
| 51471 | 1347 | unfolding eventually_at_topological by auto | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1348 | } moreover | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1349 |   { assume "?rhs" hence "?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 | 1350 | by (auto elim: eventually_elim1 simp: eventually_at_filter) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1351 | } ultimately | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1352 | show "?thesis" .. | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1353 | qed | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1354 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1355 | lemma at_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1356 | "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 | 1357 | unfolding filter_eq_iff by (intro allI eventually_within_interior) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1358 | |
| 43338 | 1359 | lemma Lim_within_LIMSEQ: | 
| 44584 | 1360 | fixes a :: "'a::metric_space" | 
| 43338 | 1361 | assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" | 
| 1362 | shows "(X ---> L) (at a within T)" | |
| 44584 | 1363 | using assms unfolding tendsto_def [where l=L] | 
| 1364 | by (simp add: sequentially_imp_eventually_within) | |
| 43338 | 1365 | |
| 1366 | lemma Lim_right_bound: | |
| 51773 | 1367 |   fixes f :: "'a :: {linorder_topology, conditionally_complete_linorder, no_top} \<Rightarrow>
 | 
| 1368 |     'b::{linorder_topology, conditionally_complete_linorder}"
 | |
| 43338 | 1369 | 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" | 
| 1370 | assumes bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a" | |
| 1371 |   shows "(f ---> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
 | |
| 1372 | proof cases | |
| 1373 |   assume "{x<..} \<inter> I = {}" then show ?thesis by (simp add: Lim_within_empty)
 | |
| 1374 | next | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1375 |   assume e: "{x<..} \<inter> I \<noteq> {}"
 | 
| 43338 | 1376 | show ?thesis | 
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1377 | proof (rule order_tendstoI) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1378 |     fix a assume a: "a < Inf (f ` ({x<..} \<inter> I))"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1379 |     { fix y assume "y \<in> {x<..} \<inter> I"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1380 |       with e bnd have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1381 | by (auto intro: cInf_lower) | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1382 | with a have "a < f y" by (blast intro: less_le_trans) } | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1383 |     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 | 1384 | 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 | 1385 | next | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1386 |     fix a assume "Inf (f ` ({x<..} \<inter> I)) < a"
 | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1387 | from cInf_lessD[OF _ this] e obtain y where y: "x < y" "y \<in> I" "f y < a" 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 | 1388 | then have "eventually (\<lambda>x. x \<in> I \<longrightarrow> f x < a) (at_right x)" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1389 | unfolding eventually_at_right by (metis less_imp_le le_less_trans mono) | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 1390 |     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 | 1391 | unfolding eventually_at_filter by eventually_elim simp | 
| 43338 | 1392 | qed | 
| 1393 | qed | |
| 1394 | ||
| 33175 | 1395 | text{* Another limit point characterization. *}
 | 
| 1396 | ||
| 1397 | lemma islimpt_sequential: | |
| 50883 | 1398 | fixes x :: "'a::first_countable_topology" | 
| 1399 |   shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S - {x}) \<and> (f ---> x) sequentially)"
 | |
| 33175 | 1400 | (is "?lhs = ?rhs") | 
| 1401 | proof | |
| 1402 | assume ?lhs | |
| 50883 | 1403 | from countable_basis_at_decseq[of x] guess A . note A = this | 
| 1404 | def f \<equiv> "\<lambda>n. SOME y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y" | |
| 1405 |   { fix n
 | |
| 1406 | from `?lhs` have "\<exists>y. y \<in> S \<and> y \<in> A n \<and> x \<noteq> y" | |
| 1407 | unfolding islimpt_def using A(1,2)[of n] by auto | |
| 1408 | then have "f n \<in> S \<and> f n \<in> A n \<and> x \<noteq> f n" | |
| 1409 | unfolding f_def by (rule someI_ex) | |
| 1410 | then have "f n \<in> S" "f n \<in> A n" "x \<noteq> f n" by auto } | |
| 1411 |   then have "\<forall>n. f n \<in> S - {x}" by auto
 | |
| 1412 | moreover have "(\<lambda>n. f n) ----> x" | |
| 1413 | proof (rule topological_tendstoI) | |
| 1414 | fix S assume "open S" "x \<in> S" | |
| 1415 | from A(3)[OF this] `\<And>n. f n \<in> A n` | |
| 1416 | show "eventually (\<lambda>x. f x \<in> S) sequentially" by (auto elim!: eventually_elim1) | |
| 44584 | 1417 | qed | 
| 1418 | ultimately show ?rhs by fast | |
| 33175 | 1419 | next | 
| 1420 | assume ?rhs | |
| 50883 | 1421 |   then obtain f :: "nat \<Rightarrow> 'a" where f: "\<And>n. f n \<in> S - {x}" and lim: "f ----> x" by auto
 | 
| 1422 | show ?lhs | |
| 1423 | unfolding islimpt_def | |
| 1424 | proof safe | |
| 1425 | fix T assume "open T" "x \<in> T" | |
| 1426 | from lim[THEN topological_tendstoD, OF this] f | |
| 1427 | show "\<exists>y\<in>S. y \<in> T \<and> y \<noteq> x" | |
| 1428 | unfolding eventually_sequentially by auto | |
| 1429 | qed | |
| 33175 | 1430 | qed | 
| 1431 | ||
| 44125 | 1432 | lemma Lim_inv: (* TODO: delete *) | 
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1433 | fixes f :: "'a \<Rightarrow> real" and A :: "'a filter" | 
| 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1434 | assumes "(f ---> l) A" and "l \<noteq> 0" | 
| 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1435 | shows "((inverse o f) ---> inverse l) A" | 
| 36437 | 1436 | unfolding o_def using assms by (rule tendsto_inverse) | 
| 1437 | ||
| 33175 | 1438 | lemma Lim_null: | 
| 1439 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 44125 | 1440 | shows "(f ---> l) net \<longleftrightarrow> ((\<lambda>x. f(x) - l) ---> 0) net" | 
| 33175 | 1441 | by (simp add: Lim dist_norm) | 
| 1442 | ||
| 1443 | lemma Lim_null_comparison: | |
| 1444 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1445 | assumes "eventually (\<lambda>x. norm (f x) \<le> g x) net" "(g ---> 0) net" | |
| 1446 | shows "(f ---> 0) net" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1447 | proof (rule metric_tendsto_imp_tendsto) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1448 | show "(g ---> 0) net" by fact | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1449 | show "eventually (\<lambda>x. dist (f x) 0 \<le> dist (g x) 0) net" | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1450 | using assms(1) by (rule eventually_elim1, simp add: dist_norm) | 
| 33175 | 1451 | qed | 
| 1452 | ||
| 1453 | lemma Lim_transform_bound: | |
| 1454 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1455 | fixes g :: "'a \<Rightarrow> 'c::real_normed_vector" | |
| 1456 | assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net" "(g ---> 0) net" | |
| 1457 | shows "(f ---> 0) net" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1458 | using assms(1) tendsto_norm_zero [OF assms(2)] | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1459 | by (rule Lim_null_comparison) | 
| 33175 | 1460 | |
| 1461 | text{* Deducing things about the limit from the elements. *}
 | |
| 1462 | ||
| 1463 | lemma Lim_in_closed_set: | |
| 1464 | assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) net" "\<not>(trivial_limit net)" "(f ---> l) net" | |
| 1465 | shows "l \<in> S" | |
| 1466 | proof (rule ccontr) | |
| 1467 | assume "l \<notin> S" | |
| 1468 | with `closed S` have "open (- S)" "l \<in> - S" | |
| 1469 | by (simp_all add: open_Compl) | |
| 1470 | with assms(4) have "eventually (\<lambda>x. f x \<in> - S) net" | |
| 1471 | by (rule topological_tendstoD) | |
| 1472 | with assms(2) have "eventually (\<lambda>x. False) net" | |
| 1473 | by (rule eventually_elim2) simp | |
| 1474 | with assms(3) show "False" | |
| 1475 | by (simp add: eventually_False) | |
| 1476 | qed | |
| 1477 | ||
| 1478 | text{* Need to prove closed(cball(x,e)) before deducing this as a corollary. *}
 | |
| 1479 | ||
| 1480 | lemma Lim_dist_ubound: | |
| 1481 | assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. dist a (f x) <= e) net" | |
| 1482 | shows "dist a l <= e" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1483 | proof- | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1484 |   have "dist a l \<in> {..e}"
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1485 | proof (rule Lim_in_closed_set) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1486 |     show "closed {..e}" by simp
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1487 |     show "eventually (\<lambda>x. dist a (f x) \<in> {..e}) net" by (simp add: assms)
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1488 | show "\<not> trivial_limit net" by fact | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1489 | show "((\<lambda>x. dist a (f x)) ---> dist a l) net" by (intro tendsto_intros assms) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1490 | qed | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1491 | thus ?thesis by simp | 
| 33175 | 1492 | qed | 
| 1493 | ||
| 1494 | lemma Lim_norm_ubound: | |
| 1495 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1496 | assumes "\<not>(trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. norm(f x) <= e) net" | |
| 1497 | shows "norm(l) <= e" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1498 | proof- | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1499 |   have "norm l \<in> {..e}"
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1500 | proof (rule Lim_in_closed_set) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1501 |     show "closed {..e}" by simp
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1502 |     show "eventually (\<lambda>x. norm (f x) \<in> {..e}) net" by (simp add: assms)
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1503 | show "\<not> trivial_limit net" by fact | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1504 | show "((\<lambda>x. norm (f x)) ---> norm l) net" by (intro tendsto_intros assms) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1505 | qed | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1506 | thus ?thesis by simp | 
| 33175 | 1507 | qed | 
| 1508 | ||
| 1509 | lemma Lim_norm_lbound: | |
| 1510 | fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" | |
| 1511 | assumes "\<not> (trivial_limit net)" "(f ---> l) net" "eventually (\<lambda>x. e <= norm(f x)) net" | |
| 1512 | shows "e \<le> norm l" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1513 | proof- | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1514 |   have "norm l \<in> {e..}"
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1515 | proof (rule Lim_in_closed_set) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1516 |     show "closed {e..}" by simp
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1517 |     show "eventually (\<lambda>x. norm (f x) \<in> {e..}) net" by (simp add: assms)
 | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1518 | show "\<not> trivial_limit net" by fact | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1519 | show "((\<lambda>x. norm (f x)) ---> norm l) net" by (intro tendsto_intros assms) | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1520 | qed | 
| 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1521 | thus ?thesis by simp | 
| 33175 | 1522 | qed | 
| 1523 | ||
| 1524 | text{* Limit under bilinear function *}
 | |
| 1525 | ||
| 1526 | lemma Lim_bilinear: | |
| 1527 | assumes "(f ---> l) net" and "(g ---> m) net" and "bounded_bilinear h" | |
| 1528 | shows "((\<lambda>x. h (f x) (g x)) ---> (h l m)) net" | |
| 1529 | using `bounded_bilinear h` `(f ---> l) net` `(g ---> m) net` | |
| 1530 | by (rule bounded_bilinear.tendsto) | |
| 1531 | ||
| 1532 | text{* These are special for limits out of the same vector space. *}
 | |
| 1533 | ||
| 1534 | 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 | 1535 | unfolding id_def by (rule tendsto_ident_at) | 
| 33175 | 1536 | |
| 1537 | lemma Lim_at_id: "(id ---> a) (at a)" | |
| 45031 | 1538 | unfolding id_def by (rule tendsto_ident_at) | 
| 33175 | 1539 | |
| 1540 | lemma Lim_at_zero: | |
| 1541 | fixes a :: "'a::real_normed_vector" | |
| 1542 | fixes l :: "'b::topological_space" | |
| 1543 | shows "(f ---> l) (at a) \<longleftrightarrow> ((\<lambda>x. f(a + x)) ---> l) (at 0)" (is "?lhs = ?rhs") | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1544 | using LIM_offset_zero LIM_offset_zero_cancel .. | 
| 33175 | 1545 | |
| 44081 
730f7cced3a6
rename type 'a net to 'a filter, following standard mathematical terminology
 huffman parents: 
44076diff
changeset | 1546 | text{* It's also sometimes useful to extract the limit point from the filter. *}
 | 
| 33175 | 1547 | |
| 51365 | 1548 | abbreviation netlimit :: "'a::t2_space filter \<Rightarrow> 'a" where | 
| 1549 | "netlimit F \<equiv> Lim F (\<lambda>x. x)" | |
| 33175 | 1550 | |
| 1551 | lemma netlimit_within: | |
| 51365 | 1552 | "\<not> trivial_limit (at a within S) \<Longrightarrow> netlimit (at a within S) = a" | 
| 1553 | by (rule tendsto_Lim) (auto intro: tendsto_intros) | |
| 33175 | 1554 | |
| 1555 | lemma netlimit_at: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 1556 |   fixes a :: "'a::{perfect_space,t2_space}"
 | 
| 33175 | 1557 | shows "netlimit (at a) = a" | 
| 45031 | 1558 | using netlimit_within [of a UNIV] by simp | 
| 33175 | 1559 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1560 | lemma lim_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1561 | "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 | 1562 | by (metis at_within_interior) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1563 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1564 | lemma netlimit_within_interior: | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1565 |   fixes x :: "'a::{t2_space,perfect_space}"
 | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1566 | assumes "x \<in> interior S" | 
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1567 | shows "netlimit (at x within S) = 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 | 1568 | using assms by (metis at_within_interior netlimit_at) | 
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1569 | |
| 33175 | 1570 | text{* Transformation of limit. *}
 | 
| 1571 | ||
| 1572 | lemma Lim_transform: | |
| 1573 | fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector" | |
| 1574 | assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net" | |
| 1575 | shows "(g ---> l) net" | |
| 44252 
10362a07eb7c
Topology_Euclidean_Space.thy: simplify some proofs
 huffman parents: 
44250diff
changeset | 1576 | using tendsto_diff [OF assms(2) assms(1)] by simp | 
| 33175 | 1577 | |
| 1578 | lemma Lim_transform_eventually: | |
| 36667 | 1579 | "eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net \<Longrightarrow> (g ---> l) net" | 
| 33175 | 1580 | apply (rule topological_tendstoI) | 
| 1581 | apply (drule (2) topological_tendstoD) | |
| 1582 | apply (erule (1) eventually_elim2, simp) | |
| 1583 | done | |
| 1584 | ||
| 1585 | lemma Lim_transform_within: | |
| 36667 | 1586 | assumes "0 < d" and "\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | 
| 1587 | and "(f ---> l) (at x within S)" | |
| 1588 | shows "(g ---> l) (at x within S)" | |
| 1589 | proof (rule Lim_transform_eventually) | |
| 1590 | 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 | 1591 | using assms(1,2) by (auto simp: dist_nz eventually_at) | 
| 36667 | 1592 | show "(f ---> l) (at x within S)" by fact | 
| 1593 | qed | |
| 33175 | 1594 | |
| 1595 | lemma Lim_transform_at: | |
| 36667 | 1596 | assumes "0 < d" and "\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | 
| 1597 | and "(f ---> l) (at x)" | |
| 1598 | shows "(g ---> l) (at x)" | |
| 1599 | proof (rule Lim_transform_eventually) | |
| 1600 | 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 | 1601 | unfolding eventually_at2 | 
| 36667 | 1602 | using assms(1,2) by auto | 
| 1603 | show "(f ---> l) (at x)" by fact | |
| 1604 | qed | |
| 33175 | 1605 | |
| 1606 | text{* Common case assuming being away from some crucial point like 0. *}
 | |
| 1607 | ||
| 1608 | lemma Lim_transform_away_within: | |
| 36669 | 1609 | fixes a b :: "'a::t1_space" | 
| 36667 | 1610 | assumes "a \<noteq> b" and "\<forall>x\<in>S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" | 
| 33175 | 1611 | and "(f ---> l) (at a within S)" | 
| 1612 | shows "(g ---> l) (at a within S)" | |
| 36669 | 1613 | proof (rule Lim_transform_eventually) | 
| 1614 | show "(f ---> l) (at a within S)" by fact | |
| 1615 | 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 | 1616 | unfolding eventually_at_topological | 
| 36669 | 1617 |     by (rule exI [where x="- {b}"], simp add: open_Compl assms)
 | 
| 33175 | 1618 | qed | 
| 1619 | ||
| 1620 | lemma Lim_transform_away_at: | |
| 36669 | 1621 | fixes a b :: "'a::t1_space" | 
| 33175 | 1622 | assumes ab: "a\<noteq>b" and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x" | 
| 1623 | and fl: "(f ---> l) (at a)" | |
| 1624 | shows "(g ---> l) (at a)" | |
| 1625 | using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl | |
| 45031 | 1626 | by simp | 
| 33175 | 1627 | |
| 1628 | text{* Alternatively, within an open set. *}
 | |
| 1629 | ||
| 1630 | lemma Lim_transform_within_open: | |
| 36667 | 1631 | assumes "open S" and "a \<in> S" and "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x" | 
| 1632 | and "(f ---> l) (at a)" | |
| 33175 | 1633 | shows "(g ---> l) (at a)" | 
| 36667 | 1634 | proof (rule Lim_transform_eventually) | 
| 1635 | show "eventually (\<lambda>x. f x = g x) (at a)" | |
| 1636 | unfolding eventually_at_topological | |
| 1637 | using assms(1,2,3) by auto | |
| 1638 | show "(f ---> l) (at a)" by fact | |
| 33175 | 1639 | qed | 
| 1640 | ||
| 1641 | text{* A congruence rule allowing us to transform limits assuming not at point. *}
 | |
| 1642 | ||
| 1643 | (* FIXME: Only one congruence rule for tendsto can be used at a time! *) | |
| 1644 | ||
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 1645 | lemma Lim_cong_within(*[cong add]*): | 
| 43338 | 1646 | assumes "a = b" "x = y" "S = T" | 
| 1647 | assumes "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x" | |
| 1648 | 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 | 1649 | unfolding tendsto_def eventually_at_topological | 
| 36667 | 1650 | using assms by simp | 
| 1651 | ||
| 1652 | lemma Lim_cong_at(*[cong add]*): | |
| 43338 | 1653 | assumes "a = b" "x = y" | 
| 36667 | 1654 | assumes "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x" | 
| 43338 | 1655 | shows "((\<lambda>x. f x) ---> x) (at a) \<longleftrightarrow> ((g ---> y) (at a))" | 
| 36667 | 1656 | unfolding tendsto_def eventually_at_topological | 
| 1657 | using assms by simp | |
| 33175 | 1658 | |
| 1659 | text{* Useful lemmas on closure and set of possible sequential limits.*}
 | |
| 1660 | ||
| 1661 | lemma closure_sequential: | |
| 50883 | 1662 | fixes l :: "'a::first_countable_topology" | 
| 33175 | 1663 | shows "l \<in> closure S \<longleftrightarrow> (\<exists>x. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially)" (is "?lhs = ?rhs") | 
| 1664 | proof | |
| 1665 | assume "?lhs" moreover | |
| 1666 |   { assume "l \<in> S"
 | |
| 44125 | 1667 | hence "?rhs" using tendsto_const[of l sequentially] by auto | 
| 33175 | 1668 | } moreover | 
| 1669 |   { assume "l islimpt S"
 | |
| 1670 | hence "?rhs" unfolding islimpt_sequential by auto | |
| 1671 | } ultimately | |
| 1672 | show "?rhs" unfolding closure_def by auto | |
| 1673 | next | |
| 1674 | assume "?rhs" | |
| 1675 | thus "?lhs" unfolding closure_def unfolding islimpt_sequential by auto | |
| 1676 | qed | |
| 1677 | ||
| 1678 | lemma closed_sequential_limits: | |
| 50883 | 1679 | fixes S :: "'a::first_countable_topology set" | 
| 33175 | 1680 | shows "closed S \<longleftrightarrow> (\<forall>x l. (\<forall>n. x n \<in> S) \<and> (x ---> l) sequentially \<longrightarrow> l \<in> S)" | 
| 1681 | unfolding closed_limpt | |
| 1682 | using closure_sequential [where 'a='a] closure_closed [where 'a='a] closed_limpt [where 'a='a] islimpt_sequential [where 'a='a] mem_delete [where 'a='a] | |
| 1683 | by metis | |
| 1684 | ||
| 1685 | lemma closure_approachable: | |
| 1686 | fixes S :: "'a::metric_space set" | |
| 1687 | shows "x \<in> closure S \<longleftrightarrow> (\<forall>e>0. \<exists>y\<in>S. dist y x < e)" | |
| 1688 | apply (auto simp add: closure_def islimpt_approachable) | |
| 1689 | by (metis dist_self) | |
| 1690 | ||
| 1691 | lemma closed_approachable: | |
| 1692 | fixes S :: "'a::metric_space set" | |
| 1693 | shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S" | |
| 1694 | by (metis closure_closed closure_approachable) | |
| 1695 | ||
| 51351 | 1696 | lemma closure_contains_Inf: | 
| 1697 | fixes S :: "real set" | |
| 1698 |   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
 | |
| 1699 | shows "Inf S \<in> closure S" | |
| 1700 | unfolding closure_approachable | |
| 1701 | proof safe | |
| 1702 | have *: "\<forall>x\<in>S. Inf S \<le> x" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1703 | using cInf_lower_EX[of _ S] assms by metis | 
| 51351 | 1704 | |
| 1705 | fix e :: real assume "0 < e" | |
| 51518 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1706 | then have "Inf S < Inf S + e" by simp | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1707 | with assms obtain x where "x \<in> S" "x < Inf S + e" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1708 | by (subst (asm) cInf_less_iff[of _ B]) auto | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1709 | with * show "\<exists>x\<in>S. dist x (Inf S) < e" | 
| 
6a56b7088a6a
separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
 hoelzl parents: 
51481diff
changeset | 1710 | by (intro bexI[of _ x]) (auto simp add: dist_real_def) | 
| 51351 | 1711 | qed | 
| 1712 | ||
| 1713 | lemma closed_contains_Inf: | |
| 1714 | fixes S :: "real set" | |
| 1715 |   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
 | |
| 1716 | and "closed S" | |
| 1717 | shows "Inf S \<in> S" | |
| 1718 | by (metis closure_contains_Inf closure_closed assms) | |
| 1719 | ||
| 1720 | ||
| 1721 | lemma not_trivial_limit_within_ball: | |
| 1722 |   "(\<not> trivial_limit (at x within S)) = (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
 | |
| 1723 | (is "?lhs = ?rhs") | |
| 1724 | proof - | |
| 1725 |   { assume "?lhs"
 | |
| 1726 |     { fix e :: real
 | |
| 1727 | assume "e>0" | |
| 1728 |       then obtain y where "y:(S-{x}) & dist y x < e"
 | |
| 1729 |         using `?lhs` not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
 | |
| 1730 | by auto | |
| 1731 |       then have "y : (S Int ball x e - {x})"
 | |
| 1732 | unfolding ball_def by (simp add: dist_commute) | |
| 1733 |       then have "S Int ball x e - {x} ~= {}" by blast
 | |
| 1734 | } then have "?rhs" by auto | |
| 1735 | } | |
| 1736 | moreover | |
| 1737 |   { assume "?rhs"
 | |
| 1738 |     { fix e :: real
 | |
| 1739 | assume "e>0" | |
| 1740 |       then obtain y where "y : (S Int ball x e - {x})" using `?rhs` by blast
 | |
| 1741 |       then have "y:(S-{x}) & dist y x < e"
 | |
| 1742 | unfolding ball_def by (simp add: dist_commute) | |
| 1743 |       then have "EX y:(S-{x}). dist y x < e" by auto
 | |
| 1744 | } | |
| 1745 | then have "?lhs" | |
| 1746 |       using not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"] by auto
 | |
| 1747 | } | |
| 1748 | ultimately show ?thesis by auto | |
| 1749 | qed | |
| 1750 | ||
| 50087 | 1751 | subsection {* Infimum Distance *}
 | 
| 1752 | ||
| 1753 | definition "infdist x A = (if A = {} then 0 else Inf {dist x a|a. a \<in> A})"
 | |
| 1754 | ||
| 1755 | lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = Inf {dist x a|a. a \<in> A}"
 | |
| 1756 | by (simp add: infdist_def) | |
| 1757 | ||
| 1758 | lemma infdist_nonneg: | |
| 1759 | shows "0 \<le> infdist x A" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1760 | using assms by (auto simp add: infdist_def intro: cInf_greatest) | 
| 50087 | 1761 | |
| 1762 | lemma infdist_le: | |
| 1763 | assumes "a \<in> A" | |
| 1764 | assumes "d = dist x a" | |
| 1765 | shows "infdist x A \<le> d" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1766 | using assms by (auto intro!: cInf_lower[where z=0] simp add: infdist_def) | 
| 50087 | 1767 | |
| 1768 | lemma infdist_zero[simp]: | |
| 1769 | assumes "a \<in> A" shows "infdist a A = 0" | |
| 1770 | proof - | |
| 1771 | from infdist_le[OF assms, of "dist a a"] have "infdist a A \<le> 0" by auto | |
| 1772 | with infdist_nonneg[of a A] assms show "infdist a A = 0" by auto | |
| 1773 | qed | |
| 1774 | ||
| 1775 | lemma infdist_triangle: | |
| 1776 | shows "infdist x A \<le> infdist y A + dist x y" | |
| 1777 | proof cases | |
| 1778 |   assume "A = {}" thus ?thesis by (simp add: infdist_def)
 | |
| 1779 | next | |
| 1780 |   assume "A \<noteq> {}" then obtain a where "a \<in> A" by auto
 | |
| 1781 |   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 | 1782 | proof (rule cInf_greatest) | 
| 50087 | 1783 |     from `A \<noteq> {}` show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}" by simp
 | 
| 1784 |     fix d assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
 | |
| 1785 | then obtain a where d: "d = dist x y + dist y a" "a \<in> A" by auto | |
| 1786 | show "infdist x A \<le> d" | |
| 1787 |       unfolding infdist_notempty[OF `A \<noteq> {}`]
 | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1788 | proof (rule cInf_lower2) | 
| 50087 | 1789 |       show "dist x a \<in> {dist x a |a. a \<in> A}" using `a \<in> A` by auto
 | 
| 1790 | show "dist x a \<le> d" unfolding d by (rule dist_triangle) | |
| 1791 |       fix d assume "d \<in> {dist x a |a. a \<in> A}"
 | |
| 1792 | then obtain a where "a \<in> A" "d = dist x a" by auto | |
| 1793 | thus "infdist x A \<le> d" by (rule infdist_le) | |
| 1794 | qed | |
| 1795 | qed | |
| 1796 | 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 | 1797 | proof (rule cInf_eq, safe) | 
| 50087 | 1798 | fix a assume "a \<in> A" | 
| 1799 | thus "dist x y + infdist y A \<le> dist x y + dist y a" by (auto intro: infdist_le) | |
| 1800 | next | |
| 1801 |     fix i assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
 | |
| 1802 |     hence "i - dist x y \<le> infdist y A" unfolding infdist_notempty[OF `A \<noteq> {}`] using `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 | 1803 | by (intro cInf_greatest) (auto simp: field_simps) | 
| 50087 | 1804 | thus "i \<le> dist x y + infdist y A" by simp | 
| 1805 | qed | |
| 1806 | finally show ?thesis by simp | |
| 1807 | qed | |
| 1808 | ||
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1809 | lemma in_closure_iff_infdist_zero: | 
| 50087 | 1810 |   assumes "A \<noteq> {}"
 | 
| 1811 | shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | |
| 1812 | proof | |
| 1813 | assume "x \<in> closure A" | |
| 1814 | show "infdist x A = 0" | |
| 1815 | proof (rule ccontr) | |
| 1816 | assume "infdist x A \<noteq> 0" | |
| 1817 | with infdist_nonneg[of x A] have "infdist x A > 0" by auto | |
| 1818 |     hence "ball x (infdist x A) \<inter> closure A = {}" apply auto
 | |
| 1819 | by (metis `0 < infdist x A` `x \<in> closure A` closure_approachable dist_commute | |
| 1820 | eucl_less_not_refl euclidean_trans(2) infdist_le) | |
| 1821 | hence "x \<notin> closure A" by (metis `0 < infdist x A` centre_in_ball disjoint_iff_not_equal) | |
| 1822 | thus False using `x \<in> closure A` by simp | |
| 1823 | qed | |
| 1824 | next | |
| 1825 | assume x: "infdist x A = 0" | |
| 1826 | then obtain a where "a \<in> A" by atomize_elim (metis all_not_in_conv assms) | |
| 1827 | show "x \<in> closure A" unfolding closure_approachable | |
| 1828 | proof (safe, rule ccontr) | |
| 1829 | fix e::real assume "0 < e" | |
| 1830 | assume "\<not> (\<exists>y\<in>A. dist y x < e)" | |
| 1831 | hence "infdist x A \<ge> e" using `a \<in> A` | |
| 1832 | unfolding infdist_def | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1833 | by (force simp: dist_commute intro: cInf_greatest) | 
| 50087 | 1834 | with x `0 < e` show False by auto | 
| 1835 | qed | |
| 1836 | qed | |
| 1837 | ||
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 1838 | lemma in_closed_iff_infdist_zero: | 
| 50087 | 1839 |   assumes "closed A" "A \<noteq> {}"
 | 
| 1840 | shows "x \<in> A \<longleftrightarrow> infdist x A = 0" | |
| 1841 | proof - | |
| 1842 | have "x \<in> closure A \<longleftrightarrow> infdist x A = 0" | |
| 1843 | by (rule in_closure_iff_infdist_zero) fact | |
| 1844 | with assms show ?thesis by simp | |
| 1845 | qed | |
| 1846 | ||
| 1847 | lemma tendsto_infdist [tendsto_intros]: | |
| 1848 | assumes f: "(f ---> l) F" | |
| 1849 | shows "((\<lambda>x. infdist (f x) A) ---> infdist l A) F" | |
| 1850 | proof (rule tendstoI) | |
| 1851 | fix e ::real assume "0 < e" | |
| 1852 | from tendstoD[OF f this] | |
| 1853 | show "eventually (\<lambda>x. dist (infdist (f x) A) (infdist l A) < e) F" | |
| 1854 | proof (eventually_elim) | |
| 1855 | fix x | |
| 1856 | from infdist_triangle[of l A "f x"] infdist_triangle[of "f x" A l] | |
| 1857 | have "dist (infdist (f x) A) (infdist l A) \<le> dist (f x) l" | |
| 1858 | by (simp add: dist_commute dist_real_def) | |
| 1859 | also assume "dist (f x) l < e" | |
| 1860 | finally show "dist (infdist (f x) A) (infdist l A) < e" . | |
| 1861 | qed | |
| 1862 | qed | |
| 1863 | ||
| 33175 | 1864 | text{* Some other lemmas about sequences. *}
 | 
| 1865 | ||
| 36441 | 1866 | lemma sequentially_offset: | 
| 1867 | assumes "eventually (\<lambda>i. P i) sequentially" | |
| 1868 | shows "eventually (\<lambda>i. P (i + k)) sequentially" | |
| 1869 | using assms unfolding eventually_sequentially by (metis trans_le_add1) | |
| 1870 | ||
| 33175 | 1871 | lemma seq_offset: | 
| 36441 | 1872 | assumes "(f ---> l) sequentially" | 
| 1873 | shows "((\<lambda>i. f (i + k)) ---> l) sequentially" | |
| 44584 | 1874 | using assms by (rule LIMSEQ_ignore_initial_segment) (* FIXME: redundant *) | 
| 33175 | 1875 | |
| 1876 | lemma seq_offset_neg: | |
| 1877 | "(f ---> l) sequentially ==> ((\<lambda>i. f(i - k)) ---> l) sequentially" | |
| 1878 | apply (rule topological_tendstoI) | |
| 1879 | apply (drule (2) topological_tendstoD) | |
| 1880 | apply (simp only: eventually_sequentially) | |
| 1881 | apply (subgoal_tac "\<And>N k (n::nat). N + k <= n ==> N <= n - k") | |
| 1882 | apply metis | |
| 1883 | by arith | |
| 1884 | ||
| 1885 | lemma seq_offset_rev: | |
| 1886 | "((\<lambda>i. f(i + k)) ---> l) sequentially ==> (f ---> l) sequentially" | |
| 44584 | 1887 | by (rule LIMSEQ_offset) (* FIXME: redundant *) | 
| 33175 | 1888 | |
| 1889 | lemma seq_harmonic: "((\<lambda>n. inverse (real n)) ---> 0) sequentially" | |
| 44584 | 1890 | using LIMSEQ_inverse_real_of_nat by (rule LIMSEQ_imp_Suc) | 
| 33175 | 1891 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 1892 | subsection {* More properties of closed balls *}
 | 
| 33175 | 1893 | |
| 1894 | lemma closed_cball: "closed (cball x e)" | |
| 1895 | unfolding cball_def closed_def | |
| 1896 | unfolding Collect_neg_eq [symmetric] not_le | |
| 1897 | apply (clarsimp simp add: open_dist, rename_tac y) | |
| 1898 | apply (rule_tac x="dist x y - e" in exI, clarsimp) | |
| 1899 | apply (rename_tac x') | |
| 1900 | apply (cut_tac x=x and y=x' and z=y in dist_triangle) | |
| 1901 | apply simp | |
| 1902 | done | |
| 1903 | ||
| 1904 | lemma open_contains_cball: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e>0. cball x e \<subseteq> S)" | |
| 1905 | proof- | |
| 1906 |   { fix x and e::real assume "x\<in>S" "e>0" "ball x e \<subseteq> S"
 | |
| 1907 | hence "\<exists>d>0. cball x d \<subseteq> S" unfolding subset_eq by (rule_tac x="e/2" in exI, auto) | |
| 1908 | } moreover | |
| 1909 |   { fix x and e::real assume "x\<in>S" "e>0" "cball x e \<subseteq> S"
 | |
| 1910 | hence "\<exists>d>0. ball x d \<subseteq> S" unfolding subset_eq apply(rule_tac x="e/2" in exI) by auto | |
| 1911 | } ultimately | |
| 1912 | show ?thesis unfolding open_contains_ball by auto | |
| 1913 | qed | |
| 1914 | ||
| 1915 | lemma open_contains_cball_eq: "open S ==> (\<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 | 1916 | by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball) | 
| 33175 | 1917 | |
| 1918 | lemma mem_interior_cball: "x \<in> interior S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S)" | |
| 1919 | apply (simp add: interior_def, safe) | |
| 1920 | apply (force simp add: open_contains_cball) | |
| 1921 | apply (rule_tac x="ball x e" in exI) | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 1922 | apply (simp add: subset_trans [OF ball_subset_cball]) | 
| 33175 | 1923 | done | 
| 1924 | ||
| 1925 | lemma islimpt_ball: | |
| 1926 |   fixes x y :: "'a::{real_normed_vector,perfect_space}"
 | |
| 1927 | shows "y islimpt ball x e \<longleftrightarrow> 0 < e \<and> y \<in> cball x e" (is "?lhs = ?rhs") | |
| 1928 | proof | |
| 1929 | assume "?lhs" | |
| 1930 |   { assume "e \<le> 0"
 | |
| 1931 |     hence *:"ball x e = {}" using ball_eq_empty[of x e] by auto
 | |
| 1932 | have False using `?lhs` unfolding * using islimpt_EMPTY[of y] by auto | |
| 1933 | } | |
| 1934 | hence "e > 0" by (metis not_less) | |
| 1935 | moreover | |
| 1936 | have "y \<in> cball x e" using closed_cball[of x e] islimpt_subset[of y "ball x e" "cball x e"] ball_subset_cball[of x e] `?lhs` unfolding closed_limpt by auto | |
| 1937 | ultimately show "?rhs" by auto | |
| 1938 | next | |
| 1939 | assume "?rhs" hence "e>0" by auto | |
| 1940 |   { fix d::real assume "d>0"
 | |
| 1941 | have "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 1942 | proof(cases "d \<le> dist x y") | |
| 1943 | case True thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 1944 | proof(cases "x=y") | |
| 1945 | case True hence False using `d \<le> dist x y` `d>0` by auto | |
| 1946 | thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by auto | |
| 1947 | next | |
| 1948 | case False | |
| 1949 | ||
| 1950 | have "dist x (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) | |
| 1951 | = norm (x - y + (d / (2 * norm (y - x))) *\<^sub>R (y - x))" | |
| 1952 | unfolding mem_cball mem_ball dist_norm diff_diff_eq2 diff_add_eq[THEN sym] by auto | |
| 1953 | also have "\<dots> = \<bar>- 1 + d / (2 * norm (x - y))\<bar> * norm (x - y)" | |
| 1954 | using scaleR_left_distrib[of "- 1" "d / (2 * norm (y - x))", THEN sym, of "y - x"] | |
| 1955 | unfolding scaleR_minus_left scaleR_one | |
| 1956 | by (auto simp add: norm_minus_commute) | |
| 1957 | also have "\<dots> = \<bar>- norm (x - y) + d / 2\<bar>" | |
| 1958 | unfolding abs_mult_pos[of "norm (x - y)", OF norm_ge_zero[of "x - y"]] | |
| 49962 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 webertj parents: 
49834diff
changeset | 1959 | unfolding distrib_right using `x\<noteq>y`[unfolded dist_nz, unfolded dist_norm] by auto | 
| 33175 | 1960 | also have "\<dots> \<le> e - d/2" using `d \<le> dist x y` and `d>0` and `?rhs` by(auto simp add: dist_norm) | 
| 1961 | finally have "y - (d / (2 * dist y x)) *\<^sub>R (y - x) \<in> ball x e" using `d>0` by auto | |
| 1962 | ||
| 1963 | moreover | |
| 1964 | ||
| 1965 | have "(d / (2*dist y x)) *\<^sub>R (y - x) \<noteq> 0" | |
| 1966 | using `x\<noteq>y`[unfolded dist_nz] `d>0` unfolding scaleR_eq_0_iff by (auto simp add: dist_commute) | |
| 1967 | moreover | |
| 1968 | have "dist (y - (d / (2 * dist y x)) *\<^sub>R (y - x)) y < d" unfolding dist_norm apply simp unfolding norm_minus_cancel | |
| 1969 | using `d>0` `x\<noteq>y`[unfolded dist_nz] dist_commute[of x y] | |
| 1970 | unfolding dist_norm by auto | |
| 1971 | ultimately show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" by (rule_tac x="y - (d / (2*dist y x)) *\<^sub>R (y - x)" in bexI) auto | |
| 1972 | qed | |
| 1973 | next | |
| 1974 | case False hence "d > dist x y" by auto | |
| 1975 | show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 1976 | proof(cases "x=y") | |
| 1977 | case True | |
| 1978 | obtain z where **: "z \<noteq> y" "dist z y < min e d" | |
| 1979 | using perfect_choose_dist[of "min e d" y] | |
| 1980 | using `d > 0` `e>0` by auto | |
| 1981 | show "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 1982 | unfolding `x = y` | |
| 1983 | using `z \<noteq> y` ** | |
| 1984 | by (rule_tac x=z in bexI, auto simp add: dist_commute) | |
| 1985 | next | |
| 1986 | case False thus "\<exists>x'\<in>ball x e. x' \<noteq> y \<and> dist x' y < d" | |
| 1987 | using `d>0` `d > dist x y` `?rhs` by(rule_tac x=x in bexI, auto) | |
| 1988 | qed | |
| 1989 | qed } | |
| 1990 | thus "?lhs" unfolding mem_cball islimpt_approachable mem_ball by auto | |
| 1991 | qed | |
| 1992 | ||
| 1993 | lemma closure_ball_lemma: | |
| 1994 | fixes x y :: "'a::real_normed_vector" | |
| 1995 | assumes "x \<noteq> y" shows "y islimpt ball x (dist x y)" | |
| 1996 | proof (rule islimptI) | |
| 1997 | fix T assume "y \<in> T" "open T" | |
| 1998 | then obtain r where "0 < r" "\<forall>z. dist z y < r \<longrightarrow> z \<in> T" | |
| 1999 | unfolding open_dist by fast | |
| 2000 | (* choose point between x and y, within distance r of y. *) | |
| 2001 | def k \<equiv> "min 1 (r / (2 * dist x y))" | |
| 2002 | def z \<equiv> "y + scaleR k (x - y)" | |
| 2003 | have z_def2: "z = x + scaleR (1 - k) (y - x)" | |
| 2004 | unfolding z_def by (simp add: algebra_simps) | |
| 2005 | have "dist z y < r" | |
| 2006 | unfolding z_def k_def using `0 < r` | |
| 2007 | by (simp add: dist_norm min_def) | |
| 2008 | hence "z \<in> T" using `\<forall>z. dist z y < r \<longrightarrow> z \<in> T` by simp | |
| 2009 | have "dist x z < dist x y" | |
| 2010 | unfolding z_def2 dist_norm | |
| 2011 | apply (simp add: norm_minus_commute) | |
| 2012 | apply (simp only: dist_norm [symmetric]) | |
| 2013 | apply (subgoal_tac "\<bar>1 - k\<bar> * dist x y < 1 * dist x y", simp) | |
| 2014 | apply (rule mult_strict_right_mono) | |
| 2015 | apply (simp add: k_def divide_pos_pos zero_less_dist_iff `0 < r` `x \<noteq> y`) | |
| 2016 | apply (simp add: zero_less_dist_iff `x \<noteq> y`) | |
| 2017 | done | |
| 2018 | hence "z \<in> ball x (dist x y)" by simp | |
| 2019 | have "z \<noteq> y" | |
| 2020 | unfolding z_def k_def using `x \<noteq> y` `0 < r` | |
| 2021 | by (simp add: min_def) | |
| 2022 | show "\<exists>z\<in>ball x (dist x y). z \<in> T \<and> z \<noteq> y" | |
| 2023 | using `z \<in> ball x (dist x y)` `z \<in> T` `z \<noteq> y` | |
| 2024 | by fast | |
| 2025 | qed | |
| 2026 | ||
| 2027 | lemma closure_ball: | |
| 2028 | fixes x :: "'a::real_normed_vector" | |
| 2029 | shows "0 < e \<Longrightarrow> closure (ball x e) = cball x e" | |
| 2030 | apply (rule equalityI) | |
| 2031 | apply (rule closure_minimal) | |
| 2032 | apply (rule ball_subset_cball) | |
| 2033 | apply (rule closed_cball) | |
| 2034 | apply (rule subsetI, rename_tac y) | |
| 2035 | apply (simp add: le_less [where 'a=real]) | |
| 2036 | apply (erule disjE) | |
| 2037 | apply (rule subsetD [OF closure_subset], simp) | |
| 2038 | apply (simp add: closure_def) | |
| 2039 | apply clarify | |
| 2040 | apply (rule closure_ball_lemma) | |
| 2041 | apply (simp add: zero_less_dist_iff) | |
| 2042 | done | |
| 2043 | ||
| 2044 | (* In a trivial vector space, this fails for e = 0. *) | |
| 2045 | lemma interior_cball: | |
| 2046 |   fixes x :: "'a::{real_normed_vector, perfect_space}"
 | |
| 2047 | shows "interior (cball x e) = ball x e" | |
| 2048 | proof(cases "e\<ge>0") | |
| 2049 | case False note cs = this | |
| 2050 |   from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover
 | |
| 2051 |   { fix y assume "y \<in> cball x e"
 | |
| 2052 | hence False unfolding mem_cball using dist_nz[of x y] cs by auto } | |
| 2053 |   hence "cball x e = {}" by auto
 | |
| 2054 |   hence "interior (cball x e) = {}" using interior_empty by auto
 | |
| 2055 | ultimately show ?thesis by blast | |
| 2056 | next | |
| 2057 | case True note cs = this | |
| 2058 | have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover | |
| 2059 |   { fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S"
 | |
| 2060 | then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast | |
| 2061 | ||
| 2062 | then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d" | |
| 2063 | using perfect_choose_dist [of d] by auto | |
| 2064 | have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute) | |
| 2065 | hence xa_cball:"xa \<in> cball x e" using as(1) by auto | |
| 2066 | ||
| 2067 | hence "y \<in> ball x e" proof(cases "x = y") | |
| 2068 | case True | |
| 2069 | hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute) | |
| 2070 | thus "y \<in> ball x e" using `x = y ` by simp | |
| 2071 | next | |
| 2072 | case False | |
| 2073 | have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm | |
| 2074 | using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto | |
| 2075 | hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast | |
| 2076 | have "y - x \<noteq> 0" using `x \<noteq> y` by auto | |
| 2077 | hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym] | |
| 2078 | using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto | |
| 2079 | ||
| 2080 | have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x = norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)" | |
| 2081 | by (auto simp add: dist_norm algebra_simps) | |
| 2082 | also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))" | |
| 2083 | by (auto simp add: algebra_simps) | |
| 2084 | also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)" | |
| 2085 | using ** by auto | |
| 49962 
a8cc904a6820
Renamed {left,right}_distrib to distrib_{right,left}.
 webertj parents: 
49834diff
changeset | 2086 | also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: distrib_right dist_norm) | 
| 33175 | 2087 | finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute) | 
| 2088 | thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto | |
| 2089 | qed } | |
| 2090 | hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto | |
| 2091 | ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto | |
| 2092 | qed | |
| 2093 | ||
| 2094 | lemma frontier_ball: | |
| 2095 | fixes a :: "'a::real_normed_vector" | |
| 2096 |   shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}"
 | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 2097 | 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 | 2098 | apply (simp add: set_eq_iff) | 
| 33175 | 2099 | by arith | 
| 2100 | ||
| 2101 | lemma frontier_cball: | |
| 2102 |   fixes a :: "'a::{real_normed_vector, perfect_space}"
 | |
| 2103 |   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 | 2104 | 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 | 2105 | apply (simp add: set_eq_iff) | 
| 33175 | 2106 | by arith | 
| 2107 | ||
| 2108 | 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 | 2109 | apply (simp add: set_eq_iff not_le) | 
| 33175 | 2110 | by (metis zero_le_dist dist_self order_less_le_trans) | 
| 2111 | lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty)
 | |
| 2112 | ||
| 2113 | lemma cball_eq_sing: | |
| 44072 
5b970711fb39
class perfect_space inherits from topological_space;
 huffman parents: 
43338diff
changeset | 2114 |   fixes x :: "'a::{metric_space,perfect_space}"
 | 
| 33175 | 2115 |   shows "(cball x e = {x}) \<longleftrightarrow> e = 0"
 | 
| 2116 | proof (rule linorder_cases) | |
| 2117 | assume e: "0 < e" | |
| 2118 | obtain a where "a \<noteq> x" "dist a x < e" | |
| 2119 | using perfect_choose_dist [OF e] by auto | |
| 2120 | hence "a \<noteq> x" "dist x a \<le> e" 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 | 2121 | with e show ?thesis by (auto simp add: set_eq_iff) | 
| 33175 | 2122 | qed auto | 
| 2123 | ||
| 2124 | lemma cball_sing: | |
| 2125 | fixes x :: "'a::metric_space" | |
| 2126 |   shows "e = 0 ==> 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 | 2127 | by (auto simp add: set_eq_iff) | 
| 33175 | 2128 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2129 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 2130 | subsection {* Boundedness *}
 | 
| 33175 | 2131 | |
| 2132 | (* FIXME: This has to be unified with BSEQ!! *) | |
| 44207 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 2133 | definition (in metric_space) | 
| 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 2134 | bounded :: "'a set \<Rightarrow> bool" where | 
| 33175 | 2135 | "bounded S \<longleftrightarrow> (\<exists>x e. \<forall>y\<in>S. dist x y \<le> e)" | 
| 2136 | ||
| 50998 | 2137 | lemma bounded_subset_cball: "bounded S \<longleftrightarrow> (\<exists>e x. S \<subseteq> cball x e)" | 
| 2138 | unfolding bounded_def subset_eq by auto | |
| 2139 | ||
| 33175 | 2140 | lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)" | 
| 2141 | unfolding bounded_def | |
| 2142 | apply safe | |
| 2143 | apply (rule_tac x="dist a x + e" in exI, clarify) | |
| 2144 | apply (drule (1) bspec) | |
| 2145 | apply (erule order_trans [OF dist_triangle add_left_mono]) | |
| 2146 | apply auto | |
| 2147 | done | |
| 2148 | ||
| 2149 | lemma bounded_iff: "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. norm x \<le> a)" | |
| 2150 | unfolding bounded_any_center [where a=0] | |
| 2151 | by (simp add: dist_norm) | |
| 2152 | ||
| 50104 | 2153 | lemma bounded_realI: assumes "\<forall>x\<in>s. abs (x::real) \<le> B" shows "bounded s" | 
| 2154 | unfolding bounded_def dist_real_def apply(rule_tac x=0 in exI) | |
| 2155 | using assms by auto | |
| 2156 | ||
| 50948 | 2157 | lemma bounded_empty [simp]: "bounded {}"
 | 
| 2158 | by (simp add: bounded_def) | |
| 2159 | ||
| 33175 | 2160 | lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T ==> bounded S" | 
| 2161 | by (metis bounded_def subset_eq) | |
| 2162 | ||
| 2163 | lemma bounded_interior[intro]: "bounded S ==> bounded(interior S)" | |
| 2164 | by (metis bounded_subset interior_subset) | |
| 2165 | ||
| 2166 | lemma bounded_closure[intro]: assumes "bounded S" shows "bounded(closure S)" | |
| 2167 | proof- | |
| 2168 | from assms obtain x and a where a: "\<forall>y\<in>S. dist x y \<le> a" unfolding bounded_def by auto | |
| 2169 |   { fix y assume "y \<in> closure S"
 | |
| 2170 | then obtain f where f: "\<forall>n. f n \<in> S" "(f ---> y) sequentially" | |
| 2171 | unfolding closure_sequential by auto | |
| 2172 | have "\<forall>n. f n \<in> S \<longrightarrow> dist x (f n) \<le> a" using a by simp | |
| 2173 | hence "eventually (\<lambda>n. dist x (f n) \<le> a) sequentially" | |
| 2174 | by (rule eventually_mono, simp add: f(1)) | |
| 2175 | have "dist x y \<le> a" | |
| 2176 | apply (rule Lim_dist_ubound [of sequentially f]) | |
| 2177 | apply (rule trivial_limit_sequentially) | |
| 2178 | apply (rule f(2)) | |
| 2179 | apply fact | |
| 2180 | done | |
| 2181 | } | |
| 2182 | thus ?thesis unfolding bounded_def by auto | |
| 2183 | qed | |
| 2184 | ||
| 2185 | lemma bounded_cball[simp,intro]: "bounded (cball x e)" | |
| 2186 | apply (simp add: bounded_def) | |
| 2187 | apply (rule_tac x=x in exI) | |
| 2188 | apply (rule_tac x=e in exI) | |
| 2189 | apply auto | |
| 2190 | done | |
| 2191 | ||
| 2192 | lemma bounded_ball[simp,intro]: "bounded(ball x e)" | |
| 2193 | by (metis ball_subset_cball bounded_cball bounded_subset) | |
| 2194 | ||
| 2195 | lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T" | |
| 2196 | apply (auto simp add: bounded_def) | |
| 2197 | apply (rename_tac x y r s) | |
| 2198 | apply (rule_tac x=x in exI) | |
| 2199 | apply (rule_tac x="max r (dist x y + s)" in exI) | |
| 2200 | apply (rule ballI, rename_tac z, safe) | |
| 2201 | apply (drule (1) bspec, simp) | |
| 2202 | apply (drule (1) bspec) | |
| 2203 | apply (rule min_max.le_supI2) | |
| 2204 | apply (erule order_trans [OF dist_triangle add_left_mono]) | |
| 2205 | done | |
| 2206 | ||
| 2207 | lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)" | |
| 2208 | by (induct rule: finite_induct[of F], auto) | |
| 2209 | ||
| 50955 | 2210 | lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)" | 
| 2211 | by (induct set: finite, auto) | |
| 2212 | ||
| 50948 | 2213 | lemma bounded_insert [simp]: "bounded (insert x S) \<longleftrightarrow> bounded S" | 
| 2214 | proof - | |
| 2215 |   have "\<forall>y\<in>{x}. dist x y \<le> 0" by simp
 | |
| 2216 |   hence "bounded {x}" unfolding bounded_def by fast
 | |
| 2217 | thus ?thesis by (metis insert_is_Un bounded_Un) | |
| 2218 | qed | |
| 2219 | ||
| 2220 | lemma finite_imp_bounded [intro]: "finite S \<Longrightarrow> bounded S" | |
| 2221 | by (induct set: finite, simp_all) | |
| 2222 | ||
| 33175 | 2223 | lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)" | 
| 2224 | apply (simp add: bounded_iff) | |
| 2225 | apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)") | |
| 2226 | by metis arith | |
| 2227 | ||
| 51473 | 2228 | lemma Bseq_eq_bounded: "Bseq f \<longleftrightarrow> bounded (range f::_::real_normed_vector set)" | 
| 50972 | 2229 | unfolding Bseq_def bounded_pos by auto | 
| 2230 | ||
| 33175 | 2231 | lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)" | 
| 2232 | by (metis Int_lower1 Int_lower2 bounded_subset) | |
| 2233 | ||
| 2234 | lemma bounded_diff[intro]: "bounded S ==> bounded (S - T)" | |
| 2235 | apply (metis Diff_subset bounded_subset) | |
| 2236 | done | |
| 2237 | ||
| 2238 | lemma not_bounded_UNIV[simp, intro]: | |
| 2239 |   "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
 | |
| 2240 | proof(auto simp add: bounded_pos not_le) | |
| 2241 | obtain x :: 'a where "x \<noteq> 0" | |
| 2242 | using perfect_choose_dist [OF zero_less_one] by fast | |
| 2243 | fix b::real assume b: "b >0" | |
| 2244 | have b1: "b +1 \<ge> 0" using b by simp | |
| 2245 | with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))" | |
| 2246 | by (simp add: norm_sgn) | |
| 2247 | then show "\<exists>x::'a. b < norm x" .. | |
| 2248 | qed | |
| 2249 | ||
| 2250 | lemma bounded_linear_image: | |
| 2251 | assumes "bounded S" "bounded_linear f" | |
| 2252 | shows "bounded(f ` S)" | |
| 2253 | proof- | |
| 2254 | from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto | |
| 2255 | from assms(2) obtain B where B:"B>0" "\<forall>x. norm (f x) \<le> B * norm x" using bounded_linear.pos_bounded by (auto simp add: mult_ac) | |
| 2256 |   { fix x assume "x\<in>S"
 | |
| 2257 | hence "norm x \<le> b" using b by auto | |
| 2258 | hence "norm (f x) \<le> B * b" using B(2) apply(erule_tac x=x in allE) | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 2259 | by (metis B(1) B(2) order_trans mult_le_cancel_left_pos) | 
| 33175 | 2260 | } | 
| 2261 | thus ?thesis unfolding bounded_pos apply(rule_tac x="b*B" in exI) | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 2262 | using b B mult_pos_pos [of b B] by (auto simp add: mult_commute) | 
| 33175 | 2263 | qed | 
| 2264 | ||
| 2265 | lemma bounded_scaling: | |
| 2266 | fixes S :: "'a::real_normed_vector set" | |
| 2267 | shows "bounded S \<Longrightarrow> bounded ((\<lambda>x. c *\<^sub>R x) ` S)" | |
| 2268 | apply (rule bounded_linear_image, assumption) | |
| 44282 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 huffman parents: 
44252diff
changeset | 2269 | apply (rule bounded_linear_scaleR_right) | 
| 33175 | 2270 | done | 
| 2271 | ||
| 2272 | lemma bounded_translation: | |
| 2273 | fixes S :: "'a::real_normed_vector set" | |
| 2274 | assumes "bounded S" shows "bounded ((\<lambda>x. a + x) ` S)" | |
| 2275 | proof- | |
| 2276 | from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b" unfolding bounded_pos by auto | |
| 2277 |   { fix x assume "x\<in>S"
 | |
| 2278 | hence "norm (a + x) \<le> b + norm a" using norm_triangle_ineq[of a x] b by auto | |
| 2279 | } | |
| 2280 | thus ?thesis unfolding bounded_pos using norm_ge_zero[of a] b(1) using add_strict_increasing[of b 0 "norm a"] | |
| 48048 
87b94fb75198
remove stray reference to no-longer-existing theorem 'add'
 huffman parents: 
47108diff
changeset | 2281 | by (auto intro!: exI[of _ "b + norm a"]) | 
| 33175 | 2282 | qed | 
| 2283 | ||
| 2284 | ||
| 2285 | text{* Some theorems on sups and infs using the notion "bounded". *}
 | |
| 2286 | ||
| 2287 | lemma bounded_real: | |
| 2288 | fixes S :: "real set" | |
| 2289 | shows "bounded S \<longleftrightarrow> (\<exists>a. \<forall>x\<in>S. abs x <= a)" | |
| 2290 | by (simp add: bounded_iff) | |
| 2291 | ||
| 33270 | 2292 | lemma bounded_has_Sup: | 
| 2293 | fixes S :: "real set" | |
| 2294 |   assumes "bounded S" "S \<noteq> {}"
 | |
| 2295 | shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b" | |
| 2296 | proof | |
| 2297 | fix x assume "x\<in>S" | |
| 2298 | thus "x \<le> Sup S" | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2299 | by (metis cSup_upper abs_le_D1 assms(1) bounded_real) | 
| 33270 | 2300 | next | 
| 2301 | show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2302 | by (metis cSup_least) | 
| 33270 | 2303 | qed | 
| 2304 | ||
| 2305 | lemma Sup_insert: | |
| 2306 | fixes S :: "real set" | |
| 2307 |   shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))" 
 | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2308 | apply (subst cSup_insert_If) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2309 | apply (rule bounded_has_Sup(1)[of S, rule_format]) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2310 | apply (auto simp: sup_max) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2311 | done | 
| 33270 | 2312 | |
| 2313 | lemma Sup_insert_finite: | |
| 2314 | fixes S :: "real set" | |
| 2315 |   shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
 | |
| 2316 | apply (rule Sup_insert) | |
| 2317 | apply (rule finite_imp_bounded) | |
| 2318 | by simp | |
| 2319 | ||
| 2320 | lemma bounded_has_Inf: | |
| 2321 | fixes S :: "real set" | |
| 2322 |   assumes "bounded S"  "S \<noteq> {}"
 | |
| 2323 | shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b" | |
| 33175 | 2324 | proof | 
| 2325 | fix x assume "x\<in>S" | |
| 2326 | from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto | |
| 33270 | 2327 | thus "x \<ge> Inf S" using `x\<in>S` | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2328 | by (metis cInf_lower_EX abs_le_D2 minus_le_iff) | 
| 33175 | 2329 | next | 
| 33270 | 2330 | show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2331 | by (metis cInf_greatest) | 
| 33270 | 2332 | qed | 
| 2333 | ||
| 2334 | lemma Inf_insert: | |
| 2335 | fixes S :: "real set" | |
| 2336 |   shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" 
 | |
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2337 | apply (subst cInf_insert_if) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2338 | apply (rule bounded_has_Inf(1)[of S, rule_format]) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2339 | apply (auto simp: inf_min) | 
| 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 2340 | done | 
| 50944 | 2341 | |
| 33270 | 2342 | lemma Inf_insert_finite: | 
| 2343 | fixes S :: "real set" | |
| 2344 |   shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
 | |
| 2345 | by (rule Inf_insert, rule finite_imp_bounded, simp) | |
| 2346 | ||
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2347 | subsection {* Compactness *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2348 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2349 | subsubsection {* Bolzano-Weierstrass property *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2350 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2351 | lemma heine_borel_imp_bolzano_weierstrass: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2352 | assumes "compact s" "infinite t" "t \<subseteq> s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2353 | shows "\<exists>x \<in> s. x islimpt t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2354 | proof(rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2355 | assume "\<not> (\<exists>x \<in> s. x islimpt t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2356 | 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)" unfolding islimpt_def | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2357 | using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2358 |   obtain g where g:"g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2359 |     using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]] using f by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2360 | from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2361 |   { fix x y assume "x\<in>t" "y\<in>t" "f x = f y"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2362 | hence "x \<in> f x" "y \<in> f x \<longrightarrow> y = x" using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2363 | hence "x = y" using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2364 | hence "inj_on f t" unfolding inj_on_def by simp | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2365 | hence "infinite (f ` t)" using assms(2) using finite_imageD by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2366 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2367 |   { fix x assume "x\<in>t" "f x \<notin> g"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2368 | from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2369 | then obtain y where "y\<in>s" "h = f y" using g'[THEN bspec[where x=h]] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2370 | hence "y = x" using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2371 | hence False using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2372 | hence "f ` t \<subseteq> g" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2373 | ultimately show False using g(2) using finite_subset by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2374 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2375 | |
| 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 | 2376 | 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 | 2377 | 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 | 2378 | 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 | 2379 | shows "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2380 | proof - | 
| 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 | 2381 | from countable_basis_at_decseq[of l] guess A . note A = this | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2382 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2383 | def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> f j \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2384 |   { 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 | 2385 |     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 | 2386 | 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 | 2387 |     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 | 2388 | 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 | 2389 |     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 | 2390 | 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 | 2391 | 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 | 2392 | by (auto simp: not_le) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2393 | then have "i < s n i" "f (s n i) \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2394 | unfolding s_def by (auto intro: someI2_ex) } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2395 | note s = this | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2396 | def r \<equiv> "nat_rec (s 0 0) s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2397 | have "subseq r" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2398 | by (auto simp: r_def s subseq_Suc_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2399 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2400 | have "(\<lambda>n. f (r n)) ----> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2401 | proof (rule topological_tendstoI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2402 | fix S assume "open S" "l \<in> S" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2403 | with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2404 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2405 |     { fix i assume "Suc 0 \<le> i" then have "f (r i) \<in> A i"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2406 | by (cases i) (simp_all add: r_def s) } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2407 | then have "eventually (\<lambda>i. f (r i) \<in> A i) sequentially" by (auto simp: eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2408 | ultimately show "eventually (\<lambda>i. f (r i) \<in> S) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2409 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2410 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2411 | ultimately show "\<exists>r. subseq r \<and> (f \<circ> r) ----> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2412 | by (auto simp: convergent_def comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2413 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2414 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2415 | lemma sequence_infinite_lemma: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2416 | fixes f :: "nat \<Rightarrow> 'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2417 | assumes "\<forall>n. f n \<noteq> l" and "(f ---> l) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2418 | shows "infinite (range f)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2419 | proof | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2420 | assume "finite (range f)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2421 | hence "closed (range f)" by (rule finite_imp_closed) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2422 | hence "open (- range f)" by (rule open_Compl) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2423 | from assms(1) have "l \<in> - range f" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2424 | from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2425 | using `open (- range f)` `l \<in> - range f` by (rule topological_tendstoD) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2426 | thus False unfolding eventually_sequentially by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2427 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2428 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2429 | lemma closure_insert: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2430 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2431 | shows "closure (insert x s) = insert x (closure s)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2432 | apply (rule closure_unique) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2433 | apply (rule insert_mono [OF closure_subset]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2434 | apply (rule closed_insert [OF closed_closure]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2435 | apply (simp add: closure_minimal) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2436 | done | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2437 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2438 | lemma islimpt_insert: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2439 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2440 | shows "x islimpt (insert a s) \<longleftrightarrow> x islimpt s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2441 | proof | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2442 | assume *: "x islimpt (insert a s)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2443 | show "x islimpt s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2444 | proof (rule islimptI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2445 | fix t assume t: "x \<in> t" "open t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2446 | show "\<exists>y\<in>s. y \<in> t \<and> y \<noteq> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2447 | proof (cases "x = a") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2448 | case True | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2449 | 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 | 2450 | using * t by (rule islimptE) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2451 | with `x = a` show ?thesis by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2452 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2453 | case False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2454 |       with t have t': "x \<in> t - {a}" "open (t - {a})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2455 | by (simp_all add: open_Diff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2456 |       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 | 2457 | using * t' by (rule islimptE) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2458 | thus ?thesis by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2459 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2460 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2461 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2462 | assume "x islimpt s" thus "x islimpt (insert a s)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2463 | by (rule islimpt_subset) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2464 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2465 | |
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2466 | lemma islimpt_finite: | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2467 | fixes x :: "'a::t1_space" | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2468 | shows "finite s \<Longrightarrow> \<not> x islimpt s" | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2469 | by (induct set: finite, simp_all add: islimpt_insert) | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2470 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2471 | lemma islimpt_union_finite: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2472 | fixes x :: "'a::t1_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2473 | shows "finite s \<Longrightarrow> x islimpt (s \<union> t) \<longleftrightarrow> x islimpt t" | 
| 50897 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2474 | by (simp add: islimpt_Un islimpt_finite) | 
| 
078590669527
generalize lemma islimpt_finite to class t1_space
 huffman parents: 
50884diff
changeset | 2475 | |
| 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 | 2476 | 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 | 2477 | 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 | 2478 | 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 | 2479 | proof (safe intro!: islimptI) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2480 | fix U assume "l islimpt S" "l \<in> U" "open U" "finite (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 | 2481 |   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 | 2482 | 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 | 2483 | 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 | 2484 | 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 | 2485 | next | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2486 | fix T assume *: "\<forall>U. l\<in>U \<longrightarrow> open U \<longrightarrow> infinite (U \<inter> S)" "l \<in> T" "open 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 | 2487 |   then have "infinite (T \<inter> S - {l})" 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 | 2488 |   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 | 2489 | 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 | 2490 | 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 | 2491 | 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 | 2492 | 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 | 2493 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2494 | 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 | 2495 |   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 | 2496 | 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 | 2497 | 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 | 2498 | 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 | 2499 | 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 | 2500 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2501 | lemma sequence_unique_limpt: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2502 | fixes f :: "nat \<Rightarrow> 'a::t2_space" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2503 | assumes "(f ---> l) sequentially" and "l' islimpt (range f)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2504 | shows "l' = l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2505 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2506 | assume "l' \<noteq> l" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2507 |   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 | 2508 | using hausdorff [OF `l' \<noteq> l`] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2509 | have "eventually (\<lambda>n. f n \<in> t) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2510 | using assms(1) `open t` `l \<in> t` by (rule topological_tendstoD) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2511 | then obtain N where "\<forall>n\<ge>N. f n \<in> t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2512 | unfolding eventually_sequentially by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2513 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2514 |   have "UNIV = {..<N} \<union> {N..}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2515 |   hence "l' islimpt (f ` ({..<N} \<union> {N..}))" using assms(2) by simp
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2516 |   hence "l' islimpt (f ` {..<N} \<union> f ` {N..})" by (simp add: image_Un)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2517 |   hence "l' islimpt (f ` {N..})" by (simp add: islimpt_union_finite)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2518 |   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 | 2519 | using `l' \<in> s` `open s` by (rule islimptE) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2520 | then obtain n where "N \<le> n" "f n \<in> s" "f n \<noteq> l'" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2521 | with `\<forall>n\<ge>N. f n \<in> t` have "f n \<in> s \<inter> t" by simp | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2522 |   with `s \<inter> t = {}` show False by simp
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2523 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2524 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2525 | lemma bolzano_weierstrass_imp_closed: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2526 |   fixes s :: "'a::{first_countable_topology, t2_space} set"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2527 | 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 | 2528 | shows "closed s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2529 | proof- | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2530 |   { fix x l assume as: "\<forall>n::nat. x n \<in> s" "(x ---> l) sequentially"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2531 | hence "l \<in> s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2532 | proof(cases "\<forall>n. x n \<noteq> l") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2533 | case False thus "l\<in>s" using as(1) by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2534 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2535 | case True note cas = this | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2536 | with as(2) have "infinite (range x)" using sequence_infinite_lemma[of x l] by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2537 | then obtain l' where "l'\<in>s" "l' islimpt (range x)" using assms[THEN spec[where x="range x"]] as(1) by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2538 | thus "l\<in>s" using sequence_unique_limpt[of x l l'] using as cas by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2539 | qed } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2540 | thus ?thesis unfolding closed_sequential_limits by fast | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2541 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2542 | |
| 50944 | 2543 | lemma compact_imp_bounded: | 
| 2544 | assumes "compact U" shows "bounded U" | |
| 2545 | proof - | |
| 2546 | have "compact U" "\<forall>x\<in>U. open (ball x 1)" "U \<subseteq> (\<Union>x\<in>U. ball x 1)" using assms by auto | |
| 2547 | then obtain D where D: "D \<subseteq> U" "finite D" "U \<subseteq> (\<Union>x\<in>D. ball x 1)" | |
| 2548 | by (elim compactE_image) | |
| 50955 | 2549 | from `finite D` have "bounded (\<Union>x\<in>D. ball x 1)" | 
| 2550 | by (simp add: bounded_UN) | |
| 2551 | thus "bounded U" using `U \<subseteq> (\<Union>x\<in>D. ball x 1)` | |
| 2552 | by (rule bounded_subset) | |
| 50944 | 2553 | qed | 
| 2554 | ||
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2555 | text{* In particular, some common special cases. *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2556 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2557 | lemma compact_union [intro]: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2558 | assumes "compact s" "compact t" shows " compact (s \<union> t)" | 
| 50898 | 2559 | proof (rule compactI) | 
| 2560 | fix f assume *: "Ball f open" "s \<union> t \<subseteq> \<Union>f" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2561 | from * `compact s` obtain s' where "s' \<subseteq> f \<and> finite s' \<and> s \<subseteq> \<Union>s'" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2562 | unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) metis | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2563 | moreover from * `compact t` obtain t' where "t' \<subseteq> f \<and> finite t' \<and> t \<subseteq> \<Union>t'" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2564 | unfolding compact_eq_heine_borel by (auto elim!: allE[of _ f]) metis | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2565 | 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 | 2566 | by (auto intro!: exI[of _ "s' \<union> t'"]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2567 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2568 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2569 | 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 | 2570 | by (induct set: finite) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2571 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2572 | lemma compact_UN [intro]: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2573 | "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 | 2574 | unfolding SUP_def by (rule compact_Union) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2575 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2576 | lemma closed_inter_compact [intro]: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2577 | assumes "closed s" and "compact t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2578 | shows "compact (s \<inter> t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2579 | using compact_inter_closed [of t s] assms | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2580 | by (simp add: Int_commute) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2581 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2582 | lemma compact_inter [intro]: | 
| 50898 | 2583 | fixes s t :: "'a :: t2_space set" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2584 | assumes "compact s" and "compact t" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2585 | shows "compact (s \<inter> t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2586 | using assms by (intro compact_inter_closed compact_imp_closed) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2587 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2588 | lemma compact_sing [simp]: "compact {a}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2589 | unfolding compact_eq_heine_borel by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2590 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2591 | lemma compact_insert [simp]: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2592 | assumes "compact s" shows "compact (insert x s)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2593 | proof - | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2594 |   have "compact ({x} \<union> s)"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2595 | using compact_sing assms by (rule compact_union) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2596 | thus ?thesis by simp | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2597 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2598 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2599 | lemma finite_imp_compact: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2600 | shows "finite s \<Longrightarrow> compact s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2601 | by (induct set: finite) simp_all | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2602 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2603 | lemma open_delete: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2604 | fixes s :: "'a::t1_space set" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2605 |   shows "open s \<Longrightarrow> open (s - {x})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2606 | by (simp add: open_Diff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2607 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2608 | text{* Finite intersection property *}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2609 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2610 | lemma inj_setminus: "inj_on uminus (A::'a set set)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2611 | by (auto simp: inj_on_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2612 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2613 | lemma compact_fip: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2614 | "compact U \<longleftrightarrow> | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2615 |     (\<forall>A. (\<forall>a\<in>A. closed a) \<longrightarrow> (\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}) \<longrightarrow> U \<inter> \<Inter>A \<noteq> {})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2616 | (is "_ \<longleftrightarrow> ?R") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2617 | proof (safe intro!: compact_eq_heine_borel[THEN iffD2]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2618 |   fix A assume "compact U" and A: "\<forall>a\<in>A. closed a" "U \<inter> \<Inter>A = {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2619 |     and fi: "\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}"
 | 
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 2620 | from A have "(\<forall>a\<in>uminus`A. open a) \<and> U \<subseteq> \<Union>(uminus`A)" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2621 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2622 | with `compact U` obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<subseteq> \<Union>(uminus`B)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2623 | unfolding compact_eq_heine_borel by (metis subset_image_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2624 | with fi[THEN spec, of B] show False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2625 | by (auto dest: finite_imageD intro: inj_setminus) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2626 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2627 | fix A assume ?R and cover: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2628 |   from cover have "U \<inter> \<Inter>(uminus`A) = {}" "\<forall>a\<in>uminus`A. closed a"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2629 | by auto | 
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 2630 |   with `?R` obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<inter> \<Inter>(uminus`B) = {}"
 | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2631 | by (metis subset_image_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2632 | then show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2633 | by (auto intro!: exI[of _ B] inj_setminus dest: finite_imageD) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2634 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2635 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2636 | lemma compact_imp_fip: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2637 |   "compact s \<Longrightarrow> \<forall>t \<in> f. closed t \<Longrightarrow> \<forall>f'. finite f' \<and> f' \<subseteq> f \<longrightarrow> (s \<inter> (\<Inter> f') \<noteq> {}) \<Longrightarrow>
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2638 |     s \<inter> (\<Inter> f) \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2639 | unfolding compact_fip by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2640 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2641 | text{*Compactness expressed with filters*}
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2642 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2643 | definition "filter_from_subbase B = Abs_filter (\<lambda>P. \<exists>X \<subseteq> B. finite X \<and> Inf X \<le> P)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2644 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2645 | lemma eventually_filter_from_subbase: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2646 | "eventually P (filter_from_subbase B) \<longleftrightarrow> (\<exists>X \<subseteq> B. finite X \<and> Inf X \<le> P)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2647 | (is "_ \<longleftrightarrow> ?R P") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2648 | unfolding filter_from_subbase_def | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2649 | proof (rule eventually_Abs_filter is_filter.intro)+ | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2650 | show "?R (\<lambda>x. True)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2651 |     by (rule exI[of _ "{}"]) (simp add: le_fun_def)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2652 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2653 | fix P Q assume "?R P" then guess X .. | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2654 | moreover assume "?R Q" then guess Y .. | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2655 | ultimately show "?R (\<lambda>x. P x \<and> Q x)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2656 | by (intro exI[of _ "X \<union> Y"]) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2657 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2658 | fix P Q | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2659 | assume "?R P" then guess X .. | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2660 | moreover assume "\<forall>x. P x \<longrightarrow> Q x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2661 | ultimately show "?R Q" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2662 | by (intro exI[of _ X]) auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2663 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2664 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2665 | lemma eventually_filter_from_subbaseI: "P \<in> B \<Longrightarrow> eventually P (filter_from_subbase B)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2666 |   by (subst eventually_filter_from_subbase) (auto intro!: exI[of _ "{P}"])
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2667 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2668 | lemma filter_from_subbase_not_bot: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2669 | "\<forall>X \<subseteq> B. finite X \<longrightarrow> Inf X \<noteq> bot \<Longrightarrow> filter_from_subbase B \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2670 | unfolding trivial_limit_def eventually_filter_from_subbase by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2671 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2672 | lemma closure_iff_nhds_not_empty: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2673 |   "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 | 2674 | proof safe | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2675 | assume x: "x \<in> closure X" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2676 |   fix S A assume "open S" "x \<in> S" "X \<inter> A = {}" "S \<subseteq> A"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2677 | then have "x \<notin> closure (-S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2678 | by (auto simp: closure_complement subset_eq[symmetric] intro: interiorI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2679 | with x have "x \<in> closure X - closure (-S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2680 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2681 | also have "\<dots> \<subseteq> closure (X \<inter> S)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2682 | 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 | 2683 |   finally have "X \<inter> S \<noteq> {}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2684 |   then show False using `X \<inter> A = {}` `S \<subseteq> A` by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2685 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2686 |   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 | 2687 | from this[THEN spec, of "- X", THEN spec, of "- closure X"] | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2688 | show "x \<in> closure X" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2689 | by (simp add: closure_subset open_Compl) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2690 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2691 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2692 | lemma compact_filter: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2693 | "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 | 2694 | proof (intro allI iffI impI compact_fip[THEN iffD2] notI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2695 | fix F assume "compact U" and F: "F \<noteq> bot" "eventually (\<lambda>x. x \<in> U) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2696 |   from F have "U \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2697 | by (auto simp: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2698 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2699 |   def Z \<equiv> "closure ` {A. eventually (\<lambda>x. x \<in> A) F}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2700 | then have "\<forall>z\<in>Z. closed z" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2701 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2702 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2703 | 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 | 2704 | 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 | 2705 |   have "(\<forall>B \<subseteq> Z. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2706 | proof (intro allI impI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2707 | fix B assume "finite B" "B \<subseteq> Z" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2708 | 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 | 2709 | by (auto intro!: eventually_Ball_finite) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2710 | 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 | 2711 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2712 |     with F show "U \<inter> \<Inter>B \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2713 | by (intro notI) (simp add: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2714 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2715 |   ultimately have "U \<inter> \<Inter>Z \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2716 | using `compact U` unfolding compact_fip by blast | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2717 | then obtain x where "x \<in> U" and x: "\<And>z. z \<in> Z \<Longrightarrow> x \<in> z" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2718 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2719 | have "\<And>P. eventually P (inf (nhds x) F) \<Longrightarrow> P \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2720 | unfolding eventually_inf eventually_nhds | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2721 | proof safe | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2722 | fix P Q R S | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2723 | assume "eventually R F" "open S" "x \<in> S" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2724 |     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 | 2725 |     have "S \<inter> {x. R x} \<noteq> {}" by (auto simp: Z_def)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2726 | 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 | 2727 | ultimately show False by (auto simp: set_eq_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2728 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2729 | 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 | 2730 | by (metis eventually_bot) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2731 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2732 |   fix A assume A: "\<forall>a\<in>A. closed a" "\<forall>B\<subseteq>A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}" "U \<inter> \<Inter>A = {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2733 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2734 | def P' \<equiv> "(\<lambda>a (x::'a). x \<in> a)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2735 | then have inj_P': "\<And>A. inj_on P' A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2736 | by (auto intro!: inj_onI simp: fun_eq_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2737 | def F \<equiv> "filter_from_subbase (P' ` insert U A)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2738 | have "F \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2739 | unfolding F_def | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2740 | proof (safe intro!: filter_from_subbase_not_bot) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2741 | fix X assume "X \<subseteq> P' ` insert U A" "finite X" "Inf X = bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2742 | then obtain B where "B \<subseteq> insert U A" "finite B" and B: "Inf (P' ` B) = bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2743 | unfolding subset_image_iff by (auto intro: inj_P' finite_imageD) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2744 |     with A(2)[THEN spec, of "B - {U}"] have "U \<inter> \<Inter>(B - {U}) \<noteq> {}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2745 | with B show False by (auto simp: P'_def fun_eq_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2746 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2747 | moreover have "eventually (\<lambda>x. x \<in> U) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2748 | unfolding F_def by (rule eventually_filter_from_subbaseI) (auto simp: P'_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2749 | moreover 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)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2750 | 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 | 2751 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2752 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2753 |   { fix V assume "V \<in> A"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2754 | then have V: "eventually (\<lambda>x. x \<in> V) F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2755 | by (auto simp add: F_def image_iff P'_def intro!: eventually_filter_from_subbaseI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2756 | have "x \<in> closure V" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2757 | unfolding closure_iff_nhds_not_empty | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2758 | proof (intro impI allI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2759 | fix S A assume "open S" "x \<in> S" "S \<subseteq> A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2760 | then have "eventually (\<lambda>x. x \<in> A) (nhds x)" by (auto simp: eventually_nhds) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2761 | 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 | 2762 | by (auto simp: eventually_inf) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2763 |       with x show "V \<inter> A \<noteq> {}"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2764 | by (auto simp del: Int_iff simp add: trivial_limit_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2765 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2766 | then have "x \<in> V" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2767 | using `V \<in> A` A(1) by simp } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2768 | with `x\<in>U` have "x \<in> U \<inter> \<Inter>A" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2769 |   with `U \<inter> \<Inter>A = {}` show False by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2770 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2771 | |
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2772 | definition "countably_compact U \<longleftrightarrow> | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2773 | (\<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 | 2774 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2775 | lemma countably_compactE: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2776 | 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 | 2777 | 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 | 2778 | 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 | 2779 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2780 | lemma countably_compactI: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2781 | 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 | 2782 | shows "countably_compact s" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2783 | 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 | 2784 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2785 | 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 | 2786 | 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 | 2787 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2788 | lemma countably_compact_imp_compact: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2789 | assumes "countably_compact U" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2790 | assumes ccover: "countable B" "\<forall>b\<in>B. open b" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2791 | assumes 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" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2792 | shows "compact U" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2793 | using `countably_compact U` unfolding compact_eq_heine_borel countably_compact_def | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2794 | proof safe | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2795 | fix A assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2796 | 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 | 2797 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2798 |   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 | 2799 | 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 | 2800 | unfolding C_def using ccover by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2801 | moreover | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2802 | have "\<Union>A \<inter> U \<subseteq> \<Union>C" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2803 | proof safe | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2804 | fix x a assume "x \<in> U" "x \<in> a" "a \<in> A" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2805 | with basis[of a x] A obtain b where "b \<in> B" "x \<in> b" "b \<inter> U \<subseteq> a" by blast | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2806 | with `a \<in> A` show "x \<in> \<Union>C" unfolding C_def | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2807 | by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2808 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2809 | then have "U \<subseteq> \<Union>C" using `U \<subseteq> \<Union>A` by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2810 | ultimately obtain T where "T\<subseteq>C" "finite T" "U \<subseteq> \<Union>T" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2811 | using * by metis | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2812 | moreover 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 | 2813 | by (auto simp: C_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2814 | then guess f unfolding bchoice_iff Bex_def .. | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2815 | ultimately show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2816 | 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 | 2817 | qed | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2818 | |
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2819 | lemma countably_compact_imp_compact_second_countable: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2820 | "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 | 2821 | proof (rule countably_compact_imp_compact) | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2822 | fix T and x :: 'a assume "open T" "x \<in> T" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2823 | from topological_basisE[OF is_basis this] guess b . | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2824 | then show "\<exists>b\<in>SOME B. countable B \<and> topological_basis B. x \<in> b \<and> b \<inter> U \<subseteq> T" by auto | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2825 | qed (insert countable_basis topological_basis_open[OF is_basis], auto) | 
| 36437 | 2826 | |
| 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 | 2827 | 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 | 2828 | "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 | 2829 | using countably_compact_imp_compact_second_countable compact_imp_countably_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 | 2830 | |
| 36437 | 2831 | subsubsection{* Sequential compactness *}
 | 
| 33175 | 2832 | |
| 2833 | definition | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2834 | seq_compact :: "'a::topological_space set \<Rightarrow> bool" where | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2835 | "seq_compact S \<longleftrightarrow> | 
| 33175 | 2836 | (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> | 
| 2837 | (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))" | |
| 2838 | ||
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2839 | lemma seq_compact_imp_countably_compact: | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2840 | fixes U :: "'a :: first_countable_topology set" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2841 | assumes "seq_compact U" | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2842 | shows "countably_compact U" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2843 | proof (safe intro!: countably_compactI) | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2844 | fix A assume A: "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A" "countable A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2845 | 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 | 2846 | using `seq_compact U` by (fastforce simp: seq_compact_def subset_eq) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2847 | show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2848 | proof cases | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2849 | assume "finite A" with A show ?thesis by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2850 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2851 | assume "infinite A" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2852 |     then have "A \<noteq> {}" by auto
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2853 | show ?thesis | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2854 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2855 | assume "\<not> (\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2856 | then have "\<forall>T. \<exists>x. T \<subseteq> A \<and> finite T \<longrightarrow> (x \<in> U - \<Union>T)" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2857 | then obtain X' where T: "\<And>T. T \<subseteq> A \<Longrightarrow> finite T \<Longrightarrow> X' T \<in> U - \<Union>T" by metis | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2858 |       def X \<equiv> "\<lambda>n. X' (from_nat_into A ` {.. n})"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2859 | 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 | 2860 |         using `A \<noteq> {}` unfolding X_def SUP_def by (intro T) (auto intro: from_nat_into)
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2861 | then have "range X \<subseteq> U" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2862 | with subseq[of X] obtain r x where "x \<in> U" and r: "subseq r" "(X \<circ> r) ----> x" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2863 | 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 | 2864 | obtain n where "x \<in> from_nat_into A n" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2865 |       with r(2) A(1) from_nat_into[OF `A \<noteq> {}`, of n]
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2866 | 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 | 2867 | unfolding tendsto_def by (auto simp: comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2868 | 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 | 2869 | by (auto simp: eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2870 | 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 | 2871 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2872 | 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 | 2873 | by (auto intro!: exI[of _ "max n N"]) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2874 | ultimately show False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2875 | by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2876 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2877 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2878 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2879 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2880 | lemma compact_imp_seq_compact: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2881 | fixes U :: "'a :: first_countable_topology set" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2882 | assumes "compact U" shows "seq_compact U" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2883 | unfolding seq_compact_def | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2884 | proof safe | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2885 | fix X :: "nat \<Rightarrow> 'a" assume "\<forall>n. X n \<in> U" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2886 | then have "eventually (\<lambda>x. x \<in> U) (filtermap X sequentially)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2887 | by (auto simp: eventually_filtermap) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2888 | moreover have "filtermap X sequentially \<noteq> bot" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2889 | by (simp add: trivial_limit_def eventually_filtermap) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2890 | ultimately obtain x where "x \<in> U" and x: "inf (nhds x) (filtermap X sequentially) \<noteq> bot" (is "?F \<noteq> _") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2891 | using `compact U` by (auto simp: compact_filter) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2892 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2893 | from countable_basis_at_decseq[of x] guess A . note A = this | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2894 | def s \<equiv> "\<lambda>n i. SOME j. i < j \<and> X j \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2895 |   { fix n i
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2896 | have "\<exists>a. i < a \<and> X a \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2897 | proof (rule ccontr) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2898 | assume "\<not> (\<exists>a>i. X a \<in> A (Suc n))" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2899 | then have "\<And>a. Suc i \<le> a \<Longrightarrow> X a \<notin> A (Suc n)" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2900 | then have "eventually (\<lambda>x. x \<notin> A (Suc n)) (filtermap X sequentially)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2901 | by (auto simp: eventually_filtermap eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2902 | moreover have "eventually (\<lambda>x. x \<in> A (Suc n)) (nhds x)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2903 | using A(1,2)[of "Suc n"] by (auto simp: eventually_nhds) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2904 | ultimately have "eventually (\<lambda>x. False) ?F" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2905 | by (auto simp add: eventually_inf) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2906 | with x show False | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2907 | by (simp add: eventually_False) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2908 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2909 | then have "i < s n i" "X (s n i) \<in> A (Suc n)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2910 | unfolding s_def by (auto intro: someI2_ex) } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2911 | note s = this | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2912 | def r \<equiv> "nat_rec (s 0 0) s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2913 | have "subseq r" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2914 | by (auto simp: r_def s subseq_Suc_iff) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2915 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2916 | have "(\<lambda>n. X (r n)) ----> x" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2917 | proof (rule topological_tendstoI) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2918 | fix S assume "open S" "x \<in> S" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2919 | with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2920 | moreover | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2921 |     { fix i assume "Suc 0 \<le> i" then have "X (r i) \<in> A i"
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2922 | by (cases i) (simp_all add: r_def s) } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2923 | then have "eventually (\<lambda>i. X (r i) \<in> A i) sequentially" by (auto simp: eventually_sequentially) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2924 | ultimately show "eventually (\<lambda>i. X (r i) \<in> S) sequentially" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2925 | by eventually_elim auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2926 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2927 | 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 | 2928 | using `x \<in> U` by (auto simp: convergent_def comp_def) | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2929 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2930 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2931 | lemma seq_compactI: | 
| 44075 | 2932 | assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2933 | shows "seq_compact S" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2934 | unfolding seq_compact_def using assms by fast | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2935 | |
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2936 | lemma seq_compactE: | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2937 | assumes "seq_compact S" "\<forall>n. f n \<in> S" | 
| 44075 | 2938 | obtains l r where "l \<in> S" "subseq r" "((f \<circ> r) ---> l) sequentially" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2939 | using assms unfolding seq_compact_def by fast | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2940 | |
| 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 | 2941 | lemma 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 | 2942 | assumes "countably_compact s" "countable t" "infinite t" "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 | 2943 | 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 | 2944 | proof (rule ccontr) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2945 |   def C \<equiv> "(\<lambda>F. interior (F \<union> (- t))) ` {F. finite F \<and> F \<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 | 2946 | note `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 | 2947 | moreover have "\<forall>t\<in>C. open 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 | 2948 | 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 | 2949 | 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 | 2950 | 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 | 2951 | 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 | 2952 | 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 | 2953 | 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 | 2954 | 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 | 2955 | 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 | 2956 | 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 | 2957 | 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 | 2958 | 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 | 2959 | 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 | 2960 | 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 | 2961 | unfolding C_def by (auto intro: countable_Collect_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 | 2962 | ultimately guess D by (rule countably_compactE) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2963 |   then obtain E where E: "E \<subseteq> {F. finite F \<and> F \<subseteq> t }" "finite E" and
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2964 | s: "s \<subseteq> (\<Union>F\<in>E. interior (F \<union> (- 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 | 2965 | 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 | 2966 | 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 | 2967 | 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 | 2968 | 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 | 2969 | using E 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 | 2970 | ultimately show False using `infinite t` by (auto simp: 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 | 2971 | 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 | 2972 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 2973 | 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 | 2974 | fixes s :: "'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 | 2975 | assumes "\<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))" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2976 | shows "seq_compact s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2977 | proof - | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2978 |   { fix f :: "nat \<Rightarrow> 'a" 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 | 2979 | 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 | 2980 | proof (cases "finite (range f)") | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2981 | case True | 
| 50941 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2982 |       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 | 2983 | using pigeonhole_infinite[OF _ True] by auto | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2984 | 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 | 2985 | using infinite_enumerate by blast | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2986 | hence "subseq r \<and> (f \<circ> r) ----> f l" | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2987 | by (simp add: fr tendsto_const o_def) | 
| 
3690724028b1
add countable compacteness; replace finite_range_imp_infinite_repeats by pigeonhole_infinite
 hoelzl parents: 
50940diff
changeset | 2988 | 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 | 2989 | by auto | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2990 | next | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2991 | case False | 
| 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 | 2992 | with f assms have "\<exists>x\<in>s. \<forall>U. x\<in>U \<and> open U \<longrightarrow> infinite (U \<inter> range 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 | 2993 | 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 | 2994 | 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 | 2995 | 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 | 2996 | 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 | 2997 | qed | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2998 | } | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 2999 | thus ?thesis unfolding seq_compact_def by auto | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3000 | qed | 
| 44075 | 3001 | |
| 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 | 3002 | 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 | 3003 | 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 | 3004 | 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 | 3005 | 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 | 3006 | 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 | 3007 | 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 | 3008 | 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 | 3009 | 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 | 3010 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3011 | 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 | 3012 | fixes s :: "'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 | 3013 | shows "seq_compact s \<longleftrightarrow> (\<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)))" | 
| 
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 | 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 | 3015 | 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 | 3016 | 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 | 3017 | 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 | 3018 | 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 | 3019 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3020 | 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 | 3021 | 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 | 3022 | 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 | 3023 | 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 | 3024 | |
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3025 | 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 | 3026 |   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 | 3027 | 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 | 3028 | 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 | 3029 | |
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3030 | subsubsection{* Total boundedness *}
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3031 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3032 | lemma cauchy_def: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3033 | "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 3034 | unfolding Cauchy_def by metis | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3035 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3036 | fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3037 | "helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3038 | declare helper_1.simps[simp del] | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3039 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3040 | lemma seq_compact_imp_totally_bounded: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3041 | assumes "seq_compact s" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3042 | shows "\<forall>e>0. \<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k))" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3043 | proof(rule, rule, rule ccontr) | 
| 52141 
eff000cab70f
weaker precendence of syntax for big intersection and union on sets
 haftmann parents: 
51773diff
changeset | 3044 | fix e::real assume "e>0" and assm:"\<not> (\<exists>k. finite k \<and> k \<subseteq> s \<and> s \<subseteq> \<Union>((\<lambda>x. ball x e) ` k))" | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3045 | def x \<equiv> "helper_1 s e" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3046 |   { fix n
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3047 | have "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3048 | proof(induct_tac rule:nat_less_induct) | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3049 | fix n def Q \<equiv> "(\<lambda>y. y \<in> s \<and> (\<forall>m<n. \<not> dist (x m) y < e))" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3050 | assume as:"\<forall>m<n. x m \<in> s \<and> (\<forall>ma<m. \<not> dist (x ma) (x m) < e)" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3051 |       have "\<not> s \<subseteq> (\<Union>x\<in>x ` {0..<n}. ball x e)" using assm apply simp apply(erule_tac x="x ` {0 ..< n}" in allE) using as by auto
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3052 |       then obtain z where z:"z\<in>s" "z \<notin> (\<Union>x\<in>x ` {0..<n}. ball x e)" unfolding subset_eq by auto
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3053 | have "Q (x n)" unfolding x_def and helper_1.simps[of s e n] | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3054 | apply(rule someI2[where a=z]) unfolding x_def[symmetric] and Q_def using z by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3055 | thus "x n \<in> s \<and> (\<forall>m<n. \<not> dist (x m) (x n) < e)" unfolding Q_def by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3056 | qed } | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3057 | hence "\<forall>n::nat. x n \<in> s" and x:"\<forall>n. \<forall>m < n. \<not> (dist (x m) (x n) < e)" by blast+ | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3058 | then obtain l r where "l\<in>s" and r:"subseq r" and "((x \<circ> r) ---> l) sequentially" using assms(1)[unfolded seq_compact_def, THEN spec[where x=x]] by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3059 | from this(3) have "Cauchy (x \<circ> r)" using LIMSEQ_imp_Cauchy by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3060 | then obtain N::nat where N:"\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist ((x \<circ> r) m) ((x \<circ> r) n) < e" unfolding cauchy_def using `e>0` by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3061 | show False | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3062 | using N[THEN spec[where x=N], THEN spec[where x="N+1"]] | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3063 | using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]] | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3064 | using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3065 | qed | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3066 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3067 | subsubsection{* Heine-Borel theorem *}
 | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3068 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3069 | lemma seq_compact_imp_heine_borel: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3070 | fixes s :: "'a :: metric_space set" | 
| 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 | 3071 | assumes "seq_compact s" shows "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 | 3072 | 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 | 3073 | from seq_compact_imp_totally_bounded[OF `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 | 3074 | guess f unfolding choice_iff' .. note f = this | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3075 |   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 | 3076 | 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 | 3077 | 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 | 3078 | 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 | 3079 | 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 | 3080 | 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 | 3081 | 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 | 3082 | 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 | 3083 | 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 | 3084 | 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 | 3085 | next | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3086 | fix T x assume T: "open T" "x \<in> T" and x: "x \<in> 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 | 3087 | from openE[OF T] obtain e where "0 < e" "ball x e \<subseteq> T" 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 | 3088 | then have "0 < e / 2" "ball x (e / 2) \<subseteq> T" 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 | 3089 | from Rats_dense_in_real[OF `0 < e / 2`] obtain r where "r \<in> \<rat>" "0 < r" "r < e / 2" 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 | 3090 | 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 | 3091 | unfolding Union_image_eq 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 | 3092 | from `r \<in> \<rat>` `0 < r` `k \<in> f r` have "ball k r \<in> K" 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 | 3093 | 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 | 3094 | proof (rule bexI[rotated], safe) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 3095 | fix y assume "y \<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 | 3096 | 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 | 3097 | by (intro dist_double[where x = k and d=e]) (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 | 3098 | with `ball x e \<subseteq> T` show "y \<in> T" 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 | 3099 | qed (rule `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 | 3100 | qed | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3101 | qed | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3102 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3103 | lemma compact_eq_seq_compact_metric: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3104 | "compact (s :: 'a::metric_space set) \<longleftrightarrow> seq_compact s" | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3105 | using compact_imp_seq_compact seq_compact_imp_heine_borel by blast | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3106 | |
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3107 | lemma compact_def: | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3108 | "compact (S :: 'a::metric_space set) \<longleftrightarrow> | 
| 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 | 3109 | (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> (f o r) ----> l))" | 
| 50940 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3110 | unfolding compact_eq_seq_compact_metric seq_compact_def by auto | 
| 
a7c273a83d27
group compactness-eq-seq-compactness lemmas together
 hoelzl parents: 
50939diff
changeset | 3111 | |
| 50944 | 3112 | subsubsection {* Complete the chain of compactness variants *}
 | 
| 3113 | ||
| 3114 | lemma compact_eq_bolzano_weierstrass: | |
| 3115 | fixes s :: "'a::metric_space set" | |
| 3116 | shows "compact s \<longleftrightarrow> (\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t))" (is "?lhs = ?rhs") | |
| 3117 | proof | |
| 3118 | assume ?lhs thus ?rhs using heine_borel_imp_bolzano_weierstrass[of s] by auto | |
| 3119 | next | |
| 3120 | assume ?rhs thus ?lhs | |
| 3121 | unfolding compact_eq_seq_compact_metric by (rule bolzano_weierstrass_imp_seq_compact) | |
| 3122 | qed | |
| 3123 | ||
| 3124 | lemma bolzano_weierstrass_imp_bounded: | |
| 3125 | "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t) \<Longrightarrow> bounded s" | |
| 3126 | using compact_imp_bounded unfolding compact_eq_bolzano_weierstrass . | |
| 3127 | ||
| 33175 | 3128 | text {*
 | 
| 3129 | A metric space (or topological vector space) is said to have the | |
| 3130 | Heine-Borel property if every closed and bounded subset is compact. | |
| 3131 | *} | |
| 3132 | ||
| 44207 
ea99698c2070
locale-ize some definitions, so perfect_space and heine_borel can inherit from the proper superclasses
 huffman parents: 
44170diff
changeset | 3133 | class heine_borel = metric_space + | 
| 33175 | 3134 | assumes bounded_imp_convergent_subsequence: | 
| 50998 | 3135 | "bounded (range f) \<Longrightarrow> \<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | 
| 33175 | 3136 | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3137 | lemma bounded_closed_imp_seq_compact: | 
| 33175 | 3138 | fixes s::"'a::heine_borel set" | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3139 | assumes "bounded s" and "closed s" shows "seq_compact s" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3140 | proof (unfold seq_compact_def, clarify) | 
| 33175 | 3141 | fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s" | 
| 50998 | 3142 | with `bounded s` have "bounded (range f)" by (auto intro: bounded_subset) | 
| 33175 | 3143 | obtain l r where r: "subseq r" and l: "((f \<circ> r) ---> l) sequentially" | 
| 50998 | 3144 | using bounded_imp_convergent_subsequence [OF `bounded (range f)`] by auto | 
| 33175 | 3145 | from f have fr: "\<forall>n. (f \<circ> r) n \<in> s" by simp | 
| 3146 | have "l \<in> s" using `closed s` fr l | |
| 3147 | unfolding closed_sequential_limits by blast | |
| 3148 | show "\<exists>l\<in>s. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | |
| 3149 | using `l \<in> s` r l by blast | |
| 3150 | qed | |
| 3151 | ||
| 50944 | 3152 | lemma compact_eq_bounded_closed: | 
| 3153 | fixes s :: "'a::heine_borel set" | |
| 3154 | shows "compact s \<longleftrightarrow> bounded s \<and> closed s" (is "?lhs = ?rhs") | |
| 3155 | proof | |
| 3156 | assume ?lhs thus ?rhs | |
| 3157 | using compact_imp_closed compact_imp_bounded by blast | |
| 3158 | next | |
| 3159 | assume ?rhs thus ?lhs | |
| 3160 | using bounded_closed_imp_seq_compact[of s] unfolding compact_eq_seq_compact_metric by auto | |
| 3161 | qed | |
| 3162 | ||
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 3163 | (* TODO: is this lemma necessary? *) | 
| 50972 | 3164 | lemma bounded_increasing_convergent: | 
| 3165 | fixes s :: "nat \<Rightarrow> real" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 3166 |   shows "bounded {s n| n. True} \<Longrightarrow> \<forall>n. s n \<le> s (Suc n) \<Longrightarrow> \<exists>l. s ----> l"
 | 
| 50972 | 3167 | using Bseq_mono_convergent[of s] incseq_Suc_iff[of s] | 
| 3168 | by (auto simp: image_def Bseq_eq_bounded convergent_def incseq_def) | |
| 33175 | 3169 | |
| 3170 | instance real :: heine_borel | |
| 3171 | proof | |
| 50998 | 3172 | fix f :: "nat \<Rightarrow> real" | 
| 3173 | assume f: "bounded (range f)" | |
| 50972 | 3174 | obtain r where r: "subseq r" "monoseq (f \<circ> r)" | 
| 3175 | unfolding comp_def by (metis seq_monosub) | |
| 3176 | moreover | |
| 3177 | then have "Bseq (f \<circ> r)" | |
| 50998 | 3178 | unfolding Bseq_eq_bounded using f by (auto intro: bounded_subset) | 
| 50972 | 3179 | ultimately show "\<exists>l r. subseq r \<and> (f \<circ> r) ----> l" | 
| 3180 | using Bseq_monoseq_convergent[of "f \<circ> r"] by (auto simp: convergent_def) | |
| 33175 | 3181 | qed | 
| 3182 | ||
| 3183 | 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 | 3184 | fixes f :: "nat \<Rightarrow> 'a::euclidean_space" | 
| 50998 | 3185 | assumes "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 | 3186 | shows "\<forall>d\<subseteq>Basis. \<exists>l::'a. \<exists> r. subseq r \<and> | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3187 | (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3188 | proof safe | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3189 | fix d :: "'a set" assume d: "d \<subseteq> Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3190 | with finite_Basis have "finite d" by (blast intro: finite_subset) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3191 | from this d show "\<exists>l::'a. \<exists>r. subseq r \<and> | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3192 | (\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially)" | 
| 33175 | 3193 | proof(induct d) case empty thus ?case unfolding subseq_def 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 | 3194 | next case (insert k d) have k[intro]:"k\<in>Basis" using insert by auto | 
| 50998 | 3195 | have s': "bounded ((\<lambda>x. x \<bullet> k) ` range f)" 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 | 3196 | by (auto intro!: bounded_linear_image bounded_linear_inner_left) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3197 | obtain l1::"'a" and r1 where r1:"subseq r1" and | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3198 | 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 | 3199 | using insert(3) using insert(4) by auto | 
| 50998 | 3200 | have f': "\<forall>n. f (r1 n) \<bullet> k \<in> (\<lambda>x. x \<bullet> k) ` range f" by simp | 
| 3201 | have "bounded (range (\<lambda>i. f (r1 i) \<bullet> k))" | |
| 3202 | by (metis (lifting) bounded_subset f' image_subsetI s') | |
| 3203 | then obtain l2 r2 where r2:"subseq r2" and lr2:"((\<lambda>i. f (r1 (r2 i)) \<bullet> k) ---> l2) sequentially" | |
| 3204 | using bounded_imp_convergent_subsequence[of "\<lambda>i. f (r1 i) \<bullet> k"] by (auto simp: o_def) | |
| 33175 | 3205 | def r \<equiv> "r1 \<circ> r2" have r:"subseq r" | 
| 3206 | using r1 and r2 unfolding r_def o_def subseq_def by auto | |
| 3207 | 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 | 3208 | def l \<equiv> "(\<Sum>i\<in>Basis. (if i = k then l2 else l1\<bullet>i) *\<^sub>R i)::'a" | 
| 33175 | 3209 |     { fix e::real assume "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 | 3210 | from lr1 `e>0` have N1:"eventually (\<lambda>n. \<forall>i\<in>d. dist (f (r1 n) \<bullet> i) (l1 \<bullet> i) < e) sequentially" 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 | 3211 | from lr2 `e>0` have N2:"eventually (\<lambda>n. dist (f (r1 (r2 n)) \<bullet> k) l2 < e) sequentially" by (rule tendstoD) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3212 | 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 | 3213 | 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 | 3214 | have "eventually (\<lambda>n. \<forall>i\<in>(insert k d). dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3215 | using N1' N2 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3216 | by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def) | 
| 33175 | 3217 | } | 
| 3218 | ultimately show ?case by auto | |
| 3219 | qed | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3220 | qed | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3221 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3222 | instance euclidean_space \<subseteq> heine_borel | 
| 33175 | 3223 | proof | 
| 50998 | 3224 | fix f :: "nat \<Rightarrow> 'a" | 
| 3225 | 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 | 3226 | 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 | 3227 | and l: "\<forall>e>0. eventually (\<lambda>n. \<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e) sequentially" | 
| 50998 | 3228 | using compact_lemma [OF f] by blast | 
| 33175 | 3229 |   { fix e::real assume "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 | 3230 |     hence "0 < e / real_of_nat DIM('a)" by (auto intro!: divide_pos_pos DIM_positive)
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3231 |     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 | 3232 | by simp | 
| 3233 | 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 | 3234 |     { fix n assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3235 | have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))" | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3236 | apply(subst euclidean_dist_l2) using zero_le_dist by (rule setL2_le_setsum) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3237 |       also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 3238 | apply(rule setsum_strict_mono) using n 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 | 3239 | finally have "dist (f (r n)) l < e" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 3240 | by auto | 
| 33175 | 3241 | } | 
| 3242 | ultimately have "eventually (\<lambda>n. dist (f (r n)) l < e) sequentially" | |
| 3243 | by (rule eventually_elim1) | |
| 3244 | } | |
| 3245 | hence *:"((f \<circ> r) ---> l) sequentially" unfolding o_def tendsto_iff by simp | |
| 3246 | with r show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" by auto | |
| 3247 | qed | |
| 3248 | ||
| 3249 | lemma bounded_fst: "bounded s \<Longrightarrow> bounded (fst ` s)" | |
| 3250 | unfolding bounded_def | |
| 3251 | apply clarify | |
| 3252 | apply (rule_tac x="a" in exI) | |
| 3253 | apply (rule_tac x="e" in exI) | |
| 3254 | apply clarsimp | |
| 3255 | apply (drule (1) bspec) | |
| 3256 | apply (simp add: dist_Pair_Pair) | |
| 3257 | apply (erule order_trans [OF real_sqrt_sum_squares_ge1]) | |
| 3258 | done | |
| 3259 | ||
| 3260 | lemma bounded_snd: "bounded s \<Longrightarrow> bounded (snd ` s)" | |
| 3261 | unfolding bounded_def | |
| 3262 | apply clarify | |
| 3263 | apply (rule_tac x="b" in exI) | |
| 3264 | apply (rule_tac x="e" in exI) | |
| 3265 | apply clarsimp | |
| 3266 | apply (drule (1) bspec) | |
| 3267 | apply (simp add: dist_Pair_Pair) | |
| 3268 | apply (erule order_trans [OF real_sqrt_sum_squares_ge2]) | |
| 3269 | done | |
| 3270 | ||
| 37678 
0040bafffdef
"prod" and "sum" replace "*" and "+" respectively
 haftmann parents: 
37649diff
changeset | 3271 | instance prod :: (heine_borel, heine_borel) heine_borel | 
| 33175 | 3272 | proof | 
| 50998 | 3273 | fix f :: "nat \<Rightarrow> 'a \<times> 'b" | 
| 3274 | assume f: "bounded (range f)" | |
| 3275 | from f have s1: "bounded (range (fst \<circ> f))" unfolding image_comp by (rule bounded_fst) | |
| 3276 | obtain l1 r1 where r1: "subseq r1" and l1: "(\<lambda>n. fst (f (r1 n))) ----> l1" | |
| 3277 | using bounded_imp_convergent_subsequence [OF s1] unfolding o_def by fast | |
| 3278 | from f have s2: "bounded (range (snd \<circ> f \<circ> r1))" | |
| 3279 | by (auto simp add: image_comp intro: bounded_snd bounded_subset) | |
| 33175 | 3280 | obtain l2 r2 where r2: "subseq r2" | 
| 3281 | and l2: "((\<lambda>n. snd (f (r1 (r2 n)))) ---> l2) sequentially" | |
| 50998 | 3282 | using bounded_imp_convergent_subsequence [OF s2] | 
| 33175 | 3283 | unfolding o_def by fast | 
| 3284 | have l1': "((\<lambda>n. fst (f (r1 (r2 n)))) ---> l1) sequentially" | |
| 50972 | 3285 | using LIMSEQ_subseq_LIMSEQ [OF l1 r2] unfolding o_def . | 
| 33175 | 3286 | have l: "((f \<circ> (r1 \<circ> r2)) ---> (l1, l2)) sequentially" | 
| 3287 | using tendsto_Pair [OF l1' l2] unfolding o_def by simp | |
| 3288 | have r: "subseq (r1 \<circ> r2)" | |
| 3289 | using r1 r2 unfolding subseq_def by simp | |
| 3290 | show "\<exists>l r. subseq r \<and> ((f \<circ> r) ---> l) sequentially" | |
| 3291 | using l r by fast | |
| 3292 | qed | |
| 3293 | ||
| 36437 | 3294 | subsubsection{* Completeness *}
 | 
| 33175 | 3295 | |
| 50971 | 3296 | definition complete :: "'a::metric_space set \<Rightarrow> bool" where | 
| 3297 | "complete s \<longleftrightarrow> (\<forall>f. (\<forall>n. f n \<in> s) \<and> Cauchy f \<longrightarrow> (\<exists>l\<in>s. f ----> l))" | |
| 3298 | ||
| 3299 | lemma compact_imp_complete: assumes "compact s" shows "complete s" | |
| 3300 | proof- | |
| 3301 |   { fix f assume as: "(\<forall>n::nat. f n \<in> s)" "Cauchy f"
 | |
| 3302 | from as(1) obtain l r where lr: "l\<in>s" "subseq r" "(f \<circ> r) ----> l" | |
| 3303 | using assms unfolding compact_def by blast | |
| 3304 | ||
| 3305 | note lr' = seq_suble [OF lr(2)] | |
| 3306 | ||
| 3307 |     { fix e::real assume "e>0"
 | |
| 3308 | 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" unfolding cauchy_def using `e>0` apply (erule_tac x="e/2" in allE) by auto | |
| 3309 | from lr(3)[unfolded LIMSEQ_def, THEN spec[where x="e/2"]] obtain M where M:"\<forall>n\<ge>M. dist ((f \<circ> r) n) l < e/2" using `e>0` by auto | |
| 3310 |       { fix n::nat assume n:"n \<ge> max N M"
 | |
| 3311 | have "dist ((f \<circ> r) n) l < e/2" using n M by auto | |
| 3312 | moreover have "r n \<ge> N" using lr'[of n] n by auto | |
| 3313 | hence "dist (f n) ((f \<circ> r) n) < e / 2" using N using n by auto | |
| 3314 | ultimately have "dist (f n) l < e" using dist_triangle_half_r[of "f (r n)" "f n" e l] by (auto simp add: dist_commute) } | |
| 3315 | hence "\<exists>N. \<forall>n\<ge>N. dist (f n) l < e" by blast } | |
| 3316 | hence "\<exists>l\<in>s. (f ---> l) sequentially" using `l\<in>s` unfolding LIMSEQ_def by auto } | |
| 3317 | thus ?thesis unfolding complete_def by auto | |
| 3318 | qed | |
| 3319 | ||
| 3320 | lemma nat_approx_posE: | |
| 3321 | fixes e::real | |
| 3322 | assumes "0 < e" | |
| 3323 | obtains n::nat where "1 / (Suc n) < e" | |
| 3324 | proof atomize_elim | |
| 3325 | have " 1 / real (Suc (nat (ceiling (1/e)))) < 1 / (ceiling (1/e))" | |
| 3326 | by (rule divide_strict_left_mono) (auto intro!: mult_pos_pos simp: `0 < e`) | |
| 3327 | also have "1 / (ceiling (1/e)) \<le> 1 / (1/e)" | |
| 3328 | by (rule divide_left_mono) (auto intro!: divide_pos_pos simp: `0 < e`) | |
| 3329 | also have "\<dots> = e" by simp | |
| 3330 | finally show "\<exists>n. 1 / real (Suc n) < e" .. | |
| 3331 | qed | |
| 3332 | ||
| 3333 | lemma compact_eq_totally_bounded: | |
| 3334 | "compact s \<longleftrightarrow> complete s \<and> (\<forall>e>0. \<exists>k. finite k \<and> s \<subseteq> (\<Union>((\<lambda>x. ball x e) ` k)))" | |
| 3335 | (is "_ \<longleftrightarrow> ?rhs") | |
| 3336 | proof | |
| 3337 | assume assms: "?rhs" | |
| 3338 | 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)" | |
| 3339 | by (auto simp: choice_iff') | |
| 3340 | ||
| 3341 | show "compact s" | |
| 3342 | proof cases | |
| 3343 |     assume "s = {}" thus "compact s" by (simp add: compact_def)
 | |
| 3344 | next | |
| 3345 |     assume "s \<noteq> {}"
 | |
| 3346 | show ?thesis | |
| 3347 | unfolding compact_def | |
| 3348 | proof safe | |
| 3349 | fix f :: "nat \<Rightarrow> 'a" assume f: "\<forall>n. f n \<in> s" | |
| 3350 | ||
| 3351 | def e \<equiv> "\<lambda>n. 1 / (2 * Suc n)" | |
| 3352 | then have [simp]: "\<And>n. 0 < e n" by auto | |
| 3353 |       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)"
 | |
| 3354 |       { fix n U assume "infinite {n. f n \<in> U}"
 | |
| 3355 |         then have "\<exists>b\<in>k (e n). infinite {i\<in>{n. f n \<in> U}. f i \<in> ball b (e n)}"
 | |
| 3356 | using k f by (intro pigeonhole_infinite_rel) (auto simp: subset_eq) | |
| 3357 | then guess a .. | |
| 3358 |         then have "\<exists>b. infinite {i. f i \<in> b} \<and> (\<exists>x. b \<subseteq> ball x (e n) \<inter> U)"
 | |
| 3359 | by (intro exI[of _ "ball a (e n) \<inter> U"] exI[of _ a]) (auto simp: ac_simps) | |
| 3360 | from someI_ex[OF this] | |
| 3361 |         have "infinite {i. f i \<in> B n U}" "\<exists>x. B n U \<subseteq> ball x (e n) \<inter> U"
 | |
| 3362 | unfolding B_def by auto } | |
| 3363 | note B = this | |
| 3364 | ||
| 3365 | def F \<equiv> "nat_rec (B 0 UNIV) B" | |
| 3366 |       { fix n have "infinite {i. f i \<in> F n}"
 | |
| 3367 | by (induct n) (auto simp: F_def B) } | |
| 3368 | then have F: "\<And>n. \<exists>x. F (Suc n) \<subseteq> ball x (e n) \<inter> F n" | |
| 3369 | using B by (simp add: F_def) | |
| 3370 | then have F_dec: "\<And>m n. m \<le> n \<Longrightarrow> F n \<subseteq> F m" | |
| 3371 | using decseq_SucI[of F] by (auto simp: decseq_def) | |
| 3372 | ||
| 3373 | obtain sel where sel: "\<And>k i. i < sel k i" "\<And>k i. f (sel k i) \<in> F k" | |
| 3374 | proof (atomize_elim, unfold all_conj_distrib[symmetric], intro choice allI) | |
| 3375 | fix k i | |
| 3376 |         have "infinite ({n. f n \<in> F k} - {.. i})"
 | |
| 3377 |           using `infinite {n. f n \<in> F k}` by auto
 | |
| 3378 | from infinite_imp_nonempty[OF this] | |
| 3379 | show "\<exists>x>i. f x \<in> F k" | |
| 3380 | by (simp add: set_eq_iff not_le conj_commute) | |
| 3381 | qed | |
| 3382 | ||
| 3383 | def t \<equiv> "nat_rec (sel 0 0) (\<lambda>n i. sel (Suc n) i)" | |
| 3384 | have "subseq t" | |
| 3385 | unfolding subseq_Suc_iff by (simp add: t_def sel) | |
| 3386 | moreover have "\<forall>i. (f \<circ> t) i \<in> s" | |
| 3387 | using f by auto | |
| 3388 | moreover | |
| 3389 |       { fix n have "(f \<circ> t) n \<in> F n"
 | |
| 3390 | by (cases n) (simp_all add: t_def sel) } | |
| 3391 | note t = this | |
| 3392 | ||
| 3393 | have "Cauchy (f \<circ> t)" | |
| 3394 | proof (safe intro!: metric_CauchyI exI elim!: nat_approx_posE) | |
| 3395 | fix r :: real and N n m assume "1 / Suc N < r" "Suc N \<le> n" "Suc N \<le> m" | |
| 3396 | then have "(f \<circ> t) n \<in> F (Suc N)" "(f \<circ> t) m \<in> F (Suc N)" "2 * e N < r" | |
| 3397 | using F_dec t by (auto simp: e_def field_simps real_of_nat_Suc) | |
| 3398 | with F[of N] obtain x where "dist x ((f \<circ> t) n) < e N" "dist x ((f \<circ> t) m) < e N" | |
| 3399 | by (auto simp: subset_eq) | |
| 3400 | with dist_triangle[of "(f \<circ> t) m" "(f \<circ> t) n" x] `2 * e N < r` | |
| 3401 | show "dist ((f \<circ> t) m) ((f \<circ> t) n) < r" | |
| 3402 | by (simp add: dist_commute) | |
| 3403 | qed | |
| 3404 | ||
| 3405 | ultimately show "\<exists>l\<in>s. \<exists>r. subseq r \<and> (f \<circ> r) ----> l" | |
| 3406 | using assms unfolding complete_def by blast | |
| 3407 | qed | |
| 3408 | qed | |
| 3409 | qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded) | |
| 33175 | 3410 | |
| 3411 | lemma cauchy: "Cauchy s \<longleftrightarrow> (\<forall>e>0.\<exists> N::nat. \<forall>n\<ge>N. dist(s n)(s N) < e)" (is "?lhs = ?rhs") | |
| 3412 | proof- | |
| 3413 |   { assume ?rhs
 | |
| 3414 |     { fix e::real
 | |
| 3415 | assume "e>0" | |
| 3416 | with `?rhs` obtain N where N:"\<forall>n\<ge>N. dist (s n) (s N) < e/2" | |
| 3417 | by (erule_tac x="e/2" in allE) auto | |
| 3418 |       { fix n m
 | |
| 3419 | assume nm:"N \<le> m \<and> N \<le> n" | |
| 3420 | hence "dist (s m) (s n) < e" using N | |
| 3421 | using dist_triangle_half_l[of "s m" "s N" "e" "s n"] | |
| 3422 | by blast | |
| 3423 | } | |
| 3424 | hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < e" | |
| 3425 | by blast | |
| 3426 | } | |
| 3427 | hence ?lhs | |
| 3428 | unfolding cauchy_def | |
| 3429 | by blast | |
| 3430 | } | |
| 3431 | thus ?thesis | |
| 3432 | unfolding cauchy_def | |
| 3433 | using dist_triangle_half_l | |
| 3434 | by blast | |
| 3435 | qed | |
| 3436 | ||
| 34104 | 3437 | lemma cauchy_imp_bounded: assumes "Cauchy s" shows "bounded (range s)" | 
| 33175 | 3438 | proof- | 
| 3439 | from assms obtain N::nat where "\<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (s m) (s n) < 1" unfolding cauchy_def apply(erule_tac x= 1 in allE) by auto | |
| 3440 | hence N:"\<forall>n. N \<le> n \<longrightarrow> dist (s N) (s n) < 1" by auto | |
| 3441 | moreover | |
| 3442 |   have "bounded (s ` {0..N})" using finite_imp_bounded[of "s ` {1..N}"] by auto
 | |
| 3443 |   then obtain a where a:"\<forall>x\<in>s ` {0..N}. dist (s N) x \<le> a"
 | |
| 3444 | unfolding bounded_any_center [where a="s N"] by auto | |
| 3445 | ultimately show "?thesis" | |
| 3446 | unfolding bounded_any_center [where a="s N"] | |
| 3447 | apply(rule_tac x="max a 1" in exI) apply auto | |
| 34104 | 3448 | apply(erule_tac x=y in allE) apply(erule_tac x=y in ballE) by auto | 
| 33175 | 3449 | qed | 
| 3450 | ||
| 3451 | instance heine_borel < complete_space | |
| 3452 | proof | |
| 3453 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | |
| 34104 | 3454 | hence "bounded (range f)" | 
| 3455 | by (rule cauchy_imp_bounded) | |
| 50971 | 3456 | hence "compact (closure (range f))" | 
| 3457 | unfolding compact_eq_bounded_closed by auto | |
| 33175 | 3458 | hence "complete (closure (range f))" | 
| 50971 | 3459 | by (rule compact_imp_complete) | 
| 33175 | 3460 | moreover have "\<forall>n. f n \<in> closure (range f)" | 
| 3461 | using closure_subset [of "range f"] by auto | |
| 3462 | ultimately have "\<exists>l\<in>closure (range f). (f ---> l) sequentially" | |
| 3463 | using `Cauchy f` unfolding complete_def by auto | |
| 3464 | then show "convergent f" | |
| 36660 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 huffman parents: 
36659diff
changeset | 3465 | unfolding convergent_def by auto | 
| 33175 | 3466 | qed | 
| 3467 | ||
| 44632 | 3468 | instance euclidean_space \<subseteq> banach .. | 
| 3469 | ||
| 33175 | 3470 | lemma complete_univ: "complete (UNIV :: 'a::complete_space set)" | 
| 3471 | proof(simp add: complete_def, rule, rule) | |
| 3472 | fix f :: "nat \<Rightarrow> 'a" assume "Cauchy f" | |
| 3473 | hence "convergent f" by (rule Cauchy_convergent) | |
| 36660 
1cc4ab4b7ff7
make (X ----> L) an abbreviation for (X ---> L) sequentially
 huffman parents: 
36659diff
changeset | 3474 | thus "\<exists>l. f ----> l" unfolding convergent_def . | 
| 33175 | 3475 | qed | 
| 3476 | ||
| 3477 | lemma complete_imp_closed: assumes "complete s" shows "closed s" | |
| 3478 | proof - | |
| 3479 |   { fix x assume "x islimpt s"
 | |
| 3480 |     then obtain f where f: "\<forall>n. f n \<in> s - {x}" "(f ---> x) sequentially"
 | |
| 3481 | unfolding islimpt_sequential by auto | |
| 3482 | then obtain l where l: "l\<in>s" "(f ---> l) sequentially" | |
| 50939 
ae7cd20ed118
replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
 hoelzl parents: 
50938diff
changeset | 3483 | using `complete s`[unfolded complete_def] using LIMSEQ_imp_Cauchy[of f x] by auto | 
| 41970 | 3484 | hence "x \<in> s" using tendsto_unique[of sequentially f l x] trivial_limit_sequentially f(2) by auto | 
| 33175 | 3485 | } | 
| 3486 | thus "closed s" unfolding closed_limpt by auto | |
| 3487 | qed | |
| 3488 | ||
| 3489 | lemma complete_eq_closed: | |
| 3490 | fixes s :: "'a::complete_space set" | |
| 3491 | shows "complete s \<longleftrightarrow> closed s" (is "?lhs = ?rhs") | |
| 3492 | proof | |
| 3493 | assume ?lhs thus ?rhs by (rule complete_imp_closed) | |
| 3494 | next | |
| 3495 | assume ?rhs | |
| 3496 |   { fix f assume as:"\<forall>n::nat. f n \<in> s" "Cauchy f"
 | |
| 3497 | then obtain l where "(f ---> l) sequentially" using complete_univ[unfolded complete_def, THEN spec[where x=f]] by auto | |
| 3498 | hence "\<exists>l\<in>s. (f ---> l) sequentially" using `?rhs`[unfolded closed_sequential_limits, THEN spec[where x=f], THEN spec[where x=l]] using as(1) by auto } | |
| 3499 | thus ?lhs unfolding complete_def by auto | |
| 3500 | qed | |
| 3501 | ||
| 3502 | lemma convergent_eq_cauchy: | |
| 3503 | fixes s :: "nat \<Rightarrow> 'a::complete_space" | |
| 44632 | 3504 | shows "(\<exists>l. (s ---> l) sequentially) \<longleftrightarrow> Cauchy s" | 
| 3505 | unfolding Cauchy_convergent_iff convergent_def .. | |
| 33175 | 3506 | |
| 3507 | lemma convergent_imp_bounded: | |
| 3508 | fixes s :: "nat \<Rightarrow> 'a::metric_space" | |
| 44632 | 3509 | shows "(s ---> l) sequentially \<Longrightarrow> bounded (range s)" | 
| 50939 
ae7cd20ed118
replace convergent_imp_cauchy by LIMSEQ_imp_Cauchy
 hoelzl parents: 
50938diff
changeset | 3510 | by (intro cauchy_imp_bounded LIMSEQ_imp_Cauchy) | 
| 33175 | 3511 | |
| 3512 | lemma compact_cball[simp]: | |
| 3513 | fixes x :: "'a::heine_borel" | |
| 3514 | shows "compact(cball x e)" | |
| 3515 | using compact_eq_bounded_closed bounded_cball closed_cball | |
| 3516 | by blast | |
| 3517 | ||
| 3518 | lemma compact_frontier_bounded[intro]: | |
| 3519 | fixes s :: "'a::heine_borel set" | |
| 3520 | shows "bounded s ==> compact(frontier s)" | |
| 3521 | unfolding frontier_def | |
| 3522 | using compact_eq_bounded_closed | |
| 3523 | by blast | |
| 3524 | ||
| 3525 | lemma compact_frontier[intro]: | |
| 3526 | fixes s :: "'a::heine_borel set" | |
| 3527 | shows "compact s ==> compact (frontier s)" | |
| 3528 | using compact_eq_bounded_closed compact_frontier_bounded | |
| 3529 | by blast | |
| 3530 | ||
| 3531 | lemma frontier_subset_compact: | |
| 3532 | fixes s :: "'a::heine_borel set" | |
| 3533 | shows "compact s ==> frontier s \<subseteq> s" | |
| 3534 | using frontier_subset_closed compact_eq_bounded_closed | |
| 3535 | by blast | |
| 3536 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 3537 | subsection {* Bounded closed nest property (proof does not use Heine-Borel) *}
 | 
| 33175 | 3538 | |
| 3539 | lemma bounded_closed_nest: | |
| 3540 |   assumes "\<forall>n. closed(s n)" "\<forall>n. (s n \<noteq> {})"
 | |
| 3541 | "(\<forall>m n. m \<le> n --> s n \<subseteq> s m)" "bounded(s 0)" | |
| 3542 | shows "\<exists>a::'a::heine_borel. \<forall>n::nat. a \<in> s(n)" | |
| 3543 | proof- | |
| 3544 | from assms(2) obtain x where x:"\<forall>n::nat. x n \<in> s n" using choice[of "\<lambda>n x. x\<in> s n"] by auto | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3545 | from assms(4,1) have *:"seq_compact (s 0)" using bounded_closed_imp_seq_compact[of "s 0"] by auto | 
| 33175 | 3546 | |
| 3547 | then obtain l r where lr:"l\<in>s 0" "subseq r" "((x \<circ> r) ---> l) sequentially" | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3548 | unfolding seq_compact_def apply(erule_tac x=x in allE) using x using assms(3) by blast | 
| 33175 | 3549 | |
| 3550 |   { fix n::nat
 | |
| 3551 |     { fix e::real assume "e>0"
 | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3552 | with lr(3) obtain N where N:"\<forall>m\<ge>N. dist ((x \<circ> r) m) l < e" unfolding LIMSEQ_def by auto | 
| 33175 | 3553 | hence "dist ((x \<circ> r) (max N n)) l < e" by auto | 
| 3554 | moreover | |
| 50937 | 3555 | have "r (max N n) \<ge> n" using lr(2) using seq_suble[of r "max N n"] by auto | 
| 33175 | 3556 | hence "(x \<circ> r) (max N n) \<in> s n" | 
| 3557 | using x apply(erule_tac x=n in allE) | |
| 3558 | using x apply(erule_tac x="r (max N n)" in allE) | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 3559 | using assms(3) apply(erule_tac x=n in allE) apply(erule_tac x="r (max N n)" in allE) by auto | 
| 33175 | 3560 | ultimately have "\<exists>y\<in>s n. dist y l < e" by auto | 
| 3561 | } | |
| 3562 | hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by blast | |
| 3563 | } | |
| 3564 | thus ?thesis by auto | |
| 3565 | qed | |
| 3566 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 3567 | text {* Decreasing case does not even need compactness, just completeness. *}
 | 
| 33175 | 3568 | |
| 3569 | lemma decreasing_closed_nest: | |
| 3570 | assumes "\<forall>n. closed(s n)" | |
| 3571 |           "\<forall>n. (s n \<noteq> {})"
 | |
| 3572 | "\<forall>m n. m \<le> n --> s n \<subseteq> s m" | |
| 3573 | "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y \<in> (s n). dist x y < e" | |
| 44632 | 3574 | shows "\<exists>a::'a::complete_space. \<forall>n::nat. a \<in> s n" | 
| 33175 | 3575 | proof- | 
| 3576 | have "\<forall>n. \<exists> x. x\<in>s n" using assms(2) by auto | |
| 3577 | hence "\<exists>t. \<forall>n. t n \<in> s n" using choice[of "\<lambda> n x. x \<in> s n"] by auto | |
| 3578 | then obtain t where t: "\<forall>n. t n \<in> s n" by auto | |
| 3579 |   { fix e::real assume "e>0"
 | |
| 3580 | then obtain N where N:"\<forall>x\<in>s N. \<forall>y\<in>s N. dist x y < e" using assms(4) by auto | |
| 3581 |     { fix m n ::nat assume "N \<le> m \<and> N \<le> n"
 | |
| 3582 | hence "t m \<in> s N" "t n \<in> s N" using assms(3) t unfolding subset_eq t by blast+ | |
| 3583 | hence "dist (t m) (t n) < e" using N by auto | |
| 3584 | } | |
| 3585 | hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (t m) (t n) < e" by auto | |
| 3586 | } | |
| 3587 | hence "Cauchy t" unfolding cauchy_def by auto | |
| 3588 | then obtain l where l:"(t ---> l) sequentially" using complete_univ unfolding complete_def by auto | |
| 3589 |   { fix n::nat
 | |
| 3590 |     { fix e::real assume "e>0"
 | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3591 | then obtain N::nat where N:"\<forall>n\<ge>N. dist (t n) l < e" using l[unfolded LIMSEQ_def] by auto | 
| 33175 | 3592 | have "t (max n N) \<in> s n" using assms(3) unfolding subset_eq apply(erule_tac x=n in allE) apply (erule_tac x="max n N" in allE) using t by auto | 
| 3593 | hence "\<exists>y\<in>s n. dist y l < e" apply(rule_tac x="t (max n N)" in bexI) using N by auto | |
| 3594 | } | |
| 3595 | hence "l \<in> s n" using closed_approachable[of "s n" l] assms(1) by auto | |
| 3596 | } | |
| 3597 | then show ?thesis by auto | |
| 3598 | qed | |
| 3599 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 3600 | text {* Strengthen it to the intersection actually being a singleton. *}
 | 
| 33175 | 3601 | |
| 3602 | lemma decreasing_closed_nest_sing: | |
| 44632 | 3603 | fixes s :: "nat \<Rightarrow> 'a::complete_space set" | 
| 33175 | 3604 | assumes "\<forall>n. closed(s n)" | 
| 3605 |           "\<forall>n. s n \<noteq> {}"
 | |
| 3606 | "\<forall>m n. m \<le> n --> s n \<subseteq> s m" | |
| 3607 | "\<forall>e>0. \<exists>n. \<forall>x \<in> (s n). \<forall> y\<in>(s n). dist x y < e" | |
| 34104 | 3608 |   shows "\<exists>a. \<Inter>(range s) = {a}"
 | 
| 33175 | 3609 | proof- | 
| 3610 | obtain a where a:"\<forall>n. a \<in> s n" using decreasing_closed_nest[of s] using assms by auto | |
| 34104 | 3611 |   { fix b assume b:"b \<in> \<Inter>(range s)"
 | 
| 33175 | 3612 |     { fix e::real assume "e>0"
 | 
| 3613 | hence "dist a b < e" using assms(4 )using b using a by blast | |
| 3614 | } | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 3615 | hence "dist a b = 0" by (metis dist_eq_0_iff dist_nz less_le) | 
| 33175 | 3616 | } | 
| 34104 | 3617 |   with a have "\<Inter>(range s) = {a}" unfolding image_def by auto
 | 
| 3618 | thus ?thesis .. | |
| 33175 | 3619 | qed | 
| 3620 | ||
| 3621 | text{* Cauchy-type criteria for uniform convergence. *}
 | |
| 3622 | ||
| 51102 | 3623 | lemma uniformly_convergent_eq_cauchy: fixes s::"nat \<Rightarrow> 'b \<Rightarrow> 'a::complete_space" shows | 
| 33175 | 3624 | "(\<exists>l. \<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e) \<longleftrightarrow> | 
| 3625 | (\<forall>e>0. \<exists>N. \<forall>m n x. N \<le> m \<and> N \<le> n \<and> P x --> dist (s m x) (s n x) < e)" (is "?lhs = ?rhs") | |
| 3626 | proof(rule) | |
| 3627 | assume ?lhs | |
| 3628 | 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" by auto | |
| 3629 |   { fix e::real assume "e>0"
 | |
| 3630 | then obtain N::nat where N:"\<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist (s n x) (l x) < e / 2" using l[THEN spec[where x="e/2"]] by auto | |
| 3631 |     { fix n m::nat and x::"'b" assume "N \<le> m \<and> N \<le> n \<and> P x"
 | |
| 3632 | hence "dist (s m x) (s n x) < e" | |
| 3633 | using N[THEN spec[where x=m], THEN spec[where x=x]] | |
| 3634 | using N[THEN spec[where x=n], THEN spec[where x=x]] | |
| 3635 | using dist_triangle_half_l[of "s m x" "l x" e "s n x"] by auto } | |
| 3636 | hence "\<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 } | |
| 3637 | thus ?rhs by auto | |
| 3638 | next | |
| 3639 | assume ?rhs | |
| 3640 | hence "\<forall>x. P x \<longrightarrow> Cauchy (\<lambda>n. s n x)" unfolding cauchy_def apply auto by (erule_tac x=e in allE)auto | |
| 3641 | then obtain l where l:"\<forall>x. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l x) sequentially" unfolding convergent_eq_cauchy[THEN sym] | |
| 3642 | using choice[of "\<lambda>x l. P x \<longrightarrow> ((\<lambda>n. s n x) ---> l) sequentially"] by auto | |
| 3643 |   { fix e::real assume "e>0"
 | |
| 3644 | 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" | |
| 3645 | using `?rhs`[THEN spec[where x="e/2"]] by auto | |
| 3646 |     { fix x assume "P x"
 | |
| 3647 | then obtain M where M:"\<forall>n\<ge>M. dist (s n x) (l x) < e/2" | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3648 | using l[THEN spec[where x=x], unfolded LIMSEQ_def] using `e>0` by(auto elim!: allE[where x="e/2"]) | 
| 33175 | 3649 | fix n::nat assume "n\<ge>N" | 
| 3650 | hence "dist(s n x)(l x) < e" using `P x`and N[THEN spec[where x=n], THEN spec[where x="N+M"], THEN spec[where x=x]] | |
| 3651 | using M[THEN spec[where x="N+M"]] and dist_triangle_half_l[of "s n x" "s (N+M) x" e "l x"] by (auto simp add: dist_commute) } | |
| 3652 | hence "\<exists>N. \<forall>n x. N \<le> n \<and> P x \<longrightarrow> dist(s n x)(l x) < e" by auto } | |
| 3653 | thus ?lhs by auto | |
| 3654 | qed | |
| 3655 | ||
| 3656 | lemma uniformly_cauchy_imp_uniformly_convergent: | |
| 51102 | 3657 | fixes s :: "nat \<Rightarrow> 'a \<Rightarrow> 'b::complete_space" | 
| 33175 | 3658 | 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" | 
| 3659 | "\<forall>x. P x --> (\<forall>e>0. \<exists>N. \<forall>n. N \<le> n --> dist(s n x)(l x) < e)" | |
| 3660 | shows "\<forall>e>0. \<exists>N. \<forall>n x. N \<le> n \<and> P x --> dist(s n x)(l x) < e" | |
| 3661 | proof- | |
| 3662 | 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" | |
| 3663 | using assms(1) unfolding uniformly_convergent_eq_cauchy[THEN sym] by auto | |
| 3664 | moreover | |
| 3665 |   { fix x assume "P x"
 | |
| 41970 | 3666 | hence "l x = l' x" using tendsto_unique[OF trivial_limit_sequentially, of "\<lambda>n. s n x" "l x" "l' x"] | 
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3667 | using l and assms(2) unfolding LIMSEQ_def by blast } | 
| 33175 | 3668 | ultimately show ?thesis by auto | 
| 3669 | qed | |
| 3670 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 3671 | |
| 36437 | 3672 | subsection {* Continuity *}
 | 
| 3673 | ||
| 33175 | 3674 | text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
 | 
| 3675 | ||
| 3676 | lemma continuous_within_eps_delta: | |
| 3677 | "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)" | |
| 3678 | unfolding continuous_within and Lim_within | |
| 44584 | 3679 | apply auto unfolding dist_nz[THEN sym] apply(auto del: allE elim!:allE) apply(rule_tac x=d in exI) by auto | 
| 33175 | 3680 | |
| 3681 | lemma continuous_at_eps_delta: "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. | |
| 3682 | \<forall>x'. dist x' x < d --> dist(f x')(f x) < e)" | |
| 45031 | 3683 | using continuous_within_eps_delta [of x UNIV f] by simp | 
| 33175 | 3684 | |
| 3685 | text{* Versions in terms of open balls. *}
 | |
| 3686 | ||
| 3687 | lemma continuous_within_ball: | |
| 3688 | "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. | |
| 3689 | f ` (ball x d \<inter> s) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") | |
| 3690 | proof | |
| 3691 | assume ?lhs | |
| 3692 |   { fix e::real assume "e>0"
 | |
| 3693 | 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" | |
| 3694 | using `?lhs`[unfolded continuous_within Lim_within] by auto | |
| 3695 |     { fix y assume "y\<in>f ` (ball x d \<inter> s)"
 | |
| 3696 | hence "y \<in> ball (f x) e" using d(2) unfolding dist_nz[THEN sym] | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 3697 | apply (auto simp add: dist_commute) apply(erule_tac x=xa in ballE) apply auto using `e>0` by auto | 
| 33175 | 3698 | } | 
| 3699 | hence "\<exists>d>0. f ` (ball x d \<inter> s) \<subseteq> ball (f x) e" using `d>0` unfolding subset_eq ball_def by (auto simp add: dist_commute) } | |
| 3700 | thus ?rhs by auto | |
| 3701 | next | |
| 3702 | assume ?rhs thus ?lhs unfolding continuous_within Lim_within ball_def subset_eq | |
| 3703 | apply (auto simp add: dist_commute) apply(erule_tac x=e in allE) by auto | |
| 3704 | qed | |
| 3705 | ||
| 3706 | lemma continuous_at_ball: | |
| 3707 | "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. f ` (ball x d) \<subseteq> ball (f x) e)" (is "?lhs = ?rhs") | |
| 3708 | proof | |
| 3709 | assume ?lhs thus ?rhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | |
| 3710 | apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x=xa in allE) apply (auto simp add: dist_commute dist_nz) | |
| 3711 | unfolding dist_nz[THEN sym] by auto | |
| 3712 | next | |
| 3713 | assume ?rhs thus ?lhs unfolding continuous_at Lim_at subset_eq Ball_def Bex_def image_iff mem_ball | |
| 3714 | apply auto apply(erule_tac x=e in allE) apply auto apply(rule_tac x=d in exI) apply auto apply(erule_tac x="f xa" in allE) by (auto simp add: dist_commute dist_nz) | |
| 3715 | qed | |
| 3716 | ||
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3717 | text{* Define setwise continuity in terms of limits within the set. *}
 | 
| 33175 | 3718 | |
| 36359 | 3719 | lemma continuous_on_iff: | 
| 3720 | "continuous_on s f \<longleftrightarrow> | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3721 | (\<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)" | 
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3722 | unfolding continuous_on_def Lim_within | 
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3723 | apply (intro ball_cong [OF refl] all_cong ex_cong) | 
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3724 | apply (rename_tac y, case_tac "y = x", simp) | 
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3725 | apply (simp add: dist_nz) | 
| 36359 | 3726 | done | 
| 33175 | 3727 | |
| 3728 | definition | |
| 3729 | uniformly_continuous_on :: | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3730 |     "'a set \<Rightarrow> ('a::metric_space \<Rightarrow> 'b::metric_space) \<Rightarrow> bool"
 | 
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3731 | where | 
| 33175 | 3732 | "uniformly_continuous_on s f \<longleftrightarrow> | 
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3733 | (\<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 | 3734 | |
| 33175 | 3735 | text{* Some simple consequential lemmas. *}
 | 
| 3736 | ||
| 3737 | lemma uniformly_continuous_imp_continuous: | |
| 3738 | " uniformly_continuous_on s f ==> continuous_on s f" | |
| 36359 | 3739 | unfolding uniformly_continuous_on_def continuous_on_iff by blast | 
| 33175 | 3740 | |
| 3741 | lemma continuous_at_imp_continuous_within: | |
| 3742 | "continuous (at x) f ==> continuous (at x within s) f" | |
| 3743 | unfolding continuous_within continuous_at using Lim_at_within by auto | |
| 3744 | ||
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3745 | 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 | 3746 | by simp | 
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3747 | |
| 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3748 | lemmas continuous_on = continuous_on_def -- "legacy theorem name" | 
| 33175 | 3749 | |
| 3750 | lemma continuous_within_subset: | |
| 3751 | "continuous (at x within s) f \<Longrightarrow> t \<subseteq> s | |
| 3752 | ==> 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 | 3753 | unfolding continuous_within by(metis tendsto_within_subset) | 
| 33175 | 3754 | |
| 3755 | lemma continuous_on_interior: | |
| 44519 | 3756 | shows "continuous_on s f \<Longrightarrow> x \<in> interior s \<Longrightarrow> continuous (at x) f" | 
| 3757 | by (erule interiorE, drule (1) continuous_on_subset, | |
| 3758 | simp add: continuous_on_eq_continuous_at) | |
| 33175 | 3759 | |
| 3760 | lemma continuous_on_eq: | |
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3761 | "(\<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 | 3762 | unfolding continuous_on_def tendsto_def eventually_at_topological | 
| 36440 
89a70297564d
simplify definition of continuous_on; generalize some lemmas
 huffman parents: 
36439diff
changeset | 3763 | by simp | 
| 33175 | 3764 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 3765 | text {* Characterization of various kinds of continuity in terms of sequences. *}
 | 
| 33175 | 3766 | |
| 3767 | lemma continuous_within_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3768 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 33175 | 3769 | shows "continuous (at a within s) f \<longleftrightarrow> | 
| 3770 | (\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially | |
| 3771 | --> ((f o x) ---> f a) sequentially)" (is "?lhs = ?rhs") | |
| 3772 | proof | |
| 3773 | assume ?lhs | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3774 |   { fix x::"nat \<Rightarrow> 'a" assume x:"\<forall>n. x n \<in> s" "\<forall>e>0. eventually (\<lambda>n. dist (x n) a < e) sequentially"
 | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3775 | fix T::"'b set" assume "open T" and "f a \<in> T" | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3776 | 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 | 3777 | 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 | 3778 | have "eventually (\<lambda>n. dist (x n) a < d) sequentially" | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3779 | using x(2) `d>0` by simp | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3780 | hence "eventually (\<lambda>n. (f \<circ> x) n \<in> T) sequentially" | 
| 46887 | 3781 | proof eventually_elim | 
| 3782 | case (elim n) thus ?case | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3783 | using d x(1) `f a \<in> T` unfolding dist_nz[THEN sym] by auto | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3784 | qed | 
| 33175 | 3785 | } | 
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3786 | thus ?rhs unfolding tendsto_iff unfolding tendsto_def by simp | 
| 33175 | 3787 | next | 
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3788 | assume ?rhs thus ?lhs | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3789 | unfolding continuous_within tendsto_def [where l="f a"] | 
| 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3790 | by (simp add: sequentially_imp_eventually_within) | 
| 33175 | 3791 | qed | 
| 3792 | ||
| 3793 | lemma continuous_at_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3794 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 33175 | 3795 | shows "continuous (at a) f \<longleftrightarrow> (\<forall>x. (x ---> a) sequentially | 
| 3796 | --> ((f o x) ---> f a) sequentially)" | |
| 45031 | 3797 | using continuous_within_sequentially[of a UNIV f] by simp | 
| 33175 | 3798 | |
| 3799 | lemma continuous_on_sequentially: | |
| 44533 
7abe4a59f75d
generalize and simplify proof of continuous_within_sequentially
 huffman parents: 
44531diff
changeset | 3800 | fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 36359 | 3801 | shows "continuous_on s f \<longleftrightarrow> | 
| 3802 | (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially | |
| 33175 | 3803 | --> ((f o x) ---> f(a)) sequentially)" (is "?lhs = ?rhs") | 
| 3804 | proof | |
| 3805 | assume ?rhs thus ?lhs using continuous_within_sequentially[of _ s f] unfolding continuous_on_eq_continuous_within by auto | |
| 3806 | next | |
| 3807 | assume ?lhs thus ?rhs unfolding continuous_on_eq_continuous_within using continuous_within_sequentially[of _ s f] by auto | |
| 3808 | qed | |
| 3809 | ||
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3810 | lemma uniformly_continuous_on_sequentially: | 
| 36441 | 3811 | "uniformly_continuous_on s f \<longleftrightarrow> (\<forall>x y. (\<forall>n. x n \<in> s) \<and> (\<forall>n. y n \<in> s) \<and> | 
| 3812 | ((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially | |
| 3813 | \<longrightarrow> ((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially)" (is "?lhs = ?rhs") | |
| 33175 | 3814 | proof | 
| 3815 | assume ?lhs | |
| 36441 | 3816 |   { fix x y assume x:"\<forall>n. x n \<in> s" and y:"\<forall>n. y n \<in> s" and xy:"((\<lambda>n. dist (x n) (y n)) ---> 0) sequentially"
 | 
| 33175 | 3817 |     { fix e::real assume "e>0"
 | 
| 3818 | 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" | |
| 3819 | using `?lhs`[unfolded uniformly_continuous_on_def, THEN spec[where x=e]] by auto | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3820 | obtain N where N:"\<forall>n\<ge>N. dist (x n) (y n) < d" using xy[unfolded LIMSEQ_def dist_norm] and `d>0` by auto | 
| 33175 | 3821 |       { fix n assume "n\<ge>N"
 | 
| 36441 | 3822 | hence "dist (f (x n)) (f (y n)) < e" | 
| 33175 | 3823 | using N[THEN spec[where x=n]] using d[THEN bspec[where x="x n"], THEN bspec[where x="y n"]] using x and y | 
| 36441 | 3824 | unfolding dist_commute by simp } | 
| 3825 | hence "\<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" by auto } | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3826 | hence "((\<lambda>n. dist (f(x n)) (f(y n))) ---> 0) sequentially" unfolding LIMSEQ_def and dist_real_def by auto } | 
| 33175 | 3827 | thus ?rhs by auto | 
| 3828 | next | |
| 3829 | assume ?rhs | |
| 3830 |   { assume "\<not> ?lhs"
 | |
| 3831 | 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" unfolding uniformly_continuous_on_def by auto | |
| 3832 | then obtain fa where fa:"\<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" | |
| 3833 | 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"] unfolding Bex_def | |
| 3834 | by (auto simp add: dist_commute) | |
| 3835 | def x \<equiv> "\<lambda>n::nat. fst (fa (inverse (real n + 1)))" | |
| 3836 | def y \<equiv> "\<lambda>n::nat. snd (fa (inverse (real n + 1)))" | |
| 3837 | have xyn:"\<forall>n. x n \<in> s \<and> y n \<in> s" and xy0:"\<forall>n. dist (x n) (y n) < inverse (real n + 1)" and fxy:"\<forall>n. \<not> dist (f (x n)) (f (y n)) < e" | |
| 3838 | unfolding x_def and y_def using fa by auto | |
| 3839 |     { fix e::real assume "e>0"
 | |
| 3840 | then obtain N::nat where "N \<noteq> 0" and N:"0 < inverse (real N) \<and> inverse (real N) < e" unfolding real_arch_inv[of e] by auto | |
| 3841 |       { fix n::nat assume "n\<ge>N"
 | |
| 3842 | hence "inverse (real n + 1) < inverse (real N)" using real_of_nat_ge_zero and `N\<noteq>0` by auto | |
| 3843 | also have "\<dots> < e" using N by auto | |
| 3844 | finally have "inverse (real n + 1) < e" by auto | |
| 36441 | 3845 | hence "dist (x n) (y n) < e" using xy0[THEN spec[where x=n]] by auto } | 
| 3846 | hence "\<exists>N. \<forall>n\<ge>N. dist (x n) (y n) < e" by auto } | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 3847 | hence "\<forall>e>0. \<exists>N. \<forall>n\<ge>N. dist (f (x n)) (f (y n)) < e" using `?rhs`[THEN spec[where x=x], THEN spec[where x=y]] and xyn unfolding LIMSEQ_def dist_real_def by auto | 
| 36441 | 3848 | hence False using fxy and `e>0` by auto } | 
| 33175 | 3849 | thus ?lhs unfolding uniformly_continuous_on_def by blast | 
| 3850 | qed | |
| 3851 | ||
| 3852 | text{* The usual transformation theorems. *}
 | |
| 3853 | ||
| 3854 | lemma continuous_transform_within: | |
| 36667 | 3855 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 33175 | 3856 | assumes "0 < d" "x \<in> s" "\<forall>x' \<in> s. dist x' x < d --> f x' = g x'" | 
| 3857 | "continuous (at x within s) f" | |
| 3858 | shows "continuous (at x within s) g" | |
| 36667 | 3859 | unfolding continuous_within | 
| 3860 | proof (rule Lim_transform_within) | |
| 3861 | show "0 < d" by fact | |
| 3862 | show "\<forall>x'\<in>s. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'" | |
| 3863 | using assms(3) by auto | |
| 3864 | have "f x = g x" | |
| 3865 | using assms(1,2,3) by auto | |
| 3866 | thus "(f ---> g x) (at x within s)" | |
| 3867 | using assms(4) unfolding continuous_within by simp | |
| 33175 | 3868 | qed | 
| 3869 | ||
| 3870 | lemma continuous_transform_at: | |
| 36667 | 3871 | fixes f g :: "'a::metric_space \<Rightarrow> 'b::topological_space" | 
| 33175 | 3872 | assumes "0 < d" "\<forall>x'. dist x' x < d --> f x' = g x'" | 
| 3873 | "continuous (at x) f" | |
| 3874 | shows "continuous (at x) g" | |
| 45031 | 3875 | using continuous_transform_within [of d x UNIV f g] assms by simp | 
| 33175 | 3876 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3877 | subsubsection {* Structural rules for pointwise continuity *}
 | 
| 33175 | 3878 | |
| 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 | 3879 | 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 | 3880 | |
| 
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 | 3881 | lemmas continuous_at_id = isCont_ident | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3882 | |
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 3883 | lemma continuous_infdist[continuous_intros]: | 
| 50087 | 3884 | assumes "continuous F f" | 
| 3885 | shows "continuous F (\<lambda>x. infdist (f x) A)" | |
| 3886 | using assms unfolding continuous_def by (rule tendsto_infdist) | |
| 3887 | ||
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 3888 | lemma continuous_infnorm[continuous_intros]: | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3889 | shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))" | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3890 | unfolding continuous_def by (rule tendsto_infnorm) | 
| 33175 | 3891 | |
| 51361 
21e5b6efb317
changed continuous_intros into a named theorems collection
 hoelzl parents: 
51351diff
changeset | 3892 | lemma continuous_inner[continuous_intros]: | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3893 | assumes "continuous F f" and "continuous F g" | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3894 | shows "continuous F (\<lambda>x. inner (f x) (g x))" | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3895 | using assms unfolding continuous_def by (rule tendsto_inner) | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3896 | |
| 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 | 3897 | lemmas continuous_at_inverse = isCont_inverse | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3898 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3899 | subsubsection {* Structural rules for setwise continuity *}
 | 
| 33175 | 3900 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3901 | lemma continuous_on_infnorm[continuous_on_intros]: | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3902 | shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. infnorm (f x))" | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3903 | unfolding continuous_on by (fast intro: tendsto_infnorm) | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3904 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3905 | lemma continuous_on_inner[continuous_on_intros]: | 
| 44531 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 3906 | fixes g :: "'a::topological_space \<Rightarrow> 'b::real_inner" | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 3907 | assumes "continuous_on s f" and "continuous_on s g" | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 3908 | 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 | 3909 | using bounded_bilinear_inner assms | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 3910 | by (rule bounded_bilinear.continuous_on) | 
| 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 3911 | |
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3912 | subsubsection {* Structural rules for uniform continuity *}
 | 
| 33175 | 3913 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3914 | lemma uniformly_continuous_on_id[continuous_on_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3915 | shows "uniformly_continuous_on s (\<lambda>x. x)" | 
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3916 | unfolding uniformly_continuous_on_def by auto | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 3917 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3918 | lemma uniformly_continuous_on_const[continuous_on_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3919 | shows "uniformly_continuous_on s (\<lambda>x. c)" | 
| 33175 | 3920 | unfolding uniformly_continuous_on_def by simp | 
| 3921 | ||
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3922 | lemma uniformly_continuous_on_dist[continuous_on_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3923 | 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 | 3924 | assumes "uniformly_continuous_on s f" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3925 | assumes "uniformly_continuous_on s g" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3926 | 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 | 3927 | proof - | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3928 |   { fix a b c d :: 'b have "\<bar>dist a b - dist c d\<bar> \<le> dist a c + dist b d"
 | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3929 | 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 | 3930 | 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 | 3931 | by arith | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3932 | } note le = this | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3933 |   { fix x y
 | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3934 | 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 | 3935 | 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 | 3936 | 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 | 3937 | 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 | 3938 | simp add: le) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3939 | } | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3940 | thus ?thesis using assms unfolding uniformly_continuous_on_sequentially | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3941 | unfolding dist_real_def by simp | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3942 | qed | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3943 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3944 | lemma uniformly_continuous_on_norm[continuous_on_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3945 | assumes "uniformly_continuous_on s f" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3946 | 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 | 3947 | unfolding norm_conv_dist using assms | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3948 | 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 | 3949 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3950 | lemma (in bounded_linear) uniformly_continuous_on[continuous_on_intros]: | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3951 | assumes "uniformly_continuous_on s g" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3952 | 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 | 3953 | using assms unfolding uniformly_continuous_on_sequentially | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3954 | 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 | 3955 | by (auto intro: tendsto_zero) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3956 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3957 | lemma uniformly_continuous_on_cmul[continuous_on_intros]: | 
| 36441 | 3958 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | 
| 33175 | 3959 | assumes "uniformly_continuous_on s f" | 
| 3960 | 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 | 3961 | using bounded_linear_scaleR_right assms | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3962 | by (rule bounded_linear.uniformly_continuous_on) | 
| 33175 | 3963 | |
| 3964 | lemma dist_minus: | |
| 3965 | fixes x y :: "'a::real_normed_vector" | |
| 3966 | shows "dist (- x) (- y) = dist x y" | |
| 3967 | unfolding dist_norm minus_diff_minus norm_minus_cancel .. | |
| 3968 | ||
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3969 | lemma uniformly_continuous_on_minus[continuous_on_intros]: | 
| 33175 | 3970 | 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 | 3971 | shows "uniformly_continuous_on s f \<Longrightarrow> uniformly_continuous_on s (\<lambda>x. - f x)" | 
| 33175 | 3972 | unfolding uniformly_continuous_on_def dist_minus . | 
| 3973 | ||
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3974 | lemma uniformly_continuous_on_add[continuous_on_intros]: | 
| 36441 | 3975 | 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 | 3976 | assumes "uniformly_continuous_on s f" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3977 | assumes "uniformly_continuous_on s g" | 
| 33175 | 3978 | shows "uniformly_continuous_on s (\<lambda>x. f x + g x)" | 
| 44648 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3979 | using assms unfolding uniformly_continuous_on_sequentially | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3980 | 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 | 3981 | by (auto intro: tendsto_add_zero) | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3982 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3983 | lemma uniformly_continuous_on_diff[continuous_on_intros]: | 
| 36441 | 3984 | 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 | 3985 | assumes "uniformly_continuous_on s f" and "uniformly_continuous_on s g" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3986 | shows "uniformly_continuous_on s (\<lambda>x. f x - g x)" | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3987 | unfolding ab_diff_minus using assms | 
| 
897f32a827f2
simplify some proofs about uniform continuity, and add some new ones;
 huffman parents: 
44647diff
changeset | 3988 | by (intro uniformly_continuous_on_add uniformly_continuous_on_minus) | 
| 33175 | 3989 | |
| 3990 | text{* Continuity of all kinds is preserved under composition. *}
 | |
| 3991 | ||
| 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 | 3992 | lemmas continuous_at_compose = isCont_o | 
| 33175 | 3993 | |
| 51362 
dac3f564a98d
changed continuous_on_intros into a named theorems collection
 hoelzl parents: 
51361diff
changeset | 3994 | lemma uniformly_continuous_on_compose[continuous_on_intros]: | 
| 33175 | 3995 | assumes "uniformly_continuous_on s f" "uniformly_continuous_on (f ` s) g" | 
| 3996 | shows "uniformly_continuous_on s (g o f)" | |
| 3997 | proof- | |
| 3998 |   { fix e::real assume "e>0"
 | |
| 3999 | then obtain d where "d>0" and d:"\<forall>x\<in>f ` s. \<forall>x'\<in>f ` s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" using assms(2) unfolding uniformly_continuous_on_def by auto | |
| 4000 | obtain d' where "d'>0" "\<forall>x\<in>s. \<forall>x'\<in>s. dist x' x < d' \<longrightarrow> dist (f x') (f x) < d" using `d>0` using assms(1) unfolding uniformly_continuous_on_def by auto | |
| 4001 | hence "\<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" using `d>0` using d by auto } | |
| 4002 | thus ?thesis using assms unfolding uniformly_continuous_on_def by auto | |
| 4003 | qed | |
| 4004 | ||
| 4005 | text{* Continuity in terms of open preimages. *}
 | |
| 4006 | ||
| 4007 | lemma continuous_at_open: | |
| 36441 | 4008 | shows "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)))" | 
| 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 | 4009 | unfolding continuous_within_topological [of x UNIV f] | 
| 36441 | 4010 | unfolding imp_conjL by (intro all_cong imp_cong ex_cong conj_cong refl) auto | 
| 33175 | 4011 | |
| 51351 | 4012 | lemma continuous_imp_tendsto: | 
| 4013 | assumes "continuous (at x0) f" and "x ----> x0" | |
| 4014 | shows "(f \<circ> x) ----> (f x0)" | |
| 4015 | proof (rule topological_tendstoI) | |
| 4016 | fix S | |
| 4017 | assume "open S" "f x0 \<in> S" | |
| 4018 | then obtain T where T_def: "open T" "x0 \<in> T" "\<forall>x\<in>T. f x \<in> S" | |
| 4019 | using assms continuous_at_open by metis | |
| 4020 | then have "eventually (\<lambda>n. x n \<in> T) sequentially" | |
| 4021 | using assms T_def by (auto simp: tendsto_def) | |
| 4022 | then show "eventually (\<lambda>n. (f \<circ> x) n \<in> S) sequentially" | |
| 4023 | using T_def by (auto elim!: eventually_elim1) | |
| 4024 | qed | |
| 4025 | ||
| 33175 | 4026 | lemma continuous_on_open: | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 4027 | "continuous_on s f \<longleftrightarrow> | 
| 33175 | 4028 | (\<forall>t. openin (subtopology euclidean (f ` s)) t | 
| 4029 |             --> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
 | |
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 4030 | 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 | 4031 | by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) | 
| 36441 | 4032 | |
| 4033 | text {* Similarly in terms of closed sets. *}
 | |
| 33175 | 4034 | |
| 4035 | lemma continuous_on_closed: | |
| 36359 | 4036 |   shows "continuous_on s f \<longleftrightarrow>  (\<forall>t. closedin (subtopology euclidean (f ` s)) t  --> closedin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
 | 
| 51481 
ef949192e5d6
move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
 hoelzl parents: 
51480diff
changeset | 4037 | 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 | 4038 | by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) | 
| 33175 | 4039 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4040 | text {* Half-global and completely global cases. *}
 | 
| 33175 | 4041 | |
| 4042 | lemma continuous_open_in_preimage: | |
| 4043 | assumes "continuous_on s f" "open t" | |
| 4044 |   shows "openin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | |
| 4045 | proof- | |
| 4046 | have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto | |
| 4047 | have "openin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" | |
| 4048 | using openin_open_Int[of t "f ` s", OF assms(2)] unfolding openin_open by auto | |
| 4049 | thus ?thesis using assms(1)[unfolded continuous_on_open, THEN spec[where x="t \<inter> f ` s"]] using * by auto | |
| 4050 | qed | |
| 4051 | ||
| 4052 | lemma continuous_closed_in_preimage: | |
| 4053 | assumes "continuous_on s f" "closed t" | |
| 4054 |   shows "closedin (subtopology euclidean s) {x \<in> s. f x \<in> t}"
 | |
| 4055 | proof- | |
| 4056 | have *:"\<forall>x. x \<in> s \<and> f x \<in> t \<longleftrightarrow> x \<in> s \<and> f x \<in> (t \<inter> f ` s)" by auto | |
| 4057 | have "closedin (subtopology euclidean (f ` s)) (t \<inter> f ` s)" | |
| 4058 | using closedin_closed_Int[of t "f ` s", OF assms(2)] unfolding Int_commute by auto | |
| 4059 | thus ?thesis | |
| 4060 | using assms(1)[unfolded continuous_on_closed, THEN spec[where x="t \<inter> f ` s"]] using * by auto | |
| 4061 | qed | |
| 4062 | ||
| 4063 | lemma continuous_open_preimage: | |
| 4064 | assumes "continuous_on s f" "open s" "open t" | |
| 4065 |   shows "open {x \<in> s. f x \<in> t}"
 | |
| 4066 | proof- | |
| 4067 |   obtain T where T: "open T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | |
| 4068 | using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto | |
| 4069 | thus ?thesis using open_Int[of s T, OF assms(2)] by auto | |
| 4070 | qed | |
| 4071 | ||
| 4072 | lemma continuous_closed_preimage: | |
| 4073 | assumes "continuous_on s f" "closed s" "closed t" | |
| 4074 |   shows "closed {x \<in> s. f x \<in> t}"
 | |
| 4075 | proof- | |
| 4076 |   obtain T where T: "closed T" "{x \<in> s. f x \<in> t} = s \<inter> T"
 | |
| 4077 | using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto | |
| 4078 | thus ?thesis using closed_Int[of s T, OF assms(2)] by auto | |
| 4079 | qed | |
| 4080 | ||
| 4081 | lemma continuous_open_preimage_univ: | |
| 4082 |   shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}"
 | |
| 4083 | using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto | |
| 4084 | ||
| 4085 | lemma continuous_closed_preimage_univ: | |
| 4086 |   shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}"
 | |
| 4087 | using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto | |
| 4088 | ||
| 4089 | lemma continuous_open_vimage: | |
| 4090 | shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open (f -` s)" | |
| 4091 | unfolding vimage_def by (rule continuous_open_preimage_univ) | |
| 4092 | ||
| 4093 | lemma continuous_closed_vimage: | |
| 4094 | shows "\<forall>x. continuous (at x) f \<Longrightarrow> closed s \<Longrightarrow> closed (f -` s)" | |
| 4095 | unfolding vimage_def by (rule continuous_closed_preimage_univ) | |
| 4096 | ||
| 36441 | 4097 | lemma interior_image_subset: | 
| 35172 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 4098 | assumes "\<forall>x. continuous (at x) f" "inj f" | 
| 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 4099 | shows "interior (f ` s) \<subseteq> f ` (interior s)" | 
| 44519 | 4100 | proof | 
| 4101 | fix x assume "x \<in> interior (f ` s)" | |
| 4102 | then obtain T where as: "open T" "x \<in> T" "T \<subseteq> f ` s" .. | |
| 4103 | hence "x \<in> f ` s" by auto | |
| 4104 | then obtain y where y: "y \<in> s" "x = f y" by auto | |
| 4105 | have "open (vimage f T)" | |
| 4106 | using assms(1) `open T` by (rule continuous_open_vimage) | |
| 4107 | moreover have "y \<in> vimage f T" | |
| 4108 | using `x = f y` `x \<in> T` by simp | |
| 4109 | moreover have "vimage f T \<subseteq> s" | |
| 4110 | using `T \<subseteq> image f s` `inj f` unfolding inj_on_def subset_eq by auto | |
| 4111 | ultimately have "y \<in> interior s" .. | |
| 4112 | with `x = f y` show "x \<in> f ` interior s" .. | |
| 4113 | qed | |
| 35172 
579dd5570f96
Added integration to Multivariate-Analysis (upto FTC)
 himmelma parents: 
35028diff
changeset | 4114 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4115 | text {* Equality of continuous functions on closure and related results. *}
 | 
| 33175 | 4116 | |
| 4117 | lemma continuous_closed_in_preimage_constant: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4118 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 4119 |   shows "continuous_on s f ==> 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 | 4120 |   using continuous_closed_in_preimage[of s f "{a}"] by auto
 | 
| 33175 | 4121 | |
| 4122 | lemma continuous_closed_preimage_constant: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4123 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 4124 |   shows "continuous_on s f \<Longrightarrow> closed s ==> 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 | 4125 |   using continuous_closed_preimage[of s f "{a}"] by auto
 | 
| 33175 | 4126 | |
| 4127 | lemma continuous_constant_on_closure: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4128 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 33175 | 4129 | assumes "continuous_on (closure s) f" | 
| 4130 | "\<forall>x \<in> s. f x = a" | |
| 4131 | shows "\<forall>x \<in> (closure s). f x = a" | |
| 4132 | using continuous_closed_preimage_constant[of "closure s" f a] | |
| 4133 |     assms closure_minimal[of s "{x \<in> closure s. f x = a}"] closure_subset unfolding subset_eq by auto
 | |
| 4134 | ||
| 4135 | lemma image_closure_subset: | |
| 4136 | assumes "continuous_on (closure s) f" "closed t" "(f ` s) \<subseteq> t" | |
| 4137 | shows "f ` (closure s) \<subseteq> t" | |
| 4138 | proof- | |
| 4139 |   have "s \<subseteq> {x \<in> closure s. f x \<in> t}" using assms(3) closure_subset by auto
 | |
| 4140 |   moreover have "closed {x \<in> closure s. f x \<in> t}"
 | |
| 4141 | using continuous_closed_preimage[OF assms(1)] and assms(2) by auto | |
| 4142 |   ultimately have "closure s = {x \<in> closure s . f x \<in> t}"
 | |
| 4143 |     using closure_minimal[of s "{x \<in> closure s. f x \<in> t}"] by auto
 | |
| 4144 | thus ?thesis by auto | |
| 4145 | qed | |
| 4146 | ||
| 4147 | lemma continuous_on_closure_norm_le: | |
| 4148 | fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector" | |
| 4149 | assumes "continuous_on (closure s) f" "\<forall>y \<in> s. norm(f y) \<le> b" "x \<in> (closure s)" | |
| 4150 | shows "norm(f x) \<le> b" | |
| 4151 | proof- | |
| 4152 | have *:"f ` s \<subseteq> cball 0 b" using assms(2)[unfolded mem_cball_0[THEN sym]] by auto | |
| 4153 | show ?thesis | |
| 4154 | using image_closure_subset[OF assms(1) closed_cball[of 0 b] *] assms(3) | |
| 4155 | unfolding subset_eq apply(erule_tac x="f x" in ballE) by (auto simp add: dist_norm) | |
| 4156 | qed | |
| 4157 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4158 | text {* Making a continuous function avoid some value in a neighbourhood. *}
 | 
| 33175 | 4159 | |
| 4160 | lemma continuous_within_avoid: | |
| 50898 | 4161 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 4162 | assumes "continuous (at x within s) f" and "f x \<noteq> a" | |
| 33175 | 4163 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e --> f y \<noteq> a" | 
| 4164 | proof- | |
| 50898 | 4165 | obtain U where "open U" and "f x \<in> U" and "a \<notin> U" | 
| 4166 | using t1_space [OF `f x \<noteq> a`] by fast | |
| 4167 | have "(f ---> f x) (at x within s)" | |
| 4168 | using assms(1) by (simp add: continuous_within) | |
| 4169 | hence "eventually (\<lambda>y. f y \<in> U) (at x within s)" | |
| 4170 | using `open U` and `f x \<in> U` | |
| 4171 | unfolding tendsto_def by fast | |
| 4172 | hence "eventually (\<lambda>y. f y \<noteq> a) (at x within s)" | |
| 4173 | using `a \<notin> U` by (fast elim: eventually_mono [rotated]) | |
| 4174 | thus ?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 | 4175 | using `f x \<noteq> a` by (auto simp: dist_commute zero_less_dist_iff eventually_at) | 
| 33175 | 4176 | qed | 
| 4177 | ||
| 4178 | lemma continuous_at_avoid: | |
| 50898 | 4179 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 45031 | 4180 | assumes "continuous (at x) f" and "f x \<noteq> a" | 
| 33175 | 4181 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | 
| 45031 | 4182 | using assms continuous_within_avoid[of x UNIV f a] by simp | 
| 33175 | 4183 | |
| 4184 | lemma continuous_on_avoid: | |
| 50898 | 4185 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 33175 | 4186 | assumes "continuous_on s f" "x \<in> s" "f x \<noteq> a" | 
| 4187 | shows "\<exists>e>0. \<forall>y \<in> s. dist x y < e \<longrightarrow> f y \<noteq> a" | |
| 50898 | 4188 | using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], OF assms(2)] continuous_within_avoid[of x s f a] assms(3) by auto | 
| 33175 | 4189 | |
| 4190 | lemma continuous_on_open_avoid: | |
| 50898 | 4191 | fixes f :: "'a::metric_space \<Rightarrow> 'b::t1_space" | 
| 33175 | 4192 | assumes "continuous_on s f" "open s" "x \<in> s" "f x \<noteq> a" | 
| 4193 | shows "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> f y \<noteq> a" | |
| 50898 | 4194 | using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)] continuous_at_avoid[of x f a] assms(4) by auto | 
| 33175 | 4195 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4196 | text {* Proving a function is constant by proving open-ness of level set. *}
 | 
| 33175 | 4197 | |
| 4198 | lemma continuous_levelset_open_in_cases: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4199 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 4200 | shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> | 
| 33175 | 4201 |         openin (subtopology euclidean s) {x \<in> s. f x = a}
 | 
| 4202 | ==> (\<forall>x \<in> s. f x \<noteq> a) \<or> (\<forall>x \<in> s. f x = a)" | |
| 4203 | unfolding connected_clopen using continuous_closed_in_preimage_constant by auto | |
| 4204 | ||
| 4205 | lemma continuous_levelset_open_in: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4206 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 36359 | 4207 | shows "connected s \<Longrightarrow> continuous_on s f \<Longrightarrow> | 
| 33175 | 4208 |         openin (subtopology euclidean s) {x \<in> s. f x = a} \<Longrightarrow>
 | 
| 4209 | (\<exists>x \<in> s. f x = a) ==> (\<forall>x \<in> s. f x = a)" | |
| 4210 | using continuous_levelset_open_in_cases[of s f ] | |
| 4211 | by meson | |
| 4212 | ||
| 4213 | lemma continuous_levelset_open: | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4214 | fixes f :: "_ \<Rightarrow> 'b::t1_space" | 
| 33175 | 4215 |   assumes "connected s"  "continuous_on s f"  "open {x \<in> s. f x = a}"  "\<exists>x \<in> s.  f x = a"
 | 
| 4216 | shows "\<forall>x \<in> s. f x = a" | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 4217 | using continuous_levelset_open_in[OF assms(1,2), of a, unfolded openin_open] using assms (3,4) by fast | 
| 33175 | 4218 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4219 | text {* Some arithmetical combinations (more to prove). *}
 | 
| 33175 | 4220 | |
| 4221 | lemma open_scaling[intro]: | |
| 4222 | fixes s :: "'a::real_normed_vector set" | |
| 4223 | assumes "c \<noteq> 0" "open s" | |
| 4224 | shows "open((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 4225 | proof- | |
| 4226 |   { fix x assume "x \<in> s"
 | |
| 4227 | then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> s" using assms(2)[unfolded open_dist, THEN bspec[where x=x]] by auto | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 4228 | have "e * abs c > 0" using assms(1)[unfolded zero_less_abs_iff[THEN sym]] using mult_pos_pos[OF `e>0`] by auto | 
| 33175 | 4229 | moreover | 
| 4230 |     { fix y assume "dist y (c *\<^sub>R x) < e * \<bar>c\<bar>"
 | |
| 4231 | hence "norm ((1 / c) *\<^sub>R y - x) < e" unfolding dist_norm | |
| 4232 | using norm_scaleR[of c "(1 / c) *\<^sub>R y - x", unfolded scaleR_right_diff_distrib, unfolded scaleR_scaleR] assms(1) | |
| 4233 | assms(1)[unfolded zero_less_abs_iff[THEN sym]] by (simp del:zero_less_abs_iff) | |
| 4234 | hence "y \<in> op *\<^sub>R c ` s" using rev_image_eqI[of "(1 / c) *\<^sub>R y" s y "op *\<^sub>R c"] e[THEN spec[where x="(1 / c) *\<^sub>R y"]] assms(1) unfolding dist_norm scaleR_scaleR by auto } | |
| 4235 | ultimately have "\<exists>e>0. \<forall>x'. dist x' (c *\<^sub>R x) < e \<longrightarrow> x' \<in> op *\<^sub>R c ` s" apply(rule_tac x="e * abs c" in exI) by auto } | |
| 4236 | thus ?thesis unfolding open_dist by auto | |
| 4237 | qed | |
| 4238 | ||
| 4239 | lemma minus_image_eq_vimage: | |
| 4240 | fixes A :: "'a::ab_group_add set" | |
| 4241 | shows "(\<lambda>x. - x) ` A = (\<lambda>x. - x) -` A" | |
| 4242 | by (auto intro!: image_eqI [where f="\<lambda>x. - x"]) | |
| 4243 | ||
| 4244 | lemma open_negations: | |
| 4245 | fixes s :: "'a::real_normed_vector set" | |
| 4246 | shows "open s ==> open ((\<lambda> x. -x) ` s)" | |
| 4247 | unfolding scaleR_minus1_left [symmetric] | |
| 4248 | by (rule open_scaling, auto) | |
| 4249 | ||
| 4250 | lemma open_translation: | |
| 4251 | fixes s :: "'a::real_normed_vector set" | |
| 4252 | assumes "open s" shows "open((\<lambda>x. a + x) ` s)" | |
| 4253 | proof- | |
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4254 |   { fix x have "continuous (at x) (\<lambda>x. x - a)"
 | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4255 | by (intro continuous_diff continuous_at_id continuous_const) } | 
| 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 4256 |   moreover have "{x. x - a \<in> s} = op + a ` s" by force
 | 
| 33175 | 4257 | ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto | 
| 4258 | qed | |
| 4259 | ||
| 4260 | lemma open_affinity: | |
| 4261 | fixes s :: "'a::real_normed_vector set" | |
| 4262 | assumes "open s" "c \<noteq> 0" | |
| 4263 | shows "open ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 4264 | proof- | |
| 4265 | have *:"(\<lambda>x. a + c *\<^sub>R x) = (\<lambda>x. a + x) \<circ> (\<lambda>x. c *\<^sub>R x)" unfolding o_def .. | |
| 4266 | have "op + a ` op *\<^sub>R c ` s = (op + a \<circ> op *\<^sub>R c) ` s" by auto | |
| 4267 | thus ?thesis using assms open_translation[of "op *\<^sub>R c ` s" a] unfolding * by auto | |
| 4268 | qed | |
| 4269 | ||
| 4270 | lemma interior_translation: | |
| 4271 | fixes s :: "'a::real_normed_vector set" | |
| 4272 | 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 | 4273 | proof (rule set_eqI, rule) | 
| 33175 | 4274 | fix x assume "x \<in> interior (op + a ` s)" | 
| 4275 | then obtain e where "e>0" and e:"ball x e \<subseteq> op + a ` s" unfolding mem_interior by auto | |
| 4276 | hence "ball (x - a) e \<subseteq> s" unfolding subset_eq Ball_def mem_ball dist_norm apply auto apply(erule_tac x="a + xa" in allE) unfolding ab_group_add_class.diff_diff_eq[THEN sym] by auto | |
| 4277 | thus "x \<in> op + a ` interior s" unfolding image_iff apply(rule_tac x="x - a" in bexI) unfolding mem_interior using `e > 0` by auto | |
| 4278 | next | |
| 4279 | fix x assume "x \<in> op + a ` interior s" | |
| 4280 | then obtain y e where "e>0" and e:"ball y e \<subseteq> s" and y:"x = a + y" unfolding image_iff Bex_def mem_interior by auto | |
| 4281 |   { fix z have *:"a + y - z = y + a - z" by auto
 | |
| 4282 | assume "z\<in>ball x e" | |
| 45548 
3e2722d66169
Groups.thy: generalize several lemmas from class ab_group_add to class group_add
 huffman parents: 
45270diff
changeset | 4283 | hence "z - a \<in> s" using e[unfolded subset_eq, THEN bspec[where x="z - a"]] unfolding mem_ball dist_norm y group_add_class.diff_diff_eq2 * by auto | 
| 33175 | 4284 | hence "z \<in> op + a ` s" unfolding image_iff by(auto intro!: bexI[where x="z - a"]) } | 
| 4285 | hence "ball x e \<subseteq> op + a ` s" unfolding subset_eq by auto | |
| 4286 | thus "x \<in> interior (op + a ` s)" unfolding mem_interior using `e>0` by auto | |
| 4287 | qed | |
| 4288 | ||
| 36437 | 4289 | text {* Topological properties of linear functions. *}
 | 
| 4290 | ||
| 4291 | lemma linear_lim_0: | |
| 4292 | assumes "bounded_linear f" shows "(f ---> 0) (at (0))" | |
| 4293 | proof- | |
| 4294 | interpret f: bounded_linear f by fact | |
| 4295 | have "(f ---> f 0) (at 0)" | |
| 4296 | using tendsto_ident_at by (rule f.tendsto) | |
| 4297 | thus ?thesis unfolding f.zero . | |
| 4298 | qed | |
| 4299 | ||
| 4300 | lemma linear_continuous_at: | |
| 4301 | assumes "bounded_linear f" shows "continuous (at a) f" | |
| 4302 | unfolding continuous_at using assms | |
| 4303 | apply (rule bounded_linear.tendsto) | |
| 4304 | apply (rule tendsto_ident_at) | |
| 4305 | done | |
| 4306 | ||
| 4307 | lemma linear_continuous_within: | |
| 4308 | shows "bounded_linear f ==> continuous (at x within s) f" | |
| 4309 | using continuous_at_imp_continuous_within[of x f s] using linear_continuous_at[of f] by auto | |
| 4310 | ||
| 4311 | lemma linear_continuous_on: | |
| 4312 | shows "bounded_linear f ==> continuous_on s f" | |
| 4313 | using continuous_at_imp_continuous_on[of s f] using linear_continuous_at[of f] by auto | |
| 4314 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4315 | text {* Also bilinear functions, in composition form. *}
 | 
| 36437 | 4316 | |
| 4317 | lemma bilinear_continuous_at_compose: | |
| 4318 | shows "continuous (at x) f \<Longrightarrow> continuous (at x) g \<Longrightarrow> bounded_bilinear h | |
| 4319 | ==> continuous (at x) (\<lambda>x. h (f x) (g x))" | |
| 4320 | unfolding continuous_at using Lim_bilinear[of f "f x" "(at x)" g "g x" h] by auto | |
| 4321 | ||
| 4322 | lemma bilinear_continuous_within_compose: | |
| 4323 | shows "continuous (at x within s) f \<Longrightarrow> continuous (at x within s) g \<Longrightarrow> bounded_bilinear h | |
| 4324 | ==> continuous (at x within s) (\<lambda>x. h (f x) (g x))" | |
| 4325 | unfolding continuous_within using Lim_bilinear[of f "f x"] by auto | |
| 4326 | ||
| 4327 | lemma bilinear_continuous_on_compose: | |
| 4328 | shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> bounded_bilinear h | |
| 4329 | ==> continuous_on s (\<lambda>x. h (f x) (g x))" | |
| 36441 | 4330 | unfolding continuous_on_def | 
| 4331 | by (fast elim: bounded_bilinear.tendsto) | |
| 36437 | 4332 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4333 | text {* Preservation of compactness and connectedness under continuous function. *}
 | 
| 33175 | 4334 | |
| 50898 | 4335 | lemma compact_eq_openin_cover: | 
| 4336 | "compact S \<longleftrightarrow> | |
| 4337 | (\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow> | |
| 4338 | (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))" | |
| 4339 | proof safe | |
| 4340 | fix C | |
| 4341 | assume "compact S" and "\<forall>c\<in>C. openin (subtopology euclidean S) c" and "S \<subseteq> \<Union>C" | |
| 4342 |   hence "\<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}"
 | |
| 4343 | unfolding openin_open by force+ | |
| 4344 |   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"
 | |
| 4345 | by (rule compactE) | |
| 4346 | hence "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)" | |
| 4347 | by auto | |
| 4348 | thus "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" .. | |
| 4349 | next | |
| 4350 | assume 1: "\<forall>C. (\<forall>c\<in>C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow> | |
| 4351 | (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D)" | |
| 4352 | show "compact S" | |
| 4353 | proof (rule compactI) | |
| 4354 | fix C | |
| 4355 | let ?C = "image (\<lambda>T. S \<inter> T) C" | |
| 4356 | assume "\<forall>t\<in>C. open t" and "S \<subseteq> \<Union>C" | |
| 4357 | hence "(\<forall>c\<in>?C. openin (subtopology euclidean S) c) \<and> S \<subseteq> \<Union>?C" | |
| 4358 | unfolding openin_open by auto | |
| 4359 | with 1 obtain D where "D \<subseteq> ?C" and "finite D" and "S \<subseteq> \<Union>D" | |
| 4360 | by metis | |
| 4361 | let ?D = "inv_into C (\<lambda>T. S \<inter> T) ` D" | |
| 4362 | have "?D \<subseteq> C \<and> finite ?D \<and> S \<subseteq> \<Union>?D" | |
| 4363 | proof (intro conjI) | |
| 4364 | from `D \<subseteq> ?C` show "?D \<subseteq> C" | |
| 4365 | by (fast intro: inv_into_into) | |
| 4366 | from `finite D` show "finite ?D" | |
| 4367 | by (rule finite_imageI) | |
| 4368 | from `S \<subseteq> \<Union>D` show "S \<subseteq> \<Union>?D" | |
| 4369 | apply (rule subset_trans) | |
| 4370 | apply clarsimp | |
| 4371 | apply (frule subsetD [OF `D \<subseteq> ?C`, THEN f_inv_into_f]) | |
| 4372 | apply (erule rev_bexI, fast) | |
| 4373 | done | |
| 4374 | qed | |
| 4375 | thus "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D" .. | |
| 4376 | qed | |
| 4377 | qed | |
| 4378 | ||
| 33175 | 4379 | lemma connected_continuous_image: | 
| 4380 | assumes "continuous_on s f" "connected s" | |
| 4381 | shows "connected(f ` s)" | |
| 4382 | proof- | |
| 4383 |   { fix T assume as: "T \<noteq> {}"  "T \<noteq> f ` s"  "openin (subtopology euclidean (f ` s)) T"  "closedin (subtopology euclidean (f ` s)) T"
 | |
| 4384 |     have "{x \<in> s. f x \<in> T} = {} \<or> {x \<in> s. f x \<in> T} = s"
 | |
| 4385 | using assms(1)[unfolded continuous_on_open, THEN spec[where x=T]] | |
| 4386 | using assms(1)[unfolded continuous_on_closed, THEN spec[where x=T]] | |
| 4387 |       using assms(2)[unfolded connected_clopen, THEN spec[where x="{x \<in> s. f x \<in> T}"]] as(3,4) by auto
 | |
| 4388 | hence False using as(1,2) | |
| 4389 | using as(4)[unfolded closedin_def topspace_euclidean_subtopology] by auto } | |
| 4390 | thus ?thesis unfolding connected_clopen by auto | |
| 4391 | qed | |
| 4392 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4393 | text {* Continuity implies uniform continuity on a compact domain. *}
 | 
| 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 | 4394 | |
| 33175 | 4395 | lemma compact_uniformly_continuous: | 
| 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 | 4396 | assumes f: "continuous_on s f" and s: "compact s" | 
| 33175 | 4397 | 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 | 4398 | 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 | 4399 | proof (cases, safe) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 4400 |   fix e :: real assume "0 < e" "s \<noteq> {}"
 | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 4401 |   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 | 4402 | let ?b = "(\<lambda>(y, d). ball y (d/2))" | 
| 4403 | 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 | 4404 | proof safe | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 4405 | fix y assume "y \<in> 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 | 4406 | 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 | 4407 |     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 | 4408 | 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 | 4409 | 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 | 4410 | using `0 < e` `y \<in> s` by (auto elim!: openE) | 
| 50944 | 4411 | with T `y \<in> s` show "y \<in> (\<Union>r\<in>R. ?b r)" | 
| 4412 | 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 | 4413 | qed auto | 
| 50944 | 4414 | with s obtain D where D: "finite D" "D \<subseteq> R" "s \<subseteq> (\<Union>(y, d)\<in>D. ball y (d/2))" | 
| 4415 | 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 | 4416 |   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 | 4417 | 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 | 4418 | 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 | 4419 | proof (rule, safe) | 
| 
88a00a1c7c2c
use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma
 hoelzl parents: 
50942diff
changeset | 4420 | fix x x' assume in_s: "x' \<in> s" "x \<in> 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 | 4421 | 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 | 4422 | 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 | 4423 | 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 | 4424 | 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 | 4425 | 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 | 4426 | 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 | 4427 | 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 | 4428 | 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 | 4429 | qed auto | 
| 33175 | 4430 | |
| 36437 | 4431 | text {* A uniformly convergent limit of continuous functions is continuous. *}
 | 
| 33175 | 4432 | |
| 4433 | lemma continuous_uniform_limit: | |
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4434 | 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 | 4435 | assumes "\<not> trivial_limit F" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4436 | assumes "eventually (\<lambda>n. continuous_on s (f n)) F" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4437 | assumes "\<forall>e>0. eventually (\<lambda>n. \<forall>x\<in>s. dist (f n x) (g x) < e) F" | 
| 33175 | 4438 | shows "continuous_on s g" | 
| 4439 | proof- | |
| 4440 |   { fix x and e::real assume "x\<in>s" "e>0"
 | |
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4441 | 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 | 4442 | 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 | 4443 | from eventually_happens [OF eventually_conj [OF this assms(2)]] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4444 | 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 | 4445 | using assms(1) by blast | 
| 33175 | 4446 | have "e / 3 > 0" using `e>0` by auto | 
| 4447 | 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 | 4448 | using n(2)[unfolded continuous_on_iff, THEN bspec[where x=x], OF `x\<in>s`, THEN spec[where x="e/3"]] by blast | 
| 44212 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4449 |     { fix y assume "y \<in> s" and "dist y x < d"
 | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4450 | hence "dist (f n y) (f n x) < e / 3" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4451 | by (rule d [rule_format]) | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4452 | hence "dist (f n y) (g x) < 2 * e / 3" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4453 | 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 | 4454 | 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 | 4455 | by auto | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4456 | hence "dist (g y) (g x) < e" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4457 | 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 | 4458 | using dist_triangle3 [of "g y" "g x" "f n y"] | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4459 | by auto } | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4460 | hence "\<exists>d>0. \<forall>x'\<in>s. dist x' x < d \<longrightarrow> dist (g x') (g x) < e" | 
| 
4d10e7f342b1
generalize lemma continuous_uniform_limit to class metric_space
 huffman parents: 
44211diff
changeset | 4461 | using `d>0` by auto } | 
| 36359 | 4462 | thus ?thesis unfolding continuous_on_iff by auto | 
| 33175 | 4463 | qed | 
| 4464 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4465 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4466 | subsection {* Topological stuff lifted from and dropped to R *}
 | 
| 33175 | 4467 | |
| 4468 | lemma open_real: | |
| 4469 | fixes s :: "real set" shows | |
| 4470 | "open s \<longleftrightarrow> | |
| 4471 | (\<forall>x \<in> s. \<exists>e>0. \<forall>x'. abs(x' - x) < e --> x' \<in> s)" (is "?lhs = ?rhs") | |
| 4472 | unfolding open_dist dist_norm by simp | |
| 4473 | ||
| 4474 | lemma islimpt_approachable_real: | |
| 4475 | fixes s :: "real set" | |
| 4476 | shows "x islimpt s \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> s. x' \<noteq> x \<and> abs(x' - x) < e)" | |
| 4477 | unfolding islimpt_approachable dist_norm by simp | |
| 4478 | ||
| 4479 | lemma closed_real: | |
| 4480 | fixes s :: "real set" | |
| 4481 | shows "closed s \<longleftrightarrow> | |
| 4482 | (\<forall>x. (\<forall>e>0. \<exists>x' \<in> s. x' \<noteq> x \<and> abs(x' - x) < e) | |
| 4483 | --> x \<in> s)" | |
| 4484 | unfolding closed_limpt islimpt_approachable dist_norm by simp | |
| 4485 | ||
| 4486 | lemma continuous_at_real_range: | |
| 4487 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | |
| 4488 | shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. | |
| 4489 | \<forall>x'. norm(x' - x) < d --> abs(f x' - f x) < e)" | |
| 4490 | unfolding continuous_at unfolding Lim_at | |
| 4491 | unfolding dist_nz[THEN sym] unfolding dist_norm apply auto | |
| 4492 | apply(erule_tac x=e in allE) apply auto apply (rule_tac x=d in exI) apply auto apply (erule_tac x=x' in allE) apply auto | |
| 4493 | apply(erule_tac x=e in allE) by auto | |
| 4494 | ||
| 4495 | lemma continuous_on_real_range: | |
| 4496 | fixes f :: "'a::real_normed_vector \<Rightarrow> real" | |
| 4497 | shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))" | |
| 36359 | 4498 | unfolding continuous_on_iff dist_norm by simp | 
| 33175 | 4499 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4500 | text {* Hence some handy theorems on distance, diameter etc. of/from a set. *}
 | 
| 33175 | 4501 | |
| 4502 | lemma distance_attains_sup: | |
| 4503 |   assumes "compact s" "s \<noteq> {}"
 | |
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4504 | shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a y \<le> dist a x" | 
| 33175 | 4505 | proof (rule continuous_attains_sup [OF assms]) | 
| 4506 |   { fix x assume "x\<in>s"
 | |
| 4507 | 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 | 4508 | by (intro tendsto_dist tendsto_const tendsto_ident_at) | 
| 33175 | 4509 | } | 
| 4510 | thus "continuous_on s (dist a)" | |
| 4511 | unfolding continuous_on .. | |
| 4512 | qed | |
| 4513 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4514 | text {* For \emph{minimal} distance, we only need closure, not compactness. *}
 | 
| 33175 | 4515 | |
| 4516 | lemma distance_attains_inf: | |
| 4517 | fixes a :: "'a::heine_borel" | |
| 4518 |   assumes "closed s"  "s \<noteq> {}"
 | |
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4519 | shows "\<exists>x\<in>s. \<forall>y\<in>s. dist a x \<le> dist a y" | 
| 33175 | 4520 | proof- | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4521 | 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 | 4522 | let ?B = "s \<inter> cball a (dist b a)" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4523 |   have "?B \<noteq> {}" using `b \<in> s` by (auto simp add: dist_commute)
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4524 | moreover have "continuous_on ?B (dist a)" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4525 | by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_at_id continuous_const) | 
| 33175 | 4526 | moreover have "compact ?B" | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4527 | 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 | 4528 | 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 | 4529 | by (metis continuous_attains_inf) | 
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
44668diff
changeset | 4530 | thus ?thesis by fastforce | 
| 33175 | 4531 | qed | 
| 4532 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4533 | |
| 36437 | 4534 | subsection {* Pasted sets *}
 | 
| 33175 | 4535 | |
| 4536 | lemma bounded_Times: | |
| 4537 | assumes "bounded s" "bounded t" shows "bounded (s \<times> t)" | |
| 4538 | proof- | |
| 4539 | obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b" | |
| 4540 | using assms [unfolded bounded_def] by auto | |
| 4541 | then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)" | |
| 4542 | by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono) | |
| 4543 | thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto | |
| 4544 | qed | |
| 4545 | ||
| 4546 | lemma mem_Times_iff: "x \<in> A \<times> B \<longleftrightarrow> fst x \<in> A \<and> snd x \<in> B" | |
| 4547 | by (induct x) simp | |
| 4548 | ||
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 4549 | lemma seq_compact_Times: "seq_compact s \<Longrightarrow> seq_compact t \<Longrightarrow> seq_compact (s \<times> t)" | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 4550 | unfolding seq_compact_def | 
| 33175 | 4551 | apply clarify | 
| 4552 | apply (drule_tac x="fst \<circ> f" in spec) | |
| 4553 | apply (drule mp, simp add: mem_Times_iff) | |
| 4554 | apply (clarify, rename_tac l1 r1) | |
| 4555 | apply (drule_tac x="snd \<circ> f \<circ> r1" in spec) | |
| 4556 | apply (drule mp, simp add: mem_Times_iff) | |
| 4557 | apply (clarify, rename_tac l2 r2) | |
| 4558 | apply (rule_tac x="(l1, l2)" in rev_bexI, simp) | |
| 4559 | apply (rule_tac x="r1 \<circ> r2" in exI) | |
| 4560 | apply (rule conjI, simp add: subseq_def) | |
| 50972 | 4561 | apply (drule_tac f=r2 in LIMSEQ_subseq_LIMSEQ, assumption) | 
| 33175 | 4562 | apply (drule (1) tendsto_Pair) back | 
| 4563 | apply (simp add: o_def) | |
| 4564 | done | |
| 4565 | ||
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 4566 | lemma compact_Times: | 
| 51349 | 4567 | assumes "compact s" "compact t" | 
| 4568 | shows "compact (s \<times> t)" | |
| 4569 | proof (rule compactI) | |
| 4570 | fix C assume C: "\<forall>t\<in>C. open t" "s \<times> t \<subseteq> \<Union>C" | |
| 4571 | 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)" | |
| 4572 | proof | |
| 4573 | fix x assume "x \<in> s" | |
| 4574 | 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") | |
| 4575 | proof | |
| 4576 | fix y assume "y \<in> t" | |
| 4577 | with `x \<in> s` C obtain c where "c \<in> C" "(x, y) \<in> c" "open c" by auto | |
| 4578 | then show "?P y" by (auto elim!: open_prod_elim) | |
| 4579 | qed | |
| 4580 | then obtain a b c where b: "\<And>y. y \<in> t \<Longrightarrow> open (b y)" | |
| 4581 | 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" | |
| 4582 | by metis | |
| 4583 | then have "\<forall>y\<in>t. open (b y)" "t \<subseteq> (\<Union>y\<in>t. b y)" by auto | |
| 4584 | from compactE_image[OF `compact t` this] obtain D where "D \<subseteq> t" "finite D" "t \<subseteq> (\<Union>y\<in>D. b y)" | |
| 4585 | by auto | |
| 4586 | moreover with c have "(\<Inter>y\<in>D. a y) \<times> t \<subseteq> (\<Union>y\<in>D. c y)" | |
| 4587 | by (fastforce simp: subset_eq) | |
| 4588 | 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 | 4589 | using c by (intro exI[of _ "c`D"] exI[of _ "\<Inter>(a`D)"] conjI) (auto intro!: open_INT) | 
| 51349 | 4590 | qed | 
| 4591 | then obtain a d where a: "\<forall>x\<in>s. open (a x)" "s \<subseteq> (\<Union>x\<in>s. a x)" | |
| 4592 | 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" | |
| 4593 | unfolding subset_eq UN_iff by metis | |
| 4594 | moreover from compactE_image[OF `compact s` a] obtain e where e: "e \<subseteq> s" "finite e" | |
| 4595 | and s: "s \<subseteq> (\<Union>x\<in>e. a x)" by auto | |
| 4596 | moreover | |
| 4597 |   { from s have "s \<times> t \<subseteq> (\<Union>x\<in>e. a x \<times> t)" by auto
 | |
| 4598 | also have "\<dots> \<subseteq> (\<Union>x\<in>e. \<Union>d x)" using d `e \<subseteq> s` by (intro UN_mono) auto | |
| 4599 | finally have "s \<times> t \<subseteq> (\<Union>x\<in>e. \<Union>d x)" . } | |
| 4600 | ultimately show "\<exists>C'\<subseteq>C. finite C' \<and> s \<times> t \<subseteq> \<Union>C'" | |
| 4601 | by (intro exI[of _ "(\<Union>x\<in>e. d x)"]) (auto simp add: subset_eq) | |
| 4602 | qed | |
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 4603 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4604 | text{* Hence some useful properties follow quite easily. *}
 | 
| 33175 | 4605 | |
| 4606 | lemma compact_scaling: | |
| 4607 | fixes s :: "'a::real_normed_vector set" | |
| 4608 | assumes "compact s" shows "compact ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 4609 | proof- | |
| 4610 | let ?f = "\<lambda>x. scaleR c x" | |
| 44282 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 huffman parents: 
44252diff
changeset | 4611 | have *:"bounded_linear ?f" by (rule bounded_linear_scaleR_right) | 
| 33175 | 4612 | show ?thesis using compact_continuous_image[of s ?f] continuous_at_imp_continuous_on[of s ?f] | 
| 4613 | using linear_continuous_at[OF *] assms by auto | |
| 4614 | qed | |
| 4615 | ||
| 4616 | lemma compact_negations: | |
| 4617 | fixes s :: "'a::real_normed_vector set" | |
| 4618 | assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)" | |
| 4619 | using compact_scaling [OF assms, of "- 1"] by auto | |
| 4620 | ||
| 4621 | lemma compact_sums: | |
| 4622 | fixes s t :: "'a::real_normed_vector set" | |
| 4623 |   assumes "compact s"  "compact t"  shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4624 | proof- | |
| 4625 |   have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
 | |
| 4626 | apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto | |
| 4627 | have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)" | |
| 4628 | unfolding continuous_on by (rule ballI) (intro tendsto_intros) | |
| 4629 | thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto | |
| 4630 | qed | |
| 4631 | ||
| 4632 | lemma compact_differences: | |
| 4633 | fixes s t :: "'a::real_normed_vector set" | |
| 4634 |   assumes "compact s" "compact t"  shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4635 | proof- | |
| 4636 |   have "{x - y | x y. x\<in>s \<and> y \<in> t} =  {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}"
 | |
| 4637 | apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto | |
| 4638 | thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto | |
| 4639 | qed | |
| 4640 | ||
| 4641 | lemma compact_translation: | |
| 4642 | fixes s :: "'a::real_normed_vector set" | |
| 4643 | assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)" | |
| 4644 | proof- | |
| 4645 |   have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto
 | |
| 4646 | thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto | |
| 4647 | qed | |
| 4648 | ||
| 4649 | lemma compact_affinity: | |
| 4650 | fixes s :: "'a::real_normed_vector set" | |
| 4651 | assumes "compact s" shows "compact ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 4652 | proof- | |
| 4653 | have "op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto | |
| 4654 | thus ?thesis using compact_translation[OF compact_scaling[OF assms], of a c] by auto | |
| 4655 | qed | |
| 4656 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4657 | text {* Hence we get the following. *}
 | 
| 33175 | 4658 | |
| 4659 | lemma compact_sup_maxdistance: | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4660 | fixes s :: "'a::metric_space set" | 
| 33175 | 4661 |   assumes "compact s"  "s \<noteq> {}"
 | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4662 | shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y" | 
| 33175 | 4663 | proof- | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4664 | have "compact (s \<times> s)" using `compact s` by (intro compact_Times) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4665 |   moreover have "s \<times> s \<noteq> {}" using `s \<noteq> {}` by auto
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4666 | 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 | 4667 | 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 | 4668 | ultimately show ?thesis | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4669 | using continuous_attains_sup[of "s \<times> s" "\<lambda>x. dist (fst x) (snd x)"] by auto | 
| 33175 | 4670 | qed | 
| 4671 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4672 | text {* We can state this in terms of diameter of a set. *}
 | 
| 33175 | 4673 | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4674 | definition "diameter s = (if s = {} then 0::real else Sup {dist x y | x y. x \<in> s \<and> y \<in> s})"
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4675 | |
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4676 | lemma diameter_bounded_bound: | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4677 | fixes s :: "'a :: metric_space set" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4678 | assumes s: "bounded s" "x \<in> s" "y \<in> s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4679 | shows "dist x y \<le> diameter s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4680 | proof - | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4681 |   let ?D = "{dist x y |x y. x \<in> s \<and> y \<in> s}"
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4682 | 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 | 4683 | unfolding bounded_def by auto | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4684 | have "dist x y \<le> Sup ?D" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 4685 | proof (rule cSup_upper, safe) | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4686 | fix a b assume "a \<in> s" "b \<in> s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4687 | with z[of a] z[of b] dist_triangle[of a b z] | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4688 | show "dist a b \<le> 2 * d" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4689 | by (simp add: dist_commute) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4690 | qed (insert s, auto) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4691 | with `x \<in> s` show ?thesis | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4692 | by (auto simp add: diameter_def) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4693 | qed | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4694 | |
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4695 | lemma diameter_lower_bounded: | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4696 | fixes s :: "'a :: metric_space set" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4697 | assumes s: "bounded s" and d: "0 < d" "d < diameter s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4698 | 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 | 4699 | proof (rule ccontr) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4700 |   let ?D = "{dist x y |x y. x \<in> s \<and> y \<in> s}"
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4701 | assume contr: "\<not> ?thesis" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4702 | moreover | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4703 |   from d have "s \<noteq> {}"
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4704 | by (auto simp: diameter_def) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4705 |   then have "?D \<noteq> {}" by auto
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4706 | ultimately have "Sup ?D \<le> d" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 4707 | by (intro cSup_least) (auto simp: not_less) | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4708 |   with `d < diameter s` `s \<noteq> {}` show False
 | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4709 | by (auto simp: diameter_def) | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4710 | qed | 
| 33175 | 4711 | |
| 4712 | lemma diameter_bounded: | |
| 4713 | assumes "bounded s" | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4714 | shows "\<forall>x\<in>s. \<forall>y\<in>s. dist x y \<le> diameter s" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4715 | "\<forall>d>0. d < diameter s \<longrightarrow> (\<exists>x\<in>s. \<exists>y\<in>s. dist x y > d)" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4716 | 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 | 4717 | by auto | 
| 33175 | 4718 | |
| 4719 | lemma diameter_compact_attained: | |
| 4720 |   assumes "compact s"  "s \<noteq> {}"
 | |
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4721 | 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 | 4722 | proof - | 
| 33175 | 4723 | have b:"bounded s" using assms(1) by (rule compact_imp_bounded) | 
| 50973 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4724 | then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y" | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4725 | using compact_sup_maxdistance[OF assms] by auto | 
| 
4a2c82644889
generalized diameter from real_normed_vector to metric_space
 hoelzl parents: 
50972diff
changeset | 4726 | hence "diameter s \<le> dist x y" | 
| 51475 
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
 hoelzl parents: 
51473diff
changeset | 4727 | unfolding diameter_def by clarsimp (rule cSup_least, fast+) | 
| 33324 | 4728 | thus ?thesis | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 4729 | by (metis b diameter_bounded_bound order_antisym xys) | 
| 33175 | 4730 | qed | 
| 4731 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4732 | text {* Related results with closure as the conclusion. *}
 | 
| 33175 | 4733 | |
| 4734 | lemma closed_scaling: | |
| 4735 | fixes s :: "'a::real_normed_vector set" | |
| 4736 | assumes "closed s" shows "closed ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 4737 | proof(cases "s={}")
 | |
| 4738 | case True thus ?thesis by auto | |
| 4739 | next | |
| 4740 | case False | |
| 4741 | show ?thesis | |
| 4742 | proof(cases "c=0") | |
| 4743 |     have *:"(\<lambda>x. 0) ` s = {0}" using `s\<noteq>{}` by auto
 | |
| 36668 
941ba2da372e
simplify definition of t1_space; generalize lemma closed_sing and related lemmas
 huffman parents: 
36667diff
changeset | 4744 | case True thus ?thesis apply auto unfolding * by auto | 
| 33175 | 4745 | next | 
| 4746 | case False | |
| 4747 |     { fix x l assume as:"\<forall>n::nat. x n \<in> scaleR c ` s"  "(x ---> l) sequentially"
 | |
| 4748 |       { fix n::nat have "scaleR (1 / c) (x n) \<in> s"
 | |
| 4749 | using as(1)[THEN spec[where x=n]] | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4750 | using `c\<noteq>0` by auto | 
| 33175 | 4751 | } | 
| 4752 | moreover | |
| 4753 |       { fix e::real assume "e>0"
 | |
| 4754 | hence "0 < e *\<bar>c\<bar>" using `c\<noteq>0` mult_pos_pos[of e "abs c"] by auto | |
| 4755 | then obtain N where "\<forall>n\<ge>N. dist (x n) l < e * \<bar>c\<bar>" | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 4756 | using as(2)[unfolded LIMSEQ_def, THEN spec[where x="e * abs c"]] by auto | 
| 33175 | 4757 | hence "\<exists>N. \<forall>n\<ge>N. dist (scaleR (1 / c) (x n)) (scaleR (1 / c) l) < e" | 
| 4758 | unfolding dist_norm unfolding scaleR_right_diff_distrib[THEN sym] | |
| 4759 | using mult_imp_div_pos_less[of "abs c" _ e] `c\<noteq>0` by auto } | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 4760 | hence "((\<lambda>n. scaleR (1 / c) (x n)) ---> scaleR (1 / c) l) sequentially" unfolding LIMSEQ_def by auto | 
| 33175 | 4761 | ultimately have "l \<in> scaleR c ` s" | 
| 4762 | using assms[unfolded closed_sequential_limits, THEN spec[where x="\<lambda>n. scaleR (1/c) (x n)"], THEN spec[where x="scaleR (1/c) l"]] | |
| 4763 | unfolding image_iff using `c\<noteq>0` apply(rule_tac x="scaleR (1 / c) l" in bexI) by auto } | |
| 4764 | thus ?thesis unfolding closed_sequential_limits by fast | |
| 4765 | qed | |
| 4766 | qed | |
| 4767 | ||
| 4768 | lemma closed_negations: | |
| 4769 | fixes s :: "'a::real_normed_vector set" | |
| 4770 | assumes "closed s" shows "closed ((\<lambda>x. -x) ` s)" | |
| 4771 | using closed_scaling[OF assms, of "- 1"] by simp | |
| 4772 | ||
| 4773 | lemma compact_closed_sums: | |
| 4774 | fixes s :: "'a::real_normed_vector set" | |
| 4775 |   assumes "compact s"  "closed t"  shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4776 | proof- | |
| 4777 |   let ?S = "{x + y |x y. x \<in> s \<and> y \<in> t}"
 | |
| 4778 |   { fix x l assume as:"\<forall>n. x n \<in> ?S"  "(x ---> l) sequentially"
 | |
| 4779 | 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" | |
| 4780 | using choice[of "\<lambda>n y. x n = (fst y) + (snd y) \<and> fst y \<in> s \<and> snd y \<in> t"] by auto | |
| 4781 | obtain l' r where "l'\<in>s" and r:"subseq r" and lr:"(((\<lambda>n. fst (f n)) \<circ> r) ---> l') sequentially" | |
| 4782 | using assms(1)[unfolded compact_def, THEN spec[where x="\<lambda> n. fst (f n)"]] using f(2) by auto | |
| 4783 | have "((\<lambda>n. snd (f (r n))) ---> l - l') sequentially" | |
| 50972 | 4784 | using tendsto_diff[OF LIMSEQ_subseq_LIMSEQ[OF as(2) r] lr] and f(1) unfolding o_def by auto | 
| 33175 | 4785 | hence "l - l' \<in> t" | 
| 4786 | using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\<lambda> n. snd (f (r n))"], THEN spec[where x="l - l'"]] | |
| 4787 | using f(3) by auto | |
| 4788 | hence "l \<in> ?S" using `l' \<in> s` apply auto apply(rule_tac x=l' in exI) apply(rule_tac x="l - l'" in exI) by auto | |
| 4789 | } | |
| 4790 | thus ?thesis unfolding closed_sequential_limits by fast | |
| 4791 | qed | |
| 4792 | ||
| 4793 | lemma closed_compact_sums: | |
| 4794 | fixes s t :: "'a::real_normed_vector set" | |
| 4795 | assumes "closed s" "compact t" | |
| 4796 |   shows "closed {x + y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4797 | proof- | |
| 4798 |   have "{x + y |x y. x \<in> t \<and> y \<in> s} = {x + y |x y. x \<in> s \<and> y \<in> t}" apply auto
 | |
| 4799 | apply(rule_tac x=y in exI) apply auto apply(rule_tac x=y in exI) by auto | |
| 4800 | thus ?thesis using compact_closed_sums[OF assms(2,1)] by simp | |
| 4801 | qed | |
| 4802 | ||
| 4803 | lemma compact_closed_differences: | |
| 4804 | fixes s t :: "'a::real_normed_vector set" | |
| 4805 | assumes "compact s" "closed t" | |
| 4806 |   shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4807 | proof- | |
| 4808 |   have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} =  {x - y |x y. x \<in> s \<and> y \<in> t}"
 | |
| 4809 | apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto | |
| 4810 | thus ?thesis using compact_closed_sums[OF assms(1) closed_negations[OF assms(2)]] by auto | |
| 4811 | qed | |
| 4812 | ||
| 4813 | lemma closed_compact_differences: | |
| 4814 | fixes s t :: "'a::real_normed_vector set" | |
| 4815 | assumes "closed s" "compact t" | |
| 4816 |   shows "closed {x - y | x y. x \<in> s \<and> y \<in> t}"
 | |
| 4817 | proof- | |
| 4818 |   have "{x + y |x y. x \<in> s \<and> y \<in> uminus ` t} = {x - y |x y. x \<in> s \<and> y \<in> t}"
 | |
| 4819 | apply auto apply(rule_tac x=xa in exI) apply auto apply(rule_tac x=xa in exI) by auto | |
| 4820 | thus ?thesis using closed_compact_sums[OF assms(1) compact_negations[OF assms(2)]] by simp | |
| 4821 | qed | |
| 4822 | ||
| 4823 | lemma closed_translation: | |
| 4824 | fixes a :: "'a::real_normed_vector" | |
| 4825 | assumes "closed s" shows "closed ((\<lambda>x. a + x) ` s)" | |
| 4826 | proof- | |
| 4827 |   have "{a + y |y. y \<in> s} = (op + a ` s)" by auto
 | |
| 4828 | thus ?thesis using compact_closed_sums[OF compact_sing[of a] assms] by auto | |
| 4829 | qed | |
| 4830 | ||
| 34105 | 4831 | lemma translation_Compl: | 
| 4832 | fixes a :: "'a::ab_group_add" | |
| 4833 | shows "(\<lambda>x. a + x) ` (- t) = - ((\<lambda>x. a + x) ` t)" | |
| 4834 | apply (auto simp add: image_iff) apply(rule_tac x="x - a" in bexI) by auto | |
| 4835 | ||
| 33175 | 4836 | lemma translation_UNIV: | 
| 4837 | fixes a :: "'a::ab_group_add" shows "range (\<lambda>x. a + x) = UNIV" | |
| 4838 | apply (auto simp add: image_iff) apply(rule_tac x="x - a" in exI) by auto | |
| 4839 | ||
| 4840 | lemma translation_diff: | |
| 4841 | fixes a :: "'a::ab_group_add" | |
| 4842 | shows "(\<lambda>x. a + x) ` (s - t) = ((\<lambda>x. a + x) ` s) - ((\<lambda>x. a + x) ` t)" | |
| 4843 | by auto | |
| 4844 | ||
| 4845 | lemma closure_translation: | |
| 4846 | fixes a :: "'a::real_normed_vector" | |
| 4847 | shows "closure ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (closure s)" | |
| 4848 | proof- | |
| 34105 | 4849 | have *:"op + a ` (- s) = - op + a ` s" | 
| 33175 | 4850 | apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto | 
| 34105 | 4851 | show ?thesis unfolding closure_interior translation_Compl | 
| 4852 | using interior_translation[of a "- s"] unfolding * by auto | |
| 33175 | 4853 | qed | 
| 4854 | ||
| 4855 | lemma frontier_translation: | |
| 4856 | fixes a :: "'a::real_normed_vector" | |
| 4857 | shows "frontier((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (frontier s)" | |
| 4858 | unfolding frontier_def translation_diff interior_translation closure_translation by auto | |
| 4859 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4860 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4861 | subsection {* Separation between points and sets *}
 | 
| 33175 | 4862 | |
| 4863 | lemma separate_point_closed: | |
| 4864 | fixes s :: "'a::heine_borel set" | |
| 4865 | shows "closed s \<Longrightarrow> a \<notin> s ==> (\<exists>d>0. \<forall>x\<in>s. d \<le> dist a x)" | |
| 4866 | proof(cases "s = {}")
 | |
| 4867 | case True | |
| 4868 | thus ?thesis by(auto intro!: exI[where x=1]) | |
| 4869 | next | |
| 4870 | case False | |
| 4871 | assume "closed s" "a \<notin> s" | |
| 4872 |   then obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" using `s \<noteq> {}` distance_attains_inf [of s a] by blast
 | |
| 4873 | with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast | |
| 4874 | qed | |
| 4875 | ||
| 4876 | lemma separate_compact_closed: | |
| 50949 | 4877 | fixes s t :: "'a::heine_borel set" | 
| 51346 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4878 |   assumes "compact s" and t: "closed t" "s \<inter> t = {}"
 | 
| 33175 | 4879 | 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 | 4880 | proof cases | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4881 |   assume "s \<noteq> {} \<and> t \<noteq> {}"
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4882 |   then have "s \<noteq> {}" "t \<noteq> {}" by auto
 | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4883 | let ?inf = "\<lambda>x. infdist x t" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4884 | have "continuous_on s ?inf" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4885 | 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 | 4886 | 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 | 4887 |     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 | 4888 | then have "0 < ?inf x" | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4889 |     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 | 4890 | 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 | 4891 | using x by (auto intro: order_trans infdist_le) | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4892 | ultimately show ?thesis | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4893 | by auto | 
| 
d33de22432e2
tuned proofs (used continuity of infdist, dist and continuous_attains_sup)
 hoelzl parents: 
51345diff
changeset | 4894 | qed (auto intro!: exI[of _ 1]) | 
| 33175 | 4895 | |
| 4896 | lemma separate_closed_compact: | |
| 50949 | 4897 | fixes s t :: "'a::heine_borel set" | 
| 33175 | 4898 |   assumes "closed s" and "compact t" and "s \<inter> t = {}"
 | 
| 4899 | shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" | |
| 4900 | proof- | |
| 4901 |   have *:"t \<inter> s = {}" using assms(3) by auto
 | |
| 4902 | show ?thesis using separate_compact_closed[OF assms(2,1) *] | |
| 4903 | apply auto apply(rule_tac x=d in exI) apply auto apply (erule_tac x=y in ballE) | |
| 4904 | by (auto simp add: dist_commute) | |
| 4905 | qed | |
| 4906 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 4907 | |
| 36439 | 4908 | subsection {* Intervals *}
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4909 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4910 | lemma interval: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4911 |   "{a <..< b} = {x::'a. \<forall>i\<in>Basis. a\<bullet>i < x\<bullet>i \<and> x\<bullet>i < b\<bullet>i}" and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4912 |   "{a .. b} = {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i}"
 | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 4913 | by(auto simp add:set_eq_iff eucl_le[where 'a='a] eucl_less[where 'a='a]) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4914 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4915 | lemma mem_interval: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4916 |   "x \<in> {a<..<b} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < x\<bullet>i \<and> x\<bullet>i < b\<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 | 4917 |   "x \<in> {a .. b} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i)"
 | 
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 4918 | using interval[of a b] by(auto simp add: set_eq_iff eucl_le[where 'a='a] eucl_less[where 'a='a]) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4919 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4920 | lemma interval_eq_empty: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4921 |  "({a <..< b} = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i \<le> a\<bullet>i))" (is ?th1) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4922 |  "({a  ..  b} = {} \<longleftrightarrow> (\<exists>i\<in>Basis. b\<bullet>i < a\<bullet>i))" (is ?th2)
 | 
| 33175 | 4923 | 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 | 4924 |   { fix i x assume i:"i\<in>Basis" and as:"b\<bullet>i \<le> a\<bullet>i" and x:"x\<in>{a <..< b}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4925 | hence "a \<bullet> i < x \<bullet> i \<and> x \<bullet> i < b \<bullet> i" unfolding mem_interval by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4926 | hence "a\<bullet>i < b\<bullet>i" by auto | 
| 33175 | 4927 | hence False using as by auto } | 
| 4928 | 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 | 4929 |   { assume as:"\<forall>i\<in>Basis. \<not> (b\<bullet>i \<le> a\<bullet>i)"
 | 
| 33175 | 4930 | let ?x = "(1/2) *\<^sub>R (a + b)" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4931 |     { fix i :: 'a assume i:"i\<in>Basis" 
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4932 | have "a\<bullet>i < b\<bullet>i" using as[THEN bspec[where x=i]] i by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4933 | hence "a\<bullet>i < ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i < b\<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 | 4934 | by (auto simp: inner_add_left) } | 
| 33175 | 4935 |     hence "{a <..< b} \<noteq> {}" using mem_interval(1)[of "?x" a b] by auto  }
 | 
| 4936 | ultimately show ?th1 by blast | |
| 4937 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4938 |   { fix i x assume i:"i\<in>Basis" and as:"b\<bullet>i < a\<bullet>i" and x:"x\<in>{a .. b}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4939 | hence "a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i" unfolding mem_interval by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4940 | hence "a\<bullet>i \<le> b\<bullet>i" by auto | 
| 33175 | 4941 | hence False using as by auto } | 
| 4942 | 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 | 4943 |   { assume as:"\<forall>i\<in>Basis. \<not> (b\<bullet>i < a\<bullet>i)"
 | 
| 33175 | 4944 | let ?x = "(1/2) *\<^sub>R (a + b)" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4945 |     { fix i :: 'a assume i:"i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4946 | have "a\<bullet>i \<le> b\<bullet>i" using as[THEN bspec[where x=i]] i by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4947 | hence "a\<bullet>i \<le> ((1/2) *\<^sub>R (a+b)) \<bullet> i" "((1/2) *\<^sub>R (a+b)) \<bullet> i \<le> b\<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 | 4948 | by (auto simp: inner_add_left) } | 
| 33175 | 4949 |     hence "{a .. b} \<noteq> {}" using mem_interval(2)[of "?x" a b] by auto  }
 | 
| 4950 | ultimately show ?th2 by blast | |
| 4951 | qed | |
| 4952 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4953 | lemma interval_ne_empty: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4954 |   "{a  ..  b} \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i \<le> b\<bullet>i)" and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4955 |   "{a <..< b} \<noteq> {} \<longleftrightarrow> (\<forall>i\<in>Basis. a\<bullet>i < b\<bullet>i)"
 | 
| 44890 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 nipkow parents: 
44668diff
changeset | 4956 | unfolding interval_eq_empty[of a b] by fastforce+ | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4957 | |
| 44584 | 4958 | lemma interval_sing: | 
| 4959 | fixes a :: "'a::ordered_euclidean_space" | |
| 4960 |   shows "{a .. a} = {a}" and "{a<..<a} = {}"
 | |
| 4961 | unfolding set_eq_iff mem_interval eq_iff [symmetric] | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4962 | by (auto intro: euclidean_eqI simp: ex_in_conv) | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4963 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4964 | lemma subset_interval_imp: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4965 |  "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> {c .. d} \<subseteq> {a .. b}" and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4966 |  "(\<forall>i\<in>Basis. a\<bullet>i < c\<bullet>i \<and> d\<bullet>i < b\<bullet>i) \<Longrightarrow> {c .. d} \<subseteq> {a<..<b}" and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4967 |  "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> {c<..<d} \<subseteq> {a .. b}" and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4968 |  "(\<forall>i\<in>Basis. a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i) \<Longrightarrow> {c<..<d} \<subseteq> {a<..<b}"
 | 
| 44584 | 4969 | unfolding subset_eq[unfolded Ball_def] unfolding mem_interval | 
| 4970 | by (best intro: order_trans less_le_trans le_less_trans less_imp_le)+ | |
| 4971 | ||
| 4972 | lemma interval_open_subset_closed: | |
| 4973 | fixes a :: "'a::ordered_euclidean_space" | |
| 4974 |   shows "{a<..<b} \<subseteq> {a .. b}"
 | |
| 4975 | unfolding subset_eq [unfolded Ball_def] mem_interval | |
| 4976 | by (fast intro: less_imp_le) | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4977 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4978 | lemma subset_interval: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4979 |  "{c .. d} \<subseteq> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4980 |  "{c .. d} \<subseteq> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4981 |  "{c<..<d} \<subseteq> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4982 |  "{c<..<d} \<subseteq> {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)
 | 
| 33175 | 4983 | proof- | 
| 4984 | show ?th1 unfolding subset_eq and Ball_def and mem_interval by (auto intro: order_trans) | |
| 4985 | show ?th2 unfolding subset_eq and Ball_def and mem_interval by (auto intro: le_less_trans less_le_trans order_trans less_imp_le) | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4986 |   { assume as: "{c<..<d} \<subseteq> {a .. b}" "\<forall>i\<in>Basis. c\<bullet>i < d\<bullet>i"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4987 |     hence "{c<..<d} \<noteq> {}" unfolding interval_eq_empty 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 | 4988 | fix i :: 'a assume i:"i\<in>Basis" | 
| 33175 | 4989 | (** TODO combine the following two parts as done in the HOL_light version. **) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4990 |     { 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"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4991 | assume as2: "a\<bullet>i > c\<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 | 4992 |       { fix j :: 'a assume j:"j\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4993 | hence "c \<bullet> j < ?x \<bullet> j \<and> ?x \<bullet> j < d \<bullet> j" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4994 | apply(cases "j=i") using as(2)[THEN bspec[where x=j]] i | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4995 | by (auto simp add: as2) } | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4996 |       hence "?x\<in>{c<..<d}" using i unfolding mem_interval by auto
 | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4997 | moreover | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 4998 |       have "?x\<notin>{a .. b}"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 4999 | unfolding mem_interval apply auto apply(rule_tac x=i in bexI) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5000 | using as(2)[THEN bspec[where x=i]] and as2 i | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5001 | by auto | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5002 | ultimately have False using as 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 | 5003 | hence "a\<bullet>i \<le> c\<bullet>i" by(rule ccontr)auto | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5004 | 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 | 5005 |     { 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"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5006 | assume as2: "b\<bullet>i < d\<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 | 5007 |       { fix j :: 'a assume "j\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5008 | hence "d \<bullet> j > ?x \<bullet> j \<and> ?x \<bullet> j > c \<bullet> j" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5009 | apply(cases "j=i") using as(2)[THEN bspec[where x=j]] | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5010 | by (auto simp add: as2) } | 
| 33175 | 5011 |       hence "?x\<in>{c<..<d}" unfolding mem_interval by auto
 | 
| 5012 | moreover | |
| 5013 |       have "?x\<notin>{a .. b}"
 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5014 | unfolding mem_interval apply auto apply(rule_tac x=i in bexI) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5015 | using as(2)[THEN bspec[where x=i]] and as2 using i | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 5016 | by auto | 
| 33175 | 5017 | ultimately have False using as 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 | 5018 | hence "b\<bullet>i \<ge> d\<bullet>i" by(rule ccontr)auto | 
| 33175 | 5019 | ultimately | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5020 | have "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i" by auto | 
| 33175 | 5021 | } note part1 = this | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5022 | show ?th3 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5023 | unfolding subset_eq and Ball_def and mem_interval | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5024 | apply(rule,rule,rule,rule) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5025 | apply(rule part1) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5026 | unfolding subset_eq and Ball_def and mem_interval | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5027 | prefer 4 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5028 | apply auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5029 | by(erule_tac x=xa in allE,erule_tac x=xa in allE,fastforce)+ | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5030 |   { assume as:"{c<..<d} \<subseteq> {a<..<b}" "\<forall>i\<in>Basis. c\<bullet>i < d\<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 | 5031 | fix i :: 'a assume i:"i\<in>Basis" | 
| 33175 | 5032 |     from as(1) have "{c<..<d} \<subseteq> {a..b}" using interval_open_subset_closed[of a b] 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 | 5033 | hence "a\<bullet>i \<le> c\<bullet>i \<and> d\<bullet>i \<le> b\<bullet>i" using part1 and as(2) using i by auto } note * = this | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5034 | show ?th4 unfolding subset_eq and Ball_def and mem_interval | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5035 | apply(rule,rule,rule,rule) apply(rule *) unfolding subset_eq and Ball_def and mem_interval prefer 4 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5036 | apply auto by(erule_tac x=xa in allE, simp)+ | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5037 | qed | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5038 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5039 | lemma inter_interval: fixes a :: "'a::ordered_euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5040 |  "{a .. b} \<inter> {c .. d} =  {(\<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)}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5041 | unfolding set_eq_iff and Int_iff and mem_interval by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5042 | |
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5043 | lemma disjoint_interval: fixes a::"'a::ordered_euclidean_space" shows | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5044 |   "{a .. b} \<inter> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5045 |   "{a .. b} \<inter> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5046 |   "{a<..<b} \<inter> {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) and
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5047 |   "{a<..<b} \<inter> {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)
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5048 | proof- | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5049 | 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" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5050 | have **: "\<And>P Q. (\<And>i :: 'a. i \<in> Basis \<Longrightarrow> Q ?z i \<Longrightarrow> P i) \<Longrightarrow> | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5051 | (\<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)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5052 | 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 | 5053 | note * = set_eq_iff Int_iff empty_iff mem_interval ball_conj_distrib[symmetric] eq_False ball_simps(10) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5054 | show ?th1 unfolding * by (intro **) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5055 | show ?th2 unfolding * by (intro **) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5056 | show ?th3 unfolding * by (intro **) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5057 | show ?th4 unfolding * by (intro **) auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5058 | qed | 
| 33175 | 5059 | |
| 5060 | (* Moved interval_open_subset_closed a bit upwards *) | |
| 5061 | ||
| 44250 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5062 | lemma open_interval[intro]: | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5063 |   fixes a b :: "'a::ordered_euclidean_space" shows "open {a<..<b}"
 | 
| 33175 | 5064 | 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 | 5065 |   have "open (\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i<..<b\<bullet>i})"
 | 
| 44250 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5066 | by (intro open_INT finite_lessThan ballI continuous_open_vimage allI | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5067 | linear_continuous_at open_real_greaterThanLessThan finite_Basis bounded_linear_inner_left) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5068 |   also have "(\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i<..<b\<bullet>i}) = {a<..<b}"
 | 
| 44250 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5069 | by (auto simp add: eucl_less [where 'a='a]) | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5070 |   finally show "open {a<..<b}" .
 | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5071 | qed | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5072 | |
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5073 | lemma closed_interval[intro]: | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5074 |   fixes a b :: "'a::ordered_euclidean_space" shows "closed {a .. b}"
 | 
| 33175 | 5075 | 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 | 5076 |   have "closed (\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i})"
 | 
| 44250 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5077 | by (intro closed_INT ballI continuous_closed_vimage allI | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5078 | linear_continuous_at closed_real_atLeastAtMost finite_Basis bounded_linear_inner_left) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5079 |   also have "(\<Inter>i\<in>Basis. (\<lambda>x. x\<bullet>i) -` {a\<bullet>i .. b\<bullet>i}) = {a .. b}"
 | 
| 44250 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5080 | by (auto simp add: eucl_le [where 'a='a]) | 
| 
9133bc634d9c
simplify proofs of lemmas open_interval, closed_interval
 huffman parents: 
44233diff
changeset | 5081 |   finally show "closed {a .. b}" .
 | 
| 33175 | 5082 | qed | 
| 5083 | ||
| 44519 | 5084 | lemma interior_closed_interval [intro]: | 
| 5085 | fixes a b :: "'a::ordered_euclidean_space" | |
| 5086 |   shows "interior {a..b} = {a<..<b}" (is "?L = ?R")
 | |
| 33175 | 5087 | proof(rule subset_antisym) | 
| 44519 | 5088 | show "?R \<subseteq> ?L" using interval_open_subset_closed open_interval | 
| 5089 | by (rule interior_maximal) | |
| 33175 | 5090 | next | 
| 44519 | 5091 |   { fix x assume "x \<in> interior {a..b}"
 | 
| 5092 |     then obtain s where s:"open s" "x \<in> s" "s \<subseteq> {a..b}" ..
 | |
| 33175 | 5093 |     then obtain e where "e>0" and e:"\<forall>x'. dist x' x < e \<longrightarrow> x' \<in> {a..b}" unfolding open_dist and subset_eq 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 | 5094 |     { fix i :: 'a assume i:"i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5095 | have "dist (x - (e / 2) *\<^sub>R i) x < e" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5096 | "dist (x + (e / 2) *\<^sub>R i) x < e" | 
| 33175 | 5097 | unfolding dist_norm apply 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 | 5098 | unfolding norm_minus_cancel using norm_Basis[OF i] `e>0` by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5099 | hence "a \<bullet> i \<le> (x - (e / 2) *\<^sub>R i) \<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 | 5100 | "(x + (e / 2) *\<^sub>R i) \<bullet> i \<le> b \<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 | 5101 | using e[THEN spec[where x="x - (e/2) *\<^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 | 5102 | and e[THEN spec[where x="x + (e/2) *\<^sub>R i"]] | 
| 44584 | 5103 | unfolding mem_interval using i by blast+ | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5104 | hence "a \<bullet> i < x \<bullet> i" and "x \<bullet> i < b \<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 | 5105 | using `e>0` i by (auto simp: inner_diff_left inner_Basis inner_add_left) } | 
| 33175 | 5106 |     hence "x \<in> {a<..<b}" unfolding mem_interval by auto  }
 | 
| 44519 | 5107 | thus "?L \<subseteq> ?R" .. | 
| 33175 | 5108 | qed | 
| 5109 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5110 | lemma bounded_closed_interval: fixes a :: "'a::ordered_euclidean_space" shows "bounded {a .. b}"
 | 
| 33175 | 5111 | 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 | 5112 | let ?b = "\<Sum>i\<in>Basis. \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5113 |   { fix x::"'a" assume x:"\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<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 | 5114 |     { fix i :: 'a assume "i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5115 | hence "\<bar>x\<bullet>i\<bar> \<le> \<bar>a\<bullet>i\<bar> + \<bar>b\<bullet>i\<bar>" using x[THEN bspec[where x=i]] by auto } | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5116 | hence "(\<Sum>i\<in>Basis. \<bar>x \<bullet> i\<bar>) \<le> ?b" apply-apply(rule setsum_mono) by auto | 
| 33175 | 5117 | hence "norm x \<le> ?b" using norm_le_l1[of x] by auto } | 
| 5118 | thus ?thesis unfolding interval and bounded_iff by auto | |
| 5119 | qed | |
| 5120 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5121 | lemma bounded_interval: fixes a :: "'a::ordered_euclidean_space" shows | 
| 33175 | 5122 |  "bounded {a .. b} \<and> bounded {a<..<b}"
 | 
| 5123 | using bounded_closed_interval[of a b] | |
| 5124 | using interval_open_subset_closed[of a b] | |
| 5125 |   using bounded_subset[of "{a..b}" "{a<..<b}"]
 | |
| 5126 | by simp | |
| 5127 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5128 | lemma not_interval_univ: fixes a :: "'a::ordered_euclidean_space" shows | 
| 33175 | 5129 |  "({a .. b} \<noteq> UNIV) \<and> ({a<..<b} \<noteq> UNIV)"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5130 | using bounded_interval[of a b] by auto | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5131 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5132 | lemma compact_interval: fixes a :: "'a::ordered_euclidean_space" shows "compact {a .. b}"
 | 
| 50884 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 5133 |   using bounded_closed_imp_seq_compact[of "{a..b}"] using bounded_interval[of a b]
 | 
| 
2b21b4e2d7cb
differentiate (cover) compactness and sequential compactness
 hoelzl parents: 
50883diff
changeset | 5134 | by (auto simp: compact_eq_seq_compact_metric) | 
| 33175 | 5135 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5136 | lemma open_interval_midpoint: fixes a :: "'a::ordered_euclidean_space" | 
| 33175 | 5137 |   assumes "{a<..<b} \<noteq> {}" shows "((1/2) *\<^sub>R (a + b)) \<in> {a<..<b}"
 | 
| 5138 | 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 | 5139 |   { fix i :: 'a assume "i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5140 | hence "a \<bullet> i < ((1 / 2) *\<^sub>R (a + b)) \<bullet> i \<and> ((1 / 2) *\<^sub>R (a + b)) \<bullet> i < b \<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 | 5141 | using assms[unfolded interval_ne_empty, THEN bspec[where x=i]] by (auto simp: inner_add_left) } | 
| 33175 | 5142 | thus ?thesis unfolding mem_interval by auto | 
| 5143 | qed | |
| 5144 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5145 | lemma open_closed_interval_convex: fixes x :: "'a::ordered_euclidean_space" | 
| 33175 | 5146 |   assumes x:"x \<in> {a<..<b}" and y:"y \<in> {a .. b}" and e:"0 < e" "e \<le> 1"
 | 
| 5147 |   shows "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<in> {a<..<b}"
 | |
| 5148 | 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 | 5149 |   { fix i :: 'a assume i:"i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5150 | have "a \<bullet> i = e * (a \<bullet> i) + (1 - e) * (a \<bullet> i)" unfolding left_diff_distrib by simp | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5151 | also have "\<dots> < e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)" apply(rule add_less_le_mono) | 
| 33175 | 5152 | using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5153 | using x unfolding mem_interval using i apply simp | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5154 | using y unfolding mem_interval using i apply simp | 
| 33175 | 5155 | 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 | 5156 | finally have "a \<bullet> i < (e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i" unfolding inner_simps by auto | 
| 33175 | 5157 |     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 | 5158 | have "b \<bullet> i = e * (b\<bullet>i) + (1 - e) * (b\<bullet>i)" unfolding left_diff_distrib by simp | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5159 | also have "\<dots> > e * (x \<bullet> i) + (1 - e) * (y \<bullet> i)" apply(rule add_less_le_mono) | 
| 33175 | 5160 | using e unfolding mult_less_cancel_left and mult_le_cancel_left apply simp_all | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5161 | using x unfolding mem_interval using i apply simp | 
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5162 | using y unfolding mem_interval using i apply simp | 
| 33175 | 5163 | 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 | 5164 | finally have "(e *\<^sub>R x + (1 - e) *\<^sub>R y) \<bullet> i < b \<bullet> i" unfolding inner_simps by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5165 | } 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" by auto } | 
| 33175 | 5166 | thus ?thesis unfolding mem_interval by auto | 
| 5167 | qed | |
| 5168 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5169 | lemma closure_open_interval: fixes a :: "'a::ordered_euclidean_space" | 
| 33175 | 5170 |   assumes "{a<..<b} \<noteq> {}"
 | 
| 5171 |   shows "closure {a<..<b} = {a .. b}"
 | |
| 5172 | proof- | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5173 | have ab:"a < b" using assms[unfolded interval_ne_empty] apply(subst eucl_less) by auto | 
| 33175 | 5174 | let ?c = "(1 / 2) *\<^sub>R (a + b)" | 
| 5175 |   { fix x assume as:"x \<in> {a .. b}"
 | |
| 5176 | def f == "\<lambda>n::nat. x + (inverse (real n + 1)) *\<^sub>R (?c - x)" | |
| 5177 |     { fix n assume fn:"f n < b \<longrightarrow> a < f n \<longrightarrow> f n = x" and xc:"x \<noteq> ?c"
 | |
| 5178 | have *:"0 < inverse (real n + 1)" "inverse (real n + 1) \<le> 1" unfolding inverse_le_1_iff by auto | |
| 5179 | have "(inverse (real n + 1)) *\<^sub>R ((1 / 2) *\<^sub>R (a + b)) + (1 - inverse (real n + 1)) *\<^sub>R x = | |
| 5180 | x + (inverse (real n + 1)) *\<^sub>R (((1 / 2) *\<^sub>R (a + b)) - x)" | |
| 5181 | by (auto simp add: algebra_simps) | |
| 5182 | hence "f n < b" and "a < f n" using open_closed_interval_convex[OF open_interval_midpoint[OF assms] as *] unfolding f_def by auto | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5183 | hence False using fn unfolding f_def using xc by auto } | 
| 33175 | 5184 | moreover | 
| 5185 |     { assume "\<not> (f ---> x) sequentially"
 | |
| 5186 |       { fix e::real assume "e>0"
 | |
| 5187 | hence "\<exists>N::nat. inverse (real (N + 1)) < e" using real_arch_inv[of e] apply (auto simp add: Suc_pred') apply(rule_tac x="n - 1" in exI) by auto | |
| 5188 | then obtain N::nat where "inverse (real (N + 1)) < e" by auto | |
| 5189 | hence "\<forall>n\<ge>N. inverse (real n + 1) < e" by (auto, metis Suc_le_mono le_SucE less_imp_inverse_less nat_le_real_less order_less_trans real_of_nat_Suc real_of_nat_Suc_gt_zero) | |
| 5190 | hence "\<exists>N::nat. \<forall>n\<ge>N. inverse (real n + 1) < e" by auto } | |
| 5191 | hence "((\<lambda>n. inverse (real n + 1)) ---> 0) sequentially" | |
| 44907 
93943da0a010
remove redundant lemma Lim_sequentially in favor of lemma LIMSEQ_def
 huffman parents: 
44905diff
changeset | 5192 | unfolding LIMSEQ_def by(auto simp add: dist_norm) | 
| 33175 | 5193 | hence "(f ---> x) sequentially" unfolding f_def | 
| 44125 | 5194 | 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] | 
| 44282 
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
 huffman parents: 
44252diff
changeset | 5195 | using tendsto_scaleR [OF _ tendsto_const, of "\<lambda>n::nat. inverse (real n + 1)" 0 sequentially "((1 / 2) *\<^sub>R (a + b) - x)"] by auto } | 
| 33175 | 5196 |     ultimately have "x \<in> closure {a<..<b}"
 | 
| 5197 | using as and open_interval_midpoint[OF assms] unfolding closure_def unfolding islimpt_sequential by(cases "x=?c")auto } | |
| 5198 | thus ?thesis using closure_minimal[OF interval_open_subset_closed closed_interval, of a b] by blast | |
| 5199 | qed | |
| 5200 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5201 | lemma bounded_subset_open_interval_symmetric: fixes s::"('a::ordered_euclidean_space) set"
 | 
| 33175 | 5202 |   assumes "bounded s"  shows "\<exists>a. s \<subseteq> {-a<..<a}"
 | 
| 5203 | proof- | |
| 5204 | obtain b where "b>0" and b:"\<forall>x\<in>s. norm x \<le> b" using assms[unfolded bounded_pos] 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 | 5205 | def a \<equiv> "(\<Sum>i\<in>Basis. (b + 1) *\<^sub>R i)::'a" | 
| 33175 | 5206 |   { fix x assume "x\<in>s"
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5207 | fix i :: 'a assume i:"i\<in>Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5208 | hence "(-a)\<bullet>i < x\<bullet>i" and "x\<bullet>i < a\<bullet>i" using b[THEN bspec[where x=x], OF `x\<in>s`] | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5209 | and Basis_le_norm[OF i, of x] unfolding inner_simps and a_def by auto } | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5210 | thus ?thesis by(auto intro: exI[where x=a] simp add: eucl_less[where 'a='a]) | 
| 33175 | 5211 | qed | 
| 5212 | ||
| 5213 | lemma bounded_subset_open_interval: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5214 |   fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 5215 |   shows "bounded s ==> (\<exists>a b. s \<subseteq> {a<..<b})"
 | 
| 5216 | by (auto dest!: bounded_subset_open_interval_symmetric) | |
| 5217 | ||
| 5218 | lemma bounded_subset_closed_interval_symmetric: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5219 |   fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 5220 |   assumes "bounded s" shows "\<exists>a. s \<subseteq> {-a .. a}"
 | 
| 5221 | proof- | |
| 5222 |   obtain a where "s \<subseteq> {- a<..<a}" using bounded_subset_open_interval_symmetric[OF assms] by auto
 | |
| 5223 | thus ?thesis using interval_open_subset_closed[of "-a" a] by auto | |
| 5224 | qed | |
| 5225 | ||
| 5226 | lemma bounded_subset_closed_interval: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5227 |   fixes s :: "('a::ordered_euclidean_space) set"
 | 
| 33175 | 5228 |   shows "bounded s ==> (\<exists>a b. s \<subseteq> {a .. b})"
 | 
| 5229 | using bounded_subset_closed_interval_symmetric[of s] by auto | |
| 5230 | ||
| 5231 | lemma frontier_closed_interval: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5232 | fixes a b :: "'a::ordered_euclidean_space" | 
| 33175 | 5233 |   shows "frontier {a .. b} = {a .. b} - {a<..<b}"
 | 
| 5234 | unfolding frontier_def unfolding interior_closed_interval and closure_closed[OF closed_interval] .. | |
| 5235 | ||
| 5236 | lemma frontier_open_interval: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5237 | fixes a b :: "'a::ordered_euclidean_space" | 
| 33175 | 5238 |   shows "frontier {a<..<b} = (if {a<..<b} = {} then {} else {a .. b} - {a<..<b})"
 | 
| 5239 | proof(cases "{a<..<b} = {}")
 | |
| 5240 | case True thus ?thesis using frontier_empty by auto | |
| 5241 | next | |
| 5242 | case False thus ?thesis unfolding frontier_def and closure_open_interval[OF False] and interior_open[OF open_interval] by auto | |
| 5243 | qed | |
| 5244 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5245 | lemma inter_interval_mixed_eq_empty: fixes a :: "'a::ordered_euclidean_space" | 
| 33175 | 5246 |   assumes "{c<..<d} \<noteq> {}"  shows "{a<..<b} \<inter> {c .. d} = {} \<longleftrightarrow> {a<..<b} \<inter> {c<..<d} = {}"
 | 
| 5247 | unfolding closure_open_interval[OF assms, THEN sym] unfolding open_inter_closure_eq_empty[OF open_interval] .. | |
| 5248 | ||
| 5249 | ||
| 5250 | (* Some stuff for half-infinite intervals too; FIXME: notation? *) | |
| 5251 | ||
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5252 | lemma closed_interval_left: fixes b::"'a::euclidean_space" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5253 |   shows "closed {x::'a. \<forall>i\<in>Basis. x\<bullet>i \<le> b\<bullet>i}"
 | 
| 33175 | 5254 | 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 | 5255 |   { fix i :: 'a assume i:"i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5256 |     fix x::"'a" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i\<in>Basis. x \<bullet> i \<le> b \<bullet> i}. x' \<noteq> x \<and> dist x' x < e"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5257 |     { assume "x\<bullet>i > b\<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 | 5258 | then obtain y where "y \<bullet> i \<le> b \<bullet> i" "y \<noteq> x" "dist y x < x\<bullet>i - b\<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 | 5259 | using x[THEN spec[where x="x\<bullet>i - b\<bullet>i"]] using i by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5260 | hence False using Basis_le_norm[OF i, of "y - x"] unfolding dist_norm inner_simps using i | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5261 | by auto } | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5262 | hence "x\<bullet>i \<le> b\<bullet>i" by(rule ccontr)auto } | 
| 33175 | 5263 | thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast | 
| 5264 | qed | |
| 5265 | ||
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5266 | lemma closed_interval_right: fixes a::"'a::euclidean_space" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5267 |   shows "closed {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i}"
 | 
| 33175 | 5268 | 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 | 5269 |   { fix i :: 'a assume i:"i\<in>Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5270 |     fix x::"'a" assume x:"\<forall>e>0. \<exists>x'\<in>{x. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i}. x' \<noteq> x \<and> dist x' x < e"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5271 |     { assume "a\<bullet>i > x\<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 | 5272 | then obtain y where "a \<bullet> i \<le> y \<bullet> i" "y \<noteq> x" "dist y x < a\<bullet>i - x\<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 | 5273 | using x[THEN spec[where x="a\<bullet>i - x\<bullet>i"]] i by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5274 | hence False using Basis_le_norm[OF i, of "y - x"] unfolding dist_norm inner_simps by auto } | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5275 | hence "a\<bullet>i \<le> x\<bullet>i" by(rule ccontr)auto } | 
| 33175 | 5276 | thus ?thesis unfolding closed_limpt unfolding islimpt_approachable by blast | 
| 5277 | qed | |
| 5278 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5279 | lemma open_box: "open (box a b)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5280 | proof - | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5281 |   have "open (\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<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 | 5282 | by (auto intro!: continuous_open_vimage continuous_inner continuous_at_id continuous_const) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5283 |   also have "(\<Inter>i\<in>Basis. (op \<bullet> i) -` {a \<bullet> i <..< b \<bullet> i}) = box a b"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5284 | by (auto simp add: box_def inner_commute) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5285 | finally 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 | 5286 | qed | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5287 | |
| 50881 
ae630bab13da
renamed countable_basis_space to second_countable_topology
 hoelzl parents: 
50526diff
changeset | 5288 | instance euclidean_space \<subseteq> second_countable_topology | 
| 50087 | 5289 | 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 | 5290 | def a \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<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 | 5291 | then have a: "\<And>f. (\<Sum>i\<in>Basis. fst (f i) *\<^sub>R i) = a f" by simp | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5292 | def b \<equiv> "\<lambda>f :: 'a \<Rightarrow> (real \<times> real). \<Sum>i\<in>Basis. snd (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 | 5293 | then have b: "\<And>f. (\<Sum>i\<in>Basis. snd (f i) *\<^sub>R i) = b f" by simp | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5294 | def B \<equiv> "(\<lambda>f. box (a f) (b f)) ` (Basis \<rightarrow>\<^isub>E (\<rat> \<times> \<rat>))" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5295 | |
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5296 | have "Ball B open" by (simp add: B_def open_box) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5297 | moreover have "(\<forall>A. open A \<longrightarrow> (\<exists>B'\<subseteq>B. \<Union>B' = A))" | 
| 50087 | 5298 | proof safe | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5299 | fix A::"'a set" assume "open A" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5300 | show "\<exists>B'\<subseteq>B. \<Union>B' = A" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5301 |       apply (rule exI[of _ "{b\<in>B. b \<subseteq> A}"])
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5302 | apply (subst (3) open_UNION_box[OF `open A`]) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5303 | apply (auto simp add: a b B_def) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5304 | done | 
| 50087 | 5305 | qed | 
| 5306 | ultimately | |
| 51343 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 5307 | have "topological_basis B" unfolding topological_basis_def by blast | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 5308 | moreover | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 5309 | have "countable B" unfolding B_def | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 5310 | by (intro countable_image countable_PiE finite_Basis countable_SIGMA countable_rat) | 
| 
b61b32f62c78
use generate_topology for second countable topologies, does not require intersection stable basis
 hoelzl parents: 
51342diff
changeset | 5311 | ultimately show "\<exists>B::'a 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 | 5312 | by (blast intro: topological_basis_imp_subbasis) | 
| 50087 | 5313 | qed | 
| 5314 | ||
| 51103 | 5315 | instance euclidean_space \<subseteq> polish_space .. | 
| 50087 | 5316 | |
| 36439 | 5317 | text {* Intervals in general, including infinite and mixtures of open and closed. *}
 | 
| 33175 | 5318 | |
| 37732 
6432bf0d7191
generalize type of is_interval to class euclidean_space
 huffman parents: 
37680diff
changeset | 5319 | definition "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
 | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5320 | (\<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)" | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5321 | |
| 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5322 | lemma is_interval_interval: "is_interval {a .. b::'a::ordered_euclidean_space}" (is ?th1)
 | 
| 39086 
c4b809e57fe0
preimages of open sets over continuous function are open
 hoelzl parents: 
38656diff
changeset | 5323 |   "is_interval {a<..<b}" (is ?th2) proof -
 | 
| 33175 | 5324 | show ?th1 ?th2 unfolding is_interval_def mem_interval Ball_def atLeastAtMost_iff | 
| 44584 | 5325 | by(meson order_trans le_less_trans less_le_trans less_trans)+ qed | 
| 33175 | 5326 | |
| 5327 | lemma is_interval_empty: | |
| 5328 |  "is_interval {}"
 | |
| 5329 | unfolding is_interval_def | |
| 5330 | by simp | |
| 5331 | ||
| 5332 | lemma is_interval_univ: | |
| 5333 | "is_interval UNIV" | |
| 5334 | unfolding is_interval_def | |
| 5335 | by simp | |
| 5336 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5337 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5338 | subsection {* Closure of halfspaces and hyperplanes *}
 | 
| 33175 | 5339 | |
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5340 | lemma isCont_open_vimage: | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5341 | assumes "\<And>x. isCont f x" and "open s" shows "open (f -` s)" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5342 | proof - | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5343 | 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 | 5344 | unfolding isCont_def continuous_on_def by simp | 
| 44219 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5345 |   hence "open {x \<in> UNIV. f x \<in> s}"
 | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5346 | using open_UNIV `open s` by (rule continuous_open_preimage) | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5347 | thus "open (f -` s)" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5348 | 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 | 5349 | qed | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5350 | |
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5351 | lemma isCont_closed_vimage: | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5352 | assumes "\<And>x. isCont f x" and "closed s" shows "closed (f -` s)" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5353 | 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 | 5354 | 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 | 5355 | |
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5356 | 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 | 5357 | 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 | 5358 | assumes f: "\<And>x. isCont f x" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5359 | assumes g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5360 |   shows "open {x. f x < g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5361 | proof - | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5362 |   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 | 5363 | 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 | 5364 | by (rule isCont_open_vimage) | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5365 |   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 | 5366 | by auto | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5367 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5368 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5369 | |
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5370 | 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 | 5371 | 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 | 5372 | assumes f: "\<And>x. isCont f x" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5373 | assumes g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5374 |   shows "closed {x. f x \<le> g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5375 | proof - | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5376 |   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 | 5377 | 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 | 5378 | by (rule isCont_closed_vimage) | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5379 |   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 | 5380 | by auto | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5381 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5382 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5383 | |
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5384 | 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 | 5385 | 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 | 5386 | assumes f: "\<And>x. isCont f x" | 
| 
f738e3200e24
generalize lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq to class topological_space
 huffman parents: 
44216diff
changeset | 5387 | assumes g: "\<And>x. isCont g x" | 
| 44213 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5388 |   shows "closed {x. f x = g x}"
 | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5389 | proof - | 
| 44216 | 5390 |   have "open {(x::'b, y::'b). x \<noteq> y}"
 | 
| 5391 | unfolding open_prod_def by (auto dest!: hausdorff) | |
| 5392 |   hence "closed {(x::'b, y::'b). x = y}"
 | |
| 5393 | 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 | 5394 | with isCont_Pair [OF f g] | 
| 44216 | 5395 |   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 | 5396 | by (rule isCont_closed_vimage) | 
| 44216 | 5397 |   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 | 5398 | finally show ?thesis . | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5399 | qed | 
| 
6fb54701a11b
add lemmas open_Collect_less, closed_Collect_le, closed_Collect_eq;
 huffman parents: 
44212diff
changeset | 5400 | |
| 33175 | 5401 | lemma continuous_at_inner: "continuous (at x) (inner a)" | 
| 5402 | unfolding continuous_at by (intro tendsto_intros) | |
| 5403 | ||
| 5404 | lemma closed_halfspace_le: "closed {x. inner a x \<le> b}"
 | |
| 44233 | 5405 | by (simp add: closed_Collect_le) | 
| 33175 | 5406 | |
| 5407 | lemma closed_halfspace_ge: "closed {x. inner a x \<ge> b}"
 | |
| 44233 | 5408 | by (simp add: closed_Collect_le) | 
| 33175 | 5409 | |
| 5410 | lemma closed_hyperplane: "closed {x. inner a x = b}"
 | |
| 44233 | 5411 | by (simp add: closed_Collect_eq) | 
| 33175 | 5412 | |
| 5413 | lemma closed_halfspace_component_le: | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5414 |   shows "closed {x::'a::euclidean_space. x\<bullet>i \<le> a}"
 | 
| 44233 | 5415 | by (simp add: closed_Collect_le) | 
| 33175 | 5416 | |
| 5417 | lemma closed_halfspace_component_ge: | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5418 |   shows "closed {x::'a::euclidean_space. x\<bullet>i \<ge> a}"
 | 
| 44233 | 5419 | by (simp add: closed_Collect_le) | 
| 33175 | 5420 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5421 | text {* Openness of halfspaces. *}
 | 
| 33175 | 5422 | |
| 5423 | lemma open_halfspace_lt: "open {x. inner a x < b}"
 | |
| 44233 | 5424 | by (simp add: open_Collect_less) | 
| 33175 | 5425 | |
| 5426 | lemma open_halfspace_gt: "open {x. inner a x > b}"
 | |
| 44233 | 5427 | by (simp add: open_Collect_less) | 
| 33175 | 5428 | |
| 5429 | lemma open_halfspace_component_lt: | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5430 |   shows "open {x::'a::euclidean_space. x\<bullet>i < a}"
 | 
| 44233 | 5431 | by (simp add: open_Collect_less) | 
| 33175 | 5432 | |
| 5433 | lemma open_halfspace_component_gt: | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5434 |   shows "open {x::'a::euclidean_space. x\<bullet>i > a}"
 | 
| 44233 | 5435 | by (simp add: open_Collect_less) | 
| 33175 | 5436 | |
| 38656 | 5437 | text{* Instantiation for intervals on @{text ordered_euclidean_space} *}
 | 
| 5438 | ||
| 5439 | lemma eucl_lessThan_eq_halfspaces: | |
| 5440 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5441 |   shows "{..<a} = (\<Inter>i\<in>Basis. {x. x \<bullet> i < a \<bullet> i})"
 | 
| 38656 | 5442 | by (auto simp: eucl_less[where 'a='a]) | 
| 5443 | ||
| 5444 | lemma eucl_greaterThan_eq_halfspaces: | |
| 5445 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5446 |   shows "{a<..} = (\<Inter>i\<in>Basis. {x. a \<bullet> i < x \<bullet> i})"
 | 
| 38656 | 5447 | by (auto simp: eucl_less[where 'a='a]) | 
| 5448 | ||
| 5449 | lemma eucl_atMost_eq_halfspaces: | |
| 5450 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5451 |   shows "{.. a} = (\<Inter>i\<in>Basis. {x. x \<bullet> i \<le> a \<bullet> i})"
 | 
| 38656 | 5452 | by (auto simp: eucl_le[where 'a='a]) | 
| 5453 | ||
| 5454 | lemma eucl_atLeast_eq_halfspaces: | |
| 5455 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5456 |   shows "{a ..} = (\<Inter>i\<in>Basis. {x. a \<bullet> i \<le> x \<bullet> i})"
 | 
| 38656 | 5457 | by (auto simp: eucl_le[where 'a='a]) | 
| 5458 | ||
| 5459 | lemma open_eucl_lessThan[simp, intro]: | |
| 5460 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 5461 |   shows "open {..< a}"
 | |
| 5462 | by (auto simp: eucl_lessThan_eq_halfspaces open_halfspace_component_lt) | |
| 5463 | ||
| 5464 | lemma open_eucl_greaterThan[simp, intro]: | |
| 5465 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 5466 |   shows "open {a <..}"
 | |
| 5467 | by (auto simp: eucl_greaterThan_eq_halfspaces open_halfspace_component_gt) | |
| 5468 | ||
| 5469 | lemma closed_eucl_atMost[simp, intro]: | |
| 5470 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 5471 |   shows "closed {.. a}"
 | |
| 5472 | unfolding eucl_atMost_eq_halfspaces | |
| 44233 | 5473 | by (simp add: closed_INT closed_Collect_le) | 
| 38656 | 5474 | |
| 5475 | lemma closed_eucl_atLeast[simp, intro]: | |
| 5476 | fixes a :: "'a\<Colon>ordered_euclidean_space" | |
| 5477 |   shows "closed {a ..}"
 | |
| 5478 | unfolding eucl_atLeast_eq_halfspaces | |
| 44233 | 5479 | by (simp add: closed_INT closed_Collect_le) | 
| 38656 | 5480 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5481 | text {* This gives a simple derivation of limit component bounds. *}
 | 
| 33175 | 5482 | |
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5483 | lemma Lim_component_le: fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5484 | assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. f(x)\<bullet>i \<le> b) net" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5485 | 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 | 5486 | 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 | 5487 | |
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5488 | lemma Lim_component_ge: fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5489 | assumes "(f ---> l) net" "\<not> (trivial_limit net)" "eventually (\<lambda>x. b \<le> (f x)\<bullet>i) net" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5490 | 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 | 5491 | 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 | 5492 | |
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5493 | lemma Lim_component_eq: fixes f :: "'a \<Rightarrow> 'b::euclidean_space" | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5494 | assumes net:"(f ---> l) net" "~(trivial_limit net)" and ev:"eventually (\<lambda>x. f(x)\<bullet>i = b) net" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5495 | 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 | 5496 | using ev[unfolded order_eq_iff eventually_conj_iff] | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5497 | using Lim_component_ge[OF net, of b i] and Lim_component_le[OF net, of i b] by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5498 | |
| 33175 | 5499 | text{* Limits relative to a union.                                               *}
 | 
| 5500 | ||
| 5501 | lemma eventually_within_Un: | |
| 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 | 5502 | "eventually P (at x within (s \<union> t)) \<longleftrightarrow> eventually P (at x within s) \<and> eventually P (at x within t)" | 
| 
cd05e9fcc63d
remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
 hoelzl parents: 
51530diff
changeset | 5503 | unfolding eventually_at_filter | 
| 33175 | 5504 | by (auto elim!: eventually_rev_mp) | 
| 5505 | ||
| 5506 | 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 | 5507 | "(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 | 5508 | (f ---> l) (at x within s) \<and> (f ---> l) (at x within t)" | 
| 33175 | 5509 | unfolding tendsto_def | 
| 5510 | by (auto simp add: eventually_within_Un) | |
| 5511 | ||
| 36442 | 5512 | lemma Lim_topological: | 
| 5513 | "(f ---> l) net \<longleftrightarrow> | |
| 5514 | trivial_limit net \<or> | |
| 5515 | (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net)" | |
| 5516 | unfolding tendsto_def trivial_limit_eq by auto | |
| 5517 | ||
| 33175 | 5518 | text{* Some more convenient intermediate-value theorem formulations.             *}
 | 
| 5519 | ||
| 5520 | lemma connected_ivt_hyperplane: | |
| 5521 | assumes "connected s" "x \<in> s" "y \<in> s" "inner a x \<le> b" "b \<le> inner a y" | |
| 5522 | shows "\<exists>z \<in> s. inner a z = b" | |
| 5523 | proof(rule ccontr) | |
| 5524 | assume as:"\<not> (\<exists>z\<in>s. inner a z = b)" | |
| 5525 |   let ?A = "{x. inner a x < b}"
 | |
| 5526 |   let ?B = "{x. inner a x > b}"
 | |
| 5527 | have "open ?A" "open ?B" using open_halfspace_lt and open_halfspace_gt by auto | |
| 5528 |   moreover have "?A \<inter> ?B = {}" by auto
 | |
| 5529 | moreover have "s \<subseteq> ?A \<union> ?B" using as by auto | |
| 5530 | ultimately show False using assms(1)[unfolded connected_def not_ex, THEN spec[where x="?A"], THEN spec[where x="?B"]] and assms(2-5) by auto | |
| 5531 | qed | |
| 5532 | ||
| 37673 
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
 huffman parents: 
37649diff
changeset | 5533 | lemma connected_ivt_component: fixes x::"'a::euclidean_space" shows | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5534 | "connected s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s \<Longrightarrow> x\<bullet>k \<le> a \<Longrightarrow> a \<le> y\<bullet>k \<Longrightarrow> (\<exists>z\<in>s. z\<bullet>k = a)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5535 | using connected_ivt_hyperplane[of s x y "k::'a" a] by (auto simp: inner_commute) | 
| 33175 | 5536 | |
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5537 | |
| 36437 | 5538 | subsection {* Homeomorphisms *}
 | 
| 33175 | 5539 | |
| 5540 | definition "homeomorphism s t f g \<equiv> | |
| 5541 | (\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and> | |
| 5542 | (\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g" | |
| 5543 | ||
| 5544 | definition | |
| 50898 | 5545 | homeomorphic :: "'a::topological_space set \<Rightarrow> 'b::topological_space set \<Rightarrow> bool" | 
| 33175 | 5546 | (infixr "homeomorphic" 60) where | 
| 5547 | homeomorphic_def: "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)" | |
| 5548 | ||
| 5549 | lemma homeomorphic_refl: "s homeomorphic s" | |
| 5550 | unfolding homeomorphic_def | |
| 5551 | unfolding homeomorphism_def | |
| 5552 | using continuous_on_id | |
| 5553 | apply(rule_tac x = "(\<lambda>x. x)" in exI) | |
| 5554 | apply(rule_tac x = "(\<lambda>x. x)" in exI) | |
| 5555 | by blast | |
| 5556 | ||
| 5557 | lemma homeomorphic_sym: | |
| 5558 | "s homeomorphic t \<longleftrightarrow> t homeomorphic s" | |
| 5559 | unfolding homeomorphic_def | |
| 5560 | unfolding homeomorphism_def | |
| 33324 | 5561 | by blast | 
| 33175 | 5562 | |
| 5563 | lemma homeomorphic_trans: | |
| 5564 | assumes "s homeomorphic t" "t homeomorphic u" shows "s homeomorphic u" | |
| 5565 | proof- | |
| 5566 | obtain f1 g1 where fg1:"\<forall>x\<in>s. g1 (f1 x) = x" "f1 ` s = t" "continuous_on s f1" "\<forall>y\<in>t. f1 (g1 y) = y" "g1 ` t = s" "continuous_on t g1" | |
| 5567 | using assms(1) unfolding homeomorphic_def homeomorphism_def by auto | |
| 5568 | obtain f2 g2 where fg2:"\<forall>x\<in>t. g2 (f2 x) = x" "f2 ` t = u" "continuous_on t f2" "\<forall>y\<in>u. f2 (g2 y) = y" "g2 ` u = t" "continuous_on u g2" | |
| 5569 | using assms(2) unfolding homeomorphic_def homeomorphism_def by auto | |
| 5570 | ||
| 5571 |   { fix x assume "x\<in>s" hence "(g1 \<circ> g2) ((f2 \<circ> f1) x) = x" using fg1(1)[THEN bspec[where x=x]] and fg2(1)[THEN bspec[where x="f1 x"]] and fg1(2) by auto }
 | |
| 5572 | moreover have "(f2 \<circ> f1) ` s = u" using fg1(2) fg2(2) by auto | |
| 5573 | moreover have "continuous_on s (f2 \<circ> f1)" using continuous_on_compose[OF fg1(3)] and fg2(3) unfolding fg1(2) by auto | |
| 5574 |   moreover { fix y assume "y\<in>u" hence "(f2 \<circ> f1) ((g1 \<circ> g2) y) = y" using fg2(4)[THEN bspec[where x=y]] and fg1(4)[THEN bspec[where x="g2 y"]] and fg2(5) by auto }
 | |
| 5575 | moreover have "(g1 \<circ> g2) ` u = s" using fg1(5) fg2(5) by auto | |
| 5576 | moreover have "continuous_on u (g1 \<circ> g2)" using continuous_on_compose[OF fg2(6)] and fg1(6) unfolding fg2(5) by auto | |
| 5577 | ultimately show ?thesis unfolding homeomorphic_def homeomorphism_def apply(rule_tac x="f2 \<circ> f1" in exI) apply(rule_tac x="g1 \<circ> g2" in exI) by auto | |
| 5578 | qed | |
| 5579 | ||
| 5580 | lemma homeomorphic_minimal: | |
| 5581 | "s homeomorphic t \<longleftrightarrow> | |
| 5582 | (\<exists>f g. (\<forall>x\<in>s. f(x) \<in> t \<and> (g(f(x)) = x)) \<and> | |
| 5583 | (\<forall>y\<in>t. g(y) \<in> s \<and> (f(g(y)) = y)) \<and> | |
| 5584 | continuous_on s f \<and> continuous_on t g)" | |
| 5585 | unfolding homeomorphic_def homeomorphism_def | |
| 5586 | apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) | |
| 5587 | apply auto apply (rule_tac x=f in exI) apply (rule_tac x=g in exI) apply auto | |
| 5588 | unfolding image_iff | |
| 5589 | apply(erule_tac x="g x" in ballE) apply(erule_tac x="x" in ballE) | |
| 5590 | apply auto apply(rule_tac x="g x" in bexI) apply auto | |
| 5591 | apply(erule_tac x="f x" in ballE) apply(erule_tac x="x" in ballE) | |
| 5592 | apply auto apply(rule_tac x="f x" in bexI) by auto | |
| 5593 | ||
| 36437 | 5594 | text {* Relatively weak hypotheses if a set is compact. *}
 | 
| 33175 | 5595 | |
| 5596 | lemma homeomorphism_compact: | |
| 50898 | 5597 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 33175 | 5598 | assumes "compact s" "continuous_on s f" "f ` s = t" "inj_on f s" | 
| 5599 | shows "\<exists>g. homeomorphism s t f g" | |
| 5600 | proof- | |
| 5601 | def g \<equiv> "\<lambda>x. SOME y. y\<in>s \<and> f y = x" | |
| 5602 | have g:"\<forall>x\<in>s. g (f x) = x" using assms(3) assms(4)[unfolded inj_on_def] unfolding g_def by auto | |
| 5603 |   { fix y assume "y\<in>t"
 | |
| 5604 | then obtain x where x:"f x = y" "x\<in>s" using assms(3) by auto | |
| 5605 | hence "g (f x) = x" using g by auto | |
| 5606 | hence "f (g y) = y" unfolding x(1)[THEN sym] by auto } | |
| 5607 | hence g':"\<forall>x\<in>t. f (g x) = x" by auto | |
| 5608 | moreover | |
| 5609 |   { fix x
 | |
| 5610 | have "x\<in>s \<Longrightarrow> x \<in> g ` t" using g[THEN bspec[where x=x]] unfolding image_iff using assms(3) by(auto intro!: bexI[where x="f x"]) | |
| 5611 | moreover | |
| 5612 |     { assume "x\<in>g ` t"
 | |
| 5613 | then obtain y where y:"y\<in>t" "g y = x" by auto | |
| 5614 | then obtain x' where x':"x'\<in>s" "f x' = y" using assms(3) by auto | |
| 5615 | hence "x \<in> s" unfolding g_def using someI2[of "\<lambda>b. b\<in>s \<and> f b = y" x' "\<lambda>x. x\<in>s"] unfolding y(2)[THEN sym] and g_def by auto } | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 5616 | ultimately have "x\<in>s \<longleftrightarrow> x \<in> g ` t" .. } | 
| 33175 | 5617 | hence "g ` t = s" by auto | 
| 5618 | ultimately | |
| 5619 | show ?thesis unfolding homeomorphism_def homeomorphic_def | |
| 44647 
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
 huffman parents: 
44632diff
changeset | 5620 | apply(rule_tac x=g in exI) using g and assms(3) and continuous_on_inv[OF assms(2,1), of g, unfolded assms(3)] and assms(2) by auto | 
| 33175 | 5621 | qed | 
| 5622 | ||
| 5623 | lemma homeomorphic_compact: | |
| 50898 | 5624 | fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space" | 
| 33175 | 5625 | shows "compact s \<Longrightarrow> continuous_on s f \<Longrightarrow> (f ` s = t) \<Longrightarrow> inj_on f s | 
| 5626 | \<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 | 5627 | unfolding homeomorphic_def by (metis homeomorphism_compact) | 
| 33175 | 5628 | |
| 5629 | text{* Preservation of topological properties.                                   *}
 | |
| 5630 | ||
| 5631 | lemma homeomorphic_compactness: | |
| 5632 | "s homeomorphic t ==> (compact s \<longleftrightarrow> compact t)" | |
| 5633 | unfolding homeomorphic_def homeomorphism_def | |
| 5634 | by (metis compact_continuous_image) | |
| 5635 | ||
| 5636 | text{* Results on translation, scaling etc.                                      *}
 | |
| 5637 | ||
| 5638 | lemma homeomorphic_scaling: | |
| 5639 | fixes s :: "'a::real_normed_vector set" | |
| 5640 | assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. c *\<^sub>R x) ` s)" | |
| 5641 | unfolding homeomorphic_minimal | |
| 5642 | apply(rule_tac x="\<lambda>x. c *\<^sub>R x" in exI) | |
| 5643 | apply(rule_tac x="\<lambda>x. (1 / c) *\<^sub>R x" in exI) | |
| 44531 
1d477a2b1572
replace some continuous_on lemmas with more general versions
 huffman parents: 
44530diff
changeset | 5644 | using assms by (auto simp add: continuous_on_intros) | 
| 33175 | 5645 | |
| 5646 | lemma homeomorphic_translation: | |
| 5647 | fixes s :: "'a::real_normed_vector set" | |
| 5648 | shows "s homeomorphic ((\<lambda>x. a + x) ` s)" | |
| 5649 | unfolding homeomorphic_minimal | |
| 5650 | apply(rule_tac x="\<lambda>x. a + x" in exI) | |
| 5651 | apply(rule_tac x="\<lambda>x. -a + x" in exI) | |
| 5652 | using continuous_on_add[OF continuous_on_const continuous_on_id] by auto | |
| 5653 | ||
| 5654 | lemma homeomorphic_affinity: | |
| 5655 | fixes s :: "'a::real_normed_vector set" | |
| 5656 | assumes "c \<noteq> 0" shows "s homeomorphic ((\<lambda>x. a + c *\<^sub>R x) ` s)" | |
| 5657 | proof- | |
| 5658 | have *:"op + a ` op *\<^sub>R c ` s = (\<lambda>x. a + c *\<^sub>R x) ` s" by auto | |
| 5659 | show ?thesis | |
| 5660 | using homeomorphic_trans | |
| 5661 | using homeomorphic_scaling[OF assms, of s] | |
| 5662 | using homeomorphic_translation[of "(\<lambda>x. c *\<^sub>R x) ` s" a] unfolding * by auto | |
| 5663 | qed | |
| 5664 | ||
| 5665 | lemma homeomorphic_balls: | |
| 50898 | 5666 | fixes a b ::"'a::real_normed_vector" | 
| 33175 | 5667 | assumes "0 < d" "0 < e" | 
| 5668 | shows "(ball a d) homeomorphic (ball b e)" (is ?th) | |
| 5669 | "(cball a d) homeomorphic (cball b e)" (is ?cth) | |
| 5670 | proof- | |
| 5671 | show ?th unfolding homeomorphic_minimal | |
| 5672 | apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) | |
| 5673 | apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) | |
| 51364 | 5674 | using assms | 
| 5675 | apply (auto intro!: continuous_on_intros | |
| 5676 | simp: dist_commute dist_norm pos_divide_less_eq mult_strict_left_mono) | |
| 5677 | done | |
| 33175 | 5678 | next | 
| 5679 | show ?cth unfolding homeomorphic_minimal | |
| 5680 | apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI) | |
| 5681 | apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI) | |
| 51364 | 5682 | using assms | 
| 5683 | apply (auto intro!: continuous_on_intros | |
| 5684 | simp: dist_commute dist_norm pos_divide_le_eq mult_strict_left_mono) | |
| 5685 | done | |
| 33175 | 5686 | qed | 
| 5687 | ||
| 5688 | text{* "Isometry" (up to constant bounds) of injective linear map etc.           *}
 | |
| 5689 | ||
| 5690 | lemma cauchy_isometric: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5691 | fixes x :: "nat \<Rightarrow> 'a::euclidean_space" | 
| 33175 | 5692 | assumes e:"0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and xs:"\<forall>n::nat. x n \<in> s" and cf:"Cauchy(f o x)" | 
| 5693 | shows "Cauchy x" | |
| 5694 | proof- | |
| 5695 | interpret f: bounded_linear f by fact | |
| 5696 |   { fix d::real assume "d>0"
 | |
| 5697 | then obtain N where N:"\<forall>n\<ge>N. norm (f (x n) - f (x N)) < e * d" | |
| 5698 | using cf[unfolded cauchy o_def dist_norm, THEN spec[where x="e*d"]] and e and mult_pos_pos[of e d] by auto | |
| 5699 |     { fix n 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 | 5700 | have "e * norm (x n - x N) \<le> norm (f (x n - x N))" | 
| 33175 | 5701 | using subspace_sub[OF s, of "x n" "x N"] using xs[THEN spec[where x=N]] and xs[THEN spec[where x=n]] | 
| 5702 | using normf[THEN bspec[where x="x n - x N"]] 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 | 5703 | also have "norm (f (x n - x N)) < e * d" | 
| 
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 | 5704 | using `N \<le> n` N unfolding f.diff[THEN sym] by auto | 
| 
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 | 5705 | finally have "norm (x n - x N) < d" using `e>0` by simp } | 
| 33175 | 5706 | hence "\<exists>N. \<forall>n\<ge>N. norm (x n - x N) < d" by auto } | 
| 5707 | thus ?thesis unfolding cauchy and dist_norm by auto | |
| 5708 | qed | |
| 5709 | ||
| 5710 | lemma complete_isometric_image: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5711 | fixes f :: "'a::euclidean_space => 'b::euclidean_space" | 
| 33175 | 5712 | assumes "0 < e" and s:"subspace s" and f:"bounded_linear f" and normf:"\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)" and cs:"complete s" | 
| 5713 | shows "complete(f ` s)" | |
| 5714 | proof- | |
| 5715 |   { fix g assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
 | |
| 33324 | 5716 | then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)" | 
| 33175 | 5717 | using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto | 
| 5718 | hence x:"\<forall>n. x n \<in> s" "\<forall>n. g n = f (x n)" by auto | |
| 39302 
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
 nipkow parents: 
39198diff
changeset | 5719 | hence "f \<circ> x = g" unfolding fun_eq_iff by auto | 
| 33175 | 5720 | then obtain l where "l\<in>s" and l:"(x ---> l) sequentially" | 
| 5721 | using cs[unfolded complete_def, THEN spec[where x="x"]] | |
| 5722 | using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto | |
| 5723 | hence "\<exists>l\<in>f ` s. (g ---> l) sequentially" | |
| 5724 | using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l] | |
| 5725 | unfolding `f \<circ> x = g` by auto } | |
| 5726 | thus ?thesis unfolding complete_def by auto | |
| 5727 | qed | |
| 5728 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5729 | lemma injective_imp_isometric: fixes f::"'a::euclidean_space \<Rightarrow> 'b::euclidean_space" | 
| 33175 | 5730 | assumes s:"closed s" "subspace s" and f:"bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)" | 
| 5731 | shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)" | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5732 | proof(cases "s \<subseteq> {0::'a}")
 | 
| 33175 | 5733 | case True | 
| 5734 |   { fix x assume "x \<in> s"
 | |
| 5735 | hence "x = 0" using True by auto | |
| 5736 | hence "norm x \<le> norm (f x)" by auto } | |
| 5737 | thus ?thesis by(auto intro!: exI[where x=1]) | |
| 5738 | next | |
| 5739 | interpret f: bounded_linear f by fact | |
| 5740 | case False | |
| 5741 | then obtain a where a:"a\<noteq>0" "a\<in>s" by auto | |
| 5742 |   from False have "s \<noteq> {}" by auto
 | |
| 5743 |   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 | 5744 |   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 | 5745 |   let ?S'' = "{x::'a. norm x = norm a}"
 | 
| 33175 | 5746 | |
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36360diff
changeset | 5747 | have "?S'' = frontier(cball 0 (norm a))" unfolding frontier_cball and dist_norm by auto | 
| 33175 | 5748 | hence "compact ?S''" using compact_frontier[OF compact_cball, of 0 "norm a"] by auto | 
| 5749 | moreover have "?S' = s \<inter> ?S''" by auto | |
| 5750 | ultimately have "compact ?S'" using closed_inter_compact[of s ?S''] using s(1) by auto | |
| 5751 | moreover have *:"f ` ?S' = ?S" by auto | |
| 5752 | ultimately have "compact ?S" using compact_continuous_image[OF linear_continuous_on[OF f(1)], of ?S'] by auto | |
| 5753 | hence "closed ?S" using compact_imp_closed by auto | |
| 5754 |   moreover have "?S \<noteq> {}" using a by auto
 | |
| 5755 | ultimately obtain b' where "b'\<in>?S" "\<forall>y\<in>?S. norm b' \<le> norm y" using distance_attains_inf[of ?S 0] unfolding dist_0_norm by auto | |
| 5756 |   then obtain b where "b\<in>s" and ba:"norm b = norm a" and b:"\<forall>x\<in>{x \<in> s. norm x = norm a}. norm (f b) \<le> norm (f x)" unfolding *[THEN sym] unfolding image_iff by auto
 | |
| 5757 | ||
| 5758 | let ?e = "norm (f b) / norm b" | |
| 5759 | have "norm b > 0" using ba and a and norm_ge_zero by auto | |
| 5760 | moreover have "norm (f b) > 0" using f(2)[THEN bspec[where x=b], OF `b\<in>s`] using `norm b >0` unfolding zero_less_norm_iff by auto | |
| 5761 | ultimately have "0 < norm (f b) / norm b" by(simp only: divide_pos_pos) | |
| 5762 | moreover | |
| 5763 |   { fix x assume "x\<in>s"
 | |
| 5764 | hence "norm (f b) / norm b * norm x \<le> norm (f x)" | |
| 5765 | proof(cases "x=0") | |
| 5766 | case True thus "norm (f b) / norm b * norm x \<le> norm (f x)" by auto | |
| 5767 | next | |
| 5768 | case False | |
| 5769 | hence *:"0 < norm a / norm x" using `a\<noteq>0` unfolding zero_less_norm_iff[THEN sym] by(simp only: divide_pos_pos) | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5770 | have "\<forall>c. \<forall>x\<in>s. c *\<^sub>R x \<in> s" using s[unfolded subspace_def] by auto | 
| 33175 | 5771 |       hence "(norm a / norm x) *\<^sub>R x \<in> {x \<in> s. norm x = norm a}" using `x\<in>s` and `x\<noteq>0` by auto
 | 
| 5772 | thus "norm (f b) / norm b * norm x \<le> norm (f x)" using b[THEN bspec[where x="(norm a / norm x) *\<^sub>R x"]] | |
| 5773 | unfolding f.scaleR and ba using `x\<noteq>0` `a\<noteq>0` | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 5774 | by (auto simp add: mult_commute pos_le_divide_eq pos_divide_le_eq) | 
| 33175 | 5775 | qed } | 
| 5776 | ultimately | |
| 5777 | show ?thesis by auto | |
| 5778 | qed | |
| 5779 | ||
| 5780 | 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 | 5781 | fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" | 
| 33175 | 5782 | assumes "subspace s" "bounded_linear f" "\<forall>x\<in>s. f x = 0 --> x = 0" "closed s" | 
| 5783 | shows "closed(f ` s)" | |
| 5784 | proof- | |
| 5785 | obtain e where "e>0" and e:"\<forall>x\<in>s. e * norm x \<le> norm (f x)" using injective_imp_isometric[OF assms(4,1,2,3)] by auto | |
| 5786 | show ?thesis using complete_isometric_image[OF `e>0` assms(1,2) e] and assms(4) | |
| 5787 | unfolding complete_eq_closed[THEN sym] by auto | |
| 5788 | qed | |
| 5789 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5790 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5791 | subsection {* Some properties of a canonical subspace *}
 | 
| 33175 | 5792 | |
| 5793 | 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 | 5794 |   "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 | 5795 | unfolding subspace_def by (auto simp: inner_add_left) | 
| 33175 | 5796 | |
| 5797 | lemma closed_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 | 5798 |  "closed {x::'a::euclidean_space. \<forall>i\<in>Basis. P i --> x\<bullet>i = 0}" (is "closed ?A")
 | 
| 33175 | 5799 | 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 | 5800 |   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 | 5801 |   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 | 5802 | 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 | 5803 |   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 | 5804 | by auto | 
| 
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
 huffman parents: 
44365diff
changeset | 5805 | finally show "closed ?A" . | 
| 33175 | 5806 | qed | 
| 5807 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5808 | lemma dim_substandard: assumes d: "d \<subseteq> Basis" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5809 |   shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _")
 | 
| 33175 | 5810 | 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 | 5811 | let ?D = "Basis :: 'a set" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5812 | have "d \<subseteq> ?A" using d by (auto simp: inner_Basis) | 
| 33175 | 5813 | 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 | 5814 |   { fix x::"'a" assume "x \<in> ?A"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5815 | hence "finite d" "x \<in> ?A" using assms by(auto intro: finite_subset[OF _ finite_Basis]) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5816 | from this d have "x \<in> span d" | 
| 33175 | 5817 | proof(induct d arbitrary: x) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5818 | case empty hence "x=0" apply(rule_tac euclidean_eqI) by auto | 
| 33175 | 5819 |       thus ?case using subspace_0[OF subspace_span[of "{}"]] by auto
 | 
| 5820 | next | |
| 5821 | case (insert k 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 | 5822 | hence *:"\<forall>i\<in>Basis. i \<notin> insert k F \<longrightarrow> x \<bullet> i = 0" by auto | 
| 33175 | 5823 | have **:"F \<subseteq> insert k F" 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 | 5824 | def y \<equiv> "x - (x\<bullet>k) *\<^sub>R k" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5825 | have y:"x = y + (x\<bullet>k) *\<^sub>R k" unfolding y_def by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5826 |       { fix i assume i': "i \<notin> F" "i \<in> Basis"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5827 | hence "y \<bullet> i = 0" unfolding y_def | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5828 | using *[THEN bspec[where x=i]] insert by (auto simp: inner_simps inner_Basis) } | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5829 | hence "y \<in> span F" using insert by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5830 | hence "y \<in> span (insert k F)" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5831 | using span_mono[of F "insert k F"] using assms by auto | 
| 33175 | 5832 | 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 | 5833 | have "k \<in> span (insert k F)" by(rule span_superset, auto) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5834 | hence "(x\<bullet>k) *\<^sub>R k \<in> span (insert k F)" | 
| 36593 
fb69c8cd27bd
define linear algebra concepts using scaleR instead of (op *s); generalized many lemmas, though a few theorems that used to work on type int^'n are a bit less general
 huffman parents: 
36590diff
changeset | 5835 | using span_mul by auto | 
| 33175 | 5836 | ultimately | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5837 | have "y + (x\<bullet>k) *\<^sub>R k \<in> span (insert k F)" | 
| 33175 | 5838 | using span_add by auto | 
| 5839 | thus ?case using y by auto | |
| 5840 | qed | |
| 5841 | } | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5842 | hence "?A \<subseteq> span d" by auto | 
| 33175 | 5843 | 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 | 5844 |   { fix x assume "x \<in> d" hence "x \<in> ?D" using assms by auto  }
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5845 | hence "independent d" using independent_mono[OF independent_Basis, of d] and assms by auto | 
| 33175 | 5846 | moreover | 
| 5847 | have "d \<subseteq> ?D" unfolding subset_eq using assms 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 | 5848 | ultimately show ?thesis using dim_unique[of d ?A] by auto | 
| 33175 | 5849 | qed | 
| 5850 | ||
| 5851 | text{* Hence closure and completeness of all subspaces.                          *}
 | |
| 5852 | ||
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5853 | lemma ex_card: assumes "n \<le> card A" shows "\<exists>S\<subseteq>A. card S = n" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5854 | 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 | 5855 | assume "finite A" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5856 | from ex_bij_betw_nat_finite[OF this] guess f .. | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5857 |   moreover with `n \<le> card A` have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
 | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5858 | 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 | 5859 |   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 | 5860 | 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 | 5861 | 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 | 5862 | next | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5863 | assume "\<not> finite A" with `n \<le> card A` show ?thesis by force | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5864 | qed | 
| 33175 | 5865 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5866 | lemma closed_subspace: fixes s::"('a::euclidean_space) set"
 | 
| 33175 | 5867 | assumes "subspace s" shows "closed s" | 
| 5868 | 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 | 5869 | have "dim s \<le> card (Basis :: 'a set)" using dim_subset_UNIV by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5870 | with ex_card[OF this] obtain d :: "'a set" where t: "card d = dim s" and d: "d \<subseteq> Basis" by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5871 |   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 | 5872 |   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 | 5873 |       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 | 5874 | 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 | 5875 | by (intro subspace_isomorphism[OF subspace_substandard[of "\<lambda>i. i \<notin> d"]]) (auto simp: inner_Basis) | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5876 | then guess f by (elim exE conjE) note f = this | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5877 | interpret f: bounded_linear f using f unfolding linear_conv_bounded_linear 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 | 5878 |   { fix x have "x\<in>?t \<Longrightarrow> f x = 0 \<Longrightarrow> x = 0" using f.zero d f(3)[THEN inj_onD, of x 0] by auto }
 | 
| 33175 | 5879 | moreover have "closed ?t" using closed_substandard . | 
| 5880 | moreover have "subspace ?t" using subspace_substandard . | |
| 5881 | ultimately show ?thesis 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 | 5882 | unfolding f(2) using f(1) unfolding linear_conv_bounded_linear by auto | 
| 33175 | 5883 | qed | 
| 5884 | ||
| 5885 | lemma complete_subspace: | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5886 |   fixes s :: "('a::euclidean_space) set" shows "subspace s ==> complete s"
 | 
| 33175 | 5887 | using complete_eq_closed closed_subspace | 
| 5888 | by auto | |
| 5889 | ||
| 5890 | 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 | 5891 |   fixes s :: "('a::euclidean_space) set"
 | 
| 33175 | 5892 | shows "dim(closure s) = dim s" (is "?dc = ?d") | 
| 5893 | proof- | |
| 5894 | have "?dc \<le> ?d" using closure_minimal[OF span_inc, of s] | |
| 5895 | using closed_subspace[OF subspace_span, of s] | |
| 5896 | using dim_subset[of "closure s" "span s"] unfolding dim_span by auto | |
| 5897 | thus ?thesis using dim_subset[OF closure_subset, of s] by auto | |
| 5898 | qed | |
| 5899 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5900 | |
| 36437 | 5901 | subsection {* Affine transformations of intervals *}
 | 
| 33175 | 5902 | |
| 5903 | lemma real_affinity_le: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5904 | "0 < (m::'a::linordered_field) ==> (m * x + c \<le> y \<longleftrightarrow> x \<le> inverse(m) * y + -(c / m))" | 
| 33175 | 5905 | by (simp add: field_simps inverse_eq_divide) | 
| 5906 | ||
| 5907 | lemma real_le_affinity: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5908 | "0 < (m::'a::linordered_field) ==> (y \<le> m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) \<le> x)" | 
| 33175 | 5909 | by (simp add: field_simps inverse_eq_divide) | 
| 5910 | ||
| 5911 | lemma real_affinity_lt: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5912 | "0 < (m::'a::linordered_field) ==> (m * x + c < y \<longleftrightarrow> x < inverse(m) * y + -(c / m))" | 
| 33175 | 5913 | by (simp add: field_simps inverse_eq_divide) | 
| 5914 | ||
| 5915 | lemma real_lt_affinity: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5916 | "0 < (m::'a::linordered_field) ==> (y < m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) < x)" | 
| 33175 | 5917 | by (simp add: field_simps inverse_eq_divide) | 
| 5918 | ||
| 5919 | lemma real_affinity_eq: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5920 | "(m::'a::linordered_field) \<noteq> 0 ==> (m * x + c = y \<longleftrightarrow> x = inverse(m) * y + -(c / m))" | 
| 33175 | 5921 | by (simp add: field_simps inverse_eq_divide) | 
| 5922 | ||
| 5923 | lemma real_eq_affinity: | |
| 35028 
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
 haftmann parents: 
34999diff
changeset | 5924 | "(m::'a::linordered_field) \<noteq> 0 ==> (y = m * x + c \<longleftrightarrow> inverse(m) * y + -(c / m) = x)" | 
| 33175 | 5925 | by (simp add: field_simps inverse_eq_divide) | 
| 5926 | ||
| 5927 | lemma image_affinity_interval: fixes m::real | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5928 | fixes a b c :: "'a::ordered_euclidean_space" | 
| 33175 | 5929 |   shows "(\<lambda>x. m *\<^sub>R x + c) ` {a .. b} =
 | 
| 5930 |             (if {a .. b} = {} then {}
 | |
| 5931 |             else (if 0 \<le> m then {m *\<^sub>R a + c .. m *\<^sub>R b + c}
 | |
| 5932 |             else {m *\<^sub>R b + c .. m *\<^sub>R a + c}))"
 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5933 | proof(cases "m=0") | 
| 33175 | 5934 |   { fix x assume "x \<le> c" "c \<le> x"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5935 | hence "x=c" unfolding eucl_le[where 'a='a] apply- | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5936 | apply(subst euclidean_eq_iff) by (auto intro: order_antisym) } | 
| 33175 | 5937 | moreover case True | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5938 |   moreover have "c \<in> {m *\<^sub>R a + c..m *\<^sub>R b + c}" unfolding True by(auto simp add: eucl_le[where 'a='a])
 | 
| 33175 | 5939 | ultimately show ?thesis by auto | 
| 5940 | next | |
| 5941 | case False | |
| 5942 |   { fix y assume "a \<le> y" "y \<le> b" "m > 0"
 | |
| 5943 | hence "m *\<^sub>R a + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R b + c" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5944 | unfolding eucl_le[where 'a='a] by (auto simp: inner_simps) | 
| 33175 | 5945 | } moreover | 
| 5946 |   { fix y assume "a \<le> y" "y \<le> b" "m < 0"
 | |
| 5947 | hence "m *\<^sub>R b + c \<le> m *\<^sub>R y + c" "m *\<^sub>R y + c \<le> m *\<^sub>R a + c" | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5948 | unfolding eucl_le[where 'a='a] by(auto simp add: mult_left_mono_neg inner_simps) | 
| 33175 | 5949 | } moreover | 
| 5950 |   { fix y assume "m > 0"  "m *\<^sub>R a + c \<le> y"  "y \<le> m *\<^sub>R b + c"
 | |
| 5951 |     hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5952 | unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a] | 
| 44516 
d9a496ae5d9d
move everything related to 'norm' method into new theory file Norm_Arith.thy
 huffman parents: 
44457diff
changeset | 5953 | apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5954 | by(auto simp add: pos_le_divide_eq pos_divide_le_eq mult_commute diff_le_iff inner_simps) | 
| 33175 | 5955 | } moreover | 
| 5956 |   { fix y assume "m *\<^sub>R b + c \<le> y" "y \<le> m *\<^sub>R a + c" "m < 0"
 | |
| 5957 |     hence "y \<in> (\<lambda>x. m *\<^sub>R x + c) ` {a..b}"
 | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5958 | unfolding image_iff Bex_def mem_interval eucl_le[where 'a='a] | 
| 44516 
d9a496ae5d9d
move everything related to 'norm' method into new theory file Norm_Arith.thy
 huffman parents: 
44457diff
changeset | 5959 | apply (intro exI[where x="(1 / m) *\<^sub>R (y - c)"]) | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50324diff
changeset | 5960 | by(auto simp add: neg_le_divide_eq neg_divide_le_eq mult_commute diff_le_iff inner_simps) | 
| 33175 | 5961 | } | 
| 5962 | ultimately show ?thesis using False by auto | |
| 5963 | qed | |
| 5964 | ||
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
37452diff
changeset | 5965 | lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a..b} =
 | 
| 33175 | 5966 |   (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})"
 | 
| 5967 | using image_affinity_interval[of m 0 a b] by auto | |
| 5968 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5969 | |
| 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 5970 | subsection {* Banach fixed point theorem (not really topological...) *}
 | 
| 33175 | 5971 | |
| 5972 | lemma banach_fix: | |
| 5973 |   assumes s:"complete s" "s \<noteq> {}" and c:"0 \<le> c" "c < 1" and f:"(f ` s) \<subseteq> s" and
 | |
| 5974 | lipschitz:"\<forall>x\<in>s. \<forall>y\<in>s. dist (f x) (f y) \<le> c * dist x y" | |
| 5975 | shows "\<exists>! x\<in>s. (f x = x)" | |
| 5976 | proof- | |
| 5977 | have "1 - c > 0" using c by auto | |
| 5978 | ||
| 5979 | from s(2) obtain z0 where "z0 \<in> s" by auto | |
| 5980 | def z \<equiv> "\<lambda>n. (f ^^ n) z0" | |
| 5981 |   { fix n::nat
 | |
| 5982 | have "z n \<in> s" unfolding z_def | |
| 5983 | proof(induct n) case 0 thus ?case using `z0 \<in>s` by auto | |
| 5984 | next case Suc thus ?case using f by auto qed } | |
| 5985 | note z_in_s = this | |
| 5986 | ||
| 5987 | def d \<equiv> "dist (z 0) (z 1)" | |
| 5988 | ||
| 5989 | have fzn:"\<And>n. f (z n) = z (Suc n)" unfolding z_def by auto | |
| 5990 |   { fix n::nat
 | |
| 5991 | have "dist (z n) (z (Suc n)) \<le> (c ^ n) * d" | |
| 5992 | proof(induct n) | |
| 5993 | case 0 thus ?case unfolding d_def by auto | |
| 5994 | next | |
| 5995 | case (Suc m) | |
| 5996 | hence "c * dist (z m) (z (Suc m)) \<le> c ^ Suc m * d" | |
| 38642 
8fa437809c67
dropped type classes mult_mono and mult_mono1; tuned names of technical rule duplicates
 haftmann parents: 
37732diff
changeset | 5997 | using `0 \<le> c` using mult_left_mono[of "dist (z m) (z (Suc m))" "c ^ m * d" c] by auto | 
| 33175 | 5998 | thus ?case using lipschitz[THEN bspec[where x="z m"], OF z_in_s, THEN bspec[where x="z (Suc m)"], OF z_in_s] | 
| 5999 | unfolding fzn and mult_le_cancel_left by auto | |
| 6000 | qed | |
| 6001 | } note cf_z = this | |
| 6002 | ||
| 6003 |   { fix n m::nat
 | |
| 6004 | have "(1 - c) * dist (z m) (z (m+n)) \<le> (c ^ m) * d * (1 - c ^ n)" | |
| 6005 | proof(induct n) | |
| 6006 | case 0 show ?case by auto | |
| 6007 | next | |
| 6008 | case (Suc k) | |
| 6009 | have "(1 - c) * dist (z m) (z (m + Suc k)) \<le> (1 - c) * (dist (z m) (z (m + k)) + dist (z (m + k)) (z (Suc (m + k))))" | |
| 6010 | using dist_triangle and c by(auto simp add: dist_triangle) | |
| 6011 | also have "\<dots> \<le> (1 - c) * (dist (z m) (z (m + k)) + c ^ (m + k) * d)" | |
| 6012 | using cf_z[of "m + k"] and c by auto | |
| 6013 | also have "\<dots> \<le> c ^ m * d * (1 - c ^ k) + (1 - c) * c ^ (m + k) * d" | |
| 36350 | 6014 | using Suc by (auto simp add: field_simps) | 
| 33175 | 6015 | also have "\<dots> = (c ^ m) * (d * (1 - c ^ k) + (1 - c) * c ^ k * d)" | 
| 36350 | 6016 | unfolding power_add by (auto simp add: field_simps) | 
| 33175 | 6017 | also have "\<dots> \<le> (c ^ m) * d * (1 - c ^ Suc k)" | 
| 36350 | 6018 | using c by (auto simp add: field_simps) | 
| 33175 | 6019 | finally show ?case by auto | 
| 6020 | qed | |
| 6021 | } note cf_z2 = this | |
| 6022 |   { fix e::real assume "e>0"
 | |
| 6023 | hence "\<exists>N. \<forall>m n. N \<le> m \<and> N \<le> n \<longrightarrow> dist (z m) (z n) < e" | |
| 6024 | proof(cases "d = 0") | |
| 6025 | case True | |
| 41863 | 6026 | have *: "\<And>x. ((1 - c) * x \<le> 0) = (x \<le> 0)" using `1 - c > 0` | 
| 45051 
c478d1876371
discontinued legacy theorem names from RealDef.thy
 huffman parents: 
45031diff
changeset | 6027 | by (metis mult_zero_left mult_commute real_mult_le_cancel_iff1) | 
| 41863 | 6028 | from True have "\<And>n. z n = z0" using cf_z2[of 0] and c unfolding z_def | 
| 6029 | by (simp add: *) | |
| 33175 | 6030 | thus ?thesis using `e>0` by auto | 
| 6031 | next | |
| 6032 | case False hence "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 | 6033 | by (metis False d_def less_le) | 
| 33175 | 6034 | hence "0 < e * (1 - c) / d" using `e>0` and `1-c>0` | 
| 6035 | using divide_pos_pos[of "e * (1 - c)" d] and mult_pos_pos[of e "1 - c"] by auto | |
| 6036 | then obtain N where N:"c ^ N < e * (1 - c) / d" using real_arch_pow_inv[of "e * (1 - c) / d" c] and c by auto | |
| 6037 |       { fix m n::nat assume "m>n" and as:"m\<ge>N" "n\<ge>N"
 | |
| 6038 | have *:"c ^ n \<le> c ^ N" using `n\<ge>N` and c using power_decreasing[OF `n\<ge>N`, of c] by auto | |
| 6039 | have "1 - c ^ (m - n) > 0" using c and power_strict_mono[of c 1 "m - n"] using `m>n` by auto | |
| 6040 | hence **:"d * (1 - c ^ (m - n)) / (1 - c) > 0" | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 6041 | using mult_pos_pos[OF `d>0`, of "1 - c ^ (m - n)"] | 
| 33175 | 6042 | using divide_pos_pos[of "d * (1 - c ^ (m - n))" "1 - c"] | 
| 6043 | using `0 < 1 - c` by auto | |
| 6044 | ||
| 6045 | have "dist (z m) (z n) \<le> c ^ n * d * (1 - c ^ (m - n)) / (1 - c)" | |
| 6046 | using cf_z2[of n "m - n"] and `m>n` unfolding pos_le_divide_eq[OF `1-c>0`] | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 6047 | by (auto simp add: mult_commute dist_commute) | 
| 33175 | 6048 | also have "\<dots> \<le> c ^ N * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 6049 | using mult_right_mono[OF * order_less_imp_le[OF **]] | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 6050 | unfolding mult_assoc by auto | 
| 33175 | 6051 | also have "\<dots> < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)" | 
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 6052 | using mult_strict_right_mono[OF N **] unfolding mult_assoc by auto | 
| 33175 | 6053 | also have "\<dots> = e * (1 - c ^ (m - n))" using c and `d>0` and `1 - c > 0` by auto | 
| 6054 | also have "\<dots> \<le> e" using c and `1 - c ^ (m - n) > 0` and `e>0` using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto | |
| 6055 | finally have "dist (z m) (z n) < e" by auto | |
| 6056 | } note * = this | |
| 6057 |       { fix m n::nat assume as:"N\<le>m" "N\<le>n"
 | |
| 6058 | hence "dist (z n) (z m) < e" | |
| 6059 | proof(cases "n = m") | |
| 6060 | case True thus ?thesis using `e>0` by auto | |
| 6061 | next | |
| 6062 | case False thus ?thesis using as and *[of n m] *[of m n] unfolding nat_neq_iff by (auto simp add: dist_commute) | |
| 6063 | qed } | |
| 6064 | thus ?thesis by auto | |
| 6065 | qed | |
| 6066 | } | |
| 6067 | hence "Cauchy z" unfolding cauchy_def by auto | |
| 6068 | then obtain x where "x\<in>s" and x:"(z ---> x) sequentially" using s(1)[unfolded compact_def complete_def, THEN spec[where x=z]] and z_in_s by auto | |
| 6069 | ||
| 6070 | def e \<equiv> "dist (f x) x" | |
| 6071 | have "e = 0" proof(rule ccontr) | |
| 6072 | assume "e \<noteq> 0" hence "e>0" unfolding e_def using zero_le_dist[of "f x" x] | |
| 6073 | by (metis dist_eq_0_iff dist_nz e_def) | |
| 6074 | 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 | 6075 | using x[unfolded LIMSEQ_def, THEN spec[where x="e/2"]] by auto | 
| 33175 | 6076 | hence N':"dist (z N) x < e / 2" by auto | 
| 6077 | ||
| 6078 | have *:"c * dist (z N) x \<le> dist (z N) x" unfolding mult_le_cancel_right2 | |
| 6079 | using zero_le_dist[of "z N" x] and c | |
| 36778 
739a9379e29b
avoid using real-specific versions of generic lemmas
 huffman parents: 
36669diff
changeset | 6080 | by (metis dist_eq_0_iff dist_nz order_less_asym less_le) | 
| 33175 | 6081 | have "dist (f (z N)) (f x) \<le> c * dist (z N) x" using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]] | 
| 6082 | using z_in_s[of N] `x\<in>s` using c by auto | |
| 6083 | also have "\<dots> < e / 2" using N' and c using * by auto | |
| 6084 | finally show False unfolding fzn | |
| 6085 | using N[THEN spec[where x="Suc N"]] and dist_triangle_half_r[of "z (Suc N)" "f x" e x] | |
| 6086 | unfolding e_def by auto | |
| 6087 | qed | |
| 6088 | hence "f x = x" unfolding e_def by auto | |
| 6089 | moreover | |
| 6090 |   { fix y assume "f y = y" "y\<in>s"
 | |
| 6091 | hence "dist x y \<le> c * dist x y" using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]] | |
| 6092 | using `x\<in>s` and `f x = x` by auto | |
| 6093 | hence "dist x y = 0" unfolding mult_le_cancel_right1 | |
| 6094 | using c and zero_le_dist[of x y] by auto | |
| 6095 | hence "y = x" by auto | |
| 6096 | } | |
| 34999 
5312d2ffee3b
Changed 'bounded unique existential quantifiers' from a constant to syntax translation.
 hoelzl parents: 
34964diff
changeset | 6097 | ultimately show ?thesis using `x\<in>s` by blast+ | 
| 33175 | 6098 | qed | 
| 6099 | ||
| 44210 
eba74571833b
Topology_Euclidean_Space.thy: organize section headings
 huffman parents: 
44207diff
changeset | 6100 | subsection {* Edelstein fixed point theorem *}
 | 
| 33175 | 6101 | |
| 6102 | lemma edelstein_fix: | |
| 50970 
3e5b67f85bf9
generalized theorem edelstein_fix to class metric_space
 huffman parents: 
50955diff
changeset | 6103 | fixes s :: "'a::metric_space set" | 
| 33175 | 6104 |   assumes s:"compact s" "s \<noteq> {}" and gs:"(g ` s) \<subseteq> s"
 | 
| 6105 | 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 | 6106 | 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 | 6107 | proof - | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6108 | 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 | 6109 |   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 | 6110 | by (rule compact_continuous_image) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6111 | (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 | 6112 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6113 | 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 | 6114 | using dist by fastforce | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6115 | 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 | 6116 | 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 | 6117 | 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 | 6118 | 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 | 6119 | 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 | 6120 | (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 | 6121 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6122 | 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 | 6123 | 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 | 6124 | |
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6125 | have "g a = a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6126 | proof (rule ccontr) | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6127 | assume "g a \<noteq> a" | 
| 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6128 | 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 | 6129 | 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 | 6130 | 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 | 6131 | 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 | 6132 | ultimately show False by auto | 
| 33175 | 6133 | qed | 
| 51347 
f8a00792fbc1
tuned proof of Edelstein fixed point theorem (use continuity of dist and attains_sup)
 hoelzl parents: 
51346diff
changeset | 6134 | 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 | 6135 | 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 | 6136 | ultimately show "\<exists>!x\<in>s. g x = x" using `a \<in> s` by blast | 
| 33175 | 6137 | qed | 
| 6138 | ||
| 44131 
5fc334b94e00
declare tendsto_const [intro] (accidentally removed in 230a8665c919)
 huffman parents: 
44129diff
changeset | 6139 | declare tendsto_const [intro] (* FIXME: move *) | 
| 
5fc334b94e00
declare tendsto_const [intro] (accidentally removed in 230a8665c919)
 huffman parents: 
44129diff
changeset | 6140 | |
| 33175 | 6141 | end |