| author | wenzelm | 
| Mon, 06 Mar 2023 10:16:40 +0100 | |
| changeset 77534 | fc57886e37dd | 
| parent 73795 | 8893e0ed263a | 
| child 77935 | 7f240b0dabd9 | 
| permissions | -rw-r--r-- | 
| 63969 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 1 | (* Title: HOL/Analysis/Convex_Euclidean_Space.thy | 
| 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 2 | Author: L C Paulson, University of Cambridge | 
| 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 3 | Author: Robert Himmelmann, TU Muenchen | 
| 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 4 | Author: Bogdan Grechuk, University of Edinburgh | 
| 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 5 | Author: Armin Heller, TU Muenchen | 
| 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 6 | Author: Johannes Hoelzl, TU Muenchen | 
| 33175 | 7 | *) | 
| 8 | ||
| 69619 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69618diff
changeset | 9 | section \<open>Convex Sets and Functions on (Normed) Euclidean Spaces\<close> | 
| 33175 | 10 | |
| 11 | theory Convex_Euclidean_Space | |
| 44132 | 12 | imports | 
| 69619 
3f7d8e05e0f2
split off Convex.thy: material that does not require Topology_Euclidean_Space
 immler parents: 
69618diff
changeset | 13 | Convex | 
| 69617 | 14 | Topology_Euclidean_Space | 
| 33175 | 15 | begin | 
| 16 | ||
| 70136 | 17 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Topological Properties of Convex Sets and Functions\<close> | 
| 63969 
f4b4fba60b1d
HOL-Analysis: move Library/Convex to Convex_Euclidean_Space
 hoelzl parents: 
63967diff
changeset | 18 | |
| 40377 | 19 | lemma aff_dim_cball: | 
| 53347 | 20 | fixes a :: "'n::euclidean_space" | 
| 21 | assumes "e > 0" | |
| 22 |   shows "aff_dim (cball a e) = int (DIM('n))"
 | |
| 23 | proof - | |
| 24 | have "(\<lambda>x. a + x) ` (cball 0 e) \<subseteq> cball a e" | |
| 25 | unfolding cball_def dist_norm by auto | |
| 26 | then have "aff_dim (cball (0 :: 'n::euclidean_space) e) \<le> aff_dim (cball a e)" | |
| 27 | using aff_dim_translation_eq[of a "cball 0 e"] | |
| 67399 | 28 | aff_dim_subset[of "(+) a ` cball 0 e" "cball a e"] | 
| 53347 | 29 | by auto | 
| 30 |   moreover have "aff_dim (cball (0 :: 'n::euclidean_space) e) = int (DIM('n))"
 | |
| 31 | using hull_inc[of "(0 :: 'n::euclidean_space)" "cball 0 e"] | |
| 32 | centre_in_cball[of "(0 :: 'n::euclidean_space)"] assms | |
| 33 | by (simp add: dim_cball[of e] aff_dim_zero[of "cball 0 e"]) | |
| 34 | ultimately show ?thesis | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 35 | using aff_dim_le_DIM[of "cball a e"] by auto | 
| 40377 | 36 | qed | 
| 37 | ||
| 38 | lemma aff_dim_open: | |
| 53347 | 39 | fixes S :: "'n::euclidean_space set" | 
| 40 | assumes "open S" | |
| 41 |     and "S \<noteq> {}"
 | |
| 42 |   shows "aff_dim S = int (DIM('n))"
 | |
| 43 | proof - | |
| 44 | obtain x where "x \<in> S" | |
| 45 | using assms by auto | |
| 46 | then obtain e where e: "e > 0" "cball x e \<subseteq> S" | |
| 47 | using open_contains_cball[of S] assms by auto | |
| 48 | then have "aff_dim (cball x e) \<le> aff_dim S" | |
| 49 | using aff_dim_subset by auto | |
| 50 | with e show ?thesis | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 51 | using aff_dim_cball[of e x] aff_dim_le_DIM[of S] by auto | 
| 40377 | 52 | qed | 
| 53 | ||
| 54 | lemma low_dim_interior: | |
| 53347 | 55 | fixes S :: "'n::euclidean_space set" | 
| 56 |   assumes "\<not> aff_dim S = int (DIM('n))"
 | |
| 57 |   shows "interior S = {}"
 | |
| 58 | proof - | |
| 59 | have "aff_dim(interior S) \<le> aff_dim S" | |
| 60 | using interior_subset aff_dim_subset[of "interior S" S] by auto | |
| 61 | then show ?thesis | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 62 | using aff_dim_open[of "interior S"] aff_dim_le_DIM[of S] assms by auto | 
| 40377 | 63 | qed | 
| 64 | ||
| 60307 
75e1aa7a450e
Convex hulls: theorems about interior, etc. And a few simple lemmas.
 paulson <lp15@cam.ac.uk> parents: 
60303diff
changeset | 65 | corollary empty_interior_lowdim: | 
| 
75e1aa7a450e
Convex hulls: theorems about interior, etc. And a few simple lemmas.
 paulson <lp15@cam.ac.uk> parents: 
60303diff
changeset | 66 | fixes S :: "'n::euclidean_space set" | 
| 
75e1aa7a450e
Convex hulls: theorems about interior, etc. And a few simple lemmas.
 paulson <lp15@cam.ac.uk> parents: 
60303diff
changeset | 67 |   shows "dim S < DIM ('n) \<Longrightarrow> interior S = {}"
 | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 68 | by (metis low_dim_interior affine_hull_UNIV dim_affine_hull less_not_refl dim_UNIV) | 
| 60307 
75e1aa7a450e
Convex hulls: theorems about interior, etc. And a few simple lemmas.
 paulson <lp15@cam.ac.uk> parents: 
60303diff
changeset | 69 | |
| 63016 
3590590699b1
numerous theorems about affine hulls, hyperplanes, etc.
 paulson <lp15@cam.ac.uk> parents: 
63007diff
changeset | 70 | corollary aff_dim_nonempty_interior: | 
| 
3590590699b1
numerous theorems about affine hulls, hyperplanes, etc.
 paulson <lp15@cam.ac.uk> parents: 
63007diff
changeset | 71 | fixes S :: "'a::euclidean_space set" | 
| 
3590590699b1
numerous theorems about affine hulls, hyperplanes, etc.
 paulson <lp15@cam.ac.uk> parents: 
63007diff
changeset | 72 |   shows "interior S \<noteq> {} \<Longrightarrow> aff_dim S = DIM('a)"
 | 
| 
3590590699b1
numerous theorems about affine hulls, hyperplanes, etc.
 paulson <lp15@cam.ac.uk> parents: 
63007diff
changeset | 73 | by (metis low_dim_interior) | 
| 
3590590699b1
numerous theorems about affine hulls, hyperplanes, etc.
 paulson <lp15@cam.ac.uk> parents: 
63007diff
changeset | 74 | |
| 63881 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 75 | |
| 60420 | 76 | subsection \<open>Relative interior of a set\<close> | 
| 40377 | 77 | |
| 70136 | 78 | definition\<^marker>\<open>tag important\<close> "rel_interior S = | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 79 |   {x. \<exists>T. openin (top_of_set (affine hull S)) T \<and> x \<in> T \<and> T \<subseteq> S}"
 | 
| 53347 | 80 | |
| 64287 | 81 | lemma rel_interior_mono: | 
| 82 | "\<lbrakk>S \<subseteq> T; affine hull S = affine hull T\<rbrakk> | |
| 83 | \<Longrightarrow> (rel_interior S) \<subseteq> (rel_interior T)" | |
| 84 | by (auto simp: rel_interior_def) | |
| 85 | ||
| 86 | lemma rel_interior_maximal: | |
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 87 | "\<lbrakk>T \<subseteq> S; openin(top_of_set (affine hull S)) T\<rbrakk> \<Longrightarrow> T \<subseteq> (rel_interior S)" | 
| 64287 | 88 | by (auto simp: rel_interior_def) | 
| 89 | ||
| 72356 | 90 | lemma rel_interior: "rel_interior S = {x \<in> S. \<exists>T. open T \<and> x \<in> T \<and> T \<inter> affine hull S \<subseteq> S}"
 | 
| 91 | (is "?lhs = ?rhs") | |
| 92 | proof | |
| 93 | show "?lhs \<subseteq> ?rhs" | |
| 94 | by (force simp add: rel_interior_def openin_open) | |
| 95 |   { fix x T
 | |
| 96 | assume *: "x \<in> S" "open T" "x \<in> T" "T \<inter> affine hull S \<subseteq> S" | |
| 97 | then have **: "x \<in> T \<inter> affine hull S" | |
| 98 | using hull_inc by auto | |
| 99 | with * have "\<exists>Tb. (\<exists>Ta. open Ta \<and> Tb = affine hull S \<inter> Ta) \<and> x \<in> Tb \<and> Tb \<subseteq> S" | |
| 100 | by (rule_tac x = "T \<inter> (affine hull S)" in exI) auto | |
| 101 | } | |
| 102 | then show "?rhs \<subseteq> ?lhs" | |
| 103 | by (force simp add: rel_interior_def openin_open) | |
| 53347 | 104 | qed | 
| 105 | ||
| 106 | lemma mem_rel_interior: "x \<in> rel_interior S \<longleftrightarrow> (\<exists>T. open T \<and> x \<in> T \<inter> S \<and> T \<inter> affine hull S \<subseteq> S)" | |
| 68031 | 107 | by (auto simp: rel_interior) | 
| 53347 | 108 | |
| 109 | lemma mem_rel_interior_ball: | |
| 110 | "x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S)" | |
| 72356 | 111 | (is "?lhs = ?rhs") | 
| 112 | proof | |
| 113 | assume ?rhs then show ?lhs | |
| 114 | by (simp add: rel_interior) (meson Elementary_Metric_Spaces.open_ball centre_in_ball) | |
| 115 | qed (force simp: rel_interior open_contains_ball) | |
| 40377 | 116 | |
| 49531 | 117 | lemma rel_interior_ball: | 
| 53347 | 118 |   "rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S}"
 | 
| 119 | using mem_rel_interior_ball [of _ S] by auto | |
| 120 | ||
| 121 | lemma mem_rel_interior_cball: | |
| 122 | "x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S)" | |
| 72356 | 123 | (is "?lhs = ?rhs") | 
| 124 | proof | |
| 125 | assume ?rhs then obtain e where "x \<in> S" "e > 0" "cball x e \<inter> affine hull S \<subseteq> S" | |
| 126 | by (auto simp: rel_interior) | |
| 127 | then have "ball x e \<inter> affine hull S \<subseteq> S" | |
| 128 | by auto | |
| 129 | then show ?lhs | |
| 130 | using \<open>0 < e\<close> \<open>x \<in> S\<close> rel_interior_ball by auto | |
| 131 | qed (force simp: rel_interior open_contains_cball) | |
| 40377 | 132 | |
| 53347 | 133 | lemma rel_interior_cball: | 
| 134 |   "rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S}"
 | |
| 135 | using mem_rel_interior_cball [of _ S] by auto | |
| 40377 | 136 | |
| 60303 | 137 | lemma rel_interior_empty [simp]: "rel_interior {} = {}"
 | 
| 68031 | 138 | by (auto simp: rel_interior_def) | 
| 40377 | 139 | |
| 60303 | 140 | lemma affine_hull_sing [simp]: "affine hull {a :: 'n::euclidean_space} = {a}"
 | 
| 53347 | 141 | by (metis affine_hull_eq affine_sing) | 
| 40377 | 142 | |
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63092diff
changeset | 143 | lemma rel_interior_sing [simp]: | 
| 72356 | 144 |   fixes a :: "'n::euclidean_space"  shows "rel_interior {a} = {a}"
 | 
| 145 | proof - | |
| 146 | have "\<exists>x::real. 0 < x" | |
| 147 | using zero_less_one by blast | |
| 148 | then show ?thesis | |
| 149 | by (auto simp: rel_interior_ball) | |
| 150 | qed | |
| 40377 | 151 | |
| 152 | lemma subset_rel_interior: | |
| 53347 | 153 | fixes S T :: "'n::euclidean_space set" | 
| 154 | assumes "S \<subseteq> T" | |
| 155 | and "affine hull S = affine hull T" | |
| 156 | shows "rel_interior S \<subseteq> rel_interior T" | |
| 68031 | 157 | using assms by (auto simp: rel_interior_def) | 
| 49531 | 158 | |
| 53347 | 159 | lemma rel_interior_subset: "rel_interior S \<subseteq> S" | 
| 68031 | 160 | by (auto simp: rel_interior_def) | 
| 53347 | 161 | |
| 162 | lemma rel_interior_subset_closure: "rel_interior S \<subseteq> closure S" | |
| 68031 | 163 | using rel_interior_subset by (auto simp: closure_def) | 
| 53347 | 164 | |
| 165 | lemma interior_subset_rel_interior: "interior S \<subseteq> rel_interior S" | |
| 68031 | 166 | by (auto simp: rel_interior interior_def) | 
| 40377 | 167 | |
| 168 | lemma interior_rel_interior: | |
| 53347 | 169 | fixes S :: "'n::euclidean_space set" | 
| 170 |   assumes "aff_dim S = int(DIM('n))"
 | |
| 171 | shows "rel_interior S = interior S" | |
| 40377 | 172 | proof - | 
| 53347 | 173 | have "affine hull S = UNIV" | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 174 | using assms affine_hull_UNIV[of S] by auto | 
| 53347 | 175 | then show ?thesis | 
| 176 | unfolding rel_interior interior_def by auto | |
| 40377 | 177 | qed | 
| 178 | ||
| 60303 | 179 | lemma rel_interior_interior: | 
| 180 | fixes S :: "'n::euclidean_space set" | |
| 181 | assumes "affine hull S = UNIV" | |
| 182 | shows "rel_interior S = interior S" | |
| 183 | using assms unfolding rel_interior interior_def by auto | |
| 184 | ||
| 40377 | 185 | lemma rel_interior_open: | 
| 53347 | 186 | fixes S :: "'n::euclidean_space set" | 
| 187 | assumes "open S" | |
| 188 | shows "rel_interior S = S" | |
| 189 | by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset) | |
| 40377 | 190 | |
| 191 | lemma interior_rel_interior_gen: | |
| 53347 | 192 | fixes S :: "'n::euclidean_space set" | 
| 193 |   shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})"
 | |
| 194 | by (metis interior_rel_interior low_dim_interior) | |
| 40377 | 195 | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 196 | lemma rel_interior_nonempty_interior: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 197 | fixes S :: "'n::euclidean_space set" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 198 |   shows "interior S \<noteq> {} \<Longrightarrow> rel_interior S = interior S"
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 199 | by (metis interior_rel_interior_gen) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 200 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 201 | lemma affine_hull_nonempty_interior: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 202 | fixes S :: "'n::euclidean_space set" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 203 |   shows "interior S \<noteq> {} \<Longrightarrow> affine hull S = UNIV"
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 204 | by (metis affine_hull_UNIV interior_rel_interior_gen) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 205 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 206 | lemma rel_interior_affine_hull [simp]: | 
| 53347 | 207 | fixes S :: "'n::euclidean_space set" | 
| 208 | shows "rel_interior (affine hull S) = affine hull S" | |
| 209 | proof - | |
| 210 | have *: "rel_interior (affine hull S) \<subseteq> affine hull S" | |
| 211 | using rel_interior_subset by auto | |
| 212 |   {
 | |
| 213 | fix x | |
| 214 | assume x: "x \<in> affine hull S" | |
| 63040 | 215 | define e :: real where "e = 1" | 
| 53347 | 216 | then have "e > 0" "ball x e \<inter> affine hull (affine hull S) \<subseteq> affine hull S" | 
| 217 | using hull_hull[of _ S] by auto | |
| 218 | then have "x \<in> rel_interior (affine hull S)" | |
| 219 | using x rel_interior_ball[of "affine hull S"] by auto | |
| 220 | } | |
| 221 | then show ?thesis using * by auto | |
| 40377 | 222 | qed | 
| 223 | ||
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 224 | lemma rel_interior_UNIV [simp]: "rel_interior (UNIV :: ('n::euclidean_space) set) = UNIV"
 | 
| 53347 | 225 | by (metis open_UNIV rel_interior_open) | 
| 40377 | 226 | |
| 227 | lemma rel_interior_convex_shrink: | |
| 53347 | 228 | fixes S :: "'a::euclidean_space set" | 
| 229 | assumes "convex S" | |
| 230 | and "c \<in> rel_interior S" | |
| 231 | and "x \<in> S" | |
| 232 | and "0 < e" | |
| 233 | and "e \<le> 1" | |
| 234 | shows "x - e *\<^sub>R (x - c) \<in> rel_interior S" | |
| 235 | proof - | |
| 54465 | 236 | obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S" | 
| 53347 | 237 | using assms(2) unfolding mem_rel_interior_ball by auto | 
| 238 |   {
 | |
| 239 | fix y | |
| 240 | assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d" "y \<in> affine hull S" | |
| 241 | have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x" | |
| 68031 | 242 | using \<open>e > 0\<close> by (auto simp: scaleR_left_diff_distrib scaleR_right_diff_distrib) | 
| 53347 | 243 | have "x \<in> affine hull S" | 
| 244 | using assms hull_subset[of S] by auto | |
| 49531 | 245 | moreover have "1 / e + - ((1 - e) / e) = 1" | 
| 60420 | 246 | using \<open>e > 0\<close> left_diff_distrib[of "1" "(1-e)" "1/e"] by auto | 
| 53347 | 247 | ultimately have **: "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S" | 
| 248 | using as affine_affine_hull[of S] mem_affine[of "affine hull S" y x "(1 / e)" "-((1 - e) / e)"] | |
| 249 | by (simp add: algebra_simps) | |
| 72356 | 250 | have "c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)" | 
| 60420 | 251 | using \<open>e > 0\<close> | 
| 72356 | 252 | by (auto simp: euclidean_eq_iff[where 'a='a] field_simps inner_simps) | 
| 253 | then have "dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1/e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)" | |
| 254 | unfolding dist_norm norm_scaleR[symmetric] by auto | |
| 61945 | 255 | also have "\<dots> = \<bar>1/e\<bar> * norm (x - e *\<^sub>R (x - c) - y)" | 
| 53347 | 256 | by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps) | 
| 257 | also have "\<dots> < d" | |
| 60420 | 258 | using as[unfolded dist_norm] and \<open>e > 0\<close> | 
| 68031 | 259 | by (auto simp:pos_divide_less_eq[OF \<open>e > 0\<close>] mult.commute) | 
| 72356 | 260 | finally have "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S" | 
| 261 | using "**" d by auto | |
| 262 | then have "y \<in> S" | |
| 263 | using * convexD [OF \<open>convex S\<close>] assms(3-5) | |
| 264 | by (metis diff_add_cancel diff_ge_0_iff_ge le_add_same_cancel1 less_eq_real_def) | |
| 53347 | 265 | } | 
| 266 | then have "ball (x - e *\<^sub>R (x - c)) (e*d) \<inter> affine hull S \<subseteq> S" | |
| 267 | by auto | |
| 268 | moreover have "e * d > 0" | |
| 60420 | 269 | using \<open>e > 0\<close> \<open>d > 0\<close> by simp | 
| 53347 | 270 | moreover have c: "c \<in> S" | 
| 271 | using assms rel_interior_subset by auto | |
| 272 | moreover from c have "x - e *\<^sub>R (x - c) \<in> S" | |
| 72356 | 273 | using convexD_alt[of S x c e] assms | 
| 274 | by (metis diff_add_eq diff_diff_eq2 less_eq_real_def scaleR_diff_left scaleR_one scale_right_diff_distrib) | |
| 53347 | 275 | ultimately show ?thesis | 
| 60420 | 276 | using mem_rel_interior_ball[of "x - e *\<^sub>R (x - c)" S] \<open>e > 0\<close> by auto | 
| 40377 | 277 | qed | 
| 278 | ||
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 279 | lemma interior_real_atLeast [simp]: | 
| 53347 | 280 | fixes a :: real | 
| 281 |   shows "interior {a..} = {a<..}"
 | |
