diff --git a/thys/Euler_Polyhedron_Formula/Inclusion_Exclusion.thy b/thys/Euler_Polyhedron_Formula/Inclusion_Exclusion.thy --- a/thys/Euler_Polyhedron_Formula/Inclusion_Exclusion.thy +++ b/thys/Euler_Polyhedron_Formula/Inclusion_Exclusion.thy @@ -1,295 +1,296 @@ section \Inclusion-exclusion principle\ text \Inclusion-exclusion principle, the usual and generalized forms.\ theory Inclusion_Exclusion imports Main begin lemma subset_insert_lemma: "{T. T \ (insert a S) \ P T} = {T. T \ S \ P T} \ {insert a T |T. T \ S \ P(insert a T)}" (is "?L=?R") proof show "?L \ ?R" by (smt (verit) UnI1 UnI2 insert_Diff mem_Collect_eq subsetI subset_insert_iff) qed blast locale Incl_Excl = fixes P :: "'a set \ bool" and f :: "'a set \ 'b::ring_1" assumes disj_add: "\P S; P T; disjnt S T\ \ f(S \ T) = f S + f T" and empty: "P{}" and Int: "\P S; P T\ \ P(S \ T)" and Un: "\P S; P T\ \ P(S \ T)" and Diff: "\P S; P T\ \ P(S - T)" begin lemma f_empty [simp]: "f{} = 0" using disj_add empty by fastforce lemma f_Un_Int: "\P S; P T\ \ f(S \ T) + f(S \ T) = f S + f T" - by (smt (verit, ccfv_threshold) Groups.add_ac(2) Incl_Excl.Diff Incl_Excl.Int Incl_Excl_axioms Int_Diff_Un Int_Diff_disjoint Int_absorb Un_Diff Un_Int_eq(2) disj_add disjnt_def group_cancel.add2 sup_bot.right_neutral) + by (smt (verit, ccfv_threshold) Diff Int Groups.add_ac Incl_Excl.Diff Incl_Excl.Int Incl_Excl_axioms Int_Diff_Un Int_Diff_disjoint Int_absorb Un_Diff Un_Int_eq disj_add disjnt_def group_cancel.add2 sup_bot.right_neutral) + lemma restricted_indexed: assumes "finite A" and X: "\a. a \ A \ P(X a)" shows "f(\(X ` A)) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\ (X ` B)))" proof - have "\finite A; card A = n; \a \ A. P (X a)\ \ f(\(X ` A)) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\ (X ` B)))" for n X and A :: "'c set" proof (induction n arbitrary: A X rule: less_induct) case (less n0 A0 X) show ?case proof (cases "n0=0") case True with less show ?thesis by fastforce next case False with less.prems obtain A n a where *: "n0 = Suc n" "A0 = insert a A" "a \ A" "card A = n" "finite A" by (metis card_Suc_eq_finite not0_implies_Suc) with less have "P (X a)" by blast have APX: "\a \ A. P (X a)" by (simp add: "*" less.prems) have PUXA: "P (\ (X ` A))" using \finite A\ APX by (induction) (auto simp: empty Un) have "f (\ (X ` A0)) = f (X a \ \ (X ` A))" by (simp add: *) also have "... = f (X a) + f (\ (X ` A)) - f (X a \ \ (X ` A))" using f_Un_Int add_diff_cancel PUXA \P (X a)\ by metis also have "... = f (X a) - (\B | B \ A \ B \ {}. (- 1) ^ card B * f (\ (X ` B))) + (\B | B \ A \ B \ {}. (- 1) ^ card B * f (X a \ \ (X ` B)))" proof - have 1: "f (\i\A. X a \ X i) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\b\B. X a \ X b))" using less.IH [of n A "\i. X a \ X i"] APX Int \P (X a)\ by (simp add: *) have 2: "X a \ \ (X ` A) = (\i\A. X a \ X i)" by auto have 3: "f (\ (X ` A)) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\ (X ` B)))" using less.IH [of n A X] APX Int \P (X a)\ by (simp add: *) show ?thesis unfolding 3 2 1 by (simp add: sum_negf) qed also have "... = (\B | B \ A0 \ B \ {}. (- 1) ^ (card B + 1) * f (\ (X ` B)))" proof - have F: "{insert a B |B. B \ A} = insert a ` Pow A \ {B. B \ A \ B \ {}} = Pow A - {{}}" by auto have G: "(\B\Pow A. (- 1) ^ card (insert a B) * f (X a \ \ (X ` B))) = (\B\Pow A. - ((- 1) ^ card B * f (X a \ \ (X ` B))))" proof (rule sum.cong [OF refl]) fix B assume B: "B \ Pow A" then have "finite B" using \finite A\ finite_subset by auto show "(- 1) ^ card (insert a B) * f (X a \ \ (X ` B)) = - ((- 1) ^ card B * f (X a \ \ (X ` B)))" using B * by (auto simp add: card_insert_if \finite B\) qed have disj: "{B. B \ A \ B \ {}} \ {insert a B |B. B \ A} = {}" using * by blast have inj: "inj_on (insert a) (Pow A)" using "*" inj_on_def by fastforce show ?thesis apply (simp add: * subset_insert_lemma sum.union_disjoint disj sum_negf) apply (simp add: F G sum_negf sum.reindex [OF inj] o_def sum_diff *) done qed finally show ?thesis . qed qed then show ?thesis by (meson assms) qed lemma restricted: assumes "finite A" "\a. a \ A \ P a" shows "f(\ A) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\ B))" using restricted_indexed [of A "\x. x"] assms by auto end subsection\Versions for unrestrictedly additive functions\ lemma Incl_Excl_UN: fixes f :: "'a set \ 'b::ring_1" assumes "\S T. disjnt S T \ f(S \ T) = f S + f T" "finite A" shows "f(\(G ` A)) = (\B | B \ A \ B \ {}. (-1) ^ (card B + 1) * f (\ (G ` B)))" proof - interpret Incl_Excl "\x. True" f by (simp add: Incl_Excl.intro assms(1)) show ?thesis using restricted_indexed assms by blast qed lemma Incl_Excl_Union: fixes f :: "'a set \ 'b::ring_1" assumes "\S T. disjnt S T \ f(S \ T) = f S + f T" "finite A" shows "f(\ A) = (\B | B \ A \ B \ {}. (- 1) ^ (card B + 1) * f (\ B))" using Incl_Excl_UN[of f A "\X. X"] assms by simp text \The famous inclusion-exclusion formula for the cardinality of a union\ lemma int_card_UNION: assumes "finite A" "\K. K \ A \ finite K" shows "int (card (\A)) = (\I | I \ A \ I \ {}. (- 1) ^ (card I + 1) * int (card (\I)))" proof - interpret Incl_Excl finite "int o card" proof qed (auto simp add: card_Un_disjnt) show ?thesis using restricted assms by auto qed text\A more conventional form\ lemma inclusion_exclusion: assumes "finite A" "\K. K \ A \ finite K" shows "int(card(\ A)) = (\n=1..card A. (-1) ^ (Suc n) * (\B | B \ A \ card B = n. int (card (\ B))))" (is "_=?R") proof - have fin: "finite {I. I \ A \ I \ {}}" by (simp add: assms) have "\k. \Suc 0 \ k; k \ card A\ \ \B\A. B \ {} \ k = card B" by (metis (mono_tags, lifting) Suc_le_D Zero_neq_Suc card_eq_0_iff obtain_subset_with_card_n) with \finite A\ finite_subset have card_eq: "card ` {I. I \ A \ I \ {}} = {1..card A}" using not_less_eq_eq card_mono by (fastforce simp: image_iff) have "int(card(\ A)) = (\y = 1..card A. \I\{x. x \ A \ x \ {} \ card x = y}. - ((- 1) ^ y * int (card (\ I))))" by (simp add: int_card_UNION assms sum.image_gen [OF fin, where g=card] card_eq) also have "... = ?R" proof - have "{B. B \ A \ B \ {} \ card B = k} = {B. B \ A \ card B = k}" if "Suc 0 \ k" and "k \ card A" for k using that by auto then show ?thesis by (clarsimp simp add: sum_negf simp flip: sum_distrib_left) qed finally show ?thesis . qed lemma card_UNION: assumes "finite A" and "\K. K \ A \ finite K" shows "card (\A) = nat (\I | I \ A \ I \ {}. (- 1) ^ (card I + 1) * int (card (\I)))" by (simp only: flip: int_card_UNION [OF assms]) lemma card_UNION_nonneg: assumes "finite A" and "\K. K \ A \ finite K" shows "(\I | I \ A \ I \ {}. (- 1) ^ (card I + 1) * int (card (\I))) \ 0" using int_card_UNION [OF assms] by presburger subsection \a general "Moebius inversion" inclusion-exclusion principle. This "symmetric" form is from Ira Gessel: "Symmetric Inclusion-Exclusion" \ lemma sum_Un_eq: "\S \ T = {}; S \ T = U; finite U\ \ (sum f S + sum f T = sum f U)" by (metis finite_Un sum.union_disjoint) lemma card_adjust_lemma: "\inj_on f S; x = y + card (f ` S)\ \ x = y + card S" by (simp add: card_image) lemma card_subsets_step: assumes "finite S" "x \ S" "U \ S" shows "card {T. T \ (insert x S) \ U \ T \ odd(card T)} = card {T. T \ S \ U \ T \ odd(card T)} + card {T. T \ S \ U \ T \ even(card T)} \ card {T. T \ (insert x S) \ U \ T \ even(card T)} = card {T. T \ S \ U \ T \ even(card T)} + card {T. T \ S \ U \ T \ odd(card T)}" proof - have inj: "inj_on (insert x) {T. T \ S \ P T}" for P using assms by (auto simp: inj_on_def) have [simp]: "finite {T. T \ S \ P T}" "finite (insert x ` {T. T \ S \ P T})" for P using \finite S\ by auto have [simp]: "disjnt {T. T \ S \ P T} (insert x ` {T. T \ S \ Q T})" for P Q using assms by (auto simp: disjnt_iff) have eq: "{T. T \ S \ U \ T \ P T} \ insert x ` {T. T \ S \ U \ T \ Q T} = {T. T \ insert x S \ U \ T \ P T}" (is "?L = ?R") if "\A. A \ S \ Q (insert x A) \ P A" "\A. \ Q A \ P A" for P Q proof show "?L \ ?R" by (clarsimp simp: image_iff subset_iff) (meson subsetI that) show "?R \ ?L" using \U \ S\ by (clarsimp simp: image_iff) (smt (verit) insert_iff mk_disjoint_insert subset_iff that) qed have [simp]: "\A. A \ S \ even (card (insert x A)) \ odd (card A)" by (metis \finite S\ \x \ S\ card_insert_disjoint even_Suc finite_subset subsetD) show ?thesis by (intro conjI card_adjust_lemma [OF inj]; simp add: eq flip: card_Un_disjnt) qed lemma card_subsupersets_even_odd: assumes "finite S" "U \ S" shows "card {T. T \ S \ U \ T \ even(card T)} = card {T. T \ S \ U \ T \ odd(card T)}" using assms proof (induction "card S" arbitrary: S rule: less_induct) case (less S) then obtain x where "x \ U" "x \ S" by blast then have U: "U \ S - {x}" using less.prems(2) by blast let ?V = "S - {x}" show ?case using card_subsets_step [of ?V x U] less.prems U by (simp add: insert_absorb \x \ S\) qed lemma sum_alternating_cancels: assumes "finite S" "card {x. x \ S \ even(f x)} = card {x. x \ S \ odd(f x)}" shows "(\x\S. (-1) ^ f x) = (0::'b::ring_1)" proof - have "(\x\S. (-1) ^ f x) = (\x | x \ S \ even (f x). (-1) ^ f x) + (\x | x \ S \ odd (f x). (-1) ^ f x)" by (rule sum_Un_eq [symmetric]; force simp: \finite S\) also have "... = (0::'b::ring_1)" by (simp add: minus_one_power_iff assms cong: conj_cong) finally show ?thesis . qed lemma inclusion_exclusion_symmetric: fixes f :: "'a set \ 'b::ring_1" assumes \
: "\S. finite S \ g S = (\T \ Pow S. (-1) ^ card T * f T)" and "finite S" shows "f S = (\T \ Pow S. (-1) ^ card T * g T)" proof - have "(-1) ^ card T * g T = (-1) ^ card T * (\U | U \ S \ U \ T. (-1) ^ card U * f U)" if "T \ S" for T proof - have [simp]: "{U. U \ S \ U \ T} = Pow T" using that by auto show ?thesis using that by (simp add: \finite S\ finite_subset \
) qed then have "(\T \ Pow S. (-1) ^ card T * g T) = (\T\Pow S. (-1) ^ card T * (\U | U \ {U. U \ S} \ U \ T. (-1) ^ card U * f U))" by simp also have "... = (\U\Pow S. (\T | T \ S \ U \ T. (-1) ^ card T) * (-1) ^ card U * f U)" unfolding sum_distrib_left by (subst sum.swap_restrict; simp add: \finite S\ algebra_simps sum_distrib_right Pow_def) also have "... = (\U\Pow S. if U=S then f S else 0)" proof - have [simp]: "{T. T \ S \ S \ T} = {S}" by auto show ?thesis apply (rule sum.cong [OF refl]) by (simp add: sum_alternating_cancels card_subsupersets_even_odd \finite S\ flip: power_add) qed also have "... = f S" by (simp add: \finite S\) finally show ?thesis by presburger qed text\ The more typical non-symmetric version. \ lemma inclusion_exclusion_mobius: fixes f :: "'a set \ 'b::ring_1" assumes \
: "\S. finite S \ g S = sum f (Pow S)" and "finite S" shows "f S = (\T \ Pow S. (-1) ^ (card S - card T) * g T)" (is "_ = ?rhs") proof - have "(- 1) ^ card S * f S = (\T\Pow S. (- 1) ^ card T * g T)" by (rule inclusion_exclusion_symmetric; simp add: assms flip: power_add mult.assoc) then have "((- 1) ^ card S * (- 1) ^ card S) * f S = ((- 1) ^ card S) * (\T\Pow S. (- 1) ^ card T * g T)" by (simp add: mult_ac) then have "f S = (\T\Pow S. (- 1) ^ (card S + card T) * g T)" by (simp add: sum_distrib_left flip: power_add mult.assoc) also have "... = ?rhs" by (simp add: \finite S\ card_mono neg_one_power_add_eq_neg_one_power_diff) finally show ?thesis . qed end \ No newline at end of file diff --git a/thys/Euler_Polyhedron_Formula/Library_Extras.thy b/thys/Euler_Polyhedron_Formula/Library_Extras.thy --- a/thys/Euler_Polyhedron_Formula/Library_Extras.thy +++ b/thys/Euler_Polyhedron_Formula/Library_Extras.thy @@ -1,896 +1,747 @@ section \Library Extras\ text \For adding to the repository\ theory Library_Extras imports "HOL-Analysis.Polytope" begin -section \Preliminaries\ - -lemma Inter_over_Union: - "\ {\ (\ x) |x. x \ S} = \ {\ (G ` S) |G. \x\S. G x \ \ x}" -proof - - have "\x. \s\S. \X \ \ s. x \ X \ \G. (\x\S. G x \ \ x) \ (\s\S. x \ G s)" - by metis - then show ?thesis - by (auto simp flip: all_simps ex_simps) -qed - -lemmas closure_Int_convex = convex_closure_inter_two - -lemmas span_not_UNIV_orthogonal = span_not_univ_orthogonal - -lemma convex_closure_rel_interior_Int: - assumes "\S. S\\ \ convex (S :: 'n::euclidean_space set)" - and "\(rel_interior ` \) \ {}" - shows "\(closure ` \) \ closure (\(rel_interior ` \))" -proof - - obtain x where x: "\S\\. x \ rel_interior S" - using assms by auto - show ?thesis - proof - fix y - assume y: "y \ \ (closure ` \)" - show "y \ closure (\(rel_interior ` \))" - proof (cases "y=x") - case True - with closure_subset x show ?thesis - by fastforce - next - case False - { fix \ :: real - assume e: "\ > 0" - define e1 where "e1 = min 1 (\/norm (y - x))" - then have e1: "e1 > 0" "e1 \ 1" "e1 * norm (y - x) \ \" - using \y \ x\ \\ > 0\ le_divide_eq[of e1 \ "norm (y - x)"] - by simp_all - define z where "z = y - e1 *\<^sub>R (y - x)" - { - fix S - assume "S \ \" - then have "z \ rel_interior S" - using rel_interior_closure_convex_shrink[of S x y e1] assms x y e1 z_def - by auto - } - then have *: "z \ \(rel_interior ` \)" - by auto - have "\x\\ (rel_interior ` \). dist x y \ \" - using \y \ x\ z_def * e1 e dist_norm[of z y] - by force - } then - show ?thesis - by (auto simp: closure_approachable_le) - qed - qed -qed - - -lemma closure_Inter_convex: - fixes \ :: "'n::euclidean_space set set" - assumes "\S. S \ \ \ convex S" and "\(rel_interior ` \) \ {}" - shows "closure(\\) = \(closure ` \)" -proof - - have "\(closure ` \) \ closure (\(rel_interior ` \))" - by (meson assms convex_closure_rel_interior_Int) - moreover - have "closure (\(rel_interior ` \)) \ closure (\\)" - using rel_interior_inter_aux closure_mono[of "\(rel_interior ` \)" "\\"] - by auto - ultimately show ?thesis - using closure_Int[of \] by blast -qed - -lemma closure_Inter_convex_open: - "(\S::'n::euclidean_space set. S \ \ \ convex S \ open S) - \ closure(\\) = (if \\ = {} then {} else \(closure ` \))" - by (simp add: closure_Inter_convex rel_interior_open) - -lemma empty_interior_subset_hyperplane_aux: - fixes S :: "'a::euclidean_space set" - assumes "convex S" "0 \ S" and empty_int: "interior S = {}" - shows "\a b. a\0 \ S \ {x. a \ x = b}" -proof - - have False if "\a. a = 0 \ (\b. \T \ S. a \ T \ b)" - proof - - have rel_int: "rel_interior S \ {}" - using assms rel_interior_eq_empty by auto - moreover - have "dim S \ dim (UNIV::'a set)" - by (metis aff_dim_zero affine_hull_UNIV \0 \ S\ dim_UNIV empty_int hull_inc rel_int rel_interior_interior) - then obtain a where "a \ 0" and a: "span S \ {x. a \ x = 0}" - using lowdim_subset_hyperplane - by (metis dim_UNIV dim_subset_UNIV order_less_le) - have "span UNIV = span S" - by (metis span_base span_not_UNIV_orthogonal that) - then have "UNIV \ affine hull S" - by (simp add: \0 \ S\ hull_inc affine_hull_span_0) - ultimately show False - using \rel_interior S \ {}\ empty_int rel_interior_interior by blast - qed - then show ?thesis - by blast -qed - -lemma empty_interior_subset_hyperplane: - fixes S :: "'a::euclidean_space set" - assumes "convex S" and int: "interior S = {}" - obtains a b where "a \ 0" "S \ {x. a \ x = b}" -proof (cases "S = {}") - case True - then show ?thesis - using that by blast -next - case False - then obtain u where "u \ S" - by blast - have "\a b. a \ 0 \ (\x. x - u) ` S \ {x. a \ x = b}" - proof (rule empty_interior_subset_hyperplane_aux) - show "convex ((\x. x - u) ` S)" - using \convex S\ by force - show "0 \ (\x. x - u) ` S" - by (simp add: \u \ S\) - show "interior ((\x. x - u) ` S) = {}" - by (simp add: int interior_translation_subtract) - qed - then obtain a b where "a \ 0" and ab: "(\x. x - u) ` S \ {x. a \ x = b}" - by metis - then have "S \ {x. a \ x = b + (a \ u)}" - using ab by (auto simp: algebra_simps) - then show ?thesis - using \a \ 0\ that by auto -qed - -lemma aff_dim_psubset: - "(affine hull S) \ (affine hull T) \ aff_dim S < aff_dim T" - by (metis aff_dim_affine_hull aff_dim_empty aff_dim_subset affine_affine_hull affine_dim_equal order_less_le) - -lemma aff_dim_eq_full_gen: - "S \ T \ (aff_dim S = aff_dim T \ affine hull S = affine hull T)" - by (smt (verit, del_insts) aff_dim_affine_hull2 aff_dim_psubset hull_mono psubsetI) - -lemma aff_dim_eq_full: - fixes S :: "'n::euclidean_space set" - shows "aff_dim S = (DIM('n)) \ affine hull S = UNIV" - by (metis aff_dim_UNIV aff_dim_affine_hull affine_hull_UNIV) - - section \Conic sets and conic hull\ definition conic :: "'a::real_vector set \ bool" where "conic S \ \x c. x \ S \ 0 \ c \ (c *\<^sub>R x) \ S" lemma conicD: "\conic S; x \ S; 0 \ c\ \ (c *\<^sub>R x) \ S" by (meson conic_def) lemma subspace_imp_conic: "subspace S \ conic S" by (simp add: conic_def subspace_def) lemma conic_empty [simp]: "conic {}" using conic_def by blast lemma conic_UNIV: "conic UNIV" by (simp add: conic_def) lemma conic_Inter: "(\S. S \ \ \ conic S) \ conic(\\)" by (simp add: conic_def) lemma conic_linear_image: "\conic S; linear f\ \ conic(f ` S)" by (smt (verit) conic_def image_iff linear.scaleR) lemma conic_linear_image_eq: "\linear f; inj f\ \ conic (f ` S) \ conic S" by (smt (verit) conic_def conic_linear_image inj_image_mem_iff linear_cmul) lemma conic_mul: "\conic S; x \ S; 0 \ c\ \ (c *\<^sub>R x) \ S" using conic_def by blast lemma conic_conic_hull: "conic(conic hull S)" by (metis (no_types, lifting) conic_Inter hull_def mem_Collect_eq) lemma conic_hull_eq: "(conic hull S = S) \ conic S" by (metis conic_conic_hull hull_same) lemma conic_hull_UNIV [simp]: "conic hull UNIV = UNIV" by simp lemma conic_negations: "conic S \ conic (image uminus S)" by (auto simp: conic_def image_iff) lemma conic_span [iff]: "conic(span S)" by (simp add: subspace_imp_conic) lemma conic_hull_explicit: "conic hull S = {c *\<^sub>R x| c x. 0 \ c \ x \ S}" proof (rule hull_unique) show "S \ {c *\<^sub>R x |c x. 0 \ c \ x \ S}" by (metis (no_types) cone_hull_expl hull_subset) show "conic {c *\<^sub>R x |c x. 0 \ c \ x \ S}" using mult_nonneg_nonneg by (force simp: conic_def) qed (auto simp: conic_def) lemma conic_hull_as_image: "conic hull S = (\z. fst z *\<^sub>R snd z) ` ({0..} \ S)" by (force simp: conic_hull_explicit) lemma conic_hull_linear_image: "linear f \ conic hull f ` S = f ` (conic hull S)" by (force simp: conic_hull_explicit image_iff set_eq_iff linear_scale) lemma conic_hull_image_scale: assumes "\x. x \ S \ 0 < c x" shows "conic hull (\x. c x *\<^sub>R x) ` S = conic hull S" proof show "conic hull (\x. c x *\<^sub>R x) ` S \ conic hull S" proof (rule hull_minimal) show "(\x. c x *\<^sub>R x) ` S \ conic hull S" using assms conic_hull_explicit by fastforce qed (simp add: conic_conic_hull) show "conic hull S \ conic hull (\x. c x *\<^sub>R x) ` S" proof (rule hull_minimal) { fix x assume "x \ S" then have "x = inverse(c x) *\<^sub>R c x *\<^sub>R x" using assms by fastforce then have "x \ conic hull (\x. c x *\<^sub>R x) ` S" by (smt (verit, best) \x \ S\ assms conic_conic_hull conic_mul hull_inc image_eqI inverse_nonpositive_iff_nonpositive) } then show "S \ conic hull (\x. c x *\<^sub>R x) ` S" by auto qed (simp add: conic_conic_hull) qed lemma convex_conic_hull: assumes "convex S" shows "convex (conic hull S)" proof - { fix c x d y and u :: real assume \
: "(0::real) \ c" "x \ S" "(0::real) \ d" "y \ S" "0 \ u" "u \ 1" have "\c'' x''. ((1 - u) * c) *\<^sub>R x + (u * d) *\<^sub>R y = c'' *\<^sub>R x'' \ 0 \ c'' \ x'' \ S" proof (cases "(1 - u) * c = 0") case True with \0 \ d\ \y \ S\\0 \ u\ show ?thesis by force next case False define \ where "\ \ (1 - u) * c + u * d" have *: "c * u \ c" by (simp add: "\
" mult_left_le) have "\ > 0" using False \
by (smt (verit, best) \_def split_mult_pos_le) then have **: "c + d * u = \ + c * u" by (simp add: \_def mult.commute right_diff_distrib') show ?thesis proof (intro exI conjI) show "0 \ \" using \0 < \\ by auto show "((1 - u) * c) *\<^sub>R x + (u * d) *\<^sub>R y = \ *\<^sub>R (((1 - u) * c / \) *\<^sub>R x + (u * d / \) *\<^sub>R y)" using \\ > 0\ by (simp add: algebra_simps diff_divide_distrib) show "((1 - u) * c / \) *\<^sub>R x + (u * d / \) *\<^sub>R y \ S" using \0 < \\ by (intro convexD [OF assms]) (auto simp: \
field_split_simps * **) qed qed } then show ?thesis by (auto simp add: conic_hull_explicit convex_alt) qed lemma conic_halfspace_le: "conic {x. a \ x \ 0}" by (auto simp: conic_def mult_le_0_iff) lemma conic_halfspace_ge: "conic {x. a \ x \ 0}" by (auto simp: conic_def mult_le_0_iff) lemma conic_hull_empty [simp]: "conic hull {} = {}" by (simp add: conic_hull_eq) lemma conic_contains_0: "conic S \ (0 \ S \ S \ {})" by (simp add: Convex.cone_def cone_contains_0 conic_def) lemma conic_hull_eq_empty: "conic hull S = {} \ (S = {})" using conic_hull_explicit by fastforce lemma conic_sums: "\conic S; conic T\ \ conic (\x\ S. \y \ T. {x + y})" by (simp add: conic_def) (metis scaleR_right_distrib) lemma conic_Times: "\conic S; conic T\ \ conic(S \ T)" by (auto simp: conic_def) lemma conic_Times_eq: "conic(S \ T) \ S = {} \ T = {} \ conic S \ conic T" (is "?lhs = ?rhs") proof show "?lhs \ ?rhs" by (force simp: conic_def) show "?rhs \ ?lhs" by (force simp: conic_Times) qed lemma conic_hull_0 [simp]: "conic hull {0} = {0}" by (simp add: conic_hull_eq subspace_imp_conic) lemma conic_hull_contains_0 [simp]: "0 \ conic hull S \ (S \ {})" by (simp add: conic_conic_hull conic_contains_0 conic_hull_eq_empty) lemma conic_hull_eq_sing: "conic hull S = {x} \ S = {0} \ x = 0" proof show "conic hull S = {x} \ S = {0} \ x = 0" by (metis conic_conic_hull conic_contains_0 conic_def conic_hull_eq hull_inc insert_not_empty singleton_iff) qed simp lemma conic_hull_Int_affine_hull: assumes "T \ S" "0 \ affine hull S" shows "(conic hull T) \ (affine hull S) = T" proof - have TaffS: "T \ affine hull S" using \T \ S\ hull_subset by fastforce moreover { fix c x assume "c *\<^sub>R x \ affine hull S" and "0 \ c" and "x \ T" have "c *\<^sub>R x \ T" proof (cases "c=1") case True then show ?thesis by (simp add: \x \ T\) next case False then have "x /\<^sub>R (1 - c) = x + (c * inverse (1 - c)) *\<^sub>R x" by (smt (verit, ccfv_SIG) diff_add_cancel mult.commute real_vector_affinity_eq scaleR_collapse scaleR_scaleR) then have "0 = inverse(1 - c) *\<^sub>R c *\<^sub>R x + (1 - inverse(1 - c)) *\<^sub>R x" by (simp add: algebra_simps) then have "0 \ affine hull S" by (smt (verit) \c *\<^sub>R x \ affine hull S\ \x \ T\ affine_affine_hull TaffS in_mono mem_affine) then show ?thesis using assms by auto qed } then have "conic hull T \ affine hull S \ T" by (auto simp: conic_hull_explicit) ultimately show ?thesis by (auto simp: hull_inc) qed lemma open_in_subset_relative_interior: fixes S :: "'a::euclidean_space set" shows "openin (top_of_set (affine hull T)) S \ (S \ rel_interior T) = (S \ T)" by (meson order.trans rel_interior_maximal rel_interior_subset) lemma conic_hull_eq_span_affine_hull: fixes S :: "'a::euclidean_space set" assumes "0 \ rel_interior S" shows "conic hull S = span S \ conic hull S = affine hull S" proof - obtain \ where "\>0" and \: "cball 0 \ \ affine hull S \ S" using assms mem_rel_interior_cball by blast have *: "affine hull S = span S" by (meson affine_hull_span_0 assms hull_inc mem_rel_interior_cball) moreover have "conic hull S \ span S" by (simp add: hull_minimal span_superset) moreover { fix x assume "x \ affine hull S" have "x \ conic hull S" proof (cases "x=0") case True then show ?thesis using \x \ affine hull S\ by auto next case False then have "(\ / norm x) *\<^sub>R x \ cball 0 \ \ affine hull S" using \0 < \\ \x \ affine hull S\ * span_mul by fastforce then have "(\ / norm x) *\<^sub>R x \ S" by (meson \ subsetD) then have "\c xa. x = c *\<^sub>R xa \ 0 \ c \ xa \ S" by (smt (verit, del_insts) \0 < \\ divide_nonneg_nonneg eq_vector_fraction_iff norm_eq_zero norm_ge_zero) then show ?thesis by (simp add: conic_hull_explicit) qed } then have "affine hull S \ conic hull S" by auto ultimately show ?thesis by blast qed lemma conic_hull_eq_span: fixes S :: "'a::euclidean_space set" assumes "0 \ rel_interior S" shows "conic hull S = span S" by (simp add: assms conic_hull_eq_span_affine_hull) lemma conic_hull_eq_affine_hull: fixes S :: "'a::euclidean_space set" assumes "0 \ rel_interior S" shows "conic hull S = affine hull S" using assms conic_hull_eq_span_affine_hull by blast lemma conic_hull_eq_span_eq: fixes S :: "'a::euclidean_space set" shows "0 \ rel_interior(conic hull S) \ conic hull S = span S" (is "?lhs = ?rhs") proof show "?lhs \ ?rhs" by (metis conic_hull_eq_span conic_span hull_hull hull_minimal hull_subset span_eq) show "?rhs \ ?lhs" by (metis rel_interior_affine subspace_affine subspace_span) qed section\Closure of conic hulls\ proposition closedin_conic_hull: fixes S :: "'a::euclidean_space set" assumes "compact T" "0 \ T" "T \ S" shows "closedin (top_of_set (conic hull S)) (conic hull T)" proof - have **: "compact ({0..} \ T \ (\z. fst z *\<^sub>R snd z) -` K)" (is "compact ?L") if "K \ (\z. (fst z) *\<^sub>R snd z) ` ({0..} \ S)" "compact K" for K proof - obtain r where "r > 0" and r: "\x. x \ K \ norm x \ r" by (metis \compact K\ bounded_normE compact_imp_bounded) show ?thesis unfolding compact_eq_bounded_closed proof have "bounded ({0..r / setdist{0}T} \ T)" by (simp add: assms(1) bounded_Times compact_imp_bounded) moreover { fix a b assume "a *\<^sub>R b \ K" and "b \ T" and "0 \ a" have "setdist {0} T \ 0" using \b \ T\ assms compact_imp_closed setdist_eq_0_closed by auto then have T0: "setdist {0} T > 0" using less_eq_real_def by fastforce then have "a * setdist {0} T \ r" by (smt (verit, ccfv_SIG) \0 \ a\ \a *\<^sub>R b \ K\ \b \ T\ dist_0_norm mult_mono' norm_scaleR r setdist_le_dist singletonI) with T0 \r>0\ have "a \ r / setdist {0} T" by (simp add: divide_simps) } then have "?L \ ({0..r / setdist{0}T} \ T)" by auto ultimately show "bounded ?L" by (meson bounded_subset) show "closed ?L" proof (rule continuous_closed_preimage) show "continuous_on ({0..} \ T) (\z. fst z *\<^sub>R snd z)" by (intro continuous_intros) show "closed ({0::real..} \ T)" by (simp add: assms(1) closed_Times compact_imp_closed) show "closed K" by (simp add: compact_imp_closed that(2)) qed qed qed show ?thesis unfolding conic_hull_as_image proof (rule proper_map) show "compact ({0..} \ T \ (\z. fst z *\<^sub>R snd z) -` K)" (is "compact ?L") if "K \ (\z. (fst z) *\<^sub>R snd z) ` ({0..} \ S)" "compact K" for K proof - obtain r where "r > 0" and r: "\x. x \ K \ norm x \ r" by (metis \compact K\ bounded_normE compact_imp_bounded) show ?thesis unfolding compact_eq_bounded_closed proof have "bounded ({0..r / setdist{0}T} \ T)" by (simp add: assms(1) bounded_Times compact_imp_bounded) moreover { fix a b assume "a *\<^sub>R b \ K" and "b \ T" and "0 \ a" have "setdist {0} T \ 0" using \b \ T\ assms compact_imp_closed setdist_eq_0_closed by auto then have T0: "setdist {0} T > 0" using less_eq_real_def by fastforce then have "a * setdist {0} T \ r" by (smt (verit, ccfv_SIG) \0 \ a\ \a *\<^sub>R b \ K\ \b \ T\ dist_0_norm mult_mono' norm_scaleR r setdist_le_dist singletonI) with T0 \r>0\ have "a \ r / setdist {0} T" by (simp add: divide_simps) } then have "?L \ ({0..r / setdist{0}T} \ T)" by auto ultimately show "bounded ?L" by (meson bounded_subset) show "closed ?L" proof (rule continuous_closed_preimage) show "continuous_on ({0..} \ T) (\z. fst z *\<^sub>R snd z)" by (intro continuous_intros) show "closed ({0::real..} \ T)" by (simp add: assms(1) closed_Times compact_imp_closed) show "closed K" by (simp add: compact_imp_closed that(2)) qed qed qed show "(\z. fst z *\<^sub>R snd z) ` ({0::real..} \ T) \ (\z. fst z *\<^sub>R snd z) ` ({0..} \ S)" using \T \ S\ by force qed auto qed lemma closed_conic_hull: fixes S :: "'a::euclidean_space set" assumes "0 \ rel_interior S \ compact S \ 0 \ S" shows "closed(conic hull S)" using assms proof assume "0 \ rel_interior S" then show "closed (conic hull S)" by (simp add: conic_hull_eq_span) next assume "compact S \ 0 \ S" then have "closedin (top_of_set UNIV) (conic hull S)" using closedin_conic_hull by force then show "closed (conic hull S)" by simp qed lemma conic_closure: fixes S :: "'a::euclidean_space set" shows "conic S \ conic(closure S)" by (meson Convex.cone_def cone_closure conic_def) lemma closure_conic_hull: fixes S :: "'a::euclidean_space set" assumes "0 \ rel_interior S \ bounded S \ ~(0 \ closure S)" shows "closure(conic hull S) = conic hull (closure S)" using assms proof assume "0 \ rel_interior S" then show "closure (conic hull S) = conic hull closure S" by (metis closed_affine_hull closure_closed closure_same_affine_hull closure_subset conic_hull_eq_affine_hull subsetD subset_rel_interior) next have "\x. x \ conic hull closure S \ x \ closure (conic hull S)" by (metis (no_types, opaque_lifting) closure_mono conic_closure conic_conic_hull subset_eq subset_hull) moreover assume "bounded S \ 0 \ closure S" then have "\x. x \ closure (conic hull S) \ x \ conic hull closure S" by (metis closed_conic_hull closure_Un_frontier closure_closed closure_mono compact_closure hull_Un_subset le_sup_iff subsetD) ultimately show "closure (conic hull S) = conic hull closure S" by blast qed lemma faces_of_linear_image: "\linear f; inj f\ \ {T. T face_of (f ` S)} = (image f) ` {T. T face_of S}" by (smt (verit) Collect_cong face_of_def face_of_linear_image setcompr_eq_image subset_imageE) lemma face_of_conic: assumes "conic S" "f face_of S" shows "conic f" unfolding conic_def proof (intro strip) fix x and c::real assume "x \ f" and "0 \ c" have f: "\a b x. \a \ S; b \ S; x \ f; x \ open_segment a b\ \ a \ f \ b \ f" using \f face_of S\ face_ofD by blast show "c *\<^sub>R x \ f" proof (cases "x=0 \ c=1") case True then show ?thesis using \x \ f\ by auto next case False with \0 \ c\ obtain d e where de: "0 \ d" "0 \ e" "d < 1" "1 < e" "d < e" "(d = c \ e = c)" apply (simp add: neq_iff) by (metis gt_ex less_eq_real_def order_less_le_trans zero_less_one) then obtain [simp]: "c *\<^sub>R x \ S" "e *\<^sub>R x \ S" \x \ S\ using \x \ f\ assms conic_mul face_of_imp_subset by blast have "x \ open_segment (d *\<^sub>R x) (e *\<^sub>R x)" if "c *\<^sub>R x \ f" using de False that apply (simp add: in_segment) apply (rule exI [where x="(1 - d) / (e - d)"]) apply (simp add: field_simps) by (smt (verit, del_insts) add_divide_distrib divide_self scaleR_collapse) then show ?thesis using \conic S\ f [of "d *\<^sub>R x" "e *\<^sub>R x" x] de \x \ f\ by (force simp: conic_def in_segment) qed qed lemma extreme_point_of_conic: assumes "conic S" and x: "x extreme_point_of S" shows "x = 0" proof - have "{x} face_of S" by (simp add: face_of_singleton x) then have "conic{x}" using assms(1) face_of_conic by blast then show ?thesis by (force simp: conic_def) qed section \Convex cones and corresponding hulls\ definition convex_cone :: "'a::real_vector set \ bool" where "convex_cone \ \S. S \ {} \ convex S \ conic S" lemma convex_cone_iff: "convex_cone S \ 0 \ S \ (\x \ S. \y \ S. x + y \ S) \ (\x \ S. \c\0. c *\<^sub>R x \ S)" by (metis cone_def conic_contains_0 conic_def convex_cone convex_cone_def) lemma convex_cone_add: "\convex_cone S; x \ S; y \ S\ \ x+y \ S" by (simp add: convex_cone_iff) lemma convex_cone_scaleR: "\convex_cone S; 0 \ c; x \ S\ \ c *\<^sub>R x \ S" by (simp add: convex_cone_iff) lemma convex_cone_nonempty: "convex_cone S \ S \ {}" by (simp add: convex_cone_def) lemma convex_cone_linear_image: "convex_cone S \ linear f \ convex_cone(f ` S)" by (simp add: conic_linear_image convex_cone_def convex_linear_image) lemma convex_cone_linear_image_eq: "\linear f; inj f\ \ (convex_cone(f ` S) \ convex_cone S)" by (simp add: conic_linear_image_eq convex_cone_def) lemma convex_cone_halfspace_ge: "convex_cone {x. a \ x \ 0}" by (simp add: convex_cone_iff inner_simps(2)) lemma convex_cone_halfspace_le: "convex_cone {x. a \ x \ 0}" by (simp add: convex_cone_iff inner_right_distrib mult_nonneg_nonpos) lemma convex_cone_contains_0: "convex_cone S \ 0 \ S" using convex_cone_iff by blast lemma convex_cone_Inter: "(\S. S \ f \ convex_cone S) \ convex_cone(\ f)" by (simp add: convex_cone_iff) lemma convex_cone_convex_cone_hull: "convex_cone(convex_cone hull S)" by (metis (no_types, lifting) convex_cone_Inter hull_def mem_Collect_eq) lemma convex_convex_cone_hull: "convex(convex_cone hull S)" by (meson convex_cone_convex_cone_hull convex_cone_def) lemma conic_convex_cone_hull: "conic(convex_cone hull S)" by (metis convex_cone_convex_cone_hull convex_cone_def) lemma convex_cone_hull_nonempty: "convex_cone hull S \ {}" by (simp add: convex_cone_convex_cone_hull convex_cone_nonempty) lemma convex_cone_hull_contains_0: "0 \ convex_cone hull S" by (simp add: convex_cone_contains_0 convex_cone_convex_cone_hull) lemma convex_cone_hull_add: "\x \ convex_cone hull S; y \ convex_cone hull S\ \ x + y \ convex_cone hull S" by (simp add: convex_cone_add convex_cone_convex_cone_hull) lemma convex_cone_hull_mul: "\x \ convex_cone hull S; 0 \ c\ \ (c *\<^sub>R x) \ convex_cone hull S" by (simp add: conic_convex_cone_hull conic_mul) lemma convex_cone_sums: "\convex_cone S; convex_cone T\ \ convex_cone (\x\ S. \y \ T. {x + y})" by (simp add: convex_cone_def conic_sums convex_sums) lemma convex_cone_Times: "\convex_cone S; convex_cone T\ \ convex_cone(S \ T)" by (simp add: conic_Times convex_Times convex_cone_def) lemma convex_cone_Times_D1: "convex_cone (S \ T) \ convex_cone S" by (metis Times_empty conic_Times_eq convex_cone_def convex_convex_hull convex_hull_Times hull_same times_eq_iff) lemma convex_cone_Times_eq: "convex_cone(S \ T) \ convex_cone S \ convex_cone T" proof (cases "S={} \ T={}") case True then show ?thesis by (auto dest: convex_cone_nonempty) next case False then have "convex_cone (S \ T) \ convex_cone T" by (metis conic_Times_eq convex_cone_def convex_convex_hull convex_hull_Times hull_same times_eq_iff) then show ?thesis using convex_cone_Times convex_cone_Times_D1 by blast qed lemma convex_cone_hull_Un: "convex_cone hull(S \ T) = (\x \ convex_cone hull S. \y \ convex_cone hull T. {x + y})" (is "?lhs = ?rhs") proof show "?lhs \ ?rhs" proof (rule hull_minimal) show "S \ T \ (\x\convex_cone hull S. \y\convex_cone hull T. {x + y})" apply (clarsimp simp: subset_iff) by (metis add_0 convex_cone_hull_contains_0 group_cancel.rule0 hull_inc) show "convex_cone (\x\convex_cone hull S. \y\convex_cone hull T. {x + y})" by (simp add: convex_cone_convex_cone_hull convex_cone_sums) qed next show "?rhs \ ?lhs" by clarify (metis convex_cone_hull_add hull_mono le_sup_iff subsetD subsetI) qed lemma convex_cone_singleton [iff]: "convex_cone {0}" by (simp add: convex_cone_iff) lemma convex_hull_subset_convex_cone_hull: "convex hull S \ convex_cone hull S" by (simp add: convex_convex_cone_hull hull_minimal hull_subset) lemma conic_hull_subset_convex_cone_hull: "conic hull S \ convex_cone hull S" by (simp add: conic_convex_cone_hull hull_minimal hull_subset) lemma subspace_imp_convex_cone: "subspace S \ convex_cone S" by (simp add: convex_cone_iff subspace_def) lemma convex_cone_span: "convex_cone(span S)" by (simp add: subspace_imp_convex_cone) lemma convex_cone_negations: "convex_cone S \ convex_cone (image uminus S)" by (simp add: convex_cone_linear_image module_hom_uminus) lemma subspace_convex_cone_symmetric: "subspace S \ convex_cone S \ (\x \ S. -x \ S)" by (smt (verit) convex_cone_iff scaleR_left.minus subspace_def subspace_neg) lemma convex_cone_hull_separate_nonempty: assumes "S \ {}" shows "convex_cone hull S = conic hull (convex hull S)" (is "?lhs = ?rhs") proof show "?lhs \ ?rhs" by (simp add: assms conic_conic_hull conic_hull_eq_empty convex_cone_def convex_conic_hull hull_inc hull_minimal subsetI) show "?rhs \ ?lhs" by (simp add: conic_convex_cone_hull convex_hull_subset_convex_cone_hull subset_hull) qed lemma convex_cone_hull_empty [simp]: "convex_cone hull {} = {0}" by (metis convex_cone_hull_contains_0 convex_cone_singleton hull_redundant hull_same) lemma convex_cone_hull_separate: "convex_cone hull S = insert 0 (conic hull (convex hull S))" by (cases "S={}") (simp_all add: convex_cone_hull_separate_nonempty insert_absorb) lemma convex_cone_hull_convex_hull_nonempty: "S \ {} \ convex_cone hull S = (\x \ convex hull S. \c\{0..}. {c *\<^sub>R x})" by (force simp: convex_cone_hull_separate_nonempty conic_hull_as_image) lemma convex_cone_hull_convex_hull: "convex_cone hull S = insert 0 (\x \ convex hull S. \c\{0..}. {c *\<^sub>R x})" by (force simp: convex_cone_hull_separate conic_hull_as_image) lemma convex_cone_hull_linear_image: "linear f \ convex_cone hull (f ` S) = image f (convex_cone hull S)" by (metis (no_types, lifting) conic_hull_linear_image convex_cone_hull_separate convex_hull_linear_image image_insert linear_0) subsection \Finitely generated cone is polyhedral, and hence closed\ proposition polyhedron_convex_cone_hull: fixes S :: "'a::euclidean_space set" assumes "finite S" shows "polyhedron(convex_cone hull S)" proof (cases "S = {}") case True then show ?thesis by (simp add: affine_imp_polyhedron) next case False then have "polyhedron(convex hull (insert 0 S))" by (simp add: assms polyhedron_convex_hull) then obtain F a b where "finite F" and F: "convex hull (insert 0 S) = \ F" and ab: "\h. h \ F \ a h \ 0 \ h = {x. a h \ x \ b h}" unfolding polyhedron_def by metis then have "F \ {}" by (metis bounded_convex_hull finite_imp_bounded Inf_empty assms finite_insert not_bounded_UNIV) show ?thesis unfolding polyhedron_def proof (intro exI conjI) show "convex_cone hull S = \ {h \ F. b h = 0}" (is "?lhs = ?rhs") proof show "?lhs \ ?rhs" proof (rule hull_minimal) show "S \ \ {h \ F. b h = 0}" by (smt (verit, best) F InterE InterI hull_subset insert_subset mem_Collect_eq subset_eq) have "\S. \S \ F; b S = 0\ \ convex_cone S" by (metis ab convex_cone_halfspace_le) then show "convex_cone (\ {h \ F. b h = 0})" by (force intro: convex_cone_Inter) qed have "x \ convex_cone hull S" if x: "\h. \h \ F; b h = 0\ \ x \ h" for x proof - have "\t. 0 < t \ (t *\<^sub>R x) \ h" if "h \ F" for h proof (cases "b h = 0") case True then show ?thesis by (metis x linordered_field_no_ub mult_1 scaleR_one that zero_less_mult_iff) next case False then have "b h > 0" by (smt (verit, del_insts) F InterE ab hull_subset inner_zero_right insert_subset mem_Collect_eq that) then have "0 \ interior {x. a h \ x \ b h}" by (simp add: ab that) then have "0 \ interior h" using ab that by auto then obtain \ where "0 < \" and \: "ball 0 \ \ h" using mem_interior by blast show ?thesis proof (cases "x=0") case True then show ?thesis using \ \0 < \\ by auto next case False with \ \0 < \\ show ?thesis by (intro exI [where x="\ / (2 * norm x)"]) (auto simp: divide_simps) qed qed then obtain t where t: "\h. h \ F \ 0 < t h \ (t h *\<^sub>R x) \ h" by metis then have "Inf (t ` F) *\<^sub>R x /\<^sub>R Inf (t ` F) = x" by (smt (verit) \F \ {}\ \finite F\ field_simps(58) finite_imageI finite_less_Inf_iff image_iff image_is_empty) moreover have "Inf (t ` F) *\<^sub>R x /\<^sub>R Inf (t ` F) \ convex_cone hull S" proof (rule conicD [OF conic_convex_cone_hull]) have "Inf (t ` F) *\<^sub>R x \ \ F" proof clarify fix h assume "h \ F" have eq: "Inf (t ` F) *\<^sub>R x = (1 - Inf(t ` F) / t h) *\<^sub>R 0 + (Inf(t ` F) / t h) *\<^sub>R t h *\<^sub>R x" using \h \ F\ t by force show "Inf (t ` F) *\<^sub>R x \ h" unfolding eq proof (rule convexD_alt) have "h = {x. a h \ x \ b h}" by (simp add: \h \ F\ ab) then show "convex h" by (metis convex_halfspace_le) show "0 \ h" by (metis F InterE \h \ F\ hull_subset insertCI subsetD) show "t h *\<^sub>R x \ h" by (simp add: \h \ F\ t) show "0 \ Inf (t ` F) / t h" by (metis \F \ {}\ \h \ F\ cINF_greatest divide_nonneg_pos less_eq_real_def t) show "Inf (t ` F) / t h \ 1" by (simp add: \finite F\ \h \ F\ cInf_le_finite t) qed qed moreover have "convex hull (insert 0 S) \ convex_cone hull S" by (simp add: convex_cone_hull_contains_0 convex_convex_cone_hull hull_minimal hull_subset) ultimately show "Inf (t ` F) *\<^sub>R x \ convex_cone hull S" using F by blast show "0 \ inverse (Inf (t ` F))" using t by (simp add: \F \ {}\ \finite F\ finite_less_Inf_iff less_eq_real_def) qed ultimately show ?thesis by auto qed then show "?rhs \ ?lhs" by auto qed show "\h\{h \ F. b h = 0}. \a b. a \ 0 \ h = {x. a \ x \ b}" using ab by blast qed (auto simp: \finite F\) qed lemma closed_convex_cone_hull: fixes S :: "'a::euclidean_space set" shows "finite S \ closed(convex_cone hull S)" by (simp add: polyhedron_convex_cone_hull polyhedron_imp_closed) lemma polyhedron_convex_cone_hull_polytope: fixes S :: "'a::euclidean_space set" shows "polytope S \ polyhedron(convex_cone hull S)" by (metis convex_cone_hull_separate hull_hull polyhedron_convex_cone_hull polytope_def) lemma polyhedron_conic_hull_polytope: fixes S :: "'a::euclidean_space set" shows "polytope S \ polyhedron(conic hull S)" by (metis conic_hull_eq_empty convex_cone_hull_separate_nonempty hull_hull polyhedron_convex_cone_hull_polytope polyhedron_empty polytope_def) lemma closed_conic_hull_strong: fixes S :: "'a::euclidean_space set" shows "0 \ rel_interior S \ polytope S \ compact S \ ~(0 \ S) \ closed(conic hull S)" using closed_conic_hull polyhedron_conic_hull_polytope polyhedron_imp_closed by blast end \ No newline at end of file