# HG changeset patch # User paulson # Date 1465914861 -3600 # Node ID d3c87eb0bad2c38482f14ff523cdd8bc75d49da6 # Parent ce995deef4b07e747da7a77e5bed096ee13760d3 new results about topology diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Library/Countable_Set.thy Tue Jun 14 15:34:21 2016 +0100 @@ -299,6 +299,20 @@ subsection \Misc lemmas\ +lemma countable_subset_image: + "countable B \ B \ (f ` A) \ (\A'. countable A' \ A' \ A \ (B = f ` A'))" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply (rule_tac x="inv_into A f ` B" in exI) + apply (auto simp: f_inv_into_f subset_iff image_inv_into_cancel inv_into_into) + done +next + assume ?rhs + then show ?lhs by force +qed + lemma infinite_countable_subset': assumes X: "infinite X" shows "\C\X. countable C \ infinite C" proof - diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Limits.thy --- a/src/HOL/Limits.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Limits.thy Tue Jun 14 15:34:21 2016 +0100 @@ -611,21 +611,21 @@ lemma tendsto_setsum [tendsto_intros]: fixes f :: "'a \ 'b \ 'c::topological_comm_monoid_add" - assumes "\i. i \ S \ (f i \ a i) F" - shows "((\x. \i\S. f i x) \ (\i\S. a i)) F" -proof (cases "finite S") - assume "finite S" thus ?thesis using assms + assumes "\i. i \ I \ (f i \ a i) F" + shows "((\x. \i\I. f i x) \ (\i\I. a i)) F" +proof (cases "finite I") + assume "finite I" thus ?thesis using assms by (induct, simp, simp add: tendsto_add) qed simp lemma continuous_setsum [continuous_intros]: fixes f :: "'a \ 'b::t2_space \ 'c::topological_comm_monoid_add" - shows "(\i. i \ S \ continuous F (f i)) \ continuous F (\x. \i\S. f i x)" + shows "(\i. i \ I \ continuous F (f i)) \ continuous F (\x. \i\I. f i x)" unfolding continuous_def by (rule tendsto_setsum) lemma continuous_on_setsum [continuous_intros]: fixes f :: "'a \ 'b::topological_space \ 'c::topological_comm_monoid_add" - shows "(\i. i \ S \ continuous_on s (f i)) \ continuous_on s (\x. \i\S. f i x)" + shows "(\i. i \ I \ continuous_on S (f i)) \ continuous_on S (\x. \i\I. f i x)" unfolding continuous_on_def by (auto intro: tendsto_setsum) instance nat :: topological_comm_monoid_add diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy --- a/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Tue Jun 14 15:34:21 2016 +0100 @@ -2088,6 +2088,11 @@ by (simp add: \continuous_on t r\ continuous_on_diff continuous_on_id continuous_on_norm) qed +lemma closedin_self [simp]: + fixes S :: "'a :: real_normed_vector set" + shows "closedin (subtopology euclidean S) S" + by (simp add: closedin_retract) + lemma retract_of_contractible: assumes "contractible t" "s retract_of t" shows "contractible s" @@ -2195,4 +2200,97 @@ apply (rule conjI continuous_intros | erule continuous_on_subset | force simp: image_subset_iff)+ done +subsection\Borsuk-style characterization of separation\ + +lemma continuous_on_Borsuk_map: + "a \ s \ continuous_on s (\x. inverse(norm (x - a)) *\<^sub>R (x - a))" +by (rule continuous_intros | force)+ + +lemma Borsuk_map_into_sphere: + "(\x. inverse(norm (x - a)) *\<^sub>R (x - a)) ` s \ sphere 0 1 \ (a \ s)" + by auto (metis eq_iff_diff_eq_0 left_inverse norm_eq_zero) + +lemma Borsuk_maps_homotopic_in_path_component: + assumes "path_component (- s) a b" + shows "homotopic_with (\x. True) s (sphere 0 1) + (\x. inverse(norm(x - a)) *\<^sub>R (x - a)) + (\x. inverse(norm(x - b)) *\<^sub>R (x - b))" +proof - + obtain g where "path g" "path_image g \ -s" "pathstart g = a" "pathfinish g = b" + using assms by (auto simp: path_component_def) + then show ?thesis + apply (simp add: path_def path_image_def pathstart_def pathfinish_def homotopic_with_def) + apply (rule_tac x = "\z. inverse(norm(snd z - (g o fst)z)) *\<^sub>R (snd z - (g o fst)z)" in exI) + apply (intro conjI continuous_intros) + apply (rule continuous_intros | erule continuous_on_subset | fastforce simp: divide_simps sphere_def)+ + done +qed + +lemma non_extensible_Borsuk_map: + fixes a :: "'a :: euclidean_space" + assumes "compact s" and cin: "c \ components(- s)" and boc: "bounded c" and "a \ c" + shows "~ (\g. continuous_on (s \ c) g \ + g ` (s \ c) \ sphere 0 1 \ + (\x \ s. g x = inverse(norm(x - a)) *\<^sub>R (x - a)))" +proof - + have "closed s" using assms by (simp add: compact_imp_closed) + have "c \ -s" + using assms by (simp add: in_components_subset) + with \a \ c\ have "a \ s" by blast + then have ceq: "c = connected_component_set (- s) a" + by (metis \a \ c\ cin components_iff connected_component_eq) + then have "bounded (s \ connected_component_set (- s) a)" + using \compact s\ boc compact_imp_bounded by auto + with bounded_subset_ballD obtain r where "0 < r" and r: "(s \ connected_component_set (- s) a) \ ball a r" + by blast + { fix g + assume "continuous_on (s \ c) g" + "g ` (s \ c) \ sphere 0 1" + and [simp]: "\x. x \ s \ g x = (x - a) /\<^sub>R norm (x - a)" + then have [simp]: "\x. x \ s \ c \ norm (g x) = 1" + by force + have cb_eq: "cball a r = (s \ connected_component_set (- s) a) \ + (cball a r - connected_component_set (- s) a)" + using ball_subset_cball [of a r] r by auto + have cont1: "continuous_on (s \ connected_component_set (- s) a) + (\x. a + r *\<^sub>R g x)" + apply (rule continuous_intros)+ + using \continuous_on (s \ c) g\ ceq by blast + have cont2: "continuous_on (cball a r - connected_component_set (- s) a) + (\x. a + r *\<^sub>R ((x - a) /\<^sub>R norm (x - a)))" + by (rule continuous_intros | force simp: \a \ s\)+ + have 1: "continuous_on (cball a r) + (\x. if connected_component (- s) a x + then a + r *\<^sub>R g x + else a + r *\<^sub>R ((x - a) /\<^sub>R norm (x - a)))" + apply (subst cb_eq) + apply (rule continuous_on_cases [OF _ _ cont1 cont2]) + using ceq cin + apply (auto intro: closed_Un_complement_component + simp: \closed s\ open_Compl open_connected_component) + done + have 2: "(\x. a + r *\<^sub>R g x) ` (cball a r \ connected_component_set (- s) a) + \ sphere a r " + using \0 < r\ by (force simp: dist_norm ceq) + have "retraction (cball a r) (sphere a r) + (\x. if x \ connected_component_set (- s) a + then a + r *\<^sub>R g x + else a + r *\<^sub>R ((x - a) /\<^sub>R norm (x - a)))" + using \0 < r\ + apply (simp add: retraction_def dist_norm 1 2, safe) + apply (force simp: dist_norm abs_if mult_less_0_iff divide_simps \a \ s\) + using r + by (auto simp: dist_norm norm_minus_commute) + then have False + using no_retraction_cball + [OF \0 < r\, of a, unfolded retract_of_def, simplified, rule_format, + of "\x. if x \ connected_component_set (- s) a + then a + r *\<^sub>R g x + else a + r *\<^sub>R inverse(norm(x - a)) *\<^sub>R (x - a)"] + by blast + } + then show ?thesis + by blast +qed + end diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Tue Jun 14 15:34:21 2016 +0100 @@ -6196,7 +6196,7 @@ done qed -lemma midpoint_eq_endpoint: +lemma midpoint_eq_endpoint [simp]: "midpoint a b = a \ a = b" "midpoint a b = b \ a = b" unfolding midpoint_eq_iff by auto @@ -6432,6 +6432,17 @@ apply (simp add: convex_contains_open_segment, clarify) by (metis (no_types, hide_lams) less_le_trans mem_ball mem_cball subsetCE dist_decreases_open_segment) +lemma csegment_midpoint_subset: "closed_segment (midpoint a b) b \ closed_segment a b" + apply (clarsimp simp: midpoint_def in_segment) + apply (rule_tac x="(1 + u) / 2" in exI) + apply (auto simp: algebra_simps add_divide_distrib diff_divide_distrib) + by (metis real_sum_of_halves scaleR_left.add) + +lemma notin_segment_midpoint: + fixes a :: "'a :: euclidean_space" + shows "a \ b \ a \ closed_segment (midpoint a b) b" +by (auto simp: dist_midpoint dest!: dist_in_closed_segment) + subsubsection\More lemmas, especially for working with the underlying formula\ lemma segment_eq_compose: @@ -10243,7 +10254,7 @@ lemma setdist_empty2 [simp]: "setdist t {} = 0" by (simp add: setdist_def) -lemma setdist_pos_le: "0 \ setdist s t" +lemma setdist_pos_le [simp]: "0 \ setdist s t" by (auto simp: setdist_def ex_in_conv [symmetric] intro: cInf_greatest) lemma le_setdistI: @@ -10307,10 +10318,10 @@ apply (subst setdist_singletons [symmetric]) by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym) -lemma continuous_at_setdist: "continuous (at x) (\y. (setdist {y} s))" +lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\y. (setdist {y} s))" by (force simp: continuous_at_eps_delta dist_real_def intro: le_less_trans [OF setdist_Lipschitz]) -lemma continuous_on_setdist: "continuous_on t (\y. (setdist {y} s))" +lemma continuous_on_setdist [continuous_intros]: "continuous_on t (\y. (setdist {y} s))" by (metis continuous_at_setdist continuous_at_imp_continuous_on) lemma uniformly_continuous_on_setdist: "uniformly_continuous_on t (\y. (setdist {y} s))" @@ -10424,34 +10435,44 @@ apply (auto simp: closest_point_in_set) done -lemma setdist_eq_0_sing_1 [simp]: - fixes s :: "'a::euclidean_space set" - shows "setdist {x} s = 0 \ s = {} \ x \ closure s" -by (auto simp: setdist_eq_0_bounded) - -lemma setdist_eq_0_sing_2 [simp]: - fixes s :: "'a::euclidean_space set" - shows "setdist s {x} = 0 \ s = {} \ x \ closure s" -by (auto simp: setdist_eq_0_bounded) +lemma setdist_eq_0_sing_1: + fixes s :: "'a::euclidean_space set" + shows "setdist {x} s = 0 \ s = {} \ x \ closure s" + by (auto simp: setdist_eq_0_bounded) + +lemma setdist_eq_0_sing_2: + fixes s :: "'a::euclidean_space set" + shows "setdist s {x} = 0 \ s = {} \ x \ closure s" + by (auto simp: setdist_eq_0_bounded) lemma setdist_neq_0_sing_1: fixes s :: "'a::euclidean_space set" shows "\setdist {x} s = a; a \ 0\ \ s \ {} \ x \ closure s" -by auto + by (auto simp: setdist_eq_0_sing_1) lemma setdist_neq_0_sing_2: - fixes s :: "'a::euclidean_space set" + fixes s :: "'a::euclidean_space set" shows "\setdist s {x} = a; a \ 0\ \ s \ {} \ x \ closure s" -by auto + by (auto simp: setdist_eq_0_sing_2) lemma setdist_sing_in_set: - fixes s :: "'a::euclidean_space set" - shows "x \ s \ setdist {x} s = 0" -using closure_subset by force + fixes s :: "'a::euclidean_space set" + shows "x \ s \ setdist {x} s = 0" + using closure_subset by (auto simp: setdist_eq_0_sing_1) lemma setdist_le_sing: "x \ s ==> setdist s t \ setdist {x} t" using setdist_subset_left by auto +lemma setdist_eq_0_closed: + fixes s :: "'a::euclidean_space set" + shows "closed s \ (setdist {x} s = 0 \ s = {} \ x \ s)" +by (simp add: setdist_eq_0_sing_1) + +lemma setdist_eq_0_closedin: + fixes s :: "'a::euclidean_space set" + shows "\closedin (subtopology euclidean u) s; x \ u\ + \ (setdist {x} s = 0 \ s = {} \ x \ s)" + by (auto simp: closedin_limpt setdist_eq_0_sing_1 closure_def) subsection\Basic lemmas about hyperplanes and halfspaces\ @@ -10506,6 +10527,294 @@ using halfspace_eq_empty_le [of "-a" "-b"] by simp +subsection\Use set distance for an easy proof of separation properties\ + +proposition separation_closures: + fixes S :: "'a::euclidean_space set" + assumes "S \ closure T = {}" "T \ closure S = {}" + obtains U V where "U \ V = {}" "open U" "open V" "S \ U" "T \ V" +proof (cases "S = {} \ T = {}") + case True with that show ?thesis by auto +next + case False + define f where "f \ \x. setdist {x} T - setdist {x} S" + have contf: "\x. isCont f x" + unfolding f_def by (intro continuous_intros continuous_at_setdist) + show ?thesis + proof (rule_tac U = "{x. f x > 0}" and V = "{x. f x < 0}" in that) + show "{x. 0 < f x} \ {x. f x < 0} = {}" + by auto + show "open {x. 0 < f x}" + by (simp add: open_Collect_less contf) + show "open {x. f x < 0}" + by (simp add: open_Collect_less contf) + show "S \ {x. 0 < f x}" + apply (clarsimp simp add: f_def setdist_sing_in_set) + using assms + by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym) + show "T \ {x. f x < 0}" + apply (clarsimp simp add: f_def setdist_sing_in_set) + using assms + by (metis False IntI empty_iff le_less setdist_eq_0_sing_2 setdist_pos_le setdist_sym) + qed +qed + +lemma separation_normal: + fixes S :: "'a::euclidean_space set" + assumes "closed S" "closed T" "S \ T = {}" + obtains U V where "open U" "open V" "S \ U" "T \ V" "U \ V = {}" +using separation_closures [of S T] +by (metis assms closure_closed disjnt_def inf_commute) + + +lemma separation_normal_local: + fixes S :: "'a::euclidean_space set" + assumes US: "closedin (subtopology euclidean U) S" + and UT: "closedin (subtopology euclidean U) T" + and "S \ T = {}" + obtains S' T' where "openin (subtopology euclidean U) S'" + "openin (subtopology euclidean U) T'" + "S \ S'" "T \ T'" "S' \ T' = {}" +proof (cases "S = {} \ T = {}") + case True with that show ?thesis + apply safe + using UT closedin_subset apply blast + using US closedin_subset apply blast + done +next + case False + define f where "f \ \x. setdist {x} T - setdist {x} S" + have contf: "continuous_on U f" + unfolding f_def by (intro continuous_intros) + show ?thesis + proof (rule_tac S' = "{x\U. f x > 0}" and T' = "{x\U. f x < 0}" in that) + show "{x \ U. 0 < f x} \ {x \ U. f x < 0} = {}" + by auto + have "openin (subtopology euclidean U) {x \ U. f x \ {0<..}}" + apply (rule continuous_openin_preimage [where T=UNIV]) + apply (simp_all add: contf) + using open_greaterThan open_openin by blast + then show "openin (subtopology euclidean U) {x \ U. 0 < f x}" by simp + next + have "openin (subtopology euclidean U) {x \ U. f x \ {..<0}}" + apply (rule continuous_openin_preimage [where T=UNIV]) + apply (simp_all add: contf) + using open_lessThan open_openin by blast + then show "openin (subtopology euclidean U) {x \ U. f x < 0}" by simp + next + show "S \ {x \ U. 0 < f x}" + apply (clarsimp simp add: f_def setdist_sing_in_set) + using assms + by (metis False Int_insert_right closedin_imp_subset empty_not_insert insert_absorb insert_subset linorder_neqE_linordered_idom not_le setdist_eq_0_closedin setdist_pos_le) + show "T \ {x \ U. f x < 0}" + apply (clarsimp simp add: f_def setdist_sing_in_set) + using assms + by (metis False closedin_subset disjoint_iff_not_equal insert_absorb insert_subset linorder_neqE_linordered_idom not_less setdist_eq_0_closedin setdist_pos_le topspace_euclidean_subtopology) + qed +qed + +lemma separation_normal_compact: + fixes S :: "'a::euclidean_space set" + assumes "compact S" "closed T" "S \ T = {}" + obtains U V where "open U" "compact(closure U)" "open V" "S \ U" "T \ V" "U \ V = {}" +proof - + have "closed S" "bounded S" + using assms by (auto simp: compact_eq_bounded_closed) + then obtain r where "r>0" and r: "S \ ball 0 r" + by (auto dest!: bounded_subset_ballD) + have **: "closed (T \ - ball 0 r)" "S \ (T \ - ball 0 r) = {}" + using assms r by blast+ + then show ?thesis + apply (rule separation_normal [OF \closed S\]) + apply (rule_tac U=U and V=V in that) + by auto (meson bounded_ball bounded_subset compl_le_swap2 disjoint_eq_subset_Compl) +qed + +subsection\Proper maps, including projections out of compact sets\ + +lemma finite_indexed_bound: + assumes A: "finite A" "\x. x \ A \ \n::'a::linorder. P x n" + shows "\m. \x \ A. \k\m. P x k" +using A +proof (induction A) + case empty then show ?case by force +next + case (insert a A) + then obtain m n where "\x \ A. \k\m. P x k" "P a n" + by force + then show ?case + apply (rule_tac x="max m n" in exI, safe) + using max.cobounded2 apply blast + by (meson le_max_iff_disj) +qed + +proposition proper_map: + fixes f :: "'a::heine_borel \ 'b::heine_borel" + assumes "closedin (subtopology euclidean S) K" + and com: "\U. \U \ T; compact U\ \ compact {x \ S. f x \ U}" + and "f ` S \ T" + shows "closedin (subtopology euclidean T) (f ` K)" +proof - + have "K \ S" + using assms closedin_imp_subset by metis + obtain C where "closed C" and Keq: "K = S \ C" + using assms by (auto simp: closedin_closed) + have *: "y \ f ` K" if "y \ T" and y: "y islimpt f ` K" for y + proof - + obtain h where "\n. (\x\K. h n = f x) \ h n \ y" "inj h" and hlim: "(h \ y) sequentially" + using \y \ T\ y by (force simp: limpt_sequential_inj) + then obtain X where X: "\n. X n \ K \ h n = f (X n) \ h n \ y" + by metis + then have fX: "\n. f (X n) = h n" + by metis + have "compact (C \ {a \ S. f a \ insert y (range (\i. f(X(n + i))))})" for n + apply (rule closed_Int_compact [OF \closed C\]) + apply (rule com) + using X \K \ S\ \f ` S \ T\ \y \ T\ apply blast + apply (rule compact_sequence_with_limit) + apply (simp add: fX add.commute [of n] LIMSEQ_ignore_initial_segment [OF hlim]) + done + then have comf: "compact {a \ K. f a \ insert y (range (\i. f(X(n + i))))}" for n + by (simp add: Keq Int_def conj_commute) + have ne: "\\ \ {}" + if "finite \" + and \: "\t. t \ \ \ + (\n. t = {a \ K. f a \ insert y (range (\i. f (X (n + i))))})" + for \ + proof - + obtain m where m: "\t. t \ \ \ \k\m. t = {a \ K. f a \ insert y (range (\i. f (X (k + i))))}" + apply (rule exE) + apply (rule finite_indexed_bound [OF \finite \\ \], assumption, force) + done + have "X m \ \\" + using X le_Suc_ex by (fastforce dest: m) + then show ?thesis by blast + qed + have "\{{a. a \ K \ f a \ insert y (range (\i. f(X(n + i))))} |n. n \ UNIV} + \ {}" + apply (rule compact_fip_heine_borel) + using comf apply force + using ne apply (simp add: subset_iff del: insert_iff) + done + then have "\x. x \ (\n. {a \ K. f a \ insert y (range (\i. f (X (n + i))))})" + by blast + then show ?thesis + apply (simp add: image_iff fX) + by (metis \inj h\ le_add1 not_less_eq_eq rangeI range_ex1_eq) + qed + with assms closedin_subset show ?thesis + by (force simp: closedin_limpt) +qed + + +lemma compact_continuous_image_eq: + fixes f :: "'a::heine_borel \ 'b::heine_borel" + assumes f: "inj_on f S" + shows "continuous_on S f \ (\T. compact T \ T \ S \ compact(f ` T))" + (is "?lhs = ?rhs") +proof + assume ?lhs then show ?rhs + by (metis continuous_on_subset compact_continuous_image) +next + assume RHS: ?rhs + obtain g where gf: "\x. x \ S \ g (f x) = x" + by (metis inv_into_f_f f) + then have *: "{x \ S. f x \ U} = g ` U" if "U \ f ` S" for U + using that by fastforce + have gfim: "g ` f ` S \ S" using gf by auto + have **: "compact {x \ f ` S. g x \ C}" if C: "C \ S" "compact C" for C + proof - + obtain h :: "'a set \ 'a" where "h C \ C \ h C \ S \ compact (f ` C)" + by (force simp: C RHS) + moreover have "f ` C = {b \ f ` S. g b \ C}" + using C gf by auto + ultimately show "compact {b \ f ` S. g b \ C}" + using C by auto + qed + show ?lhs + using proper_map [OF _ _ gfim] ** + by (simp add: continuous_on_closed * closedin_imp_subset) +qed + +lemma proper_map_from_compact: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes contf: "continuous_on S f" and imf: "f ` S \ T" and "compact S" + "closedin (subtopology euclidean T) K" + shows "compact {x. x \ S \ f x \ K}" +by (rule closedin_compact [OF \compact S\] continuous_closedin_preimage_gen assms)+ + +lemma proper_map_fst: + assumes "compact T" "K \ S" "compact K" + shows "compact {z \ S \ T. fst z \ K}" +proof - + have "{z \ S \ T. fst z \ K} = K \ T" + using assms by auto + then show ?thesis by (simp add: assms compact_Times) +qed + +lemma closed_map_fst: + fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set" + assumes "compact T" "closedin (subtopology euclidean (S \ T)) c" + shows "closedin (subtopology euclidean S) (fst ` c)" +proof - + have *: "fst ` (S \ T) \ S" + by auto + show ?thesis + using proper_map [OF _ _ *] by (simp add: proper_map_fst assms) +qed + +lemma proper_map_snd: + assumes "compact S" "K \ T" "compact K" + shows "compact {z \ S \ T. snd z \ K}" +proof - + have "{z \ S \ T. snd z \ K} = S \ K" + using assms by auto + then show ?thesis by (simp add: assms compact_Times) +qed + +lemma closed_map_snd: + fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set" + assumes "compact S" "closedin (subtopology euclidean (S \ T)) c" + shows "closedin (subtopology euclidean T) (snd ` c)" +proof - + have *: "snd ` (S \ T) \ T" + by auto + show ?thesis + using proper_map [OF _ _ *] by (simp add: proper_map_snd assms) +qed + +lemma closedin_compact_projection: + fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set" + assumes "compact S" and clo: "closedin (subtopology euclidean (S \ T)) U" + shows "closedin (subtopology euclidean T) {y. \x. x \ S \ (x, y) \ U}" +proof - + have "U \ S \ T" + by (metis clo closedin_imp_subset) + then have "{y. \x. x \ S \ (x, y) \ U} = snd ` U" + by force + moreover have "closedin (subtopology euclidean T) (snd ` U)" + by (rule closed_map_snd [OF assms]) + ultimately show ?thesis + by simp +qed + + +lemma closed_compact_projection: + fixes S :: "'a::euclidean_space set" + and T :: "('a * 'b::euclidean_space) set" + assumes "compact S" and clo: "closed T" + shows "closed {y. \x. x \ S \ (x, y) \ T}" +proof - + have *: "{y. \x. x \ S \ Pair x y \ T} = + {y. \x. x \ S \ Pair x y \ ((S \ UNIV) \ T)}" + by auto + show ?thesis + apply (subst *) + apply (rule closedin_closed_trans [OF _ closed_UNIV]) + apply (rule closedin_compact_projection [OF \compact S\]) + by (simp add: clo closedin_closed_Int) +qed + subsubsection\Representing affine hull as a finite intersection of hyperplanes\ proposition affine_hull_convex_Int_nonempty_interior: @@ -12082,4 +12391,151 @@ by (rule that) qed +subsection\Several Variants of Paracompactness\ + +proposition paracompact: + fixes S :: "'a :: euclidean_space set" + assumes "S \ \\" and opC: "\T. T \ \ \ open T" + obtains \' where "S \ \ \'" + and "\U. U \ \' \ open U \ (\T. T \ \ \ U \ T)" + and "\x. x \ S + \ \V. open V \ x \ V \ + finite {U. U \ \' \ (U \ V \ {})}" +proof (cases "S = {}") + case True with that show ?thesis by blast +next + case False + have "\T U. x \ U \ open U \ closure U \ T \ T \ \" if "x \ S" for x + proof - + obtain T where "x \ T" "T \ \" "open T" + using assms \x \ S\ by blast + then obtain e where "e > 0" "cball x e \ T" + by (force simp: open_contains_cball) + then show ?thesis + apply (rule_tac x = T in exI) + apply (rule_tac x = "ball x e" in exI) + using \T \ \\ + apply (simp add: closure_minimal) + done + qed + then obtain F G where Gin: "x \ G x" and oG: "open (G x)" + and clos: "closure (G x) \ F x" and Fin: "F x \ \" + if "x \ S" for x + by metis + then obtain \ where "\ \ G ` S" "countable \" "\\ = UNION S G" + using Lindelof [of "G ` S"] by (metis image_iff) + then obtain K where K: "K \ S" "countable K" and eq: "UNION K G = UNION S G" + by (metis countable_subset_image) + with False Gin have "K \ {}" by force + then obtain a :: "nat \ 'a" where "range a = K" + by (metis range_from_nat_into \countable K\) + then have odif: "\n. open (F (a n) - \{closure (G (a m)) |m. m < n})" + using \K \ S\ Fin opC by (fastforce simp add:) + let ?C = "range (\n. F(a n) - \{closure(G(a m)) |m. m < n})" + have enum_S: "\n. x \ F(a n) \ x \ G(a n)" if "x \ S" for x + proof - + have "\y \ K. x \ G y" using eq that Gin by fastforce + then show ?thesis + using clos K \range a = K\ closure_subset by blast + qed + have 1: "S \ Union ?C" + proof + fix x assume "x \ S" + define n where "n \ LEAST n. x \ F(a n)" + have n: "x \ F(a n)" + using enum_S [OF \x \ S\] by (force simp: n_def intro: LeastI) + have notn: "x \ F(a m)" if "m < n" for m + using that not_less_Least by (force simp: n_def) + then have "x \ \{closure (G (a m)) |m. m < n}" + using n \K \ S\ \range a = K\ clos notn by fastforce + with n show "x \ Union ?C" + by blast + qed + have 3: "\V. open V \ x \ V \ finite {U. U \ ?C \ (U \ V \ {})}" if "x \ S" for x + proof - + obtain n where n: "x \ F(a n)" "x \ G(a n)" + using \x \ S\ enum_S by auto + have "{U \ ?C. U \ G (a n) \ {}} \ (\n. F(a n) - \{closure(G(a m)) |m. m < n}) ` atMost n" + proof clarsimp + fix k assume "(F (a k) - \{closure (G (a m)) |m. m < k}) \ G (a n) \ {}" + then have "k \ n" + by auto (metis closure_subset not_le subsetCE) + then show "F (a k) - \{closure (G (a m)) |m. m < k} + \ (\n. F (a n) - \{closure (G (a m)) |m. m < n}) ` {..n}" + by force + qed + moreover have "finite ((\n. F(a n) - \{closure(G(a m)) |m. m < n}) ` atMost n)" + by force + ultimately have *: "finite {U \ ?C. U \ G (a n) \ {}}" + using finite_subset by blast + show ?thesis + apply (rule_tac x="G (a n)" in exI) + apply (intro conjI oG n *) + using \K \ S\ \range a = K\ apply blast + done + qed + show ?thesis + apply (rule that [OF 1 _ 3]) + using Fin \K \ S\ \range a = K\ apply (auto simp: odif) + done +qed + + +corollary paracompact_closedin: + fixes S :: "'a :: euclidean_space set" + assumes cin: "closedin (subtopology euclidean U) S" + and oin: "\T. T \ \ \ openin (subtopology euclidean U) T" + and "S \ \\" + obtains \' where "S \ \ \'" + and "\V. V \ \' \ openin (subtopology euclidean U) V \ (\T. T \ \ \ V \ T)" + and "\x. x \ U + \ \V. openin (subtopology euclidean U) V \ x \ V \ + finite {X. X \ \' \ (X \ V \ {})}" +proof - + have "\Z. open Z \ (T = U \ Z)" if "T \ \" for T + using oin [OF that] by (auto simp: openin_open) + then obtain F where opF: "open (F T)" and intF: "U \ F T = T" if "T \ \" for T + by metis + obtain K where K: "closed K" "U \ K = S" + using cin by (auto simp: closedin_closed) + have 1: "U \ \insert (- K) (F ` \)" + by clarsimp (metis Int_iff Union_iff \U \ K = S\ \S \ \\\ subsetD intF) + have 2: "\T. T \ insert (- K) (F ` \) \ open T" + using \closed K\ by (auto simp: opF) + obtain \ where "U \ \\" + and D1: "\U. U \ \ \ open U \ (\T. T \ insert (- K) (F ` \) \ U \ T)" + and D2: "\x. x \ U \ \V. open V \ x \ V \ finite {U \ \. U \ V \ {}}" + using paracompact [OF 1 2] by auto + let ?C = "{U \ V |V. V \ \ \ (V \ K \ {})}" + show ?thesis + proof (rule_tac \' = "{U \ V |V. V \ \ \ (V \ K \ {})}" in that) + show "S \ \?C" + using \U \ K = S\ \U \ \\\ K by (blast dest!: subsetD) + show "\V. V \ ?C \ openin (subtopology euclidean U) V \ (\T. T \ \ \ V \ T)" + using D1 intF by fastforce + have *: "{X. (\V. X = U \ V \ V \ \ \ V \ K \ {}) \ X \ (U \ V) \ {}} \ + (\x. U \ x) ` {U \ \. U \ V \ {}}" for V + by blast + show "\V. openin (subtopology euclidean U) V \ x \ V \ finite {X \ ?C. X \ V \ {}}" + if "x \ U" for x + using D2 [OF that] + apply clarify + apply (rule_tac x="U \ V" in exI) + apply (auto intro: that finite_subset [OF *]) + done + qed +qed + +corollary paracompact_closed: + fixes S :: "'a :: euclidean_space set" + assumes "closed S" + and opC: "\T. T \ \ \ open T" + and "S \ \\" + obtains \' where "S \ \\'" + and "\U. U \ \' \ open U \ (\T. T \ \ \ U \ T)" + and "\x. \V. open V \ x \ V \ + finite {U. U \ \' \ (U \ V \ {})}" +using paracompact_closedin [of UNIV S \] assms +by (auto simp: open_openin [symmetric] closed_closedin [symmetric]) + end diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Homeomorphism.thy --- a/src/HOL/Multivariate_Analysis/Homeomorphism.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Homeomorphism.thy Tue Jun 14 15:34:21 2016 +0100 @@ -933,7 +933,8 @@ by (simp add: \open U\ closed_Compl) define f :: "'a \ 'a \ 'b" where "f \ \x. (x, One /\<^sub>R setdist {x} (- U))" have "continuous_on U (\x. (x, One /\<^sub>R setdist {x} (- U)))" - by (auto simp: Ucomp continuous_intros continuous_on_setdist) + apply (intro continuous_intros continuous_on_setdist) + by (simp add: Ucomp setdist_eq_0_sing_1) then have homU: "homeomorphism U (f`U) f fst" by (auto simp: f_def homeomorphism_def image_iff continuous_intros) have cloS: "closedin (subtopology euclidean U) S" @@ -945,9 +946,9 @@ have *: "r *\<^sub>R b = One \ b = (1 / r) *\<^sub>R One" for r and b::'b by (metis One_non_0 nonzero_divide_eq_eq real_vector.scale_eq_0_iff real_vector.scale_scale scaleR_one) have "f ` U = {z. (setdist {fst z} (- U) *\<^sub>R snd z) \ {One}}" - apply (auto simp: f_def field_simps Ucomp) + apply (auto simp: f_def setdist_eq_0_sing_1 field_simps Ucomp) apply (rule_tac x=a in image_eqI) - apply (auto simp: * dest: setdist1D) + apply (auto simp: * setdist_eq_0_sing_1 dest: setdist1D) done then have clfU: "closed (f ` U)" apply (rule ssubst) @@ -1103,4 +1104,176 @@ using assms by (meson zero_less_one homeomorphic_trans homeomorphic_convex_compact_cball homeomorphic_sym) +subsection\Covering spaces and lifting results for them\ + +definition covering_space + :: "'a::topological_space set \ ('a \ 'b) \ 'b::topological_space set \ bool" + where + "covering_space c p s \ + continuous_on c p \ p ` c = s \ + (\x \ s. \t. x \ t \ openin (subtopology euclidean s) t \ + (\v. \v = {x. x \ c \ p x \ t} \ + (\u \ v. openin (subtopology euclidean c) u) \ + pairwise disjnt v \ + (\u \ v. \q. homeomorphism u t p q)))" + +lemma covering_space_imp_continuous: "covering_space c p s \ continuous_on c p" + by (simp add: covering_space_def) + +lemma covering_space_imp_surjective: "covering_space c p s \ p ` c = s" + by (simp add: covering_space_def) + +lemma homeomorphism_imp_covering_space: "homeomorphism s t f g \ covering_space s f t" + apply (simp add: homeomorphism_def covering_space_def, clarify) + apply (rule_tac x=t in exI, simp) + apply (rule_tac x="{s}" in exI, auto) + done + +lemma covering_space_local_homeomorphism: + assumes "covering_space c p s" "x \ c" + obtains t u q where "x \ t" "openin (subtopology euclidean c) t" + "p x \ u" "openin (subtopology euclidean s) u" + "homeomorphism t u p q" +using assms +apply (simp add: covering_space_def, clarify) +apply (drule_tac x="p x" in bspec, force) +by (metis (no_types, lifting) Union_iff mem_Collect_eq) + + +lemma covering_space_local_homeomorphism_alt: + assumes p: "covering_space c p s" and "y \ s" + obtains x t u q where "p x = y" + "x \ t" "openin (subtopology euclidean c) t" + "y \ u" "openin (subtopology euclidean s) u" + "homeomorphism t u p q" +proof - + obtain x where "p x = y" "x \ c" + using assms covering_space_imp_surjective by blast + show ?thesis + apply (rule covering_space_local_homeomorphism [OF p \x \ c\]) + using that \p x = y\ by blast +qed + +proposition covering_space_open_map: + fixes s :: "'a :: metric_space set" and t :: "'b :: metric_space set" + assumes p: "covering_space c p s" and t: "openin (subtopology euclidean c) t" + shows "openin (subtopology euclidean s) (p ` t)" +proof - + have pce: "p ` c = s" + and covs: + "\x. x \ s \ + \X VS. x \ X \ openin (subtopology euclidean s) X \ + \VS = {x. x \ c \ p x \ X} \ + (\u \ VS. openin (subtopology euclidean c) u) \ + pairwise disjnt VS \ + (\u \ VS. \q. homeomorphism u X p q)" + using p by (auto simp: covering_space_def) + have "t \ c" by (metis openin_euclidean_subtopology_iff t) + have "\T. openin (subtopology euclidean s) T \ y \ T \ T \ p ` t" + if "y \ p ` t" for y + proof - + have "y \ s" using \t \ c\ pce that by blast + obtain U VS where "y \ U" and U: "openin (subtopology euclidean s) U" + and VS: "\VS = {x. x \ c \ p x \ U}" + and openVS: "\V \ VS. openin (subtopology euclidean c) V" + and homVS: "\V. V \ VS \ \q. homeomorphism V U p q" + using covs [OF \y \ s\] by auto + obtain x where "x \ c" "p x \ U" "x \ t" "p x = y" + apply simp + using t [unfolded openin_euclidean_subtopology_iff] \y \ U\ \y \ p ` t\ by blast + with VS obtain V where "x \ V" "V \ VS" by auto + then obtain q where q: "homeomorphism V U p q" using homVS by blast + then have ptV: "p ` (t \ V) = U \ {z. q z \ (t \ V)}" + using VS \V \ VS\ by (auto simp: homeomorphism_def) + have ocv: "openin (subtopology euclidean c) V" + by (simp add: \V \ VS\ openVS) + have "openin (subtopology euclidean U) {z \ U. q z \ t \ V}" + apply (rule continuous_on_open [THEN iffD1, rule_format]) + using homeomorphism_def q apply blast + using openin_subtopology_Int_subset [of c] q t unfolding homeomorphism_def + by (metis inf.absorb_iff2 Int_commute ocv openin_euclidean_subtopology_iff) + then have os: "openin (subtopology euclidean s) (U \ {z. q z \ t \ V})" + using openin_trans [of U] by (simp add: Collect_conj_eq U) + show ?thesis + apply (rule_tac x = "p ` (t \ V)" in exI) + apply (rule conjI) + apply (simp only: ptV os) + using \p x = y\ \x \ V\ \x \ t\ apply blast + done + qed + with openin_subopen show ?thesis by blast +qed + +lemma covering_space_lift_unique_gen: + fixes f :: "'a::topological_space \ 'b::topological_space" + fixes g1 :: "'a \ 'c::real_normed_vector" + assumes cov: "covering_space c p s" + and eq: "g1 a = g2 a" + and f: "continuous_on t f" "f ` t \ s" + and g1: "continuous_on t g1" "g1 ` t \ c" + and fg1: "\x. x \ t \ f x = p(g1 x)" + and g2: "continuous_on t g2" "g2 ` t \ c" + and fg2: "\x. x \ t \ f x = p(g2 x)" + and u_compt: "u \ components t" and "a \ u" "x \ u" + shows "g1 x = g2 x" +proof - + have "u \ t" by (rule in_components_subset [OF u_compt]) + def G12 \ "{x \ u. g1 x - g2 x = 0}" + have "connected u" by (rule in_components_connected [OF u_compt]) + have contu: "continuous_on u g1" "continuous_on u g2" + using \u \ t\ continuous_on_subset g1 g2 by blast+ + have o12: "openin (subtopology euclidean u) G12" + unfolding G12_def + proof (subst openin_subopen, clarify) + fix z + assume z: "z \ u" "g1 z - g2 z = 0" + obtain v w q where "g1 z \ v" and ocv: "openin (subtopology euclidean c) v" + and "p (g1 z) \ w" and osw: "openin (subtopology euclidean s) w" + and hom: "homeomorphism v w p q" + apply (rule_tac x = "g1 z" in covering_space_local_homeomorphism [OF cov]) + using \u \ t\ \z \ u\ g1(2) apply blast+ + done + have "g2 z \ v" using \g1 z \ v\ z by auto + have gg: "{x \ u. g x \ v} = {x \ u. g x \ (v \ g ` u)}" for g + by auto + have "openin (subtopology euclidean (g1 ` u)) (v \ g1 ` u)" + using ocv \u \ t\ g1 by (fastforce simp add: openin_open) + then have 1: "openin (subtopology euclidean u) {x \ u. g1 x \ v}" + unfolding gg by (blast intro: contu continuous_on_open [THEN iffD1, rule_format]) + have "openin (subtopology euclidean (g2 ` u)) (v \ g2 ` u)" + using ocv \u \ t\ g2 by (fastforce simp add: openin_open) + then have 2: "openin (subtopology euclidean u) {x \ u. g2 x \ v}" + unfolding gg by (blast intro: contu continuous_on_open [THEN iffD1, rule_format]) + show "\T. openin (subtopology euclidean u) T \ + z \ T \ T \ {z \ u. g1 z - g2 z = 0}" + using z + apply (rule_tac x = "{x. x \ u \ g1 x \ v} \ {x. x \ u \ g2 x \ v}" in exI) + apply (intro conjI) + apply (rule openin_Int [OF 1 2]) + using \g1 z \ v\ \g2 z \ v\ apply (force simp:, clarify) + apply (metis \u \ t\ subsetD eq_iff_diff_eq_0 fg1 fg2 hom homeomorphism_def) + done + qed + have c12: "closedin (subtopology euclidean u) G12" + unfolding G12_def + by (intro continuous_intros continuous_closedin_preimage_constant contu) + have "G12 = {} \ G12 = u" + by (intro connected_clopen [THEN iffD1, rule_format] \connected u\ conjI o12 c12) + with eq \a \ u\ have "\x. x \ u \ g1 x - g2 x = 0" by (auto simp: G12_def) + then show ?thesis + using \x \ u\ by force +qed + +proposition covering_space_lift_unique: + fixes f :: "'a::topological_space \ 'b::topological_space" + fixes g1 :: "'a \ 'c::real_normed_vector" + assumes "covering_space c p s" + "g1 a = g2 a" + "continuous_on t f" "f ` t \ s" + "continuous_on t g1" "g1 ` t \ c" "\x. x \ t \ f x = p(g1 x)" + "continuous_on t g2" "g2 ` t \ c" "\x. x \ t \ f x = p(g2 x)" + "connected t" "a \ t" "x \ t" + shows "g1 x = g2 x" +using covering_space_lift_unique_gen [of c p s] in_components_self assms ex_in_conv by blast + end diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Integration.thy --- a/src/HOL/Multivariate_Analysis/Integration.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Integration.thy Tue Jun 14 15:34:21 2016 +0100 @@ -11,6 +11,173 @@ "~~/src/HOL/Library/Indicator_Function" begin +(*FIXME: move elsewhere and use the existing locales*) + +subsection \Using additivity of lifted function to encode definedness.\ + +definition "neutral opp = (SOME x. \y. opp x y = y \ opp y x = y)" + +fun lifted where + "lifted (opp :: 'a \ 'a \ 'b) (Some x) (Some y) = Some (opp x y)" +| "lifted opp None _ = (None::'b option)" +| "lifted opp _ None = None" + +lemma lifted_simp_1[simp]: "lifted opp v None = None" + by (induct v) auto + +definition "monoidal opp \ + (\x y. opp x y = opp y x) \ + (\x y z. opp x (opp y z) = opp (opp x y) z) \ + (\x. opp (neutral opp) x = x)" + +lemma monoidalI: + assumes "\x y. opp x y = opp y x" + and "\x y z. opp x (opp y z) = opp (opp x y) z" + and "\x. opp (neutral opp) x = x" + shows "monoidal opp" + unfolding monoidal_def using assms by fastforce + +lemma monoidal_ac: + assumes "monoidal opp" + shows [simp]: "opp (neutral opp) a = a" + and [simp]: "opp a (neutral opp) = a" + and "opp a b = opp b a" + and "opp (opp a b) c = opp a (opp b c)" + and "opp a (opp b c) = opp b (opp a c)" + using assms unfolding monoidal_def by metis+ + +lemma neutral_lifted [cong]: + assumes "monoidal opp" + shows "neutral (lifted opp) = Some (neutral opp)" +proof - + { fix x + assume "\y. lifted opp x y = y \ lifted opp y x = y" + then have "Some (neutral opp) = x" + apply (induct x) + apply force + by (metis assms lifted.simps(1) monoidal_ac(2) option.inject) } + note [simp] = this + show ?thesis + apply (subst neutral_def) + apply (intro some_equality allI) + apply (induct_tac y) + apply (auto simp add:monoidal_ac[OF assms]) + done +qed + +lemma monoidal_lifted[intro]: + assumes "monoidal opp" + shows "monoidal (lifted opp)" + unfolding monoidal_def split_option_all neutral_lifted[OF assms] + using monoidal_ac[OF assms] + by auto + +definition "support opp f s = {x. x\s \ f x \ neutral opp}" +definition "fold' opp e s = (if finite s then Finite_Set.fold opp e s else e)" +definition "iterate opp s f = fold' (\x a. opp (f x) a) (neutral opp) (support opp f s)" + +lemma support_subset[intro]: "support opp f s \ s" + unfolding support_def by auto + +lemma support_empty[simp]: "support opp f {} = {}" + using support_subset[of opp f "{}"] by auto + +lemma comp_fun_commute_monoidal[intro]: + assumes "monoidal opp" + shows "comp_fun_commute opp" + unfolding comp_fun_commute_def + using monoidal_ac[OF assms] + by auto + +lemma support_clauses: + "\f g s. support opp f {} = {}" + "\f g s. support opp f (insert x s) = + (if f(x) = neutral opp then support opp f s else insert x (support opp f s))" + "\f g s. support opp f (s - {x}) = (support opp f s) - {x}" + "\f g s. support opp f (s \ t) = (support opp f s) \ (support opp f t)" + "\f g s. support opp f (s \ t) = (support opp f s) \ (support opp f t)" + "\f g s. support opp f (s - t) = (support opp f s) - (support opp f t)" + "\f g s. support opp g (f ` s) = f ` (support opp (g \ f) s)" + unfolding support_def by auto + +lemma finite_support[intro]: "finite s \ finite (support opp f s)" + unfolding support_def by auto + +lemma iterate_empty[simp]: "iterate opp {} f = neutral opp" + unfolding iterate_def fold'_def by auto + +lemma iterate_insert[simp]: + assumes "monoidal opp" + and "finite s" + shows "iterate opp (insert x s) f = + (if x \ s then iterate opp s f else opp (f x) (iterate opp s f))" +proof (cases "x \ s") + case True + then show ?thesis by (auto simp: insert_absorb iterate_def) +next + case False + note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] + show ?thesis + proof (cases "f x = neutral opp") + case True + then show ?thesis + using assms \x \ s\ + by (auto simp: iterate_def support_clauses) + next + case False + with \x \ s\ \finite s\ support_subset show ?thesis + apply (simp add: iterate_def fold'_def support_clauses) + apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) + apply (force simp add: )+ + done + qed +qed + +lemma iterate_some: + "\monoidal opp; finite s\ \ iterate (lifted opp) s (\x. Some(f x)) = Some (iterate opp s f)" + by (erule finite_induct) (auto simp: monoidal_lifted) + +lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)" + unfolding neutral_def + by (force elim: allE [where x=0]) + +lemma support_if: "a \ neutral opp \ support opp (\x. if P x then a else neutral opp) A = {x \ A. P x}" +unfolding support_def +by (force intro: Collect_cong) + +lemma support_if_subset: "support opp (\x. if P x then a else neutral opp) A \ {x \ A. P x}" +by (simp add: subset_iff support_def) + +definition supp_setsum where "supp_setsum f A \ setsum f (support op+ f A)" + +lemma supp_setsum_divide_distrib: + "supp_setsum f A / (r::'a::field) = supp_setsum (\n. f n / r) A" +apply (cases "r = 0") +apply (simp add: supp_setsum_def) +apply (simp add: supp_setsum_def setsum_divide_distrib support_def) +done + +(*FIXME move up e.g. to Library/Convex.thy*) +lemma convex_supp_setsum: + assumes "convex S" and 1: "supp_setsum u I = 1" + and "\i. i \ I \ 0 \ u i \ (u i = 0 \ f i \ S)" + shows "supp_setsum (\i. u i *\<^sub>R f i) I \ S" +proof - + have fin: "finite {i \ I. u i \ 0}" + using 1 setsum.infinite by (force simp: supp_setsum_def support_def) + then have eq: "supp_setsum(\i. u i *\<^sub>R f i) I = + setsum (\i. u i *\<^sub>R f i) {i \ I. u i \ 0}" + by (force intro: setsum.mono_neutral_left simp: supp_setsum_def support_def) + show ?thesis + apply (simp add: eq) + apply (rule convex_setsum [OF fin \convex S\]) + using 1 assms apply (auto simp: supp_setsum_def support_def) + done +qed + +(*END OF SUPPORT, ETC.*) + + lemmas scaleR_simps = scaleR_zero_left scaleR_minus_left scaleR_left_diff_distrib scaleR_zero_right scaleR_minus_right scaleR_right_diff_distrib scaleR_eq_0_iff scaleR_cancel_left scaleR_cancel_right scaleR_add_right scaleR_add_left real_vector_class.scaleR_one @@ -3565,8 +3732,6 @@ subsection \Generalized notion of additivity.\ -definition "neutral opp = (SOME x. \y. opp x y = y \ opp y x = y)" - definition operative :: "('a \ 'a \ 'a) \ (('b::euclidean_space) set \ 'a) \ bool" where "operative opp f \ (\a b. content (cbox a b) = 0 \ f (cbox a b) = neutral opp) \ @@ -3587,135 +3752,8 @@ unfolding operative_def by (rule property_empty_interval) auto -subsection \Using additivity of lifted function to encode definedness.\ - -fun lifted where - "lifted (opp :: 'a \ 'a \ 'b) (Some x) (Some y) = Some (opp x y)" -| "lifted opp None _ = (None::'b option)" -| "lifted opp _ None = None" - -lemma lifted_simp_1[simp]: "lifted opp v None = None" - by (induct v) auto - -definition "monoidal opp \ - (\x y. opp x y = opp y x) \ - (\x y z. opp x (opp y z) = opp (opp x y) z) \ - (\x. opp (neutral opp) x = x)" - -lemma monoidalI: - assumes "\x y. opp x y = opp y x" - and "\x y z. opp x (opp y z) = opp (opp x y) z" - and "\x. opp (neutral opp) x = x" - shows "monoidal opp" - unfolding monoidal_def using assms by fastforce - -lemma monoidal_ac: - assumes "monoidal opp" - shows [simp]: "opp (neutral opp) a = a" - and [simp]: "opp a (neutral opp) = a" - and "opp a b = opp b a" - and "opp (opp a b) c = opp a (opp b c)" - and "opp a (opp b c) = opp b (opp a c)" - using assms unfolding monoidal_def by metis+ - -lemma neutral_lifted [cong]: - assumes "monoidal opp" - shows "neutral (lifted opp) = Some (neutral opp)" -proof - - { fix x - assume "\y. lifted opp x y = y \ lifted opp y x = y" - then have "Some (neutral opp) = x" - apply (induct x) - apply force - by (metis assms lifted.simps(1) monoidal_ac(2) option.inject) } - note [simp] = this - show ?thesis - apply (subst neutral_def) - apply (intro some_equality allI) - apply (induct_tac y) - apply (auto simp add:monoidal_ac[OF assms]) - done -qed - -lemma monoidal_lifted[intro]: - assumes "monoidal opp" - shows "monoidal (lifted opp)" - unfolding monoidal_def split_option_all neutral_lifted[OF assms] - using monoidal_ac[OF assms] - by auto - -definition "support opp f s = {x. x\s \ f x \ neutral opp}" -definition "fold' opp e s = (if finite s then Finite_Set.fold opp e s else e)" -definition "iterate opp s f = fold' (\x a. opp (f x) a) (neutral opp) (support opp f s)" - -lemma support_subset[intro]: "support opp f s \ s" - unfolding support_def by auto - -lemma support_empty[simp]: "support opp f {} = {}" - using support_subset[of opp f "{}"] by auto - -lemma comp_fun_commute_monoidal[intro]: - assumes "monoidal opp" - shows "comp_fun_commute opp" - unfolding comp_fun_commute_def - using monoidal_ac[OF assms] - by auto - -lemma support_clauses: - "\f g s. support opp f {} = {}" - "\f g s. support opp f (insert x s) = - (if f(x) = neutral opp then support opp f s else insert x (support opp f s))" - "\f g s. support opp f (s - {x}) = (support opp f s) - {x}" - "\f g s. support opp f (s \ t) = (support opp f s) \ (support opp f t)" - "\f g s. support opp f (s \ t) = (support opp f s) \ (support opp f t)" - "\f g s. support opp f (s - t) = (support opp f s) - (support opp f t)" - "\f g s. support opp g (f ` s) = f ` (support opp (g \ f) s)" - unfolding support_def by auto - -lemma finite_support[intro]: "finite s \ finite (support opp f s)" - unfolding support_def by auto - -lemma iterate_empty[simp]: "iterate opp {} f = neutral opp" - unfolding iterate_def fold'_def by auto - -lemma iterate_insert[simp]: - assumes "monoidal opp" - and "finite s" - shows "iterate opp (insert x s) f = - (if x \ s then iterate opp s f else opp (f x) (iterate opp s f))" -proof (cases "x \ s") - case True - then show ?thesis by (auto simp: insert_absorb iterate_def) -next - case False - note * = comp_fun_commute.comp_comp_fun_commute [OF comp_fun_commute_monoidal[OF assms(1)]] - show ?thesis - proof (cases "f x = neutral opp") - case True - then show ?thesis - using assms \x \ s\ - by (auto simp: iterate_def support_clauses) - next - case False - with \x \ s\ \finite s\ support_subset show ?thesis - apply (simp add: iterate_def fold'_def support_clauses) - apply (subst comp_fun_commute.fold_insert[OF * finite_support, simplified comp_def]) - apply (force simp add: )+ - done - qed -qed - -lemma iterate_some: - "\monoidal opp; finite s\ \ iterate (lifted opp) s (\x. Some(f x)) = Some (iterate opp s f)" - by (erule finite_induct) (auto simp: monoidal_lifted) - - subsection \Two key instances of additivity.\ -lemma neutral_add[simp]: "neutral op + = (0::'a::comm_monoid_add)" - unfolding neutral_def - by (force elim: allE [where x=0]) - lemma operative_content[intro]: "operative (op +) content" by (force simp add: operative_def content_split[symmetric]) diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Path_Connected.thy --- a/src/HOL/Multivariate_Analysis/Path_Connected.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Path_Connected.thy Tue Jun 14 15:34:21 2016 +0100 @@ -1433,8 +1433,8 @@ ultimately show False using *[unfolded connected_local not_ex, rule_format, of "{x\{0..1}. g x \ e1}" "{x\{0..1}. g x \ e2}"] - using continuous_openin_preimage[OF g(1)[unfolded path_def] as(1)] - using continuous_openin_preimage[OF g(1)[unfolded path_def] as(2)] + using continuous_openin_preimage_gen[OF g(1)[unfolded path_def] as(1)] + using continuous_openin_preimage_gen[OF g(1)[unfolded path_def] as(2)] by auto qed @@ -4605,6 +4605,24 @@ using eq homeomorphism_sym homeomorphism_symD [OF hom] apply blast+ done +lemma homeomorphic_locally: + fixes S:: "'a::metric_space set" and T:: "'b::metric_space set" + assumes hom: "S homeomorphic T" + and iff: "\X Y. X homeomorphic Y \ (P X \ Q Y)" + shows "locally P S \ locally Q T" +proof - + obtain f g where hom: "homeomorphism S T f g" + using assms by (force simp: homeomorphic_def) + then show ?thesis + using homeomorphic_def local.iff + by (blast intro!: homeomorphism_locally) +qed + +lemma homeomorphic_local_compactness: + fixes S:: "'a::metric_space set" and T:: "'b::metric_space set" + shows "S homeomorphic T \ locally compact S \ locally compact T" +by (simp add: homeomorphic_compactness homeomorphic_locally) + lemma locally_translation: fixes P :: "'a :: real_normed_vector set \ bool" shows @@ -4651,6 +4669,107 @@ done qed +subsection\Sort of induction principle for connected sets\ + +lemma connected_induction: + assumes "connected S" + and opD: "\T a. \openin (subtopology euclidean S) T; a \ T\ \ \z. z \ T \ P z" + and opI: "\a. a \ S + \ \T. openin (subtopology euclidean S) T \ a \ T \ + (\x \ T. \y \ T. P x \ P y \ Q x \ Q y)" + and etc: "a \ S" "b \ S" "P a" "P b" "Q a" + shows "Q b" +proof - + have 1: "openin (subtopology euclidean S) + {b. \T. openin (subtopology euclidean S) T \ + b \ T \ (\x\T. P x \ Q x)}" + apply (subst openin_subopen, clarify) + apply (rule_tac x=T in exI, auto) + done + have 2: "openin (subtopology euclidean S) + {b. \T. openin (subtopology euclidean S) T \ + b \ T \ (\x\T. P x \ ~ Q x)}" + apply (subst openin_subopen, clarify) + apply (rule_tac x=T in exI, auto) + done + show ?thesis + using \connected S\ + apply (simp only: connected_openin HOL.not_ex HOL.de_Morgan_conj) + apply (elim disjE allE) + apply (blast intro: 1) + apply (blast intro: 2, simp_all) + apply clarify apply (metis opI) + using opD apply (blast intro: etc elim: dest:) + using opI etc apply meson+ + done +qed + +lemma connected_equivalence_relation_gen: + assumes "connected S" + and etc: "a \ S" "b \ S" "P a" "P b" + and trans: "\x y z. \R x y; R y z\ \ R x z" + and opD: "\T a. \openin (subtopology euclidean S) T; a \ T\ \ \z. z \ T \ P z" + and opI: "\a. a \ S + \ \T. openin (subtopology euclidean S) T \ a \ T \ + (\x \ T. \y \ T. P x \ P y \ R x y)" + shows "R a b" +proof - + have "\a b c. \a \ S; P a; b \ S; c \ S; P b; P c; R a b\ \ R a c" + apply (rule connected_induction [OF \connected S\ opD], simp_all) + by (meson trans opI) + then show ?thesis by (metis etc opI) +qed + +lemma connected_induction_simple: + assumes "connected S" + and etc: "a \ S" "b \ S" "P a" + and opI: "\a. a \ S + \ \T. openin (subtopology euclidean S) T \ a \ T \ + (\x \ T. \y \ T. P x \ P y)" + shows "P b" +apply (rule connected_induction [OF \connected S\ _, where P = "\x. True"], blast) +apply (frule opI) +using etc apply simp_all +done + +lemma connected_equivalence_relation: + assumes "connected S" + and etc: "a \ S" "b \ S" + and sym: "\x y z. R x y \ R y x" + and trans: "\x y z. R x y \ R y z \ R x z" + and opI: "\a. a \ S + \ \T. openin (subtopology euclidean S) T \ a \ T \ (\x \ T. R a x)" + shows "R a b" +proof - + have "\a b c. \a \ S; b \ S; c \ S; R a b\ \ R a c" + apply (rule connected_induction_simple [OF \connected S\], simp_all) + by (meson local.sym local.trans opI) + then show ?thesis by (metis etc opI) +qed + + +lemma locally_constant_imp_constant: + assumes "connected S" + and opI: "\a. a \ S + \ \T. openin (subtopology euclidean S) T \ a \ T \ (\x \ T. f x = f a)" + shows "f constant_on S" +proof - + have "\x y. x \ S \ y \ S \ f x = f y" + apply (rule connected_equivalence_relation [OF \connected S\], simp_all) + by (metis opI) + then show ?thesis + by (metis constant_on_def) +qed + +lemma locally_constant: + "connected S \ locally (\U. f constant_on U) S \ f constant_on S" +apply (simp add: locally_def) +apply (rule iffI) + apply (rule locally_constant_imp_constant, assumption) + apply (metis (mono_tags, hide_lams) constant_on_def constant_on_subset openin_subtopology_self) +by (meson constant_on_subset openin_imp_subset order_refl) + + subsection\Basic properties of local compactness\ lemma locally_compact: @@ -5145,7 +5264,7 @@ lemma continuous_openin_preimage_eq: "continuous_on S f \ (\t. open t \ openin (subtopology euclidean S) {x. x \ S \ f x \ t})" -apply (auto simp: continuous_openin_preimage) +apply (auto simp: continuous_openin_preimage_gen) apply (fastforce simp add: continuous_on_open openin_open) done @@ -5171,7 +5290,7 @@ using Union_components by blast then show "openin (subtopology euclidean S) {x \ S. f x \ t}" using \open t\ assms - by (fastforce intro: openin_trans continuous_openin_preimage) + by (fastforce intro: openin_trans continuous_openin_preimage_gen) qed lemma continuous_on_components: diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Tue Jun 14 15:34:21 2016 +0100 @@ -1906,12 +1906,12 @@ lemma islimpt_in_closure: "(x islimpt S) = (x:closure(S-{x}))" unfolding closure_def using islimpt_punctured by blast -lemma connected_imp_connected_closure: "connected s \ connected (closure s)" +lemma connected_imp_connected_closure: "connected S \ connected (closure S)" by (rule connectedI) (meson closure_subset open_Int open_Int_closure_eq_empty subset_trans connectedD) lemma limpt_of_limpts: fixes x :: "'a::metric_space" - shows "x islimpt {y. y islimpt s} \ x islimpt s" + shows "x islimpt {y. y islimpt S} \ x islimpt S" apply (clarsimp simp add: islimpt_approachable) apply (drule_tac x="e/2" in spec) apply (auto simp: simp del: less_divide_eq_numeral1) @@ -1920,27 +1920,37 @@ apply (erule rev_bexI) by (metis dist_commute dist_triangle_half_r less_trans less_irrefl) -lemma closed_limpts: "closed {x::'a::metric_space. x islimpt s}" +lemma closed_limpts: "closed {x::'a::metric_space. x islimpt S}" using closed_limpt limpt_of_limpts by blast lemma limpt_of_closure: fixes x :: "'a::metric_space" - shows "x islimpt closure s \ x islimpt s" + shows "x islimpt closure S \ x islimpt S" by (auto simp: closure_def islimpt_Un dest: limpt_of_limpts) lemma closedin_limpt: - "closedin (subtopology euclidean t) s \ s \ t \ (\x. x islimpt s \ x \ t \ x \ s)" + "closedin (subtopology euclidean T) S \ S \ T \ (\x. x islimpt S \ x \ T \ x \ S)" apply (simp add: closedin_closed, safe) apply (simp add: closed_limpt islimpt_subset) - apply (rule_tac x="closure s" in exI) + apply (rule_tac x="closure S" in exI) apply simp apply (force simp: closure_def) done lemma closedin_closed_eq: - "closed s \ (closedin (subtopology euclidean s) t \ closed t \ t \ s)" + "closed S \ (closedin (subtopology euclidean S) T \ closed T \ T \ S)" by (meson closedin_limpt closed_subset closedin_closed_trans) +lemma closedin_subset_trans: + "\closedin (subtopology euclidean U) S; S \ T; T \ U\ + \ closedin (subtopology euclidean T) S" +by (meson closedin_limpt subset_iff) + +lemma closedin_Times: + "\closedin (subtopology euclidean S) S'; closedin (subtopology euclidean T) T'\ + \ closedin (subtopology euclidean (S \ T)) (S' \ T')" +unfolding closedin_closed using closed_Times by blast + lemma bdd_below_closure: fixes A :: "real set" assumes "bdd_below A" @@ -2438,14 +2448,13 @@ by (rule topological_tendstoI, auto elim: eventually_mono) lemma Lim_transform_within_set: - fixes a l :: "'a::real_normed_vector" - shows "\(f \ l) (at a within s); eventually (\x. x \ s \ x \ t) (at a)\ - \ (f \ l) (at a within t)" + fixes a :: "'a::metric_space" and l :: "'b::metric_space" + shows "\(f \ l) (at a within S); eventually (\x. x \ S \ x \ T) (at a)\ + \ (f \ l) (at a within T)" apply (clarsimp simp: eventually_at Lim_within) apply (drule_tac x=e in spec, clarify) apply (rename_tac k) -apply (rule_tac x="min d k" in exI) -apply (simp add:) +apply (rule_tac x="min d k" in exI, simp) done lemma Lim_transform_within_set_eq: @@ -2454,6 +2463,31 @@ \ ((f \ l) (at a within s) \ (f \ l) (at a within t))" by (force intro: Lim_transform_within_set elim: eventually_mono) +lemma Lim_transform_within_openin: + fixes a :: "'a::metric_space" + assumes f: "(f \ l) (at a within T)" + and "openin (subtopology euclidean T) S" "a \ S" + and eq: "\x. \x \ S; x \ a\ \ f x = g x" + shows "(g \ l) (at a within T)" +proof - + obtain \ where "0 < \" and \: "ball a \ \ T \ S" + using assms by (force simp: openin_contains_ball) + then have "a \ ball a \" + by force + show ?thesis + apply (rule Lim_transform_within [OF f \0 < \\ eq]) + using \ apply (auto simp: dist_commute subset_iff) + done +qed + +lemma continuous_transform_within_openin: + fixes a :: "'a::metric_space" + assumes "continuous (at a within T) f" + and "openin (subtopology euclidean T) S" "a \ S" + and eq: "\x. x \ S \ f x = g x" + shows "continuous (at a within T) g" +using assms by (simp add: Lim_transform_within_openin continuous_within) + text\The expected monotonicity property.\ lemma Lim_Un: @@ -2544,6 +2578,72 @@ text\Another limit point characterization.\ +lemma limpt_sequential_inj: + fixes x :: "'a::metric_space" + shows "x islimpt S \ + (\f. (\n::nat. f n \ S - {x}) \ inj f \ (f \ x) sequentially)" + (is "?lhs = ?rhs") +proof + assume ?lhs + then have "\e>0. \x'\S. x' \ x \ dist x' x < e" + by (force simp: islimpt_approachable) + then obtain y where y: "\e. e>0 \ y e \ S \ y e \ x \ dist (y e) x < e" + by metis + define f where "f \ rec_nat (y 1) (\n fn. y (min (inverse(2 ^ (Suc n))) (dist fn x)))" + have [simp]: "f 0 = y 1" + "f(Suc n) = y (min (inverse(2 ^ (Suc n))) (dist (f n) x))" for n + by (simp_all add: f_def) + have f: "f n \ S \ (f n \ x) \ dist (f n) x < inverse(2 ^ n)" for n + proof (induction n) + case 0 show ?case + by (simp add: y) + next + case (Suc n) then show ?case + apply (auto simp: y) + by (metis half_gt_zero_iff inverse_positive_iff_positive less_divide_eq_numeral1(1) min_less_iff_conj y zero_less_dist_iff zero_less_numeral zero_less_power) + qed + show ?rhs + proof (rule_tac x=f in exI, intro conjI allI) + show "\n. f n \ S - {x}" + using f by blast + have "dist (f n) x < dist (f m) x" if "m < n" for m n + using that + proof (induction n) + case 0 then show ?case by simp + next + case (Suc n) + then consider "m < n" | "m = n" using less_Suc_eq by blast + then show ?case + proof cases + assume "m < n" + have "dist (f(Suc n)) x = dist (y (min (inverse(2 ^ (Suc n))) (dist (f n) x))) x" + by simp + also have "... < dist (f n) x" + by (metis dist_pos_lt f min.strict_order_iff min_less_iff_conj y) + also have "... < dist (f m) x" + using Suc.IH \m < n\ by blast + finally show ?thesis . + next + assume "m = n" then show ?case + by simp (metis dist_pos_lt f half_gt_zero_iff inverse_positive_iff_positive min_less_iff_conj y zero_less_numeral zero_less_power) + qed + qed + then show "inj f" + by (metis less_irrefl linorder_injI) + show "f \ x" + apply (rule tendstoI) + apply (rule_tac c="nat (ceiling(1/e))" in eventually_sequentiallyI) + apply (rule less_trans [OF f [THEN conjunct2, THEN conjunct2]]) + apply (simp add: field_simps) + by (meson le_less_trans mult_less_cancel_left not_le of_nat_less_two_power) + qed +next + assume ?rhs + then show ?lhs + by (fastforce simp add: islimpt_approachable lim_sequentially) +qed + +(*could prove directly from islimpt_sequential_inj, but only for metric spaces*) lemma islimpt_sequential: fixes x :: "'a::first_countable_topology" shows "x islimpt S \ (\f. (\n::nat. f n \ S - {x}) \ (f \ x) sequentially)" @@ -5822,6 +5922,36 @@ unfolding continuous_on_open_invariant openin_open Int_def vimage_def Int_commute by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) +lemma continuous_on_open_gen: + fixes f :: "'a::metric_space \ 'b::metric_space" + assumes "f ` S \ T" + shows "continuous_on S f \ + (\U. openin (subtopology euclidean T) U + \ openin (subtopology euclidean S) {x \ S. f x \ U})" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply (auto simp: openin_euclidean_subtopology_iff continuous_on_iff) + by (metis assms image_subset_iff) +next + have ope: "openin (subtopology euclidean T) (ball y e \ T)" for y e + by (simp add: Int_commute openin_open_Int) + assume ?rhs + then show ?lhs + apply (clarsimp simp add: continuous_on_iff) + apply (drule_tac x = "ball (f x) e \ T" in spec) + apply (clarsimp simp add: ope openin_euclidean_subtopology_iff [of S]) + by (metis (no_types, hide_lams) assms dist_commute dist_self image_subset_iff) +qed + +lemma continuous_openin_preimage: + fixes f :: "'a::metric_space \ 'b::metric_space" + shows + "\continuous_on S f; f ` S \ T; openin (subtopology euclidean T) U\ + \ openin (subtopology euclidean S) {x \ S. f x \ U}" +by (simp add: continuous_on_open_gen) + text \Similarly in terms of closed sets.\ lemma continuous_on_closed: @@ -5831,9 +5961,37 @@ unfolding continuous_on_closed_invariant closedin_closed Int_def vimage_def Int_commute by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong) +lemma continuous_on_closed_gen: + fixes f :: "'a::metric_space \ 'b::metric_space" + assumes "f ` S \ T" + shows "continuous_on S f \ + (\U. closedin (subtopology euclidean T) U + \ closedin (subtopology euclidean S) {x \ S. f x \ U})" +proof - + have *: "U \ T \ {x \ S. f x \ T \ f x \ U} = S - {x \ S. f x \ U}" for U + using assms by blast + show ?thesis + apply (simp add: continuous_on_open_gen [OF assms], safe) + apply (drule_tac [!] x="T-U" in spec) + apply (force simp: closedin_def *) + apply (force simp: openin_closedin_eq *) + done +qed + +lemma continuous_closedin_preimage_gen: + fixes f :: "'a::metric_space \ 'b::metric_space" + assumes "continuous_on S f" "f ` S \ T" "closedin (subtopology euclidean T) U" + shows "closedin (subtopology euclidean S) {x \ S. f x \ U}" +using assms continuous_on_closed_gen by blast + +lemma continuous_on_imp_closedin: + assumes "continuous_on S f" "closedin (subtopology euclidean (f ` S)) T" + shows "closedin (subtopology euclidean S) {x. x \ S \ f x \ T}" +using assms continuous_on_closed by blast + subsection \Half-global and completely global cases.\ -lemma continuous_openin_preimage: +lemma continuous_openin_preimage_gen: assumes "continuous_on s f" "open t" shows "openin (subtopology euclidean s) {x \ s. f x \ t}" proof - @@ -5867,7 +6025,7 @@ shows "open {x \ s. f x \ t}" proof- obtain T where T: "open T" "{x \ s. f x \ t} = s \ T" - using continuous_openin_preimage[OF assms(1,3)] unfolding openin_open by auto + using continuous_openin_preimage_gen[OF assms(1,3)] unfolding openin_open by auto then show ?thesis using open_Int[of s T, OF assms(2)] by auto qed @@ -6753,7 +6911,7 @@ proof safe fix y assume "y \ s" - from continuous_openin_preimage[OF f open_ball] + from continuous_openin_preimage_gen[OF f open_ball] obtain T where "open T" and T: "{x \ s. f x \ ball (f y) (e/2)} = T \ s" unfolding openin_subtopology open_openin by metis then obtain d where "ball y d \ T" "0 < d" @@ -9257,12 +9415,12 @@ assumes "open S" "finite X" "p \ S" shows "\e>0. \w\ball p e. w\S \ (w\p \ w\X)" proof - - obtain e1 where "0 < e1" and e1_b:"ball p e1 \ S" + obtain e1 where "0 < e1" and e1_b:"ball p e1 \ S" using open_contains_ball_eq[OF \open S\] assms by auto - obtain e2 where "0 < e2" and "\x\X. x \ p \ e2 \ dist p x" + obtain e2 where "0 < e2" and "\x\X. x \ p \ e2 \ dist p x" using finite_set_avoid[OF \finite X\,of p] by auto hence "\w\ball p (min e1 e2). w\S \ (w\p \ w\X)" using e1_b by auto - thus "\e>0. \w\ball p e. w \ S \ (w \ p \ w \ X)" using \e2>0\ \e1>0\ + thus "\e>0. \w\ball p e. w \ S \ (w \ p \ w \ X)" using \e2>0\ \e1>0\ apply (rule_tac x="min e1 e2" in exI) by auto qed @@ -9272,7 +9430,7 @@ assumes "open S" "finite X" "p \ S" shows "\e>0. \w\cball p e. w\S \ (w\p \ w\X)" proof - - obtain e1 where "e1>0" and e1: "\w\ball p e1. w\S \ (w\p \ w\X)" + obtain e1 where "e1>0" and e1: "\w\ball p e1. w\S \ (w\p \ w\X)" using finite_ball_avoid[OF assms] by auto define e2 where "e2 \ e1/2" have "e2>0" and "e2 < e1" unfolding e2_def using \e1>0\ by auto @@ -9280,6 +9438,180 @@ then show "\e>0. \w\cball p e. w \ S \ (w \ p \ w \ X)" using \e2>0\ e1 by auto qed +subsection\Various separability-type properties\ + +lemma univ_second_countable: + obtains \ :: "'a::euclidean_space set set" + where "countable \" "\C. C \ \ \ open C" + "\S. open S \ \U. U \ \ \ S = \U" +by (metis ex_countable_basis topological_basis_def) + +lemma univ_second_countable_sequence: + obtains B :: "nat \ 'a::euclidean_space set" + where "inj B" "\n. open(B n)" "\S. open S \ \k. S = \{B n |n. n \ k}" +proof - + obtain \ :: "'a set set" + where "countable \" + and op: "\C. C \ \ \ open C" + and Un: "\S. open S \ \U. U \ \ \ S = \U" + using univ_second_countable by blast + have *: "infinite (range (\n. ball (0::'a) (inverse(Suc n))))" + apply (rule Infinite_Set.range_inj_infinite) + apply (simp add: inj_on_def ball_eq_ball_iff) + done + have "infinite \" + proof + assume "finite \" + then have "finite (Union ` (Pow \))" + by simp + then have "finite (range (\n. ball (0::'a) (inverse(Suc n))))" + apply (rule rev_finite_subset) + by (metis (no_types, lifting) PowI image_eqI image_subset_iff Un [OF open_ball]) + with * show False by simp + qed + obtain f :: "nat \ 'a set" where "\ = range f" "inj f" + by (blast intro: countable_as_injective_image [OF \countable \\ \infinite \\]) + have *: "\k. S = \{f n |n. n \ k}" if "open S" for S + using Un [OF that] + apply clarify + apply (rule_tac x="f-`U" in exI) + using \inj f\ \\ = range f\ apply force + done + show ?thesis + apply (rule that [OF \inj f\ _ *]) + apply (auto simp: \\ = range f\ op) + done +qed + +proposition Lindelof: + fixes \ :: "'a::euclidean_space set set" + assumes \: "\S. S \ \ \ open S" + obtains \' where "\' \ \" "countable \'" "\\' = \\" +proof - + obtain \ :: "'a set set" + where "countable \" "\C. C \ \ \ open C" + and \: "\S. open S \ \U. U \ \ \ S = \U" + using univ_second_countable by blast + define \ where "\ \ {S. S \ \ \ (\U. U \ \ \ S \ U)}" + have "countable \" + apply (rule countable_subset [OF _ \countable \\]) + apply (force simp: \_def) + done + have "\S. \U. S \ \ \ U \ \ \ S \ U" + by (simp add: \_def) + then obtain G where G: "\S. S \ \ \ G S \ \ \ S \ G S" + by metis + have "\\ \ \\" + unfolding \_def by (blast dest: \ \) + moreover have "\\ \ \\" + using \_def by blast + ultimately have eq1: "\\ = \\" .. + have eq2: "\\ = UNION \ G" + using G eq1 by auto + show ?thesis + apply (rule_tac \' = "G ` \" in that) + using G \countable \\ apply (auto simp: eq1 eq2) + done +qed + +lemma Lindelof_openin: + fixes \ :: "'a::euclidean_space set set" + assumes "\S. S \ \ \ openin (subtopology euclidean U) S" + obtains \' where "\' \ \" "countable \'" "\\' = \\" +proof - + have "\S. S \ \ \ \T. open T \ S = U \ T" + using assms by (simp add: openin_open) + then obtain tf where tf: "\S. S \ \ \ open (tf S) \ (S = U \ tf S)" + by metis + have [simp]: "\\'. \' \ \ \ \\' = U \ \(tf ` \')" + using tf by fastforce + obtain \ where "countable \ \ \ \ tf ` \" "\\ = UNION \ tf" + using tf by (force intro: Lindelof [of "tf ` \"]) + then obtain \' where \': "\' \ \" "countable \'" "\\' = \\" + by (clarsimp simp add: countable_subset_image) + then show ?thesis .. +qed + +lemma countable_disjoint_open_subsets: + fixes \ :: "'a::euclidean_space set set" + assumes "\S. S \ \ \ open S" and pw: "pairwise disjnt \" + shows "countable \" +proof - + obtain \' where "\' \ \" "countable \'" "\\' = \\" + by (meson assms Lindelof) + with pw have "\ \ insert {} \'" + by (fastforce simp add: pairwise_def disjnt_iff) + then show ?thesis + by (simp add: \countable \'\ countable_subset) +qed + +lemma closedin_compact: + "\compact S; closedin (subtopology euclidean S) T\ \ compact T" +by (metis closedin_closed compact_Int_closed) + +lemma closedin_compact_eq: + fixes S :: "'a::t2_space set" + shows + "compact S + \ (closedin (subtopology euclidean S) T \ + compact T \ T \ S)" +by (metis closedin_imp_subset closedin_compact closed_subset compact_imp_closed) + +subsection\ Finite intersection property\ + +text\Also developed in HOL's toplogical spaces theory, but the Heine-Borel type class isn't available there.\ + +lemma closed_imp_fip: + fixes S :: "'a::heine_borel set" + assumes "closed S" + and T: "T \ \" "bounded T" + and clof: "\T. T \ \ \ closed T" + and none: "\\'. \finite \'; \' \ \\ \ S \ \\' \ {}" + shows "S \ \\ \ {}" +proof - + have "compact (S \ T)" + using \closed S\ clof compact_eq_bounded_closed T by blast + then have "(S \ T) \ \\ \ {}" + apply (rule compact_imp_fip) + apply (simp add: clof) + by (metis Int_assoc complete_lattice_class.Inf_insert finite_insert insert_subset none \T \ \\) + then show ?thesis by blast +qed + +lemma closed_imp_fip_compact: + fixes S :: "'a::heine_borel set" + shows + "\closed S; \T. T \ \ \ compact T; + \\'. \finite \'; \' \ \\ \ S \ \\' \ {}\ + \ S \ \\ \ {}" +by (metis Inf_greatest closed_imp_fip compact_eq_bounded_closed empty_subsetI finite.emptyI inf.orderE) + +lemma closed_fip_heine_borel: + fixes \ :: "'a::heine_borel set set" + assumes "closed S" "T \ \" "bounded T" + and "\T. T \ \ \ closed T" + and "\\'. \finite \'; \' \ \\ \ \\' \ {}" + shows "\\ \ {}" +proof - + have "UNIV \ \\ \ {}" + using assms closed_imp_fip [OF closed_UNIV] by auto + then show ?thesis by simp +qed + +lemma compact_fip_heine_borel: + fixes \ :: "'a::heine_borel set set" + assumes clof: "\T. T \ \ \ compact T" + and none: "\\'. \finite \'; \' \ \\ \ \\' \ {}" + shows "\\ \ {}" +by (metis InterI all_not_in_conv clof closed_fip_heine_borel compact_eq_bounded_closed none) + +lemma compact_sequence_with_limit: + fixes f :: "nat \ 'a::heine_borel" + shows "(f \ l) sequentially \ compact (insert l (range f))" +apply (simp add: compact_eq_bounded_closed, auto) +apply (simp add: convergent_imp_bounded) +by (simp add: closed_limpt islimpt_insert sequence_unique_limpt) + no_notation eucl_less (infix " A \ B = {}" +lemma disjnt_iff: "disjnt A B \ (\x. ~ (x \ A \ x \ B))" + by (force simp: disjnt_def) + lemma pairwise_empty [simp]: "pairwise P {}" by (simp add: pairwise_def) diff -r ce995deef4b0 -r d3c87eb0bad2 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Mon Jun 13 22:42:38 2016 +0200 +++ b/src/HOL/Topological_Spaces.thy Tue Jun 14 15:34:21 2016 +0100 @@ -146,7 +146,7 @@ shows "x \ y \ (\U. open U \ x \ U \ y \ U)" using t1_space[of x y] by blast -lemma closed_singleton: +lemma closed_singleton [iff]: fixes a :: "'a::t1_space" shows "closed {a}" proof - @@ -1610,6 +1610,9 @@ lemma continuous_on_id[continuous_intros]: "continuous_on s (\x. x)" unfolding continuous_on_def by fast +lemma continuous_on_id'[continuous_intros]: "continuous_on s id" + unfolding continuous_on_def id_def by fast + lemma continuous_on_const[continuous_intros]: "continuous_on s (\x. c)" unfolding continuous_on_def by auto @@ -1841,6 +1844,8 @@ lemma inj_setminus: "inj_on uminus (A::'a set set)" by (auto simp: inj_on_def) +subsection\ Finite intersection property\ + lemma compact_fip: "compact U \ (\A. (\a\A. closed a) \ (\B \ A. finite B \ U \ \B \ {}) \ U \ \A \ {})"