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