8895 by blast |
8904 by blast |
8896 qed |
8905 qed |
8897 then show ?thesis |
8906 then show ?thesis |
8898 using `y < x` by (simp add: field_simps) |
8907 using `y < x` by (simp add: field_simps) |
8899 qed simp |
8908 qed simp |
|
8909 subsection{* Explicit formulas for interior and relative interior of convex hull*} |
|
8910 |
|
8911 lemma affine_independent_convex_affine_hull: |
|
8912 fixes s :: "'a::euclidean_space set" |
|
8913 assumes "~affine_dependent s" "t \<subseteq> s" |
|
8914 shows "convex hull t = affine hull t \<inter> convex hull s" |
|
8915 proof - |
|
8916 have fin: "finite s" "finite t" using assms aff_independent_finite finite_subset by auto |
|
8917 { fix u v x |
|
8918 assume uv: "setsum u t = 1" "\<forall>x\<in>s. 0 \<le> v x" "setsum v s = 1" |
|
8919 "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>v\<in>t. u v *\<^sub>R v)" "x \<in> t" |
|
8920 then have s: "s = (s - t) \<union> t" --{*split into separate cases*} |
|
8921 using assms by auto |
|
8922 have [simp]: "(\<Sum>x\<in>t. v x *\<^sub>R x) + (\<Sum>x\<in>s - t. v x *\<^sub>R x) = (\<Sum>x\<in>t. u x *\<^sub>R x)" |
|
8923 "setsum v t + setsum v (s - t) = 1" |
|
8924 using uv fin s |
|
8925 by (auto simp: setsum.union_disjoint [symmetric] Un_commute) |
|
8926 have "(\<Sum>x\<in>s. if x \<in> t then v x - u x else v x) = 0" |
|
8927 "(\<Sum>x\<in>s. (if x \<in> t then v x - u x else v x) *\<^sub>R x) = 0" |
|
8928 using uv fin |
|
8929 by (subst s, subst setsum.union_disjoint, auto simp: algebra_simps setsum_subtractf)+ |
|
8930 } note [simp] = this |
|
8931 have "convex hull t \<subseteq> affine hull t" |
|
8932 using convex_hull_subset_affine_hull by blast |
|
8933 moreover have "convex hull t \<subseteq> convex hull s" |
|
8934 using assms hull_mono by blast |
|
8935 moreover have "affine hull t \<inter> convex hull s \<subseteq> convex hull t" |
|
8936 using assms |
|
8937 apply (simp add: convex_hull_finite affine_hull_finite fin affine_dependent_explicit) |
|
8938 apply (drule_tac x=s in spec) |
|
8939 apply (auto simp: fin) |
|
8940 apply (rule_tac x=u in exI) |
|
8941 apply (rename_tac v) |
|
8942 apply (drule_tac x="\<lambda>x. if x \<in> t then v x - u x else v x" in spec) |
|
8943 apply (force)+ |
|
8944 done |
|
8945 ultimately show ?thesis |
|
8946 by blast |
|
8947 qed |
|
8948 |
|
8949 lemma affine_independent_span_eq: |
|
8950 fixes s :: "'a::euclidean_space set" |
|
8951 assumes "~affine_dependent s" "card s = Suc (DIM ('a))" |
|
8952 shows "affine hull s = UNIV" |
|
8953 proof (cases "s = {}") |
|
8954 case True then show ?thesis |
|
8955 using assms by simp |
|
8956 next |
|
8957 case False |
|
8958 then obtain a t where t: "a \<notin> t" "s = insert a t" |
|
8959 by blast |
|
8960 then have fin: "finite t" using assms |
|
8961 by (metis finite_insert aff_independent_finite) |
|
8962 show ?thesis |
|
8963 using assms t fin |
|
8964 apply (simp add: affine_dependent_iff_dependent affine_hull_insert_span_gen) |
|
8965 apply (rule subset_antisym) |
|
8966 apply force |
|
8967 apply (rule Fun.vimage_subsetD) |
|
8968 apply (metis add.commute diff_add_cancel surj_def) |
|
8969 apply (rule card_ge_dim_independent) |
|
8970 apply (auto simp: card_image inj_on_def dim_subset_UNIV) |
|
8971 done |
|
8972 qed |
|
8973 |
|
8974 lemma affine_independent_span_gt: |
|
8975 fixes s :: "'a::euclidean_space set" |
|
8976 assumes ind: "~ affine_dependent s" and dim: "DIM ('a) < card s" |
|
8977 shows "affine hull s = UNIV" |
|
8978 apply (rule affine_independent_span_eq [OF ind]) |
|
8979 apply (rule antisym) |
|
8980 using assms |
|
8981 apply auto |
|
8982 apply (metis add_2_eq_Suc' not_less_eq_eq affine_dependent_biggerset aff_independent_finite) |
|
8983 done |
|
8984 |
|
8985 lemma empty_interior_affine_hull: |
|
8986 fixes s :: "'a::euclidean_space set" |
|
8987 assumes "finite s" and dim: "card s \<le> DIM ('a)" |
|
8988 shows "interior(affine hull s) = {}" |
|
8989 using assms |
|
8990 apply (induct s rule: finite_induct) |
|
8991 apply (simp_all add: affine_dependent_iff_dependent affine_hull_insert_span_gen interior_translation) |
|
8992 apply (rule empty_interior_lowdim) |
|
8993 apply (simp add: affine_dependent_iff_dependent affine_hull_insert_span_gen) |
|
8994 apply (metis Suc_le_lessD not_less order_trans card_image_le finite_imageI dim_le_card) |
|
8995 done |
|
8996 |
|
8997 lemma empty_interior_convex_hull: |
|
8998 fixes s :: "'a::euclidean_space set" |
|
8999 assumes "finite s" and dim: "card s \<le> DIM ('a)" |
|
9000 shows "interior(convex hull s) = {}" |
|
9001 by (metis Diff_empty Diff_eq_empty_iff convex_hull_subset_affine_hull |
|
9002 interior_mono empty_interior_affine_hull [OF assms]) |
|
9003 |
|
9004 lemma explicit_subset_rel_interior_convex_hull: |
|
9005 fixes s :: "'a::euclidean_space set" |
|
9006 shows "finite s |
|
9007 \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y} |
|
9008 \<subseteq> rel_interior (convex hull s)" |
|
9009 by (force simp add: rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified]) |
|
9010 |
|
9011 lemma explicit_subset_rel_interior_convex_hull_minimal: |
|
9012 fixes s :: "'a::euclidean_space set" |
|
9013 shows "finite s |
|
9014 \<Longrightarrow> {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y} |
|
9015 \<subseteq> rel_interior (convex hull s)" |
|
9016 by (force simp add: rel_interior_convex_hull_union [where S="\<lambda>x. {x}" and I=s, simplified]) |
|
9017 |
|
9018 lemma rel_interior_convex_hull_explicit: |
|
9019 fixes s :: "'a::euclidean_space set" |
|
9020 assumes "~ affine_dependent s" |
|
9021 shows "rel_interior(convex hull s) = |
|
9022 {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}" |
|
9023 (is "?lhs = ?rhs") |
|
9024 proof |
|
9025 show "?rhs \<le> ?lhs" |
|
9026 by (simp add: aff_independent_finite explicit_subset_rel_interior_convex_hull_minimal assms) |
|
9027 next |
|
9028 show "?lhs \<le> ?rhs" |
|
9029 proof (cases "\<exists>a. s = {a}") |
|
9030 case True then show "?lhs \<le> ?rhs" |
|
9031 by force |
|
9032 next |
|
9033 case False |
|
9034 have fs: "finite s" |
|
9035 using assms by (simp add: aff_independent_finite) |
|
9036 { fix a b and d::real |
|
9037 assume ab: "a \<in> s" "b \<in> s" "a \<noteq> b" |
|
9038 then have s: "s = (s - {a,b}) \<union> {a,b}" --{*split into separate cases*} |
|
9039 by auto |
|
9040 have "(\<Sum>x\<in>s. if x = a then - d else if x = b then d else 0) = 0" |
|
9041 "(\<Sum>x\<in>s. (if x = a then - d else if x = b then d else 0) *\<^sub>R x) = d *\<^sub>R b - d *\<^sub>R a" |
|
9042 using ab fs |
|
9043 by (subst s, subst setsum.union_disjoint, auto)+ |
|
9044 } note [simp] = this |
|
9045 { fix y |
|
9046 assume y: "y \<in> convex hull s" "y \<notin> ?rhs" |
|
9047 { fix u T a |
|
9048 assume ua: "\<forall>x\<in>s. 0 \<le> u x" "setsum u s = 1" "\<not> 0 < u a" "a \<in> s" |
|
9049 and yT: "y = (\<Sum>x\<in>s. u x *\<^sub>R x)" "y \<in> T" "open T" |
|
9050 and sb: "T \<inter> affine hull s \<subseteq> {w. \<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) = w}" |
|
9051 have ua0: "u a = 0" |
|
9052 using ua by auto |
|
9053 obtain b where b: "b\<in>s" "a \<noteq> b" |
|
9054 using ua False by auto |
|
9055 obtain e where e: "0 < e" "ball (\<Sum>x\<in>s. u x *\<^sub>R x) e \<subseteq> T" |
|
9056 using yT by (auto elim: openE) |
|
9057 with b obtain d where d: "0 < d" "norm(d *\<^sub>R (a-b)) < e" |
|
9058 by (auto intro: that [of "e / 2 / norm(a-b)"]) |
|
9059 have "(\<Sum>x\<in>s. u x *\<^sub>R x) \<in> affine hull s" |
|
9060 using yT y by (metis affine_hull_convex_hull hull_redundant_eq) |
|
9061 then have "(\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b) \<in> affine hull s" |
|
9062 using ua b by (auto simp: hull_inc intro: mem_affine_3_minus2) |
|
9063 then have "y - d *\<^sub>R (a - b) \<in> T \<inter> affine hull s" |
|
9064 using d e yT by auto |
|
9065 then obtain v where "\<forall>x\<in>s. 0 \<le> v x" |
|
9066 "setsum v s = 1" |
|
9067 "(\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x) - d *\<^sub>R (a - b)" |
|
9068 using subsetD [OF sb] yT |
|
9069 by auto |
|
9070 then have False |
|
9071 using assms |
|
9072 apply (simp add: affine_dependent_explicit_finite fs) |
|
9073 apply (drule_tac x="\<lambda>x. (v x - u x) - (if x = a then -d else if x = b then d else 0)" in spec) |
|
9074 using ua b d |
|
9075 apply (auto simp: algebra_simps setsum_subtractf setsum.distrib) |
|
9076 done |
|
9077 } note * = this |
|
9078 have "y \<notin> rel_interior (convex hull s)" |
|
9079 using y |
|
9080 apply (simp add: mem_rel_interior affine_hull_convex_hull) |
|
9081 apply (auto simp: convex_hull_finite [OF fs]) |
|
9082 apply (drule_tac x=u in spec) |
|
9083 apply (auto intro: *) |
|
9084 done |
|
9085 } with rel_interior_subset show "?lhs \<le> ?rhs" |
|
9086 by blast |
|
9087 qed |
|
9088 qed |
|
9089 |
|
9090 lemma interior_convex_hull_explicit_minimal: |
|
9091 fixes s :: "'a::euclidean_space set" |
|
9092 shows |
|
9093 "~ affine_dependent s |
|
9094 ==> interior(convex hull s) = |
|
9095 (if card(s) \<le> DIM('a) then {} |
|
9096 else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})" |
|
9097 apply (simp add: aff_independent_finite empty_interior_convex_hull, clarify) |
|
9098 apply (rule trans [of _ "rel_interior(convex hull s)"]) |
|
9099 apply (simp add: affine_hull_convex_hull affine_independent_span_gt rel_interior_interior) |
|
9100 by (simp add: rel_interior_convex_hull_explicit) |
|
9101 |
|
9102 lemma interior_convex_hull_explicit: |
|
9103 fixes s :: "'a::euclidean_space set" |
|
9104 assumes "~ affine_dependent s" |
|
9105 shows |
|
9106 "interior(convex hull s) = |
|
9107 (if card(s) \<le> DIM('a) then {} |
|
9108 else {y. \<exists>u. (\<forall>x \<in> s. 0 < u x \<and> u x < 1) \<and> setsum u s = 1 \<and> (\<Sum>x\<in>s. u x *\<^sub>R x) = y})" |
|
9109 proof - |
|
9110 { fix u :: "'a \<Rightarrow> real" and a |
|
9111 assume "card Basis < card s" and u: "\<And>x. x\<in>s \<Longrightarrow> 0 < u x" "setsum u s = 1" and a: "a \<in> s" |
|
9112 then have cs: "Suc 0 < card s" |
|
9113 by (metis DIM_positive less_trans_Suc) |
|
9114 obtain b where b: "b \<in> s" "a \<noteq> b" |
|
9115 proof (cases "s \<le> {a}") |
|
9116 case True |
|
9117 then show thesis |
|
9118 using cs subset_singletonD by fastforce |
|
9119 next |
|
9120 case False |
|
9121 then show thesis |
|
9122 by (blast intro: that) |
|
9123 qed |
|
9124 have "u a + u b \<le> setsum u {a,b}" |
|
9125 using a b by simp |
|
9126 also have "... \<le> setsum u s" |
|
9127 apply (rule Groups_Big.setsum_mono2) |
|
9128 using a b u |
|
9129 apply (auto simp: less_imp_le aff_independent_finite assms) |
|
9130 done |
|
9131 finally have "u a < 1" |
|
9132 using `b \<in> s` u by fastforce |
|
9133 } note [simp] = this |
|
9134 show ?thesis |
|
9135 using assms |
|
9136 apply (auto simp: interior_convex_hull_explicit_minimal) |
|
9137 apply (rule_tac x=u in exI) |
|
9138 apply (auto simp: not_le) |
|
9139 done |
|
9140 qed |
|
9141 |
|
9142 subsection{* Similar results for closure and (relative or absolute) frontier.*} |
|
9143 |
|
9144 lemma closure_convex_hull [simp]: |
|
9145 fixes s :: "'a::euclidean_space set" |
|
9146 shows "compact s ==> closure(convex hull s) = convex hull s" |
|
9147 by (simp add: compact_imp_closed compact_convex_hull) |
|
9148 |
|
9149 lemma rel_frontier_convex_hull_explicit: |
|
9150 fixes s :: "'a::euclidean_space set" |
|
9151 assumes "~ affine_dependent s" |
|
9152 shows "rel_frontier(convex hull s) = |
|
9153 {y. \<exists>u. (\<forall>x \<in> s. 0 \<le> u x) \<and> (\<exists>x \<in> s. u x = 0) \<and> setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}" |
|
9154 proof - |
|
9155 have fs: "finite s" |
|
9156 using assms by (simp add: aff_independent_finite) |
|
9157 show ?thesis |
|
9158 apply (simp add: rel_frontier_def finite_imp_compact rel_interior_convex_hull_explicit assms fs) |
|
9159 apply (auto simp: convex_hull_finite fs) |
|
9160 apply (drule_tac x=u in spec) |
|
9161 apply (rule_tac x=u in exI) |
|
9162 apply force |
|
9163 apply (rename_tac v) |
|
9164 apply (rule notE [OF assms]) |
|
9165 apply (simp add: affine_dependent_explicit) |
|
9166 apply (rule_tac x=s in exI) |
|
9167 apply (auto simp: fs) |
|
9168 apply (rule_tac x = "\<lambda>x. u x - v x" in exI) |
|
9169 apply (force simp: setsum_subtractf scaleR_diff_left) |
|
9170 done |
|
9171 qed |
|
9172 |
|
9173 lemma frontier_convex_hull_explicit: |
|
9174 fixes s :: "'a::euclidean_space set" |
|
9175 assumes "~ affine_dependent s" |
|
9176 shows "frontier(convex hull s) = |
|
9177 {y. \<exists>u. (\<forall>x \<in> s. 0 \<le> u x) \<and> (DIM ('a) < card s \<longrightarrow> (\<exists>x \<in> s. u x = 0)) \<and> |
|
9178 setsum u s = 1 \<and> setsum (\<lambda>x. u x *\<^sub>R x) s = y}" |
|
9179 proof - |
|
9180 have fs: "finite s" |
|
9181 using assms by (simp add: aff_independent_finite) |
|
9182 show ?thesis |
|
9183 proof (cases "DIM ('a) < card s") |
|
9184 case True |
|
9185 with assms fs show ?thesis |
|
9186 by (simp add: rel_frontier_def frontier_def rel_frontier_convex_hull_explicit [symmetric] |
|
9187 interior_convex_hull_explicit_minimal rel_interior_convex_hull_explicit) |
|
9188 next |
|
9189 case False |
|
9190 then have "card s \<le> DIM ('a)" |
|
9191 by linarith |
|
9192 then show ?thesis |
|
9193 using assms fs |
|
9194 apply (simp add: frontier_def interior_convex_hull_explicit finite_imp_compact) |
|
9195 apply (simp add: convex_hull_finite) |
|
9196 done |
|
9197 qed |
|
9198 qed |
|
9199 |
|
9200 lemma rel_frontier_convex_hull_cases: |
|
9201 fixes s :: "'a::euclidean_space set" |
|
9202 assumes "~ affine_dependent s" |
|
9203 shows "rel_frontier(convex hull s) = \<Union>{convex hull (s - {x}) |x. x \<in> s}" |
|
9204 proof - |
|
9205 have fs: "finite s" |
|
9206 using assms by (simp add: aff_independent_finite) |
|
9207 { fix u a |
|
9208 have "\<forall>x\<in>s. 0 \<le> u x \<Longrightarrow> a \<in> s \<Longrightarrow> u a = 0 \<Longrightarrow> setsum u s = 1 \<Longrightarrow> |
|
9209 \<exists>x v. x \<in> s \<and> |
|
9210 (\<forall>x\<in>s - {x}. 0 \<le> v x) \<and> |
|
9211 setsum v (s - {x}) = 1 \<and> (\<Sum>x\<in>s - {x}. v x *\<^sub>R x) = (\<Sum>x\<in>s. u x *\<^sub>R x)" |
|
9212 apply (rule_tac x=a in exI) |
|
9213 apply (rule_tac x=u in exI) |
|
9214 apply (simp add: Groups_Big.setsum_diff1 fs) |
|
9215 done } |
|
9216 moreover |
|
9217 { fix a u |
|
9218 have "a \<in> s \<Longrightarrow> \<forall>x\<in>s - {a}. 0 \<le> u x \<Longrightarrow> setsum u (s - {a}) = 1 \<Longrightarrow> |
|
9219 \<exists>v. (\<forall>x\<in>s. 0 \<le> v x) \<and> |
|
9220 (\<exists>x\<in>s. v x = 0) \<and> setsum v s = 1 \<and> (\<Sum>x\<in>s. v x *\<^sub>R x) = (\<Sum>x\<in>s - {a}. u x *\<^sub>R x)" |
|
9221 apply (rule_tac x="\<lambda>x. if x = a then 0 else u x" in exI) |
|
9222 apply (auto simp: setsum.If_cases Diff_eq if_smult fs) |
|
9223 done } |
|
9224 ultimately show ?thesis |
|
9225 using assms |
|
9226 apply (simp add: rel_frontier_convex_hull_explicit) |
|
9227 apply (simp add: convex_hull_finite fs Union_SetCompr_eq, auto) |
|
9228 done |
|
9229 qed |
|
9230 |
|
9231 lemma frontier_convex_hull_eq_rel_frontier: |
|
9232 fixes s :: "'a::euclidean_space set" |
|
9233 assumes "~ affine_dependent s" |
|
9234 shows "frontier(convex hull s) = |
|
9235 (if card s \<le> DIM ('a) then convex hull s else rel_frontier(convex hull s))" |
|
9236 using assms |
|
9237 unfolding rel_frontier_def frontier_def |
|
9238 by (simp add: affine_independent_span_gt rel_interior_interior |
|
9239 finite_imp_compact empty_interior_convex_hull aff_independent_finite) |
|
9240 |
|
9241 lemma frontier_convex_hull_cases: |
|
9242 fixes s :: "'a::euclidean_space set" |
|
9243 assumes "~ affine_dependent s" |
|
9244 shows "frontier(convex hull s) = |
|
9245 (if card s \<le> DIM ('a) then convex hull s else \<Union>{convex hull (s - {x}) |x. x \<in> s})" |
|
9246 by (simp add: assms frontier_convex_hull_eq_rel_frontier rel_frontier_convex_hull_cases) |
|
9247 |
|
9248 lemma in_frontier_convex_hull: |
|
9249 fixes s :: "'a::euclidean_space set" |
|
9250 assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s" |
|
9251 shows "x \<in> frontier(convex hull s)" |
|
9252 proof (cases "affine_dependent s") |
|
9253 case True |
|
9254 with assms show ?thesis |
|
9255 apply (auto simp: affine_dependent_def frontier_def finite_imp_compact hull_inc) |
|
9256 by (metis card.insert_remove convex_hull_subset_affine_hull empty_interior_affine_hull finite_Diff hull_redundant insert_Diff insert_Diff_single insert_not_empty interior_mono not_less_eq_eq subset_empty) |
|
9257 next |
|
9258 case False |
|
9259 { assume "card s = Suc (card Basis)" |
|
9260 then have cs: "Suc 0 < card s" |
|
9261 by (simp add: DIM_positive) |
|
9262 with subset_singletonD have "\<exists>y \<in> s. y \<noteq> x" |
|
9263 by (cases "s \<le> {x}") fastforce+ |
|
9264 } note [dest!] = this |
|
9265 show ?thesis using assms |
|
9266 unfolding frontier_convex_hull_cases [OF False] Union_SetCompr_eq |
|
9267 by (auto simp: le_Suc_eq hull_inc) |
|
9268 qed |
|
9269 |
|
9270 lemma not_in_interior_convex_hull: |
|
9271 fixes s :: "'a::euclidean_space set" |
|
9272 assumes "finite s" "card s \<le> Suc (DIM ('a))" "x \<in> s" |
|
9273 shows "x \<notin> interior(convex hull s)" |
|
9274 using in_frontier_convex_hull [OF assms] |
|
9275 by (metis Diff_iff frontier_def) |
|
9276 |
|
9277 lemma interior_convex_hull_eq_empty: |
|
9278 fixes s :: "'a::euclidean_space set" |
|
9279 assumes "card s = Suc (DIM ('a))" "x \<in> s" |
|
9280 shows "interior(convex hull s) = {} \<longleftrightarrow> affine_dependent s" |
|
9281 proof - |
|
9282 { fix a b |
|
9283 assume ab: "a \<in> interior (convex hull s)" "b \<in> s" "b \<in> affine hull (s - {b})" |
|
9284 then have "interior(affine hull s) = {}" using assms |
|
9285 by (metis DIM_positive One_nat_def Suc_mono card.remove card_infinite empty_interior_affine_hull eq_iff hull_redundant insert_Diff not_less zero_le_one) |
|
9286 then have False using ab |
|
9287 by (metis convex_hull_subset_affine_hull equals0D interior_mono subset_eq) |
|
9288 } then |
|
9289 show ?thesis |
|
9290 using assms |
|
9291 apply auto |
|
9292 apply (metis UNIV_I affine_hull_convex_hull affine_hull_empty affine_independent_span_eq convex_convex_hull empty_iff rel_interior_interior rel_interior_same_affine_hull) |
|
9293 apply (auto simp: affine_dependent_def) |
|
9294 done |
|
9295 qed |
8900 |
9296 |
8901 end |
9297 end |