# HG changeset patch # User paulson # Date 1460388462 -3600 # Node ID 7700f467892b738938f6587694371653109b29d8 # Parent 3374f3ffb2ec77daf30e6e2f7e26460232583534 lots of new theorems for multivariate analysis diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy --- a/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Brouwer_Fixpoint.thy Mon Apr 11 16:27:42 2016 +0100 @@ -19,7 +19,7 @@ section \Results connected with topological dimension.\ theory Brouwer_Fixpoint -imports Convex_Euclidean_Space +imports Path_Connected begin lemma bij_betw_singleton_eq: @@ -2010,4 +2010,186 @@ using x assms by auto qed +subsection\Retractions\ + +lemma retraction: + "retraction s t r \ + t \ s \ continuous_on s r \ r ` s = t \ (\x \ t. r x = x)" +by (force simp: retraction_def) + +lemma retract_of_imp_extensible: + assumes "s retract_of t" and "continuous_on s f" and "f ` s \ u" + obtains g where "continuous_on t g" "g ` t \ u" "\x. x \ s \ g x = f x" +using assms +apply (clarsimp simp add: retract_of_def retraction) +apply (rule_tac g = "f o r" in that) +apply (auto simp: continuous_on_compose2) +done + +lemma idempotent_imp_retraction: + assumes "continuous_on s f" and "f ` s \ s" and "\x. x \ s \ f(f x) = f x" + shows "retraction s (f ` s) f" +by (simp add: assms retraction) + +lemma retraction_subset: + assumes "retraction s t r" and "t \ s'" and "s' \ s" + shows "retraction s' t r" +apply (simp add: retraction_def) +by (metis assms continuous_on_subset image_mono retraction) + +lemma retract_of_subset: + assumes "t retract_of s" and "t \ s'" and "s' \ s" + shows "t retract_of s'" +by (meson assms retract_of_def retraction_subset) + +lemma retraction_refl [simp]: "retraction s s (\x. x)" +by (simp add: continuous_on_id retraction) + +lemma retract_of_refl [iff]: "s retract_of s" + using continuous_on_id retract_of_def retraction_def by fastforce + +lemma retract_of_imp_subset: + "s retract_of t \ s \ t" +by (simp add: retract_of_def retraction_def) + +lemma retract_of_empty [simp]: + "({} retract_of s) \ s = {}" "(s retract_of {}) \ s = {}" +by (auto simp: retract_of_def retraction_def) + +lemma retract_of_singleton [iff]: "({x} retract_of s) \ x \ s" + using continuous_on_const + by (auto simp: retract_of_def retraction_def) + +lemma retraction_comp: + "\retraction s t f; retraction t u g\ + \ retraction s u (g o f)" +apply (auto simp: retraction_def intro: continuous_on_compose2) +by blast + +lemma retract_of_trans: + assumes "s retract_of t" and "t retract_of u" + shows "s retract_of u" +using assms by (auto simp: retract_of_def intro: retraction_comp) + +lemma closedin_retract: + fixes s :: "'a :: real_normed_vector set" + assumes "s retract_of t" + shows "closedin (subtopology euclidean t) s" +proof - + obtain r where "s \ t" "continuous_on t r" "r ` t \ s" "\x. x \ s \ r x = x" + using assms by (auto simp: retract_of_def retraction_def) + then have s: "s = {x \ t. (norm(r x - x)) = 0}" by auto + show ?thesis + apply (subst s) + apply (rule continuous_closedin_preimage_constant) + by (simp add: \continuous_on t r\ continuous_on_diff continuous_on_id continuous_on_norm) +qed + +lemma retract_of_contractible: + assumes "contractible t" "s retract_of t" + shows "contractible s" +using assms +apply (clarsimp simp add: retract_of_def contractible_def retraction_def homotopic_with) +apply (rule_tac x="r a" in exI) +apply (rule_tac x="r o h" in exI) +apply (intro conjI continuous_intros continuous_on_compose) +apply (erule continuous_on_subset | force)+ +done + +lemma retract_of_compact: + "\compact t; s retract_of t\ \ compact s" + by (metis compact_continuous_image retract_of_def retraction) + +lemma retract_of_closed: + fixes s :: "'a :: real_normed_vector set" + shows "\closed t; s retract_of t\ \ closed s" + by (metis closedin_retract closedin_closed_eq) + +lemma retract_of_connected: + "\connected t; s retract_of t\ \ connected s" + by (metis Topological_Spaces.connected_continuous_image retract_of_def retraction) + +lemma retract_of_path_connected: + "\path_connected t; s retract_of t\ \ path_connected s" + by (metis path_connected_continuous_image retract_of_def retraction) + +lemma retract_of_simply_connected: + "\simply_connected t; s retract_of t\ \ simply_connected s" +apply (simp add: retract_of_def retraction_def, clarify) +apply (rule simply_connected_retraction_gen) +apply (force simp: continuous_on_id elim!: continuous_on_subset)+ +done + +lemma retract_of_homotopically_trivial: + assumes ts: "t retract_of s" + and hom: "\f g. \continuous_on u f; f ` u \ s; + continuous_on u g; g ` u \ s\ + \ homotopic_with (\x. True) u s f g" + and "continuous_on u f" "f ` u \ t" + and "continuous_on u g" "g ` u \ t" + shows "homotopic_with (\x. True) u t f g" +proof - + obtain r where "r ` s \ s" "continuous_on s r" "\x\s. r (r x) = r x" "t = r ` s" + using ts by (auto simp: retract_of_def retraction) + then obtain k where "Retracts s r t k" + unfolding Retracts_def + by (metis continuous_on_subset dual_order.trans image_iff image_mono) + then show ?thesis + apply (rule Retracts.homotopically_trivial_retraction_gen) + using assms + apply (force simp: hom)+ + done +qed + +lemma retract_of_homotopically_trivial_null: + assumes ts: "t retract_of s" + and hom: "\f. \continuous_on u f; f ` u \ s\ + \ \c. homotopic_with (\x. True) u s f (\x. c)" + and "continuous_on u f" "f ` u \ t" + obtains c where "homotopic_with (\x. True) u t f (\x. c)" +proof - + obtain r where "r ` s \ s" "continuous_on s r" "\x\s. r (r x) = r x" "t = r ` s" + using ts by (auto simp: retract_of_def retraction) + then obtain k where "Retracts s r t k" + unfolding Retracts_def + by (metis continuous_on_subset dual_order.trans image_iff image_mono) + then show ?thesis + apply (rule Retracts.homotopically_trivial_retraction_null_gen) + apply (rule TrueI refl assms that | assumption)+ + done +qed + +lemma retraction_imp_quotient_map: + "retraction s t r + \ u \ t + \ (openin (subtopology euclidean s) {x. x \ s \ r x \ u} \ + openin (subtopology euclidean t) u)" +apply (clarsimp simp add: retraction) +apply (rule continuous_right_inverse_imp_quotient_map [where g=r]) +apply (auto simp: elim: continuous_on_subset) +done + +lemma retract_of_locally_compact: + fixes s :: "'a :: {heine_borel,real_normed_vector} set" + shows "\ locally compact s; t retract_of s\ \ locally compact t" + by (metis locally_compact_closedin closedin_retract) + +lemma retract_of_times: + "\s retract_of s'; t retract_of t'\ \ (s \ t) retract_of (s' \ t')" +apply (simp add: retract_of_def retraction_def Sigma_mono, clarify) +apply (rename_tac f g) +apply (rule_tac x="\z. ((f o fst) z, (g o snd) z)" in exI) +apply (rule conjI continuous_intros | erule continuous_on_subset | force)+ +done + +lemma homotopic_into_retract: + "\f ` s \ t; g ` s \ t; t retract_of u; + homotopic_with (\x. True) s u f g\ + \ homotopic_with (\x. True) s t f g" +apply (subst (asm) homotopic_with_def) +apply (simp add: homotopic_with retract_of_def retraction_def, clarify) +apply (rule_tac x="r o h" in exI) +apply (rule conjI continuous_intros | erule continuous_on_subset | force simp: image_subset_iff)+ +done + end diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Convex_Euclidean_Space.thy Mon Apr 11 16:27:42 2016 +0100 @@ -411,13 +411,13 @@ lemma affine_alt: "affine s \ (\x\s. \y\s. \u::real. (1 - u) *\<^sub>R x + u *\<^sub>R y \ s)" unfolding affine_def by (metis eq_diff_eq') -lemma affine_empty[intro]: "affine {}" +lemma affine_empty [iff]: "affine {}" unfolding affine_def by auto -lemma affine_sing[intro]: "affine {x}" +lemma affine_sing [iff]: "affine {x}" unfolding affine_alt by (auto simp add: scaleR_left_distrib [symmetric]) -lemma affine_UNIV[intro]: "affine UNIV" +lemma affine_UNIV [iff]: "affine UNIV" unfolding affine_def by auto lemma affine_Inter[intro]: "(\s\f. affine s) \ affine (\f)" @@ -433,6 +433,9 @@ lemma affine_hull_eq[simp]: "(affine hull s = s) \ affine s" by (metis affine_affine_hull hull_same) +lemma affine_hyperplane: "affine {x. a \ x = b}" + by (simp add: affine_def algebra_simps) (metis distrib_right mult.left_neutral) + subsubsection \Some explicit formulations (from Lars Schewe)\ @@ -1384,6 +1387,11 @@ shows "compact s \ open s \ s = {}" by (auto simp: compact_eq_bounded_closed clopen) +corollary finite_imp_not_open: + fixes S :: "'a::{real_normed_vector, perfect_space} set" + shows "\finite S; open S\ \ S={}" + using clopen [of S] finite_imp_closed not_bounded_UNIV by blast + text \Balls, being convex, are connected.\ lemma convex_prod: @@ -2745,7 +2753,7 @@ apply (simp add: aff_dim_affine_independent aff_independent_finite) by (metis affine_basis_exists [of s] aff_dim_unique card_subset_eq diff_add_cancel of_nat_eq_iff) -lemma aff_dim_sing: +lemma aff_dim_sing [simp]: fixes a :: "'n::euclidean_space" shows "aff_dim {a} = 0" using aff_dim_affine_independent[of "{a}"] affine_independent_sing by auto @@ -3553,7 +3561,7 @@ shows "closure S \ affine hull S" by (intro closure_minimal hull_subset affine_closed affine_affine_hull) -lemma closure_same_affine_hull: +lemma closure_same_affine_hull [simp]: fixes S :: "'n::euclidean_space set" shows "affine hull (closure S) = affine hull S" proof - @@ -4741,7 +4749,7 @@ subsection \More convexity generalities\ -lemma convex_closure: +lemma convex_closure [intro,simp]: fixes s :: "'a::real_normed_vector set" assumes "convex s" shows "convex (closure s)" @@ -4753,7 +4761,7 @@ apply (auto del: tendsto_const intro!: tendsto_intros) done -lemma convex_interior: +lemma convex_interior [intro,simp]: fixes s :: "'a::real_normed_vector set" assumes "convex s" shows "convex (interior s)" @@ -6379,6 +6387,11 @@ lemmas segment = open_segment_def closed_segment_def +lemma in_segment: + "x \ closed_segment a b \ (\u. 0 \ u \ u \ 1 \ x = (1 - u) *\<^sub>R a + u *\<^sub>R b)" + "x \ open_segment a b \ a \ b \ (\u. 0 < u \ u < 1 \ x = (1 - u) *\<^sub>R a + u *\<^sub>R b)" + using less_eq_real_def by (auto simp: segment algebra_simps) + definition "between = (\(a,b) x. x \ closed_segment a b)" definition "starlike s \ (\a\s. \x\s. closed_segment a x \ s)" @@ -7819,9 +7832,9 @@ have yball: "y \ cball z e" using mem_cball y_def dist_norm[of z y] e by auto have "x \ affine hull closure S" - using x rel_interior_subset_closure hull_inc[of x "closure S"] by auto + using x rel_interior_subset_closure hull_inc[of x "closure S"] by blast moreover have "z \ affine hull closure S" - using z rel_interior_subset hull_subset[of "closure S"] by auto + using z rel_interior_subset hull_subset[of "closure S"] by blast ultimately have "y \ affine hull closure S" using y_def affine_affine_hull[of "closure S"] mem_affine_3_minus [of "affine hull closure S" z z x "e/norm(z-x)"] by auto @@ -7969,8 +7982,7 @@ have "S1 \ closure S2" using assms unfolding rel_frontier_def by auto then have *: "affine hull S1 \ affine hull S2" - using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] - by auto + using hull_mono[of "S1" "closure S2"] closure_same_affine_hull[of S2] by blast then have "aff_dim S1 \ aff_dim S2" using * aff_dim_affine_hull[of S1] aff_dim_affine_hull[of S2] aff_dim_subset[of "affine hull S1" "affine hull S2"] @@ -8072,7 +8084,7 @@ using \m > 1\ by auto } ultimately have "\m. m > 1 \ (\e. e > 1 \ e \ m \ (1 - e) *\<^sub>R x + e *\<^sub>R z \ S )" - by auto + by blast } then show ?thesis by auto qed diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Multivariate_Analysis/Linear_Algebra.thy --- a/src/HOL/Multivariate_Analysis/Linear_Algebra.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Linear_Algebra.thy Mon Apr 11 16:27:42 2016 +0100 @@ -784,7 +784,7 @@ apply (auto simp add: subspace_def) done -lemma (in real_vector) independent_empty[intro]: "independent {}" +lemma (in real_vector) independent_empty [iff]: "independent {}" by (simp add: dependent_def) lemma dependent_single[simp]: "dependent {x} \ x = 0" diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Multivariate_Analysis/Path_Connected.thy --- a/src/HOL/Multivariate_Analysis/Path_Connected.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Path_Connected.thy Mon Apr 11 16:27:42 2016 +0100 @@ -1388,8 +1388,6 @@ "\x \ t; path_connected t; t \ s\ \ t \ (path_component_set s x)" by (metis path_component_mono path_connected_component_set) -subsection \More about path-connectedness\ - lemma convex_imp_path_connected: fixes s :: "'a::real_normed_vector set" assumes "convex s" @@ -1773,6 +1771,60 @@ using is_interval_connected_1 is_interval_path_connected path_connected_imp_connected by blast +lemma Union_path_component [simp]: + "Union {path_component_set S x |x. x \ S} = S" +apply (rule subset_antisym) +using path_component_subset apply force +using path_component_refl by auto + +lemma path_component_disjoint: + "disjnt (path_component_set S a) (path_component_set S b) \ + (a \ path_component_set S b)" +apply (auto simp: disjnt_def) +using path_component_eq apply fastforce +using path_component_sym path_component_trans by blast + +lemma path_component_eq_eq: + "path_component S x = path_component S y \ + (x \ S) \ (y \ S) \ x \ S \ y \ S \ path_component S x y" +apply (rule iffI, metis (no_types) path_component_mem(1) path_component_refl) +apply (erule disjE, metis Collect_empty_eq_bot path_component_eq_empty) +apply (rule ext) +apply (metis path_component_trans path_component_sym) +done + +lemma path_component_unique: + assumes "x \ c" "c \ S" "path_connected c" + "\c'. \x \ c'; c' \ S; path_connected c'\ \ c' \ c" + shows "path_component_set S x = c" +apply (rule subset_antisym) +using assms +apply (metis mem_Collect_eq subsetCE path_component_eq_eq path_component_subset path_connected_path_component) +by (simp add: assms path_component_maximal) + +lemma path_component_intermediate_subset: + "path_component_set u a \ t \ t \ u + \ path_component_set t a = path_component_set u a" +by (metis (no_types) path_component_mono path_component_path_component subset_antisym) + +lemma complement_path_component_Union: + fixes x :: "'a :: topological_space" + shows "S - path_component_set S x = + \({path_component_set S y| y. y \ S} - {path_component_set S x})" +proof - + have *: "(\x. x \ S - {a} \ disjnt a x) \ \S - a = \(S - {a})" + for a::"'a set" and S + by (auto simp: disjnt_def) + have "\y. y \ {path_component_set S x |x. x \ S} - {path_component_set S x} + \ disjnt (path_component_set S x) y" + using path_component_disjoint path_component_eq by fastforce + then have "\{path_component_set S x |x. x \ S} - path_component_set S x = + \({path_component_set S y |y. y \ S} - {path_component_set S x})" + by (meson *) + then show ?thesis by simp +qed + + subsection \Sphere is path-connected\ lemma path_connected_punctured_universe: @@ -3697,11 +3749,10 @@ shows "homotopic_paths s g h" using assms unfolding path_def - apply (simp add: pathstart_def pathfinish_def homotopic_paths_def homotopic_with_def) + apply (simp add: closed_segment_def pathstart_def pathfinish_def homotopic_paths_def homotopic_with_def) apply (rule_tac x="\y. ((1 - (fst y)) *\<^sub>R g(snd y) + (fst y) *\<^sub>R h(snd y))" in exI) - apply (auto intro!: continuous_intros intro: continuous_on_compose2 [where g=g] continuous_on_compose2 [where g=h] ) - apply (force simp: closed_segment_def) - apply (simp_all add: algebra_simps) + apply (intro conjI subsetI continuous_intros) + apply (fastforce intro: continuous_intros continuous_on_compose2 [where g=g] continuous_on_compose2 [where g=h])+ done lemma homotopic_loops_linear: @@ -4322,4 +4373,852 @@ done qed +subsection\Local versions of topological properties in general\ + +definition locally :: "('a::topological_space set \ bool) \ 'a set \ bool" +where + "locally P S \ + \w x. openin (subtopology euclidean S) w \ x \ w + \ (\u v. openin (subtopology euclidean S) u \ P v \ + x \ u \ u \ v \ v \ w)" + +lemma locallyI: + assumes "\w x. \openin (subtopology euclidean S) w; x \ w\ + \ \u v. openin (subtopology euclidean S) u \ P v \ + x \ u \ u \ v \ v \ w" + shows "locally P S" +using assms by (force simp: locally_def) + +lemma locallyE: + assumes "locally P S" "openin (subtopology euclidean S) w" "x \ w" + obtains u v where "openin (subtopology euclidean S) u" + "P v" "x \ u" "u \ v" "v \ w" +using assms by (force simp: locally_def) + +lemma locally_mono: + assumes "locally P S" "\t. P t \ Q t" + shows "locally Q S" +by (metis assms locally_def) + +lemma locally_open_subset: + assumes "locally P S" "openin (subtopology euclidean S) t" + shows "locally P t" +using assms +apply (simp add: locally_def) +apply (erule all_forward)+ +apply (rule impI) +apply (erule impCE) + using openin_trans apply blast +apply (erule ex_forward) +by (metis (no_types, hide_lams) Int_absorb1 Int_lower1 Int_subset_iff openin_open openin_subtopology_Int_subset) + +lemma locally_diff_closed: + "\locally P S; closedin (subtopology euclidean S) t\ \ locally P (S - t)" + using locally_open_subset closedin_def by fastforce + +lemma locally_empty [iff]: "locally P {}" + by (simp add: locally_def openin_subtopology) + +lemma locally_singleton [iff]: + fixes a :: "'a::metric_space" + shows "locally P {a} \ P {a}" +apply (simp add: locally_def openin_euclidean_subtopology_iff subset_singleton_iff conj_disj_distribR cong: conj_cong) +using zero_less_one by blast + +lemma locally_iff: + "locally P S \ + (\T x. open T \ x \ S \ T \ (\U. open U \ (\v. P v \ x \ S \ U \ S \ U \ v \ v \ S \ T)))" +apply (simp add: le_inf_iff locally_def openin_open, safe) +apply (metis IntE IntI le_inf_iff) +apply (metis IntI Int_subset_iff) +done + +lemma locally_Int: + assumes S: "locally P S" and t: "locally P t" + and P: "\S t. P S \ P t \ P(S \ t)" + shows "locally P (S \ t)" +using S t unfolding locally_iff +apply clarify +apply (drule_tac x=T in spec)+ +apply (drule_tac x=x in spec)+ +apply clarsimp +apply (rename_tac U1 U2 V1 V2) +apply (rule_tac x="U1 \ U2" in exI) +apply (simp add: open_Int) +apply (rule_tac x="V1 \ V2" in exI) +apply (auto intro: P) +done + + +proposition homeomorphism_locally_imp: + fixes S :: "'a::metric_space set" and t :: "'b::t2_space set" + assumes S: "locally P S" and hom: "homeomorphism S t f g" + and Q: "\S t. \P S; homeomorphism S t f g\ \ Q t" + shows "locally Q t" +proof (clarsimp simp: locally_def) + fix w y + assume "y \ w" and "openin (subtopology euclidean t) w" + then obtain T where T: "open T" "w = t \ T" + by (force simp: openin_open) + then have "w \ t" by auto + have f: "\x. x \ S \ g(f x) = x" "f ` S = t" "continuous_on S f" + and g: "\y. y \ t \ f(g y) = y" "g ` t = S" "continuous_on t g" + using hom by (auto simp: homeomorphism_def) + have gw: "g ` w = S \ {x. f x \ w}" + using \w \ t\ + apply auto + using \g ` t = S\ \w \ t\ apply blast + using g \w \ t\ apply auto[1] + by (simp add: f rev_image_eqI) + have o: "openin (subtopology euclidean S) (g ` w)" + proof - + have "continuous_on S f" + using f(3) by blast + then show "openin (subtopology euclidean S) (g ` w)" + by (simp add: gw Collect_conj_eq \openin (subtopology euclidean t) w\ continuous_on_open f(2)) + qed + then obtain u v + where osu: "openin (subtopology euclidean S) u" and uv: "P v" "g y \ u" "u \ v" "v \ g ` w" + using S [unfolded locally_def, rule_format, of "g ` w" "g y"] \y \ w\ by force + have "v \ S" using uv by (simp add: gw) + have fv: "f ` v = t \ {x. g x \ v}" + using \f ` S = t\ f \v \ S\ by auto + have "f ` v \ w" + using uv using Int_lower2 gw image_subsetI mem_Collect_eq subset_iff by auto + have contvf: "continuous_on v f" + using \v \ S\ continuous_on_subset f(3) by blast + have contvg: "continuous_on (f ` v) g" + using \f ` v \ w\ \w \ t\ continuous_on_subset g(3) by blast + have homv: "homeomorphism v (f ` v) f g" + using \v \ S\ \w \ t\ f + apply (simp add: homeomorphism_def contvf contvg, auto) + by (metis f(1) rev_image_eqI rev_subsetD) + have 1: "openin (subtopology euclidean t) {x \ t. g x \ u}" + apply (rule continuous_on_open [THEN iffD1, rule_format]) + apply (rule \continuous_on t g\) + using \g ` t = S\ apply (simp add: osu) + done + have 2: "\v. Q v \ y \ {x \ t. g x \ u} \ {x \ t. g x \ u} \ v \ v \ w" + apply (rule_tac x="f ` v" in exI) + apply (intro conjI Q [OF \P v\ homv]) + using \w \ t\ \y \ w\ \f ` v \ w\ uv apply (auto simp: fv) + done + show "\u. openin (subtopology euclidean t) u \ + (\v. Q v \ y \ u \ u \ v \ v \ w)" + by (meson 1 2) +qed + +lemma homeomorphism_locally: + fixes f:: "'a::metric_space \ 'b::metric_space" + assumes hom: "homeomorphism S t f g" + and eq: "\S t. homeomorphism S t f g \ (P S \ Q t)" + shows "locally P S \ locally Q t" +apply (rule iffI) +apply (erule homeomorphism_locally_imp [OF _ hom]) +apply (simp add: eq) +apply (erule homeomorphism_locally_imp) +using eq homeomorphism_sym homeomorphism_symD [OF hom] apply blast+ +done + +lemma locally_translation: + fixes P :: "'a :: real_normed_vector set \ bool" + shows + "(\S. P (image (\x. a + x) S) \ P S) + \ locally P (image (\x. a + x) S) \ locally P S" +apply (rule homeomorphism_locally [OF homeomorphism_translation]) +apply (simp add: homeomorphism_def) +by metis + +lemma locally_injective_linear_image: + fixes f :: "'a::euclidean_space \ 'b::euclidean_space" + assumes f: "linear f" "inj f" and iff: "\S. P (f ` S) \ Q S" + shows "locally P (f ` S) \ locally Q S" +apply (rule linear_homeomorphism_image [OF f]) +apply (rule_tac f=g and g = f in homeomorphism_locally, assumption) +by (metis iff homeomorphism_def) + +lemma locally_open_map_image: + fixes f :: "'a::real_normed_vector \ 'b::real_normed_vector" + assumes P: "locally P S" + and f: "continuous_on S f" + and oo: "\t. openin (subtopology euclidean S) t + \ openin (subtopology euclidean (f ` S)) (f ` t)" + and Q: "\t. \t \ S; P t\ \ Q(f ` t)" + shows "locally Q (f ` S)" +proof (clarsimp simp add: locally_def) + fix w y + assume oiw: "openin (subtopology euclidean (f ` S)) w" and "y \ w" + then have "w \ f ` S" by (simp add: openin_euclidean_subtopology_iff) + have oivf: "openin (subtopology euclidean S) {x \ S. f x \ w}" + by (rule continuous_on_open [THEN iffD1, rule_format, OF f oiw]) + then obtain x where "x \ S" "f x = y" + using \w \ f ` S\ \y \ w\ by blast + then obtain u v + where "openin (subtopology euclidean S) u" "P v" "x \ u" "u \ v" "v \ {x \ S. f x \ w}" + using P [unfolded locally_def, rule_format, of "{x. x \ S \ f x \ w}" x] oivf \y \ w\ + by auto + then show "\u. openin (subtopology euclidean (f ` S)) u \ + (\v. Q v \ y \ u \ u \ v \ v \ w)" + apply (rule_tac x="f ` u" in exI) + apply (rule conjI, blast intro!: oo) + apply (rule_tac x="f ` v" in exI) + apply (force simp: \f x = y\ rev_image_eqI intro: Q) + done +qed + +subsection\Basic properties of local compactness\ + +lemma locally_compact: + fixes s :: "'a :: metric_space set" + shows + "locally compact s \ + (\x \ s. \u v. x \ u \ u \ v \ v \ s \ + openin (subtopology euclidean s) u \ compact v)" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply clarify + apply (erule_tac w = "s \ ball x 1" in locallyE) + by auto +next + assume r [rule_format]: ?rhs + have *: "\u v. + openin (subtopology euclidean s) u \ + compact v \ x \ u \ u \ v \ v \ s \ T" + if "open T" "x \ s" "x \ T" for x T + proof - + obtain u v where uv: "x \ u" "u \ v" "v \ s" "compact v" "openin (subtopology euclidean s) u" + using r [OF \x \ s\] by auto + obtain e where "e>0" and e: "cball x e \ T" + using open_contains_cball \open T\ \x \ T\ by blast + show ?thesis + apply (rule_tac x="(s \ ball x e) \ u" in exI) + apply (rule_tac x="cball x e \ v" in exI) + using that \e > 0\ e uv + apply auto + done + qed + show ?lhs + apply (rule locallyI) + apply (subst (asm) openin_open) + apply (blast intro: *) + done +qed + +lemma locally_compactE: + fixes s :: "'a :: metric_space set" + assumes "locally compact s" + obtains u v where "\x. x \ s \ x \ u x \ u x \ v x \ v x \ s \ + openin (subtopology euclidean s) (u x) \ compact (v x)" +using assms +unfolding locally_compact by metis + +lemma locally_compact_alt: + fixes s :: "'a :: heine_borel set" + shows "locally compact s \ + (\x \ s. \u. x \ u \ + openin (subtopology euclidean s) u \ compact(closure u) \ closure u \ s)" +apply (simp add: locally_compact) +apply (intro ball_cong ex_cong refl iffI) +apply (metis bounded_subset closure_eq closure_mono compact_eq_bounded_closed dual_order.trans) +by (meson closure_subset compact_closure) + +lemma locally_compact_Int_cball: + fixes s :: "'a :: heine_borel set" + shows "locally compact s \ (\x \ s. \e. 0 < e \ closed(cball x e \ s))" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply (simp add: locally_compact openin_contains_cball) + apply (clarify | assumption | drule bspec)+ + by (metis (no_types, lifting) compact_cball compact_imp_closed compact_Int inf.absorb_iff2 inf.orderE inf_sup_aci(2)) +next + assume ?rhs + then show ?lhs + apply (simp add: locally_compact openin_contains_cball) + apply (clarify | assumption | drule bspec)+ + apply (rule_tac x="ball x e \ s" in exI, simp) + apply (rule_tac x="cball x e \ s" in exI) + using compact_eq_bounded_closed + apply auto + apply (metis open_ball le_infI1 mem_ball open_contains_cball_eq) + done +qed + +lemma locally_compact_compact: + fixes s :: "'a :: heine_borel set" + shows "locally compact s \ + (\k. k \ s \ compact k + \ (\u v. k \ u \ u \ v \ v \ s \ + openin (subtopology euclidean s) u \ compact v))" + (is "?lhs = ?rhs") +proof + assume ?lhs + then obtain u v where + uv: "\x. x \ s \ x \ u x \ u x \ v x \ v x \ s \ + openin (subtopology euclidean s) (u x) \ compact (v x)" + by (metis locally_compactE) + have *: "\u v. k \ u \ u \ v \ v \ s \ openin (subtopology euclidean s) u \ compact v" + if "k \ s" "compact k" for k + proof - + have "\C. (\c\C. openin (subtopology euclidean k) c) \ k \ \C \ + \D\C. finite D \ k \ \D" + using that by (simp add: compact_eq_openin_cover) + moreover have "\c \ (\x. k \ u x) ` k. openin (subtopology euclidean k) c" + using that by clarify (metis subsetD inf.absorb_iff2 openin_subset openin_subtopology_Int_subset topspace_euclidean_subtopology uv) + moreover have "k \ \((\x. k \ u x) ` k)" + using that by clarsimp (meson subsetCE uv) + ultimately obtain D where "D \ (\x. k \ u x) ` k" "finite D" "k \ \D" + by metis + then obtain T where T: "T \ k" "finite T" "k \ \((\x. k \ u x) ` T)" + by (metis finite_subset_image) + have Tuv: "UNION T u \ UNION T v" + using T that by (force simp: dest!: uv) + show ?thesis + apply (rule_tac x="\(u ` T)" in exI) + apply (rule_tac x="\(v ` T)" in exI) + apply (simp add: Tuv) + using T that + apply (auto simp: dest!: uv) + done + qed + show ?rhs + by (blast intro: *) +next + assume ?rhs + then show ?lhs + apply (clarsimp simp add: locally_compact) + apply (drule_tac x="{x}" in spec, simp) + done +qed + +lemma open_imp_locally_compact: + fixes s :: "'a :: heine_borel set" + assumes "open s" + shows "locally compact s" +proof - + have *: "\u v. x \ u \ u \ v \ v \ s \ openin (subtopology euclidean s) u \ compact v" + if "x \ s" for x + proof - + obtain e where "e>0" and e: "cball x e \ s" + using open_contains_cball assms \x \ s\ by blast + have ope: "openin (subtopology euclidean s) (ball x e)" + by (meson e open_ball ball_subset_cball dual_order.trans open_subset) + show ?thesis + apply (rule_tac x="ball x e" in exI) + apply (rule_tac x="cball x e" in exI) + using \e > 0\ e apply (auto simp: ope) + done + qed + show ?thesis + unfolding locally_compact + by (blast intro: *) +qed + +lemma closed_imp_locally_compact: + fixes s :: "'a :: heine_borel set" + assumes "closed s" + shows "locally compact s" +proof - + have *: "\u v. x \ u \ u \ v \ v \ s \ + openin (subtopology euclidean s) u \ compact v" + if "x \ s" for x + proof - + show ?thesis + apply (rule_tac x = "s \ ball x 1" in exI) + apply (rule_tac x = "s \ cball x 1" in exI) + using \x \ s\ assms apply auto + done + qed + show ?thesis + unfolding locally_compact + by (blast intro: *) +qed + +lemma locally_compact_UNIV: "locally compact (UNIV :: 'a :: heine_borel set)" + by (simp add: closed_imp_locally_compact) + +lemma locally_compact_Int: + fixes s :: "'a :: t2_space set" + shows "\locally compact s; locally compact t\ \ locally compact (s \ t)" +by (simp add: compact_Int locally_Int) + +lemma locally_compact_closedin: + fixes s :: "'a :: heine_borel set" + shows "\closedin (subtopology euclidean s) t; locally compact s\ + \ locally compact t" +unfolding closedin_closed +using closed_imp_locally_compact locally_compact_Int by blast + +lemma locally_compact_delete: + fixes s :: "'a :: t1_space set" + shows "locally compact s \ locally compact (s - {a})" + by (auto simp: openin_delete locally_open_subset) + +lemma locally_closed: + fixes s :: "'a :: heine_borel set" + shows "locally closed s \ locally compact s" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply (simp only: locally_def) + apply (erule all_forward imp_forward asm_rl exE)+ + apply (rule_tac x = "u \ ball x 1" in exI) + apply (rule_tac x = "v \ cball x 1" in exI) + apply (force intro: openin_trans) + done +next + assume ?rhs then show ?lhs + using compact_eq_bounded_closed locally_mono by blast +qed + +subsection\Important special cases of local connectedness and path connectedness\ + +lemma locally_connected_1: + assumes + "\v x. \openin (subtopology euclidean S) v; x \ v\ + \ \u. openin (subtopology euclidean S) u \ + connected u \ x \ u \ u \ v" + shows "locally connected S" +apply (clarsimp simp add: locally_def) +apply (drule assms; blast) +done + +lemma locally_connected_2: + assumes "locally connected S" + "openin (subtopology euclidean S) t" + "x \ t" + shows "openin (subtopology euclidean S) (connected_component_set t x)" +proof - + { fix y :: 'a + let ?SS = "subtopology euclidean S" + assume 1: "openin ?SS t" + "\w x. openin ?SS w \ x \ w \ (\u. openin ?SS u \ (\v. connected v \ x \ u \ u \ v \ v \ w))" + and "connected_component t x y" + then have "y \ t" and y: "y \ connected_component_set t x" + using connected_component_subset by blast+ + obtain F where + "\x y. (\w. openin ?SS w \ (\u. connected u \ x \ w \ w \ u \ u \ y)) = (openin ?SS (F x y) \ (\u. connected u \ x \ F x y \ F x y \ u \ u \ y))" + by moura + then obtain G where + "\a A. (\U. openin ?SS U \ (\V. connected V \ a \ U \ U \ V \ V \ A)) = (openin ?SS (F a A) \ connected (G a A) \ a \ F a A \ F a A \ G a A \ G a A \ A)" + by moura + then have *: "openin ?SS (F y t) \ connected (G y t) \ y \ F y t \ F y t \ G y t \ G y t \ t" + using 1 \y \ t\ by presburger + have "G y t \ connected_component_set t y" + by (metis (no_types) * connected_component_eq_self connected_component_mono contra_subsetD) + then have "\A. openin ?SS A \ y \ A \ A \ connected_component_set t x" + by (metis (no_types) * connected_component_eq dual_order.trans y) + } + then show ?thesis + using assms openin_subopen by (force simp: locally_def) +qed + +lemma locally_connected_3: + assumes "\t x. \openin (subtopology euclidean S) t; x \ t\ + \ openin (subtopology euclidean S) + (connected_component_set t x)" + "openin (subtopology euclidean S) v" "x \ v" + shows "\u. openin (subtopology euclidean S) u \ connected u \ x \ u \ u \ v" +using assms connected_component_subset by fastforce + +lemma locally_connected: + "locally connected S \ + (\v x. openin (subtopology euclidean S) v \ x \ v + \ (\u. openin (subtopology euclidean S) u \ connected u \ x \ u \ u \ v))" +by (metis locally_connected_1 locally_connected_2 locally_connected_3) + +lemma locally_connected_open_connected_component: + "locally connected S \ + (\t x. openin (subtopology euclidean S) t \ x \ t + \ openin (subtopology euclidean S) (connected_component_set t x))" +by (metis locally_connected_1 locally_connected_2 locally_connected_3) + +lemma locally_path_connected_1: + assumes + "\v x. \openin (subtopology euclidean S) v; x \ v\ + \ \u. openin (subtopology euclidean S) u \ path_connected u \ x \ u \ u \ v" + shows "locally path_connected S" +apply (clarsimp simp add: locally_def) +apply (drule assms; blast) +done + +lemma locally_path_connected_2: + assumes "locally path_connected S" + "openin (subtopology euclidean S) t" + "x \ t" + shows "openin (subtopology euclidean S) (path_component_set t x)" +proof - + { fix y :: 'a + let ?SS = "subtopology euclidean S" + assume 1: "openin ?SS t" + "\w x. openin ?SS w \ x \ w \ (\u. openin ?SS u \ (\v. path_connected v \ x \ u \ u \ v \ v \ w))" + and "path_component t x y" + then have "y \ t" and y: "y \ path_component_set t x" + using path_component_mem(2) by blast+ + obtain F where + "\x y. (\w. openin ?SS w \ (\u. path_connected u \ x \ w \ w \ u \ u \ y)) = (openin ?SS (F x y) \ (\u. path_connected u \ x \ F x y \ F x y \ u \ u \ y))" + by moura + then obtain G where + "\a A. (\U. openin ?SS U \ (\V. path_connected V \ a \ U \ U \ V \ V \ A)) = (openin ?SS (F a A) \ path_connected (G a A) \ a \ F a A \ F a A \ G a A \ G a A \ A)" + by moura + then have *: "openin ?SS (F y t) \ path_connected (G y t) \ y \ F y t \ F y t \ G y t \ G y t \ t" + using 1 \y \ t\ by presburger + have "G y t \ path_component_set t y" + using * path_component_maximal set_rev_mp by blast + then have "\A. openin ?SS A \ y \ A \ A \ path_component_set t x" + by (metis "*" \G y t \ path_component_set t y\ dual_order.trans path_component_eq y) + } + then show ?thesis + using assms openin_subopen by (force simp: locally_def) +qed + +lemma locally_path_connected_3: + assumes "\t x. \openin (subtopology euclidean S) t; x \ t\ + \ openin (subtopology euclidean S) (path_component_set t x)" + "openin (subtopology euclidean S) v" "x \ v" + shows "\u. openin (subtopology euclidean S) u \ path_connected u \ x \ u \ u \ v" +proof - + have "path_component v x x" + by (meson assms(3) path_component_refl) + then show ?thesis + by (metis assms(1) assms(2) assms(3) mem_Collect_eq path_component_subset path_connected_path_component) +qed + +proposition locally_path_connected: + "locally path_connected S \ + (\v x. openin (subtopology euclidean S) v \ x \ v + \ (\u. openin (subtopology euclidean S) u \ path_connected u \ x \ u \ u \ v))" +by (metis locally_path_connected_1 locally_path_connected_2 locally_path_connected_3) + +proposition locally_path_connected_open_path_connected_component: + "locally path_connected S \ + (\t x. openin (subtopology euclidean S) t \ x \ t + \ openin (subtopology euclidean S) (path_component_set t x))" +by (metis locally_path_connected_1 locally_path_connected_2 locally_path_connected_3) + +lemma locally_connected_open_component: + "locally connected S \ + (\t c. openin (subtopology euclidean S) t \ c \ components t + \ openin (subtopology euclidean S) c)" +by (metis components_iff locally_connected_open_connected_component) + +proposition locally_connected_im_kleinen: + "locally connected S \ + (\v x. openin (subtopology euclidean S) v \ x \ v + \ (\u. openin (subtopology euclidean S) u \ + x \ u \ u \ v \ + (\y. y \ u \ (\c. connected c \ c \ v \ x \ c \ y \ c))))" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + by (fastforce simp add: locally_connected) +next + assume ?rhs + have *: "\T. openin (subtopology euclidean S) T \ x \ T \ T \ c" + if "openin (subtopology euclidean S) t" and c: "c \ components t" and "x \ c" for t c x + proof - + from that \?rhs\ [rule_format, of t x] + obtain u where u: + "openin (subtopology euclidean S) u \ x \ u \ u \ t \ + (\y. y \ u \ (\c. connected c \ c \ t \ x \ c \ y \ c))" + by auto (meson subsetD in_components_subset) + obtain F :: "'a set \ 'a set \ 'a" where + "\x y. (\z. z \ x \ y = connected_component_set x z) = (F x y \ x \ y = connected_component_set x (F x y))" + by moura + then have F: "F t c \ t \ c = connected_component_set t (F t c)" + by (meson components_iff c) + obtain G :: "'a set \ 'a set \ 'a" where + G: "\x y. (\z. z \ y \ z \ x) = (G x y \ y \ G x y \ x)" + by moura + have "G c u \ u \ G c u \ c" + using F by (metis (full_types) u connected_componentI connected_component_eq mem_Collect_eq that(3)) + then show ?thesis + using G u by auto + qed + show ?lhs + apply (clarsimp simp add: locally_connected_open_component) + apply (subst openin_subopen) + apply (blast intro: *) + done +qed + +proposition locally_path_connected_im_kleinen: + "locally path_connected S \ + (\v x. openin (subtopology euclidean S) v \ x \ v + \ (\u. openin (subtopology euclidean S) u \ + x \ u \ u \ v \ + (\y. y \ u \ (\p. path p \ path_image p \ v \ + pathstart p = x \ pathfinish p = y))))" + (is "?lhs = ?rhs") +proof + assume ?lhs + then show ?rhs + apply (simp add: locally_path_connected path_connected_def) + apply (erule all_forward ex_forward imp_forward conjE | simp)+ + by (meson dual_order.trans) +next + assume ?rhs + have *: "\T. openin (subtopology euclidean S) T \ + x \ T \ T \ path_component_set u z" + if "openin (subtopology euclidean S) u" and "z \ u" and c: "path_component u z x" for u z x + proof - + have "x \ u" + by (meson c path_component_mem(2)) + with that \?rhs\ [rule_format, of u x] + obtain U where U: + "openin (subtopology euclidean S) U \ x \ U \ U \ u \ + (\y. y \ U \ (\p. path p \ path_image p \ u \ pathstart p = x \ pathfinish p = y))" + by blast + show ?thesis + apply (rule_tac x=U in exI) + apply (auto simp: U) + apply (metis U c path_component_trans path_component_def) + done + qed + show ?lhs + apply (clarsimp simp add: locally_path_connected_open_path_connected_component) + apply (subst openin_subopen) + apply (blast intro: *) + done +qed + +lemma locally_path_connected_imp_locally_connected: + "locally path_connected S \ locally connected S" +using locally_mono path_connected_imp_connected by blast + +lemma locally_connected_components: + "\locally connected S; c \ components S\ \ locally connected c" +by (meson locally_connected_open_component locally_open_subset openin_subtopology_self) + +lemma locally_path_connected_components: + "\locally path_connected S; c \ components S\ \ locally path_connected c" +by (meson locally_connected_open_component locally_open_subset locally_path_connected_imp_locally_connected openin_subtopology_self) + +lemma locally_path_connected_connected_component: + "locally path_connected S \ locally path_connected (connected_component_set S x)" +by (metis components_iff connected_component_eq_empty locally_empty locally_path_connected_components) + +lemma open_imp_locally_path_connected: + fixes S :: "'a :: real_normed_vector set" + shows "open S \ locally path_connected S" +apply (rule locally_mono [of convex]) +apply (simp_all add: locally_def openin_open_eq convex_imp_path_connected) +apply (meson Topology_Euclidean_Space.open_ball centre_in_ball convex_ball openE order_trans) +done + +lemma open_imp_locally_connected: + fixes S :: "'a :: real_normed_vector set" + shows "open S \ locally connected S" +by (simp add: locally_path_connected_imp_locally_connected open_imp_locally_path_connected) + +lemma locally_path_connected_UNIV: "locally path_connected (UNIV::'a :: real_normed_vector set)" + by (simp add: open_imp_locally_path_connected) + +lemma locally_connected_UNIV: "locally connected (UNIV::'a :: real_normed_vector set)" + by (simp add: open_imp_locally_connected) + +lemma openin_connected_component_locally_connected: + "locally connected S + \ openin (subtopology euclidean S) (connected_component_set S x)" +apply (simp add: locally_connected_open_connected_component) +by (metis connected_component_eq_empty connected_component_subset open_empty open_subset openin_subtopology_self) + +lemma openin_components_locally_connected: + "\locally connected S; c \ components S\ \ openin (subtopology euclidean S) c" + using locally_connected_open_component openin_subtopology_self by blast + +lemma openin_path_component_locally_path_connected: + "locally path_connected S + \ openin (subtopology euclidean S) (path_component_set S x)" +by (metis (no_types) empty_iff locally_path_connected_2 openin_subopen openin_subtopology_self path_component_eq_empty) + +lemma closedin_path_component_locally_path_connected: + "locally path_connected S + \ closedin (subtopology euclidean S) (path_component_set S x)" +apply (simp add: closedin_def path_component_subset complement_path_component_Union) +apply (rule openin_Union) +using openin_path_component_locally_path_connected by auto + +lemma convex_imp_locally_path_connected: + fixes S :: "'a:: real_normed_vector set" + shows "convex S \ locally path_connected S" +apply (clarsimp simp add: locally_path_connected) +apply (subst (asm) openin_open) +apply clarify +apply (erule (1) Topology_Euclidean_Space.openE) +apply (rule_tac x = "S \ ball x e" in exI) +apply (force simp: convex_Int convex_imp_path_connected) +done + +subsection\Retracts, in a general sense, preserve (co)homotopic triviality)\ + +locale Retracts = + fixes s h t k + assumes conth: "continuous_on s h" + and imh: "h ` s = t" + and contk: "continuous_on t k" + and imk: "k ` t \ s" + and idhk: "\y. y \ t \ h(k y) = y" + +begin + +lemma homotopically_trivial_retraction_gen: + assumes P: "\f. \continuous_on u f; f ` u \ t; Q f\ \ P(k o f)" + and Q: "\f. \continuous_on u f; f ` u \ s; P f\ \ Q(h o f)" + and Qeq: "\h k. (\x. x \ u \ h x = k x) \ Q h = Q k" + and hom: "\f g. \continuous_on u f; f ` u \ s; P f; + continuous_on u g; g ` u \ s; P g\ + \ homotopic_with P u s f g" + and contf: "continuous_on u f" and imf: "f ` u \ t" and Qf: "Q f" + and contg: "continuous_on u g" and img: "g ` u \ t" and Qg: "Q g" + shows "homotopic_with Q u t f g" +proof - + have feq: "\x. x \ u \ (h \ (k \ f)) x = f x" using idhk imf by auto + have geq: "\x. x \ u \ (h \ (k \ g)) x = g x" using idhk img by auto + have "continuous_on u (k \ f)" + using contf continuous_on_compose continuous_on_subset contk imf by blast + moreover have "(k \ f) ` u \ s" + using imf imk by fastforce + moreover have "P (k \ f)" + by (simp add: P Qf contf imf) + moreover have "continuous_on u (k \ g)" + using contg continuous_on_compose continuous_on_subset contk img by blast + moreover have "(k \ g) ` u \ s" + using img imk by fastforce + moreover have "P (k \ g)" + by (simp add: P Qg contg img) + ultimately have "homotopic_with P u s (k \ f) (k \ g)" + by (rule hom) + then have "homotopic_with Q u t (h \ (k \ f)) (h \ (k \ g))" + apply (rule homotopic_with_compose_continuous_left [OF homotopic_with_mono]) + using Q by (auto simp: conth imh) + then show ?thesis + apply (rule homotopic_with_eq) + apply (metis feq) + apply (metis geq) + apply (metis Qeq) + done +qed + +lemma homotopically_trivial_retraction_null_gen: + assumes P: "\f. \continuous_on u f; f ` u \ t; Q f\ \ P(k o f)" + and Q: "\f. \continuous_on u f; f ` u \ s; P f\ \ Q(h o f)" + and Qeq: "\h k. (\x. x \ u \ h x = k x) \ Q h = Q k" + and hom: "\f. \continuous_on u f; f ` u \ s; P f\ + \ \c. homotopic_with P u s f (\x. c)" + and contf: "continuous_on u f" and imf:"f ` u \ t" and Qf: "Q f" + obtains c where "homotopic_with Q u t f (\x. c)" +proof - + have feq: "\x. x \ u \ (h \ (k \ f)) x = f x" using idhk imf by auto + have "continuous_on u (k \ f)" + using contf continuous_on_compose continuous_on_subset contk imf by blast + moreover have "(k \ f) ` u \ s" + using imf imk by fastforce + moreover have "P (k \ f)" + by (simp add: P Qf contf imf) + ultimately obtain c where "homotopic_with P u s (k \ f) (\x. c)" + by (metis hom) + then have "homotopic_with Q u t (h \ (k \ f)) (h o (\x. c))" + apply (rule homotopic_with_compose_continuous_left [OF homotopic_with_mono]) + using Q by (auto simp: conth imh) + then show ?thesis + apply (rule_tac c = "h c" in that) + apply (erule homotopic_with_eq) + apply (metis feq, simp) + apply (metis Qeq) + done +qed + +lemma cohomotopically_trivial_retraction_gen: + assumes P: "\f. \continuous_on t f; f ` t \ u; Q f\ \ P(f o h)" + and Q: "\f. \continuous_on s f; f ` s \ u; P f\ \ Q(f o k)" + and Qeq: "\h k. (\x. x \ t \ h x = k x) \ Q h = Q k" + and hom: "\f g. \continuous_on s f; f ` s \ u; P f; + continuous_on s g; g ` s \ u; P g\ + \ homotopic_with P s u f g" + and contf: "continuous_on t f" and imf: "f ` t \ u" and Qf: "Q f" + and contg: "continuous_on t g" and img: "g ` t \ u" and Qg: "Q g" + shows "homotopic_with Q t u f g" +proof - + have feq: "\x. x \ t \ (f \ h \ k) x = f x" using idhk imf by auto + have geq: "\x. x \ t \ (g \ h \ k) x = g x" using idhk img by auto + have "continuous_on s (f \ h)" + using contf conth continuous_on_compose imh by blast + moreover have "(f \ h) ` s \ u" + using imf imh by fastforce + moreover have "P (f \ h)" + by (simp add: P Qf contf imf) + moreover have "continuous_on s (g o h)" + using contg continuous_on_compose continuous_on_subset conth imh by blast + moreover have "(g \ h) ` s \ u" + using img imh by fastforce + moreover have "P (g \ h)" + by (simp add: P Qg contg img) + ultimately have "homotopic_with P s u (f o h) (g \ h)" + by (rule hom) + then have "homotopic_with Q t u (f o h o k) (g \ h o k)" + apply (rule homotopic_with_compose_continuous_right [OF homotopic_with_mono]) + using Q by (auto simp: contk imk) + then show ?thesis + apply (rule homotopic_with_eq) + apply (metis feq) + apply (metis geq) + apply (metis Qeq) + done +qed + +lemma cohomotopically_trivial_retraction_null_gen: + assumes P: "\f. \continuous_on t f; f ` t \ u; Q f\ \ P(f o h)" + and Q: "\f. \continuous_on s f; f ` s \ u; P f\ \ Q(f o k)" + and Qeq: "\h k. (\x. x \ t \ h x = k x) \ Q h = Q k" + and hom: "\f g. \continuous_on s f; f ` s \ u; P f\ + \ \c. homotopic_with P s u f (\x. c)" + and contf: "continuous_on t f" and imf: "f ` t \ u" and Qf: "Q f" + obtains c where "homotopic_with Q t u f (\x. c)" +proof - + have feq: "\x. x \ t \ (f \ h \ k) x = f x" using idhk imf by auto + have "continuous_on s (f \ h)" + using contf conth continuous_on_compose imh by blast + moreover have "(f \ h) ` s \ u" + using imf imh by fastforce + moreover have "P (f \ h)" + by (simp add: P Qf contf imf) + ultimately obtain c where "homotopic_with P s u (f o h) (\x. c)" + by (metis hom) + then have "homotopic_with Q t u (f o h o k) ((\x. c) o k)" + apply (rule homotopic_with_compose_continuous_right [OF homotopic_with_mono]) + using Q by (auto simp: contk imk) + then show ?thesis + apply (rule_tac c = c in that) + apply (erule homotopic_with_eq) + apply (metis feq, simp) + apply (metis Qeq) + done +qed + end + +lemma simply_connected_retraction_gen: + shows "\simply_connected S; continuous_on S h; h ` S = T; + continuous_on T k; k ` T \ S; \y. y \ T \ h(k y) = y\ + \ simply_connected T" +apply (simp add: simply_connected_def path_def path_image_def homotopic_loops_def, clarify) +apply (rule Retracts.homotopically_trivial_retraction_gen + [of S h _ k _ "\p. pathfinish p = pathstart p" "\p. pathfinish p = pathstart p"]) +apply (simp_all add: Retracts_def pathfinish_def pathstart_def) +done + +lemma homeomorphic_simply_connected: + "\S homeomorphic T; simply_connected S\ \ simply_connected T" + by (auto simp: homeomorphic_def homeomorphism_def intro: simply_connected_retraction_gen) + +lemma homeomorphic_simply_connected_eq: + "S homeomorphic T \ (simply_connected S \ simply_connected T)" + by (metis homeomorphic_simply_connected homeomorphic_sym) + +end diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Apr 11 16:27:42 2016 +0100 @@ -629,6 +629,31 @@ lemma subtopology_UNIV[simp]: "subtopology U UNIV = U" by (simp add: subtopology_superset) +lemma openin_subtopology_empty: + "openin (subtopology U {}) s \ s = {}" +by (metis Int_empty_right openin_empty openin_subtopology) + +lemma closedin_subtopology_empty: + "closedin (subtopology U {}) s \ s = {}" +by (metis Int_empty_right closedin_empty closedin_subtopology) + +lemma closedin_subtopology_refl: + "closedin (subtopology U u) u \ u \ topspace U" +by (metis closedin_def closedin_topspace inf.absorb_iff2 le_inf_iff topspace_subtopology) + +lemma openin_imp_subset: + "openin (subtopology U s) t \ t \ s" +by (metis Int_iff openin_subtopology subsetI) + +lemma closedin_imp_subset: + "closedin (subtopology U s) t \ t \ s" +by (simp add: closedin_def topspace_subtopology) + +lemma openin_subtopology_Un: + "openin (subtopology U t) s \ openin (subtopology U u) s + \ openin (subtopology U (t \ u)) s" +by (simp add: openin_subtopology) blast + subsubsection \The standard Euclidean topology\ @@ -657,6 +682,9 @@ lemma open_subopen: "open S \ (\x\S. \T. open T \ x \ T \ T \ S)" by (simp add: open_openin openin_subopen[symmetric]) +lemma openin_subtopology_self [simp]: "openin (subtopology euclidean S) S" + by (metis openin_topspace topspace_euclidean_subtopology) + text \Basic "localization" results are handy for connectedness.\ lemma openin_open: "openin (subtopology euclidean U) S \ (\T. open T \ (S = U \ T))" @@ -3483,12 +3511,16 @@ by (auto intro!: exI[of _ "b + norm a"]) qed +lemma bounded_translation_minus: + fixes S :: "'a::real_normed_vector set" + shows "bounded S \ bounded ((\x. x - a) ` S)" +using bounded_translation [of S "-a"] by simp + lemma bounded_uminus [simp]: fixes X :: "'a::real_normed_vector set" shows "bounded (uminus ` X) \ bounded X" by (auto simp: bounded_def dist_norm; rule_tac x="-x" in exI; force simp add: add.commute norm_minus_commute) - text\Some theorems on sups and infs using the notion "bounded".\ lemma bounded_real: "bounded (S::real set) \ (\a. \x\S. \x\ \ a)" @@ -3908,6 +3940,12 @@ shows "open s \ open (s - {x})" by (simp add: open_Diff) +lemma openin_delete: + fixes a :: "'a :: t1_space" + shows "openin (subtopology euclidean u) s + \ openin (subtopology euclidean u) (s - {a})" +by (metis Int_Diff open_delete openin_open) + text\Compactness expressed with filters\ lemma closure_iff_nhds_not_empty: @@ -6043,6 +6081,118 @@ qed qed +subsection\Quotient maps\ + +lemma quotient_map_imp_continuous_open: + assumes t: "f ` s \ t" + and ope: "\u. u \ t + \ (openin (subtopology euclidean s) {x. x \ s \ f x \ u} \ + openin (subtopology euclidean t) u)" + shows "continuous_on s f" +proof - + have [simp]: "{x \ s. f x \ f ` s} = s" by auto + show ?thesis + using ope [OF t] + apply (simp add: continuous_on_open) + by (metis (no_types, lifting) "ope" openin_imp_subset openin_trans) +qed + +lemma quotient_map_imp_continuous_closed: + assumes t: "f ` s \ t" + and ope: "\u. u \ t + \ (closedin (subtopology euclidean s) {x. x \ s \ f x \ u} \ + closedin (subtopology euclidean t) u)" + shows "continuous_on s f" +proof - + have [simp]: "{x \ s. f x \ f ` s} = s" by auto + show ?thesis + using ope [OF t] + apply (simp add: continuous_on_closed) + by (metis (no_types, lifting) "ope" closedin_imp_subset closedin_subtopology_refl closedin_trans openin_subtopology_refl openin_subtopology_self) +qed + +lemma open_map_imp_quotient_map: + assumes contf: "continuous_on s f" + and t: "t \ f ` s" + and ope: "\t. openin (subtopology euclidean s) t + \ openin (subtopology euclidean (f ` s)) (f ` t)" + shows "openin (subtopology euclidean s) {x \ s. f x \ t} = + openin (subtopology euclidean (f ` s)) t" +proof - + have "t = image f {x. x \ s \ f x \ t}" + using t by blast + then show ?thesis + using "ope" contf continuous_on_open by fastforce +qed + +lemma closed_map_imp_quotient_map: + assumes contf: "continuous_on s f" + and t: "t \ f ` s" + and ope: "\t. closedin (subtopology euclidean s) t + \ closedin (subtopology euclidean (f ` s)) (f ` t)" + shows "openin (subtopology euclidean s) {x \ s. f x \ t} \ + openin (subtopology euclidean (f ` s)) t" + (is "?lhs = ?rhs") +proof + assume ?lhs + then have *: "closedin (subtopology euclidean s) (s - {x \ s. f x \ t})" + using closedin_diff by fastforce + have [simp]: "(f ` s - f ` (s - {x \ s. f x \ t})) = t" + using t by blast + show ?rhs + using ope [OF *, unfolded closedin_def] by auto +next + assume ?rhs + with contf show ?lhs + by (auto simp: continuous_on_open) +qed + +lemma continuous_right_inverse_imp_quotient_map: + assumes contf: "continuous_on s f" and imf: "f ` s \ t" + and contg: "continuous_on t g" and img: "g ` t \ s" + and fg [simp]: "\y. y \ t \ f(g y) = y" + and u: "u \ t" + shows "openin (subtopology euclidean s) {x. x \ s \ f x \ u} \ + openin (subtopology euclidean t) u" + (is "?lhs = ?rhs") +proof - + have f: "\z. openin (subtopology euclidean (f ` s)) z \ + openin (subtopology euclidean s) {x \ s. f x \ z}" + and g: "\z. openin (subtopology euclidean (g ` t)) z \ + openin (subtopology euclidean t) {x \ t. g x \ z}" + using contf contg by (auto simp: continuous_on_open) + show ?thesis + proof + have "{x \ t. g x \ g ` t \ g x \ s \ f (g x) \ u} = {x \ t. f (g x) \ u}" + using imf img by blast + also have "... = u" + using u by auto + finally have [simp]: "{x \ t. g x \ g ` t \ g x \ s \ f (g x) \ u} = u" . + assume ?lhs + then have *: "openin (subtopology euclidean (g ` t)) (g ` t \ {x \ s. f x \ u})" + by (meson img openin_Int openin_subtopology_Int_subset openin_subtopology_self) + show ?rhs + using g [OF *] by simp + next + assume rhs: ?rhs + show ?lhs + apply (rule f) + by (metis fg image_eqI image_subset_iff imf img openin_subopen openin_subtopology_self openin_trans rhs) + qed +qed + +lemma continuous_left_inverse_imp_quotient_map: + assumes "continuous_on s f" + and "continuous_on (f ` s) g" + and "\x. x \ s \ g(f x) = x" + and "u \ f ` s" + shows "openin (subtopology euclidean s) {x. x \ s \ f x \ u} \ + openin (subtopology euclidean (f ` s)) u" +apply (rule continuous_right_inverse_imp_quotient_map) +using assms +apply force+ +done + subsection \A function constant on a set\ definition constant_on (infixl "(constant'_on)" 50) @@ -7803,13 +7953,23 @@ (\x\s. (g(f x) = x)) \ (f ` s = t) \ continuous_on s f \ (\y\t. (f(g y) = y)) \ (g ` t = s) \ continuous_on t g" +lemma homeomorphism_translation: + fixes a :: "'a :: real_normed_vector" + shows "homeomorphism (op + a ` S) S (op + (- a)) (op + a)" +unfolding homeomorphism_def by (auto simp: algebra_simps continuous_intros) + +lemma homeomorphism_symD: "homeomorphism S t f g \ homeomorphism t S g f" + by (simp add: homeomorphism_def) + +lemma homeomorphism_sym: "homeomorphism S t f g = homeomorphism t S g f" + by (force simp: homeomorphism_def) + definition homeomorphic :: "'a::topological_space set \ 'b::topological_space set \ bool" (infixr "homeomorphic" 60) where "s homeomorphic t \ (\f g. homeomorphism s t f g)" lemma homeomorphic_refl: "s homeomorphic s" - unfolding homeomorphic_def - unfolding homeomorphism_def + unfolding homeomorphic_def homeomorphism_def using continuous_on_id apply (rule_tac x = "(\x. x)" in exI) apply (rule_tac x = "(\x. x)" in exI) @@ -7817,8 +7977,7 @@ done lemma homeomorphic_sym: "s homeomorphic t \ t homeomorphic s" - unfolding homeomorphic_def - unfolding homeomorphism_def + unfolding homeomorphic_def homeomorphism_def by blast lemma homeomorphic_trans [trans]: diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Real_Vector_Spaces.thy Mon Apr 11 16:27:42 2016 +0100 @@ -259,6 +259,27 @@ using real_vector_affinity_eq[where m=m and x=x and y=y and c=c] by metis +lemma scaleR_eq_iff [simp]: + fixes a :: "'a :: real_vector" + shows "b + u *\<^sub>R a = a + u *\<^sub>R b \ a=b \ u=1" +proof (cases "u=1") + case True then show ?thesis by auto +next + case False + { assume "b + u *\<^sub>R a = a + u *\<^sub>R b" + then have "(u - 1) *\<^sub>R a = (u - 1) *\<^sub>R b" + by (simp add: algebra_simps) + with False have "a=b" + by auto + } + then show ?thesis by auto +qed + +lemma scaleR_collapse [simp]: + fixes a :: "'a :: real_vector" + shows "(1 - u) *\<^sub>R a + u *\<^sub>R a = a" +by (simp add: algebra_simps) + subsection \Embedding of the Reals into any \real_algebra_1\: @{term of_real}\ @@ -920,10 +941,21 @@ qed lemma norm_power: - fixes x :: "'a::{real_normed_div_algebra}" + fixes x :: "'a::real_normed_div_algebra" shows "norm (x ^ n) = norm x ^ n" by (induct n) (simp_all add: norm_mult) +lemma power_eq_imp_eq_norm: + fixes w :: "'a::real_normed_div_algebra" + assumes eq: "w ^ n = z ^ n" and "n > 0" + shows "norm w = norm z" +proof - + have "norm w ^ n = norm z ^ n" + by (metis (no_types) eq norm_power) + then show ?thesis + using assms by (force intro: power_eq_imp_eq_base) +qed + lemma norm_mult_numeral1 [simp]: fixes a b :: "'a::{real_normed_field, field}" shows "norm (numeral w * a) = numeral w * norm a" @@ -1077,6 +1109,10 @@ shows "dist x z + dist y z < e ==> dist x y < e" by (rule le_less_trans [OF dist_triangle2]) +lemma dist_triangle_less_add: + "\dist x1 y < e1; dist x2 y < e2\ \ dist x1 x2 < e1 + e2" +by (rule dist_triangle_lt [where z=y], simp) + lemma dist_triangle_half_l: shows "dist x1 y < e / 2 \ dist x2 y < e / 2 \ dist x1 x2 < e" by (rule dist_triangle_lt [where z=y], simp) diff -r 3374f3ffb2ec -r 7700f467892b src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Sun Apr 10 23:15:34 2016 +0200 +++ b/src/HOL/Transcendental.thy Mon Apr 11 16:27:42 2016 +0100 @@ -3569,6 +3569,20 @@ using sin_ge_zero [of "x-pi"] by (simp add: sin_diff) +lemma sin_pi_divide_n_ge_0 [simp]: + assumes "n \ 0" shows "0 \ sin (pi / real n)" +apply (rule sin_ge_zero) +using assms +apply (simp_all add: divide_simps) +done + +lemma sin_pi_divide_n_gt_0: + assumes "2 \ n" shows "0 < sin (pi / real n)" +apply (rule sin_gt_zero) +using assms +apply (simp_all add: divide_simps) +done + text \FIXME: This proof is almost identical to lemma \cos_is_zero\. It should be possible to factor out some of the common parts.\