| 282 | proof - | |
| 283 |   {
 | |
| 284 | fix y | |
| 72356 | 285 |     have "ball y (y - a) \<subseteq> {a..}"
 | 
| 286 | by (auto simp: dist_norm) | |
| 287 | moreover assume "a < y" | |
| 288 |     ultimately have "y \<in> interior {a..}"
 | |
| 289 | by (force simp add: mem_interior) | |
| 53347 | 290 | } | 
| 291 | moreover | |
| 292 |   {
 | |
| 293 | fix y | |
| 294 |     assume "y \<in> interior {a..}"
 | |
| 295 |     then obtain e where e: "e > 0" "cball y e \<subseteq> {a..}"
 | |
| 296 |       using mem_interior_cball[of y "{a..}"] by auto
 | |
| 297 | moreover from e have "y - e \<in> cball y e" | |
| 68031 | 298 | by (auto simp: cball_def dist_norm) | 
| 60307 
75e1aa7a450e
Convex hulls: theorems about interior, etc. And a few simple lemmas.
 paulson <lp15@cam.ac.uk> parents: 
60303diff
changeset | 299 | ultimately have "a \<le> y - e" by blast | 
| 53347 | 300 | then have "a < y" using e by auto | 
| 301 | } | |
| 302 | ultimately show ?thesis by auto | |
| 40377 | 303 | qed | 
| 304 | ||
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 305 | lemma continuous_ge_on_Ioo: | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 306 |   assumes "continuous_on {c..d} g" "\<And>x. x \<in> {c<..<d} \<Longrightarrow> g x \<ge> a" "c < d" "x \<in> {c..d}"
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 307 | shows "g (x::real) \<ge> (a::real)" | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 308 | proof- | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 309 |   from assms(3) have "{c..d} = closure {c<..<d}" by (rule closure_greaterThanLessThan[symmetric])
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 310 |   also from assms(2) have "{c<..<d} \<subseteq> (g -` {a..} \<inter> {c..d})" by auto
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 311 |   hence "closure {c<..<d} \<subseteq> closure (g -` {a..} \<inter> {c..d})" by (rule closure_mono)
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 312 |   also from assms(1) have "closed (g -` {a..} \<inter> {c..d})"
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 313 | by (auto simp: continuous_on_closed_vimage) | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 314 |   hence "closure (g -` {a..} \<inter> {c..d}) = g -` {a..} \<inter> {c..d}" by simp
 | 
| 62087 
44841d07ef1d
revisions to limits and derivatives, plus new lemmas
 paulson parents: 
61952diff
changeset | 315 |   finally show ?thesis using \<open>x \<in> {c..d}\<close> by auto
 | 
| 
44841d07ef1d
revisions to limits and derivatives, plus new lemmas
 paulson parents: 
61952diff
changeset | 316 | qed | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 317 | |
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 318 | lemma interior_real_atMost [simp]: | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 319 | fixes a :: real | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 320 |   shows "interior {..a} = {..<a}"
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 321 | proof - | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 322 |   {
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 323 | fix y | 
| 72356 | 324 |     have "ball y (a - y) \<subseteq> {..a}"
 | 
| 325 | by (auto simp: dist_norm) | |
| 326 | moreover assume "a > y" | |
| 327 |     ultimately have "y \<in> interior {..a}"
 | |
| 328 | by (force simp add: mem_interior) | |
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 329 | } | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 330 | moreover | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 331 |   {
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 332 | fix y | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 333 |     assume "y \<in> interior {..a}"
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 334 |     then obtain e where e: "e > 0" "cball y e \<subseteq> {..a}"
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 335 |       using mem_interior_cball[of y "{..a}"] by auto
 | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 336 | moreover from e have "y + e \<in> cball y e" | 
| 68031 | 337 | by (auto simp: cball_def dist_norm) | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 338 | ultimately have "a \<ge> y + e" by auto | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 339 | then have "a > y" using e by auto | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 340 | } | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 341 | ultimately show ?thesis by auto | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 342 | qed | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 343 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 344 | lemma interior_atLeastAtMost_real [simp]: "interior {a..b} = {a<..<b :: real}"
 | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 345 | proof- | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 346 |   have "{a..b} = {a..} \<inter> {..b}" by auto
 | 
| 68031 | 347 |   also have "interior \<dots> = {a<..} \<inter> {..<b}"
 | 
| 71633 | 348 | by (simp) | 
| 68031 | 349 |   also have "\<dots> = {a<..<b}" by auto
 | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 350 | finally show ?thesis . | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 351 | qed | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 352 | |
| 66793 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 353 | lemma interior_atLeastLessThan [simp]: | 
| 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 354 |   fixes a::real shows "interior {a..<b} = {a<..<b}"
 | 
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 355 | by (metis atLeastLessThan_def greaterThanLessThan_def interior_atLeastAtMost_real interior_Int interior_interior interior_real_atLeast) | 
| 66793 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 356 | |
| 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 357 | lemma interior_lessThanAtMost [simp]: | 
| 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 358 |   fixes a::real shows "interior {a<..b} = {a<..<b}"
 | 
| 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 359 | by (metis atLeastAtMost_def greaterThanAtMost_def interior_atLeastAtMost_real interior_Int | 
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 360 | interior_interior interior_real_atLeast) | 
| 66793 
deabce3ccf1f
new material about connectedness, etc.
 paulson <lp15@cam.ac.uk> parents: 
66641diff
changeset | 361 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 362 | lemma interior_greaterThanLessThan_real [simp]: "interior {a<..<b} = {a<..<b :: real}"
 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 363 | by (metis interior_atLeastAtMost_real interior_interior) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 364 | |
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 365 | lemma frontier_real_atMost [simp]: | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 366 | fixes a :: real | 
| 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 367 |   shows "frontier {..a} = {a}"
 | 
| 72356 | 368 | unfolding frontier_def by auto | 
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 369 | |
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 370 | lemma frontier_real_atLeast [simp]: "frontier {a..} = {a::real}"
 | 
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 371 | by (auto simp: frontier_def) | 
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 372 | |
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 373 | lemma frontier_real_greaterThan [simp]: "frontier {a<..} = {a::real}"
 | 
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 374 | by (auto simp: interior_open frontier_def) | 
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 375 | |
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 376 | lemma frontier_real_lessThan [simp]: "frontier {..<a} = {a::real}"
 | 
| 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 377 | by (auto simp: interior_open frontier_def) | 
| 61880 
ff4d33058566
moved some theorems from the CLT proof; reordered some theorems / notation
 hoelzl parents: 
61848diff
changeset | 378 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 379 | lemma rel_interior_real_box [simp]: | 
| 53347 | 380 | fixes a b :: real | 
| 381 | assumes "a < b" | |
| 56188 | 382 |   shows "rel_interior {a .. b} = {a <..< b}"
 | 
| 53347 | 383 | proof - | 
| 54775 
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
 immler parents: 
54465diff
changeset | 384 |   have "box a b \<noteq> {}"
 | 
| 53347 | 385 | using assms | 
| 386 | unfolding set_eq_iff | |
| 56189 
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
 immler parents: 
56188diff
changeset | 387 | by (auto intro!: exI[of _ "(a + b) / 2"] simp: box_def) | 
| 40377 | 388 | then show ?thesis | 
| 56188 | 389 | using interior_rel_interior_gen[of "cbox a b", symmetric] | 
| 72356 | 390 | by (simp split: if_split_asm del: box_real add: box_real[symmetric]) | 
| 40377 | 391 | qed | 
| 392 | ||
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 393 | lemma rel_interior_real_semiline [simp]: | 
| 53347 | 394 | fixes a :: real | 
| 395 |   shows "rel_interior {a..} = {a<..}"
 | |
| 396 | proof - | |
| 397 |   have *: "{a<..} \<noteq> {}"
 | |
| 398 | unfolding set_eq_iff by (auto intro!: exI[of _ "a + 1"]) | |
| 69710 
61372780515b
some renamings and a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
69619diff
changeset | 399 |   then show ?thesis using interior_real_atLeast interior_rel_interior_gen[of "{a..}"]
 | 
| 62390 | 400 | by (auto split: if_split_asm) | 
| 40377 | 401 | qed | 
| 402 | ||
| 60420 | 403 | subsubsection \<open>Relative open sets\<close> | 
| 40377 | 404 | |
| 70136 | 405 | definition\<^marker>\<open>tag important\<close> "rel_open S \<longleftrightarrow> rel_interior S = S" | 
| 53347 | 406 | |
| 72356 | 407 | lemma rel_open: "rel_open S \<longleftrightarrow> openin (top_of_set (affine hull S)) S" (is "?lhs = ?rhs") | 
| 408 | proof | |
| 409 | assume ?lhs | |
| 410 | then show ?rhs | |
| 411 | unfolding rel_open_def rel_interior_def | |
| 412 | using openin_subopen[of "top_of_set (affine hull S)" S] by auto | |
| 413 | qed (auto simp: rel_open_def rel_interior_def) | |
| 53347 | 414 | |
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 415 | lemma openin_rel_interior: "openin (top_of_set (affine hull S)) (rel_interior S)" | 
| 72356 | 416 | using openin_subopen by (fastforce simp add: rel_interior_def) | 
| 40377 | 417 | |
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 418 | lemma openin_set_rel_interior: | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 419 | "openin (top_of_set S) (rel_interior S)" | 
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 420 | by (rule openin_subset_trans [OF openin_rel_interior rel_interior_subset hull_subset]) | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 421 | |
| 49531 | 422 | lemma affine_rel_open: | 
| 53347 | 423 | fixes S :: "'n::euclidean_space set" | 
| 424 | assumes "affine S" | |
| 425 | shows "rel_open S" | |
| 426 | unfolding rel_open_def | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 427 | using assms rel_interior_affine_hull[of S] affine_hull_eq[of S] | 
| 53347 | 428 | by metis | 
| 40377 | 429 | |
| 49531 | 430 | lemma affine_closed: | 
| 53347 | 431 | fixes S :: "'n::euclidean_space set" | 
| 432 | assumes "affine S" | |
| 433 | shows "closed S" | |
| 434 | proof - | |
| 435 |   {
 | |
| 436 |     assume "S \<noteq> {}"
 | |
| 437 | then obtain L where L: "subspace L" "affine_parallel S L" | |
| 438 | using assms affine_parallel_subspace[of S] by auto | |
| 67399 | 439 | then obtain a where a: "S = ((+) a ` L)" | 
| 53347 | 440 | using affine_parallel_def[of L S] affine_parallel_commut by auto | 
| 441 | from L have "closed L" using closed_subspace by auto | |
| 442 | then have "closed S" | |
| 443 | using closed_translation a by auto | |
| 444 | } | |
| 445 | then show ?thesis by auto | |
| 40377 | 446 | qed | 
| 447 | ||
| 448 | lemma closure_affine_hull: | |
| 53347 | 449 | fixes S :: "'n::euclidean_space set" | 
| 450 | shows "closure S \<subseteq> affine hull S" | |
| 44524 | 451 | by (intro closure_minimal hull_subset affine_closed affine_affine_hull) | 
| 40377 | 452 | |
| 71225 | 453 | lemma closed_affine_hull [iff]: | 
| 454 | fixes S :: "'n::euclidean_space set" | |
| 455 | shows "closed (affine hull S)" | |
| 456 | by (metis affine_affine_hull affine_closed) | |
| 457 | ||
| 62948 
7700f467892b
lots of new theorems for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
62843diff
changeset | 458 | lemma closure_same_affine_hull [simp]: | 
| 53347 | 459 | fixes S :: "'n::euclidean_space set" | 
| 40377 | 460 | shows "affine hull (closure S) = affine hull S" | 
| 53347 | 461 | proof - | 
| 462 | have "affine hull (closure S) \<subseteq> affine hull S" | |
| 463 | using hull_mono[of "closure S" "affine hull S" "affine"] | |
| 464 | closure_affine_hull[of S] hull_hull[of "affine" S] | |
| 465 | by auto | |
| 466 | moreover have "affine hull (closure S) \<supseteq> affine hull S" | |
| 467 | using hull_mono[of "S" "closure S" "affine"] closure_subset by auto | |
| 468 | ultimately show ?thesis by auto | |
| 49531 | 469 | qed | 
| 470 | ||
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63092diff
changeset | 471 | lemma closure_aff_dim [simp]: | 
| 53347 | 472 | fixes S :: "'n::euclidean_space set" | 
| 40377 | 473 | shows "aff_dim (closure S) = aff_dim S" | 
| 53347 | 474 | proof - | 
| 475 | have "aff_dim S \<le> aff_dim (closure S)" | |
| 476 | using aff_dim_subset closure_subset by auto | |
| 477 | moreover have "aff_dim (closure S) \<le> aff_dim (affine hull S)" | |
| 63075 
60a42a4166af
lemmas about dimension, hyperplanes, span, etc.
 paulson <lp15@cam.ac.uk> parents: 
63072diff
changeset | 478 | using aff_dim_subset closure_affine_hull by blast | 
| 53347 | 479 | moreover have "aff_dim (affine hull S) = aff_dim S" | 
| 480 | using aff_dim_affine_hull by auto | |
| 481 | ultimately show ?thesis by auto | |
| 40377 | 482 | qed | 
| 483 | ||
| 484 | lemma rel_interior_closure_convex_shrink: | |
| 53347 | 485 | fixes S :: "_::euclidean_space set" | 
| 486 | assumes "convex S" | |
| 487 | and "c \<in> rel_interior S" | |
| 488 | and "x \<in> closure S" | |
| 489 | and "e > 0" | |
| 490 | and "e \<le> 1" | |
| 491 | shows "x - e *\<^sub>R (x - c) \<in> rel_interior S" | |
| 492 | proof - | |
| 493 | obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S" | |
| 494 | using assms(2) unfolding mem_rel_interior_ball by auto | |
| 495 | have "\<exists>y \<in> S. norm (y - x) * (1 - e) < e * d" | |
| 496 | proof (cases "x \<in> S") | |
| 497 | case True | |
| 72356 | 498 | then show ?thesis using \<open>e > 0\<close> \<open>d > 0\<close> by force | 
| 53347 | 499 | next | 
| 500 | case False | |
| 501 | then have x: "x islimpt S" | |
| 502 | using assms(3)[unfolded closure_def] by auto | |
| 503 | show ?thesis | |
| 504 | proof (cases "e = 1") | |
| 505 | case True | |
| 506 | obtain y where "y \<in> S" "y \<noteq> x" "dist y x < 1" | |
| 40377 | 507 | using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto | 
| 53347 | 508 | then show ?thesis | 
| 72356 | 509 | unfolding True using \<open>d > 0\<close> by (force simp add: ) | 
| 53347 | 510 | next | 
| 511 | case False | |
| 512 | then have "0 < e * d / (1 - e)" and *: "1 - e > 0" | |
| 68031 | 513 | using \<open>e \<le> 1\<close> \<open>e > 0\<close> \<open>d > 0\<close> by auto | 
| 53347 | 514 | then obtain y where "y \<in> S" "y \<noteq> x" "dist y x < e * d / (1 - e)" | 
| 40377 | 515 | using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto | 
| 53347 | 516 | then show ?thesis | 
| 72356 | 517 | unfolding dist_norm using pos_less_divide_eq[OF *] by force | 
| 53347 | 518 | qed | 
| 519 | qed | |
| 520 | then obtain y where "y \<in> S" and y: "norm (y - x) * (1 - e) < e * d" | |
| 521 | by auto | |
| 63040 | 522 | define z where "z = c + ((1 - e) / e) *\<^sub>R (x - y)" | 
| 53347 | 523 | have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)" | 
| 60420 | 524 | unfolding z_def using \<open>e > 0\<close> | 
| 68031 | 525 | by (auto simp: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib) | 
| 53347 | 526 | have zball: "z \<in> ball c d" | 
| 527 | using mem_ball z_def dist_norm[of c] | |
| 528 | using y and assms(4,5) | |
| 70802 
160eaf566bcb
formally augmented corresponding rules for field_simps
 haftmann parents: 
70136diff
changeset | 529 | by (simp add: norm_minus_commute) (simp add: field_simps) | 
| 53347 | 530 | have "x \<in> affine hull S" | 
| 531 | using closure_affine_hull assms by auto | |
| 532 | moreover have "y \<in> affine hull S" | |
| 60420 | 533 | using \<open>y \<in> S\<close> hull_subset[of S] by auto | 
| 53347 | 534 | moreover have "c \<in> affine hull S" | 
| 535 | using assms rel_interior_subset hull_subset[of S] by auto | |
| 536 | ultimately have "z \<in> affine hull S" | |
| 49531 | 537 | using z_def affine_affine_hull[of S] | 
| 53347 | 538 | mem_affine_3_minus [of "affine hull S" c x y "(1 - e) / e"] | 
| 539 | assms | |
| 70802 
160eaf566bcb
formally augmented corresponding rules for field_simps
 haftmann parents: 
70136diff
changeset | 540 | by simp | 
| 53347 | 541 | then have "z \<in> S" using d zball by auto | 
| 542 | obtain d1 where "d1 > 0" and d1: "ball z d1 \<le> ball c d" | |
| 40377 | 543 | using zball open_ball[of c d] openE[of "ball c d" z] by auto | 
| 53347 | 544 | then have "ball z d1 \<inter> affine hull S \<subseteq> ball c d \<inter> affine hull S" | 
| 545 | by auto | |
| 546 | then have "ball z d1 \<inter> affine hull S \<subseteq> S" | |
| 547 | using d by auto | |
| 548 | then have "z \<in> rel_interior S" | |
| 60420 | 549 | using mem_rel_interior_ball using \<open>d1 > 0\<close> \<open>z \<in> S\<close> by auto | 
| 53347 | 550 | then have "y - e *\<^sub>R (y - z) \<in> rel_interior S" | 
| 60420 | 551 | using rel_interior_convex_shrink[of S z y e] assms \<open>y \<in> S\<close> by auto | 
| 53347 | 552 | then show ?thesis using * by auto | 
| 553 | qed | |
| 554 | ||
| 62620 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 555 | lemma rel_interior_eq: | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 556 | "rel_interior s = s \<longleftrightarrow> openin(top_of_set (affine hull s)) s" | 
| 62620 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 557 | using rel_open rel_open_def by blast | 
| 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 558 | |
| 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 559 | lemma rel_interior_openin: | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 560 | "openin(top_of_set (affine hull s)) s \<Longrightarrow> rel_interior s = s" | 
| 62620 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 561 | by (simp add: rel_interior_eq) | 
| 
d21dab28b3f9
New results about paths, segments, etc. The notion of simply_connected.
 paulson <lp15@cam.ac.uk> parents: 
