# HG changeset patch # User wenzelm # Date 1384721172 -3600 # Node ID 2f7867850cc3005736ba561d0aff447c25d3e872 # Parent b0074321bf1418726d3c835ffcd5759a6b4c622a tuned proofs; diff -r b0074321bf14 -r 2f7867850cc3 src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Sun Nov 17 20:24:37 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Sun Nov 17 21:46:12 2013 +0100 @@ -277,13 +277,13 @@ assumes "linear f" "inj f" shows "f ` (closure S) = closure (f ` S)" proof - - obtain f' where f'_def: "linear f' \ f \ f' = id \ f' \ f = id" + obtain f' where f': "linear f' \ f \ f' = id \ f' \ f = id" using assms linear_injective_isomorphism[of f] isomorphism_expand by auto then have "f' ` closure (f ` S) \ closure (S)" using closure_linear_image[of f' "f ` S"] image_compose[of f' f] by auto then have "f ` f' ` closure (f ` S) \ f ` closure S" by auto then have "closure (f ` S) \ f ` closure S" - using image_compose[of f f' "closure (f ` S)"] f'_def by auto + using image_compose[of f f' "closure (f ` S)"] f' by auto then show ?thesis using closure_linear_image[of f S] assms by auto qed @@ -304,7 +304,7 @@ lemma snd_linear: "linear snd" unfolding linear_iff by (simp add: algebra_simps) -lemma fst_snd_linear: "linear (%(x,y). x + y)" +lemma fst_snd_linear: "linear (\(x,y). x + y)" unfolding linear_iff by (simp add: algebra_simps) lemma scaleR_2: @@ -938,18 +938,19 @@ assume assm: "affine S \ 0 \ S" { fix c :: real - fix x assume x_def: "x \ S" + fix x + assume x: "x \ S" have "c *\<^sub>R x = (1-c) *\<^sub>R 0 + c *\<^sub>R x" by auto moreover have "(1 - c) *\<^sub>R 0 + c *\<^sub>R x \ S" - using affine_alt[of S] assm x_def by auto + using affine_alt[of S] assm x by auto ultimately have "c *\<^sub>R x \ S" by auto } then have h1: "\c. \x \ S. c *\<^sub>R x \ S" by auto { fix x y - assume xy_def: "x \ S" "y \ S" + assume xy: "x \ S" "y \ S" def u == "(1 :: real)/2" have "(1/2) *\<^sub>R (x+y) = (1/2) *\<^sub>R (x+y)" by auto @@ -957,16 +958,16 @@ have "(1/2) *\<^sub>R (x+y)=(1/2) *\<^sub>R x + (1-(1/2)) *\<^sub>R y" by (simp add: algebra_simps) moreover - have "(1-u) *\<^sub>R x + u *\<^sub>R y \ S" - using affine_alt[of S] assm xy_def by auto + have "(1 - u) *\<^sub>R x + u *\<^sub>R y \ S" + using affine_alt[of S] assm xy by auto ultimately have "(1/2) *\<^sub>R (x+y) \ S" using u_def by auto moreover - have "(x+y) = 2 *\<^sub>R ((1/2) *\<^sub>R (x+y))" + have "x + y = 2 *\<^sub>R ((1/2) *\<^sub>R (x+y))" by auto ultimately - have "(x+y) \ S" + have "x + y \ S" using h1[rule_format, of "(1/2) *\<^sub>R (x+y)" "2"] by auto } then have "\x \ S. \y \ S. x + y \ S" @@ -990,13 +991,14 @@ qed lemma parallel_subspace_explicit: - assumes "affine S" "a : S" - assumes "L \ {y. \x \ S. (-a)+x=y}" - shows "subspace L & affine_parallel S L" + assumes "affine S" + and "a \ S" + assumes "L \ {y. \x \ S. (-a) + x = y}" + shows "subspace L \ affine_parallel S L" proof - from assms have "L = plus (- a) ` S" by auto then have par: "affine_parallel S L" - unfolding affine_parallel_def .. + unfolding affine_parallel_def .. then have "affine L" using assms parallel_is_affine by auto moreover have "0 \ L" using assms by auto @@ -1010,14 +1012,14 @@ and "affine_parallel A B" shows "A \ B" proof - - from assms obtain a where a_def: "\x. x \ A \ a + x \ B" + from assms obtain a where a: "\x. x \ A \ a + x \ B" using affine_parallel_expl[of A B] by auto then have "-a \ A" using assms subspace_0[of B] by auto then have "a \ A" using assms subspace_neg[of A "-a"] by auto then show ?thesis - using assms a_def unfolding subspace_def by auto + using assms a unfolding subspace_def by auto qed lemma parallel_subspace: @@ -1116,7 +1118,7 @@ then have "x \ (op *\<^sub>R c) ` S" unfolding image_def using `cone S` `c>0` mem_cone[of S x "1/c"] - exI[of "(%t. t:S & x = c *\<^sub>R t)" "(1 / c) *\<^sub>R x"] + exI[of "(\t. t \ S \ x = c *\<^sub>R t)" "(1 / c) *\<^sub>R x"] by auto } moreover @@ -1169,17 +1171,17 @@ { fix x assume "x \ ?rhs" - then obtain cx :: real and xx where x_def: "x = cx *\<^sub>R xx" "cx \ 0" "xx \ S" + then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \ 0" "xx \ S" by auto fix c :: real assume c: "c \ 0" then have "c *\<^sub>R x = (c * cx) *\<^sub>R xx" - using x_def by (simp add: algebra_simps) + using x by (simp add: algebra_simps) moreover have "c * cx \ 0" - using c x_def using mult_nonneg_nonneg by auto + using c x using mult_nonneg_nonneg by auto ultimately - have "c *\<^sub>R x \ ?rhs" using x_def by auto + have "c *\<^sub>R x \ ?rhs" using x by auto } then have "cone ?rhs" unfolding cone_def by auto @@ -1202,12 +1204,12 @@ { fix x assume "x \ ?rhs" - then obtain cx :: real and xx where x_def: "x = cx *\<^sub>R xx" "cx \ 0" "xx \ S" + then obtain cx :: real and xx where x: "x = cx *\<^sub>R xx" "cx \ 0" "xx \ S" by auto then have "xx \ cone hull S" using hull_subset[of S] by auto then have "x \ ?lhs" - using x_def cone_cone_hull[of S] cone_def[of "cone hull S"] by auto + using x cone_cone_hull[of S] cone_def[of "cone hull S"] by auto } ultimately show ?thesis by auto qed @@ -2398,27 +2400,27 @@ by (metis hull_minimal) then have "affine hull ((\x. a + x) ` S) >= (\x. a + x) ` (affine hull S)" by auto - from this show ?thesis using h1 by auto + then show ?thesis using h1 by auto qed lemma affine_dependent_translation: assumes "affine_dependent S" shows "affine_dependent ((\x. a + x) ` S)" proof - - obtain x where x_def: "x \ S \ x \ affine hull (S - {x})" + obtain x where x: "x \ S \ x \ affine hull (S - {x})" using assms affine_dependent_def by auto have "op + a ` (S - {x}) = op + a ` S - {a + x}" by auto then have "a + x \ affine hull ((\x. a + x) ` S - {a + x})" - using affine_hull_translation[of a "S - {x}"] x_def by auto + using affine_hull_translation[of a "S - {x}"] x by auto moreover have "a + x \ (\x. a + x) ` S" - using x_def by auto + using x by auto ultimately show ?thesis unfolding affine_dependent_def by auto qed lemma affine_dependent_translation_eq: - "affine_dependent S <-> affine_dependent ((\x. a + x) ` S)" + "affine_dependent S \ affine_dependent ((\x. a + x) ` S)" proof - { assume "affine_dependent ((\x. a + x) ` S)" @@ -2434,12 +2436,12 @@ assumes "0 \ affine hull S" shows "dependent S" proof - - obtain s u where s_u_def: "finite s \ s \ {} \ s \ S \ setsum u s = 1 \ (\v\s. u v *\<^sub>R v) = 0" + obtain s u where s_u: "finite s \ s \ {} \ s \ S \ setsum u s = 1 \ (\v\s. u v *\<^sub>R v) = 0" using assms affine_hull_explicit[of S] by auto then have "\v\s. u v \ 0" using setsum_not_0[of "u" "s"] by auto then have "finite s \ s \ S \ (\v\s. u v \ 0 \ (\v\s. u v *\<^sub>R v) = 0)" - using s_u_def by auto + using s_u by auto then show ?thesis unfolding dependent_explicit[of S] by auto qed @@ -2448,7 +2450,7 @@ assumes "affine_dependent (insert 0 S)" shows "dependent S" proof - - obtain x where x_def: "x \ insert 0 S \ x \ affine hull (insert 0 S - {x})" + obtain x where x: "x \ insert 0 S \ x \ affine hull (insert 0 S - {x})" using affine_dependent_def[of "(insert 0 S)"] assms by blast then have "x \ span (insert 0 S - {x})" using affine_hull_subset_span by auto @@ -2456,12 +2458,12 @@ using insert_Diff_if[of "0" S "{x}"] span_insert_0[of "S-{x}"] by auto ultimately have "x \ span (S - {x})" by auto then have "x \ 0 \ dependent S" - using x_def dependent_def by auto + using x dependent_def by auto moreover { assume "x = 0" then have "0 \ affine hull S" - using x_def hull_mono[of "S - {0}" S] by auto + using x hull_mono[of "S - {0}" S] by auto then have "dependent S" using affine_hull_0_dependent by auto } @@ -2549,11 +2551,11 @@ assumes "\ affine_dependent S" "S \ V" "S \ {}" shows "\T. \ affine_dependent T \ S \ T \ T \ V \ affine hull T = affine hull V" proof - - obtain a where a_def: "a \ S" + obtain a where a: "a \ S" using assms by auto then have h0: "independent ((\x. -a + x) ` (S-{a}))" using affine_dependent_iff_dependent2 assms by auto - then obtain B where B_def: + then obtain B where B: "(\x. -a+x) ` (S - {a}) \ B \ B \ (\x. -a+x) ` V \ independent B \ (\x. -a+x) ` V \ span B" using maximal_independent_subset_extend[of "(\x. -a+x) ` (S-{a})" "(\x. -a + x) ` V"] assms by blast @@ -2564,18 +2566,18 @@ using affine_hull_insert_span_gen[of a "((\x. a+x) ` B)"] translation_assoc[of "-a" a B] by auto then have "V \ affine hull T" - using B_def assms translation_inverse_subset[of a V "span B"] + using B assms translation_inverse_subset[of a V "span B"] by auto moreover have "T \ V" - using T_def B_def a_def assms by auto + using T_def B a assms by auto ultimately have "affine hull T = affine hull V" by (metis Int_absorb1 Int_absorb2 hull_hull hull_mono) moreover have "S \ T" - using T_def B_def translation_inverse_subset[of a "S-{a}" B] + using T_def B translation_inverse_subset[of a "S-{a}" B] by auto moreover have "\ affine_dependent T" using T_def affine_dependent_translation_eq[of "insert 0 B"] - affine_dependent_imp_dependent2 B_def + affine_dependent_imp_dependent2 B by auto ultimately show ?thesis using `T \ V` by auto qed @@ -2670,31 +2672,31 @@ shows "aff_dim V = int (dim L)" proof - obtain B where - B_def: "affine hull B = affine hull V \ \ affine_dependent B \ int (card B) = aff_dim V + 1" + B: "affine hull B = affine hull V \ \ affine_dependent B \ int (card B) = aff_dim V + 1" using aff_dim_basis_exists by auto then have "B \ {}" - using assms B_def affine_hull_nonempty[of V] affine_hull_nonempty[of B] + using assms B affine_hull_nonempty[of V] affine_hull_nonempty[of B] by auto - then obtain a where a_def: "a \ B" by auto + then obtain a where a: "a \ B" by auto def Lb \ "span ((\x. -a+x) ` (B-{a}))" moreover have "affine_parallel (affine hull B) Lb" - using Lb_def B_def assms affine_hull_span2[of a B] a_def + using Lb_def B assms affine_hull_span2[of a B] a affine_parallel_commut[of "Lb" "(affine hull B)"] unfolding affine_parallel_def by auto moreover have "subspace Lb" using Lb_def subspace_span by auto moreover have "affine hull B \ {}" - using assms B_def affine_hull_nonempty[of V] by auto + using assms B affine_hull_nonempty[of V] by auto ultimately have "L = Lb" - using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B_def + using assms affine_parallel_subspace[of "affine hull B"] affine_affine_hull[of B] B by auto then have "dim L = dim Lb" by auto moreover have "card B - 1 = dim Lb" and "finite B" - using Lb_def aff_dim_parallel_subspace_aux a_def B_def by auto + using Lb_def aff_dim_parallel_subspace_aux a B by auto ultimately show ?thesis - using B_def `B \ {}` card_gt_0_iff[of B] by auto + using B `B \ {}` card_gt_0_iff[of B] by auto qed lemma aff_independent_finite: @@ -2782,7 +2784,7 @@ defer unfolding dim_span[of B] apply(rule B) - unfolding span_substd_basis[OF d, symmetric] + unfolding span_substd_basis[OF d, symmetric] apply (rule span_inc) apply (rule independent_substdbasis[OF d]) apply rule @@ -2831,10 +2833,10 @@ using `B = {}` by auto next case False - then obtain a where a_def: "a \ B" by auto + then obtain a where a: "a \ B" by auto def Lb \ "span ((\x. -a+x) ` (B-{a}))" have "affine_parallel (affine hull B) Lb" - using Lb_def affine_hull_span2[of a B] a_def + using Lb_def affine_hull_span2[of a B] a affine_parallel_commut[of "Lb" "(affine hull B)"] unfolding affine_parallel_def by auto moreover have "subspace Lb" @@ -2842,7 +2844,7 @@ ultimately have "aff_dim B = int(dim Lb)" using aff_dim_parallel_subspace[of B Lb] `B \ {}` by auto moreover have "(card B) - 1 = dim Lb" "finite B" - using Lb_def aff_dim_parallel_subspace_aux a_def assms by auto + using Lb_def aff_dim_parallel_subspace_aux a assms by auto ultimately have "of_nat (card B) = aff_dim B + 1" using `B \ {}` card_gt_0_iff[of B] by auto then show ?thesis @@ -3171,8 +3173,8 @@ assume *: "x \ S" "open T" "x \ T" "T \ affine hull S \ S" then have **: "x \ T \ affine hull S" using hull_inc by auto - show "\Tb. (\Ta. open Ta \ Tb = affine hull S Int Ta) \ x \ Tb \ Tb \ S" - apply (rule_tac x="T Int (affine hull S)" in exI) + show "\Tb. (\Ta. open Ta \ Tb = affine hull S \ Ta) \ x \ Tb \ Tb \ S" + apply (rule_tac x = "T \ (affine hull S)" in exI) using * ** apply auto done @@ -3287,7 +3289,7 @@ and "e \ 1" shows "x - e *\<^sub>R (x - c) \ rel_interior S" proof - - obtain d where "d > 0" and d: "ball c d Int affine hull S \ S" + obtain d where "d > 0" and d: "ball c d \ affine hull S \ S" using assms(2) unfolding mem_rel_interior_ball by auto { fix y @@ -3657,7 +3659,7 @@ { fix x assume x: "x \ rel_interior S" - then obtain e2 where e2: "e2 > 0" "cball x e2 Int affine hull S \ S" + then obtain e2 where e2: "e2 > 0" "cball x e2 \ affine hull S \ S" using rel_interior_cball[of S] by auto have "x \ S" using x rel_interior_subset by auto then have *: "f x \ f ` S" by auto @@ -3786,7 +3788,7 @@ moreover from `x\t` have "x \ s" using obt(2) by auto ultimately have "x + (y - a) \ s" - using y and b[THEN bspec[where x=x]] unfolding subset_eq by fast + using y and b[THEN bspec[where x=x]] unfolding subset_eq by fast } moreover have *: "inj_on (\v. v + (y - a)) t" @@ -4756,7 +4758,8 @@ then show ?thesis by auto next case False - then have *: "0 \ S & (!c. c>0 --> op *\<^sub>R c ` S = S)" using cone_iff[of S] assms by auto + then have *: "0 \ S \ (\c. c > 0 \ op *\<^sub>R c ` S = S)" + using cone_iff[of S] assms by auto { fix c :: real assume "c > 0" @@ -4784,7 +4787,7 @@ unfolding Inter_iff Ball_def mem_Collect_eq apply (rule,rule,erule conjE) proof - - fix x + fix x assume "\xa. s \ xa \ (\a b. xa = {x. inner a x \ b}) \ x \ xa" then have "\a b. s \ {x. inner a x \ b} \ x \ {x. inner a x \ b}" by blast @@ -5675,28 +5678,55 @@ "is_interval (s::real set) \ (\a\s. \b\s. \ x. a \ x \ x \ b \ x \ s)" unfolding is_interval_def by auto -lemma is_interval_connected_1: "is_interval s \ connected (s::real set)" - apply(rule, rule is_interval_connected, assumption) unfolding is_interval_1 - apply(rule,rule,rule,rule,erule conjE,rule ccontr) proof- - fix a b x assume as:"connected s" "a \ s" "b \ s" "a \ x" "x \ b" "x\s" - hence *:"a < x" "x < b" unfolding not_le [symmetric] by auto - let ?halfl = "{.. s" with `x \ s` have "x \ y" by auto - then have "y \ ?halfr \ ?halfl" by auto } - moreover have "a\?halfl" "b\?halfr" using * by auto - hence "?halfl \ s \ {}" "?halfr \ s \ {}" using as(2-3) by auto - ultimately show False apply(rule_tac notE[OF as(1)[unfolded connected_def]]) - apply(rule_tac x="?halfl" in exI, rule_tac x="?halfr" in exI) - apply(rule, rule open_lessThan, rule, rule open_greaterThan) - by auto qed +lemma is_interval_connected_1: + fixes s :: "real set" + shows "is_interval s \ connected s" + apply rule + apply (rule is_interval_connected, assumption) + unfolding is_interval_1 + apply rule + apply rule + apply rule + apply rule + apply (erule conjE) + apply (rule ccontr) +proof - + fix a b x + assume as: "connected s" "a \ s" "b \ s" "a \ x" "x \ b" "x \ s" + then have *: "a < x" "x < b" + unfolding not_le [symmetric] by auto + let ?halfl = "{.. s" + with `x \ s` have "x \ y" by auto + then have "y \ ?halfr \ ?halfl" by auto + } + moreover have "a \ ?halfl" "b \ ?halfr" using * by auto + then have "?halfl \ s \ {}" "?halfr \ s \ {}" + using as(2-3) by auto + ultimately show False + apply (rule_tac notE[OF as(1)[unfolded connected_def]]) + apply (rule_tac x = ?halfl in exI) + apply (rule_tac x = ?halfr in exI) + apply rule + apply (rule open_lessThan) + apply rule + apply (rule open_greaterThan) + apply auto + done +qed lemma is_interval_convex_1: - "is_interval s \ convex (s::real set)" -by(metis is_interval_convex convex_connected is_interval_connected_1) + fixes s :: "real set" + shows "is_interval s \ convex s" + by (metis is_interval_convex convex_connected is_interval_connected_1) lemma convex_connected_1: - "connected s \ convex (s::real set)" -by(metis is_interval_convex convex_connected is_interval_connected_1) + fixes s :: "real set" + shows "connected s \ convex s" + by (metis is_interval_convex convex_connected is_interval_connected_1) subsection {* Another intermediate value theorem formulation *} @@ -6604,7 +6634,7 @@ lemma substd_simplex: assumes d: "d \ Basis" shows "convex hull (insert 0 d) = - {x. (\i\Basis. 0 \ x\i) \ (\i\d. x\i) \ 1 \ (\i\Basis. i \ d --> x\i = 0)}" + {x. (\i\Basis. 0 \ x\i) \ (\i\d. x\i) \ 1 \ (\i\Basis. i \ d \ x\i = 0)}" (is "convex hull (insert 0 ?p) = ?s") proof - let ?D = d @@ -6613,7 +6643,7 @@ from d have "finite d" by (blast intro: finite_subset finite_Basis) show ?thesis - unfolding simplex[OF `finite d` `0 ~: ?p`] + unfolding simplex[OF `finite d` `0 \ ?p`] apply (rule set_eqI) unfolding mem_Collect_eq apply rule @@ -6624,7 +6654,7 @@ fix u assume as: "\x\?D. 0 \ u x" "setsum u ?D \ 1" "(\x\?D. u x *\<^sub>R x) = x" have *: "\i\Basis. i:d \ u i = x\i" - and "(\i\Basis. i ~: d --> x \ i = 0)" + and "(\i\Basis. i \ d \ x \ i = 0)" using as(3) unfolding substdbasis_expansion_unique[OF assms] by auto @@ -6838,8 +6868,9 @@ unfolding ball_def unfolding substd_simplex[OF assms] using assms by auto have x0: "(\i\Basis. i \ d \ x\i = 0)" using x rel_interior_subset substd_simplex[OF assms] by auto - have "(\i\d. 0 < x \ i) \ setsum (op \ x) d < 1 \ (\i\Basis. i \ d --> x\i = 0)" - apply (rule, rule) + have "(\i\d. 0 < x \ i) \ setsum (op \ x) d < 1 \ (\i\Basis. i \ d \ x\i = 0)" + apply rule + apply rule proof - fix i :: 'a assume "i \ d" @@ -6891,7 +6922,7 @@ by auto moreover have "\i. i \ d \ i \ d" by auto ultimately - have "\i. (\i\d. 0 < x\i) \ (\i. i \ d \ x\i = 0) --> 0 \ x\i" + have "\i. (\i\d. 0 < x\i) \ (\i. i \ d \ x\i = 0) \ 0 \ x\i" by metis then have h2: "x \ convex hull (insert 0 ?p)" using as assms @@ -6908,7 +6939,7 @@ using as using `0 < card d` by auto ultimately have h3: "min (Min ((op \ x) ` d)) ?d > 0" by auto - + have "x \ rel_interior (convex hull (insert 0 ?p))" unfolding rel_interior_ball mem_Collect_eq h0 apply (rule,rule h2) @@ -6940,7 +6971,7 @@ using `0 < card d` by auto finally show "setsum (op \ y) d \ 1" . - + fix i :: 'a assume i: "i \ Basis" then show "0 \ y\i" @@ -7280,7 +7311,7 @@ moreover { fix z - assume z: "z : rel_interior (closure S)" + assume z: "z \ rel_interior (closure S)" obtain x where x: "x \ rel_interior S" using `S \ {}` assms rel_interior_convex_nonempty by auto have "z \ rel_interior S" @@ -7289,7 +7320,7 @@ then show ?thesis using x by auto next case False - obtain e where e: "e > 0" "cball z e Int affine hull closure S \ closure S" + obtain e where e: "e > 0" "cball z e \ affine hull closure S \ closure S" using z rel_interior_cball[of "closure S"] by auto then have *: "0 < e/norm(z-x)" using e False divide_pos_pos[of e "norm(z-x)"] by auto @@ -7338,7 +7369,7 @@ assumes "convex S1" and "convex S2" shows "closure S1 = closure S2 \ rel_interior S1 \ S2 \ S2 \ closure S1" - (is "?A <-> ?B") + (is "?A \ ?B") proof assume ?A then show ?B @@ -7422,7 +7453,7 @@ using mem_rel_interior[of a S1] a by auto then have "a \ T \ closure S2" using a assms unfolding rel_frontier_def by auto - then obtain b where b: "b \ T Int rel_interior S2" + then obtain b where b: "b \ T \ rel_interior S2" using open_inter_closure_rel_interior[of S2 T] assms T by auto then have "b \ affine hull S1" using rel_interior_subset hull_subset[of S2] ** by auto @@ -7442,12 +7473,13 @@ and "z \ rel_interior S" shows "\x\affine hull S. \m. m > 1 \ (\e. e > 1 \ e \ m \ (1 - e) *\<^sub>R x + e *\<^sub>R z \ S)" proof - - obtain e1 where e1: "e1>0 & cball z e1 Int affine hull S <= S" - using mem_rel_interior_cball[of z S] assms by auto + obtain e1 where e1: "e1 > 0 \ cball z e1 \ affine hull S \ S" + using mem_rel_interior_cball[of z S] assms by auto { fix x assume x: "x \ affine hull S" - { assume "x ~= z" + { + assume "x \ z" def m \ "1 + e1/norm(x-z)" then have "m > 1" using e1 `x \ z` divide_pos_pos[of e1 "norm (x - z)"] by auto @@ -7568,18 +7600,18 @@ assume r: "\x. \e. e > 0 \ z + e *\<^sub>R x \ S" { fix x - obtain e1 where e1_def: "e1 > 0 \ z + e1 *\<^sub>R (x - z) \ S" + obtain e1 where e1: "e1 > 0 \ z + e1 *\<^sub>R (x - z) \ S" using r by auto - obtain e2 where e2_def: "e2 > 0 \ z + e2 *\<^sub>R (z - x) \ S" + obtain e2 where e2: "e2 > 0 \ z + e2 *\<^sub>R (z - x) \ S" using r by auto def x1 \ "z + e1 *\<^sub>R (x - z)" then have x1: "x1 \ affine hull S" - using e1_def hull_subset[of S] by auto + using e1 hull_subset[of S] by auto def x2 \ "z + e2 *\<^sub>R (z - x)" then have x2: "x2 \ affine hull S" - using e2_def hull_subset[of S] by auto + using e2 hull_subset[of S] by auto have *: "e1/(e1+e2) + e2/(e1+e2) = 1" - using add_divide_distrib[of e1 e2 "e1+e2"] e1_def e2_def by simp + using add_divide_distrib[of e1 e2 "e1+e2"] e1 e2 by simp then have "z = (e2/(e1+e2)) *\<^sub>R x1 + (e1/(e1+e2)) *\<^sub>R x2" using x1_def x2_def apply (auto simp add: algebra_simps) @@ -7593,7 +7625,7 @@ have "x1 - x2 = (e1 + e2) *\<^sub>R (x - z)" using x1_def x2_def by (auto simp add: algebra_simps) then have "x = z+(1/(e1+e2)) *\<^sub>R (x1-x2)" - using e1_def e2_def by simp + using e1 e2 by simp then have "x \ affine hull S" using mem_affine_3_minus[of "affine hull S" z x1 x2 "1/(e1+e2)"] x1 x2 z affine_affine_hull[of S] @@ -7690,9 +7722,9 @@ } then have "\I \ \{closure S |S. S \ I}" by auto - moreover have "closed (Inter {closure S |S. S \ I})" + moreover have "closed (\{closure S |S. S \ I})" unfolding closed_Inter closed_closure by auto - ultimately show ?thesis using closure_hull[of "Inter I"] + ultimately show ?thesis using closure_hull[of "\I"] hull_minimal[of "\I" "\{closure S |S. S \ I}" "closed"] by auto qed @@ -7711,7 +7743,7 @@ { assume "y = x" then have "y \ closure (\{rel_interior S |S. S \ I})" - using x closure_subset[of "Inter {rel_interior S |S. S \ I}"] by auto + using x closure_subset[of "\{rel_interior S |S. S \ I}"] by auto } moreover { @@ -7753,13 +7785,13 @@ lemma convex_closure_inter: assumes "\S\I. convex (S :: 'n::euclidean_space set)" and "\{rel_interior S |S. S \ I} \ {}" - shows "closure (Inter I) = Inter {closure S |S. S \ I}" + shows "closure (\I) = \{closure S |S. S \ I}" proof - have "\{closure S |S. S \ I} \ closure (\{rel_interior S |S. S \ I})" using convex_closure_rel_interior_inter assms by auto moreover - have "closure (Inter {rel_interior S |S. S \ I}) \ closure (Inter I)" - using rel_interior_inter_aux closure_mono[of "Inter {rel_interior S |S. S \ I}" "\I"] + have "closure (\{rel_interior S |S. S \ I}) \ closure (\ I)" + using rel_interior_inter_aux closure_mono[of "\{rel_interior S |S. S \ I}" "\I"] by auto ultimately show ?thesis using closure_inter[of I] by auto @@ -7768,13 +7800,13 @@ lemma convex_inter_rel_interior_same_closure: assumes "\S\I. convex (S :: 'n::euclidean_space set)" and "\{rel_interior S |S. S \ I} \ {}" - shows "closure (Inter {rel_interior S |S. S \ I}) = closure (\I)" + shows "closure (\{rel_interior S |S. S \ I}) = closure (\I)" proof - have "\{closure S |S. S \ I} \ closure (\{rel_interior S |S. S \ I})" using convex_closure_rel_interior_inter assms by auto moreover have "closure (\{rel_interior S |S. S \ I}) \ closure (\I)" - using rel_interior_inter_aux closure_mono[of "Inter {rel_interior S |S. S \ I}" "\I"] + using rel_interior_inter_aux closure_mono[of "\{rel_interior S |S. S \ I}" "\I"] by auto ultimately show ?thesis using closure_inter[of I] by auto @@ -7783,12 +7815,12 @@ lemma convex_rel_interior_inter: assumes "\S\I. convex (S :: 'n::euclidean_space set)" and "\{rel_interior S |S. S \ I} \ {}" - shows "rel_interior (Inter I) \ Inter {rel_interior S |S. S \ I}" + shows "rel_interior (\I) \ \{rel_interior S |S. S \ I}" proof - have "convex (\I)" using assms convex_Inter by auto moreover - have "convex(Inter {rel_interior S |S. S \ I})" + have "convex (\{rel_interior S |S. S \ I})" apply (rule convex_Inter) using assms convex_rel_interior apply auto @@ -7968,18 +8000,18 @@ fix x assume "x \ f ` S" then obtain x1 where x1: "x1 \ S" "f x1 = x" by auto - then obtain e where e_def: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S" + then obtain e where e: "e > 1" "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1 : S" using convex_rel_interior_iff[of S z1] `convex S` x1 z1 by auto moreover have "f ((1 - e) *\<^sub>R x1 + e *\<^sub>R z1) = (1 - e) *\<^sub>R x + e *\<^sub>R z" using x1 z1 `linear f` by (simp add: linear_add_cmul) ultimately have "(1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S" using imageI[of "(1 - e) *\<^sub>R x1 + e *\<^sub>R z1" S f] by auto then have "\e. e > 1 \ (1 - e) *\<^sub>R x + e *\<^sub>R z : f ` S" - using e_def by auto + using e by auto } then have "z \ rel_interior (f ` S)" using convex_rel_interior_iff[of "f ` S" z] `convex S` - `linear f` `S ~= {}` convex_linear_image[of f S] linear_conv_bounded_linear[of f] + `linear f` `S \ {}` convex_linear_image[of f S] linear_conv_bounded_linear[of f] by auto } ultimately show ?thesis by auto @@ -8022,7 +8054,7 @@ using convex_rel_interior_iff[of "f -` S" z] conv nonemp by auto } moreover - { + { fix z assume z: "z \ rel_interior (f -` S)" { @@ -8037,7 +8069,7 @@ using e by auto } then have "f z \ rel_interior (S \ range f)" - using `convex (S Int (range f))` `S \ range f \ {}` + using `convex (S \ (range f))` `S \ range f \ {}` convex_rel_interior_iff[of "S \ (range f)" "f z"] by auto moreover have "affine (range f)" @@ -8132,7 +8164,7 @@ assumes "\S\I. convex (S :: 'n::euclidean_space set) \ rel_open S" and "finite I" shows "convex (\I) \ rel_open (\I)" -proof (cases "Inter {rel_interior S |S. S : I} = {}") +proof (cases "\{rel_interior S |S. S \ I} = {}") case True then have "\I = {}" using assms unfolding rel_open_def by auto @@ -8140,7 +8172,7 @@ unfolding rel_open_def using rel_interior_empty by auto next case False - then have "rel_open (Inter I)" + then have "rel_open (\I)" using assms unfolding rel_open_def using convex_rel_interior_finite_inter[of I] by auto @@ -8290,191 +8322,274 @@ then have *: "0 \ S \ (\c. c > 0 \ op *\<^sub>R c ` S = S)" using cone_iff[of S] assms by auto then have *: "0 \ ({0} \ rel_interior S)" - and "\c. c > 0 \ op *\<^sub>R c ` ({0} \ rel_interior S) = ({0} Un rel_interior S)" + and "\c. c > 0 \ op *\<^sub>R c ` ({0} \ rel_interior S) = ({0} \ rel_interior S)" by (auto simp add: rel_interior_scaleR) then show ?thesis - using cone_iff[of "{0} Un rel_interior S"] by auto + using cone_iff[of "{0} \ rel_interior S"] by auto qed lemma rel_interior_convex_cone_aux: -fixes S :: "('m::euclidean_space) set" -assumes "convex S" -shows "(c,x) : rel_interior (cone hull ({(1 :: real)} <*> S)) <-> - c>0 & x : ((op *\<^sub>R c) ` (rel_interior S))" -proof- -{ assume "S={}" hence ?thesis by (simp add: rel_interior_empty cone_hull_empty) } -moreover -{ assume "S ~= {}" from this obtain s where "s : S" by auto -have conv: "convex ({(1 :: real)} <*> S)" using convex_Times[of "{(1 :: real)}" S] - assms convex_singleton[of "1 :: real"] by auto -def f == "(%y. {z. (y,z) : cone hull ({(1 :: real)} <*> S)})" -hence *: "(c, x) : rel_interior (cone hull ({(1 :: real)} <*> S)) = - (c : rel_interior {y. f y ~= {}} & x : rel_interior (f c))" - apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} <*> S)" f c x]) - using convex_cone_hull[of "{(1 :: real)} <*> S"] conv by auto -{ fix y assume "(y :: real)>=0" - hence "y *\<^sub>R (1,s) : cone hull ({(1 :: real)} <*> S)" - using cone_hull_expl[of "{(1 :: real)} <*> S"] `s:S` by auto - hence "f y ~= {}" using f_def by auto -} -hence "{y. f y ~= {}} = {0..}" using f_def cone_hull_expl[of "{(1 :: real)} <*> S"] by auto -hence **: "rel_interior {y. f y ~= {}} = {0<..}" using rel_interior_real_semiline by auto -{ fix c assume "c>(0 :: real)" - hence "f c = (op *\<^sub>R c ` S)" using f_def cone_hull_expl[of "{(1 :: real)} <*> S"] by auto - hence "rel_interior (f c)= (op *\<^sub>R c ` rel_interior S)" - using rel_interior_convex_scaleR[of S c] assms by auto -} -hence ?thesis using * ** by auto -} ultimately show ?thesis by blast -qed - + fixes S :: "'m::euclidean_space set" + assumes "convex S" + shows "(c, x) \ rel_interior (cone hull ({(1 :: real)} <*> S)) \ + c > 0 \ x \ ((op *\<^sub>R c) ` (rel_interior S))" +proof (cases "S = {}") + case True + then show ?thesis + by (simp add: rel_interior_empty cone_hull_empty) +next + case False + then obtain s where "s \ S" by auto + have conv: "convex ({(1 :: real)} <*> S)" + using convex_Times[of "{(1 :: real)}" S] assms convex_singleton[of "1 :: real"] + by auto + def f \ "\y. {z. (y, z) \ cone hull ({1 :: real} <*> S)}" + then have *: "(c, x) \ rel_interior (cone hull ({(1 :: real)} <*> S)) = + (c \ rel_interior {y. f y \ {}} \ x \ rel_interior (f c))" + apply (subst rel_interior_projection[of "cone hull ({(1 :: real)} <*> S)" f c x]) + using convex_cone_hull[of "{(1 :: real)} <*> S"] conv + apply auto + done + { + fix y :: real + assume "y \ 0" + then have "y *\<^sub>R (1,s) \ cone hull ({1 :: real} <*> S)" + using cone_hull_expl[of "{(1 :: real)} <*> S"] `s \ S` by auto + then have "f y \ {}" + using f_def by auto + } + then have "{y. f y \ {}} = {0..}" + using f_def cone_hull_expl[of "{1 :: real} <*> S"] by auto + then have **: "rel_interior {y. f y \ {}} = {0<..}" + using rel_interior_real_semiline by auto + { + fix c :: real + assume "c > 0" + then have "f c = (op *\<^sub>R c ` S)" + using f_def cone_hull_expl[of "{1 :: real} <*> S"] by auto + then have "rel_interior (f c) = op *\<^sub>R c ` rel_interior S" + using rel_interior_convex_scaleR[of S c] assms by auto + } + then show ?thesis using * ** by auto +qed lemma rel_interior_convex_cone: -fixes S :: "('m::euclidean_space) set" -assumes "convex S" -shows "rel_interior (cone hull ({(1 :: real)} <*> S)) = - {(c,c *\<^sub>R x) |c x. c>0 & x : (rel_interior S)}" -(is "?lhs=?rhs") -proof- -{ fix z assume "z:?lhs" - have *: "z=(fst z,snd z)" by auto - have "z:?rhs" using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms `z:?lhs` apply auto - apply (rule_tac x="fst z" in exI) apply (rule_tac x="x" in exI) using * by auto -} -moreover -{ fix z assume "z:?rhs" hence "z:?lhs" - using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms by auto -} -ultimately show ?thesis by blast + fixes S :: "'m::euclidean_space set" + assumes "convex S" + shows "rel_interior (cone hull ({1 :: real} <*> S)) = + {(c, c *\<^sub>R x) | c x. c > 0 \ x \ rel_interior S}" + (is "?lhs = ?rhs") +proof - + { + fix z + assume "z \ ?lhs" + have *: "z = (fst z, snd z)" + by auto + have "z \ ?rhs" + using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms `z \ ?lhs` + apply auto + apply (rule_tac x = "fst z" in exI) + apply (rule_tac x = x in exI) + using * + apply auto + done + } + moreover + { + fix z + assume "z \ ?rhs" + then have "z \ ?lhs" + using rel_interior_convex_cone_aux[of S "fst z" "snd z"] assms + by auto + } + ultimately show ?thesis by blast qed lemma convex_hull_finite_union: -assumes "finite I" -assumes "!i:I. (convex (S i) & (S i) ~= {})" -shows "convex hull (Union (S ` I)) = - {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)}" + assumes "finite I" + assumes "\i\I. convex (S i) \ (S i) \ {}" + shows "convex hull (\(S ` I)) = + {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)}" (is "?lhs = ?rhs") -proof- -{ fix x assume "x : ?rhs" - from this obtain c s - where *: "setsum (%i. c i *\<^sub>R s i) I=x" "(setsum c I = 1)" - "(!i:I. c i >= 0) & (!i:I. s i : S i)" by auto - hence "!i:I. s i : convex hull (Union (S ` I))" using hull_subset[of "Union (S ` I)" convex] by auto - hence "x : ?lhs" unfolding *(1)[symmetric] - apply (subst convex_setsum[of I "convex hull Union (S ` I)" c s]) - using * assms convex_convex_hull by auto -} hence "?lhs >= ?rhs" by auto - -{ fix i assume "i:I" - from this assms have "EX p. p : S i" by auto -} -from this obtain p where p_def: "!i:I. p i : S i" by metis - -{ fix i assume "i:I" - { fix x assume "x : S i" - def c == "(%j. if (j=i) then (1::real) else 0)" - hence *: "setsum c I = 1" using `finite I` `i:I` setsum_delta[of I i "(%(j::'a). (1::real))"] by auto - def s == "(%j. if (j=i) then x else p j)" - hence "!j. c j *\<^sub>R s j = (if (j=i) then x else 0)" using c_def by (auto simp add: algebra_simps) - hence "x = setsum (%i. c i *\<^sub>R s i) I" - using s_def c_def `finite I` `i:I` setsum_delta[of I i "(%(j::'a). x)"] by auto - hence "x : ?rhs" apply auto - apply (rule_tac x="c" in exI) - apply (rule_tac x="s" in exI) using * c_def s_def p_def `x : S i` by auto - } hence "?rhs >= S i" by auto -} hence *: "?rhs >= Union (S ` I)" by auto - -{ fix u v assume uv: "(u :: real)>=0 & v>=0 & u+v=1" - fix x y assume xy: "(x : ?rhs) & (y : ?rhs)" - from xy obtain c s where xc: "x=setsum (%i. c i *\<^sub>R s i) I & - (!i:I. c i >= 0) & (setsum c I = 1) & (!i:I. s i : S i)" by auto - from xy obtain d t where yc: "y=setsum (%i. d i *\<^sub>R t i) I & - (!i:I. d i >= 0) & (setsum d I = 1) & (!i:I. t i : S i)" by auto - def e == "(%i. u * (c i)+v * (d i))" - have ge0: "!i:I. e i >= 0" using e_def xc yc uv by (simp add: mult_nonneg_nonneg) - have "setsum (%i. u * c i) I = u * setsum c I" by (simp add: setsum_right_distrib) - moreover have "setsum (%i. v * d i) I = v * setsum d I" by (simp add: setsum_right_distrib) - ultimately have sum1: "setsum e I = 1" using e_def xc yc uv by (simp add: setsum_addf) - def q == "(%i. if (e i = 0) then (p i) - else (u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i))" - { fix i assume "i:I" - { assume "e i = 0" hence "q i : S i" using `i:I` p_def q_def by auto } - moreover - { assume "e i ~= 0" - hence "q i : S i" using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"] - mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"] - assms q_def e_def `i:I` `e i ~= 0` xc yc uv by auto - } ultimately have "q i : S i" by auto - } hence qs: "!i:I. q i : S i" by auto - { fix i assume "i:I" - { assume "e i = 0" - have ge: "u * (c i) >= 0 & v * (d i) >= 0" using xc yc uv `i:I` by (simp add: mult_nonneg_nonneg) - moreover from ge have "u * (c i) <= 0 & v * (d i) <= 0" using `e i = 0` e_def `i:I` by simp - ultimately have "u * (c i) = 0 & v * (d i) = 0" by auto - hence "(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" - using `e i = 0` by auto +proof - + have "?lhs \ ?rhs" + proof + fix x + assume "x : ?rhs" + then obtain c s where *: "setsum (\i. c i *\<^sub>R s i) I = x" "setsum c I = 1" + "(\i\I. c i \ 0) \ (\i\I. s i \ S i)" by auto + then have "\i\I. s i \ convex hull (\(S ` I))" + using hull_subset[of "\(S ` I)" convex] by auto + then show "x \ ?lhs" + unfolding *(1)[symmetric] + apply (subst convex_setsum[of I "convex hull \(S ` I)" c s]) + using * assms convex_convex_hull + apply auto + done + qed + + { + fix i + assume "i \ I" + with assms have "\p. p \ S i" by auto + } + then obtain p where p: "\i\I. p i \ S i" by metis + + { + fix i + assume "i \ I" + { + fix x + assume "x \ S i" + def c \ "\j. if j = i then 1::real else 0" + then have *: "setsum c I = 1" + using `finite I` `i \ I` setsum_delta[of I i "\j::'a. 1::real"] + by auto + def s \ "\j. if j = i then x else p j" + then have "\j. c j *\<^sub>R s j = (if j = i then x else 0)" + using c_def by (auto simp add: algebra_simps) + then have "x = setsum (\i. c i *\<^sub>R s i) I" + using s_def c_def `finite I` `i \ I` setsum_delta[of I i "\j::'a. x"] + by auto + then have "x \ ?rhs" + apply auto + apply (rule_tac x = c in exI) + apply (rule_tac x = s in exI) + using * c_def s_def p `x \ S i` + apply auto + done } - moreover - { assume "e i ~= 0" - hence "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i" - using q_def by auto - hence "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i)) - = (e i) *\<^sub>R (q i)" by auto - hence "(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" - using `e i ~= 0` by (simp add: algebra_simps) - } ultimately have - "(u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" by blast - } hence *: "!i:I. - (u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i) = (e i) *\<^sub>R (q i)" by auto - have "u *\<^sub>R x + v *\<^sub>R y = - setsum (%i. (u * (c i))*\<^sub>R (s i)+(v * (d i))*\<^sub>R (t i)) I" - using xc yc by (simp add: algebra_simps scaleR_right.setsum setsum_addf) - also have "...=setsum (%i. (e i) *\<^sub>R (q i)) I" using * by auto - finally have "u *\<^sub>R x + v *\<^sub>R y = setsum (%i. (e i) *\<^sub>R (q i)) I" by auto - hence "u *\<^sub>R x + v *\<^sub>R y : ?rhs" using ge0 sum1 qs by auto -} hence "convex ?rhs" unfolding convex_def by auto -from this show ?thesis using `?lhs >= ?rhs` * - hull_minimal[of "Union (S ` I)" "?rhs" "convex"] by blast + then have "?rhs \ S i" by auto + } + then have *: "?rhs \ \(S ` I)" by auto + + { + fix u v :: real + assume uv: "u \ 0 \ v \ 0 \ u + v = 1" + fix x y + assume xy: "x \ ?rhs \ y \ ?rhs" + from xy obtain c s where + xc: "x = setsum (\i. c i *\<^sub>R s i) I \ (\i\I. c i \ 0) \ setsum c I = 1 \ (\i\I. s i \ S i)" + by auto + from xy obtain d t where + yc: "y = setsum (\i. d i *\<^sub>R t i) I \ (\i\I. d i \ 0) \ setsum d I = 1 \ (\i\I. t i \ S i)" + by auto + def e \ "\i. u * c i + v * d i" + have ge0: "\i\I. e i \ 0" + using e_def xc yc uv by (simp add: mult_nonneg_nonneg) + have "setsum (\i. u * c i) I = u * setsum c I" + by (simp add: setsum_right_distrib) + moreover have "setsum (\i. v * d i) I = v * setsum d I" + by (simp add: setsum_right_distrib) + ultimately have sum1: "setsum e I = 1" + using e_def xc yc uv by (simp add: setsum_addf) + def q \ "\i. if e i = 0 then p i else (u * c i / e i) *\<^sub>R s i + (v * d i / e i) *\<^sub>R t i" + { + fix i + assume i: "i \ I" + have "q i \ S i" + proof (cases "e i = 0") + case True + then show ?thesis using i p q_def by auto + next + case False + then show ?thesis + using mem_convex_alt[of "S i" "s i" "t i" "u * (c i)" "v * (d i)"] + mult_nonneg_nonneg[of u "c i"] mult_nonneg_nonneg[of v "d i"] + assms q_def e_def i False xc yc uv + by auto + qed + } + then have qs: "\i\I. q i \ S i" by auto + { + fix i + assume i: "i \ I" + have "(u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i" + proof (cases "e i = 0") + case True + have ge: "u * (c i) \ 0 \ v * d i \ 0" + using xc yc uv i by (simp add: mult_nonneg_nonneg) + moreover from ge have "u * c i \ 0 \ v * d i \ 0" + using True e_def i by simp + ultimately have "u * c i = 0 \ v * d i = 0" by auto + with True show ?thesis by auto + next + case False + then have "(u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i) = q i" + using q_def by auto + then have "e i *\<^sub>R ((u * (c i)/(e i))*\<^sub>R (s i)+(v * (d i)/(e i))*\<^sub>R (t i)) + = (e i) *\<^sub>R (q i)" by auto + with False show ?thesis by (simp add: algebra_simps) + qed + } + then have *: "\i\I. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i = e i *\<^sub>R q i" + by auto + have "u *\<^sub>R x + v *\<^sub>R y = setsum (\i. (u * c i) *\<^sub>R s i + (v * d i) *\<^sub>R t i) I" + using xc yc by (simp add: algebra_simps scaleR_right.setsum setsum_addf) + also have "\ = setsum (\i. e i *\<^sub>R q i) I" + using * by auto + finally have "u *\<^sub>R x + v *\<^sub>R y = setsum (\i. (e i) *\<^sub>R (q i)) I" + by auto + then have "u *\<^sub>R x + v *\<^sub>R y \ ?rhs" + using ge0 sum1 qs by auto + } + then have "convex ?rhs" unfolding convex_def by auto + then show ?thesis + using `?lhs \ ?rhs` * hull_minimal[of "\(S ` I)" ?rhs convex] + by blast qed lemma convex_hull_union_two: -fixes S T :: "('m::euclidean_space) set" -assumes "convex S" "S ~= {}" "convex T" "T ~= {}" -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}" + fixes S T :: "'m::euclidean_space set" + assumes "convex S" + and "S \ {}" + and "convex T" + and "T \ {}" + shows "convex hull (S \ T) = + {u *\<^sub>R s + v *\<^sub>R t | u v s t. u \ 0 \ v \ 0 \ u + v = 1 \ s \ S \ t \ T}" (is "?lhs = ?rhs") -proof- -def I == "{(1::nat),2}" -def s == "(%i. (if i=(1::nat) then S else T))" -have "Union (s ` I) = S Un T" using s_def I_def by auto -hence "convex hull (Union (s ` I)) = convex hull (S Un T)" by auto -moreover have "convex hull Union (s ` I) = - {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)}" - apply (subst convex_hull_finite_union[of I s]) using assms s_def I_def by auto -moreover have - "{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)} <= - ?rhs" - using s_def I_def by auto -ultimately have "?lhs<=?rhs" by auto -{ fix x assume "x : ?rhs" - from this obtain u v s t - where *: "x=u *\<^sub>R s + v *\<^sub>R t & u>=0 & v>=0 & u+v=1 & s:S & t:T" by auto - hence "x : convex hull {s,t}" using convex_hull_2[of s t] by auto - hence "x : convex hull (S Un T)" using * hull_mono[of "{s, t}" "S Un T"] by auto -} hence "?lhs >= ?rhs" by blast -from this show ?thesis using `?lhs<=?rhs` by auto -qed +proof + def I \ "{1::nat, 2}" + def s \ "\i. if i = (1::nat) then S else T" + have "\(s ` I) = S \ T" + using s_def I_def by auto + then have "convex hull (\(s ` I)) = convex hull (S \ T)" + by auto + moreover have "convex hull \(s ` I) = + {\ i\I. c i *\<^sub>R sa i | c sa. (\i\I. 0 \ c i) \ setsum c I = 1 \ (\i\I. sa i \ s i)}" + apply (subst convex_hull_finite_union[of I s]) + using assms s_def I_def + apply auto + done + moreover have + "{\i\I. c i *\<^sub>R sa i | c sa. (\i\I. 0 \ c i) \ setsum c I = 1 \ (\i\I. sa i \ s i)} \ ?rhs" + using s_def I_def by auto + ultimately show "?lhs \ ?rhs" by auto + { + fix x + assume "x \ ?rhs" + then obtain u v s t where *: "x = u *\<^sub>R s + v *\<^sub>R t \ u \ 0 \ v \ 0 \ u + v = 1 \ s \ S \ t \ T" + by auto + then have "x \ convex hull {s, t}" + using convex_hull_2[of s t] by auto + then have "x \ convex hull (S \ T)" + using * hull_mono[of "{s, t}" "S \ T"] by auto + } + then show "?lhs \ ?rhs" by blast +qed + subsection {* Convexity on direct sums *} lemma closure_sum: - fixes S T :: "('n::euclidean_space) set" + fixes S T :: "'n::euclidean_space set" shows "closure S + closure T \ closure (S + T)" -proof- - have "(closure S) + (closure T) = (\(x,y). x + y) ` (closure S \ closure T)" +proof - + have "closure S + closure T = (\(x,y). x + y) ` (closure S \ closure T)" by (simp add: set_plus_image) - also have "... = (\(x,y). x + y) ` closure (S \ T)" + also have "\ = (\(x,y). x + y) ` closure (S \ T)" using closure_Times by auto - also have "... \ closure (S + T)" + also have "\ \ closure (S + T)" using fst_snd_linear closure_linear_image[of "(\(x,y). x + y)" "S \ T"] by (auto simp: set_plus_image) finally show ?thesis @@ -8482,216 +8597,345 @@ qed lemma convex_oplus: -fixes S T :: "('n::euclidean_space) set" -assumes "convex S" "convex T" -shows "convex (S + T)" -proof- -have "{x + y |x y. x : S & y : T} = {c. EX a:S. EX b:T. c = a + b}" by auto -thus ?thesis unfolding set_plus_def using convex_sums[of S T] assms by auto + fixes S T :: "'n::euclidean_space set" + assumes "convex S" + and "convex T" + shows "convex (S + T)" +proof - + have "{x + y |x y. x \ S \ y \ T} = {c. \a\S. \b\T. c = a + b}" + by auto + then show ?thesis + unfolding set_plus_def + using convex_sums[of S T] assms + by auto qed lemma convex_hull_sum: -fixes S T :: "('n::euclidean_space) set" -shows "convex hull (S + T) = (convex hull S) + (convex hull T)" -proof- -have "(convex hull S) + (convex hull T) = - (%(x,y). x + y) ` ((convex hull S) <*> (convex hull T))" - by (simp add: set_plus_image) -also have "... = (%(x,y). x + y) ` (convex hull (S <*> T))" using convex_hull_Times by auto -also have "...= convex hull (S + T)" using fst_snd_linear linear_conv_bounded_linear - convex_hull_linear_image[of "(%(x,y). x + y)" "S <*> T"] by (auto simp add: set_plus_image) -finally show ?thesis by auto + fixes S T :: "'n::euclidean_space set" + shows "convex hull (S + T) = convex hull S + convex hull T" +proof - + have "convex hull S + convex hull T = (\(x,y). x + y) ` ((convex hull S) <*> (convex hull T))" + by (simp add: set_plus_image) + also have "\ = (\(x,y). x + y) ` (convex hull (S <*> T))" + using convex_hull_Times by auto + also have "\ = convex hull (S + T)" + using fst_snd_linear linear_conv_bounded_linear + convex_hull_linear_image[of "(\(x,y). x + y)" "S <*> T"] + by (auto simp add: set_plus_image) + finally show ?thesis .. qed lemma rel_interior_sum: -fixes S T :: "('n::euclidean_space) set" -assumes "convex S" "convex T" -shows "rel_interior (S + T) = (rel_interior S) + (rel_interior T)" -proof- -have "(rel_interior S) + (rel_interior T) = (%(x,y). x + y) ` (rel_interior S <*> rel_interior T)" - by (simp add: set_plus_image) -also have "... = (%(x,y). x + y) ` rel_interior (S <*> T)" using rel_interior_direct_sum assms by auto -also have "...= rel_interior (S + T)" using fst_snd_linear convex_Times assms - rel_interior_convex_linear_image[of "(%(x,y). x + y)" "S <*> T"] by (auto simp add: set_plus_image) -finally show ?thesis by auto + fixes S T :: "'n::euclidean_space set" + assumes "convex S" + and "convex T" + shows "rel_interior (S + T) = rel_interior S + rel_interior T" +proof - + have "rel_interior S + rel_interior T = (\(x,y). x + y) ` (rel_interior S <*> rel_interior T)" + by (simp add: set_plus_image) + also have "\ = (\(x,y). x + y) ` rel_interior (S <*> T)" + using rel_interior_direct_sum assms by auto + also have "\ = rel_interior (S + T)" + using fst_snd_linear convex_Times assms + rel_interior_convex_linear_image[of "(\(x,y). x + y)" "S <*> T"] + by (auto simp add: set_plus_image) + finally show ?thesis .. qed lemma convex_sum_gen: fixes S :: "'a \ 'n::euclidean_space set" assumes "\i. i \ I \ (convex (S i))" shows "convex (setsum S I)" -proof cases - assume "finite I" from this assms show ?thesis +proof (cases "finite I") + case True + from this and assms show ?thesis by induct (auto simp: convex_oplus) -qed auto +next + case False + then show ?thesis by auto +qed lemma convex_hull_sum_gen: -fixes S :: "'a => ('n::euclidean_space) set" -shows "convex hull (setsum S I) = setsum (%i. (convex hull (S i))) I" -apply (subst setsum_set_linear) using convex_hull_sum convex_hull_singleton by auto - + fixes S :: "'a \ 'n::euclidean_space set" + shows "convex hull (setsum S I) = setsum (\i. convex hull (S i)) I" + apply (subst setsum_set_linear) + using convex_hull_sum convex_hull_singleton + apply auto + done lemma rel_interior_sum_gen: -fixes S :: "'a => ('n::euclidean_space) set" -assumes "!i:I. (convex (S i))" -shows "rel_interior (setsum S I) = setsum (%i. (rel_interior (S i))) I" -apply (subst setsum_set_cond_linear[of convex]) - using rel_interior_sum rel_interior_sing[of "0"] assms by (auto simp add: convex_oplus) + fixes S :: "'a \ 'n::euclidean_space set" + assumes "\i\I. convex (S i)" + shows "rel_interior (setsum S I) = setsum (\i. rel_interior (S i)) I" + apply (subst setsum_set_cond_linear[of convex]) + using rel_interior_sum rel_interior_sing[of "0"] assms + apply (auto simp add: convex_oplus) + done lemma convex_rel_open_direct_sum: -fixes S T :: "('n::euclidean_space) set" -assumes "convex S" "rel_open S" "convex T" "rel_open T" -shows "convex (S <*> T) & rel_open (S <*> T)" -by (metis assms convex_Times rel_interior_direct_sum rel_open_def) + fixes S T :: "'n::euclidean_space set" + assumes "convex S" + and "rel_open S" + and "convex T" + and "rel_open T" + shows "convex (S <*> T) \ rel_open (S <*> T)" + by (metis assms convex_Times rel_interior_direct_sum rel_open_def) lemma convex_rel_open_sum: -fixes S T :: "('n::euclidean_space) set" -assumes "convex S" "rel_open S" "convex T" "rel_open T" -shows "convex (S + T) & rel_open (S + T)" -by (metis assms convex_oplus rel_interior_sum rel_open_def) + fixes S T :: "'n::euclidean_space set" + assumes "convex S" + and "rel_open S" + and "convex T" + and "rel_open T" + shows "convex (S + T) \ rel_open (S + T)" + by (metis assms convex_oplus rel_interior_sum rel_open_def) lemma convex_hull_finite_union_cones: -assumes "finite I" "I ~= {}" -assumes "!i:I. (convex (S i) & cone (S i) & (S i) ~= {})" -shows "convex hull (Union (S ` I)) = setsum S I" + assumes "finite I" + and "I \ {}" + assumes "\i\I. convex (S i) \ cone (S i) \ S i \ {}" + shows "convex hull (\(S ` I)) = setsum S I" (is "?lhs = ?rhs") -proof- -{ fix x assume "x : ?lhs" - from this obtain c xs where x_def: "x=setsum (%i. c i *\<^sub>R xs i) I & - (!i:I. c i >= 0) & (setsum c I = 1) & (!i:I. xs i : S i)" - using convex_hull_finite_union[of I S] assms by auto - def s == "(%i. c i *\<^sub>R xs i)" - { fix i assume "i:I" - hence "s i : S i" using s_def x_def assms mem_cone[of "S i" "xs i" "c i"] by auto - } hence "!i:I. s i : S i" by auto - moreover have "x = setsum s I" using x_def s_def by auto - ultimately have "x : ?rhs" using set_setsum_alt[of I S] assms by auto -} -moreover -{ fix x assume "x : ?rhs" - from this obtain s where x_def: "x=setsum s I & (!i:I. s i : S i)" - using set_setsum_alt[of I S] assms by auto - def xs == "(%i. of_nat(card I) *\<^sub>R s i)" - hence "x=setsum (%i. ((1 :: real)/of_nat(card I)) *\<^sub>R xs i) I" using x_def assms by auto - moreover have "!i:I. xs i : S i" using x_def xs_def assms by (simp add: cone_def) - moreover have "(!i:I. (1 :: real)/of_nat(card I) >= 0)" by auto - moreover have "setsum (%i. (1 :: real)/of_nat(card I)) I = 1" using assms by auto - ultimately have "x : ?lhs" apply (subst convex_hull_finite_union[of I S]) - using assms apply blast - using assms apply blast - apply rule apply (rule_tac x="(%i. (1 :: real)/of_nat(card I))" in exI) by auto -} ultimately show ?thesis by auto +proof - + { + fix x + assume "x \ ?lhs" + then obtain c xs where + x: "x = setsum (\i. c i *\<^sub>R xs i) I \ (\i\I. c i \ 0) \ setsum c I = 1 \ (\i\I. xs i \ S i)" + using convex_hull_finite_union[of I S] assms by auto + def s \ "\i. c i *\<^sub>R xs i" + { + fix i + assume "i \ I" + then have "s i \ S i" + using s_def x assms mem_cone[of "S i" "xs i" "c i"] by auto + } + then have "\i\I. s i \ S i" by auto + moreover have "x = setsum s I" using x s_def by auto + ultimately have "x \ ?rhs" + using set_setsum_alt[of I S] assms by auto + } + moreover + { + fix x + assume "x \ ?rhs" + then obtain s where x: "x = setsum s I \ (\i\I. s i \ S i)" + using set_setsum_alt[of I S] assms by auto + def xs \ "\i. of_nat(card I) *\<^sub>R s i" + then have "x = setsum (\i. ((1 :: real) / of_nat(card I)) *\<^sub>R xs i) I" + using x assms by auto + moreover have "\i\I. xs i \ S i" + using x xs_def assms by (simp add: cone_def) + moreover have "\i\I. (1 :: real) / of_nat (card I) \ 0" + by auto + moreover have "setsum (\i. (1 :: real) / of_nat (card I)) I = 1" + using assms by auto + ultimately have "x \ ?lhs" + apply (subst convex_hull_finite_union[of I S]) + using assms + apply blast + using assms + apply blast + apply rule + apply (rule_tac x = "(\i. (1 :: real) / of_nat (card I))" in exI) + apply auto + done + } + ultimately show ?thesis by auto qed lemma convex_hull_union_cones_two: -fixes S T :: "('m::euclidean_space) set" -assumes "convex S" "cone S" "S ~= {}" -assumes "convex T" "cone T" "T ~= {}" -shows "convex hull (S Un T) = S + T" -proof- -def I == "{(1::nat),2}" -def A == "(%i. (if i=(1::nat) then S else T))" -have "Union (A ` I) = S Un T" using A_def I_def by auto -hence "convex hull (Union (A ` I)) = convex hull (S Un T)" by auto -moreover have "convex hull Union (A ` I) = setsum A I" - apply (subst convex_hull_finite_union_cones[of I A]) using assms A_def I_def by auto -moreover have - "setsum A I = S + T" using A_def I_def - unfolding set_plus_def apply auto unfolding set_plus_def by auto -ultimately show ?thesis by auto + fixes S T :: "'m::euclidean_space set" + assumes "convex S" + and "cone S" + and "S \ {}" + assumes "convex T" + and "cone T" + and "T \ {}" + shows "convex hull (S \ T) = S + T" +proof - + def I \ "{1::nat, 2}" + def A \ "(\i. if i = (1::nat) then S else T)" + have "\(A ` I) = S \ T" + using A_def I_def by auto + then have "convex hull (\(A ` I)) = convex hull (S \ T)" + by auto + moreover have "convex hull \(A ` I) = setsum A I" + apply (subst convex_hull_finite_union_cones[of I A]) + using assms A_def I_def + apply auto + done + moreover have "setsum A I = S + T" + using A_def I_def + unfolding set_plus_def + apply auto + unfolding set_plus_def + apply auto + done + ultimately show ?thesis by auto qed lemma rel_interior_convex_hull_union: -fixes S :: "'a => ('n::euclidean_space) set" -assumes "finite I" -assumes "!i:I. convex (S i) & (S i) ~= {}" -shows "rel_interior (convex hull (Union (S ` I))) = {setsum (%i. c i *\<^sub>R s i) I - |c s. (!i:I. c i > 0) & (setsum c I = 1) & (!i:I. s i : rel_interior(S i))}" -(is "?lhs=?rhs") -proof- -{ assume "I={}" hence ?thesis using convex_hull_empty rel_interior_empty by auto } -moreover -{ assume "I ~= {}" - def C0 == "convex hull (Union (S ` I))" - have "!i:I. C0 >= S i" unfolding C0_def using hull_subset[of "Union (S ` I)"] by auto - def K0 == "cone hull ({(1 :: real)} <*> C0)" - def K == "(%i. cone hull ({(1 :: real)} <*> (S i)))" - have "!i:I. K i ~= {}" unfolding K_def using assms by (simp add: cone_hull_empty_iff[symmetric]) - { fix i assume "i:I" - hence "convex (K i)" unfolding K_def apply (subst convex_cone_hull) apply (subst convex_Times) - using assms by auto + fixes S :: "'a \ 'n::euclidean_space set" + assumes "finite I" + and "\i\I. convex (S i) \ S i \ {}" + shows "rel_interior (convex hull (\(S ` I))) = + {setsum (\i. c i *\<^sub>R s i) I | c s. (\i\I. c i > 0) \ setsum c I = 1 \ + (\i\I. s i \ rel_interior(S i))}" + (is "?lhs = ?rhs") +proof (cases "I = {}") + case True + then show ?thesis + using convex_hull_empty rel_interior_empty by auto +next + case False + def C0 \ "convex hull (\(S ` I))" + have "\i\I. C0 \ S i" + unfolding C0_def using hull_subset[of "\(S ` I)"] by auto + def K0 \ "cone hull ({1 :: real} <*> C0)" + def K \ "\i. cone hull ({1 :: real} <*> S i)" + have "\i\I. K i \ {}" + unfolding K_def using assms + by (simp add: cone_hull_empty_iff[symmetric]) + { + fix i + assume "i \ I" + then have "convex (K i)" + unfolding K_def + apply (subst convex_cone_hull) + apply (subst convex_Times) + using assms + apply auto + done } - hence convK: "!i:I. convex (K i)" by auto - { fix i assume "i:I" - hence "K0 >= K i" unfolding K0_def K_def apply (subst hull_mono) using `!i:I. C0 >= S i` by auto + then have convK: "\i\I. convex (K i)" + by auto + { + fix i + assume "i \ I" + then have "K0 \ K i" + unfolding K0_def K_def + apply (subst hull_mono) + using `\i\I. C0 \ S i` + apply auto + done } - hence "K0 >= Union (K ` I)" by auto - moreover have "convex K0" unfolding K0_def - apply (subst convex_cone_hull) apply (subst convex_Times) - unfolding C0_def using convex_convex_hull by auto - ultimately have geq: "K0 >= convex hull (Union (K ` I))" using hull_minimal[of _ "K0" "convex"] by blast - have "!i:I. K i >= {(1 :: real)} <*> (S i)" using K_def by (simp add: hull_subset) - hence "Union (K ` I) >= {(1 :: real)} <*> Union (S ` I)" by auto - hence "convex hull Union (K ` I) >= convex hull ({(1 :: real)} <*> Union (S ` I))" by (simp add: hull_mono) - hence "convex hull Union (K ` I) >= {(1 :: real)} <*> C0" unfolding C0_def - using convex_hull_Times[of "{(1 :: real)}" "Union (S ` I)"] convex_hull_singleton by auto - moreover have "cone (convex hull(Union (K ` I)))" apply (subst cone_convex_hull) - using cone_Union[of "K ` I"] apply auto unfolding K_def using cone_cone_hull by auto - ultimately have "convex hull (Union (K ` I)) >= K0" - unfolding K0_def using hull_minimal[of _ "convex hull (Union (K ` I))" "cone"] by blast - hence "K0 = convex hull (Union (K ` I))" using geq by auto - also have "...=setsum K I" - apply (subst convex_hull_finite_union_cones[of I K]) - using assms apply blast - using `I ~= {}` apply blast - unfolding K_def apply rule - apply (subst convex_cone_hull) apply (subst convex_Times) - using assms cone_cone_hull `!i:I. K i ~= {}` K_def by auto + then have "K0 \ \(K ` I)" by auto + moreover have "convex K0" + unfolding K0_def + apply (subst convex_cone_hull) + apply (subst convex_Times) + unfolding C0_def + using convex_convex_hull + apply auto + done + ultimately have geq: "K0 \ convex hull (\(K ` I))" + using hull_minimal[of _ "K0" "convex"] by blast + have "\i\I. K i \ {1 :: real} <*> S i" + using K_def by (simp add: hull_subset) + then have "\(K ` I) \ {1 :: real} <*> \(S ` I)" + by auto + then have "convex hull \(K ` I) \ convex hull ({1 :: real} <*> \(S ` I))" + by (simp add: hull_mono) + then have "convex hull \(K ` I) \ {1 :: real} <*> C0" + unfolding C0_def + using convex_hull_Times[of "{(1 :: real)}" "\(S ` I)"] convex_hull_singleton + by auto + moreover have "cone (convex hull (\(K ` I)))" + apply (subst cone_convex_hull) + using cone_Union[of "K ` I"] + apply auto + unfolding K_def + using cone_cone_hull + apply auto + done + ultimately have "convex hull (\(K ` I)) \ K0" + unfolding K0_def + using hull_minimal[of _ "convex hull (\ (K ` I))" "cone"] + by blast + then have "K0 = convex hull (\(K ` I))" + using geq by auto + also have "\ = setsum K I" + apply (subst convex_hull_finite_union_cones[of I K]) + using assms + apply blast + using False + apply blast + unfolding K_def + apply rule + apply (subst convex_cone_hull) + apply (subst convex_Times) + using assms cone_cone_hull `\i\I. K i \ {}` K_def + apply auto + done finally have "K0 = setsum K I" by auto - hence *: "rel_interior K0 = setsum (%i. (rel_interior (K i))) I" - using rel_interior_sum_gen[of I K] convK by auto - { fix x assume "x : ?lhs" - hence "((1::real),x) : rel_interior K0" using K0_def C0_def - rel_interior_convex_cone_aux[of C0 "(1::real)" x] convex_convex_hull by auto - from this obtain k where k_def: "((1::real),x) = setsum k I & (!i:I. k i : rel_interior (K i))" - using `finite I` * set_setsum_alt[of I "(%i. rel_interior (K i))"] by auto - { fix i assume "i:I" - hence "(convex (S i)) & k i : rel_interior (cone hull {1} <*> S i)" using k_def K_def assms by auto - hence "EX ci si. k i = (ci, ci *\<^sub>R si) & 0 < ci & si : rel_interior (S i)" - using rel_interior_convex_cone[of "S i"] by auto + then have *: "rel_interior K0 = setsum (\i. (rel_interior (K i))) I" + using rel_interior_sum_gen[of I K] convK by auto + { + fix x + assume "x \ ?lhs" + then have "(1::real, x) \ rel_interior K0" + using K0_def C0_def rel_interior_convex_cone_aux[of C0 "1::real" x] convex_convex_hull + by auto + then obtain k where k: "(1::real, x) = setsum k I \ (\i\I. k i \ rel_interior (K i))" + using `finite I` * set_setsum_alt[of I "\i. rel_interior (K i)"] by auto + { + fix i + assume "i \ I" + then have "convex (S i) \ k i \ rel_interior (cone hull {1} <*> S i)" + using k K_def assms by auto + then have "\ci si. k i = (ci, ci *\<^sub>R si) \ 0 < ci \ si \ rel_interior (S i)" + using rel_interior_convex_cone[of "S i"] by auto } - from this obtain c s where cs_def: "!i:I. (k i = (c i, c i *\<^sub>R s i) & 0 < c i - & s i : rel_interior (S i))" by metis - hence "x = (SUM i:I. c i *\<^sub>R s i) & setsum c I = 1" using k_def by (simp add: setsum_prod) - hence "x : ?rhs" using k_def apply auto - apply (rule_tac x="c" in exI) apply (rule_tac x="s" in exI) using cs_def by auto + then obtain c s where + cs: "\i\I. k i = (c i, c i *\<^sub>R s i) \ 0 < c i \ s i \ rel_interior (S i)" + by metis + then have "x = (\i\I. c i *\<^sub>R s i) \ setsum c I = 1" + using k by (simp add: setsum_prod) + then have "x \ ?rhs" + using k + apply auto + apply (rule_tac x = c in exI) + apply (rule_tac x = s in exI) + using cs + apply auto + done } moreover - { fix x assume "x : ?rhs" - from this obtain c s where cs_def: "x=setsum (%i. c i *\<^sub>R s i) I & - (!i:I. c i > 0) & (setsum c I = 1) & (!i:I. s i : rel_interior(S i))" by auto - def k == "(%i. (c i, c i *\<^sub>R s i))" - { fix i assume "i:I" - hence "k i : rel_interior (K i)" - using k_def K_def assms cs_def rel_interior_convex_cone[of "S i"] by auto + { + fix x + assume "x \ ?rhs" + then obtain c s where cs: "x = setsum (\i. c i *\<^sub>R s i) I \ + (\i\I. c i > 0) \ setsum c I = 1 \ (\i\I. s i \ rel_interior (S i))" + by auto + def k \ "\i. (c i, c i *\<^sub>R s i)" + { + fix i assume "i:I" + then have "k i \ rel_interior (K i)" + using k_def K_def assms cs rel_interior_convex_cone[of "S i"] + by auto } - hence "((1::real),x) : rel_interior K0" - using K0_def * set_setsum_alt[of I "(%i. rel_interior (K i))"] assms k_def cs_def - apply auto apply (rule_tac x="k" in exI) by (simp add: setsum_prod) - hence "x : ?lhs" using K0_def C0_def - rel_interior_convex_cone_aux[of C0 "(1::real)" x] by (auto simp add: convex_convex_hull) + then have "(1::real, x) \ rel_interior K0" + using K0_def * set_setsum_alt[of I "(\i. rel_interior (K i))"] assms k_def cs + apply auto + apply (rule_tac x = k in exI) + apply (simp add: setsum_prod) + done + then have "x \ ?lhs" + using K0_def C0_def rel_interior_convex_cone_aux[of C0 1 x] + by (auto simp add: convex_convex_hull) } - ultimately have ?thesis by blast -} ultimately show ?thesis by blast + ultimately show ?thesis by blast qed lemma convex_le_Inf_differential: fixes f :: "real \ real" assumes "convex_on I f" - assumes "x \ interior I" "y \ I" + and "x \ interior I" + and "y \ I" shows "f y \ f x + Inf ((\t. (f x - f t) / (x - t)) ` ({x<..} \ I)) * (y - x)" - (is "_ \ _ + Inf (?F x) * (y - x)") + (is "_ \ _ + Inf (?F x) * (y - x)") proof (cases rule: linorder_cases) assume "x < y" moreover @@ -8705,7 +8949,8 @@ have "open (interior I)" by auto from openE[OF this `x \ interior I`] guess e . moreover def K \ "x - e / 2" - with `0 < e` have "K \ ball x e" "K < x" by (auto simp: dist_real_def) + with `0 < e` have "K \ ball x e" "K < x" + by (auto simp: dist_real_def) ultimately have "K \ I" "K < x" "x \ I" using interior_subset[of I] `x \ interior I` by auto @@ -8714,9 +8959,11 @@ show "(f x - f t) / (x - t) \ ?F x" using `t \ I` `x < t` by auto show "(f x - f t) / (x - t) \ (f x - f y) / (x - y)" - using `convex_on I f` `x \ I` `y \ I` `x < t` `t < y` by (rule convex_on_diff) + using `convex_on I f` `x \ I` `y \ I` `x < t` `t < y` + by (rule convex_on_diff) next - fix y assume "y \ ?F x" + fix y + assume "y \ ?F x" with order_trans[OF convex_on_diff[OF `convex_on I f` `K \ I` _ `K < x` _]] show "(f K - f x) / (K - x) \ y" by auto qed @@ -8737,16 +8984,21 @@ have "(f x - f y) / (x - y) = (f y - f x) / (y - x)" using `y < x` by (auto simp: field_simps) also - fix z assume "z \ ?F x" + fix z + assume "z \ ?F x" with order_trans[OF convex_on_diff[OF `convex_on I f` `y \ I` _ `y < x`]] - have "(f y - f x) / (y - x) \ z" by auto + have "(f y - f x) / (y - x) \ z" + by auto finally show "(f x - f y) / (x - y) \ z" . next have "open (interior I)" by auto from openE[OF this `x \ interior I`] guess e . note e = this - then have "x + e / 2 \ ball x e" by (auto simp: dist_real_def) - with e interior_subset[of I] have "x + e / 2 \ {x<..} \ I" by auto - then show "?F x \ {}" by blast + then have "x + e / 2 \ ball x e" + by (auto simp: dist_real_def) + with e interior_subset[of I] have "x + e / 2 \ {x<..} \ I" + by auto + then show "?F x \ {}" + by blast qed then show ?thesis using `y < x` by (simp add: field_simps)