1847 apply clarify |
1847 apply clarify |
1848 apply (rule closure_ball_lemma) |
1848 apply (rule closure_ball_lemma) |
1849 apply (simp add: zero_less_dist_iff) |
1849 apply (simp add: zero_less_dist_iff) |
1850 done |
1850 done |
1851 |
1851 |
|
1852 (* In a trivial vector space, this fails for e = 0. *) |
1852 lemma interior_cball: |
1853 lemma interior_cball: |
1853 fixes x :: "real ^ _" (* FIXME: generalize *) |
1854 fixes x :: "'a::{real_normed_vector, perfect_space}" |
1854 shows "interior(cball x e) = ball x e" |
1855 shows "interior (cball x e) = ball x e" |
1855 proof(cases "e\<ge>0") |
1856 proof(cases "e\<ge>0") |
1856 case False note cs = this |
1857 case False note cs = this |
1857 from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover |
1858 from cs have "ball x e = {}" using ball_empty[of e x] by auto moreover |
1858 { fix y assume "y \<in> cball x e" |
1859 { fix y assume "y \<in> cball x e" |
1859 hence False unfolding mem_cball using dist_nz[of x y] cs by auto } |
1860 hence False unfolding mem_cball using dist_nz[of x y] cs by auto } |
1864 case True note cs = this |
1865 case True note cs = this |
1865 have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover |
1866 have "ball x e \<subseteq> cball x e" using ball_subset_cball by auto moreover |
1866 { fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S" |
1867 { fix S y assume as: "S \<subseteq> cball x e" "open S" "y\<in>S" |
1867 then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast |
1868 then obtain d where "d>0" and d:"\<forall>x'. dist x' y < d \<longrightarrow> x' \<in> S" unfolding open_dist by blast |
1868 |
1869 |
1869 then obtain xa where xa:"dist y xa = d / 2" using vector_choose_dist[of "d/2" y] by auto |
1870 then obtain xa where xa_y: "xa \<noteq> y" and xa: "dist xa y < d" |
1870 hence xa_y:"xa \<noteq> y" using dist_nz[of y xa] using `d>0` by auto |
1871 using perfect_choose_dist [of d] by auto |
1871 have "xa\<in>S" using d[THEN spec[where x=xa]] using xa apply(auto simp add: dist_commute) unfolding dist_nz[THEN sym] using xa_y by auto |
1872 have "xa\<in>S" using d[THEN spec[where x=xa]] using xa by(auto simp add: dist_commute) |
1872 hence xa_cball:"xa \<in> cball x e" using as(1) by auto |
1873 hence xa_cball:"xa \<in> cball x e" using as(1) by auto |
1873 |
1874 |
1874 hence "y \<in> ball x e" proof(cases "x = y") |
1875 hence "y \<in> ball x e" proof(cases "x = y") |
1875 case True |
1876 case True |
1876 hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute) |
1877 hence "e>0" using xa_y[unfolded dist_nz] xa_cball[unfolded mem_cball] by (auto simp add: dist_commute) |
1877 thus "y \<in> ball x e" using `x = y ` by simp |
1878 thus "y \<in> ball x e" using `x = y ` by simp |
1878 next |
1879 next |
1879 case False |
1880 case False |
1880 have "dist (y + (d / 2 / dist y x) *s (y - x)) y < d" unfolding dist_norm |
1881 have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) y < d" unfolding dist_norm |
1881 using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by auto |
1882 using `d>0` norm_ge_zero[of "y - x"] `x \<noteq> y` by (auto simp add: norm_scaleR) |
1882 hence *:"y + (d / 2 / dist y x) *s (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast |
1883 hence *:"y + (d / 2 / dist y x) *\<^sub>R (y - x) \<in> cball x e" using d as(1)[unfolded subset_eq] by blast |
1883 have "y - x \<noteq> 0" using `x \<noteq> y` by auto |
1884 have "y - x \<noteq> 0" using `x \<noteq> y` by auto |
1884 hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym] |
1885 hence **:"d / (2 * norm (y - x)) > 0" unfolding zero_less_norm_iff[THEN sym] |
1885 using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto |
1886 using `d>0` divide_pos_pos[of d "2*norm (y - x)"] by auto |
1886 |
1887 |
1887 have "dist (y + (d / 2 / dist y x) *s (y - x)) x = norm (y + (d / (2 * norm (y - x))) *s y - (d / (2 * norm (y - x))) *s x - x)" |
1888 have "dist (y + (d / 2 / dist y x) *\<^sub>R (y - x)) x = norm (y + (d / (2 * norm (y - x))) *\<^sub>R y - (d / (2 * norm (y - x))) *\<^sub>R x - x)" |
1888 by (auto simp add: dist_norm vector_ssub_ldistrib add_diff_eq) |
1889 by (auto simp add: dist_norm algebra_simps) |
1889 also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *s (y - x))" |
1890 also have "\<dots> = norm ((1 + d / (2 * norm (y - x))) *\<^sub>R (y - x))" |
1890 by (auto simp add: vector_sadd_rdistrib vector_smult_lid ring_simps vector_sadd_rdistrib vector_ssub_ldistrib) |
1891 by (auto simp add: algebra_simps) |
1891 also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)" using ** by auto |
1892 also have "\<dots> = \<bar>1 + d / (2 * norm (y - x))\<bar> * norm (y - x)" |
|
1893 using ** by (auto simp add: norm_scaleR) |
1892 also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm) |
1894 also have "\<dots> = (dist y x) + d/2"using ** by (auto simp add: left_distrib dist_norm) |
1893 finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute) |
1895 finally have "e \<ge> dist x y +d/2" using *[unfolded mem_cball] by (auto simp add: dist_commute) |
1894 thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto |
1896 thus "y \<in> ball x e" unfolding mem_ball using `d>0` by auto |
1895 qed } |
1897 qed } |
1896 hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto |
1898 hence "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e" by auto |
1897 ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto |
1899 ultimately show ?thesis using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto |
1898 qed |
1900 qed |
1899 |
1901 |
1900 lemma frontier_ball: |
1902 lemma frontier_ball: |
1901 fixes a :: "real ^ _" (* FIXME: generalize *) |
1903 fixes a :: "'a::real_normed_vector" |
1902 shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}" |
1904 shows "0 < e ==> frontier(ball a e) = {x. dist a x = e}" |
1903 apply (simp add: frontier_def closure_ball interior_open open_ball order_less_imp_le) |
1905 apply (simp add: frontier_def closure_ball interior_open open_ball order_less_imp_le) |
1904 apply (simp add: expand_set_eq) |
1906 apply (simp add: expand_set_eq) |
1905 by arith |
1907 by arith |
1906 |
1908 |
1907 lemma frontier_cball: |
1909 lemma frontier_cball: |
1908 fixes a :: "real ^ _" (* FIXME: generalize *) |
1910 fixes a :: "'a::{real_normed_vector, perfect_space}" |
1909 shows "frontier(cball a e) = {x. dist a x = e}" |
1911 shows "frontier(cball a e) = {x. dist a x = e}" |
1910 apply (simp add: frontier_def interior_cball closed_cball closure_closed order_less_imp_le) |
1912 apply (simp add: frontier_def interior_cball closed_cball closure_closed order_less_imp_le) |
1911 apply (simp add: expand_set_eq) |
1913 apply (simp add: expand_set_eq) |
1912 by arith |
1914 by arith |
1913 |
1915 |
1915 apply (simp add: expand_set_eq not_le) |
1917 apply (simp add: expand_set_eq not_le) |
1916 by (metis zero_le_dist dist_self order_less_le_trans) |
1918 by (metis zero_le_dist dist_self order_less_le_trans) |
1917 lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty) |
1919 lemma cball_empty: "e < 0 ==> cball x e = {}" by (simp add: cball_eq_empty) |
1918 |
1920 |
1919 lemma cball_eq_sing: |
1921 lemma cball_eq_sing: |
1920 fixes x :: "real ^ _" (* FIXME: generalize *) |
1922 fixes x :: "'a::perfect_space" |
1921 shows "(cball x e = {x}) \<longleftrightarrow> e = 0" |
1923 shows "(cball x e = {x}) \<longleftrightarrow> e = 0" |
1922 proof- |
1924 proof (rule linorder_cases) |
1923 { assume as:"\<forall>xa. (dist x xa \<le> e) = (xa = x)" |
1925 assume e: "0 < e" |
1924 hence "e \<ge> 0" apply (erule_tac x=x in allE) by auto |
1926 obtain a where "a \<noteq> x" "dist a x < e" |
1925 then obtain y where y:"dist x y = e" using vector_choose_dist[of e] by auto |
1927 using perfect_choose_dist [OF e] by auto |
1926 hence "e = 0" using as apply(erule_tac x=y in allE) by auto |
1928 hence "a \<noteq> x" "dist x a \<le> e" by (auto simp add: dist_commute) |
1927 } |
1929 with e show ?thesis by (auto simp add: expand_set_eq) |
1928 thus ?thesis unfolding expand_set_eq mem_cball by (auto simp add: dist_nz) |
1930 qed auto |
1929 qed |
|
1930 |
1931 |
1931 lemma cball_sing: |
1932 lemma cball_sing: |
1932 fixes x :: "real ^ _" (* FIXME: generalize *) |
1933 fixes x :: "'a::metric_space" |
1933 shows "e = 0 ==> cball x e = {x}" by (simp add: cball_eq_sing) |
1934 shows "e = 0 ==> cball x e = {x}" |
|
1935 by (auto simp add: expand_set_eq) |
1934 |
1936 |
1935 text{* For points in the interior, localization of limits makes no difference. *} |
1937 text{* For points in the interior, localization of limits makes no difference. *} |
1936 |
1938 |
1937 lemma eventually_within_interior: |
1939 lemma eventually_within_interior: |
1938 assumes "x \<in> interior S" |
1940 assumes "x \<in> interior S" |
3734 using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto |
3736 using continuous_closed_in_preimage[OF assms(1,3)] unfolding closedin_closed by auto |
3735 thus ?thesis using closed_Int[of s T, OF assms(2)] by auto |
3737 thus ?thesis using closed_Int[of s T, OF assms(2)] by auto |
3736 qed |
3738 qed |
3737 |
3739 |
3738 lemma continuous_open_preimage_univ: |
3740 lemma continuous_open_preimage_univ: |
3739 fixes f :: "real ^ _ \<Rightarrow> real ^ _" (* FIXME: generalize *) |
3741 "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}" |
3740 shows "\<forall>x. continuous (at x) f \<Longrightarrow> open s \<Longrightarrow> open {x. f x \<in> s}" |
|
3741 using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto |
3742 using continuous_open_preimage[of UNIV f s] open_UNIV continuous_at_imp_continuous_on by auto |
3742 |
3743 |
3743 lemma continuous_closed_preimage_univ: |
3744 lemma continuous_closed_preimage_univ: |
3744 fixes f :: "real ^ _ \<Rightarrow> real ^ _" (* FIXME: generalize *) |
3745 "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}" |
3745 shows "(\<forall>x. continuous (at x) f) \<Longrightarrow> closed s ==> closed {x. f x \<in> s}" |
|
3746 using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto |
3746 using continuous_closed_preimage[of UNIV f s] closed_UNIV continuous_at_imp_continuous_on by auto |
3747 |
3747 |
3748 text{* Equality of continuous functions on closure and related results. *} |
3748 text{* Equality of continuous functions on closure and related results. *} |
3749 |
3749 |
3750 lemma continuous_closed_in_preimage_constant: |
3750 lemma continuous_closed_in_preimage_constant: |
3863 fixes s :: "(real ^ _) set" (* FIXME: generalize *) |
3863 fixes s :: "(real ^ _) set" (* FIXME: generalize *) |
3864 shows "open s ==> open ((\<lambda> x. -x) ` s)" |
3864 shows "open s ==> open ((\<lambda> x. -x) ` s)" |
3865 unfolding vector_sneg_minus1 by auto |
3865 unfolding vector_sneg_minus1 by auto |
3866 |
3866 |
3867 lemma open_translation: |
3867 lemma open_translation: |
3868 fixes s :: "(real ^ _) set" (* FIXME: generalize *) |
3868 fixes s :: "'a::real_normed_vector set" |
3869 assumes "open s" shows "open((\<lambda>x. a + x) ` s)" |
3869 assumes "open s" shows "open((\<lambda>x. a + x) ` s)" |
3870 proof- |
3870 proof- |
3871 { fix x have "continuous (at x) (\<lambda>x. x - a)" using continuous_sub[of "at x" "\<lambda>x. x" "\<lambda>x. a"] continuous_at_id[of x] continuous_const[of "at x" a] by auto } |
3871 { fix x have "continuous (at x) (\<lambda>x. x - a)" using continuous_sub[of "at x" "\<lambda>x. x" "\<lambda>x. a"] continuous_at_id[of x] continuous_const[of "at x" a] by auto } |
3872 moreover have "{x. x - a \<in> s} = op + a ` s" apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto |
3872 moreover have "{x. x - a \<in> s} = op + a ` s" apply auto unfolding image_iff apply(rule_tac x="x - a" in bexI) by auto |
3873 ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto |
3873 ultimately show ?thesis using continuous_open_preimage_univ[of "\<lambda>x. x - a" s] using assms by auto |
4116 fixes f :: "'a::real_normed_vector \<Rightarrow> real" |
4117 fixes f :: "'a::real_normed_vector \<Rightarrow> real" |
4117 shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))" |
4118 shows "continuous_on s f \<longleftrightarrow> (\<forall>x \<in> s. \<forall>e>0. \<exists>d>0. (\<forall>x' \<in> s. norm(x' - x) < d --> abs(f x' - f x) < e))" |
4118 unfolding continuous_on_def dist_norm by simp |
4119 unfolding continuous_on_def dist_norm by simp |
4119 |
4120 |
4120 lemma continuous_at_norm: "continuous (at x) norm" |
4121 lemma continuous_at_norm: "continuous (at x) norm" |
4121 unfolding continuous_at by (intro tendsto_norm Lim_ident_at) |
4122 unfolding continuous_at by (intro tendsto_intros) |
4122 |
4123 |
4123 lemma continuous_on_norm: "continuous_on s norm" |
4124 lemma continuous_on_norm: "continuous_on s norm" |
4124 unfolding continuous_on by (intro ballI tendsto_norm Lim_at_within Lim_ident_at) |
4125 unfolding continuous_on by (intro ballI tendsto_intros) |
4125 |
4126 |
4126 lemma continuous_at_component: "continuous (at a) (\<lambda>x. x $ i)" |
4127 lemma continuous_at_component: "continuous (at a) (\<lambda>x. x $ i)" |
4127 unfolding continuous_at by (intro Lim_component Lim_ident_at) |
4128 unfolding continuous_at by (intro tendsto_intros) |
4128 |
4129 |
4129 lemma continuous_on_component: "continuous_on s (\<lambda>x. x $ i)" |
4130 lemma continuous_on_component: "continuous_on s (\<lambda>x. x $ i)" |
4130 unfolding continuous_on by (intro ballI Lim_component Lim_at_within Lim_ident_at) |
4131 unfolding continuous_on by (intro ballI tendsto_intros) |
4131 |
4132 |
4132 lemma continuous_at_infnorm: "continuous (at x) infnorm" |
4133 lemma continuous_at_infnorm: "continuous (at x) infnorm" |
4133 unfolding continuous_at Lim_at o_def unfolding dist_norm |
4134 unfolding continuous_at Lim_at o_def unfolding dist_norm |
4134 apply auto apply (rule_tac x=e in exI) apply auto |
4135 apply auto apply (rule_tac x=e in exI) apply auto |
4135 using order_trans[OF real_abs_sub_infnorm infnorm_le_norm, of _ x] by (metis xt1(7)) |
4136 using order_trans[OF real_abs_sub_infnorm infnorm_le_norm, of _ x] by (metis xt1(7)) |
4278 shows "continuous net f \<Longrightarrow> f(netlimit net) \<noteq> 0 |
4279 shows "continuous net f \<Longrightarrow> f(netlimit net) \<noteq> 0 |
4279 ==> continuous net (inverse o f)" |
4280 ==> continuous net (inverse o f)" |
4280 unfolding continuous_def using Lim_inv by auto |
4281 unfolding continuous_def using Lim_inv by auto |
4281 |
4282 |
4282 lemma continuous_at_within_inv: |
4283 lemma continuous_at_within_inv: |
4283 fixes f :: "real ^ _ \<Rightarrow> real" |
4284 fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field" |
4284 assumes "continuous (at a within s) f" "f a \<noteq> 0" |
4285 assumes "continuous (at a within s) f" "f a \<noteq> 0" |
4285 shows "continuous (at a within s) (inverse o f)" |
4286 shows "continuous (at a within s) (inverse o f)" |
4286 using assms unfolding continuous_within o_apply |
4287 using assms unfolding continuous_within o_def |
4287 by (rule Lim_inv) |
4288 by (intro tendsto_intros) |
4288 |
4289 |
4289 lemma continuous_at_inv: |
4290 lemma continuous_at_inv: |
4290 fixes f :: "real ^ _ \<Rightarrow> real" |
4291 fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_field" |
4291 shows "continuous (at a) f \<Longrightarrow> f a \<noteq> 0 |
4292 shows "continuous (at a) f \<Longrightarrow> f a \<noteq> 0 |
4292 ==> continuous (at a) (inverse o f) " |
4293 ==> continuous (at a) (inverse o f) " |
4293 using within_UNIV[THEN sym, of "at a"] using continuous_at_within_inv[of a UNIV] by auto |
4294 using within_UNIV[THEN sym, of "at a"] using continuous_at_within_inv[of a UNIV] by auto |
4294 |
4295 |
4295 subsection{* Preservation properties for pasted sets. *} |
4296 subsection{* Preservation properties for pasted sets. *} |
4302 obtain a b where ab:"\<forall>x\<in>s. norm x \<le> a" "\<forall>x\<in>t. norm x \<le> b" using assms[unfolded bounded_iff] by auto |
4303 obtain a b where ab:"\<forall>x\<in>s. norm x \<le> a" "\<forall>x\<in>t. norm x \<le> b" using assms[unfolded bounded_iff] by auto |
4303 { fix x y assume "x\<in>s" "y\<in>t" |
4304 { fix x y assume "x\<in>s" "y\<in>t" |
4304 hence "norm x \<le> a" "norm y \<le> b" using ab by auto |
4305 hence "norm x \<le> a" "norm y \<le> b" using ab by auto |
4305 hence "norm (pastecart x y) \<le> a + b" using norm_pastecart[of x y] by auto } |
4306 hence "norm (pastecart x y) \<le> a + b" using norm_pastecart[of x y] by auto } |
4306 thus ?thesis unfolding bounded_iff by auto |
4307 thus ?thesis unfolding bounded_iff by auto |
|
4308 qed |
|
4309 |
|
4310 lemma bounded_Times: |
|
4311 assumes "bounded s" "bounded t" shows "bounded (s \<times> t)" |
|
4312 proof- |
|
4313 obtain x y a b where "\<forall>z\<in>s. dist x z \<le> a" "\<forall>z\<in>t. dist y z \<le> b" |
|
4314 using assms [unfolded bounded_def] by auto |
|
4315 then have "\<forall>z\<in>s \<times> t. dist (x, y) z \<le> sqrt (a\<twosuperior> + b\<twosuperior>)" |
|
4316 by (auto simp add: dist_Pair_Pair real_sqrt_le_mono add_mono power_mono) |
|
4317 thus ?thesis unfolding bounded_any_center [where a="(x, y)"] by auto |
4307 qed |
4318 qed |
4308 |
4319 |
4309 lemma closed_pastecart: |
4320 lemma closed_pastecart: |
4310 fixes s :: "(real ^ 'a::finite) set" (* FIXME: generalize *) |
4321 fixes s :: "(real ^ 'a::finite) set" (* FIXME: generalize *) |
4311 assumes "closed s" "closed t" |
4322 assumes "closed s" "closed t" |
4331 lemma compact_pastecart: |
4342 lemma compact_pastecart: |
4332 fixes s t :: "(real ^ _) set" |
4343 fixes s t :: "(real ^ _) set" |
4333 shows "compact s \<Longrightarrow> compact t ==> compact {pastecart x y | x y . x \<in> s \<and> y \<in> t}" |
4344 shows "compact s \<Longrightarrow> compact t ==> compact {pastecart x y | x y . x \<in> s \<and> y \<in> t}" |
4334 unfolding compact_eq_bounded_closed using bounded_pastecart[of s t] closed_pastecart[of s t] by auto |
4345 unfolding compact_eq_bounded_closed using bounded_pastecart[of s t] closed_pastecart[of s t] by auto |
4335 |
4346 |
|
4347 lemma compact_Times: |
|
4348 fixes s t :: "'a::heine_borel set" |
|
4349 shows "compact s \<Longrightarrow> compact t \<Longrightarrow> compact (s \<times> t)" |
|
4350 unfolding compact_eq_bounded_closed |
|
4351 using bounded_Times [of s t] closed_Times [of s t] by auto |
|
4352 |
4336 text{* Hence some useful properties follow quite easily. *} |
4353 text{* Hence some useful properties follow quite easily. *} |
4337 |
4354 |
4338 lemma compact_scaleR_image: |
4355 lemma compact_scaleR_image: |
4339 fixes s :: "'a::real_normed_vector set" |
4356 fixes s :: "'a::real_normed_vector set" |
4340 assumes "compact s" shows "compact ((\<lambda>x. scaleR c x) ` s)" |
4357 assumes "compact s" shows "compact ((\<lambda>x. scaleR c x) ` s)" |
4354 fixes s :: "'a::real_normed_vector set" |
4371 fixes s :: "'a::real_normed_vector set" |
4355 assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)" |
4372 assumes "compact s" shows "compact ((\<lambda>x. -x) ` s)" |
4356 using compact_scaleR_image [OF assms, of "- 1"] by auto |
4373 using compact_scaleR_image [OF assms, of "- 1"] by auto |
4357 |
4374 |
4358 lemma compact_sums: |
4375 lemma compact_sums: |
4359 fixes s t :: "(real ^ _) set" |
4376 fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
4360 assumes "compact s" "compact t" shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}" |
4377 assumes "compact s" "compact t" shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}" |
4361 proof- |
4378 proof- |
4362 have *:"{x + y | x y. x \<in> s \<and> y \<in> t} =(\<lambda>z. fstcart z + sndcart z) ` {pastecart x y | x y. x \<in> s \<and> y \<in> t}" |
4379 have *:"{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)" |
4363 apply auto unfolding image_iff apply(rule_tac x="pastecart xa y" in bexI) unfolding fstcart_pastecart sndcart_pastecart by auto |
4380 apply auto unfolding image_iff apply(rule_tac x="(xa, y)" in bexI) by auto |
4364 have "linear (\<lambda>z::real^('a + 'a). fstcart z + sndcart z)" unfolding linear_def |
4381 have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)" |
4365 unfolding fstcart_add sndcart_add apply auto |
4382 unfolding continuous_on by (rule ballI) (intro tendsto_intros) |
4366 unfolding vector_add_ldistrib fstcart_cmul[THEN sym] sndcart_cmul[THEN sym] by auto |
4383 thus ?thesis unfolding * using compact_continuous_image compact_Times [OF assms] by auto |
4367 hence "continuous_on {pastecart x y |x y. x \<in> s \<and> y \<in> t} (\<lambda>z. fstcart z + sndcart z)" |
|
4368 using continuous_at_imp_continuous_on linear_continuous_at by auto |
|
4369 thus ?thesis unfolding * using compact_continuous_image compact_pastecart[OF assms] by auto |
|
4370 qed |
4384 qed |
4371 |
4385 |
4372 lemma compact_differences: |
4386 lemma compact_differences: |
4373 fixes s t :: "(real ^ 'a::finite) set" |
4387 fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
4374 assumes "compact s" "compact t" shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}" |
4388 assumes "compact s" "compact t" shows "compact {x - y | x y. x \<in> s \<and> y \<in> t}" |
4375 proof- |
4389 proof- |
4376 have "{x - y | x y::real^'a. x\<in>s \<and> y \<in> t} = {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}" |
4390 have "{x - y | x y. x\<in>s \<and> y \<in> t} = {x + y | x y. x \<in> s \<and> y \<in> (uminus ` t)}" |
4377 apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto |
4391 apply auto apply(rule_tac x= xa in exI) apply auto apply(rule_tac x=xa in exI) by auto |
4378 thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto |
4392 thus ?thesis using compact_sums[OF assms(1) compact_negations[OF assms(2)]] by auto |
4379 qed |
4393 qed |
4380 |
4394 |
4381 lemma compact_translation: |
4395 lemma compact_translation: |
4382 fixes s :: "(real ^ _) set" |
4396 fixes s :: "'a::{heine_borel, real_normed_vector} set" |
4383 assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)" |
4397 assumes "compact s" shows "compact ((\<lambda>x. a + x) ` s)" |
4384 proof- |
4398 proof- |
4385 have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto |
4399 have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s" by auto |
4386 thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto |
4400 thus ?thesis using compact_sums[OF assms compact_sing[of a]] by auto |
4387 qed |
4401 qed |
4395 qed |
4409 qed |
4396 |
4410 |
4397 text{* Hence we get the following. *} |
4411 text{* Hence we get the following. *} |
4398 |
4412 |
4399 lemma compact_sup_maxdistance: |
4413 lemma compact_sup_maxdistance: |
4400 fixes s :: "(real ^ 'n::finite) set" |
4414 fixes s :: "'a::{heine_borel, real_normed_vector} set" |
4401 assumes "compact s" "s \<noteq> {}" |
4415 assumes "compact s" "s \<noteq> {}" |
4402 shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)" |
4416 shows "\<exists>x\<in>s. \<exists>y\<in>s. \<forall>u\<in>s. \<forall>v\<in>s. norm(u - v) \<le> norm(x - y)" |
4403 proof- |
4417 proof- |
4404 have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto |
4418 have "{x - y | x y . x\<in>s \<and> y\<in>s} \<noteq> {}" using `s \<noteq> {}` by auto |
4405 then obtain x where x:"x\<in>{x - y |x y. x \<in> s \<and> y \<in> s}" "\<forall>y\<in>{x - y |x y. x \<in> s \<and> y \<in> s}. norm y \<le> norm x" |
4419 then obtain x where x:"x\<in>{x - y |x y. x \<in> s \<and> y \<in> s}" "\<forall>y\<in>{x - y |x y. x \<in> s \<and> y \<in> s}. norm y \<le> norm x" |
4406 using compact_differences[OF assms(1) assms(1)] |
4420 using compact_differences[OF assms(1) assms(1)] |
4407 using distance_attains_sup[where 'a="real ^ 'n", unfolded dist_norm, of "{x - y | x y . x\<in>s \<and> y\<in>s}" 0] by(auto simp add: norm_minus_cancel) |
4421 using distance_attains_sup[where 'a="'a", unfolded dist_norm, of "{x - y | x y . x\<in>s \<and> y\<in>s}" 0] by(auto simp add: norm_minus_cancel) |
4408 from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto |
4422 from x(1) obtain a b where "a\<in>s" "b\<in>s" "x = a - b" by auto |
4409 thus ?thesis using x(2)[unfolded `x = a - b`] by blast |
4423 thus ?thesis using x(2)[unfolded `x = a - b`] by blast |
4410 qed |
4424 qed |
4411 |
4425 |
4412 text{* We can state this in terms of diameter of a set. *} |
4426 text{* We can state this in terms of diameter of a set. *} |
4446 lemma diameter_bounded_bound: |
4460 lemma diameter_bounded_bound: |
4447 "bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s" |
4461 "bounded s \<Longrightarrow> x \<in> s \<Longrightarrow> y \<in> s ==> norm(x - y) \<le> diameter s" |
4448 using diameter_bounded by blast |
4462 using diameter_bounded by blast |
4449 |
4463 |
4450 lemma diameter_compact_attained: |
4464 lemma diameter_compact_attained: |
4451 fixes s :: "(real ^ _) set" |
4465 fixes s :: "'a::{heine_borel, real_normed_vector} set" |
4452 assumes "compact s" "s \<noteq> {}" |
4466 assumes "compact s" "s \<noteq> {}" |
4453 shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)" |
4467 shows "\<exists>x\<in>s. \<exists>y\<in>s. (norm(x - y) = diameter s)" |
4454 proof- |
4468 proof- |
4455 have b:"bounded s" using assms(1) compact_eq_bounded_closed by auto |
4469 have b:"bounded s" using assms(1) compact_eq_bounded_closed by auto |
4456 then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. norm (u - v) \<le> norm (x - y)" using compact_sup_maxdistance[OF assms] by auto |
4470 then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. norm (u - v) \<le> norm (x - y)" using compact_sup_maxdistance[OF assms] by auto |
4601 then obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" using `s \<noteq> {}` distance_attains_inf [of s a] by blast |
4615 then obtain x where "x\<in>s" "\<forall>y\<in>s. dist a x \<le> dist a y" using `s \<noteq> {}` distance_attains_inf [of s a] by blast |
4602 with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast |
4616 with `x\<in>s` show ?thesis using dist_pos_lt[of a x] and`a \<notin> s` by blast |
4603 qed |
4617 qed |
4604 |
4618 |
4605 lemma separate_compact_closed: |
4619 lemma separate_compact_closed: |
4606 fixes s t :: "(real ^ _) set" |
4620 fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
|
4621 (* TODO: does this generalize to heine_borel? *) |
4607 assumes "compact s" and "closed t" and "s \<inter> t = {}" |
4622 assumes "compact s" and "closed t" and "s \<inter> t = {}" |
4608 shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
4623 shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
4609 proof- |
4624 proof- |
4610 have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto |
4625 have "0 \<notin> {x - y |x y. x \<in> s \<and> y \<in> t}" using assms(3) by auto |
4611 then obtain d where "d>0" and d:"\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. d \<le> dist 0 x" |
4626 then obtain d where "d>0" and d:"\<forall>x\<in>{x - y |x y. x \<in> s \<and> y \<in> t}. d \<le> dist 0 x" |
4617 hence "d \<le> dist x y" unfolding dist_norm by auto } |
4632 hence "d \<le> dist x y" unfolding dist_norm by auto } |
4618 thus ?thesis using `d>0` by auto |
4633 thus ?thesis using `d>0` by auto |
4619 qed |
4634 qed |
4620 |
4635 |
4621 lemma separate_closed_compact: |
4636 lemma separate_closed_compact: |
4622 fixes s t :: "(real ^ _) set" |
4637 fixes s t :: "'a::{heine_borel, real_normed_vector} set" |
4623 assumes "closed s" and "compact t" and "s \<inter> t = {}" |
4638 assumes "closed s" and "compact t" and "s \<inter> t = {}" |
4624 shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
4639 shows "\<exists>d>0. \<forall>x\<in>s. \<forall>y\<in>t. d \<le> dist x y" |
4625 proof- |
4640 proof- |
4626 have *:"t \<inter> s = {}" using assms(3) by auto |
4641 have *:"t \<inter> s = {}" using assms(3) by auto |
4627 show ?thesis using separate_compact_closed[OF assms(2,1) *] |
4642 show ?thesis using separate_compact_closed[OF assms(2,1) *] |