diff -r edee1966fddf -r bc25f3916a99 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Mar 07 08:14:18 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Mar 07 14:34:45 2016 +0000 @@ -859,6 +859,24 @@ lemma cball_diff_eq_sphere: "cball a r - ball a r = {x. dist x a = r}" by (auto simp: cball_def ball_def dist_commute) +lemma image_add_ball [simp]: + fixes a :: "'a::real_normed_vector" + shows "op + b ` ball a r = ball (a+b) r" +apply (intro equalityI subsetI) +apply (force simp: dist_norm) +apply (rule_tac x="x-b" in image_eqI) +apply (auto simp: dist_norm algebra_simps) +done + +lemma image_add_cball [simp]: + fixes a :: "'a::real_normed_vector" + shows "op + b ` cball a r = cball (a+b) r" +apply (intro equalityI subsetI) +apply (force simp: dist_norm) +apply (rule_tac x="x-b" in image_eqI) +apply (auto simp: dist_norm algebra_simps) +done + lemma open_ball [intro, simp]: "open (ball x e)" proof - have "open (dist x -` {.. (closure(- S))" @@ -2202,11 +2220,11 @@ shows "a \ frontier S \ (\e>0. (\x\S. dist a x < e) \ (\x. x \ S \ dist a x < e))" unfolding frontier_def closure_interior by (auto simp add: mem_interior subset_eq ball_def) - + lemma frontier_subset_closed: "closed S \ frontier S \ S" by (metis frontier_def closure_closed Diff_subset) -lemma frontier_empty[simp]: "frontier {} = {}" +lemma frontier_empty [simp]: "frontier {} = {}" by (simp add: frontier_def) lemma frontier_subset_eq: "frontier S \ S \ closed S" @@ -2221,7 +2239,7 @@ then show ?thesis using frontier_subset_closed[of S] .. qed -lemma frontier_complement [simp]: "frontier (- S) = frontier S" +lemma frontier_complement [simp]: "frontier (- S) = frontier S" by (auto simp add: frontier_def closure_complement interior_complement) lemma frontier_disjoint_eq: "frontier S \ S = {} \ open S" @@ -4465,6 +4483,11 @@ by auto qed +lemma compact_closure [simp]: + fixes S :: "'a::heine_borel set" + shows "compact(closure S) \ bounded S" +by (meson bounded_closure bounded_subset closed_closure closure_subset compact_eq_bounded_closed) + lemma compact_components: fixes s :: "'a::heine_borel set" shows "\compact s; c \ components s\ \ compact c" @@ -5541,10 +5564,6 @@ subsubsection \Structural rules for pointwise continuity\ -lemmas continuous_within_id = continuous_ident - -lemmas continuous_at_id = continuous_ident - lemma continuous_infdist[continuous_intros]: assumes "continuous F f" shows "continuous F (\x. infdist (f x) A)" @@ -5890,6 +5909,111 @@ qed qed +subsection\ Theorems relating continuity and uniform continuity to closures\ + +lemma continuous_on_closure: + "continuous_on (closure S) f \ + (\x e. x \ closure S \ 0 < e + \ (\d. 0 < d \ (\y. y \ S \ dist y x < d \ dist (f y) (f x) < e)))" + (is "?lhs = ?rhs") +proof + assume ?lhs then show ?rhs + unfolding continuous_on_iff by (metis Un_iff closure_def) +next + assume R [rule_format]: ?rhs + show ?lhs + proof + fix x and e::real + assume "0 < e" and x: "x \ closure S" + obtain \::real where "\ > 0" + and \: "\y. \y \ S; dist y x < \\ \ dist (f y) (f x) < e/2" + using R [of x "e/2"] \0 < e\ x by auto + have "dist (f y) (f x) \ e" if y: "y \ closure S" and dyx: "dist y x < \/2" for y + proof - + obtain \'::real where "\' > 0" + and \': "\z. \z \ S; dist z y < \'\ \ dist (f z) (f y) < e/2" + using R [of y "e/2"] \0 < e\ y by auto + obtain z where "z \ S" and z: "dist z y < min \' \ / 2" + using closure_approachable y + by (metis \0 < \'\ \0 < \\ divide_pos_pos min_less_iff_conj zero_less_numeral) + have "dist (f z) (f y) < e/2" + apply (rule \' [OF \z \ S\]) + using z \0 < \'\ by linarith + moreover have "dist (f z) (f x) < e/2" + apply (rule \ [OF \z \ S\]) + using z \0 < \\ dist_commute[of y z] dist_triangle_half_r [of y] dyx by auto + ultimately show ?thesis + by (metis dist_commute dist_triangle_half_l less_imp_le) + qed + then show "\d>0. \x'\closure S. dist x' x < d \ dist (f x') (f x) \ e" + by (rule_tac x="\/2" in exI) (simp add: \\ > 0\) + qed +qed + +lemma continuous_on_closure_sequentially: + fixes f :: "'a::metric_space \ 'b :: metric_space" + shows + "continuous_on (closure S) f \ + (\x a. a \ closure S \ (\n. x n \ S) \ x \ a \ (f \ x) \ f a)" + (is "?lhs = ?rhs") +proof - + have "continuous_on (closure S) f \ + (\x \ closure S. continuous (at x within S) f)" + by (force simp: continuous_on_closure Topology_Euclidean_Space.continuous_within_eps_delta) + also have "... = ?rhs" + by (force simp: continuous_within_sequentially) + finally show ?thesis . +qed + +lemma uniformly_continuous_on_closure: + fixes f :: "'a::metric_space \ 'b::metric_space" + assumes ucont: "uniformly_continuous_on S f" + and cont: "continuous_on (closure S) f" + shows "uniformly_continuous_on (closure S) f" +unfolding uniformly_continuous_on_def +proof (intro allI impI) + fix e::real + assume "0 < e" + then obtain d::real + where "d>0" + and d: "\x x'. \x\S; x'\S; dist x' x < d\ \ dist (f x') (f x) < e/3" + using ucont [unfolded uniformly_continuous_on_def, rule_format, of "e/3"] by auto + show "\d>0. \x\closure S. \x'\closure S. dist x' x < d \ dist (f x') (f x) < e" + proof (rule exI [where x="d/3"], clarsimp simp: \d > 0\) + fix x y + assume x: "x \ closure S" and y: "y \ closure S" and dyx: "dist y x * 3 < d" + obtain d1::real where "d1 > 0" + and d1: "\w. \w \ closure S; dist w x < d1\ \ dist (f w) (f x) < e/3" + using cont [unfolded continuous_on_iff, rule_format, of "x" "e/3"] \0 < e\ x by auto + obtain x' where "x' \ S" and x': "dist x' x < min d1 (d / 3)" + using closure_approachable [of x S] + by (metis \0 < d1\ \0 < d\ divide_pos_pos min_less_iff_conj x zero_less_numeral) + obtain d2::real where "d2 > 0" + and d2: "\w \ closure S. dist w y < d2 \ dist (f w) (f y) < e/3" + using cont [unfolded continuous_on_iff, rule_format, of "y" "e/3"] \0 < e\ y by auto + obtain y' where "y' \ S" and y': "dist y' y < min d2 (d / 3)" + using closure_approachable [of y S] + by (metis \0 < d2\ \0 < d\ divide_pos_pos min_less_iff_conj y zero_less_numeral) + have "dist x' x < d/3" using x' by auto + moreover have "dist x y < d/3" + by (metis dist_commute dyx less_divide_eq_numeral1(1)) + moreover have "dist y y' < d/3" + by (metis (no_types) dist_commute min_less_iff_conj y') + ultimately have "dist x' y' < d/3 + d/3 + d/3" + by (meson dist_commute_lessI dist_triangle_lt add_strict_mono) + then have "dist x' y' < d" by simp + then have "dist (f x') (f y') < e/3" + by (rule d [OF \y' \ S\ \x' \ S\]) + moreover have "dist (f x') (f x) < e/3" using \x' \ S\ closure_subset x' d1 + by (simp add: closure_def) + moreover have "dist (f y') (f y) < e/3" using \y' \ S\ closure_subset y' d2 + by (simp add: closure_def) + ultimately have "dist (f y) (f x) < e/3 + e/3 + e/3" + by (meson dist_commute_lessI dist_triangle_lt add_strict_mono) + then show "dist (f y) (f x) < e" by simp + qed +qed + subsection \A function constant on a set\ definition constant_on (infixl "(constant'_on)" 50) @@ -6047,7 +6171,7 @@ { fix x have "continuous (at x) (\x. x - a)" - by (intro continuous_diff continuous_at_id continuous_const) + by (intro continuous_diff continuous_ident continuous_const) } moreover have "{x. x - a \ s} = op + a ` s" by force @@ -6385,7 +6509,7 @@ have "?B \ {}" using \b \ s\ by (auto simp: dist_commute) moreover have "continuous_on ?B (dist a)" - by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_at_id continuous_const) + by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_ident continuous_const) moreover have "compact ?B" by (intro closed_inter_compact \closed s\ compact_cball) ultimately obtain x where "x \ ?B" "\y\?B. dist a x \ dist a y" @@ -6828,7 +6952,7 @@ then have "s \ {}" "t \ {}" by auto let ?inf = "\x. infdist x t" have "continuous_on s ?inf" - by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_at_id) + by (auto intro!: continuous_at_imp_continuous_on continuous_infdist continuous_ident) then obtain x where x: "x \ s" "\y\s. ?inf x \ ?inf y" using continuous_attains_inf[OF \compact s\ \s \ {}\] by auto then have "0 < ?inf x" @@ -7134,7 +7258,7 @@ lemma open_box[intro]: "open (box a b)" proof - have "open (\i\Basis. (op \ i) -` {a \ i <..< b \ i})" - by (auto intro!: continuous_open_vimage continuous_inner continuous_at_id continuous_const) + by (auto intro!: continuous_open_vimage continuous_inner continuous_ident continuous_const) also have "(\i\Basis. (op \ i) -` {a \ i <..< b \ i}) = box a b" by (auto simp add: box_def inner_commute) finally show ?thesis . @@ -8344,7 +8468,7 @@ let ?D = "(\x. (x, x)) ` s" have D: "compact ?D" "?D \ {}" by (rule compact_continuous_image) - (auto intro!: s continuous_Pair continuous_within_id simp: continuous_on_eq_continuous_within) + (auto intro!: s continuous_Pair continuous_ident simp: continuous_on_eq_continuous_within) have "\x y e. x \ s \ y \ s \ 0 < e \ dist y x < e \ dist (g y) (g x) < e" using dist by fastforce @@ -8353,7 +8477,7 @@ then have cont: "continuous_on ?D (\x. dist ((g \ fst) x) (snd x))" unfolding continuous_on_eq_continuous_within by (intro continuous_dist ballI continuous_within_compose) - (auto intro!: continuous_fst continuous_snd continuous_within_id simp: image_image) + (auto intro!: continuous_fst continuous_snd continuous_ident simp: image_image) obtain a where "a \ s" and le: "\x. x \ s \ dist (g a) a \ dist (g x) x" using continuous_attains_inf[OF D cont] by auto @@ -8408,7 +8532,7 @@ next assume ?rhs then show ?lhs apply (auto simp: ball_def dist_norm) - apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt order_trans) + apply (metis add.commute add_le_cancel_right dist_norm dist_triangle3 order_trans) done qed @@ -8448,7 +8572,7 @@ next assume ?rhs then show ?lhs apply (auto simp: ball_def dist_norm ) - apply (metis add.commute add_le_cancel_right dist_norm dist_triangle_alt le_less_trans) + apply (metis add.commute add_le_cancel_right dist_norm dist_triangle3 le_less_trans) done qed