62618diff
changeset | 562 | |
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 563 | lemma rel_interior_affine: | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 564 | fixes S :: "'n::euclidean_space set" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 565 | shows "affine S \<Longrightarrow> rel_interior S = S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 566 | using affine_rel_open rel_open_def by auto | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 567 | |
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 568 | lemma rel_interior_eq_closure: | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 569 | fixes S :: "'n::euclidean_space set" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 570 | shows "rel_interior S = closure S \<longleftrightarrow> affine S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 571 | proof (cases "S = {}")
 | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 572 | case True | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 573 | then show ?thesis | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 574 | by auto | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 575 | next | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 576 | case False show ?thesis | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 577 | proof | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 578 | assume eq: "rel_interior S = closure S" | 
| 72356 | 579 | have "openin (top_of_set (affine hull S)) S" | 
| 580 | by (metis eq closure_subset openin_rel_interior rel_interior_subset subset_antisym) | |
| 581 | moreover have "closedin (top_of_set (affine hull S)) S" | |
| 582 | by (metis closed_subset closure_subset_eq eq hull_subset rel_interior_subset) | |
| 583 |     ultimately have "S = {} \<or> S = affine hull S"
 | |
| 584 | using convex_connected connected_clopen convex_affine_hull by metis | |
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 585 | with False have "affine hull S = S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 586 | by auto | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 587 | then show "affine S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 588 | by (metis affine_hull_eq) | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 589 | next | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 590 | assume "affine S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 591 | then show "rel_interior S = closure S" | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 592 | by (simp add: rel_interior_affine affine_closed) | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 593 | qed | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 594 | qed | 
| 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 595 | |
| 40377 | 596 | |
| 70136 | 597 | subsubsection\<^marker>\<open>tag unimportant\<close>\<open>Relative interior preserves under linear transformations\<close> | 
| 40377 | 598 | |
| 599 | lemma rel_interior_translation_aux: | |
| 53347 | 600 | fixes a :: "'n::euclidean_space" | 
| 601 | shows "((\<lambda>x. a + x) ` rel_interior S) \<subseteq> rel_interior ((\<lambda>x. a + x) ` S)" | |
| 602 | proof - | |
| 603 |   {
 | |
| 604 | fix x | |
| 605 | assume x: "x \<in> rel_interior S" | |
| 606 | then obtain T where "open T" "x \<in> T \<inter> S" "T \<inter> affine hull S \<subseteq> S" | |
| 607 | using mem_rel_interior[of x S] by auto | |
| 608 | then have "open ((\<lambda>x. a + x) ` T)" | |
| 609 | and "a + x \<in> ((\<lambda>x. a + x) ` T) \<inter> ((\<lambda>x. a + x) ` S)" | |
| 610 | and "((\<lambda>x. a + x) ` T) \<inter> affine hull ((\<lambda>x. a + x) ` S) \<subseteq> (\<lambda>x. a + x) ` S" | |
| 611 | using affine_hull_translation[of a S] open_translation[of T a] x by auto | |
| 612 | then have "a + x \<in> rel_interior ((\<lambda>x. a + x) ` S)" | |
| 613 | using mem_rel_interior[of "a+x" "((\<lambda>x. a + x) ` S)"] by auto | |
| 614 | } | |
| 615 | then show ?thesis by auto | |
| 60809 
457abb82fb9e
the Cauchy integral theorem and related material
 paulson <lp15@cam.ac.uk> parents: 
60800diff
changeset | 616 | qed | 
| 40377 | 617 | |
| 618 | lemma rel_interior_translation: | |
| 53347 | 619 | fixes a :: "'n::euclidean_space" | 
| 620 | shows "rel_interior ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` rel_interior S" | |
| 621 | proof - | |
| 622 | have "(\<lambda>x. (-a) + x) ` rel_interior ((\<lambda>x. a + x) ` S) \<subseteq> rel_interior S" | |
| 623 | using rel_interior_translation_aux[of "-a" "(\<lambda>x. a + x) ` S"] | |
| 624 | translation_assoc[of "-a" "a"] | |
| 625 | by auto | |
| 626 | then have "((\<lambda>x. a + x) ` rel_interior S) \<supseteq> rel_interior ((\<lambda>x. a + x) ` S)" | |
| 67399 | 627 | using translation_inverse_subset[of a "rel_interior ((+) a ` S)" "rel_interior S"] | 
| 53347 | 628 | by auto | 
| 629 | then show ?thesis | |
| 630 | using rel_interior_translation_aux[of a S] by auto | |
| 40377 | 631 | qed | 
| 632 | ||
| 633 | ||
| 634 | lemma affine_hull_linear_image: | |
| 53347 | 635 | assumes "bounded_linear f" | 
| 636 | shows "f ` (affine hull s) = affine hull f ` s" | |
| 637 | proof - | |
| 40377 | 638 | interpret f: bounded_linear f by fact | 
| 68058 | 639 |   have "affine {x. f x \<in> affine hull f ` s}"
 | 
| 53347 | 640 | unfolding affine_def | 
| 68031 | 641 | by (auto simp: f.scaleR f.add affine_affine_hull[unfolded affine_def, rule_format]) | 
| 68058 | 642 |   moreover have "affine {x. x \<in> f ` (affine hull s)}"
 | 
| 53347 | 643 | using affine_affine_hull[unfolded affine_def, of s] | 
| 68031 | 644 | unfolding affine_def by (auto simp: f.scaleR [symmetric] f.add [symmetric]) | 
| 68058 | 645 | ultimately show ?thesis | 
| 646 | by (auto simp: hull_inc elim!: hull_induct) | |
| 647 | qed | |
| 40377 | 648 | |
| 649 | ||
| 650 | lemma rel_interior_injective_on_span_linear_image: | |
| 53347 | 651 | fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" | 
| 652 | and S :: "'m::euclidean_space set" | |
| 653 | assumes "bounded_linear f" | |
| 654 | and "inj_on f (span S)" | |
| 655 | shows "rel_interior (f ` S) = f ` (rel_interior S)" | |
| 656 | proof - | |
| 657 |   {
 | |
| 658 | fix z | |
| 659 | assume z: "z \<in> rel_interior (f ` S)" | |
| 660 | then have "z \<in> f ` S" | |
| 661 | using rel_interior_subset[of "f ` S"] by auto | |
| 662 | then obtain x where x: "x \<in> S" "f x = z" by auto | |
| 663 | obtain e2 where e2: "e2 > 0" "cball z e2 \<inter> affine hull (f ` S) \<subseteq> (f ` S)" | |
| 664 | using z rel_interior_cball[of "f ` S"] by auto | |
| 665 | obtain K where K: "K > 0" "\<And>x. norm (f x) \<le> norm x * K" | |
| 666 | using assms Real_Vector_Spaces.bounded_linear.pos_bounded[of f] by auto | |
| 63040 | 667 | define e1 where "e1 = 1 / K" | 
| 53347 | 668 | then have e1: "e1 > 0" "\<And>x. e1 * norm (f x) \<le> norm x" | 
| 669 | using K pos_le_divide_eq[of e1] by auto | |
| 63040 | 670 | define e where "e = e1 * e2" | 
| 56544 | 671 | then have "e > 0" using e1 e2 by auto | 
| 53347 | 672 |     {
 | 
| 673 | fix y | |
| 674 | assume y: "y \<in> cball x e \<inter> affine hull S" | |
| 675 | then have h1: "f y \<in> affine hull (f ` S)" | |
| 676 | using affine_hull_linear_image[of f S] assms by auto | |
| 677 | from y have "norm (x-y) \<le> e1 * e2" | |
| 678 | using cball_def[of x e] dist_norm[of x y] e_def by auto | |
| 679 | moreover have "f x - f y = f (x - y)" | |
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 680 | using assms linear_diff[of f x y] linear_conv_bounded_linear[of f] by auto | 
| 53347 | 681 | moreover have "e1 * norm (f (x-y)) \<le> norm (x - y)" | 
| 682 | using e1 by auto | |
| 683 | ultimately have "e1 * norm ((f x)-(f y)) \<le> e1 * e2" | |
| 684 | by auto | |
| 685 | then have "f y \<in> cball z e2" | |
| 686 | using cball_def[of "f x" e2] dist_norm[of "f x" "f y"] e1 x by auto | |
| 687 | then have "f y \<in> f ` S" | |
| 688 | using y e2 h1 by auto | |
| 689 | then have "y \<in> S" | |
| 690 | using assms y hull_subset[of S] affine_hull_subset_span | |
| 61520 
8f85bb443d33
Cauchy's integral formula, required lemmas, and a bit of reorganisation
 paulson <lp15@cam.ac.uk> parents: 
61518diff
changeset | 691 | inj_on_image_mem_iff [OF \<open>inj_on f (span S)\<close>] | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 692 | by (metis Int_iff span_superset subsetCE) | 
| 53347 | 693 | } | 
| 694 | then have "z \<in> f ` (rel_interior S)" | |
| 60420 | 695 | using mem_rel_interior_cball[of x S] \<open>e > 0\<close> x by auto | 
| 49531 | 696 | } | 
| 53347 | 697 | moreover | 
| 698 |   {
 | |
| 699 | fix x | |
| 700 | assume x: "x \<in> rel_interior S" | |
| 54465 | 701 | then obtain e2 where e2: "e2 > 0" "cball x e2 \<inter> affine hull S \<subseteq> S" | 
| 53347 | 702 | using rel_interior_cball[of S] by auto | 
| 703 | have "x \<in> S" using x rel_interior_subset by auto | |
| 704 | then have *: "f x \<in> f ` S" by auto | |
| 705 | have "\<forall>x\<in>span S. f x = 0 \<longrightarrow> x = 0" | |
| 706 | using assms subspace_span linear_conv_bounded_linear[of f] | |
| 707 | linear_injective_on_subspace_0[of f "span S"] | |
| 708 | by auto | |
| 709 | then obtain e1 where e1: "e1 > 0" "\<forall>x \<in> span S. e1 * norm x \<le> norm (f x)" | |
| 710 | using assms injective_imp_isometric[of "span S" f] | |
| 711 | subspace_span[of S] closed_subspace[of "span S"] | |
| 712 | by auto | |
| 63040 | 713 | define e where "e = e1 * e2" | 
| 56544 | 714 | hence "e > 0" using e1 e2 by auto | 
| 53347 | 715 |     {
 | 
| 716 | fix y | |
| 717 | assume y: "y \<in> cball (f x) e \<inter> affine hull (f ` S)" | |
| 718 | then have "y \<in> f ` (affine hull S)" | |
| 719 | using affine_hull_linear_image[of f S] assms by auto | |
| 720 | then obtain xy where xy: "xy \<in> affine hull S" "f xy = y" by auto | |
| 721 | with y have "norm (f x - f xy) \<le> e1 * e2" | |
| 722 | using cball_def[of "f x" e] dist_norm[of "f x" y] e_def by auto | |
| 723 | moreover have "f x - f xy = f (x - xy)" | |
| 63469 
b6900858dcb9
lots of new theorems about differentiable_on, retracts, ANRs, etc.
 paulson <lp15@cam.ac.uk> parents: 
63332diff
changeset | 724 | using assms linear_diff[of f x xy] linear_conv_bounded_linear[of f] by auto | 
| 53347 | 725 | moreover have *: "x - xy \<in> span S" | 
| 63114 
27afe7af7379
Lots of new material for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
63092diff
changeset | 726 | using subspace_diff[of "span S" x xy] subspace_span \<open>x \<in> S\<close> xy | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 727 | affine_hull_subset_span[of S] span_superset | 
| 53347 | 728 | by auto | 
| 729 | moreover from * have "e1 * norm (x - xy) \<le> norm (f (x - xy))" | |
| 730 | using e1 by auto | |
| 731 | ultimately have "e1 * norm (x - xy) \<le> e1 * e2" | |
| 732 | by auto | |
| 733 | then have "xy \<in> cball x e2" | |
| 734 | using cball_def[of x e2] dist_norm[of x xy] e1 by auto | |
| 735 | then have "y \<in> f ` S" | |
| 736 | using xy e2 by auto | |
| 737 | } | |
| 738 | then have "f x \<in> rel_interior (f ` S)" | |
| 60420 | 739 | using mem_rel_interior_cball[of "(f x)" "(f ` S)"] * \<open>e > 0\<close> by auto | 
| 49531 | 740 | } | 
| 53347 | 741 | ultimately show ?thesis by auto | 
| 40377 | 742 | qed | 
| 743 | ||
| 744 | lemma rel_interior_injective_linear_image: | |
| 53347 | 745 | fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" | 
| 746 | assumes "bounded_linear f" | |
| 747 | and "inj f" | |
| 748 | shows "rel_interior (f ` S) = f ` (rel_interior S)" | |
| 749 | using assms rel_interior_injective_on_span_linear_image[of f S] | |
| 750 | subset_inj_on[of f "UNIV" "span S"] | |
| 751 | by auto | |
| 752 | ||
| 40377 | 753 | |
| 70136 | 754 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Openness and compactness are preserved by convex hull operation\<close> | 
| 33175 | 755 | |
| 34964 | 756 | lemma open_convex_hull[intro]: | 
| 68052 | 757 | fixes S :: "'a::real_normed_vector set" | 
| 758 | assumes "open S" | |
| 759 | shows "open (convex hull S)" | |
| 760 | proof (clarsimp simp: open_contains_cball convex_hull_explicit) | |
| 761 | fix T and u :: "'a\<Rightarrow>real" | |
| 762 | assume obt: "finite T" "T\<subseteq>S" "\<forall>x\<in>T. 0 \<le> u x" "sum u T = 1" | |
| 53347 | 763 | |
| 764 | from assms[unfolded open_contains_cball] obtain b | |
| 68052 | 765 | where b: "\<And>x. x\<in>S \<Longrightarrow> 0 < b x \<and> cball x (b x) \<subseteq> S" by metis | 
| 766 |   have "b ` T \<noteq> {}"
 | |
| 56889 
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
 hoelzl parents: 
56571diff
changeset | 767 | using obt by auto | 
| 68052 | 768 | define i where "i = b ` T" | 
| 769 | let ?\<Phi> = "\<lambda>y. \<exists>F. finite F \<and> F \<subseteq> S \<and> (\<exists>u. (\<forall>x\<in>F. 0 \<le> u x) \<and> sum u F = 1 \<and> (\<Sum>v\<in>F. u v *\<^sub>R v) = y)" | |
| 770 | let ?a = "\<Sum>v\<in>T. u v *\<^sub>R v" | |
| 771 |   show "\<exists>e > 0. cball ?a e \<subseteq> {y. ?\<Phi> y}"
 | |
| 772 | proof (intro exI subsetI conjI) | |
| 53347 | 773 | show "0 < Min i" | 
| 68052 | 774 |       unfolding i_def and Min_gr_iff[OF finite_imageI[OF obt(1)] \<open>b ` T\<noteq>{}\<close>]
 | 
| 775 | using b \<open>T\<subseteq>S\<close> by auto | |
| 53347 | 776 | next | 
| 777 | fix y | |
| 68052 | 778 | assume "y \<in> cball ?a (Min i)" | 
| 779 | then have y: "norm (?a - y) \<le> Min i" | |
| 53347 | 780 | unfolding dist_norm[symmetric] by auto | 
| 68052 | 781 |     { fix x
 | 
| 782 | assume "x \<in> T" | |
| 53347 | 783 | then have "Min i \<le> b x" | 
| 68052 | 784 | by (simp add: i_def obt(1)) | 
| 785 | then have "x + (y - ?a) \<in> cball x (b x)" | |
| 53347 | 786 | using y unfolding mem_cball dist_norm by auto | 
| 68052 | 787 | moreover have "x \<in> S" | 
| 788 | using \<open>x\<in>T\<close> \<open>T\<subseteq>S\<close> by auto | |
| 789 | ultimately have "x + (y - ?a) \<in> S" | |
| 790 | using y b by blast | |
| 53347 | 791 | } | 
| 33175 | 792 | moreover | 
| 68052 | 793 | have *: "inj_on (\<lambda>v. v + (y - ?a)) T" | 
| 53347 | 794 | unfolding inj_on_def by auto | 
| 68052 | 795 | have "(\<Sum>v\<in>(\<lambda>v. v + (y - ?a)) ` T. u (v - (y - ?a)) *\<^sub>R v) = y" | 
| 796 | unfolding sum.reindex[OF *] o_def using obt(4) | |
| 64267 | 797 | by (simp add: sum.distrib sum_subtractf scaleR_left.sum[symmetric] scaleR_right_distrib) | 
| 68052 | 798 |     ultimately show "y \<in> {y. ?\<Phi> y}"
 | 
| 799 | proof (intro CollectI exI conjI) | |
| 800 | show "finite ((\<lambda>v. v + (y - ?a)) ` T)" | |
| 801 | by (simp add: obt(1)) | |
| 802 | show "sum (\<lambda>v. u (v - (y - ?a))) ((\<lambda>v. v + (y - ?a)) ` T) = 1" | |
| 803 | unfolding sum.reindex[OF *] o_def using obt(4) by auto | |
| 804 | qed (use obt(1, 3) in auto) | |
| 33175 | 805 | qed | 
| 806 | qed | |
| 807 | ||
| 808 | lemma compact_convex_combinations: | |
| 68052 | 809 | fixes S T :: "'a::real_normed_vector set" | 
| 810 | assumes "compact S" "compact T" | |
| 811 |   shows "compact { (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T}"
 | |
| 53347 | 812 | proof - | 
| 68052 | 813 |   let ?X = "{0..1} \<times> S \<times> T"
 | 
| 33175 | 814 | let ?h = "(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" | 
| 68052 | 815 |   have *: "{ (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. 0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> T} = ?h ` ?X"
 | 
| 816 | by force | |
| 56188 | 817 | have "continuous_on ?X (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" | 
| 33175 | 818 | unfolding continuous_on by (rule ballI) (intro tendsto_intros) | 
| 68052 | 819 | with assms show ?thesis | 
| 820 | by (simp add: * compact_Times compact_continuous_image) | |
| 33175 | 821 | qed | 
| 822 | ||
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 823 | lemma finite_imp_compact_convex_hull: | 
| 68052 | 824 | fixes S :: "'a::real_normed_vector set" | 
| 825 | assumes "finite S" | |
| 826 | shows "compact (convex hull S)" | |
| 827 | proof (cases "S = {}")
 | |
| 53347 | 828 | case True | 
| 829 | then show ?thesis by simp | |
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 830 | next | 
| 53347 | 831 | case False | 
| 832 | with assms show ?thesis | |
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 833 | proof (induct rule: finite_ne_induct) | 
| 53347 | 834 | case (singleton x) | 
| 835 | show ?case by simp | |
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 836 | next | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 837 | case (insert x A) | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 838 | let ?f = "\<lambda>(u, y::'a). u *\<^sub>R x + (1 - u) *\<^sub>R y" | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 839 |     let ?T = "{0..1::real} \<times> (convex hull A)"
 | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 840 | have "continuous_on ?T ?f" | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 841 | unfolding split_def continuous_on by (intro ballI tendsto_intros) | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 842 | moreover have "compact ?T" | 
