author | blanchet |
Fri, 01 Aug 2014 14:43:57 +0200 | |
changeset 57743 | 0af2d5dfb0ac |
parent 57512 | cc97b347b301 |
child 57865 | dcfb33c26f50 |
permissions | -rw-r--r-- |
41959 | 1 |
(* Title: HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy |
33175 | 2 |
Author: Robert Himmelmann, TU Muenchen |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
3 |
Author: Bogdan Grechuk, University of Edinburgh |
33175 | 4 |
*) |
5 |
||
6 |
header {* Convex sets, functions and related things. *} |
|
7 |
||
8 |
theory Convex_Euclidean_Space |
|
44132 | 9 |
imports |
56189
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
immler
parents:
56188
diff
changeset
|
10 |
Topology_Euclidean_Space |
44132 | 11 |
"~~/src/HOL/Library/Convex" |
12 |
"~~/src/HOL/Library/Set_Algebras" |
|
33175 | 13 |
begin |
14 |
||
15 |
||
16 |
(* ------------------------------------------------------------------------- *) |
|
17 |
(* To be moved elsewhere *) |
|
18 |
(* ------------------------------------------------------------------------- *) |
|
19 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
20 |
lemma linear_scaleR: "linear (\<lambda>x. scaleR c x)" |
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
21 |
by (simp add: linear_iff scaleR_add_right) |
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
22 |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
23 |
lemma linear_scaleR_left: "linear (\<lambda>r. scaleR r x)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
24 |
by (simp add: linear_iff scaleR_add_left) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
25 |
|
53339 | 26 |
lemma injective_scaleR: "c \<noteq> 0 \<Longrightarrow> inj (\<lambda>x::'a::real_vector. scaleR c x)" |
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
27 |
by (simp add: inj_on_def) |
40377 | 28 |
|
29 |
lemma linear_add_cmul: |
|
49529 | 30 |
assumes "linear f" |
53339 | 31 |
shows "f (a *\<^sub>R x + b *\<^sub>R y) = a *\<^sub>R f x + b *\<^sub>R f y" |
49529 | 32 |
using linear_add[of f] linear_cmul[of f] assms by simp |
40377 | 33 |
|
34 |
lemma mem_convex_alt: |
|
53406 | 35 |
assumes "convex S" "x \<in> S" "y \<in> S" "u \<ge> 0" "v \<ge> 0" "u + v > 0" |
36 |
shows "((u/(u+v)) *\<^sub>R x + (v/(u+v)) *\<^sub>R y) \<in> S" |
|
53676 | 37 |
apply (rule convexD) |
53302 | 38 |
using assms |
53676 | 39 |
apply (simp_all add: zero_le_divide_iff add_divide_distrib [symmetric]) |
49529 | 40 |
done |
40377 | 41 |
|
53302 | 42 |
lemma inj_on_image_mem_iff: "inj_on f B \<Longrightarrow> A \<subseteq> B \<Longrightarrow> f a \<in> f`A \<Longrightarrow> a \<in> B \<Longrightarrow> a \<in> A" |
49529 | 43 |
by (blast dest: inj_onD) |
40377 | 44 |
|
45 |
lemma independent_injective_on_span_image: |
|
49531 | 46 |
assumes iS: "independent S" |
53302 | 47 |
and lf: "linear f" |
48 |
and fi: "inj_on f (span S)" |
|
40377 | 49 |
shows "independent (f ` S)" |
49529 | 50 |
proof - |
51 |
{ |
|
52 |
fix a |
|
53339 | 53 |
assume a: "a \<in> S" "f a \<in> span (f ` S - {f a})" |
49529 | 54 |
have eq: "f ` S - {f a} = f ` (S - {a})" |
55 |
using fi a span_inc by (auto simp add: inj_on_def) |
|
53339 | 56 |
from a have "f a \<in> f ` span (S -{a})" |
57 |
unfolding eq span_linear_image [OF lf, of "S - {a}"] by blast |
|
58 |
moreover have "span (S - {a}) \<subseteq> span S" |
|
59 |
using span_mono[of "S - {a}" S] by auto |
|
60 |
ultimately have "a \<in> span (S - {a})" |
|
53333 | 61 |
using fi a span_inc by (auto simp add: inj_on_def) |
62 |
with a(1) iS have False |
|
63 |
by (simp add: dependent_def) |
|
49529 | 64 |
} |
53333 | 65 |
then show ?thesis |
66 |
unfolding dependent_def by blast |
|
40377 | 67 |
qed |
68 |
||
69 |
lemma dim_image_eq: |
|
53339 | 70 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'm::euclidean_space" |
53333 | 71 |
assumes lf: "linear f" |
72 |
and fi: "inj_on f (span S)" |
|
53406 | 73 |
shows "dim (f ` S) = dim (S::'n::euclidean_space set)" |
74 |
proof - |
|
75 |
obtain B where B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" |
|
49529 | 76 |
using basis_exists[of S] by auto |
77 |
then have "span S = span B" |
|
78 |
using span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
|
79 |
then have "independent (f ` B)" |
|
53406 | 80 |
using independent_injective_on_span_image[of B f] B assms by auto |
49529 | 81 |
moreover have "card (f ` B) = card B" |
53406 | 82 |
using assms card_image[of f B] subset_inj_on[of f "span S" B] B span_inc by auto |
53333 | 83 |
moreover have "(f ` B) \<subseteq> (f ` S)" |
53406 | 84 |
using B by auto |
53302 | 85 |
ultimately have "dim (f ` S) \<ge> dim S" |
53406 | 86 |
using independent_card_le_dim[of "f ` B" "f ` S"] B by auto |
53333 | 87 |
then show ?thesis |
88 |
using dim_image_le[of f S] assms by auto |
|
40377 | 89 |
qed |
90 |
||
91 |
lemma linear_injective_on_subspace_0: |
|
53302 | 92 |
assumes lf: "linear f" |
93 |
and "subspace S" |
|
94 |
shows "inj_on f S \<longleftrightarrow> (\<forall>x \<in> S. f x = 0 \<longrightarrow> x = 0)" |
|
49529 | 95 |
proof - |
53302 | 96 |
have "inj_on f S \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f x = f y \<longrightarrow> x = y)" |
97 |
by (simp add: inj_on_def) |
|
98 |
also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f x - f y = 0 \<longrightarrow> x - y = 0)" |
|
99 |
by simp |
|
100 |
also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. \<forall>y \<in> S. f (x - y) = 0 \<longrightarrow> x - y = 0)" |
|
40377 | 101 |
by (simp add: linear_sub[OF lf]) |
53302 | 102 |
also have "\<dots> \<longleftrightarrow> (\<forall>x \<in> S. f x = 0 \<longrightarrow> x = 0)" |
40377 | 103 |
using `subspace S` subspace_def[of S] subspace_sub[of S] by auto |
104 |
finally show ?thesis . |
|
105 |
qed |
|
106 |
||
53302 | 107 |
lemma subspace_Inter: "\<forall>s \<in> f. subspace s \<Longrightarrow> subspace (Inter f)" |
49531 | 108 |
unfolding subspace_def by auto |
40377 | 109 |
|
53302 | 110 |
lemma span_eq[simp]: "span s = s \<longleftrightarrow> subspace s" |
111 |
unfolding span_def by (rule hull_eq) (rule subspace_Inter) |
|
40377 | 112 |
|
49529 | 113 |
lemma substdbasis_expansion_unique: |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
114 |
assumes d: "d \<subseteq> Basis" |
53302 | 115 |
shows "(\<Sum>i\<in>d. f i *\<^sub>R i) = (x::'a::euclidean_space) \<longleftrightarrow> |
116 |
(\<forall>i\<in>Basis. (i \<in> d \<longrightarrow> f i = x \<bullet> i) \<and> (i \<notin> d \<longrightarrow> x \<bullet> i = 0))" |
|
49529 | 117 |
proof - |
53339 | 118 |
have *: "\<And>x a b P. x * (if P then a else b) = (if P then x * a else x * b)" |
53302 | 119 |
by auto |
120 |
have **: "finite d" |
|
121 |
by (auto intro: finite_subset[OF assms]) |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
122 |
have ***: "\<And>i. i \<in> Basis \<Longrightarrow> (\<Sum>i\<in>d. f i *\<^sub>R i) \<bullet> i = (\<Sum>x\<in>d. if x = i then f x else 0)" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
123 |
using d |
57418 | 124 |
by (auto intro!: setsum.cong simp: inner_Basis inner_setsum_left) |
49529 | 125 |
show ?thesis |
57418 | 126 |
unfolding euclidean_eq_iff[where 'a='a] by (auto simp: setsum.delta[OF **] ***) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
127 |
qed |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
128 |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
129 |
lemma independent_substdbasis: "d \<subseteq> Basis \<Longrightarrow> independent d" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
130 |
by (rule independent_mono[OF independent_Basis]) |
40377 | 131 |
|
49531 | 132 |
lemma dim_cball: |
53302 | 133 |
assumes "e > 0" |
49529 | 134 |
shows "dim (cball (0 :: 'n::euclidean_space) e) = DIM('n)" |
135 |
proof - |
|
53302 | 136 |
{ |
137 |
fix x :: "'n::euclidean_space" |
|
138 |
def y \<equiv> "(e / norm x) *\<^sub>R x" |
|
53339 | 139 |
then have "y \<in> cball 0 e" |
53302 | 140 |
using cball_def dist_norm[of 0 y] assms by auto |
53339 | 141 |
moreover have *: "x = (norm x / e) *\<^sub>R y" |
53302 | 142 |
using y_def assms by simp |
143 |
moreover from * have "x = (norm x/e) *\<^sub>R y" |
|
144 |
by auto |
|
53339 | 145 |
ultimately have "x \<in> span (cball 0 e)" |
49529 | 146 |
using span_mul[of y "cball 0 e" "norm x/e"] span_inc[of "cball 0 e"] by auto |
53302 | 147 |
} |
53339 | 148 |
then have "span (cball 0 e) = (UNIV :: 'n::euclidean_space set)" |
53302 | 149 |
by auto |
49529 | 150 |
then show ?thesis |
151 |
using dim_span[of "cball (0 :: 'n::euclidean_space) e"] by (auto simp add: dim_UNIV) |
|
40377 | 152 |
qed |
153 |
||
154 |
lemma indep_card_eq_dim_span: |
|
53339 | 155 |
fixes B :: "'n::euclidean_space set" |
49529 | 156 |
assumes "independent B" |
53339 | 157 |
shows "finite B \<and> card B = dim (span B)" |
40377 | 158 |
using assms basis_card_eq_dim[of B "span B"] span_inc by auto |
159 |
||
53339 | 160 |
lemma setsum_not_0: "setsum f A \<noteq> 0 \<Longrightarrow> \<exists>a \<in> A. f a \<noteq> 0" |
49529 | 161 |
by (rule ccontr) auto |
40377 | 162 |
|
49531 | 163 |
lemma translate_inj_on: |
53339 | 164 |
fixes A :: "'a::ab_group_add set" |
165 |
shows "inj_on (\<lambda>x. a + x) A" |
|
49529 | 166 |
unfolding inj_on_def by auto |
40377 | 167 |
|
168 |
lemma translation_assoc: |
|
169 |
fixes a b :: "'a::ab_group_add" |
|
53339 | 170 |
shows "(\<lambda>x. b + x) ` ((\<lambda>x. a + x) ` S) = (\<lambda>x. (a + b) + x) ` S" |
49529 | 171 |
by auto |
40377 | 172 |
|
173 |
lemma translation_invert: |
|
174 |
fixes a :: "'a::ab_group_add" |
|
53339 | 175 |
assumes "(\<lambda>x. a + x) ` A = (\<lambda>x. a + x) ` B" |
49529 | 176 |
shows "A = B" |
177 |
proof - |
|
53339 | 178 |
have "(\<lambda>x. -a + x) ` ((\<lambda>x. a + x) ` A) = (\<lambda>x. - a + x) ` ((\<lambda>x. a + x) ` B)" |
49529 | 179 |
using assms by auto |
180 |
then show ?thesis |
|
181 |
using translation_assoc[of "-a" a A] translation_assoc[of "-a" a B] by auto |
|
40377 | 182 |
qed |
183 |
||
184 |
lemma translation_galois: |
|
185 |
fixes a :: "'a::ab_group_add" |
|
53339 | 186 |
shows "T = ((\<lambda>x. a + x) ` S) \<longleftrightarrow> S = ((\<lambda>x. (- a) + x) ` T)" |
53333 | 187 |
using translation_assoc[of "-a" a S] |
188 |
apply auto |
|
189 |
using translation_assoc[of a "-a" T] |
|
190 |
apply auto |
|
49529 | 191 |
done |
40377 | 192 |
|
193 |
lemma translation_inverse_subset: |
|
53339 | 194 |
assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)" |
195 |
shows "V \<le> ((\<lambda>x. a + x) ` S)" |
|
49529 | 196 |
proof - |
53333 | 197 |
{ |
198 |
fix x |
|
199 |
assume "x \<in> V" |
|
200 |
then have "x-a \<in> S" using assms by auto |
|
201 |
then have "x \<in> {a + v |v. v \<in> S}" |
|
49529 | 202 |
apply auto |
203 |
apply (rule exI[of _ "x-a"]) |
|
204 |
apply simp |
|
205 |
done |
|
53333 | 206 |
then have "x \<in> ((\<lambda>x. a+x) ` S)" by auto |
207 |
} |
|
208 |
then show ?thesis by auto |
|
40377 | 209 |
qed |
210 |
||
211 |
lemma basis_to_basis_subspace_isomorphism: |
|
212 |
assumes s: "subspace (S:: ('n::euclidean_space) set)" |
|
49529 | 213 |
and t: "subspace (T :: ('m::euclidean_space) set)" |
214 |
and d: "dim S = dim T" |
|
53333 | 215 |
and B: "B \<subseteq> S" "independent B" "S \<subseteq> span B" "card B = dim S" |
216 |
and C: "C \<subseteq> T" "independent C" "T \<subseteq> span C" "card C = dim T" |
|
217 |
shows "\<exists>f. linear f \<and> f ` B = C \<and> f ` S = T \<and> inj_on f S" |
|
49529 | 218 |
proof - |
53333 | 219 |
from B independent_bound have fB: "finite B" |
220 |
by blast |
|
221 |
from C independent_bound have fC: "finite C" |
|
222 |
by blast |
|
40377 | 223 |
from B(4) C(4) card_le_inj[of B C] d obtain f where |
224 |
f: "f ` B \<subseteq> C" "inj_on f B" using `finite B` `finite C` by auto |
|
225 |
from linear_independent_extend[OF B(2)] obtain g where |
|
53333 | 226 |
g: "linear g" "\<forall>x \<in> B. g x = f x" by blast |
40377 | 227 |
from inj_on_iff_eq_card[OF fB, of f] f(2) |
228 |
have "card (f ` B) = card B" by simp |
|
229 |
with B(4) C(4) have ceq: "card (f ` B) = card C" using d |
|
230 |
by simp |
|
231 |
have "g ` B = f ` B" using g(2) |
|
232 |
by (auto simp add: image_iff) |
|
233 |
also have "\<dots> = C" using card_subset_eq[OF fC f(1) ceq] . |
|
234 |
finally have gBC: "g ` B = C" . |
|
235 |
have gi: "inj_on g B" using f(2) g(2) |
|
236 |
by (auto simp add: inj_on_def) |
|
237 |
note g0 = linear_indep_image_lemma[OF g(1) fB, unfolded gBC, OF C(2) gi] |
|
53333 | 238 |
{ |
239 |
fix x y |
|
49529 | 240 |
assume x: "x \<in> S" and y: "y \<in> S" and gxy: "g x = g y" |
53333 | 241 |
from B(3) x y have x': "x \<in> span B" and y': "y \<in> span B" |
242 |
by blast+ |
|
243 |
from gxy have th0: "g (x - y) = 0" |
|
244 |
by (simp add: linear_sub[OF g(1)]) |
|
245 |
have th1: "x - y \<in> span B" using x' y' |
|
246 |
by (metis span_sub) |
|
247 |
have "x = y" using g0[OF th1 th0] by simp |
|
248 |
} |
|
249 |
then have giS: "inj_on g S" unfolding inj_on_def by blast |
|
40377 | 250 |
from span_subspace[OF B(1,3) s] |
53333 | 251 |
have "g ` S = span (g ` B)" |
252 |
by (simp add: span_linear_image[OF g(1)]) |
|
253 |
also have "\<dots> = span C" |
|
254 |
unfolding gBC .. |
|
255 |
also have "\<dots> = T" |
|
256 |
using span_subspace[OF C(1,3) t] . |
|
40377 | 257 |
finally have gS: "g ` S = T" . |
53333 | 258 |
from g(1) gS giS gBC show ?thesis |
259 |
by blast |
|
40377 | 260 |
qed |
261 |
||
44524 | 262 |
lemma closure_bounded_linear_image: |
263 |
assumes f: "bounded_linear f" |
|
53333 | 264 |
shows "f ` closure S \<subseteq> closure (f ` S)" |
44524 | 265 |
using linear_continuous_on [OF f] closed_closure closure_subset |
266 |
by (rule image_closure_subset) |
|
267 |
||
40377 | 268 |
lemma closure_linear_image: |
53339 | 269 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::real_normed_vector" |
49529 | 270 |
assumes "linear f" |
53333 | 271 |
shows "f ` (closure S) \<le> closure (f ` S)" |
44524 | 272 |
using assms unfolding linear_conv_bounded_linear |
273 |
by (rule closure_bounded_linear_image) |
|
40377 | 274 |
|
275 |
lemma closure_injective_linear_image: |
|
53339 | 276 |
fixes f :: "'n::euclidean_space \<Rightarrow> 'n::euclidean_space" |
49529 | 277 |
assumes "linear f" "inj f" |
278 |
shows "f ` (closure S) = closure (f ` S)" |
|
279 |
proof - |
|
54465 | 280 |
obtain f' where f': "linear f' \<and> f \<circ> f' = id \<and> f' \<circ> f = id" |
49529 | 281 |
using assms linear_injective_isomorphism[of f] isomorphism_expand by auto |
53333 | 282 |
then have "f' ` closure (f ` S) \<le> closure (S)" |
56154
f0a927235162
more complete set of lemmas wrt. image and composition
haftmann
parents:
55929
diff
changeset
|
283 |
using closure_linear_image[of f' "f ` S"] image_comp[of f' f] by auto |
53339 | 284 |
then have "f ` f' ` closure (f ` S) \<le> f ` closure S" by auto |
285 |
then have "closure (f ` S) \<le> f ` closure S" |
|
56154
f0a927235162
more complete set of lemmas wrt. image and composition
haftmann
parents:
55929
diff
changeset
|
286 |
using image_comp[of f f' "closure (f ` S)"] f' by auto |
49529 | 287 |
then show ?thesis using closure_linear_image[of f S] assms by auto |
40377 | 288 |
qed |
289 |
||
44524 | 290 |
lemma closure_scaleR: |
53339 | 291 |
fixes S :: "'a::real_normed_vector set" |
44524 | 292 |
shows "(op *\<^sub>R c) ` (closure S) = closure ((op *\<^sub>R c) ` S)" |
293 |
proof |
|
294 |
show "(op *\<^sub>R c) ` (closure S) \<subseteq> closure ((op *\<^sub>R c) ` S)" |
|
53333 | 295 |
using bounded_linear_scaleR_right |
296 |
by (rule closure_bounded_linear_image) |
|
44524 | 297 |
show "closure ((op *\<^sub>R c) ` S) \<subseteq> (op *\<^sub>R c) ` (closure S)" |
49529 | 298 |
by (intro closure_minimal image_mono closure_subset closed_scaling closed_closure) |
299 |
qed |
|
300 |
||
301 |
lemma fst_linear: "linear fst" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
302 |
unfolding linear_iff by (simp add: algebra_simps) |
49529 | 303 |
|
304 |
lemma snd_linear: "linear snd" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
305 |
unfolding linear_iff by (simp add: algebra_simps) |
49529 | 306 |
|
54465 | 307 |
lemma fst_snd_linear: "linear (\<lambda>(x,y). x + y)" |
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
308 |
unfolding linear_iff by (simp add: algebra_simps) |
40377 | 309 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
310 |
lemma scaleR_2: |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
311 |
fixes x :: "'a::real_vector" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
312 |
shows "scaleR 2 x = x + x" |
49529 | 313 |
unfolding one_add_one [symmetric] scaleR_left_distrib by simp |
314 |
||
315 |
lemma vector_choose_size: |
|
53333 | 316 |
"0 \<le> c \<Longrightarrow> \<exists>x::'a::euclidean_space. norm x = c" |
317 |
apply (rule exI [where x="c *\<^sub>R (SOME i. i \<in> Basis)"]) |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
318 |
apply (auto simp: SOME_Basis) |
49529 | 319 |
done |
320 |
||
321 |
lemma setsum_delta_notmem: |
|
322 |
assumes "x \<notin> s" |
|
33175 | 323 |
shows "setsum (\<lambda>y. if (y = x) then P x else Q y) s = setsum Q s" |
49529 | 324 |
and "setsum (\<lambda>y. if (x = y) then P x else Q y) s = setsum Q s" |
325 |
and "setsum (\<lambda>y. if (y = x) then P y else Q y) s = setsum Q s" |
|
326 |
and "setsum (\<lambda>y. if (x = y) then P y else Q y) s = setsum Q s" |
|
57418 | 327 |
apply (rule_tac [!] setsum.cong) |
53333 | 328 |
using assms |
329 |
apply auto |
|
49529 | 330 |
done |
33175 | 331 |
|
332 |
lemma setsum_delta'': |
|
49529 | 333 |
fixes s::"'a::real_vector set" |
334 |
assumes "finite s" |
|
33175 | 335 |
shows "(\<Sum>x\<in>s. (if y = x then f x else 0) *\<^sub>R x) = (if y\<in>s then (f y) *\<^sub>R y else 0)" |
49529 | 336 |
proof - |
337 |
have *: "\<And>x y. (if y = x then f x else (0::real)) *\<^sub>R x = (if x=y then (f x) *\<^sub>R x else 0)" |
|
338 |
by auto |
|
339 |
show ?thesis |
|
57418 | 340 |
unfolding * using setsum.delta[OF assms, of y "\<lambda>x. f x *\<^sub>R x"] by auto |
33175 | 341 |
qed |
342 |
||
53333 | 343 |
lemma if_smult: "(if P then x else (y::real)) *\<^sub>R v = (if P then x *\<^sub>R v else y *\<^sub>R v)" |
57418 | 344 |
by (fact if_distrib) |
33175 | 345 |
|
346 |
lemma dist_triangle_eq: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
347 |
fixes x y z :: "'a::real_inner" |
53333 | 348 |
shows "dist x z = dist x y + dist y z \<longleftrightarrow> |
349 |
norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)" |
|
49529 | 350 |
proof - |
351 |
have *: "x - y + (y - z) = x - z" by auto |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
352 |
show ?thesis unfolding dist_norm norm_triangle_eq[of "x - y" "y - z", unfolded *] |
49529 | 353 |
by (auto simp add:norm_minus_commute) |
354 |
qed |
|
33175 | 355 |
|
53406 | 356 |
lemma norm_minus_eqI: "x = - y \<Longrightarrow> norm x = norm y" by auto |
33175 | 357 |
|
49529 | 358 |
lemma Min_grI: |
359 |
assumes "finite A" "A \<noteq> {}" "\<forall>a\<in>A. x < a" |
|
360 |
shows "x < Min A" |
|
33175 | 361 |
unfolding Min_gr_iff[OF assms(1,2)] using assms(3) by auto |
362 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
363 |
lemma norm_lt: "norm x < norm y \<longleftrightarrow> inner x x < inner y y" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
364 |
unfolding norm_eq_sqrt_inner by simp |
33175 | 365 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
366 |
lemma norm_le: "norm x \<le> norm y \<longleftrightarrow> inner x x \<le> inner y y" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
367 |
unfolding norm_eq_sqrt_inner by simp |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
368 |
|
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
369 |
|
44467 | 370 |
subsection {* Affine set and affine hull *} |
33175 | 371 |
|
49529 | 372 |
definition affine :: "'a::real_vector set \<Rightarrow> bool" |
373 |
where "affine s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s)" |
|
33175 | 374 |
|
375 |
lemma affine_alt: "affine s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. \<forall>u::real. (1 - u) *\<^sub>R x + u *\<^sub>R y \<in> s)" |
|
49529 | 376 |
unfolding affine_def by (metis eq_diff_eq') |
33175 | 377 |
|
378 |
lemma affine_empty[intro]: "affine {}" |
|
379 |
unfolding affine_def by auto |
|
380 |
||
381 |
lemma affine_sing[intro]: "affine {x}" |
|
382 |
unfolding affine_alt by (auto simp add: scaleR_left_distrib [symmetric]) |
|
383 |
||
384 |
lemma affine_UNIV[intro]: "affine UNIV" |
|
385 |
unfolding affine_def by auto |
|
386 |
||
387 |
lemma affine_Inter: "(\<forall>s\<in>f. affine s) \<Longrightarrow> affine (\<Inter> f)" |
|
49531 | 388 |
unfolding affine_def by auto |
33175 | 389 |
|
390 |
lemma affine_Int: "affine s \<Longrightarrow> affine t \<Longrightarrow> affine (s \<inter> t)" |
|
391 |
unfolding affine_def by auto |
|
392 |
||
393 |
lemma affine_affine_hull: "affine(affine hull s)" |
|
49529 | 394 |
unfolding hull_def |
395 |
using affine_Inter[of "{t. affine t \<and> s \<subseteq> t}"] by auto |
|
33175 | 396 |
|
397 |
lemma affine_hull_eq[simp]: "(affine hull s = s) \<longleftrightarrow> affine s" |
|
49529 | 398 |
by (metis affine_affine_hull hull_same) |
399 |
||
33175 | 400 |
|
44467 | 401 |
subsubsection {* Some explicit formulations (from Lars Schewe) *} |
33175 | 402 |
|
49529 | 403 |
lemma affine: |
404 |
fixes V::"'a::real_vector set" |
|
405 |
shows "affine V \<longleftrightarrow> |
|
406 |
(\<forall>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> V \<and> setsum u s = 1 \<longrightarrow> (setsum (\<lambda>x. (u x) *\<^sub>R x)) s \<in> V)" |
|
407 |
unfolding affine_def |
|
408 |
apply rule |
|
409 |
apply(rule, rule, rule) |
|
49531 | 410 |
apply(erule conjE)+ |
49529 | 411 |
defer |
412 |
apply (rule, rule, rule, rule, rule) |
|
413 |
proof - |
|
414 |
fix x y u v |
|
415 |
assume as: "x \<in> V" "y \<in> V" "u + v = (1::real)" |
|
33175 | 416 |
"\<forall>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> V \<and> setsum u s = 1 \<longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" |
49529 | 417 |
then show "u *\<^sub>R x + v *\<^sub>R y \<in> V" |
418 |
apply (cases "x = y") |
|
419 |
using as(4)[THEN spec[where x="{x,y}"], THEN spec[where x="\<lambda>w. if w = x then u else v"]] |
|
420 |
and as(1-3) |
|
53333 | 421 |
apply (auto simp add: scaleR_left_distrib[symmetric]) |
422 |
done |
|
33175 | 423 |
next |
49529 | 424 |
fix s u |
425 |
assume as: "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V" |
|
33175 | 426 |
"finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = (1::real)" |
427 |
def n \<equiv> "card s" |
|
428 |
have "card s = 0 \<or> card s = 1 \<or> card s = 2 \<or> card s > 2" by auto |
|
49529 | 429 |
then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" |
430 |
proof (auto simp only: disjE) |
|
431 |
assume "card s = 2" |
|
53333 | 432 |
then have "card s = Suc (Suc 0)" |
433 |
by auto |
|
434 |
then obtain a b where "s = {a, b}" |
|
435 |
unfolding card_Suc_eq by auto |
|
49529 | 436 |
then show ?thesis |
437 |
using as(1)[THEN bspec[where x=a], THEN bspec[where x=b]] using as(4,5) |
|
438 |
by (auto simp add: setsum_clauses(2)) |
|
439 |
next |
|
440 |
assume "card s > 2" |
|
441 |
then show ?thesis using as and n_def |
|
442 |
proof (induct n arbitrary: u s) |
|
443 |
case 0 |
|
444 |
then show ?case by auto |
|
445 |
next |
|
446 |
case (Suc n) |
|
447 |
fix s :: "'a set" and u :: "'a \<Rightarrow> real" |
|
448 |
assume IA: |
|
449 |
"\<And>u s. \<lbrakk>2 < card s; \<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V; finite s; |
|
450 |
s \<noteq> {}; s \<subseteq> V; setsum u s = 1; n = card s \<rbrakk> \<Longrightarrow> (\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" |
|
451 |
and as: |
|
452 |
"Suc n = card s" "2 < card s" "\<forall>x\<in>V. \<forall>y\<in>V. \<forall>u v. u + v = 1 \<longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> V" |
|
33175 | 453 |
"finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = 1" |
49529 | 454 |
have "\<exists>x\<in>s. u x \<noteq> 1" |
455 |
proof (rule ccontr) |
|
456 |
assume "\<not> ?thesis" |
|
53333 | 457 |
then have "setsum u s = real_of_nat (card s)" |
458 |
unfolding card_eq_setsum by auto |
|
49529 | 459 |
then show False |
460 |
using as(7) and `card s > 2` |
|
461 |
by (metis One_nat_def less_Suc0 Zero_not_Suc of_nat_1 of_nat_eq_iff numeral_2_eq_2) |
|
45498
2dc373f1867a
avoid numeral-representation-specific rules in metis proof
huffman
parents:
45051
diff
changeset
|
462 |
qed |
53339 | 463 |
then obtain x where x:"x \<in> s" "u x \<noteq> 1" by auto |
33175 | 464 |
|
49529 | 465 |
have c: "card (s - {x}) = card s - 1" |
53333 | 466 |
apply (rule card_Diff_singleton) |
467 |
using `x\<in>s` as(4) |
|
468 |
apply auto |
|
469 |
done |
|
49529 | 470 |
have *: "s = insert x (s - {x})" "finite (s - {x})" |
471 |
using `x\<in>s` and as(4) by auto |
|
472 |
have **: "setsum u (s - {x}) = 1 - u x" |
|
49530 | 473 |
using setsum_clauses(2)[OF *(2), of u x, unfolded *(1)[symmetric] as(7)] by auto |
49529 | 474 |
have ***: "inverse (1 - u x) * setsum u (s - {x}) = 1" |
475 |
unfolding ** using `u x \<noteq> 1` by auto |
|
476 |
have "(\<Sum>xa\<in>s - {x}. (inverse (1 - u x) * u xa) *\<^sub>R xa) \<in> V" |
|
477 |
proof (cases "card (s - {x}) > 2") |
|
478 |
case True |
|
479 |
then have "s - {x} \<noteq> {}" "card (s - {x}) = n" |
|
480 |
unfolding c and as(1)[symmetric] |
|
49531 | 481 |
proof (rule_tac ccontr) |
49529 | 482 |
assume "\<not> s - {x} \<noteq> {}" |
49531 | 483 |
then have "card (s - {x}) = 0" unfolding card_0_eq[OF *(2)] by simp |
49529 | 484 |
then show False using True by auto |
485 |
qed auto |
|
486 |
then show ?thesis |
|
487 |
apply (rule_tac IA[of "s - {x}" "\<lambda>y. (inverse (1 - u x) * u y)"]) |
|
53333 | 488 |
unfolding setsum_right_distrib[symmetric] |
489 |
using as and *** and True |
|
49529 | 490 |
apply auto |
491 |
done |
|
492 |
next |
|
493 |
case False |
|
53333 | 494 |
then have "card (s - {x}) = Suc (Suc 0)" |
495 |
using as(2) and c by auto |
|
496 |
then obtain a b where "(s - {x}) = {a, b}" "a\<noteq>b" |
|
497 |
unfolding card_Suc_eq by auto |
|
498 |
then show ?thesis |
|
499 |
using as(3)[THEN bspec[where x=a], THEN bspec[where x=b]] |
|
49529 | 500 |
using *** *(2) and `s \<subseteq> V` |
53333 | 501 |
unfolding setsum_right_distrib |
502 |
by (auto simp add: setsum_clauses(2)) |
|
49529 | 503 |
qed |
504 |
then have "u x + (1 - u x) = 1 \<Longrightarrow> |
|
505 |
u x *\<^sub>R x + (1 - u x) *\<^sub>R ((\<Sum>xa\<in>s - {x}. u xa *\<^sub>R xa) /\<^sub>R (1 - u x)) \<in> V" |
|
506 |
apply - |
|
507 |
apply (rule as(3)[rule_format]) |
|
51524 | 508 |
unfolding Real_Vector_Spaces.scaleR_right.setsum |
53333 | 509 |
using x(1) as(6) |
510 |
apply auto |
|
49529 | 511 |
done |
512 |
then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" |
|
49530 | 513 |
unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric] |
49529 | 514 |
apply (subst *) |
515 |
unfolding setsum_clauses(2)[OF *(2)] |
|
53333 | 516 |
using `u x \<noteq> 1` |
517 |
apply auto |
|
49529 | 518 |
done |
519 |
qed |
|
520 |
next |
|
521 |
assume "card s = 1" |
|
53333 | 522 |
then obtain a where "s={a}" |
523 |
by (auto simp add: card_Suc_eq) |
|
524 |
then show ?thesis |
|
525 |
using as(4,5) by simp |
|
49529 | 526 |
qed (insert `s\<noteq>{}` `finite s`, auto) |
33175 | 527 |
qed |
528 |
||
529 |
lemma affine_hull_explicit: |
|
53333 | 530 |
"affine hull p = |
531 |
{y. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> setsum (\<lambda>v. (u v) *\<^sub>R v) s = y}" |
|
49529 | 532 |
apply (rule hull_unique) |
533 |
apply (subst subset_eq) |
|
534 |
prefer 3 |
|
535 |
apply rule |
|
536 |
unfolding mem_Collect_eq |
|
537 |
apply (erule exE)+ |
|
538 |
apply (erule conjE)+ |
|
539 |
prefer 2 |
|
540 |
apply rule |
|
541 |
proof - |
|
542 |
fix x |
|
543 |
assume "x\<in>p" |
|
544 |
then show "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
53333 | 545 |
apply (rule_tac x="{x}" in exI) |
546 |
apply (rule_tac x="\<lambda>x. 1" in exI) |
|
49529 | 547 |
apply auto |
548 |
done |
|
33175 | 549 |
next |
49529 | 550 |
fix t x s u |
53333 | 551 |
assume as: "p \<subseteq> t" "affine t" "finite s" "s \<noteq> {}" |
552 |
"s \<subseteq> p" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
49529 | 553 |
then show "x \<in> t" |
53333 | 554 |
using as(2)[unfolded affine, THEN spec[where x=s], THEN spec[where x=u]] |
555 |
by auto |
|
33175 | 556 |
next |
49529 | 557 |
show "affine {y. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y}" |
558 |
unfolding affine_def |
|
559 |
apply (rule, rule, rule, rule, rule) |
|
560 |
unfolding mem_Collect_eq |
|
561 |
proof - |
|
562 |
fix u v :: real |
|
563 |
assume uv: "u + v = 1" |
|
564 |
fix x |
|
565 |
assume "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
566 |
then obtain sx ux where |
|
53333 | 567 |
x: "finite sx" "sx \<noteq> {}" "sx \<subseteq> p" "setsum ux sx = 1" "(\<Sum>v\<in>sx. ux v *\<^sub>R v) = x" |
568 |
by auto |
|
569 |
fix y |
|
570 |
assume "\<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
|
49529 | 571 |
then obtain sy uy where |
572 |
y: "finite sy" "sy \<noteq> {}" "sy \<subseteq> p" "setsum uy sy = 1" "(\<Sum>v\<in>sy. uy v *\<^sub>R v) = y" by auto |
|
53333 | 573 |
have xy: "finite (sx \<union> sy)" |
574 |
using x(1) y(1) by auto |
|
575 |
have **: "(sx \<union> sy) \<inter> sx = sx" "(sx \<union> sy) \<inter> sy = sy" |
|
576 |
by auto |
|
49529 | 577 |
show "\<exists>s ua. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> |
578 |
setsum ua s = 1 \<and> (\<Sum>v\<in>s. ua v *\<^sub>R v) = u *\<^sub>R x + v *\<^sub>R y" |
|
579 |
apply (rule_tac x="sx \<union> sy" in exI) |
|
580 |
apply (rule_tac x="\<lambda>a. (if a\<in>sx then u * ux a else 0) + (if a\<in>sy then v * uy a else 0)" in exI) |
|
57418 | 581 |
unfolding scaleR_left_distrib setsum.distrib if_smult scaleR_zero_left |
582 |
** setsum.inter_restrict[OF xy, symmetric] |
|
53333 | 583 |
unfolding scaleR_scaleR[symmetric] Real_Vector_Spaces.scaleR_right.setsum [symmetric] |
584 |
and setsum_right_distrib[symmetric] |
|
49529 | 585 |
unfolding x y |
53333 | 586 |
using x(1-3) y(1-3) uv |
587 |
apply simp |
|
49529 | 588 |
done |
589 |
qed |
|
590 |
qed |
|
33175 | 591 |
|
592 |
lemma affine_hull_finite: |
|
593 |
assumes "finite s" |
|
594 |
shows "affine hull s = {y. \<exists>u. setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}" |
|
53333 | 595 |
unfolding affine_hull_explicit and set_eq_iff and mem_Collect_eq |
596 |
apply (rule, rule) |
|
597 |
apply (erule exE)+ |
|
598 |
apply (erule conjE)+ |
|
49529 | 599 |
defer |
600 |
apply (erule exE) |
|
601 |
apply (erule conjE) |
|
602 |
proof - |
|
603 |
fix x u |
|
604 |
assume "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
605 |
then show "\<exists>sa u. finite sa \<and> |
|
606 |
\<not> (\<forall>x. (x \<in> sa) = (x \<in> {})) \<and> sa \<subseteq> s \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = x" |
|
607 |
apply (rule_tac x=s in exI, rule_tac x=u in exI) |
|
53333 | 608 |
using assms |
609 |
apply auto |
|
49529 | 610 |
done |
33175 | 611 |
next |
49529 | 612 |
fix x t u |
613 |
assume "t \<subseteq> s" |
|
53333 | 614 |
then have *: "s \<inter> t = t" |
615 |
by auto |
|
33175 | 616 |
assume "finite t" "\<not> (\<forall>x. (x \<in> t) = (x \<in> {}))" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = x" |
49529 | 617 |
then show "\<exists>u. setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
618 |
apply (rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI) |
|
57418 | 619 |
unfolding if_smult scaleR_zero_left and setsum.inter_restrict[OF assms, symmetric] and * |
49529 | 620 |
apply auto |
621 |
done |
|
622 |
qed |
|
623 |
||
33175 | 624 |
|
44467 | 625 |
subsubsection {* Stepping theorems and hence small special cases *} |
33175 | 626 |
|
627 |
lemma affine_hull_empty[simp]: "affine hull {} = {}" |
|
49529 | 628 |
by (rule hull_unique) auto |
33175 | 629 |
|
630 |
lemma affine_hull_finite_step: |
|
631 |
fixes y :: "'a::real_vector" |
|
49529 | 632 |
shows |
633 |
"(\<exists>u. setsum u {} = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) {} = y) \<longleftrightarrow> w = 0 \<and> y = 0" (is ?th1) |
|
53347 | 634 |
and |
49529 | 635 |
"finite s \<Longrightarrow> |
636 |
(\<exists>u. setsum u (insert a s) = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) (insert a s) = y) \<longleftrightarrow> |
|
53347 | 637 |
(\<exists>v u. setsum u s = w - v \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y - v *\<^sub>R a)" (is "_ \<Longrightarrow> ?lhs = ?rhs") |
49529 | 638 |
proof - |
33175 | 639 |
show ?th1 by simp |
53347 | 640 |
assume fin: "finite s" |
641 |
show "?lhs = ?rhs" |
|
642 |
proof |
|
53302 | 643 |
assume ?lhs |
644 |
then obtain u where u: "setsum u (insert a s) = w \<and> (\<Sum>x\<in>insert a s. u x *\<^sub>R x) = y" |
|
645 |
by auto |
|
53347 | 646 |
show ?rhs |
49529 | 647 |
proof (cases "a \<in> s") |
648 |
case True |
|
649 |
then have *: "insert a s = s" by auto |
|
53302 | 650 |
show ?thesis |
651 |
using u[unfolded *] |
|
652 |
apply(rule_tac x=0 in exI) |
|
653 |
apply auto |
|
654 |
done |
|
33175 | 655 |
next |
49529 | 656 |
case False |
657 |
then show ?thesis |
|
658 |
apply (rule_tac x="u a" in exI) |
|
53347 | 659 |
using u and fin |
53302 | 660 |
apply auto |
49529 | 661 |
done |
53302 | 662 |
qed |
53347 | 663 |
next |
53302 | 664 |
assume ?rhs |
665 |
then obtain v u where vu: "setsum u s = w - v" "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a" |
|
666 |
by auto |
|
667 |
have *: "\<And>x M. (if x = a then v else M) *\<^sub>R x = (if x = a then v *\<^sub>R x else M *\<^sub>R x)" |
|
668 |
by auto |
|
53347 | 669 |
show ?lhs |
49529 | 670 |
proof (cases "a \<in> s") |
671 |
case True |
|
672 |
then show ?thesis |
|
673 |
apply (rule_tac x="\<lambda>x. (if x=a then v else 0) + u x" in exI) |
|
53347 | 674 |
unfolding setsum_clauses(2)[OF fin] |
53333 | 675 |
apply simp |
57418 | 676 |
unfolding scaleR_left_distrib and setsum.distrib |
33175 | 677 |
unfolding vu and * and scaleR_zero_left |
57418 | 678 |
apply (auto simp add: setsum.delta[OF fin]) |
49529 | 679 |
done |
33175 | 680 |
next |
49531 | 681 |
case False |
49529 | 682 |
then have **: |
683 |
"\<And>x. x \<in> s \<Longrightarrow> u x = (if x = a then v else u x)" |
|
684 |
"\<And>x. x \<in> s \<Longrightarrow> u x *\<^sub>R x = (if x = a then v *\<^sub>R x else u x *\<^sub>R x)" by auto |
|
33175 | 685 |
from False show ?thesis |
49529 | 686 |
apply (rule_tac x="\<lambda>x. if x=a then v else u x" in exI) |
53347 | 687 |
unfolding setsum_clauses(2)[OF fin] and * using vu |
57418 | 688 |
using setsum.cong [of s _ "\<lambda>x. u x *\<^sub>R x" "\<lambda>x. if x = a then v *\<^sub>R x else u x *\<^sub>R x", OF _ **(2)] |
689 |
using setsum.cong [of s _ u "\<lambda>x. if x = a then v else u x", OF _ **(1)] |
|
49529 | 690 |
apply auto |
691 |
done |
|
692 |
qed |
|
53347 | 693 |
qed |
33175 | 694 |
qed |
695 |
||
696 |
lemma affine_hull_2: |
|
697 |
fixes a b :: "'a::real_vector" |
|
53302 | 698 |
shows "affine hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b| u v. (u + v = 1)}" |
699 |
(is "?lhs = ?rhs") |
|
49529 | 700 |
proof - |
701 |
have *: |
|
49531 | 702 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)" |
49529 | 703 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto |
33175 | 704 |
have "?lhs = {y. \<exists>u. setsum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}" |
705 |
using affine_hull_finite[of "{a,b}"] by auto |
|
706 |
also have "\<dots> = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}" |
|
49529 | 707 |
by (simp add: affine_hull_finite_step(2)[of "{b}" a]) |
33175 | 708 |
also have "\<dots> = ?rhs" unfolding * by auto |
709 |
finally show ?thesis by auto |
|
710 |
qed |
|
711 |
||
712 |
lemma affine_hull_3: |
|
713 |
fixes a b c :: "'a::real_vector" |
|
53302 | 714 |
shows "affine hull {a,b,c} = { u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c| u v w. u + v + w = 1}" |
49529 | 715 |
proof - |
716 |
have *: |
|
49531 | 717 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)" |
49529 | 718 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto |
719 |
show ?thesis |
|
720 |
apply (simp add: affine_hull_finite affine_hull_finite_step) |
|
721 |
unfolding * |
|
722 |
apply auto |
|
53302 | 723 |
apply (rule_tac x=v in exI) |
724 |
apply (rule_tac x=va in exI) |
|
725 |
apply auto |
|
726 |
apply (rule_tac x=u in exI) |
|
727 |
apply force |
|
49529 | 728 |
done |
33175 | 729 |
qed |
730 |
||
40377 | 731 |
lemma mem_affine: |
53333 | 732 |
assumes "affine S" "x \<in> S" "y \<in> S" "u + v = 1" |
53347 | 733 |
shows "u *\<^sub>R x + v *\<^sub>R y \<in> S" |
40377 | 734 |
using assms affine_def[of S] by auto |
735 |
||
736 |
lemma mem_affine_3: |
|
53333 | 737 |
assumes "affine S" "x \<in> S" "y \<in> S" "z \<in> S" "u + v + w = 1" |
53347 | 738 |
shows "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> S" |
49529 | 739 |
proof - |
53347 | 740 |
have "u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z \<in> affine hull {x, y, z}" |
49529 | 741 |
using affine_hull_3[of x y z] assms by auto |
742 |
moreover |
|
53347 | 743 |
have "affine hull {x, y, z} \<subseteq> affine hull S" |
49529 | 744 |
using hull_mono[of "{x, y, z}" "S"] assms by auto |
745 |
moreover |
|
53347 | 746 |
have "affine hull S = S" |
747 |
using assms affine_hull_eq[of S] by auto |
|
49531 | 748 |
ultimately show ?thesis by auto |
40377 | 749 |
qed |
750 |
||
751 |
lemma mem_affine_3_minus: |
|
53333 | 752 |
assumes "affine S" "x \<in> S" "y \<in> S" "z \<in> S" |
753 |
shows "x + v *\<^sub>R (y-z) \<in> S" |
|
754 |
using mem_affine_3[of S x y z 1 v "-v"] assms |
|
755 |
by (simp add: algebra_simps) |
|
40377 | 756 |
|
757 |
||
44467 | 758 |
subsubsection {* Some relations between affine hull and subspaces *} |
33175 | 759 |
|
760 |
lemma affine_hull_insert_subset_span: |
|
49529 | 761 |
"affine hull (insert a s) \<subseteq> {a + v| v . v \<in> span {x - a | x . x \<in> s}}" |
762 |
unfolding subset_eq Ball_def |
|
763 |
unfolding affine_hull_explicit span_explicit mem_Collect_eq |
|
50804 | 764 |
apply (rule, rule) |
765 |
apply (erule exE)+ |
|
766 |
apply (erule conjE)+ |
|
49529 | 767 |
proof - |
768 |
fix x t u |
|
769 |
assume as: "finite t" "t \<noteq> {}" "t \<subseteq> insert a s" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = x" |
|
53333 | 770 |
have "(\<lambda>x. x - a) ` (t - {a}) \<subseteq> {x - a |x. x \<in> s}" |
771 |
using as(3) by auto |
|
49529 | 772 |
then show "\<exists>v. x = a + v \<and> (\<exists>S u. finite S \<and> S \<subseteq> {x - a |x. x \<in> s} \<and> (\<Sum>v\<in>S. u v *\<^sub>R v) = v)" |
773 |
apply (rule_tac x="x - a" in exI) |
|
33175 | 774 |
apply (rule conjI, simp) |
49529 | 775 |
apply (rule_tac x="(\<lambda>x. x - a) ` (t - {a})" in exI) |
776 |
apply (rule_tac x="\<lambda>x. u (x + a)" in exI) |
|
33175 | 777 |
apply (rule conjI) using as(1) apply simp |
778 |
apply (erule conjI) |
|
779 |
using as(1) |
|
57418 | 780 |
apply (simp add: setsum.reindex[unfolded inj_on_def] scaleR_right_diff_distrib |
49530 | 781 |
setsum_subtractf scaleR_left.setsum[symmetric] setsum_diff1 scaleR_left_diff_distrib) |
49529 | 782 |
unfolding as |
783 |
apply simp |
|
784 |
done |
|
785 |
qed |
|
33175 | 786 |
|
787 |
lemma affine_hull_insert_span: |
|
788 |
assumes "a \<notin> s" |
|
49529 | 789 |
shows "affine hull (insert a s) = {a + v | v . v \<in> span {x - a | x. x \<in> s}}" |
790 |
apply (rule, rule affine_hull_insert_subset_span) |
|
791 |
unfolding subset_eq Ball_def |
|
792 |
unfolding affine_hull_explicit and mem_Collect_eq |
|
793 |
proof (rule, rule, erule exE, erule conjE) |
|
49531 | 794 |
fix y v |
49529 | 795 |
assume "y = a + v" "v \<in> span {x - a |x. x \<in> s}" |
53339 | 796 |
then obtain t u where obt: "finite t" "t \<subseteq> {x - a |x. x \<in> s}" "a + (\<Sum>v\<in>t. u v *\<^sub>R v) = y" |
49529 | 797 |
unfolding span_explicit by auto |
33175 | 798 |
def f \<equiv> "(\<lambda>x. x + a) ` t" |
53333 | 799 |
have f: "finite f" "f \<subseteq> s" "(\<Sum>v\<in>f. u (v - a) *\<^sub>R (v - a)) = y - a" |
57418 | 800 |
unfolding f_def using obt by (auto simp add: setsum.reindex[unfolded inj_on_def]) |
53333 | 801 |
have *: "f \<inter> {a} = {}" "f \<inter> - {a} = f" |
802 |
using f(2) assms by auto |
|
33175 | 803 |
show "\<exists>sa u. finite sa \<and> sa \<noteq> {} \<and> sa \<subseteq> insert a s \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y" |
49529 | 804 |
apply (rule_tac x = "insert a f" in exI) |
805 |
apply (rule_tac x = "\<lambda>x. if x=a then 1 - setsum (\<lambda>x. u (x - a)) f else u (x - a)" in exI) |
|
53339 | 806 |
using assms and f |
807 |
unfolding setsum_clauses(2)[OF f(1)] and if_smult |
|
57418 | 808 |
unfolding setsum.If_cases[OF f(1), of "\<lambda>x. x = a"] |
49529 | 809 |
apply (auto simp add: setsum_subtractf scaleR_left.setsum algebra_simps *) |
810 |
done |
|
811 |
qed |
|
33175 | 812 |
|
813 |
lemma affine_hull_span: |
|
814 |
assumes "a \<in> s" |
|
815 |
shows "affine hull s = {a + v | v. v \<in> span {x - a | x. x \<in> s - {a}}}" |
|
816 |
using affine_hull_insert_span[of a "s - {a}", unfolded insert_Diff[OF assms]] by auto |
|
817 |
||
49529 | 818 |
|
44467 | 819 |
subsubsection {* Parallel affine sets *} |
40377 | 820 |
|
53347 | 821 |
definition affine_parallel :: "'a::real_vector set \<Rightarrow> 'a::real_vector set \<Rightarrow> bool" |
53339 | 822 |
where "affine_parallel S T \<longleftrightarrow> (\<exists>a. T = (\<lambda>x. a + x) ` S)" |
40377 | 823 |
|
824 |
lemma affine_parallel_expl_aux: |
|
49529 | 825 |
fixes S T :: "'a::real_vector set" |
53339 | 826 |
assumes "\<forall>x. x \<in> S \<longleftrightarrow> a + x \<in> T" |
827 |
shows "T = (\<lambda>x. a + x) ` S" |
|
49529 | 828 |
proof - |
53302 | 829 |
{ |
830 |
fix x |
|
53339 | 831 |
assume "x \<in> T" |
832 |
then have "( - a) + x \<in> S" |
|
833 |
using assms by auto |
|
834 |
then have "x \<in> ((\<lambda>x. a + x) ` S)" |
|
53333 | 835 |
using imageI[of "-a+x" S "(\<lambda>x. a+x)"] by auto |
53302 | 836 |
} |
53339 | 837 |
moreover have "T \<ge> (\<lambda>x. a + x) ` S" |
53333 | 838 |
using assms by auto |
49529 | 839 |
ultimately show ?thesis by auto |
840 |
qed |
|
841 |
||
53339 | 842 |
lemma affine_parallel_expl: "affine_parallel S T \<longleftrightarrow> (\<exists>a. \<forall>x. x \<in> S \<longleftrightarrow> a + x \<in> T)" |
49529 | 843 |
unfolding affine_parallel_def |
844 |
using affine_parallel_expl_aux[of S _ T] by auto |
|
845 |
||
846 |
lemma affine_parallel_reflex: "affine_parallel S S" |
|
53302 | 847 |
unfolding affine_parallel_def |
848 |
apply (rule exI[of _ "0"]) |
|
849 |
apply auto |
|
850 |
done |
|
40377 | 851 |
|
852 |
lemma affine_parallel_commut: |
|
49529 | 853 |
assumes "affine_parallel A B" |
854 |
shows "affine_parallel B A" |
|
855 |
proof - |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
856 |
from assms obtain a where B: "B = (\<lambda>x. a + x) ` A" |
49529 | 857 |
unfolding affine_parallel_def by auto |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
858 |
have [simp]: "(\<lambda>x. x - a) = plus (- a)" by (simp add: fun_eq_iff) |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
859 |
from B show ?thesis |
53333 | 860 |
using translation_galois [of B a A] |
861 |
unfolding affine_parallel_def by auto |
|
40377 | 862 |
qed |
863 |
||
864 |
lemma affine_parallel_assoc: |
|
53339 | 865 |
assumes "affine_parallel A B" |
866 |
and "affine_parallel B C" |
|
49531 | 867 |
shows "affine_parallel A C" |
49529 | 868 |
proof - |
53333 | 869 |
from assms obtain ab where "B = (\<lambda>x. ab + x) ` A" |
49531 | 870 |
unfolding affine_parallel_def by auto |
871 |
moreover |
|
53333 | 872 |
from assms obtain bc where "C = (\<lambda>x. bc + x) ` B" |
49529 | 873 |
unfolding affine_parallel_def by auto |
874 |
ultimately show ?thesis |
|
875 |
using translation_assoc[of bc ab A] unfolding affine_parallel_def by auto |
|
40377 | 876 |
qed |
877 |
||
878 |
lemma affine_translation_aux: |
|
879 |
fixes a :: "'a::real_vector" |
|
53333 | 880 |
assumes "affine ((\<lambda>x. a + x) ` S)" |
881 |
shows "affine S" |
|
53302 | 882 |
proof - |
883 |
{ |
|
884 |
fix x y u v |
|
53333 | 885 |
assume xy: "x \<in> S" "y \<in> S" "(u :: real) + v = 1" |
886 |
then have "(a + x) \<in> ((\<lambda>x. a + x) ` S)" "(a + y) \<in> ((\<lambda>x. a + x) ` S)" |
|
887 |
by auto |
|
53339 | 888 |
then have h1: "u *\<^sub>R (a + x) + v *\<^sub>R (a + y) \<in> (\<lambda>x. a + x) ` S" |
49529 | 889 |
using xy assms unfolding affine_def by auto |
53339 | 890 |
have "u *\<^sub>R (a + x) + v *\<^sub>R (a + y) = (u + v) *\<^sub>R a + (u *\<^sub>R x + v *\<^sub>R y)" |
49529 | 891 |
by (simp add: algebra_simps) |
53339 | 892 |
also have "\<dots> = a + (u *\<^sub>R x + v *\<^sub>R y)" |
893 |
using `u + v = 1` by auto |
|
894 |
ultimately have "a + (u *\<^sub>R x + v *\<^sub>R y) \<in> (\<lambda>x. a + x) ` S" |
|
53333 | 895 |
using h1 by auto |
49529 | 896 |
then have "u *\<^sub>R x + v *\<^sub>R y : S" by auto |
897 |
} |
|
898 |
then show ?thesis unfolding affine_def by auto |
|
40377 | 899 |
qed |
900 |
||
901 |
lemma affine_translation: |
|
902 |
fixes a :: "'a::real_vector" |
|
53339 | 903 |
shows "affine S \<longleftrightarrow> affine ((\<lambda>x. a + x) ` S)" |
49529 | 904 |
proof - |
53339 | 905 |
have "affine S \<Longrightarrow> affine ((\<lambda>x. a + x) ` S)" |
906 |
using affine_translation_aux[of "-a" "((\<lambda>x. a + x) ` S)"] |
|
49529 | 907 |
using translation_assoc[of "-a" a S] by auto |
908 |
then show ?thesis using affine_translation_aux by auto |
|
40377 | 909 |
qed |
910 |
||
911 |
lemma parallel_is_affine: |
|
49529 | 912 |
fixes S T :: "'a::real_vector set" |
913 |
assumes "affine S" "affine_parallel S T" |
|
914 |
shows "affine T" |
|
915 |
proof - |
|
53339 | 916 |
from assms obtain a where "T = (\<lambda>x. a + x) ` S" |
49531 | 917 |
unfolding affine_parallel_def by auto |
53339 | 918 |
then show ?thesis |
919 |
using affine_translation assms by auto |
|
40377 | 920 |
qed |
921 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
922 |
lemma subspace_imp_affine: "subspace s \<Longrightarrow> affine s" |
40377 | 923 |
unfolding subspace_def affine_def by auto |
924 |
||
49529 | 925 |
|
44467 | 926 |
subsubsection {* Subspace parallel to an affine set *} |
40377 | 927 |
|
53339 | 928 |
lemma subspace_affine: "subspace S \<longleftrightarrow> affine S \<and> 0 \<in> S" |
49529 | 929 |
proof - |
53333 | 930 |
have h0: "subspace S \<Longrightarrow> affine S \<and> 0 \<in> S" |
49529 | 931 |
using subspace_imp_affine[of S] subspace_0 by auto |
53302 | 932 |
{ |
53333 | 933 |
assume assm: "affine S \<and> 0 \<in> S" |
53302 | 934 |
{ |
935 |
fix c :: real |
|
54465 | 936 |
fix x |
937 |
assume x: "x \<in> S" |
|
49529 | 938 |
have "c *\<^sub>R x = (1-c) *\<^sub>R 0 + c *\<^sub>R x" by auto |
939 |
moreover |
|
53339 | 940 |
have "(1 - c) *\<^sub>R 0 + c *\<^sub>R x \<in> S" |
54465 | 941 |
using affine_alt[of S] assm x by auto |
53333 | 942 |
ultimately have "c *\<^sub>R x \<in> S" by auto |
49529 | 943 |
} |
53333 | 944 |
then have h1: "\<forall>c. \<forall>x \<in> S. c *\<^sub>R x \<in> S" by auto |
49529 | 945 |
|
53302 | 946 |
{ |
947 |
fix x y |
|
54465 | 948 |
assume xy: "x \<in> S" "y \<in> S" |
49529 | 949 |
def u == "(1 :: real)/2" |
53302 | 950 |
have "(1/2) *\<^sub>R (x+y) = (1/2) *\<^sub>R (x+y)" |
951 |
by auto |
|
49529 | 952 |
moreover |
53302 | 953 |
have "(1/2) *\<^sub>R (x+y)=(1/2) *\<^sub>R x + (1-(1/2)) *\<^sub>R y" |
954 |
by (simp add: algebra_simps) |
|
49529 | 955 |
moreover |
54465 | 956 |
have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> S" |
957 |
using affine_alt[of S] assm xy by auto |
|
49529 | 958 |
ultimately |
53333 | 959 |
have "(1/2) *\<^sub>R (x+y) \<in> S" |
53302 | 960 |
using u_def by auto |
49529 | 961 |
moreover |
54465 | 962 |
have "x + y = 2 *\<^sub>R ((1/2) *\<^sub>R (x+y))" |
53302 | 963 |
by auto |
49529 | 964 |
ultimately |
54465 | 965 |
have "x + y \<in> S" |
53302 | 966 |
using h1[rule_format, of "(1/2) *\<^sub>R (x+y)" "2"] by auto |
49529 | 967 |
} |
53302 | 968 |
then have "\<forall>x \<in> S. \<forall>y \<in> S. x + y \<in> S" |
969 |
by auto |
|
970 |
then have "subspace S" |
|
971 |
using h1 assm unfolding subspace_def by auto |
|
49529 | 972 |
} |
973 |
then show ?thesis using h0 by metis |
|
40377 | 974 |
qed |
975 |
||
976 |
lemma affine_diffs_subspace: |
|
53333 | 977 |
assumes "affine S" "a \<in> S" |
53302 | 978 |
shows "subspace ((\<lambda>x. (-a)+x) ` S)" |
49529 | 979 |
proof - |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
980 |
have [simp]: "(\<lambda>x. x - a) = plus (- a)" by (simp add: fun_eq_iff) |
53302 | 981 |
have "affine ((\<lambda>x. (-a)+x) ` S)" |
49531 | 982 |
using affine_translation assms by auto |
53302 | 983 |
moreover have "0 : ((\<lambda>x. (-a)+x) ` S)" |
53333 | 984 |
using assms exI[of "(\<lambda>x. x\<in>S \<and> -a+x = 0)" a] by auto |
49531 | 985 |
ultimately show ?thesis using subspace_affine by auto |
40377 | 986 |
qed |
987 |
||
988 |
lemma parallel_subspace_explicit: |
|
54465 | 989 |
assumes "affine S" |
990 |
and "a \<in> S" |
|
991 |
assumes "L \<equiv> {y. \<exists>x \<in> S. (-a) + x = y}" |
|
992 |
shows "subspace L \<and> affine_parallel S L" |
|
49529 | 993 |
proof - |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
994 |
from assms have "L = plus (- a) ` S" by auto |
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
995 |
then have par: "affine_parallel S L" |
54465 | 996 |
unfolding affine_parallel_def .. |
49531 | 997 |
then have "affine L" using assms parallel_is_affine by auto |
53302 | 998 |
moreover have "0 \<in> L" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
999 |
using assms by auto |
53302 | 1000 |
ultimately show ?thesis |
1001 |
using subspace_affine par by auto |
|
40377 | 1002 |
qed |
1003 |
||
1004 |
lemma parallel_subspace_aux: |
|
53302 | 1005 |
assumes "subspace A" |
1006 |
and "subspace B" |
|
1007 |
and "affine_parallel A B" |
|
1008 |
shows "A \<supseteq> B" |
|
49529 | 1009 |
proof - |
54465 | 1010 |
from assms obtain a where a: "\<forall>x. x \<in> A \<longleftrightarrow> a + x \<in> B" |
49529 | 1011 |
using affine_parallel_expl[of A B] by auto |
53302 | 1012 |
then have "-a \<in> A" |
1013 |
using assms subspace_0[of B] by auto |
|
1014 |
then have "a \<in> A" |
|
1015 |
using assms subspace_neg[of A "-a"] by auto |
|
1016 |
then show ?thesis |
|
54465 | 1017 |
using assms a unfolding subspace_def by auto |
40377 | 1018 |
qed |
1019 |
||
1020 |
lemma parallel_subspace: |
|
53302 | 1021 |
assumes "subspace A" |
1022 |
and "subspace B" |
|
1023 |
and "affine_parallel A B" |
|
49529 | 1024 |
shows "A = B" |
1025 |
proof |
|
53302 | 1026 |
show "A \<supseteq> B" |
49529 | 1027 |
using assms parallel_subspace_aux by auto |
53302 | 1028 |
show "A \<subseteq> B" |
49529 | 1029 |
using assms parallel_subspace_aux[of B A] affine_parallel_commut by auto |
40377 | 1030 |
qed |
1031 |
||
1032 |
lemma affine_parallel_subspace: |
|
53302 | 1033 |
assumes "affine S" "S \<noteq> {}" |
53339 | 1034 |
shows "\<exists>!L. subspace L \<and> affine_parallel S L" |
49529 | 1035 |
proof - |
53339 | 1036 |
have ex: "\<exists>L. subspace L \<and> affine_parallel S L" |
49531 | 1037 |
using assms parallel_subspace_explicit by auto |
53302 | 1038 |
{ |
1039 |
fix L1 L2 |
|
53339 | 1040 |
assume ass: "subspace L1 \<and> affine_parallel S L1" "subspace L2 \<and> affine_parallel S L2" |
49529 | 1041 |
then have "affine_parallel L1 L2" |
1042 |
using affine_parallel_commut[of S L1] affine_parallel_assoc[of L1 S L2] by auto |
|
1043 |
then have "L1 = L2" |
|
1044 |
using ass parallel_subspace by auto |
|
1045 |
} |
|
1046 |
then show ?thesis using ex by auto |
|
1047 |
qed |
|
1048 |
||
40377 | 1049 |
|
44467 | 1050 |
subsection {* Cones *} |
33175 | 1051 |
|
49529 | 1052 |
definition cone :: "'a::real_vector set \<Rightarrow> bool" |
53339 | 1053 |
where "cone s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>c\<ge>0. c *\<^sub>R x \<in> s)" |
33175 | 1054 |
|
1055 |
lemma cone_empty[intro, simp]: "cone {}" |
|
1056 |
unfolding cone_def by auto |
|
1057 |
||
1058 |
lemma cone_univ[intro, simp]: "cone UNIV" |
|
1059 |
unfolding cone_def by auto |
|
1060 |
||
53339 | 1061 |
lemma cone_Inter[intro]: "\<forall>s\<in>f. cone s \<Longrightarrow> cone (\<Inter>f)" |
33175 | 1062 |
unfolding cone_def by auto |
1063 |
||
49529 | 1064 |
|
44467 | 1065 |
subsubsection {* Conic hull *} |
33175 | 1066 |
|
1067 |
lemma cone_cone_hull: "cone (cone hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1068 |
unfolding hull_def by auto |
33175 | 1069 |
|
53302 | 1070 |
lemma cone_hull_eq: "cone hull s = s \<longleftrightarrow> cone s" |
49529 | 1071 |
apply (rule hull_eq) |
53302 | 1072 |
using cone_Inter |
1073 |
unfolding subset_eq |
|
1074 |
apply auto |
|
49529 | 1075 |
done |
33175 | 1076 |
|
40377 | 1077 |
lemma mem_cone: |
53302 | 1078 |
assumes "cone S" "x \<in> S" "c \<ge> 0" |
40377 | 1079 |
shows "c *\<^sub>R x : S" |
1080 |
using assms cone_def[of S] by auto |
|
1081 |
||
1082 |
lemma cone_contains_0: |
|
49529 | 1083 |
assumes "cone S" |
53302 | 1084 |
shows "S \<noteq> {} \<longleftrightarrow> 0 \<in> S" |
49529 | 1085 |
proof - |
53302 | 1086 |
{ |
1087 |
assume "S \<noteq> {}" |
|
1088 |
then obtain a where "a \<in> S" by auto |
|
1089 |
then have "0 \<in> S" |
|
1090 |
using assms mem_cone[of S a 0] by auto |
|
49529 | 1091 |
} |
1092 |
then show ?thesis by auto |
|
40377 | 1093 |
qed |
1094 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1095 |
lemma cone_0: "cone {0}" |
49529 | 1096 |
unfolding cone_def by auto |
40377 | 1097 |
|
53302 | 1098 |
lemma cone_Union[intro]: "(\<forall>s\<in>f. cone s) \<longrightarrow> cone (Union f)" |
40377 | 1099 |
unfolding cone_def by blast |
1100 |
||
1101 |
lemma cone_iff: |
|
53347 | 1102 |
assumes "S \<noteq> {}" |
1103 |
shows "cone S \<longleftrightarrow> 0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)" |
|
49529 | 1104 |
proof - |
53302 | 1105 |
{ |
1106 |
assume "cone S" |
|
1107 |
{ |
|
53347 | 1108 |
fix c :: real |
1109 |
assume "c > 0" |
|
53302 | 1110 |
{ |
1111 |
fix x |
|
53347 | 1112 |
assume "x \<in> S" |
1113 |
then have "x \<in> (op *\<^sub>R c) ` S" |
|
49529 | 1114 |
unfolding image_def |
1115 |
using `cone S` `c>0` mem_cone[of S x "1/c"] |
|
54465 | 1116 |
exI[of "(\<lambda>t. t \<in> S \<and> x = c *\<^sub>R t)" "(1 / c) *\<^sub>R x"] |
53347 | 1117 |
by auto |
49529 | 1118 |
} |
1119 |
moreover |
|
53302 | 1120 |
{ |
1121 |
fix x |
|
53347 | 1122 |
assume "x \<in> (op *\<^sub>R c) ` S" |
1123 |
then have "x \<in> S" |
|
1124 |
using `cone S` `c > 0` |
|
1125 |
unfolding cone_def image_def `c > 0` by auto |
|
49529 | 1126 |
} |
53302 | 1127 |
ultimately have "(op *\<^sub>R c) ` S = S" by auto |
40377 | 1128 |
} |
53339 | 1129 |
then have "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)" |
49529 | 1130 |
using `cone S` cone_contains_0[of S] assms by auto |
1131 |
} |
|
1132 |
moreover |
|
53302 | 1133 |
{ |
53339 | 1134 |
assume a: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> (op *\<^sub>R c) ` S = S)" |
53302 | 1135 |
{ |
1136 |
fix x |
|
1137 |
assume "x \<in> S" |
|
53347 | 1138 |
fix c1 :: real |
1139 |
assume "c1 \<ge> 0" |
|
1140 |
then have "c1 = 0 \<or> c1 > 0" by auto |
|
1141 |
then have "c1 *\<^sub>R x \<in> S" using a `x \<in> S` by auto |
|
49529 | 1142 |
} |
1143 |
then have "cone S" unfolding cone_def by auto |
|
40377 | 1144 |
} |
49529 | 1145 |
ultimately show ?thesis by blast |
1146 |
qed |
|
1147 |
||
1148 |
lemma cone_hull_empty: "cone hull {} = {}" |
|
1149 |
by (metis cone_empty cone_hull_eq) |
|
1150 |
||
53302 | 1151 |
lemma cone_hull_empty_iff: "S = {} \<longleftrightarrow> cone hull S = {}" |
49529 | 1152 |
by (metis bot_least cone_hull_empty hull_subset xtrans(5)) |
1153 |
||
53302 | 1154 |
lemma cone_hull_contains_0: "S \<noteq> {} \<longleftrightarrow> 0 \<in> cone hull S" |
49529 | 1155 |
using cone_cone_hull[of S] cone_contains_0[of "cone hull S"] cone_hull_empty_iff[of S] |
1156 |
by auto |
|
40377 | 1157 |
|
1158 |
lemma mem_cone_hull: |
|
53347 | 1159 |
assumes "x \<in> S" "c \<ge> 0" |
53302 | 1160 |
shows "c *\<^sub>R x \<in> cone hull S" |
49529 | 1161 |
by (metis assms cone_cone_hull hull_inc mem_cone) |
1162 |
||
53339 | 1163 |
lemma cone_hull_expl: "cone hull S = {c *\<^sub>R x | c x. c \<ge> 0 \<and> x \<in> S}" |
1164 |
(is "?lhs = ?rhs") |
|
49529 | 1165 |
proof - |
53302 | 1166 |
{ |
1167 |
fix x |
|
1168 |
assume "x \<in> ?rhs" |
|
54465 | 1169 |
then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S" |
49529 | 1170 |
by auto |
53347 | 1171 |
fix c :: real |
1172 |
assume c: "c \<ge> 0" |
|
53339 | 1173 |
then have "c *\<^sub>R x = (c * cx) *\<^sub>R xx" |
54465 | 1174 |
using x by (simp add: algebra_simps) |
49529 | 1175 |
moreover |
56536 | 1176 |
have "c * cx \<ge> 0" using c x by auto |
49529 | 1177 |
ultimately |
54465 | 1178 |
have "c *\<^sub>R x \<in> ?rhs" using x by auto |
53302 | 1179 |
} |
53347 | 1180 |
then have "cone ?rhs" |
1181 |
unfolding cone_def by auto |
|
1182 |
then have "?rhs \<in> Collect cone" |
|
1183 |
unfolding mem_Collect_eq by auto |
|
53302 | 1184 |
{ |
1185 |
fix x |
|
1186 |
assume "x \<in> S" |
|
1187 |
then have "1 *\<^sub>R x \<in> ?rhs" |
|
49531 | 1188 |
apply auto |
53347 | 1189 |
apply (rule_tac x = 1 in exI) |
49529 | 1190 |
apply auto |
1191 |
done |
|
53302 | 1192 |
then have "x \<in> ?rhs" by auto |
53347 | 1193 |
} |
1194 |
then have "S \<subseteq> ?rhs" by auto |
|
53302 | 1195 |
then have "?lhs \<subseteq> ?rhs" |
1196 |
using `?rhs \<in> Collect cone` hull_minimal[of S "?rhs" "cone"] by auto |
|
49529 | 1197 |
moreover |
53302 | 1198 |
{ |
1199 |
fix x |
|
1200 |
assume "x \<in> ?rhs" |
|
54465 | 1201 |
then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S" |
53339 | 1202 |
by auto |
1203 |
then have "xx \<in> cone hull S" |
|
1204 |
using hull_subset[of S] by auto |
|
53302 | 1205 |
then have "x \<in> ?lhs" |
54465 | 1206 |
using x cone_cone_hull[of S] cone_def[of "cone hull S"] by auto |
49529 | 1207 |
} |
1208 |
ultimately show ?thesis by auto |
|
40377 | 1209 |
qed |
1210 |
||
1211 |
lemma cone_closure: |
|
53347 | 1212 |
fixes S :: "'a::real_normed_vector set" |
49529 | 1213 |
assumes "cone S" |
1214 |
shows "cone (closure S)" |
|
1215 |
proof (cases "S = {}") |
|
1216 |
case True |
|
1217 |
then show ?thesis by auto |
|
1218 |
next |
|
1219 |
case False |
|
53339 | 1220 |
then have "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)" |
49529 | 1221 |
using cone_iff[of S] assms by auto |
53339 | 1222 |
then have "0 \<in> closure S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` closure S = closure S)" |
49529 | 1223 |
using closure_subset by (auto simp add: closure_scaleR) |
53339 | 1224 |
then show ?thesis |
1225 |
using cone_iff[of "closure S"] by auto |
|
49529 | 1226 |
qed |
1227 |
||
40377 | 1228 |
|
44467 | 1229 |
subsection {* Affine dependence and consequential theorems (from Lars Schewe) *} |
33175 | 1230 |
|
49529 | 1231 |
definition affine_dependent :: "'a::real_vector set \<Rightarrow> bool" |
53339 | 1232 |
where "affine_dependent s \<longleftrightarrow> (\<exists>x\<in>s. x \<in> affine hull (s - {x}))" |
33175 | 1233 |
|
1234 |
lemma affine_dependent_explicit: |
|
1235 |
"affine_dependent p \<longleftrightarrow> |
|
1236 |
(\<exists>s u. finite s \<and> s \<subseteq> p \<and> setsum u s = 0 \<and> |
|
53347 | 1237 |
(\<exists>v\<in>s. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = 0)" |
49529 | 1238 |
unfolding affine_dependent_def affine_hull_explicit mem_Collect_eq |
1239 |
apply rule |
|
1240 |
apply (erule bexE, erule exE, erule exE) |
|
1241 |
apply (erule conjE)+ |
|
1242 |
defer |
|
1243 |
apply (erule exE, erule exE) |
|
1244 |
apply (erule conjE)+ |
|
1245 |
apply (erule bexE) |
|
1246 |
proof - |
|
1247 |
fix x s u |
|
1248 |
assume as: "x \<in> p" "finite s" "s \<noteq> {}" "s \<subseteq> p - {x}" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
53302 | 1249 |
have "x \<notin> s" using as(1,4) by auto |
33175 | 1250 |
show "\<exists>s u. finite s \<and> s \<subseteq> p \<and> setsum u s = 0 \<and> (\<exists>v\<in>s. u v \<noteq> 0) \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0" |
49529 | 1251 |
apply (rule_tac x="insert x s" in exI, rule_tac x="\<lambda>v. if v = x then - 1 else u v" in exI) |
1252 |
unfolding if_smult and setsum_clauses(2)[OF as(2)] and setsum_delta_notmem[OF `x\<notin>s`] and as |
|
53339 | 1253 |
using as |
1254 |
apply auto |
|
49529 | 1255 |
done |
33175 | 1256 |
next |
49529 | 1257 |
fix s u v |
53302 | 1258 |
assume as: "finite s" "s \<subseteq> p" "setsum u s = 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0" "v \<in> s" "u v \<noteq> 0" |
53339 | 1259 |
have "s \<noteq> {v}" |
1260 |
using as(3,6) by auto |
|
49529 | 1261 |
then show "\<exists>x\<in>p. \<exists>s u. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p - {x} \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
53302 | 1262 |
apply (rule_tac x=v in bexI) |
1263 |
apply (rule_tac x="s - {v}" in exI) |
|
1264 |
apply (rule_tac x="\<lambda>x. - (1 / u v) * u x" in exI) |
|
49530 | 1265 |
unfolding scaleR_scaleR[symmetric] and scaleR_right.setsum [symmetric] |
1266 |
unfolding setsum_right_distrib[symmetric] and setsum_diff1[OF as(1)] |
|
53302 | 1267 |
using as |
1268 |
apply auto |
|
49529 | 1269 |
done |
33175 | 1270 |
qed |
1271 |
||
1272 |
lemma affine_dependent_explicit_finite: |
|
49529 | 1273 |
fixes s :: "'a::real_vector set" |
1274 |
assumes "finite s" |
|
53302 | 1275 |
shows "affine_dependent s \<longleftrightarrow> |
1276 |
(\<exists>u. setsum u s = 0 \<and> (\<exists>v\<in>s. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = 0)" |
|
33175 | 1277 |
(is "?lhs = ?rhs") |
1278 |
proof |
|
53347 | 1279 |
have *: "\<And>vt u v. (if vt then u v else 0) *\<^sub>R v = (if vt then (u v) *\<^sub>R v else 0::'a)" |
49529 | 1280 |
by auto |
33175 | 1281 |
assume ?lhs |
49529 | 1282 |
then obtain t u v where |
53339 | 1283 |
"finite t" "t \<subseteq> s" "setsum u t = 0" "v\<in>t" "u v \<noteq> 0" "(\<Sum>v\<in>t. u v *\<^sub>R v) = 0" |
33175 | 1284 |
unfolding affine_dependent_explicit by auto |
49529 | 1285 |
then show ?rhs |
1286 |
apply (rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI) |
|
57418 | 1287 |
apply auto unfolding * and setsum.inter_restrict[OF assms, symmetric] |
49529 | 1288 |
unfolding Int_absorb1[OF `t\<subseteq>s`] |
1289 |
apply auto |
|
1290 |
done |
|
33175 | 1291 |
next |
1292 |
assume ?rhs |
|
53339 | 1293 |
then obtain u v where "setsum u s = 0" "v\<in>s" "u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0" |
1294 |
by auto |
|
49529 | 1295 |
then show ?lhs unfolding affine_dependent_explicit |
1296 |
using assms by auto |
|
1297 |
qed |
|
1298 |
||
33175 | 1299 |
|
44465
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
1300 |
subsection {* Connectedness of convex sets *} |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
1301 |
|
51480
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1302 |
lemma connectedD: |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1303 |
"connected S \<Longrightarrow> open A \<Longrightarrow> open B \<Longrightarrow> S \<subseteq> A \<union> B \<Longrightarrow> A \<inter> B \<inter> S = {} \<Longrightarrow> A \<inter> S = {} \<or> B \<inter> S = {}" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1304 |
by (metis connected_def) |
33175 | 1305 |
|
1306 |
lemma convex_connected: |
|
1307 |
fixes s :: "'a::real_normed_vector set" |
|
53302 | 1308 |
assumes "convex s" |
1309 |
shows "connected s" |
|
51480
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1310 |
proof (rule connectedI) |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1311 |
fix A B |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1312 |
assume "open A" "open B" "A \<inter> B \<inter> s = {}" "s \<subseteq> A \<union> B" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1313 |
moreover |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1314 |
assume "A \<inter> s \<noteq> {}" "B \<inter> s \<noteq> {}" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1315 |
then obtain a b where a: "a \<in> A" "a \<in> s" and b: "b \<in> B" "b \<in> s" by auto |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1316 |
def f \<equiv> "\<lambda>u. u *\<^sub>R a + (1 - u) *\<^sub>R b" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1317 |
then have "continuous_on {0 .. 1} f" |
56371
fb9ae0727548
extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents:
56369
diff
changeset
|
1318 |
by (auto intro!: continuous_intros) |
51480
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1319 |
then have "connected (f ` {0 .. 1})" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1320 |
by (auto intro!: connected_continuous_image) |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1321 |
note connectedD[OF this, of A B] |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1322 |
moreover have "a \<in> A \<inter> f ` {0 .. 1}" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1323 |
using a by (auto intro!: image_eqI[of _ _ 1] simp: f_def) |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1324 |
moreover have "b \<in> B \<inter> f ` {0 .. 1}" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1325 |
using b by (auto intro!: image_eqI[of _ _ 0] simp: f_def) |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1326 |
moreover have "f ` {0 .. 1} \<subseteq> s" |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1327 |
using `convex s` a b unfolding convex_def f_def by auto |
3793c3a11378
move connected to HOL image; used to show intermediate value theorem
hoelzl
parents:
51475
diff
changeset
|
1328 |
ultimately show False by auto |
33175 | 1329 |
qed |
1330 |
||
44467 | 1331 |
text {* One rather trivial consequence. *} |
33175 | 1332 |
|
34964 | 1333 |
lemma connected_UNIV[intro]: "connected (UNIV :: 'a::real_normed_vector set)" |
33175 | 1334 |
by(simp add: convex_connected convex_UNIV) |
1335 |
||
44467 | 1336 |
text {* Balls, being convex, are connected. *} |
33175 | 1337 |
|
56188 | 1338 |
lemma convex_prod: |
53347 | 1339 |
assumes "\<And>i. i \<in> Basis \<Longrightarrow> convex {x. P i x}" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
1340 |
shows "convex {x. \<forall>i\<in>Basis. P i (x\<bullet>i)}" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
1341 |
using assms unfolding convex_def |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
1342 |
by (auto simp: inner_add_left) |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
1343 |
|
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
1344 |
lemma convex_positive_orthant: "convex {x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i)}" |
56188 | 1345 |
by (rule convex_prod) (simp add: atLeast_def[symmetric] convex_real_interval) |
33175 | 1346 |
|
1347 |
lemma convex_local_global_minimum: |
|
1348 |
fixes s :: "'a::real_normed_vector set" |
|
53347 | 1349 |
assumes "e > 0" |
1350 |
and "convex_on s f" |
|
1351 |
and "ball x e \<subseteq> s" |
|
1352 |
and "\<forall>y\<in>ball x e. f x \<le> f y" |
|
33175 | 1353 |
shows "\<forall>y\<in>s. f x \<le> f y" |
53302 | 1354 |
proof (rule ccontr) |
1355 |
have "x \<in> s" using assms(1,3) by auto |
|
1356 |
assume "\<not> ?thesis" |
|
1357 |
then obtain y where "y\<in>s" and y: "f x > f y" by auto |
|
53347 | 1358 |
then have xy: "0 < dist x y" |
1359 |
by (auto simp add: dist_nz[symmetric]) |
|
1360 |
||
1361 |
then obtain u where "0 < u" "u \<le> 1" and u: "u < e / dist x y" |
|
56541 | 1362 |
using real_lbound_gt_zero[of 1 "e / dist x y"] xy `e>0` by auto |
53302 | 1363 |
then have "f ((1-u) *\<^sub>R x + u *\<^sub>R y) \<le> (1-u) * f x + u * f y" |
1364 |
using `x\<in>s` `y\<in>s` |
|
1365 |
using assms(2)[unfolded convex_on_def, |
|
1366 |
THEN bspec[where x=x], THEN bspec[where x=y], THEN spec[where x="1-u"]] |
|
50804 | 1367 |
by auto |
33175 | 1368 |
moreover |
50804 | 1369 |
have *: "x - ((1 - u) *\<^sub>R x + u *\<^sub>R y) = u *\<^sub>R (x - y)" |
1370 |
by (simp add: algebra_simps) |
|
1371 |
have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> ball x e" |
|
53302 | 1372 |
unfolding mem_ball dist_norm |
1373 |
unfolding * and norm_scaleR and abs_of_pos[OF `0<u`] |
|
50804 | 1374 |
unfolding dist_norm[symmetric] |
53302 | 1375 |
using u |
1376 |
unfolding pos_less_divide_eq[OF xy] |
|
1377 |
by auto |
|
1378 |
then have "f x \<le> f ((1 - u) *\<^sub>R x + u *\<^sub>R y)" |
|
1379 |
using assms(4) by auto |
|
50804 | 1380 |
ultimately show False |
53302 | 1381 |
using mult_strict_left_mono[OF y `u>0`] |
1382 |
unfolding left_diff_distrib |
|
1383 |
by auto |
|
33175 | 1384 |
qed |
1385 |
||
1386 |
lemma convex_ball: |
|
1387 |
fixes x :: "'a::real_normed_vector" |
|
49531 | 1388 |
shows "convex (ball x e)" |
50804 | 1389 |
proof (auto simp add: convex_def) |
1390 |
fix y z |
|
1391 |
assume yz: "dist x y < e" "dist x z < e" |
|
1392 |
fix u v :: real |
|
1393 |
assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1394 |
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z" |
|
1395 |
using uv yz |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1396 |
using convex_on_dist [of "ball x e" x, unfolded convex_on_def, |
53302 | 1397 |
THEN bspec[where x=y], THEN bspec[where x=z]] |
50804 | 1398 |
by auto |
1399 |
then show "dist x (u *\<^sub>R y + v *\<^sub>R z) < e" |
|
1400 |
using convex_bound_lt[OF yz uv] by auto |
|
33175 | 1401 |
qed |
1402 |
||
1403 |
lemma convex_cball: |
|
1404 |
fixes x :: "'a::real_normed_vector" |
|
53347 | 1405 |
shows "convex (cball x e)" |
1406 |
proof - |
|
1407 |
{ |
|
1408 |
fix y z |
|
1409 |
assume yz: "dist x y \<le> e" "dist x z \<le> e" |
|
1410 |
fix u v :: real |
|
1411 |
assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1412 |
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z" |
|
1413 |
using uv yz |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1414 |
using convex_on_dist [of "cball x e" x, unfolded convex_on_def, |
53347 | 1415 |
THEN bspec[where x=y], THEN bspec[where x=z]] |
1416 |
by auto |
|
1417 |
then have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e" |
|
1418 |
using convex_bound_le[OF yz uv] by auto |
|
1419 |
} |
|
1420 |
then show ?thesis by (auto simp add: convex_def Ball_def) |
|
33175 | 1421 |
qed |
1422 |
||
1423 |
lemma connected_ball: |
|
1424 |
fixes x :: "'a::real_normed_vector" |
|
1425 |
shows "connected (ball x e)" |
|
1426 |
using convex_connected convex_ball by auto |
|
1427 |
||
1428 |
lemma connected_cball: |
|
1429 |
fixes x :: "'a::real_normed_vector" |
|
53302 | 1430 |
shows "connected (cball x e)" |
33175 | 1431 |
using convex_connected convex_cball by auto |
1432 |
||
50804 | 1433 |
|
44467 | 1434 |
subsection {* Convex hull *} |
33175 | 1435 |
|
53302 | 1436 |
lemma convex_convex_hull: "convex (convex hull s)" |
1437 |
unfolding hull_def |
|
1438 |
using convex_Inter[of "{t. convex t \<and> s \<subseteq> t}"] |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1439 |
by auto |
33175 | 1440 |
|
34064
eee04bbbae7e
avoid dependency on implicit dest rule predicate1D in proofs
haftmann
parents:
33758
diff
changeset
|
1441 |
lemma convex_hull_eq: "convex hull s = s \<longleftrightarrow> convex s" |
50804 | 1442 |
by (metis convex_convex_hull hull_same) |
33175 | 1443 |
|
1444 |
lemma bounded_convex_hull: |
|
1445 |
fixes s :: "'a::real_normed_vector set" |
|
53347 | 1446 |
assumes "bounded s" |
1447 |
shows "bounded (convex hull s)" |
|
50804 | 1448 |
proof - |
1449 |
from assms obtain B where B: "\<forall>x\<in>s. norm x \<le> B" |
|
1450 |
unfolding bounded_iff by auto |
|
1451 |
show ?thesis |
|
1452 |
apply (rule bounded_subset[OF bounded_cball, of _ 0 B]) |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1453 |
unfolding subset_hull[of convex, OF convex_cball] |
53302 | 1454 |
unfolding subset_eq mem_cball dist_norm using B |
1455 |
apply auto |
|
50804 | 1456 |
done |
1457 |
qed |
|
33175 | 1458 |
|
1459 |
lemma finite_imp_bounded_convex_hull: |
|
1460 |
fixes s :: "'a::real_normed_vector set" |
|
53302 | 1461 |
shows "finite s \<Longrightarrow> bounded (convex hull s)" |
1462 |
using bounded_convex_hull finite_imp_bounded |
|
1463 |
by auto |
|
33175 | 1464 |
|
50804 | 1465 |
|
44467 | 1466 |
subsubsection {* Convex hull is "preserved" by a linear function *} |
40377 | 1467 |
|
1468 |
lemma convex_hull_linear_image: |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1469 |
assumes f: "linear f" |
40377 | 1470 |
shows "f ` (convex hull s) = convex hull (f ` s)" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1471 |
proof |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1472 |
show "convex hull (f ` s) \<subseteq> f ` (convex hull s)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1473 |
by (intro hull_minimal image_mono hull_subset convex_linear_image assms convex_convex_hull) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1474 |
show "f ` (convex hull s) \<subseteq> convex hull (f ` s)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1475 |
proof (unfold image_subset_iff_subset_vimage, rule hull_minimal) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1476 |
show "s \<subseteq> f -` (convex hull (f ` s))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1477 |
by (fast intro: hull_inc) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1478 |
show "convex (f -` (convex hull (f ` s)))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1479 |
by (intro convex_linear_vimage [OF f] convex_convex_hull) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1480 |
qed |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1481 |
qed |
40377 | 1482 |
|
1483 |
lemma in_convex_hull_linear_image: |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1484 |
assumes "linear f" |
53347 | 1485 |
and "x \<in> convex hull s" |
53339 | 1486 |
shows "f x \<in> convex hull (f ` s)" |
50804 | 1487 |
using convex_hull_linear_image[OF assms(1)] assms(2) by auto |
1488 |
||
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1489 |
lemma convex_hull_Times: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1490 |
"convex hull (s \<times> t) = (convex hull s) \<times> (convex hull t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1491 |
proof |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1492 |
show "convex hull (s \<times> t) \<subseteq> (convex hull s) \<times> (convex hull t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1493 |
by (intro hull_minimal Sigma_mono hull_subset convex_Times convex_convex_hull) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1494 |
have "\<forall>x\<in>convex hull s. \<forall>y\<in>convex hull t. (x, y) \<in> convex hull (s \<times> t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1495 |
proof (intro hull_induct) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1496 |
fix x y assume "x \<in> s" and "y \<in> t" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1497 |
then show "(x, y) \<in> convex hull (s \<times> t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1498 |
by (simp add: hull_inc) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1499 |
next |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1500 |
fix x let ?S = "((\<lambda>y. (0, y)) -` (\<lambda>p. (- x, 0) + p) ` (convex hull s \<times> t))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1501 |
have "convex ?S" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1502 |
by (intro convex_linear_vimage convex_translation convex_convex_hull, |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1503 |
simp add: linear_iff) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1504 |
also have "?S = {y. (x, y) \<in> convex hull (s \<times> t)}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1505 |
by (auto simp add: uminus_add_conv_diff image_def Bex_def) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1506 |
finally show "convex {y. (x, y) \<in> convex hull (s \<times> t)}" . |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1507 |
next |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1508 |
show "convex {x. \<forall>y\<in>convex hull t. (x, y) \<in> convex hull (s \<times> t)}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1509 |
proof (unfold Collect_ball_eq, rule convex_INT [rule_format]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1510 |
fix y let ?S = "((\<lambda>x. (x, 0)) -` (\<lambda>p. (0, - y) + p) ` (convex hull s \<times> t))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1511 |
have "convex ?S" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1512 |
by (intro convex_linear_vimage convex_translation convex_convex_hull, |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1513 |
simp add: linear_iff) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1514 |
also have "?S = {x. (x, y) \<in> convex hull (s \<times> t)}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1515 |
by (auto simp add: uminus_add_conv_diff image_def Bex_def) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1516 |
finally show "convex {x. (x, y) \<in> convex hull (s \<times> t)}" . |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1517 |
qed |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1518 |
qed |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1519 |
then show "(convex hull s) \<times> (convex hull t) \<subseteq> convex hull (s \<times> t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1520 |
unfolding subset_eq split_paired_Ball_Sigma . |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1521 |
qed |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
1522 |
|
40377 | 1523 |
|
44467 | 1524 |
subsubsection {* Stepping theorems for convex hulls of finite sets *} |
33175 | 1525 |
|
1526 |
lemma convex_hull_empty[simp]: "convex hull {} = {}" |
|
50804 | 1527 |
by (rule hull_unique) auto |
33175 | 1528 |
|
1529 |
lemma convex_hull_singleton[simp]: "convex hull {a} = {a}" |
|
50804 | 1530 |
by (rule hull_unique) auto |
33175 | 1531 |
|
1532 |
lemma convex_hull_insert: |
|
1533 |
fixes s :: "'a::real_vector set" |
|
1534 |
assumes "s \<noteq> {}" |
|
50804 | 1535 |
shows "convex hull (insert a s) = |
1536 |
{x. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. (u + v = 1) \<and> b \<in> (convex hull s) \<and> (x = u *\<^sub>R a + v *\<^sub>R b)}" |
|
53347 | 1537 |
(is "_ = ?hull") |
50804 | 1538 |
apply (rule, rule hull_minimal, rule) |
1539 |
unfolding insert_iff |
|
1540 |
prefer 3 |
|
1541 |
apply rule |
|
1542 |
proof - |
|
1543 |
fix x |
|
1544 |
assume x: "x = a \<or> x \<in> s" |
|
1545 |
then show "x \<in> ?hull" |
|
1546 |
apply rule |
|
1547 |
unfolding mem_Collect_eq |
|
1548 |
apply (rule_tac x=1 in exI) |
|
1549 |
defer |
|
1550 |
apply (rule_tac x=0 in exI) |
|
1551 |
using assms hull_subset[of s convex] |
|
1552 |
apply auto |
|
1553 |
done |
|
33175 | 1554 |
next |
50804 | 1555 |
fix x |
1556 |
assume "x \<in> ?hull" |
|
1557 |
then obtain u v b where obt: "u\<ge>0" "v\<ge>0" "u + v = 1" "b \<in> convex hull s" "x = u *\<^sub>R a + v *\<^sub>R b" |
|
1558 |
by auto |
|
53339 | 1559 |
have "a \<in> convex hull insert a s" "b \<in> convex hull insert a s" |
50804 | 1560 |
using hull_mono[of s "insert a s" convex] hull_mono[of "{a}" "insert a s" convex] and obt(4) |
1561 |
by auto |
|
1562 |
then show "x \<in> convex hull insert a s" |
|
53676 | 1563 |
unfolding obt(5) using obt(1-3) |
1564 |
by (rule convexD [OF convex_convex_hull]) |
|
33175 | 1565 |
next |
50804 | 1566 |
show "convex ?hull" |
53676 | 1567 |
proof (rule convexI) |
50804 | 1568 |
fix x y u v |
1569 |
assume as: "(0::real) \<le> u" "0 \<le> v" "u + v = 1" "x\<in>?hull" "y\<in>?hull" |
|
53339 | 1570 |
from as(4) obtain u1 v1 b1 where |
1571 |
obt1: "u1\<ge>0" "v1\<ge>0" "u1 + v1 = 1" "b1 \<in> convex hull s" "x = u1 *\<^sub>R a + v1 *\<^sub>R b1" |
|
1572 |
by auto |
|
1573 |
from as(5) obtain u2 v2 b2 where |
|
1574 |
obt2: "u2\<ge>0" "v2\<ge>0" "u2 + v2 = 1" "b2 \<in> convex hull s" "y = u2 *\<^sub>R a + v2 *\<^sub>R b2" |
|
1575 |
by auto |
|
50804 | 1576 |
have *: "\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x" |
1577 |
by (auto simp add: algebra_simps) |
|
1578 |
have **: "\<exists>b \<in> convex hull s. u *\<^sub>R x + v *\<^sub>R y = |
|
1579 |
(u * u1) *\<^sub>R a + (v * u2) *\<^sub>R a + (b - (u * u1) *\<^sub>R b - (v * u2) *\<^sub>R b)" |
|
1580 |
proof (cases "u * v1 + v * v2 = 0") |
|
1581 |
case True |
|
1582 |
have *: "\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x" |
|
1583 |
by (auto simp add: algebra_simps) |
|
1584 |
from True have ***: "u * v1 = 0" "v * v2 = 0" |
|
53302 | 1585 |
using mult_nonneg_nonneg[OF `u\<ge>0` `v1\<ge>0`] mult_nonneg_nonneg[OF `v\<ge>0` `v2\<ge>0`] |
1586 |
by arith+ |
|
50804 | 1587 |
then have "u * u1 + v * u2 = 1" |
1588 |
using as(3) obt1(3) obt2(3) by auto |
|
1589 |
then show ?thesis |
|
1590 |
unfolding obt1(5) obt2(5) * |
|
1591 |
using assms hull_subset[of s convex] |
|
1592 |
by (auto simp add: *** scaleR_right_distrib) |
|
33175 | 1593 |
next |
50804 | 1594 |
case False |
1595 |
have "1 - (u * u1 + v * u2) = (u + v) - (u * u1 + v * u2)" |
|
1596 |
using as(3) obt1(3) obt2(3) by (auto simp add: field_simps) |
|
1597 |
also have "\<dots> = u * (v1 + u1 - u1) + v * (v2 + u2 - u2)" |
|
1598 |
using as(3) obt1(3) obt2(3) by (auto simp add: field_simps) |
|
1599 |
also have "\<dots> = u * v1 + v * v2" |
|
1600 |
by simp |
|
1601 |
finally have **:"1 - (u * u1 + v * u2) = u * v1 + v * v2" by auto |
|
1602 |
have "0 \<le> u * v1 + v * v2" "0 \<le> u * v1" "0 \<le> u * v1 + v * v2" "0 \<le> v * v2" |
|
56536 | 1603 |
using as(1,2) obt1(1,2) obt2(1,2) by auto |
50804 | 1604 |
then show ?thesis |
1605 |
unfolding obt1(5) obt2(5) |
|
1606 |
unfolding * and ** |
|
1607 |
using False |
|
53339 | 1608 |
apply (rule_tac |
1609 |
x = "((u * v1) / (u * v1 + v * v2)) *\<^sub>R b1 + ((v * v2) / (u * v1 + v * v2)) *\<^sub>R b2" in bexI) |
|
50804 | 1610 |
defer |
53676 | 1611 |
apply (rule convexD [OF convex_convex_hull]) |
50804 | 1612 |
using obt1(4) obt2(4) |
49530 | 1613 |
unfolding add_divide_distrib[symmetric] and zero_le_divide_iff |
50804 | 1614 |
apply (auto simp add: scaleR_left_distrib scaleR_right_distrib) |
1615 |
done |
|
1616 |
qed |
|
1617 |
have u1: "u1 \<le> 1" |
|
1618 |
unfolding obt1(3)[symmetric] and not_le using obt1(2) by auto |
|
1619 |
have u2: "u2 \<le> 1" |
|
1620 |
unfolding obt2(3)[symmetric] and not_le using obt2(2) by auto |
|
53339 | 1621 |
have "u1 * u + u2 * v \<le> max u1 u2 * u + max u1 u2 * v" |
50804 | 1622 |
apply (rule add_mono) |
1623 |
apply (rule_tac [!] mult_right_mono) |
|
1624 |
using as(1,2) obt1(1,2) obt2(1,2) |
|
1625 |
apply auto |
|
1626 |
done |
|
1627 |
also have "\<dots> \<le> 1" |
|
1628 |
unfolding distrib_left[symmetric] and as(3) using u1 u2 by auto |
|
1629 |
finally show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull" |
|
1630 |
unfolding mem_Collect_eq |
|
1631 |
apply (rule_tac x="u * u1 + v * u2" in exI) |
|
1632 |
apply (rule conjI) |
|
1633 |
defer |
|
1634 |
apply (rule_tac x="1 - u * u1 - v * u2" in exI) |
|
1635 |
unfolding Bex_def |
|
1636 |
using as(1,2) obt1(1,2) obt2(1,2) ** |
|
56536 | 1637 |
apply (auto simp add: algebra_simps) |
50804 | 1638 |
done |
33175 | 1639 |
qed |
1640 |
qed |
|
1641 |
||
1642 |
||
44467 | 1643 |
subsubsection {* Explicit expression for convex hull *} |
33175 | 1644 |
|
1645 |
lemma convex_hull_indexed: |
|
1646 |
fixes s :: "'a::real_vector set" |
|
50804 | 1647 |
shows "convex hull s = |
53347 | 1648 |
{y. \<exists>k u x. |
1649 |
(\<forall>i\<in>{1::nat .. k}. 0 \<le> u i \<and> x i \<in> s) \<and> |
|
1650 |
(setsum u {1..k} = 1) \<and> (setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} = y)}" |
|
53339 | 1651 |
(is "?xyz = ?hull") |
50804 | 1652 |
apply (rule hull_unique) |
1653 |
apply rule |
|
1654 |
defer |
|
53676 | 1655 |
apply (rule convexI) |
50804 | 1656 |
proof - |
1657 |
fix x |
|
1658 |
assume "x\<in>s" |
|
1659 |
then show "x \<in> ?hull" |
|
1660 |
unfolding mem_Collect_eq |
|
1661 |
apply (rule_tac x=1 in exI, rule_tac x="\<lambda>x. 1" in exI) |
|
1662 |
apply auto |
|
1663 |
done |
|
33175 | 1664 |
next |
50804 | 1665 |
fix t |
1666 |
assume as: "s \<subseteq> t" "convex t" |
|
1667 |
show "?hull \<subseteq> t" |
|
1668 |
apply rule |
|
1669 |
unfolding mem_Collect_eq |
|
53302 | 1670 |
apply (elim exE conjE) |
50804 | 1671 |
proof - |
1672 |
fix x k u y |
|
1673 |
assume assm: |
|
1674 |
"\<forall>i\<in>{1::nat..k}. 0 \<le> u i \<and> y i \<in> s" |
|
1675 |
"setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R y i) = x" |
|
1676 |
show "x\<in>t" |
|
1677 |
unfolding assm(3) [symmetric] |
|
1678 |
apply (rule as(2)[unfolded convex, rule_format]) |
|
1679 |
using assm(1,2) as(1) apply auto |
|
1680 |
done |
|
1681 |
qed |
|
33175 | 1682 |
next |
50804 | 1683 |
fix x y u v |
53347 | 1684 |
assume uv: "0 \<le> u" "0 \<le> v" "u + v = (1::real)" |
1685 |
assume xy: "x \<in> ?hull" "y \<in> ?hull" |
|
50804 | 1686 |
from xy obtain k1 u1 x1 where |
53339 | 1687 |
x: "\<forall>i\<in>{1::nat..k1}. 0\<le>u1 i \<and> x1 i \<in> s" "setsum u1 {Suc 0..k1} = 1" "(\<Sum>i = Suc 0..k1. u1 i *\<^sub>R x1 i) = x" |
50804 | 1688 |
by auto |
1689 |
from xy obtain k2 u2 x2 where |
|
53339 | 1690 |
y: "\<forall>i\<in>{1::nat..k2}. 0\<le>u2 i \<and> x2 i \<in> s" "setsum u2 {Suc 0..k2} = 1" "(\<Sum>i = Suc 0..k2. u2 i *\<^sub>R x2 i) = y" |
50804 | 1691 |
by auto |
1692 |
have *: "\<And>P (x1::'a) x2 s1 s2 i. |
|
1693 |
(if P i then s1 else s2) *\<^sub>R (if P i then x1 else x2) = (if P i then s1 *\<^sub>R x1 else s2 *\<^sub>R x2)" |
|
33175 | 1694 |
"{1..k1 + k2} \<inter> {1..k1} = {1..k1}" "{1..k1 + k2} \<inter> - {1..k1} = (\<lambda>i. i + k1) ` {1..k2}" |
50804 | 1695 |
prefer 3 |
1696 |
apply (rule, rule) |
|
1697 |
unfolding image_iff |
|
1698 |
apply (rule_tac x = "x - k1" in bexI) |
|
1699 |
apply (auto simp add: not_le) |
|
1700 |
done |
|
1701 |
have inj: "inj_on (\<lambda>i. i + k1) {1..k2}" |
|
1702 |
unfolding inj_on_def by auto |
|
1703 |
show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull" |
|
1704 |
apply rule |
|
1705 |
apply (rule_tac x="k1 + k2" in exI) |
|
1706 |
apply (rule_tac x="\<lambda>i. if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)" in exI) |
|
1707 |
apply (rule_tac x="\<lambda>i. if i \<in> {1..k1} then x1 i else x2 (i - k1)" in exI) |
|
1708 |
apply (rule, rule) |
|
1709 |
defer |
|
1710 |
apply rule |
|
57418 | 1711 |
unfolding * and setsum.If_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and |
1712 |
setsum.reindex[OF inj] and o_def Collect_mem_eq |
|
50804 | 1713 |
unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] setsum_right_distrib[symmetric] |
1714 |
proof - |
|
1715 |
fix i |
|
1716 |
assume i: "i \<in> {1..k1+k2}" |
|
1717 |
show "0 \<le> (if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)) \<and> |
|
1718 |
(if i \<in> {1..k1} then x1 i else x2 (i - k1)) \<in> s" |
|
1719 |
proof (cases "i\<in>{1..k1}") |
|
1720 |
case True |
|
1721 |
then show ?thesis |
|
56536 | 1722 |
using uv(1) x(1)[THEN bspec[where x=i]] by auto |
50804 | 1723 |
next |
1724 |
case False |
|
1725 |
def j \<equiv> "i - k1" |
|
53347 | 1726 |
from i False have "j \<in> {1..k2}" |
1727 |
unfolding j_def by auto |
|
50804 | 1728 |
then show ?thesis |
56536 | 1729 |
using False uv(2) y(1)[THEN bspec[where x=j]] |
1730 |
by (auto simp: j_def[symmetric]) |
|
50804 | 1731 |
qed |
1732 |
qed (auto simp add: not_le x(2,3) y(2,3) uv(3)) |
|
33175 | 1733 |
qed |
1734 |
||
1735 |
lemma convex_hull_finite: |
|
1736 |
fixes s :: "'a::real_vector set" |
|
1737 |
assumes "finite s" |
|
1738 |
shows "convex hull s = {y. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> |
|
53339 | 1739 |
setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}" |
1740 |
(is "?HULL = ?set") |
|
50804 | 1741 |
proof (rule hull_unique, auto simp add: convex_def[of ?set]) |
1742 |
fix x |
|
1743 |
assume "x \<in> s" |
|
1744 |
then show "\<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = x" |
|
1745 |
apply (rule_tac x="\<lambda>y. if x=y then 1 else 0" in exI) |
|
1746 |
apply auto |
|
57418 | 1747 |
unfolding setsum.delta'[OF assms] and setsum_delta''[OF assms] |
50804 | 1748 |
apply auto |
1749 |
done |
|
33175 | 1750 |
next |
50804 | 1751 |
fix u v :: real |
1752 |
assume uv: "0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1753 |
fix ux assume ux: "\<forall>x\<in>s. 0 \<le> ux x" "setsum ux s = (1::real)" |
|
1754 |
fix uy assume uy: "\<forall>x\<in>s. 0 \<le> uy x" "setsum uy s = (1::real)" |
|
53339 | 1755 |
{ |
1756 |
fix x |
|
50804 | 1757 |
assume "x\<in>s" |
1758 |
then have "0 \<le> u * ux x + v * uy x" |
|
1759 |
using ux(1)[THEN bspec[where x=x]] uy(1)[THEN bspec[where x=x]] and uv(1,2) |
|
56536 | 1760 |
by auto |
50804 | 1761 |
} |
1762 |
moreover |
|
1763 |
have "(\<Sum>x\<in>s. u * ux x + v * uy x) = 1" |
|
57418 | 1764 |
unfolding setsum.distrib and setsum_right_distrib[symmetric] and ux(2) uy(2) |
53302 | 1765 |
using uv(3) by auto |
50804 | 1766 |
moreover |
1767 |
have "(\<Sum>x\<in>s. (u * ux x + v * uy x) *\<^sub>R x) = u *\<^sub>R (\<Sum>x\<in>s. ux x *\<^sub>R x) + v *\<^sub>R (\<Sum>x\<in>s. uy x *\<^sub>R x)" |
|
57418 | 1768 |
unfolding scaleR_left_distrib and setsum.distrib and scaleR_scaleR[symmetric] |
53339 | 1769 |
and scaleR_right.setsum [symmetric] |
50804 | 1770 |
by auto |
1771 |
ultimately |
|
1772 |
show "\<exists>uc. (\<forall>x\<in>s. 0 \<le> uc x) \<and> setsum uc s = 1 \<and> |
|
1773 |
(\<Sum>x\<in>s. uc x *\<^sub>R x) = u *\<^sub>R (\<Sum>x\<in>s. ux x *\<^sub>R x) + v *\<^sub>R (\<Sum>x\<in>s. uy x *\<^sub>R x)" |
|
1774 |
apply (rule_tac x="\<lambda>x. u * ux x + v * uy x" in exI) |
|
1775 |
apply auto |
|
1776 |
done |
|
33175 | 1777 |
next |
50804 | 1778 |
fix t |
1779 |
assume t: "s \<subseteq> t" "convex t" |
|
1780 |
fix u |
|
1781 |
assume u: "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = (1::real)" |
|
1782 |
then show "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> t" |
|
1783 |
using t(2)[unfolded convex_explicit, THEN spec[where x=s], THEN spec[where x=u]] |
|
33175 | 1784 |
using assms and t(1) by auto |
1785 |
qed |
|
1786 |
||
50804 | 1787 |
|
44467 | 1788 |
subsubsection {* Another formulation from Lars Schewe *} |
33175 | 1789 |
|
1790 |
lemma setsum_constant_scaleR: |
|
1791 |
fixes y :: "'a::real_vector" |
|
1792 |
shows "(\<Sum>x\<in>A. y) = of_nat (card A) *\<^sub>R y" |
|
50804 | 1793 |
apply (cases "finite A") |
1794 |
apply (induct set: finite) |
|
1795 |
apply (simp_all add: algebra_simps) |
|
1796 |
done |
|
33175 | 1797 |
|
1798 |
lemma convex_hull_explicit: |
|
1799 |
fixes p :: "'a::real_vector set" |
|
53347 | 1800 |
shows "convex hull p = |
1801 |
{y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}" |
|
53339 | 1802 |
(is "?lhs = ?rhs") |
50804 | 1803 |
proof - |
53302 | 1804 |
{ |
1805 |
fix x |
|
1806 |
assume "x\<in>?lhs" |
|
50804 | 1807 |
then obtain k u y where |
1808 |
obt: "\<forall>i\<in>{1::nat..k}. 0 \<le> u i \<and> y i \<in> p" "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R y i) = x" |
|
33175 | 1809 |
unfolding convex_hull_indexed by auto |
1810 |
||
50804 | 1811 |
have fin: "finite {1..k}" by auto |
1812 |
have fin': "\<And>v. finite {i \<in> {1..k}. y i = v}" by auto |
|
53302 | 1813 |
{ |
1814 |
fix j |
|
50804 | 1815 |
assume "j\<in>{1..k}" |
1816 |
then have "y j \<in> p" "0 \<le> setsum u {i. Suc 0 \<le> i \<and> i \<le> k \<and> y i = y j}" |
|
1817 |
using obt(1)[THEN bspec[where x=j]] and obt(2) |
|
1818 |
apply simp |
|
1819 |
apply (rule setsum_nonneg) |
|
1820 |
using obt(1) |
|
1821 |
apply auto |
|
1822 |
done |
|
1823 |
} |
|
33175 | 1824 |
moreover |
49531 | 1825 |
have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v}) = 1" |
49530 | 1826 |
unfolding setsum_image_gen[OF fin, symmetric] using obt(2) by auto |
33175 | 1827 |
moreover have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v} *\<^sub>R v) = x" |
49530 | 1828 |
using setsum_image_gen[OF fin, of "\<lambda>i. u i *\<^sub>R y i" y, symmetric] |
33175 | 1829 |
unfolding scaleR_left.setsum using obt(3) by auto |
50804 | 1830 |
ultimately |
1831 |
have "\<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
1832 |
apply (rule_tac x="y ` {1..k}" in exI) |
|
1833 |
apply (rule_tac x="\<lambda>v. setsum u {i\<in>{1..k}. y i = v}" in exI) |
|
1834 |
apply auto |
|
1835 |
done |
|
1836 |
then have "x\<in>?rhs" by auto |
|
1837 |
} |
|
33175 | 1838 |
moreover |
53302 | 1839 |
{ |
1840 |
fix y |
|
1841 |
assume "y\<in>?rhs" |
|
50804 | 1842 |
then obtain s u where |
53339 | 1843 |
obt: "finite s" "s \<subseteq> p" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
1844 |
by auto |
|
50804 | 1845 |
|
1846 |
obtain f where f: "inj_on f {1..card s}" "f ` {1..card s} = s" |
|
1847 |
using ex_bij_betw_nat_finite_1[OF obt(1)] unfolding bij_betw_def by auto |
|
1848 |
||
53302 | 1849 |
{ |
1850 |
fix i :: nat |
|
50804 | 1851 |
assume "i\<in>{1..card s}" |
1852 |
then have "f i \<in> s" |
|
1853 |
apply (subst f(2)[symmetric]) |
|
1854 |
apply auto |
|
1855 |
done |
|
1856 |
then have "0 \<le> u (f i)" "f i \<in> p" using obt(2,3) by auto |
|
1857 |
} |
|
53347 | 1858 |
moreover have *: "finite {1..card s}" by auto |
53302 | 1859 |
{ |
1860 |
fix y |
|
50804 | 1861 |
assume "y\<in>s" |
53302 | 1862 |
then obtain i where "i\<in>{1..card s}" "f i = y" |
1863 |
using f using image_iff[of y f "{1..card s}"] |
|
50804 | 1864 |
by auto |
1865 |
then have "{x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = {i}" |
|
1866 |
apply auto |
|
1867 |
using f(1)[unfolded inj_on_def] |
|
1868 |
apply(erule_tac x=x in ballE) |
|
1869 |
apply auto |
|
1870 |
done |
|
1871 |
then have "card {x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = 1" by auto |
|
1872 |
then have "(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x)) = u y" |
|
1873 |
"(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x) *\<^sub>R f x) = u y *\<^sub>R y" |
|
1874 |
by (auto simp add: setsum_constant_scaleR) |
|
1875 |
} |
|
1876 |
then have "(\<Sum>x = 1..card s. u (f x)) = 1" "(\<Sum>i = 1..card s. u (f i) *\<^sub>R f i) = y" |
|
53339 | 1877 |
unfolding setsum_image_gen[OF *(1), of "\<lambda>x. u (f x) *\<^sub>R f x" f] |
1878 |
and setsum_image_gen[OF *(1), of "\<lambda>x. u (f x)" f] |
|
1879 |
unfolding f |
|
57418 | 1880 |
using setsum.cong [of s s "\<lambda>y. (\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x) *\<^sub>R f x)" "\<lambda>v. u v *\<^sub>R v"] |
1881 |
using setsum.cong [of s s "\<lambda>y. (\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x))" u] |
|
53302 | 1882 |
unfolding obt(4,5) |
1883 |
by auto |
|
50804 | 1884 |
ultimately |
1885 |
have "\<exists>k u x. (\<forall>i\<in>{1..k}. 0 \<le> u i \<and> x i \<in> p) \<and> setsum u {1..k} = 1 \<and> |
|
1886 |
(\<Sum>i::nat = 1..k. u i *\<^sub>R x i) = y" |
|
1887 |
apply (rule_tac x="card s" in exI) |
|
1888 |
apply (rule_tac x="u \<circ> f" in exI) |
|
1889 |
apply (rule_tac x=f in exI) |
|
1890 |
apply fastforce |
|
1891 |
done |
|
53302 | 1892 |
then have "y \<in> ?lhs" |
1893 |
unfolding convex_hull_indexed by auto |
|
50804 | 1894 |
} |
53302 | 1895 |
ultimately show ?thesis |
1896 |
unfolding set_eq_iff by blast |
|
33175 | 1897 |
qed |
1898 |
||
50804 | 1899 |
|
44467 | 1900 |
subsubsection {* A stepping theorem for that expansion *} |
33175 | 1901 |
|
1902 |
lemma convex_hull_finite_step: |
|
50804 | 1903 |
fixes s :: "'a::real_vector set" |
1904 |
assumes "finite s" |
|
53302 | 1905 |
shows |
1906 |
"(\<exists>u. (\<forall>x\<in>insert a s. 0 \<le> u x) \<and> setsum u (insert a s) = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) (insert a s) = y) |
|
1907 |
\<longleftrightarrow> (\<exists>v\<ge>0. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = w - v \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y - v *\<^sub>R a)" |
|
1908 |
(is "?lhs = ?rhs") |
|
50804 | 1909 |
proof (rule, case_tac[!] "a\<in>s") |
53302 | 1910 |
assume "a \<in> s" |
53339 | 1911 |
then have *: "insert a s = s" by auto |
50804 | 1912 |
assume ?lhs |
1913 |
then show ?rhs |
|
1914 |
unfolding * |
|
1915 |
apply (rule_tac x=0 in exI) |
|
1916 |
apply auto |
|
1917 |
done |
|
33175 | 1918 |
next |
50804 | 1919 |
assume ?lhs |
53302 | 1920 |
then obtain u where |
1921 |
u: "\<forall>x\<in>insert a s. 0 \<le> u x" "setsum u (insert a s) = w" "(\<Sum>x\<in>insert a s. u x *\<^sub>R x) = y" |
|
50804 | 1922 |
by auto |
1923 |
assume "a \<notin> s" |
|
1924 |
then show ?rhs |
|
1925 |
apply (rule_tac x="u a" in exI) |
|
1926 |
using u(1)[THEN bspec[where x=a]] |
|
1927 |
apply simp |
|
1928 |
apply (rule_tac x=u in exI) |
|
1929 |
using u[unfolded setsum_clauses(2)[OF assms]] and `a\<notin>s` |
|
1930 |
apply auto |
|
1931 |
done |
|
33175 | 1932 |
next |
50804 | 1933 |
assume "a \<in> s" |
1934 |
then have *: "insert a s = s" by auto |
|
1935 |
have fin: "finite (insert a s)" using assms by auto |
|
1936 |
assume ?rhs |
|
1937 |
then obtain v u where uv: "v\<ge>0" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = w - v" "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a" |
|
1938 |
by auto |
|
1939 |
show ?lhs |
|
1940 |
apply (rule_tac x = "\<lambda>x. (if a = x then v else 0) + u x" in exI) |
|
57418 | 1941 |
unfolding scaleR_left_distrib and setsum.distrib and setsum_delta''[OF fin] and setsum.delta'[OF fin] |
50804 | 1942 |
unfolding setsum_clauses(2)[OF assms] |
1943 |
using uv and uv(2)[THEN bspec[where x=a]] and `a\<in>s` |
|
1944 |
apply auto |
|
1945 |
done |
|
33175 | 1946 |
next |
50804 | 1947 |
assume ?rhs |
53339 | 1948 |
then obtain v u where |
1949 |
uv: "v\<ge>0" "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = w - v" "(\<Sum>x\<in>s. u x *\<^sub>R x) = y - v *\<^sub>R a" |
|
50804 | 1950 |
by auto |
1951 |
moreover |
|
1952 |
assume "a \<notin> s" |
|
1953 |
moreover |
|
53302 | 1954 |
have "(\<Sum>x\<in>s. if a = x then v else u x) = setsum u s" |
1955 |
and "(\<Sum>x\<in>s. (if a = x then v else u x) *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" |
|
57418 | 1956 |
apply (rule_tac setsum.cong) apply rule |
50804 | 1957 |
defer |
57418 | 1958 |
apply (rule_tac setsum.cong) apply rule |
50804 | 1959 |
using `a \<notin> s` |
1960 |
apply auto |
|
1961 |
done |
|
1962 |
ultimately show ?lhs |
|
1963 |
apply (rule_tac x="\<lambda>x. if a = x then v else u x" in exI) |
|
1964 |
unfolding setsum_clauses(2)[OF assms] |
|
1965 |
apply auto |
|
1966 |
done |
|
1967 |
qed |
|
1968 |
||
33175 | 1969 |
|
44467 | 1970 |
subsubsection {* Hence some special cases *} |
33175 | 1971 |
|
1972 |
lemma convex_hull_2: |
|
1973 |
"convex hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b | u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v = 1}" |
|
53302 | 1974 |
proof - |
1975 |
have *: "\<And>u. (\<forall>x\<in>{a, b}. 0 \<le> u x) \<longleftrightarrow> 0 \<le> u a \<and> 0 \<le> u b" |
|
1976 |
by auto |
|
1977 |
have **: "finite {b}" by auto |
|
1978 |
show ?thesis |
|
1979 |
apply (simp add: convex_hull_finite) |
|
1980 |
unfolding convex_hull_finite_step[OF **, of a 1, unfolded * conj_assoc] |
|
1981 |
apply auto |
|
1982 |
apply (rule_tac x=v in exI) |
|
1983 |
apply (rule_tac x="1 - v" in exI) |
|
1984 |
apply simp |
|
1985 |
apply (rule_tac x=u in exI) |
|
1986 |
apply simp |
|
1987 |
apply (rule_tac x="\<lambda>x. v" in exI) |
|
1988 |
apply simp |
|
1989 |
done |
|
1990 |
qed |
|
33175 | 1991 |
|
1992 |
lemma convex_hull_2_alt: "convex hull {a,b} = {a + u *\<^sub>R (b - a) | u. 0 \<le> u \<and> u \<le> 1}" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1993 |
unfolding convex_hull_2 |
53302 | 1994 |
proof (rule Collect_cong) |
1995 |
have *: "\<And>x y ::real. x + y = 1 \<longleftrightarrow> x = 1 - y" |
|
1996 |
by auto |
|
1997 |
fix x |
|
1998 |
show "(\<exists>v u. x = v *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> v \<and> 0 \<le> u \<and> v + u = 1) \<longleftrightarrow> |
|
1999 |
(\<exists>u. x = a + u *\<^sub>R (b - a) \<and> 0 \<le> u \<and> u \<le> 1)" |
|
2000 |
unfolding * |
|
2001 |
apply auto |
|
2002 |
apply (rule_tac[!] x=u in exI) |
|
2003 |
apply (auto simp add: algebra_simps) |
|
2004 |
done |
|
2005 |
qed |
|
33175 | 2006 |
|
2007 |
lemma convex_hull_3: |
|
2008 |
"convex hull {a,b,c} = { u *\<^sub>R a + v *\<^sub>R b + w *\<^sub>R c | u v w. 0 \<le> u \<and> 0 \<le> v \<and> 0 \<le> w \<and> u + v + w = 1}" |
|
53302 | 2009 |
proof - |
2010 |
have fin: "finite {a,b,c}" "finite {b,c}" "finite {c}" |
|
2011 |
by auto |
|
2012 |
have *: "\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z" |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
2013 |
by (auto simp add: field_simps) |
53302 | 2014 |
show ?thesis |
2015 |
unfolding convex_hull_finite[OF fin(1)] and convex_hull_finite_step[OF fin(2)] and * |
|
2016 |
unfolding convex_hull_finite_step[OF fin(3)] |
|
2017 |
apply (rule Collect_cong) |
|
2018 |
apply simp |
|
2019 |
apply auto |
|
2020 |
apply (rule_tac x=va in exI) |
|
2021 |
apply (rule_tac x="u c" in exI) |
|
2022 |
apply simp |
|
2023 |
apply (rule_tac x="1 - v - w" in exI) |
|
2024 |
apply simp |
|
2025 |
apply (rule_tac x=v in exI) |
|
2026 |
apply simp |
|
2027 |
apply (rule_tac x="\<lambda>x. w" in exI) |
|
2028 |
apply simp |
|
2029 |
done |
|
2030 |
qed |
|
33175 | 2031 |
|
2032 |
lemma convex_hull_3_alt: |
|
2033 |
"convex hull {a,b,c} = {a + u *\<^sub>R (b - a) + v *\<^sub>R (c - a) | u v. 0 \<le> u \<and> 0 \<le> v \<and> u + v \<le> 1}" |
|
53302 | 2034 |
proof - |
2035 |
have *: "\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z" |
|
2036 |
by auto |
|
2037 |
show ?thesis |
|
2038 |
unfolding convex_hull_3 |
|
2039 |
apply (auto simp add: *) |
|
2040 |
apply (rule_tac x=v in exI) |
|
2041 |
apply (rule_tac x=w in exI) |
|
2042 |
apply (simp add: algebra_simps) |
|
2043 |
apply (rule_tac x=u in exI) |
|
2044 |
apply (rule_tac x=v in exI) |
|
2045 |
apply (simp add: algebra_simps) |
|
2046 |
done |
|
2047 |
qed |
|
2048 |
||
33175 | 2049 |
|
44467 | 2050 |
subsection {* Relations among closure notions and corresponding hulls *} |
33175 | 2051 |
|
2052 |
lemma affine_imp_convex: "affine s \<Longrightarrow> convex s" |
|
2053 |
unfolding affine_def convex_def by auto |
|
2054 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
2055 |
lemma subspace_imp_convex: "subspace s \<Longrightarrow> convex s" |
33175 | 2056 |
using subspace_imp_affine affine_imp_convex by auto |
2057 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
2058 |
lemma affine_hull_subset_span: "(affine hull s) \<subseteq> (span s)" |
53302 | 2059 |
by (metis hull_minimal span_inc subspace_imp_affine subspace_span) |
33175 | 2060 |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
2061 |
lemma convex_hull_subset_span: "(convex hull s) \<subseteq> (span s)" |
53302 | 2062 |
by (metis hull_minimal span_inc subspace_imp_convex subspace_span) |
33175 | 2063 |
|
2064 |
lemma convex_hull_subset_affine_hull: "(convex hull s) \<subseteq> (affine hull s)" |
|
53302 | 2065 |
by (metis affine_affine_hull affine_imp_convex hull_minimal hull_subset) |
2066 |
||
2067 |
||
2068 |
lemma affine_dependent_imp_dependent: "affine_dependent s \<Longrightarrow> dependent s" |
|
49531 | 2069 |
unfolding affine_dependent_def dependent_def |
33175 | 2070 |
using affine_hull_subset_span by auto |
2071 |
||
2072 |
lemma dependent_imp_affine_dependent: |
|
53302 | 2073 |
assumes "dependent {x - a| x . x \<in> s}" |
2074 |
and "a \<notin> s" |
|
33175 | 2075 |
shows "affine_dependent (insert a s)" |
53302 | 2076 |
proof - |
49531 | 2077 |
from assms(1)[unfolded dependent_explicit] obtain S u v |
53347 | 2078 |
where obt: "finite S" "S \<subseteq> {x - a |x. x \<in> s}" "v\<in>S" "u v \<noteq> 0" "(\<Sum>v\<in>S. u v *\<^sub>R v) = 0" |
2079 |
by auto |
|
33175 | 2080 |
def t \<equiv> "(\<lambda>x. x + a) ` S" |
2081 |
||
53347 | 2082 |
have inj: "inj_on (\<lambda>x. x + a) S" |
53302 | 2083 |
unfolding inj_on_def by auto |
2084 |
have "0 \<notin> S" |
|
2085 |
using obt(2) assms(2) unfolding subset_eq by auto |
|
53347 | 2086 |
have fin: "finite t" and "t \<subseteq> s" |
53302 | 2087 |
unfolding t_def using obt(1,2) by auto |
2088 |
then have "finite (insert a t)" and "insert a t \<subseteq> insert a s" |
|
2089 |
by auto |
|
2090 |
moreover have *: "\<And>P Q. (\<Sum>x\<in>t. (if x = a then P x else Q x)) = (\<Sum>x\<in>t. Q x)" |
|
57418 | 2091 |
apply (rule setsum.cong) |
53302 | 2092 |
using `a\<notin>s` `t\<subseteq>s` |
2093 |
apply auto |
|
2094 |
done |
|
33175 | 2095 |
have "(\<Sum>x\<in>insert a t. if x = a then - (\<Sum>x\<in>t. u (x - a)) else u (x - a)) = 0" |
53302 | 2096 |
unfolding setsum_clauses(2)[OF fin] |
2097 |
using `a\<notin>s` `t\<subseteq>s` |
|
2098 |
apply auto |
|
2099 |
unfolding * |
|
2100 |
apply auto |
|
2101 |
done |
|
33175 | 2102 |
moreover have "\<exists>v\<in>insert a t. (if v = a then - (\<Sum>x\<in>t. u (x - a)) else u (v - a)) \<noteq> 0" |
53302 | 2103 |
apply (rule_tac x="v + a" in bexI) |
2104 |
using obt(3,4) and `0\<notin>S` |
|
2105 |
unfolding t_def |
|
2106 |
apply auto |
|
2107 |
done |
|
2108 |
moreover have *: "\<And>P Q. (\<Sum>x\<in>t. (if x = a then P x else Q x) *\<^sub>R x) = (\<Sum>x\<in>t. Q x *\<^sub>R x)" |
|
57418 | 2109 |
apply (rule setsum.cong) |
53302 | 2110 |
using `a\<notin>s` `t\<subseteq>s` |
2111 |
apply auto |
|
2112 |
done |
|
49531 | 2113 |
have "(\<Sum>x\<in>t. u (x - a)) *\<^sub>R a = (\<Sum>v\<in>t. u (v - a) *\<^sub>R v)" |
53302 | 2114 |
unfolding scaleR_left.setsum |
57418 | 2115 |
unfolding t_def and setsum.reindex[OF inj] and o_def |
53302 | 2116 |
using obt(5) |
57418 | 2117 |
by (auto simp add: setsum.distrib scaleR_right_distrib) |
53302 | 2118 |
then have "(\<Sum>v\<in>insert a t. (if v = a then - (\<Sum>x\<in>t. u (x - a)) else u (v - a)) *\<^sub>R v) = 0" |
2119 |
unfolding setsum_clauses(2)[OF fin] |
|
2120 |
using `a\<notin>s` `t\<subseteq>s` |
|
2121 |
by (auto simp add: *) |
|
2122 |
ultimately show ?thesis |
|
2123 |
unfolding affine_dependent_explicit |
|
2124 |
apply (rule_tac x="insert a t" in exI) |
|
2125 |
apply auto |
|
2126 |
done |
|
33175 | 2127 |
qed |
2128 |
||
2129 |
lemma convex_cone: |
|
53302 | 2130 |
"convex s \<and> cone s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>y\<in>s. (x + y) \<in> s) \<and> (\<forall>x\<in>s. \<forall>c\<ge>0. (c *\<^sub>R x) \<in> s)" |
2131 |
(is "?lhs = ?rhs") |
|
2132 |
proof - |
|
2133 |
{ |
|
2134 |
fix x y |
|
2135 |
assume "x\<in>s" "y\<in>s" and ?lhs |
|
2136 |
then have "2 *\<^sub>R x \<in>s" "2 *\<^sub>R y \<in> s" |
|
2137 |
unfolding cone_def by auto |
|
2138 |
then have "x + y \<in> s" |
|
2139 |
using `?lhs`[unfolded convex_def, THEN conjunct1] |
|
2140 |
apply (erule_tac x="2*\<^sub>R x" in ballE) |
|
2141 |
apply (erule_tac x="2*\<^sub>R y" in ballE) |
|
2142 |
apply (erule_tac x="1/2" in allE) |
|
2143 |
apply simp |
|
2144 |
apply (erule_tac x="1/2" in allE) |
|
2145 |
apply auto |
|
2146 |
done |
|
2147 |
} |
|
2148 |
then show ?thesis |
|
2149 |
unfolding convex_def cone_def by blast |
|
2150 |
qed |
|
2151 |
||
2152 |
lemma affine_dependent_biggerset: |
|
53347 | 2153 |
fixes s :: "'a::euclidean_space set" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2154 |
assumes "finite s" "card s \<ge> DIM('a) + 2" |
33175 | 2155 |
shows "affine_dependent s" |
53302 | 2156 |
proof - |
2157 |
have "s \<noteq> {}" using assms by auto |
|
2158 |
then obtain a where "a\<in>s" by auto |
|
2159 |
have *: "{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})" |
|
2160 |
by auto |
|
2161 |
have "card {x - a |x. x \<in> s - {a}} = card (s - {a})" |
|
2162 |
unfolding * |
|
2163 |
apply (rule card_image) |
|
2164 |
unfolding inj_on_def |
|
2165 |
apply auto |
|
2166 |
done |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2167 |
also have "\<dots> > DIM('a)" using assms(2) |
33175 | 2168 |
unfolding card_Diff_singleton[OF assms(1) `a\<in>s`] by auto |
53302 | 2169 |
finally show ?thesis |
2170 |
apply (subst insert_Diff[OF `a\<in>s`, symmetric]) |
|
2171 |
apply (rule dependent_imp_affine_dependent) |
|
2172 |
apply (rule dependent_biggerset) |
|
2173 |
apply auto |
|
2174 |
done |
|
2175 |
qed |
|
33175 | 2176 |
|
2177 |
lemma affine_dependent_biggerset_general: |
|
53347 | 2178 |
assumes "finite (s :: 'a::euclidean_space set)" |
2179 |
and "card s \<ge> dim s + 2" |
|
33175 | 2180 |
shows "affine_dependent s" |
53302 | 2181 |
proof - |
33175 | 2182 |
from assms(2) have "s \<noteq> {}" by auto |
2183 |
then obtain a where "a\<in>s" by auto |
|
53302 | 2184 |
have *: "{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})" |
2185 |
by auto |
|
2186 |
have **: "card {x - a |x. x \<in> s - {a}} = card (s - {a})" |
|
2187 |
unfolding * |
|
2188 |
apply (rule card_image) |
|
2189 |
unfolding inj_on_def |
|
2190 |
apply auto |
|
2191 |
done |
|
33175 | 2192 |
have "dim {x - a |x. x \<in> s - {a}} \<le> dim s" |
53302 | 2193 |
apply (rule subset_le_dim) |
2194 |
unfolding subset_eq |
|
2195 |
using `a\<in>s` |
|
2196 |
apply (auto simp add:span_superset span_sub) |
|
2197 |
done |
|
33175 | 2198 |
also have "\<dots> < dim s + 1" by auto |
53302 | 2199 |
also have "\<dots> \<le> card (s - {a})" |
2200 |
using assms |
|
2201 |
using card_Diff_singleton[OF assms(1) `a\<in>s`] |
|
2202 |
by auto |
|
2203 |
finally show ?thesis |
|
2204 |
apply (subst insert_Diff[OF `a\<in>s`, symmetric]) |
|
2205 |
apply (rule dependent_imp_affine_dependent) |
|
2206 |
apply (rule dependent_biggerset_general) |
|
2207 |
unfolding ** |
|
2208 |
apply auto |
|
2209 |
done |
|
2210 |
qed |
|
2211 |
||
33175 | 2212 |
|
2213 |
subsection {* Caratheodory's theorem. *} |
|
2214 |
||
53302 | 2215 |
lemma convex_hull_caratheodory: |
2216 |
fixes p :: "('a::euclidean_space) set" |
|
2217 |
shows "convex hull p = |
|
2218 |
{y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> |
|
2219 |
(\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
2220 |
unfolding convex_hull_explicit set_eq_iff mem_Collect_eq |
53302 | 2221 |
proof (rule, rule) |
2222 |
fix y |
|
2223 |
let ?P = "\<lambda>n. \<exists>s u. finite s \<and> card s = n \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> |
|
2224 |
setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
|
33175 | 2225 |
assume "\<exists>s u. finite s \<and> s \<subseteq> p \<and> (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
2226 |
then obtain N where "?P N" by auto |
|
53302 | 2227 |
then have "\<exists>n\<le>N. (\<forall>k<n. \<not> ?P k) \<and> ?P n" |
2228 |
apply (rule_tac ex_least_nat_le) |
|
2229 |
apply auto |
|
2230 |
done |
|
2231 |
then obtain n where "?P n" and smallest: "\<forall>k<n. \<not> ?P k" |
|
2232 |
by blast |
|
2233 |
then obtain s u where obt: "finite s" "card s = n" "s\<subseteq>p" "\<forall>x\<in>s. 0 \<le> u x" |
|
2234 |
"setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = y" by auto |
|
2235 |
||
2236 |
have "card s \<le> DIM('a) + 1" |
|
2237 |
proof (rule ccontr, simp only: not_le) |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2238 |
assume "DIM('a) + 1 < card s" |
53302 | 2239 |
then have "affine_dependent s" |
2240 |
using affine_dependent_biggerset[OF obt(1)] by auto |
|
2241 |
then obtain w v where wv: "setsum w s = 0" "v\<in>s" "w v \<noteq> 0" "(\<Sum>v\<in>s. w v *\<^sub>R v) = 0" |
|
33175 | 2242 |
using affine_dependent_explicit_finite[OF obt(1)] by auto |
53302 | 2243 |
def i \<equiv> "(\<lambda>v. (u v) / (- w v)) ` {v\<in>s. w v < 0}" |
2244 |
def t \<equiv> "Min i" |
|
2245 |
have "\<exists>x\<in>s. w x < 0" |
|
2246 |
proof (rule ccontr, simp add: not_less) |
|
33175 | 2247 |
assume as:"\<forall>x\<in>s. 0 \<le> w x" |
53302 | 2248 |
then have "setsum w (s - {v}) \<ge> 0" |
2249 |
apply (rule_tac setsum_nonneg) |
|
2250 |
apply auto |
|
2251 |
done |
|
2252 |
then have "setsum w s > 0" |
|
57418 | 2253 |
unfolding setsum.remove[OF obt(1) `v\<in>s`] |
53302 | 2254 |
using as[THEN bspec[where x=v]] and `v\<in>s` |
2255 |
using `w v \<noteq> 0` |
|
2256 |
by auto |
|
2257 |
then show False using wv(1) by auto |
|
2258 |
qed |
|
2259 |
then have "i \<noteq> {}" unfolding i_def by auto |
|
2260 |
||
2261 |
then have "t \<ge> 0" |
|
2262 |
using Min_ge_iff[of i 0 ] and obt(1) |
|
2263 |
unfolding t_def i_def |
|
2264 |
using obt(4)[unfolded le_less] |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
2265 |
by (auto simp: divide_le_0_iff) |
53302 | 2266 |
have t: "\<forall>v\<in>s. u v + t * w v \<ge> 0" |
2267 |
proof |
|
2268 |
fix v |
|
2269 |
assume "v \<in> s" |
|
2270 |
then have v: "0 \<le> u v" |
|
2271 |
using obt(4)[THEN bspec[where x=v]] by auto |
|
2272 |
show "0 \<le> u v + t * w v" |
|
2273 |
proof (cases "w v < 0") |
|
2274 |
case False |
|
56536 | 2275 |
thus ?thesis using v `t\<ge>0` by auto |
53302 | 2276 |
next |
2277 |
case True |
|
2278 |
then have "t \<le> u v / (- w v)" |
|
2279 |
using `v\<in>s` |
|
2280 |
unfolding t_def i_def |
|
2281 |
apply (rule_tac Min_le) |
|
2282 |
using obt(1) |
|
2283 |
apply auto |
|
2284 |
done |
|
2285 |
then show ?thesis |
|
2286 |
unfolding real_0_le_add_iff |
|
2287 |
using pos_le_divide_eq[OF True[unfolded neg_0_less_iff_less[symmetric]]] |
|
2288 |
by auto |
|
2289 |
qed |
|
2290 |
qed |
|
2291 |
||
2292 |
obtain a where "a \<in> s" and "t = (\<lambda>v. (u v) / (- w v)) a" and "w a < 0" |
|
33175 | 2293 |
using Min_in[OF _ `i\<noteq>{}`] and obt(1) unfolding i_def t_def by auto |
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56409
diff
changeset
|
2294 |
then have a: "a \<in> s" "u a + t * w a = 0" by auto |
53302 | 2295 |
have *: "\<And>f. setsum f (s - {a}) = setsum f s - ((f a)::'b::ab_group_add)" |
57418 | 2296 |
unfolding setsum.remove[OF obt(1) `a\<in>s`] by auto |
33175 | 2297 |
have "(\<Sum>v\<in>s. u v + t * w v) = 1" |
57418 | 2298 |
unfolding setsum.distrib wv(1) setsum_right_distrib[symmetric] obt(5) by auto |
49531 | 2299 |
moreover have "(\<Sum>v\<in>s. u v *\<^sub>R v + (t * w v) *\<^sub>R v) - (u a *\<^sub>R a + (t * w a) *\<^sub>R a) = y" |
57418 | 2300 |
unfolding setsum.distrib obt(6) scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] wv(4) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2301 |
using a(2) [THEN eq_neg_iff_add_eq_0 [THEN iffD2]] by simp |
53302 | 2302 |
ultimately have "?P (n - 1)" |
2303 |
apply (rule_tac x="(s - {a})" in exI) |
|
2304 |
apply (rule_tac x="\<lambda>v. u v + t * w v" in exI) |
|
2305 |
using obt(1-3) and t and a |
|
2306 |
apply (auto simp add: * scaleR_left_distrib) |
|
2307 |
done |
|
2308 |
then show False |
|
2309 |
using smallest[THEN spec[where x="n - 1"]] by auto |
|
2310 |
qed |
|
2311 |
then show "\<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> |
|
53347 | 2312 |
(\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
2313 |
using obt by auto |
|
33175 | 2314 |
qed auto |
2315 |
||
2316 |
lemma caratheodory: |
|
53302 | 2317 |
"convex hull p = |
2318 |
{x::'a::euclidean_space. \<exists>s. finite s \<and> s \<subseteq> p \<and> |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2319 |
card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s}" |
53302 | 2320 |
unfolding set_eq_iff |
2321 |
apply rule |
|
2322 |
apply rule |
|
2323 |
unfolding mem_Collect_eq |
|
2324 |
proof - |
|
2325 |
fix x |
|
2326 |
assume "x \<in> convex hull p" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2327 |
then obtain s u where "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1" |
53302 | 2328 |
"\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
2329 |
unfolding convex_hull_caratheodory by auto |
|
2330 |
then show "\<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s" |
|
2331 |
apply (rule_tac x=s in exI) |
|
2332 |
using hull_subset[of s convex] |
|
53347 | 2333 |
using convex_convex_hull[unfolded convex_explicit, of s, |
2334 |
THEN spec[where x=s], THEN spec[where x=u]] |
|
53302 | 2335 |
apply auto |
2336 |
done |
|
33175 | 2337 |
next |
53302 | 2338 |
fix x |
2339 |
assume "\<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s" |
|
2340 |
then obtain s where "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1" "x \<in> convex hull s" |
|
2341 |
by auto |
|
2342 |
then show "x \<in> convex hull p" |
|
2343 |
using hull_mono[OF `s\<subseteq>p`] by auto |
|
33175 | 2344 |
qed |
2345 |
||
40377 | 2346 |
|
2347 |
subsection {* Some Properties of Affine Dependent Sets *} |
|
2348 |
||
53347 | 2349 |
lemma affine_independent_empty: "\<not> affine_dependent {}" |
40377 | 2350 |
by (simp add: affine_dependent_def) |
2351 |
||
53302 | 2352 |
lemma affine_independent_sing: "\<not> affine_dependent {a}" |
2353 |
by (simp add: affine_dependent_def) |
|
2354 |
||
2355 |
lemma affine_hull_translation: "affine hull ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` (affine hull S)" |
|
2356 |
proof - |
|
2357 |
have "affine ((\<lambda>x. a + x) ` (affine hull S))" |
|
2358 |
using affine_translation affine_affine_hull by auto |
|
53347 | 2359 |
moreover have "(\<lambda>x. a + x) ` S \<subseteq> (\<lambda>x. a + x) ` (affine hull S)" |
53302 | 2360 |
using hull_subset[of S] by auto |
53347 | 2361 |
ultimately have h1: "affine hull ((\<lambda>x. a + x) ` S) \<subseteq> (\<lambda>x. a + x) ` (affine hull S)" |
53302 | 2362 |
by (metis hull_minimal) |
2363 |
have "affine((\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) ` S)))" |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
2364 |
using affine_translation affine_affine_hull by (auto simp del: uminus_add_conv_diff) |
53347 | 2365 |
moreover have "(\<lambda>x. -a + x) ` (\<lambda>x. a + x) ` S \<subseteq> (\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) ` S))" |
53302 | 2366 |
using hull_subset[of "(\<lambda>x. a + x) ` S"] by auto |
53347 | 2367 |
moreover have "S = (\<lambda>x. -a + x) ` (\<lambda>x. a + x) ` S" |
53302 | 2368 |
using translation_assoc[of "-a" a] by auto |
2369 |
ultimately have "(\<lambda>x. -a + x) ` (affine hull ((\<lambda>x. a + x) ` S)) >= (affine hull S)" |
|
2370 |
by (metis hull_minimal) |
|
2371 |
then have "affine hull ((\<lambda>x. a + x) ` S) >= (\<lambda>x. a + x) ` (affine hull S)" |
|
2372 |
by auto |
|
54465 | 2373 |
then show ?thesis using h1 by auto |
40377 | 2374 |
qed |
2375 |
||
2376 |
lemma affine_dependent_translation: |
|
2377 |
assumes "affine_dependent S" |
|
53339 | 2378 |
shows "affine_dependent ((\<lambda>x. a + x) ` S)" |
53302 | 2379 |
proof - |
54465 | 2380 |
obtain x where x: "x \<in> S \<and> x \<in> affine hull (S - {x})" |
53302 | 2381 |
using assms affine_dependent_def by auto |
2382 |
have "op + a ` (S - {x}) = op + a ` S - {a + x}" |
|
2383 |
by auto |
|
53347 | 2384 |
then have "a + x \<in> affine hull ((\<lambda>x. a + x) ` S - {a + x})" |
54465 | 2385 |
using affine_hull_translation[of a "S - {x}"] x by auto |
53347 | 2386 |
moreover have "a + x \<in> (\<lambda>x. a + x) ` S" |
54465 | 2387 |
using x by auto |
53302 | 2388 |
ultimately show ?thesis |
2389 |
unfolding affine_dependent_def by auto |
|
40377 | 2390 |
qed |
2391 |
||
2392 |
lemma affine_dependent_translation_eq: |
|
54465 | 2393 |
"affine_dependent S \<longleftrightarrow> affine_dependent ((\<lambda>x. a + x) ` S)" |
53302 | 2394 |
proof - |
2395 |
{ |
|
53339 | 2396 |
assume "affine_dependent ((\<lambda>x. a + x) ` S)" |
53302 | 2397 |
then have "affine_dependent S" |
53339 | 2398 |
using affine_dependent_translation[of "((\<lambda>x. a + x) ` S)" "-a"] translation_assoc[of "-a" a] |
53302 | 2399 |
by auto |
2400 |
} |
|
2401 |
then show ?thesis |
|
2402 |
using affine_dependent_translation by auto |
|
40377 | 2403 |
qed |
2404 |
||
2405 |
lemma affine_hull_0_dependent: |
|
53339 | 2406 |
assumes "0 \<in> affine hull S" |
40377 | 2407 |
shows "dependent S" |
53302 | 2408 |
proof - |
54465 | 2409 |
obtain s u where s_u: "finite s \<and> s \<noteq> {} \<and> s \<subseteq> S \<and> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0" |
53302 | 2410 |
using assms affine_hull_explicit[of S] by auto |
53339 | 2411 |
then have "\<exists>v\<in>s. u v \<noteq> 0" |
53302 | 2412 |
using setsum_not_0[of "u" "s"] by auto |
53339 | 2413 |
then have "finite s \<and> s \<subseteq> S \<and> (\<exists>v\<in>s. u v \<noteq> 0 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = 0)" |
54465 | 2414 |
using s_u by auto |
53302 | 2415 |
then show ?thesis |
2416 |
unfolding dependent_explicit[of S] by auto |
|
40377 | 2417 |
qed |
2418 |
||
2419 |
lemma affine_dependent_imp_dependent2: |
|
2420 |
assumes "affine_dependent (insert 0 S)" |
|
2421 |
shows "dependent S" |
|
53302 | 2422 |
proof - |
54465 | 2423 |
obtain x where x: "x \<in> insert 0 S \<and> x \<in> affine hull (insert 0 S - {x})" |
53302 | 2424 |
using affine_dependent_def[of "(insert 0 S)"] assms by blast |
2425 |
then have "x \<in> span (insert 0 S - {x})" |
|
2426 |
using affine_hull_subset_span by auto |
|
2427 |
moreover have "span (insert 0 S - {x}) = span (S - {x})" |
|
2428 |
using insert_Diff_if[of "0" S "{x}"] span_insert_0[of "S-{x}"] by auto |
|
2429 |
ultimately have "x \<in> span (S - {x})" by auto |
|
2430 |
then have "x \<noteq> 0 \<Longrightarrow> dependent S" |
|
54465 | 2431 |
using x dependent_def by auto |
53302 | 2432 |
moreover |
2433 |
{ |
|
2434 |
assume "x = 0" |
|
2435 |
then have "0 \<in> affine hull S" |
|
54465 | 2436 |
using x hull_mono[of "S - {0}" S] by auto |
53302 | 2437 |
then have "dependent S" |
2438 |
using affine_hull_0_dependent by auto |
|
2439 |
} |
|
2440 |
ultimately show ?thesis by auto |
|
40377 | 2441 |
qed |
2442 |
||
2443 |
lemma affine_dependent_iff_dependent: |
|
53302 | 2444 |
assumes "a \<notin> S" |
2445 |
shows "affine_dependent (insert a S) \<longleftrightarrow> dependent ((\<lambda>x. -a + x) ` S)" |
|
2446 |
proof - |
|
2447 |
have "(op + (- a) ` S) = {x - a| x . x : S}" by auto |
|
2448 |
then show ?thesis |
|
2449 |
using affine_dependent_translation_eq[of "(insert a S)" "-a"] |
|
49531 | 2450 |
affine_dependent_imp_dependent2 assms |
53302 | 2451 |
dependent_imp_affine_dependent[of a S] |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
2452 |
by (auto simp del: uminus_add_conv_diff) |
40377 | 2453 |
qed |
2454 |
||
2455 |
lemma affine_dependent_iff_dependent2: |
|
53339 | 2456 |
assumes "a \<in> S" |
2457 |
shows "affine_dependent S \<longleftrightarrow> dependent ((\<lambda>x. -a + x) ` (S-{a}))" |
|
53302 | 2458 |
proof - |
53339 | 2459 |
have "insert a (S - {a}) = S" |
53302 | 2460 |
using assms by auto |
2461 |
then show ?thesis |
|
2462 |
using assms affine_dependent_iff_dependent[of a "S-{a}"] by auto |
|
40377 | 2463 |
qed |
2464 |
||
2465 |
lemma affine_hull_insert_span_gen: |
|
53339 | 2466 |
"affine hull (insert a s) = (\<lambda>x. a + x) ` span ((\<lambda>x. - a + x) ` s)" |
53302 | 2467 |
proof - |
53339 | 2468 |
have h1: "{x - a |x. x \<in> s} = ((\<lambda>x. -a+x) ` s)" |
53302 | 2469 |
by auto |
2470 |
{ |
|
2471 |
assume "a \<notin> s" |
|
2472 |
then have ?thesis |
|
2473 |
using affine_hull_insert_span[of a s] h1 by auto |
|
2474 |
} |
|
2475 |
moreover |
|
2476 |
{ |
|
2477 |
assume a1: "a \<in> s" |
|
53339 | 2478 |
have "\<exists>x. x \<in> s \<and> -a+x=0" |
53302 | 2479 |
apply (rule exI[of _ a]) |
2480 |
using a1 |
|
2481 |
apply auto |
|
2482 |
done |
|
53339 | 2483 |
then have "insert 0 ((\<lambda>x. -a+x) ` (s - {a})) = (\<lambda>x. -a+x) ` s" |
53302 | 2484 |
by auto |
53339 | 2485 |
then have "span ((\<lambda>x. -a+x) ` (s - {a}))=span ((\<lambda>x. -a+x) ` s)" |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
2486 |
using span_insert_0[of "op + (- a) ` (s - {a})"] by (auto simp del: uminus_add_conv_diff) |
53339 | 2487 |
moreover have "{x - a |x. x \<in> (s - {a})} = ((\<lambda>x. -a+x) ` (s - {a}))" |
53302 | 2488 |
by auto |
53339 | 2489 |
moreover have "insert a (s - {a}) = insert a s" |
53302 | 2490 |
using assms by auto |
2491 |
ultimately have ?thesis |
|
2492 |
using assms affine_hull_insert_span[of "a" "s-{a}"] by auto |
|
2493 |
} |
|
2494 |
ultimately show ?thesis by auto |
|
40377 | 2495 |
qed |
2496 |
||
2497 |
lemma affine_hull_span2: |
|
53302 | 2498 |
assumes "a \<in> s" |
2499 |
shows "affine hull s = (\<lambda>x. a+x) ` span ((\<lambda>x. -a+x) ` (s-{a}))" |
|
2500 |
using affine_hull_insert_span_gen[of a "s - {a}", unfolded insert_Diff[OF assms]] |
|
2501 |
by auto |
|
40377 | 2502 |
|
2503 |
lemma affine_hull_span_gen: |
|
53339 | 2504 |
assumes "a \<in> affine hull s" |
2505 |
shows "affine hull s = (\<lambda>x. a+x) ` span ((\<lambda>x. -a+x) ` s)" |
|
53302 | 2506 |
proof - |
2507 |
have "affine hull (insert a s) = affine hull s" |
|
2508 |
using hull_redundant[of a affine s] assms by auto |
|
2509 |
then show ?thesis |
|
2510 |
using affine_hull_insert_span_gen[of a "s"] by auto |
|
40377 | 2511 |
qed |
2512 |
||
2513 |
lemma affine_hull_span_0: |
|
53339 | 2514 |
assumes "0 \<in> affine hull S" |
40377 | 2515 |
shows "affine hull S = span S" |
53302 | 2516 |
using affine_hull_span_gen[of "0" S] assms by auto |
40377 | 2517 |
|
2518 |
||
2519 |
lemma extend_to_affine_basis: |
|
53339 | 2520 |
fixes S V :: "'n::euclidean_space set" |
2521 |
assumes "\<not> affine_dependent S" "S \<subseteq> V" "S \<noteq> {}" |
|
2522 |
shows "\<exists>T. \<not> affine_dependent T \<and> S \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V" |
|
53302 | 2523 |
proof - |
54465 | 2524 |
obtain a where a: "a \<in> S" |
53302 | 2525 |
using assms by auto |
53339 | 2526 |
then have h0: "independent ((\<lambda>x. -a + x) ` (S-{a}))" |
53302 | 2527 |
using affine_dependent_iff_dependent2 assms by auto |
54465 | 2528 |
then obtain B where B: |
53339 | 2529 |
"(\<lambda>x. -a+x) ` (S - {a}) \<subseteq> B \<and> B \<subseteq> (\<lambda>x. -a+x) ` V \<and> independent B \<and> (\<lambda>x. -a+x) ` V \<subseteq> span B" |
2530 |
using maximal_independent_subset_extend[of "(\<lambda>x. -a+x) ` (S-{a})" "(\<lambda>x. -a + x) ` V"] assms |
|
53302 | 2531 |
by blast |
53339 | 2532 |
def T \<equiv> "(\<lambda>x. a+x) ` insert 0 B" |
2533 |
then have "T = insert a ((\<lambda>x. a+x) ` B)" |
|
2534 |
by auto |
|
2535 |
then have "affine hull T = (\<lambda>x. a+x) ` span B" |
|
2536 |
using affine_hull_insert_span_gen[of a "((\<lambda>x. a+x) ` B)"] translation_assoc[of "-a" a B] |
|
53302 | 2537 |
by auto |
53347 | 2538 |
then have "V \<subseteq> affine hull T" |
54465 | 2539 |
using B assms translation_inverse_subset[of a V "span B"] |
53302 | 2540 |
by auto |
53339 | 2541 |
moreover have "T \<subseteq> V" |
54465 | 2542 |
using T_def B a assms by auto |
53302 | 2543 |
ultimately have "affine hull T = affine hull V" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
2544 |
by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono) |
53347 | 2545 |
moreover have "S \<subseteq> T" |
54465 | 2546 |
using T_def B translation_inverse_subset[of a "S-{a}" B] |
53302 | 2547 |
by auto |
2548 |
moreover have "\<not> affine_dependent T" |
|
53339 | 2549 |
using T_def affine_dependent_translation_eq[of "insert 0 B"] |
54465 | 2550 |
affine_dependent_imp_dependent2 B |
53302 | 2551 |
by auto |
53339 | 2552 |
ultimately show ?thesis using `T \<subseteq> V` by auto |
40377 | 2553 |
qed |
2554 |
||
49531 | 2555 |
lemma affine_basis_exists: |
53339 | 2556 |
fixes V :: "'n::euclidean_space set" |
2557 |
shows "\<exists>B. B \<subseteq> V \<and> \<not> affine_dependent B \<and> affine hull V = affine hull B" |
|
53302 | 2558 |
proof (cases "V = {}") |
2559 |
case True |
|
2560 |
then show ?thesis |
|
2561 |
using affine_independent_empty by auto |
|
2562 |
next |
|
2563 |
case False |
|
2564 |
then obtain x where "x \<in> V" by auto |
|
2565 |
then show ?thesis |
|
53347 | 2566 |
using affine_dependent_def[of "{x}"] extend_to_affine_basis[of "{x}" V] |
53302 | 2567 |
by auto |
2568 |
qed |
|
2569 |
||
40377 | 2570 |
|
2571 |
subsection {* Affine Dimension of a Set *} |
|
2572 |
||
53302 | 2573 |
definition "aff_dim V = |
53339 | 2574 |
(SOME d :: int. |
2575 |
\<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = d + 1)" |
|
40377 | 2576 |
|
2577 |
lemma aff_dim_basis_exists: |
|
49531 | 2578 |
fixes V :: "('n::euclidean_space) set" |
53339 | 2579 |
shows "\<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = aff_dim V + 1" |
53302 | 2580 |
proof - |
53347 | 2581 |
obtain B where "\<not> affine_dependent B \<and> affine hull B = affine hull V" |
53302 | 2582 |
using affine_basis_exists[of V] by auto |
2583 |
then show ?thesis |
|
53339 | 2584 |
unfolding aff_dim_def |
53347 | 2585 |
some_eq_ex[of "\<lambda>d. \<exists>B. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> of_nat (card B) = d + 1"] |
53302 | 2586 |
apply auto |
53339 | 2587 |
apply (rule exI[of _ "int (card B) - (1 :: int)"]) |
53302 | 2588 |
apply (rule exI[of _ "B"]) |
2589 |
apply auto |
|
2590 |
done |
|
2591 |
qed |
|
2592 |
||
2593 |
lemma affine_hull_nonempty: "S \<noteq> {} \<longleftrightarrow> affine hull S \<noteq> {}" |
|
2594 |
proof - |
|
2595 |
have "S = {} \<Longrightarrow> affine hull S = {}" |
|
2596 |
using affine_hull_empty by auto |
|
2597 |
moreover have "affine hull S = {} \<Longrightarrow> S = {}" |
|
2598 |
unfolding hull_def by auto |
|
2599 |
ultimately show ?thesis by blast |
|
40377 | 2600 |
qed |
2601 |
||
2602 |
lemma aff_dim_parallel_subspace_aux: |
|
53347 | 2603 |
fixes B :: "'n::euclidean_space set" |
53302 | 2604 |
assumes "\<not> affine_dependent B" "a \<in> B" |
53339 | 2605 |
shows "finite B \<and> ((card B) - 1 = dim (span ((\<lambda>x. -a+x) ` (B-{a}))))" |
53302 | 2606 |
proof - |
53339 | 2607 |
have "independent ((\<lambda>x. -a + x) ` (B-{a}))" |
53302 | 2608 |
using affine_dependent_iff_dependent2 assms by auto |
53339 | 2609 |
then have fin: "dim (span ((\<lambda>x. -a+x) ` (B-{a}))) = card ((\<lambda>x. -a + x) ` (B-{a}))" |
2610 |
"finite ((\<lambda>x. -a + x) ` (B - {a}))" |
|
53347 | 2611 |
using indep_card_eq_dim_span[of "(\<lambda>x. -a+x) ` (B-{a})"] by auto |
53302 | 2612 |
show ?thesis |
53339 | 2613 |
proof (cases "(\<lambda>x. -a + x) ` (B - {a}) = {}") |
53302 | 2614 |
case True |
53339 | 2615 |
have "B = insert a ((\<lambda>x. a + x) ` (\<lambda>x. -a + x) ` (B - {a}))" |
53302 | 2616 |
using translation_assoc[of "a" "-a" "(B - {a})"] assms by auto |
53339 | 2617 |
then have "B = {a}" using True by auto |
53302 | 2618 |
then show ?thesis using assms fin by auto |
2619 |
next |
|
2620 |
case False |
|
53339 | 2621 |
then have "card ((\<lambda>x. -a + x) ` (B - {a})) > 0" |
53302 | 2622 |
using fin by auto |
53339 | 2623 |
moreover have h1: "card ((\<lambda>x. -a + x) ` (B-{a})) = card (B-{a})" |
53302 | 2624 |
apply (rule card_image) |
2625 |
using translate_inj_on |
|
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
53676
diff
changeset
|
2626 |
apply (auto simp del: uminus_add_conv_diff) |
53302 | 2627 |
done |
53339 | 2628 |
ultimately have "card (B-{a}) > 0" by auto |
2629 |
then have *: "finite (B - {a})" |
|
53302 | 2630 |
using card_gt_0_iff[of "(B - {a})"] by auto |
53339 | 2631 |
then have "card (B - {a}) = card B - 1" |
53302 | 2632 |
using card_Diff_singleton assms by auto |
2633 |
with * show ?thesis using fin h1 by auto |
|
2634 |
qed |
|
40377 | 2635 |
qed |
2636 |
||
2637 |
lemma aff_dim_parallel_subspace: |
|
53339 | 2638 |
fixes V L :: "'n::euclidean_space set" |
53302 | 2639 |
assumes "V \<noteq> {}" |
53339 | 2640 |
and "subspace L" |
2641 |
and "affine_parallel (affine hull V) L" |
|
53302 | 2642 |
shows "aff_dim V = int (dim L)" |
2643 |
proof - |
|
53339 | 2644 |
obtain B where |
54465 | 2645 |
B: "affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1" |
53302 | 2646 |
using aff_dim_basis_exists by auto |
2647 |
then have "B \<noteq> {}" |
|
54465 | 2648 |
using assms B affine_hull_nonempty[of V] affine_hull_nonempty[of B] |
53302 | 2649 |
by auto |
54465 | 2650 |
then obtain a where a: "a \<in> B" by auto |
53302 | 2651 |
def Lb \<equiv> "span ((\<lambda>x. -a+x) ` (B-{a}))" |
40377 | 2652 |
moreover have "affine_parallel (affine hull B) Lb" |
54465 | 2653 |
using Lb_def B assms affine_hull_span2[of a B] a |
53339 | 2654 |
affine_parallel_commut[of "Lb" "(affine hull B)"] |
2655 |
unfolding affine_parallel_def |
|
2656 |
by auto |
|
53302 | 2657 |
moreover have "subspace Lb" |
2658 |
using Lb_def subspace_span by auto |
|
2659 |
moreover have "affine hull B \<noteq> {}" |
|
54465 | 2660 |
using assms B affine_hull_nonempty[of V] by auto |
53302 | 2661 |
ultimately have "L = Lb" |
54465 | 2662 |
using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B |
53302 | 2663 |
by auto |
53339 | 2664 |
then have "dim L = dim Lb" |
2665 |
by auto |
|
2666 |
moreover have "card B - 1 = dim Lb" and "finite B" |
|
54465 | 2667 |
using Lb_def aff_dim_parallel_subspace_aux a B by auto |
53302 | 2668 |
ultimately show ?thesis |
54465 | 2669 |
using B `B \<noteq> {}` card_gt_0_iff[of B] by auto |
40377 | 2670 |
qed |
2671 |
||
2672 |
lemma aff_independent_finite: |
|
53339 | 2673 |
fixes B :: "'n::euclidean_space set" |
2674 |
assumes "\<not> affine_dependent B" |
|
53302 | 2675 |
shows "finite B" |
2676 |
proof - |
|
2677 |
{ |
|
2678 |
assume "B \<noteq> {}" |
|
2679 |
then obtain a where "a \<in> B" by auto |
|
2680 |
then have ?thesis |
|
2681 |
using aff_dim_parallel_subspace_aux assms by auto |
|
2682 |
} |
|
2683 |
then show ?thesis by auto |
|
40377 | 2684 |
qed |
2685 |
||
2686 |
lemma independent_finite: |
|
53339 | 2687 |
fixes B :: "'n::euclidean_space set" |
53302 | 2688 |
assumes "independent B" |
2689 |
shows "finite B" |
|
2690 |
using affine_dependent_imp_dependent[of B] aff_independent_finite[of B] assms |
|
2691 |
by auto |
|
40377 | 2692 |
|
2693 |
lemma subspace_dim_equal: |
|
53339 | 2694 |
assumes "subspace (S :: ('n::euclidean_space) set)" |
2695 |
and "subspace T" |
|
2696 |
and "S \<subseteq> T" |
|
2697 |
and "dim S \<ge> dim T" |
|
53302 | 2698 |
shows "S = T" |
2699 |
proof - |
|
53347 | 2700 |
obtain B where B: "B \<le> S" "independent B \<and> S \<subseteq> span B" "card B = dim S" |
53339 | 2701 |
using basis_exists[of S] by auto |
2702 |
then have "span B \<subseteq> S" |
|
2703 |
using span_mono[of B S] span_eq[of S] assms by metis |
|
2704 |
then have "span B = S" |
|
53347 | 2705 |
using B by auto |
53339 | 2706 |
have "dim S = dim T" |
2707 |
using assms dim_subset[of S T] by auto |
|
2708 |
then have "T \<subseteq> span B" |
|
53347 | 2709 |
using card_eq_dim[of B T] B independent_finite assms by auto |
53339 | 2710 |
then show ?thesis |
2711 |
using assms `span B = S` by auto |
|
40377 | 2712 |
qed |
2713 |
||
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
2714 |
lemma span_substd_basis: |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
2715 |
assumes d: "d \<subseteq> Basis" |
53347 | 2716 |
shows "span d = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}" |
2717 |
(is "_ = ?B") |
|
53339 | 2718 |
proof - |
2719 |
have "d \<subseteq> ?B" |
|
2720 |
using d by (auto simp: inner_Basis) |
|
2721 |
moreover have s: "subspace ?B" |
|
2722 |
using subspace_substandard[of "\<lambda>i. i \<notin> d"] . |
|
2723 |
ultimately have "span d \<subseteq> ?B" |
|
2724 |
using span_mono[of d "?B"] span_eq[of "?B"] by blast |
|
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53348
diff
changeset
|
2725 |
moreover have *: "card d \<le> dim (span d)" |
53339 | 2726 |
using independent_card_le_dim[of d "span d"] independent_substdbasis[OF assms] span_inc[of d] |
2727 |
by auto |
|
53374
a14d2a854c02
tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents:
53348
diff
changeset
|
2728 |
moreover from * have "dim ?B \<le> dim (span d)" |
53339 | 2729 |
using dim_substandard[OF assms] by auto |
2730 |
ultimately show ?thesis |
|
2731 |
using s subspace_dim_equal[of "span d" "?B"] subspace_span[of d] by auto |
|
40377 | 2732 |
qed |
2733 |
||
2734 |
lemma basis_to_substdbasis_subspace_isomorphism: |
|
53339 | 2735 |
fixes B :: "'a::euclidean_space set" |
2736 |
assumes "independent B" |
|
2737 |
shows "\<exists>f d::'a set. card d = card B \<and> linear f \<and> f ` B = d \<and> |
|
2738 |
f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0} \<and> inj_on f (span B) \<and> d \<subseteq> Basis" |
|
2739 |
proof - |
|
2740 |
have B: "card B = dim B" |
|
2741 |
using dim_unique[of B B "card B"] assms span_inc[of B] by auto |
|
2742 |
have "dim B \<le> card (Basis :: 'a set)" |
|
2743 |
using dim_subset_UNIV[of B] by simp |
|
2744 |
from ex_card[OF this] obtain d :: "'a set" where d: "d \<subseteq> Basis" and t: "card d = dim B" |
|
2745 |
by auto |
|
53347 | 2746 |
let ?t = "{x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}" |
53339 | 2747 |
have "\<exists>f. linear f \<and> f ` B = d \<and> f ` span B = ?t \<and> inj_on f (span B)" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
2748 |
apply (rule basis_to_basis_subspace_isomorphism[of "span B" ?t B "d"]) |
53339 | 2749 |
apply (rule subspace_span) |
2750 |
apply (rule subspace_substandard) |
|
2751 |
defer |
|
2752 |
apply (rule span_inc) |
|
2753 |
apply (rule assms) |
|
2754 |
defer |
|
2755 |
unfolding dim_span[of B] |
|
2756 |
apply(rule B) |
|
54465 | 2757 |
unfolding span_substd_basis[OF d, symmetric] |
53339 | 2758 |
apply (rule span_inc) |
2759 |
apply (rule independent_substdbasis[OF d]) |
|
2760 |
apply rule |
|
2761 |
apply assumption |
|
2762 |
unfolding t[symmetric] span_substd_basis[OF d] dim_substandard[OF d] |
|
2763 |
apply auto |
|
2764 |
done |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
2765 |
with t `card B = dim B` d show ?thesis by auto |
40377 | 2766 |
qed |
2767 |
||
2768 |
lemma aff_dim_empty: |
|
53339 | 2769 |
fixes S :: "'n::euclidean_space set" |
2770 |
shows "S = {} \<longleftrightarrow> aff_dim S = -1" |
|
2771 |
proof - |
|
2772 |
obtain B where *: "affine hull B = affine hull S" |
|
2773 |
and "\<not> affine_dependent B" |
|
2774 |
and "int (card B) = aff_dim S + 1" |
|
2775 |
using aff_dim_basis_exists by auto |
|
2776 |
moreover |
|
2777 |
from * have "S = {} \<longleftrightarrow> B = {}" |
|
2778 |
using affine_hull_nonempty[of B] affine_hull_nonempty[of S] by auto |
|
2779 |
ultimately show ?thesis |
|
2780 |
using aff_independent_finite[of B] card_gt_0_iff[of B] by auto |
|
2781 |
qed |
|
2782 |
||
2783 |
lemma aff_dim_affine_hull: "aff_dim (affine hull S) = aff_dim S" |
|
2784 |
unfolding aff_dim_def using hull_hull[of _ S] by auto |
|
40377 | 2785 |
|
2786 |
lemma aff_dim_affine_hull2: |
|
53339 | 2787 |
assumes "affine hull S = affine hull T" |
2788 |
shows "aff_dim S = aff_dim T" |
|
2789 |
unfolding aff_dim_def using assms by auto |
|
40377 | 2790 |
|
49531 | 2791 |
lemma aff_dim_unique: |
53339 | 2792 |
fixes B V :: "'n::euclidean_space set" |
2793 |
assumes "affine hull B = affine hull V \<and> \<not> affine_dependent B" |
|
2794 |
shows "of_nat (card B) = aff_dim V + 1" |
|
2795 |
proof (cases "B = {}") |
|
2796 |
case True |
|
2797 |
then have "V = {}" |
|
2798 |
using affine_hull_nonempty[of V] affine_hull_nonempty[of B] assms |
|
2799 |
by auto |
|
2800 |
then have "aff_dim V = (-1::int)" |
|
2801 |
using aff_dim_empty by auto |
|
2802 |
then show ?thesis |
|
53347 | 2803 |
using `B = {}` by auto |
53339 | 2804 |
next |
2805 |
case False |
|
54465 | 2806 |
then obtain a where a: "a \<in> B" by auto |
53339 | 2807 |
def Lb \<equiv> "span ((\<lambda>x. -a+x) ` (B-{a}))" |
40377 | 2808 |
have "affine_parallel (affine hull B) Lb" |
54465 | 2809 |
using Lb_def affine_hull_span2[of a B] a |
53339 | 2810 |
affine_parallel_commut[of "Lb" "(affine hull B)"] |
2811 |
unfolding affine_parallel_def by auto |
|
2812 |
moreover have "subspace Lb" |
|
2813 |
using Lb_def subspace_span by auto |
|
2814 |
ultimately have "aff_dim B = int(dim Lb)" |
|
53347 | 2815 |
using aff_dim_parallel_subspace[of B Lb] `B \<noteq> {}` by auto |
53339 | 2816 |
moreover have "(card B) - 1 = dim Lb" "finite B" |
54465 | 2817 |
using Lb_def aff_dim_parallel_subspace_aux a assms by auto |
53339 | 2818 |
ultimately have "of_nat (card B) = aff_dim B + 1" |
2819 |
using `B \<noteq> {}` card_gt_0_iff[of B] by auto |
|
2820 |
then show ?thesis |
|
2821 |
using aff_dim_affine_hull2 assms by auto |
|
40377 | 2822 |
qed |
2823 |
||
49531 | 2824 |
lemma aff_dim_affine_independent: |
53339 | 2825 |
fixes B :: "'n::euclidean_space set" |
2826 |
assumes "\<not> affine_dependent B" |
|
2827 |
shows "of_nat (card B) = aff_dim B + 1" |
|
40377 | 2828 |
using aff_dim_unique[of B B] assms by auto |
2829 |
||
49531 | 2830 |
lemma aff_dim_sing: |
53339 | 2831 |
fixes a :: "'n::euclidean_space" |
2832 |
shows "aff_dim {a} = 0" |
|
40377 | 2833 |
using aff_dim_affine_independent[of "{a}"] affine_independent_sing by auto |
2834 |
||
2835 |
lemma aff_dim_inner_basis_exists: |
|
49531 | 2836 |
fixes V :: "('n::euclidean_space) set" |
53339 | 2837 |
shows "\<exists>B. B \<subseteq> V \<and> affine hull B = affine hull V \<and> |
2838 |
\<not> affine_dependent B \<and> of_nat (card B) = aff_dim V + 1" |
|
2839 |
proof - |
|
53347 | 2840 |
obtain B where B: "\<not> affine_dependent B" "B \<subseteq> V" "affine hull B = affine hull V" |
53339 | 2841 |
using affine_basis_exists[of V] by auto |
2842 |
then have "of_nat(card B) = aff_dim V+1" using aff_dim_unique by auto |
|
53347 | 2843 |
with B show ?thesis by auto |
40377 | 2844 |
qed |
2845 |
||
2846 |
lemma aff_dim_le_card: |
|
53347 | 2847 |
fixes V :: "'n::euclidean_space set" |
53339 | 2848 |
assumes "finite V" |
53347 | 2849 |
shows "aff_dim V \<le> of_nat (card V) - 1" |
53339 | 2850 |
proof - |
53347 | 2851 |
obtain B where B: "B \<subseteq> V" "of_nat (card B) = aff_dim V + 1" |
53339 | 2852 |
using aff_dim_inner_basis_exists[of V] by auto |
2853 |
then have "card B \<le> card V" |
|
2854 |
using assms card_mono by auto |
|
53347 | 2855 |
with B show ?thesis by auto |
40377 | 2856 |
qed |
2857 |
||
2858 |
lemma aff_dim_parallel_eq: |
|
53339 | 2859 |
fixes S T :: "'n::euclidean_space set" |
2860 |
assumes "affine_parallel (affine hull S) (affine hull T)" |
|
2861 |
shows "aff_dim S = aff_dim T" |
|
2862 |
proof - |
|
2863 |
{ |
|
2864 |
assume "T \<noteq> {}" "S \<noteq> {}" |
|
53347 | 2865 |
then obtain L where L: "subspace L \<and> affine_parallel (affine hull T) L" |
2866 |
using affine_parallel_subspace[of "affine hull T"] |
|
2867 |
affine_affine_hull[of T] affine_hull_nonempty |
|
53339 | 2868 |
by auto |
2869 |
then have "aff_dim T = int (dim L)" |
|
2870 |
using aff_dim_parallel_subspace `T \<noteq> {}` by auto |
|
2871 |
moreover have *: "subspace L \<and> affine_parallel (affine hull S) L" |
|
53347 | 2872 |
using L affine_parallel_assoc[of "affine hull S" "affine hull T" L] assms by auto |
53339 | 2873 |
moreover from * have "aff_dim S = int (dim L)" |
2874 |
using aff_dim_parallel_subspace `S \<noteq> {}` by auto |
|
2875 |
ultimately have ?thesis by auto |
|
2876 |
} |
|
2877 |
moreover |
|
2878 |
{ |
|
2879 |
assume "S = {}" |
|
2880 |
then have "S = {}" and "T = {}" |
|
2881 |
using assms affine_hull_nonempty |
|
2882 |
unfolding affine_parallel_def |
|
2883 |
by auto |
|
2884 |
then have ?thesis using aff_dim_empty by auto |
|
2885 |
} |
|
2886 |
moreover |
|
2887 |
{ |
|
2888 |
assume "T = {}" |
|
2889 |
then have "S = {}" and "T = {}" |
|
2890 |
using assms affine_hull_nonempty |
|
2891 |
unfolding affine_parallel_def |
|
2892 |
by auto |
|
2893 |
then have ?thesis |
|
2894 |
using aff_dim_empty by auto |
|
2895 |
} |
|
2896 |
ultimately show ?thesis by blast |
|
40377 | 2897 |
qed |
2898 |
||
2899 |
lemma aff_dim_translation_eq: |
|
53339 | 2900 |
fixes a :: "'n::euclidean_space" |
2901 |
shows "aff_dim ((\<lambda>x. a + x) ` S) = aff_dim S" |
|
2902 |
proof - |
|
53347 | 2903 |
have "affine_parallel (affine hull S) (affine hull ((\<lambda>x. a + x) ` S))" |
53339 | 2904 |
unfolding affine_parallel_def |
2905 |
apply (rule exI[of _ "a"]) |
|
2906 |
using affine_hull_translation[of a S] |
|
2907 |
apply auto |
|
2908 |
done |
|
2909 |
then show ?thesis |
|
2910 |
using aff_dim_parallel_eq[of S "(\<lambda>x. a + x) ` S"] by auto |
|
40377 | 2911 |
qed |
2912 |
||
2913 |
lemma aff_dim_affine: |
|
53339 | 2914 |
fixes S L :: "'n::euclidean_space set" |
2915 |
assumes "S \<noteq> {}" |
|
2916 |
and "affine S" |
|
2917 |
and "subspace L" |
|
2918 |
and "affine_parallel S L" |
|
2919 |
shows "aff_dim S = int (dim L)" |
|
2920 |
proof - |
|
2921 |
have *: "affine hull S = S" |
|
2922 |
using assms affine_hull_eq[of S] by auto |
|
2923 |
then have "affine_parallel (affine hull S) L" |
|
2924 |
using assms by (simp add: *) |
|
2925 |
then show ?thesis |
|
2926 |
using assms aff_dim_parallel_subspace[of S L] by blast |
|
40377 | 2927 |
qed |
2928 |
||
2929 |
lemma dim_affine_hull: |
|
53339 | 2930 |
fixes S :: "'n::euclidean_space set" |
2931 |
shows "dim (affine hull S) = dim S" |
|
2932 |
proof - |
|
2933 |
have "dim (affine hull S) \<ge> dim S" |
|
2934 |
using dim_subset by auto |
|
2935 |
moreover have "dim (span S) \<ge> dim (affine hull S)" |
|
2936 |
using dim_subset affine_hull_subset_span by auto |
|
2937 |
moreover have "dim (span S) = dim S" |
|
2938 |
using dim_span by auto |
|
2939 |
ultimately show ?thesis by auto |
|
40377 | 2940 |
qed |
2941 |
||
2942 |
lemma aff_dim_subspace: |
|
53339 | 2943 |
fixes S :: "'n::euclidean_space set" |
2944 |
assumes "S \<noteq> {}" |
|
2945 |
and "subspace S" |
|
2946 |
shows "aff_dim S = int (dim S)" |
|
2947 |
using aff_dim_affine[of S S] assms subspace_imp_affine[of S] affine_parallel_reflex[of S] |
|
2948 |
by auto |
|
40377 | 2949 |
|
2950 |
lemma aff_dim_zero: |
|
53339 | 2951 |
fixes S :: "'n::euclidean_space set" |
2952 |
assumes "0 \<in> affine hull S" |
|
2953 |
shows "aff_dim S = int (dim S)" |
|
2954 |
proof - |
|
2955 |
have "subspace (affine hull S)" |
|
2956 |
using subspace_affine[of "affine hull S"] affine_affine_hull assms |
|
2957 |
by auto |
|
2958 |
then have "aff_dim (affine hull S) = int (dim (affine hull S))" |
|
2959 |
using assms aff_dim_subspace[of "affine hull S"] by auto |
|
2960 |
then show ?thesis |
|
2961 |
using aff_dim_affine_hull[of S] dim_affine_hull[of S] |
|
2962 |
by auto |
|
40377 | 2963 |
qed |
2964 |
||
53347 | 2965 |
lemma aff_dim_univ: "aff_dim (UNIV :: 'n::euclidean_space set) = int(DIM('n))" |
2966 |
using aff_dim_subspace[of "(UNIV :: 'n::euclidean_space set)"] |
|
53339 | 2967 |
dim_UNIV[where 'a="'n::euclidean_space"] |
2968 |
by auto |
|
40377 | 2969 |
|
2970 |
lemma aff_dim_geq: |
|
53339 | 2971 |
fixes V :: "'n::euclidean_space set" |
2972 |
shows "aff_dim V \<ge> -1" |
|
2973 |
proof - |
|
53347 | 2974 |
obtain B where "affine hull B = affine hull V" |
2975 |
and "\<not> affine_dependent B" |
|
2976 |
and "int (card B) = aff_dim V + 1" |
|
53339 | 2977 |
using aff_dim_basis_exists by auto |
2978 |
then show ?thesis by auto |
|
40377 | 2979 |
qed |
2980 |
||
49531 | 2981 |
lemma independent_card_le_aff_dim: |
53347 | 2982 |
fixes B :: "'n::euclidean_space set" |
2983 |
assumes "B \<subseteq> V" |
|
53339 | 2984 |
assumes "\<not> affine_dependent B" |
2985 |
shows "int (card B) \<le> aff_dim V + 1" |
|
2986 |
proof (cases "B = {}") |
|
2987 |
case True |
|
2988 |
then have "-1 \<le> aff_dim V" |
|
2989 |
using aff_dim_geq by auto |
|
2990 |
with True show ?thesis by auto |
|
2991 |
next |
|
2992 |
case False |
|
53347 | 2993 |
then obtain T where T: "\<not> affine_dependent T \<and> B \<subseteq> T \<and> T \<subseteq> V \<and> affine hull T = affine hull V" |
53339 | 2994 |
using assms extend_to_affine_basis[of B V] by auto |
2995 |
then have "of_nat (card T) = aff_dim V + 1" |
|
2996 |
using aff_dim_unique by auto |
|
2997 |
then show ?thesis |
|
53347 | 2998 |
using T card_mono[of T B] aff_independent_finite[of T] by auto |
40377 | 2999 |
qed |
3000 |
||
3001 |
lemma aff_dim_subset: |
|
53347 | 3002 |
fixes S T :: "'n::euclidean_space set" |
3003 |
assumes "S \<subseteq> T" |
|
3004 |
shows "aff_dim S \<le> aff_dim T" |
|
53339 | 3005 |
proof - |
53347 | 3006 |
obtain B where B: "\<not> affine_dependent B" "B \<subseteq> S" "affine hull B = affine hull S" |
3007 |
"of_nat (card B) = aff_dim S + 1" |
|
53339 | 3008 |
using aff_dim_inner_basis_exists[of S] by auto |
3009 |
then have "int (card B) \<le> aff_dim T + 1" |
|
3010 |
using assms independent_card_le_aff_dim[of B T] by auto |
|
53347 | 3011 |
with B show ?thesis by auto |
40377 | 3012 |
qed |
3013 |
||
3014 |
lemma aff_dim_subset_univ: |
|
53339 | 3015 |
fixes S :: "'n::euclidean_space set" |
3016 |
shows "aff_dim S \<le> int (DIM('n))" |
|
49531 | 3017 |
proof - |
53339 | 3018 |
have "aff_dim (UNIV :: 'n::euclidean_space set) = int(DIM('n))" |
3019 |
using aff_dim_univ by auto |
|
3020 |
then show "aff_dim (S:: 'n::euclidean_space set) \<le> int(DIM('n))" |
|
3021 |
using assms aff_dim_subset[of S "(UNIV :: ('n::euclidean_space) set)"] subset_UNIV by auto |
|
40377 | 3022 |
qed |
3023 |
||
3024 |
lemma affine_dim_equal: |
|
53347 | 3025 |
fixes S :: "'n::euclidean_space set" |
3026 |
assumes "affine S" "affine T" "S \<noteq> {}" "S \<subseteq> T" "aff_dim S = aff_dim T" |
|
3027 |
shows "S = T" |
|
3028 |
proof - |
|
3029 |
obtain a where "a \<in> S" using assms by auto |
|
3030 |
then have "a \<in> T" using assms by auto |
|
3031 |
def LS \<equiv> "{y. \<exists>x \<in> S. (-a) + x = y}" |
|
3032 |
then have ls: "subspace LS" "affine_parallel S LS" |
|
3033 |
using assms parallel_subspace_explicit[of S a LS] `a \<in> S` by auto |
|
3034 |
then have h1: "int(dim LS) = aff_dim S" |
|
3035 |
using assms aff_dim_affine[of S LS] by auto |
|
3036 |
have "T \<noteq> {}" using assms by auto |
|
3037 |
def LT \<equiv> "{y. \<exists>x \<in> T. (-a) + x = y}" |
|
3038 |
then have lt: "subspace LT \<and> affine_parallel T LT" |
|
3039 |
using assms parallel_subspace_explicit[of T a LT] `a \<in> T` by auto |
|
3040 |
then have "int(dim LT) = aff_dim T" |
|
3041 |
using assms aff_dim_affine[of T LT] `T \<noteq> {}` by auto |
|
3042 |
then have "dim LS = dim LT" |
|
3043 |
using h1 assms by auto |
|
3044 |
moreover have "LS \<le> LT" |
|
3045 |
using LS_def LT_def assms by auto |
|
3046 |
ultimately have "LS = LT" |
|
3047 |
using subspace_dim_equal[of LS LT] ls lt by auto |
|
3048 |
moreover have "S = {x. \<exists>y \<in> LS. a+y=x}" |
|
3049 |
using LS_def by auto |
|
3050 |
moreover have "T = {x. \<exists>y \<in> LT. a+y=x}" |
|
3051 |
using LT_def by auto |
|
3052 |
ultimately show ?thesis by auto |
|
40377 | 3053 |
qed |
3054 |
||
3055 |
lemma affine_hull_univ: |
|
53347 | 3056 |
fixes S :: "'n::euclidean_space set" |
3057 |
assumes "aff_dim S = int(DIM('n))" |
|
3058 |
shows "affine hull S = (UNIV :: ('n::euclidean_space) set)" |
|
3059 |
proof - |
|
3060 |
have "S \<noteq> {}" |
|
3061 |
using assms aff_dim_empty[of S] by auto |
|
3062 |
have h0: "S \<subseteq> affine hull S" |
|
3063 |
using hull_subset[of S _] by auto |
|
3064 |
have h1: "aff_dim (UNIV :: ('n::euclidean_space) set) = aff_dim S" |
|
3065 |
using aff_dim_univ assms by auto |
|
3066 |
then have h2: "aff_dim (affine hull S) \<le> aff_dim (UNIV :: ('n::euclidean_space) set)" |
|
3067 |
using aff_dim_subset_univ[of "affine hull S"] assms h0 by auto |
|
3068 |
have h3: "aff_dim S \<le> aff_dim (affine hull S)" |
|
3069 |
using h0 aff_dim_subset[of S "affine hull S"] assms by auto |
|
3070 |
then have h4: "aff_dim (affine hull S) = aff_dim (UNIV :: ('n::euclidean_space) set)" |
|
3071 |
using h0 h1 h2 by auto |
|
3072 |
then show ?thesis |
|
3073 |
using affine_dim_equal[of "affine hull S" "(UNIV :: ('n::euclidean_space) set)"] |
|
3074 |
affine_affine_hull[of S] affine_UNIV assms h4 h0 `S \<noteq> {}` |
|
3075 |
by auto |
|
40377 | 3076 |
qed |
3077 |
||
3078 |
lemma aff_dim_convex_hull: |
|
53347 | 3079 |
fixes S :: "'n::euclidean_space set" |
3080 |
shows "aff_dim (convex hull S) = aff_dim S" |
|
49531 | 3081 |
using aff_dim_affine_hull[of S] convex_hull_subset_affine_hull[of S] |
53347 | 3082 |
hull_subset[of S "convex"] aff_dim_subset[of S "convex hull S"] |
3083 |
aff_dim_subset[of "convex hull S" "affine hull S"] |
|
3084 |
by auto |
|
40377 | 3085 |
|
3086 |
lemma aff_dim_cball: |
|
53347 | 3087 |
fixes a :: "'n::euclidean_space" |
3088 |
assumes "e > 0" |
|
3089 |
shows "aff_dim (cball a e) = int (DIM('n))" |
|
3090 |
proof - |
|
3091 |
have "(\<lambda>x. a + x) ` (cball 0 e) \<subseteq> cball a e" |
|
3092 |
unfolding cball_def dist_norm by auto |
|
3093 |
then have "aff_dim (cball (0 :: 'n::euclidean_space) e) \<le> aff_dim (cball a e)" |
|
3094 |
using aff_dim_translation_eq[of a "cball 0 e"] |
|
3095 |
aff_dim_subset[of "op + a ` cball 0 e" "cball a e"] |
|
3096 |
by auto |
|
3097 |
moreover have "aff_dim (cball (0 :: 'n::euclidean_space) e) = int (DIM('n))" |
|
3098 |
using hull_inc[of "(0 :: 'n::euclidean_space)" "cball 0 e"] |
|
3099 |
centre_in_cball[of "(0 :: 'n::euclidean_space)"] assms |
|
3100 |
by (simp add: dim_cball[of e] aff_dim_zero[of "cball 0 e"]) |
|
3101 |
ultimately show ?thesis |
|
3102 |
using aff_dim_subset_univ[of "cball a e"] by auto |
|
40377 | 3103 |
qed |
3104 |
||
3105 |
lemma aff_dim_open: |
|
53347 | 3106 |
fixes S :: "'n::euclidean_space set" |
3107 |
assumes "open S" |
|
3108 |
and "S \<noteq> {}" |
|
3109 |
shows "aff_dim S = int (DIM('n))" |
|
3110 |
proof - |
|
3111 |
obtain x where "x \<in> S" |
|
3112 |
using assms by auto |
|
3113 |
then obtain e where e: "e > 0" "cball x e \<subseteq> S" |
|
3114 |
using open_contains_cball[of S] assms by auto |
|
3115 |
then have "aff_dim (cball x e) \<le> aff_dim S" |
|
3116 |
using aff_dim_subset by auto |
|
3117 |
with e show ?thesis |
|
3118 |
using aff_dim_cball[of e x] aff_dim_subset_univ[of S] by auto |
|
40377 | 3119 |
qed |
3120 |
||
3121 |
lemma low_dim_interior: |
|
53347 | 3122 |
fixes S :: "'n::euclidean_space set" |
3123 |
assumes "\<not> aff_dim S = int (DIM('n))" |
|
3124 |
shows "interior S = {}" |
|
3125 |
proof - |
|
3126 |
have "aff_dim(interior S) \<le> aff_dim S" |
|
3127 |
using interior_subset aff_dim_subset[of "interior S" S] by auto |
|
3128 |
then show ?thesis |
|
3129 |
using aff_dim_open[of "interior S"] aff_dim_subset_univ[of S] assms by auto |
|
40377 | 3130 |
qed |
3131 |
||
44467 | 3132 |
subsection {* Relative interior of a set *} |
40377 | 3133 |
|
53347 | 3134 |
definition "rel_interior S = |
3135 |
{x. \<exists>T. openin (subtopology euclidean (affine hull S)) T \<and> x \<in> T \<and> T \<subseteq> S}" |
|
3136 |
||
3137 |
lemma rel_interior: |
|
3138 |
"rel_interior S = {x \<in> S. \<exists>T. open T \<and> x \<in> T \<and> T \<inter> affine hull S \<subseteq> S}" |
|
3139 |
unfolding rel_interior_def[of S] openin_open[of "affine hull S"] |
|
3140 |
apply auto |
|
3141 |
proof - |
|
3142 |
fix x T |
|
3143 |
assume *: "x \<in> S" "open T" "x \<in> T" "T \<inter> affine hull S \<subseteq> S" |
|
3144 |
then have **: "x \<in> T \<inter> affine hull S" |
|
3145 |
using hull_inc by auto |
|
54465 | 3146 |
show "\<exists>Tb. (\<exists>Ta. open Ta \<and> Tb = affine hull S \<inter> Ta) \<and> x \<in> Tb \<and> Tb \<subseteq> S" |
3147 |
apply (rule_tac x = "T \<inter> (affine hull S)" in exI) |
|
53347 | 3148 |
using * ** |
3149 |
apply auto |
|
3150 |
done |
|
3151 |
qed |
|
3152 |
||
3153 |
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)" |
|
3154 |
by (auto simp add: rel_interior) |
|
3155 |
||
3156 |
lemma mem_rel_interior_ball: |
|
3157 |
"x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S)" |
|
40377 | 3158 |
apply (simp add: rel_interior, safe) |
3159 |
apply (force simp add: open_contains_ball) |
|
53347 | 3160 |
apply (rule_tac x = "ball x e" in exI) |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3161 |
apply simp |
40377 | 3162 |
done |
3163 |
||
49531 | 3164 |
lemma rel_interior_ball: |
53347 | 3165 |
"rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> ball x e \<inter> affine hull S \<subseteq> S}" |
3166 |
using mem_rel_interior_ball [of _ S] by auto |
|
3167 |
||
3168 |
lemma mem_rel_interior_cball: |
|
3169 |
"x \<in> rel_interior S \<longleftrightarrow> x \<in> S \<and> (\<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S)" |
|
49531 | 3170 |
apply (simp add: rel_interior, safe) |
40377 | 3171 |
apply (force simp add: open_contains_cball) |
53347 | 3172 |
apply (rule_tac x = "ball x e" in exI) |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3173 |
apply (simp add: subset_trans [OF ball_subset_cball]) |
40377 | 3174 |
apply auto |
3175 |
done |
|
3176 |
||
53347 | 3177 |
lemma rel_interior_cball: |
3178 |
"rel_interior S = {x \<in> S. \<exists>e. e > 0 \<and> cball x e \<inter> affine hull S \<subseteq> S}" |
|
3179 |
using mem_rel_interior_cball [of _ S] by auto |
|
40377 | 3180 |
|
49531 | 3181 |
lemma rel_interior_empty: "rel_interior {} = {}" |
3182 |
by (auto simp add: rel_interior_def) |
|
40377 | 3183 |
|
3184 |
lemma affine_hull_sing: "affine hull {a :: 'n::euclidean_space} = {a}" |
|
53347 | 3185 |
by (metis affine_hull_eq affine_sing) |
40377 | 3186 |
|
3187 |
lemma rel_interior_sing: "rel_interior {a :: 'n::euclidean_space} = {a}" |
|
53347 | 3188 |
unfolding rel_interior_ball affine_hull_sing |
3189 |
apply auto |
|
3190 |
apply (rule_tac x = "1 :: real" in exI) |
|
3191 |
apply simp |
|
3192 |
done |
|
40377 | 3193 |
|
3194 |
lemma subset_rel_interior: |
|
53347 | 3195 |
fixes S T :: "'n::euclidean_space set" |
3196 |
assumes "S \<subseteq> T" |
|
3197 |
and "affine hull S = affine hull T" |
|
3198 |
shows "rel_interior S \<subseteq> rel_interior T" |
|
49531 | 3199 |
using assms by (auto simp add: rel_interior_def) |
3200 |
||
53347 | 3201 |
lemma rel_interior_subset: "rel_interior S \<subseteq> S" |
3202 |
by (auto simp add: rel_interior_def) |
|
3203 |
||
3204 |
lemma rel_interior_subset_closure: "rel_interior S \<subseteq> closure S" |
|
3205 |
using rel_interior_subset by (auto simp add: closure_def) |
|
3206 |
||
3207 |
lemma interior_subset_rel_interior: "interior S \<subseteq> rel_interior S" |
|
3208 |
by (auto simp add: rel_interior interior_def) |
|
40377 | 3209 |
|
3210 |
lemma interior_rel_interior: |
|
53347 | 3211 |
fixes S :: "'n::euclidean_space set" |
3212 |
assumes "aff_dim S = int(DIM('n))" |
|
3213 |
shows "rel_interior S = interior S" |
|
40377 | 3214 |
proof - |
53347 | 3215 |
have "affine hull S = UNIV" |
3216 |
using assms affine_hull_univ[of S] by auto |
|
3217 |
then show ?thesis |
|
3218 |
unfolding rel_interior interior_def by auto |
|
40377 | 3219 |
qed |
3220 |
||
3221 |
lemma rel_interior_open: |
|
53347 | 3222 |
fixes S :: "'n::euclidean_space set" |
3223 |
assumes "open S" |
|
3224 |
shows "rel_interior S = S" |
|
3225 |
by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset) |
|
40377 | 3226 |
|
3227 |
lemma interior_rel_interior_gen: |
|
53347 | 3228 |
fixes S :: "'n::euclidean_space set" |
3229 |
shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})" |
|
3230 |
by (metis interior_rel_interior low_dim_interior) |
|
40377 | 3231 |
|
49531 | 3232 |
lemma rel_interior_univ: |
53347 | 3233 |
fixes S :: "'n::euclidean_space set" |
3234 |
shows "rel_interior (affine hull S) = affine hull S" |
|
3235 |
proof - |
|
3236 |
have *: "rel_interior (affine hull S) \<subseteq> affine hull S" |
|
3237 |
using rel_interior_subset by auto |
|
3238 |
{ |
|
3239 |
fix x |
|
3240 |
assume x: "x \<in> affine hull S" |
|
3241 |
def e \<equiv> "1::real" |
|
3242 |
then have "e > 0" "ball x e \<inter> affine hull (affine hull S) \<subseteq> affine hull S" |
|
3243 |
using hull_hull[of _ S] by auto |
|
3244 |
then have "x \<in> rel_interior (affine hull S)" |
|
3245 |
using x rel_interior_ball[of "affine hull S"] by auto |
|
3246 |
} |
|
3247 |
then show ?thesis using * by auto |
|
40377 | 3248 |
qed |
3249 |
||
3250 |
lemma rel_interior_univ2: "rel_interior (UNIV :: ('n::euclidean_space) set) = UNIV" |
|
53347 | 3251 |
by (metis open_UNIV rel_interior_open) |
40377 | 3252 |
|
3253 |
lemma rel_interior_convex_shrink: |
|
53347 | 3254 |
fixes S :: "'a::euclidean_space set" |
3255 |
assumes "convex S" |
|
3256 |
and "c \<in> rel_interior S" |
|
3257 |
and "x \<in> S" |
|
3258 |
and "0 < e" |
|
3259 |
and "e \<le> 1" |
|
3260 |
shows "x - e *\<^sub>R (x - c) \<in> rel_interior S" |
|
3261 |
proof - |
|
54465 | 3262 |
obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S" |
53347 | 3263 |
using assms(2) unfolding mem_rel_interior_ball by auto |
3264 |
{ |
|
3265 |
fix y |
|
3266 |
assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d" "y \<in> affine hull S" |
|
3267 |
have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x" |
|
3268 |
using `e > 0` by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib) |
|
3269 |
have "x \<in> affine hull S" |
|
3270 |
using assms hull_subset[of S] by auto |
|
49531 | 3271 |
moreover have "1 / e + - ((1 - e) / e) = 1" |
53347 | 3272 |
using `e > 0` left_diff_distrib[of "1" "(1-e)" "1/e"] by auto |
3273 |
ultimately have **: "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S" |
|
3274 |
using as affine_affine_hull[of S] mem_affine[of "affine hull S" y x "(1 / e)" "-((1 - e) / e)"] |
|
3275 |
by (simp add: algebra_simps) |
|
40377 | 3276 |
have "dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = abs(1/e) * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)" |
53347 | 3277 |
unfolding dist_norm norm_scaleR[symmetric] |
3278 |
apply (rule arg_cong[where f=norm]) |
|
3279 |
using `e > 0` |
|
3280 |
apply (auto simp add: euclidean_eq_iff[where 'a='a] field_simps inner_simps) |
|
3281 |
done |
|
3282 |
also have "\<dots> = abs (1/e) * norm (x - e *\<^sub>R (x - c) - y)" |
|
3283 |
by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps) |
|
3284 |
also have "\<dots> < d" |
|
3285 |
using as[unfolded dist_norm] and `e > 0` |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57447
diff
changeset
|
3286 |
by (auto simp add:pos_divide_less_eq[OF `e > 0`] mult.commute) |
53347 | 3287 |
finally have "y \<in> S" |
3288 |
apply (subst *) |
|
3289 |
apply (rule assms(1)[unfolded convex_alt,rule_format]) |
|
3290 |
apply (rule d[unfolded subset_eq,rule_format]) |
|
3291 |
unfolding mem_ball |
|
3292 |
using assms(3-5) ** |
|
3293 |
apply auto |
|
3294 |
done |
|
3295 |
} |
|
3296 |
then have "ball (x - e *\<^sub>R (x - c)) (e*d) \<inter> affine hull S \<subseteq> S" |
|
3297 |
by auto |
|
3298 |
moreover have "e * d > 0" |
|
56544 | 3299 |
using `e > 0` `d > 0` by simp |
53347 | 3300 |
moreover have c: "c \<in> S" |
3301 |
using assms rel_interior_subset by auto |
|
3302 |
moreover from c have "x - e *\<^sub>R (x - c) \<in> S" |
|
3303 |
using mem_convex[of S x c e] |
|
3304 |
apply (simp add: algebra_simps) |
|
3305 |
using assms |
|
3306 |
apply auto |
|
3307 |
done |
|
3308 |
ultimately show ?thesis |
|
3309 |
using mem_rel_interior_ball[of "x - e *\<^sub>R (x - c)" S] `e > 0` by auto |
|
40377 | 3310 |
qed |
3311 |
||
3312 |
lemma interior_real_semiline: |
|
53347 | 3313 |
fixes a :: real |
3314 |
shows "interior {a..} = {a<..}" |
|
3315 |
proof - |
|
3316 |
{ |
|
3317 |
fix y |
|
3318 |
assume "a < y" |
|
3319 |
then have "y \<in> interior {a..}" |
|
3320 |
apply (simp add: mem_interior) |
|
3321 |
apply (rule_tac x="(y-a)" in exI) |
|
3322 |
apply (auto simp add: dist_norm) |
|
3323 |
done |
|
3324 |
} |
|
3325 |
moreover |
|
3326 |
{ |
|
3327 |
fix y |
|
3328 |
assume "y \<in> interior {a..}" |
|
3329 |
then obtain e where e: "e > 0" "cball y e \<subseteq> {a..}" |
|
3330 |
using mem_interior_cball[of y "{a..}"] by auto |
|
3331 |
moreover from e have "y - e \<in> cball y e" |
|
3332 |
by (auto simp add: cball_def dist_norm) |
|
3333 |
ultimately have "a \<le> y - e" by auto |
|
3334 |
then have "a < y" using e by auto |
|
3335 |
} |
|
3336 |
ultimately show ?thesis by auto |
|
40377 | 3337 |
qed |
3338 |
||
56188 | 3339 |
lemma rel_interior_real_box: |
53347 | 3340 |
fixes a b :: real |
3341 |
assumes "a < b" |
|
56188 | 3342 |
shows "rel_interior {a .. b} = {a <..< b}" |
53347 | 3343 |
proof - |
54775
2d3df8633dad
prefer box over greaterThanLessThan on euclidean_space
immler
parents:
54465
diff
changeset
|
3344 |
have "box a b \<noteq> {}" |
53347 | 3345 |
using assms |
3346 |
unfolding set_eq_iff |
|
56189
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
immler
parents:
56188
diff
changeset
|
3347 |
by (auto intro!: exI[of _ "(a + b) / 2"] simp: box_def) |
40377 | 3348 |
then show ?thesis |
56188 | 3349 |
using interior_rel_interior_gen[of "cbox a b", symmetric] |
3350 |
by (simp split: split_if_asm del: box_real add: box_real[symmetric] interior_cbox) |
|
40377 | 3351 |
qed |
3352 |
||
3353 |
lemma rel_interior_real_semiline: |
|
53347 | 3354 |
fixes a :: real |
3355 |
shows "rel_interior {a..} = {a<..}" |
|
3356 |
proof - |
|
3357 |
have *: "{a<..} \<noteq> {}" |
|
3358 |
unfolding set_eq_iff by (auto intro!: exI[of _ "a + 1"]) |
|
3359 |
then show ?thesis using interior_real_semiline interior_rel_interior_gen[of "{a..}"] |
|
3360 |
by (auto split: split_if_asm) |
|
40377 | 3361 |
qed |
3362 |
||
44467 | 3363 |
subsubsection {* Relative open sets *} |
40377 | 3364 |
|
53347 | 3365 |
definition "rel_open S \<longleftrightarrow> rel_interior S = S" |
3366 |
||
3367 |
lemma rel_open: "rel_open S \<longleftrightarrow> openin (subtopology euclidean (affine hull S)) S" |
|
3368 |
unfolding rel_open_def rel_interior_def |
|
3369 |
apply auto |
|
3370 |
using openin_subopen[of "subtopology euclidean (affine hull S)" S] |
|
3371 |
apply auto |
|
3372 |
done |
|
3373 |
||
3374 |
lemma opein_rel_interior: "openin (subtopology euclidean (affine hull S)) (rel_interior S)" |
|
40377 | 3375 |
apply (simp add: rel_interior_def) |
53347 | 3376 |
apply (subst openin_subopen) |
3377 |
apply blast |
|
3378 |
done |
|
40377 | 3379 |
|
49531 | 3380 |
lemma affine_rel_open: |
53347 | 3381 |
fixes S :: "'n::euclidean_space set" |
3382 |
assumes "affine S" |
|
3383 |
shows "rel_open S" |
|
3384 |
unfolding rel_open_def |
|
3385 |
using assms rel_interior_univ[of S] affine_hull_eq[of S] |
|
3386 |
by metis |
|
40377 | 3387 |
|
49531 | 3388 |
lemma affine_closed: |
53347 | 3389 |
fixes S :: "'n::euclidean_space set" |
3390 |
assumes "affine S" |
|
3391 |
shows "closed S" |
|
3392 |
proof - |
|
3393 |
{ |
|
3394 |
assume "S \<noteq> {}" |
|
3395 |
then obtain L where L: "subspace L" "affine_parallel S L" |
|
3396 |
using assms affine_parallel_subspace[of S] by auto |
|
3397 |
then obtain a where a: "S = (op + a ` L)" |
|
3398 |
using affine_parallel_def[of L S] affine_parallel_commut by auto |
|
3399 |
from L have "closed L" using closed_subspace by auto |
|
3400 |
then have "closed S" |
|
3401 |
using closed_translation a by auto |
|
3402 |
} |
|
3403 |
then show ?thesis by auto |
|
40377 | 3404 |
qed |
3405 |
||
3406 |
lemma closure_affine_hull: |
|
53347 | 3407 |
fixes S :: "'n::euclidean_space set" |
3408 |
shows "closure S \<subseteq> affine hull S" |
|
44524 | 3409 |
by (intro closure_minimal hull_subset affine_closed affine_affine_hull) |
40377 | 3410 |
|
3411 |
lemma closure_same_affine_hull: |
|
53347 | 3412 |
fixes S :: "'n::euclidean_space set" |
40377 | 3413 |
shows "affine hull (closure S) = affine hull S" |
53347 | 3414 |
proof - |
3415 |
have "affine hull (closure S) \<subseteq> affine hull S" |
|
3416 |
using hull_mono[of "closure S" "affine hull S" "affine"] |
|
3417 |
closure_affine_hull[of S] hull_hull[of "affine" S] |
|
3418 |
by auto |
|
3419 |
moreover have "affine hull (closure S) \<supseteq> affine hull S" |
|
3420 |
using hull_mono[of "S" "closure S" "affine"] closure_subset by auto |
|
3421 |
ultimately show ?thesis by auto |
|
49531 | 3422 |
qed |
3423 |
||
3424 |
lemma closure_aff_dim: |
|
53347 | 3425 |
fixes S :: "'n::euclidean_space set" |
40377 | 3426 |
shows "aff_dim (closure S) = aff_dim S" |
53347 | 3427 |
proof - |
3428 |
have "aff_dim S \<le> aff_dim (closure S)" |
|
3429 |
using aff_dim_subset closure_subset by auto |
|
3430 |
moreover have "aff_dim (closure S) \<le> aff_dim (affine hull S)" |
|
3431 |
using aff_dim_subset closure_affine_hull by auto |
|
3432 |
moreover have "aff_dim (affine hull S) = aff_dim S" |
|
3433 |
using aff_dim_affine_hull by auto |
|
3434 |
ultimately show ?thesis by auto |
|
40377 | 3435 |
qed |
3436 |
||
3437 |
lemma rel_interior_closure_convex_shrink: |
|
53347 | 3438 |
fixes S :: "_::euclidean_space set" |
3439 |
assumes "convex S" |
|
3440 |
and "c \<in> rel_interior S" |
|
3441 |
and "x \<in> closure S" |
|
3442 |
and "e > 0" |
|
3443 |
and "e \<le> 1" |
|
3444 |
shows "x - e *\<^sub>R (x - c) \<in> rel_interior S" |
|
3445 |
proof - |
|
3446 |
obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S" |
|
3447 |
using assms(2) unfolding mem_rel_interior_ball by auto |
|
3448 |
have "\<exists>y \<in> S. norm (y - x) * (1 - e) < e * d" |
|
3449 |
proof (cases "x \<in> S") |
|
3450 |
case True |
|
3451 |
then show ?thesis using `e > 0` `d > 0` |
|
3452 |
apply (rule_tac bexI[where x=x]) |
|
56544 | 3453 |
apply (auto) |
53347 | 3454 |
done |
3455 |
next |
|
3456 |
case False |
|
3457 |
then have x: "x islimpt S" |
|
3458 |
using assms(3)[unfolded closure_def] by auto |
|
3459 |
show ?thesis |
|
3460 |
proof (cases "e = 1") |
|
3461 |
case True |
|
3462 |
obtain y where "y \<in> S" "y \<noteq> x" "dist y x < 1" |
|
40377 | 3463 |
using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto |
53347 | 3464 |
then show ?thesis |
3465 |
apply (rule_tac x=y in bexI) |
|
3466 |
unfolding True |
|
3467 |
using `d > 0` |
|
3468 |
apply auto |
|
3469 |
done |
|
3470 |
next |
|
3471 |
case False |
|
3472 |
then have "0 < e * d / (1 - e)" and *: "1 - e > 0" |
|
56544 | 3473 |
using `e \<le> 1` `e > 0` `d > 0` by (auto) |
53347 | 3474 |
then obtain y where "y \<in> S" "y \<noteq> x" "dist y x < e * d / (1 - e)" |
40377 | 3475 |
using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto |
53347 | 3476 |
then show ?thesis |
3477 |
apply (rule_tac x=y in bexI) |
|
3478 |
unfolding dist_norm |
|
3479 |
using pos_less_divide_eq[OF *] |
|
3480 |
apply auto |
|
3481 |
done |
|
3482 |
qed |
|
3483 |
qed |
|
3484 |
then obtain y where "y \<in> S" and y: "norm (y - x) * (1 - e) < e * d" |
|
3485 |
by auto |
|
3486 |
def z \<equiv> "c + ((1 - e) / e) *\<^sub>R (x - y)" |
|
3487 |
have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)" |
|
3488 |
unfolding z_def using `e > 0` |
|
3489 |
by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib) |
|
3490 |
have zball: "z \<in> ball c d" |
|
3491 |
using mem_ball z_def dist_norm[of c] |
|
3492 |
using y and assms(4,5) |
|
3493 |
by (auto simp add:field_simps norm_minus_commute) |
|
3494 |
have "x \<in> affine hull S" |
|
3495 |
using closure_affine_hull assms by auto |
|
3496 |
moreover have "y \<in> affine hull S" |
|
3497 |
using `y \<in> S` hull_subset[of S] by auto |
|
3498 |
moreover have "c \<in> affine hull S" |
|
3499 |
using assms rel_interior_subset hull_subset[of S] by auto |
|
3500 |
ultimately have "z \<in> affine hull S" |
|
49531 | 3501 |
using z_def affine_affine_hull[of S] |
53347 | 3502 |
mem_affine_3_minus [of "affine hull S" c x y "(1 - e) / e"] |
3503 |
assms |
|
3504 |
by (auto simp add: field_simps) |
|
3505 |
then have "z \<in> S" using d zball by auto |
|
3506 |
obtain d1 where "d1 > 0" and d1: "ball z d1 \<le> ball c d" |
|
40377 | 3507 |
using zball open_ball[of c d] openE[of "ball c d" z] by auto |
53347 | 3508 |
then have "ball z d1 \<inter> affine hull S \<subseteq> ball c d \<inter> affine hull S" |
3509 |
by auto |
|
3510 |
then have "ball z d1 \<inter> affine hull S \<subseteq> S" |
|
3511 |
using d by auto |
|
3512 |
then have "z \<in> rel_interior S" |
|
3513 |
using mem_rel_interior_ball using `d1 > 0` `z \<in> S` by auto |
|
3514 |
then have "y - e *\<^sub>R (y - z) \<in> rel_interior S" |
|
3515 |
using rel_interior_convex_shrink[of S z y e] assms `y \<in> S` by auto |
|
3516 |
then show ?thesis using * by auto |
|
3517 |
qed |
|
3518 |
||
40377 | 3519 |
|
44467 | 3520 |
subsubsection{* Relative interior preserves under linear transformations *} |
40377 | 3521 |
|
3522 |
lemma rel_interior_translation_aux: |
|
53347 | 3523 |
fixes a :: "'n::euclidean_space" |
3524 |
shows "((\<lambda>x. a + x) ` rel_interior S) \<subseteq> rel_interior ((\<lambda>x. a + x) ` S)" |
|
3525 |
proof - |
|
3526 |
{ |
|
3527 |
fix x |
|
3528 |
assume x: "x \<in> rel_interior S" |
|
3529 |
then obtain T where "open T" "x \<in> T \<inter> S" "T \<inter> affine hull S \<subseteq> S" |
|
3530 |
using mem_rel_interior[of x S] by auto |
|
3531 |
then have "open ((\<lambda>x. a + x) ` T)" |
|
3532 |
and "a + x \<in> ((\<lambda>x. a + x) ` T) \<inter> ((\<lambda>x. a + x) ` S)" |
|
3533 |
and "((\<lambda>x. a + x) ` T) \<inter> affine hull ((\<lambda>x. a + x) ` S) \<subseteq> (\<lambda>x. a + x) ` S" |
|
3534 |
using affine_hull_translation[of a S] open_translation[of T a] x by auto |
|
3535 |
then have "a + x \<in> rel_interior ((\<lambda>x. a + x) ` S)" |
|
3536 |
using mem_rel_interior[of "a+x" "((\<lambda>x. a + x) ` S)"] by auto |
|
3537 |
} |
|
3538 |
then show ?thesis by auto |
|
40377 | 3539 |
qed |
3540 |
||
3541 |
lemma rel_interior_translation: |
|
53347 | 3542 |
fixes a :: "'n::euclidean_space" |
3543 |
shows "rel_interior ((\<lambda>x. a + x) ` S) = (\<lambda>x. a + x) ` rel_interior S" |
|
3544 |
proof - |
|
3545 |
have "(\<lambda>x. (-a) + x) ` rel_interior ((\<lambda>x. a + x) ` S) \<subseteq> rel_interior S" |
|
3546 |
using rel_interior_translation_aux[of "-a" "(\<lambda>x. a + x) ` S"] |
|
3547 |
translation_assoc[of "-a" "a"] |
|
3548 |
by auto |
|
3549 |
then have "((\<lambda>x. a + x) ` rel_interior S) \<supseteq> rel_interior ((\<lambda>x. a + x) ` S)" |
|
3550 |
using translation_inverse_subset[of a "rel_interior (op + a ` S)" "rel_interior S"] |
|
3551 |
by auto |
|
3552 |
then show ?thesis |
|
3553 |
using rel_interior_translation_aux[of a S] by auto |
|
40377 | 3554 |
qed |
3555 |
||
3556 |
||
3557 |
lemma affine_hull_linear_image: |
|
53347 | 3558 |
assumes "bounded_linear f" |
3559 |
shows "f ` (affine hull s) = affine hull f ` s" |
|
3560 |
apply rule |
|
3561 |
unfolding subset_eq ball_simps |
|
3562 |
apply (rule_tac[!] hull_induct, rule hull_inc) |
|
3563 |
prefer 3 |
|
3564 |
apply (erule imageE) |
|
3565 |
apply (rule_tac x=xa in image_eqI) |
|
3566 |
apply assumption |
|
3567 |
apply (rule hull_subset[unfolded subset_eq, rule_format]) |
|
3568 |
apply assumption |
|
3569 |
proof - |
|
40377 | 3570 |
interpret f: bounded_linear f by fact |
53347 | 3571 |
show "affine {x. f x \<in> affine hull f ` s}" |
3572 |
unfolding affine_def |
|
3573 |
by (auto simp add: f.scaleR f.add affine_affine_hull[unfolded affine_def, rule_format]) |
|
3574 |
show "affine {x. x \<in> f ` (affine hull s)}" |
|
3575 |
using affine_affine_hull[unfolded affine_def, of s] |
|
40377 | 3576 |
unfolding affine_def by (auto simp add: f.scaleR [symmetric] f.add [symmetric]) |
3577 |
qed auto |
|
3578 |
||
3579 |
||
3580 |
lemma rel_interior_injective_on_span_linear_image: |
|
53347 | 3581 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
3582 |
and S :: "'m::euclidean_space set" |
|
3583 |
assumes "bounded_linear f" |
|
3584 |
and "inj_on f (span S)" |
|
3585 |
shows "rel_interior (f ` S) = f ` (rel_interior S)" |
|
3586 |
proof - |
|
3587 |
{ |
|
3588 |
fix z |
|
3589 |
assume z: "z \<in> rel_interior (f ` S)" |
|
3590 |
then have "z \<in> f ` S" |
|
3591 |
using rel_interior_subset[of "f ` S"] by auto |
|
3592 |
then obtain x where x: "x \<in> S" "f x = z" by auto |
|
3593 |
obtain e2 where e2: "e2 > 0" "cball z e2 \<inter> affine hull (f ` S) \<subseteq> (f ` S)" |
|
3594 |
using z rel_interior_cball[of "f ` S"] by auto |
|
3595 |
obtain K where K: "K > 0" "\<And>x. norm (f x) \<le> norm x * K" |
|
3596 |
using assms Real_Vector_Spaces.bounded_linear.pos_bounded[of f] by auto |
|
3597 |
def e1 \<equiv> "1 / K" |
|
3598 |
then have e1: "e1 > 0" "\<And>x. e1 * norm (f x) \<le> norm x" |
|
3599 |
using K pos_le_divide_eq[of e1] by auto |
|
3600 |
def e \<equiv> "e1 * e2" |
|
56544 | 3601 |
then have "e > 0" using e1 e2 by auto |
53347 | 3602 |
{ |
3603 |
fix y |
|
3604 |
assume y: "y \<in> cball x e \<inter> affine hull S" |
|
3605 |
then have h1: "f y \<in> affine hull (f ` S)" |
|
3606 |
using affine_hull_linear_image[of f S] assms by auto |
|
3607 |
from y have "norm (x-y) \<le> e1 * e2" |
|
3608 |
using cball_def[of x e] dist_norm[of x y] e_def by auto |
|
3609 |
moreover have "f x - f y = f (x - y)" |
|
3610 |
using assms linear_sub[of f x y] linear_conv_bounded_linear[of f] by auto |
|
3611 |
moreover have "e1 * norm (f (x-y)) \<le> norm (x - y)" |
|
3612 |
using e1 by auto |
|
3613 |
ultimately have "e1 * norm ((f x)-(f y)) \<le> e1 * e2" |
|
3614 |
by auto |
|
3615 |
then have "f y \<in> cball z e2" |
|
3616 |
using cball_def[of "f x" e2] dist_norm[of "f x" "f y"] e1 x by auto |
|
3617 |
then have "f y \<in> f ` S" |
|
3618 |
using y e2 h1 by auto |
|
3619 |
then have "y \<in> S" |
|
3620 |
using assms y hull_subset[of S] affine_hull_subset_span |
|
3621 |
inj_on_image_mem_iff[of f "span S" S y] |
|
3622 |
by auto |
|
3623 |
} |
|
3624 |
then have "z \<in> f ` (rel_interior S)" |
|
3625 |
using mem_rel_interior_cball[of x S] `e > 0` x by auto |
|
49531 | 3626 |
} |
53347 | 3627 |
moreover |
3628 |
{ |
|
3629 |
fix x |
|
3630 |
assume x: "x \<in> rel_interior S" |
|
54465 | 3631 |
then obtain e2 where e2: "e2 > 0" "cball x e2 \<inter> affine hull S \<subseteq> S" |
53347 | 3632 |
using rel_interior_cball[of S] by auto |
3633 |
have "x \<in> S" using x rel_interior_subset by auto |
|
3634 |
then have *: "f x \<in> f ` S" by auto |
|
3635 |
have "\<forall>x\<in>span S. f x = 0 \<longrightarrow> x = 0" |
|
3636 |
using assms subspace_span linear_conv_bounded_linear[of f] |
|
3637 |
linear_injective_on_subspace_0[of f "span S"] |
|
3638 |
by auto |
|
3639 |
then obtain e1 where e1: "e1 > 0" "\<forall>x \<in> span S. e1 * norm x \<le> norm (f x)" |
|
3640 |
using assms injective_imp_isometric[of "span S" f] |
|
3641 |
subspace_span[of S] closed_subspace[of "span S"] |
|
3642 |
by auto |
|
3643 |
def e \<equiv> "e1 * e2" |
|
56544 | 3644 |
hence "e > 0" using e1 e2 by auto |
53347 | 3645 |
{ |
3646 |
fix y |
|
3647 |
assume y: "y \<in> cball (f x) e \<inter> affine hull (f ` S)" |
|
3648 |
then have "y \<in> f ` (affine hull S)" |
|
3649 |
using affine_hull_linear_image[of f S] assms by auto |
|
3650 |
then obtain xy where xy: "xy \<in> affine hull S" "f xy = y" by auto |
|
3651 |
with y have "norm (f x - f xy) \<le> e1 * e2" |
|
3652 |
using cball_def[of "f x" e] dist_norm[of "f x" y] e_def by auto |
|
3653 |
moreover have "f x - f xy = f (x - xy)" |
|
3654 |
using assms linear_sub[of f x xy] linear_conv_bounded_linear[of f] by auto |
|
3655 |
moreover have *: "x - xy \<in> span S" |
|
3656 |
using subspace_sub[of "span S" x xy] subspace_span `x \<in> S` xy |
|
3657 |
affine_hull_subset_span[of S] span_inc |
|
3658 |
by auto |
|
3659 |
moreover from * have "e1 * norm (x - xy) \<le> norm (f (x - xy))" |
|
3660 |
using e1 by auto |
|
3661 |
ultimately have "e1 * norm (x - xy) \<le> e1 * e2" |
|
3662 |
by auto |
|
3663 |
then have "xy \<in> cball x e2" |
|
3664 |
using cball_def[of x e2] dist_norm[of x xy] e1 by auto |
|
3665 |
then have "y \<in> f ` S" |
|
3666 |
using xy e2 by auto |
|
3667 |
} |
|
3668 |
then have "f x \<in> rel_interior (f ` S)" |
|
3669 |
using mem_rel_interior_cball[of "(f x)" "(f ` S)"] * `e > 0` by auto |
|
49531 | 3670 |
} |
53347 | 3671 |
ultimately show ?thesis by auto |
40377 | 3672 |
qed |
3673 |
||
3674 |
lemma rel_interior_injective_linear_image: |
|
53347 | 3675 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
3676 |
assumes "bounded_linear f" |
|
3677 |
and "inj f" |
|
3678 |
shows "rel_interior (f ` S) = f ` (rel_interior S)" |
|
3679 |
using assms rel_interior_injective_on_span_linear_image[of f S] |
|
3680 |
subset_inj_on[of f "UNIV" "span S"] |
|
3681 |
by auto |
|
3682 |
||
40377 | 3683 |
|
3684 |
subsection{* Some Properties of subset of standard basis *} |
|
3685 |
||
53347 | 3686 |
lemma affine_hull_substd_basis: |
3687 |
assumes "d \<subseteq> Basis" |
|
3688 |
shows "affine hull (insert 0 d) = {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0}" |
|
3689 |
(is "affine hull (insert 0 ?A) = ?B") |
|
3690 |
proof - |
|
3691 |
have *: "\<And>A. op + (0\<Colon>'a) ` A = A" "\<And>A. op + (- (0\<Colon>'a)) ` A = A" |
|
3692 |
by auto |
|
3693 |
show ?thesis |
|
3694 |
unfolding affine_hull_insert_span_gen span_substd_basis[OF assms,symmetric] * .. |
|
40377 | 3695 |
qed |
3696 |
||
3697 |
lemma affine_hull_convex_hull: "affine hull (convex hull S) = affine hull S" |
|
53347 | 3698 |
by (metis Int_absorb1 Int_absorb2 convex_hull_subset_affine_hull hull_hull hull_mono hull_subset) |
3699 |
||
40377 | 3700 |
|
33175 | 3701 |
subsection {* Openness and compactness are preserved by convex hull operation. *} |
3702 |
||
34964 | 3703 |
lemma open_convex_hull[intro]: |
33175 | 3704 |
fixes s :: "'a::real_normed_vector set" |
3705 |
assumes "open s" |
|
53347 | 3706 |
shows "open (convex hull s)" |
3707 |
unfolding open_contains_cball convex_hull_explicit |
|
3708 |
unfolding mem_Collect_eq ball_simps(8) |
|
3709 |
proof (rule, rule) |
|
3710 |
fix a |
|
33175 | 3711 |
assume "\<exists>sa u. finite sa \<and> sa \<subseteq> s \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = a" |
53347 | 3712 |
then obtain t u where obt: "finite t" "t\<subseteq>s" "\<forall>x\<in>t. 0 \<le> u x" "setsum u t = 1" "(\<Sum>v\<in>t. u v *\<^sub>R v) = a" |
3713 |
by auto |
|
3714 |
||
3715 |
from assms[unfolded open_contains_cball] obtain b |
|
3716 |
where b: "\<forall>x\<in>s. 0 < b x \<and> cball x (b x) \<subseteq> s" |
|
3717 |
using bchoice[of s "\<lambda>x e. e > 0 \<and> cball x e \<subseteq> s"] by auto |
|
3718 |
have "b ` t \<noteq> {}" |
|
56889
48a745e1bde7
avoid the Complex constructor, use the more natural Re/Im view; moved csqrt to Complex.
hoelzl
parents:
56571
diff
changeset
|
3719 |
using obt by auto |
53347 | 3720 |
def i \<equiv> "b ` t" |
3721 |
||
3722 |
show "\<exists>e > 0. |
|
3723 |
cball a e \<subseteq> {y. \<exists>sa u. finite sa \<and> sa \<subseteq> s \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y}" |
|
3724 |
apply (rule_tac x = "Min i" in exI) |
|
3725 |
unfolding subset_eq |
|
3726 |
apply rule |
|
3727 |
defer |
|
3728 |
apply rule |
|
3729 |
unfolding mem_Collect_eq |
|
3730 |
proof - |
|
3731 |
show "0 < Min i" |
|
3732 |
unfolding i_def and Min_gr_iff[OF finite_imageI[OF obt(1)] `b \` t\<noteq>{}`] |
|
3733 |
using b |
|
3734 |
apply simp |
|
3735 |
apply rule |
|
3736 |
apply (erule_tac x=x in ballE) |
|
3737 |
using `t\<subseteq>s` |
|
3738 |
apply auto |
|
3739 |
done |
|
3740 |
next |
|
3741 |
fix y |
|
3742 |
assume "y \<in> cball a (Min i)" |
|
3743 |
then have y: "norm (a - y) \<le> Min i" |
|
3744 |
unfolding dist_norm[symmetric] by auto |
|
3745 |
{ |
|
3746 |
fix x |
|
3747 |
assume "x \<in> t" |
|
3748 |
then have "Min i \<le> b x" |
|
3749 |
unfolding i_def |
|
3750 |
apply (rule_tac Min_le) |
|
3751 |
using obt(1) |
|
3752 |
apply auto |
|
3753 |
done |
|
3754 |
then have "x + (y - a) \<in> cball x (b x)" |
|
3755 |
using y unfolding mem_cball dist_norm by auto |
|
3756 |
moreover from `x\<in>t` have "x \<in> s" |
|
3757 |
using obt(2) by auto |
|
3758 |
ultimately have "x + (y - a) \<in> s" |
|
54465 | 3759 |
using y and b[THEN bspec[where x=x]] unfolding subset_eq by fast |
53347 | 3760 |
} |
33175 | 3761 |
moreover |
53347 | 3762 |
have *: "inj_on (\<lambda>v. v + (y - a)) t" |
3763 |
unfolding inj_on_def by auto |
|
33175 | 3764 |
have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a))) = 1" |
57418 | 3765 |
unfolding setsum.reindex[OF *] o_def using obt(4) by auto |
33175 | 3766 |
moreover have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a)) *\<^sub>R v) = y" |
57418 | 3767 |
unfolding setsum.reindex[OF *] o_def using obt(4,5) |
3768 |
by (simp add: setsum.distrib setsum_subtractf scaleR_left.setsum[symmetric] scaleR_right_distrib) |
|
53347 | 3769 |
ultimately |
3770 |
show "\<exists>sa u. finite sa \<and> (\<forall>x\<in>sa. x \<in> s) \<and> (\<forall>x\<in>sa. 0 \<le> u x) \<and> setsum u sa = 1 \<and> (\<Sum>v\<in>sa. u v *\<^sub>R v) = y" |
|
3771 |
apply (rule_tac x="(\<lambda>v. v + (y - a)) ` t" in exI) |
|
3772 |
apply (rule_tac x="\<lambda>v. u (v - (y - a))" in exI) |
|
3773 |
using obt(1, 3) |
|
3774 |
apply auto |
|
3775 |
done |
|
33175 | 3776 |
qed |
3777 |
qed |
|
3778 |
||
3779 |
lemma compact_convex_combinations: |
|
3780 |
fixes s t :: "'a::real_normed_vector set" |
|
3781 |
assumes "compact s" "compact t" |
|
3782 |
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 | 3783 |
proof - |
33175 | 3784 |
let ?X = "{0..1} \<times> s \<times> t" |
3785 |
let ?h = "(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" |
|
53347 | 3786 |
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" |
3787 |
apply (rule set_eqI) |
|
3788 |
unfolding image_iff mem_Collect_eq |
|
3789 |
apply rule |
|
3790 |
apply auto |
|
3791 |
apply (rule_tac x=u in rev_bexI) |
|
3792 |
apply simp |
|
3793 |
apply (erule rev_bexI) |
|
3794 |
apply (erule rev_bexI) |
|
3795 |
apply simp |
|
3796 |
apply auto |
|
3797 |
done |
|
56188 | 3798 |
have "continuous_on ?X (\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" |
33175 | 3799 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros) |
53347 | 3800 |
then show ?thesis |
3801 |
unfolding * |
|
33175 | 3802 |
apply (rule compact_continuous_image) |
56188 | 3803 |
apply (intro compact_Times compact_Icc assms) |
33175 | 3804 |
done |
3805 |
qed |
|
3806 |
||
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3807 |
lemma finite_imp_compact_convex_hull: |
53347 | 3808 |
fixes s :: "'a::real_normed_vector set" |
3809 |
assumes "finite s" |
|
3810 |
shows "compact (convex hull s)" |
|
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3811 |
proof (cases "s = {}") |
53347 | 3812 |
case True |
3813 |
then show ?thesis by simp |
|
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3814 |
next |
53347 | 3815 |
case False |
3816 |
with assms show ?thesis |
|
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3817 |
proof (induct rule: finite_ne_induct) |
53347 | 3818 |
case (singleton x) |
3819 |
show ?case by simp |
|
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3820 |
next |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3821 |
case (insert x A) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3822 |
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:
44524
diff
changeset
|
3823 |
let ?T = "{0..1::real} \<times> (convex hull A)" |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3824 |
have "continuous_on ?T ?f" |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3825 |
unfolding split_def continuous_on by (intro ballI tendsto_intros) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3826 |
moreover have "compact ?T" |
56188 | 3827 |
by (intro compact_Times compact_Icc insert) |
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3828 |
ultimately have "compact (?f ` ?T)" |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3829 |
by (rule compact_continuous_image) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3830 |
also have "?f ` ?T = convex hull (insert x A)" |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3831 |
unfolding convex_hull_insert [OF `A \<noteq> {}`] |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3832 |
apply safe |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3833 |
apply (rule_tac x=a in exI, simp) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3834 |
apply (rule_tac x="1 - a" in exI, simp) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3835 |
apply fast |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3836 |
apply (rule_tac x="(u, b)" in image_eqI, simp_all) |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3837 |
done |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3838 |
finally show "compact (convex hull (insert x A))" . |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3839 |
qed |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3840 |
qed |
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
3841 |
|
53347 | 3842 |
lemma compact_convex_hull: |
3843 |
fixes s :: "'a::euclidean_space set" |
|
3844 |
assumes "compact s" |
|
3845 |
shows "compact (convex hull s)" |
|
3846 |
proof (cases "s = {}") |
|
3847 |
case True |
|
3848 |
then show ?thesis using compact_empty by simp |
|
33175 | 3849 |
next |
53347 | 3850 |
case False |
3851 |
then obtain w where "w \<in> s" by auto |
|
3852 |
show ?thesis |
|
3853 |
unfolding caratheodory[of s] |
|
3854 |
proof (induct ("DIM('a) + 1")) |
|
3855 |
case 0 |
|
3856 |
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:
36341
diff
changeset
|
3857 |
using compact_empty by auto |
53347 | 3858 |
from 0 show ?case unfolding * by simp |
33175 | 3859 |
next |
3860 |
case (Suc n) |
|
53347 | 3861 |
show ?case |
3862 |
proof (cases "n = 0") |
|
3863 |
case True |
|
3864 |
have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} = s" |
|
3865 |
unfolding set_eq_iff and mem_Collect_eq |
|
3866 |
proof (rule, rule) |
|
3867 |
fix x |
|
3868 |
assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
|
3869 |
then obtain t where t: "finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t" |
|
3870 |
by auto |
|
3871 |
show "x \<in> s" |
|
3872 |
proof (cases "card t = 0") |
|
3873 |
case True |
|
3874 |
then show ?thesis |
|
3875 |
using t(4) unfolding card_0_eq[OF t(1)] by simp |
|
33175 | 3876 |
next |
53347 | 3877 |
case False |
3878 |
then have "card t = Suc 0" using t(3) `n=0` by auto |
|
33175 | 3879 |
then obtain a where "t = {a}" unfolding card_Suc_eq by auto |
53347 | 3880 |
then show ?thesis using t(2,4) by simp |
33175 | 3881 |
qed |
3882 |
next |
|
3883 |
fix x assume "x\<in>s" |
|
53347 | 3884 |
then show "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
3885 |
apply (rule_tac x="{x}" in exI) |
|
3886 |
unfolding convex_hull_singleton |
|
3887 |
apply auto |
|
3888 |
done |
|
3889 |
qed |
|
3890 |
then show ?thesis using assms by simp |
|
33175 | 3891 |
next |
53347 | 3892 |
case False |
3893 |
have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} = |
|
3894 |
{(1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. |
|
3895 |
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}}" |
|
3896 |
unfolding set_eq_iff and mem_Collect_eq |
|
3897 |
proof (rule, rule) |
|
3898 |
fix x |
|
3899 |
assume "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> |
|
33175 | 3900 |
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)" |
53347 | 3901 |
then obtain u v c t where obt: "x = (1 - c) *\<^sub>R u + c *\<^sub>R v" |
3902 |
"0 \<le> c \<and> c \<le> 1" "u \<in> s" "finite t" "t \<subseteq> s" "card t \<le> n" "v \<in> convex hull t" |
|
3903 |
by auto |
|
33175 | 3904 |
moreover have "(1 - c) *\<^sub>R u + c *\<^sub>R v \<in> convex hull insert u t" |
53347 | 3905 |
apply (rule mem_convex) |
3906 |
using obt(2) and convex_convex_hull and hull_subset[of "insert u t" convex] |
|
3907 |
using obt(7) and hull_mono[of t "insert u t"] |
|
3908 |
apply auto |
|
3909 |
done |
|
33175 | 3910 |
ultimately show "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
53347 | 3911 |
apply (rule_tac x="insert u t" in exI) |
3912 |
apply (auto simp add: card_insert_if) |
|
3913 |
done |
|
33175 | 3914 |
next |
53347 | 3915 |
fix x |
3916 |
assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
|
3917 |
then obtain t where t: "finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t" |
|
3918 |
by auto |
|
3919 |
show "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> |
|
33175 | 3920 |
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)" |
53347 | 3921 |
proof (cases "card t = Suc n") |
3922 |
case False |
|
3923 |
then have "card t \<le> n" using t(3) by auto |
|
3924 |
then show ?thesis |
|
3925 |
apply (rule_tac x=w in exI, rule_tac x=x in exI, rule_tac x=1 in exI) |
|
3926 |
using `w\<in>s` and t |
|
3927 |
apply (auto intro!: exI[where x=t]) |
|
3928 |
done |
|
33175 | 3929 |
next |
53347 | 3930 |
case True |
3931 |
then obtain a u where au: "t = insert a u" "a\<notin>u" |
|
3932 |
apply (drule_tac card_eq_SucD) |
|
3933 |
apply auto |
|
3934 |
done |
|
3935 |
show ?thesis |
|
3936 |
proof (cases "u = {}") |
|
3937 |
case True |
|
3938 |
then have "x = a" using t(4)[unfolded au] by auto |
|
3939 |
show ?thesis unfolding `x = a` |
|
3940 |
apply (rule_tac x=a in exI) |
|
3941 |
apply (rule_tac x=a in exI) |
|
3942 |
apply (rule_tac x=1 in exI) |
|
3943 |
using t and `n \<noteq> 0` |
|
3944 |
unfolding au |
|
3945 |
apply (auto intro!: exI[where x="{a}"]) |
|
3946 |
done |
|
33175 | 3947 |
next |
53347 | 3948 |
case False |
3949 |
obtain ux vx b where obt: "ux\<ge>0" "vx\<ge>0" "ux + vx = 1" |
|
3950 |
"b \<in> convex hull u" "x = ux *\<^sub>R a + vx *\<^sub>R b" |
|
3951 |
using t(4)[unfolded au convex_hull_insert[OF False]] |
|
3952 |
by auto |
|
3953 |
have *: "1 - vx = ux" using obt(3) by auto |
|
3954 |
show ?thesis |
|
3955 |
apply (rule_tac x=a in exI) |
|
3956 |
apply (rule_tac x=b in exI) |
|
3957 |
apply (rule_tac x=vx in exI) |
|
3958 |
using obt and t(1-3) |
|
3959 |
unfolding au and * using card_insert_disjoint[OF _ au(2)] |
|
3960 |
apply (auto intro!: exI[where x=u]) |
|
3961 |
done |
|
33175 | 3962 |
qed |
3963 |
qed |
|
3964 |
qed |
|
53347 | 3965 |
then show ?thesis |
3966 |
using compact_convex_combinations[OF assms Suc] by simp |
|
33175 | 3967 |
qed |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3968 |
qed |
33175 | 3969 |
qed |
3970 |
||
53347 | 3971 |
|
33175 | 3972 |
subsection {* Extremal points of a simplex are some vertices. *} |
3973 |
||
3974 |
lemma dist_increases_online: |
|
3975 |
fixes a b d :: "'a::real_inner" |
|
3976 |
assumes "d \<noteq> 0" |
|
3977 |
shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b" |
|
53347 | 3978 |
proof (cases "inner a d - inner b d > 0") |
3979 |
case True |
|
3980 |
then have "0 < inner d d + (inner a d * 2 - inner b d * 2)" |
|
3981 |
apply (rule_tac add_pos_pos) |
|
3982 |
using assms |
|
3983 |
apply auto |
|
3984 |
done |
|
3985 |
then show ?thesis |
|
3986 |
apply (rule_tac disjI2) |
|
3987 |
unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff |
|
3988 |
apply (simp add: algebra_simps inner_commute) |
|
3989 |
done |
|
33175 | 3990 |
next |
53347 | 3991 |
case False |
3992 |
then have "0 < inner d d + (inner b d * 2 - inner a d * 2)" |
|
3993 |
apply (rule_tac add_pos_nonneg) |
|
3994 |
using assms |
|
3995 |
apply auto |
|
3996 |
done |
|
3997 |
then show ?thesis |
|
3998 |
apply (rule_tac disjI1) |
|
3999 |
unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff |
|
4000 |
apply (simp add: algebra_simps inner_commute) |
|
4001 |
done |
|
33175 | 4002 |
qed |
4003 |
||
4004 |
lemma norm_increases_online: |
|
4005 |
fixes d :: "'a::real_inner" |
|
53347 | 4006 |
shows "d \<noteq> 0 \<Longrightarrow> norm (a + d) > norm a \<or> norm(a - d) > norm a" |
33175 | 4007 |
using dist_increases_online[of d a 0] unfolding dist_norm by auto |
4008 |
||
4009 |
lemma simplex_furthest_lt: |
|
53347 | 4010 |
fixes s :: "'a::real_inner set" |
4011 |
assumes "finite s" |
|
4012 |
shows "\<forall>x \<in> convex hull s. x \<notin> s \<longrightarrow> (\<exists>y \<in> convex hull s. norm (x - a) < norm(y - a))" |
|
4013 |
using assms |
|
4014 |
proof induct |
|
4015 |
fix x s |
|
4016 |
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))" |
|
4017 |
show "\<forall>xa\<in>convex hull insert x s. xa \<notin> insert x s \<longrightarrow> |
|
4018 |
(\<exists>y\<in>convex hull insert x s. norm (xa - a) < norm (y - a))" |
|
4019 |
proof (rule, rule, cases "s = {}") |
|
4020 |
case False |
|
4021 |
fix y |
|
4022 |
assume y: "y \<in> convex hull insert x s" "y \<notin> insert x s" |
|
4023 |
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 | 4024 |
using y(1)[unfolded convex_hull_insert[OF False]] by auto |
4025 |
show "\<exists>z\<in>convex hull insert x s. norm (y - a) < norm (z - a)" |
|
53347 | 4026 |
proof (cases "y \<in> convex hull s") |
4027 |
case True |
|
4028 |
then obtain z where "z \<in> convex hull s" "norm (y - a) < norm (z - a)" |
|
33175 | 4029 |
using as(3)[THEN bspec[where x=y]] and y(2) by auto |
53347 | 4030 |
then show ?thesis |
4031 |
apply (rule_tac x=z in bexI) |
|
4032 |
unfolding convex_hull_insert[OF False] |
|
4033 |
apply auto |
|
4034 |
done |
|
33175 | 4035 |
next |
53347 | 4036 |
case False |
4037 |
show ?thesis |
|
4038 |
using obt(3) |
|
4039 |
proof (cases "u = 0", case_tac[!] "v = 0") |
|
4040 |
assume "u = 0" "v \<noteq> 0" |
|
4041 |
then have "y = b" using obt by auto |
|
4042 |
then show ?thesis using False and obt(4) by auto |
|
33175 | 4043 |
next |
53347 | 4044 |
assume "u \<noteq> 0" "v = 0" |
4045 |
then have "y = x" using obt by auto |
|
4046 |
then show ?thesis using y(2) by auto |
|
4047 |
next |
|
4048 |
assume "u \<noteq> 0" "v \<noteq> 0" |
|
4049 |
then obtain w where w: "w>0" "w<u" "w<v" |
|
4050 |
using real_lbound_gt_zero[of u v] and obt(1,2) by auto |
|
4051 |
have "x \<noteq> b" |
|
4052 |
proof |
|
4053 |
assume "x = b" |
|
4054 |
then have "y = b" unfolding obt(5) |
|
4055 |
using obt(3) by (auto simp add: scaleR_left_distrib[symmetric]) |
|
4056 |
then show False using obt(4) and False by simp |
|
4057 |
qed |
|
4058 |
then have *: "w *\<^sub>R (x - b) \<noteq> 0" using w(1) by auto |
|
4059 |
show ?thesis |
|
4060 |
using dist_increases_online[OF *, of a y] |
|
4061 |
proof (elim disjE) |
|
33175 | 4062 |
assume "dist a y < dist a (y + w *\<^sub>R (x - b))" |
53347 | 4063 |
then have "norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)" |
4064 |
unfolding dist_commute[of a] |
|
4065 |
unfolding dist_norm obt(5) |
|
4066 |
by (simp add: algebra_simps) |
|
33175 | 4067 |
moreover have "(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x s" |
4068 |
unfolding convex_hull_insert[OF `s\<noteq>{}`] and mem_Collect_eq |
|
53347 | 4069 |
apply (rule_tac x="u + w" in exI) |
4070 |
apply rule |
|
4071 |
defer |
|
4072 |
apply (rule_tac x="v - w" in exI) |
|
4073 |
using `u \<ge> 0` and w and obt(3,4) |
|
4074 |
apply auto |
|
4075 |
done |
|
33175 | 4076 |
ultimately show ?thesis by auto |
4077 |
next |
|
4078 |
assume "dist a y < dist a (y - w *\<^sub>R (x - b))" |
|
53347 | 4079 |
then have "norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)" |
4080 |
unfolding dist_commute[of a] |
|
4081 |
unfolding dist_norm obt(5) |
|
4082 |
by (simp add: algebra_simps) |
|
33175 | 4083 |
moreover have "(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x s" |
4084 |
unfolding convex_hull_insert[OF `s\<noteq>{}`] and mem_Collect_eq |
|
53347 | 4085 |
apply (rule_tac x="u - w" in exI) |
4086 |
apply rule |
|
4087 |
defer |
|
4088 |
apply (rule_tac x="v + w" in exI) |
|
4089 |
using `u \<ge> 0` and w and obt(3,4) |
|
4090 |
apply auto |
|
4091 |
done |
|
33175 | 4092 |
ultimately show ?thesis by auto |
4093 |
qed |
|
4094 |
qed auto |
|
4095 |
qed |
|
4096 |
qed auto |
|
4097 |
qed (auto simp add: assms) |
|
4098 |
||
4099 |
lemma simplex_furthest_le: |
|
53347 | 4100 |
fixes s :: "'a::real_inner set" |
4101 |
assumes "finite s" |
|
4102 |
and "s \<noteq> {}" |
|
4103 |
shows "\<exists>y\<in>s. \<forall>x\<in> convex hull s. norm (x - a) \<le> norm (y - a)" |
|
4104 |
proof - |
|
4105 |
have "convex hull s \<noteq> {}" |
|
4106 |
using hull_subset[of s convex] and assms(2) by auto |
|
4107 |
then obtain x where x: "x \<in> convex hull s" "\<forall>y\<in>convex hull s. norm (y - a) \<le> norm (x - a)" |
|
33175 | 4108 |
using distance_attains_sup[OF finite_imp_compact_convex_hull[OF assms(1)], of a] |
53347 | 4109 |
unfolding dist_commute[of a] |
4110 |
unfolding dist_norm |
|
4111 |
by auto |
|
4112 |
show ?thesis |
|
4113 |
proof (cases "x \<in> s") |
|
4114 |
case False |
|
4115 |
then obtain y where "y \<in> convex hull s" "norm (x - a) < norm (y - a)" |
|
4116 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=x]] and x(1) |
|
4117 |
by auto |
|
4118 |
then show ?thesis |
|
4119 |
using x(2)[THEN bspec[where x=y]] by auto |
|
4120 |
next |
|
4121 |
case True |
|
4122 |
with x show ?thesis by auto |
|
4123 |
qed |
|
33175 | 4124 |
qed |
4125 |
||
4126 |
lemma simplex_furthest_le_exists: |
|
44525
fbb777aec0d4
generalize lemma finite_imp_compact_convex_hull and related lemmas
huffman
parents:
44524
diff
changeset
|
4127 |
fixes s :: "('a::real_inner) set" |
53347 | 4128 |
shows "finite s \<Longrightarrow> \<forall>x\<in>(convex hull s). \<exists>y\<in>s. norm (x - a) \<le> norm (y - a)" |
4129 |
using simplex_furthest_le[of s] by (cases "s = {}") auto |
|
33175 | 4130 |
|
4131 |
lemma simplex_extremal_le: |
|
53347 | 4132 |
fixes s :: "'a::real_inner set" |
4133 |
assumes "finite s" |
|
4134 |
and "s \<noteq> {}" |
|
4135 |
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)" |
|
4136 |
proof - |
|
4137 |
have "convex hull s \<noteq> {}" |
|
4138 |
using hull_subset[of s convex] and assms(2) by auto |
|
4139 |
then obtain u v where obt: "u \<in> convex hull s" "v \<in> convex hull s" |
|
33175 | 4140 |
"\<forall>x\<in>convex hull s. \<forall>y\<in>convex hull s. norm (x - y) \<le> norm (u - v)" |
53347 | 4141 |
using compact_sup_maxdistance[OF finite_imp_compact_convex_hull[OF assms(1)]] |
4142 |
by (auto simp: dist_norm) |
|
4143 |
then show ?thesis |
|
4144 |
proof (cases "u\<notin>s \<or> v\<notin>s", elim disjE) |
|
4145 |
assume "u \<notin> s" |
|
4146 |
then obtain y where "y \<in> convex hull s" "norm (u - v) < norm (y - v)" |
|
4147 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=u]] and obt(1) |
|
4148 |
by auto |
|
4149 |
then show ?thesis |
|
4150 |
using obt(3)[THEN bspec[where x=y], THEN bspec[where x=v]] and obt(2) |
|
4151 |
by auto |
|
33175 | 4152 |
next |
53347 | 4153 |
assume "v \<notin> s" |
4154 |
then obtain y where "y \<in> convex hull s" "norm (v - u) < norm (y - u)" |
|
4155 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=v]] and obt(2) |
|
4156 |
by auto |
|
4157 |
then show ?thesis |
|
4158 |
using obt(3)[THEN bspec[where x=u], THEN bspec[where x=y]] and obt(1) |
|
33175 | 4159 |
by (auto simp add: norm_minus_commute) |
4160 |
qed auto |
|
49531 | 4161 |
qed |
33175 | 4162 |
|
4163 |
lemma simplex_extremal_le_exists: |
|
53347 | 4164 |
fixes s :: "'a::real_inner set" |
4165 |
shows "finite s \<Longrightarrow> x \<in> convex hull s \<Longrightarrow> y \<in> convex hull s \<Longrightarrow> |
|
4166 |
\<exists>u\<in>s. \<exists>v\<in>s. norm (x - y) \<le> norm (u - v)" |
|
4167 |
using convex_hull_empty simplex_extremal_le[of s] |
|
4168 |
by(cases "s = {}") auto |
|
4169 |
||
33175 | 4170 |
|
4171 |
subsection {* Closest point of a convex set is unique, with a continuous projection. *} |
|
4172 |
||
53347 | 4173 |
definition closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a" |
4174 |
where "closest_point s a = (SOME x. x \<in> s \<and> (\<forall>y\<in>s. dist a x \<le> dist a y))" |
|
33175 | 4175 |
|
4176 |
lemma closest_point_exists: |
|
53347 | 4177 |
assumes "closed s" |
4178 |
and "s \<noteq> {}" |
|
4179 |
shows "closest_point s a \<in> s" |
|
4180 |
and "\<forall>y\<in>s. dist a (closest_point s a) \<le> dist a y" |
|
4181 |
unfolding closest_point_def |
|
4182 |
apply(rule_tac[!] someI2_ex) |
|
4183 |
using distance_attains_inf[OF assms(1,2), of a] |
|
4184 |
apply auto |
|
4185 |
done |
|
4186 |
||
4187 |
lemma closest_point_in_set: "closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> closest_point s a \<in> s" |
|
4188 |
by (meson closest_point_exists) |
|
4189 |
||
4190 |
lemma closest_point_le: "closed s \<Longrightarrow> x \<in> s \<Longrightarrow> dist a (closest_point s a) \<le> dist a x" |
|
33175 | 4191 |
using closest_point_exists[of s] by auto |
4192 |
||
4193 |
lemma closest_point_self: |
|
53347 | 4194 |
assumes "x \<in> s" |
4195 |
shows "closest_point s x = x" |
|
4196 |
unfolding closest_point_def |
|
4197 |
apply (rule some1_equality, rule ex1I[of _ x]) |
|
4198 |
using assms |
|
4199 |
apply auto |
|
4200 |
done |
|
4201 |
||
4202 |
lemma closest_point_refl: "closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> closest_point s x = x \<longleftrightarrow> x \<in> s" |
|
4203 |
using closest_point_in_set[of s x] closest_point_self[of x s] |
|
4204 |
by auto |
|
33175 | 4205 |
|
36337 | 4206 |
lemma closer_points_lemma: |
33175 | 4207 |
assumes "inner y z > 0" |
4208 |
shows "\<exists>u>0. \<forall>v>0. v \<le> u \<longrightarrow> norm(v *\<^sub>R z - y) < norm y" |
|
53347 | 4209 |
proof - |
4210 |
have z: "inner z z > 0" |
|
4211 |
unfolding inner_gt_zero_iff using assms by auto |
|
4212 |
then show ?thesis |
|
4213 |
using assms |
|
4214 |
apply (rule_tac x = "inner y z / inner z z" in exI) |
|
4215 |
apply rule |
|
4216 |
defer |
|
4217 |
proof rule+ |
|
4218 |
fix v |
|
4219 |
assume "0 < v" and "v \<le> inner y z / inner z z" |
|
4220 |
then show "norm (v *\<^sub>R z - y) < norm y" |
|
4221 |
unfolding norm_lt using z and assms |
|
33175 | 4222 |
by (simp add: field_simps inner_diff inner_commute mult_strict_left_mono[OF _ `0<v`]) |
56541 | 4223 |
qed auto |
53347 | 4224 |
qed |
33175 | 4225 |
|
4226 |
lemma closer_point_lemma: |
|
4227 |
assumes "inner (y - x) (z - x) > 0" |
|
4228 |
shows "\<exists>u>0. u \<le> 1 \<and> dist (x + u *\<^sub>R (z - x)) y < dist x y" |
|
53347 | 4229 |
proof - |
4230 |
obtain u where "u > 0" |
|
4231 |
and u: "\<forall>v>0. v \<le> u \<longrightarrow> norm (v *\<^sub>R (z - x) - (y - x)) < norm (y - x)" |
|
33175 | 4232 |
using closer_points_lemma[OF assms] by auto |
53347 | 4233 |
show ?thesis |
4234 |
apply (rule_tac x="min u 1" in exI) |
|
4235 |
using u[THEN spec[where x="min u 1"]] and `u > 0` |
|
4236 |
unfolding dist_norm by (auto simp add: norm_minus_commute field_simps) |
|
4237 |
qed |
|
33175 | 4238 |
|
4239 |
lemma any_closest_point_dot: |
|
4240 |
assumes "convex s" "closed s" "x \<in> s" "y \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z" |
|
4241 |
shows "inner (a - x) (y - x) \<le> 0" |
|
53347 | 4242 |
proof (rule ccontr) |
4243 |
assume "\<not> ?thesis" |
|
4244 |
then obtain u where u: "u>0" "u\<le>1" "dist (x + u *\<^sub>R (y - x)) a < dist x a" |
|
4245 |
using closer_point_lemma[of a x y] by auto |
|
4246 |
let ?z = "(1 - u) *\<^sub>R x + u *\<^sub>R y" |
|
4247 |
have "?z \<in> s" |
|
4248 |
using mem_convex[OF assms(1,3,4), of u] using u by auto |
|
4249 |
then show False |
|
4250 |
using assms(5)[THEN bspec[where x="?z"]] and u(3) |
|
4251 |
by (auto simp add: dist_commute algebra_simps) |
|
4252 |
qed |
|
33175 | 4253 |
|
4254 |
lemma any_closest_point_unique: |
|
36337 | 4255 |
fixes x :: "'a::real_inner" |
33175 | 4256 |
assumes "convex s" "closed s" "x \<in> s" "y \<in> s" |
53347 | 4257 |
"\<forall>z\<in>s. dist a x \<le> dist a z" "\<forall>z\<in>s. dist a y \<le> dist a z" |
4258 |
shows "x = y" |
|
4259 |
using any_closest_point_dot[OF assms(1-4,5)] and any_closest_point_dot[OF assms(1-2,4,3,6)] |
|
33175 | 4260 |
unfolding norm_pths(1) and norm_le_square |
4261 |
by (auto simp add: algebra_simps) |
|
4262 |
||
4263 |
lemma closest_point_unique: |
|
4264 |
assumes "convex s" "closed s" "x \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z" |
|
4265 |
shows "x = closest_point s a" |
|
49531 | 4266 |
using any_closest_point_unique[OF assms(1-3) _ assms(4), of "closest_point s a"] |
33175 | 4267 |
using closest_point_exists[OF assms(2)] and assms(3) by auto |
4268 |
||
4269 |
lemma closest_point_dot: |
|
4270 |
assumes "convex s" "closed s" "x \<in> s" |
|
4271 |
shows "inner (a - closest_point s a) (x - closest_point s a) \<le> 0" |
|
53347 | 4272 |
apply (rule any_closest_point_dot[OF assms(1,2) _ assms(3)]) |
4273 |
using closest_point_exists[OF assms(2)] and assms(3) |
|
4274 |
apply auto |
|
4275 |
done |
|
33175 | 4276 |
|
4277 |
lemma closest_point_lt: |
|
4278 |
assumes "convex s" "closed s" "x \<in> s" "x \<noteq> closest_point s a" |
|
4279 |
shows "dist a (closest_point s a) < dist a x" |
|
53347 | 4280 |
apply (rule ccontr) |
4281 |
apply (rule_tac notE[OF assms(4)]) |
|
4282 |
apply (rule closest_point_unique[OF assms(1-3), of a]) |
|
4283 |
using closest_point_le[OF assms(2), of _ a] |
|
4284 |
apply fastforce |
|
4285 |
done |
|
33175 | 4286 |
|
4287 |
lemma closest_point_lipschitz: |
|
53347 | 4288 |
assumes "convex s" |
4289 |
and "closed s" "s \<noteq> {}" |
|
33175 | 4290 |
shows "dist (closest_point s x) (closest_point s y) \<le> dist x y" |
53347 | 4291 |
proof - |
33175 | 4292 |
have "inner (x - closest_point s x) (closest_point s y - closest_point s x) \<le> 0" |
53347 | 4293 |
and "inner (y - closest_point s y) (closest_point s x - closest_point s y) \<le> 0" |
4294 |
apply (rule_tac[!] any_closest_point_dot[OF assms(1-2)]) |
|
4295 |
using closest_point_exists[OF assms(2-3)] |
|
4296 |
apply auto |
|
4297 |
done |
|
4298 |
then show ?thesis unfolding dist_norm and norm_le |
|
33175 | 4299 |
using inner_ge_zero[of "(x - closest_point s x) - (y - closest_point s y)"] |
53347 | 4300 |
by (simp add: inner_add inner_diff inner_commute) |
4301 |
qed |
|
33175 | 4302 |
|
4303 |
lemma continuous_at_closest_point: |
|
53347 | 4304 |
assumes "convex s" |
4305 |
and "closed s" |
|
4306 |
and "s \<noteq> {}" |
|
33175 | 4307 |
shows "continuous (at x) (closest_point s)" |
49531 | 4308 |
unfolding continuous_at_eps_delta |
33175 | 4309 |
using le_less_trans[OF closest_point_lipschitz[OF assms]] by auto |
4310 |
||
4311 |
lemma continuous_on_closest_point: |
|
53347 | 4312 |
assumes "convex s" |
4313 |
and "closed s" |
|
4314 |
and "s \<noteq> {}" |
|
33175 | 4315 |
shows "continuous_on t (closest_point s)" |
53347 | 4316 |
by (metis continuous_at_imp_continuous_on continuous_at_closest_point[OF assms]) |
4317 |
||
33175 | 4318 |
|
44467 | 4319 |
subsubsection {* Various point-to-set separating/supporting hyperplane theorems. *} |
33175 | 4320 |
|
4321 |
lemma supporting_hyperplane_closed_point: |
|
36337 | 4322 |
fixes z :: "'a::{real_inner,heine_borel}" |
53347 | 4323 |
assumes "convex s" |
4324 |
and "closed s" |
|
4325 |
and "s \<noteq> {}" |
|
4326 |
and "z \<notin> s" |
|
4327 |
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)" |
|
4328 |
proof - |
|
4329 |
from distance_attains_inf[OF assms(2-3)] |
|
4330 |
obtain y where "y \<in> s" and y: "\<forall>x\<in>s. dist z y \<le> dist z x" |
|
4331 |
by auto |
|
4332 |
show ?thesis |
|
4333 |
apply (rule_tac x="y - z" in exI) |
|
4334 |
apply (rule_tac x="inner (y - z) y" in exI) |
|
4335 |
apply (rule_tac x=y in bexI) |
|
4336 |
apply rule |
|
4337 |
defer |
|
4338 |
apply rule |
|
4339 |
defer |
|
4340 |
apply rule |
|
4341 |
apply (rule ccontr) |
|
4342 |
using `y \<in> s` |
|
4343 |
proof - |
|
4344 |
show "inner (y - z) z < inner (y - z) y" |
|
4345 |
apply (subst diff_less_iff(1)[symmetric]) |
|
4346 |
unfolding inner_diff_right[symmetric] and inner_gt_zero_iff |
|
4347 |
using `y\<in>s` `z\<notin>s` |
|
4348 |
apply auto |
|
4349 |
done |
|
33175 | 4350 |
next |
53347 | 4351 |
fix x |
4352 |
assume "x \<in> s" |
|
4353 |
have *: "\<forall>u. 0 \<le> u \<and> u \<le> 1 \<longrightarrow> dist z y \<le> dist z ((1 - u) *\<^sub>R y + u *\<^sub>R x)" |
|
33175 | 4354 |
using assms(1)[unfolded convex_alt] and y and `x\<in>s` and `y\<in>s` by auto |
53347 | 4355 |
assume "\<not> inner (y - z) y \<le> inner (y - z) x" |
4356 |
then obtain v where "v > 0" "v \<le> 1" "dist (y + v *\<^sub>R (x - y)) z < dist y z" |
|
4357 |
using closer_point_lemma[of z y x] by (auto simp add: inner_diff) |
|
4358 |
then show False |
|
4359 |
using *[THEN spec[where x=v]] by (auto simp add: dist_commute algebra_simps) |
|
33175 | 4360 |
qed auto |
4361 |
qed |
|
4362 |
||
4363 |
lemma separating_hyperplane_closed_point: |
|
36337 | 4364 |
fixes z :: "'a::{real_inner,heine_borel}" |
53347 | 4365 |
assumes "convex s" |
4366 |
and "closed s" |
|
4367 |
and "z \<notin> s" |
|
33175 | 4368 |
shows "\<exists>a b. inner a z < b \<and> (\<forall>x\<in>s. inner a x > b)" |
53347 | 4369 |
proof (cases "s = {}") |
4370 |
case True |
|
4371 |
then show ?thesis |
|
4372 |
apply (rule_tac x="-z" in exI) |
|
4373 |
apply (rule_tac x=1 in exI) |
|
4374 |
using less_le_trans[OF _ inner_ge_zero[of z]] |
|
4375 |
apply auto |
|
4376 |
done |
|
33175 | 4377 |
next |
53347 | 4378 |
case False |
4379 |
obtain y where "y \<in> s" and y: "\<forall>x\<in>s. dist z y \<le> dist z x" |
|
33175 | 4380 |
using distance_attains_inf[OF assms(2) False] by auto |
53347 | 4381 |
show ?thesis |
4382 |
apply (rule_tac x="y - z" in exI) |
|
4383 |
apply (rule_tac x="inner (y - z) z + (norm (y - z))\<^sup>2 / 2" in exI) |
|
4384 |
apply rule |
|
4385 |
defer |
|
4386 |
apply rule |
|
4387 |
proof - |
|
4388 |
fix x |
|
4389 |
assume "x \<in> s" |
|
4390 |
have "\<not> 0 < inner (z - y) (x - y)" |
|
4391 |
apply (rule notI) |
|
4392 |
apply (drule closer_point_lemma) |
|
4393 |
proof - |
|
33175 | 4394 |
assume "\<exists>u>0. u \<le> 1 \<and> dist (y + u *\<^sub>R (x - y)) z < dist y z" |
53347 | 4395 |
then obtain u where "u > 0" "u \<le> 1" "dist (y + u *\<^sub>R (x - y)) z < dist y z" |
4396 |
by auto |
|
4397 |
then show False using y[THEN bspec[where x="y + u *\<^sub>R (x - y)"]] |
|
33175 | 4398 |
using assms(1)[unfolded convex_alt, THEN bspec[where x=y]] |
53347 | 4399 |
using `x\<in>s` `y\<in>s` by (auto simp add: dist_commute algebra_simps) |
4400 |
qed |
|
4401 |
moreover have "0 < (norm (y - z))\<^sup>2" |
|
4402 |
using `y\<in>s` `z\<notin>s` by auto |
|
4403 |
then have "0 < inner (y - z) (y - z)" |
|
4404 |
unfolding power2_norm_eq_inner by simp |
|
53015
a1119cf551e8
standardized symbols via "isabelle update_sub_sup", excluding src/Pure and src/Tools/WWW_Find;
wenzelm
parents:
51524
diff
changeset
|
4405 |
ultimately show "inner (y - z) z + (norm (y - z))\<^sup>2 / 2 < inner (y - z) x" |
53347 | 4406 |
unfolding power2_norm_eq_inner and not_less |
4407 |
by (auto simp add: field_simps inner_commute inner_diff) |
|
4408 |
qed (insert `y\<in>s` `z\<notin>s`, auto) |
|
33175 | 4409 |
qed |
4410 |
||
4411 |
lemma separating_hyperplane_closed_0: |
|
53347 | 4412 |
assumes "convex (s::('a::euclidean_space) set)" |
4413 |
and "closed s" |
|
4414 |
and "0 \<notin> s" |
|
33175 | 4415 |
shows "\<exists>a b. a \<noteq> 0 \<and> 0 < b \<and> (\<forall>x\<in>s. inner a x > b)" |
53347 | 4416 |
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:
50104
diff
changeset
|
4417 |
case True |
53347 | 4418 |
have "norm ((SOME i. i\<in>Basis)::'a) = 1" "(SOME i. i\<in>Basis) \<noteq> (0::'a)" |
4419 |
defer |
|
4420 |
apply (subst norm_le_zero_iff[symmetric]) |
|
4421 |
apply (auto simp: SOME_Basis) |
|
4422 |
done |
|
4423 |
then show ?thesis |
|
4424 |
apply (rule_tac x="SOME i. i\<in>Basis" in exI) |
|
4425 |
apply (rule_tac x=1 in exI) |
|
4426 |
using True using DIM_positive[where 'a='a] |
|
4427 |
apply auto |
|
4428 |
done |
|
4429 |
next |
|
4430 |
case False |
|
4431 |
then show ?thesis |
|
4432 |
using False using separating_hyperplane_closed_point[OF assms] |
|
4433 |
apply (elim exE) |
|
4434 |
unfolding inner_zero_right |
|
4435 |
apply (rule_tac x=a in exI) |
|
4436 |
apply (rule_tac x=b in exI) |
|
4437 |
apply auto |
|
4438 |
done |
|
4439 |
qed |
|
4440 |
||
33175 | 4441 |
|
44467 | 4442 |
subsubsection {* Now set-to-set for closed/compact sets *} |
33175 | 4443 |
|
4444 |
lemma separating_hyperplane_closed_compact: |
|
53347 | 4445 |
fixes s :: "'a::euclidean_space set" |
4446 |
assumes "convex s" |
|
4447 |
and "closed s" |
|
4448 |
and "convex t" |
|
4449 |
and "compact t" |
|
4450 |
and "t \<noteq> {}" |
|
4451 |
and "s \<inter> t = {}" |
|
33175 | 4452 |
shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)" |
53347 | 4453 |
proof (cases "s = {}") |
33175 | 4454 |
case True |
53347 | 4455 |
obtain b where b: "b > 0" "\<forall>x\<in>t. norm x \<le> b" |
4456 |
using compact_imp_bounded[OF assms(4)] unfolding bounded_pos by auto |
|
4457 |
obtain z :: 'a where z: "norm z = b + 1" |
|
4458 |
using vector_choose_size[of "b + 1"] and b(1) by auto |
|
4459 |
then have "z \<notin> t" using b(2)[THEN bspec[where x=z]] by auto |
|
4460 |
then obtain a b where ab: "inner a z < b" "\<forall>x\<in>t. b < inner a x" |
|
4461 |
using separating_hyperplane_closed_point[OF assms(3) compact_imp_closed[OF assms(4)], of z] |
|
4462 |
by auto |
|
4463 |
then show ?thesis |
|
4464 |
using True by auto |
|
33175 | 4465 |
next |
53347 | 4466 |
case False |
4467 |
then obtain y where "y \<in> s" by auto |
|
33175 | 4468 |
obtain a b where "0 < b" "\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. b < inner a x" |
4469 |
using separating_hyperplane_closed_point[OF convex_differences[OF assms(1,3)], of 0] |
|
53347 | 4470 |
using closed_compact_differences[OF assms(2,4)] |
4471 |
using assms(6) by auto blast |
|
4472 |
then have ab: "\<forall>x\<in>s. \<forall>y\<in>t. b + inner a y < inner a x" |
|
4473 |
apply - |
|
4474 |
apply rule |
|
4475 |
apply rule |
|
4476 |
apply (erule_tac x="x - y" in ballE) |
|
4477 |
apply (auto simp add: inner_diff) |
|
4478 |
done |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4479 |
def k \<equiv> "SUP x:t. a \<bullet> x" |
53347 | 4480 |
show ?thesis |
4481 |
apply (rule_tac x="-a" in exI) |
|
4482 |
apply (rule_tac x="-(k + b / 2)" in exI) |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4483 |
apply (intro conjI ballI) |
53347 | 4484 |
unfolding inner_minus_left and neg_less_iff_less |
4485 |
proof - |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4486 |
fix x assume "x \<in> t" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4487 |
then have "inner a x - b / 2 < k" |
53347 | 4488 |
unfolding k_def |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4489 |
proof (subst less_cSUP_iff) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4490 |
show "t \<noteq> {}" by fact |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4491 |
show "bdd_above (op \<bullet> a ` t)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4492 |
using ab[rule_format, of y] `y \<in> s` |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4493 |
by (intro bdd_aboveI2[where M="inner a y - b"]) (auto simp: field_simps intro: less_imp_le) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4494 |
qed (auto intro!: bexI[of _ x] `0<b`) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4495 |
then show "inner a x < k + b / 2" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4496 |
by auto |
33175 | 4497 |
next |
53347 | 4498 |
fix x |
4499 |
assume "x \<in> s" |
|
4500 |
then have "k \<le> inner a x - b" |
|
4501 |
unfolding k_def |
|
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4502 |
apply (rule_tac cSUP_least) |
53347 | 4503 |
using assms(5) |
4504 |
using ab[THEN bspec[where x=x]] |
|
4505 |
apply auto |
|
4506 |
done |
|
4507 |
then show "k + b / 2 < inner a x" |
|
4508 |
using `0 < b` by auto |
|
33175 | 4509 |
qed |
4510 |
qed |
|
4511 |
||
4512 |
lemma separating_hyperplane_compact_closed: |
|
53347 | 4513 |
fixes s :: "'a::euclidean_space set" |
4514 |
assumes "convex s" |
|
4515 |
and "compact s" |
|
4516 |
and "s \<noteq> {}" |
|
4517 |
and "convex t" |
|
4518 |
and "closed t" |
|
4519 |
and "s \<inter> t = {}" |
|
33175 | 4520 |
shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)" |
53347 | 4521 |
proof - |
4522 |
obtain a b where "(\<forall>x\<in>t. inner a x < b) \<and> (\<forall>x\<in>s. b < inner a x)" |
|
4523 |
using separating_hyperplane_closed_compact[OF assms(4-5,1-2,3)] and assms(6) |
|
4524 |
by auto |
|
4525 |
then show ?thesis |
|
4526 |
apply (rule_tac x="-a" in exI) |
|
4527 |
apply (rule_tac x="-b" in exI) |
|
4528 |
apply auto |
|
4529 |
done |
|
4530 |
qed |
|
4531 |
||
33175 | 4532 |
|
44467 | 4533 |
subsubsection {* General case without assuming closure and getting non-strict separation *} |
33175 | 4534 |
|
4535 |
lemma separating_hyperplane_set_0: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4536 |
assumes "convex s" "(0::'a::euclidean_space) \<notin> s" |
33175 | 4537 |
shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>s. 0 \<le> inner a x)" |
53347 | 4538 |
proof - |
4539 |
let ?k = "\<lambda>c. {x::'a. 0 \<le> inner c x}" |
|
33175 | 4540 |
have "frontier (cball 0 1) \<inter> (\<Inter> (?k ` s)) \<noteq> {}" |
53347 | 4541 |
apply (rule compact_imp_fip) |
4542 |
apply (rule compact_frontier[OF compact_cball]) |
|
4543 |
defer |
|
4544 |
apply rule |
|
4545 |
apply rule |
|
4546 |
apply (erule conjE) |
|
4547 |
proof - |
|
4548 |
fix f |
|
4549 |
assume as: "f \<subseteq> ?k ` s" "finite f" |
|
4550 |
obtain c where c: "f = ?k ` c" "c \<subseteq> s" "finite c" |
|
4551 |
using finite_subset_image[OF as(2,1)] by auto |
|
4552 |
then obtain a b where ab: "a \<noteq> 0" "0 < b" "\<forall>x\<in>convex hull c. b < inner a x" |
|
33175 | 4553 |
using separating_hyperplane_closed_0[OF convex_convex_hull, of c] |
4554 |
using finite_imp_compact_convex_hull[OF c(3), THEN compact_imp_closed] and assms(2) |
|
53347 | 4555 |
using subset_hull[of convex, OF assms(1), symmetric, of c] |
4556 |
by auto |
|
4557 |
then have "\<exists>x. norm x = 1 \<and> (\<forall>y\<in>c. 0 \<le> inner y x)" |
|
4558 |
apply (rule_tac x = "inverse(norm a) *\<^sub>R a" in exI) |
|
4559 |
using hull_subset[of c convex] |
|
4560 |
unfolding subset_eq and inner_scaleR |
|
56536 | 4561 |
by (auto simp add: inner_commute del: ballE elim!: ballE) |
53347 | 4562 |
then show "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}" |
4563 |
unfolding c(1) frontier_cball dist_norm by auto |
|
4564 |
qed (insert closed_halfspace_ge, auto) |
|
4565 |
then obtain x where "norm x = 1" "\<forall>y\<in>s. x\<in>?k y" |
|
4566 |
unfolding frontier_cball dist_norm by auto |
|
4567 |
then show ?thesis |
|
4568 |
apply (rule_tac x=x in exI) |
|
4569 |
apply (auto simp add: inner_commute) |
|
4570 |
done |
|
4571 |
qed |
|
33175 | 4572 |
|
4573 |
lemma separating_hyperplane_sets: |
|
53347 | 4574 |
fixes s t :: "'a::euclidean_space set" |
4575 |
assumes "convex s" |
|
4576 |
and "convex t" |
|
4577 |
and "s \<noteq> {}" |
|
4578 |
and "t \<noteq> {}" |
|
4579 |
and "s \<inter> t = {}" |
|
33175 | 4580 |
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 | 4581 |
proof - |
4582 |
from separating_hyperplane_set_0[OF convex_differences[OF assms(2,1)]] |
|
4583 |
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" |
|
49531 | 4584 |
using assms(3-5) by auto |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4585 |
then have *: "\<And>x y. x \<in> t \<Longrightarrow> y \<in> s \<Longrightarrow> inner a y \<le> inner a x" |
33270 | 4586 |
by (force simp add: inner_diff) |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4587 |
then have bdd: "bdd_above ((op \<bullet> a)`s)" |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4588 |
using `t \<noteq> {}` by (auto intro: bdd_aboveI2[OF *]) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4589 |
show ?thesis |
53347 | 4590 |
using `a\<noteq>0` |
54263
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4591 |
by (intro exI[of _ a] exI[of _ "SUP x:s. a \<bullet> x"]) |
c4159fe6fa46
move Lubs from HOL to HOL-Library (replaced by conditionally complete lattices)
hoelzl
parents:
54258
diff
changeset
|
4592 |
(auto intro!: cSUP_upper bdd cSUP_least `a \<noteq> 0` `s \<noteq> {}` *) |
33270 | 4593 |
qed |
33175 | 4594 |
|
53347 | 4595 |
|
44467 | 4596 |
subsection {* More convexity generalities *} |
33175 | 4597 |
|
4598 |
lemma convex_closure: |
|
4599 |
fixes s :: "'a::real_normed_vector set" |
|
53347 | 4600 |
assumes "convex s" |
4601 |
shows "convex (closure s)" |
|
53676 | 4602 |
apply (rule convexI) |
4603 |
apply (unfold closure_sequential, elim exE) |
|
4604 |
apply (rule_tac x="\<lambda>n. u *\<^sub>R xa n + v *\<^sub>R xb n" in exI) |
|
53347 | 4605 |
apply (rule,rule) |
53676 | 4606 |
apply (rule convexD [OF assms]) |
53347 | 4607 |
apply (auto del: tendsto_const intro!: tendsto_intros) |
4608 |
done |
|
33175 | 4609 |
|
4610 |
lemma convex_interior: |
|
4611 |
fixes s :: "'a::real_normed_vector set" |
|
53347 | 4612 |
assumes "convex s" |
4613 |
shows "convex (interior s)" |
|
4614 |
unfolding convex_alt Ball_def mem_interior |
|
4615 |
apply (rule,rule,rule,rule,rule,rule) |
|
4616 |
apply (elim exE conjE) |
|
4617 |
proof - |
|
4618 |
fix x y u |
|
4619 |
assume u: "0 \<le> u" "u \<le> (1::real)" |
|
4620 |
fix e d |
|
4621 |
assume ed: "ball x e \<subseteq> s" "ball y d \<subseteq> s" "0<d" "0<e" |
|
4622 |
show "\<exists>e>0. ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) e \<subseteq> s" |
|
4623 |
apply (rule_tac x="min d e" in exI) |
|
4624 |
apply rule |
|
4625 |
unfolding subset_eq |
|
4626 |
defer |
|
4627 |
apply rule |
|
4628 |
proof - |
|
4629 |
fix z |
|
4630 |
assume "z \<in> ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) (min d e)" |
|
4631 |
then have "(1- u) *\<^sub>R (z - u *\<^sub>R (y - x)) + u *\<^sub>R (z + (1 - u) *\<^sub>R (y - x)) \<in> s" |
|
4632 |
apply (rule_tac assms[unfolded convex_alt, rule_format]) |
|
4633 |
using ed(1,2) and u |
|
4634 |
unfolding subset_eq mem_ball Ball_def dist_norm |
|
4635 |
apply (auto simp add: algebra_simps) |
|
4636 |
done |
|
4637 |
then show "z \<in> s" |
|
4638 |
using u by (auto simp add: algebra_simps) |
|
4639 |
qed(insert u ed(3-4), auto) |
|
4640 |
qed |
|
33175 | 4641 |
|
34964 | 4642 |
lemma convex_hull_eq_empty[simp]: "convex hull s = {} \<longleftrightarrow> s = {}" |
33175 | 4643 |
using hull_subset[of s convex] convex_hull_empty by auto |
4644 |
||
53347 | 4645 |
|
33175 | 4646 |
subsection {* Moving and scaling convex hulls. *} |
4647 |
||
53676 | 4648 |
lemma convex_hull_set_plus: |
4649 |
"convex hull (s + t) = convex hull s + convex hull t" |
|
4650 |
unfolding set_plus_image |
|
4651 |
apply (subst convex_hull_linear_image [symmetric]) |
|
4652 |
apply (simp add: linear_iff scaleR_right_distrib) |
|
4653 |
apply (simp add: convex_hull_Times) |
|
4654 |
done |
|
4655 |
||
4656 |
lemma translation_eq_singleton_plus: "(\<lambda>x. a + x) ` t = {a} + t" |
|
4657 |
unfolding set_plus_def by auto |
|
33175 | 4658 |
|
4659 |
lemma convex_hull_translation: |
|
4660 |
"convex hull ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (convex hull s)" |
|
53676 | 4661 |
unfolding translation_eq_singleton_plus |
4662 |
by (simp only: convex_hull_set_plus convex_hull_singleton) |
|
33175 | 4663 |
|
4664 |
lemma convex_hull_scaling: |
|
4665 |
"convex hull ((\<lambda>x. c *\<^sub>R x) ` s) = (\<lambda>x. c *\<^sub>R x) ` (convex hull s)" |
|
53676 | 4666 |
using linear_scaleR by (rule convex_hull_linear_image [symmetric]) |
33175 | 4667 |
|
4668 |
lemma convex_hull_affinity: |
|
4669 |
"convex hull ((\<lambda>x. a + c *\<^sub>R x) ` s) = (\<lambda>x. a + c *\<^sub>R x) ` (convex hull s)" |
|
53347 | 4670 |
by(simp only: image_image[symmetric] convex_hull_scaling convex_hull_translation) |
4671 |
||
33175 | 4672 |
|
40377 | 4673 |
subsection {* Convexity of cone hulls *} |
4674 |
||
4675 |
lemma convex_cone_hull: |
|
53347 | 4676 |
assumes "convex S" |
4677 |
shows "convex (cone hull S)" |
|
53676 | 4678 |
proof (rule convexI) |
4679 |
fix x y |
|
4680 |
assume xy: "x \<in> cone hull S" "y \<in> cone hull S" |
|
4681 |
then have "S \<noteq> {}" |
|
4682 |
using cone_hull_empty_iff[of S] by auto |
|
4683 |
fix u v :: real |
|
4684 |
assume uv: "u \<ge> 0" "v \<ge> 0" "u + v = 1" |
|
4685 |
then have *: "u *\<^sub>R x \<in> cone hull S" "v *\<^sub>R y \<in> cone hull S" |
|
4686 |
using cone_cone_hull[of S] xy cone_def[of "cone hull S"] by auto |
|
4687 |
from * obtain cx :: real and xx where x: "u *\<^sub>R x = cx *\<^sub>R xx" "cx \<ge> 0" "xx \<in> S" |
|
4688 |
using cone_hull_expl[of S] by auto |
|
4689 |
from * obtain cy :: real and yy where y: "v *\<^sub>R y = cy *\<^sub>R yy" "cy \<ge> 0" "yy \<in> S" |
|
4690 |
using cone_hull_expl[of S] by auto |
|
53347 | 4691 |
{ |
53676 | 4692 |
assume "cx + cy \<le> 0" |
4693 |
then have "u *\<^sub>R x = 0" and "v *\<^sub>R y = 0" |
|
4694 |
using x y by auto |
|
4695 |
then have "u *\<^sub>R x + v *\<^sub>R y = 0" |
|
4696 |
by auto |
|
4697 |
then have "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S" |
|
4698 |
using cone_hull_contains_0[of S] `S \<noteq> {}` by auto |
|
40377 | 4699 |
} |
53676 | 4700 |
moreover |
4701 |
{ |
|
4702 |
assume "cx + cy > 0" |
|
4703 |
then have "(cx / (cx + cy)) *\<^sub>R xx + (cy / (cx + cy)) *\<^sub>R yy \<in> S" |
|
4704 |
using assms mem_convex_alt[of S xx yy cx cy] x y by auto |
|
4705 |
then have "cx *\<^sub>R xx + cy *\<^sub>R yy \<in> cone hull S" |
|
4706 |
using mem_cone_hull[of "(cx/(cx+cy)) *\<^sub>R xx + (cy/(cx+cy)) *\<^sub>R yy" S "cx+cy"] `cx+cy>0` |
|
4707 |
by (auto simp add: scaleR_right_distrib) |
|
4708 |
then have "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S" |
|
4709 |
using x y by auto |
|
4710 |
} |
|
4711 |
moreover have "cx + cy \<le> 0 \<or> cx + cy > 0" by auto |
|
4712 |
ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> cone hull S" by blast |
|
40377 | 4713 |
qed |
4714 |
||
4715 |
lemma cone_convex_hull: |
|
53347 | 4716 |
assumes "cone S" |
4717 |
shows "cone (convex hull S)" |
|
4718 |
proof (cases "S = {}") |
|
4719 |
case True |
|
4720 |
then show ?thesis by auto |
|
4721 |
next |
|
4722 |
case False |
|
54465 | 4723 |
then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)" |
4724 |
using cone_iff[of S] assms by auto |
|
53347 | 4725 |
{ |
4726 |
fix c :: real |
|
4727 |
assume "c > 0" |
|
4728 |
then have "op *\<^sub>R c ` (convex hull S) = convex hull (op *\<^sub>R c ` S)" |
|
4729 |
using convex_hull_scaling[of _ S] by auto |
|
4730 |
also have "\<dots> = convex hull S" |
|
4731 |
using * `c > 0` by auto |
|
4732 |
finally have "op *\<^sub>R c ` (convex hull S) = convex hull S" |
|
4733 |
by auto |
|
40377 | 4734 |
} |
53347 | 4735 |
then have "0 \<in> convex hull S" "\<And>c. c > 0 \<Longrightarrow> (op *\<^sub>R c ` (convex hull S)) = (convex hull S)" |
4736 |
using * hull_subset[of S convex] by auto |
|
4737 |
then show ?thesis |
|
4738 |
using `S \<noteq> {}` cone_iff[of "convex hull S"] by auto |
|
40377 | 4739 |
qed |
4740 |
||
44467 | 4741 |
subsection {* Convex set as intersection of halfspaces *} |
33175 | 4742 |
|
4743 |
lemma convex_halfspace_intersection: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4744 |
fixes s :: "('a::euclidean_space) set" |
33175 | 4745 |
assumes "closed s" "convex s" |
4746 |
shows "s = \<Inter> {h. s \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}" |
|
53347 | 4747 |
apply (rule set_eqI) |
4748 |
apply rule |
|
4749 |
unfolding Inter_iff Ball_def mem_Collect_eq |
|
4750 |
apply (rule,rule,erule conjE) |
|
4751 |
proof - |
|
54465 | 4752 |
fix x |
53347 | 4753 |
assume "\<forall>xa. s \<subseteq> xa \<and> (\<exists>a b. xa = {x. inner a x \<le> b}) \<longrightarrow> x \<in> xa" |
4754 |
then have "\<forall>a b. s \<subseteq> {x. inner a x \<le> b} \<longrightarrow> x \<in> {x. inner a x \<le> b}" |
|
4755 |
by blast |
|
4756 |
then show "x \<in> s" |
|
4757 |
apply (rule_tac ccontr) |
|
4758 |
apply (drule separating_hyperplane_closed_point[OF assms(2,1)]) |
|
4759 |
apply (erule exE)+ |
|
4760 |
apply (erule_tac x="-a" in allE) |
|
4761 |
apply (erule_tac x="-b" in allE) |
|
4762 |
apply auto |
|
4763 |
done |
|
33175 | 4764 |
qed auto |
4765 |
||
53347 | 4766 |
|
44467 | 4767 |
subsection {* Radon's theorem (from Lars Schewe) *} |
33175 | 4768 |
|
4769 |
lemma radon_ex_lemma: |
|
4770 |
assumes "finite c" "affine_dependent c" |
|
4771 |
shows "\<exists>u. setsum u c = 0 \<and> (\<exists>v\<in>c. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) c = 0" |
|
53347 | 4772 |
proof - |
55697 | 4773 |
from assms(2)[unfolded affine_dependent_explicit] |
4774 |
obtain s u where |
|
4775 |
"finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0" |
|
4776 |
by blast |
|
53347 | 4777 |
then show ?thesis |
4778 |
apply (rule_tac x="\<lambda>v. if v\<in>s then u v else 0" in exI) |
|
57418 | 4779 |
unfolding if_smult scaleR_zero_left and setsum.inter_restrict[OF assms(1), symmetric] |
53347 | 4780 |
apply (auto simp add: Int_absorb1) |
4781 |
done |
|
4782 |
qed |
|
33175 | 4783 |
|
4784 |
lemma radon_s_lemma: |
|
53347 | 4785 |
assumes "finite s" |
4786 |
and "setsum f s = (0::real)" |
|
33175 | 4787 |
shows "setsum f {x\<in>s. 0 < f x} = - setsum f {x\<in>s. f x < 0}" |
53347 | 4788 |
proof - |
4789 |
have *: "\<And>x. (if f x < 0 then f x else 0) + (if 0 < f x then f x else 0) = f x" |
|
4790 |
by auto |
|
4791 |
show ?thesis |
|
57418 | 4792 |
unfolding real_add_eq_0_iff[symmetric] and setsum.inter_filter[OF assms(1)] |
4793 |
and setsum.distrib[symmetric] and * |
|
53347 | 4794 |
using assms(2) |
4795 |
apply assumption |
|
4796 |
done |
|
4797 |
qed |
|
33175 | 4798 |
|
4799 |
lemma radon_v_lemma: |
|
53347 | 4800 |
assumes "finite s" |
4801 |
and "setsum f s = 0" |
|
4802 |
and "\<forall>x. g x = (0::real) \<longrightarrow> f x = (0::'a::euclidean_space)" |
|
33175 | 4803 |
shows "(setsum f {x\<in>s. 0 < g x}) = - setsum f {x\<in>s. g x < 0}" |
53347 | 4804 |
proof - |
4805 |
have *: "\<And>x. (if 0 < g x then f x else 0) + (if g x < 0 then f x else 0) = f x" |
|
4806 |
using assms(3) by auto |
|
4807 |
show ?thesis |
|
57418 | 4808 |
unfolding eq_neg_iff_add_eq_0 and setsum.inter_filter[OF assms(1)] |
4809 |
and setsum.distrib[symmetric] and * |
|
53347 | 4810 |
using assms(2) |
4811 |
apply assumption |
|
4812 |
done |
|
4813 |
qed |
|
33175 | 4814 |
|
4815 |
lemma radon_partition: |
|
4816 |
assumes "finite c" "affine_dependent c" |
|
53347 | 4817 |
shows "\<exists>m p. m \<inter> p = {} \<and> m \<union> p = c \<and> (convex hull m) \<inter> (convex hull p) \<noteq> {}" |
4818 |
proof - |
|
4819 |
obtain u v where uv: "setsum u c = 0" "v\<in>c" "u v \<noteq> 0" "(\<Sum>v\<in>c. u v *\<^sub>R v) = 0" |
|
4820 |
using radon_ex_lemma[OF assms] by auto |
|
4821 |
have fin: "finite {x \<in> c. 0 < u x}" "finite {x \<in> c. 0 > u x}" |
|
4822 |
using assms(1) by auto |
|
4823 |
def z \<equiv> "inverse (setsum u {x\<in>c. u x > 0}) *\<^sub>R setsum (\<lambda>x. u x *\<^sub>R x) {x\<in>c. u x > 0}" |
|
4824 |
have "setsum u {x \<in> c. 0 < u x} \<noteq> 0" |
|
4825 |
proof (cases "u v \<ge> 0") |
|
4826 |
case False |
|
4827 |
then have "u v < 0" by auto |
|
4828 |
then show ?thesis |
|
4829 |
proof (cases "\<exists>w\<in>{x \<in> c. 0 < u x}. u w > 0") |
|
4830 |
case True |
|
4831 |
then show ?thesis |
|
4832 |
using setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] by auto |
|
33175 | 4833 |
next |
53347 | 4834 |
case False |
4835 |
then have "setsum u c \<le> setsum (\<lambda>x. if x=v then u v else 0) c" |
|
4836 |
apply (rule_tac setsum_mono) |
|
4837 |
apply auto |
|
4838 |
done |
|
4839 |
then show ?thesis |
|
57418 | 4840 |
unfolding setsum.delta[OF assms(1)] using uv(2) and `u v < 0` and uv(1) by auto |
53347 | 4841 |
qed |
33175 | 4842 |
qed (insert setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] uv(2-3), auto) |
4843 |
||
53347 | 4844 |
then have *: "setsum u {x\<in>c. u x > 0} > 0" |
4845 |
unfolding less_le |
|
4846 |
apply (rule_tac conjI) |
|
4847 |
apply (rule_tac setsum_nonneg) |
|
4848 |
apply auto |
|
4849 |
done |
|
33175 | 4850 |
moreover have "setsum u ({x \<in> c. 0 < u x} \<union> {x \<in> c. u x < 0}) = setsum u c" |
4851 |
"(\<Sum>x\<in>{x \<in> c. 0 < u x} \<union> {x \<in> c. u x < 0}. u x *\<^sub>R x) = (\<Sum>x\<in>c. u x *\<^sub>R x)" |
|
53347 | 4852 |
using assms(1) |
57418 | 4853 |
apply (rule_tac[!] setsum.mono_neutral_left) |
53347 | 4854 |
apply auto |
4855 |
done |
|
4856 |
then have "setsum u {x \<in> c. 0 < u x} = - setsum u {x \<in> c. 0 > u x}" |
|
4857 |
"(\<Sum>x\<in>{x \<in> c. 0 < u x}. u x *\<^sub>R x) = - (\<Sum>x\<in>{x \<in> c. 0 > u x}. u x *\<^sub>R x)" |
|
4858 |
unfolding eq_neg_iff_add_eq_0 |
|
4859 |
using uv(1,4) |
|
57418 | 4860 |
by (auto simp add: setsum.union_inter_neutral[OF fin, symmetric]) |
49531 | 4861 |
moreover have "\<forall>x\<in>{v \<in> c. u v < 0}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * - u x" |
53347 | 4862 |
apply rule |
4863 |
apply (rule mult_nonneg_nonneg) |
|
4864 |
using * |
|
4865 |
apply auto |
|
4866 |
done |
|
4867 |
ultimately have "z \<in> convex hull {v \<in> c. u v \<le> 0}" |
|
4868 |
unfolding convex_hull_explicit mem_Collect_eq |
|
4869 |
apply (rule_tac x="{v \<in> c. u v < 0}" in exI) |
|
4870 |
apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * - u y" in exI) |
|
49530 | 4871 |
using assms(1) unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def |
53347 | 4872 |
apply (auto simp add: setsum_negf setsum_right_distrib[symmetric]) |
4873 |
done |
|
49531 | 4874 |
moreover have "\<forall>x\<in>{v \<in> c. 0 < u v}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * u x" |
53347 | 4875 |
apply rule |
4876 |
apply (rule mult_nonneg_nonneg) |
|
4877 |
using * |
|
4878 |
apply auto |
|
4879 |
done |
|
4880 |
then have "z \<in> convex hull {v \<in> c. u v > 0}" |
|
4881 |
unfolding convex_hull_explicit mem_Collect_eq |
|
4882 |
apply (rule_tac x="{v \<in> c. 0 < u v}" in exI) |
|
4883 |
apply (rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * u y" in exI) |
|
4884 |
using assms(1) |
|
4885 |
unfolding scaleR_scaleR[symmetric] scaleR_right.setsum [symmetric] and z_def |
|
4886 |
using * |
|
4887 |
apply (auto simp add: setsum_negf setsum_right_distrib[symmetric]) |
|
4888 |
done |
|
4889 |
ultimately show ?thesis |
|
4890 |
apply (rule_tac x="{v\<in>c. u v \<le> 0}" in exI) |
|
4891 |
apply (rule_tac x="{v\<in>c. u v > 0}" in exI) |
|
4892 |
apply auto |
|
4893 |
done |
|
4894 |
qed |
|
4895 |
||
4896 |
lemma radon: |
|
4897 |
assumes "affine_dependent c" |
|
4898 |
obtains m p where "m \<subseteq> c" "p \<subseteq> c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}" |
|
4899 |
proof - |
|
55697 | 4900 |
from assms[unfolded affine_dependent_explicit] |
4901 |
obtain s u where |
|
4902 |
"finite s" "s \<subseteq> c" "setsum u s = 0" "\<exists>v\<in>s. u v \<noteq> 0" "(\<Sum>v\<in>s. u v *\<^sub>R v) = 0" |
|
4903 |
by blast |
|
53347 | 4904 |
then have *: "finite s" "affine_dependent s" and s: "s \<subseteq> c" |
4905 |
unfolding affine_dependent_explicit by auto |
|
55697 | 4906 |
from radon_partition[OF *] |
4907 |
obtain m p where "m \<inter> p = {}" "m \<union> p = s" "convex hull m \<inter> convex hull p \<noteq> {}" |
|
4908 |
by blast |
|
53347 | 4909 |
then show ?thesis |
4910 |
apply (rule_tac that[of p m]) |
|
4911 |
using s |
|
4912 |
apply auto |
|
4913 |
done |
|
4914 |
qed |
|
4915 |
||
33175 | 4916 |
|
44467 | 4917 |
subsection {* Helly's theorem *} |
33175 | 4918 |
|
53347 | 4919 |
lemma helly_induct: |
4920 |
fixes f :: "'a::euclidean_space set set" |
|
4921 |
assumes "card f = n" |
|
4922 |
and "n \<ge> DIM('a) + 1" |
|
4923 |
and "\<forall>s\<in>f. convex s" "\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter> t \<noteq> {}" |
|
4924 |
shows "\<Inter>f \<noteq> {}" |
|
4925 |
using assms |
|
4926 |
proof (induct n arbitrary: f) |
|
4927 |
case 0 |
|
4928 |
then show ?case by auto |
|
4929 |
next |
|
4930 |
case (Suc n) |
|
4931 |
have "finite f" |
|
4932 |
using `card f = Suc n` by (auto intro: card_ge_0_finite) |
|
4933 |
show "\<Inter>f \<noteq> {}" |
|
4934 |
apply (cases "n = DIM('a)") |
|
4935 |
apply (rule Suc(5)[rule_format]) |
|
4936 |
unfolding `card f = Suc n` |
|
4937 |
proof - |
|
4938 |
assume ng: "n \<noteq> DIM('a)" |
|
4939 |
then have "\<exists>X. \<forall>s\<in>f. X s \<in> \<Inter>(f - {s})" |
|
4940 |
apply (rule_tac bchoice) |
|
4941 |
unfolding ex_in_conv |
|
4942 |
apply (rule, rule Suc(1)[rule_format]) |
|
4943 |
unfolding card_Diff_singleton_if[OF `finite f`] `card f = Suc n` |
|
4944 |
defer |
|
4945 |
defer |
|
4946 |
apply (rule Suc(4)[rule_format]) |
|
4947 |
defer |
|
4948 |
apply (rule Suc(5)[rule_format]) |
|
4949 |
using Suc(3) `finite f` |
|
4950 |
apply auto |
|
4951 |
done |
|
4952 |
then obtain X where X: "\<forall>s\<in>f. X s \<in> \<Inter>(f - {s})" by auto |
|
4953 |
show ?thesis |
|
4954 |
proof (cases "inj_on X f") |
|
4955 |
case False |
|
4956 |
then obtain s t where st: "s\<noteq>t" "s\<in>f" "t\<in>f" "X s = X t" |
|
4957 |
unfolding inj_on_def by auto |
|
4958 |
then have *: "\<Inter>f = \<Inter>(f - {s}) \<inter> \<Inter>(f - {t})" by auto |
|
4959 |
show ?thesis |
|
4960 |
unfolding * |
|
4961 |
unfolding ex_in_conv[symmetric] |
|
4962 |
apply (rule_tac x="X s" in exI) |
|
4963 |
apply rule |
|
4964 |
apply (rule X[rule_format]) |
|
4965 |
using X st |
|
4966 |
apply auto |
|
4967 |
done |
|
4968 |
next |
|
4969 |
case True |
|
4970 |
then obtain m p where mp: "m \<inter> p = {}" "m \<union> p = X ` f" "convex hull m \<inter> convex hull p \<noteq> {}" |
|
4971 |
using radon_partition[of "X ` f"] and affine_dependent_biggerset[of "X ` f"] |
|
4972 |
unfolding card_image[OF True] and `card f = Suc n` |
|
4973 |
using Suc(3) `finite f` and ng |
|
4974 |
by auto |
|
4975 |
have "m \<subseteq> X ` f" "p \<subseteq> X ` f" |
|
4976 |
using mp(2) by auto |
|
4977 |
then obtain g h where gh:"m = X ` g" "p = X ` h" "g \<subseteq> f" "h \<subseteq> f" |
|
4978 |
unfolding subset_image_iff by auto |
|
4979 |
then have "f \<union> (g \<union> h) = f" by auto |
|
4980 |
then have f: "f = g \<union> h" |
|
4981 |
using inj_on_Un_image_eq_iff[of X f "g \<union> h"] and True |
|
4982 |
unfolding mp(2)[unfolded image_Un[symmetric] gh] |
|
4983 |
by auto |
|
4984 |
have *: "g \<inter> h = {}" |
|
4985 |
using mp(1) |
|
4986 |
unfolding gh |
|
4987 |
using inj_on_image_Int[OF True gh(3,4)] |
|
4988 |
by auto |
|
4989 |
have "convex hull (X ` h) \<subseteq> \<Inter>g" "convex hull (X ` g) \<subseteq> \<Inter>h" |
|
4990 |
apply (rule_tac [!] hull_minimal) |
|
4991 |
using Suc gh(3-4) |
|
4992 |
unfolding subset_eq |
|
4993 |
apply (rule_tac [2] convex_Inter, rule_tac [4] convex_Inter) |
|
4994 |
apply rule |
|
4995 |
prefer 3 |
|
4996 |
apply rule |
|
4997 |
proof - |
|
4998 |
fix x |
|
4999 |
assume "x \<in> X ` g" |
|
55697 | 5000 |
then obtain y where "y \<in> g" "x = X y" |
5001 |
unfolding image_iff .. |
|
53347 | 5002 |
then show "x \<in> \<Inter>h" |
5003 |
using X[THEN bspec[where x=y]] using * f by auto |
|
5004 |
next |
|
5005 |
fix x |
|
5006 |
assume "x \<in> X ` h" |
|
55697 | 5007 |
then obtain y where "y \<in> h" "x = X y" |
5008 |
unfolding image_iff .. |
|
53347 | 5009 |
then show "x \<in> \<Inter>g" |
5010 |
using X[THEN bspec[where x=y]] using * f by auto |
|
5011 |
qed auto |
|
5012 |
then show ?thesis |
|
5013 |
unfolding f using mp(3)[unfolded gh] by blast |
|
5014 |
qed |
|
5015 |
qed auto |
|
5016 |
qed |
|
5017 |
||
5018 |
lemma helly: |
|
5019 |
fixes f :: "'a::euclidean_space set set" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5020 |
assumes "card f \<ge> DIM('a) + 1" "\<forall>s\<in>f. convex s" |
53347 | 5021 |
and "\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter> t \<noteq> {}" |
5022 |
shows "\<Inter>f \<noteq> {}" |
|
5023 |
apply (rule helly_induct) |
|
5024 |
using assms |
|
5025 |
apply auto |
|
5026 |
done |
|
5027 |
||
33175 | 5028 |
|
44467 | 5029 |
subsection {* Homeomorphism of all convex compact sets with nonempty interior *} |
33175 | 5030 |
|
5031 |
lemma compact_frontier_line_lemma: |
|
53347 | 5032 |
fixes s :: "'a::euclidean_space set" |
5033 |
assumes "compact s" |
|
5034 |
and "0 \<in> s" |
|
5035 |
and "x \<noteq> 0" |
|
5036 |
obtains u where "0 \<le> u" and "(u *\<^sub>R x) \<in> frontier s" "\<forall>v>u. (v *\<^sub>R x) \<notin> s" |
|
5037 |
proof - |
|
5038 |
obtain b where b: "b > 0" "\<forall>x\<in>s. norm x \<le> b" |
|
5039 |
using compact_imp_bounded[OF assms(1), unfolded bounded_pos] by auto |
|
33175 | 5040 |
let ?A = "{y. \<exists>u. 0 \<le> u \<and> u \<le> b / norm(x) \<and> (y = u *\<^sub>R x)}" |
53347 | 5041 |
have A: "?A = (\<lambda>u. u *\<^sub>R x) ` {0 .. b / norm x}" |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
5042 |
by auto |
53347 | 5043 |
have *: "\<And>x A B. x\<in>A \<Longrightarrow> x\<in>B \<Longrightarrow> A\<inter>B \<noteq> {}" by blast |
5044 |
have "compact ?A" |
|
5045 |
unfolding A |
|
5046 |
apply (rule compact_continuous_image) |
|
5047 |
apply (rule continuous_at_imp_continuous_on) |
|
5048 |
apply rule |
|
5049 |
apply (intro continuous_intros) |
|
56188 | 5050 |
apply (rule compact_Icc) |
53347 | 5051 |
done |
5052 |
moreover have "{y. \<exists>u\<ge>0. u \<le> b / norm x \<and> y = u *\<^sub>R x} \<inter> s \<noteq> {}" |
|
5053 |
apply(rule *[OF _ assms(2)]) |
|
5054 |
unfolding mem_Collect_eq |
|
5055 |
using `b > 0` assms(3) |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
5056 |
apply auto |
53347 | 5057 |
done |
33175 | 5058 |
ultimately obtain u y where obt: "u\<ge>0" "u \<le> b / norm x" "y = u *\<^sub>R x" |
53347 | 5059 |
"y \<in> ?A" "y \<in> s" "\<forall>z\<in>?A \<inter> s. dist 0 z \<le> dist 0 y" |
5060 |
using distance_attains_sup[OF compact_inter[OF _ assms(1), of ?A], of 0] |
|
5061 |
by auto |
|
5062 |
||
5063 |
have "norm x > 0" |
|
5064 |
using assms(3)[unfolded zero_less_norm_iff[symmetric]] by auto |
|
5065 |
{ |
|
5066 |
fix v |
|
5067 |
assume as: "v > u" "v *\<^sub>R x \<in> s" |
|
5068 |
then have "v \<le> b / norm x" |
|
5069 |
using b(2)[rule_format, OF as(2)] |
|
5070 |
using `u\<ge>0` |
|
5071 |
unfolding pos_le_divide_eq[OF `norm x > 0`] |
|
5072 |
by auto |
|
5073 |
then have "norm (v *\<^sub>R x) \<le> norm y" |
|
5074 |
apply (rule_tac obt(6)[rule_format, unfolded dist_0_norm]) |
|
5075 |
apply (rule IntI) |
|
5076 |
defer |
|
5077 |
apply (rule as(2)) |
|
5078 |
unfolding mem_Collect_eq |
|
5079 |
apply (rule_tac x=v in exI) |
|
5080 |
using as(1) `u\<ge>0` |
|
5081 |
apply (auto simp add: field_simps) |
|
5082 |
done |
|
5083 |
then have False |
|
5084 |
unfolding obt(3) using `u\<ge>0` `norm x > 0` `v > u` |
|
5085 |
by (auto simp add:field_simps) |
|
33175 | 5086 |
} note u_max = this |
5087 |
||
53347 | 5088 |
have "u *\<^sub>R x \<in> frontier s" |
5089 |
unfolding frontier_straddle |
|
5090 |
apply (rule,rule,rule) |
|
5091 |
apply (rule_tac x="u *\<^sub>R x" in bexI) |
|
5092 |
unfolding obt(3)[symmetric] |
|
5093 |
prefer 3 |
|
5094 |
apply (rule_tac x="(u + (e / 2) / norm x) *\<^sub>R x" in exI) |
|
5095 |
apply (rule, rule) |
|
5096 |
proof - |
|
5097 |
fix e |
|
5098 |
assume "e > 0" and as: "(u + e / 2 / norm x) *\<^sub>R x \<in> s" |
|
5099 |
then have "u + e / 2 / norm x > u" |
|
56541 | 5100 |
using `norm x > 0` by (auto simp del:zero_less_norm_iff) |
53347 | 5101 |
then show False using u_max[OF _ as] by auto |
5102 |
qed (insert `y\<in>s`, auto simp add: dist_norm scaleR_left_distrib obt(3)) |
|
5103 |
then show ?thesis by(metis that[of u] u_max obt(1)) |
|
36071 | 5104 |
qed |
33175 | 5105 |
|
5106 |
lemma starlike_compact_projective: |
|
53347 | 5107 |
assumes "compact s" |
5108 |
and "cball (0::'a::euclidean_space) 1 \<subseteq> s " |
|
5109 |
and "\<forall>x\<in>s. \<forall>u. 0 \<le> u \<and> u < 1 \<longrightarrow> u *\<^sub>R x \<in> s - frontier s" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5110 |
shows "s homeomorphic (cball (0::'a::euclidean_space) 1)" |
53347 | 5111 |
proof - |
5112 |
have fs: "frontier s \<subseteq> s" |
|
5113 |
apply (rule frontier_subset_closed) |
|
5114 |
using compact_imp_closed[OF assms(1)] |
|
5115 |
apply simp |
|
5116 |
done |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5117 |
def pi \<equiv> "\<lambda>x::'a. inverse (norm x) *\<^sub>R x" |
53347 | 5118 |
have "0 \<notin> frontier s" |
5119 |
unfolding frontier_straddle |
|
5120 |
apply (rule notI) |
|
5121 |
apply (erule_tac x=1 in allE) |
|
5122 |
using assms(2)[unfolded subset_eq Ball_def mem_cball] |
|
5123 |
apply auto |
|
5124 |
done |
|
5125 |
have injpi: "\<And>x y. pi x = pi y \<and> norm x = norm y \<longleftrightarrow> x = y" |
|
5126 |
unfolding pi_def by auto |
|
5127 |
||
5128 |
have contpi: "continuous_on (UNIV - {0}) pi" |
|
5129 |
apply (rule continuous_at_imp_continuous_on) |
|
33175 | 5130 |
apply rule unfolding pi_def |
44647
e4de7750cdeb
modernize lemmas about 'continuous' and 'continuous_on';
huffman
parents:
44629
diff
changeset
|
5131 |
apply (intro continuous_intros) |
33175 | 5132 |
apply simp |
5133 |
done |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5134 |
def sphere \<equiv> "{x::'a. norm x = 1}" |
53347 | 5135 |
have pi: "\<And>x. x \<noteq> 0 \<Longrightarrow> pi x \<in> sphere" "\<And>x u. u>0 \<Longrightarrow> pi (u *\<^sub>R x) = pi x" |
5136 |
unfolding pi_def sphere_def by auto |
|
5137 |
||
5138 |
have "0 \<in> s" |
|
5139 |
using assms(2) and centre_in_cball[of 0 1] by auto |
|
5140 |
have front_smul: "\<forall>x\<in>frontier s. \<forall>u\<ge>0. u *\<^sub>R x \<in> s \<longleftrightarrow> u \<le> 1" |
|
5141 |
proof (rule,rule,rule) |
|
5142 |
fix x and u :: real |
|
5143 |
assume x: "x \<in> frontier s" and "0 \<le> u" |
|
5144 |
then have "x \<noteq> 0" |
|
5145 |
using `0 \<notin> frontier s` by auto |
|
5146 |
obtain v where v: "0 \<le> v" "v *\<^sub>R x \<in> frontier s" "\<forall>w>v. w *\<^sub>R x \<notin> s" |
|
33175 | 5147 |
using compact_frontier_line_lemma[OF assms(1) `0\<in>s` `x\<noteq>0`] by auto |
53347 | 5148 |
have "v = 1" |
5149 |
apply (rule ccontr) |
|
5150 |
unfolding neq_iff |
|
5151 |
apply (erule disjE) |
|
5152 |
proof - |
|
5153 |
assume "v < 1" |
|
5154 |
then show False |
|
5155 |
using v(3)[THEN spec[where x=1]] using x and fs by auto |
|
5156 |
next |
|
5157 |
assume "v > 1" |
|
5158 |
then show False |
|
5159 |
using assms(3)[THEN bspec[where x="v *\<^sub>R x"], THEN spec[where x="inverse v"]] |
|
5160 |
using v and x and fs |
|
5161 |
unfolding inverse_less_1_iff by auto |
|
5162 |
qed |
|
5163 |
show "u *\<^sub>R x \<in> s \<longleftrightarrow> u \<le> 1" |
|
5164 |
apply rule |
|
5165 |
using v(3)[unfolded `v=1`, THEN spec[where x=u]] |
|
5166 |
proof - |
|
5167 |
assume "u \<le> 1" |
|
5168 |
then show "u *\<^sub>R x \<in> s" |
|
5169 |
apply (cases "u = 1") |
|
5170 |
using assms(3)[THEN bspec[where x=x], THEN spec[where x=u]] |
|
5171 |
using `0\<le>u` and x and fs |
|
5172 |
apply auto |
|
5173 |
done |
|
5174 |
qed auto |
|
5175 |
qed |
|
33175 | 5176 |
|
5177 |
have "\<exists>surf. homeomorphism (frontier s) sphere pi surf" |
|
53347 | 5178 |
apply (rule homeomorphism_compact) |
5179 |
apply (rule compact_frontier[OF assms(1)]) |
|
5180 |
apply (rule continuous_on_subset[OF contpi]) |
|
5181 |
defer |
|
5182 |
apply (rule set_eqI) |
|
5183 |
apply rule |
|
5184 |
unfolding inj_on_def |
|
5185 |
prefer 3 |
|
5186 |
apply(rule,rule,rule) |
|
5187 |
proof - |
|
5188 |
fix x |
|
5189 |
assume "x \<in> pi ` frontier s" |
|
5190 |
then obtain y where "y \<in> frontier s" "x = pi y" by auto |
|
5191 |
then show "x \<in> sphere" |
|
5192 |
using pi(1)[of y] and `0 \<notin> frontier s` by auto |
|
5193 |
next |
|
5194 |
fix x |
|
5195 |
assume "x \<in> sphere" |
|
5196 |
then have "norm x = 1" "x \<noteq> 0" |
|
5197 |
unfolding sphere_def by auto |
|
33175 | 5198 |
then obtain u where "0 \<le> u" "u *\<^sub>R x \<in> frontier s" "\<forall>v>u. v *\<^sub>R x \<notin> s" |
5199 |
using compact_frontier_line_lemma[OF assms(1) `0\<in>s`, of x] by auto |
|
53347 | 5200 |
then show "x \<in> pi ` frontier s" |
5201 |
unfolding image_iff le_less pi_def |
|
5202 |
apply (rule_tac x="u *\<^sub>R x" in bexI) |
|
53348 | 5203 |
using `norm x = 1` `0 \<notin> frontier s` |
53347 | 5204 |
apply auto |
5205 |
done |
|
5206 |
next |
|
5207 |
fix x y |
|
5208 |
assume as: "x \<in> frontier s" "y \<in> frontier s" "pi x = pi y" |
|
53348 | 5209 |
then have xys: "x \<in> s" "y \<in> s" |
53347 | 5210 |
using fs by auto |
53348 | 5211 |
from as(1,2) have nor: "norm x \<noteq> 0" "norm y \<noteq> 0" |
5212 |
using `0\<notin>frontier s` by auto |
|
5213 |
from nor have x: "x = norm x *\<^sub>R ((inverse (norm y)) *\<^sub>R y)" |
|
5214 |
unfolding as(3)[unfolded pi_def, symmetric] by auto |
|
5215 |
from nor have y: "y = norm y *\<^sub>R ((inverse (norm x)) *\<^sub>R x)" |
|
5216 |
unfolding as(3)[unfolded pi_def] by auto |
|
5217 |
have "0 \<le> norm y * inverse (norm x)" and "0 \<le> norm x * inverse (norm y)" |
|
53347 | 5218 |
using nor |
5219 |
apply auto |
|
5220 |
done |
|
5221 |
then have "norm x = norm y" |
|
5222 |
apply - |
|
5223 |
apply (rule ccontr) |
|
5224 |
unfolding neq_iff |
|
33175 | 5225 |
using x y and front_smul[THEN bspec, OF as(1), THEN spec[where x="norm y * (inverse (norm x))"]] |
5226 |
using front_smul[THEN bspec, OF as(2), THEN spec[where x="norm x * (inverse (norm y))"]] |
|
53347 | 5227 |
using xys nor |
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
5228 |
apply (auto simp add: field_simps) |
53347 | 5229 |
done |
5230 |
then show "x = y" |
|
5231 |
apply (subst injpi[symmetric]) |
|
5232 |
using as(3) |
|
5233 |
apply auto |
|
5234 |
done |
|
5235 |
qed (insert `0 \<notin> frontier s`, auto) |
|
5236 |
then obtain surf where |
|
5237 |
surf: "\<forall>x\<in>frontier s. surf (pi x) = x" "pi ` frontier s = sphere" "continuous_on (frontier s) pi" |
|
5238 |
"\<forall>y\<in>sphere. pi (surf y) = y" "surf ` sphere = frontier s" "continuous_on sphere surf" |
|
5239 |
unfolding homeomorphism_def by auto |
|
5240 |
||
5241 |
have cont_surfpi: "continuous_on (UNIV - {0}) (surf \<circ> pi)" |
|
5242 |
apply (rule continuous_on_compose) |
|
5243 |
apply (rule contpi) |
|
5244 |
apply (rule continuous_on_subset[of sphere]) |
|
5245 |
apply (rule surf(6)) |
|
5246 |
using pi(1) |
|
5247 |
apply auto |
|
5248 |
done |
|
5249 |
||
5250 |
{ |
|
5251 |
fix x |
|
5252 |
assume as: "x \<in> cball (0::'a) 1" |
|
5253 |
have "norm x *\<^sub>R surf (pi x) \<in> s" |
|
5254 |
proof (cases "x=0 \<or> norm x = 1") |
|
5255 |
case False |
|
5256 |
then have "pi x \<in> sphere" "norm x < 1" |
|
5257 |
using pi(1)[of x] as by(auto simp add: dist_norm) |
|
5258 |
then show ?thesis |
|
5259 |
apply (rule_tac assms(3)[rule_format, THEN DiffD1]) |
|
5260 |
apply (rule_tac fs[unfolded subset_eq, rule_format]) |
|
5261 |
unfolding surf(5)[symmetric] |
|
5262 |
apply auto |
|
5263 |
done |
|
5264 |
next |
|
5265 |
case True |
|
5266 |
then show ?thesis |
|
5267 |
apply rule |
|
5268 |
defer |
|
5269 |
unfolding pi_def |
|
5270 |
apply (rule fs[unfolded subset_eq, rule_format]) |
|
5271 |
unfolding surf(5)[unfolded sphere_def, symmetric] |
|
5272 |
using `0\<in>s` |
|
5273 |
apply auto |
|
5274 |
done |
|
5275 |
qed |
|
5276 |
} note hom = this |
|
5277 |
||
5278 |
{ |
|
5279 |
fix x |
|
5280 |
assume "x \<in> s" |
|
5281 |
then have "x \<in> (\<lambda>x. norm x *\<^sub>R surf (pi x)) ` cball 0 1" |
|
5282 |
proof (cases "x = 0") |
|
5283 |
case True |
|
5284 |
show ?thesis |
|
5285 |
unfolding image_iff True |
|
5286 |
apply (rule_tac x=0 in bexI) |
|
5287 |
apply auto |
|
5288 |
done |
|
5289 |
next |
|
5290 |
let ?a = "inverse (norm (surf (pi x)))" |
|
5291 |
case False |
|
5292 |
then have invn: "inverse (norm x) \<noteq> 0" by auto |
|
5293 |
from False have pix: "pi x\<in>sphere" using pi(1) by auto |
|
5294 |
then have "pi (surf (pi x)) = pi x" |
|
5295 |
apply (rule_tac surf(4)[rule_format]) |
|
5296 |
apply assumption |
|
5297 |
done |
|
5298 |
then have **: "norm x *\<^sub>R (?a *\<^sub>R surf (pi x)) = x" |
|
5299 |
apply (rule_tac scaleR_left_imp_eq[OF invn]) |
|
5300 |
unfolding pi_def |
|
5301 |
using invn |
|
5302 |
apply auto |
|
5303 |
done |
|
5304 |
then have *: "?a * norm x > 0" and "?a > 0" "?a \<noteq> 0" |
|
5305 |
using surf(5) `0\<notin>frontier s` |
|
5306 |
apply - |
|
5307 |
apply (rule mult_pos_pos) |
|
5308 |
using False[unfolded zero_less_norm_iff[symmetric]] |
|
5309 |
apply auto |
|
5310 |
done |
|
5311 |
have "norm (surf (pi x)) \<noteq> 0" |
|
5312 |
using ** False by auto |
|
5313 |
then have "norm x = norm ((?a * norm x) *\<^sub>R surf (pi x))" |
|
33175 | 5314 |
unfolding norm_scaleR abs_mult abs_norm_cancel abs_of_pos[OF `?a > 0`] by auto |
49531 | 5315 |
moreover have "pi x = pi ((inverse (norm (surf (pi x))) * norm x) *\<^sub>R surf (pi x))" |
33175 | 5316 |
unfolding pi(2)[OF *] surf(4)[rule_format, OF pix] .. |
53347 | 5317 |
moreover have "surf (pi x) \<in> frontier s" |
5318 |
using surf(5) pix by auto |
|
5319 |
then have "dist 0 (inverse (norm (surf (pi x))) *\<^sub>R x) \<le> 1" |
|
5320 |
unfolding dist_norm |
|
5321 |
using ** and * |
|
5322 |
using front_smul[THEN bspec[where x="surf (pi x)"], THEN spec[where x="norm x * ?a"]] |
|
5323 |
using False `x\<in>s` |
|
5324 |
by (auto simp add: field_simps) |
|
5325 |
ultimately show ?thesis |
|
5326 |
unfolding image_iff |
|
5327 |
apply (rule_tac x="inverse (norm (surf(pi x))) *\<^sub>R x" in bexI) |
|
5328 |
apply (subst injpi[symmetric]) |
|
5329 |
unfolding abs_mult abs_norm_cancel abs_of_pos[OF `?a > 0`] |
|
5330 |
unfolding pi(2)[OF `?a > 0`] |
|
5331 |
apply auto |
|
5332 |
done |
|
5333 |
qed |
|
5334 |
} note hom2 = this |
|
5335 |
||
5336 |
show ?thesis |
|
5337 |
apply (subst homeomorphic_sym) |
|
5338 |
apply (rule homeomorphic_compact[where f="\<lambda>x. norm x *\<^sub>R surf (pi x)"]) |
|
5339 |
apply (rule compact_cball) |
|
5340 |
defer |
|
5341 |
apply (rule set_eqI) |
|
5342 |
apply rule |
|
5343 |
apply (erule imageE) |
|
5344 |
apply (drule hom) |
|
5345 |
prefer 4 |
|
5346 |
apply (rule continuous_at_imp_continuous_on) |
|
5347 |
apply rule |
|
5348 |
apply (rule_tac [3] hom2) |
|
5349 |
proof - |
|
5350 |
fix x :: 'a |
|
5351 |
assume as: "x \<in> cball 0 1" |
|
5352 |
then show "continuous (at x) (\<lambda>x. norm x *\<^sub>R surf (pi x))" |
|
5353 |
proof (cases "x = 0") |
|
5354 |
case False |
|
5355 |
then show ?thesis |
|
5356 |
apply (intro continuous_intros) |
|
5357 |
using cont_surfpi |
|
5358 |
unfolding continuous_on_eq_continuous_at[OF open_delete[OF open_UNIV]] o_def |
|
5359 |
apply auto |
|
5360 |
done |
|
5361 |
next |
|
5362 |
case True |
|
5363 |
obtain B where B: "\<forall>x\<in>s. norm x \<le> B" |
|
5364 |
using compact_imp_bounded[OF assms(1)] unfolding bounded_iff by auto |
|
5365 |
then have "B > 0" |
|
5366 |
using assms(2) |
|
5367 |
unfolding subset_eq |
|
5368 |
apply (erule_tac x="SOME i. i\<in>Basis" in ballE) |
|
5369 |
defer |
|
5370 |
apply (erule_tac x="SOME i. i\<in>Basis" in ballE) |
|
5371 |
unfolding Ball_def mem_cball dist_norm |
|
5372 |
using DIM_positive[where 'a='a] |
|
5373 |
apply (auto simp: SOME_Basis) |
|
5374 |
done |
|
5375 |
show ?thesis |
|
5376 |
unfolding True continuous_at Lim_at |
|
5377 |
apply(rule,rule) |
|
5378 |
apply(rule_tac x="e / B" in exI) |
|
5379 |
apply rule |
|
5380 |
apply (rule divide_pos_pos) |
|
5381 |
prefer 3 |
|
5382 |
apply(rule,rule,erule conjE) |
|
5383 |
unfolding norm_zero scaleR_zero_left dist_norm diff_0_right norm_scaleR abs_norm_cancel |
|
5384 |
proof - |
|
5385 |
fix e and x :: 'a |
|
5386 |
assume as: "norm x < e / B" "0 < norm x" "e > 0" |
|
5387 |
then have "surf (pi x) \<in> frontier s" |
|
5388 |
using pi(1)[of x] unfolding surf(5)[symmetric] by auto |
|
5389 |
then have "norm (surf (pi x)) \<le> B" |
|
5390 |
using B fs by auto |
|
5391 |
then have "norm x * norm (surf (pi x)) \<le> norm x * B" |
|
5392 |
using as(2) by auto |
|
5393 |
also have "\<dots> < e / B * B" |
|
5394 |
apply (rule mult_strict_right_mono) |
|
5395 |
using as(1) `B>0` |
|
5396 |
apply auto |
|
5397 |
done |
|
5398 |
also have "\<dots> = e" using `B > 0` by auto |
|
5399 |
finally show "norm x * norm (surf (pi x)) < e" . |
|
5400 |
qed (insert `B>0`, auto) |
|
5401 |
qed |
|
5402 |
next |
|
5403 |
{ |
|
5404 |
fix x |
|
5405 |
assume as: "surf (pi x) = 0" |
|
5406 |
have "x = 0" |
|
5407 |
proof (rule ccontr) |
|
5408 |
assume "x \<noteq> 0" |
|
5409 |
then have "pi x \<in> sphere" |
|
5410 |
using pi(1) by auto |
|
5411 |
then have "surf (pi x) \<in> frontier s" |
|
5412 |
using surf(5) by auto |
|
5413 |
then show False |
|
5414 |
using `0\<notin>frontier s` unfolding as by simp |
|
5415 |
qed |
|
33175 | 5416 |
} note surf_0 = this |
53347 | 5417 |
show "inj_on (\<lambda>x. norm x *\<^sub>R surf (pi x)) (cball 0 1)" |
5418 |
unfolding inj_on_def |
|
5419 |
proof (rule,rule,rule) |
|
5420 |
fix x y |
|
5421 |
assume as: "x \<in> cball 0 1" "y \<in> cball 0 1" "norm x *\<^sub>R surf (pi x) = norm y *\<^sub>R surf (pi y)" |
|
5422 |
then show "x = y" |
|
5423 |
proof (cases "x=0 \<or> y=0") |
|
5424 |
case True |
|
5425 |
then show ?thesis |
|
5426 |
using as by (auto elim: surf_0) |
|
5427 |
next |
|
33175 | 5428 |
case False |
53347 | 5429 |
then have "pi (surf (pi x)) = pi (surf (pi y))" |
5430 |
using as(3) |
|
5431 |
using pi(2)[of "norm x" "surf (pi x)"] pi(2)[of "norm y" "surf (pi y)"] |
|
5432 |
by auto |
|
5433 |
moreover have "pi x \<in> sphere" "pi y \<in> sphere" |
|
5434 |
using pi(1) False by auto |
|
5435 |
ultimately have *: "pi x = pi y" |
|
5436 |
using surf(4)[THEN bspec[where x="pi x"]] surf(4)[THEN bspec[where x="pi y"]] |
|
5437 |
by auto |
|
5438 |
moreover have "norm x = norm y" |
|
5439 |
using as(3)[unfolded *] using False |
|
5440 |
by (auto dest:surf_0) |
|
5441 |
ultimately show ?thesis |
|
5442 |
using injpi by auto |
|
5443 |
qed |
|
5444 |
qed |
|
5445 |
qed auto |
|
5446 |
qed |
|
33175 | 5447 |
|
44519 | 5448 |
lemma homeomorphic_convex_compact_lemma: |
53347 | 5449 |
fixes s :: "'a::euclidean_space set" |
5450 |
assumes "convex s" |
|
5451 |
and "compact s" |
|
5452 |
and "cball 0 1 \<subseteq> s" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5453 |
shows "s homeomorphic (cball (0::'a) 1)" |
44519 | 5454 |
proof (rule starlike_compact_projective[OF assms(2-3)], clarify) |
53347 | 5455 |
fix x u |
5456 |
assume "x \<in> s" and "0 \<le> u" and "u < (1::real)" |
|
5457 |
have "open (ball (u *\<^sub>R x) (1 - u))" |
|
5458 |
by (rule open_ball) |
|
44519 | 5459 |
moreover have "u *\<^sub>R x \<in> ball (u *\<^sub>R x) (1 - u)" |
5460 |
unfolding centre_in_ball using `u < 1` by simp |
|
5461 |
moreover have "ball (u *\<^sub>R x) (1 - u) \<subseteq> s" |
|
5462 |
proof |
|
53347 | 5463 |
fix y |
5464 |
assume "y \<in> ball (u *\<^sub>R x) (1 - u)" |
|
5465 |
then have "dist (u *\<^sub>R x) y < 1 - u" |
|
5466 |
unfolding mem_ball . |
|
44519 | 5467 |
with `u < 1` have "inverse (1 - u) *\<^sub>R (y - u *\<^sub>R x) \<in> cball 0 1" |
5468 |
by (simp add: dist_norm inverse_eq_divide norm_minus_commute) |
|
5469 |
with assms(3) have "inverse (1 - u) *\<^sub>R (y - u *\<^sub>R x) \<in> s" .. |
|
5470 |
with assms(1) have "(1 - u) *\<^sub>R ((y - u *\<^sub>R x) /\<^sub>R (1 - u)) + u *\<^sub>R x \<in> s" |
|
5471 |
using `x \<in> s` `0 \<le> u` `u < 1` [THEN less_imp_le] by (rule mem_convex) |
|
53347 | 5472 |
then show "y \<in> s" using `u < 1` |
5473 |
by simp |
|
44519 | 5474 |
qed |
5475 |
ultimately have "u *\<^sub>R x \<in> interior s" .. |
|
53347 | 5476 |
then show "u *\<^sub>R x \<in> s - frontier s" |
5477 |
using frontier_def and interior_subset by auto |
|
5478 |
qed |
|
33175 | 5479 |
|
53348 | 5480 |
lemma homeomorphic_convex_compact_cball: |
5481 |
fixes e :: real |
|
5482 |
and s :: "'a::euclidean_space set" |
|
5483 |
assumes "convex s" |
|
5484 |
and "compact s" |
|
5485 |
and "interior s \<noteq> {}" |
|
5486 |
and "e > 0" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5487 |
shows "s homeomorphic (cball (b::'a) e)" |
53348 | 5488 |
proof - |
5489 |
obtain a where "a \<in> interior s" |
|
5490 |
using assms(3) by auto |
|
5491 |
then obtain d where "d > 0" and d: "cball a d \<subseteq> s" |
|
5492 |
unfolding mem_interior_cball by auto |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
5493 |
let ?d = "inverse d" and ?n = "0::'a" |
33175 | 5494 |
have "cball ?n 1 \<subseteq> (\<lambda>x. inverse d *\<^sub>R (x - a)) ` s" |
53348 | 5495 |
apply rule |
5496 |
apply (rule_tac x="d *\<^sub>R x + a" in image_eqI) |
|
5497 |
defer |
|
5498 |
apply (rule d[unfolded subset_eq, rule_format]) |
|
5499 |
using `d > 0` |
|
5500 |
unfolding mem_cball dist_norm |
|
5501 |
apply (auto simp add: mult_right_le_one_le) |
|
5502 |
done |
|
5503 |
then have "(\<lambda>x. inverse d *\<^sub>R (x - a)) ` s homeomorphic cball ?n 1" |
|
5504 |
using homeomorphic_convex_compact_lemma[of "(\<lambda>x. ?d *\<^sub>R -a + ?d *\<^sub>R x) ` s", |
|
5505 |
OF convex_affinity compact_affinity] |
|
5506 |
using assms(1,2) |
|
5507 |
by (auto simp add: uminus_add_conv_diff scaleR_right_diff_distrib) |
|
5508 |
then show ?thesis |
|
5509 |
apply (rule_tac homeomorphic_trans[OF _ homeomorphic_balls(2)[of 1 _ ?n]]) |
|
5510 |
apply (rule homeomorphic_trans[OF homeomorphic_affinity[of "?d" s "?d *\<^sub>R -a"]]) |
|
5511 |
using `d>0` `e>0` |
|
5512 |
apply (auto simp add: uminus_add_conv_diff scaleR_right_diff_distrib) |
|
5513 |
done |
|
5514 |
qed |
|
5515 |
||
5516 |
lemma homeomorphic_convex_compact: |
|
5517 |
fixes s :: "'a::euclidean_space set" |
|
5518 |
and t :: "'a set" |
|
33175 | 5519 |
assumes "convex s" "compact s" "interior s \<noteq> {}" |
53348 | 5520 |
and "convex t" "compact t" "interior t \<noteq> {}" |
33175 | 5521 |
shows "s homeomorphic t" |
53348 | 5522 |
using assms |
5523 |
by (meson zero_less_one homeomorphic_trans homeomorphic_convex_compact_cball homeomorphic_sym) |
|
5524 |
||
33175 | 5525 |
|
44467 | 5526 |
subsection {* Epigraphs of convex functions *} |
33175 | 5527 |
|
53348 | 5528 |
definition "epigraph s (f :: _ \<Rightarrow> real) = {xy. fst xy \<in> s \<and> f (fst xy) \<le> snd xy}" |
5529 |
||
5530 |
lemma mem_epigraph: "(x, y) \<in> epigraph s f \<longleftrightarrow> x \<in> s \<and> f x \<le> y" |
|
5531 |
unfolding epigraph_def by auto |
|
5532 |
||
5533 |
lemma convex_epigraph: "convex (epigraph s f) \<longleftrightarrow> convex_on s f \<and> convex s" |
|
36338 | 5534 |
unfolding convex_def convex_on_def |
5535 |
unfolding Ball_def split_paired_All epigraph_def |
|
5536 |
unfolding mem_Collect_eq fst_conv snd_conv fst_add snd_add fst_scaleR snd_scaleR Ball_def[symmetric] |
|
53348 | 5537 |
apply safe |
5538 |
defer |
|
5539 |
apply (erule_tac x=x in allE) |
|
5540 |
apply (erule_tac x="f x" in allE) |
|
5541 |
apply safe |
|
5542 |
apply (erule_tac x=xa in allE) |
|
5543 |
apply (erule_tac x="f xa" in allE) |
|
5544 |
prefer 3 |
|
5545 |
apply (rule_tac y="u * f a + v * f aa" in order_trans) |
|
5546 |
defer |
|
5547 |
apply (auto intro!:mult_left_mono add_mono) |
|
5548 |
done |
|
5549 |
||
5550 |
lemma convex_epigraphI: "convex_on s f \<Longrightarrow> convex s \<Longrightarrow> convex (epigraph s f)" |
|
5551 |
unfolding convex_epigraph by auto |
|
5552 |
||
5553 |
lemma convex_epigraph_convex: "convex s \<Longrightarrow> convex_on s f \<longleftrightarrow> convex(epigraph s f)" |
|
5554 |
by (simp add: convex_epigraph) |
|
5555 |
||
33175 | 5556 |
|
44467 | 5557 |
subsubsection {* Use this to derive general bound property of convex function *} |
33175 | 5558 |
|
5559 |
lemma convex_on: |
|
5560 |
assumes "convex s" |
|
53348 | 5561 |
shows "convex_on s f \<longleftrightarrow> |
5562 |
(\<forall>k u x. (\<forall>i\<in>{1..k::nat}. 0 \<le> u i \<and> x i \<in> s) \<and> setsum u {1..k} = 1 \<longrightarrow> |
|
5563 |
f (setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} ) \<le> setsum (\<lambda>i. u i * f(x i)) {1..k})" |
|
33175 | 5564 |
unfolding convex_epigraph_convex[OF assms] convex epigraph_def Ball_def mem_Collect_eq |
36338 | 5565 |
unfolding fst_setsum snd_setsum fst_scaleR snd_scaleR |
5566 |
apply safe |
|
5567 |
apply (drule_tac x=k in spec) |
|
5568 |
apply (drule_tac x=u in spec) |
|
5569 |
apply (drule_tac x="\<lambda>i. (x i, f (x i))" in spec) |
|
5570 |
apply simp |
|
53348 | 5571 |
using assms[unfolded convex] |
5572 |
apply simp |
|
5573 |
apply (rule_tac y="\<Sum>i = 1..k. u i * f (fst (x i))" in order_trans) |
|
5574 |
defer |
|
5575 |
apply (rule setsum_mono) |
|
5576 |
apply (erule_tac x=i in allE) |
|
5577 |
unfolding real_scaleR_def |
|
5578 |
apply (rule mult_left_mono) |
|
5579 |
using assms[unfolded convex] |
|
5580 |
apply auto |
|
5581 |
done |
|
33175 | 5582 |
|
36338 | 5583 |
|
44467 | 5584 |
subsection {* Convexity of general and special intervals *} |
33175 | 5585 |
|
5586 |
lemma is_interval_convex: |
|
53348 | 5587 |
fixes s :: "'a::euclidean_space set" |
5588 |
assumes "is_interval s" |
|
5589 |
shows "convex s" |
|
37732
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
5590 |
proof (rule convexI) |
53348 | 5591 |
fix x y and u v :: real |
5592 |
assume as: "x \<in> s" "y \<in> s" "0 \<le> u" "0 \<le> v" "u + v = 1" |
|
5593 |
then have *: "u = 1 - v" "1 - v \<ge> 0" and **: "v = 1 - u" "1 - u \<ge> 0" |
|
5594 |
by auto |
|
5595 |
{ |
|
5596 |
fix a b |
|
5597 |
assume "\<not> b \<le> u * a + v * b" |
|
5598 |
then have "u * a < (1 - v) * b" |
|
5599 |
unfolding not_le using as(4) by (auto simp add: field_simps) |
|
5600 |
then have "a < b" |
|
5601 |
unfolding * using as(4) *(2) |
|
5602 |
apply (rule_tac mult_left_less_imp_less[of "1 - v"]) |
|
5603 |
apply (auto simp add: field_simps) |
|
5604 |
done |
|
5605 |
then have "a \<le> u * a + v * b" |
|
5606 |
unfolding * using as(4) |
|
5607 |
by (auto simp add: field_simps intro!:mult_right_mono) |
|
5608 |
} |
|
5609 |
moreover |
|
5610 |
{ |
|
5611 |
fix a b |
|
5612 |
assume "\<not> u * a + v * b \<le> a" |
|
5613 |
then have "v * b > (1 - u) * a" |
|
5614 |
unfolding not_le using as(4) by (auto simp add: field_simps) |
|
5615 |
then have "a < b" |
|
5616 |
unfolding * using as(4) |
|
5617 |
apply (rule_tac mult_left_less_imp_less) |
|
5618 |
apply (auto simp add: field_simps) |
|
5619 |
done |
|
5620 |
then have "u * a + v * b \<le> b" |
|
5621 |
unfolding ** |
|
5622 |
using **(2) as(3) |
|
5623 |
by (auto simp add: field_simps intro!:mult_right_mono) |
|
5624 |
} |
|
5625 |
ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> s" |
|
5626 |
apply - |
|
5627 |
apply (rule assms[unfolded is_interval_def, rule_format, OF as(1,2)]) |
|
5628 |
using as(3-) DIM_positive[where 'a='a] |
|
5629 |
apply (auto simp: inner_simps) |
|
5630 |
done |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5631 |
qed |
33175 | 5632 |
|
5633 |
lemma is_interval_connected: |
|
53348 | 5634 |
fixes s :: "'a::euclidean_space set" |
33175 | 5635 |
shows "is_interval s \<Longrightarrow> connected s" |
5636 |
using is_interval_convex convex_connected by auto |
|
5637 |
||
56188 | 5638 |
lemma convex_box: "convex (cbox a b)" "convex (box a (b::'a::euclidean_space))" |
5639 |
apply (rule_tac[!] is_interval_convex)+ |
|
56189
c4daa97ac57a
removed dependencies on theory Ordered_Euclidean_Space
immler
parents:
56188
diff
changeset
|
5640 |
using is_interval_box is_interval_cbox |
53348 | 5641 |
apply auto |
5642 |
done |
|
33175 | 5643 |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5644 |
subsection {* On @{text "real"}, @{text "is_interval"}, @{text "convex"} and @{text "connected"} are all equivalent. *} |
33175 | 5645 |
|
5646 |
lemma is_interval_1: |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5647 |
"is_interval (s::real set) \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall> x. a \<le> x \<and> x \<le> b \<longrightarrow> x \<in> s)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5648 |
unfolding is_interval_def by auto |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5649 |
|
54465 | 5650 |
lemma is_interval_connected_1: |
5651 |
fixes s :: "real set" |
|
5652 |
shows "is_interval s \<longleftrightarrow> connected s" |
|
5653 |
apply rule |
|
5654 |
apply (rule is_interval_connected, assumption) |
|
5655 |
unfolding is_interval_1 |
|
5656 |
apply rule |
|
5657 |
apply rule |
|
5658 |
apply rule |
|
5659 |
apply rule |
|
5660 |
apply (erule conjE) |
|
5661 |
apply (rule ccontr) |
|
5662 |
proof - |
|
5663 |
fix a b x |
|
5664 |
assume as: "connected s" "a \<in> s" "b \<in> s" "a \<le> x" "x \<le> b" "x \<notin> s" |
|
5665 |
then have *: "a < x" "x < b" |
|
5666 |
unfolding not_le [symmetric] by auto |
|
5667 |
let ?halfl = "{..<x} " |
|
5668 |
let ?halfr = "{x<..}" |
|
5669 |
{ |
|
5670 |
fix y |
|
5671 |
assume "y \<in> s" |
|
5672 |
with `x \<notin> s` have "x \<noteq> y" by auto |
|
5673 |
then have "y \<in> ?halfr \<union> ?halfl" by auto |
|
5674 |
} |
|
5675 |
moreover have "a \<in> ?halfl" "b \<in> ?halfr" using * by auto |
|
5676 |
then have "?halfl \<inter> s \<noteq> {}" "?halfr \<inter> s \<noteq> {}" |
|
5677 |
using as(2-3) by auto |
|
5678 |
ultimately show False |
|
5679 |
apply (rule_tac notE[OF as(1)[unfolded connected_def]]) |
|
5680 |
apply (rule_tac x = ?halfl in exI) |
|
5681 |
apply (rule_tac x = ?halfr in exI) |
|
5682 |
apply rule |
|
5683 |
apply (rule open_lessThan) |
|
5684 |
apply rule |
|
5685 |
apply (rule open_greaterThan) |
|
5686 |
apply auto |
|
5687 |
done |
|
5688 |
qed |
|
33175 | 5689 |
|
5690 |
lemma is_interval_convex_1: |
|
54465 | 5691 |
fixes s :: "real set" |
5692 |
shows "is_interval s \<longleftrightarrow> convex s" |
|
5693 |
by (metis is_interval_convex convex_connected is_interval_connected_1) |
|
33175 | 5694 |
|
5695 |
lemma convex_connected_1: |
|
54465 | 5696 |
fixes s :: "real set" |
5697 |
shows "connected s \<longleftrightarrow> convex s" |
|
5698 |
by (metis is_interval_convex convex_connected is_interval_connected_1) |
|
53348 | 5699 |
|
5700 |
||
44467 | 5701 |
subsection {* Another intermediate value theorem formulation *} |
33175 | 5702 |
|
53348 | 5703 |
lemma ivt_increasing_component_on_1: |
5704 |
fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
|
5705 |
assumes "a \<le> b" |
|
56188 | 5706 |
and "continuous_on (cbox a b) f" |
53348 | 5707 |
and "(f a)\<bullet>k \<le> y" "y \<le> (f b)\<bullet>k" |
56188 | 5708 |
shows "\<exists>x\<in>cbox a b. (f x)\<bullet>k = y" |
5709 |
proof - |
|
5710 |
have "f a \<in> f ` cbox a b" "f b \<in> f ` cbox a b" |
|
53348 | 5711 |
apply (rule_tac[!] imageI) |
5712 |
using assms(1) |
|
5713 |
apply auto |
|
5714 |
done |
|
5715 |
then show ?thesis |
|
56188 | 5716 |
using connected_ivt_component[of "f ` cbox a b" "f a" "f b" k y] |
5717 |
using connected_continuous_image[OF assms(2) convex_connected[OF convex_box(1)]] |
|
53348 | 5718 |
using assms |
56188 | 5719 |
by auto |
53348 | 5720 |
qed |
5721 |
||
5722 |
lemma ivt_increasing_component_1: |
|
5723 |
fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
|
56188 | 5724 |
shows "a \<le> b \<Longrightarrow> \<forall>x\<in>cbox a b. continuous (at x) f \<Longrightarrow> |
5725 |
f a\<bullet>k \<le> y \<Longrightarrow> y \<le> f b\<bullet>k \<Longrightarrow> \<exists>x\<in>cbox a b. (f x)\<bullet>k = y" |
|
53348 | 5726 |
by (rule ivt_increasing_component_on_1) (auto simp add: continuous_at_imp_continuous_on) |
5727 |
||
5728 |
lemma ivt_decreasing_component_on_1: |
|
5729 |
fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
|
5730 |
assumes "a \<le> b" |
|
56188 | 5731 |
and "continuous_on (cbox a b) f" |
53348 | 5732 |
and "(f b)\<bullet>k \<le> y" |
5733 |
and "y \<le> (f a)\<bullet>k" |
|
56188 | 5734 |
shows "\<exists>x\<in>cbox a b. (f x)\<bullet>k = y" |
53348 | 5735 |
apply (subst neg_equal_iff_equal[symmetric]) |
44531
1d477a2b1572
replace some continuous_on lemmas with more general versions
huffman
parents:
44525
diff
changeset
|
5736 |
using ivt_increasing_component_on_1[of a b "\<lambda>x. - f x" k "- y"] |
53348 | 5737 |
using assms using continuous_on_minus |
5738 |
apply auto |
|
5739 |
done |
|
5740 |
||
5741 |
lemma ivt_decreasing_component_1: |
|
5742 |
fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
|
56188 | 5743 |
shows "a \<le> b \<Longrightarrow> \<forall>x\<in>cbox a b. continuous (at x) f \<Longrightarrow> |
5744 |
f b\<bullet>k \<le> y \<Longrightarrow> y \<le> f a\<bullet>k \<Longrightarrow> \<exists>x\<in>cbox a b. (f x)\<bullet>k = y" |
|
53348 | 5745 |
by (rule ivt_decreasing_component_on_1) (auto simp: continuous_at_imp_continuous_on) |
5746 |
||
33175 | 5747 |
|
44467 | 5748 |
subsection {* A bound within a convex hull, and so an interval *} |
33175 | 5749 |
|
5750 |
lemma convex_on_convex_hull_bound: |
|
53348 | 5751 |
assumes "convex_on (convex hull s) f" |
5752 |
and "\<forall>x\<in>s. f x \<le> b" |
|
5753 |
shows "\<forall>x\<in> convex hull s. f x \<le> b" |
|
5754 |
proof |
|
5755 |
fix x |
|
5756 |
assume "x \<in> convex hull s" |
|
5757 |
then obtain k u v where |
|
5758 |
obt: "\<forall>i\<in>{1..k::nat}. 0 \<le> u i \<and> v i \<in> s" "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R v i) = x" |
|
33175 | 5759 |
unfolding convex_hull_indexed mem_Collect_eq by auto |
53348 | 5760 |
have "(\<Sum>i = 1..k. u i * f (v i)) \<le> b" |
5761 |
using setsum_mono[of "{1..k}" "\<lambda>i. u i * f (v i)" "\<lambda>i. u i * b"] |
|
5762 |
unfolding setsum_left_distrib[symmetric] obt(2) mult_1 |
|
5763 |
apply (drule_tac meta_mp) |
|
5764 |
apply (rule mult_left_mono) |
|
5765 |
using assms(2) obt(1) |
|
5766 |
apply auto |
|
5767 |
done |
|
5768 |
then show "f x \<le> b" |
|
5769 |
using assms(1)[unfolded convex_on[OF convex_convex_hull], rule_format, of k u v] |
|
5770 |
unfolding obt(2-3) |
|
5771 |
using obt(1) and hull_subset[unfolded subset_eq, rule_format, of _ s] |
|
5772 |
by auto |
|
5773 |
qed |
|
5774 |
||
5775 |
lemma inner_setsum_Basis[simp]: "i \<in> Basis \<Longrightarrow> (\<Sum>Basis) \<bullet> i = 1" |
|
57418 | 5776 |
by (simp add: inner_setsum_left setsum.If_cases inner_Basis) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5777 |
|
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5778 |
lemma convex_set_plus: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5779 |
assumes "convex s" and "convex t" shows "convex (s + t)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5780 |
proof - |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5781 |
have "convex {x + y |x y. x \<in> s \<and> y \<in> t}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5782 |
using assms by (rule convex_sums) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5783 |
moreover have "{x + y |x y. x \<in> s \<and> y \<in> t} = s + t" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5784 |
unfolding set_plus_def by auto |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5785 |
finally show "convex (s + t)" . |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5786 |
qed |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5787 |
|
55929
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5788 |
lemma convex_set_setsum: |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5789 |
assumes "\<And>i. i \<in> A \<Longrightarrow> convex (B i)" |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5790 |
shows "convex (\<Sum>i\<in>A. B i)" |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5791 |
proof (cases "finite A") |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5792 |
case True then show ?thesis using assms |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5793 |
by induct (auto simp: convex_set_plus) |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5794 |
qed auto |
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
5795 |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5796 |
lemma finite_set_setsum: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5797 |
assumes "finite A" and "\<forall>i\<in>A. finite (B i)" shows "finite (\<Sum>i\<in>A. B i)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5798 |
using assms by (induct set: finite, simp, simp add: finite_set_plus) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5799 |
|
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5800 |
lemma set_setsum_eq: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5801 |
"finite A \<Longrightarrow> (\<Sum>i\<in>A. B i) = {\<Sum>i\<in>A. f i |f. \<forall>i\<in>A. f i \<in> B i}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5802 |
apply (induct set: finite) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5803 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5804 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5805 |
apply (safe elim!: set_plus_elim) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5806 |
apply (rule_tac x="fun_upd f x a" in exI) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5807 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5808 |
apply (rule_tac f="\<lambda>x. a + x" in arg_cong) |
57418 | 5809 |
apply (rule setsum.cong [OF refl]) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5810 |
apply clarsimp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5811 |
apply (fast intro: set_plus_intro) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5812 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5813 |
|
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5814 |
lemma box_eq_set_setsum_Basis: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5815 |
shows "{x. \<forall>i\<in>Basis. x\<bullet>i \<in> B i} = (\<Sum>i\<in>Basis. image (\<lambda>x. x *\<^sub>R i) (B i))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5816 |
apply (subst set_setsum_eq [OF finite_Basis]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5817 |
apply safe |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5818 |
apply (fast intro: euclidean_representation [symmetric]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5819 |
apply (subst inner_setsum_left) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5820 |
apply (subgoal_tac "(\<Sum>x\<in>Basis. f x \<bullet> i) = f i \<bullet> i") |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5821 |
apply (drule (1) bspec) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5822 |
apply clarsimp |
57418 | 5823 |
apply (frule setsum.remove [OF finite_Basis]) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5824 |
apply (erule trans) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5825 |
apply simp |
57418 | 5826 |
apply (rule setsum.neutral) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5827 |
apply clarsimp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5828 |
apply (frule_tac x=i in bspec, assumption) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5829 |
apply (drule_tac x=x in bspec, assumption) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5830 |
apply clarsimp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5831 |
apply (cut_tac u=x and v=i in inner_Basis, assumption+) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5832 |
apply (rule ccontr) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5833 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5834 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5835 |
|
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5836 |
lemma convex_hull_set_setsum: |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5837 |
"convex hull (\<Sum>i\<in>A. B i) = (\<Sum>i\<in>A. convex hull (B i))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5838 |
proof (cases "finite A") |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5839 |
assume "finite A" then show ?thesis |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5840 |
by (induct set: finite, simp, simp add: convex_hull_set_plus) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5841 |
qed simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5842 |
|
56188 | 5843 |
lemma convex_hull_eq_real_cbox: |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5844 |
fixes x y :: real assumes "x \<le> y" |
56188 | 5845 |
shows "convex hull {x, y} = cbox x y" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5846 |
proof (rule hull_unique) |
56188 | 5847 |
show "{x, y} \<subseteq> cbox x y" using `x \<le> y` by auto |
5848 |
show "convex (cbox x y)" |
|
5849 |
by (rule convex_box) |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5850 |
next |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5851 |
fix s assume "{x, y} \<subseteq> s" and "convex s" |
56188 | 5852 |
then show "cbox x y \<subseteq> s" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5853 |
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:
53600
diff
changeset
|
5854 |
by - (clarify, simp (no_asm_use), fast) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5855 |
qed |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5856 |
|
33175 | 5857 |
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:
57418
diff
changeset
|
5858 |
"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:
36844
diff
changeset
|
5859 |
(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:
50104
diff
changeset
|
5860 |
proof - |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5861 |
have One[simp]: "\<And>i. i \<in> Basis \<Longrightarrow> One \<bullet> i = 1" |
57418 | 5862 |
by (simp add: One_def inner_setsum_left setsum.If_cases inner_Basis) |
56188 | 5863 |
have "?int = {x. \<forall>i\<in>Basis. x \<bullet> i \<in> cbox 0 1}" |
5864 |
by (auto simp: cbox_def) |
|
5865 |
also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` cbox 0 1)" |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5866 |
by (simp only: box_eq_set_setsum_Basis) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5867 |
also have "\<dots> = (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` (convex hull {0, 1}))" |
56188 | 5868 |
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:
53600
diff
changeset
|
5869 |
also have "\<dots> = (\<Sum>i\<in>Basis. convex hull ((\<lambda>x. x *\<^sub>R i) ` {0, 1}))" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5870 |
by (simp only: convex_hull_linear_image linear_scaleR_left) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5871 |
also have "\<dots> = convex hull (\<Sum>i\<in>Basis. (\<lambda>x. x *\<^sub>R i) ` {0, 1})" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5872 |
by (simp only: convex_hull_set_setsum) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5873 |
also have "\<dots> = convex hull {x. \<forall>i\<in>Basis. x\<bullet>i \<in> {0, 1}}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5874 |
by (simp only: box_eq_set_setsum_Basis) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5875 |
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:
53600
diff
changeset
|
5876 |
by simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
5877 |
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:
50104
diff
changeset
|
5878 |
qed |
33175 | 5879 |
|
44467 | 5880 |
text {* And this is a finite set of vertices. *} |
33175 | 5881 |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5882 |
lemma unit_cube_convex_hull: |
56188 | 5883 |
obtains s :: "'a::euclidean_space set" |
5884 |
where "finite s" and "cbox 0 (\<Sum>Basis) = convex hull s" |
|
53348 | 5885 |
apply (rule that[of "{x::'a. \<forall>i\<in>Basis. x\<bullet>i=0 \<or> x\<bullet>i=1}"]) |
5886 |
apply (rule finite_subset[of _ "(\<lambda>s. (\<Sum>i\<in>Basis. (if i\<in>s then 1 else 0) *\<^sub>R i)::'a) ` Pow Basis"]) |
|
5887 |
prefer 3 |
|
5888 |
apply (rule unit_interval_convex_hull) |
|
5889 |
apply rule |
|
5890 |
unfolding mem_Collect_eq |
|
5891 |
proof - |
|
5892 |
fix x :: 'a |
|
5893 |
assume as: "\<forall>i\<in>Basis. x \<bullet> i = 0 \<or> x \<bullet> i = 1" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5894 |
show "x \<in> (\<lambda>s. \<Sum>i\<in>Basis. (if i\<in>s then 1 else 0) *\<^sub>R i) ` Pow Basis" |
53348 | 5895 |
apply (rule image_eqI[where x="{i. i\<in>Basis \<and> x\<bullet>i = 1}"]) |
5896 |
using as |
|
5897 |
apply (subst euclidean_eq_iff) |
|
5898 |
apply (auto simp: inner_setsum_left_Basis) |
|
5899 |
done |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5900 |
qed auto |
33175 | 5901 |
|
44467 | 5902 |
text {* Hence any cube (could do any nonempty interval). *} |
33175 | 5903 |
|
5904 |
lemma cube_convex_hull: |
|
53348 | 5905 |
assumes "d > 0" |
56188 | 5906 |
obtains s :: "'a::euclidean_space set" where |
5907 |
"finite s" and "cbox (x - (\<Sum>i\<in>Basis. d*\<^sub>Ri)) (x + (\<Sum>i\<in>Basis. d*\<^sub>Ri)) = convex hull s" |
|
53348 | 5908 |
proof - |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5909 |
let ?d = "(\<Sum>i\<in>Basis. d*\<^sub>Ri)::'a" |
56188 | 5910 |
have *: "cbox (x - ?d) (x + ?d) = (\<lambda>y. x - ?d + (2 * d) *\<^sub>R y) ` cbox 0 (\<Sum>Basis)" |
53348 | 5911 |
apply (rule set_eqI, rule) |
5912 |
unfolding image_iff |
|
5913 |
defer |
|
5914 |
apply (erule bexE) |
|
5915 |
proof - |
|
5916 |
fix y |
|
56188 | 5917 |
assume as: "y\<in>cbox (x - ?d) (x + ?d)" |
53348 | 5918 |
{ |
5919 |
fix i :: 'a |
|
5920 |
assume i: "i \<in> Basis" |
|
5921 |
have "x \<bullet> i \<le> d + y \<bullet> i" "y \<bullet> i \<le> d + x \<bullet> i" |
|
56188 | 5922 |
using as[unfolded mem_box, THEN bspec[where x=i]] i |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5923 |
by (auto simp: inner_simps) |
53348 | 5924 |
then have "1 \<ge> inverse d * (x \<bullet> i - y \<bullet> i)" "1 \<ge> inverse d * (y \<bullet> i - x \<bullet> i)" |
5925 |
apply (rule_tac[!] mult_left_le_imp_le[OF _ assms]) |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57447
diff
changeset
|
5926 |
unfolding mult.assoc[symmetric] |
53348 | 5927 |
using assms |
5928 |
by (auto simp add: field_simps) |
|
5929 |
then have "inverse d * (x \<bullet> i * 2) \<le> 2 + inverse d * (y \<bullet> i * 2)" |
|
5930 |
"inverse d * (y \<bullet> i * 2) \<le> 2 + inverse d * (x \<bullet> i * 2)" |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
5931 |
using `0<d` by (auto simp add: field_simps) } |
56188 | 5932 |
then have "inverse (2 * d) *\<^sub>R (y - (x - ?d)) \<in> cbox 0 (\<Sum>Basis)" |
5933 |
unfolding mem_box using assms |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
5934 |
by (auto simp add: field_simps inner_simps simp del: inverse_eq_divide) |
56188 | 5935 |
then show "\<exists>z\<in>cbox 0 (\<Sum>Basis). y = x - ?d + (2 * d) *\<^sub>R z" |
53348 | 5936 |
apply - |
5937 |
apply (rule_tac x="inverse (2 * d) *\<^sub>R (y - (x - ?d))" in bexI) |
|
5938 |
using assms |
|
5939 |
apply auto |
|
5940 |
done |
|
33175 | 5941 |
next |
53348 | 5942 |
fix y z |
56188 | 5943 |
assume as: "z\<in>cbox 0 (\<Sum>Basis)" "y = x - ?d + (2*d) *\<^sub>R z" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
5944 |
have "\<And>i. i\<in>Basis \<Longrightarrow> 0 \<le> d * (z \<bullet> i) \<and> d * (z \<bullet> i) \<le> d" |
56188 | 5945 |
using assms as(1)[unfolded mem_box] |
53348 | 5946 |
apply (erule_tac x=i in ballE) |
5947 |
apply rule |
|
56536 | 5948 |
prefer 2 |
53348 | 5949 |
apply (rule mult_right_le_one_le) |
5950 |
using assms |
|
5951 |
apply auto |
|
5952 |
done |
|
56188 | 5953 |
then show "y \<in> cbox (x - ?d) (x + ?d)" |
5954 |
unfolding as(2) mem_box |
|
53348 | 5955 |
apply - |
5956 |
apply rule |
|
56188 | 5957 |
using as(1)[unfolded mem_box] |
53348 | 5958 |
apply (erule_tac x=i in ballE) |
5959 |
using assms |
|
5960 |
apply (auto simp: inner_simps) |
|
5961 |
done |
|
5962 |
qed |
|
56188 | 5963 |
obtain s where "finite s" "cbox 0 (\<Sum>Basis::'a) = convex hull s" |
53348 | 5964 |
using unit_cube_convex_hull by auto |
5965 |
then show ?thesis |
|
5966 |
apply (rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` s"]) |
|
5967 |
unfolding * and convex_hull_affinity |
|
5968 |
apply auto |
|
5969 |
done |
|
5970 |
qed |
|
5971 |
||
33175 | 5972 |
|
44467 | 5973 |
subsection {* Bounded convex function on open set is continuous *} |
33175 | 5974 |
|
5975 |
lemma convex_on_bounded_continuous: |
|
36338 | 5976 |
fixes s :: "('a::real_normed_vector) set" |
53348 | 5977 |
assumes "open s" |
5978 |
and "convex_on s f" |
|
5979 |
and "\<forall>x\<in>s. abs(f x) \<le> b" |
|
33175 | 5980 |
shows "continuous_on s f" |
53348 | 5981 |
apply (rule continuous_at_imp_continuous_on) |
5982 |
unfolding continuous_at_real_range |
|
5983 |
proof (rule,rule,rule) |
|
5984 |
fix x and e :: real |
|
5985 |
assume "x \<in> s" "e > 0" |
|
33175 | 5986 |
def B \<equiv> "abs b + 1" |
53348 | 5987 |
have B: "0 < B" "\<And>x. x\<in>s \<Longrightarrow> abs (f x) \<le> B" |
5988 |
unfolding B_def |
|
5989 |
defer |
|
5990 |
apply (drule assms(3)[rule_format]) |
|
5991 |
apply auto |
|
5992 |
done |
|
5993 |
obtain k where "k > 0" and k: "cball x k \<subseteq> s" |
|
5994 |
using assms(1)[unfolded open_contains_cball, THEN bspec[where x=x]] |
|
5995 |
using `x\<in>s` by auto |
|
33175 | 5996 |
show "\<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e" |
53348 | 5997 |
apply (rule_tac x="min (k / 2) (e / (2 * B) * k)" in exI) |
5998 |
apply rule |
|
5999 |
defer |
|
6000 |
proof (rule, rule) |
|
6001 |
fix y |
|
6002 |
assume as: "norm (y - x) < min (k / 2) (e / (2 * B) * k)" |
|
6003 |
show "\<bar>f y - f x\<bar> < e" |
|
6004 |
proof (cases "y = x") |
|
6005 |
case False |
|
6006 |
def t \<equiv> "k / norm (y - x)" |
|
6007 |
have "2 < t" "0<t" |
|
6008 |
unfolding t_def using as False and `k>0` |
|
6009 |
by (auto simp add:field_simps) |
|
6010 |
have "y \<in> s" |
|
6011 |
apply (rule k[unfolded subset_eq,rule_format]) |
|
6012 |
unfolding mem_cball dist_norm |
|
6013 |
apply (rule order_trans[of _ "2 * norm (x - y)"]) |
|
6014 |
using as |
|
6015 |
by (auto simp add: field_simps norm_minus_commute) |
|
6016 |
{ |
|
6017 |
def w \<equiv> "x + t *\<^sub>R (y - x)" |
|
6018 |
have "w \<in> s" |
|
6019 |
unfolding w_def |
|
6020 |
apply (rule k[unfolded subset_eq,rule_format]) |
|
6021 |
unfolding mem_cball dist_norm |
|
6022 |
unfolding t_def |
|
6023 |
using `k>0` |
|
6024 |
apply auto |
|
6025 |
done |
|
6026 |
have "(1 / t) *\<^sub>R x + - x + ((t - 1) / t) *\<^sub>R x = (1 / t - 1 + (t - 1) / t) *\<^sub>R x" |
|
6027 |
by (auto simp add: algebra_simps) |
|
6028 |
also have "\<dots> = 0" |
|
6029 |
using `t > 0` by (auto simp add:field_simps) |
|
6030 |
finally have w: "(1 / t) *\<^sub>R w + ((t - 1) / t) *\<^sub>R x = y" |
|
6031 |
unfolding w_def using False and `t > 0` |
|
6032 |
by (auto simp add: algebra_simps) |
|
6033 |
have "2 * B < e * t" |
|
6034 |
unfolding t_def using `0 < e` `0 < k` `B > 0` and as and False |
|
6035 |
by (auto simp add:field_simps) |
|
6036 |
then have "(f w - f x) / t < e" |
|
6037 |
using B(2)[OF `w\<in>s`] and B(2)[OF `x\<in>s`] |
|
6038 |
using `t > 0` by (auto simp add:field_simps) |
|
6039 |
then have th1: "f y - f x < e" |
|
6040 |
apply - |
|
6041 |
apply (rule le_less_trans) |
|
6042 |
defer |
|
6043 |
apply assumption |
|
33175 | 6044 |
using assms(2)[unfolded convex_on_def,rule_format,of w x "1/t" "(t - 1)/t", unfolded w] |
53348 | 6045 |
using `0 < t` `2 < t` and `x \<in> s` `w \<in> s` |
6046 |
by (auto simp add:field_simps) |
|
6047 |
} |
|
49531 | 6048 |
moreover |
53348 | 6049 |
{ |
6050 |
def w \<equiv> "x - t *\<^sub>R (y - x)" |
|
6051 |
have "w \<in> s" |
|
6052 |
unfolding w_def |
|
6053 |
apply (rule k[unfolded subset_eq,rule_format]) |
|
6054 |
unfolding mem_cball dist_norm |
|
6055 |
unfolding t_def |
|
6056 |
using `k > 0` |
|
6057 |
apply auto |
|
6058 |
done |
|
6059 |
have "(1 / (1 + t)) *\<^sub>R x + (t / (1 + t)) *\<^sub>R x = (1 / (1 + t) + t / (1 + t)) *\<^sub>R x" |
|
6060 |
by (auto simp add: algebra_simps) |
|
6061 |
also have "\<dots> = x" |
|
6062 |
using `t > 0` by (auto simp add:field_simps) |
|
6063 |
finally have w: "(1 / (1+t)) *\<^sub>R w + (t / (1 + t)) *\<^sub>R y = x" |
|
6064 |
unfolding w_def using False and `t > 0` |
|
6065 |
by (auto simp add: algebra_simps) |
|
6066 |
have "2 * B < e * t" |
|
6067 |
unfolding t_def |
|
6068 |
using `0 < e` `0 < k` `B > 0` and as and False |
|
6069 |
by (auto simp add:field_simps) |
|
6070 |
then have *: "(f w - f y) / t < e" |
|
6071 |
using B(2)[OF `w\<in>s`] and B(2)[OF `y\<in>s`] |
|
6072 |
using `t > 0` |
|
6073 |
by (auto simp add:field_simps) |
|
49531 | 6074 |
have "f x \<le> 1 / (1 + t) * f w + (t / (1 + t)) * f y" |
33175 | 6075 |
using assms(2)[unfolded convex_on_def,rule_format,of w y "1/(1+t)" "t / (1+t)",unfolded w] |
53348 | 6076 |
using `0 < t` `2 < t` and `y \<in> s` `w \<in> s` |
6077 |
by (auto simp add:field_simps) |
|
6078 |
also have "\<dots> = (f w + t * f y) / (1 + t)" |
|
6079 |
using `t > 0` unfolding divide_inverse by (auto simp add: field_simps) |
|
6080 |
also have "\<dots> < e + f y" |
|
6081 |
using `t > 0` * `e > 0` by (auto simp add: field_simps) |
|
6082 |
finally have "f x - f y < e" by auto |
|
6083 |
} |
|
49531 | 6084 |
ultimately show ?thesis by auto |
53348 | 6085 |
qed (insert `0<e`, auto) |
56544 | 6086 |
qed (insert `0<e` `0<k` `0<B`, auto simp: field_simps) |
53348 | 6087 |
qed |
6088 |
||
33175 | 6089 |
|
44467 | 6090 |
subsection {* Upper bound on a ball implies upper and lower bounds *} |
33175 | 6091 |
|
6092 |
lemma convex_bounds_lemma: |
|
36338 | 6093 |
fixes x :: "'a::real_normed_vector" |
53348 | 6094 |
assumes "convex_on (cball x e) f" |
6095 |
and "\<forall>y \<in> cball x e. f y \<le> b" |
|
6096 |
shows "\<forall>y \<in> cball x e. abs (f y) \<le> b + 2 * abs (f x)" |
|
6097 |
apply rule |
|
6098 |
proof (cases "0 \<le> e") |
|
6099 |
case True |
|
6100 |
fix y |
|
6101 |
assume y: "y \<in> cball x e" |
|
6102 |
def z \<equiv> "2 *\<^sub>R x - y" |
|
6103 |
have *: "x - (2 *\<^sub>R x - y) = y - x" |
|
6104 |
by (simp add: scaleR_2) |
|
6105 |
have z: "z \<in> cball x e" |
|
6106 |
using y unfolding z_def mem_cball dist_norm * by (auto simp add: norm_minus_commute) |
|
6107 |
have "(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x" |
|
6108 |
unfolding z_def by (auto simp add: algebra_simps) |
|
6109 |
then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" |
|
6110 |
using assms(1)[unfolded convex_on_def,rule_format, OF y z, of "1/2" "1/2"] |
|
6111 |
using assms(2)[rule_format,OF y] assms(2)[rule_format,OF z] |
|
6112 |
by (auto simp add:field_simps) |
|
6113 |
next |
|
6114 |
case False |
|
6115 |
fix y |
|
6116 |
assume "y \<in> cball x e" |
|
6117 |
then have "dist x y < 0" |
|
6118 |
using False unfolding mem_cball not_le by (auto simp del: dist_not_less_zero) |
|
6119 |
then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" |
|
6120 |
using zero_le_dist[of x y] by auto |
|
6121 |
qed |
|
6122 |
||
33175 | 6123 |
|
44467 | 6124 |
subsubsection {* Hence a convex function on an open set is continuous *} |
33175 | 6125 |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6126 |
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:
50104
diff
changeset
|
6127 |
by auto |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6128 |
|
33175 | 6129 |
lemma convex_on_continuous: |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6130 |
assumes "open (s::('a::euclidean_space) set)" "convex_on s f" |
33175 | 6131 |
shows "continuous_on s f" |
53348 | 6132 |
unfolding continuous_on_eq_continuous_at[OF assms(1)] |
6133 |
proof |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
6134 |
note dimge1 = DIM_positive[where 'a='a] |
53348 | 6135 |
fix x |
6136 |
assume "x \<in> s" |
|
6137 |
then obtain e where e: "cball x e \<subseteq> s" "e > 0" |
|
6138 |
using assms(1) unfolding open_contains_cball by auto |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
6139 |
def d \<equiv> "e / real DIM('a)" |
53348 | 6140 |
have "0 < d" |
56541 | 6141 |
unfolding d_def using `e > 0` 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:
50104
diff
changeset
|
6142 |
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:
53600
diff
changeset
|
6143 |
obtain c |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6144 |
where c: "finite c" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6145 |
and c1: "convex hull c \<subseteq> cball x e" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6146 |
and c2: "cball x d \<subseteq> convex hull c" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6147 |
proof |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6148 |
def c \<equiv> "\<Sum>i\<in>Basis. (\<lambda>a. a *\<^sub>R i) ` {x\<bullet>i - d, x\<bullet>i + d}" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6149 |
show "finite c" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6150 |
unfolding c_def by (simp add: finite_set_setsum) |
56188 | 6151 |
have 1: "convex hull c = {a. \<forall>i\<in>Basis. a \<bullet> i \<in> cbox (x \<bullet> i - d) (x \<bullet> i + d)}" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6152 |
unfolding box_eq_set_setsum_Basis |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6153 |
unfolding c_def convex_hull_set_setsum |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6154 |
apply (subst convex_hull_linear_image [symmetric]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6155 |
apply (simp add: linear_iff scaleR_add_left) |
57418 | 6156 |
apply (rule setsum.cong [OF refl]) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6157 |
apply (rule image_cong [OF _ refl]) |
56188 | 6158 |
apply (rule convex_hull_eq_real_cbox) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6159 |
apply (cut_tac `0 < d`, simp) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6160 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6161 |
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:
53600
diff
changeset
|
6162 |
by (simp add: dist_norm abs_le_iff algebra_simps) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6163 |
show "cball x d \<subseteq> convex hull c" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6164 |
unfolding 2 |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6165 |
apply clarsimp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6166 |
apply (simp only: dist_norm) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6167 |
apply (subst inner_diff_left [symmetric]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6168 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6169 |
apply (erule (1) order_trans [OF Basis_le_norm]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6170 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6171 |
have e': "e = (\<Sum>(i::'a)\<in>Basis. d)" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6172 |
by (simp add: d_def real_of_nat_def DIM_positive) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6173 |
show "convex hull c \<subseteq> cball x e" |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6174 |
unfolding 2 |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6175 |
apply clarsimp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6176 |
apply (subst euclidean_dist_l2) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6177 |
apply (rule order_trans [OF setL2_le_setsum]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6178 |
apply (rule zero_le_dist) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6179 |
unfolding e' |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6180 |
apply (rule setsum_mono) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6181 |
apply simp |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6182 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6183 |
qed |
33175 | 6184 |
def k \<equiv> "Max (f ` c)" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6185 |
have "convex_on (convex hull c) f" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6186 |
apply(rule convex_on_subset[OF assms(2)]) |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6187 |
apply(rule subset_trans[OF _ e(1)]) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6188 |
apply(rule c1) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6189 |
done |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6190 |
then have k: "\<forall>y\<in>convex hull c. f y \<le> k" |
53348 | 6191 |
apply (rule_tac convex_on_convex_hull_bound) |
6192 |
apply assumption |
|
6193 |
unfolding k_def |
|
6194 |
apply (rule, rule Max_ge) |
|
6195 |
using c(1) |
|
6196 |
apply auto |
|
6197 |
done |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6198 |
have "d \<le> e" |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6199 |
unfolding d_def |
53348 | 6200 |
apply (rule mult_imp_div_pos_le) |
6201 |
using `e > 0` |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6202 |
unfolding mult_le_cancel_left1 |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6203 |
apply (auto simp: real_of_nat_ge_one_iff Suc_le_eq DIM_positive) |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6204 |
done |
53348 | 6205 |
then have dsube: "cball x d \<subseteq> cball x e" |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6206 |
by (rule subset_cball) |
53348 | 6207 |
have conv: "convex_on (cball x d) f" |
6208 |
apply (rule convex_on_subset) |
|
6209 |
apply (rule convex_on_subset[OF assms(2)]) |
|
6210 |
apply (rule e(1)) |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6211 |
apply (rule dsube) |
53348 | 6212 |
done |
6213 |
then have "\<forall>y\<in>cball x d. abs (f y) \<le> k + 2 * abs (f x)" |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6214 |
apply (rule convex_bounds_lemma) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6215 |
apply (rule ballI) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6216 |
apply (rule k [rule_format]) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6217 |
apply (erule rev_subsetD) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6218 |
apply (rule c2) |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
6219 |
done |
53348 | 6220 |
then have "continuous_on (ball x d) f" |
6221 |
apply (rule_tac convex_on_bounded_continuous) |
|
6222 |
apply (rule open_ball, rule convex_on_subset[OF conv]) |
|
6223 |
apply (rule ball_subset_cball) |
|
33270 | 6224 |
apply force |
6225 |
done |
|
53348 | 6226 |
then show "continuous (at x) f" |
6227 |
unfolding continuous_on_eq_continuous_at[OF open_ball] |
|
6228 |
using `d > 0` by auto |
|
6229 |
qed |
|
6230 |
||
33270 | 6231 |
|
44467 | 6232 |
subsection {* Line segments, Starlike Sets, etc. *} |
33270 | 6233 |
|
49531 | 6234 |
(* Use the same overloading tricks as for intervals, so that |
33270 | 6235 |
segment[a,b] is closed and segment(a,b) is open relative to affine hull. *) |
33175 | 6236 |
|
53348 | 6237 |
definition midpoint :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a" |
6238 |
where "midpoint a b = (inverse (2::real)) *\<^sub>R (a + b)" |
|
6239 |
||
6240 |
definition open_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" |
|
6241 |
where "open_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 < u \<and> u < 1}" |
|
6242 |
||
6243 |
definition closed_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" |
|
6244 |
where "closed_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 \<le> u \<and> u \<le> 1}" |
|
6245 |
||
6246 |
definition "between = (\<lambda>(a,b) x. x \<in> closed_segment a b)" |
|
33175 | 6247 |
|
6248 |
lemmas segment = open_segment_def closed_segment_def |
|
6249 |
||
56369
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents:
56196
diff
changeset
|
6250 |
lemma open_closed_segment: "u \<in> open_segment w z \<Longrightarrow> u \<in> closed_segment w z" |
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents:
56196
diff
changeset
|
6251 |
by (auto simp add: closed_segment_def open_segment_def) |
2704ca85be98
moved generic theorems from Complex_Analysis_Basic; fixed some theorem names
hoelzl
parents:
56196
diff
changeset
|
6252 |
|
33175 | 6253 |
definition "starlike s \<longleftrightarrow> (\<exists>a\<in>s. \<forall>x\<in>s. closed_segment a x \<subseteq> s)" |
6254 |
||
6255 |
lemma midpoint_refl: "midpoint x x = x" |
|
53348 | 6256 |
unfolding midpoint_def |
6257 |
unfolding scaleR_right_distrib |
|
6258 |
unfolding scaleR_left_distrib[symmetric] |
|
6259 |
by auto |
|
6260 |
||
6261 |
lemma midpoint_sym: "midpoint a b = midpoint b a" |
|
6262 |
unfolding midpoint_def by (auto simp add: scaleR_right_distrib) |
|
33175 | 6263 |
|
36338 | 6264 |
lemma midpoint_eq_iff: "midpoint a b = c \<longleftrightarrow> a + b = c + c" |
6265 |
proof - |
|
6266 |
have "midpoint a b = c \<longleftrightarrow> scaleR 2 (midpoint a b) = scaleR 2 c" |
|
6267 |
by simp |
|
53348 | 6268 |
then show ?thesis |
36338 | 6269 |
unfolding midpoint_def scaleR_2 [symmetric] by simp |
6270 |
qed |
|
6271 |
||
33175 | 6272 |
lemma dist_midpoint: |
36338 | 6273 |
fixes a b :: "'a::real_normed_vector" shows |
33175 | 6274 |
"dist a (midpoint a b) = (dist a b) / 2" (is ?t1) |
6275 |
"dist b (midpoint a b) = (dist a b) / 2" (is ?t2) |
|
6276 |
"dist (midpoint a b) a = (dist a b) / 2" (is ?t3) |
|
6277 |
"dist (midpoint a b) b = (dist a b) / 2" (is ?t4) |
|
53348 | 6278 |
proof - |
6279 |
have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2" |
|
6280 |
unfolding equation_minus_iff by auto |
|
6281 |
have **: "\<And>x y::'a. 2 *\<^sub>R x = y \<Longrightarrow> norm x = (norm y) / 2" |
|
6282 |
by auto |
|
33175 | 6283 |
note scaleR_right_distrib [simp] |
53348 | 6284 |
show ?t1 |
6285 |
unfolding midpoint_def dist_norm |
|
6286 |
apply (rule **) |
|
6287 |
apply (simp add: scaleR_right_diff_distrib) |
|
6288 |
apply (simp add: scaleR_2) |
|
6289 |
done |
|
6290 |
show ?t2 |
|
6291 |
unfolding midpoint_def dist_norm |
|
6292 |
apply (rule *) |
|
6293 |
apply (simp add: scaleR_right_diff_distrib) |
|
6294 |
apply (simp add: scaleR_2) |
|
6295 |
done |
|
6296 |
show ?t3 |
|
6297 |
unfolding midpoint_def dist_norm |
|
6298 |
apply (rule *) |
|
6299 |
apply (simp add: scaleR_right_diff_distrib) |
|
6300 |
apply (simp add: scaleR_2) |
|
6301 |
done |
|
6302 |
show ?t4 |
|
6303 |
unfolding midpoint_def dist_norm |
|
6304 |
apply (rule **) |
|
6305 |
apply (simp add: scaleR_right_diff_distrib) |
|
6306 |
apply (simp add: scaleR_2) |
|
6307 |
done |
|
36338 | 6308 |
qed |
33175 | 6309 |
|
6310 |
lemma midpoint_eq_endpoint: |
|
36338 | 6311 |
"midpoint a b = a \<longleftrightarrow> a = b" |
33175 | 6312 |
"midpoint a b = b \<longleftrightarrow> a = b" |
36338 | 6313 |
unfolding midpoint_eq_iff by auto |
33175 | 6314 |
|
6315 |
lemma convex_contains_segment: |
|
6316 |
"convex s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. closed_segment a b \<subseteq> s)" |
|
6317 |
unfolding convex_alt closed_segment_def by auto |
|
6318 |
||
6319 |
lemma convex_imp_starlike: |
|
6320 |
"convex s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> starlike s" |
|
6321 |
unfolding convex_contains_segment starlike_def by auto |
|
6322 |
||
6323 |
lemma segment_convex_hull: |
|
53348 | 6324 |
"closed_segment a b = convex hull {a,b}" |
6325 |
proof - |
|
6326 |
have *: "\<And>x. {x} \<noteq> {}" by auto |
|
6327 |
have **: "\<And>u v. u + v = 1 \<longleftrightarrow> u = 1 - (v::real)" by auto |
|
6328 |
show ?thesis |
|
6329 |
unfolding segment convex_hull_insert[OF *] convex_hull_singleton |
|
6330 |
apply (rule set_eqI) |
|
6331 |
unfolding mem_Collect_eq |
|
6332 |
apply (rule, erule exE) |
|
6333 |
apply (rule_tac x="1 - u" in exI) |
|
6334 |
apply rule |
|
6335 |
defer |
|
6336 |
apply (rule_tac x=u in exI) |
|
6337 |
defer |
|
6338 |
apply (elim exE conjE) |
|
6339 |
apply (rule_tac x="1 - u" in exI) |
|
6340 |
unfolding ** |
|
6341 |
apply auto |
|
6342 |
done |
|
6343 |
qed |
|
33175 | 6344 |
|
6345 |
lemma convex_segment: "convex (closed_segment a b)" |
|
6346 |
unfolding segment_convex_hull by(rule convex_convex_hull) |
|
6347 |
||
6348 |
lemma ends_in_segment: "a \<in> closed_segment a b" "b \<in> closed_segment a b" |
|
53348 | 6349 |
unfolding segment_convex_hull |
6350 |
apply (rule_tac[!] hull_subset[unfolded subset_eq, rule_format]) |
|
6351 |
apply auto |
|
6352 |
done |
|
33175 | 6353 |
|
6354 |
lemma segment_furthest_le: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
6355 |
fixes a b x y :: "'a::euclidean_space" |
53348 | 6356 |
assumes "x \<in> closed_segment a b" |
6357 |
shows "norm (y - x) \<le> norm (y - a) \<or> norm (y - x) \<le> norm (y - b)" |
|
6358 |
proof - |
|
6359 |
obtain z where "z \<in> {a, b}" "norm (x - y) \<le> norm (z - y)" |
|
6360 |
using simplex_furthest_le[of "{a, b}" y] |
|
6361 |
using assms[unfolded segment_convex_hull] |
|
6362 |
by auto |
|
6363 |
then show ?thesis |
|
6364 |
by (auto simp add:norm_minus_commute) |
|
6365 |
qed |
|
33175 | 6366 |
|
6367 |
lemma segment_bound: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
6368 |
fixes x a b :: "'a::euclidean_space" |
33175 | 6369 |
assumes "x \<in> closed_segment a b" |
53348 | 6370 |
shows "norm (x - a) \<le> norm (b - a)" "norm (x - b) \<le> norm (b - a)" |
33175 | 6371 |
using segment_furthest_le[OF assms, of a] |
6372 |
using segment_furthest_le[OF assms, of b] |
|
49531 | 6373 |
by (auto simp add:norm_minus_commute) |
33175 | 6374 |
|
53348 | 6375 |
lemma segment_refl: "closed_segment a a = {a}" |
6376 |
unfolding segment by (auto simp add: algebra_simps) |
|
33175 | 6377 |
|
6378 |
lemma between_mem_segment: "between (a,b) x \<longleftrightarrow> x \<in> closed_segment a b" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
6379 |
unfolding between_def by auto |
33175 | 6380 |
|
53348 | 6381 |
lemma between: "between (a, b) (x::'a::euclidean_space) \<longleftrightarrow> dist a b = (dist a x) + (dist x b)" |
6382 |
proof (cases "a = b") |
|
6383 |
case True |
|
6384 |
then show ?thesis |
|
6385 |
unfolding between_def split_conv |
|
6386 |
by (auto simp add:segment_refl dist_commute) |
|
6387 |
next |
|
6388 |
case False |
|
6389 |
then have Fal: "norm (a - b) \<noteq> 0" and Fal2: "norm (a - b) > 0" |
|
6390 |
by auto |
|
6391 |
have *: "\<And>u. a - ((1 - u) *\<^sub>R a + u *\<^sub>R b) = u *\<^sub>R (a - b)" |
|
6392 |
by (auto simp add: algebra_simps) |
|
6393 |
show ?thesis |
|
6394 |
unfolding between_def split_conv closed_segment_def mem_Collect_eq |
|
6395 |
apply rule |
|
6396 |
apply (elim exE conjE) |
|
6397 |
apply (subst dist_triangle_eq) |
|
6398 |
proof - |
|
6399 |
fix u |
|
6400 |
assume as: "x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1" |
|
6401 |
then have *: "a - x = u *\<^sub>R (a - b)" "x - b = (1 - u) *\<^sub>R (a - b)" |
|
6402 |
unfolding as(1) by (auto simp add:algebra_simps) |
|
6403 |
show "norm (a - x) *\<^sub>R (x - b) = norm (x - b) *\<^sub>R (a - x)" |
|
6404 |
unfolding norm_minus_commute[of x a] * using as(2,3) |
|
6405 |
by (auto simp add: field_simps) |
|
6406 |
next |
|
6407 |
assume as: "dist a b = dist a x + dist x b" |
|
6408 |
have "norm (a - x) / norm (a - b) \<le> 1" |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
6409 |
using Fal2 unfolding as[unfolded dist_norm] norm_ge_zero by auto |
53348 | 6410 |
then show "\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1" |
6411 |
apply (rule_tac x="dist a x / dist a b" in exI) |
|
6412 |
unfolding dist_norm |
|
6413 |
apply (subst euclidean_eq_iff) |
|
6414 |
apply rule |
|
6415 |
defer |
|
6416 |
apply rule |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56544
diff
changeset
|
6417 |
prefer 3 |
53348 | 6418 |
apply rule |
6419 |
proof - |
|
6420 |
fix i :: 'a |
|
6421 |
assume i: "i \<in> Basis" |
|
6422 |
have "((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i = |
|
6423 |
((norm (a - b) - norm (a - x)) * (a \<bullet> i) + norm (a - x) * (b \<bullet> i)) / norm (a - b)" |
|
6424 |
using Fal by (auto simp add: field_simps inner_simps) |
|
6425 |
also have "\<dots> = x\<bullet>i" |
|
6426 |
apply (rule divide_eq_imp[OF Fal]) |
|
6427 |
unfolding as[unfolded dist_norm] |
|
6428 |
using as[unfolded dist_triangle_eq] |
|
6429 |
apply - |
|
6430 |
apply (subst (asm) euclidean_eq_iff) |
|
6431 |
using i |
|
6432 |
apply (erule_tac x=i in ballE) |
|
6433 |
apply (auto simp add:field_simps inner_simps) |
|
6434 |
done |
|
6435 |
finally show "x \<bullet> i = |
|
6436 |
((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) \<bullet> i" |
|
6437 |
by auto |
|
6438 |
qed (insert Fal2, auto) |
|
6439 |
qed |
|
6440 |
qed |
|
6441 |
||
6442 |
lemma between_midpoint: |
|
6443 |
fixes a :: "'a::euclidean_space" |
|
6444 |
shows "between (a,b) (midpoint a b)" (is ?t1) |
|
6445 |
and "between (b,a) (midpoint a b)" (is ?t2) |
|
6446 |
proof - |
|
6447 |
have *: "\<And>x y z. x = (1/2::real) *\<^sub>R z \<Longrightarrow> y = (1/2) *\<^sub>R z \<Longrightarrow> norm z = norm x + norm y" |
|
6448 |
by auto |
|
6449 |
show ?t1 ?t2 |
|
6450 |
unfolding between midpoint_def dist_norm |
|
6451 |
apply(rule_tac[!] *) |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6452 |
unfolding euclidean_eq_iff[where 'a='a] |
53348 | 6453 |
apply (auto simp add: field_simps inner_simps) |
6454 |
done |
|
6455 |
qed |
|
33175 | 6456 |
|
6457 |
lemma between_mem_convex_hull: |
|
6458 |
"between (a,b) x \<longleftrightarrow> x \<in> convex hull {a,b}" |
|
6459 |
unfolding between_mem_segment segment_convex_hull .. |
|
6460 |
||
53348 | 6461 |
|
44467 | 6462 |
subsection {* Shrinking towards the interior of a convex set *} |
33175 | 6463 |
|
6464 |
lemma mem_interior_convex_shrink: |
|
53348 | 6465 |
fixes s :: "'a::euclidean_space set" |
6466 |
assumes "convex s" |
|
6467 |
and "c \<in> interior s" |
|
6468 |
and "x \<in> s" |
|
6469 |
and "0 < e" |
|
6470 |
and "e \<le> 1" |
|
33175 | 6471 |
shows "x - e *\<^sub>R (x - c) \<in> interior s" |
53348 | 6472 |
proof - |
6473 |
obtain d where "d > 0" and d: "ball c d \<subseteq> s" |
|
6474 |
using assms(2) unfolding mem_interior by auto |
|
6475 |
show ?thesis |
|
6476 |
unfolding mem_interior |
|
6477 |
apply (rule_tac x="e*d" in exI) |
|
6478 |
apply rule |
|
6479 |
defer |
|
6480 |
unfolding subset_eq Ball_def mem_ball |
|
6481 |
proof (rule, rule) |
|
6482 |
fix y |
|
6483 |
assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d" |
|
6484 |
have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x" |
|
6485 |
using `e > 0` by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib) |
|
33175 | 6486 |
have "dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = abs(1/e) * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)" |
53348 | 6487 |
unfolding dist_norm |
6488 |
unfolding norm_scaleR[symmetric] |
|
6489 |
apply (rule arg_cong[where f=norm]) |
|
6490 |
using `e > 0` |
|
6491 |
by (auto simp add: euclidean_eq_iff[where 'a='a] field_simps inner_simps) |
|
6492 |
also have "\<dots> = abs (1/e) * norm (x - e *\<^sub>R (x - c) - y)" |
|
6493 |
by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps) |
|
6494 |
also have "\<dots> < d" |
|
6495 |
using as[unfolded dist_norm] and `e > 0` |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
57447
diff
changeset
|
6496 |
by (auto simp add:pos_divide_less_eq[OF `e > 0`] mult.commute) |
53348 | 6497 |
finally show "y \<in> s" |
6498 |
apply (subst *) |
|
6499 |
apply (rule assms(1)[unfolded convex_alt,rule_format]) |
|
6500 |
apply (rule d[unfolded subset_eq,rule_format]) |
|
6501 |
unfolding mem_ball |
|
6502 |
using assms(3-5) |
|
6503 |
apply auto |
|
6504 |
done |
|
56544 | 6505 |
qed (insert `e>0` `d>0`, auto) |
53348 | 6506 |
qed |
33175 | 6507 |
|
6508 |
lemma mem_interior_closure_convex_shrink: |
|
53348 | 6509 |
fixes s :: "'a::euclidean_space set" |
6510 |
assumes "convex s" |
|
6511 |
and "c \<in> interior s" |
|
6512 |
and "x \<in> closure s" |
|
6513 |
and "0 < e" |
|
6514 |
and "e \<le> 1" |
|
33175 | 6515 |
shows "x - e *\<^sub>R (x - c) \<in> interior s" |
53348 | 6516 |
proof - |
6517 |
obtain d where "d > 0" and d: "ball c d \<subseteq> s" |
|
6518 |
using assms(2) unfolding mem_interior by auto |
|
6519 |
have "\<exists>y\<in>s. norm (y - x) * (1 - e) < e * d" |
|
6520 |
proof (cases "x \<in> s") |
|
6521 |
case True |
|
6522 |
then show ?thesis |
|
6523 |
using `e > 0` `d > 0` |
|
6524 |
apply (rule_tac bexI[where x=x]) |
|
56544 | 6525 |
apply (auto) |
53348 | 6526 |
done |
6527 |
next |
|
6528 |
case False |
|
6529 |
then have x: "x islimpt s" |
|
6530 |
using assms(3)[unfolded closure_def] by auto |
|
6531 |
show ?thesis |
|
6532 |
proof (cases "e = 1") |
|
6533 |
case True |
|
6534 |
obtain y where "y \<in> s" "y \<noteq> x" "dist y x < 1" |
|
33175 | 6535 |
using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto |
53348 | 6536 |
then show ?thesis |
6537 |
apply (rule_tac x=y in bexI) |
|
6538 |
unfolding True |
|
6539 |
using `d > 0` |
|
6540 |
apply auto |
|
6541 |
done |
|
6542 |
next |
|
6543 |
case False |
|
6544 |
then have "0 < e * d / (1 - e)" and *: "1 - e > 0" |
|
56544 | 6545 |
using `e \<le> 1` `e > 0` `d > 0` by auto |
53348 | 6546 |
then obtain y where "y \<in> s" "y \<noteq> x" "dist y x < e * d / (1 - e)" |
33175 | 6547 |
using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto |
53348 | 6548 |
then show ?thesis |
6549 |
apply (rule_tac x=y in bexI) |
|
6550 |
unfolding dist_norm |
|
6551 |
using pos_less_divide_eq[OF *] |
|
6552 |
apply auto |
|
6553 |
done |
|
6554 |
qed |
|
6555 |
qed |
|
6556 |
then obtain y where "y \<in> s" and y: "norm (y - x) * (1 - e) < e * d" |
|
6557 |
by auto |
|
33175 | 6558 |
def z \<equiv> "c + ((1 - e) / e) *\<^sub>R (x - y)" |
53348 | 6559 |
have *: "x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)" |
6560 |
unfolding z_def using `e > 0` |
|
6561 |
by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib) |
|
6562 |
have "z \<in> interior s" |
|
6563 |
apply (rule interior_mono[OF d,unfolded subset_eq,rule_format]) |
|
33175 | 6564 |
unfolding interior_open[OF open_ball] mem_ball z_def dist_norm using y and assms(4,5) |
53348 | 6565 |
apply (auto simp add:field_simps norm_minus_commute) |
6566 |
done |
|
6567 |
then show ?thesis |
|
6568 |
unfolding * |
|
6569 |
apply - |
|
6570 |
apply (rule mem_interior_convex_shrink) |
|
6571 |
using assms(1,4-5) `y\<in>s` |
|
6572 |
apply auto |
|
6573 |
done |
|
6574 |
qed |
|
6575 |
||
33175 | 6576 |
|
44467 | 6577 |
subsection {* Some obvious but surprisingly hard simplex lemmas *} |
33175 | 6578 |
|
6579 |
lemma simplex: |
|
53348 | 6580 |
assumes "finite s" |
6581 |
and "0 \<notin> s" |
|
6582 |
shows "convex hull (insert 0 s) = |
|
6583 |
{y. (\<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s \<le> 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y)}" |
|
6584 |
unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]] |
|
6585 |
apply (rule set_eqI, rule) |
|
6586 |
unfolding mem_Collect_eq |
|
6587 |
apply (erule_tac[!] exE) |
|
6588 |
apply (erule_tac[!] conjE)+ |
|
6589 |
unfolding setsum_clauses(2)[OF assms(1)] |
|
6590 |
apply (rule_tac x=u in exI) |
|
6591 |
defer |
|
6592 |
apply (rule_tac x="\<lambda>x. if x = 0 then 1 - setsum u s else u x" in exI) |
|
6593 |
using assms(2) |
|
6594 |
unfolding if_smult and setsum_delta_notmem[OF assms(2)] |
|
6595 |
apply auto |
|
6596 |
done |
|
33175 | 6597 |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6598 |
lemma substd_simplex: |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6599 |
assumes d: "d \<subseteq> Basis" |
53348 | 6600 |
shows "convex hull (insert 0 d) = |
54465 | 6601 |
{x. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> (\<Sum>i\<in>d. x\<bullet>i) \<le> 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}" |
40377 | 6602 |
(is "convex hull (insert 0 ?p) = ?s") |
53348 | 6603 |
proof - |
6604 |
let ?D = d |
|
6605 |
have "0 \<notin> ?p" |
|
6606 |
using assms by (auto simp: image_def) |
|
6607 |
from d have "finite d" |
|
6608 |
by (blast intro: finite_subset finite_Basis) |
|
6609 |
show ?thesis |
|
54465 | 6610 |
unfolding simplex[OF `finite d` `0 \<notin> ?p`] |
53348 | 6611 |
apply (rule set_eqI) |
6612 |
unfolding mem_Collect_eq |
|
6613 |
apply rule |
|
6614 |
apply (elim exE conjE) |
|
6615 |
apply (erule_tac[2] conjE)+ |
|
6616 |
proof - |
|
6617 |
fix x :: "'a::euclidean_space" |
|
6618 |
fix u |
|
6619 |
assume as: "\<forall>x\<in>?D. 0 \<le> u x" "setsum u ?D \<le> 1" "(\<Sum>x\<in>?D. u x *\<^sub>R x) = x" |
|
6620 |
have *: "\<forall>i\<in>Basis. i:d \<longrightarrow> u i = x\<bullet>i" |
|
54465 | 6621 |
and "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)" |
53348 | 6622 |
using as(3) |
6623 |
unfolding substdbasis_expansion_unique[OF assms] |
|
6624 |
by auto |
|
6625 |
then have **: "setsum u ?D = setsum (op \<bullet> x) ?D" |
|
6626 |
apply - |
|
57418 | 6627 |
apply (rule setsum.cong) |
53348 | 6628 |
using assms |
6629 |
apply auto |
|
6630 |
done |
|
6631 |
have "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (op \<bullet> x) ?D \<le> 1" |
|
6632 |
proof (rule,rule) |
|
6633 |
fix i :: 'a |
|
6634 |
assume i: "i \<in> Basis" |
|
6635 |
have "i \<in> d \<Longrightarrow> 0 \<le> x\<bullet>i" |
|
6636 |
unfolding *[rule_format,OF i,symmetric] |
|
6637 |
apply (rule_tac as(1)[rule_format]) |
|
6638 |
apply auto |
|
6639 |
done |
|
6640 |
moreover have "i \<notin> d \<Longrightarrow> 0 \<le> x\<bullet>i" |
|
6641 |
using `(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)`[rule_format, OF i] by auto |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6642 |
ultimately show "0 \<le> x\<bullet>i" by auto |
53348 | 6643 |
qed (insert as(2)[unfolded **], auto) |
6644 |
then show "(\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (op \<bullet> x) ?D \<le> 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)" |
|
6645 |
using `(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)` by auto |
|
6646 |
next |
|
6647 |
fix x :: "'a::euclidean_space" |
|
6648 |
assume as: "\<forall>i\<in>Basis. 0 \<le> x \<bullet> i" "setsum (op \<bullet> x) ?D \<le> 1" "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6649 |
show "\<exists>u. (\<forall>x\<in>?D. 0 \<le> u x) \<and> setsum u ?D \<le> 1 \<and> (\<Sum>x\<in>?D. u x *\<^sub>R x) = x" |
53348 | 6650 |
using as d |
6651 |
unfolding substdbasis_expansion_unique[OF assms] |
|
6652 |
apply (rule_tac x="inner x" in exI) |
|
6653 |
apply auto |
|
6654 |
done |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6655 |
qed |
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6656 |
qed |
40377 | 6657 |
|
33175 | 6658 |
lemma std_simplex: |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6659 |
"convex hull (insert 0 Basis) = |
53348 | 6660 |
{x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 \<le> x\<bullet>i) \<and> setsum (\<lambda>i. x\<bullet>i) Basis \<le> 1}" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6661 |
using substd_simplex[of Basis] by auto |
33175 | 6662 |
|
6663 |
lemma interior_std_simplex: |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6664 |
"interior (convex hull (insert 0 Basis)) = |
53348 | 6665 |
{x::'a::euclidean_space. (\<forall>i\<in>Basis. 0 < x\<bullet>i) \<and> setsum (\<lambda>i. x\<bullet>i) Basis < 1}" |
6666 |
apply (rule set_eqI) |
|
6667 |
unfolding mem_interior std_simplex |
|
6668 |
unfolding subset_eq mem_Collect_eq Ball_def mem_ball |
|
6669 |
unfolding Ball_def[symmetric] |
|
6670 |
apply rule |
|
6671 |
apply (elim exE conjE) |
|
6672 |
defer |
|
6673 |
apply (erule conjE) |
|
6674 |
proof - |
|
6675 |
fix x :: 'a |
|
6676 |
fix e |
|
6677 |
assume "e > 0" and as: "\<forall>xa. dist x xa < e \<longrightarrow> (\<forall>x\<in>Basis. 0 \<le> xa \<bullet> x) \<and> setsum (op \<bullet> xa) Basis \<le> 1" |
|
6678 |
show "(\<forall>xa\<in>Basis. 0 < x \<bullet> xa) \<and> setsum (op \<bullet> x) Basis < 1" |
|
6679 |
apply safe |
|
6680 |
proof - |
|
6681 |
fix i :: 'a |
|
6682 |
assume i: "i \<in> Basis" |
|
6683 |
then show "0 < x \<bullet> i" |
|
6684 |
using as[THEN spec[where x="x - (e / 2) *\<^sub>R i"]] and `e > 0` |
|
6685 |
unfolding dist_norm |
|
6686 |
by (auto elim!: ballE[where x=i] simp: inner_simps) |
|
6687 |
next |
|
6688 |
have **: "dist x (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) < e" using `e > 0` |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6689 |
unfolding dist_norm |
53348 | 6690 |
by (auto intro!: mult_strict_left_mono simp: SOME_Basis) |
6691 |
have "\<And>i. i \<in> Basis \<Longrightarrow> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis)) \<bullet> i = |
|
6692 |
x\<bullet>i + (if i = (SOME i. i\<in>Basis) then e/2 else 0)" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6693 |
by (auto simp: SOME_Basis inner_Basis inner_simps) |
53348 | 6694 |
then have *: "setsum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis = |
6695 |
setsum (\<lambda>i. x\<bullet>i + (if (SOME i. i\<in>Basis) = i then e/2 else 0)) Basis" |
|
57418 | 6696 |
apply (rule_tac setsum.cong) |
53348 | 6697 |
apply auto |
6698 |
done |
|
6699 |
have "setsum (op \<bullet> x) Basis < setsum (op \<bullet> (x + (e / 2) *\<^sub>R (SOME i. i\<in>Basis))) Basis" |
|
57418 | 6700 |
unfolding * setsum.distrib |
53348 | 6701 |
using `e > 0` DIM_positive[where 'a='a] |
57418 | 6702 |
apply (subst setsum.delta') |
53348 | 6703 |
apply (auto simp: SOME_Basis) |
6704 |
done |
|
6705 |
also have "\<dots> \<le> 1" |
|
6706 |
using ** |
|
6707 |
apply (drule_tac as[rule_format]) |
|
6708 |
apply auto |
|
6709 |
done |
|
6710 |
finally show "setsum (op \<bullet> x) Basis < 1" by auto |
|
6711 |
qed |
|
6712 |
next |
|
6713 |
fix x :: 'a |
|
6714 |
assume as: "\<forall>i\<in>Basis. 0 < x \<bullet> i" "setsum (op \<bullet> x) Basis < 1" |
|
55697 | 6715 |
obtain a :: 'b where "a \<in> UNIV" using UNIV_witness .. |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6716 |
let ?d = "(1 - setsum (op \<bullet> x) Basis) / real (DIM('a))" |
53348 | 6717 |
have "Min ((op \<bullet> x) ` Basis) > 0" |
6718 |
apply (rule Min_grI) |
|
6719 |
using as(1) |
|
6720 |
apply auto |
|
6721 |
done |
|
6722 |
moreover have "?d > 0" |
|
56541 | 6723 |
using as(2) by (auto simp: Suc_le_eq DIM_positive) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6724 |
ultimately show "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> (\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> setsum (op \<bullet> y) Basis \<le> 1" |
53348 | 6725 |
apply (rule_tac x="min (Min ((op \<bullet> x) ` Basis)) ?D" in exI) |
6726 |
apply rule |
|
6727 |
defer |
|
6728 |
apply (rule, rule) |
|
6729 |
proof - |
|
6730 |
fix y |
|
6731 |
assume y: "dist x y < min (Min (op \<bullet> x ` Basis)) ?d" |
|
6732 |
have "setsum (op \<bullet> y) Basis \<le> setsum (\<lambda>i. x\<bullet>i + ?d) Basis" |
|
6733 |
proof (rule setsum_mono) |
|
6734 |
fix i :: 'a |
|
6735 |
assume i: "i \<in> Basis" |
|
6736 |
then have "abs (y\<bullet>i - x\<bullet>i) < ?d" |
|
6737 |
apply - |
|
6738 |
apply (rule le_less_trans) |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6739 |
using Basis_le_norm[OF i, of "y - x"] |
53348 | 6740 |
using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2] |
6741 |
apply (auto simp add: norm_minus_commute inner_diff_left) |
|
6742 |
done |
|
6743 |
then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto |
|
6744 |
qed |
|
6745 |
also have "\<dots> \<le> 1" |
|
57418 | 6746 |
unfolding setsum.distrib setsum_constant real_eq_of_nat |
53348 | 6747 |
by (auto simp add: Suc_le_eq) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6748 |
finally show "(\<forall>i\<in>Basis. 0 \<le> y \<bullet> i) \<and> setsum (op \<bullet> y) Basis \<le> 1" |
53348 | 6749 |
proof safe |
6750 |
fix i :: 'a |
|
6751 |
assume i: "i \<in> Basis" |
|
6752 |
have "norm (x - y) < x\<bullet>i" |
|
6753 |
apply (rule less_le_trans) |
|
6754 |
apply (rule y[unfolded min_less_iff_conj dist_norm, THEN conjunct1]) |
|
6755 |
using i |
|
6756 |
apply auto |
|
6757 |
done |
|
6758 |
then show "0 \<le> y\<bullet>i" |
|
6759 |
using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format, OF i] |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6760 |
by (auto simp: inner_simps) |
53348 | 6761 |
qed |
6762 |
qed auto |
|
6763 |
qed |
|
6764 |
||
6765 |
lemma interior_std_simplex_nonempty: |
|
6766 |
obtains a :: "'a::euclidean_space" where |
|
6767 |
"a \<in> interior(convex hull (insert 0 Basis))" |
|
6768 |
proof - |
|
6769 |
let ?D = "Basis :: 'a set" |
|
6770 |
let ?a = "setsum (\<lambda>b::'a. inverse (2 * real DIM('a)) *\<^sub>R b) Basis" |
|
6771 |
{ |
|
6772 |
fix i :: 'a |
|
6773 |
assume i: "i \<in> Basis" |
|
6774 |
have "?a \<bullet> i = inverse (2 * real DIM('a))" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6775 |
by (rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real DIM('a)) else 0) ?D"]) |
57418 | 6776 |
(simp_all add: setsum.If_cases i) } |
33175 | 6777 |
note ** = this |
53348 | 6778 |
show ?thesis |
6779 |
apply (rule that[of ?a]) |
|
6780 |
unfolding interior_std_simplex mem_Collect_eq |
|
6781 |
proof safe |
|
6782 |
fix i :: 'a |
|
6783 |
assume i: "i \<in> Basis" |
|
6784 |
show "0 < ?a \<bullet> i" |
|
6785 |
unfolding **[OF i] by (auto simp add: Suc_le_eq DIM_positive) |
|
6786 |
next |
|
6787 |
have "setsum (op \<bullet> ?a) ?D = setsum (\<lambda>i. inverse (2 * real DIM('a))) ?D" |
|
57418 | 6788 |
apply (rule setsum.cong) |
6789 |
apply rule |
|
53348 | 6790 |
apply auto |
6791 |
done |
|
6792 |
also have "\<dots> < 1" |
|
6793 |
unfolding setsum_constant real_eq_of_nat divide_inverse[symmetric] |
|
6794 |
by (auto simp add: field_simps) |
|
6795 |
finally show "setsum (op \<bullet> ?a) ?D < 1" by auto |
|
40377 | 6796 |
qed |
53348 | 6797 |
qed |
6798 |
||
6799 |
lemma rel_interior_substd_simplex: |
|
6800 |
assumes d: "d \<subseteq> Basis" |
|
6801 |
shows "rel_interior (convex hull (insert 0 d)) = |
|
6802 |
{x::'a::euclidean_space. (\<forall>i\<in>d. 0 < x\<bullet>i) \<and> (\<Sum>i\<in>d. x\<bullet>i) < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}" |
|
6803 |
(is "rel_interior (convex hull (insert 0 ?p)) = ?s") |
|
6804 |
proof - |
|
6805 |
have "finite d" |
|
6806 |
apply (rule finite_subset) |
|
6807 |
using assms |
|
6808 |
apply auto |
|
6809 |
done |
|
6810 |
show ?thesis |
|
6811 |
proof (cases "d = {}") |
|
6812 |
case True |
|
6813 |
then show ?thesis |
|
6814 |
using rel_interior_sing using euclidean_eq_iff[of _ 0] by auto |
|
6815 |
next |
|
6816 |
case False |
|
6817 |
have h0: "affine hull (convex hull (insert 0 ?p)) = |
|
6818 |
{x::'a::euclidean_space. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)}" |
|
6819 |
using affine_hull_convex_hull affine_hull_substd_basis assms by auto |
|
6820 |
have aux: "\<And>x::'a. \<forall>i\<in>Basis. (\<forall>i\<in>d. 0 \<le> x\<bullet>i) \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0) \<longrightarrow> 0 \<le> x\<bullet>i" |
|
6821 |
by auto |
|
6822 |
{ |
|
6823 |
fix x :: "'a::euclidean_space" |
|
6824 |
assume x: "x \<in> rel_interior (convex hull (insert 0 ?p))" |
|
6825 |
then obtain e where e0: "e > 0" and |
|
6826 |
"ball x e \<inter> {xa. (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0)} \<subseteq> convex hull (insert 0 ?p)" |
|
6827 |
using mem_rel_interior_ball[of x "convex hull (insert 0 ?p)"] h0 by auto |
|
6828 |
then have as: "\<forall>xa. dist x xa < e \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> xa\<bullet>i = 0) \<longrightarrow> |
|
6829 |
(\<forall>i\<in>d. 0 \<le> xa \<bullet> i) \<and> setsum (op \<bullet> xa) d \<le> 1" |
|
6830 |
unfolding ball_def unfolding substd_simplex[OF assms] using assms by auto |
|
6831 |
have x0: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)" |
|
6832 |
using x rel_interior_subset substd_simplex[OF assms] by auto |
|
54465 | 6833 |
have "(\<forall>i\<in>d. 0 < x \<bullet> i) \<and> setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)" |
6834 |
apply rule |
|
6835 |
apply rule |
|
53348 | 6836 |
proof - |
6837 |
fix i :: 'a |
|
6838 |
assume "i \<in> d" |
|
6839 |
then have "\<forall>ia\<in>d. 0 \<le> (x - (e / 2) *\<^sub>R i) \<bullet> ia" |
|
6840 |
apply - |
|
6841 |
apply (rule as[rule_format,THEN conjunct1]) |
|
6842 |
unfolding dist_norm |
|
6843 |
using d `e > 0` x0 |
|
6844 |
apply (auto simp: inner_simps inner_Basis) |
|
6845 |
done |
|
6846 |
then show "0 < x \<bullet> i" |
|
6847 |
apply (erule_tac x=i in ballE) |
|
6848 |
using `e > 0` `i \<in> d` d |
|
6849 |
apply (auto simp: inner_simps inner_Basis) |
|
6850 |
done |
|
6851 |
next |
|
6852 |
obtain a where a: "a \<in> d" |
|
6853 |
using `d \<noteq> {}` by auto |
|
6854 |
then have **: "dist x (x + (e / 2) *\<^sub>R a) < e" |
|
6855 |
using `e > 0` norm_Basis[of a] d |
|
6856 |
unfolding dist_norm |
|
6857 |
by auto |
|
6858 |
have "\<And>i. i \<in> Basis \<Longrightarrow> (x + (e / 2) *\<^sub>R a) \<bullet> i = x\<bullet>i + (if i = a then e/2 else 0)" |
|
6859 |
using a d by (auto simp: inner_simps inner_Basis) |
|
6860 |
then have *: "setsum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d = |
|
6861 |
setsum (\<lambda>i. x\<bullet>i + (if a = i then e/2 else 0)) d" |
|
57418 | 6862 |
using d by (intro setsum.cong) auto |
53348 | 6863 |
have "a \<in> Basis" |
6864 |
using `a \<in> d` d by auto |
|
6865 |
then have h1: "(\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> (x + (e / 2) *\<^sub>R a) \<bullet> i = 0)" |
|
6866 |
using x0 d `a\<in>d` by (auto simp add: inner_add_left inner_Basis) |
|
6867 |
have "setsum (op \<bullet> x) d < setsum (op \<bullet> (x + (e / 2) *\<^sub>R a)) d" |
|
57418 | 6868 |
unfolding * setsum.distrib |
53348 | 6869 |
using `e > 0` `a \<in> d` |
6870 |
using `finite d` |
|
57418 | 6871 |
by (auto simp add: setsum.delta') |
53348 | 6872 |
also have "\<dots> \<le> 1" |
6873 |
using ** h1 as[rule_format, of "x + (e / 2) *\<^sub>R a"] |
|
6874 |
by auto |
|
6875 |
finally show "setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0)" |
|
6876 |
using x0 by auto |
|
6877 |
qed |
|
6878 |
} |
|
6879 |
moreover |
|
6880 |
{ |
|
6881 |
fix x :: "'a::euclidean_space" |
|
6882 |
assume as: "x \<in> ?s" |
|
6883 |
have "\<forall>i. 0 < x\<bullet>i \<or> 0 = x\<bullet>i \<longrightarrow> 0 \<le> x\<bullet>i" |
|
6884 |
by auto |
|
6885 |
moreover have "\<forall>i. i \<in> d \<or> i \<notin> d" by auto |
|
6886 |
ultimately |
|
54465 | 6887 |
have "\<forall>i. (\<forall>i\<in>d. 0 < x\<bullet>i) \<and> (\<forall>i. i \<notin> d \<longrightarrow> x\<bullet>i = 0) \<longrightarrow> 0 \<le> x\<bullet>i" |
53348 | 6888 |
by metis |
6889 |
then have h2: "x \<in> convex hull (insert 0 ?p)" |
|
6890 |
using as assms |
|
6891 |
unfolding substd_simplex[OF assms] by fastforce |
|
6892 |
obtain a where a: "a \<in> d" |
|
6893 |
using `d \<noteq> {}` by auto |
|
6894 |
let ?d = "(1 - setsum (op \<bullet> x) d) / real (card d)" |
|
6895 |
have "0 < card d" using `d \<noteq> {}` `finite d` |
|
44466 | 6896 |
by (simp add: card_gt_0_iff) |
53348 | 6897 |
have "Min ((op \<bullet> x) ` d) > 0" |
6898 |
using as `d \<noteq> {}` `finite d` by (simp add: Min_grI) |
|
56541 | 6899 |
moreover have "?d > 0" using as using `0 < card d` by auto |
53348 | 6900 |
ultimately have h3: "min (Min ((op \<bullet> x) ` d)) ?d > 0" |
6901 |
by auto |
|
54465 | 6902 |
|
53348 | 6903 |
have "x \<in> rel_interior (convex hull (insert 0 ?p))" |
6904 |
unfolding rel_interior_ball mem_Collect_eq h0 |
|
6905 |
apply (rule,rule h2) |
|
6906 |
unfolding substd_simplex[OF assms] |
|
6907 |
apply (rule_tac x="min (Min ((op \<bullet> x) ` d)) ?d" in exI) |
|
6908 |
apply (rule, rule h3) |
|
6909 |
apply safe |
|
6910 |
unfolding mem_ball |
|
6911 |
proof - |
|
6912 |
fix y :: 'a |
|
6913 |
assume y: "dist x y < min (Min (op \<bullet> x ` d)) ?d" |
|
6914 |
assume y2: "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> y\<bullet>i = 0" |
|
6915 |
have "setsum (op \<bullet> y) d \<le> setsum (\<lambda>i. x\<bullet>i + ?d) d" |
|
6916 |
proof (rule setsum_mono) |
|
6917 |
fix i |
|
6918 |
assume "i \<in> d" |
|
6919 |
with d have i: "i \<in> Basis" |
|
6920 |
by auto |
|
6921 |
have "abs (y\<bullet>i - x\<bullet>i) < ?d" |
|
6922 |
apply (rule le_less_trans) |
|
6923 |
using Basis_le_norm[OF i, of "y - x"] |
|
6924 |
using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2] |
|
6925 |
apply (auto simp add: norm_minus_commute inner_simps) |
|
6926 |
done |
|
6927 |
then show "y \<bullet> i \<le> x \<bullet> i + ?d" by auto |
|
6928 |
qed |
|
6929 |
also have "\<dots> \<le> 1" |
|
57418 | 6930 |
unfolding setsum.distrib setsum_constant real_eq_of_nat |
53348 | 6931 |
using `0 < card d` |
6932 |
by auto |
|
6933 |
finally show "setsum (op \<bullet> y) d \<le> 1" . |
|
54465 | 6934 |
|
53348 | 6935 |
fix i :: 'a |
6936 |
assume i: "i \<in> Basis" |
|
6937 |
then show "0 \<le> y\<bullet>i" |
|
6938 |
proof (cases "i\<in>d") |
|
6939 |
case True |
|
6940 |
have "norm (x - y) < x\<bullet>i" |
|
6941 |
using y[unfolded min_less_iff_conj dist_norm, THEN conjunct1] |
|
6942 |
using Min_gr_iff[of "op \<bullet> x ` d" "norm (x - y)"] `0 < card d` `i:d` |
|
6943 |
by (simp add: card_gt_0_iff) |
|
6944 |
then show "0 \<le> y\<bullet>i" |
|
6945 |
using Basis_le_norm[OF i, of "x - y"] and as(1)[rule_format] |
|
6946 |
by (auto simp: inner_simps) |
|
6947 |
qed (insert y2, auto) |
|
6948 |
qed |
|
6949 |
} |
|
6950 |
ultimately have |
|
6951 |
"\<And>x. x \<in> rel_interior (convex hull insert 0 d) \<longleftrightarrow> |
|
6952 |
x \<in> {x. (\<forall>i\<in>d. 0 < x \<bullet> i) \<and> setsum (op \<bullet> x) d < 1 \<and> (\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0)}" |
|
6953 |
by blast |
|
6954 |
then show ?thesis by (rule set_eqI) |
|
40377 | 6955 |
qed |
53348 | 6956 |
qed |
6957 |
||
6958 |
lemma rel_interior_substd_simplex_nonempty: |
|
6959 |
assumes "d \<noteq> {}" |
|
6960 |
and "d \<subseteq> Basis" |
|
6961 |
obtains a :: "'a::euclidean_space" |
|
6962 |
where "a \<in> rel_interior (convex hull (insert 0 d))" |
|
6963 |
proof - |
|
6964 |
let ?D = d |
|
6965 |
let ?a = "setsum (\<lambda>b::'a::euclidean_space. inverse (2 * real (card d)) *\<^sub>R b) ?D" |
|
6966 |
have "finite d" |
|
6967 |
apply (rule finite_subset) |
|
6968 |
using assms(2) |
|
6969 |
apply auto |
|
6970 |
done |
|
6971 |
then have d1: "0 < real (card d)" |
|
6972 |
using `d \<noteq> {}` by auto |
|
6973 |
{ |
|
6974 |
fix i |
|
6975 |
assume "i \<in> d" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6976 |
have "?a \<bullet> i = inverse (2 * real (card d))" |
53348 | 6977 |
apply (rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real (card d)) else 0) ?D"]) |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6978 |
unfolding inner_setsum_left |
57418 | 6979 |
apply (rule setsum.cong) |
6980 |
using `i \<in> d` `finite d` setsum.delta'[of d i "(\<lambda>k. inverse (2 * real (card d)))"] |
|
53348 | 6981 |
d1 assms(2) |
57418 | 6982 |
by (auto simp: inner_Basis set_rev_mp[OF _ assms(2)]) |
53348 | 6983 |
} |
40377 | 6984 |
note ** = this |
53348 | 6985 |
show ?thesis |
6986 |
apply (rule that[of ?a]) |
|
6987 |
unfolding rel_interior_substd_simplex[OF assms(2)] mem_Collect_eq |
|
6988 |
proof safe |
|
6989 |
fix i |
|
6990 |
assume "i \<in> d" |
|
6991 |
have "0 < inverse (2 * real (card d))" |
|
6992 |
using d1 by auto |
|
6993 |
also have "\<dots> = ?a \<bullet> i" using **[of i] `i \<in> d` |
|
6994 |
by auto |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
6995 |
finally show "0 < ?a \<bullet> i" by auto |
53348 | 6996 |
next |
6997 |
have "setsum (op \<bullet> ?a) ?D = setsum (\<lambda>i. inverse (2 * real (card d))) ?D" |
|
57418 | 6998 |
by (rule setsum.cong) (rule refl, rule **) |
53348 | 6999 |
also have "\<dots> < 1" |
7000 |
unfolding setsum_constant real_eq_of_nat divide_real_def[symmetric] |
|
7001 |
by (auto simp add: field_simps) |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
7002 |
finally show "setsum (op \<bullet> ?a) ?D < 1" by auto |
53348 | 7003 |
next |
7004 |
fix i |
|
7005 |
assume "i \<in> Basis" and "i \<notin> d" |
|
7006 |
have "?a \<in> span d" |
|
56196
32b7eafc5a52
remove unnecessary finiteness assumptions from lemmas about setsum
huffman
parents:
56189
diff
changeset
|
7007 |
proof (rule span_setsum[of d "(\<lambda>b. b /\<^sub>R (2 * real (card d)))" d]) |
53348 | 7008 |
{ |
7009 |
fix x :: "'a::euclidean_space" |
|
7010 |
assume "x \<in> d" |
|
7011 |
then have "x \<in> span d" |
|
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
7012 |
using span_superset[of _ "d"] by auto |
53348 | 7013 |
then have "x /\<^sub>R (2 * real (card d)) \<in> span d" |
50526
899c9c4e4a4c
Remove the indexed basis from the definition of euclidean spaces and only use the set of Basis vectors
hoelzl
parents:
50104
diff
changeset
|
7014 |
using span_mul[of x "d" "(inverse (real (card d)) / 2)"] by auto |
53348 | 7015 |
} |
7016 |
then show "\<forall>x\<in>d. x /\<^sub>R (2 * real (card d)) \<in> span d" |
|
7017 |
by auto |
|
40377 | 7018 |
qed |
53348 | 7019 |
then show "?a \<bullet> i = 0 " |
7020 |
using `i \<notin> d` unfolding span_substd_basis[OF assms(2)] using `i \<in> Basis` by auto |
|
40377 | 7021 |
qed |
7022 |
qed |
|
7023 |
||
53348 | 7024 |
|
44467 | 7025 |
subsection {* Relative interior of convex set *} |
40377 | 7026 |
|
49531 | 7027 |
lemma rel_interior_convex_nonempty_aux: |
53348 | 7028 |
fixes S :: "'n::euclidean_space set" |
7029 |
assumes "convex S" |
|
7030 |
and "0 \<in> S" |
|
7031 |
shows "rel_interior S \<noteq> {}" |
|
7032 |
proof (cases "S = {0}") |
|
7033 |
case True |
|
7034 |
then show ?thesis using rel_interior_sing by auto |
|
7035 |
next |
|
7036 |
case False |
|
7037 |
obtain B where B: "independent B \<and> B \<le> S \<and> S \<le> span B \<and> card B = dim S" |
|
7038 |
using basis_exists[of S] by auto |
|
7039 |
then have "B \<noteq> {}" |
|
7040 |
using B assms `S \<noteq> {0}` span_empty by auto |
|
7041 |
have "insert 0 B \<le> span B" |
|
7042 |
using subspace_span[of B] subspace_0[of "span B"] span_inc by auto |
|
7043 |
then have "span (insert 0 B) \<le> span B" |
|
40377 | 7044 |
using span_span[of B] span_mono[of "insert 0 B" "span B"] by blast |
53348 | 7045 |
then have "convex hull insert 0 B \<le> span B" |
40377 | 7046 |
using convex_hull_subset_span[of "insert 0 B"] by auto |
53348 | 7047 |
then have "span (convex hull insert 0 B) \<le> span B" |
40377 | 7048 |
using span_span[of B] span_mono[of "convex hull insert 0 B" "span B"] by blast |
53348 | 7049 |
then have *: "span (convex hull insert 0 B) = span B" |
40377 | 7050 |
using span_mono[of B "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto |
53348 | 7051 |
then have "span (convex hull insert 0 B) = span S" |
7052 |
using B span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
|
7053 |
moreover have "0 \<in> affine hull (convex hull insert 0 B)" |
|
40377 | 7054 |
using hull_subset[of "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto |
53348 | 7055 |
ultimately have **: "affine hull (convex hull insert 0 B) = affine hull S" |
49531 | 7056 |
using affine_hull_span_0[of "convex hull insert 0 B"] affine_hull_span_0[of "S"] |
53348 | 7057 |
assms hull_subset[of S] |
7058 |
by auto |
|
7059 |
obtain d and f :: "'n \<Rightarrow> 'n" where |
|
7060 |
fd: "card d = card B" "linear f" "f ` B = d" |
|
7061 |
"f ` span B = {x. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = (0::real)} \<and> inj_on f (span B)" |
|
7062 |
and d: "d \<subseteq> Basis" |
|
7063 |
using basis_to_substdbasis_subspace_isomorphism[of B,OF _ ] B by auto |
|
7064 |
then have "bounded_linear f" |
|
7065 |
using linear_conv_bounded_linear by auto |
|
7066 |
have "d \<noteq> {}" |
|
7067 |
using fd B `B \<noteq> {}` by auto |
|
7068 |
have "insert 0 d = f ` (insert 0 B)" |
|
7069 |
using fd linear_0 by auto |
|
7070 |
then have "(convex hull (insert 0 d)) = f ` (convex hull (insert 0 B))" |
|
7071 |
using convex_hull_linear_image[of f "(insert 0 d)"] |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
7072 |
convex_hull_linear_image[of f "(insert 0 B)"] `linear f` |
53348 | 7073 |
by auto |
7074 |
moreover have "rel_interior (f ` (convex hull insert 0 B)) = |
|
7075 |
f ` rel_interior (convex hull insert 0 B)" |
|
7076 |
apply (rule rel_interior_injective_on_span_linear_image[of f "(convex hull insert 0 B)"]) |
|
7077 |
using `bounded_linear f` fd * |
|
7078 |
apply auto |
|
7079 |
done |
|
7080 |
ultimately have "rel_interior (convex hull insert 0 B) \<noteq> {}" |
|
7081 |
using rel_interior_substd_simplex_nonempty[OF `d \<noteq> {}` d] |
|
7082 |
apply auto |
|
7083 |
apply blast |
|
7084 |
done |
|
7085 |
moreover have "convex hull (insert 0 B) \<subseteq> S" |
|
7086 |
using B assms hull_mono[of "insert 0 B" "S" "convex"] convex_hull_eq |
|
7087 |
by auto |
|
7088 |
ultimately show ?thesis |
|
7089 |
using subset_rel_interior[of "convex hull insert 0 B" S] ** by auto |
|
40377 | 7090 |
qed |
7091 |
||
7092 |
lemma rel_interior_convex_nonempty: |
|
53348 | 7093 |
fixes S :: "'n::euclidean_space set" |
7094 |
assumes "convex S" |
|
7095 |
shows "rel_interior S = {} \<longleftrightarrow> S = {}" |
|
7096 |
proof - |
|
7097 |
{ |
|
7098 |
assume "S \<noteq> {}" |
|
7099 |
then obtain a where "a \<in> S" by auto |
|
7100 |
then have "0 \<in> op + (-a) ` S" |
|
7101 |
using assms exI[of "(\<lambda>x. x \<in> S \<and> - a + x = 0)" a] by auto |
|
7102 |
then have "rel_interior (op + (-a) ` S) \<noteq> {}" |
|
7103 |
using rel_interior_convex_nonempty_aux[of "op + (-a) ` S"] |
|
7104 |
convex_translation[of S "-a"] assms |
|
7105 |
by auto |
|
7106 |
then have "rel_interior S \<noteq> {}" |
|
7107 |
using rel_interior_translation by auto |
|
7108 |
} |
|
7109 |
then show ?thesis |
|
7110 |
using rel_interior_empty by auto |
|
40377 | 7111 |
qed |
7112 |
||
7113 |
lemma convex_rel_interior: |
|
53348 | 7114 |
fixes S :: "'n::euclidean_space set" |
7115 |
assumes "convex S" |
|
7116 |
shows "convex (rel_interior S)" |
|
7117 |
proof - |
|
7118 |
{ |
|
7119 |
fix x y and u :: real |
|
7120 |
assume assm: "x \<in> rel_interior S" "y \<in> rel_interior S" "0 \<le> u" "u \<le> 1" |
|
7121 |
then have "x \<in> S" |
|
7122 |
using rel_interior_subset by auto |
|
7123 |
have "x - u *\<^sub>R (x-y) \<in> rel_interior S" |
|
7124 |
proof (cases "0 = u") |
|
7125 |
case False |
|
7126 |
then have "0 < u" using assm by auto |
|
7127 |
then show ?thesis |
|
7128 |
using assm rel_interior_convex_shrink[of S y x u] assms `x \<in> S` by auto |
|
7129 |
next |
|
7130 |
case True |
|
7131 |
then show ?thesis using assm by auto |
|
7132 |
qed |
|
7133 |
then have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> rel_interior S" |
|
7134 |
by (simp add: algebra_simps) |
|
7135 |
} |
|
7136 |
then show ?thesis |
|
7137 |
unfolding convex_alt by auto |
|
40377 | 7138 |
qed |
7139 |
||
49531 | 7140 |
lemma convex_closure_rel_interior: |
53348 | 7141 |
fixes S :: "'n::euclidean_space set" |
7142 |
assumes "convex S" |
|
7143 |
shows "closure (rel_interior S) = closure S" |
|
7144 |
proof - |
|
7145 |
have h1: "closure (rel_interior S) \<le> closure S" |
|
7146 |
using closure_mono[of "rel_interior S" S] rel_interior_subset[of S] by auto |
|
7147 |
show ?thesis |
|
7148 |
proof (cases "S = {}") |
|
7149 |
case False |
|
7150 |
then obtain a where a: "a \<in> rel_interior S" |
|
7151 |
using rel_interior_convex_nonempty assms by auto |
|
7152 |
{ fix x |
|
7153 |
assume x: "x \<in> closure S" |
|
7154 |
{ |
|
7155 |
assume "x = a" |
|
7156 |
then have "x \<in> closure (rel_interior S)" |
|
7157 |
using a unfolding closure_def by auto |
|
7158 |
} |
|
7159 |
moreover |
|
7160 |
{ |
|
7161 |
assume "x \<noteq> a" |
|
7162 |
{ |
|
7163 |
fix e :: real |
|
7164 |
assume "e > 0" |
|
7165 |
def e1 \<equiv> "min 1 (e/norm (x - a))" |
|
7166 |
then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (x - a) \<le> e" |
|
56541 | 7167 |
using `x \<noteq> a` `e > 0` le_divide_eq[of e1 e "norm (x - a)"] |
53348 | 7168 |
by simp_all |
7169 |
then have *: "x - e1 *\<^sub>R (x - a) : rel_interior S" |
|
7170 |
using rel_interior_closure_convex_shrink[of S a x e1] assms x a e1_def |
|
7171 |
by auto |
|
7172 |
have "\<exists>y. y \<in> rel_interior S \<and> y \<noteq> x \<and> dist y x \<le> e" |
|
7173 |
apply (rule_tac x="x - e1 *\<^sub>R (x - a)" in exI) |
|
7174 |
using * e1 dist_norm[of "x - e1 *\<^sub>R (x - a)" x] `x \<noteq> a` |
|
7175 |
apply simp |
|
7176 |
done |
|
7177 |
} |
|
7178 |
then have "x islimpt rel_interior S" |
|
7179 |
unfolding islimpt_approachable_le by auto |
|
7180 |
then have "x \<in> closure(rel_interior S)" |
|
7181 |
unfolding closure_def by auto |
|
7182 |
} |
|
7183 |
ultimately have "x \<in> closure(rel_interior S)" by auto |
|
7184 |
} |
|
7185 |
then show ?thesis using h1 by auto |
|
7186 |
next |
|
7187 |
case True |
|
7188 |
then have "rel_interior S = {}" |
|
7189 |
using rel_interior_empty by auto |
|
7190 |
then have "closure (rel_interior S) = {}" |
|
7191 |
using closure_empty by auto |
|
7192 |
with True show ?thesis by auto |
|
7193 |
qed |
|
40377 | 7194 |
qed |
7195 |
||
7196 |
lemma rel_interior_same_affine_hull: |
|
53348 | 7197 |
fixes S :: "'n::euclidean_space set" |
40377 | 7198 |
assumes "convex S" |
7199 |
shows "affine hull (rel_interior S) = affine hull S" |
|
53348 | 7200 |
by (metis assms closure_same_affine_hull convex_closure_rel_interior) |
40377 | 7201 |
|
49531 | 7202 |
lemma rel_interior_aff_dim: |
53348 | 7203 |
fixes S :: "'n::euclidean_space set" |
40377 | 7204 |
assumes "convex S" |
7205 |
shows "aff_dim (rel_interior S) = aff_dim S" |
|
53348 | 7206 |
by (metis aff_dim_affine_hull2 assms rel_interior_same_affine_hull) |
40377 | 7207 |
|
7208 |
lemma rel_interior_rel_interior: |
|
53348 | 7209 |
fixes S :: "'n::euclidean_space set" |
40377 | 7210 |
assumes "convex S" |
7211 |
shows "rel_interior (rel_interior S) = rel_interior S" |
|
53348 | 7212 |
proof - |
7213 |
have "openin (subtopology euclidean (affine hull (rel_interior S))) (rel_interior S)" |
|
7214 |
using opein_rel_interior[of S] rel_interior_same_affine_hull[of S] assms by auto |
|
7215 |
then show ?thesis |
|
7216 |
using rel_interior_def by auto |
|
40377 | 7217 |
qed |
7218 |
||
7219 |
lemma rel_interior_rel_open: |
|
53348 | 7220 |
fixes S :: "'n::euclidean_space set" |
40377 | 7221 |
assumes "convex S" |
7222 |
shows "rel_open (rel_interior S)" |
|
53348 | 7223 |
unfolding rel_open_def using rel_interior_rel_interior assms by auto |
40377 | 7224 |
|
7225 |
lemma convex_rel_interior_closure_aux: |
|
53348 | 7226 |
fixes x y z :: "'n::euclidean_space" |
7227 |
assumes "0 < a" "0 < b" "(a + b) *\<^sub>R z = a *\<^sub>R x + b *\<^sub>R y" |
|
7228 |
obtains e where "0 < e" "e \<le> 1" "z = y - e *\<^sub>R (y - x)" |
|
7229 |
proof - |
|
7230 |
def e \<equiv> "a / (a + b)" |
|
7231 |
have "z = (1 / (a + b)) *\<^sub>R ((a + b) *\<^sub>R z)" |
|
7232 |
apply auto |
|
7233 |
using assms |
|
7234 |
apply simp |
|
7235 |
done |
|
7236 |
also have "\<dots> = (1 / (a + b)) *\<^sub>R (a *\<^sub>R x + b *\<^sub>R y)" |
|
7237 |
using assms scaleR_cancel_left[of "1/(a+b)" "(a + b) *\<^sub>R z" "a *\<^sub>R x + b *\<^sub>R y"] |
|
7238 |
by auto |
|
7239 |
also have "\<dots> = y - e *\<^sub>R (y-x)" |
|
7240 |
using e_def |
|
7241 |
apply (simp add: algebra_simps) |
|
7242 |
using scaleR_left_distrib[of "a/(a+b)" "b/(a+b)" y] assms add_divide_distrib[of a b "a+b"] |
|
7243 |
apply auto |
|
7244 |
done |
|
7245 |
finally have "z = y - e *\<^sub>R (y-x)" |
|
7246 |
by auto |
|
56541 | 7247 |
moreover have "e > 0" using e_def assms by auto |
7248 |
moreover have "e \<le> 1" using e_def assms by auto |
|
7249 |
ultimately show ?thesis using that[of e] by auto |
|
40377 | 7250 |
qed |
7251 |
||
49531 | 7252 |
lemma convex_rel_interior_closure: |
53348 | 7253 |
fixes S :: "'n::euclidean_space set" |
40377 | 7254 |
assumes "convex S" |
7255 |
shows "rel_interior (closure S) = rel_interior S" |
|
53348 | 7256 |
proof (cases "S = {}") |
7257 |
case True |
|
7258 |
then show ?thesis |
|
7259 |
using assms rel_interior_convex_nonempty by auto |
|
7260 |
next |
|
7261 |
case False |
|
7262 |
have "rel_interior (closure S) \<supseteq> rel_interior S" |
|
7263 |
using subset_rel_interior[of S "closure S"] closure_same_affine_hull closure_subset |
|
7264 |
by auto |
|
40377 | 7265 |
moreover |
53348 | 7266 |
{ |
7267 |
fix z |
|
54465 | 7268 |
assume z: "z \<in> rel_interior (closure S)" |
53348 | 7269 |
obtain x where x: "x \<in> rel_interior S" |
7270 |
using `S \<noteq> {}` assms rel_interior_convex_nonempty by auto |
|
7271 |
have "z \<in> rel_interior S" |
|
7272 |
proof (cases "x = z") |
|
7273 |
case True |
|
7274 |
then show ?thesis using x by auto |
|
7275 |
next |
|
7276 |
case False |
|
54465 | 7277 |
obtain e where e: "e > 0" "cball z e \<inter> affine hull closure S \<le> closure S" |
53348 | 7278 |
using z rel_interior_cball[of "closure S"] by auto |
56541 | 7279 |
hence *: "0 < e/norm(z-x)" using e False by auto |
53348 | 7280 |
def y \<equiv> "z + (e/norm(z-x)) *\<^sub>R (z-x)" |
7281 |
have yball: "y \<in> cball z e" |
|
7282 |
using mem_cball y_def dist_norm[of z y] e by auto |
|
7283 |
have "x \<in> affine hull closure S" |
|
7284 |
using x rel_interior_subset_closure hull_inc[of x "closure S"] by auto |
|
7285 |
moreover have "z \<in> affine hull closure S" |
|
7286 |
using z rel_interior_subset hull_subset[of "closure S"] by auto |
|
7287 |
ultimately have "y \<in> affine hull closure S" |
|
49531 | 7288 |
using y_def affine_affine_hull[of "closure S"] |
40377 | 7289 |
mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"] by auto |
53348 | 7290 |
then have "y \<in> closure S" using e yball by auto |
7291 |
have "(1 + (e/norm(z-x))) *\<^sub>R z = (e/norm(z-x)) *\<^sub>R x + y" |
|
49531 | 7292 |
using y_def by (simp add: algebra_simps) |
53348 | 7293 |
then obtain e1 where "0 < e1" "e1 \<le> 1" "z = y - e1 *\<^sub>R (y - x)" |
49531 | 7294 |
using * convex_rel_interior_closure_aux[of "e / norm (z - x)" 1 z x y] |
53348 | 7295 |
by (auto simp add: algebra_simps) |
7296 |
then show ?thesis |
|
7297 |
using rel_interior_closure_convex_shrink assms x `y \<in> closure S` |
|
7298 |
by auto |
|
7299 |
qed |
|
7300 |
} |
|
7301 |
ultimately show ?thesis by auto |
|
40377 | 7302 |
qed |
7303 |
||
49531 | 7304 |
lemma convex_interior_closure: |
53348 | 7305 |
fixes S :: "'n::euclidean_space set" |
7306 |
assumes "convex S" |
|
7307 |
shows "interior (closure S) = interior S" |
|
7308 |
using closure_aff_dim[of S] interior_rel_interior_gen[of S] |
|
7309 |
interior_rel_interior_gen[of "closure S"] |
|
7310 |
convex_rel_interior_closure[of S] assms |
|
7311 |
by auto |
|
40377 | 7312 |
|
7313 |
lemma closure_eq_rel_interior_eq: |
|
53348 | 7314 |
fixes S1 S2 :: "'n::euclidean_space set" |
7315 |
assumes "convex S1" |
|
7316 |
and "convex S2" |
|
7317 |
shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 = rel_interior S2" |
|
7318 |
by (metis convex_rel_interior_closure convex_closure_rel_interior assms) |
|
40377 | 7319 |
|
7320 |
lemma closure_eq_between: |
|
53348 | 7321 |
fixes S1 S2 :: "'n::euclidean_space set" |
7322 |
assumes "convex S1" |
|
7323 |
and "convex S2" |
|
7324 |
shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 \<le> S2 \<and> S2 \<subseteq> closure S1" |
|
54465 | 7325 |
(is "?A \<longleftrightarrow> ?B") |
53348 | 7326 |
proof |
7327 |
assume ?A |
|
7328 |
then show ?B |
|
7329 |
by (metis assms closure_subset convex_rel_interior_closure rel_interior_subset) |
|
7330 |
next |
|
7331 |
assume ?B |
|
7332 |
then have "closure S1 \<subseteq> closure S2" |
|
7333 |
by (metis assms(1) convex_closure_rel_interior closure_mono) |
|
7334 |
moreover from `?B` have "closure S1 \<supseteq> closure S2" |
|
7335 |
by (metis closed_closure closure_minimal) |
|
7336 |
ultimately show ?A .. |
|
40377 | 7337 |
qed |
7338 |
||
7339 |
lemma open_inter_closure_rel_interior: |
|
53348 | 7340 |
fixes S A :: "'n::euclidean_space set" |
7341 |
assumes "convex S" |
|
7342 |
and "open A" |
|
7343 |
shows "A \<inter> closure S = {} \<longleftrightarrow> A \<inter> rel_interior S = {}" |
|
7344 |
by (metis assms convex_closure_rel_interior open_inter_closure_eq_empty) |
|
40377 | 7345 |
|
7346 |
definition "rel_frontier S = closure S - rel_interior S" |
|
7347 |
||
53348 | 7348 |
lemma closed_affine_hull: |
7349 |
fixes S :: "'n::euclidean_space set" |
|
7350 |
shows "closed (affine hull S)" |
|
7351 |
by (metis affine_affine_hull affine_closed) |
|
7352 |
||
7353 |
lemma closed_rel_frontier: |
|
7354 |
fixes S :: "'n::euclidean_space set" |
|
7355 |
shows "closed (rel_frontier S)" |
|
7356 |
proof - |
|
7357 |
have *: "closedin (subtopology euclidean (affine hull S)) (closure S - rel_interior S)" |
|
7358 |
apply (rule closedin_diff[of "subtopology euclidean (affine hull S)""closure S" "rel_interior S"]) |
|
7359 |
using closed_closedin_trans[of "affine hull S" "closure S"] closed_affine_hull[of S] |
|
7360 |
closure_affine_hull[of S] opein_rel_interior[of S] |
|
7361 |
apply auto |
|
7362 |
done |
|
7363 |
show ?thesis |
|
7364 |
apply (rule closedin_closed_trans[of "affine hull S" "rel_frontier S"]) |
|
7365 |
unfolding rel_frontier_def |
|
7366 |
using * closed_affine_hull |
|
7367 |
apply auto |
|
7368 |
done |
|
49531 | 7369 |
qed |
7370 |
||
40377 | 7371 |
|
7372 |
lemma convex_rel_frontier_aff_dim: |
|
53348 | 7373 |
fixes S1 S2 :: "'n::euclidean_space set" |
7374 |
assumes "convex S1" |
|
7375 |
and "convex S2" |
|
7376 |
and "S2 \<noteq> {}" |
|
7377 |
and "S1 \<le> rel_frontier S2" |
|
7378 |
shows "aff_dim S1 < aff_dim S2" |
|
7379 |
proof - |
|
7380 |
have "S1 \<subseteq> closure S2" |
|
7381 |
using assms unfolding rel_frontier_def by auto |
|
7382 |
then have *: "affine hull S1 \<subseteq> affine hull S2" |
|
7383 |
using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] |
|
7384 |
by auto |
|
7385 |
then have "aff_dim S1 \<le> aff_dim S2" |
|
7386 |
using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2] |
|
7387 |
aff_dim_subset[of "affine hull S1" "affine hull S2"] |
|
7388 |
by auto |
|
7389 |
moreover |
|
7390 |
{ |
|
7391 |
assume eq: "aff_dim S1 = aff_dim S2" |
|
7392 |
then have "S1 \<noteq> {}" |
|
7393 |
using aff_dim_empty[of S1] aff_dim_empty[of S2] `S2 \<noteq> {}` by auto |
|
7394 |
have **: "affine hull S1 = affine hull S2" |
|
7395 |
apply (rule affine_dim_equal) |
|
7396 |
using * affine_affine_hull |
|
7397 |
apply auto |
|
7398 |
using `S1 \<noteq> {}` hull_subset[of S1] |
|
7399 |
apply auto |
|
7400 |
using eq aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2] |
|
7401 |
apply auto |
|
7402 |
done |
|
7403 |
obtain a where a: "a \<in> rel_interior S1" |
|
7404 |
using `S1 \<noteq> {}` rel_interior_convex_nonempty assms by auto |
|
7405 |
obtain T where T: "open T" "a \<in> T \<inter> S1" "T \<inter> affine hull S1 \<subseteq> S1" |
|
7406 |
using mem_rel_interior[of a S1] a by auto |
|
7407 |
then have "a \<in> T \<inter> closure S2" |
|
7408 |
using a assms unfolding rel_frontier_def by auto |
|
54465 | 7409 |
then obtain b where b: "b \<in> T \<inter> rel_interior S2" |
53348 | 7410 |
using open_inter_closure_rel_interior[of S2 T] assms T by auto |
7411 |
then have "b \<in> affine hull S1" |
|
7412 |
using rel_interior_subset hull_subset[of S2] ** by auto |
|
7413 |
then have "b \<in> S1" |
|
7414 |
using T b by auto |
|
7415 |
then have False |
|
7416 |
using b assms unfolding rel_frontier_def by auto |
|
7417 |
} |
|
7418 |
ultimately show ?thesis |
|
7419 |
using less_le by auto |
|
40377 | 7420 |
qed |
7421 |
||
7422 |
||
7423 |
lemma convex_rel_interior_if: |
|
53348 | 7424 |
fixes S :: "'n::euclidean_space set" |
7425 |
assumes "convex S" |
|
7426 |
and "z \<in> rel_interior S" |
|
7427 |
shows "\<forall>x\<in>affine hull S. \<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" |
|
7428 |
proof - |
|
54465 | 7429 |
obtain e1 where e1: "e1 > 0 \<and> cball z e1 \<inter> affine hull S \<subseteq> S" |
7430 |
using mem_rel_interior_cball[of z S] assms by auto |
|
53348 | 7431 |
{ |
7432 |
fix x |
|
7433 |
assume x: "x \<in> affine hull S" |
|
54465 | 7434 |
{ |
7435 |
assume "x \<noteq> z" |
|
53348 | 7436 |
def m \<equiv> "1 + e1/norm(x-z)" |
56541 | 7437 |
hence "m > 1" using e1 `x \<noteq> z` by auto |
53348 | 7438 |
{ |
7439 |
fix e |
|
7440 |
assume e: "e > 1 \<and> e \<le> m" |
|
7441 |
have "z \<in> affine hull S" |
|
7442 |
using assms rel_interior_subset hull_subset[of S] by auto |
|
7443 |
then have *: "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> affine hull S" |
|
7444 |
using mem_affine[of "affine hull S" x z "(1-e)" e] affine_affine_hull[of S] x |
|
7445 |
by auto |
|
7446 |
have "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) = norm ((e - 1) *\<^sub>R (x - z))" |
|
7447 |
by (simp add: algebra_simps) |
|
7448 |
also have "\<dots> = (e - 1) * norm (x-z)" |
|
7449 |
using norm_scaleR e by auto |
|
7450 |
also have "\<dots> \<le> (m - 1) * norm (x - z)" |
|
7451 |
using e mult_right_mono[of _ _ "norm(x-z)"] by auto |
|
7452 |
also have "\<dots> = (e1 / norm (x - z)) * norm (x - z)" |
|
7453 |
using m_def by auto |
|
7454 |
also have "\<dots> = e1" |
|
7455 |
using `x \<noteq> z` e1 by simp |
|
7456 |
finally have **: "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) \<le> e1" |
|
7457 |
by auto |
|
7458 |
have "(1 - e)*\<^sub>R x+ e *\<^sub>R z \<in> cball z e1" |
|
7459 |
using m_def ** |
|
7460 |
unfolding cball_def dist_norm |
|
7461 |
by (auto simp add: algebra_simps) |
|
7462 |
then have "(1 - e) *\<^sub>R x+ e *\<^sub>R z \<in> S" |
|
7463 |
using e * e1 by auto |
|
7464 |
} |
|
7465 |
then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S )" |
|
7466 |
using `m> 1 ` by auto |
|
7467 |
} |
|
7468 |
moreover |
|
7469 |
{ |
|
7470 |
assume "x = z" |
|
7471 |
def m \<equiv> "1 + e1" |
|
7472 |
then have "m > 1" |
|
7473 |
using e1 by auto |
|
7474 |
{ |
|
7475 |
fix e |
|
7476 |
assume e: "e > 1 \<and> e \<le> m" |
|
7477 |
then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7478 |
using e1 x `x = z` by (auto simp add: algebra_simps) |
|
7479 |
then have "(1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7480 |
using e by auto |
|
7481 |
} |
|
7482 |
then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" |
|
7483 |
using `m > 1` by auto |
|
7484 |
} |
|
7485 |
ultimately have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S )" |
|
7486 |
by auto |
|
40377 | 7487 |
} |
53348 | 7488 |
then show ?thesis by auto |
40377 | 7489 |
qed |
7490 |
||
7491 |
lemma convex_rel_interior_if2: |
|
53348 | 7492 |
fixes S :: "'n::euclidean_space set" |
7493 |
assumes "convex S" |
|
7494 |
assumes "z \<in> rel_interior S" |
|
7495 |
shows "\<forall>x\<in>affine hull S. \<exists>e. e > 1 \<and> (1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7496 |
using convex_rel_interior_if[of S z] assms by auto |
|
40377 | 7497 |
|
7498 |
lemma convex_rel_interior_only_if: |
|
53348 | 7499 |
fixes S :: "'n::euclidean_space set" |
7500 |
assumes "convex S" |
|
7501 |
and "S \<noteq> {}" |
|
7502 |
assumes "\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7503 |
shows "z \<in> rel_interior S" |
|
7504 |
proof - |
|
7505 |
obtain x where x: "x \<in> rel_interior S" |
|
7506 |
using rel_interior_convex_nonempty assms by auto |
|
7507 |
then have "x \<in> S" |
|
7508 |
using rel_interior_subset by auto |
|
7509 |
then obtain e where e: "e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7510 |
using assms by auto |
|
7511 |
def y \<equiv> "(1 - e) *\<^sub>R x + e *\<^sub>R z" |
|
7512 |
then have "y \<in> S" using e by auto |
|
7513 |
def e1 \<equiv> "1/e" |
|
7514 |
then have "0 < e1 \<and> e1 < 1" using e by auto |
|
7515 |
then have "z =y - (1 - e1) *\<^sub>R (y - x)" |
|
7516 |
using e1_def y_def by (auto simp add: algebra_simps) |
|
7517 |
then show ?thesis |
|
7518 |
using rel_interior_convex_shrink[of S x y "1-e1"] `0 < e1 \<and> e1 < 1` `y \<in> S` x assms |
|
7519 |
by auto |
|
40377 | 7520 |
qed |
7521 |
||
7522 |
lemma convex_rel_interior_iff: |
|
53348 | 7523 |
fixes S :: "'n::euclidean_space set" |
7524 |
assumes "convex S" |
|
7525 |
and "S \<noteq> {}" |
|
7526 |
shows "z \<in> rel_interior S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" |
|
7527 |
using assms hull_subset[of S "affine"] |
|
7528 |
convex_rel_interior_if[of S z] convex_rel_interior_only_if[of S z] |
|
7529 |
by auto |
|
40377 | 7530 |
|
7531 |
lemma convex_rel_interior_iff2: |
|
53348 | 7532 |
fixes S :: "'n::euclidean_space set" |
7533 |
assumes "convex S" |
|
7534 |
and "S \<noteq> {}" |
|
7535 |
shows "z \<in> rel_interior S \<longleftrightarrow> (\<forall>x\<in>affine hull S. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" |
|
7536 |
using assms hull_subset[of S] convex_rel_interior_if2[of S z] convex_rel_interior_only_if[of S z] |
|
7537 |
by auto |
|
40377 | 7538 |
|
7539 |
lemma convex_interior_iff: |
|
53348 | 7540 |
fixes S :: "'n::euclidean_space set" |
7541 |
assumes "convex S" |
|
7542 |
shows "z \<in> interior S \<longleftrightarrow> (\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S)" |
|
7543 |
proof (cases "aff_dim S = int DIM('n)") |
|
7544 |
case False |
|
7545 |
{ |
|
7546 |
assume "z \<in> interior S" |
|
7547 |
then have False |
|
7548 |
using False interior_rel_interior_gen[of S] by auto |
|
40377 | 7549 |
} |
7550 |
moreover |
|
53348 | 7551 |
{ |
7552 |
assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S" |
|
7553 |
{ |
|
7554 |
fix x |
|
54465 | 7555 |
obtain e1 where e1: "e1 > 0 \<and> z + e1 *\<^sub>R (x - z) \<in> S" |
53348 | 7556 |
using r by auto |
54465 | 7557 |
obtain e2 where e2: "e2 > 0 \<and> z + e2 *\<^sub>R (z - x) \<in> S" |
53348 | 7558 |
using r by auto |
7559 |
def x1 \<equiv> "z + e1 *\<^sub>R (x - z)" |
|
7560 |
then have x1: "x1 \<in> affine hull S" |
|
54465 | 7561 |
using e1 hull_subset[of S] by auto |
53348 | 7562 |
def x2 \<equiv> "z + e2 *\<^sub>R (z - x)" |
7563 |
then have x2: "x2 \<in> affine hull S" |
|
54465 | 7564 |
using e2 hull_subset[of S] by auto |
53348 | 7565 |
have *: "e1/(e1+e2) + e2/(e1+e2) = 1" |
54465 | 7566 |
using add_divide_distrib[of e1 e2 "e1+e2"] e1 e2 by simp |
53348 | 7567 |
then have "z = (e2/(e1+e2)) *\<^sub>R x1 + (e1/(e1+e2)) *\<^sub>R x2" |
7568 |
using x1_def x2_def |
|
7569 |
apply (auto simp add: algebra_simps) |
|
7570 |
using scaleR_left_distrib[of "e1/(e1+e2)" "e2/(e1+e2)" z] |
|
7571 |
apply auto |
|
7572 |
done |
|
7573 |
then have z: "z \<in> affine hull S" |
|
7574 |
using mem_affine[of "affine hull S" x1 x2 "e2/(e1+e2)" "e1/(e1+e2)"] |
|
7575 |
x1 x2 affine_affine_hull[of S] * |
|
7576 |
by auto |
|
7577 |
have "x1 - x2 = (e1 + e2) *\<^sub>R (x - z)" |
|
7578 |
using x1_def x2_def by (auto simp add: algebra_simps) |
|
7579 |
then have "x = z+(1/(e1+e2)) *\<^sub>R (x1-x2)" |
|
54465 | 7580 |
using e1 e2 by simp |
53348 | 7581 |
then have "x \<in> affine hull S" |
7582 |
using mem_affine_3_minus[of "affine hull S" z x1 x2 "1/(e1+e2)"] |
|
7583 |
x1 x2 z affine_affine_hull[of S] |
|
7584 |
by auto |
|
7585 |
} |
|
7586 |
then have "affine hull S = UNIV" |
|
7587 |
by auto |
|
7588 |
then have "aff_dim S = int DIM('n)" |
|
7589 |
using aff_dim_affine_hull[of S] by (simp add: aff_dim_univ) |
|
7590 |
then have False |
|
7591 |
using False by auto |
|
7592 |
} |
|
7593 |
ultimately show ?thesis by auto |
|
7594 |
next |
|
7595 |
case True |
|
7596 |
then have "S \<noteq> {}" |
|
7597 |
using aff_dim_empty[of S] by auto |
|
7598 |
have *: "affine hull S = UNIV" |
|
7599 |
using True affine_hull_univ by auto |
|
7600 |
{ |
|
7601 |
assume "z \<in> interior S" |
|
7602 |
then have "z \<in> rel_interior S" |
|
7603 |
using True interior_rel_interior_gen[of S] by auto |
|
7604 |
then have **: "\<forall>x. \<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7605 |
using convex_rel_interior_iff2[of S z] assms `S \<noteq> {}` * by auto |
|
7606 |
fix x |
|
7607 |
obtain e1 where e1: "e1 > 1" "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z \<in> S" |
|
40377 | 7608 |
using **[rule_format, of "z-x"] by auto |
53348 | 7609 |
def e \<equiv> "e1 - 1" |
7610 |
then have "(1 - e1) *\<^sub>R (z - x) + e1 *\<^sub>R z = z + e *\<^sub>R x" |
|
7611 |
by (simp add: algebra_simps) |
|
7612 |
then have "e > 0" "z + e *\<^sub>R x \<in> S" |
|
7613 |
using e1 e_def by auto |
|
7614 |
then have "\<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S" |
|
7615 |
by auto |
|
40377 | 7616 |
} |
7617 |
moreover |
|
53348 | 7618 |
{ |
7619 |
assume r: "\<forall>x. \<exists>e. e > 0 \<and> z + e *\<^sub>R x \<in> S" |
|
7620 |
{ |
|
7621 |
fix x |
|
7622 |
obtain e1 where e1: "e1 > 0" "z + e1 *\<^sub>R (z - x) \<in> S" |
|
7623 |
using r[rule_format, of "z-x"] by auto |
|
7624 |
def e \<equiv> "e1 + 1" |
|
7625 |
then have "z + e1 *\<^sub>R (z - x) = (1 - e) *\<^sub>R x + e *\<^sub>R z" |
|
7626 |
by (simp add: algebra_simps) |
|
7627 |
then have "e > 1" "(1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S" |
|
7628 |
using e1 e_def by auto |
|
7629 |
then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S" by auto |
|
40377 | 7630 |
} |
53348 | 7631 |
then have "z \<in> rel_interior S" |
7632 |
using convex_rel_interior_iff2[of S z] assms `S \<noteq> {}` by auto |
|
7633 |
then have "z \<in> interior S" |
|
7634 |
using True interior_rel_interior_gen[of S] by auto |
|
7635 |
} |
|
7636 |
ultimately show ?thesis by auto |
|
7637 |
qed |
|
7638 |
||
40377 | 7639 |
|
44467 | 7640 |
subsubsection {* Relative interior and closure under common operations *} |
40377 | 7641 |
|
53348 | 7642 |
lemma rel_interior_inter_aux: "\<Inter>{rel_interior S |S. S : I} \<subseteq> \<Inter>I" |
7643 |
proof - |
|
7644 |
{ |
|
7645 |
fix y |
|
7646 |
assume "y \<in> \<Inter>{rel_interior S |S. S : I}" |
|
7647 |
then have y: "\<forall>S \<in> I. y \<in> rel_interior S" |
|
7648 |
by auto |
|
7649 |
{ |
|
7650 |
fix S |
|
7651 |
assume "S \<in> I" |
|
7652 |
then have "y \<in> S" |
|
7653 |
using rel_interior_subset y by auto |
|
7654 |
} |
|
7655 |
then have "y \<in> \<Inter>I" by auto |
|
7656 |
} |
|
7657 |
then show ?thesis by auto |
|
7658 |
qed |
|
7659 |
||
7660 |
lemma closure_inter: "closure (\<Inter>I) \<le> \<Inter>{closure S |S. S \<in> I}" |
|
7661 |
proof - |
|
7662 |
{ |
|
7663 |
fix y |
|
7664 |
assume "y \<in> \<Inter>I" |
|
7665 |
then have y: "\<forall>S \<in> I. y \<in> S" by auto |
|
7666 |
{ |
|
7667 |
fix S |
|
7668 |
assume "S \<in> I" |
|
7669 |
then have "y \<in> closure S" |
|
7670 |
using closure_subset y by auto |
|
7671 |
} |
|
7672 |
then have "y \<in> \<Inter>{closure S |S. S \<in> I}" |
|
7673 |
by auto |
|
7674 |
} |
|
7675 |
then have "\<Inter>I \<subseteq> \<Inter>{closure S |S. S \<in> I}" |
|
7676 |
by auto |
|
54465 | 7677 |
moreover have "closed (\<Inter>{closure S |S. S \<in> I})" |
53348 | 7678 |
unfolding closed_Inter closed_closure by auto |
54465 | 7679 |
ultimately show ?thesis using closure_hull[of "\<Inter>I"] |
53348 | 7680 |
hull_minimal[of "\<Inter>I" "\<Inter>{closure S |S. S \<in> I}" "closed"] by auto |
40377 | 7681 |
qed |
7682 |
||
49531 | 7683 |
lemma convex_closure_rel_interior_inter: |
53348 | 7684 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
7685 |
and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
|
7686 |
shows "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
7687 |
proof - |
|
7688 |
obtain x where x: "\<forall>S\<in>I. x \<in> rel_interior S" |
|
7689 |
using assms by auto |
|
7690 |
{ |
|
7691 |
fix y |
|
7692 |
assume "y \<in> \<Inter>{closure S |S. S \<in> I}" |
|
7693 |
then have y: "\<forall>S \<in> I. y \<in> closure S" |
|
7694 |
by auto |
|
7695 |
{ |
|
7696 |
assume "y = x" |
|
7697 |
then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
54465 | 7698 |
using x closure_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto |
53348 | 7699 |
} |
7700 |
moreover |
|
7701 |
{ |
|
7702 |
assume "y \<noteq> x" |
|
7703 |
{ fix e :: real |
|
7704 |
assume e: "e > 0" |
|
7705 |
def e1 \<equiv> "min 1 (e/norm (y - x))" |
|
7706 |
then have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (y - x) \<le> e" |
|
56541 | 7707 |
using `y \<noteq> x` `e > 0` le_divide_eq[of e1 e "norm (y - x)"] |
53348 | 7708 |
by simp_all |
7709 |
def z \<equiv> "y - e1 *\<^sub>R (y - x)" |
|
7710 |
{ |
|
7711 |
fix S |
|
7712 |
assume "S \<in> I" |
|
7713 |
then have "z \<in> rel_interior S" |
|
7714 |
using rel_interior_closure_convex_shrink[of S x y e1] assms x y e1 z_def |
|
7715 |
by auto |
|
7716 |
} |
|
7717 |
then have *: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}" |
|
7718 |
by auto |
|
7719 |
have "\<exists>z. z \<in> \<Inter>{rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e" |
|
7720 |
apply (rule_tac x="z" in exI) |
|
7721 |
using `y \<noteq> x` z_def * e1 e dist_norm[of z y] |
|
7722 |
apply simp |
|
7723 |
done |
|
7724 |
} |
|
7725 |
then have "y islimpt \<Inter>{rel_interior S |S. S \<in> I}" |
|
7726 |
unfolding islimpt_approachable_le by blast |
|
7727 |
then have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
7728 |
unfolding closure_def by auto |
|
7729 |
} |
|
7730 |
ultimately have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
7731 |
by auto |
|
40377 | 7732 |
} |
53348 | 7733 |
then show ?thesis by auto |
40377 | 7734 |
qed |
7735 |
||
7736 |
||
49531 | 7737 |
lemma convex_closure_inter: |
53348 | 7738 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
7739 |
and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
|
54465 | 7740 |
shows "closure (\<Inter>I) = \<Inter>{closure S |S. S \<in> I}" |
53348 | 7741 |
proof - |
7742 |
have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
7743 |
using convex_closure_rel_interior_inter assms by auto |
|
7744 |
moreover |
|
54465 | 7745 |
have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter> I)" |
7746 |
using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
|
53348 | 7747 |
by auto |
7748 |
ultimately show ?thesis |
|
7749 |
using closure_inter[of I] by auto |
|
40377 | 7750 |
qed |
7751 |
||
49531 | 7752 |
lemma convex_inter_rel_interior_same_closure: |
53348 | 7753 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
7754 |
and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
|
54465 | 7755 |
shows "closure (\<Inter>{rel_interior S |S. S \<in> I}) = closure (\<Inter>I)" |
53348 | 7756 |
proof - |
7757 |
have "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})" |
|
7758 |
using convex_closure_rel_interior_inter assms by auto |
|
7759 |
moreover |
|
7760 |
have "closure (\<Inter>{rel_interior S |S. S \<in> I}) \<le> closure (\<Inter>I)" |
|
54465 | 7761 |
using rel_interior_inter_aux closure_mono[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
53348 | 7762 |
by auto |
7763 |
ultimately show ?thesis |
|
7764 |
using closure_inter[of I] by auto |
|
40377 | 7765 |
qed |
7766 |
||
49531 | 7767 |
lemma convex_rel_interior_inter: |
53348 | 7768 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
7769 |
and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
|
54465 | 7770 |
shows "rel_interior (\<Inter>I) \<subseteq> \<Inter>{rel_interior S |S. S \<in> I}" |
53348 | 7771 |
proof - |
7772 |
have "convex (\<Inter>I)" |
|
7773 |
using assms convex_Inter by auto |
|
7774 |
moreover |
|
54465 | 7775 |
have "convex (\<Inter>{rel_interior S |S. S \<in> I})" |
53348 | 7776 |
apply (rule convex_Inter) |
7777 |
using assms convex_rel_interior |
|
7778 |
apply auto |
|
7779 |
done |
|
7780 |
ultimately |
|
7781 |
have "rel_interior (\<Inter>{rel_interior S |S. S \<in> I}) = rel_interior (\<Inter>I)" |
|
7782 |
using convex_inter_rel_interior_same_closure assms |
|
7783 |
closure_eq_rel_interior_eq[of "\<Inter>{rel_interior S |S. S \<in> I}" "\<Inter>I"] |
|
7784 |
by blast |
|
7785 |
then show ?thesis |
|
7786 |
using rel_interior_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"] by auto |
|
40377 | 7787 |
qed |
7788 |
||
49531 | 7789 |
lemma convex_rel_interior_finite_inter: |
53348 | 7790 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)" |
7791 |
and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}" |
|
7792 |
and "finite I" |
|
7793 |
shows "rel_interior (\<Inter>I) = \<Inter>{rel_interior S |S. S \<in> I}" |
|
7794 |
proof - |
|
7795 |
have "\<Inter>I \<noteq> {}" |
|
7796 |
using assms rel_interior_inter_aux[of I] by auto |
|
7797 |
have "convex (\<Inter>I)" |
|
7798 |
using convex_Inter assms by auto |
|
7799 |
show ?thesis |
|
7800 |
proof (cases "I = {}") |
|
7801 |
case True |
|
7802 |
then show ?thesis |
|
7803 |
using Inter_empty rel_interior_univ2 by auto |
|
7804 |
next |
|
7805 |
case False |
|
7806 |
{ |
|
7807 |
fix z |
|
7808 |
assume z: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}" |
|
7809 |
{ |
|
7810 |
fix x |
|
7811 |
assume x: "x \<in> Inter I" |
|
7812 |
{ |
|
7813 |
fix S |
|
7814 |
assume S: "S \<in> I" |
|
7815 |
then have "z \<in> rel_interior S" "x \<in> S" |
|
7816 |
using z x by auto |
|
7817 |
then have "\<exists>m. m > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> m \<longrightarrow> (1 - e)*\<^sub>R x + e *\<^sub>R z \<in> S)" |
|
7818 |
using convex_rel_interior_if[of S z] S assms hull_subset[of S] by auto |
|
7819 |
} |
|
7820 |
then obtain mS where |
|
7821 |
mS: "\<forall>S\<in>I. mS S > 1 \<and> (\<forall>e. e > 1 \<and> e \<le> mS S \<longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> S)" by metis |
|
7822 |
def e \<equiv> "Min (mS ` I)" |
|
7823 |
then have "e \<in> mS ` I" using assms `I \<noteq> {}` by simp |
|
7824 |
then have "e > 1" using mS by auto |
|
7825 |
moreover have "\<forall>S\<in>I. e \<le> mS S" |
|
7826 |
using e_def assms by auto |
|
7827 |
ultimately have "\<exists>e > 1. (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> \<Inter>I" |
|
7828 |
using mS by auto |
|
7829 |
} |
|
7830 |
then have "z \<in> rel_interior (\<Inter>I)" |
|
7831 |
using convex_rel_interior_iff[of "\<Inter>I" z] `\<Inter>I \<noteq> {}` `convex (\<Inter>I)` by auto |
|
7832 |
} |
|
7833 |
then show ?thesis |
|
7834 |
using convex_rel_interior_inter[of I] assms by auto |
|
7835 |
qed |
|
40377 | 7836 |
qed |
7837 |
||
49531 | 7838 |
lemma convex_closure_inter_two: |
53348 | 7839 |
fixes S T :: "'n::euclidean_space set" |
7840 |
assumes "convex S" |
|
7841 |
and "convex T" |
|
7842 |
assumes "rel_interior S \<inter> rel_interior T \<noteq> {}" |
|
7843 |
shows "closure (S \<inter> T) = closure S \<inter> closure T" |
|
7844 |
using convex_closure_inter[of "{S,T}"] assms by auto |
|
40377 | 7845 |
|
49531 | 7846 |
lemma convex_rel_interior_inter_two: |
53348 | 7847 |
fixes S T :: "'n::euclidean_space set" |
7848 |
assumes "convex S" |
|
7849 |
and "convex T" |
|
7850 |
and "rel_interior S \<inter> rel_interior T \<noteq> {}" |
|
7851 |
shows "rel_interior (S \<inter> T) = rel_interior S \<inter> rel_interior T" |
|
7852 |
using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto |
|
40377 | 7853 |
|
49531 | 7854 |
lemma convex_affine_closure_inter: |
53348 | 7855 |
fixes S T :: "'n::euclidean_space set" |
7856 |
assumes "convex S" |
|
7857 |
and "affine T" |
|
7858 |
and "rel_interior S \<inter> T \<noteq> {}" |
|
7859 |
shows "closure (S \<inter> T) = closure S \<inter> T" |
|
7860 |
proof - |
|
7861 |
have "affine hull T = T" |
|
7862 |
using assms by auto |
|
7863 |
then have "rel_interior T = T" |
|
7864 |
using rel_interior_univ[of T] by metis |
|
7865 |
moreover have "closure T = T" |
|
7866 |
using assms affine_closed[of T] by auto |
|
7867 |
ultimately show ?thesis |
|
7868 |
using convex_closure_inter_two[of S T] assms affine_imp_convex by auto |
|
49531 | 7869 |
qed |
7870 |
||
7871 |
lemma convex_affine_rel_interior_inter: |
|
53348 | 7872 |
fixes S T :: "'n::euclidean_space set" |
7873 |
assumes "convex S" |
|
7874 |
and "affine T" |
|
7875 |
and "rel_interior S \<inter> T \<noteq> {}" |
|
7876 |
shows "rel_interior (S \<inter> T) = rel_interior S \<inter> T" |
|
7877 |
proof - |
|
7878 |
have "affine hull T = T" |
|
7879 |
using assms by auto |
|
7880 |
then have "rel_interior T = T" |
|
7881 |
using rel_interior_univ[of T] by metis |
|
7882 |
moreover have "closure T = T" |
|
7883 |
using assms affine_closed[of T] by auto |
|
7884 |
ultimately show ?thesis |
|
7885 |
using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto |
|
40377 | 7886 |
qed |
7887 |
||
7888 |
lemma subset_rel_interior_convex: |
|
53348 | 7889 |
fixes S T :: "'n::euclidean_space set" |
7890 |
assumes "convex S" |
|
7891 |
and "convex T" |
|
7892 |
and "S \<le> closure T" |
|
7893 |
and "\<not> S \<subseteq> rel_frontier T" |
|
7894 |
shows "rel_interior S \<subseteq> rel_interior T" |
|
7895 |
proof - |
|
7896 |
have *: "S \<inter> closure T = S" |
|
7897 |
using assms by auto |
|
7898 |
have "\<not> rel_interior S \<subseteq> rel_frontier T" |
|
7899 |
using closure_mono[of "rel_interior S" "rel_frontier T"] closed_rel_frontier[of T] |
|
7900 |
closure_closed[of S] convex_closure_rel_interior[of S] closure_subset[of S] assms |
|
7901 |
by auto |
|
7902 |
then have "rel_interior S \<inter> rel_interior (closure T) \<noteq> {}" |
|
7903 |
using assms rel_frontier_def[of T] rel_interior_subset convex_rel_interior_closure[of T] |
|
7904 |
by auto |
|
7905 |
then have "rel_interior S \<inter> rel_interior T = rel_interior (S \<inter> closure T)" |
|
7906 |
using assms convex_closure convex_rel_interior_inter_two[of S "closure T"] |
|
7907 |
convex_rel_interior_closure[of T] |
|
7908 |
by auto |
|
7909 |
also have "\<dots> = rel_interior S" |
|
7910 |
using * by auto |
|
7911 |
finally show ?thesis |
|
7912 |
by auto |
|
7913 |
qed |
|
40377 | 7914 |
|
7915 |
lemma rel_interior_convex_linear_image: |
|
53348 | 7916 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
7917 |
assumes "linear f" |
|
7918 |
and "convex S" |
|
7919 |
shows "f ` (rel_interior S) = rel_interior (f ` S)" |
|
7920 |
proof (cases "S = {}") |
|
7921 |
case True |
|
7922 |
then show ?thesis |
|
7923 |
using assms rel_interior_empty rel_interior_convex_nonempty by auto |
|
7924 |
next |
|
7925 |
case False |
|
7926 |
have *: "f ` (rel_interior S) \<subseteq> f ` S" |
|
7927 |
unfolding image_mono using rel_interior_subset by auto |
|
7928 |
have "f ` S \<subseteq> f ` (closure S)" |
|
7929 |
unfolding image_mono using closure_subset by auto |
|
7930 |
also have "\<dots> = f ` (closure (rel_interior S))" |
|
7931 |
using convex_closure_rel_interior assms by auto |
|
7932 |
also have "\<dots> \<subseteq> closure (f ` (rel_interior S))" |
|
7933 |
using closure_linear_image assms by auto |
|
7934 |
finally have "closure (f ` S) = closure (f ` rel_interior S)" |
|
7935 |
using closure_mono[of "f ` S" "closure (f ` rel_interior S)"] closure_closure |
|
7936 |
closure_mono[of "f ` rel_interior S" "f ` S"] * |
|
7937 |
by auto |
|
7938 |
then have "rel_interior (f ` S) = rel_interior (f ` rel_interior S)" |
|
7939 |
using assms convex_rel_interior |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
7940 |
linear_conv_bounded_linear[of f] convex_linear_image[of _ S] |
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
7941 |
convex_linear_image[of _ "rel_interior S"] |
53348 | 7942 |
closure_eq_rel_interior_eq[of "f ` S" "f ` rel_interior S"] |
7943 |
by auto |
|
7944 |
then have "rel_interior (f ` S) \<subseteq> f ` rel_interior S" |
|
7945 |
using rel_interior_subset by auto |
|
7946 |
moreover |
|
7947 |
{ |
|
7948 |
fix z |
|
7949 |
assume "z \<in> f ` rel_interior S" |
|
7950 |
then obtain z1 where z1: "z1 \<in> rel_interior S" "f z1 = z" by auto |
|
7951 |
{ |
|
7952 |
fix x |
|
7953 |
assume "x \<in> f ` S" |
|
7954 |
then obtain x1 where x1: "x1 \<in> S" "f x1 = x" by auto |
|
54465 | 7955 |
then obtain e where e: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S" |
53348 | 7956 |
using convex_rel_interior_iff[of S z1] `convex S` x1 z1 by auto |
7957 |
moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (1 - e) *\<^sub>R x + e *\<^sub>R z" |
|
7958 |
using x1 z1 `linear f` by (simp add: linear_add_cmul) |
|
7959 |
ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S" |
|
40377 | 7960 |
using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto |
53348 | 7961 |
then have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S" |
54465 | 7962 |
using e by auto |
53348 | 7963 |
} |
7964 |
then have "z \<in> rel_interior (f ` S)" |
|
7965 |
using convex_rel_interior_iff[of "f ` S" z] `convex S` |
|
54465 | 7966 |
`linear f` `S \<noteq> {}` convex_linear_image[of f S] linear_conv_bounded_linear[of f] |
53348 | 7967 |
by auto |
7968 |
} |
|
7969 |
ultimately show ?thesis by auto |
|
40377 | 7970 |
qed |
7971 |
||
7972 |
lemma rel_interior_convex_linear_preimage: |
|
53348 | 7973 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
7974 |
assumes "linear f" |
|
7975 |
and "convex S" |
|
7976 |
and "f -` (rel_interior S) \<noteq> {}" |
|
7977 |
shows "rel_interior (f -` S) = f -` (rel_interior S)" |
|
7978 |
proof - |
|
7979 |
have "S \<noteq> {}" |
|
7980 |
using assms rel_interior_empty by auto |
|
7981 |
have nonemp: "f -` S \<noteq> {}" |
|
7982 |
by (metis assms(3) rel_interior_subset subset_empty vimage_mono) |
|
7983 |
then have "S \<inter> (range f) \<noteq> {}" |
|
7984 |
by auto |
|
7985 |
have conv: "convex (f -` S)" |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
7986 |
using convex_linear_vimage assms by auto |
53348 | 7987 |
then have "convex (S \<inter> range f)" |
7988 |
by (metis assms(1) assms(2) convex_Int subspace_UNIV subspace_imp_convex subspace_linear_image) |
|
7989 |
{ |
|
7990 |
fix z |
|
7991 |
assume "z \<in> f -` (rel_interior S)" |
|
7992 |
then have z: "f z : rel_interior S" |
|
7993 |
by auto |
|
7994 |
{ |
|
7995 |
fix x |
|
7996 |
assume "x \<in> f -` S" |
|
7997 |
then have "f x \<in> S" by auto |
|
7998 |
then obtain e where e: "e > 1" "(1 - e) *\<^sub>R f x + e *\<^sub>R f z \<in> S" |
|
7999 |
using convex_rel_interior_iff[of S "f z"] z assms `S \<noteq> {}` by auto |
|
8000 |
moreover have "(1 - e) *\<^sub>R f x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R x + e *\<^sub>R z)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
8001 |
using `linear f` by (simp add: linear_iff) |
53348 | 8002 |
ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R z \<in> f -` S" |
8003 |
using e by auto |
|
8004 |
} |
|
8005 |
then have "z \<in> rel_interior (f -` S)" |
|
8006 |
using convex_rel_interior_iff[of "f -` S" z] conv nonemp by auto |
|
8007 |
} |
|
8008 |
moreover |
|
54465 | 8009 |
{ |
53348 | 8010 |
fix z |
8011 |
assume z: "z \<in> rel_interior (f -` S)" |
|
8012 |
{ |
|
8013 |
fix x |
|
8014 |
assume "x \<in> S \<inter> range f" |
|
8015 |
then obtain y where y: "f y = x" "y \<in> f -` S" by auto |
|
8016 |
then obtain e where e: "e > 1" "(1 - e) *\<^sub>R y + e *\<^sub>R z \<in> f -` S" |
|
8017 |
using convex_rel_interior_iff[of "f -` S" z] z conv by auto |
|
8018 |
moreover have "(1 - e) *\<^sub>R x + e *\<^sub>R f z = f ((1 - e) *\<^sub>R y + e *\<^sub>R z)" |
|
53600
8fda7ad57466
make 'linear' into a sublocale of 'bounded_linear';
huffman
parents:
53406
diff
changeset
|
8019 |
using `linear f` y by (simp add: linear_iff) |
53348 | 8020 |
ultimately have "\<exists>e. e > 1 \<and> (1 - e) *\<^sub>R x + e *\<^sub>R f z \<in> S \<inter> range f" |
8021 |
using e by auto |
|
8022 |
} |
|
8023 |
then have "f z \<in> rel_interior (S \<inter> range f)" |
|
54465 | 8024 |
using `convex (S \<inter> (range f))` `S \<inter> range f \<noteq> {}` |
53348 | 8025 |
convex_rel_interior_iff[of "S \<inter> (range f)" "f z"] |
8026 |
by auto |
|
8027 |
moreover have "affine (range f)" |
|
8028 |
by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image) |
|
8029 |
ultimately have "f z \<in> rel_interior S" |
|
8030 |
using convex_affine_rel_interior_inter[of S "range f"] assms by auto |
|
8031 |
then have "z \<in> f -` (rel_interior S)" |
|
8032 |
by auto |
|
8033 |
} |
|
8034 |
ultimately show ?thesis by auto |
|
40377 | 8035 |
qed |
49531 | 8036 |
|
40377 | 8037 |
lemma rel_interior_direct_sum: |
53348 | 8038 |
fixes S :: "'n::euclidean_space set" |
8039 |
and T :: "'m::euclidean_space set" |
|
8040 |
assumes "convex S" |
|
8041 |
and "convex T" |
|
8042 |
shows "rel_interior (S \<times> T) = rel_interior S \<times> rel_interior T" |
|
8043 |
proof - |
|
8044 |
{ |
|
8045 |
assume "S = {}" |
|
8046 |
then have ?thesis |
|
8047 |
apply auto |
|
8048 |
using rel_interior_empty |
|
8049 |
apply auto |
|
8050 |
done |
|
8051 |
} |
|
8052 |
moreover |
|
8053 |
{ |
|
8054 |
assume "T = {}" |
|
8055 |
then have ?thesis |
|
8056 |
apply auto |
|
8057 |
using rel_interior_empty |
|
8058 |
apply auto |
|
8059 |
done |
|
8060 |
} |
|
8061 |
moreover |
|
8062 |
{ |
|
8063 |
assume "S \<noteq> {}" "T \<noteq> {}" |
|
8064 |
then have ri: "rel_interior S \<noteq> {}" "rel_interior T \<noteq> {}" |
|
8065 |
using rel_interior_convex_nonempty assms by auto |
|
8066 |
then have "fst -` rel_interior S \<noteq> {}" |
|
8067 |
using fst_vimage_eq_Times[of "rel_interior S"] by auto |
|
8068 |
then have "rel_interior ((fst :: 'n * 'm \<Rightarrow> 'n) -` S) = fst -` rel_interior S" |
|
8069 |
using fst_linear `convex S` rel_interior_convex_linear_preimage[of fst S] by auto |
|
8070 |
then have s: "rel_interior (S \<times> (UNIV :: 'm set)) = rel_interior S \<times> UNIV" |
|
8071 |
by (simp add: fst_vimage_eq_Times) |
|
8072 |
from ri have "snd -` rel_interior T \<noteq> {}" |
|
8073 |
using snd_vimage_eq_Times[of "rel_interior T"] by auto |
|
8074 |
then have "rel_interior ((snd :: 'n * 'm \<Rightarrow> 'm) -` T) = snd -` rel_interior T" |
|
8075 |
using snd_linear `convex T` rel_interior_convex_linear_preimage[of snd T] by auto |
|
8076 |
then have t: "rel_interior ((UNIV :: 'n set) \<times> T) = UNIV \<times> rel_interior T" |
|
8077 |
by (simp add: snd_vimage_eq_Times) |
|
8078 |
from s t have *: "rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T) = |
|
8079 |
rel_interior S \<times> rel_interior T" by auto |
|
8080 |
have "S \<times> T = S \<times> (UNIV :: 'm set) \<inter> (UNIV :: 'n set) \<times> T" |
|
8081 |
by auto |
|
8082 |
then have "rel_interior (S \<times> T) = rel_interior ((S \<times> (UNIV :: 'm set)) \<inter> ((UNIV :: 'n set) \<times> T))" |
|
8083 |
by auto |
|
8084 |
also have "\<dots> = rel_interior (S \<times> (UNIV :: 'm set)) \<inter> rel_interior ((UNIV :: 'n set) \<times> T)" |
|
55787 | 8085 |
apply (subst convex_rel_interior_inter_two[of "S \<times> (UNIV :: 'm set)" "(UNIV :: 'n set) \<times> T"]) |
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
8086 |
using * ri assms convex_Times |
53348 | 8087 |
apply auto |
8088 |
done |
|
8089 |
finally have ?thesis using * by auto |
|
8090 |
} |
|
8091 |
ultimately show ?thesis by blast |
|
40377 | 8092 |
qed |
8093 |
||
49531 | 8094 |
lemma rel_interior_scaleR: |
53348 | 8095 |
fixes S :: "'n::euclidean_space set" |
8096 |
assumes "c \<noteq> 0" |
|
8097 |
shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)" |
|
8098 |
using rel_interior_injective_linear_image[of "(op *\<^sub>R c)" S] |
|
8099 |
linear_conv_bounded_linear[of "op *\<^sub>R c"] linear_scaleR injective_scaleR[of c] assms |
|
8100 |
by auto |
|
40377 | 8101 |
|
49531 | 8102 |
lemma rel_interior_convex_scaleR: |
53348 | 8103 |
fixes S :: "'n::euclidean_space set" |
8104 |
assumes "convex S" |
|
8105 |
shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)" |
|
8106 |
by (metis assms linear_scaleR rel_interior_convex_linear_image) |
|
40377 | 8107 |
|
49531 | 8108 |
lemma convex_rel_open_scaleR: |
53348 | 8109 |
fixes S :: "'n::euclidean_space set" |
8110 |
assumes "convex S" |
|
8111 |
and "rel_open S" |
|
8112 |
shows "convex ((op *\<^sub>R c) ` S) \<and> rel_open ((op *\<^sub>R c) ` S)" |
|
8113 |
by (metis assms convex_scaling rel_interior_convex_scaleR rel_open_def) |
|
40377 | 8114 |
|
49531 | 8115 |
lemma convex_rel_open_finite_inter: |
53348 | 8116 |
assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set) \<and> rel_open S" |
8117 |
and "finite I" |
|
8118 |
shows "convex (\<Inter>I) \<and> rel_open (\<Inter>I)" |
|
54465 | 8119 |
proof (cases "\<Inter>{rel_interior S |S. S \<in> I} = {}") |
53348 | 8120 |
case True |
8121 |
then have "\<Inter>I = {}" |
|
8122 |
using assms unfolding rel_open_def by auto |
|
8123 |
then show ?thesis |
|
8124 |
unfolding rel_open_def using rel_interior_empty by auto |
|
8125 |
next |
|
8126 |
case False |
|
54465 | 8127 |
then have "rel_open (\<Inter>I)" |
53348 | 8128 |
using assms unfolding rel_open_def |
8129 |
using convex_rel_interior_finite_inter[of I] |
|
8130 |
by auto |
|
8131 |
then show ?thesis |
|
8132 |
using convex_Inter assms by auto |
|
40377 | 8133 |
qed |
8134 |
||
8135 |
lemma convex_rel_open_linear_image: |
|
53348 | 8136 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
8137 |
assumes "linear f" |
|
8138 |
and "convex S" |
|
8139 |
and "rel_open S" |
|
8140 |
shows "convex (f ` S) \<and> rel_open (f ` S)" |
|
8141 |
by (metis assms convex_linear_image rel_interior_convex_linear_image |
|
8142 |
linear_conv_bounded_linear rel_open_def) |
|
40377 | 8143 |
|
8144 |
lemma convex_rel_open_linear_preimage: |
|
53348 | 8145 |
fixes f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space" |
8146 |
assumes "linear f" |
|
8147 |
and "convex S" |
|
8148 |
and "rel_open S" |
|
8149 |
shows "convex (f -` S) \<and> rel_open (f -` S)" |
|
8150 |
proof (cases "f -` (rel_interior S) = {}") |
|
8151 |
case True |
|
8152 |
then have "f -` S = {}" |
|
8153 |
using assms unfolding rel_open_def by auto |
|
8154 |
then show ?thesis |
|
8155 |
unfolding rel_open_def using rel_interior_empty by auto |
|
8156 |
next |
|
8157 |
case False |
|
8158 |
then have "rel_open (f -` S)" |
|
8159 |
using assms unfolding rel_open_def |
|
8160 |
using rel_interior_convex_linear_preimage[of f S] |
|
8161 |
by auto |
|
8162 |
then show ?thesis |
|
53620
3c7f5e7926dc
generalized and simplified proofs of several theorems about convex sets
huffman
parents:
53600
diff
changeset
|
8163 |
using convex_linear_vimage assms |
53348 | 8164 |
by auto |
40377 | 8165 |
qed |
8166 |
||
8167 |
lemma rel_interior_projection: |
|
53348 | 8168 |
fixes S :: "('m::euclidean_space \<times> 'n::euclidean_space) set" |
8169 |
and f :: "'m::euclidean_space \<Rightarrow> 'n::euclidean_space set" |
|
8170 |
assumes "convex S" |
|
8171 |
and "f = (\<lambda>y. {z. (y, z) \<in> S})" |
|
8172 |
shows "(y, z) \<in> rel_interior S \<longleftrightarrow> (y \<in> rel_interior {y. (f y \<noteq> {})} \<and> z \<in> rel_interior (f y))" |
|
8173 |
proof - |
|
8174 |
{ |
|
8175 |
fix y |
|
8176 |
assume "y \<in> {y. f y \<noteq> {}}" |
|
8177 |
then obtain z where "(y, z) \<in> S" |
|
8178 |
using assms by auto |
|
8179 |
then have "\<exists>x. x \<in> S \<and> y = fst x" |
|
8180 |
apply (rule_tac x="(y, z)" in exI) |
|
8181 |
apply auto |
|
8182 |
done |
|
8183 |
then obtain x where "x \<in> S" "y = fst x" |
|
8184 |
by blast |
|
8185 |
then have "y \<in> fst ` S" |
|
8186 |
unfolding image_def by auto |
|
40377 | 8187 |
} |
53348 | 8188 |
then have "fst ` S = {y. f y \<noteq> {}}" |
8189 |
unfolding fst_def using assms by auto |
|
8190 |
then have h1: "fst ` rel_interior S = rel_interior {y. f y \<noteq> {}}" |
|
8191 |
using rel_interior_convex_linear_image[of fst S] assms fst_linear by auto |
|
8192 |
{ |
|
8193 |
fix y |
|
8194 |
assume "y \<in> rel_interior {y. f y \<noteq> {}}" |
|
8195 |
then have "y \<in> fst ` rel_interior S" |
|
8196 |
using h1 by auto |
|
8197 |
then have *: "rel_interior S \<inter> fst -` {y} \<noteq> {}" |
|
8198 |
by auto |
|
8199 |
moreover have aff: "affine (fst -` {y})" |
|
8200 |
unfolding affine_alt by (simp add: algebra_simps) |
|
8201 |
ultimately have **: "rel_interior (S \<inter> fst -` {y}) = rel_interior S \<inter> fst -` {y}" |
|
8202 |
using convex_affine_rel_interior_inter[of S "fst -` {y}"] assms by auto |
|
8203 |
have conv: "convex (S \<inter> fst -` {y})" |
|
8204 |
using convex_Int assms aff affine_imp_convex by auto |
|
8205 |
{ |
|
8206 |
fix x |
|
8207 |
assume "x \<in> f y" |
|
8208 |
then have "(y, x) \<in> S \<inter> (fst -` {y})" |
|
8209 |
using assms by auto |
|
8210 |
moreover have "x = snd (y, x)" by auto |
|
8211 |
ultimately have "x \<in> snd ` (S \<inter> fst -` {y})" |
|
8212 |
by blast |
|
8213 |
} |
|
8214 |
then have "snd ` (S \<inter> fst -` {y}) = f y" |
|
8215 |
using assms by auto |
|
8216 |
then have ***: "rel_interior (f y) = snd ` rel_interior (S \<inter> fst -` {y})" |
|
8217 |
using rel_interior_convex_linear_image[of snd "S \<inter> fst -` {y}"] snd_linear conv |
|
8218 |
by auto |
|
8219 |
{ |
|
8220 |
fix z |
|
8221 |
assume "z \<in> rel_interior (f y)" |
|
8222 |
then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})" |
|
8223 |
using *** by auto |
|
8224 |
moreover have "{y} = fst ` rel_interior (S \<inter> fst -` {y})" |
|
8225 |
using * ** rel_interior_subset by auto |
|
8226 |
ultimately have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})" |
|
8227 |
by force |
|
8228 |
then have "(y,z) \<in> rel_interior S" |
|
8229 |
using ** by auto |
|
8230 |
} |
|
8231 |
moreover |
|
8232 |
{ |
|
8233 |
fix z |
|
8234 |
assume "(y, z) \<in> rel_interior S" |
|
8235 |
then have "(y, z) \<in> rel_interior (S \<inter> fst -` {y})" |
|
8236 |
using ** by auto |
|
8237 |
then have "z \<in> snd ` rel_interior (S \<inter> fst -` {y})" |
|
8238 |
by (metis Range_iff snd_eq_Range) |
|
8239 |
then have "z \<in> rel_interior (f y)" |
|
8240 |
using *** by auto |
|
8241 |
} |
|
8242 |
ultimately have "\<And>z. (y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)" |
|
8243 |
by auto |
|
40377 | 8244 |
} |
53348 | 8245 |
then have h2: "\<And>y z. y \<in> rel_interior {t. f t \<noteq> {}} \<Longrightarrow> |
8246 |
(y, z) \<in> rel_interior S \<longleftrightarrow> z \<in> rel_interior (f y)" |
|
8247 |
by auto |
|
8248 |
{ |
|
8249 |
fix y z |
|
8250 |
assume asm: "(y, z) \<in> rel_interior S" |
|
8251 |
then have "y \<in> fst ` rel_interior S" |
|
8252 |
by (metis Domain_iff fst_eq_Domain) |
|
8253 |
then have "y \<in> rel_interior {t. f t \<noteq> {}}" |
|
8254 |
using h1 by auto |
|
8255 |
then have "y \<in> rel_interior {t. f t \<noteq> {}}" and "(z : rel_interior (f y))" |
|
8256 |
using h2 asm by auto |
|
40377 | 8257 |
} |
53348 | 8258 |
then show ?thesis using h2 by blast |
8259 |
qed |
|
8260 |
||
40377 | 8261 |
|
44467 | 8262 |
subsubsection {* Relative interior of convex cone *} |
40377 | 8263 |
|
8264 |
lemma cone_rel_interior: |
|
53348 | 8265 |
fixes S :: "'m::euclidean_space set" |
8266 |
assumes "cone S" |
|
8267 |
shows "cone ({0} \<union> rel_interior S)" |
|
8268 |
proof (cases "S = {}") |
|
8269 |
case True |
|
8270 |
then show ?thesis |
|
8271 |
by (simp add: rel_interior_empty cone_0) |
|
8272 |
next |
|
8273 |
case False |
|
8274 |
then have *: "0 \<in> S \<and> (\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` S = S)" |
|
8275 |
using cone_iff[of S] assms by auto |
|
8276 |
then have *: "0 \<in> ({0} \<union> rel_interior S)" |
|
54465 | 8277 |
and "\<forall>c. c > 0 \<longrightarrow> op *\<^sub>R c ` ({0} \<union> rel_interior S) = ({0} \<union> rel_interior S)" |
53348 | 8278 |
by (auto simp add: rel_interior_scaleR) |
8279 |
then show ?thesis |
|
54465 | 8280 |
using cone_iff[of "{0} \<union> rel_interior S"] by auto |
40377 | 8281 |
qed |
8282 |
||
8283 |
lemma rel_interior_convex_cone_aux: |
|
54465 | 8284 |
fixes S :: "'m::euclidean_space set" |
8285 |
assumes "convex S" |
|
55787 | 8286 |
shows "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) \<longleftrightarrow> |
54465 | 8287 |
c > 0 \<and> x \<in> ((op *\<^sub>R c) ` (rel_interior S))" |
8288 |
proof (cases "S = {}") |
|
8289 |
case True |
|
8290 |
then show ?thesis |
|
8291 |
by (simp add: rel_interior_empty cone_hull_empty) |
|
8292 |
next |
|
8293 |
case False |
|
8294 |
then obtain s where "s \<in> S" by auto |
|
55787 | 8295 |
have conv: "convex ({(1 :: real)} \<times> S)" |
54465 | 8296 |
using convex_Times[of "{(1 :: real)}" S] assms convex_singleton[of "1 :: real"] |
8297 |
by auto |
|
55787 | 8298 |
def f \<equiv> "\<lambda>y. {z. (y, z) \<in> cone hull ({1 :: real} \<times> S)}" |
8299 |
then have *: "(c, x) \<in> rel_interior (cone hull ({(1 :: real)} \<times> S)) = |
|
54465 | 8300 |
(c \<in> rel_interior {y. f y \<noteq> {}} \<and> x \<in> rel_interior (f c))" |
55787 | 8301 |
apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} \<times> S)" f c x]) |
8302 |
using convex_cone_hull[of "{(1 :: real)} \<times> S"] conv |
|
54465 | 8303 |
apply auto |
8304 |
done |
|
8305 |
{ |
|
8306 |
fix y :: real |
|
8307 |
assume "y \<ge> 0" |
|
55787 | 8308 |
then have "y *\<^sub>R (1,s) \<in> cone hull ({1 :: real} \<times> S)" |
8309 |
using cone_hull_expl[of "{(1 :: real)} \<times> S"] `s \<in> S` by auto |
|
54465 | 8310 |
then have "f y \<noteq> {}" |
8311 |
using f_def by auto |
|
8312 |
} |
|
8313 |
then have "{y. f y \<noteq> {}} = {0..}" |
|
55787 | 8314 |
using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto |
54465 | 8315 |
then have **: "rel_interior {y. f y \<noteq> {}} = {0<..}" |
8316 |
using rel_interior_real_semiline by auto |
|
8317 |
{ |
|
8318 |
fix c :: real |
|
8319 |
assume "c > 0" |
|
8320 |
then have "f c = (op *\<^sub>R c ` S)" |
|
55787 | 8321 |
using f_def cone_hull_expl[of "{1 :: real} \<times> S"] by auto |
54465 | 8322 |
then have "rel_interior (f c) = op *\<^sub>R c ` rel_interior S" |
8323 |
using rel_interior_convex_scaleR[of S c] assms by auto |
|
8324 |
} |
|
8325 |
then show ?thesis using * ** by auto |
|
8326 |
qed |
|
40377 | 8327 |
|
8328 |
lemma rel_interior_convex_cone: |
|
54465 | 8329 |
fixes S :: "'m::euclidean_space set" |
8330 |
assumes "convex S" |
|
55787 | 8331 |
shows "rel_interior (cone hull ({1 :: real} \<times> S)) = |
54465 | 8332 |
{(c, c *\<^sub>R x) | c x. c > 0 \<and> x \<in> rel_interior S}" |
8333 |
(is "?lhs = ?rhs") |
|
8334 |
proof - |
|
8335 |
{ |
|
8336 |
fix z |
|
8337 |
assume "z \<in> ?lhs" |
|
8338 |
have *: "z = (fst z, snd z)" |
|
8339 |
by auto |
|
8340 |
have "z \<in> ?rhs" |
|
8341 |
using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms `z \<in> ?lhs` |
|
8342 |
apply auto |
|
8343 |
apply (rule_tac x = "fst z" in exI) |
|
8344 |
apply (rule_tac x = x in exI) |
|
8345 |
using * |
|
8346 |
apply auto |
|
8347 |
done |
|
8348 |
} |
|
8349 |
moreover |
|
8350 |
{ |
|
8351 |
fix z |
|
8352 |
assume "z \<in> ?rhs" |
|
8353 |
then have "z \<in> ?lhs" |
|
8354 |
using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms |
|
8355 |
by auto |
|
8356 |
} |
|
8357 |
ultimately show ?thesis by blast |
|
40377 | 8358 |
qed |
8359 |
||
8360 |
lemma convex_hull_finite_union: |
|
54465 | 8361 |
assumes "finite I" |
8362 |
assumes "\<forall>i\<in>I. convex (S i) \<and> (S i) \<noteq> {}" |
|
8363 |
shows "convex hull (\<Union>(S ` I)) = |
|
8364 |
{setsum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)}" |
|
40377 | 8365 |
(is "?lhs = ?rhs") |
54465 | 8366 |
proof - |
8367 |
have "?lhs \<supseteq> ?rhs" |
|
8368 |
proof |
|
8369 |
fix x |
|
8370 |
assume "x : ?rhs" |
|
8371 |
then obtain c s where *: "setsum (\<lambda>i. c i *\<^sub>R s i) I = x" "setsum c I = 1" |
|
8372 |
"(\<forall>i\<in>I. c i \<ge> 0) \<and> (\<forall>i\<in>I. s i \<in> S i)" by auto |
|
8373 |
then have "\<forall>i\<in>I. s i \<in> convex hull (\<Union>(S ` I))" |
|
8374 |
using hull_subset[of "\<Union>(S ` I)" convex] by auto |
|
8375 |
then show "x \<in> ?lhs" |
|
8376 |
unfolding *(1)[symmetric] |
|
8377 |
apply (subst convex_setsum[of I "convex hull \<Union>(S ` I)" c s]) |
|
8378 |
using * assms convex_convex_hull |
|
8379 |
apply auto |
|
8380 |
done |
|
8381 |
qed |
|
8382 |
||
8383 |
{ |
|
8384 |
fix i |
|
8385 |
assume "i \<in> I" |
|
8386 |
with assms have "\<exists>p. p \<in> S i" by auto |
|
8387 |
} |
|
8388 |
then obtain p where p: "\<forall>i\<in>I. p i \<in> S i" by metis |
|
8389 |
||
8390 |
{ |
|
8391 |
fix i |
|
8392 |
assume "i \<in> I" |
|
8393 |
{ |
|
8394 |
fix x |
|
8395 |
assume "x \<in> S i" |
|
8396 |
def c \<equiv> "\<lambda>j. if j = i then 1::real else 0" |
|
8397 |
then have *: "setsum c I = 1" |
|
57418 | 8398 |
using `finite I` `i \<in> I` setsum.delta[of I i "\<lambda>j::'a. 1::real"] |
54465 | 8399 |
by auto |
8400 |
def s \<equiv> "\<lambda>j. if j = i then x else p j" |
|
8401 |
then have "\<forall>j. c j *\<^sub>R s j = (if j = i then x else 0)" |
|
8402 |
using c_def by (auto simp add: algebra_simps) |
|
8403 |
then have "x = setsum (\<lambda>i. c i *\<^sub>R s i) I" |
|
57418 | 8404 |
using s_def c_def `finite I` `i \<in> I` setsum.delta[of I i "\<lambda>j::'a. x"] |
54465 | 8405 |
by auto |
8406 |
then have "x \<in> ?rhs" |
|
8407 |
apply auto |
|
8408 |
apply (rule_tac x = c in exI) |
|
8409 |
apply (rule_tac x = s in exI) |
|
8410 |
using * c_def s_def p `x \<in> S i` |
|
8411 |
apply auto |
|
8412 |
done |
|
40377 | 8413 |
} |
54465 | 8414 |
then have "?rhs \<supseteq> S i" by auto |
8415 |
} |
|
8416 |
then have *: "?rhs \<supseteq> \<Union>(S ` I)" by auto |
|
8417 |
||
8418 |
{ |
|
8419 |
fix u v :: real |
|
8420 |
assume uv: "u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1" |
|
8421 |
fix x y |
|
8422 |
assume xy: "x \<in> ?rhs \<and> y \<in> ?rhs" |
|
8423 |
from xy obtain c s where |
|
8424 |
xc: "x = setsum (\<lambda>i. c i *\<^sub>R s i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> S i)" |
|
8425 |
by auto |
|
8426 |
from xy obtain d t where |
|
8427 |
yc: "y = setsum (\<lambda>i. d i *\<^sub>R t i) I \<and> (\<forall>i\<in>I. d i \<ge> 0) \<and> setsum d I = 1 \<and> (\<forall>i\<in>I. t i \<in> S i)" |
|
8428 |
by auto |
|
8429 |
def e \<equiv> "\<lambda>i. u * c i + v * d i" |
|
8430 |
have ge0: "\<forall>i\<in>I. e i \<ge> 0" |
|
56536 | 8431 |
using e_def xc yc uv by simp |
54465 | 8432 |
have "setsum (\<lambda>i. u * c i) I = u * setsum c I" |
8433 |
by (simp add: setsum_right_distrib) |
|
8434 |
moreover have "setsum (\<lambda>i. v * d i) I = v * setsum d I" |
|
8435 |
by (simp add: setsum_right_distrib) |
|
8436 |
ultimately have sum1: "setsum e I = 1" |
|
57418 | 8437 |
using e_def xc yc uv by (simp add: setsum.distrib) |
54465 | 8438 |
def q \<equiv> "\<lambda>i. if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i" |
8439 |
{ |
|
8440 |
fix i |
|
8441 |
assume i: "i \<in> I" |
|
8442 |
have "q i \<in> S i" |
|
8443 |
proof (cases "e i = 0") |
|
8444 |
case True |
|
8445 |
then show ?thesis using i p q_def by auto |
|
8446 |
next |
|
8447 |
case False |
|
8448 |
then show ?thesis |
|
8449 |
using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"] |
|
8450 |
mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"] |
|
8451 |
assms q_def e_def i False xc yc uv |
|
56536 | 8452 |
by (auto simp del: mult_nonneg_nonneg) |
54465 | 8453 |
qed |
8454 |
} |
|
8455 |
then have qs: "\<forall>i\<in>I. q i \<in> S i" by auto |
|
8456 |
{ |
|
8457 |
fix i |
|
8458 |
assume i: "i \<in> I" |
|
8459 |
have "(u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i" |
|
8460 |
proof (cases "e i = 0") |
|
8461 |
case True |
|
8462 |
have ge: "u * (c i) \<ge> 0 \<and> v * d i \<ge> 0" |
|
56536 | 8463 |
using xc yc uv i by simp |
54465 | 8464 |
moreover from ge have "u * c i \<le> 0 \<and> v * d i \<le> 0" |
8465 |
using True e_def i by simp |
|
8466 |
ultimately have "u * c i = 0 \<and> v * d i = 0" by auto |
|
8467 |
with True show ?thesis by auto |
|
8468 |
next |
|
8469 |
case False |
|
8470 |
then have "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i" |
|
8471 |
using q_def by auto |
|
8472 |
then have "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i)) |
|
8473 |
= (e i) *\<^sub>R (q i)" by auto |
|
8474 |
with False show ?thesis by (simp add: algebra_simps) |
|
8475 |
qed |
|
8476 |
} |
|
8477 |
then have *: "\<forall>i\<in>I. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i" |
|
8478 |
by auto |
|
8479 |
have "u *\<^sub>R x + v *\<^sub>R y = setsum (\<lambda>i. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i) I" |
|
57418 | 8480 |
using xc yc by (simp add: algebra_simps scaleR_right.setsum setsum.distrib) |
54465 | 8481 |
also have "\<dots> = setsum (\<lambda>i. e i *\<^sub>R q i) I" |
8482 |
using * by auto |
|
8483 |
finally have "u *\<^sub>R x + v *\<^sub>R y = setsum (\<lambda>i. (e i) *\<^sub>R (q i)) I" |
|
8484 |
by auto |
|
8485 |
then have "u *\<^sub>R x + v *\<^sub>R y \<in> ?rhs" |
|
8486 |
using ge0 sum1 qs by auto |
|
8487 |
} |
|
8488 |
then have "convex ?rhs" unfolding convex_def by auto |
|
8489 |
then show ?thesis |
|
8490 |
using `?lhs \<supseteq> ?rhs` * hull_minimal[of "\<Union>(S ` I)" ?rhs convex] |
|
8491 |
by blast |
|
40377 | 8492 |
qed |
8493 |
||
8494 |
lemma convex_hull_union_two: |
|
54465 | 8495 |
fixes S T :: "'m::euclidean_space set" |
8496 |
assumes "convex S" |
|
8497 |
and "S \<noteq> {}" |
|
8498 |
and "convex T" |
|
8499 |
and "T \<noteq> {}" |
|
8500 |
shows "convex hull (S \<union> T) = |
|
8501 |
{u *\<^sub>R s + v *\<^sub>R t | u v s t. u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T}" |
|
40377 | 8502 |
(is "?lhs = ?rhs") |
54465 | 8503 |
proof |
8504 |
def I \<equiv> "{1::nat, 2}" |
|
8505 |
def s \<equiv> "\<lambda>i. if i = (1::nat) then S else T" |
|
8506 |
have "\<Union>(s ` I) = S \<union> T" |
|
8507 |
using s_def I_def by auto |
|
8508 |
then have "convex hull (\<Union>(s ` I)) = convex hull (S \<union> T)" |
|
8509 |
by auto |
|
8510 |
moreover have "convex hull \<Union>(s ` I) = |
|
8511 |
{\<Sum> i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)}" |
|
8512 |
apply (subst convex_hull_finite_union[of I s]) |
|
8513 |
using assms s_def I_def |
|
8514 |
apply auto |
|
8515 |
done |
|
8516 |
moreover have |
|
8517 |
"{\<Sum>i\<in>I. c i *\<^sub>R sa i | c sa. (\<forall>i\<in>I. 0 \<le> c i) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. sa i \<in> s i)} \<le> ?rhs" |
|
8518 |
using s_def I_def by auto |
|
8519 |
ultimately show "?lhs \<subseteq> ?rhs" by auto |
|
8520 |
{ |
|
8521 |
fix x |
|
8522 |
assume "x \<in> ?rhs" |
|
8523 |
then obtain u v s t where *: "x = u *\<^sub>R s + v *\<^sub>R t \<and> u \<ge> 0 \<and> v \<ge> 0 \<and> u + v = 1 \<and> s \<in> S \<and> t \<in> T" |
|
8524 |
by auto |
|
8525 |
then have "x \<in> convex hull {s, t}" |
|
8526 |
using convex_hull_2[of s t] by auto |
|
8527 |
then have "x \<in> convex hull (S \<union> T)" |
|
8528 |
using * hull_mono[of "{s, t}" "S \<union> T"] by auto |
|
8529 |
} |
|
8530 |
then show "?lhs \<supseteq> ?rhs" by blast |
|
8531 |
qed |
|
8532 |
||
40377 | 8533 |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8534 |
subsection {* Convexity on direct sums *} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8535 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8536 |
lemma closure_sum: |
55928 | 8537 |
fixes S T :: "'a::real_normed_vector set" |
47445
69e96e5500df
Set_Algebras: removed syntax \<oplus> and \<otimes>, in favour of plain + and *
krauss
parents:
47444
diff
changeset
|
8538 |
shows "closure S + closure T \<subseteq> closure (S + T)" |
55928 | 8539 |
unfolding set_plus_image closure_Times [symmetric] split_def |
8540 |
by (intro closure_bounded_linear_image bounded_linear_add |
|
8541 |
bounded_linear_fst bounded_linear_snd) |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8542 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8543 |
lemma rel_interior_sum: |
54465 | 8544 |
fixes S T :: "'n::euclidean_space set" |
8545 |
assumes "convex S" |
|
8546 |
and "convex T" |
|
8547 |
shows "rel_interior (S + T) = rel_interior S + rel_interior T" |
|
8548 |
proof - |
|
55787 | 8549 |
have "rel_interior S + rel_interior T = (\<lambda>(x,y). x + y) ` (rel_interior S \<times> rel_interior T)" |
54465 | 8550 |
by (simp add: set_plus_image) |
55787 | 8551 |
also have "\<dots> = (\<lambda>(x,y). x + y) ` rel_interior (S \<times> T)" |
54465 | 8552 |
using rel_interior_direct_sum assms by auto |
8553 |
also have "\<dots> = rel_interior (S + T)" |
|
8554 |
using fst_snd_linear convex_Times assms |
|
55787 | 8555 |
rel_interior_convex_linear_image[of "(\<lambda>(x,y). x + y)" "S \<times> T"] |
54465 | 8556 |
by (auto simp add: set_plus_image) |
8557 |
finally show ?thesis .. |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8558 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8559 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8560 |
lemma rel_interior_sum_gen: |
54465 | 8561 |
fixes S :: "'a \<Rightarrow> 'n::euclidean_space set" |
8562 |
assumes "\<forall>i\<in>I. convex (S i)" |
|
8563 |
shows "rel_interior (setsum S I) = setsum (\<lambda>i. rel_interior (S i)) I" |
|
8564 |
apply (subst setsum_set_cond_linear[of convex]) |
|
8565 |
using rel_interior_sum rel_interior_sing[of "0"] assms |
|
55929
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
8566 |
apply (auto simp add: convex_set_plus) |
54465 | 8567 |
done |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8568 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8569 |
lemma convex_rel_open_direct_sum: |
54465 | 8570 |
fixes S T :: "'n::euclidean_space set" |
8571 |
assumes "convex S" |
|
8572 |
and "rel_open S" |
|
8573 |
and "convex T" |
|
8574 |
and "rel_open T" |
|
55787 | 8575 |
shows "convex (S \<times> T) \<and> rel_open (S \<times> T)" |
54465 | 8576 |
by (metis assms convex_Times rel_interior_direct_sum rel_open_def) |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8577 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8578 |
lemma convex_rel_open_sum: |
54465 | 8579 |
fixes S T :: "'n::euclidean_space set" |
8580 |
assumes "convex S" |
|
8581 |
and "rel_open S" |
|
8582 |
and "convex T" |
|
8583 |
and "rel_open T" |
|
8584 |
shows "convex (S + T) \<and> rel_open (S + T)" |
|
55929
91f245c23bc5
remove lemmas in favor of more general ones: convex(_hull)_set_{plus,setsum}
huffman
parents:
55928
diff
changeset
|
8585 |
by (metis assms convex_set_plus rel_interior_sum rel_open_def) |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8586 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8587 |
lemma convex_hull_finite_union_cones: |
54465 | 8588 |
assumes "finite I" |
8589 |
and "I \<noteq> {}" |
|
8590 |
assumes "\<forall>i\<in>I. convex (S i) \<and> cone (S i) \<and> S i \<noteq> {}" |
|
8591 |
shows "convex hull (\<Union>(S ` I)) = setsum S I" |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8592 |
(is "?lhs = ?rhs") |
54465 | 8593 |
proof - |
8594 |
{ |
|
8595 |
fix x |
|
8596 |
assume "x \<in> ?lhs" |
|
8597 |
then obtain c xs where |
|
8598 |
x: "x = setsum (\<lambda>i. c i *\<^sub>R xs i) I \<and> (\<forall>i\<in>I. c i \<ge> 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. xs i \<in> S i)" |
|
8599 |
using convex_hull_finite_union[of I S] assms by auto |
|
8600 |
def s \<equiv> "\<lambda>i. c i *\<^sub>R xs i" |
|
8601 |
{ |
|
8602 |
fix i |
|
8603 |
assume "i \<in> I" |
|
8604 |
then have "s i \<in> S i" |
|
8605 |
using s_def x assms mem_cone[of "S i" "xs i" "c i"] by auto |
|
8606 |
} |
|
8607 |
then have "\<forall>i\<in>I. s i \<in> S i" by auto |
|
8608 |
moreover have "x = setsum s I" using x s_def by auto |
|
8609 |
ultimately have "x \<in> ?rhs" |
|
8610 |
using set_setsum_alt[of I S] assms by auto |
|
8611 |
} |
|
8612 |
moreover |
|
8613 |
{ |
|
8614 |
fix x |
|
8615 |
assume "x \<in> ?rhs" |
|
8616 |
then obtain s where x: "x = setsum s I \<and> (\<forall>i\<in>I. s i \<in> S i)" |
|
8617 |
using set_setsum_alt[of I S] assms by auto |
|
8618 |
def xs \<equiv> "\<lambda>i. of_nat(card I) *\<^sub>R s i" |
|
8619 |
then have "x = setsum (\<lambda>i. ((1 :: real) / of_nat(card I)) *\<^sub>R xs i) I" |
|
8620 |
using x assms by auto |
|
8621 |
moreover have "\<forall>i\<in>I. xs i \<in> S i" |
|
8622 |
using x xs_def assms by (simp add: cone_def) |
|
8623 |
moreover have "\<forall>i\<in>I. (1 :: real) / of_nat (card I) \<ge> 0" |
|
8624 |
by auto |
|
8625 |
moreover have "setsum (\<lambda>i. (1 :: real) / of_nat (card I)) I = 1" |
|
8626 |
using assms by auto |
|
8627 |
ultimately have "x \<in> ?lhs" |
|
8628 |
apply (subst convex_hull_finite_union[of I S]) |
|
8629 |
using assms |
|
8630 |
apply blast |
|
8631 |
using assms |
|
8632 |
apply blast |
|
8633 |
apply rule |
|
8634 |
apply (rule_tac x = "(\<lambda>i. (1 :: real) / of_nat (card I))" in exI) |
|
8635 |
apply auto |
|
8636 |
done |
|
8637 |
} |
|
8638 |
ultimately show ?thesis by auto |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8639 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8640 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8641 |
lemma convex_hull_union_cones_two: |
54465 | 8642 |
fixes S T :: "'m::euclidean_space set" |
8643 |
assumes "convex S" |
|
8644 |
and "cone S" |
|
8645 |
and "S \<noteq> {}" |
|
8646 |
assumes "convex T" |
|
8647 |
and "cone T" |
|
8648 |
and "T \<noteq> {}" |
|
8649 |
shows "convex hull (S \<union> T) = S + T" |
|
8650 |
proof - |
|
8651 |
def I \<equiv> "{1::nat, 2}" |
|
8652 |
def A \<equiv> "(\<lambda>i. if i = (1::nat) then S else T)" |
|
8653 |
have "\<Union>(A ` I) = S \<union> T" |
|
8654 |
using A_def I_def by auto |
|
8655 |
then have "convex hull (\<Union>(A ` I)) = convex hull (S \<union> T)" |
|
8656 |
by auto |
|
8657 |
moreover have "convex hull \<Union>(A ` I) = setsum A I" |
|
8658 |
apply (subst convex_hull_finite_union_cones[of I A]) |
|
8659 |
using assms A_def I_def |
|
8660 |
apply auto |
|
8661 |
done |
|
8662 |
moreover have "setsum A I = S + T" |
|
8663 |
using A_def I_def |
|
8664 |
unfolding set_plus_def |
|
8665 |
apply auto |
|
8666 |
unfolding set_plus_def |
|
8667 |
apply auto |
|
8668 |
done |
|
8669 |
ultimately show ?thesis by auto |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8670 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8671 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8672 |
lemma rel_interior_convex_hull_union: |
54465 | 8673 |
fixes S :: "'a \<Rightarrow> 'n::euclidean_space set" |
8674 |
assumes "finite I" |
|
8675 |
and "\<forall>i\<in>I. convex (S i) \<and> S i \<noteq> {}" |
|
8676 |
shows "rel_interior (convex hull (\<Union>(S ` I))) = |
|
8677 |
{setsum (\<lambda>i. c i *\<^sub>R s i) I | c s. (\<forall>i\<in>I. c i > 0) \<and> setsum c I = 1 \<and> |
|
8678 |
(\<forall>i\<in>I. s i \<in> rel_interior(S i))}" |
|
8679 |
(is "?lhs = ?rhs") |
|
8680 |
proof (cases "I = {}") |
|
8681 |
case True |
|
8682 |
then show ?thesis |
|
8683 |
using convex_hull_empty rel_interior_empty by auto |
|
8684 |
next |
|
8685 |
case False |
|
8686 |
def C0 \<equiv> "convex hull (\<Union>(S ` I))" |
|
8687 |
have "\<forall>i\<in>I. C0 \<ge> S i" |
|
8688 |
unfolding C0_def using hull_subset[of "\<Union>(S ` I)"] by auto |
|
55787 | 8689 |
def K0 \<equiv> "cone hull ({1 :: real} \<times> C0)" |
8690 |
def K \<equiv> "\<lambda>i. cone hull ({1 :: real} \<times> S i)" |
|
54465 | 8691 |
have "\<forall>i\<in>I. K i \<noteq> {}" |
8692 |
unfolding K_def using assms |
|
8693 |
by (simp add: cone_hull_empty_iff[symmetric]) |
|
8694 |
{ |
|
8695 |
fix i |
|
8696 |
assume "i \<in> I" |
|
8697 |
then have "convex (K i)" |
|
8698 |
unfolding K_def |
|
8699 |
apply (subst convex_cone_hull) |
|
8700 |
apply (subst convex_Times) |
|
8701 |
using assms |
|
8702 |
apply auto |
|
8703 |
done |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8704 |
} |
54465 | 8705 |
then have convK: "\<forall>i\<in>I. convex (K i)" |
8706 |
by auto |
|
8707 |
{ |
|
8708 |
fix i |
|
8709 |
assume "i \<in> I" |
|
8710 |
then have "K0 \<supseteq> K i" |
|
8711 |
unfolding K0_def K_def |
|
8712 |
apply (subst hull_mono) |
|
8713 |
using `\<forall>i\<in>I. C0 \<ge> S i` |
|
8714 |
apply auto |
|
8715 |
done |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8716 |
} |
54465 | 8717 |
then have "K0 \<supseteq> \<Union>(K ` I)" by auto |
8718 |
moreover have "convex K0" |
|
8719 |
unfolding K0_def |
|
8720 |
apply (subst convex_cone_hull) |
|
8721 |
apply (subst convex_Times) |
|
8722 |
unfolding C0_def |
|
8723 |
using convex_convex_hull |
|
8724 |
apply auto |
|
8725 |
done |
|
8726 |
ultimately have geq: "K0 \<supseteq> convex hull (\<Union>(K ` I))" |
|
8727 |
using hull_minimal[of _ "K0" "convex"] by blast |
|
55787 | 8728 |
have "\<forall>i\<in>I. K i \<supseteq> {1 :: real} \<times> S i" |
54465 | 8729 |
using K_def by (simp add: hull_subset) |
55787 | 8730 |
then have "\<Union>(K ` I) \<supseteq> {1 :: real} \<times> \<Union>(S ` I)" |
54465 | 8731 |
by auto |
55787 | 8732 |
then have "convex hull \<Union>(K ` I) \<supseteq> convex hull ({1 :: real} \<times> \<Union>(S ` I))" |
54465 | 8733 |
by (simp add: hull_mono) |
55787 | 8734 |
then have "convex hull \<Union>(K ` I) \<supseteq> {1 :: real} \<times> C0" |
54465 | 8735 |
unfolding C0_def |
8736 |
using convex_hull_Times[of "{(1 :: real)}" "\<Union>(S ` I)"] convex_hull_singleton |
|
8737 |
by auto |
|
8738 |
moreover have "cone (convex hull (\<Union>(K ` I)))" |
|
8739 |
apply (subst cone_convex_hull) |
|
8740 |
using cone_Union[of "K ` I"] |
|
8741 |
apply auto |
|
8742 |
unfolding K_def |
|
8743 |
using cone_cone_hull |
|
8744 |
apply auto |
|
8745 |
done |
|
8746 |
ultimately have "convex hull (\<Union>(K ` I)) \<supseteq> K0" |
|
8747 |
unfolding K0_def |
|
8748 |
using hull_minimal[of _ "convex hull (\<Union> (K ` I))" "cone"] |
|
8749 |
by blast |
|
8750 |
then have "K0 = convex hull (\<Union>(K ` I))" |
|
8751 |
using geq by auto |
|
8752 |
also have "\<dots> = setsum K I" |
|
8753 |
apply (subst convex_hull_finite_union_cones[of I K]) |
|
8754 |
using assms |
|
8755 |
apply blast |
|
8756 |
using False |
|
8757 |
apply blast |
|
8758 |
unfolding K_def |
|
8759 |
apply rule |
|
8760 |
apply (subst convex_cone_hull) |
|
8761 |
apply (subst convex_Times) |
|
8762 |
using assms cone_cone_hull `\<forall>i\<in>I. K i \<noteq> {}` K_def |
|
8763 |
apply auto |
|
8764 |
done |
|
47444
d21c95af2df7
removed "setsum_set", now subsumed by generic setsum
krauss
parents:
47108
diff
changeset
|
8765 |
finally have "K0 = setsum K I" by auto |
54465 | 8766 |
then have *: "rel_interior K0 = setsum (\<lambda>i. (rel_interior (K i))) I" |
8767 |
using rel_interior_sum_gen[of I K] convK by auto |
|
8768 |
{ |
|
8769 |
fix x |
|
8770 |
assume "x \<in> ?lhs" |
|
8771 |
then have "(1::real, x) \<in> rel_interior K0" |
|
8772 |
using K0_def C0_def rel_interior_convex_cone_aux[of C0 "1::real" x] convex_convex_hull |
|
8773 |
by auto |
|
8774 |
then obtain k where k: "(1::real, x) = setsum k I \<and> (\<forall>i\<in>I. k i \<in> rel_interior (K i))" |
|
8775 |
using `finite I` * set_setsum_alt[of I "\<lambda>i. rel_interior (K i)"] by auto |
|
8776 |
{ |
|
8777 |
fix i |
|
8778 |
assume "i \<in> I" |
|
55787 | 8779 |
then have "convex (S i) \<and> k i \<in> rel_interior (cone hull {1} \<times> S i)" |
54465 | 8780 |
using k K_def assms by auto |
8781 |
then have "\<exists>ci si. k i = (ci, ci *\<^sub>R si) \<and> 0 < ci \<and> si \<in> rel_interior (S i)" |
|
8782 |
using rel_interior_convex_cone[of "S i"] by auto |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8783 |
} |
54465 | 8784 |
then obtain c s where |
8785 |
cs: "\<forall>i\<in>I. k i = (c i, c i *\<^sub>R s i) \<and> 0 < c i \<and> s i \<in> rel_interior (S i)" |
|
8786 |
by metis |
|
8787 |
then have "x = (\<Sum>i\<in>I. c i *\<^sub>R s i) \<and> setsum c I = 1" |
|
8788 |
using k by (simp add: setsum_prod) |
|
8789 |
then have "x \<in> ?rhs" |
|
8790 |
using k |
|
8791 |
apply auto |
|
8792 |
apply (rule_tac x = c in exI) |
|
8793 |
apply (rule_tac x = s in exI) |
|
8794 |
using cs |
|
8795 |
apply auto |
|
8796 |
done |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8797 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8798 |
moreover |
54465 | 8799 |
{ |
8800 |
fix x |
|
8801 |
assume "x \<in> ?rhs" |
|
8802 |
then obtain c s where cs: "x = setsum (\<lambda>i. c i *\<^sub>R s i) I \<and> |
|
8803 |
(\<forall>i\<in>I. c i > 0) \<and> setsum c I = 1 \<and> (\<forall>i\<in>I. s i \<in> rel_interior (S i))" |
|
8804 |
by auto |
|
8805 |
def k \<equiv> "\<lambda>i. (c i, c i *\<^sub>R s i)" |
|
8806 |
{ |
|
8807 |
fix i assume "i:I" |
|
8808 |
then have "k i \<in> rel_interior (K i)" |
|
8809 |
using k_def K_def assms cs rel_interior_convex_cone[of "S i"] |
|
8810 |
by auto |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8811 |
} |
54465 | 8812 |
then have "(1::real, x) \<in> rel_interior K0" |
8813 |
using K0_def * set_setsum_alt[of I "(\<lambda>i. rel_interior (K i))"] assms k_def cs |
|
8814 |
apply auto |
|
8815 |
apply (rule_tac x = k in exI) |
|
8816 |
apply (simp add: setsum_prod) |
|
8817 |
done |
|
8818 |
then have "x \<in> ?lhs" |
|
8819 |
using K0_def C0_def rel_interior_convex_cone_aux[of C0 1 x] |
|
8820 |
by (auto simp add: convex_convex_hull) |
|
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8821 |
} |
54465 | 8822 |
ultimately show ?thesis by blast |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8823 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
8824 |
|
50104 | 8825 |
|
8826 |
lemma convex_le_Inf_differential: |
|
8827 |
fixes f :: "real \<Rightarrow> real" |
|
8828 |
assumes "convex_on I f" |
|
54465 | 8829 |
and "x \<in> interior I" |
8830 |
and "y \<in> I" |
|
50104 | 8831 |
shows "f y \<ge> f x + Inf ((\<lambda>t. (f x - f t) / (x - t)) ` ({x<..} \<inter> I)) * (y - x)" |
54465 | 8832 |
(is "_ \<ge> _ + Inf (?F x) * (y - x)") |
50104 | 8833 |
proof (cases rule: linorder_cases) |
8834 |
assume "x < y" |
|
8835 |
moreover |
|
8836 |
have "open (interior I)" by auto |
|
55697 | 8837 |
from openE[OF this `x \<in> interior I`] |
8838 |
obtain e where e: "0 < e" "ball x e \<subseteq> interior I" . |
|
50104 | 8839 |
moreover def t \<equiv> "min (x + e / 2) ((x + y) / 2)" |
8840 |
ultimately have "x < t" "t < y" "t \<in> ball x e" |
|
8841 |
by (auto simp: dist_real_def field_simps split: split_min) |
|
8842 |
with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto |
|
8843 |
||
8844 |
have "open (interior I)" by auto |
|
55697 | 8845 |
from openE[OF this `x \<in> interior I`] |
8846 |
obtain e where "0 < e" "ball x e \<subseteq> interior I" . |
|
50104 | 8847 |
moreover def K \<equiv> "x - e / 2" |
54465 | 8848 |
with `0 < e` have "K \<in> ball x e" "K < x" |
8849 |
by (auto simp: dist_real_def) |
|
50104 | 8850 |
ultimately have "K \<in> I" "K < x" "x \<in> I" |
8851 |
using interior_subset[of I] `x \<in> interior I` by auto |
|
8852 |
||
8853 |
have "Inf (?F x) \<le> (f x - f y) / (x - y)" |
|
54258
adfc759263ab
use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents:
54230
diff
changeset
|
8854 |
proof (intro bdd_belowI cInf_lower2) |
50104 | 8855 |
show "(f x - f t) / (x - t) \<in> ?F x" |
8856 |
using `t \<in> I` `x < t` by auto |
|
8857 |
show "(f x - f t) / (x - t) \<le> (f x - f y) / (x - y)" |
|
54465 | 8858 |
using `convex_on I f` `x \<in> I` `y \<in> I` `x < t` `t < y` |
8859 |
by (rule convex_on_diff) |
|
50104 | 8860 |
next |
54465 | 8861 |
fix y |
8862 |
assume "y \<in> ?F x" |
|
50104 | 8863 |
with order_trans[OF convex_on_diff[OF `convex_on I f` `K \<in> I` _ `K < x` _]] |
8864 |
show "(f K - f x) / (K - x) \<le> y" by auto |
|
8865 |
qed |
|
8866 |
then show ?thesis |
|
8867 |
using `x < y` by (simp add: field_simps) |
|
8868 |
next |
|
8869 |
assume "y < x" |
|
8870 |
moreover |
|
8871 |
have "open (interior I)" by auto |
|
55697 | 8872 |
from openE[OF this `x \<in> interior I`] |
8873 |
obtain e where e: "0 < e" "ball x e \<subseteq> interior I" . |
|
50104 | 8874 |
moreover def t \<equiv> "x + e / 2" |
8875 |
ultimately have "x < t" "t \<in> ball x e" |
|
8876 |
by (auto simp: dist_real_def field_simps) |
|
8877 |
with `x \<in> interior I` e interior_subset[of I] have "t \<in> I" "x \<in> I" by auto |
|
8878 |
||
8879 |
have "(f x - f y) / (x - y) \<le> Inf (?F x)" |
|
51475
ebf9d4fd00ba
introduct the conditional_complete_lattice type class; generalize theorems about real Sup and Inf to it
hoelzl
parents:
50979
diff
changeset
|
8880 |
proof (rule cInf_greatest) |
50104 | 8881 |
have "(f x - f y) / (x - y) = (f y - f x) / (y - x)" |
8882 |
using `y < x` by (auto simp: field_simps) |
|
8883 |
also |
|
54465 | 8884 |
fix z |
8885 |
assume "z \<in> ?F x" |
|
50104 | 8886 |
with order_trans[OF convex_on_diff[OF `convex_on I f` `y \<in> I` _ `y < x`]] |
54465 | 8887 |
have "(f y - f x) / (y - x) \<le> z" |
8888 |
by auto |
|
50104 | 8889 |
finally show "(f x - f y) / (x - y) \<le> z" . |
8890 |
next |
|
8891 |
have "open (interior I)" by auto |
|
55697 | 8892 |
from openE[OF this `x \<in> interior I`] |
8893 |
obtain e where e: "0 < e" "ball x e \<subseteq> interior I" . |
|
54465 | 8894 |
then have "x + e / 2 \<in> ball x e" |
8895 |
by (auto simp: dist_real_def) |
|
8896 |
with e interior_subset[of I] have "x + e / 2 \<in> {x<..} \<inter> I" |
|
8897 |
by auto |
|
8898 |
then show "?F x \<noteq> {}" |
|
8899 |
by blast |
|
50104 | 8900 |
qed |
8901 |
then show ?thesis |
|
8902 |
using `y < x` by (simp add: field_simps) |
|
8903 |
qed simp |
|
8904 |
||
33175 | 8905 |
end |