equal
deleted
inserted
replaced
12 imports |
12 imports |
13 Convex |
13 Convex |
14 Topology_Euclidean_Space |
14 Topology_Euclidean_Space |
15 begin |
15 begin |
16 |
16 |
17 subsection%unimportant \<open>Topological Properties of Convex Sets and Functions\<close> |
17 subsection\<^marker>\<open>tag unimportant\<close> \<open>Topological Properties of Convex Sets and Functions\<close> |
18 |
18 |
19 lemma convex_supp_sum: |
19 lemma convex_supp_sum: |
20 assumes "convex S" and 1: "supp_sum u I = 1" |
20 assumes "convex S" and 1: "supp_sum u I = 1" |
21 and "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> u i \<and> (u i = 0 \<or> f i \<in> S)" |
21 and "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> u i \<and> (u i = 0 \<or> f i \<in> S)" |
22 shows "supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S" |
22 shows "supp_sum (\<lambda>i. u i *\<^sub>R f i) I \<in> S" |
316 by (metis low_dim_interior) |
316 by (metis low_dim_interior) |
317 |
317 |
318 |
318 |
319 subsection \<open>Relative interior of a set\<close> |
319 subsection \<open>Relative interior of a set\<close> |
320 |
320 |
321 definition%important "rel_interior S = |
321 definition\<^marker>\<open>tag important\<close> "rel_interior S = |
322 {x. \<exists>T. openin (top_of_set (affine hull S)) T \<and> x \<in> T \<and> T \<subseteq> S}" |
322 {x. \<exists>T. openin (top_of_set (affine hull S)) T \<and> x \<in> T \<and> T \<subseteq> S}" |
323 |
323 |
324 lemma rel_interior_mono: |
324 lemma rel_interior_mono: |
325 "\<lbrakk>S \<subseteq> T; affine hull S = affine hull T\<rbrakk> |
325 "\<lbrakk>S \<subseteq> T; affine hull S = affine hull T\<rbrakk> |
326 \<Longrightarrow> (rel_interior S) \<subseteq> (rel_interior T)" |
326 \<Longrightarrow> (rel_interior S) \<subseteq> (rel_interior T)" |
647 by (auto split: if_split_asm) |
647 by (auto split: if_split_asm) |
648 qed |
648 qed |
649 |
649 |
650 subsubsection \<open>Relative open sets\<close> |
650 subsubsection \<open>Relative open sets\<close> |
651 |
651 |
652 definition%important "rel_open S \<longleftrightarrow> rel_interior S = S" |
652 definition\<^marker>\<open>tag important\<close> "rel_open S \<longleftrightarrow> rel_interior S = S" |
653 |
653 |
654 lemma rel_open: "rel_open S \<longleftrightarrow> openin (top_of_set (affine hull S)) S" |
654 lemma rel_open: "rel_open S \<longleftrightarrow> openin (top_of_set (affine hull S)) S" |
655 unfolding rel_open_def rel_interior_def |
655 unfolding rel_open_def rel_interior_def |
656 apply auto |
656 apply auto |
657 using openin_subopen[of "top_of_set (affine hull S)" S] |
657 using openin_subopen[of "top_of_set (affine hull S)" S] |
846 by (simp add: rel_interior_affine affine_closed) |
846 by (simp add: rel_interior_affine affine_closed) |
847 qed |
847 qed |
848 qed |
848 qed |
849 |
849 |
850 |
850 |
851 subsubsection%unimportant\<open>Relative interior preserves under linear transformations\<close> |
851 subsubsection\<^marker>\<open>tag unimportant\<close>\<open>Relative interior preserves under linear transformations\<close> |
852 |
852 |
853 lemma rel_interior_translation_aux: |
853 lemma rel_interior_translation_aux: |
854 fixes a :: "'n::euclidean_space" |
854 fixes a :: "'n::euclidean_space" |
855 shows "((\<lambda>x. a + x) ` rel_interior S) \<subseteq> rel_interior ((\<lambda>x. a + x) ` S)" |
855 shows "((\<lambda>x. a + x) ` rel_interior S) \<subseteq> rel_interior ((\<lambda>x. a + x) ` S)" |
856 proof - |
856 proof - |
1003 using assms rel_interior_injective_on_span_linear_image[of f S] |
1003 using assms rel_interior_injective_on_span_linear_image[of f S] |
1004 subset_inj_on[of f "UNIV" "span S"] |
1004 subset_inj_on[of f "UNIV" "span S"] |
1005 by auto |
1005 by auto |
1006 |
1006 |
1007 |
1007 |
1008 subsection%unimportant \<open>Openness and compactness are preserved by convex hull operation\<close> |
1008 subsection\<^marker>\<open>tag unimportant\<close> \<open>Openness and compactness are preserved by convex hull operation\<close> |
1009 |
1009 |
1010 lemma open_convex_hull[intro]: |
1010 lemma open_convex_hull[intro]: |
1011 fixes S :: "'a::real_normed_vector set" |
1011 fixes S :: "'a::real_normed_vector set" |
1012 assumes "open S" |
1012 assumes "open S" |
1013 shows "open (convex hull S)" |
1013 shows "open (convex hull S)" |
1235 qed |
1235 qed |
1236 qed |
1236 qed |
1237 qed |
1237 qed |
1238 |
1238 |
1239 |
1239 |
1240 subsection%unimportant \<open>Extremal points of a simplex are some vertices\<close> |
1240 subsection\<^marker>\<open>tag unimportant\<close> \<open>Extremal points of a simplex are some vertices\<close> |
1241 |
1241 |
1242 lemma dist_increases_online: |
1242 lemma dist_increases_online: |
1243 fixes a b d :: "'a::real_inner" |
1243 fixes a b d :: "'a::real_inner" |
1244 assumes "d \<noteq> 0" |
1244 assumes "d \<noteq> 0" |
1245 shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b" |
1245 shows "dist a (b + d) > dist a b \<or> dist a (b - d) > dist a b" |
1430 by(cases "S = {}") auto |
1430 by(cases "S = {}") auto |
1431 |
1431 |
1432 |
1432 |
1433 subsection \<open>Closest point of a convex set is unique, with a continuous projection\<close> |
1433 subsection \<open>Closest point of a convex set is unique, with a continuous projection\<close> |
1434 |
1434 |
1435 definition%important closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a" |
1435 definition\<^marker>\<open>tag important\<close> closest_point :: "'a::{real_inner,heine_borel} set \<Rightarrow> 'a \<Rightarrow> 'a" |
1436 where "closest_point S a = (SOME x. x \<in> S \<and> (\<forall>y\<in>S. dist a x \<le> dist a y))" |
1436 where "closest_point S a = (SOME x. x \<in> S \<and> (\<forall>y\<in>S. dist a x \<le> dist a y))" |
1437 |
1437 |
1438 lemma closest_point_exists: |
1438 lemma closest_point_exists: |
1439 assumes "closed S" |
1439 assumes "closed S" |
1440 and "S \<noteq> {}" |
1440 and "S \<noteq> {}" |
1620 using rel_interior_subset False by blast |
1620 using rel_interior_subset False by blast |
1621 ultimately show ?thesis by blast |
1621 ultimately show ?thesis by blast |
1622 qed |
1622 qed |
1623 |
1623 |
1624 |
1624 |
1625 subsubsection%unimportant \<open>Various point-to-set separating/supporting hyperplane theorems\<close> |
1625 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Various point-to-set separating/supporting hyperplane theorems\<close> |
1626 |
1626 |
1627 lemma supporting_hyperplane_closed_point: |
1627 lemma supporting_hyperplane_closed_point: |
1628 fixes z :: "'a::{real_inner,heine_borel}" |
1628 fixes z :: "'a::{real_inner,heine_borel}" |
1629 assumes "convex S" |
1629 assumes "convex S" |
1630 and "closed S" |
1630 and "closed S" |
1705 using False using separating_hyperplane_closed_point[OF assms] |
1705 using False using separating_hyperplane_closed_point[OF assms] |
1706 by (metis all_not_in_conv inner_zero_left inner_zero_right less_eq_real_def not_le) |
1706 by (metis all_not_in_conv inner_zero_left inner_zero_right less_eq_real_def not_le) |
1707 qed |
1707 qed |
1708 |
1708 |
1709 |
1709 |
1710 subsubsection%unimportant \<open>Now set-to-set for closed/compact sets\<close> |
1710 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Now set-to-set for closed/compact sets\<close> |
1711 |
1711 |
1712 lemma separating_hyperplane_closed_compact: |
1712 lemma separating_hyperplane_closed_compact: |
1713 fixes S :: "'a::euclidean_space set" |
1713 fixes S :: "'a::euclidean_space set" |
1714 assumes "convex S" |
1714 assumes "convex S" |
1715 and "closed S" |
1715 and "closed S" |
1795 apply (rule_tac x="-b" in exI, auto) |
1795 apply (rule_tac x="-b" in exI, auto) |
1796 done |
1796 done |
1797 qed |
1797 qed |
1798 |
1798 |
1799 |
1799 |
1800 subsubsection%unimportant \<open>General case without assuming closure and getting non-strict separation\<close> |
1800 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>General case without assuming closure and getting non-strict separation\<close> |
1801 |
1801 |
1802 lemma separating_hyperplane_set_0: |
1802 lemma separating_hyperplane_set_0: |
1803 assumes "convex S" "(0::'a::euclidean_space) \<notin> S" |
1803 assumes "convex S" "(0::'a::euclidean_space) \<notin> S" |
1804 shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>S. 0 \<le> inner a x)" |
1804 shows "\<exists>a. a \<noteq> 0 \<and> (\<forall>x\<in>S. 0 \<le> inner a x)" |
1805 proof - |
1805 proof - |
1853 by (intro exI[of _ a] exI[of _ "SUP x\<in>S. a \<bullet> x"]) |
1853 by (intro exI[of _ a] exI[of _ "SUP x\<in>S. a \<bullet> x"]) |
1854 (auto intro!: cSUP_upper bdd cSUP_least \<open>a \<noteq> 0\<close> \<open>S \<noteq> {}\<close> *) |
1854 (auto intro!: cSUP_upper bdd cSUP_least \<open>a \<noteq> 0\<close> \<open>S \<noteq> {}\<close> *) |
1855 qed |
1855 qed |
1856 |
1856 |
1857 |
1857 |
1858 subsection%unimportant \<open>More convexity generalities\<close> |
1858 subsection\<^marker>\<open>tag unimportant\<close> \<open>More convexity generalities\<close> |
1859 |
1859 |
1860 lemma convex_closure [intro,simp]: |
1860 lemma convex_closure [intro,simp]: |
1861 fixes S :: "'a::real_normed_vector set" |
1861 fixes S :: "'a::real_normed_vector set" |
1862 assumes "convex S" |
1862 assumes "convex S" |
1863 shows "convex (closure S)" |
1863 shows "convex (closure S)" |
1896 |
1896 |
1897 lemma convex_hull_eq_empty[simp]: "convex hull S = {} \<longleftrightarrow> S = {}" |
1897 lemma convex_hull_eq_empty[simp]: "convex hull S = {} \<longleftrightarrow> S = {}" |
1898 using hull_subset[of S convex] convex_hull_empty by auto |
1898 using hull_subset[of S convex] convex_hull_empty by auto |
1899 |
1899 |
1900 |
1900 |
1901 subsection%unimportant \<open>Convex set as intersection of halfspaces\<close> |
1901 subsection\<^marker>\<open>tag unimportant\<close> \<open>Convex set as intersection of halfspaces\<close> |
1902 |
1902 |
1903 lemma convex_halfspace_intersection: |
1903 lemma convex_halfspace_intersection: |
1904 fixes s :: "('a::euclidean_space) set" |
1904 fixes s :: "('a::euclidean_space) set" |
1905 assumes "closed s" "convex s" |
1905 assumes "closed s" "convex s" |
1906 shows "s = \<Inter>{h. s \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}" |
1906 shows "s = \<Inter>{h. s \<subseteq> h \<and> (\<exists>a b. h = {x. inner a x \<le> b})}" |
1920 apply (erule_tac x="-b" in allE, auto) |
1920 apply (erule_tac x="-b" in allE, auto) |
1921 done |
1921 done |
1922 qed auto |
1922 qed auto |
1923 |
1923 |
1924 |
1924 |
1925 subsection%unimportant \<open>Convexity of general and special intervals\<close> |
1925 subsection\<^marker>\<open>tag unimportant\<close> \<open>Convexity of general and special intervals\<close> |
1926 |
1926 |
1927 lemma is_interval_convex: |
1927 lemma is_interval_convex: |
1928 fixes S :: "'a::euclidean_space set" |
1928 fixes S :: "'a::euclidean_space set" |
1929 assumes "is_interval S" |
1929 assumes "is_interval S" |
1930 shows "convex S" |
1930 shows "convex S" |
2005 |
2005 |
2006 lemma connected_imp_perfect_aff_dim: |
2006 lemma connected_imp_perfect_aff_dim: |
2007 "\<lbrakk>connected S; aff_dim S \<noteq> 0; a \<in> S\<rbrakk> \<Longrightarrow> a islimpt S" |
2007 "\<lbrakk>connected S; aff_dim S \<noteq> 0; a \<in> S\<rbrakk> \<Longrightarrow> a islimpt S" |
2008 using aff_dim_sing connected_imp_perfect by blast |
2008 using aff_dim_sing connected_imp_perfect by blast |
2009 |
2009 |
2010 subsection%unimportant \<open>On \<open>real\<close>, \<open>is_interval\<close>, \<open>convex\<close> and \<open>connected\<close> are all equivalent\<close> |
2010 subsection\<^marker>\<open>tag unimportant\<close> \<open>On \<open>real\<close>, \<open>is_interval\<close>, \<open>convex\<close> and \<open>connected\<close> are all equivalent\<close> |
2011 |
2011 |
2012 lemma mem_is_interval_1_I: |
2012 lemma mem_is_interval_1_I: |
2013 fixes a b c::real |
2013 fixes a b c::real |
2014 assumes "is_interval S" |
2014 assumes "is_interval S" |
2015 assumes "a \<in> S" "c \<in> S" |
2015 assumes "a \<in> S" "c \<in> S" |
2097 and is_interval_oo: "is_interval {r<..<s}" |
2097 and is_interval_oo: "is_interval {r<..<s}" |
2098 and is_interval_oc: "is_interval {r<..s}" |
2098 and is_interval_oc: "is_interval {r<..s}" |
2099 and is_interval_co: "is_interval {r..<s}" |
2099 and is_interval_co: "is_interval {r..<s}" |
2100 by (simp_all add: is_interval_convex_1) |
2100 by (simp_all add: is_interval_convex_1) |
2101 |
2101 |
2102 subsection%unimportant \<open>Another intermediate value theorem formulation\<close> |
2102 subsection\<^marker>\<open>tag unimportant\<close> \<open>Another intermediate value theorem formulation\<close> |
2103 |
2103 |
2104 lemma ivt_increasing_component_on_1: |
2104 lemma ivt_increasing_component_on_1: |
2105 fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
2105 fixes f :: "real \<Rightarrow> 'a::euclidean_space" |
2106 assumes "a \<le> b" |
2106 assumes "a \<le> b" |
2107 and "continuous_on {a..b} f" |
2107 and "continuous_on {a..b} f" |
2142 shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow> |
2142 shows "a \<le> b \<Longrightarrow> \<forall>x\<in>{a..b}. continuous (at x) f \<Longrightarrow> |
2143 f b\<bullet>k \<le> y \<Longrightarrow> y \<le> f a\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y" |
2143 f b\<bullet>k \<le> y \<Longrightarrow> y \<le> f a\<bullet>k \<Longrightarrow> \<exists>x\<in>{a..b}. (f x)\<bullet>k = y" |
2144 by (rule ivt_decreasing_component_on_1) (auto simp: continuous_at_imp_continuous_on) |
2144 by (rule ivt_decreasing_component_on_1) (auto simp: continuous_at_imp_continuous_on) |
2145 |
2145 |
2146 |
2146 |
2147 subsection%unimportant \<open>A bound within an interval\<close> |
2147 subsection\<^marker>\<open>tag unimportant\<close> \<open>A bound within an interval\<close> |
2148 |
2148 |
2149 lemma convex_hull_eq_real_cbox: |
2149 lemma convex_hull_eq_real_cbox: |
2150 fixes x y :: real assumes "x \<le> y" |
2150 fixes x y :: real assumes "x \<le> y" |
2151 shows "convex hull {x, y} = cbox x y" |
2151 shows "convex hull {x, y} = cbox x y" |
2152 proof (rule hull_unique) |
2152 proof (rule hull_unique) |
2233 using unit_cube_convex_hull by auto |
2233 using unit_cube_convex_hull by auto |
2234 then show ?thesis |
2234 then show ?thesis |
2235 by (rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` S"]) (auto simp: convex_hull_affinity *) |
2235 by (rule_tac that[of "(\<lambda>y. x - ?d + (2 * d) *\<^sub>R y)` S"]) (auto simp: convex_hull_affinity *) |
2236 qed |
2236 qed |
2237 |
2237 |
2238 subsection%unimportant\<open>Representation of any interval as a finite convex hull\<close> |
2238 subsection\<^marker>\<open>tag unimportant\<close>\<open>Representation of any interval as a finite convex hull\<close> |
2239 |
2239 |
2240 lemma image_stretch_interval: |
2240 lemma image_stretch_interval: |
2241 "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) = |
2241 "(\<lambda>x. \<Sum>k\<in>Basis. (m k * (x\<bullet>k)) *\<^sub>R k) ` cbox a (b::'a::euclidean_space) = |
2242 (if (cbox a b) = {} then {} else |
2242 (if (cbox a b) = {} then {} else |
2243 cbox (\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k::'a) |
2243 cbox (\<Sum>k\<in>Basis. (min (m k * (a\<bullet>k)) (m k * (b\<bullet>k))) *\<^sub>R k::'a) |
2310 apply (simp add: eq [symmetric] cbox_image_unit_interval [OF False]) |
2310 apply (simp add: eq [symmetric] cbox_image_unit_interval [OF False]) |
2311 done |
2311 done |
2312 qed |
2312 qed |
2313 |
2313 |
2314 |
2314 |
2315 subsection%unimportant \<open>Bounded convex function on open set is continuous\<close> |
2315 subsection\<^marker>\<open>tag unimportant\<close> \<open>Bounded convex function on open set is continuous\<close> |
2316 |
2316 |
2317 lemma convex_on_bounded_continuous: |
2317 lemma convex_on_bounded_continuous: |
2318 fixes S :: "('a::real_normed_vector) set" |
2318 fixes S :: "('a::real_normed_vector) set" |
2319 assumes "open S" |
2319 assumes "open S" |
2320 and "convex_on S f" |
2320 and "convex_on S f" |
2403 qed (insert \<open>0<e\<close>, auto) |
2403 qed (insert \<open>0<e\<close>, auto) |
2404 qed (insert \<open>0<e\<close> \<open>0<k\<close> \<open>0<B\<close>, auto simp: field_simps) |
2404 qed (insert \<open>0<e\<close> \<open>0<k\<close> \<open>0<B\<close>, auto simp: field_simps) |
2405 qed |
2405 qed |
2406 |
2406 |
2407 |
2407 |
2408 subsection%unimportant \<open>Upper bound on a ball implies upper and lower bounds\<close> |
2408 subsection\<^marker>\<open>tag unimportant\<close> \<open>Upper bound on a ball implies upper and lower bounds\<close> |
2409 |
2409 |
2410 lemma convex_bounds_lemma: |
2410 lemma convex_bounds_lemma: |
2411 fixes x :: "'a::real_normed_vector" |
2411 fixes x :: "'a::real_normed_vector" |
2412 assumes "convex_on (cball x e) f" |
2412 assumes "convex_on (cball x e) f" |
2413 and "\<forall>y \<in> cball x e. f y \<le> b" |
2413 and "\<forall>y \<in> cball x e. f y \<le> b" |
2437 then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" |
2437 then show "\<bar>f y\<bar> \<le> b + 2 * \<bar>f x\<bar>" |
2438 using zero_le_dist[of x y] by auto |
2438 using zero_le_dist[of x y] by auto |
2439 qed |
2439 qed |
2440 |
2440 |
2441 |
2441 |
2442 subsubsection%unimportant \<open>Hence a convex function on an open set is continuous\<close> |
2442 subsubsection\<^marker>\<open>tag unimportant\<close> \<open>Hence a convex function on an open set is continuous\<close> |
2443 |
2443 |
2444 lemma real_of_nat_ge_one_iff: "1 \<le> real (n::nat) \<longleftrightarrow> 1 \<le> n" |
2444 lemma real_of_nat_ge_one_iff: "1 \<le> real (n::nat) \<longleftrightarrow> 1 \<le> n" |
2445 by auto |
2445 by auto |
2446 |
2446 |
2447 lemma convex_on_continuous: |
2447 lemma convex_on_continuous: |