| 56188 | 843 | by (intro compact_Times compact_Icc insert) | 
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 844 | ultimately have "compact (?f ` ?T)" | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 845 | by (rule compact_continuous_image) | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 846 | also have "?f ` ?T = convex hull (insert x A)" | 
| 60420 | 847 |       unfolding convex_hull_insert [OF \<open>A \<noteq> {}\<close>]
 | 
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 848 | apply safe | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 849 | apply (rule_tac x=a in exI, simp) | 
| 68031 | 850 | apply (rule_tac x="1 - a" in exI, simp, fast) | 
| 44525 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 851 | apply (rule_tac x="(u, b)" in image_eqI, simp_all) | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 852 | done | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 853 | finally show "compact (convex hull (insert x A))" . | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 854 | qed | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 855 | qed | 
| 
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
 huffman parents: 
44524diff
changeset | 856 | |
| 53347 | 857 | lemma compact_convex_hull: | 
| 68052 | 858 | fixes S :: "'a::euclidean_space set" | 
| 859 | assumes "compact S" | |
| 860 | shows "compact (convex hull S)" | |
| 861 | proof (cases "S = {}")
 | |
| 53347 | 862 | case True | 
| 863 | then show ?thesis using compact_empty by simp | |
| 33175 | 864 | next | 
| 53347 | 865 | case False | 
| 68052 | 866 | then obtain w where "w \<in> S" by auto | 
| 53347 | 867 | show ?thesis | 
| 68052 | 868 | unfolding caratheodory[of S] | 
| 53347 | 869 |   proof (induct ("DIM('a) + 1"))
 | 
| 870 | case 0 | |
| 68052 | 871 |     have *: "{x.\<exists>sa. finite sa \<and> sa \<subseteq> S \<and> card sa \<le> 0 \<and> x \<in> convex hull sa} = {}"
 | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36341diff
changeset | 872 | using compact_empty by auto | 
| 53347 | 873 | from 0 show ?case unfolding * by simp | 
| 33175 | 874 | next | 
| 875 | case (Suc n) | |
| 53347 | 876 | show ?case | 
| 877 | proof (cases "n = 0") | |
| 878 | case True | |
| 68052 | 879 |       have "{x. \<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T} = S"
 | 
| 53347 | 880 | unfolding set_eq_iff and mem_Collect_eq | 
| 881 | proof (rule, rule) | |
| 882 | fix x | |
| 68052 | 883 | assume "\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T" | 
| 884 | then obtain T where T: "finite T" "T \<subseteq> S" "card T \<le> Suc n" "x \<in> convex hull T" | |
| 53347 | 885 | by auto | 
| 68052 | 886 | show "x \<in> S" | 
| 887 | proof (cases "card T = 0") | |
| 53347 | 888 | case True | 
| 889 | then show ?thesis | |
| 68052 | 890 | using T(4) unfolding card_0_eq[OF T(1)] by simp | 
| 33175 | 891 | next | 
| 53347 | 892 | case False | 
| 68052 | 893 | then have "card T = Suc 0" using T(3) \<open>n=0\<close> by auto | 
| 894 |           then obtain a where "T = {a}" unfolding card_Suc_eq by auto
 | |
| 895 | then show ?thesis using T(2,4) by simp | |
| 33175 | 896 | qed | 
| 897 | next | |
| 68052 | 898 | fix x assume "x\<in>S" | 
| 899 | then show "\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T" | |
| 72356 | 900 |           by (rule_tac x="{x}" in exI) (use convex_hull_singleton in auto)
 | 
| 53347 | 901 | qed | 
| 902 | then show ?thesis using assms by simp | |
| 33175 | 903 | next | 
| 53347 | 904 | case False | 
| 68052 | 905 |       have "{x. \<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T} =
 | 
| 53347 | 906 |         {(1 - u) *\<^sub>R x + u *\<^sub>R y | x y u.
 | 
| 68052 | 907 |           0 \<le> u \<and> u \<le> 1 \<and> x \<in> S \<and> y \<in> {x. \<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> n \<and> x \<in> convex hull T}}"
 | 
| 53347 | 908 | unfolding set_eq_iff and mem_Collect_eq | 
| 909 | proof (rule, rule) | |
| 910 | fix x | |
| 911 | assume "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> | |
| 68052 | 912 | 0 \<le> c \<and> c \<le> 1 \<and> u \<in> S \<and> (\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> n \<and> v \<in> convex hull T)" | 
| 913 | then obtain u v c T where obt: "x = (1 - c) *\<^sub>R u + c *\<^sub>R v" | |
| 914 | "0 \<le> c \<and> c \<le> 1" "u \<in> S" "finite T" "T \<subseteq> S" "card T \<le> n" "v \<in> convex hull T" | |
| 53347 | 915 | by auto | 
| 68052 | 916 | moreover have "(1 - c) *\<^sub>R u + c *\<^sub>R v \<in> convex hull insert u T" | 
| 72356 | 917 | by (meson convexD_alt convex_convex_hull hull_inc hull_mono in_mono insertCI obt(2) obt(7) subset_insertI) | 
| 68052 | 918 | ultimately show "\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T" | 
| 72356 | 919 | by (rule_tac x="insert u T" in exI) (auto simp: card_insert_if) | 
| 33175 | 920 | next | 
| 53347 | 921 | fix x | 
| 68052 | 922 | assume "\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> Suc n \<and> x \<in> convex hull T" | 
| 923 | then obtain T where T: "finite T" "T \<subseteq> S" "card T \<le> Suc n" "x \<in> convex hull T" | |
| 53347 | 924 | by auto | 
| 925 | show "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> | |
| 68052 | 926 | 0 \<le> c \<and> c \<le> 1 \<and> u \<in> S \<and> (\<exists>T. finite T \<and> T \<subseteq> S \<and> card T \<le> n \<and> v \<in> convex hull T)" | 
| 927 | proof (cases "card T = Suc n") | |
| 53347 | 928 | case False | 
| 68052 | 929 | then have "card T \<le> n" using T(3) by auto | 
| 53347 | 930 | then show ?thesis | 
| 68052 | 931 | using \<open>w\<in>S\<close> and T | 
| 72356 | 932 | by (rule_tac x=w in exI, rule_tac x=x in exI, rule_tac x=1 in exI) auto | 
| 33175 | 933 | next | 
| 53347 | 934 | case True | 
| 68052 | 935 | then obtain a u where au: "T = insert a u" "a\<notin>u" | 
| 72356 | 936 | by (metis card_le_Suc_iff order_refl) | 
| 53347 | 937 | show ?thesis | 
| 938 |           proof (cases "u = {}")
 | |
| 939 | case True | |
| 68052 | 940 | then have "x = a" using T(4)[unfolded au] by auto | 
| 60420 | 941 | show ?thesis unfolding \<open>x = a\<close> | 
| 72356 | 942 | using T \<open>n \<noteq> 0\<close> unfolding au | 
| 943 | by (rule_tac x=a in exI, rule_tac x=a in exI, rule_tac x=1 in exI) force | |
| 33175 | 944 | next | 
| 53347 | 945 | case False | 
| 946 | obtain ux vx b where obt: "ux\<ge>0" "vx\<ge>0" "ux + vx = 1" | |
| 947 | "b \<in> convex hull u" "x = ux *\<^sub>R a + vx *\<^sub>R b" | |
| 68052 | 948 | using T(4)[unfolded au convex_hull_insert[OF False]] | 
| 53347 | 949 | by auto | 
| 950 | have *: "1 - vx = ux" using obt(3) by auto | |
| 951 | show ?thesis | |
| 72356 | 952 | using obt T(1-3) card_insert_disjoint[OF _ au(2)] unfolding au * | 
| 953 | by (rule_tac x=a in exI, rule_tac x=b in exI, rule_tac x=vx in exI) force | |
| 33175 | 954 | qed | 
| 955 | qed | |
| 956 | qed | |
| 53347 | 957 | then show ?thesis | 
| 958 | using compact_convex_combinations[OF assms Suc] by simp | |
| 33175 | 959 | qed | 
| 36362 
06475a1547cb
fix lots of looping simp calls and other warnings
 huffman parents: 
36341diff
changeset | 960 | qed | 
| 33175 | 961 | qed | 
| 962 | ||
| 53347 | 963 | |
| 70136 | 964 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Extremal points of a simplex are some vertices\<close> | 
| 33175 | 965 | |
| 966 | lemma dist_increases_online: | |
| 967 | fixes a b d :: "'a::real_inner" | |
| 968 | assumes "d \<noteq> 0" | |
| 969 | shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b" | |
| 53347 | 970 | proof (cases "inner a d - inner b d > 0") | 
| 971 | case True | |
| 972 | then have "0 < inner d d + (inner a d * 2 - inner b d * 2)" | |
| 973 | using assms | |
| 72356 | 974 | by (intro add_pos_pos) auto | 
| 53347 | 975 | then show ?thesis | 
| 976 | unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff | |
| 72356 | 977 | by (simp add: algebra_simps inner_commute) | 
| 33175 | 978 | next | 
| 53347 | 979 | case False | 
| 980 | then have "0 < inner d d + (inner b d * 2 - inner a d * 2)" | |
| 981 | using assms | |
| 72356 | 982 | by (intro add_pos_nonneg) auto | 
| 53347 | 983 | then show ?thesis | 
| 984 | unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff | |
| 72356 | 985 | by (simp add: algebra_simps inner_commute) | 
| 33175 | 986 | qed | 
| 987 | ||
| 988 | lemma norm_increases_online: | |
| 989 | fixes d :: "'a::real_inner" | |
| 53347 | 990 | shows "d \<noteq> 0 \<Longrightarrow> norm (a + d) > norm a \<or> norm(a - d) > norm a" | 
| 33175 | 991 | using dist_increases_online[of d a 0] unfolding dist_norm by auto | 
| 992 | ||
| 993 | lemma simplex_furthest_lt: | |
| 68052 | 994 | fixes S :: "'a::real_inner set" | 
| 995 | assumes "finite S" | |
| 996 | shows "\<forall>x \<in> convex hull S. x \<notin> S \<longrightarrow> (\<exists>y \<in> convex hull S. norm (x - a) < norm(y - a))" | |
| 53347 | 997 | using assms | 
| 998 | proof induct | |
| 68052 | 999 | fix x S | 
| 1000 | assume as: "finite S" "x\<notin>S" "\<forall>x\<in>convex hull S. x \<notin> S \<longrightarrow> (\<exists>y\<in>convex hull S. norm (x - a) < norm (y - a))" | |
| 1001 | show "\<forall>xa\<in>convex hull insert x S. xa \<notin> insert x S \<longrightarrow> | |
| 1002 | (\<exists>y\<in>convex hull insert x S. norm (xa - a) < norm (y - a))" | |
| 1003 |   proof (intro impI ballI, cases "S = {}")
 | |
| 53347 | 1004 | case False | 
| 1005 | fix y | |
| 68052 | 1006 | assume y: "y \<in> convex hull insert x S" "y \<notin> insert x S" | 
| 1007 | obtain u v b where obt: "u\<ge>0" "v\<ge>0" "u + v = 1" "b \<in> convex hull S" "y = u *\<^sub>R x + v *\<^sub>R b" | |
| 33175 | 1008 | using y(1)[unfolded convex_hull_insert[OF False]] by auto | 
| 68052 | 1009 | show "\<exists>z\<in>convex hull insert x S. norm (y - a) < norm (z - a)" | 
| 1010 | proof (cases "y \<in> convex hull S") | |
| 53347 | 1011 | case True | 
| 68052 | 1012 | then obtain z where "z \<in> convex hull S" "norm (y - a) < norm (z - a)" | 
| 33175 | 1013 | using as(3)[THEN bspec[where x=y]] and y(2) by auto | 
| 53347 | 1014 | then show ?thesis | 
| 72356 | 1015 | by (meson hull_mono subsetD subset_insertI) | 
| 33175 | 1016 | next | 
| 53347 | 1017 | case False | 
| 1018 | show ?thesis | |
| 72356 | 1019 | proof (cases "u = 0 \<or> v = 0") | 
| 1020 | case True | |
| 1021 | with False show ?thesis | |
| 1022 | using obt y by auto | |
| 33175 | 1023 | next | 
| 72356 | 1024 | case False | 
| 53347 | 1025 | then obtain w where w: "w>0" "w<u" "w<v" | 
| 68527 
2f4e2aab190a
Generalising and renaming some basic results
 paulson <lp15@cam.ac.uk> parents: 
68074diff
changeset | 1026 | using field_lbound_gt_zero[of u v] and obt(1,2) by auto | 
| 53347 | 1027 | have "x \<noteq> b" | 
| 1028 | proof | |
| 1029 | assume "x = b" | |
| 1030 | then have "y = b" unfolding obt(5) | |
| 68031 | 1031 | using obt(3) by (auto simp: scaleR_left_distrib[symmetric]) | 
| 72356 | 1032 | then show False using obt(4) and False | 
| 1033 | using \<open>x = b\<close> y(2) by blast | |
| 53347 | 1034 | qed | 
| 1035 | then have *: "w *\<^sub>R (x - b) \<noteq> 0" using w(1) by auto | |
| 1036 | show ?thesis | |
| 1037 | using dist_increases_online[OF *, of a y] | |
| 1038 | proof (elim disjE) | |
| 33175 | 1039 | assume "dist a y < dist a (y + w *\<^sub>R (x - b))" | 
| 53347 | 1040 | then have "norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)" | 
| 1041 | unfolding dist_commute[of a] | |
| 1042 | unfolding dist_norm obt(5) | |
| 1043 | by (simp add: algebra_simps) | |
| 68052 | 1044 | moreover have "(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x S" | 
| 1045 |             unfolding convex_hull_insert[OF \<open>S\<noteq>{}\<close>]
 | |
| 1046 | proof (intro CollectI conjI exI) | |
| 1047 | show "u + w \<ge> 0" "v - w \<ge> 0" | |
| 1048 | using obt(1) w by auto | |
| 1049 | qed (use obt in auto) | |
| 33175 | 1050 | ultimately show ?thesis by auto | 
| 1051 | next | |
| 1052 | assume "dist a y < dist a (y - w *\<^sub>R (x - b))" | |
| 53347 | 1053 | then have "norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)" | 
| 1054 | unfolding dist_commute[of a] | |
| 1055 | unfolding dist_norm obt(5) | |
| 1056 | by (simp add: algebra_simps) | |
| 68052 | 1057 | moreover have "(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x S" | 
| 1058 |             unfolding convex_hull_insert[OF \<open>S\<noteq>{}\<close>]
 | |
| 1059 | proof (intro CollectI conjI exI) | |
| 1060 | show "u - w \<ge> 0" "v + w \<ge> 0" | |
| 1061 | using obt(1) w by auto | |
| 1062 | qed (use obt in auto) | |
| 33175 | 1063 | ultimately show ?thesis by auto | 
| 1064 | qed | |
| 72356 | 1065 | qed | 
| 33175 | 1066 | qed | 
| 1067 | qed auto | |
| 68031 | 1068 | qed (auto simp: assms) | 
| 33175 | 1069 | |
| 1070 | lemma simplex_furthest_le: | |
| 68052 | 1071 | fixes S :: "'a::real_inner set" | 
| 1072 | assumes "finite S" | |
| 1073 |     and "S \<noteq> {}"
 | |
| 1074 | shows "\<exists>y\<in>S. \<forall>x\<in> convex hull S. norm (x - a) \<le> norm (y - a)" | |
| 53347 | 1075 | proof - | 
| 68052 | 1076 |   have "convex hull S \<noteq> {}"
 | 
| 1077 | using hull_subset[of S convex] and assms(2) by auto | |
| 1078 | then obtain x where x: "x \<in> convex hull S" "\<forall>y\<in>convex hull S. norm (y - a) \<le> norm (x - a)" | |
| 1079 | using distance_attains_sup[OF finite_imp_compact_convex_hull[OF \<open>finite S\<close>], of a] | |
| 53347 | 1080 | unfolding dist_commute[of a] | 
| 1081 | unfolding dist_norm | |
| 1082 | by auto | |
| 1083 | show ?thesis | |
| 68052 | 1084 | proof (cases "x \<in> S") | 
| 53347 | 1085 | case False | 
| 68052 | 1086 | then obtain y where "y \<in> convex hull S" "norm (x - a) < norm (y - a)" | 
| 53347 | 1087 | using simplex_furthest_lt[OF assms(1), THEN bspec[where x=x]] and x(1) | 
| 1088 | by auto | |
| 1089 | then show ?thesis | |
| 1090 | using x(2)[THEN bspec[where x=y]] by auto | |
| 1091 | next | |
| 1092 | case True | |
| 1093 | with x show ?thesis by auto | |
| 1094 | qed | |
| 33175 | 1095 | qed | 
| 1096 | ||
| 1097 | lemma simplex_furthest_le_exists: | |
| 68052 | 1098 |   fixes S :: "('a::real_inner) set"
 | 
| 1099 | shows "finite S \<Longrightarrow> \<forall>x\<in>(convex hull S). \<exists>y\<in>S. norm (x - a) \<le> norm (y - a)" | |
| 1100 |   using simplex_furthest_le[of S] by (cases "S = {}") auto
 | |
| 33175 | 1101 | |
| 1102 | lemma simplex_extremal_le: | |
| 68052 | 1103 | fixes S :: "'a::real_inner set" | 
| 1104 | assumes "finite S" | |
| 1105 |     and "S \<noteq> {}"
 | |
| 1106 | shows "\<exists>u\<in>S. \<exists>v\<in>S. \<forall>x\<in>convex hull S. \<forall>y \<in> convex hull S. norm (x - y) \<le> norm (u - v)" | |
| 53347 | 1107 | proof - | 
| 68052 | 1108 |   have "convex hull S \<noteq> {}"
 | 
| 1109 | using hull_subset[of S convex] and assms(2) by auto | |
| 1110 | then obtain u v where obt: "u \<in> convex hull S" "v \<in> convex hull S" | |
| 1111 | "\<forall>x\<in>convex hull S. \<forall>y\<in>convex hull S. norm (x - y) \<le> norm (u - v)" | |
| 53347 | 1112 | using compact_sup_maxdistance[OF finite_imp_compact_convex_hull[OF assms(1)]] | 
| 1113 | by (auto simp: dist_norm) | |
| 1114 | then show ?thesis | |
| 68052 | 1115 | proof (cases "u\<notin>S \<or> v\<notin>S", elim disjE) | 
| 1116 | assume "u \<notin> S" | |
| 1117 | then obtain y where "y \<in> convex hull S" "norm (u - v) < norm (y - v)" | |
| 53347 | 1118 | using simplex_furthest_lt[OF assms(1), THEN bspec[where x=u]] and obt(1) | 
| 1119 | by auto | |
| 1120 | then show ?thesis | |
| 1121 | using obt(3)[THEN bspec[where x=y], THEN bspec[where x=v]] and obt(2) | |
| 1122 | by auto | |
| 33175 | 1123 | next | 
| 68052 | 1124 | assume "v \<notin> S" | 
| 1125 | then obtain y where "y \<in> convex hull S" "norm (v - u) < norm (y - u)" | |
| 53347 | 1126 | using simplex_furthest_lt[OF assms(1), THEN bspec[where x=v]] and obt(2) | 
| 1127 | by auto | |
| 1128 | then show ?thesis | |
| 1129 | using obt(3)[THEN bspec[where x=u], THEN bspec[where x=y]] and obt(1) | |
| 68031 | 1130 | by (auto simp: norm_minus_commute) | 
| 33175 | 1131 | qed auto | 
| 49531 | 1132 | qed | 
| 33175 | 1133 | |
| 1134 | lemma simplex_extremal_le_exists: | |
| 68052 | 1135 | fixes S :: "'a::real_inner set" | 
| 1136 | shows "finite S \<Longrightarrow> x \<in> convex hull S \<Longrightarrow> y \<in> convex hull S \<Longrightarrow> | |
| 1137 | \<exists>u\<in>S. \<exists>v\<in>S. norm (x - y) \<le> norm (u - v)" | |
| 1138 | using convex_hull_empty simplex_extremal_le[of S] | |
| 1139 |   by(cases "S = {}") auto
 | |
