author | huffman |
Thu, 25 Aug 2011 12:43:55 -0700 | |
changeset 44522 | 2f7e9d890efe |
parent 44519 | ea85d78a994e |
child 44523 | d55161d67821 |
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 |
10 |
Topology_Euclidean_Space |
|
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)" |
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
21 |
by (simp add: linear_def scaleR_add_right) |
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
22 |
|
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
23 |
lemma injective_scaleR: "c \<noteq> 0 \<Longrightarrow> inj (\<lambda>(x::'a::real_vector). scaleR c x)" |
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
24 |
by (simp add: inj_on_def) |
40377 | 25 |
|
26 |
lemma linear_add_cmul: |
|
27 |
assumes "linear f" |
|
28 |
shows "f(a *\<^sub>R x + b *\<^sub>R y) = a *\<^sub>R f x + b *\<^sub>R f y" |
|
29 |
using linear_add[of f] linear_cmul[of f] assms by (simp) |
|
30 |
||
31 |
lemma mem_convex_2: |
|
32 |
assumes "convex S" "x : S" "y : S" "u>=0" "v>=0" "u+v=1" |
|
33 |
shows "(u *\<^sub>R x + v *\<^sub>R y) : S" |
|
34 |
using assms convex_def[of S] by auto |
|
35 |
||
36 |
lemma mem_convex_alt: |
|
37 |
assumes "convex S" "x : S" "y : S" "u>=0" "v>=0" "u+v>0" |
|
38 |
shows "((u/(u+v)) *\<^sub>R x + (v/(u+v)) *\<^sub>R y) : S" |
|
39 |
apply (subst mem_convex_2) |
|
40 |
using assms apply (auto simp add: algebra_simps zero_le_divide_iff) |
|
41 |
using add_divide_distrib[of u v "u+v"] by auto |
|
42 |
||
43 |
lemma inj_on_image_mem_iff: "inj_on f B ==> (A <= B) ==> (f a : f`A) ==> (a : B) ==> (a : A)" |
|
44 |
by (blast dest: inj_onD) |
|
45 |
||
46 |
lemma independent_injective_on_span_image: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
47 |
assumes iS: "independent S" |
40377 | 48 |
and lf: "linear f" and fi: "inj_on f (span S)" |
49 |
shows "independent (f ` S)" |
|
50 |
proof- |
|
51 |
{fix a assume a: "a : S" "f a : span (f ` S - {f a})" |
|
52 |
have eq: "f ` S - {f a} = f ` (S - {a})" using fi a span_inc |
|
53 |
by (auto simp add: inj_on_def) |
|
54 |
from a have "f a : f ` span (S -{a})" |
|
55 |
unfolding eq span_linear_image[OF lf, of "S - {a}"] by blast |
|
56 |
moreover have "span (S -{a}) <= span S" using span_mono[of "S-{a}" S] by auto |
|
57 |
ultimately have "a : span (S -{a})" using fi a span_inc by (auto simp add: inj_on_def) |
|
58 |
with a(1) iS have False by (simp add: dependent_def) } |
|
59 |
then show ?thesis unfolding dependent_def by blast |
|
60 |
qed |
|
61 |
||
62 |
lemma dim_image_eq: |
|
63 |
fixes f :: "'n::euclidean_space => 'm::euclidean_space" |
|
64 |
assumes lf: "linear f" and fi: "inj_on f (span S)" |
|
65 |
shows "dim (f ` S) = dim (S:: ('n::euclidean_space) set)" |
|
66 |
proof- |
|
67 |
obtain B where B_def: "B<=S & independent B & S <= span B & card B = dim S" |
|
68 |
using basis_exists[of S] by auto |
|
69 |
hence "span S = span B" using span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
|
70 |
hence "independent (f ` B)" using independent_injective_on_span_image[of B f] B_def assms by auto |
|
71 |
moreover have "card (f ` B) = card B" using assms card_image[of f B] subset_inj_on[of f "span S" B] |
|
72 |
B_def span_inc by auto |
|
73 |
moreover have "(f ` B) <= (f ` S)" using B_def by auto |
|
74 |
ultimately have "dim (f ` S) >= dim S" |
|
75 |
using independent_card_le_dim[of "f ` B" "f ` S"] B_def by auto |
|
76 |
from this show ?thesis using dim_image_le[of f S] assms by auto |
|
77 |
qed |
|
78 |
||
79 |
lemma linear_injective_on_subspace_0: |
|
80 |
assumes lf: "linear f" and "subspace S" |
|
81 |
shows "inj_on f S <-> (!x : S. f x = 0 --> x = 0)" |
|
82 |
proof- |
|
83 |
have "inj_on f S <-> (!x : S. !y : S. f x = f y --> x = y)" by (simp add: inj_on_def) |
|
84 |
also have "... <-> (!x : S. !y : S. f x - f y = 0 --> x - y = 0)" by simp |
|
85 |
also have "... <-> (!x : S. !y : S. f (x - y) = 0 --> x - y = 0)" |
|
86 |
by (simp add: linear_sub[OF lf]) |
|
87 |
also have "... <-> (! x : S. f x = 0 --> x = 0)" |
|
88 |
using `subspace S` subspace_def[of S] subspace_sub[of S] by auto |
|
89 |
finally show ?thesis . |
|
90 |
qed |
|
91 |
||
92 |
lemma subspace_Inter: "(!s : f. subspace s) ==> subspace (Inter f)" |
|
93 |
unfolding subspace_def by auto |
|
94 |
||
95 |
lemma span_eq[simp]: "(span s = s) <-> subspace s" |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
96 |
unfolding span_def by (rule hull_eq, rule subspace_Inter) |
40377 | 97 |
|
98 |
lemma basis_inj_on: "d \<subseteq> {..<DIM('n)} \<Longrightarrow> inj_on (basis :: nat => 'n::euclidean_space) d" |
|
99 |
by(auto simp add: inj_on_def euclidean_eq[where 'a='n]) |
|
100 |
||
101 |
lemma finite_substdbasis: "finite {basis i ::'n::euclidean_space |i. i : (d:: nat set)}" (is "finite ?S") |
|
102 |
proof- |
|
103 |
have eq: "?S = basis ` d" by blast |
|
104 |
show ?thesis unfolding eq apply(rule finite_subset[OF _ range_basis_finite]) by auto |
|
105 |
qed |
|
106 |
||
107 |
lemma card_substdbasis: assumes "d \<subseteq> {..<DIM('n::euclidean_space)}" |
|
108 |
shows "card {basis i ::'n::euclidean_space | i. i : d} = card d" (is "card ?S = _") |
|
109 |
proof- |
|
110 |
have eq: "?S = basis ` d" by blast |
|
111 |
show ?thesis unfolding eq using card_image[OF basis_inj_on[of d]] assms by auto |
|
112 |
qed |
|
113 |
||
114 |
lemma substdbasis_expansion_unique: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
|
115 |
shows "setsum (%i. f i *\<^sub>R basis i) d = (x::'a::euclidean_space) |
|
116 |
<-> (!i<DIM('a). (i:d --> f i = x$$i) & (i ~: d --> x $$ i = 0))" |
|
117 |
proof- have *:"\<And>x a b P. x * (if P then a else b) = (if P then x*a else x*b)" by auto |
|
118 |
have **:"finite d" apply(rule finite_subset[OF assms]) by fastsimp |
|
119 |
have ***:"\<And>i. (setsum (%i. f i *\<^sub>R ((basis i)::'a)) d) $$ i = (\<Sum>x\<in>d. if x = i then f x else 0)" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
120 |
unfolding euclidean_component_setsum euclidean_component_scaleR basis_component * |
40377 | 121 |
apply(rule setsum_cong2) using assms by auto |
122 |
show ?thesis unfolding euclidean_eq[where 'a='a] *** setsum_delta[OF **] using assms by auto |
|
123 |
qed |
|
124 |
||
125 |
lemma independent_substdbasis: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
|
126 |
shows "independent {basis i ::'a::euclidean_space |i. i : (d :: nat set)}" (is "independent ?A") |
|
127 |
proof - |
|
128 |
have *: "{basis i |i. i < DIM('a)} = basis ` {..<DIM('a)}" by auto |
|
129 |
show ?thesis |
|
130 |
apply(intro independent_mono[of "{basis i ::'a |i. i : {..<DIM('a::euclidean_space)}}" "?A"] ) |
|
131 |
using independent_basis[where 'a='a] assms by (auto simp: *) |
|
132 |
qed |
|
133 |
||
134 |
lemma dim_cball: |
|
135 |
assumes "0<e" |
|
136 |
shows "dim (cball (0 :: 'n::euclidean_space) e) = DIM('n)" |
|
137 |
proof- |
|
138 |
{ fix x :: "'n::euclidean_space" def y == "(e/norm x) *\<^sub>R x" |
|
139 |
hence "y : cball 0 e" using cball_def dist_norm[of 0 y] assms by auto |
|
140 |
moreover have "x = (norm x/e) *\<^sub>R y" using y_def assms by simp |
|
141 |
moreover hence "x = (norm x/e) *\<^sub>R y" by auto |
|
142 |
ultimately have "x : span (cball 0 e)" |
|
143 |
using span_mul[of y "cball 0 e" "norm x/e"] span_inc[of "cball 0 e"] by auto |
|
144 |
} hence "span (cball 0 e) = (UNIV :: ('n::euclidean_space) set)" by auto |
|
145 |
from this show ?thesis using dim_span[of "cball (0 :: 'n::euclidean_space) e"] by (auto simp add: dim_UNIV) |
|
146 |
qed |
|
147 |
||
148 |
lemma indep_card_eq_dim_span: |
|
149 |
fixes B :: "('n::euclidean_space) set" |
|
150 |
assumes "independent B" |
|
151 |
shows "finite B & card B = dim (span B)" |
|
152 |
using assms basis_card_eq_dim[of B "span B"] span_inc by auto |
|
153 |
||
154 |
lemma setsum_not_0: "setsum f A ~= 0 ==> EX a:A. f a ~= 0" |
|
155 |
apply(rule ccontr) by auto |
|
156 |
||
157 |
lemma translate_inj_on: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
158 |
fixes A :: "('a::ab_group_add) set" |
40377 | 159 |
shows "inj_on (%x. a+x) A" unfolding inj_on_def by auto |
160 |
||
161 |
lemma translation_assoc: |
|
162 |
fixes a b :: "'a::ab_group_add" |
|
163 |
shows "(\<lambda>x. b+x) ` ((\<lambda>x. a+x) ` S) = (\<lambda>x. (a+b)+x) ` S" by auto |
|
164 |
||
165 |
lemma translation_invert: |
|
166 |
fixes a :: "'a::ab_group_add" |
|
167 |
assumes "(\<lambda>x. a+x) ` A = (\<lambda>x. a+x) ` B" |
|
168 |
shows "A=B" |
|
169 |
proof- |
|
170 |
have "(%x. -a+x) ` ((%x. a+x) ` A) = (%x. -a+x) ` ((%x. a+x) ` B)" using assms by auto |
|
171 |
from this show ?thesis using translation_assoc[of "-a" a A] translation_assoc[of "-a" a B] by auto |
|
172 |
qed |
|
173 |
||
174 |
lemma translation_galois: |
|
175 |
fixes a :: "'a::ab_group_add" |
|
176 |
shows "T=((\<lambda>x. a+x) ` S) <-> S=((\<lambda>x. (-a)+x) ` T)" |
|
177 |
using translation_assoc[of "-a" a S] apply auto |
|
178 |
using translation_assoc[of a "-a" T] by auto |
|
179 |
||
180 |
lemma translation_inverse_subset: |
|
181 |
assumes "((%x. -a+x) ` V) <= (S :: 'n::ab_group_add set)" |
|
182 |
shows "V <= ((%x. a+x) ` S)" |
|
183 |
proof- |
|
184 |
{ fix x assume "x:V" hence "x-a : S" using assms by auto |
|
185 |
hence "x : {a + v |v. v : S}" apply auto apply (rule exI[of _ "x-a"]) apply simp done |
|
186 |
hence "x : ((%x. a+x) ` S)" by auto } |
|
187 |
from this show ?thesis by auto |
|
188 |
qed |
|
189 |
||
190 |
lemma basis_to_basis_subspace_isomorphism: |
|
191 |
assumes s: "subspace (S:: ('n::euclidean_space) set)" |
|
192 |
and t: "subspace (T :: ('m::euclidean_space) set)" |
|
193 |
and d: "dim S = dim T" |
|
194 |
and B: "B <= S" "independent B" "S <= span B" "card B = dim S" |
|
195 |
and C: "C <= T" "independent C" "T <= span C" "card C = dim T" |
|
196 |
shows "EX f. linear f & f ` B = C & f ` S = T & inj_on f S" |
|
197 |
proof- |
|
198 |
(* Proof is a modified copy of the proof of similar lemma subspace_isomorphism |
|
199 |
*) |
|
200 |
from B independent_bound have fB: "finite B" by blast |
|
201 |
from C independent_bound have fC: "finite C" by blast |
|
202 |
from B(4) C(4) card_le_inj[of B C] d obtain f where |
|
203 |
f: "f ` B \<subseteq> C" "inj_on f B" using `finite B` `finite C` by auto |
|
204 |
from linear_independent_extend[OF B(2)] obtain g where |
|
205 |
g: "linear g" "\<forall>x\<in> B. g x = f x" by blast |
|
206 |
from inj_on_iff_eq_card[OF fB, of f] f(2) |
|
207 |
have "card (f ` B) = card B" by simp |
|
208 |
with B(4) C(4) have ceq: "card (f ` B) = card C" using d |
|
209 |
by simp |
|
210 |
have "g ` B = f ` B" using g(2) |
|
211 |
by (auto simp add: image_iff) |
|
212 |
also have "\<dots> = C" using card_subset_eq[OF fC f(1) ceq] . |
|
213 |
finally have gBC: "g ` B = C" . |
|
214 |
have gi: "inj_on g B" using f(2) g(2) |
|
215 |
by (auto simp add: inj_on_def) |
|
216 |
note g0 = linear_indep_image_lemma[OF g(1) fB, unfolded gBC, OF C(2) gi] |
|
217 |
{fix x y assume x: "x \<in> S" and y: "y \<in> S" and gxy:"g x = g y" |
|
218 |
from B(3) x y have x': "x \<in> span B" and y': "y \<in> span B" by blast+ |
|
219 |
from gxy have th0: "g (x - y) = 0" by (simp add: linear_sub[OF g(1)]) |
|
220 |
have th1: "x - y \<in> span B" using x' y' by (metis span_sub) |
|
221 |
have "x=y" using g0[OF th1 th0] by simp } |
|
222 |
then have giS: "inj_on g S" |
|
223 |
unfolding inj_on_def by blast |
|
224 |
from span_subspace[OF B(1,3) s] |
|
225 |
have "g ` S = span (g ` B)" by (simp add: span_linear_image[OF g(1)]) |
|
226 |
also have "\<dots> = span C" unfolding gBC .. |
|
227 |
also have "\<dots> = T" using span_subspace[OF C(1,3) t] . |
|
228 |
finally have gS: "g ` S = T" . |
|
229 |
from g(1) gS giS gBC show ?thesis by blast |
|
230 |
qed |
|
231 |
||
232 |
lemma closure_linear_image: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
233 |
fixes f :: "('m::euclidean_space) => ('n::real_normed_vector)" |
40377 | 234 |
assumes "linear f" |
235 |
shows "f ` (closure S) <= closure (f ` S)" |
|
236 |
using image_closure_subset[of S f "closure (f ` S)"] assms linear_conv_bounded_linear[of f] |
|
237 |
linear_continuous_on[of f "closure S"] closed_closure[of "f ` S"] closure_subset[of "f ` S"] by auto |
|
238 |
||
239 |
lemma closure_injective_linear_image: |
|
240 |
fixes f :: "('n::euclidean_space) => ('n::euclidean_space)" |
|
241 |
assumes "linear f" "inj f" |
|
242 |
shows "f ` (closure S) = closure (f ` S)" |
|
243 |
proof- |
|
244 |
obtain f' where f'_def: "linear f' & f o f' = id & f' o f = id" |
|
245 |
using assms linear_injective_isomorphism[of f] isomorphism_expand by auto |
|
246 |
hence "f' ` closure (f ` S) <= closure (S)" |
|
247 |
using closure_linear_image[of f' "f ` S"] image_compose[of f' f] by auto |
|
248 |
hence "f ` f' ` closure (f ` S) <= f ` closure (S)" by auto |
|
249 |
hence "closure (f ` S) <= f ` closure (S)" using image_compose[of f f' "closure (f ` S)"] f'_def by auto |
|
250 |
from this show ?thesis using closure_linear_image[of f S] assms by auto |
|
251 |
qed |
|
252 |
||
253 |
lemma closure_direct_sum: |
|
254 |
shows "closure (S <*> T) = closure S <*> closure T" |
|
44365 | 255 |
by (rule closure_Times) |
40377 | 256 |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
257 |
lemma closure_scaleR: (* TODO: generalize to real_normed_vector *) |
40377 | 258 |
fixes S :: "('n::euclidean_space) set" |
259 |
shows "(op *\<^sub>R c) ` (closure S) = closure ((op *\<^sub>R c) ` S)" |
|
260 |
proof- |
|
261 |
{ assume "c ~= 0" hence ?thesis using closure_injective_linear_image[of "(op *\<^sub>R c)" S] |
|
262 |
linear_scaleR injective_scaleR by auto |
|
263 |
} |
|
264 |
moreover |
|
265 |
{ assume zero: "c=0 & S ~= {}" |
|
266 |
hence "closure S ~= {}" using closure_subset by auto |
|
267 |
hence "op *\<^sub>R c ` (closure S) = {0}" using zero by auto |
|
268 |
moreover have "op *\<^sub>R 0 ` S = {0}" using zero by auto |
|
269 |
ultimately have ?thesis using zero by auto |
|
270 |
} |
|
271 |
moreover |
|
272 |
{ assume "S={}" hence ?thesis by auto } |
|
273 |
ultimately show ?thesis by blast |
|
274 |
qed |
|
275 |
||
276 |
lemma fst_linear: "linear fst" unfolding linear_def by (simp add: algebra_simps) |
|
277 |
||
278 |
lemma snd_linear: "linear snd" unfolding linear_def by (simp add: algebra_simps) |
|
279 |
||
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
280 |
lemma fst_snd_linear: "linear (%(x,y). x + y)" unfolding linear_def by (simp add: algebra_simps) |
40377 | 281 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
282 |
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
|
283 |
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
|
284 |
shows "scaleR 2 x = x + x" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
285 |
unfolding one_add_one_is_two [symmetric] scaleR_left_distrib by simp |
34964 | 286 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
287 |
lemma vector_choose_size: "0 <= c ==> \<exists>(x::'a::euclidean_space). norm x = c" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
288 |
apply (rule exI[where x="c *\<^sub>R basis 0 ::'a"]) using DIM_positive[where 'a='a] by auto |
33175 | 289 |
|
290 |
lemma setsum_delta_notmem: assumes "x\<notin>s" |
|
291 |
shows "setsum (\<lambda>y. if (y = x) then P x else Q y) s = setsum Q s" |
|
292 |
"setsum (\<lambda>y. if (x = y) then P x else Q y) s = setsum Q s" |
|
293 |
"setsum (\<lambda>y. if (y = x) then P y else Q y) s = setsum Q s" |
|
294 |
"setsum (\<lambda>y. if (x = y) then P y else Q y) s = setsum Q s" |
|
295 |
apply(rule_tac [!] setsum_cong2) using assms by auto |
|
296 |
||
297 |
lemma setsum_delta'': |
|
298 |
fixes s::"'a::real_vector set" assumes "finite s" |
|
299 |
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)" |
|
300 |
proof- |
|
301 |
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)" by auto |
|
302 |
show ?thesis unfolding * using setsum_delta[OF assms, of y "\<lambda>x. f x *\<^sub>R x"] by auto |
|
303 |
qed |
|
304 |
||
305 |
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)" by auto |
|
306 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
307 |
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::'a::ordered_euclidean_space)) ` {a..b} = |
33175 | 308 |
(if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})" |
309 |
using image_affinity_interval[of m 0 a b] by auto |
|
310 |
||
311 |
lemma dist_triangle_eq: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
312 |
fixes x y z :: "'a::real_inner" |
33175 | 313 |
shows "dist x z = dist x y + dist y z \<longleftrightarrow> norm (x - y) *\<^sub>R (y - z) = norm (y - z) *\<^sub>R (x - y)" |
314 |
proof- 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
|
315 |
show ?thesis unfolding dist_norm norm_triangle_eq[of "x - y" "y - z", unfolded *] |
33175 | 316 |
by(auto simp add:norm_minus_commute) qed |
317 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
318 |
lemma norm_minus_eqI:"x = - y \<Longrightarrow> norm x = norm y" by auto |
33175 | 319 |
|
320 |
lemma Min_grI: assumes "finite A" "A \<noteq> {}" "\<forall>a\<in>A. x < a" shows "x < Min A" |
|
321 |
unfolding Min_gr_iff[OF assms(1,2)] using assms(3) by auto |
|
322 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
323 |
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
|
324 |
unfolding norm_eq_sqrt_inner by simp |
33175 | 325 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
326 |
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
|
327 |
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
|
328 |
|
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
329 |
|
44467 | 330 |
subsection {* Affine set and affine hull *} |
33175 | 331 |
|
332 |
definition |
|
333 |
affine :: "'a::real_vector set \<Rightarrow> bool" where |
|
334 |
"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)" |
|
335 |
||
336 |
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)" |
|
36071 | 337 |
unfolding affine_def by(metis eq_diff_eq') |
33175 | 338 |
|
339 |
lemma affine_empty[intro]: "affine {}" |
|
340 |
unfolding affine_def by auto |
|
341 |
||
342 |
lemma affine_sing[intro]: "affine {x}" |
|
343 |
unfolding affine_alt by (auto simp add: scaleR_left_distrib [symmetric]) |
|
344 |
||
345 |
lemma affine_UNIV[intro]: "affine UNIV" |
|
346 |
unfolding affine_def by auto |
|
347 |
||
348 |
lemma affine_Inter: "(\<forall>s\<in>f. affine s) \<Longrightarrow> affine (\<Inter> f)" |
|
349 |
unfolding affine_def by auto |
|
350 |
||
351 |
lemma affine_Int: "affine s \<Longrightarrow> affine t \<Longrightarrow> affine (s \<inter> t)" |
|
352 |
unfolding affine_def by auto |
|
353 |
||
354 |
lemma affine_affine_hull: "affine(affine hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
355 |
unfolding hull_def using affine_Inter[of "{t. affine t \<and> s \<subseteq> t}"] |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
356 |
by auto |
33175 | 357 |
|
358 |
lemma affine_hull_eq[simp]: "(affine hull s = s) \<longleftrightarrow> affine s" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
359 |
by (metis affine_affine_hull hull_same) |
33175 | 360 |
|
44467 | 361 |
subsubsection {* Some explicit formulations (from Lars Schewe) *} |
33175 | 362 |
|
363 |
lemma affine: fixes V::"'a::real_vector set" |
|
364 |
shows "affine V \<longleftrightarrow> (\<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)" |
|
365 |
unfolding affine_def apply rule apply(rule, rule, rule) apply(erule conjE)+ |
|
366 |
defer apply(rule, rule, rule, rule, rule) proof- |
|
367 |
fix x y u v assume as:"x \<in> V" "y \<in> V" "u + v = (1::real)" |
|
368 |
"\<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" |
|
369 |
thus "u *\<^sub>R x + v *\<^sub>R y \<in> V" apply(cases "x=y") |
|
370 |
using as(4)[THEN spec[where x="{x,y}"], THEN spec[where x="\<lambda>w. if w = x then u else v"]] and as(1-3) |
|
371 |
by(auto simp add: scaleR_left_distrib[THEN sym]) |
|
372 |
next |
|
373 |
fix s u 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" |
|
374 |
"finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = (1::real)" |
|
375 |
def n \<equiv> "card s" |
|
376 |
have "card s = 0 \<or> card s = 1 \<or> card s = 2 \<or> card s > 2" by auto |
|
377 |
thus "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" proof(auto simp only: disjE) |
|
378 |
assume "card s = 2" hence "card s = Suc (Suc 0)" by auto |
|
379 |
then obtain a b where "s = {a, b}" unfolding card_Suc_eq by auto |
|
380 |
thus ?thesis using as(1)[THEN bspec[where x=a], THEN bspec[where x=b]] using as(4,5) |
|
381 |
by(auto simp add: setsum_clauses(2)) |
|
382 |
next assume "card s > 2" thus ?thesis using as and n_def proof(induct n arbitrary: u s) |
|
383 |
case (Suc n) fix s::"'a set" and u::"'a \<Rightarrow> real" |
|
384 |
assume IA:"\<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; |
|
34915 | 385 |
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" and |
386 |
as:"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 | 387 |
"finite s" "s \<noteq> {}" "s \<subseteq> V" "setsum u s = 1" |
388 |
have "\<exists>x\<in>s. u x \<noteq> 1" proof(rule_tac ccontr) |
|
389 |
assume " \<not> (\<exists>x\<in>s. u x \<noteq> 1)" hence "setsum u s = real_of_nat (card s)" unfolding card_eq_setsum by auto |
|
390 |
thus False using as(7) and `card s > 2` by (metis Numeral1_eq1_nat less_0_number_of less_int_code(15) |
|
391 |
less_nat_number_of not_less_iff_gr_or_eq of_nat_1 of_nat_eq_iff pos2 rel_simps(4)) qed |
|
392 |
then obtain x where x:"x\<in>s" "u x \<noteq> 1" by auto |
|
393 |
||
394 |
have c:"card (s - {x}) = card s - 1" apply(rule card_Diff_singleton) using `x\<in>s` as(4) by auto |
|
395 |
have *:"s = insert x (s - {x})" "finite (s - {x})" using `x\<in>s` and as(4) by auto |
|
396 |
have **:"setsum u (s - {x}) = 1 - u x" |
|
397 |
using setsum_clauses(2)[OF *(2), of u x, unfolded *(1)[THEN sym] as(7)] by auto |
|
398 |
have ***:"inverse (1 - u x) * setsum u (s - {x}) = 1" unfolding ** using `u x \<noteq> 1` by auto |
|
399 |
have "(\<Sum>xa\<in>s - {x}. (inverse (1 - u x) * u xa) *\<^sub>R xa) \<in> V" proof(cases "card (s - {x}) > 2") |
|
400 |
case True hence "s - {x} \<noteq> {}" "card (s - {x}) = n" unfolding c and as(1)[symmetric] proof(rule_tac ccontr) |
|
401 |
assume "\<not> s - {x} \<noteq> {}" hence "card (s - {x}) = 0" unfolding card_0_eq[OF *(2)] by simp |
|
402 |
thus False using True by auto qed auto |
|
403 |
thus ?thesis apply(rule_tac IA[of "s - {x}" "\<lambda>y. (inverse (1 - u x) * u y)"]) |
|
404 |
unfolding setsum_right_distrib[THEN sym] using as and *** and True by auto |
|
405 |
next case False hence "card (s - {x}) = Suc (Suc 0)" using as(2) and c by auto |
|
406 |
then obtain a b where "(s - {x}) = {a, b}" "a\<noteq>b" unfolding card_Suc_eq by auto |
|
407 |
thus ?thesis using as(3)[THEN bspec[where x=a], THEN bspec[where x=b]] |
|
408 |
using *** *(2) and `s \<subseteq> V` unfolding setsum_right_distrib by(auto simp add: setsum_clauses(2)) qed |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
409 |
hence "u x + (1 - u x) = 1 \<Longrightarrow> 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" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
410 |
apply-apply(rule as(3)[rule_format]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
411 |
unfolding RealVector.scaleR_right.setsum using x(1) as(6) by auto |
33175 | 412 |
thus "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> V" unfolding scaleR_scaleR[THEN sym] and scaleR_right.setsum [symmetric] |
413 |
apply(subst *) unfolding setsum_clauses(2)[OF *(2)] |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
414 |
using `u x \<noteq> 1` by auto |
33175 | 415 |
qed auto |
416 |
next assume "card s = 1" then obtain a where "s={a}" by(auto simp add: card_Suc_eq) |
|
417 |
thus ?thesis using as(4,5) by simp |
|
418 |
qed(insert `s\<noteq>{}` `finite s`, auto) |
|
419 |
qed |
|
420 |
||
421 |
lemma affine_hull_explicit: |
|
422 |
"affine hull p = {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}" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
423 |
apply(rule hull_unique) apply(subst subset_eq) prefer 3 apply rule unfolding mem_Collect_eq |
33175 | 424 |
apply (erule exE)+ apply(erule conjE)+ prefer 2 apply rule proof- |
425 |
fix x assume "x\<in>p" thus "\<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" |
|
426 |
apply(rule_tac x="{x}" in exI, rule_tac x="\<lambda>x. 1" in exI) by auto |
|
427 |
next |
|
428 |
fix t x s u assume as:"p \<subseteq> t" "affine t" "finite s" "s \<noteq> {}" "s \<subseteq> p" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
429 |
thus "x \<in> t" using as(2)[unfolded affine, THEN spec[where x=s], THEN spec[where x=u]] by auto |
|
430 |
next |
|
431 |
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}" unfolding affine_def |
|
432 |
apply(rule,rule,rule,rule,rule) unfolding mem_Collect_eq proof- |
|
433 |
fix u v ::real assume uv:"u + v = 1" |
|
434 |
fix x 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" |
|
435 |
then obtain sx ux where x:"finite sx" "sx \<noteq> {}" "sx \<subseteq> p" "setsum ux sx = 1" "(\<Sum>v\<in>sx. ux v *\<^sub>R v) = x" by auto |
|
436 |
fix y 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" |
|
437 |
then obtain sy uy where y:"finite sy" "sy \<noteq> {}" "sy \<subseteq> p" "setsum uy sy = 1" "(\<Sum>v\<in>sy. uy v *\<^sub>R v) = y" by auto |
|
438 |
have xy:"finite (sx \<union> sy)" using x(1) y(1) by auto |
|
439 |
have **:"(sx \<union> sy) \<inter> sx = sx" "(sx \<union> sy) \<inter> sy = sy" by auto |
|
440 |
show "\<exists>s ua. finite s \<and> s \<noteq> {} \<and> s \<subseteq> p \<and> setsum ua s = 1 \<and> (\<Sum>v\<in>s. ua v *\<^sub>R v) = u *\<^sub>R x + v *\<^sub>R y" |
|
441 |
apply(rule_tac x="sx \<union> sy" in exI) |
|
442 |
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) |
|
443 |
unfolding scaleR_left_distrib setsum_addf if_smult scaleR_zero_left ** setsum_restrict_set[OF xy, THEN sym] |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
444 |
unfolding scaleR_scaleR[THEN sym] RealVector.scaleR_right.setsum [symmetric] and setsum_right_distrib[THEN sym] |
33175 | 445 |
unfolding x y using x(1-3) y(1-3) uv by simp qed qed |
446 |
||
447 |
lemma affine_hull_finite: |
|
448 |
assumes "finite s" |
|
449 |
shows "affine hull s = {y. \<exists>u. 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
|
450 |
unfolding affine_hull_explicit and set_eq_iff and mem_Collect_eq apply (rule,rule) |
33175 | 451 |
apply(erule exE)+ apply(erule conjE)+ defer apply(erule exE) apply(erule conjE) proof- |
452 |
fix x u assume "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x" |
|
453 |
thus "\<exists>sa u. finite sa \<and> \<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" |
|
454 |
apply(rule_tac x=s in exI, rule_tac x=u in exI) using assms by auto |
|
455 |
next |
|
456 |
fix x t u assume "t \<subseteq> s" hence *:"s \<inter> t = t" by auto |
|
457 |
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" |
|
458 |
thus "\<exists>u. setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = x" apply(rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI) |
|
459 |
unfolding if_smult scaleR_zero_left and setsum_restrict_set[OF assms, THEN sym] and * by auto qed |
|
460 |
||
44467 | 461 |
subsubsection {* Stepping theorems and hence small special cases *} |
33175 | 462 |
|
463 |
lemma affine_hull_empty[simp]: "affine hull {} = {}" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
464 |
apply(rule hull_unique) by auto |
33175 | 465 |
|
466 |
lemma affine_hull_finite_step: |
|
467 |
fixes y :: "'a::real_vector" |
|
468 |
shows "(\<exists>u. setsum u {} = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) {} = y) \<longleftrightarrow> w = 0 \<and> y = 0" (is ?th1) |
|
469 |
"finite s \<Longrightarrow> (\<exists>u. setsum u (insert a s) = w \<and> setsum (\<lambda>x. u x *\<^sub>R x) (insert a s) = y) \<longleftrightarrow> |
|
470 |
(\<exists>v u. setsum u s = w - v \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y - v *\<^sub>R a)" (is "?as \<Longrightarrow> (?lhs = ?rhs)") |
|
471 |
proof- |
|
472 |
show ?th1 by simp |
|
473 |
assume ?as |
|
474 |
{ assume ?lhs |
|
475 |
then obtain u where u:"setsum u (insert a s) = w \<and> (\<Sum>x\<in>insert a s. u x *\<^sub>R x) = y" by auto |
|
476 |
have ?rhs proof(cases "a\<in>s") |
|
477 |
case True hence *:"insert a s = s" by auto |
|
478 |
show ?thesis using u[unfolded *] apply(rule_tac x=0 in exI) by auto |
|
479 |
next |
|
480 |
case False thus ?thesis apply(rule_tac x="u a" in exI) using u and `?as` by auto |
|
481 |
qed } moreover |
|
482 |
{ assume ?rhs |
|
483 |
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" by auto |
|
484 |
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)" by auto |
|
485 |
have ?lhs proof(cases "a\<in>s") |
|
486 |
case True thus ?thesis |
|
487 |
apply(rule_tac x="\<lambda>x. (if x=a then v else 0) + u x" in exI) |
|
488 |
unfolding setsum_clauses(2)[OF `?as`] apply simp |
|
489 |
unfolding scaleR_left_distrib and setsum_addf |
|
490 |
unfolding vu and * and scaleR_zero_left |
|
491 |
by (auto simp add: setsum_delta[OF `?as`]) |
|
492 |
next |
|
493 |
case False |
|
494 |
hence **:"\<And>x. x \<in> s \<Longrightarrow> u x = (if x = a then v else u x)" |
|
495 |
"\<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 |
|
496 |
from False show ?thesis |
|
497 |
apply(rule_tac x="\<lambda>x. if x=a then v else u x" in exI) |
|
498 |
unfolding setsum_clauses(2)[OF `?as`] and * using vu |
|
499 |
using setsum_cong2[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)] |
|
500 |
using setsum_cong2[of s u "\<lambda>x. if x = a then v else u x", OF **(1)] by auto |
|
501 |
qed } |
|
502 |
ultimately show "?lhs = ?rhs" by blast |
|
503 |
qed |
|
504 |
||
505 |
lemma affine_hull_2: |
|
506 |
fixes a b :: "'a::real_vector" |
|
507 |
shows "affine hull {a,b} = {u *\<^sub>R a + v *\<^sub>R b| u v. (u + v = 1)}" (is "?lhs = ?rhs") |
|
508 |
proof- |
|
509 |
have *:"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)" |
|
510 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto |
|
511 |
have "?lhs = {y. \<exists>u. setsum u {a, b} = 1 \<and> (\<Sum>v\<in>{a, b}. u v *\<^sub>R v) = y}" |
|
512 |
using affine_hull_finite[of "{a,b}"] by auto |
|
513 |
also have "\<dots> = {y. \<exists>v u. u b = 1 - v \<and> u b *\<^sub>R b = y - v *\<^sub>R a}" |
|
514 |
by(simp add: affine_hull_finite_step(2)[of "{b}" a]) |
|
515 |
also have "\<dots> = ?rhs" unfolding * by auto |
|
516 |
finally show ?thesis by auto |
|
517 |
qed |
|
518 |
||
519 |
lemma affine_hull_3: |
|
520 |
fixes a b c :: "'a::real_vector" |
|
521 |
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}" (is "?lhs = ?rhs") |
|
522 |
proof- |
|
523 |
have *:"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::real)" |
|
524 |
"\<And>x y z. z = x - y \<longleftrightarrow> y + z = (x::'a)" by auto |
|
525 |
show ?thesis apply(simp add: affine_hull_finite affine_hull_finite_step) |
|
526 |
unfolding * apply auto |
|
527 |
apply(rule_tac x=v in exI) apply(rule_tac x=va in exI) apply auto |
|
528 |
apply(rule_tac x=u in exI) by(auto intro!: exI) |
|
529 |
qed |
|
530 |
||
40377 | 531 |
lemma mem_affine: |
532 |
assumes "affine S" "x : S" "y : S" "u+v=1" |
|
533 |
shows "(u *\<^sub>R x + v *\<^sub>R y) : S" |
|
534 |
using assms affine_def[of S] by auto |
|
535 |
||
536 |
lemma mem_affine_3: |
|
537 |
assumes "affine S" "x : S" "y : S" "z : S" "u+v+w=1" |
|
538 |
shows "(u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z) : S" |
|
539 |
proof- |
|
540 |
have "(u *\<^sub>R x + v *\<^sub>R y + w *\<^sub>R z) : affine hull {x, y, z}" |
|
541 |
using affine_hull_3[of x y z] assms by auto |
|
542 |
moreover have " affine hull {x, y, z} <= affine hull S" |
|
543 |
using hull_mono[of "{x, y, z}" "S"] assms by auto |
|
544 |
moreover have "affine hull S = S" |
|
545 |
using assms affine_hull_eq[of S] by auto |
|
546 |
ultimately show ?thesis by auto |
|
547 |
qed |
|
548 |
||
549 |
lemma mem_affine_3_minus: |
|
550 |
assumes "affine S" "x : S" "y : S" "z : S" |
|
551 |
shows "x + v *\<^sub>R (y-z) : S" |
|
552 |
using mem_affine_3[of S x y z 1 v "-v"] assms by (simp add: algebra_simps) |
|
553 |
||
554 |
||
44467 | 555 |
subsubsection {* Some relations between affine hull and subspaces *} |
33175 | 556 |
|
557 |
lemma affine_hull_insert_subset_span: |
|
558 |
shows "affine hull (insert a s) \<subseteq> {a + v| v . v \<in> span {x - a | x . x \<in> 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
|
559 |
unfolding subset_eq Ball_def unfolding affine_hull_explicit span_explicit mem_Collect_eq |
33175 | 560 |
apply(rule,rule) apply(erule exE)+ apply(erule conjE)+ proof- |
561 |
fix x t u 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" |
|
562 |
have "(\<lambda>x. x - a) ` (t - {a}) \<subseteq> {x - a |x. x \<in> s}" using as(3) by auto |
|
563 |
thus "\<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)" |
|
564 |
apply(rule_tac x="x - a" in exI) |
|
565 |
apply (rule conjI, simp) |
|
566 |
apply(rule_tac x="(\<lambda>x. x - a) ` (t - {a})" in exI) |
|
567 |
apply(rule_tac x="\<lambda>x. u (x + a)" in exI) |
|
568 |
apply (rule conjI) using as(1) apply simp |
|
569 |
apply (erule conjI) |
|
570 |
using as(1) |
|
571 |
apply (simp add: setsum_reindex[unfolded inj_on_def] scaleR_right_diff_distrib setsum_subtractf scaleR_left.setsum[THEN sym] setsum_diff1 scaleR_left_diff_distrib) |
|
572 |
unfolding as by simp qed |
|
573 |
||
574 |
lemma affine_hull_insert_span: |
|
575 |
assumes "a \<notin> s" |
|
576 |
shows "affine hull (insert a s) = |
|
577 |
{a + v | v . v \<in> span {x - a | x. x \<in> s}}" |
|
578 |
apply(rule, rule affine_hull_insert_subset_span) unfolding subset_eq Ball_def |
|
579 |
unfolding affine_hull_explicit and mem_Collect_eq proof(rule,rule,erule exE,erule conjE) |
|
580 |
fix y v assume "y = a + v" "v \<in> span {x - a |x. x \<in> 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
|
581 |
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" unfolding span_explicit by auto |
33175 | 582 |
def f \<equiv> "(\<lambda>x. x + a) ` t" |
583 |
have f:"finite f" "f \<subseteq> s" "(\<Sum>v\<in>f. u (v - a) *\<^sub>R (v - a)) = y - a" unfolding f_def using obt |
|
584 |
by(auto simp add: setsum_reindex[unfolded inj_on_def]) |
|
585 |
have *:"f \<inter> {a} = {}" "f \<inter> - {a} = f" using f(2) assms by auto |
|
586 |
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" |
|
587 |
apply(rule_tac x="insert a f" in exI) |
|
588 |
apply(rule_tac x="\<lambda>x. if x=a then 1 - setsum (\<lambda>x. u (x - a)) f else u (x - a)" in exI) |
|
589 |
using assms and f unfolding setsum_clauses(2)[OF f(1)] and if_smult |
|
35577 | 590 |
unfolding setsum_cases[OF f(1), of "\<lambda>x. x = a"] |
591 |
by (auto simp add: setsum_subtractf scaleR_left.setsum algebra_simps *) qed |
|
33175 | 592 |
|
593 |
lemma affine_hull_span: |
|
594 |
assumes "a \<in> s" |
|
595 |
shows "affine hull s = {a + v | v. v \<in> span {x - a | x. x \<in> s - {a}}}" |
|
596 |
using affine_hull_insert_span[of a "s - {a}", unfolded insert_Diff[OF assms]] by auto |
|
597 |
||
44467 | 598 |
subsubsection {* Parallel affine sets *} |
40377 | 599 |
|
600 |
definition affine_parallel :: "'a::real_vector set => 'a::real_vector set => bool" |
|
601 |
where "affine_parallel S T = (? a. T = ((%x. a + x) ` S))" |
|
602 |
||
603 |
lemma affine_parallel_expl_aux: |
|
604 |
fixes S T :: "'a::real_vector set" |
|
605 |
assumes "!x. (x : S <-> (a+x) : T)" |
|
606 |
shows "T = ((%x. a + x) ` S)" |
|
607 |
proof- |
|
608 |
{ fix x assume "x : T" hence "(-a)+x : S" using assms by auto |
|
609 |
hence " x : ((%x. a + x) ` S)" using imageI[of "-a+x" S "(%x. a+x)"] by auto} |
|
610 |
moreover have "T >= ((%x. a + x) ` S)" using assms by auto |
|
611 |
ultimately show ?thesis by auto |
|
612 |
qed |
|
613 |
||
614 |
lemma affine_parallel_expl: |
|
615 |
"affine_parallel S T = (? a. !x. (x : S <-> (a+x) : T))" |
|
616 |
unfolding affine_parallel_def using affine_parallel_expl_aux[of S _ T] by auto |
|
617 |
||
618 |
lemma affine_parallel_reflex: "affine_parallel S S" unfolding affine_parallel_def apply (rule exI[of _ "0"]) by auto |
|
619 |
||
620 |
lemma affine_parallel_commut: |
|
621 |
assumes "affine_parallel A B" shows "affine_parallel B A" |
|
622 |
proof- |
|
623 |
from assms obtain a where "B=((%x. a + x) ` A)" unfolding affine_parallel_def by auto |
|
624 |
from this show ?thesis using translation_galois[of B a A] unfolding affine_parallel_def by auto |
|
625 |
qed |
|
626 |
||
627 |
lemma affine_parallel_assoc: |
|
628 |
assumes "affine_parallel A B" "affine_parallel B C" |
|
629 |
shows "affine_parallel A C" |
|
630 |
proof- |
|
631 |
from assms obtain ab where "B=((%x. ab + x) ` A)" unfolding affine_parallel_def by auto |
|
632 |
moreover |
|
633 |
from assms obtain bc where "C=((%x. bc + x) ` B)" unfolding affine_parallel_def by auto |
|
634 |
ultimately show ?thesis using translation_assoc[of bc ab A] unfolding affine_parallel_def by auto |
|
635 |
qed |
|
636 |
||
637 |
lemma affine_translation_aux: |
|
638 |
fixes a :: "'a::real_vector" |
|
639 |
assumes "affine ((%x. a + x) ` S)" shows "affine S" |
|
640 |
proof- |
|
641 |
{ fix x y u v |
|
642 |
assume xy: "x : S" "y : S" "(u :: real)+v=1" |
|
643 |
hence "(a+x):((%x. a + x) ` S)" "(a+y):((%x. a + x) ` S)" by auto |
|
644 |
hence h1: "u *\<^sub>R (a+x) + v *\<^sub>R (a+y) : ((%x. a + x) ` S)" using xy assms unfolding affine_def by auto |
|
645 |
have "u *\<^sub>R (a+x) + v *\<^sub>R (a+y) = (u+v) *\<^sub>R a + (u *\<^sub>R x + v *\<^sub>R y)" by (simp add:algebra_simps) |
|
646 |
also have "...= a + (u *\<^sub>R x + v *\<^sub>R y)" using `u+v=1` by auto |
|
647 |
ultimately have "a + (u *\<^sub>R x + v *\<^sub>R y) : ((%x. a + x) ` S)" using h1 by auto |
|
648 |
hence "u *\<^sub>R x + v *\<^sub>R y : S" by auto |
|
649 |
} from this show ?thesis unfolding affine_def by auto |
|
650 |
qed |
|
651 |
||
652 |
lemma affine_translation: |
|
653 |
fixes a :: "'a::real_vector" |
|
654 |
shows "affine S <-> affine ((%x. a + x) ` S)" |
|
655 |
proof- |
|
656 |
have "affine S ==> affine ((%x. a + x) ` S)" using affine_translation_aux[of "-a" "((%x. a + x) ` S)"] using translation_assoc[of "-a" a S] by auto |
|
657 |
from this show ?thesis using affine_translation_aux by auto |
|
658 |
qed |
|
659 |
||
660 |
lemma parallel_is_affine: |
|
661 |
fixes S T :: "'a::real_vector set" |
|
662 |
assumes "affine S" "affine_parallel S T" |
|
663 |
shows "affine T" |
|
664 |
proof- |
|
665 |
from assms obtain a where "T=((%x. a + x) ` S)" unfolding affine_parallel_def by auto |
|
666 |
from this show ?thesis using affine_translation assms by auto |
|
667 |
qed |
|
668 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
669 |
lemma subspace_imp_affine: "subspace s \<Longrightarrow> affine s" |
40377 | 670 |
unfolding subspace_def affine_def by auto |
671 |
||
44467 | 672 |
subsubsection {* Subspace parallel to an affine set *} |
40377 | 673 |
|
674 |
lemma subspace_affine: |
|
675 |
shows "subspace S <-> (affine S & 0 : S)" |
|
676 |
proof- |
|
677 |
have h0: "subspace S ==> (affine S & 0 : S)" using subspace_imp_affine[of S] subspace_0 by auto |
|
678 |
{ assume assm: "affine S & 0 : S" |
|
679 |
{ fix c :: real |
|
680 |
fix x assume x_def: "x : S" |
|
681 |
have "c *\<^sub>R x = (1-c) *\<^sub>R 0 + c *\<^sub>R x" by auto |
|
682 |
moreover have "(1-c) *\<^sub>R 0 + c *\<^sub>R x : S" using affine_alt[of S] assm x_def by auto |
|
683 |
ultimately have "c *\<^sub>R x : S" by auto |
|
684 |
} hence h1: "!c. !x : S. c *\<^sub>R x : S" by auto |
|
685 |
{ fix x y assume xy_def: "x : S" "y : S" |
|
686 |
def u == "(1 :: real)/2" |
|
687 |
have "(1/2) *\<^sub>R (x+y) = (1/2) *\<^sub>R (x+y)" by auto |
|
688 |
moreover have "(1/2) *\<^sub>R (x+y)=(1/2) *\<^sub>R x + (1-(1/2)) *\<^sub>R y" by (simp add: algebra_simps) |
|
689 |
moreover have "(1-u) *\<^sub>R x + u *\<^sub>R y : S" using affine_alt[of S] assm xy_def by auto |
|
690 |
ultimately have "(1/2) *\<^sub>R (x+y) : S" using u_def by auto |
|
691 |
moreover have "(x+y) = 2 *\<^sub>R ((1/2) *\<^sub>R (x+y))" by auto |
|
692 |
ultimately have "(x+y) : S" using h1[rule_format, of "(1/2) *\<^sub>R (x+y)" "2"] by auto |
|
693 |
} hence "!x : S. !y : S. (x+y) : S" by auto |
|
694 |
hence "subspace S" using h1 assm unfolding subspace_def by auto |
|
695 |
} from this show ?thesis using h0 by metis |
|
696 |
qed |
|
697 |
||
698 |
lemma affine_diffs_subspace: |
|
699 |
assumes "affine S" "a : S" |
|
700 |
shows "subspace ((%x. (-a)+x) ` S)" |
|
701 |
proof- |
|
702 |
have "affine ((%x. (-a)+x) ` S)" using affine_translation assms by auto |
|
703 |
moreover have "0 : ((%x. (-a)+x) ` S)" using assms exI[of "(%x. x:S & -a+x=0)" a] by auto |
|
704 |
ultimately show ?thesis using subspace_affine by auto |
|
705 |
qed |
|
706 |
||
707 |
lemma parallel_subspace_explicit: |
|
708 |
assumes "affine S" "a : S" |
|
709 |
assumes "L == {y. ? x : S. (-a)+x=y}" |
|
710 |
shows "subspace L & affine_parallel S L" |
|
711 |
proof- |
|
712 |
have par: "affine_parallel S L" unfolding affine_parallel_def using assms by auto |
|
713 |
hence "affine L" using assms parallel_is_affine by auto |
|
714 |
moreover have "0 : L" using assms apply auto using exI[of "(%x. x:S & -a+x=0)" a] by auto |
|
715 |
ultimately show ?thesis using subspace_affine par by auto |
|
716 |
qed |
|
717 |
||
718 |
lemma parallel_subspace_aux: |
|
719 |
assumes "subspace A" "subspace B" "affine_parallel A B" |
|
720 |
shows "A>=B" |
|
721 |
proof- |
|
722 |
from assms obtain a where a_def: "!x. (x : A <-> (a+x) : B)" using affine_parallel_expl[of A B] by auto |
|
723 |
hence "-a : A" using assms subspace_0[of B] by auto |
|
724 |
hence "a : A" using assms subspace_neg[of A "-a"] by auto |
|
725 |
from this show ?thesis using assms a_def unfolding subspace_def by auto |
|
726 |
qed |
|
727 |
||
728 |
lemma parallel_subspace: |
|
729 |
assumes "subspace A" "subspace B" "affine_parallel A B" |
|
730 |
shows "A=B" |
|
731 |
proof- |
|
732 |
have "A>=B" using assms parallel_subspace_aux by auto |
|
733 |
moreover have "A<=B" using assms parallel_subspace_aux[of B A] affine_parallel_commut by auto |
|
734 |
ultimately show ?thesis by auto |
|
735 |
qed |
|
736 |
||
737 |
lemma affine_parallel_subspace: |
|
738 |
assumes "affine S" "S ~= {}" |
|
739 |
shows "?!L. subspace L & affine_parallel S L" |
|
740 |
proof- |
|
741 |
have ex: "? L. subspace L & affine_parallel S L" using assms parallel_subspace_explicit by auto |
|
742 |
{ fix L1 L2 assume ass: "subspace L1 & affine_parallel S L1" "subspace L2 & affine_parallel S L2" |
|
743 |
hence "affine_parallel L1 L2" using affine_parallel_commut[of S L1] affine_parallel_assoc[of L1 S L2] by auto |
|
744 |
hence "L1=L2" using ass parallel_subspace by auto |
|
745 |
} from this show ?thesis using ex by auto |
|
746 |
qed |
|
747 |
||
44467 | 748 |
subsection {* Cones *} |
33175 | 749 |
|
750 |
definition |
|
751 |
cone :: "'a::real_vector set \<Rightarrow> bool" where |
|
752 |
"cone s \<longleftrightarrow> (\<forall>x\<in>s. \<forall>c\<ge>0. (c *\<^sub>R x) \<in> s)" |
|
753 |
||
754 |
lemma cone_empty[intro, simp]: "cone {}" |
|
755 |
unfolding cone_def by auto |
|
756 |
||
757 |
lemma cone_univ[intro, simp]: "cone UNIV" |
|
758 |
unfolding cone_def by auto |
|
759 |
||
760 |
lemma cone_Inter[intro]: "(\<forall>s\<in>f. cone s) \<Longrightarrow> cone(\<Inter> f)" |
|
761 |
unfolding cone_def by auto |
|
762 |
||
44467 | 763 |
subsubsection {* Conic hull *} |
33175 | 764 |
|
765 |
lemma cone_cone_hull: "cone (cone hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
766 |
unfolding hull_def by auto |
33175 | 767 |
|
768 |
lemma cone_hull_eq: "(cone hull s = s) \<longleftrightarrow> cone s" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
769 |
apply(rule hull_eq) |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
770 |
using cone_Inter unfolding subset_eq by auto |
33175 | 771 |
|
40377 | 772 |
lemma mem_cone: |
773 |
assumes "cone S" "x : S" "c>=0" |
|
774 |
shows "c *\<^sub>R x : S" |
|
775 |
using assms cone_def[of S] by auto |
|
776 |
||
777 |
lemma cone_contains_0: |
|
778 |
assumes "cone S" |
|
779 |
shows "(S ~= {}) <-> (0 : S)" |
|
780 |
proof- |
|
781 |
{ assume "S ~= {}" from this obtain a where "a:S" by auto |
|
782 |
hence "0 : S" using assms mem_cone[of S a 0] by auto |
|
783 |
} from this show ?thesis by auto |
|
784 |
qed |
|
785 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
786 |
lemma cone_0: "cone {0}" |
40377 | 787 |
unfolding cone_def by auto |
788 |
||
789 |
lemma cone_Union[intro]: "(!s:f. cone s) --> (cone (Union f))" |
|
790 |
unfolding cone_def by blast |
|
791 |
||
792 |
lemma cone_iff: |
|
793 |
assumes "S ~= {}" |
|
794 |
shows "cone S <-> 0:S & (!c. c>0 --> ((op *\<^sub>R c) ` S) = S)" |
|
795 |
proof- |
|
796 |
{ assume "cone S" |
|
797 |
{ fix c assume "(c :: real)>0" |
|
798 |
{ fix x assume "x : S" hence "x : (op *\<^sub>R c) ` S" unfolding image_def |
|
799 |
using `cone S` `c>0` mem_cone[of S x "1/c"] |
|
800 |
exI[of "(%t. t:S & x = c *\<^sub>R t)" "(1 / c) *\<^sub>R x"] by auto |
|
801 |
} |
|
802 |
moreover |
|
803 |
{ fix x assume "x : (op *\<^sub>R c) ` S" |
|
804 |
(*from this obtain t where "t:S & x = c *\<^sub>R t" by auto*) |
|
805 |
hence "x:S" using `cone S` `c>0` unfolding cone_def image_def `c>0` by auto |
|
806 |
} |
|
807 |
ultimately have "((op *\<^sub>R c) ` S) = S" by auto |
|
808 |
} hence "0:S & (!c. c>0 --> ((op *\<^sub>R c) ` S) = S)" using `cone S` cone_contains_0[of S] assms by auto |
|
809 |
} |
|
810 |
moreover |
|
811 |
{ assume a: "0:S & (!c. c>0 --> ((op *\<^sub>R c) ` S) = S)" |
|
812 |
{ fix x assume "x:S" |
|
813 |
fix c1 assume "(c1 :: real)>=0" |
|
814 |
hence "(c1=0) | (c1>0)" by auto |
|
815 |
hence "c1 *\<^sub>R x : S" using a `x:S` by auto |
|
816 |
} |
|
817 |
hence "cone S" unfolding cone_def by auto |
|
818 |
} ultimately show ?thesis by blast |
|
819 |
qed |
|
820 |
||
821 |
lemma cone_hull_empty: |
|
822 |
"cone hull {} = {}" |
|
823 |
by (metis cone_empty cone_hull_eq) |
|
824 |
||
825 |
lemma cone_hull_empty_iff: |
|
826 |
shows "(S = {}) <-> (cone hull S = {})" |
|
827 |
by (metis bot_least cone_hull_empty hull_subset xtrans(5)) |
|
828 |
||
829 |
lemma cone_hull_contains_0: |
|
830 |
shows "(S ~= {}) <-> (0 : cone hull S)" |
|
831 |
using cone_cone_hull[of S] cone_contains_0[of "cone hull S"] cone_hull_empty_iff[of S] by auto |
|
832 |
||
833 |
lemma mem_cone_hull: |
|
834 |
assumes "x : S" "c>=0" |
|
835 |
shows "c *\<^sub>R x : cone hull S" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
836 |
by (metis assms cone_cone_hull hull_inc mem_cone) |
40377 | 837 |
|
838 |
lemma cone_hull_expl: |
|
839 |
shows "cone hull S = {c *\<^sub>R x | c x. c>=0 & x : S}" (is "?lhs = ?rhs") |
|
840 |
proof- |
|
841 |
{ fix x assume "x : ?rhs" |
|
842 |
from this obtain cx xx where x_def: "x= cx *\<^sub>R xx & (cx :: real)>=0 & xx : S" by auto |
|
843 |
fix c assume c_def: "(c :: real)>=0" |
|
844 |
hence "c *\<^sub>R x = (c*cx) *\<^sub>R xx" using x_def by (simp add: algebra_simps) |
|
845 |
moreover have "(c*cx) >= 0" using c_def x_def using mult_nonneg_nonneg by auto |
|
846 |
ultimately have "c *\<^sub>R x : ?rhs" using x_def by auto |
|
847 |
} hence "cone ?rhs" unfolding cone_def by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
848 |
hence "?rhs : Collect cone" unfolding mem_Collect_eq by auto |
40377 | 849 |
{ fix x assume "x : S" hence "1 *\<^sub>R x : ?rhs" apply auto apply(rule_tac x="1" in exI) by auto |
850 |
hence "x : ?rhs" by auto |
|
851 |
} hence "S <= ?rhs" by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
852 |
hence "?lhs <= ?rhs" using `?rhs : Collect cone` hull_minimal[of S "?rhs" "cone"] by auto |
40377 | 853 |
moreover |
854 |
{ fix x assume "x : ?rhs" |
|
855 |
from this obtain cx xx where x_def: "x= cx *\<^sub>R xx & (cx :: real)>=0 & xx : S" by auto |
|
856 |
hence "xx : cone hull S" using hull_subset[of S] by auto |
|
857 |
hence "x : ?lhs" using x_def cone_cone_hull[of S] cone_def[of "cone hull S"] by auto |
|
858 |
} ultimately show ?thesis by auto |
|
859 |
qed |
|
860 |
||
861 |
lemma cone_closure: |
|
862 |
fixes S :: "('m::euclidean_space) set" |
|
863 |
assumes "cone S" |
|
864 |
shows "cone (closure S)" |
|
865 |
proof- |
|
866 |
{ assume "S = {}" hence ?thesis by auto } |
|
867 |
moreover |
|
868 |
{ assume "S ~= {}" hence "0:S & (!c. c>0 --> op *\<^sub>R c ` S = S)" using cone_iff[of S] assms by auto |
|
869 |
hence "0:(closure S) & (!c. c>0 --> op *\<^sub>R c ` (closure S) = (closure S))" |
|
870 |
using closure_subset by (auto simp add: closure_scaleR) |
|
871 |
hence ?thesis using cone_iff[of "closure S"] by auto |
|
872 |
} |
|
873 |
ultimately show ?thesis by blast |
|
874 |
qed |
|
875 |
||
44467 | 876 |
subsection {* Affine dependence and consequential theorems (from Lars Schewe) *} |
33175 | 877 |
|
878 |
definition |
|
879 |
affine_dependent :: "'a::real_vector set \<Rightarrow> bool" where |
|
880 |
"affine_dependent s \<longleftrightarrow> (\<exists>x\<in>s. x \<in> (affine hull (s - {x})))" |
|
881 |
||
882 |
lemma affine_dependent_explicit: |
|
883 |
"affine_dependent p \<longleftrightarrow> |
|
884 |
(\<exists>s u. finite s \<and> s \<subseteq> p \<and> setsum u s = 0 \<and> |
|
885 |
(\<exists>v\<in>s. u v \<noteq> 0) \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = 0)" |
|
886 |
unfolding affine_dependent_def affine_hull_explicit mem_Collect_eq apply(rule) |
|
887 |
apply(erule bexE,erule exE,erule exE) apply(erule conjE)+ defer apply(erule exE,erule exE) apply(erule conjE)+ apply(erule bexE) |
|
888 |
proof- |
|
889 |
fix x s u 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" |
|
890 |
have "x\<notin>s" using as(1,4) by auto |
|
891 |
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" |
|
892 |
apply(rule_tac x="insert x s" in exI, rule_tac x="\<lambda>v. if v = x then - 1 else u v" in exI) |
|
893 |
unfolding if_smult and setsum_clauses(2)[OF as(2)] and setsum_delta_notmem[OF `x\<notin>s`] and as using as by auto |
|
894 |
next |
|
895 |
fix s u v 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" |
|
896 |
have "s \<noteq> {v}" using as(3,6) by auto |
|
897 |
thus "\<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" |
|
898 |
apply(rule_tac x=v in bexI, rule_tac x="s - {v}" in exI, rule_tac x="\<lambda>x. - (1 / u v) * u x" in exI) |
|
899 |
unfolding scaleR_scaleR[THEN sym] and scaleR_right.setsum [symmetric] unfolding setsum_right_distrib[THEN sym] and setsum_diff1[OF as(1)] using as by auto |
|
900 |
qed |
|
901 |
||
902 |
lemma affine_dependent_explicit_finite: |
|
903 |
fixes s :: "'a::real_vector set" assumes "finite s" |
|
904 |
shows "affine_dependent s \<longleftrightarrow> (\<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)" |
|
905 |
(is "?lhs = ?rhs") |
|
906 |
proof |
|
907 |
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))" by auto |
|
908 |
assume ?lhs |
|
909 |
then obtain t u v where "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" |
|
910 |
unfolding affine_dependent_explicit by auto |
|
911 |
thus ?rhs apply(rule_tac x="\<lambda>x. if x\<in>t then u x else 0" in exI) |
|
912 |
apply auto unfolding * and setsum_restrict_set[OF assms, THEN sym] |
|
913 |
unfolding Int_absorb1[OF `t\<subseteq>s`] by auto |
|
914 |
next |
|
915 |
assume ?rhs |
|
916 |
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" by auto |
|
917 |
thus ?lhs unfolding affine_dependent_explicit using assms by auto |
|
918 |
qed |
|
919 |
||
44465
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
920 |
subsection {* Connectedness of convex sets *} |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
921 |
|
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
922 |
lemma connected_real_lemma: |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
923 |
fixes f :: "real \<Rightarrow> 'a::metric_space" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
924 |
assumes ab: "a \<le> b" and fa: "f a \<in> e1" and fb: "f b \<in> e2" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
925 |
and dst: "\<And>e x. a <= x \<Longrightarrow> x <= b \<Longrightarrow> 0 < e ==> \<exists>d > 0. \<forall>y. abs(y - x) < d \<longrightarrow> dist(f y) (f x) < e" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
926 |
and e1: "\<forall>y \<in> e1. \<exists>e > 0. \<forall>y'. dist y' y < e \<longrightarrow> y' \<in> e1" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
927 |
and e2: "\<forall>y \<in> e2. \<exists>e > 0. \<forall>y'. dist y' y < e \<longrightarrow> y' \<in> e2" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
928 |
and e12: "~(\<exists>x \<ge> a. x <= b \<and> f x \<in> e1 \<and> f x \<in> e2)" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
929 |
shows "\<exists>x \<ge> a. x <= b \<and> f x \<notin> e1 \<and> f x \<notin> e2" (is "\<exists> x. ?P x") |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
930 |
proof- |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
931 |
let ?S = "{c. \<forall>x \<ge> a. x <= c \<longrightarrow> f x \<in> e1}" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
932 |
have Se: " \<exists>x. x \<in> ?S" apply (rule exI[where x=a]) by (auto simp add: fa) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
933 |
have Sub: "\<exists>y. isUb UNIV ?S y" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
934 |
apply (rule exI[where x= b]) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
935 |
using ab fb e12 by (auto simp add: isUb_def setle_def) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
936 |
from reals_complete[OF Se Sub] obtain l where |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
937 |
l: "isLub UNIV ?S l"by blast |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
938 |
have alb: "a \<le> l" "l \<le> b" using l ab fa fb e12 |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
939 |
apply (auto simp add: isLub_def leastP_def isUb_def setle_def setge_def) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
940 |
by (metis linorder_linear) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
941 |
have ale1: "\<forall>z \<ge> a. z < l \<longrightarrow> f z \<in> e1" using l |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
942 |
apply (auto simp add: isLub_def leastP_def isUb_def setle_def setge_def) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
943 |
by (metis linorder_linear not_le) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
944 |
have th1: "\<And>z x e d :: real. z <= x + e \<Longrightarrow> e < d ==> z < x \<or> abs(z - x) < d" by arith |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
945 |
have th2: "\<And>e x:: real. 0 < e ==> ~(x + e <= x)" by arith |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
946 |
have "\<And>d::real. 0 < d \<Longrightarrow> 0 < d/2 \<and> d/2 < d" by simp |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
947 |
then have th3: "\<And>d::real. d > 0 \<Longrightarrow> \<exists>e > 0. e < d" by blast |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
948 |
{assume le2: "f l \<in> e2" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
949 |
from le2 fa fb e12 alb have la: "l \<noteq> a" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
950 |
hence lap: "l - a > 0" using alb by arith |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
951 |
from e2[rule_format, OF le2] obtain e where |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
952 |
e: "e > 0" "\<forall>y. dist y (f l) < e \<longrightarrow> y \<in> e2" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
953 |
from dst[OF alb e(1)] obtain d where |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
954 |
d: "d > 0" "\<forall>y. \<bar>y - l\<bar> < d \<longrightarrow> dist (f y) (f l) < e" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
955 |
let ?d' = "min (d/2) ((l - a)/2)" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
956 |
have "?d' < d \<and> 0 < ?d' \<and> ?d' < l - a" using lap d(1) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
957 |
by (simp add: min_max.less_infI2) |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
958 |
then have "\<exists>d'. d' < d \<and> d' >0 \<and> l - d' > a" by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
959 |
then obtain d' where d': "d' > 0" "d' < d" "l - d' > a" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
960 |
from d e have th0: "\<forall>y. \<bar>y - l\<bar> < d \<longrightarrow> f y \<in> e2" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
961 |
from th0[rule_format, of "l - d'"] d' have "f (l - d') \<in> e2" by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
962 |
moreover |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
963 |
have "f (l - d') \<in> e1" using ale1[rule_format, of "l -d'"] d' by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
964 |
ultimately have False using e12 alb d' by auto} |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
965 |
moreover |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
966 |
{assume le1: "f l \<in> e1" |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
967 |
from le1 fa fb e12 alb have lb: "l \<noteq> b" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
968 |
hence blp: "b - l > 0" using alb by arith |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
969 |
from e1[rule_format, OF le1] obtain e where |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
970 |
e: "e > 0" "\<forall>y. dist y (f l) < e \<longrightarrow> y \<in> e1" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
971 |
from dst[OF alb e(1)] obtain d where |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
972 |
d: "d > 0" "\<forall>y. \<bar>y - l\<bar> < d \<longrightarrow> dist (f y) (f l) < e" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
973 |
have "\<And>d::real. 0 < d \<Longrightarrow> d/2 < d \<and> 0 < d/2" by simp |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
974 |
then have "\<exists>d'. d' < d \<and> d' >0" using d(1) by blast |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
975 |
then obtain d' where d': "d' > 0" "d' < d" by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
976 |
from d e have th0: "\<forall>y. \<bar>y - l\<bar> < d \<longrightarrow> f y \<in> e1" by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
977 |
hence "\<forall>y. l \<le> y \<and> y \<le> l + d' \<longrightarrow> f y \<in> e1" using d' by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
978 |
with ale1 have "\<forall>y. a \<le> y \<and> y \<le> l + d' \<longrightarrow> f y \<in> e1" by auto |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
979 |
with l d' have False |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
980 |
by (auto simp add: isLub_def isUb_def setle_def setge_def leastP_def) } |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
981 |
ultimately show ?thesis using alb by metis |
fa56622bb7bc
move connected_real_lemma to the one place it is used
huffman
parents:
44457
diff
changeset
|
982 |
qed |
33175 | 983 |
|
984 |
lemma convex_connected: |
|
985 |
fixes s :: "'a::real_normed_vector set" |
|
986 |
assumes "convex s" shows "connected s" |
|
987 |
proof- |
|
988 |
{ fix e1 e2 assume as:"open e1" "open e2" "e1 \<inter> e2 \<inter> s = {}" "s \<subseteq> e1 \<union> e2" |
|
989 |
assume "e1 \<inter> s \<noteq> {}" "e2 \<inter> s \<noteq> {}" |
|
990 |
then obtain x1 x2 where x1:"x1\<in>e1" "x1\<in>s" and x2:"x2\<in>e2" "x2\<in>s" by auto |
|
991 |
hence n:"norm (x1 - x2) > 0" unfolding zero_less_norm_iff using as(3) by auto |
|
992 |
||
993 |
{ fix x e::real assume as:"0 \<le> x" "x \<le> 1" "0 < e" |
|
994 |
{ fix y have *:"(1 - x) *\<^sub>R x1 + x *\<^sub>R x2 - ((1 - y) *\<^sub>R x1 + y *\<^sub>R x2) = (y - x) *\<^sub>R x1 - (y - x) *\<^sub>R x2" |
|
995 |
by (simp add: algebra_simps) |
|
996 |
assume "\<bar>y - x\<bar> < e / norm (x1 - x2)" |
|
997 |
hence "norm ((1 - x) *\<^sub>R x1 + x *\<^sub>R x2 - ((1 - y) *\<^sub>R x1 + y *\<^sub>R x2)) < e" |
|
998 |
unfolding * and scaleR_right_diff_distrib[THEN sym] |
|
999 |
unfolding less_divide_eq using n by auto } |
|
1000 |
hence "\<exists>d>0. \<forall>y. \<bar>y - x\<bar> < d \<longrightarrow> norm ((1 - x) *\<^sub>R x1 + x *\<^sub>R x2 - ((1 - y) *\<^sub>R x1 + y *\<^sub>R x2)) < e" |
|
1001 |
apply(rule_tac x="e / norm (x1 - x2)" in exI) using as |
|
1002 |
apply auto unfolding zero_less_divide_iff using n by simp } note * = this |
|
1003 |
||
1004 |
have "\<exists>x\<ge>0. x \<le> 1 \<and> (1 - x) *\<^sub>R x1 + x *\<^sub>R x2 \<notin> e1 \<and> (1 - x) *\<^sub>R x1 + x *\<^sub>R x2 \<notin> e2" |
|
1005 |
apply(rule connected_real_lemma) apply (simp add: `x1\<in>e1` `x2\<in>e2` dist_commute)+ |
|
1006 |
using * apply(simp add: dist_norm) |
|
1007 |
using as(1,2)[unfolded open_dist] apply simp |
|
1008 |
using as(1,2)[unfolded open_dist] apply simp |
|
1009 |
using assms[unfolded convex_alt, THEN bspec[where x=x1], THEN bspec[where x=x2]] using x1 x2 |
|
1010 |
using as(3) by auto |
|
1011 |
then obtain x where "x\<ge>0" "x\<le>1" "(1 - x) *\<^sub>R x1 + x *\<^sub>R x2 \<notin> e1" "(1 - x) *\<^sub>R x1 + x *\<^sub>R x2 \<notin> e2" by auto |
|
1012 |
hence False using as(4) |
|
1013 |
using assms[unfolded convex_alt, THEN bspec[where x=x1], THEN bspec[where x=x2]] |
|
1014 |
using x1(2) x2(2) by auto } |
|
1015 |
thus ?thesis unfolding connected_def by auto |
|
1016 |
qed |
|
1017 |
||
44467 | 1018 |
text {* One rather trivial consequence. *} |
33175 | 1019 |
|
34964 | 1020 |
lemma connected_UNIV[intro]: "connected (UNIV :: 'a::real_normed_vector set)" |
33175 | 1021 |
by(simp add: convex_connected convex_UNIV) |
1022 |
||
44467 | 1023 |
text {* Balls, being convex, are connected. *} |
33175 | 1024 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1025 |
lemma convex_box: fixes a::"'a::euclidean_space" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1026 |
assumes "\<And>i. i<DIM('a) \<Longrightarrow> convex {x. P i x}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1027 |
shows "convex {x. \<forall>i<DIM('a). P i (x$$i)}" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
1028 |
using assms unfolding convex_def by auto |
33175 | 1029 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1030 |
lemma convex_positive_orthant: "convex {x::'a::euclidean_space. (\<forall>i<DIM('a). 0 \<le> x$$i)}" |
36623 | 1031 |
by (rule convex_box) (simp add: atLeast_def[symmetric] convex_real_interval) |
33175 | 1032 |
|
1033 |
lemma convex_local_global_minimum: |
|
1034 |
fixes s :: "'a::real_normed_vector set" |
|
1035 |
assumes "0<e" "convex_on s f" "ball x e \<subseteq> s" "\<forall>y\<in>ball x e. f x \<le> f y" |
|
1036 |
shows "\<forall>y\<in>s. f x \<le> f y" |
|
1037 |
proof(rule ccontr) |
|
1038 |
have "x\<in>s" using assms(1,3) by auto |
|
1039 |
assume "\<not> (\<forall>y\<in>s. f x \<le> f y)" |
|
1040 |
then obtain y where "y\<in>s" and y:"f x > f y" by auto |
|
1041 |
hence xy:"0 < dist x y" by (auto simp add: dist_nz[THEN sym]) |
|
1042 |
||
1043 |
then obtain u where "0 < u" "u \<le> 1" and u:"u < e / dist x y" |
|
1044 |
using real_lbound_gt_zero[of 1 "e / dist x y"] using xy `e>0` and divide_pos_pos[of e "dist x y"] by auto |
|
1045 |
hence "f ((1-u) *\<^sub>R x + u *\<^sub>R y) \<le> (1-u) * f x + u * f y" using `x\<in>s` `y\<in>s` |
|
1046 |
using assms(2)[unfolded convex_on_def, THEN bspec[where x=x], THEN bspec[where x=y], THEN spec[where x="1-u"]] by auto |
|
1047 |
moreover |
|
1048 |
have *:"x - ((1 - u) *\<^sub>R x + u *\<^sub>R y) = u *\<^sub>R (x - y)" by (simp add: algebra_simps) |
|
1049 |
have "(1 - u) *\<^sub>R x + u *\<^sub>R y \<in> ball x e" unfolding mem_ball dist_norm unfolding * and norm_scaleR and abs_of_pos[OF `0<u`] unfolding dist_norm[THEN sym] |
|
1050 |
using u unfolding pos_less_divide_eq[OF xy] by auto |
|
1051 |
hence "f x \<le> f ((1 - u) *\<^sub>R x + u *\<^sub>R y)" using assms(4) by auto |
|
1052 |
ultimately show False using mult_strict_left_mono[OF y `u>0`] unfolding left_diff_distrib by auto |
|
1053 |
qed |
|
1054 |
||
1055 |
lemma convex_ball: |
|
1056 |
fixes x :: "'a::real_normed_vector" |
|
1057 |
shows "convex (ball x e)" |
|
1058 |
proof(auto simp add: convex_def) |
|
1059 |
fix y z assume yz:"dist x y < e" "dist x z < e" |
|
1060 |
fix u v ::real assume uv:"0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1061 |
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z" using uv yz |
|
1062 |
using convex_distance[of "ball x e" x, unfolded convex_on_def, THEN bspec[where x=y], THEN bspec[where x=z]] by auto |
|
36623 | 1063 |
thus "dist x (u *\<^sub>R y + v *\<^sub>R z) < e" using convex_bound_lt[OF yz uv] by auto |
33175 | 1064 |
qed |
1065 |
||
1066 |
lemma convex_cball: |
|
1067 |
fixes x :: "'a::real_normed_vector" |
|
1068 |
shows "convex(cball x e)" |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
1069 |
proof(auto simp add: convex_def Ball_def) |
33175 | 1070 |
fix y z assume yz:"dist x y \<le> e" "dist x z \<le> e" |
1071 |
fix u v ::real assume uv:" 0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1072 |
have "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> u * dist x y + v * dist x z" using uv yz |
|
1073 |
using convex_distance[of "cball x e" x, unfolded convex_on_def, THEN bspec[where x=y], THEN bspec[where x=z]] by auto |
|
36623 | 1074 |
thus "dist x (u *\<^sub>R y + v *\<^sub>R z) \<le> e" using convex_bound_le[OF yz uv] by auto |
33175 | 1075 |
qed |
1076 |
||
1077 |
lemma connected_ball: |
|
1078 |
fixes x :: "'a::real_normed_vector" |
|
1079 |
shows "connected (ball x e)" |
|
1080 |
using convex_connected convex_ball by auto |
|
1081 |
||
1082 |
lemma connected_cball: |
|
1083 |
fixes x :: "'a::real_normed_vector" |
|
1084 |
shows "connected(cball x e)" |
|
1085 |
using convex_connected convex_cball by auto |
|
1086 |
||
44467 | 1087 |
subsection {* Convex hull *} |
33175 | 1088 |
|
1089 |
lemma convex_convex_hull: "convex(convex hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1090 |
unfolding hull_def using convex_Inter[of "{t. convex t \<and> s \<subseteq> t}"] |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1091 |
by auto |
33175 | 1092 |
|
34064
eee04bbbae7e
avoid dependency on implicit dest rule predicate1D in proofs
haftmann
parents:
33758
diff
changeset
|
1093 |
lemma convex_hull_eq: "convex hull s = s \<longleftrightarrow> convex s" |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1094 |
by (metis convex_convex_hull hull_same) |
33175 | 1095 |
|
1096 |
lemma bounded_convex_hull: |
|
1097 |
fixes s :: "'a::real_normed_vector set" |
|
1098 |
assumes "bounded s" shows "bounded(convex hull s)" |
|
1099 |
proof- from assms obtain B where B:"\<forall>x\<in>s. norm x \<le> B" unfolding bounded_iff by auto |
|
1100 |
show ?thesis 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
|
1101 |
unfolding subset_hull[of convex, OF convex_cball] |
33175 | 1102 |
unfolding subset_eq mem_cball dist_norm using B by auto qed |
1103 |
||
1104 |
lemma finite_imp_bounded_convex_hull: |
|
1105 |
fixes s :: "'a::real_normed_vector set" |
|
1106 |
shows "finite s \<Longrightarrow> bounded(convex hull s)" |
|
1107 |
using bounded_convex_hull finite_imp_bounded by auto |
|
1108 |
||
44467 | 1109 |
subsubsection {* Convex hull is "preserved" by a linear function *} |
40377 | 1110 |
|
1111 |
lemma convex_hull_linear_image: |
|
1112 |
assumes "bounded_linear f" |
|
1113 |
shows "f ` (convex hull s) = convex hull (f ` s)" |
|
1114 |
apply rule unfolding subset_eq ball_simps apply(rule_tac[!] hull_induct, rule hull_inc) prefer 3 |
|
1115 |
apply(erule imageE)apply(rule_tac x=xa in image_eqI) apply assumption |
|
1116 |
apply(rule hull_subset[unfolded subset_eq, rule_format]) apply assumption |
|
1117 |
proof- |
|
1118 |
interpret f: bounded_linear f by fact |
|
1119 |
show "convex {x. f x \<in> convex hull f ` s}" |
|
1120 |
unfolding convex_def by(auto simp add: f.scaleR f.add convex_convex_hull[unfolded convex_def, rule_format]) next |
|
1121 |
interpret f: bounded_linear f by fact |
|
1122 |
show "convex {x. x \<in> f ` (convex hull s)}" using convex_convex_hull[unfolded convex_def, of s] |
|
1123 |
unfolding convex_def by (auto simp add: f.scaleR [symmetric] f.add [symmetric]) |
|
1124 |
qed auto |
|
1125 |
||
1126 |
lemma in_convex_hull_linear_image: |
|
1127 |
assumes "bounded_linear f" "x \<in> convex hull s" |
|
1128 |
shows "(f x) \<in> convex hull (f ` s)" |
|
1129 |
using convex_hull_linear_image[OF assms(1)] assms(2) by auto |
|
1130 |
||
44467 | 1131 |
subsubsection {* Stepping theorems for convex hulls of finite sets *} |
33175 | 1132 |
|
1133 |
lemma convex_hull_empty[simp]: "convex hull {} = {}" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1134 |
apply(rule hull_unique) by auto |
33175 | 1135 |
|
1136 |
lemma convex_hull_singleton[simp]: "convex hull {a} = {a}" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1137 |
apply(rule hull_unique) by auto |
33175 | 1138 |
|
1139 |
lemma convex_hull_insert: |
|
1140 |
fixes s :: "'a::real_vector set" |
|
1141 |
assumes "s \<noteq> {}" |
|
1142 |
shows "convex hull (insert a s) = {x. \<exists>u\<ge>0. \<exists>v\<ge>0. \<exists>b. (u + v = 1) \<and> |
|
1143 |
b \<in> (convex hull s) \<and> (x = u *\<^sub>R a + v *\<^sub>R b)}" (is "?xyz = ?hull") |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1144 |
apply(rule,rule hull_minimal,rule) unfolding insert_iff prefer 3 apply rule proof- |
33175 | 1145 |
fix x assume x:"x = a \<or> x \<in> s" |
1146 |
thus "x\<in>?hull" apply rule unfolding mem_Collect_eq apply(rule_tac x=1 in exI) defer |
|
1147 |
apply(rule_tac x=0 in exI) using assms hull_subset[of s convex] by auto |
|
1148 |
next |
|
1149 |
fix x assume "x\<in>?hull" |
|
1150 |
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" by auto |
|
1151 |
have "a\<in>convex hull insert a s" "b\<in>convex hull insert a s" |
|
1152 |
using hull_mono[of s "insert a s" convex] hull_mono[of "{a}" "insert a s" convex] and obt(4) by auto |
|
1153 |
thus "x\<in> convex hull insert a s" unfolding obt(5) using convex_convex_hull[of "insert a s", unfolded convex_def] |
|
1154 |
apply(erule_tac x=a in ballE) apply(erule_tac x=b in ballE) apply(erule_tac x=u in allE) using obt by auto |
|
1155 |
next |
|
1156 |
show "convex ?hull" unfolding convex_def apply(rule,rule,rule,rule,rule,rule,rule) proof- |
|
1157 |
fix x y u v assume as:"(0::real) \<le> u" "0 \<le> v" "u + v = 1" "x\<in>?hull" "y\<in>?hull" |
|
1158 |
from as(4) obtain u1 v1 b1 where obt1:"u1\<ge>0" "v1\<ge>0" "u1 + v1 = 1" "b1 \<in> convex hull s" "x = u1 *\<^sub>R a + v1 *\<^sub>R b1" by auto |
|
1159 |
from as(5) obtain u2 v2 b2 where obt2:"u2\<ge>0" "v2\<ge>0" "u2 + v2 = 1" "b2 \<in> convex hull s" "y = u2 *\<^sub>R a + v2 *\<^sub>R b2" by auto |
|
1160 |
have *:"\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x" by (auto simp add: algebra_simps) |
|
1161 |
have "\<exists>b \<in> convex hull s. u *\<^sub>R x + v *\<^sub>R y = (u * u1) *\<^sub>R a + (v * u2) *\<^sub>R a + (b - (u * u1) *\<^sub>R b - (v * u2) *\<^sub>R b)" |
|
1162 |
proof(cases "u * v1 + v * v2 = 0") |
|
1163 |
have *:"\<And>(x::'a) s1 s2. x - s1 *\<^sub>R x - s2 *\<^sub>R x = ((1::real) - (s1 + s2)) *\<^sub>R x" by (auto simp add: algebra_simps) |
|
36071 | 1164 |
case True hence **:"u * v1 = 0" "v * v2 = 0" |
1165 |
using mult_nonneg_nonneg[OF `u\<ge>0` `v1\<ge>0`] mult_nonneg_nonneg[OF `v\<ge>0` `v2\<ge>0`] by arith+ |
|
33175 | 1166 |
hence "u * u1 + v * u2 = 1" using as(3) obt1(3) obt2(3) by auto |
1167 |
thus ?thesis unfolding obt1(5) obt2(5) * using assms hull_subset[of s convex] by(auto simp add: ** scaleR_right_distrib) |
|
1168 |
next |
|
1169 |
have "1 - (u * u1 + v * u2) = (u + v) - (u * u1 + v * u2)" using as(3) obt1(3) obt2(3) by (auto simp add: field_simps) |
|
1170 |
also have "\<dots> = u * (v1 + u1 - u1) + v * (v2 + u2 - u2)" using as(3) obt1(3) obt2(3) by (auto simp add: field_simps) |
|
1171 |
also have "\<dots> = u * v1 + v * v2" by simp finally have **:"1 - (u * u1 + v * u2) = u * v1 + v * v2" by auto |
|
1172 |
case False have "0 \<le> u * v1 + v * v2" "0 \<le> u * v1" "0 \<le> u * v1 + v * v2" "0 \<le> v * v2" apply - |
|
1173 |
apply(rule add_nonneg_nonneg) prefer 4 apply(rule add_nonneg_nonneg) apply(rule_tac [!] mult_nonneg_nonneg) |
|
1174 |
using as(1,2) obt1(1,2) obt2(1,2) by auto |
|
1175 |
thus ?thesis unfolding obt1(5) obt2(5) unfolding * and ** using False |
|
1176 |
apply(rule_tac x="((u * v1) / (u * v1 + v * v2)) *\<^sub>R b1 + ((v * v2) / (u * v1 + v * v2)) *\<^sub>R b2" in bexI) defer |
|
1177 |
apply(rule convex_convex_hull[of s, unfolded convex_def, rule_format]) using obt1(4) obt2(4) |
|
44349
f057535311c5
remove redundant lemma real_0_le_divide_iff in favor or zero_le_divide_iff
huffman
parents:
44282
diff
changeset
|
1178 |
unfolding add_divide_distrib[THEN sym] and zero_le_divide_iff |
33175 | 1179 |
by (auto simp add: scaleR_left_distrib scaleR_right_distrib) |
1180 |
qed note * = this |
|
36071 | 1181 |
have u1:"u1 \<le> 1" unfolding obt1(3)[THEN sym] and not_le using obt1(2) by auto |
1182 |
have u2:"u2 \<le> 1" unfolding obt2(3)[THEN sym] and not_le using obt2(2) by auto |
|
33175 | 1183 |
have "u1 * u + u2 * v \<le> (max u1 u2) * u + (max u1 u2) * v" apply(rule add_mono) |
1184 |
apply(rule_tac [!] mult_right_mono) using as(1,2) obt1(1,2) obt2(1,2) by auto |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
1185 |
also have "\<dots> \<le> 1" unfolding right_distrib[THEN sym] and as(3) using u1 u2 by auto |
33175 | 1186 |
finally |
1187 |
show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull" unfolding mem_Collect_eq apply(rule_tac x="u * u1 + v * u2" in exI) |
|
1188 |
apply(rule conjI) defer apply(rule_tac x="1 - u * u1 - v * u2" in exI) unfolding Bex_def |
|
1189 |
using as(1,2) obt1(1,2) obt2(1,2) * by(auto intro!: mult_nonneg_nonneg add_nonneg_nonneg simp add: algebra_simps) |
|
1190 |
qed |
|
1191 |
qed |
|
1192 |
||
1193 |
||
44467 | 1194 |
subsubsection {* Explicit expression for convex hull *} |
33175 | 1195 |
|
1196 |
lemma convex_hull_indexed: |
|
1197 |
fixes s :: "'a::real_vector set" |
|
1198 |
shows "convex hull s = {y. \<exists>k u x. (\<forall>i\<in>{1::nat .. k}. 0 \<le> u i \<and> x i \<in> s) \<and> |
|
1199 |
(setsum u {1..k} = 1) \<and> |
|
1200 |
(setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} = y)}" (is "?xyz = ?hull") |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1201 |
apply(rule hull_unique) apply(rule) defer |
33175 | 1202 |
apply(subst convex_def) apply(rule,rule,rule,rule,rule,rule,rule) |
1203 |
proof- |
|
1204 |
fix x assume "x\<in>s" |
|
1205 |
thus "x \<in> ?hull" unfolding mem_Collect_eq apply(rule_tac x=1 in exI, rule_tac x="\<lambda>x. 1" in exI) by auto |
|
1206 |
next |
|
1207 |
fix t assume as:"s \<subseteq> t" "convex t" |
|
1208 |
show "?hull \<subseteq> t" apply(rule) unfolding mem_Collect_eq apply(erule exE | erule conjE)+ proof- |
|
1209 |
fix x k u y assume assm:"\<forall>i\<in>{1::nat..k}. 0 \<le> u i \<and> y i \<in> s" "setsum u {1..k} = 1" "(\<Sum>i = 1..k. u i *\<^sub>R y i) = x" |
|
1210 |
show "x\<in>t" unfolding assm(3)[THEN sym] apply(rule as(2)[unfolded convex, rule_format]) |
|
1211 |
using assm(1,2) as(1) by auto qed |
|
1212 |
next |
|
1213 |
fix x y u v assume uv:"0\<le>u" "0\<le>v" "u+v=(1::real)" and xy:"x\<in>?hull" "y\<in>?hull" |
|
1214 |
from xy obtain k1 u1 x1 where 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" by auto |
|
1215 |
from xy obtain k2 u2 x2 where 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" by auto |
|
1216 |
have *:"\<And>P (x1::'a) x2 s1 s2 i.(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)" |
|
1217 |
"{1..k1 + k2} \<inter> {1..k1} = {1..k1}" "{1..k1 + k2} \<inter> - {1..k1} = (\<lambda>i. i + k1) ` {1..k2}" |
|
1218 |
prefer 3 apply(rule,rule) unfolding image_iff apply(rule_tac x="x - k1" in bexI) by(auto simp add: not_le) |
|
1219 |
have inj:"inj_on (\<lambda>i. i + k1) {1..k2}" unfolding inj_on_def by auto |
|
1220 |
show "u *\<^sub>R x + v *\<^sub>R y \<in> ?hull" apply(rule) |
|
1221 |
apply(rule_tac x="k1 + k2" in exI, rule_tac x="\<lambda>i. if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)" in exI) |
|
1222 |
apply(rule_tac x="\<lambda>i. if i \<in> {1..k1} then x1 i else x2 (i - k1)" in exI) apply(rule,rule) defer apply(rule) |
|
35577 | 1223 |
unfolding * and setsum_cases[OF finite_atLeastAtMost[of 1 "k1 + k2"]] and setsum_reindex[OF inj] and o_def Collect_mem_eq |
33175 | 1224 |
unfolding scaleR_scaleR[THEN sym] scaleR_right.setsum [symmetric] setsum_right_distrib[THEN sym] proof- |
1225 |
fix i assume i:"i \<in> {1..k1+k2}" |
|
1226 |
show "0 \<le> (if i \<in> {1..k1} then u * u1 i else v * u2 (i - k1)) \<and> (if i \<in> {1..k1} then x1 i else x2 (i - k1)) \<in> s" |
|
1227 |
proof(cases "i\<in>{1..k1}") |
|
1228 |
case True thus ?thesis using mult_nonneg_nonneg[of u "u1 i"] and uv(1) x(1)[THEN bspec[where x=i]] by auto |
|
1229 |
next def j \<equiv> "i - k1" |
|
1230 |
case False with i have "j \<in> {1..k2}" unfolding j_def by auto |
|
1231 |
thus ?thesis unfolding j_def[symmetric] using False |
|
1232 |
using mult_nonneg_nonneg[of v "u2 j"] and uv(2) y(1)[THEN bspec[where x=j]] by auto qed |
|
1233 |
qed(auto simp add: not_le x(2,3) y(2,3) uv(3)) |
|
1234 |
qed |
|
1235 |
||
1236 |
lemma convex_hull_finite: |
|
1237 |
fixes s :: "'a::real_vector set" |
|
1238 |
assumes "finite s" |
|
1239 |
shows "convex hull s = {y. \<exists>u. (\<forall>x\<in>s. 0 \<le> u x) \<and> |
|
1240 |
setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}" (is "?HULL = ?set") |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1241 |
proof(rule hull_unique, auto simp add: convex_def[of ?set]) |
33175 | 1242 |
fix x assume "x\<in>s" thus " \<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" |
1243 |
apply(rule_tac x="\<lambda>y. if x=y then 1 else 0" in exI) apply auto |
|
1244 |
unfolding setsum_delta'[OF assms] and setsum_delta''[OF assms] by auto |
|
1245 |
next |
|
1246 |
fix u v ::real assume uv:"0 \<le> u" "0 \<le> v" "u + v = 1" |
|
1247 |
fix ux assume ux:"\<forall>x\<in>s. 0 \<le> ux x" "setsum ux s = (1::real)" |
|
1248 |
fix uy assume uy:"\<forall>x\<in>s. 0 \<le> uy x" "setsum uy s = (1::real)" |
|
1249 |
{ fix x assume "x\<in>s" |
|
1250 |
hence "0 \<le> u * ux x + v * uy x" using ux(1)[THEN bspec[where x=x]] uy(1)[THEN bspec[where x=x]] and uv(1,2) |
|
1251 |
by (auto, metis add_nonneg_nonneg mult_nonneg_nonneg uv(1) uv(2)) } |
|
1252 |
moreover have "(\<Sum>x\<in>s. u * ux x + v * uy x) = 1" |
|
1253 |
unfolding setsum_addf and setsum_right_distrib[THEN sym] and ux(2) uy(2) using uv(3) by auto |
|
1254 |
moreover 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)" |
|
1255 |
unfolding scaleR_left_distrib and setsum_addf and scaleR_scaleR[THEN sym] and scaleR_right.setsum [symmetric] by auto |
|
1256 |
ultimately show "\<exists>uc. (\<forall>x\<in>s. 0 \<le> uc x) \<and> setsum uc s = 1 \<and> (\<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)" |
|
1257 |
apply(rule_tac x="\<lambda>x. u * ux x + v * uy x" in exI) by auto |
|
1258 |
next |
|
1259 |
fix t assume t:"s \<subseteq> t" "convex t" |
|
1260 |
fix u assume u:"\<forall>x\<in>s. 0 \<le> u x" "setsum u s = (1::real)" |
|
1261 |
thus "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> t" using t(2)[unfolded convex_explicit, THEN spec[where x=s], THEN spec[where x=u]] |
|
1262 |
using assms and t(1) by auto |
|
1263 |
qed |
|
1264 |
||
44467 | 1265 |
subsubsection {* Another formulation from Lars Schewe *} |
33175 | 1266 |
|
1267 |
lemma setsum_constant_scaleR: |
|
1268 |
fixes y :: "'a::real_vector" |
|
1269 |
shows "(\<Sum>x\<in>A. y) = of_nat (card A) *\<^sub>R y" |
|
1270 |
apply (cases "finite A") |
|
1271 |
apply (induct set: finite) |
|
1272 |
apply (simp_all add: algebra_simps) |
|
1273 |
done |
|
1274 |
||
1275 |
lemma convex_hull_explicit: |
|
1276 |
fixes p :: "'a::real_vector set" |
|
1277 |
shows "convex hull p = {y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> |
|
1278 |
(\<forall>x\<in>s. 0 \<le> u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>v. u v *\<^sub>R v) s = y}" (is "?lhs = ?rhs") |
|
1279 |
proof- |
|
1280 |
{ fix x assume "x\<in>?lhs" |
|
1281 |
then obtain k u y where 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" |
|
1282 |
unfolding convex_hull_indexed by auto |
|
1283 |
||
1284 |
have fin:"finite {1..k}" by auto |
|
1285 |
have fin':"\<And>v. finite {i \<in> {1..k}. y i = v}" by auto |
|
1286 |
{ fix j assume "j\<in>{1..k}" |
|
1287 |
hence "y j \<in> p" "0 \<le> setsum u {i. Suc 0 \<le> i \<and> i \<le> k \<and> y i = y j}" |
|
1288 |
using obt(1)[THEN bspec[where x=j]] and obt(2) apply simp |
|
1289 |
apply(rule setsum_nonneg) using obt(1) by auto } |
|
1290 |
moreover |
|
1291 |
have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v}) = 1" |
|
1292 |
unfolding setsum_image_gen[OF fin, THEN sym] using obt(2) by auto |
|
1293 |
moreover have "(\<Sum>v\<in>y ` {1..k}. setsum u {i \<in> {1..k}. y i = v} *\<^sub>R v) = x" |
|
1294 |
using setsum_image_gen[OF fin, of "\<lambda>i. u i *\<^sub>R y i" y, THEN sym] |
|
1295 |
unfolding scaleR_left.setsum using obt(3) by auto |
|
1296 |
ultimately 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" |
|
1297 |
apply(rule_tac x="y ` {1..k}" in exI) |
|
1298 |
apply(rule_tac x="\<lambda>v. setsum u {i\<in>{1..k}. y i = v}" in exI) by auto |
|
1299 |
hence "x\<in>?rhs" by auto } |
|
1300 |
moreover |
|
1301 |
{ fix y assume "y\<in>?rhs" |
|
1302 |
then obtain s u where 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" by auto |
|
1303 |
||
1304 |
obtain f where f:"inj_on f {1..card s}" "f ` {1..card s} = s" using ex_bij_betw_nat_finite_1[OF obt(1)] unfolding bij_betw_def by auto |
|
1305 |
||
1306 |
{ fix i::nat assume "i\<in>{1..card s}" |
|
1307 |
hence "f i \<in> s" apply(subst f(2)[THEN sym]) by auto |
|
1308 |
hence "0 \<le> u (f i)" "f i \<in> p" using obt(2,3) by auto } |
|
1309 |
moreover have *:"finite {1..card s}" by auto |
|
1310 |
{ fix y assume "y\<in>s" |
|
1311 |
then obtain i where "i\<in>{1..card s}" "f i = y" using f using image_iff[of y f "{1..card s}"] by auto |
|
1312 |
hence "{x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = {i}" apply auto using f(1)[unfolded inj_on_def] apply(erule_tac x=x in ballE) by auto |
|
1313 |
hence "card {x. Suc 0 \<le> x \<and> x \<le> card s \<and> f x = y} = 1" by auto |
|
1314 |
hence "(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x)) = u y" |
|
1315 |
"(\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x) *\<^sub>R f x) = u y *\<^sub>R y" |
|
1316 |
by (auto simp add: setsum_constant_scaleR) } |
|
1317 |
||
1318 |
hence "(\<Sum>x = 1..card s. u (f x)) = 1" "(\<Sum>i = 1..card s. u (f i) *\<^sub>R f i) = y" |
|
1319 |
unfolding setsum_image_gen[OF *(1), of "\<lambda>x. u (f x) *\<^sub>R f x" f] and setsum_image_gen[OF *(1), of "\<lambda>x. u (f x)" f] |
|
1320 |
unfolding f using setsum_cong2[of 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"] |
|
1321 |
using setsum_cong2 [of s "\<lambda>y. (\<Sum>x\<in>{x \<in> {1..card s}. f x = y}. u (f x))" u] unfolding obt(4,5) by auto |
|
1322 |
||
1323 |
ultimately 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> (\<Sum>i::nat = 1..k. u i *\<^sub>R x i) = y" |
|
1324 |
apply(rule_tac x="card s" in exI) apply(rule_tac x="u \<circ> f" in exI) apply(rule_tac x=f in exI) by fastsimp |
|
1325 |
hence "y \<in> ?lhs" unfolding convex_hull_indexed by auto } |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
1326 |
ultimately show ?thesis unfolding set_eq_iff by blast |
33175 | 1327 |
qed |
1328 |
||
44467 | 1329 |
subsubsection {* A stepping theorem for that expansion *} |
33175 | 1330 |
|
1331 |
lemma convex_hull_finite_step: |
|
1332 |
fixes s :: "'a::real_vector set" assumes "finite s" |
|
1333 |
shows "(\<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) |
|
1334 |
\<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)" (is "?lhs = ?rhs") |
|
1335 |
proof(rule, case_tac[!] "a\<in>s") |
|
1336 |
assume "a\<in>s" hence *:"insert a s = s" by auto |
|
1337 |
assume ?lhs thus ?rhs unfolding * apply(rule_tac x=0 in exI) by auto |
|
1338 |
next |
|
1339 |
assume ?lhs then obtain u where 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" by auto |
|
1340 |
assume "a\<notin>s" thus ?rhs apply(rule_tac x="u a" in exI) using u(1)[THEN bspec[where x=a]] apply simp |
|
1341 |
apply(rule_tac x=u in exI) using u[unfolded setsum_clauses(2)[OF assms]] and `a\<notin>s` by auto |
|
1342 |
next |
|
1343 |
assume "a\<in>s" hence *:"insert a s = s" by auto |
|
1344 |
have fin:"finite (insert a s)" using assms by auto |
|
1345 |
assume ?rhs 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" by auto |
|
1346 |
show ?lhs apply(rule_tac x="\<lambda>x. (if a = x then v else 0) + u x" in exI) unfolding scaleR_left_distrib and setsum_addf and setsum_delta''[OF fin] and setsum_delta'[OF fin] |
|
1347 |
unfolding setsum_clauses(2)[OF assms] using uv and uv(2)[THEN bspec[where x=a]] and `a\<in>s` by auto |
|
1348 |
next |
|
1349 |
assume ?rhs 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" by auto |
|
1350 |
moreover assume "a\<notin>s" moreover have "(\<Sum>x\<in>s. if a = x then v else u x) = setsum u s" "(\<Sum>x\<in>s. (if a = x then v else u x) *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" |
|
1351 |
apply(rule_tac setsum_cong2) defer apply(rule_tac setsum_cong2) using `a\<notin>s` by auto |
|
1352 |
ultimately show ?lhs apply(rule_tac x="\<lambda>x. if a = x then v else u x" in exI) unfolding setsum_clauses(2)[OF assms] by auto |
|
1353 |
qed |
|
1354 |
||
44467 | 1355 |
subsubsection {* Hence some special cases *} |
33175 | 1356 |
|
1357 |
lemma convex_hull_2: |
|
1358 |
"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}" |
|
1359 |
proof- have *:"\<And>u. (\<forall>x\<in>{a, b}. 0 \<le> u x) \<longleftrightarrow> 0 \<le> u a \<and> 0 \<le> u b" by auto have **:"finite {b}" by auto |
|
1360 |
show ?thesis apply(simp add: convex_hull_finite) unfolding convex_hull_finite_step[OF **, of a 1, unfolded * conj_assoc] |
|
1361 |
apply auto apply(rule_tac x=v in exI) apply(rule_tac x="1 - v" in exI) apply simp |
|
1362 |
apply(rule_tac x=u in exI) apply simp apply(rule_tac x="\<lambda>x. v" in exI) by simp qed |
|
1363 |
||
1364 |
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
|
1365 |
unfolding convex_hull_2 |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1366 |
proof(rule Collect_cong) have *:"\<And>x y ::real. x + y = 1 \<longleftrightarrow> x = 1 - y" by auto |
33175 | 1367 |
fix x 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) = (\<exists>u. x = a + u *\<^sub>R (b - a) \<and> 0 \<le> u \<and> u \<le> 1)" |
1368 |
unfolding * apply auto apply(rule_tac[!] x=u in exI) by (auto simp add: algebra_simps) qed |
|
1369 |
||
1370 |
lemma convex_hull_3: |
|
1371 |
"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}" |
|
1372 |
proof- |
|
1373 |
have fin:"finite {a,b,c}" "finite {b,c}" "finite {c}" by auto |
|
1374 |
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
|
1375 |
by (auto simp add: field_simps) |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1376 |
show ?thesis unfolding convex_hull_finite[OF fin(1)] and convex_hull_finite_step[OF fin(2)] and * |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1377 |
unfolding convex_hull_finite_step[OF fin(3)] apply(rule Collect_cong) apply simp apply auto |
33175 | 1378 |
apply(rule_tac x=va in exI) apply (rule_tac x="u c" in exI) apply simp |
1379 |
apply(rule_tac x="1 - v - w" in exI) apply simp apply(rule_tac x=v in exI) apply simp apply(rule_tac x="\<lambda>x. w" in exI) by simp qed |
|
1380 |
||
1381 |
lemma convex_hull_3_alt: |
|
1382 |
"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}" |
|
1383 |
proof- have *:"\<And>x y z ::real. x + y + z = 1 \<longleftrightarrow> x = 1 - y - z" by auto |
|
1384 |
show ?thesis unfolding convex_hull_3 apply (auto simp add: *) apply(rule_tac x=v in exI) apply(rule_tac x=w in exI) apply (simp add: algebra_simps) |
|
1385 |
apply(rule_tac x=u in exI) apply(rule_tac x=v in exI) by (simp add: algebra_simps) qed |
|
1386 |
||
44467 | 1387 |
subsection {* Relations among closure notions and corresponding hulls *} |
33175 | 1388 |
|
1389 |
lemma affine_imp_convex: "affine s \<Longrightarrow> convex s" |
|
1390 |
unfolding affine_def convex_def by auto |
|
1391 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1392 |
lemma subspace_imp_convex: "subspace s \<Longrightarrow> convex s" |
33175 | 1393 |
using subspace_imp_affine affine_imp_convex by auto |
1394 |
||
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1395 |
lemma affine_hull_subset_span: "(affine hull s) \<subseteq> (span s)" |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1396 |
by (metis hull_minimal span_inc subspace_imp_affine subspace_span) |
33175 | 1397 |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1398 |
lemma convex_hull_subset_span: "(convex hull s) \<subseteq> (span s)" |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1399 |
by (metis hull_minimal span_inc subspace_imp_convex subspace_span) |
33175 | 1400 |
|
1401 |
lemma convex_hull_subset_affine_hull: "(convex hull s) \<subseteq> (affine hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1402 |
by (metis affine_affine_hull affine_imp_convex hull_minimal hull_subset) |
36071 | 1403 |
|
33175 | 1404 |
|
1405 |
lemma affine_dependent_imp_dependent: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1406 |
shows "affine_dependent s \<Longrightarrow> dependent s" |
33175 | 1407 |
unfolding affine_dependent_def dependent_def |
1408 |
using affine_hull_subset_span by auto |
|
1409 |
||
1410 |
lemma dependent_imp_affine_dependent: |
|
1411 |
assumes "dependent {x - a| x . x \<in> s}" "a \<notin> s" |
|
1412 |
shows "affine_dependent (insert a s)" |
|
1413 |
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
|
1414 |
from assms(1)[unfolded dependent_explicit] obtain S u v |
33175 | 1415 |
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" by auto |
1416 |
def t \<equiv> "(\<lambda>x. x + a) ` S" |
|
1417 |
||
1418 |
have inj:"inj_on (\<lambda>x. x + a) S" unfolding inj_on_def by auto |
|
1419 |
have "0\<notin>S" using obt(2) assms(2) unfolding subset_eq by auto |
|
1420 |
have fin:"finite t" and "t\<subseteq>s" unfolding t_def using obt(1,2) by auto |
|
1421 |
||
1422 |
hence "finite (insert a t)" and "insert a t \<subseteq> insert a s" by auto |
|
1423 |
moreover have *:"\<And>P Q. (\<Sum>x\<in>t. (if x = a then P x else Q x)) = (\<Sum>x\<in>t. Q x)" |
|
1424 |
apply(rule setsum_cong2) using `a\<notin>s` `t\<subseteq>s` by auto |
|
1425 |
have "(\<Sum>x\<in>insert a t. if x = a then - (\<Sum>x\<in>t. u (x - a)) else u (x - a)) = 0" |
|
1426 |
unfolding setsum_clauses(2)[OF fin] using `a\<notin>s` `t\<subseteq>s` apply auto unfolding * by auto |
|
1427 |
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" |
|
1428 |
apply(rule_tac x="v + a" in bexI) using obt(3,4) and `0\<notin>S` unfolding t_def by auto |
|
1429 |
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)" |
|
1430 |
apply(rule setsum_cong2) using `a\<notin>s` `t\<subseteq>s` by auto |
|
1431 |
have "(\<Sum>x\<in>t. u (x - a)) *\<^sub>R a = (\<Sum>v\<in>t. u (v - a) *\<^sub>R v)" |
|
1432 |
unfolding scaleR_left.setsum unfolding t_def and setsum_reindex[OF inj] and o_def |
|
1433 |
using obt(5) by (auto simp add: setsum_addf scaleR_right_distrib) |
|
1434 |
hence "(\<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" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1435 |
unfolding setsum_clauses(2)[OF fin] using `a\<notin>s` `t\<subseteq>s` by (auto simp add: *) |
33175 | 1436 |
ultimately show ?thesis unfolding affine_dependent_explicit |
1437 |
apply(rule_tac x="insert a t" in exI) by auto |
|
1438 |
qed |
|
1439 |
||
1440 |
lemma convex_cone: |
|
1441 |
"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)" (is "?lhs = ?rhs") |
|
1442 |
proof- |
|
1443 |
{ fix x y assume "x\<in>s" "y\<in>s" and ?lhs |
|
1444 |
hence "2 *\<^sub>R x \<in>s" "2 *\<^sub>R y \<in> s" unfolding cone_def by auto |
|
1445 |
hence "x + y \<in> s" using `?lhs`[unfolded convex_def, THEN conjunct1] |
|
1446 |
apply(erule_tac x="2*\<^sub>R x" in ballE) apply(erule_tac x="2*\<^sub>R y" in ballE) |
|
1447 |
apply(erule_tac x="1/2" in allE) apply simp apply(erule_tac x="1/2" in allE) by auto } |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
1448 |
thus ?thesis unfolding convex_def cone_def by blast |
33175 | 1449 |
qed |
1450 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1451 |
lemma affine_dependent_biggerset: fixes s::"('a::euclidean_space) set" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1452 |
assumes "finite s" "card s \<ge> DIM('a) + 2" |
33175 | 1453 |
shows "affine_dependent s" |
1454 |
proof- |
|
1455 |
have "s\<noteq>{}" using assms by auto then obtain a where "a\<in>s" by auto |
|
1456 |
have *:"{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})" by auto |
|
1457 |
have "card {x - a |x. x \<in> s - {a}} = card (s - {a})" unfolding * |
|
1458 |
apply(rule card_image) unfolding inj_on_def 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
|
1459 |
also have "\<dots> > DIM('a)" using assms(2) |
33175 | 1460 |
unfolding card_Diff_singleton[OF assms(1) `a\<in>s`] by auto |
1461 |
finally show ?thesis apply(subst insert_Diff[OF `a\<in>s`, THEN sym]) |
|
1462 |
apply(rule dependent_imp_affine_dependent) |
|
1463 |
apply(rule dependent_biggerset) by auto qed |
|
1464 |
||
1465 |
lemma affine_dependent_biggerset_general: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1466 |
assumes "finite (s::('a::euclidean_space) set)" "card s \<ge> dim s + 2" |
33175 | 1467 |
shows "affine_dependent s" |
1468 |
proof- |
|
1469 |
from assms(2) have "s \<noteq> {}" by auto |
|
1470 |
then obtain a where "a\<in>s" by auto |
|
1471 |
have *:"{x - a |x. x \<in> s - {a}} = (\<lambda>x. x - a) ` (s - {a})" by auto |
|
1472 |
have **:"card {x - a |x. x \<in> s - {a}} = card (s - {a})" unfolding * |
|
1473 |
apply(rule card_image) unfolding inj_on_def by auto |
|
1474 |
have "dim {x - a |x. x \<in> s - {a}} \<le> dim s" |
|
1475 |
apply(rule subset_le_dim) unfolding subset_eq |
|
1476 |
using `a\<in>s` by (auto simp add:span_superset span_sub) |
|
1477 |
also have "\<dots> < dim s + 1" by auto |
|
1478 |
also have "\<dots> \<le> card (s - {a})" using assms |
|
1479 |
using card_Diff_singleton[OF assms(1) `a\<in>s`] by auto |
|
1480 |
finally show ?thesis apply(subst insert_Diff[OF `a\<in>s`, THEN sym]) |
|
1481 |
apply(rule dependent_imp_affine_dependent) apply(rule dependent_biggerset_general) unfolding ** by auto qed |
|
1482 |
||
1483 |
subsection {* Caratheodory's theorem. *} |
|
1484 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1485 |
lemma convex_hull_caratheodory: fixes p::"('a::euclidean_space) set" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1486 |
shows "convex hull p = {y. \<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> |
33175 | 1487 |
(\<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
|
1488 |
unfolding convex_hull_explicit set_eq_iff mem_Collect_eq |
33175 | 1489 |
proof(rule,rule) |
1490 |
fix y 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> setsum u s = 1 \<and> (\<Sum>v\<in>s. u v *\<^sub>R v) = y" |
|
1491 |
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" |
|
1492 |
then obtain N where "?P N" by auto |
|
1493 |
hence "\<exists>n\<le>N. (\<forall>k<n. \<not> ?P k) \<and> ?P n" apply(rule_tac ex_least_nat_le) by auto |
|
1494 |
then obtain n where "?P n" and smallest:"\<forall>k<n. \<not> ?P k" by blast |
|
1495 |
then obtain s u where obt:"finite s" "card s = n" "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" by auto |
|
1496 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1497 |
have "card s \<le> DIM('a) + 1" proof(rule ccontr, simp only: not_le) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1498 |
assume "DIM('a) + 1 < card s" |
33175 | 1499 |
hence "affine_dependent s" using affine_dependent_biggerset[OF obt(1)] by auto |
1500 |
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" |
|
1501 |
using affine_dependent_explicit_finite[OF obt(1)] by auto |
|
1502 |
def i \<equiv> "(\<lambda>v. (u v) / (- w v)) ` {v\<in>s. w v < 0}" def t \<equiv> "Min i" |
|
1503 |
have "\<exists>x\<in>s. w x < 0" proof(rule ccontr, simp add: not_less) |
|
1504 |
assume as:"\<forall>x\<in>s. 0 \<le> w x" |
|
1505 |
hence "setsum w (s - {v}) \<ge> 0" apply(rule_tac setsum_nonneg) by auto |
|
1506 |
hence "setsum w s > 0" unfolding setsum_diff1'[OF obt(1) `v\<in>s`] |
|
1507 |
using as[THEN bspec[where x=v]] and `v\<in>s` using `w v \<noteq> 0` by auto |
|
1508 |
thus False using wv(1) by auto |
|
1509 |
qed hence "i\<noteq>{}" unfolding i_def by auto |
|
1510 |
||
1511 |
hence "t \<ge> 0" using Min_ge_iff[of i 0 ] and obt(1) unfolding t_def i_def |
|
1512 |
using obt(4)[unfolded le_less] apply auto unfolding divide_le_0_iff by auto |
|
1513 |
have t:"\<forall>v\<in>s. u v + t * w v \<ge> 0" proof |
|
1514 |
fix v assume "v\<in>s" hence v:"0\<le>u v" using obt(4)[THEN bspec[where x=v]] by auto |
|
1515 |
show"0 \<le> u v + t * w v" proof(cases "w v < 0") |
|
1516 |
case False thus ?thesis apply(rule_tac add_nonneg_nonneg) |
|
1517 |
using v apply simp apply(rule mult_nonneg_nonneg) using `t\<ge>0` by auto next |
|
1518 |
case True hence "t \<le> u v / (- w v)" using `v\<in>s` |
|
1519 |
unfolding t_def i_def apply(rule_tac Min_le) using obt(1) by auto |
|
1520 |
thus ?thesis unfolding real_0_le_add_iff |
|
1521 |
using pos_le_divide_eq[OF True[unfolded neg_0_less_iff_less[THEN sym]]] by auto |
|
1522 |
qed qed |
|
1523 |
||
1524 |
obtain a where "a\<in>s" and "t = (\<lambda>v. (u v) / (- w v)) a" and "w a < 0" |
|
1525 |
using Min_in[OF _ `i\<noteq>{}`] and obt(1) unfolding i_def t_def by auto |
|
1526 |
hence a:"a\<in>s" "u a + t * w a = 0" 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
|
1527 |
have *:"\<And>f. setsum f (s - {a}) = setsum f s - ((f a)::'b::ab_group_add)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1528 |
unfolding setsum_diff1'[OF obt(1) `a\<in>s`] by auto |
33175 | 1529 |
have "(\<Sum>v\<in>s. u v + t * w v) = 1" |
1530 |
unfolding setsum_addf wv(1) setsum_right_distrib[THEN sym] obt(5) by auto |
|
1531 |
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" |
|
1532 |
unfolding setsum_addf obt(6) scaleR_scaleR[THEN sym] 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
|
1533 |
using a(2) [THEN eq_neg_iff_add_eq_0 [THEN iffD2]] by simp |
33175 | 1534 |
ultimately have "?P (n - 1)" apply(rule_tac x="(s - {a})" in exI) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1535 |
apply(rule_tac x="\<lambda>v. u v + t * w v" in exI) using obt(1-3) and t and a |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1536 |
by (auto simp add: * scaleR_left_distrib) |
33175 | 1537 |
thus False using smallest[THEN spec[where x="n - 1"]] by auto qed |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1538 |
thus "\<exists>s u. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 |
33175 | 1539 |
\<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" using obt by auto |
1540 |
qed auto |
|
1541 |
||
1542 |
lemma caratheodory: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1543 |
"convex hull p = {x::'a::euclidean_space. \<exists>s. finite s \<and> s \<subseteq> p \<and> |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1544 |
card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s}" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
1545 |
unfolding set_eq_iff apply(rule, rule) unfolding mem_Collect_eq proof- |
33175 | 1546 |
fix x 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
|
1547 |
then obtain s u where "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1" |
33175 | 1548 |
"\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "(\<Sum>v\<in>s. u v *\<^sub>R v) = x"unfolding convex_hull_caratheodory 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
|
1549 |
thus "\<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s" |
33175 | 1550 |
apply(rule_tac x=s in exI) using hull_subset[of s convex] |
1551 |
using convex_convex_hull[unfolded convex_explicit, of s, THEN spec[where x=s], THEN spec[where x=u]] by auto |
|
1552 |
next |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1553 |
fix x assume "\<exists>s. finite s \<and> s \<subseteq> p \<and> card s \<le> DIM('a) + 1 \<and> x \<in> convex hull s" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
1554 |
then obtain s where "finite s" "s \<subseteq> p" "card s \<le> DIM('a) + 1" "x \<in> convex hull s" by auto |
33175 | 1555 |
thus "x \<in> convex hull p" using hull_mono[OF `s\<subseteq>p`] by auto |
1556 |
qed |
|
1557 |
||
40377 | 1558 |
|
1559 |
subsection {* Some Properties of Affine Dependent Sets *} |
|
1560 |
||
1561 |
lemma affine_independent_empty: "~(affine_dependent {})" |
|
1562 |
by (simp add: affine_dependent_def) |
|
1563 |
||
1564 |
lemma affine_independent_sing: |
|
1565 |
shows "~(affine_dependent {a})" |
|
1566 |
by (simp add: affine_dependent_def) |
|
1567 |
||
1568 |
lemma affine_hull_translation: |
|
1569 |
"affine hull ((%x. a + x) ` S) = (%x. a + x) ` (affine hull S)" |
|
1570 |
proof- |
|
1571 |
have "affine ((%x. a + x) ` (affine hull S))" using affine_translation affine_affine_hull by auto |
|
1572 |
moreover have "(%x. a + x) ` S <= (%x. a + x) ` (affine hull S)" using hull_subset[of S] by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1573 |
ultimately have h1: "affine hull ((%x. a + x) ` S) <= (%x. a + x) ` (affine hull S)" by (metis hull_minimal) |
40377 | 1574 |
have "affine((%x. -a + x) ` (affine hull ((%x. a + x) ` S)))" using affine_translation affine_affine_hull by auto |
1575 |
moreover have "(%x. -a + x) ` (%x. a + x) ` S <= (%x. -a + x) ` (affine hull ((%x. a + x) ` S))" using hull_subset[of "(%x. a + x) ` S"] by auto |
|
1576 |
moreover have "S=(%x. -a + x) ` (%x. a + x) ` S" using translation_assoc[of "-a" a] by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
1577 |
ultimately have "(%x. -a + x) ` (affine hull ((%x. a + x) ` S)) >= (affine hull S)" by (metis hull_minimal) |
40377 | 1578 |
hence "affine hull ((%x. a + x) ` S) >= (%x. a + x) ` (affine hull S)" by auto |
1579 |
from this show ?thesis using h1 by auto |
|
1580 |
qed |
|
1581 |
||
1582 |
lemma affine_dependent_translation: |
|
1583 |
assumes "affine_dependent S" |
|
1584 |
shows "affine_dependent ((%x. a + x) ` S)" |
|
1585 |
proof- |
|
1586 |
obtain x where x_def: "x : S & x : affine hull (S - {x})" using assms affine_dependent_def by auto |
|
1587 |
have "op + a ` (S - {x}) = op + a ` S - {a + x}" by auto |
|
1588 |
hence "a+x : affine hull ((%x. a + x) ` S - {a+x})" using affine_hull_translation[of a "S-{x}"] x_def by auto |
|
1589 |
moreover have "a+x : (%x. a + x) ` S" using x_def by auto |
|
1590 |
ultimately show ?thesis unfolding affine_dependent_def by auto |
|
1591 |
qed |
|
1592 |
||
1593 |
lemma affine_dependent_translation_eq: |
|
1594 |
"affine_dependent S <-> affine_dependent ((%x. a + x) ` S)" |
|
1595 |
proof- |
|
1596 |
{ assume "affine_dependent ((%x. a + x) ` S)" |
|
1597 |
hence "affine_dependent S" using affine_dependent_translation[of "((%x. a + x) ` S)" "-a"] translation_assoc[of "-a" a] by auto |
|
1598 |
} from this show ?thesis using affine_dependent_translation by auto |
|
1599 |
qed |
|
1600 |
||
1601 |
lemma affine_hull_0_dependent: |
|
1602 |
assumes "0 : affine hull S" |
|
1603 |
shows "dependent S" |
|
1604 |
proof- |
|
1605 |
obtain s u where s_u_def: "finite s & s ~= {} & s <= S & setsum u s = 1 & (SUM v:s. u v *\<^sub>R v) = 0" using assms affine_hull_explicit[of S] by auto |
|
1606 |
hence "EX v:s. u v ~= 0" using setsum_not_0[of "u" "s"] by auto |
|
1607 |
hence "finite s & s <= S & (EX v:s. u v ~= 0 & (SUM v:s. u v *\<^sub>R v) = 0)" using s_u_def by auto |
|
1608 |
from this show ?thesis unfolding dependent_explicit[of S] by auto |
|
1609 |
qed |
|
1610 |
||
1611 |
lemma affine_dependent_imp_dependent2: |
|
1612 |
assumes "affine_dependent (insert 0 S)" |
|
1613 |
shows "dependent S" |
|
1614 |
proof- |
|
1615 |
obtain x where x_def: "x:insert 0 S & x : affine hull (insert 0 S - {x})" using affine_dependent_def[of "(insert 0 S)"] assms by blast |
|
1616 |
hence "x : span (insert 0 S - {x})" using affine_hull_subset_span by auto |
|
1617 |
moreover have "span (insert 0 S - {x}) = span (S - {x})" using insert_Diff_if[of "0" S "{x}"] span_insert_0[of "S-{x}"] by auto |
|
1618 |
ultimately have "x : span (S - {x})" by auto |
|
1619 |
hence "(x~=0) ==> dependent S" using x_def dependent_def by auto |
|
1620 |
moreover |
|
1621 |
{ assume "x=0" hence "0 : affine hull S" using x_def hull_mono[of "S - {0}" S] by auto |
|
1622 |
hence "dependent S" using affine_hull_0_dependent by auto |
|
1623 |
} ultimately show ?thesis by auto |
|
1624 |
qed |
|
1625 |
||
1626 |
lemma affine_dependent_iff_dependent: |
|
1627 |
assumes "a ~: S" |
|
1628 |
shows "affine_dependent (insert a S) <-> dependent ((%x. -a + x) ` S)" |
|
1629 |
proof- |
|
1630 |
have "(op + (- a) ` S)={x - a| x . x : S}" by auto |
|
1631 |
from this show ?thesis using affine_dependent_translation_eq[of "(insert a S)" "-a"] |
|
1632 |
affine_dependent_imp_dependent2 assms |
|
1633 |
dependent_imp_affine_dependent[of a S] by auto |
|
1634 |
qed |
|
1635 |
||
1636 |
lemma affine_dependent_iff_dependent2: |
|
1637 |
assumes "a : S" |
|
1638 |
shows "affine_dependent S <-> dependent ((%x. -a + x) ` (S-{a}))" |
|
1639 |
proof- |
|
1640 |
have "insert a (S - {a})=S" using assms by auto |
|
1641 |
from this show ?thesis using assms affine_dependent_iff_dependent[of a "S-{a}"] by auto |
|
1642 |
qed |
|
1643 |
||
1644 |
lemma affine_hull_insert_span_gen: |
|
1645 |
shows "affine hull (insert a s) = (%x. a+x) ` span ((%x. -a+x) ` s)" |
|
1646 |
proof- |
|
1647 |
have h1: "{x - a |x. x : s}=((%x. -a+x) ` s)" by auto |
|
1648 |
{ assume "a ~: s" hence ?thesis using affine_hull_insert_span[of a s] h1 by auto} |
|
1649 |
moreover |
|
1650 |
{ assume a1: "a : s" |
|
1651 |
have "EX x. x:s & -a+x=0" apply (rule exI[of _ a]) using a1 by auto |
|
1652 |
hence "insert 0 ((%x. -a+x) ` (s - {a}))=(%x. -a+x) ` s" by auto |
|
1653 |
hence "span ((%x. -a+x) ` (s - {a}))=span ((%x. -a+x) ` s)" |
|
1654 |
using span_insert_0[of "op + (- a) ` (s - {a})"] by auto |
|
1655 |
moreover have "{x - a |x. x : (s - {a})}=((%x. -a+x) ` (s - {a}))" by auto |
|
1656 |
moreover have "insert a (s - {a})=(insert a s)" using assms by auto |
|
1657 |
ultimately have ?thesis using assms affine_hull_insert_span[of "a" "s-{a}"] by auto |
|
1658 |
} |
|
1659 |
ultimately show ?thesis by auto |
|
1660 |
qed |
|
1661 |
||
1662 |
lemma affine_hull_span2: |
|
1663 |
assumes "a : s" |
|
1664 |
shows "affine hull s = (%x. a+x) ` span ((%x. -a+x) ` (s-{a}))" |
|
1665 |
using affine_hull_insert_span_gen[of a "s - {a}", unfolded insert_Diff[OF assms]] by auto |
|
1666 |
||
1667 |
lemma affine_hull_span_gen: |
|
1668 |
assumes "a : affine hull s" |
|
1669 |
shows "affine hull s = (%x. a+x) ` span ((%x. -a+x) ` s)" |
|
1670 |
proof- |
|
1671 |
have "affine hull (insert a s) = affine hull s" using hull_redundant[of a affine s] assms by auto |
|
1672 |
from this show ?thesis using affine_hull_insert_span_gen[of a "s"] by auto |
|
1673 |
qed |
|
1674 |
||
1675 |
lemma affine_hull_span_0: |
|
44361
75ec83d45303
remove unnecessary euclidean_space class constraints
huffman
parents:
44349
diff
changeset
|
1676 |
assumes "0 : affine hull S" |
40377 | 1677 |
shows "affine hull S = span S" |
1678 |
using affine_hull_span_gen[of "0" S] assms by auto |
|
1679 |
||
1680 |
||
1681 |
lemma extend_to_affine_basis: |
|
1682 |
fixes S V :: "('n::euclidean_space) set" |
|
1683 |
assumes "~(affine_dependent S)" "S <= V" "S~={}" |
|
1684 |
shows "? T. ~(affine_dependent T) & S<=T & T<=V & affine hull T = affine hull V" |
|
1685 |
proof- |
|
1686 |
obtain a where a_def: "a : S" using assms by auto |
|
1687 |
hence h0: "independent ((%x. -a + x) ` (S-{a}))" using affine_dependent_iff_dependent2 assms by auto |
|
1688 |
from this obtain B |
|
1689 |
where B_def: "(%x. -a+x) ` (S - {a}) <= B & B <= (%x. -a+x) ` V & independent B & (%x. -a+x) ` V <= span B" |
|
1690 |
using maximal_independent_subset_extend[of "(%x. -a+x) ` (S-{a})" "(%x. -a + x) ` V"] assms by blast |
|
1691 |
def T == "(%x. a+x) ` (insert 0 B)" hence "T=insert a ((%x. a+x) ` B)" by auto |
|
1692 |
hence "affine hull T = (%x. a+x) ` span B" using affine_hull_insert_span_gen[of a "((%x. a+x) ` B)"] translation_assoc[of "-a" a B] by auto |
|
1693 |
hence "V <= affine hull T" using B_def assms translation_inverse_subset[of a V "span B"] by auto |
|
1694 |
moreover have "T<=V" using T_def B_def a_def assms by auto |
|
1695 |
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
|
1696 |
by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono) |
40377 | 1697 |
moreover have "S<=T" using T_def B_def translation_inverse_subset[of a "S-{a}" B] by auto |
1698 |
moreover have "~(affine_dependent T)" using T_def affine_dependent_translation_eq[of "insert 0 B"] affine_dependent_imp_dependent2 B_def by auto |
|
1699 |
ultimately show ?thesis using `T<=V` by auto |
|
1700 |
qed |
|
1701 |
||
1702 |
lemma affine_basis_exists: |
|
1703 |
fixes V :: "('n::euclidean_space) set" |
|
1704 |
shows "? B. B <= V & ~(affine_dependent B) & affine hull V = affine hull B" |
|
1705 |
proof- |
|
1706 |
{ assume empt: "V={}" have "? B. B <= V & ~(affine_dependent B) & (affine hull V=affine hull B)" using empt affine_independent_empty by auto |
|
1707 |
} |
|
1708 |
moreover |
|
1709 |
{ assume nonempt: "V~={}" obtain x where "x:V" using nonempt by auto |
|
1710 |
hence "? B. B <= V & ~(affine_dependent B) & (affine hull V=affine hull B)" |
|
1711 |
using affine_dependent_def[of "{x}"] extend_to_affine_basis[of "{x}:: ('n::euclidean_space) set" V] by auto |
|
1712 |
} |
|
1713 |
ultimately show ?thesis by auto |
|
1714 |
qed |
|
1715 |
||
1716 |
subsection {* Affine Dimension of a Set *} |
|
1717 |
||
1718 |
definition "aff_dim V = (SOME d :: int. ? B. (affine hull B=affine hull V) & ~(affine_dependent B) & (of_nat(card B) = d+1))" |
|
1719 |
||
1720 |
lemma aff_dim_basis_exists: |
|
1721 |
fixes V :: "('n::euclidean_space) set" |
|
1722 |
shows "? B. (affine hull B=affine hull V) & ~(affine_dependent B) & (of_nat(card B) = aff_dim V+1)" |
|
1723 |
proof- |
|
1724 |
obtain B where B_def: "~(affine_dependent B) & (affine hull B=affine hull V)" using affine_basis_exists[of V] by auto |
|
1725 |
from this show ?thesis unfolding aff_dim_def some_eq_ex[of "%d. ? (B :: ('n::euclidean_space) set). (affine hull B=affine hull V) & ~(affine_dependent B) & (of_nat(card B) = d+1)"] apply auto apply (rule exI[of _ "int (card B)-(1 :: int)"]) apply (rule exI[of _ "B"]) by auto |
|
1726 |
qed |
|
1727 |
||
1728 |
lemma affine_hull_nonempty: "(S ~= {}) <-> affine hull S ~= {}" |
|
1729 |
proof- |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
1730 |
have "(S = {}) ==> affine hull S = {}"using affine_hull_empty by auto |
40377 | 1731 |
moreover have "affine hull S = {} ==> S = {}" unfolding hull_def by auto |
1732 |
ultimately show "(S ~= {}) <-> affine hull S ~= {}" by blast |
|
1733 |
qed |
|
1734 |
||
1735 |
lemma aff_dim_parallel_subspace_aux: |
|
1736 |
fixes B :: "('n::euclidean_space) set" |
|
1737 |
assumes "~(affine_dependent B)" "a:B" |
|
1738 |
shows "finite B & ((card B) - 1 = dim (span ((%x. -a+x) ` (B-{a}))))" |
|
1739 |
proof- |
|
1740 |
have "independent ((%x. -a + x) ` (B-{a}))" using affine_dependent_iff_dependent2 assms by auto |
|
1741 |
hence fin: "dim (span ((%x. -a+x) ` (B-{a}))) = card ((%x. -a + x) ` (B-{a}))" "finite ((%x. -a + x) ` (B - {a}))" using indep_card_eq_dim_span[of "(%x. -a+x) ` (B-{a})"] by auto |
|
1742 |
{ assume emp: "(%x. -a + x) ` (B - {a}) = {}" |
|
1743 |
have "B=insert a ((%x. a + x) ` (%x. -a + x) ` (B - {a}))" using translation_assoc[of "a" "-a" "(B - {a})"] assms by auto |
|
1744 |
hence "B={a}" using emp by auto |
|
1745 |
hence ?thesis using assms fin by auto |
|
1746 |
} |
|
1747 |
moreover |
|
1748 |
{ assume "(%x. -a + x) ` (B - {a}) ~= {}" |
|
1749 |
hence "card ((%x. -a + x) ` (B - {a}))>0" using fin by auto |
|
1750 |
moreover have h1: "card ((%x. -a + x) ` (B-{a})) = card (B-{a})" |
|
1751 |
apply (rule card_image) using translate_inj_on by auto |
|
1752 |
ultimately have "card (B-{a})>0" by auto |
|
1753 |
hence "finite(B-{a})" using card_gt_0_iff[of "(B - {a})"] by auto |
|
1754 |
moreover hence "(card (B-{a})= (card B) - 1)" using card_Diff_singleton assms by auto |
|
1755 |
ultimately have ?thesis using fin h1 by auto |
|
1756 |
} ultimately show ?thesis by auto |
|
1757 |
qed |
|
1758 |
||
1759 |
lemma aff_dim_parallel_subspace: |
|
1760 |
fixes V L :: "('n::euclidean_space) set" |
|
1761 |
assumes "V ~= {}" |
|
1762 |
assumes "subspace L" "affine_parallel (affine hull V) L" |
|
1763 |
shows "aff_dim V=int(dim L)" |
|
1764 |
proof- |
|
1765 |
obtain B where B_def: "affine hull B = affine hull V & ~ affine_dependent B & int (card B) = aff_dim V + 1" using aff_dim_basis_exists by auto |
|
1766 |
hence "B~={}" using assms B_def affine_hull_nonempty[of V] affine_hull_nonempty[of B] by auto |
|
1767 |
from this obtain a where a_def: "a : B" by auto |
|
1768 |
def Lb == "span ((%x. -a+x) ` (B-{a}))" |
|
1769 |
moreover have "affine_parallel (affine hull B) Lb" |
|
1770 |
using Lb_def B_def assms affine_hull_span2[of a B] a_def affine_parallel_commut[of "Lb" "(affine hull B)"] unfolding affine_parallel_def by auto |
|
1771 |
moreover have "subspace Lb" using Lb_def subspace_span by auto |
|
1772 |
moreover have "affine hull B ~= {}" using assms B_def affine_hull_nonempty[of V] by auto |
|
1773 |
ultimately have "L=Lb" using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B_def by auto |
|
1774 |
hence "dim L=dim Lb" by auto |
|
1775 |
moreover have "(card B) - 1 = dim Lb" "finite B" using Lb_def aff_dim_parallel_subspace_aux a_def B_def by auto |
|
1776 |
(* hence "card B=dim Lb+1" using `B~={}` card_gt_0_iff[of B] by auto *) |
|
1777 |
ultimately show ?thesis using B_def `B~={}` card_gt_0_iff[of B] by auto |
|
1778 |
qed |
|
1779 |
||
1780 |
lemma aff_independent_finite: |
|
1781 |
fixes B :: "('n::euclidean_space) set" |
|
1782 |
assumes "~(affine_dependent B)" |
|
1783 |
shows "finite B" |
|
1784 |
proof- |
|
1785 |
{ assume "B~={}" from this obtain a where "a:B" by auto |
|
1786 |
hence ?thesis using aff_dim_parallel_subspace_aux assms by auto |
|
1787 |
} from this show ?thesis by auto |
|
1788 |
qed |
|
1789 |
||
1790 |
lemma independent_finite: |
|
1791 |
fixes B :: "('n::euclidean_space) set" |
|
1792 |
assumes "independent B" |
|
1793 |
shows "finite B" |
|
1794 |
using affine_dependent_imp_dependent[of B] aff_independent_finite[of B] assms by auto |
|
1795 |
||
1796 |
lemma subspace_dim_equal: |
|
1797 |
assumes "subspace (S :: ('n::euclidean_space) set)" "subspace T" "S <= T" "dim S >= dim T" |
|
1798 |
shows "S=T" |
|
1799 |
proof- |
|
1800 |
obtain B where B_def: "B <= S & independent B & S <= span B & (card B = dim S)" using basis_exists[of S] by auto |
|
1801 |
hence "span B <= S" using span_mono[of B S] span_eq[of S] assms by metis |
|
1802 |
hence "span B = S" using B_def by auto |
|
1803 |
have "dim S = dim T" using assms dim_subset[of S T] by auto |
|
1804 |
hence "T <= span B" using card_eq_dim[of B T] B_def independent_finite assms by auto |
|
1805 |
from this show ?thesis using assms `span B=S` by auto |
|
1806 |
qed |
|
1807 |
||
1808 |
lemma span_substd_basis: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
|
1809 |
shows "(span {basis i | i. i : d}) = {x::'a::euclidean_space. (!i<DIM('a). i ~: d --> x$$i = 0)}" |
|
1810 |
(is "span ?A = ?B") |
|
1811 |
proof- |
|
1812 |
have "?A <= ?B" by auto |
|
1813 |
moreover have s: "subspace ?B" using subspace_substandard[of "%i. i ~: d"] . |
|
1814 |
ultimately have "span ?A <= ?B" using span_mono[of "?A" "?B"] span_eq[of "?B"] by blast |
|
1815 |
moreover have "card d <= dim (span ?A)" using independent_card_le_dim[of "?A" "span ?A"] |
|
1816 |
independent_substdbasis[OF assms] card_substdbasis[OF assms] span_inc[of "?A"] by auto |
|
1817 |
moreover hence "dim ?B <= dim (span ?A)" using dim_substandard[OF assms] by auto |
|
1818 |
ultimately show ?thesis using s subspace_dim_equal[of "span ?A" "?B"] |
|
1819 |
subspace_span[of "?A"] by auto |
|
1820 |
qed |
|
1821 |
||
1822 |
lemma basis_to_substdbasis_subspace_isomorphism: |
|
1823 |
fixes B :: "('a::euclidean_space) set" |
|
1824 |
assumes "independent B" |
|
1825 |
shows "EX f d. card d = card B & linear f & f ` B = {basis i::'a |i. i : (d :: nat set)} & |
|
1826 |
f ` span B = {x. ALL i<DIM('a). i ~: d --> x $$ i = (0::real)} & inj_on f (span B) \<and> d\<subseteq>{..<DIM('a)}" |
|
1827 |
proof- |
|
1828 |
have B:"card B=dim B" using dim_unique[of B B "card B"] assms span_inc[of B] by auto |
|
1829 |
def d \<equiv> "{..<dim B}" have t:"card d = dim B" unfolding d_def by auto |
|
1830 |
have "dim B <= DIM('a)" using dim_subset_UNIV[of B] by auto |
|
1831 |
hence d:"d\<subseteq>{..<DIM('a)}" unfolding d_def by auto |
|
1832 |
let ?t = "{x::'a::euclidean_space. !i<DIM('a). i ~: d --> x$$i = 0}" |
|
1833 |
have "EX f. linear f & f ` B = {basis i |i. i : d} & |
|
1834 |
f ` span B = ?t & inj_on f (span B)" |
|
1835 |
apply (rule basis_to_basis_subspace_isomorphism[of "span B" ?t B "{basis i |i. i : d}"]) |
|
1836 |
apply(rule subspace_span) apply(rule subspace_substandard) defer |
|
1837 |
apply(rule span_inc) apply(rule assms) defer unfolding dim_span[of B] apply(rule B) |
|
1838 |
unfolding span_substd_basis[OF d,THEN sym] card_substdbasis[OF d] apply(rule span_inc) |
|
1839 |
apply(rule independent_substdbasis[OF d]) apply(rule,assumption) |
|
1840 |
unfolding t[THEN sym] span_substd_basis[OF d] dim_substandard[OF d] by auto |
|
1841 |
from this t `card B=dim B` show ?thesis using d by auto |
|
1842 |
qed |
|
1843 |
||
1844 |
lemma aff_dim_empty: |
|
1845 |
fixes S :: "('n::euclidean_space) set" |
|
1846 |
shows "S = {} <-> aff_dim S = -1" |
|
1847 |
proof- |
|
1848 |
obtain B where "affine hull B = affine hull S & ~ affine_dependent B & int (card B) = aff_dim S + 1" using aff_dim_basis_exists by auto |
|
1849 |
moreover hence "S={} <-> B={}" using affine_hull_nonempty[of B] affine_hull_nonempty[of S] by auto |
|
1850 |
ultimately show ?thesis using aff_independent_finite[of B] card_gt_0_iff[of B] by auto |
|
1851 |
qed |
|
1852 |
||
1853 |
lemma aff_dim_affine_hull: |
|
1854 |
shows "aff_dim (affine hull S)=aff_dim S" |
|
1855 |
unfolding aff_dim_def using hull_hull[of _ S] by auto |
|
1856 |
||
1857 |
lemma aff_dim_affine_hull2: |
|
1858 |
assumes "affine hull S=affine hull T" |
|
1859 |
shows "aff_dim S=aff_dim T" unfolding aff_dim_def using assms by auto |
|
1860 |
||
1861 |
lemma aff_dim_unique: |
|
1862 |
fixes B V :: "('n::euclidean_space) set" |
|
1863 |
assumes "(affine hull B=affine hull V) & ~(affine_dependent B)" |
|
1864 |
shows "of_nat(card B) = aff_dim V+1" |
|
1865 |
proof- |
|
1866 |
{ assume "B={}" hence "V={}" using affine_hull_nonempty[of V] affine_hull_nonempty[of B] assms by auto |
|
1867 |
hence "aff_dim V = (-1::int)" using aff_dim_empty by auto |
|
1868 |
hence ?thesis using `B={}` by auto |
|
1869 |
} |
|
1870 |
moreover |
|
1871 |
{ assume "B~={}" from this obtain a where a_def: "a:B" by auto |
|
1872 |
def Lb == "span ((%x. -a+x) ` (B-{a}))" |
|
1873 |
have "affine_parallel (affine hull B) Lb" |
|
1874 |
using Lb_def affine_hull_span2[of a B] a_def affine_parallel_commut[of "Lb" "(affine hull B)"] |
|
1875 |
unfolding affine_parallel_def by auto |
|
1876 |
moreover have "subspace Lb" using Lb_def subspace_span by auto |
|
1877 |
ultimately have "aff_dim B=int(dim Lb)" using aff_dim_parallel_subspace[of B Lb] `B~={}` by auto |
|
1878 |
moreover have "(card B) - 1 = dim Lb" "finite B" using Lb_def aff_dim_parallel_subspace_aux a_def assms by auto |
|
1879 |
ultimately have "(of_nat(card B) = aff_dim B+1)" using `B~={}` card_gt_0_iff[of B] by auto |
|
1880 |
hence ?thesis using aff_dim_affine_hull2 assms by auto |
|
1881 |
} ultimately show ?thesis by blast |
|
1882 |
qed |
|
1883 |
||
1884 |
lemma aff_dim_affine_independent: |
|
1885 |
fixes B :: "('n::euclidean_space) set" |
|
1886 |
assumes "~(affine_dependent B)" |
|
1887 |
shows "of_nat(card B) = aff_dim B+1" |
|
1888 |
using aff_dim_unique[of B B] assms by auto |
|
1889 |
||
1890 |
lemma aff_dim_sing: |
|
1891 |
fixes a :: "'n::euclidean_space" |
|
1892 |
shows "aff_dim {a}=0" |
|
1893 |
using aff_dim_affine_independent[of "{a}"] affine_independent_sing by auto |
|
1894 |
||
1895 |
lemma aff_dim_inner_basis_exists: |
|
1896 |
fixes V :: "('n::euclidean_space) set" |
|
1897 |
shows "? B. B<=V & (affine hull B=affine hull V) & ~(affine_dependent B) & (of_nat(card B) = aff_dim V+1)" |
|
1898 |
proof- |
|
1899 |
obtain B where B_def: "~(affine_dependent B) & B<=V & (affine hull B=affine hull V)" using affine_basis_exists[of V] by auto |
|
1900 |
moreover hence "of_nat(card B) = aff_dim V+1" using aff_dim_unique by auto |
|
1901 |
ultimately show ?thesis by auto |
|
1902 |
qed |
|
1903 |
||
1904 |
lemma aff_dim_le_card: |
|
1905 |
fixes V :: "('n::euclidean_space) set" |
|
1906 |
assumes "finite V" |
|
1907 |
shows "aff_dim V <= of_nat(card V) - 1" |
|
1908 |
proof- |
|
1909 |
obtain B where B_def: "B<=V & (of_nat(card B) = aff_dim V+1)" using aff_dim_inner_basis_exists[of V] by auto |
|
1910 |
moreover hence "card B <= card V" using assms card_mono by auto |
|
1911 |
ultimately show ?thesis by auto |
|
1912 |
qed |
|
1913 |
||
1914 |
lemma aff_dim_parallel_eq: |
|
1915 |
fixes S T :: "('n::euclidean_space) set" |
|
1916 |
assumes "affine_parallel (affine hull S) (affine hull T)" |
|
1917 |
shows "aff_dim S=aff_dim T" |
|
1918 |
proof- |
|
1919 |
{ assume "T~={}" "S~={}" |
|
1920 |
from this obtain L where L_def: "subspace L & affine_parallel (affine hull T) L" |
|
1921 |
using affine_parallel_subspace[of "affine hull T"] affine_affine_hull[of T] affine_hull_nonempty by auto |
|
1922 |
hence "aff_dim T = int(dim L)" using aff_dim_parallel_subspace `T~={}` by auto |
|
1923 |
moreover have "subspace L & affine_parallel (affine hull S) L" |
|
1924 |
using L_def affine_parallel_assoc[of "affine hull S" "affine hull T" L] assms by auto |
|
1925 |
moreover hence "aff_dim S = int(dim L)" using aff_dim_parallel_subspace `S~={}` by auto |
|
1926 |
ultimately have ?thesis by auto |
|
1927 |
} |
|
1928 |
moreover |
|
1929 |
{ assume "S={}" hence "S={} & T={}" using assms affine_hull_nonempty unfolding affine_parallel_def by auto |
|
1930 |
hence ?thesis using aff_dim_empty by auto |
|
1931 |
} |
|
1932 |
moreover |
|
1933 |
{ assume "T={}" hence "S={} & T={}" using assms affine_hull_nonempty unfolding affine_parallel_def by auto |
|
1934 |
hence ?thesis using aff_dim_empty by auto |
|
1935 |
} |
|
1936 |
ultimately show ?thesis by blast |
|
1937 |
qed |
|
1938 |
||
1939 |
lemma aff_dim_translation_eq: |
|
1940 |
fixes a :: "'n::euclidean_space" |
|
1941 |
shows "aff_dim ((%x. a + x) ` S)=aff_dim S" |
|
1942 |
proof- |
|
1943 |
have "affine_parallel (affine hull S) (affine hull ((%x. a + x) ` S))" unfolding affine_parallel_def apply (rule exI[of _ "a"]) using affine_hull_translation[of a S] by auto |
|
1944 |
from this show ?thesis using aff_dim_parallel_eq[of S "(%x. a + x) ` S"] by auto |
|
1945 |
qed |
|
1946 |
||
1947 |
lemma aff_dim_affine: |
|
1948 |
fixes S L :: "('n::euclidean_space) set" |
|
1949 |
assumes "S ~= {}" "affine S" |
|
1950 |
assumes "subspace L" "affine_parallel S L" |
|
1951 |
shows "aff_dim S=int(dim L)" |
|
1952 |
proof- |
|
1953 |
have 1: "(affine hull S) = S" using assms affine_hull_eq[of S] by auto |
|
1954 |
hence "affine_parallel (affine hull S) L" using assms by (simp add:1) |
|
1955 |
from this show ?thesis using assms aff_dim_parallel_subspace[of S L] by blast |
|
1956 |
qed |
|
1957 |
||
1958 |
lemma dim_affine_hull: |
|
1959 |
fixes S :: "('n::euclidean_space) set" |
|
1960 |
shows "dim (affine hull S)=dim S" |
|
1961 |
proof- |
|
1962 |
have "dim (affine hull S)>=dim S" using dim_subset by auto |
|
1963 |
moreover have "dim(span S) >= dim (affine hull S)" using dim_subset affine_hull_subset_span by auto |
|
1964 |
moreover have "dim(span S)=dim S" using dim_span by auto |
|
1965 |
ultimately show ?thesis by auto |
|
1966 |
qed |
|
1967 |
||
1968 |
lemma aff_dim_subspace: |
|
1969 |
fixes S :: "('n::euclidean_space) set" |
|
1970 |
assumes "S ~= {}" "subspace S" |
|
1971 |
shows "aff_dim S=int(dim S)" using aff_dim_affine[of S S] assms subspace_imp_affine[of S] affine_parallel_reflex[of S] by auto |
|
1972 |
||
1973 |
lemma aff_dim_zero: |
|
1974 |
fixes S :: "('n::euclidean_space) set" |
|
1975 |
assumes "0 : affine hull S" |
|
1976 |
shows "aff_dim S=int(dim S)" |
|
1977 |
proof- |
|
1978 |
have "subspace(affine hull S)" using subspace_affine[of "affine hull S"] affine_affine_hull assms by auto |
|
1979 |
hence "aff_dim (affine hull S) =int(dim (affine hull S))" using assms aff_dim_subspace[of "affine hull S"] by auto |
|
1980 |
from this show ?thesis using aff_dim_affine_hull[of S] dim_affine_hull[of S] by auto |
|
1981 |
qed |
|
1982 |
||
1983 |
lemma aff_dim_univ: "aff_dim (UNIV :: ('n::euclidean_space) set) = int(DIM('n))" |
|
1984 |
using aff_dim_subspace[of "(UNIV :: ('n::euclidean_space) set)"] |
|
1985 |
dim_UNIV[where 'a="'n::euclidean_space"] by auto |
|
1986 |
||
1987 |
lemma aff_dim_geq: |
|
1988 |
fixes V :: "('n::euclidean_space) set" |
|
1989 |
shows "aff_dim V >= -1" |
|
1990 |
proof- |
|
1991 |
obtain B where B_def: "affine hull B = affine hull V & ~ affine_dependent B & int (card B) = aff_dim V + 1" using aff_dim_basis_exists by auto |
|
1992 |
from this show ?thesis by auto |
|
1993 |
qed |
|
1994 |
||
1995 |
lemma independent_card_le_aff_dim: |
|
1996 |
assumes "(B::('n::euclidean_space) set) <= V" |
|
1997 |
assumes "~(affine_dependent B)" |
|
1998 |
shows "int(card B) <= aff_dim V+1" |
|
1999 |
proof- |
|
2000 |
{ assume "B~={}" |
|
2001 |
from this obtain T where T_def: "~(affine_dependent T) & B<=T & T<=V & affine hull T = affine hull V" |
|
2002 |
using assms extend_to_affine_basis[of B V] by auto |
|
2003 |
hence "of_nat(card T) = aff_dim V+1" using aff_dim_unique by auto |
|
2004 |
hence ?thesis using T_def card_mono[of T B] aff_independent_finite[of T] by auto |
|
2005 |
} |
|
2006 |
moreover |
|
2007 |
{ assume "B={}" |
|
2008 |
moreover have "-1<= aff_dim V" using aff_dim_geq by auto |
|
2009 |
ultimately have ?thesis by auto |
|
2010 |
} ultimately show ?thesis by blast |
|
2011 |
qed |
|
2012 |
||
2013 |
lemma aff_dim_subset: |
|
2014 |
fixes S T :: "('n::euclidean_space) set" |
|
2015 |
assumes "S <= T" |
|
2016 |
shows "aff_dim S <= aff_dim T" |
|
2017 |
proof- |
|
2018 |
obtain B where B_def: "~(affine_dependent B) & B<=S & (affine hull B=affine hull S) & of_nat(card B) = aff_dim S+1" using aff_dim_inner_basis_exists[of S] by auto |
|
2019 |
moreover hence "int (card B) <= aff_dim T + 1" using assms independent_card_le_aff_dim[of B T] by auto |
|
2020 |
ultimately show ?thesis by auto |
|
2021 |
qed |
|
2022 |
||
2023 |
lemma aff_dim_subset_univ: |
|
2024 |
fixes S :: "('n::euclidean_space) set" |
|
2025 |
shows "aff_dim S <= int(DIM('n))" |
|
2026 |
proof - |
|
2027 |
have "aff_dim (UNIV :: ('n::euclidean_space) set) = int(DIM('n))" using aff_dim_univ by auto |
|
2028 |
from this show "aff_dim (S:: ('n::euclidean_space) set) <= int(DIM('n))" using assms aff_dim_subset[of S "(UNIV :: ('n::euclidean_space) set)"] subset_UNIV by auto |
|
2029 |
qed |
|
2030 |
||
2031 |
lemma affine_dim_equal: |
|
2032 |
assumes "affine (S :: ('n::euclidean_space) set)" "affine T" "S ~= {}" "S <= T" "aff_dim S = aff_dim T" |
|
2033 |
shows "S=T" |
|
2034 |
proof- |
|
2035 |
obtain a where "a : S" using assms by auto |
|
2036 |
hence "a : T" using assms by auto |
|
2037 |
def LS == "{y. ? x : S. (-a)+x=y}" |
|
2038 |
hence ls: "subspace LS & affine_parallel S LS" using assms parallel_subspace_explicit[of S a LS] `a : S` by auto |
|
2039 |
hence h1: "int(dim LS) = aff_dim S" using assms aff_dim_affine[of S LS] by auto |
|
2040 |
have "T ~= {}" using assms by auto |
|
2041 |
def LT == "{y. ? x : T. (-a)+x=y}" |
|
2042 |
hence lt: "subspace LT & affine_parallel T LT" using assms parallel_subspace_explicit[of T a LT] `a : T` by auto |
|
2043 |
hence "int(dim LT) = aff_dim T" using assms aff_dim_affine[of T LT] `T ~= {}` by auto |
|
2044 |
hence "dim LS = dim LT" using h1 assms by auto |
|
2045 |
moreover have "LS <= LT" using LS_def LT_def assms by auto |
|
2046 |
ultimately have "LS=LT" using subspace_dim_equal[of LS LT] ls lt by auto |
|
2047 |
moreover have "S = {x. ? y : LS. a+y=x}" using LS_def by auto |
|
2048 |
moreover have "T = {x. ? y : LT. a+y=x}" using LT_def by auto |
|
2049 |
ultimately show ?thesis by auto |
|
2050 |
qed |
|
2051 |
||
2052 |
lemma affine_hull_univ: |
|
2053 |
fixes S :: "('n::euclidean_space) set" |
|
2054 |
assumes "aff_dim S = int(DIM('n))" |
|
2055 |
shows "affine hull S = (UNIV :: ('n::euclidean_space) set)" |
|
2056 |
proof- |
|
2057 |
have "S ~= {}" using assms aff_dim_empty[of S] by auto |
|
2058 |
have h0: "S <= affine hull S" using hull_subset[of S _] by auto |
|
2059 |
have h1: "aff_dim (UNIV :: ('n::euclidean_space) set) = aff_dim S" using aff_dim_univ assms by auto |
|
2060 |
hence h2: "aff_dim (affine hull S) <= aff_dim (UNIV :: ('n::euclidean_space) set)" using aff_dim_subset_univ[of "affine hull S"] assms h0 by auto |
|
2061 |
have h3: "aff_dim S <= aff_dim (affine hull S)" using h0 aff_dim_subset[of S "affine hull S"] assms by auto |
|
2062 |
hence h4: "aff_dim (affine hull S) = aff_dim (UNIV :: ('n::euclidean_space) set)" using h0 h1 h2 by auto |
|
2063 |
from this show ?thesis using affine_dim_equal[of "affine hull S" "(UNIV :: ('n::euclidean_space) set)"] affine_affine_hull[of S] affine_UNIV assms h4 h0 `S ~= {}` by auto |
|
2064 |
qed |
|
2065 |
||
2066 |
lemma aff_dim_convex_hull: |
|
2067 |
fixes S :: "('n::euclidean_space) set" |
|
2068 |
shows "aff_dim (convex hull S)=aff_dim S" |
|
2069 |
using aff_dim_affine_hull[of S] convex_hull_subset_affine_hull[of S] |
|
2070 |
hull_subset[of S "convex"] aff_dim_subset[of S "convex hull S"] |
|
2071 |
aff_dim_subset[of "convex hull S" "affine hull S"] by auto |
|
2072 |
||
2073 |
lemma aff_dim_cball: |
|
2074 |
fixes a :: "'n::euclidean_space" |
|
2075 |
assumes "0<e" |
|
2076 |
shows "aff_dim (cball a e) = int (DIM('n))" |
|
2077 |
proof- |
|
2078 |
have "(%x. a + x) ` (cball 0 e)<=cball a e" unfolding cball_def dist_norm by auto |
|
2079 |
hence "aff_dim (cball (0 :: 'n::euclidean_space) e) <= aff_dim (cball a e)" |
|
2080 |
using aff_dim_translation_eq[of a "cball 0 e"] |
|
2081 |
aff_dim_subset[of "op + a ` cball 0 e" "cball a e"] by auto |
|
2082 |
moreover have "aff_dim (cball (0 :: 'n::euclidean_space) e) = int (DIM('n))" |
|
2083 |
using hull_inc[of "(0 :: 'n::euclidean_space)" "cball 0 e"] centre_in_cball[of "(0 :: 'n::euclidean_space)"] assms |
|
2084 |
by (simp add: dim_cball[of e] aff_dim_zero[of "cball 0 e"]) |
|
2085 |
ultimately show ?thesis using aff_dim_subset_univ[of "cball a e"] by auto |
|
2086 |
qed |
|
2087 |
||
2088 |
lemma aff_dim_open: |
|
2089 |
fixes S :: "('n::euclidean_space) set" |
|
2090 |
assumes "open S" "S ~= {}" |
|
2091 |
shows "aff_dim S = int (DIM('n))" |
|
2092 |
proof- |
|
2093 |
obtain x where "x:S" using assms by auto |
|
2094 |
from this obtain e where e_def: "e>0 & cball x e <= S" using open_contains_cball[of S] assms by auto |
|
2095 |
from this have "aff_dim (cball x e) <= aff_dim S" using aff_dim_subset by auto |
|
2096 |
from this show ?thesis using aff_dim_cball[of e x] aff_dim_subset_univ[of S] e_def by auto |
|
2097 |
qed |
|
2098 |
||
2099 |
lemma low_dim_interior: |
|
2100 |
fixes S :: "('n::euclidean_space) set" |
|
2101 |
assumes "~(aff_dim S = int (DIM('n)))" |
|
2102 |
shows "interior S = {}" |
|
2103 |
proof- |
|
2104 |
have "aff_dim(interior S) <= aff_dim S" |
|
2105 |
using interior_subset aff_dim_subset[of "interior S" S] by auto |
|
2106 |
from this show ?thesis using aff_dim_open[of "interior S"] aff_dim_subset_univ[of S] assms by auto |
|
2107 |
qed |
|
2108 |
||
44467 | 2109 |
subsection {* Relative interior of a set *} |
40377 | 2110 |
|
2111 |
definition "rel_interior S = {x. ? T. openin (subtopology euclidean (affine hull S)) T & x : T & T <= S}" |
|
2112 |
||
2113 |
lemma rel_interior: "rel_interior S = {x : S. ? T. open T & x : T & (T Int (affine hull S)) <= S}" |
|
2114 |
unfolding rel_interior_def[of S] openin_open[of "affine hull S"] apply auto |
|
2115 |
proof- |
|
2116 |
fix x T assume a: "x:S" "open T" "x : T" "(T Int (affine hull S)) <= S" |
|
2117 |
hence h1: "x : T Int affine hull S" using hull_inc by auto |
|
2118 |
show "EX Tb. (EX Ta. open Ta & Tb = affine hull S Int Ta) & x : Tb & Tb <= S" |
|
2119 |
apply (rule_tac x="T Int (affine hull S)" in exI) |
|
2120 |
using a h1 by auto |
|
2121 |
qed |
|
2122 |
||
2123 |
lemma mem_rel_interior: |
|
2124 |
"x : rel_interior S <-> (? T. open T & x : (T Int S) & (T Int (affine hull S)) <= S)" |
|
2125 |
by (auto simp add: rel_interior) |
|
2126 |
||
2127 |
lemma mem_rel_interior_ball: "x : rel_interior S <-> x : S & (? e. 0 < e & ((ball x e) Int (affine hull S)) <= S)" |
|
2128 |
apply (simp add: rel_interior, safe) |
|
2129 |
apply (force simp add: open_contains_ball) |
|
2130 |
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
|
2131 |
apply simp |
40377 | 2132 |
done |
2133 |
||
2134 |
lemma rel_interior_ball: |
|
2135 |
"rel_interior S = {x : S. ? e. e>0 & ((ball x e) Int (affine hull S)) <= S}" |
|
2136 |
using mem_rel_interior_ball [of _ S] by auto |
|
2137 |
||
2138 |
lemma mem_rel_interior_cball: "x : rel_interior S <-> x : S & (? e. 0 < e & ((cball x e) Int (affine hull S)) <= S)" |
|
2139 |
apply (simp add: rel_interior, safe) |
|
2140 |
apply (force simp add: open_contains_cball) |
|
2141 |
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
|
2142 |
apply (simp add: subset_trans [OF ball_subset_cball]) |
40377 | 2143 |
apply auto |
2144 |
done |
|
2145 |
||
2146 |
lemma rel_interior_cball: "rel_interior S = {x : S. ? e. e>0 & ((cball x e) Int (affine hull S)) <= S}" using mem_rel_interior_cball [of _ S] by auto |
|
2147 |
||
2148 |
lemma rel_interior_empty: "rel_interior {} = {}" |
|
2149 |
by (auto simp add: rel_interior_def) |
|
2150 |
||
2151 |
lemma affine_hull_sing: "affine hull {a :: 'n::euclidean_space} = {a}" |
|
2152 |
by (metis affine_hull_eq affine_sing) |
|
2153 |
||
2154 |
lemma rel_interior_sing: "rel_interior {a :: 'n::euclidean_space} = {a}" |
|
2155 |
unfolding rel_interior_ball affine_hull_sing apply auto |
|
2156 |
apply(rule_tac x="1 :: real" in exI) apply simp |
|
2157 |
done |
|
2158 |
||
2159 |
lemma subset_rel_interior: |
|
2160 |
fixes S T :: "('n::euclidean_space) set" |
|
2161 |
assumes "S<=T" "affine hull S=affine hull T" |
|
2162 |
shows "rel_interior S <= rel_interior T" |
|
2163 |
using assms by (auto simp add: rel_interior_def) |
|
2164 |
||
2165 |
lemma rel_interior_subset: "rel_interior S <= S" |
|
2166 |
by (auto simp add: rel_interior_def) |
|
2167 |
||
2168 |
lemma rel_interior_subset_closure: "rel_interior S <= closure S" |
|
2169 |
using rel_interior_subset by (auto simp add: closure_def) |
|
2170 |
||
2171 |
lemma interior_subset_rel_interior: "interior S <= rel_interior S" |
|
2172 |
by (auto simp add: rel_interior interior_def) |
|
2173 |
||
2174 |
lemma interior_rel_interior: |
|
2175 |
fixes S :: "('n::euclidean_space) set" |
|
2176 |
assumes "aff_dim S = int(DIM('n))" |
|
2177 |
shows "rel_interior S = interior S" |
|
2178 |
proof - |
|
2179 |
have "affine hull S = UNIV" using assms affine_hull_univ[of S] by auto |
|
2180 |
from this show ?thesis unfolding rel_interior interior_def by auto |
|
2181 |
qed |
|
2182 |
||
2183 |
lemma rel_interior_open: |
|
2184 |
fixes S :: "('n::euclidean_space) set" |
|
2185 |
assumes "open S" |
|
2186 |
shows "rel_interior S = S" |
|
2187 |
by (metis assms interior_eq interior_subset_rel_interior rel_interior_subset set_eq_subset) |
|
2188 |
||
2189 |
lemma interior_rel_interior_gen: |
|
2190 |
fixes S :: "('n::euclidean_space) set" |
|
2191 |
shows "interior S = (if aff_dim S = int(DIM('n)) then rel_interior S else {})" |
|
2192 |
by (metis interior_rel_interior low_dim_interior) |
|
2193 |
||
2194 |
lemma rel_interior_univ: |
|
2195 |
fixes S :: "('n::euclidean_space) set" |
|
2196 |
shows "rel_interior (affine hull S) = affine hull S" |
|
2197 |
proof- |
|
2198 |
have h1: "rel_interior (affine hull S) <= affine hull S" using rel_interior_subset by auto |
|
2199 |
{ fix x assume x_def: "x : affine hull S" |
|
2200 |
obtain e :: real where "e=1" by auto |
|
2201 |
hence "e>0 & ball x e Int affine hull (affine hull S) <= affine hull S" using hull_hull[of _ S] by auto |
|
2202 |
hence "x : rel_interior (affine hull S)" using x_def rel_interior_ball[of "affine hull S"] by auto |
|
2203 |
} from this show ?thesis using h1 by auto |
|
2204 |
qed |
|
2205 |
||
2206 |
lemma rel_interior_univ2: "rel_interior (UNIV :: ('n::euclidean_space) set) = UNIV" |
|
2207 |
by (metis open_UNIV rel_interior_open) |
|
2208 |
||
2209 |
lemma rel_interior_convex_shrink: |
|
2210 |
fixes S :: "('a::euclidean_space) set" |
|
2211 |
assumes "convex S" "c : rel_interior S" "x : S" "0 < e" "e <= 1" |
|
2212 |
shows "x - e *\<^sub>R (x - c) : rel_interior S" |
|
2213 |
proof- |
|
2214 |
(* Proof is a modified copy of the proof of similar lemma mem_interior_convex_shrink |
|
2215 |
*) |
|
2216 |
obtain d where "d>0" and d:"ball c d Int affine hull S <= S" |
|
2217 |
using assms(2) unfolding mem_rel_interior_ball by auto |
|
2218 |
{ fix y assume as:"dist (x - e *\<^sub>R (x - c)) y < e * d & y : affine hull S" |
|
2219 |
have *:"y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x" using `e>0` by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib) |
|
2220 |
have "x : affine hull S" using assms hull_subset[of S] by auto |
|
2221 |
moreover have "1 / e + - ((1 - e) / e) = 1" |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
2222 |
using `e>0` left_diff_distrib[of "1" "(1-e)" "1/e"] by auto |
40377 | 2223 |
ultimately have **: "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x : affine hull S" |
2224 |
using as affine_affine_hull[of S] mem_affine[of "affine hull S" y x "(1 / e)" "-((1 - e) / e)"] by (simp add: algebra_simps) |
|
2225 |
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)" |
|
2226 |
unfolding dist_norm unfolding norm_scaleR[THEN sym] apply(rule arg_cong[where f=norm]) using `e>0` |
|
2227 |
by(auto simp add:euclidean_eq[where 'a='a] field_simps) |
|
2228 |
also have "... = abs(1/e) * norm (x - e *\<^sub>R (x - c) - y)" by(auto intro!:arg_cong[where f=norm] simp add: algebra_simps) |
|
2229 |
also have "... < d" using as[unfolded dist_norm] and `e>0` |
|
2230 |
by(auto simp add:pos_divide_less_eq[OF `e>0`] real_mult_commute) |
|
2231 |
finally have "y : S" apply(subst *) |
|
2232 |
apply(rule assms(1)[unfolded convex_alt,rule_format]) |
|
2233 |
apply(rule d[unfolded subset_eq,rule_format]) unfolding mem_ball using assms(3-5) ** by auto |
|
2234 |
} hence "ball (x - e *\<^sub>R (x - c)) (e*d) Int affine hull S <= S" by auto |
|
2235 |
moreover have "0 < e*d" using `0<e` `0<d` using real_mult_order by auto |
|
2236 |
moreover have "c : S" using assms rel_interior_subset by auto |
|
2237 |
moreover hence "x - e *\<^sub>R (x - c) : S" |
|
2238 |
using mem_convex[of S x c e] apply (simp add: algebra_simps) using assms by auto |
|
2239 |
ultimately show ?thesis |
|
2240 |
using mem_rel_interior_ball[of "x - e *\<^sub>R (x - c)" S] `e>0` by auto |
|
2241 |
qed |
|
2242 |
||
2243 |
lemma interior_real_semiline: |
|
2244 |
fixes a :: real |
|
2245 |
shows "interior {a..} = {a<..}" |
|
2246 |
proof- |
|
2247 |
{ fix y assume "a<y" hence "y : interior {a..}" |
|
2248 |
apply (simp add: mem_interior) apply (rule_tac x="(y-a)" in exI) apply (auto simp add: dist_norm) |
|
2249 |
done } |
|
2250 |
moreover |
|
2251 |
{ fix y assume "y : interior {a..}" (*hence "a<=y" using interior_subset by auto*) |
|
2252 |
from this obtain e where e_def: "e>0 & cball y e \<subseteq> {a..}" |
|
2253 |
using mem_interior_cball[of y "{a..}"] by auto |
|
2254 |
moreover hence "y-e : cball y e" by (auto simp add: cball_def dist_norm) |
|
2255 |
ultimately have "a<=y-e" by auto |
|
2256 |
hence "a<y" using e_def by auto |
|
2257 |
} ultimately show ?thesis by auto |
|
2258 |
qed |
|
2259 |
||
2260 |
lemma rel_interior_real_interval: |
|
2261 |
fixes a b :: real assumes "a < b" shows "rel_interior {a..b} = {a<..<b}" |
|
2262 |
proof- |
|
2263 |
have "{a<..<b} \<noteq> {}" using assms unfolding set_eq_iff by (auto intro!: exI[of _ "(a + b) / 2"]) |
|
2264 |
then show ?thesis |
|
2265 |
using interior_rel_interior_gen[of "{a..b}", symmetric] |
|
2266 |
by (simp split: split_if_asm add: interior_closed_interval) |
|
2267 |
qed |
|
2268 |
||
2269 |
lemma rel_interior_real_semiline: |
|
2270 |
fixes a :: real shows "rel_interior {a..} = {a<..}" |
|
2271 |
proof- |
|
2272 |
have *: "{a<..} \<noteq> {}" unfolding set_eq_iff by (auto intro!: exI[of _ "a + 1"]) |
|
2273 |
then show ?thesis using interior_real_semiline |
|
2274 |
interior_rel_interior_gen[of "{a..}"] |
|
2275 |
by (auto split: split_if_asm) |
|
2276 |
qed |
|
2277 |
||
44467 | 2278 |
subsubsection {* Relative open sets *} |
40377 | 2279 |
|
2280 |
definition "rel_open S <-> (rel_interior S) = S" |
|
2281 |
||
2282 |
lemma rel_open: "rel_open S <-> openin (subtopology euclidean (affine hull S)) S" |
|
2283 |
unfolding rel_open_def rel_interior_def apply auto |
|
2284 |
using openin_subopen[of "subtopology euclidean (affine hull S)" S] by auto |
|
2285 |
||
2286 |
lemma opein_rel_interior: |
|
2287 |
"openin (subtopology euclidean (affine hull S)) (rel_interior S)" |
|
2288 |
apply (simp add: rel_interior_def) |
|
2289 |
apply (subst openin_subopen) by blast |
|
2290 |
||
2291 |
lemma affine_rel_open: |
|
2292 |
fixes S :: "('n::euclidean_space) set" |
|
2293 |
assumes "affine S" shows "rel_open S" |
|
2294 |
unfolding rel_open_def using assms rel_interior_univ[of S] affine_hull_eq[of S] by metis |
|
2295 |
||
2296 |
lemma affine_closed: |
|
2297 |
fixes S :: "('n::euclidean_space) set" |
|
2298 |
assumes "affine S" shows "closed S" |
|
2299 |
proof- |
|
2300 |
{ assume "S ~= {}" |
|
2301 |
from this obtain L where L_def: "subspace L & affine_parallel S L" |
|
2302 |
using assms affine_parallel_subspace[of S] by auto |
|
2303 |
from this obtain "a" where a_def: "S=(op + a ` L)" |
|
2304 |
using affine_parallel_def[of L S] affine_parallel_commut by auto |
|
2305 |
have "closed L" using L_def closed_subspace by auto |
|
2306 |
hence "closed S" using closed_translation a_def by auto |
|
2307 |
} from this show ?thesis by auto |
|
2308 |
qed |
|
2309 |
||
2310 |
lemma closure_affine_hull: |
|
2311 |
fixes S :: "('n::euclidean_space) set" |
|
2312 |
shows "closure S <= affine hull S" |
|
2313 |
proof- |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
2314 |
have "closure S <= closure (affine hull S)" using closure_mono by auto |
40377 | 2315 |
moreover have "closure (affine hull S) = affine hull S" |
2316 |
using affine_affine_hull affine_closed[of "affine hull S"] closure_eq by auto |
|
2317 |
ultimately show ?thesis by auto |
|
2318 |
qed |
|
2319 |
||
2320 |
lemma closure_same_affine_hull: |
|
2321 |
fixes S :: "('n::euclidean_space) set" |
|
2322 |
shows "affine hull (closure S) = affine hull S" |
|
2323 |
proof- |
|
2324 |
have "affine hull (closure S) <= affine hull S" |
|
2325 |
using hull_mono[of "closure S" "affine hull S" "affine"] closure_affine_hull[of S] hull_hull[of "affine" S] by auto |
|
2326 |
moreover have "affine hull (closure S) >= affine hull S" |
|
2327 |
using hull_mono[of "S" "closure S" "affine"] closure_subset by auto |
|
2328 |
ultimately show ?thesis by auto |
|
2329 |
qed |
|
2330 |
||
2331 |
lemma closure_aff_dim: |
|
2332 |
fixes S :: "('n::euclidean_space) set" |
|
2333 |
shows "aff_dim (closure S) = aff_dim S" |
|
2334 |
proof- |
|
2335 |
have "aff_dim S <= aff_dim (closure S)" using aff_dim_subset closure_subset by auto |
|
2336 |
moreover have "aff_dim (closure S) <= aff_dim (affine hull S)" |
|
2337 |
using aff_dim_subset closure_affine_hull by auto |
|
2338 |
moreover have "aff_dim (affine hull S) = aff_dim S" using aff_dim_affine_hull by auto |
|
2339 |
ultimately show ?thesis by auto |
|
2340 |
qed |
|
2341 |
||
2342 |
lemma rel_interior_closure_convex_shrink: |
|
2343 |
fixes S :: "(_::euclidean_space) set" |
|
2344 |
assumes "convex S" "c : rel_interior S" "x : closure S" "0 < e" "e <= 1" |
|
2345 |
shows "x - e *\<^sub>R (x - c) : rel_interior S" |
|
2346 |
proof- |
|
2347 |
(* Proof is a modified copy of the proof of similar lemma mem_interior_closure_convex_shrink |
|
2348 |
*) |
|
2349 |
obtain d where "d>0" and d:"ball c d Int affine hull S <= S" |
|
2350 |
using assms(2) unfolding mem_rel_interior_ball by auto |
|
2351 |
have "EX y : S. norm (y - x) * (1 - e) < e * d" proof(cases "x : S") |
|
2352 |
case True thus ?thesis using `e>0` `d>0` by(rule_tac bexI[where x=x], auto intro!: mult_pos_pos) next |
|
2353 |
case False hence x:"x islimpt S" using assms(3)[unfolded closure_def] by auto |
|
2354 |
show ?thesis proof(cases "e=1") |
|
2355 |
case True obtain y where "y : S" "y ~= x" "dist y x < 1" |
|
2356 |
using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto |
|
2357 |
thus ?thesis apply(rule_tac x=y in bexI) unfolding True using `d>0` by auto next |
|
2358 |
case False hence "0 < e * d / (1 - e)" and *:"1 - e > 0" |
|
2359 |
using `e<=1` `e>0` `d>0` by(auto intro!:mult_pos_pos divide_pos_pos) |
|
2360 |
then obtain y where "y : S" "y ~= x" "dist y x < e * d / (1 - e)" |
|
2361 |
using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto |
|
2362 |
thus ?thesis apply(rule_tac x=y in bexI) unfolding dist_norm using pos_less_divide_eq[OF *] by auto qed qed |
|
2363 |
then obtain y where "y : S" and y:"norm (y - x) * (1 - e) < e * d" by auto |
|
2364 |
def z == "c + ((1 - e) / e) *\<^sub>R (x - y)" |
|
2365 |
have *:"x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)" unfolding z_def using `e>0` by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib) |
|
2366 |
have zball: "z\<in>ball c d" |
|
2367 |
using mem_ball z_def dist_norm[of c] using y and assms(4,5) by (auto simp add:field_simps norm_minus_commute) |
|
2368 |
have "x : affine hull S" using closure_affine_hull assms by auto |
|
2369 |
moreover have "y : affine hull S" using `y : S` hull_subset[of S] by auto |
|
2370 |
moreover have "c : affine hull S" using assms rel_interior_subset hull_subset[of S] by auto |
|
2371 |
ultimately have "z : affine hull S" |
|
2372 |
using z_def affine_affine_hull[of S] |
|
2373 |
mem_affine_3_minus [of "affine hull S" c x y "(1 - e) / e"] |
|
2374 |
assms by (auto simp add: field_simps) |
|
2375 |
hence "z : S" using d zball by auto |
|
2376 |
obtain d1 where "d1>0" and d1:"ball z d1 <= ball c d" |
|
2377 |
using zball open_ball[of c d] openE[of "ball c d" z] by auto |
|
2378 |
hence "(ball z d1) Int (affine hull S) <= (ball c d) Int (affine hull S)" by auto |
|
2379 |
hence "(ball z d1) Int (affine hull S) <= S" using d by auto |
|
2380 |
hence "z : rel_interior S" using mem_rel_interior_ball using `d1>0` `z : S` by auto |
|
2381 |
hence "y - e *\<^sub>R (y - z) : rel_interior S" using rel_interior_convex_shrink[of S z y e] assms`y : S` by auto |
|
2382 |
thus ?thesis using * by auto |
|
2383 |
qed |
|
2384 |
||
44467 | 2385 |
subsubsection{* Relative interior preserves under linear transformations *} |
40377 | 2386 |
|
2387 |
lemma rel_interior_translation_aux: |
|
2388 |
fixes a :: "'n::euclidean_space" |
|
2389 |
shows "((%x. a + x) ` rel_interior S) <= rel_interior ((%x. a + x) ` S)" |
|
2390 |
proof- |
|
2391 |
{ fix x assume x_def: "x : rel_interior S" |
|
2392 |
from this obtain T where T_def: "open T & x : (T Int S) & (T Int (affine hull S)) <= S" using mem_rel_interior[of x S] by auto |
|
2393 |
from this have "open ((%x. a + x) ` T)" and |
|
2394 |
"(a + x) : (((%x. a + x) ` T) Int ((%x. a + x) ` S))" and |
|
2395 |
"(((%x. a + x) ` T) Int (affine hull ((%x. a + x) ` S))) <= ((%x. a + x) ` S)" |
|
2396 |
using affine_hull_translation[of a S] open_translation[of T a] x_def by auto |
|
2397 |
from this have "(a+x) : rel_interior ((%x. a + x) ` S)" |
|
2398 |
using mem_rel_interior[of "a+x" "((%x. a + x) ` S)"] by auto |
|
2399 |
} from this show ?thesis by auto |
|
2400 |
qed |
|
2401 |
||
2402 |
lemma rel_interior_translation: |
|
2403 |
fixes a :: "'n::euclidean_space" |
|
2404 |
shows "rel_interior ((%x. a + x) ` S) = ((%x. a + x) ` rel_interior S)" |
|
2405 |
proof- |
|
2406 |
have "(%x. (-a) + x) ` rel_interior ((%x. a + x) ` S) <= rel_interior S" |
|
2407 |
using rel_interior_translation_aux[of "-a" "(%x. a + x) ` S"] |
|
2408 |
translation_assoc[of "-a" "a"] by auto |
|
2409 |
hence "((%x. a + x) ` rel_interior S) >= rel_interior ((%x. a + x) ` S)" |
|
2410 |
using translation_inverse_subset[of a "rel_interior (op + a ` S)" "rel_interior S"] |
|
2411 |
by auto |
|
2412 |
from this show ?thesis using rel_interior_translation_aux[of a S] by auto |
|
2413 |
qed |
|
2414 |
||
2415 |
||
2416 |
lemma affine_hull_linear_image: |
|
2417 |
assumes "bounded_linear f" |
|
2418 |
shows "f ` (affine hull s) = affine hull f ` s" |
|
2419 |
(* Proof is a modified copy of the proof of similar lemma convex_hull_linear_image |
|
2420 |
*) |
|
2421 |
apply rule unfolding subset_eq ball_simps apply(rule_tac[!] hull_induct, rule hull_inc) prefer 3 |
|
2422 |
apply(erule imageE)apply(rule_tac x=xa in image_eqI) apply assumption |
|
2423 |
apply(rule hull_subset[unfolded subset_eq, rule_format]) apply assumption |
|
2424 |
proof- |
|
2425 |
interpret f: bounded_linear f by fact |
|
2426 |
show "affine {x. f x : affine hull f ` s}" |
|
2427 |
unfolding affine_def by(auto simp add: f.scaleR f.add affine_affine_hull[unfolded affine_def, rule_format]) next |
|
2428 |
interpret f: bounded_linear f by fact |
|
2429 |
show "affine {x. x : f ` (affine hull s)}" using affine_affine_hull[unfolded affine_def, of s] |
|
2430 |
unfolding affine_def by (auto simp add: f.scaleR [symmetric] f.add [symmetric]) |
|
2431 |
qed auto |
|
2432 |
||
2433 |
||
2434 |
lemma rel_interior_injective_on_span_linear_image: |
|
2435 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
2436 |
fixes S :: "('m::euclidean_space) set" |
|
2437 |
assumes "bounded_linear f" and "inj_on f (span S)" |
|
2438 |
shows "rel_interior (f ` S) = f ` (rel_interior S)" |
|
2439 |
proof- |
|
2440 |
{ fix z assume z_def: "z : rel_interior (f ` S)" |
|
2441 |
have "z : f ` S" using z_def rel_interior_subset[of "f ` S"] by auto |
|
2442 |
from this obtain x where x_def: "x : S & (f x = z)" by auto |
|
2443 |
obtain e2 where e2_def: "e2>0 & cball z e2 Int affine hull (f ` S) <= (f ` S)" |
|
2444 |
using z_def rel_interior_cball[of "f ` S"] by auto |
|
2445 |
obtain K where K_def: "K>0 & (! x. norm (f x) <= norm x * K)" |
|
2446 |
using assms RealVector.bounded_linear.pos_bounded[of f] by auto |
|
2447 |
def e1 == "1/K" hence e1_def: "e1>0 & (! x. e1 * norm (f x) <= norm x)" |
|
2448 |
using K_def pos_le_divide_eq[of e1] by auto |
|
2449 |
def e == "e1 * e2" hence "e>0" using e1_def e2_def real_mult_order by auto |
|
2450 |
{ fix y assume y_def: "y : cball x e Int affine hull S" |
|
2451 |
from this have h1: "f y : affine hull (f ` S)" |
|
2452 |
using affine_hull_linear_image[of f S] assms by auto |
|
2453 |
from y_def have "norm (x-y)<=e1 * e2" |
|
2454 |
using cball_def[of x e] dist_norm[of x y] e_def by auto |
|
2455 |
moreover have "(f x)-(f y)=f (x-y)" |
|
2456 |
using assms linear_sub[of f x y] linear_conv_bounded_linear[of f] by auto |
|
2457 |
moreover have "e1 * norm (f (x-y)) <= norm (x-y)" using e1_def by auto |
|
2458 |
ultimately have "e1 * norm ((f x)-(f y)) <= e1 * e2" by auto |
|
2459 |
hence "(f y) : (cball z e2)" |
|
2460 |
using cball_def[of "f x" e2] dist_norm[of "f x" "f y"] e1_def x_def by auto |
|
2461 |
hence "f y : (f ` S)" using y_def e2_def h1 by auto |
|
2462 |
hence "y : S" using assms y_def hull_subset[of S] affine_hull_subset_span |
|
2463 |
inj_on_image_mem_iff[of f "span S" S y] by auto |
|
2464 |
} |
|
2465 |
hence "z : f ` (rel_interior S)" using mem_rel_interior_cball[of x S] `e>0` x_def by auto |
|
2466 |
} |
|
2467 |
moreover |
|
2468 |
{ fix x assume x_def: "x : rel_interior S" |
|
2469 |
from this obtain e2 where e2_def: "e2>0 & cball x e2 Int affine hull S <= S" |
|
2470 |
using rel_interior_cball[of S] by auto |
|
2471 |
have "x : S" using x_def rel_interior_subset by auto |
|
2472 |
hence *: "f x : f ` S" by auto |
|
2473 |
have "! x:span S. f x = 0 --> x = 0" |
|
2474 |
using assms subspace_span linear_conv_bounded_linear[of f] |
|
2475 |
linear_injective_on_subspace_0[of f "span S"] by auto |
|
2476 |
from this obtain e1 where e1_def: "e1>0 & (! x : span S. e1 * norm x <= norm (f x))" |
|
2477 |
using assms injective_imp_isometric[of "span S" f] |
|
2478 |
subspace_span[of S] closed_subspace[of "span S"] by auto |
|
2479 |
def e == "e1 * e2" hence "e>0" using e1_def e2_def real_mult_order by auto |
|
2480 |
{ fix y assume y_def: "y : cball (f x) e Int affine hull (f ` S)" |
|
2481 |
from this have "y : f ` (affine hull S)" using affine_hull_linear_image[of f S] assms by auto |
|
2482 |
from this obtain xy where xy_def: "xy : affine hull S & (f xy = y)" by auto |
|
2483 |
from this y_def have "norm ((f x)-(f xy))<=e1 * e2" |
|
2484 |
using cball_def[of "f x" e] dist_norm[of "f x" y] e_def by auto |
|
2485 |
moreover have "(f x)-(f xy)=f (x-xy)" |
|
2486 |
using assms linear_sub[of f x xy] linear_conv_bounded_linear[of f] by auto |
|
2487 |
moreover have "x-xy : span S" |
|
2488 |
using subspace_sub[of "span S" x xy] subspace_span `x : S` xy_def |
|
2489 |
affine_hull_subset_span[of S] span_inc by auto |
|
2490 |
moreover hence "e1 * norm (x-xy) <= norm (f (x-xy))" using e1_def by auto |
|
2491 |
ultimately have "e1 * norm (x-xy) <= e1 * e2" by auto |
|
2492 |
hence "xy : (cball x e2)" using cball_def[of x e2] dist_norm[of x xy] e1_def by auto |
|
2493 |
hence "y : (f ` S)" using xy_def e2_def by auto |
|
2494 |
} |
|
2495 |
hence "(f x) : rel_interior (f ` S)" |
|
2496 |
using mem_rel_interior_cball[of "(f x)" "(f ` S)"] * `e>0` by auto |
|
2497 |
} |
|
2498 |
ultimately show ?thesis by auto |
|
2499 |
qed |
|
2500 |
||
2501 |
lemma rel_interior_injective_linear_image: |
|
2502 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
2503 |
assumes "bounded_linear f" and "inj f" |
|
2504 |
shows "rel_interior (f ` S) = f ` (rel_interior S)" |
|
2505 |
using assms rel_interior_injective_on_span_linear_image[of f S] |
|
2506 |
subset_inj_on[of f "UNIV" "span S"] by auto |
|
2507 |
||
2508 |
subsection{* Some Properties of subset of standard basis *} |
|
2509 |
||
2510 |
lemma affine_hull_substd_basis: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
|
2511 |
shows "affine hull (insert 0 {basis i | i. i : d}) = |
|
2512 |
{x::'a::euclidean_space. (!i<DIM('a). i ~: d --> x$$i = 0)}" |
|
2513 |
(is "affine hull (insert 0 ?A) = ?B") |
|
2514 |
proof- have *:"\<And>A. op + (0\<Colon>'a) ` A = A" "\<And>A. op + (- (0\<Colon>'a)) ` A = A" by auto |
|
2515 |
show ?thesis unfolding affine_hull_insert_span_gen span_substd_basis[OF assms,THEN sym] * .. |
|
2516 |
qed |
|
2517 |
||
2518 |
lemma affine_hull_convex_hull: "affine hull (convex hull S) = affine hull S" |
|
2519 |
by (metis Int_absorb1 Int_absorb2 convex_hull_subset_affine_hull hull_hull hull_mono hull_subset) |
|
2520 |
||
33175 | 2521 |
subsection {* Openness and compactness are preserved by convex hull operation. *} |
2522 |
||
34964 | 2523 |
lemma open_convex_hull[intro]: |
33175 | 2524 |
fixes s :: "'a::real_normed_vector set" |
2525 |
assumes "open s" |
|
2526 |
shows "open(convex hull s)" |
|
43969 | 2527 |
unfolding open_contains_cball convex_hull_explicit unfolding mem_Collect_eq ball_simps(8) |
33175 | 2528 |
proof(rule, rule) fix a |
2529 |
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" |
|
2530 |
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" by auto |
|
2531 |
||
2532 |
from assms[unfolded open_contains_cball] obtain b where b:"\<forall>x\<in>s. 0 < b x \<and> cball x (b x) \<subseteq> s" |
|
2533 |
using bchoice[of s "\<lambda>x e. e>0 \<and> cball x e \<subseteq> s"] by auto |
|
2534 |
have "b ` t\<noteq>{}" unfolding i_def using obt by auto def i \<equiv> "b ` t" |
|
2535 |
||
2536 |
show "\<exists>e>0. 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}" |
|
2537 |
apply(rule_tac x="Min i" in exI) unfolding subset_eq apply rule defer apply rule unfolding mem_Collect_eq |
|
2538 |
proof- |
|
2539 |
show "0 < Min i" unfolding i_def and Min_gr_iff[OF finite_imageI[OF obt(1)] `b \` t\<noteq>{}`] |
|
2540 |
using b apply simp apply rule apply(erule_tac x=x in ballE) using `t\<subseteq>s` by auto |
|
2541 |
next fix y assume "y \<in> cball a (Min i)" |
|
2542 |
hence y:"norm (a - y) \<le> Min i" unfolding dist_norm[THEN sym] by auto |
|
2543 |
{ fix x assume "x\<in>t" |
|
2544 |
hence "Min i \<le> b x" unfolding i_def apply(rule_tac Min_le) using obt(1) by auto |
|
2545 |
hence "x + (y - a) \<in> cball x (b x)" using y unfolding mem_cball dist_norm by auto |
|
2546 |
moreover from `x\<in>t` have "x\<in>s" using obt(2) by auto |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
2547 |
ultimately have "x + (y - a) \<in> s" using y and b[THEN bspec[where x=x]] unfolding subset_eq by fast } |
33175 | 2548 |
moreover |
2549 |
have *:"inj_on (\<lambda>v. v + (y - a)) t" unfolding inj_on_def by auto |
|
2550 |
have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a))) = 1" |
|
2551 |
unfolding setsum_reindex[OF *] o_def using obt(4) by auto |
|
2552 |
moreover have "(\<Sum>v\<in>(\<lambda>v. v + (y - a)) ` t. u (v - (y - a)) *\<^sub>R v) = y" |
|
2553 |
unfolding setsum_reindex[OF *] o_def using obt(4,5) |
|
2554 |
by (simp add: setsum_addf setsum_subtractf scaleR_left.setsum[THEN sym] scaleR_right_distrib) |
|
2555 |
ultimately 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" |
|
2556 |
apply(rule_tac x="(\<lambda>v. v + (y - a)) ` t" in exI) apply(rule_tac x="\<lambda>v. u (v - (y - a))" in exI) |
|
2557 |
using obt(1, 3) by auto |
|
2558 |
qed |
|
2559 |
qed |
|
2560 |
||
2561 |
lemma compact_convex_combinations: |
|
2562 |
fixes s t :: "'a::real_normed_vector set" |
|
2563 |
assumes "compact s" "compact t" |
|
2564 |
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}" |
|
2565 |
proof- |
|
2566 |
let ?X = "{0..1} \<times> s \<times> t" |
|
2567 |
let ?h = "(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" |
|
2568 |
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" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
2569 |
apply(rule set_eqI) unfolding image_iff mem_Collect_eq |
33175 | 2570 |
apply rule apply auto |
2571 |
apply (rule_tac x=u in rev_bexI, simp) |
|
2572 |
apply (erule rev_bexI, erule rev_bexI, simp) |
|
2573 |
by auto |
|
2574 |
have "continuous_on ({0..1} \<times> s \<times> t) |
|
2575 |
(\<lambda>z. (1 - fst z) *\<^sub>R fst (snd z) + fst z *\<^sub>R snd (snd z))" |
|
2576 |
unfolding continuous_on by (rule ballI) (intro tendsto_intros) |
|
2577 |
thus ?thesis unfolding * |
|
2578 |
apply (rule compact_continuous_image) |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2579 |
apply (intro compact_Times compact_interval assms) |
33175 | 2580 |
done |
2581 |
qed |
|
2582 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2583 |
lemma compact_convex_hull: fixes s::"('a::euclidean_space) set" |
33175 | 2584 |
assumes "compact s" shows "compact(convex hull s)" |
2585 |
proof(cases "s={}") |
|
2586 |
case True thus ?thesis using compact_empty by simp |
|
2587 |
next |
|
2588 |
case False then obtain w where "w\<in>s" by auto |
|
2589 |
show ?thesis unfolding caratheodory[of 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
|
2590 |
proof(induct ("DIM('a) + 1")) |
33175 | 2591 |
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
|
2592 |
using compact_empty by auto |
33175 | 2593 |
case 0 thus ?case unfolding * by simp |
2594 |
next |
|
2595 |
case (Suc n) |
|
2596 |
show ?case proof(cases "n=0") |
|
2597 |
case True have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} = s" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
2598 |
unfolding set_eq_iff and mem_Collect_eq proof(rule, rule) |
33175 | 2599 |
fix x assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
2600 |
then obtain t where t:"finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t" by auto |
|
2601 |
show "x\<in>s" proof(cases "card t = 0") |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
2602 |
case True thus ?thesis using t(4) unfolding card_0_eq[OF t(1)] by simp |
33175 | 2603 |
next |
2604 |
case False hence "card t = Suc 0" using t(3) `n=0` by auto |
|
2605 |
then obtain a where "t = {a}" unfolding card_Suc_eq by auto |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
2606 |
thus ?thesis using t(2,4) by simp |
33175 | 2607 |
qed |
2608 |
next |
|
2609 |
fix x assume "x\<in>s" |
|
2610 |
thus "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
|
2611 |
apply(rule_tac x="{x}" in exI) unfolding convex_hull_singleton by auto |
|
2612 |
qed thus ?thesis using assms by simp |
|
2613 |
next |
|
2614 |
case False have "{x. \<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t} = |
|
2615 |
{ (1 - u) *\<^sub>R x + u *\<^sub>R y | x y u. |
|
2616 |
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}}" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
2617 |
unfolding set_eq_iff and mem_Collect_eq proof(rule,rule) |
33175 | 2618 |
fix x assume "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> |
2619 |
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)" |
|
2620 |
then obtain u v c t where obt:"x = (1 - c) *\<^sub>R u + c *\<^sub>R v" |
|
2621 |
"0 \<le> c \<and> c \<le> 1" "u \<in> s" "finite t" "t \<subseteq> s" "card t \<le> n" "v \<in> convex hull t" by auto |
|
2622 |
moreover have "(1 - c) *\<^sub>R u + c *\<^sub>R v \<in> convex hull insert u t" |
|
2623 |
apply(rule mem_convex) using obt(2) and convex_convex_hull and hull_subset[of "insert u t" convex] |
|
2624 |
using obt(7) and hull_mono[of t "insert u t"] by auto |
|
2625 |
ultimately show "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
|
2626 |
apply(rule_tac x="insert u t" in exI) by (auto simp add: card_insert_if) |
|
2627 |
next |
|
2628 |
fix x assume "\<exists>t. finite t \<and> t \<subseteq> s \<and> card t \<le> Suc n \<and> x \<in> convex hull t" |
|
2629 |
then obtain t where t:"finite t" "t \<subseteq> s" "card t \<le> Suc n" "x \<in> convex hull t" by auto |
|
2630 |
let ?P = "\<exists>u v c. x = (1 - c) *\<^sub>R u + c *\<^sub>R v \<and> |
|
2631 |
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)" |
|
2632 |
show ?P proof(cases "card t = Suc n") |
|
2633 |
case False hence "card t \<le> n" using t(3) by auto |
|
2634 |
thus ?P apply(rule_tac x=w in exI, rule_tac x=x in exI, rule_tac x=1 in exI) using `w\<in>s` and t |
|
2635 |
by(auto intro!: exI[where x=t]) |
|
2636 |
next |
|
2637 |
case True then obtain a u where au:"t = insert a u" "a\<notin>u" apply(drule_tac card_eq_SucD) by auto |
|
2638 |
show ?P proof(cases "u={}") |
|
2639 |
case True hence "x=a" using t(4)[unfolded au] by auto |
|
2640 |
show ?P unfolding `x=a` apply(rule_tac x=a in exI, rule_tac x=a in exI, rule_tac x=1 in exI) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
2641 |
using t and `n\<noteq>0` unfolding au by(auto intro!: exI[where x="{a}"]) |
33175 | 2642 |
next |
2643 |
case False obtain ux vx b where obt:"ux\<ge>0" "vx\<ge>0" "ux + vx = 1" "b \<in> convex hull u" "x = ux *\<^sub>R a + vx *\<^sub>R b" |
|
2644 |
using t(4)[unfolded au convex_hull_insert[OF False]] by auto |
|
2645 |
have *:"1 - vx = ux" using obt(3) by auto |
|
2646 |
show ?P apply(rule_tac x=a in exI, rule_tac x=b in exI, rule_tac x=vx in exI) |
|
2647 |
using obt and t(1-3) unfolding au and * using card_insert_disjoint[OF _ au(2)] |
|
2648 |
by(auto intro!: exI[where x=u]) |
|
2649 |
qed |
|
2650 |
qed |
|
2651 |
qed |
|
2652 |
thus ?thesis using compact_convex_combinations[OF assms Suc] by simp |
|
2653 |
qed |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
2654 |
qed |
33175 | 2655 |
qed |
2656 |
||
2657 |
lemma finite_imp_compact_convex_hull: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2658 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2659 |
shows "finite s \<Longrightarrow> compact(convex hull s)" |
36071 | 2660 |
by (metis compact_convex_hull finite_imp_compact) |
33175 | 2661 |
|
2662 |
subsection {* Extremal points of a simplex are some vertices. *} |
|
2663 |
||
2664 |
lemma dist_increases_online: |
|
2665 |
fixes a b d :: "'a::real_inner" |
|
2666 |
assumes "d \<noteq> 0" |
|
2667 |
shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b" |
|
2668 |
proof(cases "inner a d - inner b d > 0") |
|
2669 |
case True hence "0 < inner d d + (inner a d * 2 - inner b d * 2)" |
|
2670 |
apply(rule_tac add_pos_pos) using assms by auto |
|
2671 |
thus ?thesis apply(rule_tac disjI2) unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff |
|
2672 |
by (simp add: algebra_simps inner_commute) |
|
2673 |
next |
|
2674 |
case False hence "0 < inner d d + (inner b d * 2 - inner a d * 2)" |
|
2675 |
apply(rule_tac add_pos_nonneg) using assms by auto |
|
2676 |
thus ?thesis apply(rule_tac disjI1) unfolding dist_norm and norm_eq_sqrt_inner and real_sqrt_less_iff |
|
2677 |
by (simp add: algebra_simps inner_commute) |
|
2678 |
qed |
|
2679 |
||
2680 |
lemma norm_increases_online: |
|
2681 |
fixes d :: "'a::real_inner" |
|
2682 |
shows "d \<noteq> 0 \<Longrightarrow> norm(a + d) > norm a \<or> norm(a - d) > norm a" |
|
2683 |
using dist_increases_online[of d a 0] unfolding dist_norm by auto |
|
2684 |
||
2685 |
lemma simplex_furthest_lt: |
|
2686 |
fixes s::"'a::real_inner set" assumes "finite s" |
|
2687 |
shows "\<forall>x \<in> (convex hull s). x \<notin> s \<longrightarrow> (\<exists>y\<in>(convex hull s). norm(x - a) < norm(y - a))" |
|
2688 |
proof(induct_tac rule: finite_induct[of s]) |
|
2689 |
fix x s 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))" |
|
2690 |
show "\<forall>xa\<in>convex hull insert x s. xa \<notin> insert x s \<longrightarrow> (\<exists>y\<in>convex hull insert x s. norm (xa - a) < norm (y - a))" |
|
2691 |
proof(rule,rule,cases "s = {}") |
|
2692 |
case False fix y assume y:"y \<in> convex hull insert x s" "y \<notin> insert x s" |
|
2693 |
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" |
|
2694 |
using y(1)[unfolded convex_hull_insert[OF False]] by auto |
|
2695 |
show "\<exists>z\<in>convex hull insert x s. norm (y - a) < norm (z - a)" |
|
2696 |
proof(cases "y\<in>convex hull s") |
|
2697 |
case True then obtain z where "z\<in>convex hull s" "norm (y - a) < norm (z - a)" |
|
2698 |
using as(3)[THEN bspec[where x=y]] and y(2) by auto |
|
2699 |
thus ?thesis apply(rule_tac x=z in bexI) unfolding convex_hull_insert[OF False] by auto |
|
2700 |
next |
|
2701 |
case False show ?thesis using obt(3) proof(cases "u=0", case_tac[!] "v=0") |
|
2702 |
assume "u=0" "v\<noteq>0" hence "y = b" using obt by auto |
|
2703 |
thus ?thesis using False and obt(4) by auto |
|
2704 |
next |
|
2705 |
assume "u\<noteq>0" "v=0" hence "y = x" using obt by auto |
|
2706 |
thus ?thesis using y(2) by auto |
|
2707 |
next |
|
2708 |
assume "u\<noteq>0" "v\<noteq>0" |
|
2709 |
then obtain w where w:"w>0" "w<u" "w<v" using real_lbound_gt_zero[of u v] and obt(1,2) by auto |
|
2710 |
have "x\<noteq>b" proof(rule ccontr) |
|
2711 |
assume "\<not> x\<noteq>b" hence "y=b" unfolding obt(5) |
|
2712 |
using obt(3) by(auto simp add: scaleR_left_distrib[THEN sym]) |
|
2713 |
thus False using obt(4) and False by simp qed |
|
2714 |
hence *:"w *\<^sub>R (x - b) \<noteq> 0" using w(1) by auto |
|
2715 |
show ?thesis using dist_increases_online[OF *, of a y] |
|
2716 |
proof(erule_tac disjE) |
|
2717 |
assume "dist a y < dist a (y + w *\<^sub>R (x - b))" |
|
2718 |
hence "norm (y - a) < norm ((u + w) *\<^sub>R x + (v - w) *\<^sub>R b - a)" |
|
2719 |
unfolding dist_commute[of a] unfolding dist_norm obt(5) by (simp add: algebra_simps) |
|
2720 |
moreover have "(u + w) *\<^sub>R x + (v - w) *\<^sub>R b \<in> convex hull insert x s" |
|
2721 |
unfolding convex_hull_insert[OF `s\<noteq>{}`] and mem_Collect_eq |
|
2722 |
apply(rule_tac x="u + w" in exI) apply rule defer |
|
2723 |
apply(rule_tac x="v - w" in exI) using `u\<ge>0` and w and obt(3,4) by auto |
|
2724 |
ultimately show ?thesis by auto |
|
2725 |
next |
|
2726 |
assume "dist a y < dist a (y - w *\<^sub>R (x - b))" |
|
2727 |
hence "norm (y - a) < norm ((u - w) *\<^sub>R x + (v + w) *\<^sub>R b - a)" |
|
2728 |
unfolding dist_commute[of a] unfolding dist_norm obt(5) by (simp add: algebra_simps) |
|
2729 |
moreover have "(u - w) *\<^sub>R x + (v + w) *\<^sub>R b \<in> convex hull insert x s" |
|
2730 |
unfolding convex_hull_insert[OF `s\<noteq>{}`] and mem_Collect_eq |
|
2731 |
apply(rule_tac x="u - w" in exI) apply rule defer |
|
2732 |
apply(rule_tac x="v + w" in exI) using `u\<ge>0` and w and obt(3,4) by auto |
|
2733 |
ultimately show ?thesis by auto |
|
2734 |
qed |
|
2735 |
qed auto |
|
2736 |
qed |
|
2737 |
qed auto |
|
2738 |
qed (auto simp add: assms) |
|
2739 |
||
2740 |
lemma simplex_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
|
2741 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2742 |
assumes "finite s" "s \<noteq> {}" |
2743 |
shows "\<exists>y\<in>s. \<forall>x\<in>(convex hull s). norm(x - a) \<le> norm(y - a)" |
|
2744 |
proof- |
|
2745 |
have "convex hull s \<noteq> {}" using hull_subset[of s convex] and assms(2) by auto |
|
2746 |
then obtain x where x:"x\<in>convex hull s" "\<forall>y\<in>convex hull s. norm (y - a) \<le> norm (x - a)" |
|
2747 |
using distance_attains_sup[OF finite_imp_compact_convex_hull[OF assms(1)], of a] |
|
2748 |
unfolding dist_commute[of a] unfolding dist_norm by auto |
|
2749 |
thus ?thesis proof(cases "x\<in>s") |
|
2750 |
case False then obtain y where "y\<in>convex hull s" "norm (x - a) < norm (y - a)" |
|
2751 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=x]] and x(1) by auto |
|
2752 |
thus ?thesis using x(2)[THEN bspec[where x=y]] by auto |
|
2753 |
qed auto |
|
2754 |
qed |
|
2755 |
||
2756 |
lemma simplex_furthest_le_exists: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2757 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2758 |
shows "finite s \<Longrightarrow> (\<forall>x\<in>(convex hull s). \<exists>y\<in>s. norm(x - a) \<le> norm(y - a))" |
2759 |
using simplex_furthest_le[of s] by (cases "s={}")auto |
|
2760 |
||
2761 |
lemma simplex_extremal_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
|
2762 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2763 |
assumes "finite s" "s \<noteq> {}" |
2764 |
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)" |
|
2765 |
proof- |
|
2766 |
have "convex hull s \<noteq> {}" using hull_subset[of s convex] and assms(2) by auto |
|
2767 |
then obtain u v where obt:"u\<in>convex hull s" "v\<in>convex hull s" |
|
2768 |
"\<forall>x\<in>convex hull s. \<forall>y\<in>convex hull s. norm (x - y) \<le> norm (u - v)" |
|
2769 |
using compact_sup_maxdistance[OF finite_imp_compact_convex_hull[OF assms(1)]] by auto |
|
2770 |
thus ?thesis proof(cases "u\<notin>s \<or> v\<notin>s", erule_tac disjE) |
|
2771 |
assume "u\<notin>s" then obtain y where "y\<in>convex hull s" "norm (u - v) < norm (y - v)" |
|
2772 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=u]] and obt(1) by auto |
|
2773 |
thus ?thesis using obt(3)[THEN bspec[where x=y], THEN bspec[where x=v]] and obt(2) by auto |
|
2774 |
next |
|
2775 |
assume "v\<notin>s" then obtain y where "y\<in>convex hull s" "norm (v - u) < norm (y - u)" |
|
2776 |
using simplex_furthest_lt[OF assms(1), THEN bspec[where x=v]] and obt(2) by auto |
|
2777 |
thus ?thesis using obt(3)[THEN bspec[where x=u], THEN bspec[where x=y]] and obt(1) |
|
2778 |
by (auto simp add: norm_minus_commute) |
|
2779 |
qed auto |
|
2780 |
qed |
|
2781 |
||
2782 |
lemma simplex_extremal_le_exists: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2783 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2784 |
shows "finite s \<Longrightarrow> x \<in> convex hull s \<Longrightarrow> y \<in> convex hull s |
2785 |
\<Longrightarrow> (\<exists>u\<in>s. \<exists>v\<in>s. norm(x - y) \<le> norm(u - v))" |
|
2786 |
using convex_hull_empty simplex_extremal_le[of s] by(cases "s={}")auto |
|
2787 |
||
2788 |
subsection {* Closest point of a convex set is unique, with a continuous projection. *} |
|
2789 |
||
2790 |
definition |
|
36337 | 2791 |
closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a" where |
33175 | 2792 |
"closest_point s a = (SOME x. x \<in> s \<and> (\<forall>y\<in>s. dist a x \<le> dist a y))" |
2793 |
||
2794 |
lemma closest_point_exists: |
|
2795 |
assumes "closed s" "s \<noteq> {}" |
|
2796 |
shows "closest_point s a \<in> s" "\<forall>y\<in>s. dist a (closest_point s a) \<le> dist a y" |
|
2797 |
unfolding closest_point_def apply(rule_tac[!] someI2_ex) |
|
2798 |
using distance_attains_inf[OF assms(1,2), of a] by auto |
|
2799 |
||
2800 |
lemma closest_point_in_set: |
|
2801 |
"closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> (closest_point s a) \<in> s" |
|
2802 |
by(meson closest_point_exists) |
|
2803 |
||
2804 |
lemma closest_point_le: |
|
2805 |
"closed s \<Longrightarrow> x \<in> s \<Longrightarrow> dist a (closest_point s a) \<le> dist a x" |
|
2806 |
using closest_point_exists[of s] by auto |
|
2807 |
||
2808 |
lemma closest_point_self: |
|
2809 |
assumes "x \<in> s" shows "closest_point s x = x" |
|
2810 |
unfolding closest_point_def apply(rule some1_equality, rule ex1I[of _ x]) |
|
2811 |
using assms by auto |
|
2812 |
||
2813 |
lemma closest_point_refl: |
|
2814 |
"closed s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> (closest_point s x = x \<longleftrightarrow> x \<in> s)" |
|
2815 |
using closest_point_in_set[of s x] closest_point_self[of x s] by auto |
|
2816 |
||
36337 | 2817 |
lemma closer_points_lemma: |
33175 | 2818 |
assumes "inner y z > 0" |
2819 |
shows "\<exists>u>0. \<forall>v>0. v \<le> u \<longrightarrow> norm(v *\<^sub>R z - y) < norm y" |
|
2820 |
proof- have z:"inner z z > 0" unfolding inner_gt_zero_iff using assms by auto |
|
2821 |
thus ?thesis using assms apply(rule_tac x="inner y z / inner z z" in exI) apply(rule) defer proof(rule+) |
|
2822 |
fix v assume "0<v" "v \<le> inner y z / inner z z" |
|
2823 |
thus "norm (v *\<^sub>R z - y) < norm y" unfolding norm_lt using z and assms |
|
2824 |
by (simp add: field_simps inner_diff inner_commute mult_strict_left_mono[OF _ `0<v`]) |
|
2825 |
qed(rule divide_pos_pos, auto) qed |
|
2826 |
||
2827 |
lemma closer_point_lemma: |
|
2828 |
assumes "inner (y - x) (z - x) > 0" |
|
2829 |
shows "\<exists>u>0. u \<le> 1 \<and> dist (x + u *\<^sub>R (z - x)) y < dist x y" |
|
2830 |
proof- obtain u where "u>0" and u:"\<forall>v>0. v \<le> u \<longrightarrow> norm (v *\<^sub>R (z - x) - (y - x)) < norm (y - x)" |
|
2831 |
using closer_points_lemma[OF assms] by auto |
|
2832 |
show ?thesis apply(rule_tac x="min u 1" in exI) using u[THEN spec[where x="min u 1"]] and `u>0` |
|
2833 |
unfolding dist_norm by(auto simp add: norm_minus_commute field_simps) qed |
|
2834 |
||
2835 |
lemma any_closest_point_dot: |
|
2836 |
assumes "convex s" "closed s" "x \<in> s" "y \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z" |
|
2837 |
shows "inner (a - x) (y - x) \<le> 0" |
|
2838 |
proof(rule ccontr) assume "\<not> inner (a - x) (y - x) \<le> 0" |
|
2839 |
then obtain u where u:"u>0" "u\<le>1" "dist (x + u *\<^sub>R (y - x)) a < dist x a" using closer_point_lemma[of a x y] by auto |
|
2840 |
let ?z = "(1 - u) *\<^sub>R x + u *\<^sub>R y" have "?z \<in> s" using mem_convex[OF assms(1,3,4), of u] using u by auto |
|
2841 |
thus False using assms(5)[THEN bspec[where x="?z"]] and u(3) by (auto simp add: dist_commute algebra_simps) qed |
|
2842 |
||
2843 |
lemma any_closest_point_unique: |
|
36337 | 2844 |
fixes x :: "'a::real_inner" |
33175 | 2845 |
assumes "convex s" "closed s" "x \<in> s" "y \<in> s" |
2846 |
"\<forall>z\<in>s. dist a x \<le> dist a z" "\<forall>z\<in>s. dist a y \<le> dist a z" |
|
2847 |
shows "x = y" using any_closest_point_dot[OF assms(1-4,5)] and any_closest_point_dot[OF assms(1-2,4,3,6)] |
|
2848 |
unfolding norm_pths(1) and norm_le_square |
|
2849 |
by (auto simp add: algebra_simps) |
|
2850 |
||
2851 |
lemma closest_point_unique: |
|
2852 |
assumes "convex s" "closed s" "x \<in> s" "\<forall>z\<in>s. dist a x \<le> dist a z" |
|
2853 |
shows "x = closest_point s a" |
|
2854 |
using any_closest_point_unique[OF assms(1-3) _ assms(4), of "closest_point s a"] |
|
2855 |
using closest_point_exists[OF assms(2)] and assms(3) by auto |
|
2856 |
||
2857 |
lemma closest_point_dot: |
|
2858 |
assumes "convex s" "closed s" "x \<in> s" |
|
2859 |
shows "inner (a - closest_point s a) (x - closest_point s a) \<le> 0" |
|
2860 |
apply(rule any_closest_point_dot[OF assms(1,2) _ assms(3)]) |
|
2861 |
using closest_point_exists[OF assms(2)] and assms(3) by auto |
|
2862 |
||
2863 |
lemma closest_point_lt: |
|
2864 |
assumes "convex s" "closed s" "x \<in> s" "x \<noteq> closest_point s a" |
|
2865 |
shows "dist a (closest_point s a) < dist a x" |
|
2866 |
apply(rule ccontr) apply(rule_tac notE[OF assms(4)]) |
|
2867 |
apply(rule closest_point_unique[OF assms(1-3), of a]) |
|
2868 |
using closest_point_le[OF assms(2), of _ a] by fastsimp |
|
2869 |
||
2870 |
lemma closest_point_lipschitz: |
|
2871 |
assumes "convex s" "closed s" "s \<noteq> {}" |
|
2872 |
shows "dist (closest_point s x) (closest_point s y) \<le> dist x y" |
|
2873 |
proof- |
|
2874 |
have "inner (x - closest_point s x) (closest_point s y - closest_point s x) \<le> 0" |
|
2875 |
"inner (y - closest_point s y) (closest_point s x - closest_point s y) \<le> 0" |
|
2876 |
apply(rule_tac[!] any_closest_point_dot[OF assms(1-2)]) |
|
2877 |
using closest_point_exists[OF assms(2-3)] by auto |
|
2878 |
thus ?thesis unfolding dist_norm and norm_le |
|
2879 |
using inner_ge_zero[of "(x - closest_point s x) - (y - closest_point s y)"] |
|
2880 |
by (simp add: inner_add inner_diff inner_commute) qed |
|
2881 |
||
2882 |
lemma continuous_at_closest_point: |
|
2883 |
assumes "convex s" "closed s" "s \<noteq> {}" |
|
2884 |
shows "continuous (at x) (closest_point s)" |
|
2885 |
unfolding continuous_at_eps_delta |
|
2886 |
using le_less_trans[OF closest_point_lipschitz[OF assms]] by auto |
|
2887 |
||
2888 |
lemma continuous_on_closest_point: |
|
2889 |
assumes "convex s" "closed s" "s \<noteq> {}" |
|
2890 |
shows "continuous_on t (closest_point s)" |
|
36071 | 2891 |
by(metis continuous_at_imp_continuous_on continuous_at_closest_point[OF assms]) |
33175 | 2892 |
|
44467 | 2893 |
subsubsection {* Various point-to-set separating/supporting hyperplane theorems. *} |
33175 | 2894 |
|
2895 |
lemma supporting_hyperplane_closed_point: |
|
36337 | 2896 |
fixes z :: "'a::{real_inner,heine_borel}" |
33175 | 2897 |
assumes "convex s" "closed s" "s \<noteq> {}" "z \<notin> s" |
2898 |
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)" |
|
2899 |
proof- |
|
2900 |
from distance_attains_inf[OF assms(2-3)] obtain y where "y\<in>s" and y:"\<forall>x\<in>s. dist z y \<le> dist z x" by auto |
|
2901 |
show ?thesis apply(rule_tac x="y - z" in exI, rule_tac x="inner (y - z) y" in exI, rule_tac x=y in bexI) |
|
2902 |
apply rule defer apply rule defer apply(rule, rule ccontr) using `y\<in>s` proof- |
|
2903 |
show "inner (y - z) z < inner (y - z) y" apply(subst diff_less_iff(1)[THEN sym]) |
|
2904 |
unfolding inner_diff_right[THEN sym] and inner_gt_zero_iff using `y\<in>s` `z\<notin>s` by auto |
|
2905 |
next |
|
2906 |
fix x assume "x\<in>s" 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)" |
|
2907 |
using assms(1)[unfolded convex_alt] and y and `x\<in>s` and `y\<in>s` by auto |
|
2908 |
assume "\<not> inner (y - z) y \<le> inner (y - z) x" then obtain v where |
|
2909 |
"v>0" "v\<le>1" "dist (y + v *\<^sub>R (x - y)) z < dist y z" using closer_point_lemma[of z y x] apply - by (auto simp add: inner_diff) |
|
2910 |
thus False using *[THEN spec[where x=v]] by(auto simp add: dist_commute algebra_simps) |
|
2911 |
qed auto |
|
2912 |
qed |
|
2913 |
||
2914 |
lemma separating_hyperplane_closed_point: |
|
36337 | 2915 |
fixes z :: "'a::{real_inner,heine_borel}" |
33175 | 2916 |
assumes "convex s" "closed s" "z \<notin> s" |
2917 |
shows "\<exists>a b. inner a z < b \<and> (\<forall>x\<in>s. inner a x > b)" |
|
2918 |
proof(cases "s={}") |
|
2919 |
case True thus ?thesis apply(rule_tac x="-z" in exI, rule_tac x=1 in exI) |
|
2920 |
using less_le_trans[OF _ inner_ge_zero[of z]] by auto |
|
2921 |
next |
|
2922 |
case False obtain y where "y\<in>s" and y:"\<forall>x\<in>s. dist z y \<le> dist z x" |
|
2923 |
using distance_attains_inf[OF assms(2) False] by auto |
|
2924 |
show ?thesis apply(rule_tac x="y - z" in exI, rule_tac x="inner (y - z) z + (norm(y - z))\<twosuperior> / 2" in exI) |
|
2925 |
apply rule defer apply rule proof- |
|
2926 |
fix x assume "x\<in>s" |
|
2927 |
have "\<not> 0 < inner (z - y) (x - y)" apply(rule_tac notI) proof(drule closer_point_lemma) |
|
2928 |
assume "\<exists>u>0. u \<le> 1 \<and> dist (y + u *\<^sub>R (x - y)) z < dist y z" |
|
2929 |
then obtain u where "u>0" "u\<le>1" "dist (y + u *\<^sub>R (x - y)) z < dist y z" by auto |
|
2930 |
thus False using y[THEN bspec[where x="y + u *\<^sub>R (x - y)"]] |
|
2931 |
using assms(1)[unfolded convex_alt, THEN bspec[where x=y]] |
|
2932 |
using `x\<in>s` `y\<in>s` by (auto simp add: dist_commute algebra_simps) qed |
|
2933 |
moreover have "0 < norm (y - z) ^ 2" using `y\<in>s` `z\<notin>s` by auto |
|
2934 |
hence "0 < inner (y - z) (y - z)" unfolding power2_norm_eq_inner by simp |
|
2935 |
ultimately show "inner (y - z) z + (norm (y - z))\<twosuperior> / 2 < inner (y - z) x" |
|
2936 |
unfolding power2_norm_eq_inner and not_less by (auto simp add: field_simps inner_commute inner_diff) |
|
2937 |
qed(insert `y\<in>s` `z\<notin>s`, auto) |
|
2938 |
qed |
|
2939 |
||
2940 |
lemma separating_hyperplane_closed_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
|
2941 |
assumes "convex (s::('a::euclidean_space) set)" "closed s" "0 \<notin> s" |
33175 | 2942 |
shows "\<exists>a b. a \<noteq> 0 \<and> 0 < b \<and> (\<forall>x\<in>s. inner a x > b)" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2943 |
proof(cases "s={}") |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2944 |
case True have "norm ((basis 0)::'a) = 1" by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2945 |
hence "norm ((basis 0)::'a) = 1" "basis 0 \<noteq> (0::'a)" defer |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2946 |
apply(subst norm_le_zero_iff[THEN sym]) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2947 |
thus ?thesis apply(rule_tac x="basis 0" in exI, rule_tac x=1 in exI) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2948 |
using True using DIM_positive[where 'a='a] by auto |
33175 | 2949 |
next case False thus ?thesis using False using separating_hyperplane_closed_point[OF assms] |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
2950 |
apply - apply(erule exE)+ unfolding inner_zero_right apply(rule_tac x=a in exI, rule_tac x=b in exI) by auto qed |
33175 | 2951 |
|
44467 | 2952 |
subsubsection {* Now set-to-set for closed/compact sets *} |
33175 | 2953 |
|
2954 |
lemma separating_hyperplane_closed_compact: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2955 |
assumes "convex (s::('a::euclidean_space) set)" "closed s" "convex t" "compact t" "t \<noteq> {}" "s \<inter> t = {}" |
33175 | 2956 |
shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)" |
2957 |
proof(cases "s={}") |
|
2958 |
case True |
|
2959 |
obtain b where b:"b>0" "\<forall>x\<in>t. norm x \<le> b" using compact_imp_bounded[OF assms(4)] unfolding bounded_pos 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
|
2960 |
obtain z::"'a" where z:"norm z = b + 1" using vector_choose_size[of "b + 1"] and b(1) by auto |
33175 | 2961 |
hence "z\<notin>t" using b(2)[THEN bspec[where x=z]] by auto |
2962 |
then obtain a b where ab:"inner a z < b" "\<forall>x\<in>t. b < inner a x" |
|
2963 |
using separating_hyperplane_closed_point[OF assms(3) compact_imp_closed[OF assms(4)], of z] by auto |
|
2964 |
thus ?thesis using True by auto |
|
2965 |
next |
|
2966 |
case False then obtain y where "y\<in>s" by auto |
|
2967 |
obtain a b where "0 < b" "\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. b < inner a x" |
|
2968 |
using separating_hyperplane_closed_point[OF convex_differences[OF assms(1,3)], of 0] |
|
2969 |
using closed_compact_differences[OF assms(2,4)] using assms(6) by(auto, blast) |
|
2970 |
hence ab:"\<forall>x\<in>s. \<forall>y\<in>t. b + inner a y < inner a x" apply- apply(rule,rule) apply(erule_tac x="x - y" in ballE) by (auto simp add: inner_diff) |
|
33270 | 2971 |
def k \<equiv> "Sup ((\<lambda>x. inner a x) ` t)" |
33175 | 2972 |
show ?thesis apply(rule_tac x="-a" in exI, rule_tac x="-(k + b / 2)" in exI) |
2973 |
apply(rule,rule) defer apply(rule) unfolding inner_minus_left and neg_less_iff_less proof- |
|
2974 |
from ab have "((\<lambda>x. inner a x) ` t) *<= (inner a y - b)" |
|
2975 |
apply(erule_tac x=y in ballE) apply(rule setleI) using `y\<in>s` by auto |
|
33270 | 2976 |
hence k:"isLub UNIV ((\<lambda>x. inner a x) ` t) k" unfolding k_def apply(rule_tac Sup) using assms(5) by auto |
33175 | 2977 |
fix x assume "x\<in>t" thus "inner a x < (k + b / 2)" using `0<b` and isLubD2[OF k, of "inner a x"] by auto |
2978 |
next |
|
2979 |
fix x assume "x\<in>s" |
|
33270 | 2980 |
hence "k \<le> inner a x - b" unfolding k_def apply(rule_tac Sup_least) using assms(5) |
33175 | 2981 |
using ab[THEN bspec[where x=x]] by auto |
2982 |
thus "k + b / 2 < inner a x" using `0 < b` by auto |
|
2983 |
qed |
|
2984 |
qed |
|
2985 |
||
2986 |
lemma separating_hyperplane_compact_closed: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2987 |
fixes s :: "('a::euclidean_space) set" |
33175 | 2988 |
assumes "convex s" "compact s" "s \<noteq> {}" "convex t" "closed t" "s \<inter> t = {}" |
2989 |
shows "\<exists>a b. (\<forall>x\<in>s. inner a x < b) \<and> (\<forall>x\<in>t. inner a x > b)" |
|
2990 |
proof- obtain a b where "(\<forall>x\<in>t. inner a x < b) \<and> (\<forall>x\<in>s. b < inner a x)" |
|
2991 |
using separating_hyperplane_closed_compact[OF assms(4-5,1-2,3)] and assms(6) by auto |
|
2992 |
thus ?thesis apply(rule_tac x="-a" in exI, rule_tac x="-b" in exI) by auto qed |
|
2993 |
||
44467 | 2994 |
subsubsection {* General case without assuming closure and getting non-strict separation *} |
33175 | 2995 |
|
2996 |
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
|
2997 |
assumes "convex s" "(0::'a::euclidean_space) \<notin> s" |
33175 | 2998 |
shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>s. 0 \<le> inner a x)" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
2999 |
proof- let ?k = "\<lambda>c. {x::'a. 0 \<le> inner c x}" |
33175 | 3000 |
have "frontier (cball 0 1) \<inter> (\<Inter> (?k ` s)) \<noteq> {}" |
3001 |
apply(rule compact_imp_fip) apply(rule compact_frontier[OF compact_cball]) |
|
3002 |
defer apply(rule,rule,erule conjE) proof- |
|
3003 |
fix f assume as:"f \<subseteq> ?k ` s" "finite f" |
|
3004 |
obtain c where c:"f = ?k ` c" "c\<subseteq>s" "finite c" using finite_subset_image[OF as(2,1)] by auto |
|
3005 |
then obtain a b where ab:"a \<noteq> 0" "0 < b" "\<forall>x\<in>convex hull c. b < inner a x" |
|
3006 |
using separating_hyperplane_closed_0[OF convex_convex_hull, of c] |
|
3007 |
using finite_imp_compact_convex_hull[OF c(3), THEN compact_imp_closed] and assms(2) |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3008 |
using subset_hull[of convex, OF assms(1), THEN sym, of c] by auto |
33175 | 3009 |
hence "\<exists>x. norm x = 1 \<and> (\<forall>y\<in>c. 0 \<le> inner y x)" apply(rule_tac x="inverse(norm a) *\<^sub>R a" in exI) |
3010 |
using hull_subset[of c convex] unfolding subset_eq and inner_scaleR |
|
3011 |
apply- apply rule defer apply rule apply(rule mult_nonneg_nonneg) |
|
3012 |
by(auto simp add: inner_commute elim!: ballE) |
|
3013 |
thus "frontier (cball 0 1) \<inter> \<Inter>f \<noteq> {}" unfolding c(1) frontier_cball dist_norm by auto |
|
3014 |
qed(insert closed_halfspace_ge, auto) |
|
3015 |
then obtain x where "norm x = 1" "\<forall>y\<in>s. x\<in>?k y" unfolding frontier_cball dist_norm by auto |
|
3016 |
thus ?thesis apply(rule_tac x=x in exI) by(auto simp add: inner_commute) qed |
|
3017 |
||
3018 |
lemma separating_hyperplane_sets: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3019 |
assumes "convex s" "convex (t::('a::euclidean_space) set)" "s \<noteq> {}" "t \<noteq> {}" "s \<inter> t = {}" |
33175 | 3020 |
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)" |
3021 |
proof- from separating_hyperplane_set_0[OF convex_differences[OF assms(2,1)]] |
|
33270 | 3022 |
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" |
3023 |
using assms(3-5) by auto |
|
3024 |
hence "\<forall>x\<in>t. \<forall>y\<in>s. inner a y \<le> inner a x" |
|
3025 |
by (force simp add: inner_diff) |
|
3026 |
thus ?thesis |
|
3027 |
apply(rule_tac x=a in exI, rule_tac x="Sup ((\<lambda>x. inner a x) ` s)" in exI) using `a\<noteq>0` |
|
3028 |
apply auto |
|
3029 |
apply (rule Sup[THEN isLubD2]) |
|
3030 |
prefer 4 |
|
3031 |
apply (rule Sup_least) |
|
3032 |
using assms(3-5) apply (auto simp add: setle_def) |
|
36071 | 3033 |
apply metis |
33270 | 3034 |
done |
3035 |
qed |
|
33175 | 3036 |
|
44467 | 3037 |
subsection {* More convexity generalities *} |
33175 | 3038 |
|
3039 |
lemma convex_closure: |
|
3040 |
fixes s :: "'a::real_normed_vector set" |
|
3041 |
assumes "convex s" shows "convex(closure s)" |
|
3042 |
unfolding convex_def Ball_def closure_sequential |
|
3043 |
apply(rule,rule,rule,rule,rule,rule,rule,rule,rule) apply(erule_tac exE)+ |
|
3044 |
apply(rule_tac x="\<lambda>n. u *\<^sub>R xb n + v *\<^sub>R xc n" in exI) apply(rule,rule) |
|
3045 |
apply(rule assms[unfolded convex_def, rule_format]) prefer 6 |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
3046 |
by (auto intro!: tendsto_intros) |
33175 | 3047 |
|
3048 |
lemma convex_interior: |
|
3049 |
fixes s :: "'a::real_normed_vector set" |
|
3050 |
assumes "convex s" shows "convex(interior s)" |
|
3051 |
unfolding convex_alt Ball_def mem_interior apply(rule,rule,rule,rule,rule,rule) apply(erule exE | erule conjE)+ proof- |
|
3052 |
fix x y u assume u:"0 \<le> u" "u \<le> (1::real)" |
|
3053 |
fix e d assume ed:"ball x e \<subseteq> s" "ball y d \<subseteq> s" "0<d" "0<e" |
|
3054 |
show "\<exists>e>0. ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) e \<subseteq> s" apply(rule_tac x="min d e" in exI) |
|
3055 |
apply rule unfolding subset_eq defer apply rule proof- |
|
3056 |
fix z assume "z \<in> ball ((1 - u) *\<^sub>R x + u *\<^sub>R y) (min d e)" |
|
3057 |
hence "(1- u) *\<^sub>R (z - u *\<^sub>R (y - x)) + u *\<^sub>R (z + (1 - u) *\<^sub>R (y - x)) \<in> s" |
|
3058 |
apply(rule_tac assms[unfolded convex_alt, rule_format]) |
|
3059 |
using ed(1,2) and u unfolding subset_eq mem_ball Ball_def dist_norm by(auto simp add: algebra_simps) |
|
3060 |
thus "z \<in> s" using u by (auto simp add: algebra_simps) qed(insert u ed(3-4), auto) qed |
|
3061 |
||
34964 | 3062 |
lemma convex_hull_eq_empty[simp]: "convex hull s = {} \<longleftrightarrow> s = {}" |
33175 | 3063 |
using hull_subset[of s convex] convex_hull_empty by auto |
3064 |
||
3065 |
subsection {* Moving and scaling convex hulls. *} |
|
3066 |
||
3067 |
lemma convex_hull_translation_lemma: |
|
3068 |
"convex hull ((\<lambda>x. a + x) ` s) \<subseteq> (\<lambda>x. a + x) ` (convex hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3069 |
by (metis convex_convex_hull convex_translation hull_minimal hull_subset image_mono) |
33175 | 3070 |
|
3071 |
lemma convex_hull_bilemma: fixes neg |
|
3072 |
assumes "(\<forall>s a. (convex hull (up a s)) \<subseteq> up a (convex hull s))" |
|
3073 |
shows "(\<forall>s. up a (up (neg a) s) = s) \<and> (\<forall>s. up (neg a) (up a s) = s) \<and> (\<forall>s t a. s \<subseteq> t \<longrightarrow> up a s \<subseteq> up a t) |
|
3074 |
\<Longrightarrow> \<forall>s. (convex hull (up a s)) = up a (convex hull s)" |
|
3075 |
using assms by(metis subset_antisym) |
|
3076 |
||
3077 |
lemma convex_hull_translation: |
|
3078 |
"convex hull ((\<lambda>x. a + x) ` s) = (\<lambda>x. a + x) ` (convex hull s)" |
|
3079 |
apply(rule convex_hull_bilemma[rule_format, of _ _ "\<lambda>a. -a"], rule convex_hull_translation_lemma) unfolding image_image by auto |
|
3080 |
||
3081 |
lemma convex_hull_scaling_lemma: |
|
3082 |
"(convex hull ((\<lambda>x. c *\<^sub>R x) ` s)) \<subseteq> (\<lambda>x. c *\<^sub>R x) ` (convex hull s)" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3083 |
by (metis convex_convex_hull convex_scaling hull_subset subset_hull subset_image_iff) |
33175 | 3084 |
|
3085 |
lemma convex_hull_scaling: |
|
3086 |
"convex hull ((\<lambda>x. c *\<^sub>R x) ` s) = (\<lambda>x. c *\<^sub>R x) ` (convex hull s)" |
|
3087 |
apply(cases "c=0") defer apply(rule convex_hull_bilemma[rule_format, of _ _ inverse]) apply(rule convex_hull_scaling_lemma) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3088 |
unfolding image_image scaleR_scaleR by(auto simp add:image_constant_conv) |
33175 | 3089 |
|
3090 |
lemma convex_hull_affinity: |
|
3091 |
"convex hull ((\<lambda>x. a + c *\<^sub>R x) ` s) = (\<lambda>x. a + c *\<^sub>R x) ` (convex hull s)" |
|
36071 | 3092 |
by(simp only: image_image[THEN sym] convex_hull_scaling convex_hull_translation) |
33175 | 3093 |
|
40377 | 3094 |
subsection {* Convexity of cone hulls *} |
3095 |
||
3096 |
lemma convex_cone_hull: |
|
3097 |
fixes S :: "('m::euclidean_space) set" |
|
3098 |
assumes "convex S" |
|
3099 |
shows "convex (cone hull S)" |
|
3100 |
proof- |
|
3101 |
{ fix x y assume xy_def: "x : cone hull S & y : cone hull S" |
|
3102 |
hence "S ~= {}" using cone_hull_empty_iff[of S] by auto |
|
3103 |
fix u v assume uv_def: "u>=0 & v>=0 & (u :: real)+v=1" |
|
3104 |
hence *: "u *\<^sub>R x : cone hull S & v *\<^sub>R y : cone hull S" |
|
3105 |
using cone_cone_hull[of S] xy_def cone_def[of "cone hull S"] by auto |
|
3106 |
from * obtain cx xx where x_def: "u *\<^sub>R x = cx *\<^sub>R xx & (cx :: real)>=0 & xx : S" |
|
3107 |
using cone_hull_expl[of S] by auto |
|
3108 |
from * obtain cy yy where y_def: "v *\<^sub>R y = cy *\<^sub>R yy & (cy :: real)>=0 & yy : S" |
|
3109 |
using cone_hull_expl[of S] by auto |
|
3110 |
{ assume "cx+cy<=0" hence "u *\<^sub>R x=0 & v *\<^sub>R y=0" using x_def y_def by auto |
|
3111 |
hence "u *\<^sub>R x+ v *\<^sub>R y = 0" by auto |
|
3112 |
hence "u *\<^sub>R x+ v *\<^sub>R y : cone hull S" using cone_hull_contains_0[of S] `S ~= {}` by auto |
|
3113 |
} |
|
3114 |
moreover |
|
3115 |
{ assume "cx+cy>0" |
|
3116 |
hence "(cx/(cx+cy)) *\<^sub>R xx + (cy/(cx+cy)) *\<^sub>R yy : S" |
|
3117 |
using assms mem_convex_alt[of S xx yy cx cy] x_def y_def by auto |
|
3118 |
hence "cx *\<^sub>R xx + cy *\<^sub>R yy : cone hull S" |
|
3119 |
using mem_cone_hull[of "(cx/(cx+cy)) *\<^sub>R xx + (cy/(cx+cy)) *\<^sub>R yy" S "cx+cy"] |
|
3120 |
`cx+cy>0` by (auto simp add: scaleR_right_distrib) |
|
3121 |
hence "u *\<^sub>R x+ v *\<^sub>R y : cone hull S" using x_def y_def by auto |
|
3122 |
} |
|
3123 |
moreover have "(cx+cy<=0) | (cx+cy>0)" by auto |
|
3124 |
ultimately have "u *\<^sub>R x+ v *\<^sub>R y : cone hull S" by blast |
|
3125 |
} from this show ?thesis unfolding convex_def by auto |
|
3126 |
qed |
|
3127 |
||
3128 |
lemma cone_convex_hull: |
|
3129 |
fixes S :: "('m::euclidean_space) set" |
|
3130 |
assumes "cone S" |
|
3131 |
shows "cone (convex hull S)" |
|
3132 |
proof- |
|
3133 |
{ assume "S = {}" hence ?thesis by auto } |
|
3134 |
moreover |
|
3135 |
{ assume "S ~= {}" hence *: "0:S & (!c. c>0 --> op *\<^sub>R c ` S = S)" using cone_iff[of S] assms by auto |
|
3136 |
{ fix c assume "(c :: real)>0" |
|
3137 |
hence "op *\<^sub>R c ` (convex hull S) = convex hull (op *\<^sub>R c ` S)" |
|
3138 |
using convex_hull_scaling[of _ S] by auto |
|
3139 |
also have "...=convex hull S" using * `c>0` by auto |
|
3140 |
finally have "op *\<^sub>R c ` (convex hull S) = convex hull S" by auto |
|
3141 |
} |
|
3142 |
hence "0 : convex hull S & (!c. c>0 --> (op *\<^sub>R c ` (convex hull S)) = (convex hull S))" |
|
3143 |
using * hull_subset[of S convex] by auto |
|
3144 |
hence ?thesis using `S ~= {}` cone_iff[of "convex hull S"] by auto |
|
3145 |
} |
|
3146 |
ultimately show ?thesis by blast |
|
3147 |
qed |
|
3148 |
||
44467 | 3149 |
subsection {* Convex set as intersection of halfspaces *} |
33175 | 3150 |
|
3151 |
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
|
3152 |
fixes s :: "('a::euclidean_space) set" |
33175 | 3153 |
assumes "closed s" "convex s" |
3154 |
shows "s = \<Inter> {h. s \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
3155 |
apply(rule set_eqI, rule) unfolding Inter_iff Ball_def mem_Collect_eq apply(rule,rule,erule conjE) proof- |
33175 | 3156 |
fix x assume "\<forall>xa. s \<subseteq> xa \<and> (\<exists>a b. xa = {x. inner a x \<le> b}) \<longrightarrow> x \<in> xa" |
3157 |
hence "\<forall>a b. s \<subseteq> {x. inner a x \<le> b} \<longrightarrow> x \<in> {x. inner a x \<le> b}" by blast |
|
3158 |
thus "x\<in>s" apply(rule_tac ccontr) apply(drule separating_hyperplane_closed_point[OF assms(2,1)]) |
|
3159 |
apply(erule exE)+ apply(erule_tac x="-a" in allE, erule_tac x="-b" in allE) by auto |
|
3160 |
qed auto |
|
3161 |
||
44467 | 3162 |
subsection {* Radon's theorem (from Lars Schewe) *} |
33175 | 3163 |
|
3164 |
lemma radon_ex_lemma: |
|
3165 |
assumes "finite c" "affine_dependent c" |
|
3166 |
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" |
|
3167 |
proof- from assms(2)[unfolded affine_dependent_explicit] guess s .. then guess u .. |
|
3168 |
thus ?thesis apply(rule_tac x="\<lambda>v. if v\<in>s then u v else 0" in exI) unfolding if_smult scaleR_zero_left |
|
3169 |
and setsum_restrict_set[OF assms(1), THEN sym] by(auto simp add: Int_absorb1) qed |
|
3170 |
||
3171 |
lemma radon_s_lemma: |
|
3172 |
assumes "finite s" "setsum f s = (0::real)" |
|
3173 |
shows "setsum f {x\<in>s. 0 < f x} = - setsum f {x\<in>s. f x < 0}" |
|
3174 |
proof- have *:"\<And>x. (if f x < 0 then f x else 0) + (if 0 < f x then f x else 0) = f x" by auto |
|
3175 |
show ?thesis unfolding real_add_eq_0_iff[THEN sym] and setsum_restrict_set''[OF assms(1)] and setsum_addf[THEN sym] and * |
|
3176 |
using assms(2) by assumption qed |
|
3177 |
||
3178 |
lemma radon_v_lemma: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3179 |
assumes "finite s" "setsum f s = 0" "\<forall>x. g x = (0::real) \<longrightarrow> f x = (0::'a::euclidean_space)" |
33175 | 3180 |
shows "(setsum f {x\<in>s. 0 < g x}) = - setsum f {x\<in>s. g x < 0}" |
3181 |
proof- |
|
3182 |
have *:"\<And>x. (if 0 < g x then f x else 0) + (if g x < 0 then f x else 0) = f x" using assms(3) by auto |
|
3183 |
show ?thesis unfolding eq_neg_iff_add_eq_0 and setsum_restrict_set''[OF assms(1)] and setsum_addf[THEN sym] and * |
|
3184 |
using assms(2) by assumption qed |
|
3185 |
||
3186 |
lemma radon_partition: |
|
3187 |
assumes "finite c" "affine_dependent c" |
|
3188 |
shows "\<exists>m p. m \<inter> p = {} \<and> m \<union> p = c \<and> (convex hull m) \<inter> (convex hull p) \<noteq> {}" proof- |
|
3189 |
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" using radon_ex_lemma[OF assms] by auto |
|
3190 |
have fin:"finite {x \<in> c. 0 < u x}" "finite {x \<in> c. 0 > u x}" using assms(1) by auto |
|
3191 |
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}" |
|
3192 |
have "setsum u {x \<in> c. 0 < u x} \<noteq> 0" proof(cases "u v \<ge> 0") |
|
3193 |
case False hence "u v < 0" by auto |
|
3194 |
thus ?thesis proof(cases "\<exists>w\<in>{x \<in> c. 0 < u x}. u w > 0") |
|
3195 |
case True thus ?thesis using setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] by auto |
|
3196 |
next |
|
3197 |
case False hence "setsum u c \<le> setsum (\<lambda>x. if x=v then u v else 0) c" apply(rule_tac setsum_mono) by auto |
|
3198 |
thus ?thesis unfolding setsum_delta[OF assms(1)] using uv(2) and `u v < 0` and uv(1) by auto qed |
|
3199 |
qed (insert setsum_nonneg_eq_0_iff[of _ u, OF fin(1)] uv(2-3), auto) |
|
3200 |
||
36778
739a9379e29b
avoid using real-specific versions of generic lemmas
huffman
parents:
36725
diff
changeset
|
3201 |
hence *:"setsum u {x\<in>c. u x > 0} > 0" unfolding less_le apply(rule_tac conjI, rule_tac setsum_nonneg) by auto |
33175 | 3202 |
moreover have "setsum u ({x \<in> c. 0 < u x} \<union> {x \<in> c. u x < 0}) = setsum u c" |
3203 |
"(\<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)" |
|
3204 |
using assms(1) apply(rule_tac[!] setsum_mono_zero_left) by auto |
|
3205 |
hence "setsum u {x \<in> c. 0 < u x} = - setsum u {x \<in> c. 0 > u x}" |
|
3206 |
"(\<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)" |
|
3207 |
unfolding eq_neg_iff_add_eq_0 using uv(1,4) by (auto simp add: setsum_Un_zero[OF fin, THEN sym]) |
|
3208 |
moreover have "\<forall>x\<in>{v \<in> c. u v < 0}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * - u x" |
|
3209 |
apply (rule) apply (rule mult_nonneg_nonneg) using * by auto |
|
3210 |
||
3211 |
ultimately have "z \<in> convex hull {v \<in> c. u v \<le> 0}" unfolding convex_hull_explicit mem_Collect_eq |
|
3212 |
apply(rule_tac x="{v \<in> c. u v < 0}" in exI, rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * - u y" in exI) |
|
3213 |
using assms(1) unfolding scaleR_scaleR[THEN sym] scaleR_right.setsum [symmetric] and z_def |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
3214 |
by(auto simp add: setsum_negf setsum_right_distrib[THEN sym]) |
33175 | 3215 |
moreover have "\<forall>x\<in>{v \<in> c. 0 < u v}. 0 \<le> inverse (setsum u {x \<in> c. 0 < u x}) * u x" |
3216 |
apply (rule) apply (rule mult_nonneg_nonneg) using * by auto |
|
3217 |
hence "z \<in> convex hull {v \<in> c. u v > 0}" unfolding convex_hull_explicit mem_Collect_eq |
|
3218 |
apply(rule_tac x="{v \<in> c. 0 < u v}" in exI, rule_tac x="\<lambda>y. inverse (setsum u {x\<in>c. u x > 0}) * u y" in exI) |
|
3219 |
using assms(1) unfolding scaleR_scaleR[THEN sym] scaleR_right.setsum [symmetric] and z_def using * |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
3220 |
by(auto simp add: setsum_negf setsum_right_distrib[THEN sym]) |
33175 | 3221 |
ultimately show ?thesis apply(rule_tac x="{v\<in>c. u v \<le> 0}" in exI, rule_tac x="{v\<in>c. u v > 0}" in exI) by auto |
3222 |
qed |
|
3223 |
||
3224 |
lemma radon: assumes "affine_dependent c" |
|
3225 |
obtains m p where "m\<subseteq>c" "p\<subseteq>c" "m \<inter> p = {}" "(convex hull m) \<inter> (convex hull p) \<noteq> {}" |
|
3226 |
proof- from assms[unfolded affine_dependent_explicit] guess s .. then guess u .. |
|
3227 |
hence *:"finite s" "affine_dependent s" and s:"s \<subseteq> c" unfolding affine_dependent_explicit by auto |
|
3228 |
from radon_partition[OF *] guess m .. then guess p .. |
|
3229 |
thus ?thesis apply(rule_tac that[of p m]) using s by auto qed |
|
3230 |
||
44467 | 3231 |
subsection {* Helly's theorem *} |
33175 | 3232 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3233 |
lemma helly_induct: fixes f::"('a::euclidean_space) set set" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3234 |
assumes "card f = n" "n \<ge> DIM('a) + 1" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3235 |
"\<forall>s\<in>f. convex s" "\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter> t \<noteq> {}" |
33175 | 3236 |
shows "\<Inter> f \<noteq> {}" |
33715 | 3237 |
using assms proof(induct n arbitrary: f) |
33175 | 3238 |
case (Suc n) |
33715 | 3239 |
have "finite f" using `card f = Suc n` by (auto intro: card_ge_0_finite) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3240 |
show "\<Inter> f \<noteq> {}" apply(cases "n = DIM('a)") apply(rule Suc(5)[rule_format]) |
33715 | 3241 |
unfolding `card f = Suc n` 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
|
3242 |
assume ng:"n \<noteq> DIM('a)" hence "\<exists>X. \<forall>s\<in>f. X s \<in> \<Inter>(f - {s})" apply(rule_tac bchoice) unfolding ex_in_conv |
33715 | 3243 |
apply(rule, rule Suc(1)[rule_format]) unfolding card_Diff_singleton_if[OF `finite f`] `card f = Suc n` |
3244 |
defer defer apply(rule Suc(4)[rule_format]) defer apply(rule Suc(5)[rule_format]) using Suc(3) `finite f` by auto |
|
33175 | 3245 |
then obtain X where X:"\<forall>s\<in>f. X s \<in> \<Inter>(f - {s})" by auto |
3246 |
show ?thesis proof(cases "inj_on X f") |
|
3247 |
case False then obtain s t where st:"s\<noteq>t" "s\<in>f" "t\<in>f" "X s = X t" unfolding inj_on_def by auto |
|
3248 |
hence *:"\<Inter> f = \<Inter> (f - {s}) \<inter> \<Inter> (f - {t})" by auto |
|
3249 |
show ?thesis unfolding * unfolding ex_in_conv[THEN sym] apply(rule_tac x="X s" in exI) |
|
3250 |
apply(rule, rule X[rule_format]) using X st by auto |
|
3251 |
next case True then obtain m p where mp:"m \<inter> p = {}" "m \<union> p = X ` f" "convex hull m \<inter> convex hull p \<noteq> {}" |
|
3252 |
using radon_partition[of "X ` f"] and affine_dependent_biggerset[of "X ` f"] |
|
33715 | 3253 |
unfolding card_image[OF True] and `card f = Suc n` using Suc(3) `finite f` and ng by auto |
33175 | 3254 |
have "m \<subseteq> X ` f" "p \<subseteq> X ` f" using mp(2) by auto |
3255 |
then obtain g h where gh:"m = X ` g" "p = X ` h" "g \<subseteq> f" "h \<subseteq> f" unfolding subset_image_iff by auto |
|
3256 |
hence "f \<union> (g \<union> h) = f" by auto |
|
3257 |
hence f:"f = g \<union> h" using inj_on_Un_image_eq_iff[of X f "g \<union> h"] and True |
|
3258 |
unfolding mp(2)[unfolded image_Un[THEN sym] gh] by auto |
|
3259 |
have *:"g \<inter> h = {}" using mp(1) unfolding gh using inj_on_image_Int[OF True gh(3,4)] by auto |
|
3260 |
have "convex hull (X ` h) \<subseteq> \<Inter> g" "convex hull (X ` g) \<subseteq> \<Inter> h" |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3261 |
apply(rule_tac [!] hull_minimal) using Suc gh(3-4) unfolding subset_eq |
33175 | 3262 |
apply(rule_tac [2] convex_Inter, rule_tac [4] convex_Inter) apply rule prefer 3 apply rule proof- |
3263 |
fix x assume "x\<in>X ` g" then guess y unfolding image_iff .. |
|
3264 |
thus "x\<in>\<Inter>h" using X[THEN bspec[where x=y]] using * f by auto next |
|
3265 |
fix x assume "x\<in>X ` h" then guess y unfolding image_iff .. |
|
3266 |
thus "x\<in>\<Inter>g" using X[THEN bspec[where x=y]] using * f by auto |
|
3267 |
qed(auto) |
|
3268 |
thus ?thesis unfolding f using mp(3)[unfolded gh] by blast qed |
|
37647 | 3269 |
qed(auto) qed(auto) |
33175 | 3270 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3271 |
lemma helly: fixes f::"('a::euclidean_space) set set" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3272 |
assumes "card f \<ge> DIM('a) + 1" "\<forall>s\<in>f. convex s" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3273 |
"\<forall>t\<subseteq>f. card t = DIM('a) + 1 \<longrightarrow> \<Inter> t \<noteq> {}" |
33175 | 3274 |
shows "\<Inter> f \<noteq>{}" |
33715 | 3275 |
apply(rule helly_induct) using assms by auto |
33175 | 3276 |
|
44467 | 3277 |
subsection {* Homeomorphism of all convex compact sets with nonempty interior *} |
33175 | 3278 |
|
3279 |
lemma compact_frontier_line_lemma: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3280 |
fixes s :: "('a::euclidean_space) set" |
33175 | 3281 |
assumes "compact s" "0 \<in> s" "x \<noteq> 0" |
3282 |
obtains u where "0 \<le> u" "(u *\<^sub>R x) \<in> frontier s" "\<forall>v>u. (v *\<^sub>R x) \<notin> s" |
|
3283 |
proof- |
|
3284 |
obtain b where b:"b>0" "\<forall>x\<in>s. norm x \<le> b" using compact_imp_bounded[OF assms(1), unfolded bounded_pos] by auto |
|
3285 |
let ?A = "{y. \<exists>u. 0 \<le> u \<and> u \<le> b / norm(x) \<and> (y = u *\<^sub>R x)}" |
|
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3286 |
have A:"?A = (\<lambda>u. u *\<^sub>R x) ` {0 .. b / norm x}" |
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3287 |
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
|
3288 |
have *:"\<And>x A B. x\<in>A \<Longrightarrow> x\<in>B \<Longrightarrow> A\<inter>B \<noteq> {}" by blast |
33175 | 3289 |
have "compact ?A" unfolding A apply(rule compact_continuous_image, rule continuous_at_imp_continuous_on) |
3290 |
apply(rule, rule continuous_vmul) |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3291 |
apply(rule continuous_at_id) by(rule compact_interval) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3292 |
moreover have "{y. \<exists>u\<ge>0. u \<le> b / norm x \<and> y = u *\<^sub>R x} \<inter> s \<noteq> {}" apply(rule *[OF _ assms(2)]) |
33175 | 3293 |
unfolding mem_Collect_eq using `b>0` assms(3) by(auto intro!: divide_nonneg_pos) |
3294 |
ultimately obtain u y where obt: "u\<ge>0" "u \<le> b / norm x" "y = u *\<^sub>R x" |
|
3295 |
"y\<in>?A" "y\<in>s" "\<forall>z\<in>?A \<inter> s. dist 0 z \<le> dist 0 y" using distance_attains_sup[OF compact_inter[OF _ assms(1), of ?A], of 0] by auto |
|
3296 |
||
3297 |
have "norm x > 0" using assms(3)[unfolded zero_less_norm_iff[THEN sym]] by auto |
|
3298 |
{ fix v assume as:"v > u" "v *\<^sub>R x \<in> s" |
|
3299 |
hence "v \<le> b / norm x" using b(2)[rule_format, OF as(2)] |
|
3300 |
using `u\<ge>0` unfolding pos_le_divide_eq[OF `norm x > 0`] by auto |
|
3301 |
hence "norm (v *\<^sub>R x) \<le> norm y" apply(rule_tac obt(6)[rule_format, unfolded dist_0_norm]) apply(rule IntI) defer |
|
3302 |
apply(rule as(2)) unfolding mem_Collect_eq apply(rule_tac x=v in exI) |
|
3303 |
using as(1) `u\<ge>0` by(auto simp add:field_simps) |
|
3304 |
hence False unfolding obt(3) using `u\<ge>0` `norm x > 0` `v>u` by(auto simp add:field_simps) |
|
3305 |
} note u_max = this |
|
3306 |
||
3307 |
have "u *\<^sub>R x \<in> frontier s" unfolding frontier_straddle apply(rule,rule,rule) apply(rule_tac x="u *\<^sub>R x" in bexI) unfolding obt(3)[THEN sym] |
|
3308 |
prefer 3 apply(rule_tac x="(u + (e / 2) / norm x) *\<^sub>R x" in exI) apply(rule, rule) proof- |
|
3309 |
fix e assume "0 < e" and as:"(u + e / 2 / norm x) *\<^sub>R x \<in> s" |
|
3310 |
hence "u + e / 2 / norm x > u" using`norm x > 0` by(auto simp del:zero_less_norm_iff intro!: divide_pos_pos) |
|
3311 |
thus False using u_max[OF _ as] by auto |
|
3312 |
qed(insert `y\<in>s`, auto simp add: dist_norm scaleR_left_distrib obt(3)) |
|
36071 | 3313 |
thus ?thesis by(metis that[of u] u_max obt(1)) |
3314 |
qed |
|
33175 | 3315 |
|
3316 |
lemma starlike_compact_projective: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3317 |
assumes "compact s" "cball (0::'a::euclidean_space) 1 \<subseteq> s " |
33175 | 3318 |
"\<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
|
3319 |
shows "s homeomorphic (cball (0::'a::euclidean_space) 1)" |
33175 | 3320 |
proof- |
3321 |
have fs:"frontier s \<subseteq> s" apply(rule frontier_subset_closed) using compact_imp_closed[OF assms(1)] by simp |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3322 |
def pi \<equiv> "\<lambda>x::'a. inverse (norm x) *\<^sub>R x" |
33175 | 3323 |
have "0 \<notin> frontier s" unfolding frontier_straddle apply(rule ccontr) unfolding not_not apply(erule_tac x=1 in allE) |
3324 |
using assms(2)[unfolded subset_eq Ball_def mem_cball] by auto |
|
3325 |
have injpi:"\<And>x y. pi x = pi y \<and> norm x = norm y \<longleftrightarrow> x = y" unfolding pi_def by auto |
|
3326 |
||
3327 |
have contpi:"continuous_on (UNIV - {0}) pi" apply(rule continuous_at_imp_continuous_on) |
|
3328 |
apply rule unfolding pi_def |
|
3329 |
apply (rule continuous_mul) |
|
3330 |
apply (rule continuous_at_inv[unfolded o_def]) |
|
3331 |
apply (rule continuous_at_norm) |
|
3332 |
apply simp |
|
3333 |
apply (rule continuous_at_id) |
|
3334 |
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
|
3335 |
def sphere \<equiv> "{x::'a. norm x = 1}" |
33175 | 3336 |
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" unfolding pi_def sphere_def by auto |
3337 |
||
3338 |
have "0\<in>s" using assms(2) and centre_in_cball[of 0 1] by auto |
|
3339 |
have front_smul:"\<forall>x\<in>frontier s. \<forall>u\<ge>0. u *\<^sub>R x \<in> s \<longleftrightarrow> u \<le> 1" proof(rule,rule,rule) |
|
3340 |
fix x u assume x:"x\<in>frontier s" and "(0::real)\<le>u" |
|
3341 |
hence "x\<noteq>0" using `0\<notin>frontier s` by auto |
|
3342 |
obtain v where v:"0 \<le> v" "v *\<^sub>R x \<in> frontier s" "\<forall>w>v. w *\<^sub>R x \<notin> s" |
|
3343 |
using compact_frontier_line_lemma[OF assms(1) `0\<in>s` `x\<noteq>0`] by auto |
|
3344 |
have "v=1" apply(rule ccontr) unfolding neq_iff apply(erule disjE) proof- |
|
3345 |
assume "v<1" thus False using v(3)[THEN spec[where x=1]] using x and fs by auto next |
|
3346 |
assume "v>1" thus False using assms(3)[THEN bspec[where x="v *\<^sub>R x"], THEN spec[where x="inverse v"]] |
|
3347 |
using v and x and fs unfolding inverse_less_1_iff by auto qed |
|
3348 |
show "u *\<^sub>R x \<in> s \<longleftrightarrow> u \<le> 1" apply rule using v(3)[unfolded `v=1`, THEN spec[where x=u]] proof- |
|
3349 |
assume "u\<le>1" thus "u *\<^sub>R x \<in> s" apply(cases "u=1") |
|
3350 |
using assms(3)[THEN bspec[where x=x], THEN spec[where x=u]] using `0\<le>u` and x and fs by auto qed auto qed |
|
3351 |
||
3352 |
have "\<exists>surf. homeomorphism (frontier s) sphere pi surf" |
|
3353 |
apply(rule homeomorphism_compact) apply(rule compact_frontier[OF assms(1)]) |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
3354 |
apply(rule continuous_on_subset[OF contpi]) defer apply(rule set_eqI,rule) |
33175 | 3355 |
unfolding inj_on_def prefer 3 apply(rule,rule,rule) |
3356 |
proof- fix x assume "x\<in>pi ` frontier s" then obtain y where "y\<in>frontier s" "x = pi y" by auto |
|
3357 |
thus "x \<in> sphere" using pi(1)[of y] and `0 \<notin> frontier s` by auto |
|
3358 |
next fix x assume "x\<in>sphere" hence "norm x = 1" "x\<noteq>0" unfolding sphere_def by auto |
|
3359 |
then obtain u where "0 \<le> u" "u *\<^sub>R x \<in> frontier s" "\<forall>v>u. v *\<^sub>R x \<notin> s" |
|
3360 |
using compact_frontier_line_lemma[OF assms(1) `0\<in>s`, of x] by auto |
|
3361 |
thus "x \<in> pi ` frontier s" unfolding image_iff le_less pi_def apply(rule_tac x="u *\<^sub>R x" in bexI) using `norm x = 1` `0\<notin>frontier s` by auto |
|
3362 |
next fix x y assume as:"x \<in> frontier s" "y \<in> frontier s" "pi x = pi y" |
|
3363 |
hence xys:"x\<in>s" "y\<in>s" using fs by auto |
|
3364 |
from as(1,2) have nor:"norm x \<noteq> 0" "norm y \<noteq> 0" using `0\<notin>frontier s` by auto |
|
3365 |
from nor have x:"x = norm x *\<^sub>R ((inverse (norm y)) *\<^sub>R y)" unfolding as(3)[unfolded pi_def, THEN sym] by auto |
|
3366 |
from nor have y:"y = norm y *\<^sub>R ((inverse (norm x)) *\<^sub>R x)" unfolding as(3)[unfolded pi_def] by auto |
|
3367 |
have "0 \<le> norm y * inverse (norm x)" "0 \<le> norm x * inverse (norm y)" |
|
3368 |
unfolding divide_inverse[THEN sym] apply(rule_tac[!] divide_nonneg_pos) using nor by auto |
|
3369 |
hence "norm x = norm y" apply(rule_tac ccontr) unfolding neq_iff |
|
3370 |
using x y and front_smul[THEN bspec, OF as(1), THEN spec[where x="norm y * (inverse (norm x))"]] |
|
3371 |
using front_smul[THEN bspec, OF as(2), THEN spec[where x="norm x * (inverse (norm y))"]] |
|
3372 |
using xys nor by(auto simp add:field_simps divide_le_eq_1 divide_inverse[THEN sym]) |
|
3373 |
thus "x = y" apply(subst injpi[THEN sym]) using as(3) by auto |
|
3374 |
qed(insert `0 \<notin> frontier s`, auto) |
|
3375 |
then obtain surf where surf:"\<forall>x\<in>frontier s. surf (pi x) = x" "pi ` frontier s = sphere" "continuous_on (frontier s) pi" |
|
3376 |
"\<forall>y\<in>sphere. pi (surf y) = y" "surf ` sphere = frontier s" "continuous_on sphere surf" unfolding homeomorphism_def by auto |
|
3377 |
||
3378 |
have cont_surfpi:"continuous_on (UNIV - {0}) (surf \<circ> pi)" apply(rule continuous_on_compose, rule contpi) |
|
3379 |
apply(rule continuous_on_subset[of sphere], rule surf(6)) using pi(1) by auto |
|
3380 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3381 |
{ fix x assume as:"x \<in> cball (0::'a) 1" |
33175 | 3382 |
have "norm x *\<^sub>R surf (pi x) \<in> s" proof(cases "x=0 \<or> norm x = 1") |
3383 |
case False hence "pi x \<in> sphere" "norm x < 1" using pi(1)[of x] as by(auto simp add: dist_norm) |
|
3384 |
thus ?thesis apply(rule_tac assms(3)[rule_format, THEN DiffD1]) |
|
3385 |
apply(rule_tac fs[unfolded subset_eq, rule_format]) |
|
3386 |
unfolding surf(5)[THEN sym] by auto |
|
3387 |
next case True thus ?thesis apply rule defer unfolding pi_def apply(rule fs[unfolded subset_eq, rule_format]) |
|
3388 |
unfolding surf(5)[unfolded sphere_def, THEN sym] using `0\<in>s` by auto qed } note hom = this |
|
3389 |
||
3390 |
{ fix x assume "x\<in>s" |
|
3391 |
hence "x \<in> (\<lambda>x. norm x *\<^sub>R surf (pi x)) ` cball 0 1" proof(cases "x=0") |
|
3392 |
case True show ?thesis unfolding image_iff True apply(rule_tac x=0 in bexI) by auto |
|
3393 |
next let ?a = "inverse (norm (surf (pi x)))" |
|
3394 |
case False hence invn:"inverse (norm x) \<noteq> 0" by auto |
|
3395 |
from False have pix:"pi x\<in>sphere" using pi(1) by auto |
|
3396 |
hence "pi (surf (pi x)) = pi x" apply(rule_tac surf(4)[rule_format]) by assumption |
|
3397 |
hence **:"norm x *\<^sub>R (?a *\<^sub>R surf (pi x)) = x" apply(rule_tac scaleR_left_imp_eq[OF invn]) unfolding pi_def using invn by auto |
|
3398 |
hence *:"?a * norm x > 0" and"?a > 0" "?a \<noteq> 0" using surf(5) `0\<notin>frontier s` apply - |
|
3399 |
apply(rule_tac mult_pos_pos) using False[unfolded zero_less_norm_iff[THEN sym]] by auto |
|
3400 |
have "norm (surf (pi x)) \<noteq> 0" using ** False by auto |
|
3401 |
hence "norm x = norm ((?a * norm x) *\<^sub>R surf (pi x))" |
|
3402 |
unfolding norm_scaleR abs_mult abs_norm_cancel abs_of_pos[OF `?a > 0`] by auto |
|
3403 |
moreover have "pi x = pi ((inverse (norm (surf (pi x))) * norm x) *\<^sub>R surf (pi x))" |
|
3404 |
unfolding pi(2)[OF *] surf(4)[rule_format, OF pix] .. |
|
3405 |
moreover have "surf (pi x) \<in> frontier s" using surf(5) pix by auto |
|
3406 |
hence "dist 0 (inverse (norm (surf (pi x))) *\<^sub>R x) \<le> 1" unfolding dist_norm |
|
3407 |
using ** and * using front_smul[THEN bspec[where x="surf (pi x)"], THEN spec[where x="norm x * ?a"]] |
|
3408 |
using False `x\<in>s` by(auto simp add:field_simps) |
|
3409 |
ultimately show ?thesis unfolding image_iff apply(rule_tac x="inverse (norm (surf(pi x))) *\<^sub>R x" in bexI) |
|
3410 |
apply(subst injpi[THEN sym]) unfolding abs_mult abs_norm_cancel abs_of_pos[OF `?a > 0`] |
|
3411 |
unfolding pi(2)[OF `?a > 0`] by auto |
|
3412 |
qed } note hom2 = this |
|
3413 |
||
3414 |
show ?thesis apply(subst homeomorphic_sym) apply(rule homeomorphic_compact[where f="\<lambda>x. norm x *\<^sub>R surf (pi x)"]) |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
3415 |
apply(rule compact_cball) defer apply(rule set_eqI, rule, erule imageE, drule hom) |
33175 | 3416 |
prefer 4 apply(rule continuous_at_imp_continuous_on, rule) apply(rule_tac [3] hom2) 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
|
3417 |
fix x::"'a" assume as:"x \<in> cball 0 1" |
33175 | 3418 |
thus "continuous (at x) (\<lambda>x. norm x *\<^sub>R surf (pi x))" proof(cases "x=0") |
3419 |
case False thus ?thesis apply(rule_tac continuous_mul, rule_tac continuous_at_norm) |
|
3420 |
using cont_surfpi unfolding continuous_on_eq_continuous_at[OF open_delete[OF open_UNIV]] o_def 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
|
3421 |
next obtain B where B:"\<forall>x\<in>s. norm x \<le> B" using compact_imp_bounded[OF assms(1)] unfolding bounded_iff by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3422 |
hence "B > 0" using assms(2) unfolding subset_eq apply(erule_tac x="basis 0" in ballE) defer |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3423 |
apply(erule_tac x="basis 0" in ballE) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3424 |
unfolding Ball_def mem_cball dist_norm using DIM_positive[where 'a='a] |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3425 |
by auto |
33175 | 3426 |
case True show ?thesis unfolding True continuous_at Lim_at apply(rule,rule) apply(rule_tac x="e / B" in exI) |
3427 |
apply(rule) apply(rule divide_pos_pos) prefer 3 apply(rule,rule,erule conjE) |
|
36586 | 3428 |
unfolding norm_zero scaleR_zero_left dist_norm diff_0_right norm_scaleR abs_norm_cancel 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
|
3429 |
fix e and x::"'a" assume as:"norm x < e / B" "0 < norm x" "0<e" |
33175 | 3430 |
hence "surf (pi x) \<in> frontier s" using pi(1)[of x] unfolding surf(5)[THEN sym] by auto |
3431 |
hence "norm (surf (pi x)) \<le> B" using B fs by auto |
|
3432 |
hence "norm x * norm (surf (pi x)) \<le> norm x * B" using as(2) by auto |
|
3433 |
also have "\<dots> < e / B * B" apply(rule mult_strict_right_mono) using as(1) `B>0` by auto |
|
3434 |
also have "\<dots> = e" using `B>0` by auto |
|
3435 |
finally show "norm x * norm (surf (pi x)) < e" by assumption |
|
3436 |
qed(insert `B>0`, auto) qed |
|
3437 |
next { fix x assume as:"surf (pi x) = 0" |
|
3438 |
have "x = 0" proof(rule ccontr) |
|
3439 |
assume "x\<noteq>0" hence "pi x \<in> sphere" using pi(1) by auto |
|
3440 |
hence "surf (pi x) \<in> frontier s" using surf(5) by auto |
|
3441 |
thus False using `0\<notin>frontier s` unfolding as by simp qed |
|
3442 |
} note surf_0 = this |
|
3443 |
show "inj_on (\<lambda>x. norm x *\<^sub>R surf (pi x)) (cball 0 1)" unfolding inj_on_def proof(rule,rule,rule) |
|
3444 |
fix x y 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)" |
|
3445 |
thus "x=y" proof(cases "x=0 \<or> y=0") |
|
3446 |
case True thus ?thesis using as by(auto elim: surf_0) next |
|
3447 |
case False |
|
3448 |
hence "pi (surf (pi x)) = pi (surf (pi y))" using as(3) |
|
3449 |
using pi(2)[of "norm x" "surf (pi x)"] pi(2)[of "norm y" "surf (pi y)"] by auto |
|
3450 |
moreover have "pi x \<in> sphere" "pi y \<in> sphere" using pi(1) False by auto |
|
3451 |
ultimately have *:"pi x = pi y" using surf(4)[THEN bspec[where x="pi x"]] surf(4)[THEN bspec[where x="pi y"]] by auto |
|
3452 |
moreover have "norm x = norm y" using as(3)[unfolded *] using False by(auto dest:surf_0) |
|
3453 |
ultimately show ?thesis using injpi by auto qed qed |
|
3454 |
qed auto qed |
|
3455 |
||
44519 | 3456 |
lemma homeomorphic_convex_compact_lemma: |
3457 |
fixes s :: "('a::euclidean_space) set" |
|
3458 |
assumes "convex s" and "compact s" 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
|
3459 |
shows "s homeomorphic (cball (0::'a) 1)" |
44519 | 3460 |
proof (rule starlike_compact_projective[OF assms(2-3)], clarify) |
3461 |
fix x u assume "x \<in> s" and "0 \<le> u" and "u < (1::real)" |
|
3462 |
have "open (ball (u *\<^sub>R x) (1 - u))" by (rule open_ball) |
|
3463 |
moreover have "u *\<^sub>R x \<in> ball (u *\<^sub>R x) (1 - u)" |
|
3464 |
unfolding centre_in_ball using `u < 1` by simp |
|
3465 |
moreover have "ball (u *\<^sub>R x) (1 - u) \<subseteq> s" |
|
3466 |
proof |
|
3467 |
fix y assume "y \<in> ball (u *\<^sub>R x) (1 - u)" |
|
3468 |
hence "dist (u *\<^sub>R x) y < 1 - u" unfolding mem_ball . |
|
3469 |
with `u < 1` have "inverse (1 - u) *\<^sub>R (y - u *\<^sub>R x) \<in> cball 0 1" |
|
3470 |
by (simp add: dist_norm inverse_eq_divide norm_minus_commute) |
|
3471 |
with assms(3) have "inverse (1 - u) *\<^sub>R (y - u *\<^sub>R x) \<in> s" .. |
|
3472 |
with assms(1) have "(1 - u) *\<^sub>R ((y - u *\<^sub>R x) /\<^sub>R (1 - u)) + u *\<^sub>R x \<in> s" |
|
3473 |
using `x \<in> s` `0 \<le> u` `u < 1` [THEN less_imp_le] by (rule mem_convex) |
|
3474 |
thus "y \<in> s" using `u < 1` by simp |
|
3475 |
qed |
|
3476 |
ultimately have "u *\<^sub>R x \<in> interior s" .. |
|
33175 | 3477 |
thus "u *\<^sub>R x \<in> s - frontier s" using frontier_def and interior_subset by auto qed |
3478 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3479 |
lemma homeomorphic_convex_compact_cball: fixes e::real and s::"('a::euclidean_space) set" |
33175 | 3480 |
assumes "convex s" "compact s" "interior s \<noteq> {}" "0 < e" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3481 |
shows "s homeomorphic (cball (b::'a) e)" |
33175 | 3482 |
proof- obtain a where "a\<in>interior s" using assms(3) by auto |
3483 |
then obtain d where "d>0" and d:"cball a d \<subseteq> s" 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
|
3484 |
let ?d = "inverse d" and ?n = "0::'a" |
33175 | 3485 |
have "cball ?n 1 \<subseteq> (\<lambda>x. inverse d *\<^sub>R (x - a)) ` s" |
3486 |
apply(rule, rule_tac x="d *\<^sub>R x + a" in image_eqI) defer |
|
3487 |
apply(rule d[unfolded subset_eq, rule_format]) using `d>0` unfolding mem_cball dist_norm |
|
3488 |
by(auto simp add: mult_right_le_one_le) |
|
3489 |
hence "(\<lambda>x. inverse d *\<^sub>R (x - a)) ` s homeomorphic cball ?n 1" |
|
3490 |
using homeomorphic_convex_compact_lemma[of "(\<lambda>x. ?d *\<^sub>R -a + ?d *\<^sub>R x) ` s", OF convex_affinity compact_affinity] |
|
3491 |
using assms(1,2) by(auto simp add: uminus_add_conv_diff scaleR_right_diff_distrib) |
|
3492 |
thus ?thesis apply(rule_tac homeomorphic_trans[OF _ homeomorphic_balls(2)[of 1 _ ?n]]) |
|
3493 |
apply(rule homeomorphic_trans[OF homeomorphic_affinity[of "?d" s "?d *\<^sub>R -a"]]) |
|
3494 |
using `d>0` `e>0` by(auto simp add: uminus_add_conv_diff scaleR_right_diff_distrib) qed |
|
3495 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3496 |
lemma homeomorphic_convex_compact: fixes s::"('a::euclidean_space) set" and t::"('a) set" |
33175 | 3497 |
assumes "convex s" "compact s" "interior s \<noteq> {}" |
3498 |
"convex t" "compact t" "interior t \<noteq> {}" |
|
3499 |
shows "s homeomorphic t" |
|
3500 |
using assms by(meson zero_less_one homeomorphic_trans homeomorphic_convex_compact_cball homeomorphic_sym) |
|
3501 |
||
44467 | 3502 |
subsection {* Epigraphs of convex functions *} |
33175 | 3503 |
|
36338 | 3504 |
definition "epigraph s (f::_ \<Rightarrow> real) = {xy. fst xy \<in> s \<and> f (fst xy) \<le> snd xy}" |
3505 |
||
3506 |
lemma mem_epigraph: "(x, y) \<in> epigraph s f \<longleftrightarrow> x \<in> s \<and> f x \<le> y" unfolding epigraph_def by auto |
|
33175 | 3507 |
|
34964 | 3508 |
(** This might break sooner or later. In fact it did already once. **) |
33175 | 3509 |
lemma convex_epigraph: |
3510 |
"convex(epigraph s f) \<longleftrightarrow> convex_on s f \<and> convex s" |
|
36338 | 3511 |
unfolding convex_def convex_on_def |
3512 |
unfolding Ball_def split_paired_All epigraph_def |
|
3513 |
unfolding mem_Collect_eq fst_conv snd_conv fst_add snd_add fst_scaleR snd_scaleR Ball_def[symmetric] |
|
34964 | 3514 |
apply safe defer apply(erule_tac x=x in allE,erule_tac x="f x" in allE) apply safe |
3515 |
apply(erule_tac x=xa in allE,erule_tac x="f xa" in allE) prefer 3 |
|
36338 | 3516 |
apply(rule_tac y="u * f a + v * f aa" in order_trans) defer by(auto intro!:mult_left_mono add_mono) |
33175 | 3517 |
|
36071 | 3518 |
lemma convex_epigraphI: |
3519 |
"convex_on s f \<Longrightarrow> convex s \<Longrightarrow> convex(epigraph s f)" |
|
3520 |
unfolding convex_epigraph by auto |
|
3521 |
||
3522 |
lemma convex_epigraph_convex: |
|
3523 |
"convex s \<Longrightarrow> convex_on s f \<longleftrightarrow> convex(epigraph s f)" |
|
3524 |
by(simp add: convex_epigraph) |
|
33175 | 3525 |
|
44467 | 3526 |
subsubsection {* Use this to derive general bound property of convex function *} |
33175 | 3527 |
|
3528 |
lemma convex_on: |
|
3529 |
assumes "convex s" |
|
3530 |
shows "convex_on s f \<longleftrightarrow> (\<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> |
|
3531 |
f (setsum (\<lambda>i. u i *\<^sub>R x i) {1..k} ) \<le> setsum (\<lambda>i. u i * f(x i)) {1..k} ) " |
|
3532 |
unfolding convex_epigraph_convex[OF assms] convex epigraph_def Ball_def mem_Collect_eq |
|
36338 | 3533 |
unfolding fst_setsum snd_setsum fst_scaleR snd_scaleR |
3534 |
apply safe |
|
3535 |
apply (drule_tac x=k in spec) |
|
3536 |
apply (drule_tac x=u in spec) |
|
3537 |
apply (drule_tac x="\<lambda>i. (x i, f (x i))" in spec) |
|
3538 |
apply simp |
|
3539 |
using assms[unfolded convex] apply simp |
|
36778
739a9379e29b
avoid using real-specific versions of generic lemmas
huffman
parents:
36725
diff
changeset
|
3540 |
apply(rule_tac y="\<Sum>i = 1..k. u i * f (fst (x i))" in order_trans) |
36338 | 3541 |
defer apply(rule setsum_mono) apply(erule_tac x=i in allE) unfolding real_scaleR_def |
34964 | 3542 |
apply(rule mult_left_mono)using assms[unfolded convex] by auto |
33175 | 3543 |
|
36338 | 3544 |
|
44467 | 3545 |
subsection {* Convexity of general and special intervals *} |
33175 | 3546 |
|
37732
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3547 |
lemma convexI: (* TODO: move to Library/Convex.thy *) |
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3548 |
assumes "\<And>x y u v. \<lbrakk>x \<in> s; y \<in> s; 0 \<le> u; 0 \<le> v; u + v = 1\<rbrakk> \<Longrightarrow> u *\<^sub>R x + v *\<^sub>R y \<in> s" |
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3549 |
shows "convex s" |
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3550 |
using assms unfolding convex_def by fast |
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3551 |
|
33175 | 3552 |
lemma is_interval_convex: |
37732
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3553 |
fixes s :: "('a::euclidean_space) set" |
33175 | 3554 |
assumes "is_interval s" shows "convex s" |
37732
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3555 |
proof (rule convexI) |
33175 | 3556 |
fix x y u v assume as:"x \<in> s" "y \<in> s" "0 \<le> u" "0 \<le> v" "u + v = (1::real)" |
3557 |
hence *:"u = 1 - v" "1 - v \<ge> 0" and **:"v = 1 - u" "1 - u \<ge> 0" by auto |
|
3558 |
{ fix a b assume "\<not> b \<le> u * a + v * b" |
|
3559 |
hence "u * a < (1 - v) * b" unfolding not_le using as(4) by(auto simp add: field_simps) |
|
3560 |
hence "a < b" unfolding * using as(4) *(2) apply(rule_tac mult_left_less_imp_less[of "1 - v"]) by(auto simp add: field_simps) |
|
3561 |
hence "a \<le> u * a + v * b" unfolding * using as(4) by (auto simp add: field_simps intro!:mult_right_mono) |
|
3562 |
} moreover |
|
3563 |
{ fix a b assume "\<not> u * a + v * b \<le> a" |
|
3564 |
hence "v * b > (1 - u) * a" unfolding not_le using as(4) by(auto simp add: field_simps) |
|
36350 | 3565 |
hence "a < b" unfolding * using as(4) apply(rule_tac mult_left_less_imp_less) by(auto simp add: field_simps) |
33175 | 3566 |
hence "u * a + v * b \<le> b" unfolding ** using **(2) as(3) by(auto simp add: field_simps intro!:mult_right_mono) } |
3567 |
ultimately show "u *\<^sub>R x + v *\<^sub>R y \<in> s" apply- apply(rule assms[unfolded is_interval_def, rule_format, OF as(1,2)]) |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3568 |
using as(3-) DIM_positive[where 'a='a] by auto qed |
33175 | 3569 |
|
3570 |
lemma is_interval_connected: |
|
37732
6432bf0d7191
generalize type of is_interval to class euclidean_space
huffman
parents:
37673
diff
changeset
|
3571 |
fixes s :: "('a::euclidean_space) set" |
33175 | 3572 |
shows "is_interval s \<Longrightarrow> connected s" |
3573 |
using is_interval_convex convex_connected by auto |
|
3574 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3575 |
lemma convex_interval: "convex {a .. b}" "convex {a<..<b::'a::ordered_euclidean_space}" |
33175 | 3576 |
apply(rule_tac[!] is_interval_convex) using is_interval_interval by auto |
3577 |
||
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3578 |
(* FIXME: rewrite these lemmas without using vec1 |
33175 | 3579 |
subsection {* On @{text "real^1"}, @{text "is_interval"}, @{text "convex"} and @{text "connected"} are all equivalent. *} |
3580 |
||
3581 |
lemma is_interval_1: |
|
3582 |
"is_interval s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. \<forall> x. dest_vec1 a \<le> dest_vec1 x \<and> dest_vec1 x \<le> dest_vec1 b \<longrightarrow> x \<in> s)" |
|
34964 | 3583 |
unfolding is_interval_def forall_1 by auto |
33175 | 3584 |
|
3585 |
lemma is_interval_connected_1: "is_interval s \<longleftrightarrow> connected (s::(real^1) set)" |
|
3586 |
apply(rule, rule is_interval_connected, assumption) unfolding is_interval_1 |
|
3587 |
apply(rule,rule,rule,rule,erule conjE,rule ccontr) proof- |
|
3588 |
fix a b x assume as:"connected s" "a \<in> s" "b \<in> s" "dest_vec1 a \<le> dest_vec1 x" "dest_vec1 x \<le> dest_vec1 b" "x\<notin>s" |
|
3589 |
hence *:"dest_vec1 a < dest_vec1 x" "dest_vec1 x < dest_vec1 b" apply(rule_tac [!] ccontr) unfolding not_less by auto |
|
3590 |
let ?halfl = "{z. inner (basis 1) z < dest_vec1 x} " and ?halfr = "{z. inner (basis 1) z > dest_vec1 x} " |
|
3591 |
{ fix y assume "y \<in> s" have "y \<in> ?halfr \<union> ?halfl" apply(rule ccontr) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3592 |
using as(6) `y\<in>s` by (auto simp add: inner_vector_def) } |
34964 | 3593 |
moreover have "a\<in>?halfl" "b\<in>?halfr" using * by (auto simp add: inner_vector_def) |
33175 | 3594 |
hence "?halfl \<inter> s \<noteq> {}" "?halfr \<inter> s \<noteq> {}" using as(2-3) by auto |
3595 |
ultimately show False apply(rule_tac notE[OF as(1)[unfolded connected_def]]) |
|
3596 |
apply(rule_tac x="?halfl" in exI, rule_tac x="?halfr" in exI) |
|
36071 | 3597 |
apply(rule, rule open_halfspace_lt, rule, rule open_halfspace_gt) |
3598 |
by(auto simp add: field_simps) qed |
|
33175 | 3599 |
|
3600 |
lemma is_interval_convex_1: |
|
3601 |
"is_interval s \<longleftrightarrow> convex (s::(real^1) set)" |
|
36071 | 3602 |
by(metis is_interval_convex convex_connected is_interval_connected_1) |
33175 | 3603 |
|
3604 |
lemma convex_connected_1: |
|
3605 |
"connected s \<longleftrightarrow> convex (s::(real^1) set)" |
|
36071 | 3606 |
by(metis is_interval_convex convex_connected is_interval_connected_1) |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3607 |
*) |
44467 | 3608 |
subsection {* Another intermediate value theorem formulation *} |
33175 | 3609 |
|
37673
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
huffman
parents:
37647
diff
changeset
|
3610 |
lemma ivt_increasing_component_on_1: fixes f::"real \<Rightarrow> 'a::euclidean_space" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3611 |
assumes "a \<le> b" "continuous_on {a .. b} f" "(f a)$$k \<le> y" "y \<le> (f b)$$k" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3612 |
shows "\<exists>x\<in>{a..b}. (f x)$$k = y" |
33175 | 3613 |
proof- have "f a \<in> f ` {a..b}" "f b \<in> f ` {a..b}" apply(rule_tac[!] imageI) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3614 |
using assms(1) by auto |
33175 | 3615 |
thus ?thesis using connected_ivt_component[of "f ` {a..b}" "f a" "f b" k y] |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3616 |
using connected_continuous_image[OF assms(2) convex_connected[OF convex_real_interval(5)]] |
33175 | 3617 |
using assms by(auto intro!: imageI) qed |
3618 |
||
37673
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
huffman
parents:
37647
diff
changeset
|
3619 |
lemma ivt_increasing_component_1: fixes f::"real \<Rightarrow> 'a::euclidean_space" |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3620 |
shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3621 |
\<Longrightarrow> f a$$k \<le> y \<Longrightarrow> y \<le> f b$$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$$k = y" |
36071 | 3622 |
by(rule ivt_increasing_component_on_1) |
3623 |
(auto simp add: continuous_at_imp_continuous_on) |
|
33175 | 3624 |
|
37673
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
huffman
parents:
37647
diff
changeset
|
3625 |
lemma ivt_decreasing_component_on_1: fixes f::"real \<Rightarrow> 'a::euclidean_space" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3626 |
assumes "a \<le> b" "continuous_on {a .. b} f" "(f b)$$k \<le> y" "y \<le> (f a)$$k" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3627 |
shows "\<exists>x\<in>{a..b}. (f x)$$k = y" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3628 |
apply(subst neg_equal_iff_equal[THEN sym]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3629 |
using ivt_increasing_component_on_1[of a b "\<lambda>x. - f x" k "- y"] using assms using continuous_on_neg |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3630 |
by auto |
33175 | 3631 |
|
37673
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
huffman
parents:
37647
diff
changeset
|
3632 |
lemma ivt_decreasing_component_1: fixes f::"real \<Rightarrow> 'a::euclidean_space" |
36431
340755027840
move definitions and theorems for type real^1 to separate theory file
huffman
parents:
36365
diff
changeset
|
3633 |
shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a .. b}. continuous (at x) f |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3634 |
\<Longrightarrow> f b$$k \<le> y \<Longrightarrow> y \<le> f a$$k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)$$k = y" |
36071 | 3635 |
by(rule ivt_decreasing_component_on_1) |
3636 |
(auto simp: continuous_at_imp_continuous_on) |
|
33175 | 3637 |
|
44467 | 3638 |
subsection {* A bound within a convex hull, and so an interval *} |
33175 | 3639 |
|
3640 |
lemma convex_on_convex_hull_bound: |
|
3641 |
assumes "convex_on (convex hull s) f" "\<forall>x\<in>s. f x \<le> b" |
|
3642 |
shows "\<forall>x\<in> convex hull s. f x \<le> b" proof |
|
3643 |
fix x assume "x\<in>convex hull s" |
|
3644 |
then obtain k u v where 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" |
|
3645 |
unfolding convex_hull_indexed mem_Collect_eq by auto |
|
3646 |
have "(\<Sum>i = 1..k. u i * f (v i)) \<le> b" using setsum_mono[of "{1..k}" "\<lambda>i. u i * f (v i)" "\<lambda>i. u i * b"] |
|
3647 |
unfolding setsum_left_distrib[THEN sym] obt(2) mult_1 apply(drule_tac meta_mp) apply(rule mult_left_mono) |
|
3648 |
using assms(2) obt(1) by auto |
|
3649 |
thus "f x \<le> b" using assms(1)[unfolded convex_on[OF convex_convex_hull], rule_format, of k u v] |
|
3650 |
unfolding obt(2-3) using obt(1) and hull_subset[unfolded subset_eq, rule_format, of _ s] by auto qed |
|
3651 |
||
3652 |
lemma unit_interval_convex_hull: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3653 |
"{0::'a::ordered_euclidean_space .. (\<chi>\<chi> i. 1)} = convex hull {x. \<forall>i<DIM('a). (x$$i = 0) \<or> (x$$i = 1)}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3654 |
(is "?int = convex hull ?points") |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3655 |
proof- have 01:"{0,(\<chi>\<chi> i. 1)} \<subseteq> convex hull ?points" apply rule apply(rule_tac hull_subset[unfolded subset_eq, rule_format]) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3656 |
{ fix n x assume "x\<in>{0::'a::ordered_euclidean_space .. \<chi>\<chi> i. 1}" "n \<le> DIM('a)" "card {i. i<DIM('a) \<and> x$$i \<noteq> 0} \<le> n" |
33175 | 3657 |
hence "x\<in>convex hull ?points" proof(induct n arbitrary: x) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3658 |
case 0 hence "x = 0" apply(subst euclidean_eq) apply rule by auto |
33175 | 3659 |
thus "x\<in>convex hull ?points" using 01 by auto |
3660 |
next |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3661 |
case (Suc n) show "x\<in>convex hull ?points" proof(cases "{i. i<DIM('a) \<and> x$$i \<noteq> 0} = {}") |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3662 |
case True hence "x = 0" apply(subst euclidean_eq) by auto |
33175 | 3663 |
thus "x\<in>convex hull ?points" using 01 by auto |
3664 |
next |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3665 |
case False def xi \<equiv> "Min ((\<lambda>i. x$$i) ` {i. i<DIM('a) \<and> x$$i \<noteq> 0})" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3666 |
have "xi \<in> (\<lambda>i. x$$i) ` {i. i<DIM('a) \<and> x$$i \<noteq> 0}" unfolding xi_def apply(rule Min_in) using False by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3667 |
then obtain i where i':"x$$i = xi" "x$$i \<noteq> 0" "i<DIM('a)" by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3668 |
have i:"\<And>j. j<DIM('a) \<Longrightarrow> x$$j > 0 \<Longrightarrow> x$$i \<le> x$$j" |
33175 | 3669 |
unfolding i'(1) xi_def apply(rule_tac Min_le) unfolding image_iff |
3670 |
defer apply(rule_tac x=j in bexI) using i' 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
|
3671 |
have i01:"x$$i \<le> 1" "x$$i > 0" using Suc(2)[unfolded mem_interval,rule_format,of i] |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3672 |
using i'(2-) `x$$i \<noteq> 0` by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3673 |
show ?thesis proof(cases "x$$i=1") |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3674 |
case True have "\<forall>j\<in>{i. i<DIM('a) \<and> x$$i \<noteq> 0}. x$$j = 1" apply(rule, rule ccontr) unfolding mem_Collect_eq |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3675 |
proof(erule conjE) fix j assume as:"x $$ j \<noteq> 0" "x $$ j \<noteq> 1" "j<DIM('a)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3676 |
hence j:"x$$j \<in> {0<..<1}" using Suc(2) by(auto simp add: eucl_le[where 'a='a] elim!:allE[where x=j]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3677 |
hence "x$$j \<in> op $$ x ` {i. i<DIM('a) \<and> x $$ i \<noteq> 0}" using as(3) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3678 |
hence "x$$j \<ge> x$$i" unfolding i'(1) xi_def apply(rule_tac Min_le) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3679 |
thus False using True Suc(2) j by(auto simp add: elim!:ballE[where x=j]) qed |
33175 | 3680 |
thus "x\<in>convex hull ?points" apply(rule_tac hull_subset[unfolded subset_eq, rule_format]) |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3681 |
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
|
3682 |
next let ?y = "\<lambda>j. if x$$j = 0 then 0 else (x$$j - x$$i) / (1 - x$$i)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3683 |
case False hence *:"x = x$$i *\<^sub>R (\<chi>\<chi> j. if x$$j = 0 then 0 else 1) + (1 - x$$i) *\<^sub>R (\<chi>\<chi> j. ?y j)" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3684 |
apply(subst euclidean_eq) by(auto simp add: field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3685 |
{ fix j assume j:"j<DIM('a)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3686 |
have "x$$j \<noteq> 0 \<Longrightarrow> 0 \<le> (x $$ j - x $$ i) / (1 - x $$ i)" "(x $$ j - x $$ i) / (1 - x $$ i) \<le> 1" |
33175 | 3687 |
apply(rule_tac divide_nonneg_pos) using i(1)[of j] using False i01 |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3688 |
using Suc(2)[unfolded mem_interval, rule_format, of j] using j |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3689 |
by(auto simp add:field_simps) |
33175 | 3690 |
hence "0 \<le> ?y j \<and> ?y j \<le> 1" 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
|
3691 |
moreover have "i\<in>{j. j<DIM('a) \<and> x$$j \<noteq> 0} - {j. j<DIM('a) \<and> ((\<chi>\<chi> j. ?y j)::'a) $$ j \<noteq> 0}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3692 |
using i01 using i'(3) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3693 |
hence "{j. j<DIM('a) \<and> x$$j \<noteq> 0} \<noteq> {j. j<DIM('a) \<and> ((\<chi>\<chi> j. ?y j)::'a) $$ j \<noteq> 0}" using i'(3) by blast |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3694 |
hence **:"{j. j<DIM('a) \<and> ((\<chi>\<chi> j. ?y j)::'a) $$ j \<noteq> 0} \<subset> {j. j<DIM('a) \<and> x$$j \<noteq> 0}" apply - apply rule |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3695 |
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
|
3696 |
have "card {j. j<DIM('a) \<and> ((\<chi>\<chi> j. ?y j)::'a) $$ j \<noteq> 0} \<le> n" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3697 |
using less_le_trans[OF psubset_card_mono[OF _ **] Suc(4)] by auto |
33175 | 3698 |
ultimately show ?thesis apply(subst *) apply(rule convex_convex_hull[unfolded convex_def, rule_format]) |
3699 |
apply(rule_tac hull_subset[unfolded subset_eq, rule_format]) defer apply(rule Suc(1)) |
|
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3700 |
unfolding mem_interval using i01 Suc(3) by auto |
33175 | 3701 |
qed qed qed } note * = this |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3702 |
have **:"DIM('a) = card {..<DIM('a)}" by auto |
33175 | 3703 |
show ?thesis apply rule defer apply(rule hull_minimal) unfolding subset_eq prefer 3 apply rule |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3704 |
apply(rule_tac n2="DIM('a)" in *) prefer 3 apply(subst(2) **) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3705 |
apply(rule card_mono) using 01 and convex_interval(1) prefer 5 apply - apply rule |
33175 | 3706 |
unfolding mem_interval apply rule unfolding mem_Collect_eq apply(erule_tac x=i in allE) |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3707 |
by auto qed |
33175 | 3708 |
|
44467 | 3709 |
text {* And this is a finite set of vertices. *} |
33175 | 3710 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3711 |
lemma unit_cube_convex_hull: obtains s where "finite s" "{0 .. (\<chi>\<chi> i. 1)::'a::ordered_euclidean_space} = convex hull s" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3712 |
apply(rule that[of "{x::'a. \<forall>i<DIM('a). x$$i=0 \<or> x$$i=1}"]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3713 |
apply(rule finite_subset[of _ "(\<lambda>s. (\<chi>\<chi> i. if i\<in>s then 1::real else 0)::'a) ` Pow {..<DIM('a)}"]) |
33175 | 3714 |
prefer 3 apply(rule unit_interval_convex_hull) apply rule unfolding mem_Collect_eq 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
|
3715 |
fix x::"'a" assume as:"\<forall>i<DIM('a). x $$ i = 0 \<or> x $$ i = 1" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3716 |
show "x \<in> (\<lambda>s. \<chi>\<chi> i. if i \<in> s then 1 else 0) ` Pow {..<DIM('a)}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3717 |
apply(rule image_eqI[where x="{i. i<DIM('a) \<and> x$$i = 1}"]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3718 |
using as apply(subst euclidean_eq) by auto qed auto |
33175 | 3719 |
|
44467 | 3720 |
text {* Hence any cube (could do any nonempty interval). *} |
33175 | 3721 |
|
3722 |
lemma cube_convex_hull: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3723 |
assumes "0 < d" obtains s::"('a::ordered_euclidean_space) set" where |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3724 |
"finite s" "{x - (\<chi>\<chi> i. d) .. x + (\<chi>\<chi> i. d)} = convex hull s" proof- |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3725 |
let ?d = "(\<chi>\<chi> i. d)::'a" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
3726 |
have *:"{x - ?d .. x + ?d} = (\<lambda>y. x - ?d + (2 * d) *\<^sub>R y) ` {0 .. \<chi>\<chi> i. 1}" apply(rule set_eqI, rule) |
33175 | 3727 |
unfolding image_iff defer apply(erule bexE) proof- |
3728 |
fix y assume as:"y\<in>{x - ?d .. x + ?d}" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3729 |
{ fix i assume i:"i<DIM('a)" have "x $$ i \<le> d + y $$ i" "y $$ i \<le> d + x $$ i" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3730 |
using as[unfolded mem_interval, THEN spec[where x=i]] i |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3731 |
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
|
3732 |
hence "1 \<ge> inverse d * (x $$ i - y $$ i)" "1 \<ge> inverse d * (y $$ i - x $$ i)" |
33175 | 3733 |
apply(rule_tac[!] mult_left_le_imp_le[OF _ assms]) unfolding mult_assoc[THEN sym] |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3734 |
using assms by(auto simp add: field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3735 |
hence "inverse d * (x $$ i * 2) \<le> 2 + inverse d * (y $$ i * 2)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3736 |
"inverse d * (y $$ i * 2) \<le> 2 + inverse d * (x $$ i * 2)" by(auto simp add:field_simps) } |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3737 |
hence "inverse (2 * d) *\<^sub>R (y - (x - ?d)) \<in> {0..\<chi>\<chi> i.1}" unfolding mem_interval using assms |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3738 |
by(auto simp add: field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3739 |
thus "\<exists>z\<in>{0..\<chi>\<chi> i.1}. y = x - ?d + (2 * d) *\<^sub>R z" apply- apply(rule_tac x="inverse (2 * d) *\<^sub>R (y - (x - ?d))" in bexI) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3740 |
using assms by auto |
33175 | 3741 |
next |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3742 |
fix y z assume as:"z\<in>{0..\<chi>\<chi> i.1}" "y = x - ?d + (2*d) *\<^sub>R z" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3743 |
have "\<And>i. i<DIM('a) \<Longrightarrow> 0 \<le> d * z $$ i \<and> d * z $$ i \<le> d" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3744 |
using assms as(1)[unfolded mem_interval] apply(erule_tac x=i in allE) |
33175 | 3745 |
apply rule apply(rule mult_nonneg_nonneg) prefer 3 apply(rule mult_right_le_one_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
|
3746 |
using assms by auto |
33175 | 3747 |
thus "y \<in> {x - ?d..x + ?d}" unfolding as(2) mem_interval apply- apply rule using as(1)[unfolded mem_interval] |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3748 |
apply(erule_tac x=i in allE) using assms by auto qed |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3749 |
obtain s where "finite s" "{0::'a..\<chi>\<chi> i.1} = convex hull s" using unit_cube_convex_hull by auto |
33175 | 3750 |
thus ?thesis apply(rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` s"]) unfolding * and convex_hull_affinity by auto qed |
3751 |
||
44467 | 3752 |
subsection {* Bounded convex function on open set is continuous *} |
33175 | 3753 |
|
3754 |
lemma convex_on_bounded_continuous: |
|
36338 | 3755 |
fixes s :: "('a::real_normed_vector) set" |
33175 | 3756 |
assumes "open s" "convex_on s f" "\<forall>x\<in>s. abs(f x) \<le> b" |
3757 |
shows "continuous_on s f" |
|
3758 |
apply(rule continuous_at_imp_continuous_on) unfolding continuous_at_real_range proof(rule,rule,rule) |
|
3759 |
fix x e assume "x\<in>s" "(0::real) < e" |
|
3760 |
def B \<equiv> "abs b + 1" |
|
3761 |
have B:"0 < B" "\<And>x. x\<in>s \<Longrightarrow> abs (f x) \<le> B" |
|
3762 |
unfolding B_def defer apply(drule assms(3)[rule_format]) by auto |
|
3763 |
obtain k where "k>0"and k:"cball x k \<subseteq> s" using assms(1)[unfolded open_contains_cball, THEN bspec[where x=x]] using `x\<in>s` by auto |
|
3764 |
show "\<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e" |
|
3765 |
apply(rule_tac x="min (k / 2) (e / (2 * B) * k)" in exI) apply rule defer proof(rule,rule) |
|
3766 |
fix y assume as:"norm (y - x) < min (k / 2) (e / (2 * B) * k)" |
|
3767 |
show "\<bar>f y - f x\<bar> < e" proof(cases "y=x") |
|
3768 |
case False def t \<equiv> "k / norm (y - x)" |
|
3769 |
have "2 < t" "0<t" unfolding t_def using as False and `k>0` by(auto simp add:field_simps) |
|
3770 |
have "y\<in>s" apply(rule k[unfolded subset_eq,rule_format]) unfolding mem_cball dist_norm |
|
3771 |
apply(rule order_trans[of _ "2 * norm (x - y)"]) using as by(auto simp add: field_simps norm_minus_commute) |
|
3772 |
{ def w \<equiv> "x + t *\<^sub>R (y - x)" |
|
3773 |
have "w\<in>s" unfolding w_def apply(rule k[unfolded subset_eq,rule_format]) unfolding mem_cball dist_norm |
|
3774 |
unfolding t_def using `k>0` by auto |
|
3775 |
have "(1 / t) *\<^sub>R x + - x + ((t - 1) / t) *\<^sub>R x = (1 / t - 1 + (t - 1) / t) *\<^sub>R x" by (auto simp add: algebra_simps) |
|
3776 |
also have "\<dots> = 0" using `t>0` by(auto simp add:field_simps) |
|
3777 |
finally have w:"(1 / t) *\<^sub>R w + ((t - 1) / t) *\<^sub>R x = y" unfolding w_def using False and `t>0` by (auto simp add: algebra_simps) |
|
3778 |
have "2 * B < e * t" unfolding t_def using `0<e` `0<k` `B>0` and as and False by (auto simp add:field_simps) |
|
3779 |
hence "(f w - f x) / t < e" |
|
3780 |
using B(2)[OF `w\<in>s`] and B(2)[OF `x\<in>s`] using `t>0` by(auto simp add:field_simps) |
|
3781 |
hence th1:"f y - f x < e" apply- apply(rule le_less_trans) defer apply assumption |
|
3782 |
using assms(2)[unfolded convex_on_def,rule_format,of w x "1/t" "(t - 1)/t", unfolded w] |
|
3783 |
using `0<t` `2<t` and `x\<in>s` `w\<in>s` by(auto simp add:field_simps) } |
|
3784 |
moreover |
|
3785 |
{ def w \<equiv> "x - t *\<^sub>R (y - x)" |
|
3786 |
have "w\<in>s" unfolding w_def apply(rule k[unfolded subset_eq,rule_format]) unfolding mem_cball dist_norm |
|
3787 |
unfolding t_def using `k>0` by auto |
|
3788 |
have "(1 / (1 + t)) *\<^sub>R x + (t / (1 + t)) *\<^sub>R x = (1 / (1 + t) + t / (1 + t)) *\<^sub>R x" by (auto simp add: algebra_simps) |
|
3789 |
also have "\<dots>=x" using `t>0` by (auto simp add:field_simps) |
|
3790 |
finally have w:"(1 / (1+t)) *\<^sub>R w + (t / (1 + t)) *\<^sub>R y = x" unfolding w_def using False and `t>0` by (auto simp add: algebra_simps) |
|
3791 |
have "2 * B < e * t" unfolding t_def using `0<e` `0<k` `B>0` and as and False by (auto simp add:field_simps) |
|
3792 |
hence *:"(f w - f y) / t < e" using B(2)[OF `w\<in>s`] and B(2)[OF `y\<in>s`] using `t>0` by(auto simp add:field_simps) |
|
3793 |
have "f x \<le> 1 / (1 + t) * f w + (t / (1 + t)) * f y" |
|
3794 |
using assms(2)[unfolded convex_on_def,rule_format,of w y "1/(1+t)" "t / (1+t)",unfolded w] |
|
3795 |
using `0<t` `2<t` and `y\<in>s` `w\<in>s` by (auto simp add:field_simps) |
|
36778
739a9379e29b
avoid using real-specific versions of generic lemmas
huffman
parents:
36725
diff
changeset
|
3796 |
also have "\<dots> = (f w + t * f y) / (1 + t)" using `t>0` unfolding divide_inverse by (auto simp add:field_simps) |
33175 | 3797 |
also have "\<dots> < e + f y" using `t>0` * `e>0` by(auto simp add:field_simps) |
3798 |
finally have "f x - f y < e" by auto } |
|
3799 |
ultimately show ?thesis by auto |
|
3800 |
qed(insert `0<e`, auto) |
|
3801 |
qed(insert `0<e` `0<k` `0<B`, auto simp add:field_simps intro!:mult_pos_pos) qed |
|
3802 |
||
44467 | 3803 |
subsection {* Upper bound on a ball implies upper and lower bounds *} |
33175 | 3804 |
|
3805 |
lemma convex_bounds_lemma: |
|
36338 | 3806 |
fixes x :: "'a::real_normed_vector" |
33175 | 3807 |
assumes "convex_on (cball x e) f" "\<forall>y \<in> cball x e. f y \<le> b" |
3808 |
shows "\<forall>y \<in> cball x e. abs(f y) \<le> b + 2 * abs(f x)" |
|
3809 |
apply(rule) proof(cases "0 \<le> e") case True |
|
3810 |
fix y assume y:"y\<in>cball x e" def z \<equiv> "2 *\<^sub>R x - y" |
|
36338 | 3811 |
have *:"x - (2 *\<^sub>R x - y) = y - x" by (simp add: scaleR_2) |
33175 | 3812 |
have z:"z\<in>cball x e" using y unfolding z_def mem_cball dist_norm * by(auto simp add: norm_minus_commute) |
3813 |
have "(1 / 2) *\<^sub>R y + (1 / 2) *\<^sub>R z = x" unfolding z_def by (auto simp add: algebra_simps) |
|
3814 |
thus "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" using assms(1)[unfolded convex_on_def,rule_format, OF y z, of "1/2" "1/2"] |
|
3815 |
using assms(2)[rule_format,OF y] assms(2)[rule_format,OF z] by(auto simp add:field_simps) |
|
3816 |
next case False fix y assume "y\<in>cball x e" |
|
3817 |
hence "dist x y < 0" using False unfolding mem_cball not_le by (auto simp del: dist_not_less_zero) |
|
3818 |
thus "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" using zero_le_dist[of x y] by auto qed |
|
3819 |
||
44467 | 3820 |
subsubsection {* Hence a convex function on an open set is continuous *} |
33175 | 3821 |
|
3822 |
lemma convex_on_continuous: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3823 |
assumes "open (s::('a::ordered_euclidean_space) set)" "convex_on s f" |
37673
f69f4b079275
generalize more lemmas from ordered_euclidean_space to euclidean_space
huffman
parents:
37647
diff
changeset
|
3824 |
(* FIXME: generalize to euclidean_space *) |
33175 | 3825 |
shows "continuous_on s f" |
3826 |
unfolding continuous_on_eq_continuous_at[OF assms(1)] 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
|
3827 |
note dimge1 = DIM_positive[where 'a='a] |
33175 | 3828 |
fix x assume "x\<in>s" |
3829 |
then obtain e where e:"cball x e \<subseteq> s" "e>0" 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
|
3830 |
def d \<equiv> "e / real DIM('a)" |
33175 | 3831 |
have "0 < d" unfolding d_def using `e>0` dimge1 by(rule_tac divide_pos_pos, 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
|
3832 |
let ?d = "(\<chi>\<chi> i. d)::'a" |
33175 | 3833 |
obtain c where c:"finite c" "{x - ?d..x + ?d} = convex hull c" using cube_convex_hull[OF `d>0`, of x] by auto |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3834 |
have "x\<in>{x - ?d..x + ?d}" using `d>0` unfolding mem_interval by auto |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3835 |
hence "c\<noteq>{}" using c by auto |
33175 | 3836 |
def k \<equiv> "Max (f ` c)" |
3837 |
have "convex_on {x - ?d..x + ?d} f" apply(rule convex_on_subset[OF assms(2)]) |
|
3838 |
apply(rule subset_trans[OF _ e(1)]) unfolding subset_eq mem_cball proof |
|
3839 |
fix z assume z:"z\<in>{x - ?d..x + ?d}" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3840 |
have e:"e = setsum (\<lambda>i. d) {..<DIM('a)}" unfolding setsum_constant d_def using dimge1 |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3841 |
unfolding real_eq_of_nat by auto |
33175 | 3842 |
show "dist x z \<le> e" unfolding dist_norm e apply(rule_tac order_trans[OF norm_le_l1], rule setsum_mono) |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3843 |
using z[unfolded mem_interval] apply(erule_tac x=i in allE) by auto qed |
33175 | 3844 |
hence k:"\<forall>y\<in>{x - ?d..x + ?d}. f y \<le> k" unfolding c(2) apply(rule_tac convex_on_convex_hull_bound) apply assumption |
3845 |
unfolding k_def apply(rule, rule Max_ge) using c(1) by auto |
|
37647 | 3846 |
have "d \<le> e" unfolding d_def apply(rule mult_imp_div_pos_le) using `e>0` dimge1 unfolding mult_le_cancel_left1 by auto |
33175 | 3847 |
hence dsube:"cball x d \<subseteq> cball x e" unfolding subset_eq Ball_def mem_cball by auto |
3848 |
have conv:"convex_on (cball x d) f" apply(rule convex_on_subset, rule convex_on_subset[OF assms(2)]) apply(rule e(1)) using dsube by auto |
|
3849 |
hence "\<forall>y\<in>cball x d. abs (f y) \<le> k + 2 * abs (f x)" apply(rule_tac convex_bounds_lemma) apply assumption proof |
|
3850 |
fix y assume y:"y\<in>cball x d" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3851 |
{ fix i assume "i<DIM('a)" hence "x $$ i - d \<le> y $$ i" "y $$ i \<le> x $$ i + d" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3852 |
using order_trans[OF component_le_norm y[unfolded mem_cball dist_norm], of i] by auto } |
33175 | 3853 |
thus "f y \<le> k" apply(rule_tac k[rule_format]) unfolding mem_cball mem_interval dist_norm |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3854 |
by auto qed |
33175 | 3855 |
hence "continuous_on (ball x d) f" apply(rule_tac convex_on_bounded_continuous) |
33270 | 3856 |
apply(rule open_ball, rule convex_on_subset[OF conv], rule ball_subset_cball) |
3857 |
apply force |
|
3858 |
done |
|
3859 |
thus "continuous (at x) f" unfolding continuous_on_eq_continuous_at[OF open_ball] |
|
3860 |
using `d>0` by auto |
|
3861 |
qed |
|
3862 |
||
44467 | 3863 |
subsection {* Line segments, Starlike Sets, etc. *} |
33270 | 3864 |
|
3865 |
(* Use the same overloading tricks as for intervals, so that |
|
3866 |
segment[a,b] is closed and segment(a,b) is open relative to affine hull. *) |
|
33175 | 3867 |
|
3868 |
definition |
|
36338 | 3869 |
midpoint :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a" where |
33175 | 3870 |
"midpoint a b = (inverse (2::real)) *\<^sub>R (a + b)" |
3871 |
||
3872 |
definition |
|
36341 | 3873 |
open_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" where |
33175 | 3874 |
"open_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 < u \<and> u < 1}" |
3875 |
||
3876 |
definition |
|
36341 | 3877 |
closed_segment :: "'a::real_vector \<Rightarrow> 'a \<Rightarrow> 'a set" where |
33175 | 3878 |
"closed_segment a b = {(1 - u) *\<^sub>R a + u *\<^sub>R b | u::real. 0 \<le> u \<and> u \<le> 1}" |
3879 |
||
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3880 |
definition "between = (\<lambda> (a,b) x. x \<in> closed_segment a b)" |
33175 | 3881 |
|
3882 |
lemmas segment = open_segment_def closed_segment_def |
|
3883 |
||
3884 |
definition "starlike s \<longleftrightarrow> (\<exists>a\<in>s. \<forall>x\<in>s. closed_segment a x \<subseteq> s)" |
|
3885 |
||
3886 |
lemma midpoint_refl: "midpoint x x = x" |
|
3887 |
unfolding midpoint_def unfolding scaleR_right_distrib unfolding scaleR_left_distrib[THEN sym] by auto |
|
3888 |
||
3889 |
lemma midpoint_sym: "midpoint a b = midpoint b a" unfolding midpoint_def by (auto simp add: scaleR_right_distrib) |
|
3890 |
||
36338 | 3891 |
lemma midpoint_eq_iff: "midpoint a b = c \<longleftrightarrow> a + b = c + c" |
3892 |
proof - |
|
3893 |
have "midpoint a b = c \<longleftrightarrow> scaleR 2 (midpoint a b) = scaleR 2 c" |
|
3894 |
by simp |
|
3895 |
thus ?thesis |
|
3896 |
unfolding midpoint_def scaleR_2 [symmetric] by simp |
|
3897 |
qed |
|
3898 |
||
33175 | 3899 |
lemma dist_midpoint: |
36338 | 3900 |
fixes a b :: "'a::real_normed_vector" shows |
33175 | 3901 |
"dist a (midpoint a b) = (dist a b) / 2" (is ?t1) |
3902 |
"dist b (midpoint a b) = (dist a b) / 2" (is ?t2) |
|
3903 |
"dist (midpoint a b) a = (dist a b) / 2" (is ?t3) |
|
3904 |
"dist (midpoint a b) b = (dist a b) / 2" (is ?t4) |
|
3905 |
proof- |
|
36338 | 3906 |
have *: "\<And>x y::'a. 2 *\<^sub>R x = - y \<Longrightarrow> norm x = (norm y) / 2" unfolding equation_minus_iff by auto |
3907 |
have **:"\<And>x y::'a. 2 *\<^sub>R x = y \<Longrightarrow> norm x = (norm y) / 2" by auto |
|
33175 | 3908 |
note scaleR_right_distrib [simp] |
36338 | 3909 |
show ?t1 unfolding midpoint_def dist_norm apply (rule **) |
3910 |
by (simp add: scaleR_right_diff_distrib, simp add: scaleR_2) |
|
3911 |
show ?t2 unfolding midpoint_def dist_norm apply (rule *) |
|
3912 |
by (simp add: scaleR_right_diff_distrib, simp add: scaleR_2) |
|
3913 |
show ?t3 unfolding midpoint_def dist_norm apply (rule *) |
|
3914 |
by (simp add: scaleR_right_diff_distrib, simp add: scaleR_2) |
|
3915 |
show ?t4 unfolding midpoint_def dist_norm apply (rule **) |
|
3916 |
by (simp add: scaleR_right_diff_distrib, simp add: scaleR_2) |
|
3917 |
qed |
|
33175 | 3918 |
|
3919 |
lemma midpoint_eq_endpoint: |
|
36338 | 3920 |
"midpoint a b = a \<longleftrightarrow> a = b" |
33175 | 3921 |
"midpoint a b = b \<longleftrightarrow> a = b" |
36338 | 3922 |
unfolding midpoint_eq_iff by auto |
33175 | 3923 |
|
3924 |
lemma convex_contains_segment: |
|
3925 |
"convex s \<longleftrightarrow> (\<forall>a\<in>s. \<forall>b\<in>s. closed_segment a b \<subseteq> s)" |
|
3926 |
unfolding convex_alt closed_segment_def by auto |
|
3927 |
||
3928 |
lemma convex_imp_starlike: |
|
3929 |
"convex s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> starlike s" |
|
3930 |
unfolding convex_contains_segment starlike_def by auto |
|
3931 |
||
3932 |
lemma segment_convex_hull: |
|
3933 |
"closed_segment a b = convex hull {a,b}" proof- |
|
3934 |
have *:"\<And>x. {x} \<noteq> {}" by auto |
|
3935 |
have **:"\<And>u v. u + v = 1 \<longleftrightarrow> u = 1 - (v::real)" by auto |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
3936 |
show ?thesis unfolding segment convex_hull_insert[OF *] convex_hull_singleton apply(rule set_eqI) |
33175 | 3937 |
unfolding mem_Collect_eq apply(rule,erule exE) |
3938 |
apply(rule_tac x="1 - u" in exI) apply rule defer apply(rule_tac x=u in exI) defer |
|
3939 |
apply(erule exE, (erule conjE)?)+ apply(rule_tac x="1 - u" in exI) unfolding ** by auto qed |
|
3940 |
||
3941 |
lemma convex_segment: "convex (closed_segment a b)" |
|
3942 |
unfolding segment_convex_hull by(rule convex_convex_hull) |
|
3943 |
||
3944 |
lemma ends_in_segment: "a \<in> closed_segment a b" "b \<in> closed_segment a b" |
|
3945 |
unfolding segment_convex_hull apply(rule_tac[!] hull_subset[unfolded subset_eq, rule_format]) by auto |
|
3946 |
||
3947 |
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
|
3948 |
fixes a b x y :: "'a::euclidean_space" |
33175 | 3949 |
assumes "x \<in> closed_segment a b" shows "norm(y - x) \<le> norm(y - a) \<or> norm(y - x) \<le> norm(y - b)" proof- |
3950 |
obtain z where "z\<in>{a, b}" "norm (x - y) \<le> norm (z - y)" using simplex_furthest_le[of "{a, b}" y] |
|
3951 |
using assms[unfolded segment_convex_hull] by auto |
|
3952 |
thus ?thesis by(auto simp add:norm_minus_commute) qed |
|
3953 |
||
3954 |
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
|
3955 |
fixes x a b :: "'a::euclidean_space" |
33175 | 3956 |
assumes "x \<in> closed_segment a b" |
3957 |
shows "norm(x - a) \<le> norm(b - a)" "norm(x - b) \<le> norm(b - a)" |
|
3958 |
using segment_furthest_le[OF assms, of a] |
|
3959 |
using segment_furthest_le[OF assms, of b] |
|
3960 |
by (auto simp add:norm_minus_commute) |
|
3961 |
||
3962 |
lemma segment_refl:"closed_segment a a = {a}" unfolding segment by (auto simp add: algebra_simps) |
|
3963 |
||
3964 |
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
|
3965 |
unfolding between_def by auto |
33175 | 3966 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3967 |
lemma between:"between (a,b) (x::'a::euclidean_space) \<longleftrightarrow> dist a b = (dist a x) + (dist x b)" |
33175 | 3968 |
proof(cases "a = b") |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3969 |
case True thus ?thesis unfolding between_def split_conv |
33175 | 3970 |
by(auto simp add:segment_refl dist_commute) next |
3971 |
case False hence Fal:"norm (a - b) \<noteq> 0" and Fal2: "norm (a - b) > 0" by auto |
|
3972 |
have *:"\<And>u. a - ((1 - u) *\<^sub>R a + u *\<^sub>R b) = u *\<^sub>R (a - b)" by (auto simp add: algebra_simps) |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
3973 |
show ?thesis unfolding between_def split_conv closed_segment_def mem_Collect_eq |
33175 | 3974 |
apply rule apply(erule exE, (erule conjE)+) apply(subst dist_triangle_eq) proof- |
3975 |
fix u assume as:"x = (1 - u) *\<^sub>R a + u *\<^sub>R b" "0 \<le> u" "u \<le> 1" |
|
3976 |
hence *:"a - x = u *\<^sub>R (a - b)" "x - b = (1 - u) *\<^sub>R (a - b)" |
|
3977 |
unfolding as(1) by(auto simp add:algebra_simps) |
|
3978 |
show "norm (a - x) *\<^sub>R (x - b) = norm (x - b) *\<^sub>R (a - x)" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3979 |
unfolding norm_minus_commute[of x a] * using as(2,3) |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
3980 |
by(auto simp add: field_simps) |
33175 | 3981 |
next assume as:"dist a b = dist a x + dist x b" |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3982 |
have "norm (a - x) / norm (a - b) \<le> 1" unfolding divide_le_eq_1_pos[OF Fal2] |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3983 |
unfolding as[unfolded dist_norm] norm_ge_zero by auto |
33175 | 3984 |
thus "\<exists>u. x = (1 - u) *\<^sub>R a + u *\<^sub>R b \<and> 0 \<le> u \<and> u \<le> 1" apply(rule_tac x="dist a x / dist a b" in exI) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3985 |
unfolding dist_norm apply(subst euclidean_eq) apply rule defer apply(rule, rule divide_nonneg_pos) prefer 4 |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3986 |
proof(rule,rule) fix i assume i:"i<DIM('a)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3987 |
have "((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) $$ i = |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3988 |
((norm (a - b) - norm (a - x)) * (a $$ i) + norm (a - x) * (b $$ i)) / norm (a - b)" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3989 |
using Fal by(auto simp add: field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3990 |
also have "\<dots> = x$$i" apply(rule divide_eq_imp[OF Fal]) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3991 |
unfolding as[unfolded dist_norm] using as[unfolded dist_triangle_eq] apply- |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
3992 |
apply(subst (asm) euclidean_eq) using i apply(erule_tac x=i in allE) by(auto simp add:field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3993 |
finally show "x $$ i = ((1 - norm (a - x) / norm (a - b)) *\<^sub>R a + (norm (a - x) / norm (a - b)) *\<^sub>R b) $$ i" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3994 |
by auto |
33175 | 3995 |
qed(insert Fal2, auto) qed qed |
3996 |
||
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
3997 |
lemma between_midpoint: fixes a::"'a::euclidean_space" shows |
33175 | 3998 |
"between (a,b) (midpoint a b)" (is ?t1) |
3999 |
"between (b,a) (midpoint a b)" (is ?t2) |
|
4000 |
proof- 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" by auto |
|
4001 |
show ?t1 ?t2 unfolding between midpoint_def dist_norm apply(rule_tac[!] *) |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4002 |
unfolding euclidean_eq[where 'a='a] |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4003 |
by(auto simp add:field_simps) qed |
33175 | 4004 |
|
4005 |
lemma between_mem_convex_hull: |
|
4006 |
"between (a,b) x \<longleftrightarrow> x \<in> convex hull {a,b}" |
|
4007 |
unfolding between_mem_segment segment_convex_hull .. |
|
4008 |
||
44467 | 4009 |
subsection {* Shrinking towards the interior of a convex set *} |
33175 | 4010 |
|
4011 |
lemma mem_interior_convex_shrink: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4012 |
fixes s :: "('a::euclidean_space) set" |
33175 | 4013 |
assumes "convex s" "c \<in> interior s" "x \<in> s" "0 < e" "e \<le> 1" |
4014 |
shows "x - e *\<^sub>R (x - c) \<in> interior s" |
|
4015 |
proof- obtain d where "d>0" and d:"ball c d \<subseteq> s" using assms(2) unfolding mem_interior by auto |
|
4016 |
show ?thesis unfolding mem_interior apply(rule_tac x="e*d" in exI) |
|
4017 |
apply(rule) defer unfolding subset_eq Ball_def mem_ball proof(rule,rule) |
|
4018 |
fix y assume as:"dist (x - e *\<^sub>R (x - c)) y < e * d" |
|
4019 |
have *:"y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x" using `e>0` by (auto simp add: scaleR_left_diff_distrib scaleR_right_diff_distrib) |
|
4020 |
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)" |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4021 |
unfolding dist_norm unfolding norm_scaleR[THEN sym] apply(rule arg_cong[where f=norm]) using `e>0` |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4022 |
by(auto simp add: euclidean_eq[where 'a='a] field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4023 |
also have "\<dots> = abs(1/e) * norm (x - e *\<^sub>R (x - c) - y)" by(auto intro!:arg_cong[where f=norm] simp add: algebra_simps) |
33175 | 4024 |
also have "\<dots> < d" using as[unfolded dist_norm] and `e>0` |
36778
739a9379e29b
avoid using real-specific versions of generic lemmas
huffman
parents:
36725
diff
changeset
|
4025 |
by(auto simp add:pos_divide_less_eq[OF `e>0`] mult_commute) |
33175 | 4026 |
finally show "y \<in> s" apply(subst *) apply(rule assms(1)[unfolded convex_alt,rule_format]) |
4027 |
apply(rule d[unfolded subset_eq,rule_format]) unfolding mem_ball using assms(3-5) by auto |
|
4028 |
qed(rule mult_pos_pos, insert `e>0` `d>0`, auto) qed |
|
4029 |
||
4030 |
lemma mem_interior_closure_convex_shrink: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4031 |
fixes s :: "('a::euclidean_space) set" |
33175 | 4032 |
assumes "convex s" "c \<in> interior s" "x \<in> closure s" "0 < e" "e \<le> 1" |
4033 |
shows "x - e *\<^sub>R (x - c) \<in> interior s" |
|
4034 |
proof- obtain d where "d>0" and d:"ball c d \<subseteq> s" using assms(2) unfolding mem_interior by auto |
|
4035 |
have "\<exists>y\<in>s. norm (y - x) * (1 - e) < e * d" proof(cases "x\<in>s") |
|
4036 |
case True thus ?thesis using `e>0` `d>0` by(rule_tac bexI[where x=x], auto intro!: mult_pos_pos) next |
|
4037 |
case False hence x:"x islimpt s" using assms(3)[unfolded closure_def] by auto |
|
4038 |
show ?thesis proof(cases "e=1") |
|
4039 |
case True obtain y where "y\<in>s" "y \<noteq> x" "dist y x < 1" |
|
4040 |
using x[unfolded islimpt_approachable,THEN spec[where x=1]] by auto |
|
4041 |
thus ?thesis apply(rule_tac x=y in bexI) unfolding True using `d>0` by auto next |
|
4042 |
case False hence "0 < e * d / (1 - e)" and *:"1 - e > 0" |
|
4043 |
using `e\<le>1` `e>0` `d>0` by(auto intro!:mult_pos_pos divide_pos_pos) |
|
4044 |
then obtain y where "y\<in>s" "y \<noteq> x" "dist y x < e * d / (1 - e)" |
|
4045 |
using x[unfolded islimpt_approachable,THEN spec[where x="e*d / (1 - e)"]] by auto |
|
4046 |
thus ?thesis apply(rule_tac x=y in bexI) unfolding dist_norm using pos_less_divide_eq[OF *] by auto qed qed |
|
4047 |
then obtain y where "y\<in>s" and y:"norm (y - x) * (1 - e) < e * d" by auto |
|
4048 |
def z \<equiv> "c + ((1 - e) / e) *\<^sub>R (x - y)" |
|
4049 |
have *:"x - e *\<^sub>R (x - c) = y - e *\<^sub>R (y - z)" unfolding z_def using `e>0` by (auto simp add: scaleR_right_diff_distrib scaleR_right_distrib scaleR_left_diff_distrib) |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4050 |
have "z\<in>interior s" apply(rule interior_mono[OF d,unfolded subset_eq,rule_format]) |
33175 | 4051 |
unfolding interior_open[OF open_ball] mem_ball z_def dist_norm using y and assms(4,5) |
4052 |
by(auto simp add:field_simps norm_minus_commute) |
|
4053 |
thus ?thesis unfolding * apply - apply(rule mem_interior_convex_shrink) |
|
4054 |
using assms(1,4-5) `y\<in>s` by auto qed |
|
4055 |
||
44467 | 4056 |
subsection {* Some obvious but surprisingly hard simplex lemmas *} |
33175 | 4057 |
|
4058 |
lemma simplex: |
|
4059 |
assumes "finite s" "0 \<notin> s" |
|
4060 |
shows "convex hull (insert 0 s) = { 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)}" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
4061 |
unfolding convex_hull_finite[OF finite.insertI[OF assms(1)]] apply(rule set_eqI, rule) unfolding mem_Collect_eq |
33175 | 4062 |
apply(erule_tac[!] exE) apply(erule_tac[!] conjE)+ unfolding setsum_clauses(2)[OF assms(1)] |
4063 |
apply(rule_tac x=u in exI) defer apply(rule_tac x="\<lambda>x. if x = 0 then 1 - setsum u s else u x" in exI) using assms(2) |
|
4064 |
unfolding if_smult and setsum_delta_notmem[OF assms(2)] by auto |
|
4065 |
||
40377 | 4066 |
lemma substd_simplex: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
4067 |
shows "convex hull (insert 0 { basis i | i. i : d}) = |
|
4068 |
{x::'a::euclidean_space . (!i<DIM('a). 0 <= x$$i) & setsum (%i. x$$i) d <= 1 & |
|
4069 |
(!i<DIM('a). i ~: d --> x$$i = 0)}" |
|
4070 |
(is "convex hull (insert 0 ?p) = ?s") |
|
4071 |
(* Proof is a modified copy of the proof of similar lemma std_simplex in Convex_Euclidean_Space.thy *) |
|
4072 |
proof- let ?D = d (*"{..<DIM('a::euclidean_space)}"*) |
|
4073 |
have "0 ~: ?p" using assms by (auto simp: image_def) |
|
4074 |
have "{(basis i)::'n::euclidean_space |i. i \<in> ?D} = basis ` ?D" by auto |
|
4075 |
note sumbas = this setsum_reindex[OF basis_inj_on[of d], unfolded o_def, OF assms] |
|
4076 |
show ?thesis unfolding simplex[OF finite_substdbasis `0 ~: ?p`] |
|
4077 |
apply(rule set_eqI) unfolding mem_Collect_eq apply rule |
|
4078 |
apply(erule exE, (erule conjE)+) apply(erule_tac[2] conjE)+ proof- |
|
4079 |
fix x::"'a::euclidean_space" and u assume as: "\<forall>x\<in>{basis i |i. i \<in>?D}. 0 \<le> u x" |
|
4080 |
"setsum u {basis i |i. i \<in> ?D} \<le> 1" "(\<Sum>x\<in>{basis i |i. i \<in>?D}. u x *\<^sub>R x) = x" |
|
4081 |
have *:"\<forall>i<DIM('a). i:d --> u (basis i) = x$$i" and "(!i<DIM('a). i ~: d --> x $$ i = 0)" using as(3) |
|
4082 |
unfolding sumbas unfolding substdbasis_expansion_unique[OF assms] by auto |
|
4083 |
hence **:"setsum u {basis i |i. i \<in> ?D} = setsum (op $$ x) ?D" unfolding sumbas |
|
4084 |
apply-apply(rule setsum_cong2) using assms by auto |
|
4085 |
have " (\<forall>i<DIM('a). 0 \<le> x$$i) \<and> setsum (op $$ x) ?D \<le> 1" |
|
4086 |
apply - proof(rule,rule,rule) |
|
4087 |
fix i assume i:"i<DIM('a)" have "i : d ==> 0 \<le> x$$i" unfolding *[rule_format,OF i,THEN sym] |
|
4088 |
apply(rule_tac as(1)[rule_format]) by auto |
|
4089 |
moreover have "i ~: d ==> 0 \<le> x$$i" |
|
4090 |
using `(!i<DIM('a). i ~: d --> x $$ i = 0)`[rule_format, OF i] by auto |
|
4091 |
ultimately show "0 \<le> x$$i" by auto |
|
4092 |
qed(insert as(2)[unfolded **], auto) |
|
4093 |
from this show " (\<forall>i<DIM('a). 0 \<le> x$$i) \<and> setsum (op $$ x) ?D \<le> 1 & (!i<DIM('a). i ~: d --> x $$ i = 0)" |
|
4094 |
using `(!i<DIM('a). i ~: d --> x $$ i = 0)` by auto |
|
4095 |
next fix x::"'a::euclidean_space" assume as:"\<forall>i<DIM('a). 0 \<le> x $$ i" "setsum (op $$ x) ?D \<le> 1" |
|
4096 |
"(!i<DIM('a). i ~: d --> x $$ i = 0)" |
|
4097 |
show "\<exists>u. (\<forall>x\<in>{basis i |i. i \<in> ?D}. 0 \<le> u x) \<and> |
|
4098 |
setsum u {basis i |i. i \<in> ?D} \<le> 1 \<and> (\<Sum>x\<in>{basis i |i. i \<in> ?D}. u x *\<^sub>R x) = x" |
|
4099 |
apply(rule_tac x="\<lambda>y. inner y x" in exI) apply(rule,rule) unfolding mem_Collect_eq apply(erule exE) |
|
4100 |
using as(1) apply(erule_tac x=i in allE) unfolding sumbas apply safe unfolding not_less basis_zero |
|
4101 |
unfolding substdbasis_expansion_unique[OF assms] euclidean_component_def[THEN sym] |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4102 |
using as(2,3) by(auto simp add:dot_basis not_less) |
40377 | 4103 |
qed qed |
4104 |
||
33175 | 4105 |
lemma std_simplex: |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4106 |
"convex hull (insert 0 { basis i | i. i<DIM('a)}) = |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4107 |
{x::'a::euclidean_space . (\<forall>i<DIM('a). 0 \<le> x$$i) \<and> setsum (\<lambda>i. x$$i) {..<DIM('a)} \<le> 1 }" |
40377 | 4108 |
using substd_simplex[of "{..<DIM('a)}"] by auto |
33175 | 4109 |
|
4110 |
lemma interior_std_simplex: |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4111 |
"interior (convex hull (insert 0 { basis i| i. i<DIM('a)})) = |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4112 |
{x::'a::euclidean_space. (\<forall>i<DIM('a). 0 < x$$i) \<and> setsum (\<lambda>i. x$$i) {..<DIM('a)} < 1 }" |
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
39198
diff
changeset
|
4113 |
apply(rule set_eqI) unfolding mem_interior std_simplex unfolding subset_eq mem_Collect_eq Ball_def mem_ball |
33175 | 4114 |
unfolding Ball_def[symmetric] apply rule apply(erule exE, (erule conjE)+) defer apply(erule conjE) 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
|
4115 |
fix x::"'a" and e assume "0<e" and as:"\<forall>xa. dist x xa < e \<longrightarrow> (\<forall>x<DIM('a). 0 \<le> xa $$ x) \<and> setsum (op $$ xa) {..<DIM('a)} \<le> 1" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4116 |
show "(\<forall>xa<DIM('a). 0 < x $$ xa) \<and> setsum (op $$ x) {..<DIM('a)} < 1" apply(safe) proof- |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4117 |
fix i assume i:"i<DIM('a)" thus "0 < x $$ i" using as[THEN spec[where x="x - (e / 2) *\<^sub>R basis i"]] and `e>0` |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4118 |
unfolding dist_norm by (auto elim!:allE[where x=i]) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4119 |
next have **:"dist x (x + (e / 2) *\<^sub>R basis 0) < e" using `e>0` |
38642
8fa437809c67
dropped type classes mult_mono and mult_mono1; tuned names of technical rule duplicates
haftmann
parents:
37732
diff
changeset
|
4120 |
unfolding dist_norm by(auto intro!: mult_strict_left_mono) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4121 |
have "\<And>i. i<DIM('a) \<Longrightarrow> (x + (e / 2) *\<^sub>R basis 0) $$ i = x$$i + (if i = 0 then e/2 else 0)" |
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4122 |
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
|
4123 |
hence *:"setsum (op $$ (x + (e / 2) *\<^sub>R basis 0)) {..<DIM('a)} = setsum (\<lambda>i. x$$i + (if 0 = i then e/2 else 0)) {..<DIM('a)}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4124 |
apply(rule_tac setsum_cong) by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4125 |
have "setsum (op $$ x) {..<DIM('a)} < setsum (op $$ (x + (e / 2) *\<^sub>R basis 0)) {..<DIM('a)}" unfolding * setsum_addf |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4126 |
using `0<e` DIM_positive[where 'a='a] apply(subst setsum_delta') by auto |
33175 | 4127 |
also have "\<dots> \<le> 1" using ** apply(drule_tac as[rule_format]) 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
|
4128 |
finally show "setsum (op $$ x) {..<DIM('a)} < 1" by auto qed |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4129 |
next fix x::"'a" assume as:"\<forall>i<DIM('a). 0 < x $$ i" "setsum (op $$ x) {..<DIM('a)} < 1" |
33175 | 4130 |
guess a using UNIV_witness[where 'a='b] .. |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4131 |
let ?d = "(1 - setsum (op $$ x) {..<DIM('a)}) / real (DIM('a))" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4132 |
have "Min ((op $$ x) ` {..<DIM('a)}) > 0" apply(rule Min_grI) using as(1) by auto |
37647 | 4133 |
moreover have"?d > 0" apply(rule divide_pos_pos) using as(2) by(auto simp add: Suc_le_eq) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4134 |
ultimately show "\<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> (\<forall>i<DIM('a). 0 \<le> y $$ i) \<and> setsum (op $$ y) {..<DIM('a)} \<le> 1" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4135 |
apply(rule_tac x="min (Min ((op $$ x) ` {..<DIM('a)})) ?D" in exI) apply rule defer apply(rule,rule) proof- |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4136 |
fix y assume y:"dist x y < min (Min (op $$ x ` {..<DIM('a)})) ?d" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4137 |
have "setsum (op $$ y) {..<DIM('a)} \<le> setsum (\<lambda>i. x$$i + ?d) {..<DIM('a)}" proof(rule setsum_mono) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4138 |
fix i assume "i\<in>{..<DIM('a)}" hence "abs (y$$i - x$$i) < ?d" apply-apply(rule le_less_trans) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4139 |
using component_le_norm[of "y - x" i] |
36362
06475a1547cb
fix lots of looping simp calls and other warnings
huffman
parents:
36341
diff
changeset
|
4140 |
using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2] by(auto simp add: norm_minus_commute) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4141 |
thus "y $$ i \<le> x $$ i + ?d" by auto qed |
37647 | 4142 |
also have "\<dots> \<le> 1" unfolding setsum_addf setsum_constant card_enum real_eq_of_nat by(auto simp add: Suc_le_eq) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4143 |
finally show "(\<forall>i<DIM('a). 0 \<le> y $$ i) \<and> setsum (op $$ y) {..<DIM('a)} \<le> 1" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4144 |
proof safe fix i assume i:"i<DIM('a)" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4145 |
have "norm (x - y) < x$$i" apply(rule less_le_trans) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4146 |
apply(rule y[unfolded min_less_iff_conj dist_norm, THEN conjunct1]) using i by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4147 |
thus "0 \<le> y$$i" using component_le_norm[of "x - y" i] and as(1)[rule_format, of i] by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4148 |
qed qed auto qed |
33175 | 4149 |
|
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4150 |
lemma interior_std_simplex_nonempty: obtains a::"'a::euclidean_space" where |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4151 |
"a \<in> interior(convex hull (insert 0 {basis i | i . i<DIM('a)}))" proof- |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4152 |
let ?D = "{..<DIM('a)}" let ?a = "setsum (\<lambda>b::'a. inverse (2 * real DIM('a)) *\<^sub>R b) {(basis i) | i. i<DIM('a)}" |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4153 |
have *:"{basis i :: 'a | i. i<DIM('a)} = basis ` ?D" by auto |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4154 |
{ fix i assume i:"i<DIM('a)" have "?a $$ i = inverse (2 * real DIM('a))" |
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
4155 |
unfolding euclidean_component_setsum * and setsum_reindex[OF basis_inj] and o_def |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4156 |
apply(rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real DIM('a)) else 0) ?D"]) apply(rule setsum_cong2) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4157 |
defer apply(subst setsum_delta') unfolding euclidean_component_def using i by(auto simp add:dot_basis) } |
33175 | 4158 |
note ** = this |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4159 |
show ?thesis apply(rule that[of ?a]) unfolding interior_std_simplex mem_Collect_eq proof safe |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4160 |
fix i assume i:"i<DIM('a)" show "0 < ?a $$ i" unfolding **[OF i] by(auto simp add: Suc_le_eq) |
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4161 |
next have "setsum (op $$ ?a) ?D = setsum (\<lambda>i. inverse (2 * real DIM('a))) ?D" apply(rule setsum_cong2, rule **) by auto |
36778
739a9379e29b
avoid using real-specific versions of generic lemmas
huffman
parents:
36725
diff
changeset
|
4162 |
also have "\<dots> < 1" unfolding setsum_constant card_enum real_eq_of_nat divide_inverse[THEN sym] by (auto simp add:field_simps) |
37489
44e42d392c6e
Introduce a type class for euclidean spaces, port most lemmas from real^'n to this type class.
hoelzl
parents:
36844
diff
changeset
|
4163 |
finally show "setsum (op $$ ?a) ?D < 1" by auto qed qed |
33175 | 4164 |
|
40377 | 4165 |
lemma rel_interior_substd_simplex: assumes "d\<subseteq>{..<DIM('a::euclidean_space)}" |
4166 |
shows "rel_interior (convex hull (insert 0 { basis i| i. i : d})) = |
|
4167 |
{x::'a::euclidean_space. (\<forall>i\<in>d. 0 < x$$i) & setsum (%i. x$$i) d < 1 & (!i<DIM('a). i ~: d --> x$$i = 0)}" |
|
4168 |
(is "rel_interior (convex hull (insert 0 ?p)) = ?s") |
|
4169 |
(* Proof is a modified copy of the proof of similar lemma interior_std_simplex in Convex_Euclidean_Space.thy *) |
|
4170 |
proof- |
|
4171 |
have "finite d" apply(rule finite_subset) using assms by auto |
|
4172 |
{ assume "d={}" hence ?thesis using rel_interior_sing using euclidean_eq[of _ 0] by auto } |
|
4173 |
moreover |
|
4174 |
{ assume "d~={}" |
|
4175 |
have h0: "affine hull (convex hull (insert 0 ?p))={x::'a::euclidean_space. (!i<DIM('a). i ~: d --> x$$i = 0)}" |
|
4176 |
using affine_hull_convex_hull affine_hull_substd_basis assms by auto |
|
4177 |
have aux: "!x::'n::euclidean_space. !i. ((! i:d. 0 <= x$$i) & (!i. i ~: d --> x$$i = 0))--> 0 <= x$$i" by auto |
|
4178 |
{ fix x::"'a::euclidean_space" assume x_def: "x : rel_interior (convex hull (insert 0 ?p))" |
|
4179 |
from this obtain e where e0: "e>0" and |
|
4180 |
"ball x e Int {xa. (!i<DIM('a). i ~: d --> xa$$i = 0)} <= convex hull (insert 0 ?p)" |
|
4181 |
using mem_rel_interior_ball[of x "convex hull (insert 0 ?p)"] h0 by auto |
|
4182 |
hence as: "ALL xa. (dist x xa < e & (!i<DIM('a). i ~: d --> xa$$i = 0)) --> |
|
4183 |
(!i : d. 0 <= xa $$ i) & setsum (op $$ xa) d <= 1" |
|
4184 |
unfolding ball_def unfolding substd_simplex[OF assms] using assms by auto |
|
4185 |
have x0: "(!i<DIM('a). i ~: d --> x$$i = 0)" |
|
4186 |
using x_def rel_interior_subset substd_simplex[OF assms] by auto |
|
4187 |
have "(!i : d. 0 < x $$ i) & setsum (op $$ x) d < 1 & (!i<DIM('a). i ~: d --> x$$i = 0)" apply(rule,rule) |
|
4188 |
proof- |
|
4189 |
fix i::nat assume "i:d" |
|
4190 |
hence "\<forall>ia\<in>d. 0 \<le> (x - (e / 2) *\<^sub>R basis i) $$ ia" apply-apply(rule as[rule_format,THEN conjunct1]) |
|
4191 |
unfolding dist_norm using assms `e>0` x0 by auto |
|
4192 |
thus "0 < x $$ i" apply(erule_tac x=i in ballE) using `e>0` `i\<in>d` assms by auto |
|
4193 |
next obtain a where a:"a:d" using `d ~= {}` by auto |
|
4194 |
have **:"dist x (x + (e / 2) *\<^sub>R basis a) < e" |
|
4195 |
using `e>0` and Euclidean_Space.norm_basis[of a] |
|
4196 |
unfolding dist_norm by auto |
|
4197 |
have "\<And>i. (x + (e / 2) *\<^sub>R basis a) $$ i = x$$i + (if i = a then e/2 else 0)" |
|
4198 |
unfolding euclidean_simps using a assms by auto |
|
4199 |
hence *:"setsum (op $$ (x + (e / 2) *\<^sub>R basis a)) d = |
|
4200 |
setsum (\<lambda>i. x$$i + (if a = i then e/2 else 0)) d" by(rule_tac setsum_cong, auto) |
|
4201 |
have h1: "(ALL i<DIM('a). i ~: d --> (x + (e / 2) *\<^sub>R basis a) $$ i = 0)" |
|
4202 |
using as[THEN spec[where x="x + (e / 2) *\<^sub>R basis a"]] `a:d` using x0 |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4203 |
by(auto elim:allE[where x=a]) |
40377 | 4204 |
have "setsum (op $$ x) d < setsum (op $$ (x + (e / 2) *\<^sub>R basis a)) d" unfolding * setsum_addf |
4205 |
using `0<e` `a:d` using `finite d` by(auto simp add: setsum_delta') |
|
4206 |
also have "\<dots> \<le> 1" using ** h1 as[rule_format, of "x + (e / 2) *\<^sub>R basis a"] by auto |
|
4207 |
finally show "setsum (op $$ x) d < 1 & (!i<DIM('a). i ~: d --> x$$i = 0)" using x0 by auto |
|
4208 |
qed |
|
4209 |
} |
|
4210 |
moreover |
|
4211 |
{ |
|
4212 |
fix x::"'a::euclidean_space" assume as: "x : ?s" |
|
4213 |
have "!i. ((0<x$$i) | (0=x$$i) --> 0<=x$$i)" by auto |
|
4214 |
moreover have "!i. (i:d) | (i ~: d)" by auto |
|
4215 |
ultimately |
|
4216 |
have "!i. ( (ALL i:d. 0 < x$$i) & (ALL i. i ~: d --> x$$i = 0) ) --> 0 <= x$$i" by metis |
|
4217 |
hence h2: "x : convex hull (insert 0 ?p)" using as assms |
|
4218 |
unfolding substd_simplex[OF assms] by fastsimp |
|
4219 |
obtain a where a:"a:d" using `d ~= {}` by auto |
|
4220 |
let ?d = "(1 - setsum (op $$ x) d) / real (card d)" |
|
44466 | 4221 |
have "0 < card d" using `d ~={}` `finite d` by (simp add: card_gt_0_iff) |
4222 |
have "Min ((op $$ x) ` d) > 0" using as `d \<noteq> {}` `finite d` by (simp add: Min_grI) |
|
4223 |
moreover have "?d > 0" apply(rule divide_pos_pos) using as using `0 < card d` by auto |
|
40377 | 4224 |
ultimately have h3: "min (Min ((op $$ x) ` d)) ?d > 0" by auto |
4225 |
||
4226 |
have "x : rel_interior (convex hull (insert 0 ?p))" |
|
4227 |
unfolding rel_interior_ball mem_Collect_eq h0 apply(rule,rule h2) |
|
4228 |
unfolding substd_simplex[OF assms] |
|
4229 |
apply(rule_tac x="min (Min ((op $$ x) ` d)) ?d" in exI) apply(rule,rule h3) apply safe unfolding mem_ball |
|
4230 |
proof- fix y::'a assume y:"dist x y < min (Min (op $$ x ` d)) ?d" and y2:"(!i<DIM('a). i ~: d --> y$$i = 0)" |
|
4231 |
have "setsum (op $$ y) d \<le> setsum (\<lambda>i. x$$i + ?d) d" proof(rule setsum_mono) |
|
4232 |
fix i assume i:"i\<in>d" |
|
4233 |
have "abs (y$$i - x$$i) < ?d" apply(rule le_less_trans) using component_le_norm[of "y - x" i] |
|
4234 |
using y[unfolded min_less_iff_conj dist_norm, THEN conjunct2] |
|
4235 |
by(auto simp add: norm_minus_commute) |
|
4236 |
thus "y $$ i \<le> x $$ i + ?d" by auto qed |
|
4237 |
also have "\<dots> \<le> 1" unfolding setsum_addf setsum_constant card_enum real_eq_of_nat |
|
44466 | 4238 |
using `0 < card d` by auto |
40377 | 4239 |
finally show "setsum (op $$ y) d \<le> 1" . |
4240 |
||
4241 |
fix i assume "i<DIM('a)" thus "0 \<le> y$$i" |
|
4242 |
proof(cases "i\<in>d") case True |
|
4243 |
have "norm (x - y) < x$$i" using y[unfolded min_less_iff_conj dist_norm, THEN conjunct1] |
|
44466 | 4244 |
using Min_gr_iff[of "op $$ x ` d" "norm (x - y)"] `0 < card d` `i:d` |
4245 |
by (simp add: card_gt_0_iff) |
|
40377 | 4246 |
thus "0 \<le> y$$i" using component_le_norm[of "x - y" i] and as(1)[rule_format] by auto |
4247 |
qed(insert y2, auto) |
|
4248 |
qed |
|
4249 |
} ultimately have |
|
4250 |
"!!x :: 'a::euclidean_space. (x : rel_interior (convex hull insert 0 {basis i |i. i : d})) = |
|
4251 |
(x : {x. (ALL i:d. 0 < x $$ i) & |
|
4252 |
setsum (op $$ x) d < 1 & (ALL i<DIM('a). i ~: d --> x $$ i = 0)})" by blast |
|
4253 |
from this have ?thesis by (rule set_eqI) |
|
4254 |
} ultimately show ?thesis by blast |
|
4255 |
qed |
|
4256 |
||
4257 |
lemma rel_interior_substd_simplex_nonempty: assumes "d ~={}" "d\<subseteq>{..<DIM('a::euclidean_space)}" |
|
4258 |
obtains a::"'a::euclidean_space" where |
|
4259 |
"a : rel_interior(convex hull (insert 0 {basis i | i . i : d}))" proof- |
|
4260 |
(* Proof is a modified copy of the proof of similar lemma interior_std_simplex_nonempty in Convex_Euclidean_Space.thy *) |
|
4261 |
let ?D = d let ?a = "setsum (\<lambda>b::'a::euclidean_space. inverse (2 * real (card d)) *\<^sub>R b) {(basis i) | i. i \<in> ?D}" |
|
4262 |
have *:"{basis i :: 'a | i. i \<in> ?D} = basis ` ?D" by auto |
|
4263 |
have "finite d" apply(rule finite_subset) using assms(2) by auto |
|
44466 | 4264 |
hence d1: "0 < real(card d)" using `d ~={}` by auto |
40377 | 4265 |
{ fix i assume "i:d" have "?a $$ i = inverse (2 * real (card d))" |
4266 |
unfolding * setsum_reindex[OF basis_inj_on, OF assms(2)] o_def |
|
4267 |
apply(rule trans[of _ "setsum (\<lambda>j. if i = j then inverse (2 * real (card d)) else 0) ?D"]) |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
4268 |
unfolding euclidean_component_setsum |
40377 | 4269 |
apply(rule setsum_cong2) |
4270 |
using `i:d` `finite d` setsum_delta'[of d i "(%k. inverse (2 * real (card d)))"] d1 assms(2) |
|
4271 |
by (auto simp add: Euclidean_Space.basis_component[of i])} |
|
4272 |
note ** = this |
|
4273 |
show ?thesis apply(rule that[of ?a]) unfolding rel_interior_substd_simplex[OF assms(2)] mem_Collect_eq |
|
4274 |
proof safe fix i assume "i:d" |
|
44466 | 4275 |
have "0 < inverse (2 * real (card d))" using d1 by auto |
40377 | 4276 |
also have "...=?a $$ i" using **[of i] `i:d` by auto |
4277 |
finally show "0 < ?a $$ i" by auto |
|
4278 |
next have "setsum (op $$ ?a) ?D = setsum (\<lambda>i. inverse (2 * real (card d))) ?D" |
|
4279 |
by(rule setsum_cong2, rule **) |
|
4280 |
also have "\<dots> < 1" unfolding setsum_constant card_enum real_eq_of_nat real_divide_def[THEN sym] |
|
4281 |
by (auto simp add:field_simps) |
|
4282 |
finally show "setsum (op $$ ?a) ?D < 1" by auto |
|
4283 |
next fix i assume "i<DIM('a)" and "i~:d" |
|
4284 |
have "?a : (span {basis i | i. i : d})" |
|
4285 |
apply (rule span_setsum[of "{basis i |i. i : d}" "(%b. b /\<^sub>R (2 * real (card d)))" "{basis i |i. i : d}"]) |
|
4286 |
using finite_substdbasis[of d] apply blast |
|
4287 |
proof- |
|
4288 |
{ fix x assume "(x :: 'a::euclidean_space): {basis i |i. i : d}" |
|
4289 |
hence "x : span {basis i |i. i : d}" |
|
4290 |
using span_superset[of _ "{basis i |i. i : d}"] by auto |
|
4291 |
hence "(x /\<^sub>R (2 * real (card d))) : (span {basis i |i. i : d})" |
|
4292 |
using span_mul[of x "{basis i |i. i : d}" "(inverse (real (card d)) / 2)"] by auto |
|
4293 |
} thus "\<forall>x\<in>{basis i |i. i \<in> d}. x /\<^sub>R (2 * real (card d)) \<in> span {basis i ::'a |i. i \<in> d}" by auto |
|
4294 |
qed |
|
4295 |
thus "?a $$ i = 0 " using `i~:d` unfolding span_substd_basis[OF assms(2)] using `i<DIM('a)` by auto |
|
4296 |
qed |
|
4297 |
qed |
|
4298 |
||
44467 | 4299 |
subsection {* Relative interior of convex set *} |
40377 | 4300 |
|
4301 |
lemma rel_interior_convex_nonempty_aux: |
|
4302 |
fixes S :: "('n::euclidean_space) set" |
|
4303 |
assumes "convex S" and "0 : S" |
|
4304 |
shows "rel_interior S ~= {}" |
|
4305 |
proof- |
|
4306 |
{ assume "S = {0}" hence ?thesis using rel_interior_sing by auto } |
|
4307 |
moreover { |
|
4308 |
assume "S ~= {0}" |
|
4309 |
obtain B where B_def: "independent B & B<=S & (S <= span B) & card B = dim S" using basis_exists[of S] by auto |
|
4310 |
hence "B~={}" using B_def assms `S ~= {0}` span_empty by auto |
|
4311 |
have "insert 0 B <= span B" using subspace_span[of B] subspace_0[of "span B"] span_inc by auto |
|
4312 |
hence "span (insert 0 B) <= span B" |
|
4313 |
using span_span[of B] span_mono[of "insert 0 B" "span B"] by blast |
|
4314 |
hence "convex hull insert 0 B <= span B" |
|
4315 |
using convex_hull_subset_span[of "insert 0 B"] by auto |
|
4316 |
hence "span (convex hull insert 0 B) <= span B" |
|
4317 |
using span_span[of B] span_mono[of "convex hull insert 0 B" "span B"] by blast |
|
4318 |
hence *: "span (convex hull insert 0 B) = span B" |
|
4319 |
using span_mono[of B "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto |
|
4320 |
hence "span (convex hull insert 0 B) = span S" |
|
4321 |
using B_def span_mono[of B S] span_mono[of S "span B"] span_span[of B] by auto |
|
4322 |
moreover have "0 : affine hull (convex hull insert 0 B)" |
|
4323 |
using hull_subset[of "convex hull insert 0 B"] hull_subset[of "insert 0 B"] by auto |
|
4324 |
ultimately have **: "affine hull (convex hull insert 0 B) = affine hull S" |
|
4325 |
using affine_hull_span_0[of "convex hull insert 0 B"] affine_hull_span_0[of "S"] |
|
4326 |
assms hull_subset[of S] by auto |
|
4327 |
obtain d and f::"'n=>'n" where fd: "card d = card B & linear f & f ` B = {basis i |i. i : (d :: nat set)} & |
|
4328 |
f ` span B = {x. ALL i<DIM('n). i ~: d --> x $$ i = (0::real)} & inj_on f (span B)" and d:"d\<subseteq>{..<DIM('n)}" |
|
4329 |
using basis_to_substdbasis_subspace_isomorphism[of B,OF _ ] B_def by auto |
|
4330 |
hence "bounded_linear f" using linear_conv_bounded_linear by auto |
|
4331 |
have "d ~={}" using fd B_def `B ~={}` by auto |
|
4332 |
have "(insert 0 {basis i |i. i : d}) = f ` (insert 0 B)" using fd linear_0 by auto |
|
4333 |
hence "(convex hull (insert 0 {basis i |i. i : d})) = f ` (convex hull (insert 0 B))" |
|
4334 |
using convex_hull_linear_image[of f "(insert 0 {basis i |i. i : d})"] |
|
4335 |
convex_hull_linear_image[of f "(insert 0 B)"] `bounded_linear f` by auto |
|
4336 |
moreover have "rel_interior (f ` (convex hull insert 0 B)) = |
|
4337 |
f ` rel_interior (convex hull insert 0 B)" |
|
4338 |
apply (rule rel_interior_injective_on_span_linear_image[of f "(convex hull insert 0 B)"]) |
|
4339 |
using `bounded_linear f` fd * by auto |
|
4340 |
ultimately have "rel_interior (convex hull insert 0 B) ~= {}" |
|
4341 |
using rel_interior_substd_simplex_nonempty[OF `d~={}` d] apply auto by blast |
|
4342 |
moreover have "convex hull (insert 0 B) <= S" |
|
4343 |
using B_def assms hull_mono[of "insert 0 B" "S" "convex"] convex_hull_eq by auto |
|
4344 |
ultimately have ?thesis using subset_rel_interior[of "convex hull insert 0 B" S] ** by auto |
|
4345 |
} ultimately show ?thesis by auto |
|
4346 |
qed |
|
4347 |
||
4348 |
lemma rel_interior_convex_nonempty: |
|
4349 |
fixes S :: "('n::euclidean_space) set" |
|
4350 |
assumes "convex S" |
|
4351 |
shows "rel_interior S = {} <-> S = {}" |
|
4352 |
proof- |
|
4353 |
{ assume "S ~= {}" from this obtain a where "a : S" by auto |
|
4354 |
hence "0 : op + (-a) ` S" using assms exI[of "(%x. x:S & -a+x=0)" a] by auto |
|
4355 |
hence "rel_interior (op + (-a) ` S) ~= {}" |
|
4356 |
using rel_interior_convex_nonempty_aux[of "op + (-a) ` S"] |
|
4357 |
convex_translation[of S "-a"] assms by auto |
|
4358 |
hence "rel_interior S ~= {}" using rel_interior_translation by auto |
|
4359 |
} from this show ?thesis using rel_interior_empty by auto |
|
4360 |
qed |
|
4361 |
||
4362 |
lemma convex_rel_interior: |
|
4363 |
fixes S :: "(_::euclidean_space) set" |
|
4364 |
assumes "convex S" |
|
4365 |
shows "convex (rel_interior S)" |
|
4366 |
proof- |
|
4367 |
{ fix "x" "y" "u" |
|
4368 |
assume assm: "x:rel_interior S" "y:rel_interior S" "0<=u" "(u :: real) <= 1" |
|
4369 |
hence "x:S" using rel_interior_subset by auto |
|
4370 |
have "x - u *\<^sub>R (x-y) : rel_interior S" |
|
4371 |
proof(cases "0=u") |
|
4372 |
case False hence "0<u" using assm by auto |
|
4373 |
thus ?thesis |
|
4374 |
using assm rel_interior_convex_shrink[of S y x u] assms `x:S` by auto |
|
4375 |
next |
|
4376 |
case True thus ?thesis using assm by auto |
|
4377 |
qed |
|
4378 |
hence "(1-u) *\<^sub>R x + u *\<^sub>R y : rel_interior S" by (simp add: algebra_simps) |
|
4379 |
} from this show ?thesis unfolding convex_alt by auto |
|
4380 |
qed |
|
4381 |
||
4382 |
lemma convex_closure_rel_interior: |
|
4383 |
fixes S :: "('n::euclidean_space) set" |
|
4384 |
assumes "convex S" |
|
4385 |
shows "closure(rel_interior S) = closure S" |
|
4386 |
proof- |
|
4387 |
have h1: "closure(rel_interior S) <= closure S" |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4388 |
using closure_mono[of "rel_interior S" S] rel_interior_subset[of S] by auto |
40377 | 4389 |
{ assume "S ~= {}" from this obtain a where a_def: "a : rel_interior S" |
4390 |
using rel_interior_convex_nonempty assms by auto |
|
4391 |
{ fix x assume x_def: "x : closure S" |
|
4392 |
{ assume "x=a" hence "x : closure(rel_interior S)" using a_def unfolding closure_def by auto } |
|
4393 |
moreover |
|
4394 |
{ assume "x ~= a" |
|
4395 |
{ fix e :: real assume e_def: "e>0" |
|
4396 |
def e1 == "min 1 (e/norm (x - a))" hence e1_def: "e1>0 & e1<=1 & e1*norm(x-a)<=e" |
|
4397 |
using `x ~= a` `e>0` divide_pos_pos[of e] le_divide_eq[of e1 e "norm(x-a)"] by simp |
|
4398 |
hence *: "x - e1 *\<^sub>R (x - a) : rel_interior S" |
|
4399 |
using rel_interior_closure_convex_shrink[of S a x e1] assms x_def a_def e1_def by auto |
|
4400 |
have "EX y. y:rel_interior S & y ~= x & (dist y x) <= e" |
|
4401 |
apply (rule_tac x="x - e1 *\<^sub>R (x - a)" in exI) |
|
4402 |
using * e1_def dist_norm[of "x - e1 *\<^sub>R (x - a)" x] `x ~= a` by simp |
|
4403 |
} hence "x islimpt rel_interior S" unfolding islimpt_approachable_le by auto |
|
4404 |
hence "x : closure(rel_interior S)" unfolding closure_def by auto |
|
4405 |
} ultimately have "x : closure(rel_interior S)" by auto |
|
4406 |
} hence ?thesis using h1 by auto |
|
4407 |
} |
|
4408 |
moreover |
|
4409 |
{ assume "S = {}" hence "rel_interior S = {}" using rel_interior_empty by auto |
|
4410 |
hence "closure(rel_interior S) = {}" using closure_empty by auto |
|
4411 |
hence ?thesis using `S={}` by auto |
|
4412 |
} ultimately show ?thesis by blast |
|
4413 |
qed |
|
4414 |
||
4415 |
lemma rel_interior_same_affine_hull: |
|
4416 |
fixes S :: "('n::euclidean_space) set" |
|
4417 |
assumes "convex S" |
|
4418 |
shows "affine hull (rel_interior S) = affine hull S" |
|
4419 |
by (metis assms closure_same_affine_hull convex_closure_rel_interior) |
|
4420 |
||
4421 |
lemma rel_interior_aff_dim: |
|
4422 |
fixes S :: "('n::euclidean_space) set" |
|
4423 |
assumes "convex S" |
|
4424 |
shows "aff_dim (rel_interior S) = aff_dim S" |
|
4425 |
by (metis aff_dim_affine_hull2 assms rel_interior_same_affine_hull) |
|
4426 |
||
4427 |
lemma rel_interior_rel_interior: |
|
4428 |
fixes S :: "('n::euclidean_space) set" |
|
4429 |
assumes "convex S" |
|
4430 |
shows "rel_interior (rel_interior S) = rel_interior S" |
|
4431 |
proof- |
|
4432 |
have "openin (subtopology euclidean (affine hull (rel_interior S))) (rel_interior S)" |
|
4433 |
using opein_rel_interior[of S] rel_interior_same_affine_hull[of S] assms by auto |
|
4434 |
from this show ?thesis using rel_interior_def by auto |
|
4435 |
qed |
|
4436 |
||
4437 |
lemma rel_interior_rel_open: |
|
4438 |
fixes S :: "('n::euclidean_space) set" |
|
4439 |
assumes "convex S" |
|
4440 |
shows "rel_open (rel_interior S)" |
|
4441 |
unfolding rel_open_def using rel_interior_rel_interior assms by auto |
|
4442 |
||
4443 |
lemma convex_rel_interior_closure_aux: |
|
4444 |
fixes x y z :: "_::euclidean_space" |
|
4445 |
assumes "0 < a" "0 < b" "(a+b) *\<^sub>R z = a *\<^sub>R x + b *\<^sub>R y" |
|
4446 |
obtains e where "0 < e" "e <= 1" "z = y - e *\<^sub>R (y-x)" |
|
4447 |
proof- |
|
4448 |
def e == "a/(a+b)" |
|
4449 |
have "z = (1 / (a + b)) *\<^sub>R ((a + b) *\<^sub>R z)" apply auto using assms by simp |
|
4450 |
also have "... = (1 / (a + b)) *\<^sub>R (a *\<^sub>R x + b *\<^sub>R y)" using assms |
|
4451 |
scaleR_cancel_left[of "1/(a+b)" "(a + b) *\<^sub>R z" "a *\<^sub>R x + b *\<^sub>R y"] by auto |
|
4452 |
also have "... = y - e *\<^sub>R (y-x)" using e_def apply (simp add: algebra_simps) |
|
4453 |
using scaleR_left_distrib[of "a/(a+b)" "b/(a+b)" y] assms add_divide_distrib[of a b "a+b"] by auto |
|
4454 |
finally have "z = y - e *\<^sub>R (y-x)" by auto |
|
4455 |
moreover have "0<e" using e_def assms divide_pos_pos[of a "a+b"] by auto |
|
4456 |
moreover have "e<=1" using e_def assms by auto |
|
4457 |
ultimately show ?thesis using that[of e] by auto |
|
4458 |
qed |
|
4459 |
||
4460 |
lemma convex_rel_interior_closure: |
|
4461 |
fixes S :: "('n::euclidean_space) set" |
|
4462 |
assumes "convex S" |
|
4463 |
shows "rel_interior (closure S) = rel_interior S" |
|
4464 |
proof- |
|
4465 |
{ assume "S={}" hence ?thesis using assms rel_interior_convex_nonempty by auto } |
|
4466 |
moreover |
|
4467 |
{ assume "S ~= {}" |
|
4468 |
have "rel_interior (closure S) >= rel_interior S" |
|
4469 |
using subset_rel_interior[of S "closure S"] closure_same_affine_hull closure_subset by auto |
|
4470 |
moreover |
|
4471 |
{ fix z assume z_def: "z : rel_interior (closure S)" |
|
4472 |
obtain x where x_def: "x : rel_interior S" |
|
4473 |
using `S ~= {}` assms rel_interior_convex_nonempty by auto |
|
4474 |
{ assume "x=z" hence "z : rel_interior S" using x_def by auto } |
|
4475 |
moreover |
|
4476 |
{ assume "x ~= z" |
|
4477 |
obtain e where e_def: "e > 0 & cball z e Int affine hull closure S <= closure S" |
|
4478 |
using z_def rel_interior_cball[of "closure S"] by auto |
|
4479 |
hence *: "0 < e/norm(z-x)" using e_def `x ~= z` divide_pos_pos[of e "norm(z-x)"] by auto |
|
4480 |
def y == "z + (e/norm(z-x)) *\<^sub>R (z-x)" |
|
4481 |
have yball: "y : cball z e" |
|
4482 |
using mem_cball y_def dist_norm[of z y] e_def by auto |
|
4483 |
have "x : affine hull closure S" |
|
4484 |
using x_def rel_interior_subset_closure hull_inc[of x "closure S"] by auto |
|
4485 |
moreover have "z : affine hull closure S" |
|
4486 |
using z_def rel_interior_subset hull_subset[of "closure S"] by auto |
|
4487 |
ultimately have "y : affine hull closure S" |
|
4488 |
using y_def affine_affine_hull[of "closure S"] |
|
4489 |
mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"] by auto |
|
4490 |
hence "y : closure S" using e_def yball by auto |
|
4491 |
have "(1+(e/norm(z-x))) *\<^sub>R z = (e/norm(z-x)) *\<^sub>R x + y" |
|
4492 |
using y_def by (simp add: algebra_simps) |
|
4493 |
from this obtain e1 where "0 < e1 & e1 <= 1 & z = y - e1 *\<^sub>R (y - x)" |
|
4494 |
using * convex_rel_interior_closure_aux[of "e / norm (z - x)" 1 z x y] |
|
4495 |
by (auto simp add: algebra_simps) |
|
4496 |
hence "z : rel_interior S" |
|
4497 |
using rel_interior_closure_convex_shrink assms x_def `y : closure S` by auto |
|
4498 |
} ultimately have "z : rel_interior S" by auto |
|
4499 |
} ultimately have ?thesis by auto |
|
4500 |
} ultimately show ?thesis by blast |
|
4501 |
qed |
|
4502 |
||
4503 |
lemma convex_interior_closure: |
|
4504 |
fixes S :: "('n::euclidean_space) set" |
|
4505 |
assumes "convex S" |
|
4506 |
shows "interior (closure S) = interior S" |
|
4507 |
using closure_aff_dim[of S] interior_rel_interior_gen[of S] interior_rel_interior_gen[of "closure S"] |
|
4508 |
convex_rel_interior_closure[of S] assms by auto |
|
4509 |
||
4510 |
lemma closure_eq_rel_interior_eq: |
|
4511 |
fixes S1 S2 :: "('n::euclidean_space) set" |
|
4512 |
assumes "convex S1" "convex S2" |
|
4513 |
shows "(closure S1 = closure S2) <-> (rel_interior S1 = rel_interior S2)" |
|
4514 |
by (metis convex_rel_interior_closure convex_closure_rel_interior assms) |
|
4515 |
||
4516 |
||
4517 |
lemma closure_eq_between: |
|
4518 |
fixes S1 S2 :: "('n::euclidean_space) set" |
|
4519 |
assumes "convex S1" "convex S2" |
|
4520 |
shows "(closure S1 = closure S2) <-> |
|
4521 |
((rel_interior S1 <= S2) & (S2 <= closure S1))" (is "?A <-> ?B") |
|
4522 |
proof- |
|
4523 |
have "?A --> ?B" by (metis assms closure_subset convex_rel_interior_closure rel_interior_subset) |
|
4524 |
moreover have "?B --> (closure S1 <= closure S2)" |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4525 |
by (metis assms(1) convex_closure_rel_interior closure_mono) |
40377 | 4526 |
moreover have "?B --> (closure S1 >= closure S2)" by (metis closed_closure closure_minimal) |
4527 |
ultimately show ?thesis by blast |
|
4528 |
qed |
|
4529 |
||
4530 |
lemma open_inter_closure_rel_interior: |
|
4531 |
fixes S A :: "('n::euclidean_space) set" |
|
4532 |
assumes "convex S" "open A" |
|
4533 |
shows "((A Int closure S) = {}) <-> ((A Int rel_interior S) = {})" |
|
4534 |
by (metis assms convex_closure_rel_interior open_inter_closure_eq_empty) |
|
4535 |
||
4536 |
definition "rel_frontier S = closure S - rel_interior S" |
|
4537 |
||
4538 |
lemma closed_affine_hull: "closed (affine hull ((S :: ('n::euclidean_space) set)))" |
|
4539 |
by (metis affine_affine_hull affine_closed) |
|
4540 |
||
4541 |
lemma closed_rel_frontier: "closed(rel_frontier (S :: ('n::euclidean_space) set))" |
|
4542 |
proof- |
|
4543 |
have *: "closedin (subtopology euclidean (affine hull S)) (closure S - rel_interior S)" |
|
4544 |
apply (rule closedin_diff[of "subtopology euclidean (affine hull S)""closure S" "rel_interior S"]) using closed_closedin_trans[of "affine hull S" "closure S"] closed_affine_hull[of S] |
|
4545 |
closure_affine_hull[of S] opein_rel_interior[of S] by auto |
|
4546 |
show ?thesis apply (rule closedin_closed_trans[of "affine hull S" "rel_frontier S"]) |
|
4547 |
unfolding rel_frontier_def using * closed_affine_hull by auto |
|
4548 |
qed |
|
4549 |
||
4550 |
||
4551 |
lemma convex_rel_frontier_aff_dim: |
|
4552 |
fixes S1 S2 :: "('n::euclidean_space) set" |
|
4553 |
assumes "convex S1" "convex S2" "S2 ~= {}" |
|
4554 |
assumes "S1 <= rel_frontier S2" |
|
4555 |
shows "aff_dim S1 < aff_dim S2" |
|
4556 |
proof- |
|
4557 |
have "S1 <= closure S2" using assms unfolding rel_frontier_def by auto |
|
4558 |
hence *: "affine hull S1 <= affine hull S2" |
|
4559 |
using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] by auto |
|
4560 |
hence "aff_dim S1 <= aff_dim S2" using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2] |
|
4561 |
aff_dim_subset[of "affine hull S1" "affine hull S2"] by auto |
|
4562 |
moreover |
|
4563 |
{ assume eq: "aff_dim S1 = aff_dim S2" |
|
4564 |
hence "S1 ~= {}" using aff_dim_empty[of S1] aff_dim_empty[of S2] `S2 ~= {}` by auto |
|
4565 |
have **: "affine hull S1 = affine hull S2" |
|
4566 |
apply (rule affine_dim_equal) using * affine_affine_hull apply auto |
|
4567 |
using `S1 ~= {}` hull_subset[of S1] apply auto |
|
4568 |
using eq aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2] by auto |
|
4569 |
obtain a where a_def: "a : rel_interior S1" |
|
4570 |
using `S1 ~= {}` rel_interior_convex_nonempty assms by auto |
|
4571 |
obtain T where T_def: "open T & a : T Int S1 & T Int affine hull S1 <= S1" |
|
4572 |
using mem_rel_interior[of a S1] a_def by auto |
|
4573 |
hence "a : T Int closure S2" using a_def assms unfolding rel_frontier_def by auto |
|
4574 |
from this obtain b where b_def: "b : T Int rel_interior S2" |
|
4575 |
using open_inter_closure_rel_interior[of S2 T] assms T_def by auto |
|
4576 |
hence "b : affine hull S1" using rel_interior_subset hull_subset[of S2] ** by auto |
|
4577 |
hence "b : S1" using T_def b_def by auto |
|
4578 |
hence False using b_def assms unfolding rel_frontier_def by auto |
|
4579 |
} ultimately show ?thesis using zless_le by auto |
|
4580 |
qed |
|
4581 |
||
4582 |
||
4583 |
lemma convex_rel_interior_if: |
|
4584 |
fixes S :: "('n::euclidean_space) set" |
|
4585 |
assumes "convex S" |
|
4586 |
assumes "z : rel_interior S" |
|
4587 |
shows "(!x:affine hull S. EX m. m>1 & (!e. (e>1 & e<=m) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S ))" |
|
4588 |
proof- |
|
4589 |
obtain e1 where e1_def: "e1>0 & cball z e1 Int affine hull S <= S" |
|
4590 |
using mem_rel_interior_cball[of z S] assms by auto |
|
4591 |
{ fix x assume x_def: "x:affine hull S" |
|
4592 |
{ assume "x ~= z" |
|
4593 |
def m == "1+e1/norm(x-z)" |
|
4594 |
hence "m>1" using e1_def `x ~= z` divide_pos_pos[of e1 "norm (x - z)"] by auto |
|
4595 |
{ fix e assume e_def: "e>1 & e<=m" |
|
4596 |
have "z : affine hull S" using assms rel_interior_subset hull_subset[of S] by auto |
|
4597 |
hence *: "(1-e)*\<^sub>R x+ e *\<^sub>R z : affine hull S" |
|
4598 |
using mem_affine[of "affine hull S" x z "(1-e)" e] affine_affine_hull[of S] x_def by auto |
|
4599 |
have "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) = norm ((e - 1) *\<^sub>R (x-z))" by (simp add: algebra_simps) |
|
4600 |
also have "...= (e - 1) * norm(x-z)" using norm_scaleR e_def by auto |
|
4601 |
also have "...<=(m - 1) * norm(x-z)" using e_def mult_right_mono[of _ _ "norm(x-z)"] by auto |
|
4602 |
also have "...= (e1 / norm (x - z)) * norm (x - z)" using m_def by auto |
|
4603 |
also have "...=e1" using `x ~= z` e1_def by simp |
|
4604 |
finally have **: "norm (z + e *\<^sub>R x - (x + e *\<^sub>R z)) <= e1" by auto |
|
4605 |
have "(1-e)*\<^sub>R x+ e *\<^sub>R z : cball z e1" |
|
4606 |
using m_def ** unfolding cball_def dist_norm by (auto simp add: algebra_simps) |
|
4607 |
hence "(1-e)*\<^sub>R x+ e *\<^sub>R z : S" using e_def * e1_def by auto |
|
4608 |
} hence "EX m. m>1 & (!e. (e>1 & e<=m) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S )" using `m>1` by auto |
|
4609 |
} |
|
4610 |
moreover |
|
4611 |
{ assume "x=z" def m == "1+e1" hence "m>1" using e1_def by auto |
|
4612 |
{ fix e assume e_def: "e>1 & e<=m" |
|
4613 |
hence "(1-e)*\<^sub>R x+ e *\<^sub>R z : S" |
|
4614 |
using e1_def x_def `x=z` by (auto simp add: algebra_simps) |
|
4615 |
hence "(1-e)*\<^sub>R x+ e *\<^sub>R z : S" using e_def by auto |
|
4616 |
} hence "EX m. m>1 & (!e. (e>1 & e<=m) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S )" using `m>1` by auto |
|
4617 |
} ultimately have "EX m. m>1 & (!e. (e>1 & e<=m) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S )" by auto |
|
4618 |
} from this show ?thesis by auto |
|
4619 |
qed |
|
4620 |
||
4621 |
lemma convex_rel_interior_if2: |
|
4622 |
fixes S :: "('n::euclidean_space) set" |
|
4623 |
assumes "convex S" |
|
4624 |
assumes "z : rel_interior S" |
|
4625 |
shows "(!x:affine hull S. EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S)" |
|
4626 |
using convex_rel_interior_if[of S z] assms by auto |
|
4627 |
||
4628 |
lemma convex_rel_interior_only_if: |
|
4629 |
fixes S :: "('n::euclidean_space) set" |
|
4630 |
assumes "convex S" "S ~= {}" |
|
4631 |
assumes "(!x:S. EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S)" |
|
4632 |
shows "z : rel_interior S" |
|
4633 |
proof- |
|
4634 |
obtain x where x_def: "x : rel_interior S" using rel_interior_convex_nonempty assms by auto |
|
4635 |
hence "x:S" using rel_interior_subset by auto |
|
4636 |
from this obtain e where e_def: "e>1 & (1 - e) *\<^sub>R x + e *\<^sub>R z : S" using assms by auto |
|
4637 |
def y == "(1 - e) *\<^sub>R x + e *\<^sub>R z" hence "y:S" using e_def by auto |
|
4638 |
def e1 == "1/e" hence "0<e1 & e1<1" using e_def by auto |
|
4639 |
hence "z=y-(1-e1)*\<^sub>R (y-x)" using e1_def y_def by (auto simp add: algebra_simps) |
|
4640 |
from this show ?thesis |
|
4641 |
using rel_interior_convex_shrink[of S x y "1-e1"] `0<e1 & e1<1` `y:S` x_def assms by auto |
|
4642 |
qed |
|
4643 |
||
4644 |
lemma convex_rel_interior_iff: |
|
4645 |
fixes S :: "('n::euclidean_space) set" |
|
4646 |
assumes "convex S" "S ~= {}" |
|
4647 |
shows "z : rel_interior S <-> (!x:S. EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S)" |
|
4648 |
using assms hull_subset[of S "affine"] |
|
4649 |
convex_rel_interior_if[of S z] convex_rel_interior_only_if[of S z] by auto |
|
4650 |
||
4651 |
lemma convex_rel_interior_iff2: |
|
4652 |
fixes S :: "('n::euclidean_space) set" |
|
4653 |
assumes "convex S" "S ~= {}" |
|
4654 |
shows "z : rel_interior S <-> (!x:affine hull S. EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S)" |
|
4655 |
using assms hull_subset[of S] |
|
4656 |
convex_rel_interior_if2[of S z] convex_rel_interior_only_if[of S z] by auto |
|
4657 |
||
4658 |
||
4659 |
lemma convex_interior_iff: |
|
4660 |
fixes S :: "('n::euclidean_space) set" |
|
4661 |
assumes "convex S" |
|
4662 |
shows "z : interior S <-> (!x. EX e. e>0 & z+ e *\<^sub>R x : S)" |
|
4663 |
proof- |
|
4664 |
{ assume a: "~(aff_dim S = int DIM('n))" |
|
4665 |
{ assume "z : interior S" |
|
4666 |
hence False using a interior_rel_interior_gen[of S] by auto |
|
4667 |
} |
|
4668 |
moreover |
|
4669 |
{ assume r: "!x. EX e. e>0 & z+ e *\<^sub>R x : S" |
|
4670 |
{ fix x obtain e1 where e1_def: "e1>0 & z+ e1 *\<^sub>R (x-z) : S" using r by auto |
|
4671 |
obtain e2 where e2_def: "e2>0 & z+ e2 *\<^sub>R (z-x) : S" using r by auto |
|
4672 |
def x1 == "z+ e1 *\<^sub>R (x-z)" |
|
4673 |
hence x1: "x1 : affine hull S" using e1_def hull_subset[of S] by auto |
|
4674 |
def x2 == "z+ e2 *\<^sub>R (z-x)" |
|
4675 |
hence x2: "x2 : affine hull S" using e2_def hull_subset[of S] by auto |
|
44282
f0de18b62d63
remove bounded_(bi)linear locale interpretations, to avoid duplicating so many lemmas
huffman
parents:
44170
diff
changeset
|
4676 |
have *: "e1/(e1+e2) + e2/(e1+e2) = 1" using add_divide_distrib[of e1 e2 "e1+e2"] e1_def e2_def by simp |
40377 | 4677 |
hence "z = (e2/(e1+e2)) *\<^sub>R x1 + (e1/(e1+e2)) *\<^sub>R x2" |
4678 |
using x1_def x2_def apply (auto simp add: algebra_simps) |
|
4679 |
using scaleR_left_distrib[of "e1/(e1+e2)" "e2/(e1+e2)" z] by auto |
|
4680 |
hence z: "z : affine hull S" |
|
4681 |
using mem_affine[of "affine hull S" x1 x2 "e2/(e1+e2)" "e1/(e1+e2)"] |
|
4682 |
x1 x2 affine_affine_hull[of S] * by auto |
|
4683 |
have "x1-x2 = (e1+e2) *\<^sub>R (x-z)" |
|
4684 |
using x1_def x2_def by (auto simp add: algebra_simps) |
|
4685 |
hence "x=z+(1/(e1+e2)) *\<^sub>R (x1-x2)" using e1_def e2_def by simp |
|
4686 |
hence "x : affine hull S" using mem_affine_3_minus[of "affine hull S" z x1 x2 "1/(e1+e2)"] |
|
4687 |
x1 x2 z affine_affine_hull[of S] by auto |
|
4688 |
} hence "affine hull S = UNIV" by auto |
|
4689 |
hence "aff_dim S = int DIM('n)" using aff_dim_affine_hull[of S] by (simp add: aff_dim_univ) |
|
4690 |
hence False using a by auto |
|
4691 |
} ultimately have ?thesis by auto |
|
4692 |
} |
|
4693 |
moreover |
|
4694 |
{ assume a: "aff_dim S = int DIM('n)" |
|
4695 |
hence "S ~= {}" using aff_dim_empty[of S] by auto |
|
4696 |
have *: "affine hull S=UNIV" using a affine_hull_univ by auto |
|
4697 |
{ assume "z : interior S" |
|
4698 |
hence "z : rel_interior S" using a interior_rel_interior_gen[of S] by auto |
|
4699 |
hence **: "(!x. EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S)" |
|
4700 |
using convex_rel_interior_iff2[of S z] assms `S~={}` * by auto |
|
4701 |
fix x obtain e1 where e1_def: "e1>1 & (1-e1)*\<^sub>R (z-x)+ e1 *\<^sub>R z : S" |
|
4702 |
using **[rule_format, of "z-x"] by auto |
|
4703 |
def e == "e1 - 1" |
|
4704 |
hence "(1-e1)*\<^sub>R (z-x)+ e1 *\<^sub>R z = z+ e *\<^sub>R x" by (simp add: algebra_simps) |
|
4705 |
hence "e>0 & z+ e *\<^sub>R x : S" using e1_def e_def by auto |
|
4706 |
hence "EX e. e>0 & z+ e *\<^sub>R x : S" by auto |
|
4707 |
} |
|
4708 |
moreover |
|
4709 |
{ assume r: "(!x. EX e. e>0 & z+ e *\<^sub>R x : S)" |
|
4710 |
{ fix x obtain e1 where e1_def: "e1>0 & z + e1*\<^sub>R (z-x) : S" |
|
4711 |
using r[rule_format, of "z-x"] by auto |
|
4712 |
def e == "e1 + 1" |
|
4713 |
hence "z + e1*\<^sub>R (z-x) = (1-e)*\<^sub>R x+ e *\<^sub>R z" by (simp add: algebra_simps) |
|
4714 |
hence "e > 1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S" using e1_def e_def by auto |
|
4715 |
hence "EX e. e>1 & (1-e)*\<^sub>R x+ e *\<^sub>R z : S" by auto |
|
4716 |
} |
|
4717 |
hence "z : rel_interior S" using convex_rel_interior_iff2[of S z] assms `S~={}` by auto |
|
4718 |
hence "z : interior S" using a interior_rel_interior_gen[of S] by auto |
|
4719 |
} ultimately have ?thesis by auto |
|
4720 |
} ultimately show ?thesis by auto |
|
4721 |
qed |
|
4722 |
||
44467 | 4723 |
subsubsection {* Relative interior and closure under common operations *} |
40377 | 4724 |
|
4725 |
lemma rel_interior_inter_aux: "Inter {rel_interior S |S. S : I} <= Inter I" |
|
4726 |
proof- |
|
4727 |
{ fix y assume "y : Inter {rel_interior S |S. S : I}" |
|
4728 |
hence y_def: "!S : I. y : rel_interior S" by auto |
|
4729 |
{ fix S assume "S : I" hence "y : S" using rel_interior_subset y_def by auto } |
|
4730 |
hence "y : Inter I" by auto |
|
4731 |
} thus ?thesis by auto |
|
4732 |
qed |
|
4733 |
||
4734 |
lemma closure_inter: "closure (Inter I) <= Inter {closure S |S. S : I}" |
|
4735 |
proof- |
|
4736 |
{ fix y assume "y : Inter I" hence y_def: "!S : I. y : S" by auto |
|
4737 |
{ fix S assume "S : I" hence "y : closure S" using closure_subset y_def by auto } |
|
4738 |
hence "y : Inter {closure S |S. S : I}" by auto |
|
4739 |
} hence "Inter I <= Inter {closure S |S. S : I}" by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
4740 |
moreover have "closed (Inter {closure S |S. S : I})" |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
4741 |
unfolding closed_Inter closed_closure by auto |
40377 | 4742 |
ultimately show ?thesis using closure_hull[of "Inter I"] |
4743 |
hull_minimal[of "Inter I" "Inter {closure S |S. S : I}" "closed"] by auto |
|
4744 |
qed |
|
4745 |
||
4746 |
lemma convex_closure_rel_interior_inter: |
|
4747 |
assumes "!S : I. convex (S :: ('n::euclidean_space) set)" |
|
4748 |
assumes "Inter {rel_interior S |S. S : I} ~= {}" |
|
4749 |
shows "Inter {closure S |S. S : I} <= closure (Inter {rel_interior S |S. S : I})" |
|
4750 |
proof- |
|
4751 |
obtain x where x_def: "!S : I. x : rel_interior S" using assms by auto |
|
4752 |
{ fix y assume "y : Inter {closure S |S. S : I}" hence y_def: "!S : I. y : closure S" by auto |
|
4753 |
{ assume "y = x" |
|
4754 |
hence "y : closure (Inter {rel_interior S |S. S : I})" |
|
4755 |
using x_def closure_subset[of "Inter {rel_interior S |S. S : I}"] by auto |
|
4756 |
} |
|
4757 |
moreover |
|
4758 |
{ assume "y ~= x" |
|
4759 |
{ fix e :: real assume e_def: "0 < e" |
|
4760 |
def e1 == "min 1 (e/norm (y - x))" hence e1_def: "e1>0 & e1<=1 & e1*norm(y-x)<=e" |
|
4761 |
using `y ~= x` `e>0` divide_pos_pos[of e] le_divide_eq[of e1 e "norm(y-x)"] by simp |
|
4762 |
def z == "y - e1 *\<^sub>R (y - x)" |
|
4763 |
{ fix S assume "S : I" |
|
4764 |
hence "z : rel_interior S" using rel_interior_closure_convex_shrink[of S x y e1] |
|
4765 |
assms x_def y_def e1_def z_def by auto |
|
4766 |
} hence *: "z : Inter {rel_interior S |S. S : I}" by auto |
|
4767 |
have "EX z. z:Inter {rel_interior S |S. S : I} & z ~= y & (dist z y) <= e" |
|
4768 |
apply (rule_tac x="z" in exI) using `y ~= x` z_def * e1_def e_def dist_norm[of z y] by simp |
|
4769 |
} hence "y islimpt Inter {rel_interior S |S. S : I}" unfolding islimpt_approachable_le by blast |
|
4770 |
hence "y : closure (Inter {rel_interior S |S. S : I})" unfolding closure_def by auto |
|
4771 |
} ultimately have "y : closure (Inter {rel_interior S |S. S : I})" by auto |
|
4772 |
} from this show ?thesis by auto |
|
4773 |
qed |
|
4774 |
||
4775 |
||
4776 |
lemma convex_closure_inter: |
|
4777 |
assumes "!S : I. convex (S :: ('n::euclidean_space) set)" |
|
4778 |
assumes "Inter {rel_interior S |S. S : I} ~= {}" |
|
4779 |
shows "closure (Inter I) = Inter {closure S |S. S : I}" |
|
4780 |
proof- |
|
4781 |
have "Inter {closure S |S. S : I} <= closure (Inter {rel_interior S |S. S : I})" |
|
4782 |
using convex_closure_rel_interior_inter assms by auto |
|
4783 |
moreover have "closure (Inter {rel_interior S |S. S : I}) <= closure (Inter I)" |
|
4784 |
using rel_interior_inter_aux |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4785 |
closure_mono[of "Inter {rel_interior S |S. S : I}" "Inter I"] by auto |
40377 | 4786 |
ultimately show ?thesis using closure_inter[of I] by auto |
4787 |
qed |
|
4788 |
||
4789 |
lemma convex_inter_rel_interior_same_closure: |
|
4790 |
assumes "!S : I. convex (S :: ('n::euclidean_space) set)" |
|
4791 |
assumes "Inter {rel_interior S |S. S : I} ~= {}" |
|
4792 |
shows "closure (Inter {rel_interior S |S. S : I}) = closure (Inter I)" |
|
4793 |
proof- |
|
4794 |
have "Inter {closure S |S. S : I} <= closure (Inter {rel_interior S |S. S : I})" |
|
4795 |
using convex_closure_rel_interior_inter assms by auto |
|
4796 |
moreover have "closure (Inter {rel_interior S |S. S : I}) <= closure (Inter I)" |
|
4797 |
using rel_interior_inter_aux |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4798 |
closure_mono[of "Inter {rel_interior S |S. S : I}" "Inter I"] by auto |
40377 | 4799 |
ultimately show ?thesis using closure_inter[of I] by auto |
4800 |
qed |
|
4801 |
||
4802 |
lemma convex_rel_interior_inter: |
|
4803 |
assumes "!S : I. convex (S :: ('n::euclidean_space) set)" |
|
4804 |
assumes "Inter {rel_interior S |S. S : I} ~= {}" |
|
4805 |
shows "rel_interior (Inter I) <= Inter {rel_interior S |S. S : I}" |
|
4806 |
proof- |
|
4807 |
have "convex(Inter I)" using assms convex_Inter by auto |
|
4808 |
moreover have "convex(Inter {rel_interior S |S. S : I})" apply (rule convex_Inter) |
|
4809 |
using assms convex_rel_interior by auto |
|
4810 |
ultimately have "rel_interior (Inter {rel_interior S |S. S : I}) = rel_interior (Inter I)" |
|
4811 |
using convex_inter_rel_interior_same_closure assms |
|
4812 |
closure_eq_rel_interior_eq[of "Inter {rel_interior S |S. S : I}" "Inter I"] by blast |
|
4813 |
from this show ?thesis using rel_interior_subset[of "Inter {rel_interior S |S. S : I}"] by auto |
|
4814 |
qed |
|
4815 |
||
4816 |
lemma convex_rel_interior_finite_inter: |
|
4817 |
assumes "!S : I. convex (S :: ('n::euclidean_space) set)" |
|
4818 |
assumes "Inter {rel_interior S |S. S : I} ~= {}" |
|
4819 |
assumes "finite I" |
|
4820 |
shows "rel_interior (Inter I) = Inter {rel_interior S |S. S : I}" |
|
4821 |
proof- |
|
4822 |
have "Inter I ~= {}" using assms rel_interior_inter_aux[of I] by auto |
|
4823 |
have "convex (Inter I)" using convex_Inter assms by auto |
|
4824 |
{ assume "I={}" hence ?thesis using Inter_empty rel_interior_univ2 by auto } |
|
4825 |
moreover |
|
4826 |
{ assume "I ~= {}" |
|
4827 |
{ fix z assume z_def: "z : Inter {rel_interior S |S. S : I}" |
|
4828 |
{ fix x assume x_def: "x : Inter I" |
|
4829 |
{ fix S assume S_def: "S : I" hence "z : rel_interior S" "x : S" using z_def x_def by auto |
|
4830 |
(*from this obtain e where e_def: "e>1 & (1 - e) *\<^sub>R x + e *\<^sub>R z : S"*) |
|
4831 |
hence "EX m. m>1 & (!e. (e>1 & e<=m) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S )" |
|
4832 |
using convex_rel_interior_if[of S z] S_def assms hull_subset[of S] by auto |
|
4833 |
} from this obtain mS where mS_def: "!S : I. (mS(S) > (1 :: real) & |
|
4834 |
(!e. (e>1 & e<=mS(S)) --> (1-e)*\<^sub>R x+ e *\<^sub>R z : S))" by metis |
|
4835 |
obtain e where e_def: "e=Min (mS ` I)" by auto |
|
44457
d366fa5551ef
declare euclidean_simps [simp] at the point they are proved;
huffman
parents:
44365
diff
changeset
|
4836 |
have "e : (mS ` I)" using e_def assms `I ~= {}` by simp |
40377 | 4837 |
hence "e>(1 :: real)" using mS_def by auto |
4838 |
moreover have "!S : I. e<=mS(S)" using e_def assms by auto |
|
4839 |
ultimately have "EX e>1. (1 - e) *\<^sub>R x + e *\<^sub>R z : Inter I" using mS_def by auto |
|
4840 |
} hence "z : rel_interior (Inter I)" using convex_rel_interior_iff[of "Inter I" z] |
|
4841 |
`Inter I ~= {}` `convex (Inter I)` by auto |
|
4842 |
} from this have ?thesis using convex_rel_interior_inter[of I] assms by auto |
|
4843 |
} ultimately show ?thesis by blast |
|
4844 |
qed |
|
4845 |
||
4846 |
lemma convex_closure_inter_two: |
|
4847 |
fixes S T :: "('n::euclidean_space) set" |
|
4848 |
assumes "convex S" "convex T" |
|
4849 |
assumes "(rel_interior S) Int (rel_interior T) ~= {}" |
|
4850 |
shows "closure (S Int T) = (closure S) Int (closure T)" |
|
4851 |
using convex_closure_inter[of "{S,T}"] assms by auto |
|
4852 |
||
4853 |
lemma convex_rel_interior_inter_two: |
|
4854 |
fixes S T :: "('n::euclidean_space) set" |
|
4855 |
assumes "convex S" "convex T" |
|
4856 |
assumes "(rel_interior S) Int (rel_interior T) ~= {}" |
|
4857 |
shows "rel_interior (S Int T) = (rel_interior S) Int (rel_interior T)" |
|
4858 |
using convex_rel_interior_finite_inter[of "{S,T}"] assms by auto |
|
4859 |
||
4860 |
||
4861 |
lemma convex_affine_closure_inter: |
|
4862 |
fixes S T :: "('n::euclidean_space) set" |
|
4863 |
assumes "convex S" "affine T" |
|
4864 |
assumes "(rel_interior S) Int T ~= {}" |
|
4865 |
shows "closure (S Int T) = (closure S) Int T" |
|
4866 |
proof- |
|
4867 |
have "affine hull T = T" using assms by auto |
|
4868 |
hence "rel_interior T = T" using rel_interior_univ[of T] by metis |
|
4869 |
moreover have "closure T = T" using assms affine_closed[of T] by auto |
|
4870 |
ultimately show ?thesis using convex_closure_inter_two[of S T] assms affine_imp_convex by auto |
|
4871 |
qed |
|
4872 |
||
4873 |
lemma convex_affine_rel_interior_inter: |
|
4874 |
fixes S T :: "('n::euclidean_space) set" |
|
4875 |
assumes "convex S" "affine T" |
|
4876 |
assumes "(rel_interior S) Int T ~= {}" |
|
4877 |
shows "rel_interior (S Int T) = (rel_interior S) Int T" |
|
4878 |
proof- |
|
4879 |
have "affine hull T = T" using assms by auto |
|
4880 |
hence "rel_interior T = T" using rel_interior_univ[of T] by metis |
|
4881 |
moreover have "closure T = T" using assms affine_closed[of T] by auto |
|
4882 |
ultimately show ?thesis using convex_rel_interior_inter_two[of S T] assms affine_imp_convex by auto |
|
4883 |
qed |
|
4884 |
||
4885 |
lemma subset_rel_interior_convex: |
|
4886 |
fixes S T :: "('n::euclidean_space) set" |
|
4887 |
assumes "convex S" "convex T" |
|
4888 |
assumes "S <= closure T" |
|
4889 |
assumes "~(S <= rel_frontier T)" |
|
4890 |
shows "rel_interior S <= rel_interior T" |
|
4891 |
proof- |
|
4892 |
have *: "S Int closure T = S" using assms by auto |
|
4893 |
have "~(rel_interior S <= rel_frontier T)" |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4894 |
using closure_mono[of "rel_interior S" "rel_frontier T"] closed_rel_frontier[of T] |
40377 | 4895 |
closure_closed convex_closure_rel_interior[of S] closure_subset[of S] assms by auto |
4896 |
hence "(rel_interior S) Int (rel_interior (closure T)) ~= {}" |
|
4897 |
using assms rel_frontier_def[of T] rel_interior_subset convex_rel_interior_closure[of T] by auto |
|
4898 |
hence "rel_interior S Int rel_interior T = rel_interior (S Int closure T)" using assms convex_closure |
|
4899 |
convex_rel_interior_inter_two[of S "closure T"] convex_rel_interior_closure[of T] by auto |
|
4900 |
also have "...=rel_interior (S)" using * by auto |
|
4901 |
finally show ?thesis by auto |
|
4902 |
qed |
|
4903 |
||
4904 |
||
4905 |
lemma rel_interior_convex_linear_image: |
|
4906 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
4907 |
assumes "linear f" |
|
4908 |
assumes "convex S" |
|
4909 |
shows "f ` (rel_interior S) = rel_interior (f ` S)" |
|
4910 |
proof- |
|
4911 |
{ assume "S = {}" hence ?thesis using assms rel_interior_empty rel_interior_convex_nonempty by auto } |
|
4912 |
moreover |
|
4913 |
{ assume "S ~= {}" |
|
4914 |
have *: "f ` (rel_interior S) <= f ` S" unfolding image_mono using rel_interior_subset by auto |
|
4915 |
have "f ` S <= f ` (closure S)" unfolding image_mono using closure_subset by auto |
|
4916 |
also have "... = f ` (closure (rel_interior S))" using convex_closure_rel_interior assms by auto |
|
4917 |
also have "... <= closure (f ` (rel_interior S))" using closure_linear_image assms by auto |
|
4918 |
finally have "closure (f ` S) = closure (f ` rel_interior S)" |
|
44522
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4919 |
using closure_mono[of "f ` S" "closure (f ` rel_interior S)"] closure_closure |
2f7e9d890efe
rename subset_{interior,closure} to {interior,closure}_mono;
huffman
parents:
44519
diff
changeset
|
4920 |
closure_mono[of "f ` rel_interior S" "f ` S"] * by auto |
40377 | 4921 |
hence "rel_interior (f ` S) = rel_interior (f ` rel_interior S)" using assms convex_rel_interior |
4922 |
linear_conv_bounded_linear[of f] convex_linear_image[of S] convex_linear_image[of "rel_interior S"] |
|
4923 |
closure_eq_rel_interior_eq[of "f ` S" "f ` rel_interior S"] by auto |
|
4924 |
hence "rel_interior (f ` S) <= f ` rel_interior S" using rel_interior_subset by auto |
|
4925 |
moreover |
|
4926 |
{ fix z assume z_def: "z : f ` rel_interior S" |
|
4927 |
from this obtain z1 where z1_def: "z1 : rel_interior S & (f z1 = z)" by auto |
|
4928 |
{ fix x assume "x : f ` S" |
|
4929 |
from this obtain x1 where x1_def: "x1 : S & (f x1 = x)" by auto |
|
4930 |
from this obtain e where e_def: "e>1 & (1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S" |
|
4931 |
using convex_rel_interior_iff[of S z1] `convex S` x1_def z1_def by auto |
|
4932 |
moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (1 - e) *\<^sub>R x + e *\<^sub>R z" |
|
4933 |
using x1_def z1_def `linear f` by (simp add: linear_add_cmul) |
|
4934 |
ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S" |
|
4935 |
using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto |
|
4936 |
hence "EX e. (e>1 & (1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S)" using e_def by auto |
|
4937 |
} from this have "z : rel_interior (f ` S)" using convex_rel_interior_iff[of "f ` S" z] `convex S` |
|
4938 |
`linear f` `S ~= {}` convex_linear_image[of S f] linear_conv_bounded_linear[of f] by auto |
|
4939 |
} ultimately have ?thesis by auto |
|
4940 |
} ultimately show ?thesis by blast |
|
4941 |
qed |
|
4942 |
||
4943 |
||
4944 |
lemma convex_linear_preimage: |
|
4945 |
assumes c:"convex S" and l:"bounded_linear f" |
|
4946 |
shows "convex(f -` S)" |
|
4947 |
proof(auto simp add: convex_def) |
|
4948 |
interpret f: bounded_linear f by fact |
|
4949 |
fix x y assume xy:"f x : S" "f y : S" |
|
4950 |
fix u v ::real assume uv:"0 <= u" "0 <= v" "u + v = 1" |
|
4951 |
show "f (u *\<^sub>R x + v *\<^sub>R y) : S" unfolding image_iff |
|
4952 |
using bexI[of _ "u *\<^sub>R x + v *\<^sub>R y"] f.add f.scaleR |
|
4953 |
c[unfolded convex_def] xy uv by auto |
|
4954 |
qed |
|
4955 |
||
4956 |
||
4957 |
lemma rel_interior_convex_linear_preimage: |
|
4958 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
4959 |
assumes "linear f" |
|
4960 |
assumes "convex S" |
|
4961 |
assumes "f -` (rel_interior S) ~= {}" |
|
4962 |
shows "rel_interior (f -` S) = f -` (rel_interior S)" |
|
4963 |
proof- |
|
4964 |
have "S ~= {}" using assms rel_interior_empty by auto |
|
4965 |
have nonemp: "f -` S ~= {}" by (metis assms(3) rel_interior_subset subset_empty vimage_mono) |
|
4966 |
hence "S Int (range f) ~= {}" by auto |
|
4967 |
have conv: "convex (f -` S)" using convex_linear_preimage assms linear_conv_bounded_linear by auto |
|
4968 |
hence "convex (S Int (range f))" |
|
4969 |
by (metis assms(1) assms(2) convex_Int subspace_UNIV subspace_imp_convex subspace_linear_image) |
|
4970 |
{ fix z assume "z : f -` (rel_interior S)" |
|
4971 |
hence z_def: "f z : rel_interior S" by auto |
|
4972 |
{ fix x assume "x : f -` S" from this have x_def: "f x : S" by auto |
|
4973 |
from this obtain e where e_def: "e>1 & (1-e)*\<^sub>R (f x)+ e *\<^sub>R (f z) : S" |
|
4974 |
using convex_rel_interior_iff[of S "f z"] z_def assms `S ~= {}` by auto |
|
4975 |
moreover have "(1-e)*\<^sub>R (f x)+ e *\<^sub>R (f z) = f ((1-e)*\<^sub>R x + e *\<^sub>R z)" |
|
4976 |
using `linear f` by (simp add: linear_def) |
|
4977 |
ultimately have "EX e. e>1 & (1-e)*\<^sub>R x + e *\<^sub>R z : f -` S" using e_def by auto |
|
4978 |
} hence "z : rel_interior (f -` S)" |
|
4979 |
using convex_rel_interior_iff[of "f -` S" z] conv nonemp by auto |
|
4980 |
} |
|
4981 |
moreover |
|
4982 |
{ fix z assume z_def: "z : rel_interior (f -` S)" |
|
4983 |
{ fix x assume x_def: "x: S Int (range f)" |
|
4984 |
from this obtain y where y_def: "(f y = x) & (y : f -` S)" by auto |
|
4985 |
from this obtain e where e_def: "e>1 & (1-e)*\<^sub>R y+ e *\<^sub>R z : f -` S" |
|
4986 |
using convex_rel_interior_iff[of "f -` S" z] z_def conv by auto |
|
4987 |
moreover have "(1-e)*\<^sub>R x+ e *\<^sub>R (f z) = f ((1-e)*\<^sub>R y + e *\<^sub>R z)" |
|
4988 |
using `linear f` y_def by (simp add: linear_def) |
|
4989 |
ultimately have "EX e. e>1 & (1-e)*\<^sub>R x + e *\<^sub>R (f z) : S Int (range f)" |
|
4990 |
using e_def by auto |
|
4991 |
} hence "f z : rel_interior (S Int (range f))" using `convex (S Int (range f))` |
|
4992 |
`S Int (range f) ~= {}` convex_rel_interior_iff[of "S Int (range f)" "f z"] by auto |
|
4993 |
moreover have "affine (range f)" |
|
4994 |
by (metis assms(1) subspace_UNIV subspace_imp_affine subspace_linear_image) |
|
4995 |
ultimately have "f z : rel_interior S" |
|
4996 |
using convex_affine_rel_interior_inter[of S "range f"] assms by auto |
|
4997 |
hence "z : f -` (rel_interior S)" by auto |
|
4998 |
} |
|
4999 |
ultimately show ?thesis by auto |
|
5000 |
qed |
|
5001 |
||
5002 |
||
5003 |
lemma convex_direct_sum: |
|
5004 |
fixes S :: "('n::euclidean_space) set" |
|
5005 |
fixes T :: "('m::euclidean_space) set" |
|
5006 |
assumes "convex S" "convex T" |
|
5007 |
shows "convex (S <*> T)" |
|
5008 |
proof- |
|
5009 |
{ |
|
5010 |
fix x assume "x : S <*> T" |
|
5011 |
from this obtain xs xt where xst_def: "xs : S & xt : T & (xs,xt) = x" by auto |
|
5012 |
fix y assume "y : S <*> T" |
|
5013 |
from this obtain ys yt where yst_def: "ys : S & yt : T & (ys,yt) = y" by auto |
|
5014 |
fix u v assume uv_def: "(u :: real)>=0 & (v :: real)>=0 & u+v=1" |
|
5015 |
have "u *\<^sub>R x + v *\<^sub>R y = (u *\<^sub>R xs + v *\<^sub>R ys, u *\<^sub>R xt + v *\<^sub>R yt)" using xst_def yst_def by auto |
|
5016 |
moreover have "u *\<^sub>R xs + v *\<^sub>R ys : S" |
|
5017 |
using uv_def xst_def yst_def convex_def[of S] assms by auto |
|
5018 |
moreover have "u *\<^sub>R xt + v *\<^sub>R yt : T" |
|
5019 |
using uv_def xst_def yst_def convex_def[of T] assms by auto |
|
5020 |
ultimately have "u *\<^sub>R x + v *\<^sub>R y : S <*> T" by auto |
|
5021 |
} from this show ?thesis unfolding convex_def by auto |
|
5022 |
qed |
|
5023 |
||
5024 |
||
5025 |
lemma convex_hull_direct_sum: |
|
5026 |
fixes S :: "('n::euclidean_space) set" |
|
5027 |
fixes T :: "('m::euclidean_space) set" |
|
5028 |
shows "convex hull (S <*> T) = (convex hull S) <*> (convex hull T)" |
|
5029 |
proof- |
|
5030 |
{ fix x assume "x : (convex hull S) <*> (convex hull T)" |
|
5031 |
from this obtain xs xt where xst_def: "xs : convex hull S & xt : convex hull T & (xs,xt) = x" by auto |
|
5032 |
from xst_def obtain sI su where s: "finite sI & sI <= S & (ALL x:sI. 0 <= su x) & setsum su sI = 1 |
|
5033 |
& (SUM v:sI. su v *\<^sub>R v) = xs" using convex_hull_explicit[of S] by auto |
|
5034 |
from xst_def obtain tI tu where t: "finite tI & tI <= T & (ALL x:tI. 0 <= tu x) & setsum tu tI = 1 |
|
5035 |
& (SUM v:tI. tu v *\<^sub>R v) = xt" using convex_hull_explicit[of T] by auto |
|
5036 |
def I == "(sI <*> tI)" |
|
5037 |
def u == "(%i. (su (fst i))*(tu(snd i)))" |
|
5038 |
have "fst (SUM v:sI <*> tI. (su (fst v) * tu (snd v)) *\<^sub>R v)= |
|
5039 |
(SUM vs:sI. SUM vt:tI. (su vs * tu vt) *\<^sub>R vs)" |
|
5040 |
using fst_setsum[of "(%v. (su (fst v) * tu (snd v)) *\<^sub>R v)" "sI <*> tI"] |
|
5041 |
by (simp add: split_def scaleR_prod_def setsum_cartesian_product) |
|
5042 |
also have "...=(SUM vt:tI. tu vt *\<^sub>R (SUM vs:sI. su vs *\<^sub>R vs))" |
|
5043 |
using setsum_commute[of "(%vt vs. (su vs * tu vt) *\<^sub>R vs)" sI tI] |
|
5044 |
by (simp add: mult_commute scaleR_right.setsum) |
|
5045 |
also have "...=(SUM vt:tI. tu vt *\<^sub>R xs)" using s by auto |
|
5046 |
also have "...=(SUM vt:tI. tu vt) *\<^sub>R xs" by (simp add: scaleR_left.setsum) |
|
5047 |
also have "...=xs" using t by auto |
|
5048 |
finally have h1: "fst (SUM v:sI <*> tI. (su (fst v) * tu (snd v)) *\<^sub>R v)=xs" by auto |
|
5049 |
have "snd (SUM v:sI <*> tI. (su (fst v) * tu (snd v)) *\<^sub>R v)= |
|
5050 |
(SUM vs:sI. SUM vt:tI. (su vs * tu vt) *\<^sub>R vt)" |
|
5051 |
using snd_setsum[of "(%v. (su (fst v) * tu (snd v)) *\<^sub>R v)" "sI <*> tI"] |
|
5052 |
by (simp add: split_def scaleR_prod_def setsum_cartesian_product) |
|
5053 |
also have "...=(SUM vs:sI. su vs *\<^sub>R (SUM vt:tI. tu vt *\<^sub>R vt))" |
|
5054 |
by (simp add: mult_commute scaleR_right.setsum) |
|
5055 |
also have "...=(SUM vs:sI. su vs *\<^sub>R xt)" using t by auto |
|
5056 |
also have "...=(SUM vs:sI. su vs) *\<^sub>R xt" by (simp add: scaleR_left.setsum) |
|
5057 |
also have "...=xt" using s by auto |
|
5058 |
finally have h2: "snd (SUM v:sI <*> tI. (su (fst v) * tu (snd v)) *\<^sub>R v)=xt" by auto |
|
5059 |
from h1 h2 have "(SUM v:sI <*> tI. (su (fst v) * tu (snd v)) *\<^sub>R v) = x" using xst_def by auto |
|
5060 |
||
5061 |
moreover have "finite I & (I <= S <*> T)" using s t I_def by auto |
|
5062 |
moreover have "!i:I. 0 <= u i" using s t I_def u_def by (simp add: mult_nonneg_nonneg) |
|
5063 |
moreover have "setsum u I = 1" using u_def I_def setsum_cartesian_product[of "(% x y. (su x)*(tu y))"] |
|
5064 |
s t setsum_product[of su sI tu tI] by (auto simp add: split_def) |
|
5065 |
ultimately have "x : convex hull (S <*> T)" |
|
5066 |
apply (subst convex_hull_explicit[of "S <*> T"]) apply rule |
|
5067 |
apply (rule_tac x="I" in exI) apply (rule_tac x="u" in exI) |
|
5068 |
using I_def u_def by auto |
|
5069 |
} |
|
5070 |
hence "convex hull (S <*> T) >= (convex hull S) <*> (convex hull T)" by auto |
|
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
5071 |
moreover have "convex ((convex hull S) <*> (convex hull T))" |
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
5072 |
by (simp add: convex_direct_sum convex_convex_hull) |
40377 | 5073 |
ultimately show ?thesis |
5074 |
using hull_minimal[of "S <*> T" "(convex hull S) <*> (convex hull T)" "convex"] |
|
5075 |
hull_subset[of S convex] hull_subset[of T convex] by auto |
|
5076 |
qed |
|
5077 |
||
5078 |
lemma rel_interior_direct_sum: |
|
5079 |
fixes S :: "('n::euclidean_space) set" |
|
5080 |
fixes T :: "('m::euclidean_space) set" |
|
5081 |
assumes "convex S" "convex T" |
|
5082 |
shows "rel_interior (S <*> T) = rel_interior S <*> rel_interior T" |
|
5083 |
proof- |
|
5084 |
{ assume "S={}" hence ?thesis apply auto using rel_interior_empty by auto } |
|
5085 |
moreover |
|
5086 |
{ assume "T={}" hence ?thesis apply auto using rel_interior_empty by auto } |
|
5087 |
moreover { |
|
5088 |
assume "S ~={}" "T ~={}" |
|
5089 |
hence ri: "rel_interior S ~= {}" "rel_interior T ~= {}" using rel_interior_convex_nonempty assms by auto |
|
5090 |
hence "fst -` rel_interior S ~= {}" using fst_vimage_eq_Times[of "rel_interior S"] by auto |
|
5091 |
hence "rel_interior ((fst :: 'n * 'm => 'n) -` S) = fst -` rel_interior S" |
|
5092 |
using fst_linear `convex S` rel_interior_convex_linear_preimage[of fst S] by auto |
|
5093 |
hence s: "rel_interior (S <*> (UNIV :: 'm set)) = rel_interior S <*> UNIV" by (simp add: fst_vimage_eq_Times) |
|
5094 |
from ri have "snd -` rel_interior T ~= {}" using snd_vimage_eq_Times[of "rel_interior T"] by auto |
|
5095 |
hence "rel_interior ((snd :: 'n * 'm => 'm) -` T) = snd -` rel_interior T" |
|
5096 |
using snd_linear `convex T` rel_interior_convex_linear_preimage[of snd T] by auto |
|
5097 |
hence t: "rel_interior ((UNIV :: 'n set) <*> T) = UNIV <*> rel_interior T" by (simp add: snd_vimage_eq_Times) |
|
5098 |
from s t have *: "rel_interior (S <*> (UNIV :: 'm set)) Int rel_interior ((UNIV :: 'n set) <*> T) |
|
5099 |
= rel_interior S <*> rel_interior T" by auto |
|
5100 |
have "(S <*> T) = (S <*> (UNIV :: 'm set)) Int ((UNIV :: 'n set) <*> T)" by auto |
|
5101 |
hence "rel_interior (S <*> T) = rel_interior ((S <*> (UNIV :: 'm set)) Int ((UNIV :: 'n set) <*> T))" by auto |
|
5102 |
also have "...=rel_interior (S <*> (UNIV :: 'm set)) Int rel_interior ((UNIV :: 'n set) <*> T)" |
|
5103 |
apply (subst convex_rel_interior_inter_two[of "S <*> (UNIV :: 'm set)" "(UNIV :: 'n set) <*> T"]) |
|
5104 |
using * ri assms convex_direct_sum by auto |
|
5105 |
finally have ?thesis using * by auto |
|
5106 |
} |
|
5107 |
ultimately show ?thesis by blast |
|
5108 |
qed |
|
5109 |
||
5110 |
lemma rel_interior_scaleR: |
|
5111 |
fixes S :: "('n::euclidean_space) set" |
|
5112 |
assumes "c ~= 0" |
|
5113 |
shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)" |
|
5114 |
using rel_interior_injective_linear_image[of "(op *\<^sub>R c)" S] |
|
5115 |
linear_conv_bounded_linear[of "op *\<^sub>R c"] linear_scaleR injective_scaleR[of c] assms by auto |
|
5116 |
||
5117 |
lemma rel_interior_convex_scaleR: |
|
5118 |
fixes S :: "('n::euclidean_space) set" |
|
5119 |
assumes "convex S" |
|
5120 |
shows "(op *\<^sub>R c) ` (rel_interior S) = rel_interior ((op *\<^sub>R c) ` S)" |
|
5121 |
by (metis assms linear_scaleR rel_interior_convex_linear_image) |
|
5122 |
||
5123 |
lemma convex_rel_open_scaleR: |
|
5124 |
fixes S :: "('n::euclidean_space) set" |
|
5125 |
assumes "convex S" "rel_open S" |
|
5126 |
shows "convex ((op *\<^sub>R c) ` S) & rel_open ((op *\<^sub>R c) ` S)" |
|
5127 |
by (metis assms convex_scaling rel_interior_convex_scaleR rel_open_def) |
|
5128 |
||
5129 |
||
5130 |
lemma convex_rel_open_finite_inter: |
|
5131 |
assumes "!S : I. (convex (S :: ('n::euclidean_space) set) & rel_open S)" |
|
5132 |
assumes "finite I" |
|
5133 |
shows "convex (Inter I) & rel_open (Inter I)" |
|
5134 |
proof- |
|
5135 |
{ assume "Inter {rel_interior S |S. S : I} = {}" |
|
5136 |
hence "Inter I = {}" using assms unfolding rel_open_def by auto |
|
5137 |
hence ?thesis unfolding rel_open_def using rel_interior_empty by auto |
|
5138 |
} |
|
5139 |
moreover |
|
5140 |
{ assume "Inter {rel_interior S |S. S : I} ~= {}" |
|
5141 |
hence "rel_open (Inter I)" using assms unfolding rel_open_def |
|
5142 |
using convex_rel_interior_finite_inter[of I] by auto |
|
5143 |
hence ?thesis using convex_Inter assms by auto |
|
5144 |
} ultimately show ?thesis by auto |
|
5145 |
qed |
|
5146 |
||
5147 |
lemma convex_rel_open_linear_image: |
|
5148 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
5149 |
assumes "linear f" |
|
5150 |
assumes "convex S" "rel_open S" |
|
5151 |
shows "convex (f ` S) & rel_open (f ` S)" |
|
5152 |
by (metis assms convex_linear_image rel_interior_convex_linear_image |
|
5153 |
linear_conv_bounded_linear rel_open_def) |
|
5154 |
||
5155 |
lemma convex_rel_open_linear_preimage: |
|
5156 |
fixes f :: "('m::euclidean_space) => ('n::euclidean_space)" |
|
5157 |
assumes "linear f" |
|
5158 |
assumes "convex S" "rel_open S" |
|
5159 |
shows "convex (f -` S) & rel_open (f -` S)" |
|
5160 |
proof- |
|
5161 |
{ assume "f -` (rel_interior S) = {}" |
|
5162 |
hence "f -` S = {}" using assms unfolding rel_open_def by auto |
|
5163 |
hence ?thesis unfolding rel_open_def using rel_interior_empty by auto |
|
5164 |
} |
|
5165 |
moreover |
|
5166 |
{ assume "f -` (rel_interior S) ~= {}" |
|
5167 |
hence "rel_open (f -` S)" using assms unfolding rel_open_def |
|
5168 |
using rel_interior_convex_linear_preimage[of f S] by auto |
|
5169 |
hence ?thesis using convex_linear_preimage assms linear_conv_bounded_linear by auto |
|
5170 |
} ultimately show ?thesis by auto |
|
5171 |
qed |
|
5172 |
||
5173 |
lemma rel_interior_projection: |
|
5174 |
fixes S :: "('m::euclidean_space*'n::euclidean_space) set" |
|
5175 |
fixes f :: "'m::euclidean_space => ('n::euclidean_space) set" |
|
5176 |
assumes "convex S" |
|
5177 |
assumes "f = (%y. {z. (y,z) : S})" |
|
5178 |
shows "(y,z) : rel_interior S <-> (y : rel_interior {y. (f y ~= {})} & z : rel_interior (f y))" |
|
5179 |
proof- |
|
5180 |
{ fix y assume "y : {y. (f y ~= {})}" from this obtain z where "(y,z) : S" using assms by auto |
|
5181 |
hence "EX x. x : S & y = fst x" apply (rule_tac x="(y,z)" in exI) by auto |
|
5182 |
from this obtain x where "x : S & y = fst x" by blast |
|
5183 |
hence "y : fst ` S" unfolding image_def by auto |
|
5184 |
} |
|
5185 |
hence "fst ` S = {y. (f y ~= {})}" unfolding fst_def using assms by auto |
|
5186 |
hence h1: "fst ` rel_interior S = rel_interior {y. (f y ~= {})}" |
|
5187 |
using rel_interior_convex_linear_image[of fst S] assms fst_linear by auto |
|
5188 |
{ fix y assume "y : rel_interior {y. (f y ~= {})}" |
|
5189 |
hence "y : fst ` rel_interior S" using h1 by auto |
|
5190 |
hence *: "rel_interior S Int fst -` {y} ~= {}" by auto |
|
5191 |
moreover have aff: "affine (fst -` {y})" unfolding affine_alt by (simp add: algebra_simps) |
|
5192 |
ultimately have **: "rel_interior (S Int fst -` {y}) = rel_interior S Int fst -` {y}" |
|
5193 |
using convex_affine_rel_interior_inter[of S "fst -` {y}"] assms by auto |
|
5194 |
have conv: "convex (S Int fst -` {y})" using convex_Int assms aff affine_imp_convex by auto |
|
5195 |
{ fix x assume "x : f y" |
|
5196 |
hence "(y,x) : S Int (fst -` {y})" using assms by auto |
|
5197 |
moreover have "x = snd (y,x)" by auto |
|
5198 |
ultimately have "x : snd ` (S Int fst -` {y})" by blast |
|
5199 |
} |
|
5200 |
hence "snd ` (S Int fst -` {y}) = f y" using assms by auto |
|
5201 |
hence ***: "rel_interior (f y) = snd ` rel_interior (S Int fst -` {y})" |
|
5202 |
using rel_interior_convex_linear_image[of snd "S Int fst -` {y}"] snd_linear conv by auto |
|
5203 |
{ fix z assume "z : rel_interior (f y)" |
|
5204 |
hence "z : snd ` rel_interior (S Int fst -` {y})" using *** by auto |
|
5205 |
moreover have "{y} = fst ` rel_interior (S Int fst -` {y})" using * ** rel_interior_subset by auto |
|
5206 |
ultimately have "(y,z) : rel_interior (S Int fst -` {y})" by force |
|
5207 |
hence "(y,z) : rel_interior S" using ** by auto |
|
5208 |
} |
|
5209 |
moreover |
|
5210 |
{ fix z assume "(y,z) : rel_interior S" |
|
5211 |
hence "(y,z) : rel_interior (S Int fst -` {y})" using ** by auto |
|
5212 |
hence "z : snd ` rel_interior (S Int fst -` {y})" by (metis Range_iff snd_eq_Range) |
|
5213 |
hence "z : rel_interior (f y)" using *** by auto |
|
5214 |
} |
|
5215 |
ultimately have "!!z. (y,z) : rel_interior S <-> z : rel_interior (f y)" by auto |
|
5216 |
} |
|
5217 |
hence h2: "!!y z. y : rel_interior {t. f t ~= {}} ==> ((y, z) : rel_interior S) = (z : rel_interior (f y))" |
|
5218 |
by auto |
|
5219 |
{ fix y z assume asm: "(y, z) : rel_interior S" |
|
5220 |
hence "y : fst ` rel_interior S" by (metis Domain_iff fst_eq_Domain) |
|
5221 |
hence "y : rel_interior {t. f t ~= {}}" using h1 by auto |
|
5222 |
hence "y : rel_interior {t. f t ~= {}} & (z : rel_interior (f y))" using h2 asm by auto |
|
5223 |
} from this show ?thesis using h2 by blast |
|
5224 |
qed |
|
5225 |
||
44467 | 5226 |
subsubsection {* Relative interior of convex cone *} |
40377 | 5227 |
|
5228 |
lemma cone_rel_interior: |
|
5229 |
fixes S :: "('m::euclidean_space) set" |
|
5230 |
assumes "cone S" |
|
5231 |
shows "cone ({0} Un (rel_interior S))" |
|
5232 |
proof- |
|
5233 |
{ assume "S = {}" hence ?thesis by (simp add: rel_interior_empty cone_0) } |
|
5234 |
moreover |
|
5235 |
{ assume "S ~= {}" hence *: "0:S & (!c. c>0 --> op *\<^sub>R c ` S = S)" using cone_iff[of S] assms by auto |
|
5236 |
hence *: "0:({0} Un (rel_interior S)) & |
|
5237 |
(!c. c>0 --> op *\<^sub>R c ` ({0} Un rel_interior S) = ({0} Un rel_interior S))" |
|
5238 |
by (auto simp add: rel_interior_scaleR) |
|
5239 |
hence ?thesis using cone_iff[of "{0} Un rel_interior S"] by auto |
|
5240 |
} |
|
5241 |
ultimately show ?thesis by blast |
|
5242 |
qed |
|
5243 |
||
5244 |
lemma rel_interior_convex_cone_aux: |
|
5245 |
fixes S :: "('m::euclidean_space) set" |
|
5246 |
assumes "convex S" |
|
5247 |
shows "(c,x) : rel_interior (cone hull ({(1 :: real)} <*> S)) <-> |
|
5248 |
c>0 & x : ((op *\<^sub>R c) ` (rel_interior S))" |
|
5249 |
proof- |
|
5250 |
{ assume "S={}" hence ?thesis by (simp add: rel_interior_empty cone_hull_empty) } |
|
5251 |
moreover |
|
5252 |
{ assume "S ~= {}" from this obtain s where "s : S" by auto |
|
5253 |
have conv: "convex ({(1 :: real)} <*> S)" using convex_direct_sum[of "{(1 :: real)}" S] |
|
5254 |
assms convex_singleton[of "1 :: real"] by auto |
|
5255 |
def f == "(%y. {z. (y,z) : cone hull ({(1 :: real)} <*> S)})" |
|
5256 |
hence *: "(c, x) : rel_interior (cone hull ({(1 :: real)} <*> S)) = |
|
5257 |
(c : rel_interior {y. f y ~= {}} & x : rel_interior (f c))" |
|
5258 |
apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} <*> S)" f c x]) |
|
5259 |
using convex_cone_hull[of "{(1 :: real)} <*> S"] conv by auto |
|
5260 |
{ fix y assume "(y :: real)>=0" |
|
5261 |
hence "y *\<^sub>R (1,s) : cone hull ({(1 :: real)} <*> S)" |
|
5262 |
using cone_hull_expl[of "{(1 :: real)} <*> S"] `s:S` by auto |
|
5263 |
hence "f y ~= {}" using f_def by auto |
|
5264 |
} |
|
5265 |
hence "{y. f y ~= {}} = {0..}" using f_def cone_hull_expl[of "{(1 :: real)} <*> S"] by auto |
|
5266 |
hence **: "rel_interior {y. f y ~= {}} = {0<..}" using rel_interior_real_semiline by auto |
|
5267 |
{ fix c assume "c>(0 :: real)" |
|
5268 |
hence "f c = (op *\<^sub>R c ` S)" using f_def cone_hull_expl[of "{(1 :: real)} <*> S"] by auto |
|
5269 |
hence "rel_interior (f c)= (op *\<^sub>R c ` rel_interior S)" |
|
5270 |
using rel_interior_convex_scaleR[of S c] assms by auto |
|
5271 |
} |
|
5272 |
hence ?thesis using * ** by auto |
|
5273 |
} ultimately show ?thesis by blast |
|
5274 |
qed |
|
5275 |
||
5276 |
||
5277 |
lemma rel_interior_convex_cone: |
|
5278 |
fixes S :: "('m::euclidean_space) set" |
|
5279 |
assumes "convex S" |
|
5280 |
shows "rel_interior (cone hull ({(1 :: real)} <*> S)) = |
|
5281 |
{(c,c *\<^sub>R x) |c x. c>0 & x : (rel_interior S)}" |
|
5282 |
(is "?lhs=?rhs") |
|
5283 |
proof- |
|
5284 |
{ fix z assume "z:?lhs" |
|
5285 |
have *: "z=(fst z,snd z)" by auto |
|
5286 |
have "z:?rhs" using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms `z:?lhs` apply auto |
|
5287 |
apply (rule_tac x="fst z" in exI) apply (rule_tac x="x" in exI) using * by auto |
|
5288 |
} |
|
5289 |
moreover |
|
5290 |
{ fix z assume "z:?rhs" hence "z:?lhs" |
|
5291 |
using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms by auto |
|
5292 |
} |
|
5293 |
ultimately show ?thesis by blast |
|
5294 |
qed |
|
5295 |
||
5296 |
lemma convex_hull_finite_union: |
|
5297 |
assumes "finite I" |
|
5298 |
assumes "!i:I. (convex (S i) & (S i) ~= {})" |
|
5299 |
shows "convex hull (Union (S ` I)) = |
|
5300 |
{setsum (%i. c i *\<^sub>R s i) I |c s. (!i:I. c i >= 0) & (setsum c I = 1) & (!i:I. s i : S i)}" |
|
5301 |
(is "?lhs = ?rhs") |
|
5302 |
proof- |
|
5303 |
{ fix x assume "x : ?rhs" |
|
5304 |
from this obtain c s |
|
5305 |
where *: "setsum (%i. c i *\<^sub>R s i) I=x" "(setsum c I = 1)" |
|
5306 |
"(!i:I. c i >= 0) & (!i:I. s i : S i)" by auto |
|
5307 |
hence "!i:I. s i : convex hull (Union (S ` I))" using hull_subset[of "Union (S ` I)" convex] by auto |
|
5308 |
hence "x : ?lhs" unfolding *(1)[THEN sym] |
|
5309 |
apply (subst convex_setsum[of I "convex hull Union (S ` I)" c s]) |
|
5310 |
using * assms convex_convex_hull by auto |
|
5311 |
} hence "?lhs >= ?rhs" by auto |
|
5312 |
||
5313 |
{ fix i assume "i:I" |
|
5314 |
from this assms have "EX p. p : S i" by auto |
|
5315 |
} |
|
5316 |
from this obtain p where p_def: "!i:I. p i : S i" by metis |
|
5317 |
||
5318 |
{ fix i assume "i:I" |
|
5319 |
{ fix x assume "x : S i" |
|
5320 |
def c == "(%j. if (j=i) then (1::real) else 0)" |
|
5321 |
hence *: "setsum c I = 1" using `finite I` `i:I` setsum_delta[of I i "(%(j::'a). (1::real))"] by auto |
|
5322 |
def s == "(%j. if (j=i) then x else p j)" |
|
5323 |
hence "!j. c j *\<^sub>R s j = (if (j=i) then x else 0)" using c_def by (auto simp add: algebra_simps) |
|
5324 |
hence "x = setsum (%i. c i *\<^sub>R s i) I" |
|
5325 |
using s_def c_def `finite I` `i:I` setsum_delta[of I i "(%(j::'a). x)"] by auto |
|
5326 |
hence "x : ?rhs" apply auto |
|
5327 |
apply (rule_tac x="c" in exI) |
|
5328 |
apply (rule_tac x="s" in exI) using * c_def s_def p_def `x : S i` by auto |
|
5329 |
} hence "?rhs >= S i" by auto |
|
5330 |
} hence *: "?rhs >= Union (S ` I)" by auto |
|
5331 |
||
5332 |
{ fix u v assume uv: "(u :: real)>=0 & v>=0 & u+v=1" |
|
5333 |
fix x y assume xy: "(x : ?rhs) & (y : ?rhs)" |
|
5334 |
from xy obtain c s where xc: "x=setsum (%i. c i *\<^sub>R s i) I & |
|
5335 |
(!i:I. c i >= 0) & (setsum c I = 1) & (!i:I. s i : S i)" by auto |
|
5336 |
from xy obtain d t where yc: "y=setsum (%i. d i *\<^sub>R t i) I & |
|
5337 |
(!i:I. d i >= 0) & (setsum d I = 1) & (!i:I. t i : S i)" by auto |
|
5338 |
def e == "(%i. u * (c i)+v * (d i))" |
|
5339 |
have ge0: "!i:I. e i >= 0" using e_def xc yc uv by (simp add: mult_nonneg_nonneg) |
|
5340 |
have "setsum (%i. u * c i) I = u * setsum c I" by (simp add: setsum_right_distrib) |
|
5341 |
moreover have "setsum (%i. v * d i) I = v * setsum d I" by (simp add: setsum_right_distrib) |
|
5342 |
ultimately have sum1: "setsum e I = 1" using e_def xc yc uv by (simp add: setsum_addf) |
|
5343 |
def q == "(%i. if (e i = 0) then (p i) |
|
5344 |
else (u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i))" |
|
5345 |
{ fix i assume "i:I" |
|
5346 |
{ assume "e i = 0" hence "q i : S i" using `i:I` p_def q_def by auto } |
|
5347 |
moreover |
|
5348 |
{ assume "e i ~= 0" |
|
5349 |
hence "q i : S i" using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"] |
|
5350 |
mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"] |
|
5351 |
assms q_def e_def `i:I` `e i ~= 0` xc yc uv by auto |
|
5352 |
} ultimately have "q i : S i" by auto |
|
5353 |
} hence qs: "!i:I. q i : S i" by auto |
|
5354 |
{ fix i assume "i:I" |
|
5355 |
{ assume "e i = 0" |
|
5356 |
have ge: "u * (c i) >= 0 & v * (d i) >= 0" using xc yc uv `i:I` by (simp add: mult_nonneg_nonneg) |
|
5357 |
moreover hence "u * (c i) <= 0 & v * (d i) <= 0" using `e i = 0` e_def `i:I` by simp |
|
5358 |
ultimately have "u * (c i) = 0 & v * (d i) = 0" by auto |
|
5359 |
hence "(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" |
|
5360 |
using `e i = 0` by auto |
|
5361 |
} |
|
5362 |
moreover |
|
5363 |
{ assume "e i ~= 0" |
|
5364 |
hence "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i" |
|
5365 |
using q_def by auto |
|
5366 |
hence "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i)) |
|
5367 |
= (e i) *\<^sub>R (q i)" by auto |
|
5368 |
hence "(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" |
|
5369 |
using `e i ~= 0` by (simp add: algebra_simps) |
|
5370 |
} ultimately have |
|
5371 |
"(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" by blast |
|
5372 |
} hence *: "!i:I. |
|
5373 |
(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" by auto |
|
5374 |
have "u *\<^sub>R x + v *\<^sub>R y = |
|
5375 |
setsum (%i. (u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i)) I" |
|
5376 |
using xc yc by (simp add: algebra_simps scaleR_right.setsum setsum_addf) |
|
5377 |
also have "...=setsum (%i. (e i) *\<^sub>R (q i)) I" using * by auto |
|
5378 |
finally have "u *\<^sub>R x + v *\<^sub>R y = setsum (%i. (e i) *\<^sub>R (q i)) I" by auto |
|
5379 |
hence "u *\<^sub>R x + v *\<^sub>R y : ?rhs" using ge0 sum1 qs by auto |
|
5380 |
} hence "convex ?rhs" unfolding convex_def by auto |
|
5381 |
from this show ?thesis using `?lhs >= ?rhs` * |
|
5382 |
hull_minimal[of "Union (S ` I)" "?rhs" "convex"] by blast |
|
5383 |
qed |
|
5384 |
||
5385 |
lemma convex_hull_union_two: |
|
5386 |
fixes S T :: "('m::euclidean_space) set" |
|
5387 |
assumes "convex S" "S ~= {}" "convex T" "T ~= {}" |
|
5388 |
shows "convex hull (S Un T) = {u *\<^sub>R s + v *\<^sub>R t |u v s t. u>=0 & v>=0 & u+v=1 & s:S & t:T}" |
|
5389 |
(is "?lhs = ?rhs") |
|
5390 |
proof- |
|
5391 |
def I == "{(1::nat),2}" |
|
5392 |
def s == "(%i. (if i=(1::nat) then S else T))" |
|
5393 |
have "Union (s ` I) = S Un T" using s_def I_def by auto |
|
5394 |
hence "convex hull (Union (s ` I)) = convex hull (S Un T)" by auto |
|
5395 |
moreover have "convex hull Union (s ` I) = |
|
5396 |
{SUM i:I. c i *\<^sub>R sa i |c sa. (ALL i:I. 0 <= c i) & setsum c I = 1 & (ALL i:I. sa i : s i)}" |
|
5397 |
apply (subst convex_hull_finite_union[of I s]) using assms s_def I_def by auto |
|
5398 |
moreover have |
|
5399 |
"{SUM i:I. c i *\<^sub>R sa i |c sa. (ALL i:I. 0 <= c i) & setsum c I = 1 & (ALL i:I. sa i : s i)} <= |
|
5400 |
?rhs" |
|
5401 |
using s_def I_def by auto |
|
5402 |
ultimately have "?lhs<=?rhs" by auto |
|
5403 |
{ fix x assume "x : ?rhs" |
|
5404 |
from this obtain u v s t |
|
5405 |
where *: "x=u *\<^sub>R s + v *\<^sub>R t & u>=0 & v>=0 & u+v=1 & s:S & t:T" by auto |
|
5406 |
hence "x : convex hull {s,t}" using convex_hull_2[of s t] by auto |
|
5407 |
hence "x : convex hull (S Un T)" using * hull_mono[of "{s, t}" "S Un T"] by auto |
|
5408 |
} hence "?lhs >= ?rhs" by blast |
|
5409 |
from this show ?thesis using `?lhs<=?rhs` by auto |
|
5410 |
qed |
|
5411 |
||
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5412 |
subsection {* Convexity on direct sums *} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5413 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5414 |
lemma closure_sum: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5415 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5416 |
shows "closure S \<oplus> closure T \<subseteq> closure (S \<oplus> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5417 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5418 |
have "(closure S) \<oplus> (closure T) = (\<lambda>(x,y). x + y) ` (closure S \<times> closure T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5419 |
by (simp add: set_plus_image) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5420 |
also have "... = (\<lambda>(x,y). x + y) ` closure (S \<times> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5421 |
using closure_direct_sum by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5422 |
also have "... \<subseteq> closure (S \<oplus> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5423 |
using fst_snd_linear closure_linear_image[of "(\<lambda>(x,y). x + y)" "S \<times> T"] |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5424 |
by (auto simp: set_plus_image) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5425 |
finally show ?thesis |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5426 |
by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5427 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5428 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5429 |
lemma convex_oplus: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5430 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5431 |
assumes "convex S" "convex T" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5432 |
shows "convex (S \<oplus> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5433 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5434 |
have "{x + y |x y. x : S & y : T} = {c. EX a:S. EX b:T. c = a + b}" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5435 |
thus ?thesis unfolding set_plus_def using convex_sums[of S T] assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5436 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5437 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5438 |
lemma convex_hull_sum: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5439 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5440 |
shows "convex hull (S \<oplus> T) = (convex hull S) \<oplus> (convex hull T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5441 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5442 |
have "(convex hull S) \<oplus> (convex hull T) = |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5443 |
(%(x,y). x + y) ` ((convex hull S) <*> (convex hull T))" |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5444 |
by (simp add: set_plus_image) |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5445 |
also have "... = (%(x,y). x + y) ` (convex hull (S <*> T))" using convex_hull_direct_sum by auto |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5446 |
also have "...= convex hull (S \<oplus> T)" using fst_snd_linear linear_conv_bounded_linear |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5447 |
convex_hull_linear_image[of "(%(x,y). x + y)" "S <*> T"] by (auto simp add: set_plus_image) |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5448 |
finally show ?thesis by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5449 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5450 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5451 |
lemma rel_interior_sum: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5452 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5453 |
assumes "convex S" "convex T" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5454 |
shows "rel_interior (S \<oplus> T) = (rel_interior S) \<oplus> (rel_interior T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5455 |
proof- |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5456 |
have "(rel_interior S) \<oplus> (rel_interior T) = (%(x,y). x + y) ` (rel_interior S <*> rel_interior T)" |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5457 |
by (simp add: set_plus_image) |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5458 |
also have "... = (%(x,y). x + y) ` rel_interior (S <*> T)" using rel_interior_direct_sum assms by auto |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5459 |
also have "...= rel_interior (S \<oplus> T)" using fst_snd_linear convex_direct_sum assms |
40897
1eb1b2f9d062
adapt proofs to changed set_plus_image (cf. ee8d0548c148);
hoelzl
parents:
40887
diff
changeset
|
5460 |
rel_interior_convex_linear_image[of "(%(x,y). x + y)" "S <*> T"] by (auto simp add: set_plus_image) |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5461 |
finally show ?thesis by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5462 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5463 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5464 |
lemma convex_sum_gen: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5465 |
fixes S :: "'a \<Rightarrow> 'n::euclidean_space set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5466 |
assumes "\<And>i. i \<in> I \<Longrightarrow> (convex (S i))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5467 |
shows "convex (setsum_set S I)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5468 |
proof cases |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5469 |
assume "finite I" from this assms show ?thesis |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5470 |
by induct (auto simp: convex_oplus) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5471 |
qed auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5472 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5473 |
lemma convex_hull_sum_gen: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5474 |
fixes S :: "'a => ('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5475 |
shows "convex hull (setsum_set S I) = setsum_set (%i. (convex hull (S i))) I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5476 |
apply (subst setsum_set_linear) using convex_hull_sum convex_hull_singleton by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5477 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5478 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5479 |
lemma rel_interior_sum_gen: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5480 |
fixes S :: "'a => ('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5481 |
assumes "!i:I. (convex (S i))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5482 |
shows "rel_interior (setsum_set S I) = setsum_set (%i. (rel_interior (S i))) I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5483 |
apply (subst setsum_set_cond_linear[of convex]) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5484 |
using rel_interior_sum rel_interior_sing[of "0"] assms by (auto simp add: convex_oplus) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5485 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5486 |
lemma convex_rel_open_direct_sum: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5487 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5488 |
assumes "convex S" "rel_open S" "convex T" "rel_open T" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5489 |
shows "convex (S <*> T) & rel_open (S <*> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5490 |
by (metis assms convex_direct_sum rel_interior_direct_sum rel_open_def) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5491 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5492 |
lemma convex_rel_open_sum: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5493 |
fixes S T :: "('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5494 |
assumes "convex S" "rel_open S" "convex T" "rel_open T" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5495 |
shows "convex (S \<oplus> T) & rel_open (S \<oplus> T)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5496 |
by (metis assms convex_oplus rel_interior_sum rel_open_def) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5497 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5498 |
lemma convex_hull_finite_union_cones: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5499 |
assumes "finite I" "I ~= {}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5500 |
assumes "!i:I. (convex (S i) & cone (S i) & (S i) ~= {})" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5501 |
shows "convex hull (Union (S ` I)) = setsum_set S I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5502 |
(is "?lhs = ?rhs") |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5503 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5504 |
{ fix x assume "x : ?lhs" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5505 |
from this obtain c xs where x_def: "x=setsum (%i. c i *\<^sub>R xs i) I & |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5506 |
(!i:I. c i >= 0) & (setsum c I = 1) & (!i:I. xs i : S i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5507 |
using convex_hull_finite_union[of I S] assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5508 |
def s == "(%i. c i *\<^sub>R xs i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5509 |
{ fix i assume "i:I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5510 |
hence "s i : S i" using s_def x_def assms mem_cone[of "S i" "xs i" "c i"] by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5511 |
} hence "!i:I. s i : S i" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5512 |
moreover have "x = setsum s I" using x_def s_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5513 |
ultimately have "x : ?rhs" using set_setsum_alt[of I S] assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5514 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5515 |
moreover |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5516 |
{ fix x assume "x : ?rhs" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5517 |
from this obtain s where x_def: "x=setsum s I & (!i:I. s i : S i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5518 |
using set_setsum_alt[of I S] assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5519 |
def xs == "(%i. of_nat(card I) *\<^sub>R s i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5520 |
hence "x=setsum (%i. ((1 :: real)/of_nat(card I)) *\<^sub>R xs i) I" using x_def assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5521 |
moreover have "!i:I. xs i : S i" using x_def xs_def assms by (simp add: cone_def) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5522 |
moreover have "(!i:I. (1 :: real)/of_nat(card I) >= 0)" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5523 |
moreover have "setsum (%i. (1 :: real)/of_nat(card I)) I = 1" using assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5524 |
ultimately have "x : ?lhs" apply (subst convex_hull_finite_union[of I S]) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5525 |
using assms apply blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5526 |
using assms apply blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5527 |
apply rule apply (rule_tac x="(%i. (1 :: real)/of_nat(card I))" in exI) by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5528 |
} ultimately show ?thesis by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5529 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5530 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5531 |
lemma convex_hull_union_cones_two: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5532 |
fixes S T :: "('m::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5533 |
assumes "convex S" "cone S" "S ~= {}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5534 |
assumes "convex T" "cone T" "T ~= {}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5535 |
shows "convex hull (S Un T) = S \<oplus> T" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5536 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5537 |
def I == "{(1::nat),2}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5538 |
def A == "(%i. (if i=(1::nat) then S else T))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5539 |
have "Union (A ` I) = S Un T" using A_def I_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5540 |
hence "convex hull (Union (A ` I)) = convex hull (S Un T)" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5541 |
moreover have "convex hull Union (A ` I) = setsum_set A I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5542 |
apply (subst convex_hull_finite_union_cones[of I A]) using assms A_def I_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5543 |
moreover have |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5544 |
"setsum_set A I = S \<oplus> T" using A_def I_def |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5545 |
unfolding set_plus_def apply auto unfolding set_plus_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5546 |
ultimately show ?thesis by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5547 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5548 |
|
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5549 |
lemma rel_interior_convex_hull_union: |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5550 |
fixes S :: "'a => ('n::euclidean_space) set" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5551 |
assumes "finite I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5552 |
assumes "!i:I. convex (S i) & (S i) ~= {}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5553 |
shows "rel_interior (convex hull (Union (S ` I))) = {setsum (%i. c i *\<^sub>R s i) I |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5554 |
|c s. (!i:I. c i > 0) & (setsum c I = 1) & (!i:I. s i : rel_interior(S i))}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5555 |
(is "?lhs=?rhs") |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5556 |
proof- |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5557 |
{ assume "I={}" hence ?thesis using convex_hull_empty rel_interior_empty by auto } |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5558 |
moreover |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5559 |
{ assume "I ~= {}" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5560 |
def C0 == "convex hull (Union (S ` I))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5561 |
have "!i:I. C0 >= S i" unfolding C0_def using hull_subset[of "Union (S ` I)"] by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5562 |
def K0 == "cone hull ({(1 :: real)} <*> C0)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5563 |
def K == "(%i. cone hull ({(1 :: real)} <*> (S i)))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5564 |
have "!i:I. K i ~= {}" unfolding K_def using assms by (simp add: cone_hull_empty_iff[symmetric]) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5565 |
{ fix i assume "i:I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5566 |
hence "convex (K i)" unfolding K_def apply (subst convex_cone_hull) apply (subst convex_direct_sum) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5567 |
using assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5568 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5569 |
hence convK: "!i:I. convex (K i)" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5570 |
{ fix i assume "i:I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5571 |
hence "K0 >= K i" unfolding K0_def K_def apply (subst hull_mono) using `!i:I. C0 >= S i` by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5572 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5573 |
hence "K0 >= Union (K ` I)" by auto |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
5574 |
moreover have "convex K0" unfolding K0_def |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5575 |
apply (subst convex_cone_hull) apply (subst convex_direct_sum) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5576 |
unfolding C0_def using convex_convex_hull by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5577 |
ultimately have geq: "K0 >= convex hull (Union (K ` I))" using hull_minimal[of _ "K0" "convex"] by blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5578 |
have "!i:I. K i >= {(1 :: real)} <*> (S i)" using K_def by (simp add: hull_subset) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5579 |
hence "Union (K ` I) >= {(1 :: real)} <*> Union (S ` I)" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5580 |
hence "convex hull Union (K ` I) >= convex hull ({(1 :: real)} <*> Union (S ` I))" by (simp add: hull_mono) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5581 |
hence "convex hull Union (K ` I) >= {(1 :: real)} <*> C0" unfolding C0_def |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5582 |
using convex_hull_direct_sum[of "{(1 :: real)}" "Union (S ` I)"] convex_hull_singleton by auto |
44170
510ac30f44c0
make Multivariate_Analysis work with separate set type
huffman
parents:
44142
diff
changeset
|
5583 |
moreover have "cone (convex hull(Union (K ` I)))" apply (subst cone_convex_hull) |
40887
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5584 |
using cone_Union[of "K ` I"] apply auto unfolding K_def using cone_cone_hull by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5585 |
ultimately have "convex hull (Union (K ` I)) >= K0" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5586 |
unfolding K0_def using hull_minimal[of _ "convex hull (Union (K ` I))" "cone"] by blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5587 |
hence "K0 = convex hull (Union (K ` I))" using geq by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5588 |
also have "...=setsum_set K I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5589 |
apply (subst convex_hull_finite_union_cones[of I K]) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5590 |
using assms apply blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5591 |
using `I ~= {}` apply blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5592 |
unfolding K_def apply rule |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5593 |
apply (subst convex_cone_hull) apply (subst convex_direct_sum) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5594 |
using assms cone_cone_hull `!i:I. K i ~= {}` K_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5595 |
finally have "K0 = setsum_set K I" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5596 |
hence *: "rel_interior K0 = setsum_set (%i. (rel_interior (K i))) I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5597 |
using rel_interior_sum_gen[of I K] convK by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5598 |
{ fix x assume "x : ?lhs" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5599 |
hence "((1::real),x) : rel_interior K0" using K0_def C0_def |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5600 |
rel_interior_convex_cone_aux[of C0 "(1::real)" x] convex_convex_hull by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5601 |
from this obtain k where k_def: "((1::real),x) = setsum k I & (!i:I. k i : rel_interior (K i))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5602 |
using `finite I` * set_setsum_alt[of I "(%i. rel_interior (K i))"] by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5603 |
{ fix i assume "i:I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5604 |
hence "(convex (S i)) & k i : rel_interior (cone hull {1} <*> S i)" using k_def K_def assms by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5605 |
hence "EX ci si. k i = (ci, ci *\<^sub>R si) & 0 < ci & si : rel_interior (S i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5606 |
using rel_interior_convex_cone[of "S i"] by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5607 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5608 |
from this obtain c s where cs_def: "!i:I. (k i = (c i, c i *\<^sub>R s i) & 0 < c i |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5609 |
& s i : rel_interior (S i))" by metis |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5610 |
hence "x = (SUM i:I. c i *\<^sub>R s i) & setsum c I = 1" using k_def by (simp add: setsum_prod) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5611 |
hence "x : ?rhs" using k_def apply auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5612 |
apply (rule_tac x="c" in exI) apply (rule_tac x="s" in exI) using cs_def by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5613 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5614 |
moreover |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5615 |
{ fix x assume "x : ?rhs" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5616 |
from this obtain c s where cs_def: "x=setsum (%i. c i *\<^sub>R s i) I & |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5617 |
(!i:I. c i > 0) & (setsum c I = 1) & (!i:I. s i : rel_interior(S i))" by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5618 |
def k == "(%i. (c i, c i *\<^sub>R s i))" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5619 |
{ fix i assume "i:I" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5620 |
hence "k i : rel_interior (K i)" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5621 |
using k_def K_def assms cs_def rel_interior_convex_cone[of "S i"] by auto |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5622 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5623 |
hence "((1::real),x) : rel_interior K0" |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5624 |
using K0_def * set_setsum_alt[of I "(%i. rel_interior (K i))"] assms k_def cs_def |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5625 |
apply auto apply (rule_tac x="k" in exI) by (simp add: setsum_prod) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5626 |
hence "x : ?lhs" using K0_def C0_def |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5627 |
rel_interior_convex_cone_aux[of C0 "(1::real)" x] by (auto simp add: convex_convex_hull) |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5628 |
} |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5629 |
ultimately have ?thesis by blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5630 |
} ultimately show ?thesis by blast |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5631 |
qed |
ee8d0548c148
Prove rel_interior_convex_hull_union (by Grechuck Bogdan).
hoelzl
parents:
40719
diff
changeset
|
5632 |
|
33175 | 5633 |
end |