| 53347 | 1140 | |
| 33175 | 1141 | |
| 67968 | 1142 | subsection \<open>Closest point of a convex set is unique, with a continuous projection\<close> | 
| 33175 | 1143 | |
| 70136 | 1144 | definition\<^marker>\<open>tag important\<close> closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a"
 | 
| 68052 | 1145 | where "closest_point S a = (SOME x. x \<in> S \<and> (\<forall>y\<in>S. dist a x \<le> dist a y))" | 
| 33175 | 1146 | |
| 1147 | lemma closest_point_exists: | |
| 68052 | 1148 | assumes "closed S" | 
| 1149 |     and "S \<noteq> {}"
 | |
| 71244 | 1150 | shows closest_point_in_set: "closest_point S a \<in> S" | 
| 68052 | 1151 | and "\<forall>y\<in>S. dist a (closest_point S a) \<le> dist a y" | 
| 53347 | 1152 | unfolding closest_point_def | 
| 72356 | 1153 | by (rule_tac someI2_ex, auto intro: distance_attains_inf[OF assms(1,2), of a])+ | 
| 53347 | 1154 | |
| 68052 | 1155 | lemma closest_point_le: "closed S \<Longrightarrow> x \<in> S \<Longrightarrow> dist a (closest_point S a) \<le> dist a x" | 
| 1156 | using closest_point_exists[of S] by auto | |
| 33175 | 1157 | |
| 1158 | lemma closest_point_self: | |
| 68052 | 1159 | assumes "x \<in> S" | 
| 1160 | shows "closest_point S x = x" | |
| 53347 | 1161 | unfolding closest_point_def | 
| 72356 | 1162 | by (rule some1_equality, rule ex1I[of _ x]) (use assms in auto) | 
| 53347 | 1163 | |
| 68052 | 1164 | lemma closest_point_refl: "closed S \<Longrightarrow> S \<noteq> {} \<Longrightarrow> closest_point S x = x \<longleftrightarrow> x \<in> S"
 | 
| 1165 | using closest_point_in_set[of S x] closest_point_self[of x S] | |
| 53347 | 1166 | by auto | 
| 33175 | 1167 | |
| 36337 | 1168 | lemma closer_points_lemma: | 
| 33175 | 1169 | assumes "inner y z > 0" | 
| 1170 | shows "\<exists>u>0. \<forall>v>0. v \<le> u \<longrightarrow> norm(v *\<^sub>R z - y) < norm y" | |
| 53347 | 1171 | proof - | 
| 1172 | have z: "inner z z > 0" | |
| 1173 | unfolding inner_gt_zero_iff using assms by auto | |
| 68031 | 1174 | have "norm (v *\<^sub>R z - y) < norm y" | 
| 1175 | if "0 < v" and "v \<le> inner y z / inner z z" for v | |
| 1176 | unfolding norm_lt using z assms that | |
| 1177 | by (simp add: field_simps inner_diff inner_commute mult_strict_left_mono[OF _ \<open>0<v\<close>]) | |
| 53347 | 1178 | then show ?thesis | 
| 68031 | 1179 | using assms z | 
| 1180 | by (rule_tac x = "inner y z / inner z z" in exI) auto | |
| 53347 | 1181 | qed | 
| 33175 | 1182 | |
| 1183 | lemma closer_point_lemma: | |
| 1184 | assumes "inner (y - x) (z - x) > 0" | |
| 1185 | shows "\<exists>u>0. u \<le> 1 \<and> dist (x + u *\<^sub>R (z - x)) y < dist x y" | |
| 53347 | 1186 | proof - | 
| 1187 | obtain u where "u > 0" | |
| 72356 | 1188 | and u: "\<And>v. \<lbrakk>0<v; v \<le> u\<rbrakk> \<Longrightarrow> norm (v *\<^sub>R (z - x) - (y - x)) < norm (y - x)" | 
| 33175 | 1189 | using closer_points_lemma[OF assms] by auto | 
| 53347 | 1190 | show ?thesis | 
| 72356 | 1191 | using u[of "min u 1"] and \<open>u > 0\<close> | 
| 1192 | by (metis diff_diff_add dist_commute dist_norm less_eq_real_def not_less u zero_less_one) | |
| 53347 | 1193 | qed | 
| 33175 | 1194 | |
| 1195 | lemma any_closest_point_dot: | |
| 68052 | 1196 | assumes "convex S" "closed S" "x \<in> S" "y \<in> S" "\<forall>z\<in>S. dist a x \<le> dist a z" | 
| 33175 | 1197 | shows "inner (a - x) (y - x) \<le> 0" | 
| 53347 | 1198 | proof (rule ccontr) | 
| 1199 | assume "\<not> ?thesis" | |
| 1200 | then obtain u where u: "u>0" "u\<le>1" "dist (x + u *\<^sub>R (y - x)) a < dist x a" | |
| 1201 | using closer_point_lemma[of a x y] by auto | |
| 1202 | let ?z = "(1 - u) *\<^sub>R x + u *\<^sub>R y" | |
| 68052 | 1203 | have "?z \<in> S" | 
| 61426 
d53db136e8fd
new material on path_component_sets, inside, outside, etc. And more default simprules
 paulson <lp15@cam.ac.uk> parents: 
61222diff
changeset | 1204 | using convexD_alt[OF assms(1,3,4), of u] using u by auto | 
| 53347 | 1205 | then show False | 
| 1206 | using assms(5)[THEN bspec[where x="?z"]] and u(3) | |
| 68031 | 1207 | by (auto simp: dist_commute algebra_simps) | 
| 53347 | 1208 | qed | 
| 33175 | 1209 | |
| 1210 | lemma any_closest_point_unique: | |
| 36337 | 1211 | fixes x :: "'a::real_inner" | 
| 68052 | 1212 | assumes "convex S" "closed S" "x \<in> S" "y \<in> S" | 
| 1213 | "\<forall>z\<in>S. dist a x \<le> dist a z" "\<forall>z\<in>S. dist a y \<le> dist a z" | |
| 53347 | 1214 | shows "x = y" | 
| 1215 | using any_closest_point_dot[OF assms(1-4,5)] and any_closest_point_dot[OF assms(1-2,4,3,6)] | |
| 33175 | 1216 | unfolding norm_pths(1) and norm_le_square | 
| 68031 | 1217 | by (auto simp: algebra_simps) | 
| 33175 | 1218 | |
| 1219 | lemma closest_point_unique: | |
| 68052 | 1220 | assumes "convex S" "closed S" "x \<in> S" "\<forall>z\<in>S. dist a x \<le> dist a z" | 
| 1221 | shows "x = closest_point S a" | |
| 1222 | using any_closest_point_unique[OF assms(1-3) _ assms(4), of "closest_point S a"] | |
| 33175 | 1223 | using closest_point_exists[OF assms(2)] and assms(3) by auto | 
| 1224 | ||
| 1225 | lemma closest_point_dot: | |
| 68052 | 1226 | assumes "convex S" "closed S" "x \<in> S" | 
| 1227 | shows "inner (a - closest_point S a) (x - closest_point S a) \<le> 0" | |
| 72356 | 1228 | using any_closest_point_dot[OF assms(1,2) _ assms(3)] | 
| 1229 | by (metis assms(2) assms(3) closest_point_in_set closest_point_le empty_iff) | |
| 33175 | 1230 | |
| 1231 | lemma closest_point_lt: | |
| 68052 | 1232 | assumes "convex S" "closed S" "x \<in> S" "x \<noteq> closest_point S a" | 
| 1233 | shows "dist a (closest_point S a) < dist a x" | |
| 72356 | 1234 | using closest_point_unique[where a=a] closest_point_le[where a=a] assms by fastforce | 
| 33175 | 1235 | |
| 69618 | 1236 | lemma setdist_closest_point: | 
| 1237 |     "\<lbrakk>closed S; S \<noteq> {}\<rbrakk> \<Longrightarrow> setdist {a} S = dist a (closest_point S a)"
 | |
| 72356 | 1238 | by (metis closest_point_exists(2) closest_point_in_set emptyE insert_iff setdist_unique) | 
| 69618 | 1239 | |
| 33175 | 1240 | lemma closest_point_lipschitz: | 
| 68052 | 1241 | assumes "convex S" | 
| 1242 |     and "closed S" "S \<noteq> {}"
 | |
| 1243 | shows "dist (closest_point S x) (closest_point S y) \<le> dist x y" | |
| 53347 | 1244 | proof - | 
| 68052 | 1245 | have "inner (x - closest_point S x) (closest_point S y - closest_point S x) \<le> 0" | 
| 1246 | and "inner (y - closest_point S y) (closest_point S x - closest_point S y) \<le> 0" | |
| 72356 | 1247 | by (simp_all add: assms closest_point_dot closest_point_in_set) | 
| 53347 | 1248 | then show ?thesis unfolding dist_norm and norm_le | 
| 68052 | 1249 | using inner_ge_zero[of "(x - closest_point S x) - (y - closest_point S y)"] | 
| 53347 | 1250 | by (simp add: inner_add inner_diff inner_commute) | 
| 1251 | qed | |
| 33175 | 1252 | |
| 1253 | lemma continuous_at_closest_point: | |
| 68052 | 1254 | assumes "convex S" | 
| 1255 | and "closed S" | |
| 1256 |     and "S \<noteq> {}"
 | |
| 1257 | shows "continuous (at x) (closest_point S)" | |
| 49531 | 1258 | unfolding continuous_at_eps_delta | 
| 33175 | 1259 | using le_less_trans[OF closest_point_lipschitz[OF assms]] by auto | 
| 1260 | ||
| 1261 | lemma continuous_on_closest_point: | |
| 68052 | 1262 | assumes "convex S" | 
| 1263 | and "closed S" | |
| 1264 |     and "S \<noteq> {}"
 | |
| 1265 | shows "continuous_on t (closest_point S)" | |
| 53347 | 1266 | by (metis continuous_at_imp_continuous_on continuous_at_closest_point[OF assms]) | 
| 1267 | ||
| 63881 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1268 | proposition closest_point_in_rel_interior: | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1269 |   assumes "closed S" "S \<noteq> {}" and x: "x \<in> affine hull S"
 | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1270 | shows "closest_point S x \<in> rel_interior S \<longleftrightarrow> x \<in> rel_interior S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1271 | proof (cases "x \<in> S") | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1272 | case True | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1273 | then show ?thesis | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1274 | by (simp add: closest_point_self) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1275 | next | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1276 | case False | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1277 | then have "False" if asm: "closest_point S x \<in> rel_interior S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1278 | proof - | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1279 | obtain e where "e > 0" and clox: "closest_point S x \<in> S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1280 | and e: "cball (closest_point S x) e \<inter> affine hull S \<subseteq> S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1281 | using asm mem_rel_interior_cball by blast | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1282 | then have clo_notx: "closest_point S x \<noteq> x" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1283 | using \<open>x \<notin> S\<close> by auto | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1284 | define y where "y \<equiv> closest_point S x - | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1285 | (min 1 (e / norm(closest_point S x - x))) *\<^sub>R (closest_point S x - x)" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1286 | have "x - y = (1 - min 1 (e / norm (closest_point S x - x))) *\<^sub>R (x - closest_point S x)" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1287 | by (simp add: y_def algebra_simps) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1288 | then have "norm (x - y) = abs ((1 - min 1 (e / norm (closest_point S x - x)))) * norm(x - closest_point S x)" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1289 | by simp | 
| 68031 | 1290 | also have "\<dots> < norm(x - closest_point S x)" | 
| 63881 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1291 | using clo_notx \<open>e > 0\<close> | 
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70802diff
changeset | 1292 | by (auto simp: mult_less_cancel_right2 field_split_simps) | 
| 63881 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1293 | finally have no_less: "norm (x - y) < norm (x - closest_point S x)" . | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1294 | have "y \<in> affine hull S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1295 | unfolding y_def | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1296 | by (meson affine_affine_hull clox hull_subset mem_affine_3_minus2 subsetD x) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1297 | moreover have "dist (closest_point S x) y \<le> e" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1298 | using \<open>e > 0\<close> by (auto simp: y_def min_mult_distrib_right) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1299 | ultimately have "y \<in> S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1300 | using subsetD [OF e] by simp | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1301 | then have "dist x (closest_point S x) \<le> dist x y" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1302 | by (simp add: closest_point_le \<open>closed S\<close>) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1303 | with no_less show False | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1304 | by (simp add: dist_norm) | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1305 | qed | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1306 | moreover have "x \<notin> rel_interior S" | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1307 | using rel_interior_subset False by blast | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1308 | ultimately show ?thesis by blast | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1309 | qed | 
| 
b746b19197bd
lots of new results about topology, affine dimension etc
 paulson <lp15@cam.ac.uk> parents: 
63627diff
changeset | 1310 | |
| 33175 | 1311 | |
| 70136 | 1312 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Various point-to-set separating/supporting hyperplane theorems\<close> | 
| 33175 | 1313 | |
| 1314 | lemma supporting_hyperplane_closed_point: | |
| 36337 | 1315 |   fixes z :: "'a::{real_inner,heine_borel}"
 | 
| 68052 | 1316 | assumes "convex S" | 
| 1317 | and "closed S" | |
| 1318 |     and "S \<noteq> {}"
 | |
| 1319 | and "z \<notin> S" | |
| 1320 | shows "\<exists>a b. \<exists>y\<in>S. inner a z < b \<and> inner a y = b \<and> (\<forall>x\<in>S. inner a x \<ge> b)" | |
| 53347 | 1321 | proof - | 
| 68052 | 1322 | obtain y where "y \<in> S" and y: "\<forall>x\<in>S. dist z y \<le> dist z x" | 
| 63075 
60a42a4166af
lemmas about dimension, hyperplanes, span, etc.
 paulson <lp15@cam.ac.uk> parents: 
63072diff
changeset | 1323 | by (metis distance_attains_inf[OF assms(2-3)]) | 
| 53347 | 1324 | show ?thesis | 
| 68052 | 1325 | proof (intro exI bexI conjI ballI) | 
| 1326 | show "(y - z) \<bullet> z < (y - z) \<bullet> y" | |
| 1327 | by (metis \<open>y \<in> S\<close> assms(4) diff_gt_0_iff_gt inner_commute inner_diff_left inner_gt_zero_iff right_minus_eq) | |
| 1328 | show "(y - z) \<bullet> y \<le> (y - z) \<bullet> x" if "x \<in> S" for x | |
| 1329 | proof (rule ccontr) | |
| 1330 | have *: "\<And>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> dist z y \<le> dist z ((1 - u) *\<^sub>R y + u *\<^sub>R x)" | |
| 1331 | using assms(1)[unfolded convex_alt] and y and \<open>x\<in>S\<close> and \<open>y\<in>S\<close> by auto | |
| 1332 | assume "\<not> (y - z) \<bullet> y \<le> (y - z) \<bullet> x" | |
| 1333 | then obtain v where "v > 0" "v \<le> 1" "dist (y + v *\<^sub>R (x - y)) z < dist y z" | |
| 1334 | using closer_point_lemma[of z y x] by (auto simp: inner_diff) | |
| 1335 | then show False | |
| 1336 | using *[of v] by (auto simp: dist_commute algebra_simps) | |
| 1337 | qed | |
| 1338 | qed (use \<open>y \<in> S\<close> in auto) | |
| 33175 | 1339 | qed | 
| 1340 | ||
| 1341 | lemma separating_hyperplane_closed_point: | |
| 36337 | 1342 |   fixes z :: "'a::{real_inner,heine_borel}"
 | 
| 68052 | 1343 | assumes "convex S" | 
| 1344 | and "closed S" | |
| 1345 | and "z \<notin> S" | |
| 1346 | shows "\<exists>a b. inner a z < b \<and> (\<forall>x\<in>S. inner a x > b)" | |
| 1347 | proof (cases "S = {}")
 | |
| 53347 | 1348 | case True | 
| 1349 | then show ?thesis | |
| 68052 | 1350 | by (simp add: gt_ex) | 
| 33175 | 1351 | next | 
| 53347 | 1352 | case False | 
| 68052 | 1353 | obtain y where "y \<in> S" and y: "\<And>x. x \<in> S \<Longrightarrow> dist z y \<le> dist z x" | 
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 1354 | by (metis distance_attains_inf[OF assms(2) False]) | 
| 53347 | 1355 | show ?thesis | 
| 68052 | 1356 | proof (intro exI conjI ballI) | 
| 1357 | show "(y - z) \<bullet> z < inner (y - z) z + (norm (y - z))\<^sup>2 / 2" | |
| 1358 | using \<open>y\<in>S\<close> \<open>z\<notin>S\<close> by auto | |
| 1359 | next | |
| 53347 | 1360 | fix x | 
| 68052 | 1361 | assume "x \<in> S" | 
| 1362 | have "False" if *: "0 < inner (z - y) (x - y)" | |
| 53347 | 1363 | proof - | 
| 68052 | 1364 | obtain u where "u > 0" "u \<le> 1" "dist (y + u *\<^sub>R (x - y)) z < dist y z" | 
| 1365 | using * closer_point_lemma by blast | |
| 1366 | then show False using y[of "y + u *\<^sub>R (x - y)"] convexD_alt [OF \<open>convex S\<close>] | |
| 1367 | using \<open>x\<in>S\<close> \<open>y\<in>S\<close> by (auto simp: dist_commute algebra_simps) | |
| 53347 | 1368 | qed | 
| 1369 | moreover have "0 < (norm (y - z))\<^sup>2" | |
| 68052 | 1370 | using \<open>y\<in>S\<close> \<open>z\<notin>S\<close> by auto | 
| 53347 | 1371 | then have "0 < inner (y - z) (y - z)" | 
| 1372 | unfolding power2_norm_eq_inner by simp | |
| 68052 | 1373 | ultimately show "(y - z) \<bullet> z + (norm (y - z))\<^sup>2 / 2 < (y - z) \<bullet> x" | 
| 1374 | by (force simp: field_simps power2_norm_eq_inner inner_commute inner_diff) | |
| 1375 | qed | |
| 33175 | 1376 | qed | 
| 1377 | ||
| 1378 | lemma separating_hyperplane_closed_0: | |
| 68052 | 1379 |   assumes "convex (S::('a::euclidean_space) set)"
 | 
| 1380 | and "closed S" | |
| 1381 | and "0 \<notin> S" | |
| 1382 | shows "\<exists>a b. a \<noteq> 0 \<and> 0 < b \<and> (\<forall>x\<in>S. inner a x > b)" | |
| 1383 | proof (cases "S = {}")
 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1384 | case True | 
| 68052 | 1385 | have "(SOME i. i\<in>Basis) \<noteq> (0::'a)" | 
| 1386 | by (metis Basis_zero SOME_Basis) | |
| 53347 | 1387 | then show ?thesis | 
| 68052 | 1388 | using True zero_less_one by blast | 
| 53347 | 1389 | next | 
| 1390 | case False | |
| 1391 | then show ?thesis | |
| 1392 | using False using separating_hyperplane_closed_point[OF assms] | |
| 68052 | 1393 | by (metis all_not_in_conv inner_zero_left inner_zero_right less_eq_real_def not_le) | 
| 53347 | 1394 | qed | 
| 1395 | ||
| 33175 | 1396 | |
| 70136 | 1397 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Now set-to-set for closed/compact sets\<close> | 
| 33175 | 1398 | |
| 1399 | lemma separating_hyperplane_closed_compact: | |
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1400 | fixes S :: "'a::euclidean_space set" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1401 | assumes "convex S" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1402 | and "closed S" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1403 | and "convex T" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1404 | and "compact T" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1405 |     and "T \<noteq> {}"
 | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1406 |     and "S \<inter> T = {}"
 | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1407 | shows "\<exists>a b. (\<forall>x\<in>S. inner a x < b) \<and> (\<forall>x\<in>T. inner a x > b)" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1408 | proof (cases "S = {}")
 | 
| 33175 | 1409 | case True | 
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1410 | obtain b where b: "b > 0" "\<forall>x\<in>T. norm x \<le> b" | 
| 53347 | 1411 | using compact_imp_bounded[OF assms(4)] unfolding bounded_pos by auto | 
| 1412 | obtain z :: 'a where z: "norm z = b + 1" | |
| 1413 | using vector_choose_size[of "b + 1"] and b(1) by auto | |
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1414 | then have "z \<notin> T" using b(2)[THEN bspec[where x=z]] by auto | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1415 | then obtain a b where ab: "inner a z < b" "\<forall>x\<in>T. b < inner a x" | 
| 53347 | 1416 | using separating_hyperplane_closed_point[OF assms(3) compact_imp_closed[OF assms(4)], of z] | 
| 1417 | by auto | |
| 1418 | then show ?thesis | |
| 1419 | using True by auto | |
| 33175 | 1420 | next | 
| 53347 | 1421 | case False | 
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1422 | then obtain y where "y \<in> S" by auto | 
| 72356 | 1423 |   obtain a b where "0 < b" and \<section>: "\<And>x. x \<in> (\<Union>x\<in> S. \<Union>y \<in> T. {x - y}) \<Longrightarrow> b < inner a x"
 | 
| 33175 | 1424 | using separating_hyperplane_closed_point[OF convex_differences[OF assms(1,3)], of 0] | 
| 72356 | 1425 | using closed_compact_differences assms by fastforce | 
| 1426 | have ab: "b + inner a y < inner a x" if "x\<in>S" "y\<in>T" for x y | |
| 1427 | using \<section> [of "x-y"] that by (auto simp add: inner_diff_right less_diff_eq) | |
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69064diff
changeset | 1428 | define k where "k = (SUP x\<in>T. a \<bullet> x)" | 
| 72356 | 1429 | have "k + b / 2 < a \<bullet> x" if "x \<in> S" for x | 
| 53347 | 1430 | proof - | 
| 72356 | 1431 | have "k \<le> inner a x - b" | 
| 1432 | unfolding k_def | |
| 1433 |       using \<open>T \<noteq> {}\<close> ab that by (fastforce intro: cSUP_least)
 | |
| 1434 | then show ?thesis | |
| 1435 | using \<open>0 < b\<close> by auto | |
| 1436 | qed | |
| 1437 | moreover | |
| 1438 | have "- (k + b / 2) < - a \<bullet> x" if "x \<in> T" for x | |
| 1439 | proof - | |
| 1440 | have "inner a x - b / 2 < k" | |
| 53347 | 1441 | unfolding k_def | 
| 54263 
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
 hoelzl parents: 
54258diff
changeset | 1442 | proof (subst less_cSUP_iff) | 
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1443 |       show "T \<noteq> {}" by fact
 | 
| 67399 | 1444 | show "bdd_above ((\<bullet>) a ` T)" | 
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1445 | using ab[rule_format, of y] \<open>y \<in> S\<close> | 
| 54263 
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
 hoelzl parents: 
54258diff
changeset | 1446 | by (intro bdd_aboveI2[where M="inner a y - b"]) (auto simp: field_simps intro: less_imp_le) | 
| 72356 | 1447 | show "\<exists>y\<in>T. a \<bullet> x - b / 2 < a \<bullet> y" | 
| 1448 | using \<open>0 < b\<close> that by force | |
| 1449 | qed | |
| 1450 | then show ?thesis | |
| 54263 
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
 hoelzl parents: 
54258diff
changeset | 1451 | by auto | 
| 33175 | 1452 | qed | 
| 72356 | 1453 | ultimately show ?thesis | 
| 1454 | by (metis inner_minus_left neg_less_iff_less) | |
| 33175 | 1455 | qed | 
| 1456 | ||
| 1457 | lemma separating_hyperplane_compact_closed: | |
| 65038 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1458 | fixes S :: "'a::euclidean_space set" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1459 | assumes "convex S" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1460 | and "compact S" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1461 |     and "S \<noteq> {}"
 | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1462 | and "convex T" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1463 | and "closed T" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1464 |     and "S \<inter> T = {}"
 | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1465 | shows "\<exists>a b. (\<forall>x\<in>S. inner a x < b) \<and> (\<forall>x\<in>T. inner a x > b)" | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1466 | proof - | 
| 
9391ea7daa17
new lemmas about segments, etc. Also recast some theorems to use Union rather than general set comprehensions
 paulson <lp15@cam.ac.uk> parents: 
65036diff
changeset | 1467 | obtain a b where "(\<forall>x\<in>T. inner a x < b) \<and> (\<forall>x\<in>S. b < inner a x)" | 
| 72356 | 1468 | by (metis disjoint_iff_not_equal separating_hyperplane_closed_compact assms) | 
| 53347 | 1469 | then show ?thesis | 
| 72356 | 1470 | by (metis inner_minus_left neg_less_iff_less) | 
| 53347 | 1471 | qed | 
| 1472 | ||
| 33175 | 1473 | |
| 70136 | 1474 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>General case without assuming closure and getting non-strict separation\<close> | 
| 33175 | 1475 | |
| 1476 | lemma separating_hyperplane_set_0: | |
| 68031 | 1477 | assumes "convex S" "(0::'a::euclidean_space) \<notin> S" | 
| 1478 | shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>S. 0 \<le> inner a x)" | |
| 53347 | 1479 | proof - | 
| 1480 |   let ?k = "\<lambda>c. {x::'a. 0 \<le> inner c x}"
 | |
| 68031 | 1481 |   have *: "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}" if as: "f \<subseteq> ?k ` S" "finite f" for f
 | 
| 53347 | 1482 | proof - | 
| 68031 | 1483 | obtain c where c: "f = ?k ` c" "c \<subseteq> S" "finite c" | 
| 53347 | 1484 | using finite_subset_image[OF as(2,1)] by auto | 
| 1485 | then obtain a b where ab: "a \<noteq> 0" "0 < b" "\<forall>x\<in>convex hull c. b < inner a x" | |
| 33175 | 1486 | using separating_hyperplane_closed_0[OF convex_convex_hull, of c] | 
| 1487 | using finite_imp_compact_convex_hull[OF c(3), THEN compact_imp_closed] and assms(2) | |
| 53347 | 1488 | using subset_hull[of convex, OF assms(1), symmetric, of c] | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 1489 | by force | 
| 72356 | 1490 | have "norm (a /\<^sub>R norm a) = 1" | 
| 1491 | by (simp add: ab(1)) | |
| 1492 | moreover have "(\<forall>y\<in>c. 0 \<le> y \<bullet> (a /\<^sub>R norm a))" | |
| 1493 | using hull_subset[of c convex] ab by (force simp: inner_commute) | |
| 1494 | ultimately have "\<exists>x. norm x = 1 \<and> (\<forall>y\<in>c. 0 \<le> inner y x)" | |
| 1495 | by blast | |
| 53347 | 1496 |     then show "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}"
 | 
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 1497 | unfolding c(1) frontier_cball sphere_def dist_norm by auto | 
| 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 1498 | qed | 
| 68031 | 1499 |   have "frontier (cball 0 1) \<inter> (\<Inter>(?k ` S)) \<noteq> {}"
 | 
| 72356 | 1500 | by (rule compact_imp_fip) (use * closed_halfspace_ge in auto) | 
| 68031 | 1501 | then obtain x where "norm x = 1" "\<forall>y\<in>S. x\<in>?k y" | 
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 1502 | unfolding frontier_cball dist_norm sphere_def by auto | 
| 53347 | 1503 | then show ?thesis | 
| 62381 
a6479cb85944
New and revised material for (multivariate) analysis
 paulson <lp15@cam.ac.uk> parents: 
62131diff
changeset | 1504 | by (metis inner_commute mem_Collect_eq norm_eq_zero zero_neq_one) | 
| 53347 | 1505 | qed | 
| 33175 | 1506 | |
| 1507 | lemma separating_hyperplane_sets: | |
| 68031 | 1508 | fixes S T :: "'a::euclidean_space set" | 
| 1509 | assumes "convex S" | |
| 1510 | and "convex T" | |
| 1511 |     and "S \<noteq> {}"
 | |
| 1512 |     and "T \<noteq> {}"
 | |
| 1513 |     and "S \<inter> T = {}"
 | |
| 1514 | shows "\<exists>a b. a \<noteq> 0 \<and> (\<forall>x\<in>S. inner a x \<le> b) \<and> (\<forall>x\<in>T. inner a x \<ge> b)" | |
| 53347 | 1515 | proof - | 
| 1516 | from separating_hyperplane_set_0[OF convex_differences[OF assms(2,1)]] | |
| 68031 | 1517 |   obtain a where "a \<noteq> 0" "\<forall>x\<in>{x - y |x y. x \<in> T \<and> y \<in> S}. 0 \<le> inner a x"
 | 
| 1518 | using assms(3-5) by force | |
| 1519 | then have *: "\<And>x y. x \<in> T \<Longrightarrow> y \<in> S \<Longrightarrow> inner a y \<le> inner a x" | |
| 1520 | by (force simp: inner_diff) | |
| 1521 | then have bdd: "bdd_above (((\<bullet>) a)`S)" | |
| 1522 |     using \<open>T \<noteq> {}\<close> by (auto intro: bdd_aboveI2[OF *])
 | |
| 54263 
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
 hoelzl parents: 
54258diff
changeset | 1523 | show ?thesis | 
| 60420 | 1524 | using \<open>a\<noteq>0\<close> | 
| 69260 
0a9688695a1b
removed relics of ASCII syntax for indexed big operators
 haftmann parents: 
69064diff
changeset | 1525 | by (intro exI[of _ a] exI[of _ "SUP x\<in>S. a \<bullet> x"]) | 
| 68031 | 1526 |        (auto intro!: cSUP_upper bdd cSUP_least \<open>a \<noteq> 0\<close> \<open>S \<noteq> {}\<close> *)
 | 
| 60420 | 1527 | qed | 
| 1528 | ||
| 1529 | ||
| 70136 | 1530 | subsection\<^marker>\<open>tag unimportant\<close> \<open>More convexity generalities\<close> | 
| 33175 | 1531 | |
| 62948 
7700f467892b
lots of new theorems for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
62843diff
changeset | 1532 | lemma convex_closure [intro,simp]: | 
| 68031 | 1533 | fixes S :: "'a::real_normed_vector set" | 
| 1534 | assumes "convex S" | |
| 1535 | shows "convex (closure S)" | |
| 53676 | 1536 | apply (rule convexI) | 
| 72356 | 1537 | unfolding closure_sequential | 
| 1538 | apply (elim exE) | |
| 1539 | subgoal for x y u v f g | |
| 1540 | by (rule_tac x="\<lambda>n. u *\<^sub>R f n + v *\<^sub>R g n" in exI) (force intro: tendsto_intros dest: convexD [OF assms]) | |
| 53347 | 1541 | done | 
| 33175 | 1542 | |
| 62948 
7700f467892b
lots of new theorems for multivariate analysis
 paulson <lp15@cam.ac.uk> parents: 
62843diff
changeset | 1543 | lemma convex_interior [intro,simp]: | 
| 68031 | 1544 | fixes S :: "'a::real_normed_vector set" | 
| 1545 | assumes "convex S" | |
| 1546 | shows "convex (interior S)" | |
| 53347 | 1547 | unfolding convex_alt Ball_def mem_interior | 
| 68052 | 1548 | proof clarify | 
| 53347 | 1549 | fix x y u | 
| 1550 | assume u: "0 \<le> u" "u \<le> (1::real)" | |
| 1551 | fix e d | |
| 68031 | 1552 | assume ed: "ball x e \<subseteq> S" "ball y d \<subseteq> S" "0<d" "0<e" | 
| 1553 | show "\<exists>e>0. ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) e \<subseteq> S" | |
| 68052 | 1554 | proof (intro exI conjI subsetI) | 
| 53347 | 1555 | fix z | 
| 72356 | 1556 | assume z: "z \<in> ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) (min d e)" | 
| 1557 | have "(1- u) *\<^sub>R (z - u *\<^sub>R (y - x)) + u *\<^sub>R (z + (1 - u) *\<^sub>R (y - x)) \<in> S" | |
| 1558 | proof (rule_tac assms[unfolded convex_alt, rule_format]) | |
| 1559 | show "z - u *\<^sub>R (y - x) \<in> S" "z + (1 - u) *\<^sub>R (y - x) \<in> S" | |
| 1560 | using ed z u by (auto simp add: algebra_simps dist_norm) | |
| 1561 | qed (use u in auto) | |
| 68031 | 1562 | then show "z \<in> S" | 
| 1563 | using u by (auto simp: algebra_simps) | |
| 72356 | 1564 | qed(use u ed in auto) | 
| 53347 | 1565 | qed | 
| 33175 | 1566 | |
| 68031 | 1567 | lemma convex_hull_eq_empty[simp]: "convex hull S = {} \<longleftrightarrow> S = {}"
 | 
| 1568 | using hull_subset[of S convex] convex_hull_empty by auto | |
| 33175 | 1569 | |
| 53347 | 1570 | |
| 70136 | 1571 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Convex set as intersection of halfspaces\<close> | 
| 33175 | 1572 | |
| 1573 | lemma convex_halfspace_intersection: | |
| 72356 | 1574 |   fixes S :: "('a::euclidean_space) set"
 | 
| 1575 | assumes "closed S" "convex S" | |
| 1576 |   shows "S = \<Inter>{h. S \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}"
 | |
| 53347 | 1577 | proof - | 
| 72356 | 1578 |   { fix z
 | 
| 1579 |     assume "\<forall>T. S \<subseteq> T \<and> (\<exists>a b. T = {x. inner a x \<le> b}) \<longrightarrow> z \<in> T"  "z \<notin> S"
 | |
| 1580 |     then have \<section>: "\<And>a b. S \<subseteq> {x. inner a x \<le> b} \<Longrightarrow> z \<in> {x. inner a x \<le> b}"
 | |
| 1581 | by blast | |
| 1582 | obtain a b where "inner a z < b" "(\<forall>x\<in>S. inner a x > b)" | |
| 1583 | using \<open>z \<notin> S\<close> assms separating_hyperplane_closed_point by blast | |
| 1584 | then have False | |
| 1585 | using \<section> [of "-a" "-b"] by fastforce | |
| 1586 | } | |
| 1587 | then show ?thesis | |
| 1588 | by force | |
| 1589 | qed | |
| 33175 | 1590 | |
| 53347 | 1591 | |
| 70136 | 1592 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Convexity of general and special intervals\<close> | 
| 33175 | 1593 | |
| 1594 | lemma is_interval_convex: | |
| 68052 | 1595 | fixes S :: "'a::euclidean_space set" | 
| 1596 | assumes "is_interval S" | |
| 1597 | shows "convex S" | |
| 37732 
6432bf0d7191
generalize type of is_interval to class euclidean_space
 huffman parents: 
37673diff
changeset | 1598 | proof (rule convexI) | 
| 53348 | 1599 | fix x y and u v :: real | 
| 72356 | 1600 | assume "x \<in> S" "y \<in> S" and uv: "0 \<le> u" "0 \<le> v" "u + v = 1" | 
| 53348 | 1601 | then have *: "u = 1 - v" "1 - v \<ge> 0" and **: "v = 1 - u" "1 - u \<ge> 0" | 
| 1602 | by auto | |
| 1603 |   {
 | |
| 1604 | fix a b | |
| 1605 | assume "\<not> b \<le> u * a + v * b" | |
| 1606 | then have "u * a < (1 - v) * b" | |
| 72356 | 1607 | unfolding not_le using \<open>0 \<le> v\<close>by (auto simp: field_simps) | 
| 53348 | 1608 | then have "a < b" | 
| 72356 | 1609 | using "*"(1) less_eq_real_def uv(1) by auto | 
| 53348 | 1610 | then have "a \<le> u * a + v * b" | 
| 72356 | 1611 | unfolding * using \<open>0 \<le> v\<close> | 
| 68031 | 1612 | by (auto simp: field_simps intro!:mult_right_mono) | 
| 53348 | 1613 | } | 
| 1614 | moreover | |
| 1615 |   {
 | |
| 1616 | fix a b | |
| 1617 | assume "\<not> u * a + v * b \<le> a" | |
| 1618 | then have "v * b > (1 - u) * a" | |
| 72356 | 1619 | unfolding not_le using \<open>0 \<le> v\<close> by (auto simp: field_simps) | 
| 53348 | 1620 | then have "a < b" | 
| 72356 | 1621 | unfolding * using \<open>0 \<le> v\<close> | 
| 1622 | by (rule_tac mult_left_less_imp_less) (auto simp: field_simps) | |
| 53348 | 1623 | then have "u * a + v * b \<le> b" | 
| 1624 | unfolding ** | |
| 72356 | 1625 | using **(2) \<open>0 \<le> u\<close> by (auto simp: algebra_simps mult_right_mono) | 
| 53348 | 1626 | } | 
| 68052 | 1627 | ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> S" | 
| 72356 | 1628 | using DIM_positive[where 'a='a] | 
| 1629 | by (intro mem_is_intervalI [OF assms \<open>x \<in> S\<close> \<open>y \<in> S\<close>]) (auto simp: inner_simps) | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1630 | qed | 
| 33175 | 1631 | |
| 1632 | lemma is_interval_connected: | |
| 68052 | 1633 | fixes S :: "'a::euclidean_space set" | 
| 1634 | shows "is_interval S \<Longrightarrow> connected S" | |
| 33175 | 1635 | using is_interval_convex convex_connected by auto | 
| 1636 | ||
| 62618 
f7f2467ab854
Refactoring (moving theorems into better locations), plus a bit of new material
 paulson <lp15@cam.ac.uk> parents: 
62533diff
changeset | 1637 | lemma convex_box [simp]: "convex (cbox a b)" "convex (box a (b::'a::euclidean_space))" | 
| 72356 | 1638 | by (auto simp add: is_interval_convex) | 
| 33175 | 1639 | |
| 63928 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1640 | text\<open>A non-singleton connected set is perfect (i.e. has no isolated points). \<close> | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1641 | lemma connected_imp_perfect: | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1642 | fixes a :: "'a::metric_space" | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1643 |   assumes "connected S" "a \<in> S" and S: "\<And>x. S \<noteq> {x}"
 | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1644 | shows "a islimpt S" | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1645 | proof - | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1646 | have False if "a \<in> T" "open T" "\<And>y. \<lbrakk>y \<in> S; y \<in> T\<rbrakk> \<Longrightarrow> y = a" for T | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1647 | proof - | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1648 | obtain e where "e > 0" and e: "cball a e \<subseteq> T" | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1649 | using \<open>open T\<close> \<open>a \<in> T\<close> by (auto simp: open_contains_cball) | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 1650 |     have "openin (top_of_set S) {a}"
 | 
| 63928 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1651 | unfolding openin_open using that \<open>a \<in> S\<close> by blast | 
| 69922 
4a9167f377b0
new material about topology, etc.; also fixes for yesterday's
 paulson <lp15@cam.ac.uk> parents: 
69710diff
changeset | 1652 |     moreover have "closedin (top_of_set S) {a}"
 | 
| 63928 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1653 | by (simp add: assms) | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1654 | ultimately show "False" | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1655 | using \<open>connected S\<close> connected_clopen S by blast | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1656 | qed | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1657 | then show ?thesis | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1658 | unfolding islimpt_def by blast | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1659 | qed | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1660 | |
| 73795 | 1661 | lemma islimpt_Ioc [simp]: | 
| 1662 | fixes a :: real | |
| 1663 | assumes "a<b" | |
| 1664 |   shows "x islimpt {a<..b} \<longleftrightarrow> x \<in> {a..b}"  (is "?lhs = ?rhs")
 | |
| 1665 | proof | |
| 1666 | show "?lhs \<Longrightarrow> ?rhs" | |
| 1667 | by (metis assms closed_atLeastAtMost closed_limpt closure_greaterThanAtMost closure_subset islimpt_subset) | |
| 1668 | next | |
| 1669 | assume ?rhs | |
| 1670 |   then have "x \<in> closure {a<..<b}"
 | |
| 1671 | using assms closure_greaterThanLessThan by blast | |
| 1672 | then show ?lhs | |
| 1673 | by (metis (no_types) Diff_empty Diff_insert0 interior_lessThanAtMost interior_limit_point interior_subset islimpt_in_closure islimpt_subset) | |
| 1674 | qed | |
| 1675 | ||
| 1676 | lemma islimpt_Ico [simp]: | |
| 1677 | fixes a :: real | |
| 1678 |   assumes "a<b" shows "x islimpt {a..<b} \<longleftrightarrow> x \<in> {a..b}"
 | |
| 1679 | by (metis assms closure_atLeastLessThan closure_greaterThanAtMost islimpt_Ioc limpt_of_closure) | |
| 1680 | ||
| 1681 | lemma islimpt_Icc [simp]: | |
| 1682 | fixes a :: real | |
| 1683 |   assumes "a<b" shows "x islimpt {a..b} \<longleftrightarrow> x \<in> {a..b}"
 | |
| 1684 | by (metis assms closure_atLeastLessThan islimpt_Ico limpt_of_closure) | |
| 1685 | ||
| 63928 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1686 | lemma connected_imp_perfect_aff_dim: | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1687 | "\<lbrakk>connected S; aff_dim S \<noteq> 0; a \<in> S\<rbrakk> \<Longrightarrow> a islimpt S" | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1688 | using aff_dim_sing connected_imp_perfect by blast | 
| 
d81fb5b46a5c
new material about topological concepts, etc
 paulson <lp15@cam.ac.uk> parents: 
63918diff
changeset | 1689 | |
| 70136 | 1690 | subsection\<^marker>\<open>tag unimportant\<close> \<open>On \<open>real\<close>, \<open>is_interval\<close>, \<open>convex\<close> and \<open>connected\<close> are all equivalent\<close> | 
| 33175 | 1691 | |
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1692 | lemma mem_is_interval_1_I: | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1693 | fixes a b c::real | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1694 | assumes "is_interval S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1695 | assumes "a \<in> S" "c \<in> S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1696 | assumes "a \<le> b" "b \<le> c" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1697 | shows "b \<in> S" | 
| 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1698 | using assms is_interval_1 by blast | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1699 | |
| 54465 | 1700 | lemma is_interval_connected_1: | 
| 72356 | 1701 | fixes S :: "real set" | 
| 1702 | shows "is_interval S \<longleftrightarrow> connected S" | |
| 1703 | by (meson connected_iff_interval is_interval_1) | |
| 33175 | 1704 | |
| 1705 | lemma is_interval_convex_1: | |
| 72356 | 1706 | fixes S :: "real set" | 
| 1707 | shows "is_interval S \<longleftrightarrow> convex S" | |
| 54465 | 1708 | by (metis is_interval_convex convex_connected is_interval_connected_1) | 
| 33175 | 1709 | |
| 64773 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1710 | lemma connected_compact_interval_1: | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1711 |      "connected S \<and> compact S \<longleftrightarrow> (\<exists>a b. S = {a..b::real})"
 | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1712 | by (auto simp: is_interval_connected_1 [symmetric] is_interval_compact) | 
| 
223b2ebdda79
Many new theorems, and more tidying
 paulson <lp15@cam.ac.uk> parents: 
64394diff
changeset | 1713 | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1714 | lemma connected_convex_1: | 
| 72356 | 1715 | fixes S :: "real set" | 
| 1716 | shows "connected S \<longleftrightarrow> convex S" | |
| 54465 | 1717 | by (metis is_interval_convex convex_connected is_interval_connected_1) | 
| 53348 | 1718 | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1719 | lemma connected_convex_1_gen: | 
| 72356 | 1720 | fixes S :: "'a :: euclidean_space set" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1721 |   assumes "DIM('a) = 1"
 | 
| 72356 | 1722 | shows "connected S \<longleftrightarrow> convex S" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1723 | proof - | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1724 | obtain f:: "'a \<Rightarrow> real" where linf: "linear f" and "inj f" | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 1725 | using subspace_isomorphism[OF subspace_UNIV subspace_UNIV, | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 1726 | where 'a='a and 'b=real] | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 1727 | unfolding Euclidean_Space.dim_UNIV | 
| 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 1728 | by (auto simp: assms) | 
| 72356 | 1729 | then have "f -` (f ` S) = S" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1730 | by (simp add: inj_vimage_image_eq) | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1731 | then show ?thesis | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1732 | by (metis connected_convex_1 convex_linear_vimage linf convex_connected connected_linear_image) | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1733 | qed | 
| 53348 | 1734 | |
| 70097 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1735 | lemma [simp]: | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1736 | fixes r s::real | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1737 |   shows is_interval_io: "is_interval {..<r}"
 | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1738 |     and is_interval_oi: "is_interval {r<..}"
 | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1739 |     and is_interval_oo: "is_interval {r<..<s}"
 | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1740 |     and is_interval_oc: "is_interval {r<..s}"
 | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1741 |     and is_interval_co: "is_interval {r..<s}"
 | 
| 
4005298550a6
The last big tranche of Homology material: invariance of domain; renamings to use generic sum/prod lemmas from their locale
 paulson <lp15@cam.ac.uk> parents: 
69922diff
changeset | 1742 | by (simp_all add: is_interval_convex_1) | 
| 67685 
bdff8bf0a75b
moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
 immler parents: 
67613diff
changeset | 1743 | |
| 70136 | 1744 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Another intermediate value theorem formulation\<close> | 
| 33175 | 1745 | |
| 53348 | 1746 | lemma ivt_increasing_component_on_1: | 
| 61609 
77b453bd616f
Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
 paulson <lp15@cam.ac.uk> parents: 
61531diff
changeset | 1747 | fixes f :: "real \<Rightarrow> 'a::euclidean_space" | 
| 53348 | 1748 | assumes "a \<le> b" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1749 |     and "continuous_on {a..b} f"
 | 
| 53348 | 1750 | and "(f a)\<bullet>k \<le> y" "y \<le> (f b)\<bullet>k" | 
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1751 |   shows "\<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
 | 
| 56188 | 1752 | proof - | 
| 1753 | have "f a \<in> f ` cbox a b" "f b \<in> f ` cbox a b" | |
| 72356 | 1754 | using \<open>a \<le> b\<close> by auto | 
| 53348 | 1755 | then show ?thesis | 
| 56188 | 1756 | using connected_ivt_component[of "f ` cbox a b" "f a" "f b" k y] | 
| 66827 
c94531b5007d
Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
 paulson <lp15@cam.ac.uk> parents: 
66793diff
changeset | 1757 | by (simp add: connected_continuous_image assms) | 
| 53348 | 1758 | qed | 
| 1759 | ||
| 1760 | lemma ivt_increasing_component_1: | |
| 1761 | fixes f :: "real \<Rightarrow> 'a::euclidean_space" | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1762 |   shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow>
 | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1763 |     f a\<bullet>k \<le> y \<Longrightarrow> y \<le> f b\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
 | 
| 68031 | 1764 | by (rule ivt_increasing_component_on_1) (auto simp: continuous_at_imp_continuous_on) | 
| 53348 | 1765 | |
| 1766 | lemma ivt_decreasing_component_on_1: | |
| 1767 | fixes f :: "real \<Rightarrow> 'a::euclidean_space" | |
| 1768 | assumes "a \<le> b" | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1769 |     and "continuous_on {a..b} f"
 | 
| 53348 | 1770 | and "(f b)\<bullet>k \<le> y" | 
| 1771 | and "y \<le> (f a)\<bullet>k" | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1772 |   shows "\<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
 | 
| 72356 | 1773 | using ivt_increasing_component_on_1[of a b "\<lambda>x. - f x" k "- y"] neg_equal_iff_equal | 
| 1774 | using assms continuous_on_minus by force | |
| 53348 | 1775 | |
| 1776 | lemma ivt_decreasing_component_1: | |
| 1777 | fixes f :: "real \<Rightarrow> 'a::euclidean_space" | |
| 61518 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1778 |   shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow>
 | 
| 
ff12606337e9
new lemmas about topology, etc., for Cauchy integral formula
 paulson parents: 
61426diff
changeset | 1779 |     f b\<bullet>k \<le> y \<Longrightarrow> y \<le> f a\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y"
 | 
| 53348 | 1780 | by (rule ivt_decreasing_component_on_1) (auto simp: continuous_at_imp_continuous_on) | 
| 1781 | ||
| 33175 | 1782 | |
| 70136 | 1783 | subsection\<^marker>\<open>tag unimportant\<close> \<open>A bound within an interval\<close> | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1784 | |
| 56188 | 1785 | lemma convex_hull_eq_real_cbox: | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1786 | fixes x y :: real assumes "x \<le> y" | 
| 56188 | 1787 |   shows "convex hull {x, y} = cbox x y"
 | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1788 | proof (rule hull_unique) | 
| 60420 | 1789 |   show "{x, y} \<subseteq> cbox x y" using \<open>x \<le> y\<close> by auto
 | 
| 56188 | 1790 | show "convex (cbox x y)" | 
| 1791 | by (rule convex_box) | |
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1792 | next | 
| 68058 | 1793 |   fix S assume "{x, y} \<subseteq> S" and "convex S"
 | 
| 1794 | then show "cbox x y \<subseteq> S" | |
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1795 | unfolding is_interval_convex_1 [symmetric] is_interval_def Basis_real_def | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1796 | by - (clarify, simp (no_asm_use), fast) | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1797 | qed | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1798 | |
| 33175 | 1799 | lemma unit_interval_convex_hull: | 
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
57418diff
changeset | 1800 |   "cbox (0::'a::euclidean_space) One = convex hull {x. \<forall>i\<in>Basis. (x\<bullet>i = 0) \<or> (x\<bullet>i = 1)}"
 | 
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36844diff
changeset | 1801 | (is "?int = convex hull ?points") | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1802 | proof - | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1803 | have One[simp]: "\<And>i. i \<in> Basis \<Longrightarrow> One \<bullet> i = 1" | 
| 64267 | 1804 | by (simp add: inner_sum_left sum.If_cases inner_Basis) | 
| 56188 | 1805 |   have "?int = {x. \<forall>i\<in>Basis. x \<bullet> i \<in> cbox 0 1}"
 | 
| 1806 | by (auto simp: cbox_def) | |
| 1807 | also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` cbox 0 1)" | |
| 64267 | 1808 | by (simp only: box_eq_set_sum_Basis) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1809 |   also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` (convex hull {0, 1}))"
 | 
| 56188 | 1810 | by (simp only: convex_hull_eq_real_cbox zero_le_one) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1811 |   also have "\<dots> = (\<Sum>i\<in>Basis. convex hull ((\<lambda>x. x *\<^sub>R i) ` {0, 1}))"
 | 
| 68072 
493b818e8e10
added Johannes' generalizations Modules.thy and Vector_Spaces.thy; adapted HOL and HOL-Analysis accordingly
 immler parents: 
67982diff
changeset | 1812 | by (simp add: convex_hull_linear_image) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1813 |   also have "\<dots> = convex hull (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` {0, 1})"
 | 
| 64267 | 1814 | by (simp only: convex_hull_set_sum) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1815 |   also have "\<dots> = convex hull {x. \<forall>i\<in>Basis. x\<bullet>i \<in> {0, 1}}"
 | 
| 64267 | 1816 | by (simp only: box_eq_set_sum_Basis) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1817 |   also have "convex hull {x. \<forall>i\<in>Basis. x\<bullet>i \<in> {0, 1}} = convex hull ?points"
 | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1818 | by simp | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 1819 | finally show ?thesis . | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1820 | qed | 
| 33175 | 1821 | |
| 60420 | 1822 | text \<open>And this is a finite set of vertices.\<close> | 
| 33175 | 1823 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 1824 | lemma unit_cube_convex_hull: | 
| 68058 | 1825 | obtains S :: "'a::euclidean_space set" | 
| 1826 | where "finite S" and "cbox 0 (\<Sum>Basis) = convex hull S" | |
| 1827 | proof | |
| 1828 |   show "finite {x::'a. \<forall>i\<in>Basis. x \<bullet> i = 0 \<or> x \<bullet> i = 1}"
 | |
| 1829 | proof (rule finite_subset, clarify) | |
| 1830 | show "finite ((\<lambda>S. \<Sum>i\<in>Basis. (if i \<in> S then 1 else 0) *\<^sub>R i) ` Pow Basis)" | |
| 1831 | using finite_Basis by blast | |
| 1832 | fix x :: 'a | |
| 72356 | 1833 | assume x: "\<forall>i\<in>Basis. x \<bullet> i = 0 \<or> x \<bullet> i = 1" | 
| 68058 | 1834 | show "x \<in> (\<lambda>S. \<Sum>i\<in>Basis. (if i\<in>S then 1 else 0) *\<^sub>R i) ` Pow Basis" | 
| 72356 | 1835 |       apply (rule image_eqI[where x="{i. i \<in> Basis \<and> x\<bullet>i = 1}"])
 | 
| 1836 | using x | |
| 1837 | by (subst euclidean_eq_iff, auto) | |
| 68058 | 1838 | qed | 
| 1839 |   show "cbox 0 One = convex hull {x. \<forall>i\<in>Basis. x \<bullet> i = 0 \<or> x \<bullet> i = 1}"
 | |
| 1840 | using unit_interval_convex_hull by blast | |
| 1841 | qed | |
| 33175 | 1842 | |
| 60420 | 1843 | text \<open>Hence any cube (could do any nonempty interval).\<close> | 
| 33175 | 1844 | |
| 1845 | lemma cube_convex_hull: | |
| 53348 | 1846 | assumes "d > 0" | 
| 68058 | 1847 | obtains S :: "'a::euclidean_space set" where | 
| 1848 | "finite S" and "cbox (x - (\<Sum>i\<in>Basis. d*\<^sub>Ri)) (x + (\<Sum>i\<in>Basis. d*\<^sub>Ri)) = convex hull S" | |
| 53348 | 1849 | proof - | 
| 68058 | 1850 | let ?d = "(\<Sum>i\<in>Basis. d *\<^sub>R i)::'a" | 
| 56188 | 1851 | have *: "cbox (x - ?d) (x + ?d) = (\<lambda>y. x - ?d + (2 * d) *\<^sub>R y) ` cbox 0 (\<Sum>Basis)" | 
| 68058 | 1852 | proof (intro set_eqI iffI) | 
| 53348 | 1853 | fix y | 
| 68058 | 1854 | assume "y \<in> cbox (x - ?d) (x + ?d)" | 
| 56188 | 1855 | then have "inverse (2 * d) *\<^sub>R (y - (x - ?d)) \<in> cbox 0 (\<Sum>Basis)" | 
| 70802 
160eaf566bcb
formally augmented corresponding rules for field_simps
 haftmann parents: 
70136diff
changeset | 1856 | using assms by (simp add: mem_box inner_simps) (simp add: field_simps) | 
| 69064 
5840724b1d71
Prefix form of infix with * on either side no longer needs special treatment
 nipkow parents: 
68607diff
changeset | 1857 | with \<open>0 < d\<close> show "y \<in> (\<lambda>y. x - sum ((*\<^sub>R) d) Basis + (2 * d) *\<^sub>R y) ` cbox 0 One" | 
| 68058 | 1858 | by (auto intro: image_eqI[where x= "inverse (2 * d) *\<^sub>R (y - (x - ?d))"]) | 
| 33175 | 1859 | next | 
| 68058 | 1860 | fix y | 
| 1861 | assume "y \<in> (\<lambda>y. x - ?d + (2 * d) *\<^sub>R y) ` cbox 0 One" | |
| 1862 | then obtain z where z: "z \<in> cbox 0 One" "y = x - ?d + (2*d) *\<^sub>R z" | |
| 68031 | 1863 | by auto | 
| 56188 | 1864 | then show "y \<in> cbox (x - ?d) (x + ?d)" | 
| 68058 | 1865 | using z assms by (auto simp: mem_box inner_simps) | 
| 53348 | 1866 | qed | 
| 68058 | 1867 | obtain S where "finite S" "cbox 0 (\<Sum>Basis::'a) = convex hull S" | 
| 53348 | 1868 | using unit_cube_convex_hull by auto | 
| 1869 | then show ?thesis | |
| 68058 | 1870 | by (rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` S"]) (auto simp: convex_hull_affinity *) | 
| 53348 | 1871 | qed | 
| 1872 | ||
| 70136 | 1873 | subsection\<^marker>\<open>tag unimportant\<close>\<open>Representation of any interval as a finite convex hull\<close> | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1874 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1875 | lemma image_stretch_interval: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1876 | "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) = | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1877 |   (if (cbox a b) = {} then {} else
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1878 | cbox (\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k::'a) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1879 | (\<Sum>k\<in>Basis. (max (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k))" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1880 | proof cases | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1881 |   assume *: "cbox a b \<noteq> {}"
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1882 | show ?thesis | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1883 | unfolding box_ne_empty if_not_P[OF *] | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1884 | apply (simp add: cbox_def image_Collect set_eq_iff euclidean_eq_iff[where 'a='a] ball_conj_distrib[symmetric]) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1885 | apply (subst choice_Basis_iff[symmetric]) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1886 | proof (intro allI ball_cong refl) | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1887 | fix x i :: 'a assume "i \<in> Basis" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1888 | with * have a_le_b: "a \<bullet> i \<le> b \<bullet> i" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1889 | unfolding box_ne_empty by auto | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1890 | show "(\<exists>xa. x \<bullet> i = m i * xa \<and> a \<bullet> i \<le> xa \<and> xa \<le> b \<bullet> i) \<longleftrightarrow> | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1891 | min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) \<le> x \<bullet> i \<and> x \<bullet> i \<le> max (m i * (a \<bullet> i)) (m i * (b \<bullet> i))" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1892 | proof (cases "m i = 0") | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1893 | case True | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1894 | with a_le_b show ?thesis by auto | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1895 | next | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1896 | case False | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1897 | then have *: "\<And>a b. a = m i * b \<longleftrightarrow> b = a / m i" | 
| 68031 | 1898 | by (auto simp: field_simps) | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1899 | from False have | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1900 | "min (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (a \<bullet> i) else m i * (b \<bullet> i))" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1901 | "max (m i * (a \<bullet> i)) (m i * (b \<bullet> i)) = (if 0 < m i then m i * (b \<bullet> i) else m i * (a \<bullet> i))" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1902 | using a_le_b by (auto simp: min_def max_def mult_le_cancel_left) | 
| 71938 | 1903 | with False show ?thesis using a_le_b * | 
| 1904 | by (simp add: le_divide_eq divide_le_eq) (simp add: ac_simps) | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1905 | qed | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1906 | qed | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1907 | qed simp | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1908 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1909 | lemma interval_image_stretch_interval: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1910 | "\<exists>u v. (\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k))*\<^sub>R k) ` cbox a (b::'a::euclidean_space) = cbox u (v::'a::euclidean_space)" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1911 | unfolding image_stretch_interval by auto | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1912 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1913 | lemma cbox_translation: "cbox (c + a) (c + b) = image (\<lambda>x. c + x) (cbox a b)" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1914 | using image_affinity_cbox [of 1 c a b] | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1915 | using box_ne_empty [of "a+c" "b+c"] box_ne_empty [of a b] | 
| 68031 | 1916 | by (auto simp: inner_left_distrib add.commute) | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1917 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1918 | lemma cbox_image_unit_interval: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1919 | fixes a :: "'a::euclidean_space" | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1920 |   assumes "cbox a b \<noteq> {}"
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1921 | shows "cbox a b = | 
| 67399 | 1922 | (+) a ` (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k) ` cbox 0 One" | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1923 | using assms | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1924 | apply (simp add: box_ne_empty image_stretch_interval cbox_translation [symmetric]) | 
| 64267 | 1925 | apply (simp add: min_def max_def algebra_simps sum_subtractf euclidean_representation) | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1926 | done | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1927 | |
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1928 | lemma closed_interval_as_convex_hull: | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1929 | fixes a :: "'a::euclidean_space" | 
| 68058 | 1930 | obtains S where "finite S" "cbox a b = convex hull S" | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1931 | proof (cases "cbox a b = {}")
 | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1932 | case True with convex_hull_empty that show ?thesis | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1933 | by blast | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1934 | next | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1935 | case False | 
| 68058 | 1936 | obtain S::"'a set" where "finite S" and eq: "cbox 0 One = convex hull S" | 
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1937 | by (blast intro: unit_cube_convex_hull) | 
| 72356 | 1938 | let ?S = "((+) a ` (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k) ` S)" | 
| 1939 | show thesis | |
| 1940 | proof | |
| 1941 | show "finite ?S" | |
| 1942 | by (simp add: \<open>finite S\<close>) | |
| 1943 | have lin: "linear (\<lambda>x. \<Sum>k\<in>Basis. ((b \<bullet> k - a \<bullet> k) * (x \<bullet> k)) *\<^sub>R k)" | |
| 1944 | by (rule linear_compose_sum) (auto simp: algebra_simps linearI) | |
| 1945 | show "cbox a b = convex hull ?S" | |
| 1946 | using convex_hull_linear_image [OF lin] | |
| 1947 | by (simp add: convex_hull_translation eq cbox_image_unit_interval [OF False]) | |
| 1948 | qed | |
| 63007 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1949 | qed | 
| 
aa894a49f77d
new theorems about convex hulls, etc.; also, renamed some theorems
 paulson <lp15@cam.ac.uk> parents: 
62950diff
changeset | 1950 | |
| 33175 | 1951 | |
| 70136 | 1952 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Bounded convex function on open set is continuous\<close> | 
| 33175 | 1953 | |
| 1954 | lemma convex_on_bounded_continuous: | |
| 68058 | 1955 |   fixes S :: "('a::real_normed_vector) set"
 | 
| 1956 | assumes "open S" | |
| 1957 | and "convex_on S f" | |
| 1958 | and "\<forall>x\<in>S. \<bar>f x\<bar> \<le> b" | |
| 1959 | shows "continuous_on S f" | |
| 72356 | 1960 | proof - | 
| 1961 | have "\<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e" if "x \<in> S" "e > 0" for x and e :: real | |
| 1962 | proof - | |
| 1963 | define B where "B = \<bar>b\<bar> + 1" | |
| 1964 | then have B: "0 < B""\<And>x. x\<in>S \<Longrightarrow> \<bar>f x\<bar> \<le> B" | |
| 1965 | using assms(3) by auto | |
| 1966 | obtain k where "k > 0" and k: "cball x k \<subseteq> S" | |
| 1967 | using \<open>x \<in> S\<close> assms(1) open_contains_cball_eq by blast | |
| 1968 | show "\<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e" | |
| 1969 | proof (intro exI conjI allI impI) | |
| 1970 | fix y | |
| 1971 | assume as: "norm (y - x) < min (k / 2) (e / (2 * B) * k)" | |
| 1972 | show "\<bar>f y - f x\<bar> < e" | |
| 1973 | proof (cases "y = x") | |
| 1974 | case False | |
| 1975 | define t where "t = k / norm (y - x)" | |
| 1976 | have "2 < t" "0<t" | |
| 1977 | unfolding t_def using as False and \<open>k>0\<close> | |
| 68031 | 1978 | by (auto simp:field_simps) | 
| 72356 | 1979 | have "y \<in> S" | 
| 1980 | apply (rule k[THEN subsetD]) | |
| 1981 | unfolding mem_cball dist_norm | |
| 1982 | apply (rule order_trans[of _ "2 * norm (x - y)"]) | |
| 1983 | using as | |
| 1984 | by (auto simp: field_simps norm_minus_commute) | |
| 1985 |         {
 | |
| 1986 | define w where "w = x + t *\<^sub>R (y - x)" | |
| 1987 | have "w \<in> S" | |
| 1988 | using \<open>k>0\<close> by (auto simp: dist_norm t_def w_def k[THEN subsetD]) | |
| 1989 | have "(1 / t) *\<^sub>R x + - x + ((t - 1) / t) *\<^sub>R x = (1 / t - 1 + (t - 1) / t) *\<^sub>R x" | |
| 1990 | by (auto simp: algebra_simps) | |
| 1991 | also have "\<dots> = 0" | |
| 1992 | using \<open>t > 0\<close> by (auto simp:field_simps) | |
| 1993 | finally have w: "(1 / t) *\<^sub>R w + ((t - 1) / t) *\<^sub>R x = y" | |
| 1994 | unfolding w_def using False and \<open>t > 0\<close> | |
| 1995 | by (auto simp: algebra_simps) | |
| 1996 | have 2: "2 * B < e * t" | |
| 1997 | unfolding t_def using \<open>0 < e\<close> \<open>0 < k\<close> \<open>B > 0\<close> and as and False | |
| 1998 | by (auto simp:field_simps) | |
| 1999 | have "f y - f x \<le> (f w - f x) / t" | |
| 2000 | using assms(2)[unfolded convex_on_def,rule_format,of w x "1/t" "(t - 1)/t", unfolded w] | |
| 2001 | using \<open>0 < t\<close> \<open>2 < t\<close> and \<open>x \<in> S\<close> \<open>w \<in> S\<close> | |
| 2002 | by (auto simp:field_simps) | |
| 2003 | also have "... < e" | |
| 2004 | using B(2)[OF \<open>w\<in>S\<close>] and B(2)[OF \<open>x\<in>S\<close>] 2 \<open>t > 0\<close> by (auto simp: field_simps) | |
| 2005 | finally have th1: "f y - f x < e" . | |
| 2006 | } | |
| 2007 | moreover | |
| 2008 |         {
 | |
| 2009 | define w where "w = x - t *\<^sub>R (y - x)" | |
| 2010 | have "w \<in> S" | |
| 2011 | using \<open>k > 0\<close> by (auto simp: dist_norm t_def w_def k[THEN subsetD]) | |
| 2012 | have "(1 / (1 + t)) *\<^sub>R x + (t / (1 + t)) *\<^sub>R x = (1 / (1 + t) + t / (1 + t)) *\<^sub>R x" | |
| 2013 | by (auto simp: algebra_simps) | |
| 2014 | also have "\<dots> = x" | |
| 2015 | using \<open>t > 0\<close> by (auto simp:field_simps) | |
| 2016 | finally have w: "(1 / (1+t)) *\<^sub>R w + (t / (1 + t)) *\<^sub>R y = x" | |
| 2017 | unfolding w_def using False and \<open>t > 0\<close> | |
| 2018 | by (auto simp: algebra_simps) | |
| 2019 | have "2 * B < e * t" | |
| 2020 | unfolding t_def | |
| 2021 | using \<open>0 < e\<close> \<open>0 < k\<close> \<open>B > 0\<close> and as and False | |
| 2022 | by (auto simp:field_simps) | |
| 2023 | then have *: "(f w - f y) / t < e" | |
| 2024 | using B(2)[OF \<open>w\<in>S\<close>] and B(2)[OF \<open>y\<in>S\<close>] | |
| 2025 | using \<open>t > 0\<close> | |
| 2026 | by (auto simp:field_simps) | |
| 2027 | have "f x \<le> 1 / (1 + t) * f w + (t / (1 + t)) * f y" | |
| 2028 | using assms(2)[unfolded convex_on_def,rule_format,of w y "1/(1+t)" "t / (1+t)",unfolded w] | |
| 2029 | using \<open>0 < t\<close> \<open>2 < t\<close> and \<open>y \<in> S\<close> \<open>w \<in> S\<close> | |
| 2030 | by (auto simp:field_simps) | |
| 2031 | also have "\<dots> = (f w + t * f y) / (1 + t)" | |
| 2032 | using \<open>t > 0\<close> by (simp add: add_divide_distrib) | |
| 2033 | also have "\<dots> < e + f y" | |
| 2034 | using \<open>t > 0\<close> * \<open>e > 0\<close> by (auto simp: field_simps) | |
| 2035 | finally have "f x - f y < e" by auto | |
| 2036 | } | |
| 2037 | ultimately show ?thesis by auto | |
| 2038 | qed (use \<open>0<e\<close> in auto) | |
| 2039 | qed (use \<open>0<e\<close> \<open>0<k\<close> \<open>0<B\<close> in \<open>auto simp: field_simps\<close>) | |
| 2040 | qed | |
| 2041 | then show ?thesis | |
| 2042 | by (metis continuous_on_iff dist_norm real_norm_def) | |
| 60420 | 2043 | qed | 
| 2044 | ||
| 70136 | 2045 | subsection\<^marker>\<open>tag unimportant\<close> \<open>Upper bound on a ball implies upper and lower bounds\<close> | 
| 33175 | 2046 | |
| 2047 | lemma convex_bounds_lemma: | |
| 36338 | 2048 | fixes x :: "'a::real_normed_vector" | 
| 53348 | 2049 | assumes "convex_on (cball x e) f" | 
| 72356 | 2050 | and "\<forall>y \<in> cball x e. f y \<le> b" and y: "y \<in> cball x e" | 
| 2051 | shows "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" | |
| 53348 | 2052 | proof (cases "0 \<le> e") | 
| 2053 | case True | |
| 63040 | 2054 | define z where "z = 2 *\<^sub>R x - y" | 
| 53348 | 2055 | have *: "x - (2 *\<^sub>R x - y) = y - x" | 
| 2056 | by (simp add: scaleR_2) | |
| 2057 | have z: "z \<in> cball x e" | |
| 68031 | 2058 | using y unfolding z_def mem_cball dist_norm * by (auto simp: norm_minus_commute) | 
| 53348 | 2059 | have "(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x" | 
| 68031 | 2060 | unfolding z_def by (auto simp: algebra_simps) | 
| 53348 | 2061 | then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" | 
| 2062 | using assms(1)[unfolded convex_on_def,rule_format, OF y z, of "1/2" "1/2"] | |
| 2063 | using assms(2)[rule_format,OF y] assms(2)[rule_format,OF z] | |
| 68031 | 2064 | by (auto simp:field_simps) | 
| 53348 | 2065 | next | 
| 2066 | case False | |
| 72356 | 2067 | have "dist x y < 0" | 
| 2068 | using False y unfolding mem_cball not_le by (auto simp del: dist_not_less_zero) | |
| 53348 | 2069 | then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" | 
| 2070 | using zero_le_dist[of x y] by auto | |
| 2071 | qed | |
| 2072 | ||
| 33175 | 2073 | |
| 70136 | 2074 | subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Hence a convex function on an open set is continuous\<close> | 
| 33175 | 2075 | |
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 2076 | lemma real_of_nat_ge_one_iff: "1 \<le> real (n::nat) \<longleftrightarrow> 1 \<le> n" | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 2077 | by auto | 
| 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 2078 | |
| 33175 | 2079 | lemma convex_on_continuous: | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2080 |   assumes "open (s::('a::euclidean_space) set)" "convex_on s f"
 | 
| 33175 | 2081 | shows "continuous_on s f" | 
| 53348 | 2082 | unfolding continuous_on_eq_continuous_at[OF assms(1)] | 
| 2083 | proof | |
| 37489 
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
 hoelzl parents: 
36844diff
changeset | 2084 | note dimge1 = DIM_positive[where 'a='a] | 
| 53348 | 2085 | fix x | 
| 2086 | assume "x \<in> s" | |
| 2087 | then obtain e where e: "cball x e \<subseteq> s" "e > 0" | |
| 2088 | using assms(1) unfolding open_contains_cball by auto | |
| 63040 | 2089 |   define d where "d = e / real DIM('a)"
 | 
| 53348 | 2090 | have "0 < d" | 
| 60420 | 2091 | unfolding d_def using \<open>e > 0\<close> dimge1 by auto | 
| 50526 
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
 hoelzl parents: 
50104diff
changeset | 2092 | let ?d = "(\<Sum>i\<in>Basis. d *\<^sub>R i)::'a" | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2093 | obtain c | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2094 | where c: "finite c" | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2095 | and c1: "convex hull c \<subseteq> cball x e" | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2096 | and c2: "cball x d \<subseteq> convex hull c" | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2097 | proof | 
| 63040 | 2098 |     define c where "c = (\<Sum>i\<in>Basis. (\<lambda>a. a *\<^sub>R i) ` {x\<bullet>i - d, x\<bullet>i + d})"
 | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2099 | show "finite c" | 
| 64267 | 2100 | unfolding c_def by (simp add: finite_set_sum) | 
| 72356 | 2101 |     have "\<And>i. i \<in> Basis \<Longrightarrow> convex hull {x \<bullet> i - d, x \<bullet> i + d} = cbox (x \<bullet> i - d) (x \<bullet> i + d)"
 | 
| 2102 | using \<open>0 < d\<close> convex_hull_eq_real_cbox by auto | |
| 2103 |     then have 1: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cbox (x \<bullet> i - d) (x \<bullet> i + d)}"
 | |
| 2104 | unfolding box_eq_set_sum_Basis c_def convex_hull_set_sum | |
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2105 | apply (subst convex_hull_linear_image [symmetric]) | 
| 72356 | 2106 | by (force simp add: linear_iff scaleR_add_left)+ | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2107 |     then have 2: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cball (x \<bullet> i) d}"
 | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2108 | by (simp add: dist_norm abs_le_iff algebra_simps) | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2109 | show "cball x d \<subseteq> convex hull c" | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2110 | unfolding 2 | 
| 68058 | 2111 | by (clarsimp simp: dist_norm) (metis inner_commute inner_diff_right norm_bound_Basis_le) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2112 | have e': "e = (\<Sum>(i::'a)\<in>Basis. d)" | 
| 71172 | 2113 | by (simp add: d_def) | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2114 | show "convex hull c \<subseteq> cball x e" | 
| 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2115 | unfolding 2 | 
| 72356 | 2116 | proof clarsimp | 
| 2117 | show "dist x y \<le> e" if "\<forall>i\<in>Basis. dist (x \<bullet> i) (y \<bullet> i) \<le> d" for y | |
| 2118 | proof - | |
| 2119 | have "\<And>i. i \<in> Basis \<Longrightarrow> 0 \<le> dist (x \<bullet> i) (y \<bullet> i)" | |
| 2120 | by simp | |
| 2121 | have "(\<Sum>i\<in>Basis. dist (x \<bullet> i) (y \<bullet> i)) \<le> e" | |
| 2122 | using e' sum_mono that by fastforce | |
| 2123 | then show ?thesis | |
| 2124 | by (metis (mono_tags) euclidean_dist_l2 order_trans [OF L2_set_le_sum] zero_le_dist) | |
| 2125 | qed | |
| 2126 | qed | |
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2127 | qed | 
| 63040 | 2128 | define k where "k = Max (f ` c)" | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2129 | have "convex_on (convex hull c) f" | 
| 72356 | 2130 | using assms(2) c1 convex_on_subset e(1) by blast | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2131 | then have k: "\<forall>y\<in>convex hull c. f y \<le> k" | 
| 72356 | 2132 | using c convex_on_convex_hull_bound k_def by fastforce | 
| 68048 | 2133 |   have "e \<le> e * real DIM('a)"
 | 
| 2134 | using e(2) real_of_nat_ge_one_iff by auto | |
| 2135 | then have "d \<le> e" | |
| 70817 
dd675800469d
dedicated fact collections for algebraic simplification rules potentially splitting goals
 haftmann parents: 
70802diff
changeset | 2136 | by (simp add: d_def field_split_simps) | 
| 53348 | 2137 | then have dsube: "cball x d \<subseteq> cball x e" | 
| 53620 
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
 huffman parents: 
53600diff
changeset | 2138 | by (rule subset_cball) | 
| 53348 | 2139 | have conv: "convex_on (cball x d) f" | 
| 68031 | 2140 | using \<open>convex_on (convex hull c) f\<close> c2 convex_on_subset by blast | 
| 72356 | 2141 | then have "\<And>y. y\<in>cball x d \<Longrightarrow> \<bar>f y\<bar> \<le> k + 2 * \<bar>f x\<bar>" | 
| 68048 | 2142 | by (rule convex_bounds_lemma) (use c2 k in blast) | 
| 53348 | 2143 | then have "continuous_on (ball x d) f" | 
| 72356 | 2144 | by (meson Elementary_Metric_Spaces.open_ball ball_subset_cball conv convex_on_bounded_continuous | 
| 2145 | convex_on_subset mem_ball_imp_mem_cball) | |
| 53348 | 2146 | then show "continuous (at x) f" | 
| 2147 | unfolding continuous_on_eq_continuous_at[OF open_ball] | |
| 60420 | 2148 | using \<open>d > 0\<close> by auto | 
| 2149 | qed | |
| 2150 | ||
| 33175 | 2151 | end |