diff -r 3793c3a11378 -r ef949192e5d6 src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/Topological_Spaces.thy Fri Mar 22 10:41:43 2013 +0100 @@ -724,6 +724,9 @@ "eventually P (at a) \ (\S. open S \ a \ S \ (\x\S. x \ a \ P x))" unfolding at_def eventually_within eventually_nhds by simp +lemma at_within_open: "a \ S \ open S \ at a within S = at a" + unfolding filter_eq_iff eventually_within eventually_at_topological by (metis open_Int Int_iff) + lemma at_eq_bot_iff: "at a = bot \ open {a}" unfolding trivial_limit_def eventually_at_topological by (safe, case_tac "S = {a}", simp, fast, fast) @@ -869,6 +872,9 @@ by (auto elim!: allE[of _ "\x. x \ S"] eventually_rev_mp) qed (auto elim!: eventually_rev_mp simp: eventually_nhds eventually_filtermap le_filter_def) +lemma tendsto_within_subset: "(f ---> l) (net within S) \ T \ S \ (f ---> l) (net within T)" + by (auto simp: tendsto_def eventually_within elim!: eventually_elim1) + lemma filterlim_at: "(LIM x F. f x :> at b) \ (eventually (\x. f x \ b) F \ (f ---> b) F)" by (simp add: at_def filterlim_within) @@ -1540,6 +1546,9 @@ ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where "f -- a --> L \ (f ---> L) (at a)" +lemma tendsto_within_open: "a \ S \ open S \ (f ---> l) (at a within S) \ (f -- a --> l)" + unfolding tendsto_def by (simp add: at_within_open) + lemma LIM_const_not_eq[tendsto_intros]: fixes a :: "'a::perfect_space" fixes k L :: "'b::t2_space" @@ -1629,6 +1638,10 @@ definition continuous_on :: "'a set \ ('a :: topological_space \ 'b :: topological_space) \ bool" where "continuous_on s f \ (\x\s. (f ---> f x) (at x within s))" +lemma continuous_on_cong [cong]: + "s = t \ (\x. x \ t \ f x = g x) \ continuous_on s f \ continuous_on t g" + unfolding continuous_on_def by (intro ball_cong filterlim_cong) (auto simp: eventually_within) + lemma continuous_on_topological: "continuous_on s f \ (\x\s. \B. open B \ f x \ B \ (\A. open A \ x \ A \ (\y\s. y \ A \ f y \ B)))" @@ -1655,6 +1668,11 @@ qed qed +lemma continuous_on_open_vimage: + "open s \ continuous_on s f \ (\B. open B \ open (f -` B \ s))" + unfolding continuous_on_open_invariant + by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s]) + lemma continuous_on_closed_invariant: "continuous_on s f \ (\B. closed B \ (\A. closed A \ A \ s = f -` B \ s))" proof - @@ -1664,6 +1682,36 @@ unfolding continuous_on_open_invariant by (intro *) (auto simp: open_closed[symmetric]) qed +lemma continuous_on_closed_vimage: + "closed s \ continuous_on s f \ (\B. closed B \ closed (f -` B \ s))" + unfolding continuous_on_closed_invariant + by (metis closed_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s]) + +lemma continuous_on_open_Union: + "(\s. s \ S \ open s) \ (\s. s \ S \ continuous_on s f) \ continuous_on (\S) f" + unfolding continuous_on_def by (simp add: tendsto_within_open open_Union) + +lemma continuous_on_open_UN: + "(\s. s \ S \ open (A s)) \ (\s. s \ S \ continuous_on (A s) f) \ continuous_on (\s\S. A s) f" + unfolding Union_image_eq[symmetric] by (rule continuous_on_open_Union) auto + +lemma continuous_on_closed_Un: + "closed s \ closed t \ continuous_on s f \ continuous_on t f \ continuous_on (s \ t) f" + by (auto simp add: continuous_on_closed_vimage closed_Un Int_Un_distrib) + +lemma continuous_on_If: + assumes closed: "closed s" "closed t" and cont: "continuous_on s f" "continuous_on t g" + and P: "\x. x \ s \ \ P x \ f x = g x" "\x. x \ t \ P x \ f x = g x" + shows "continuous_on (s \ t) (\x. if P x then f x else g x)" (is "continuous_on _ ?h") +proof- + from P have "\x\s. f x = ?h x" "\x\t. g x = ?h x" + by auto + with cont have "continuous_on s ?h" "continuous_on t ?h" + by simp_all + with closed show ?thesis + by (rule continuous_on_closed_Un) +qed + ML {* structure Continuous_On_Intros = Named_Thms @@ -1686,6 +1734,10 @@ "continuous_on s f \ continuous_on (f ` s) g \ continuous_on s (g o f)" unfolding continuous_on_topological by simp metis +lemma continuous_on_compose2: + "continuous_on t g \ continuous_on s f \ t = f ` s \ continuous_on s (\x. g (f x))" + using continuous_on_compose[of s f g] by (simp add: comp_def) + subsubsection {* Continuity at a point *} definition continuous :: "'a::t2_space filter \ ('a \ 'b::topological_space) \ bool" where @@ -1749,6 +1801,12 @@ lemma continuous_at_within: "isCont f x \ continuous (at x within s) f" by (auto intro: within_le filterlim_mono simp: continuous_at continuous_within) +lemma continuous_on_eq_continuous_at: "open s \ continuous_on s f \ (\x\s. isCont f x)" + by (simp add: continuous_on_def continuous_at tendsto_within_open) + +lemma continuous_on_subset: "continuous_on s f \ t \ s \ continuous_on t f" + unfolding continuous_on_def by (metis subset_eq tendsto_within_subset) + lemma continuous_at_imp_continuous_on: "\x\s. isCont f x \ continuous_on s f" by (auto intro: continuous_at_within simp: continuous_on_eq_continuous_within) @@ -1801,8 +1859,101 @@ using assms unfolding ball_simps[symmetric] SUP_def by (metis (lifting) finite_subset_image compact_eq_heine_borel[of s]) +lemma compact_inter_closed [intro]: + assumes "compact s" and "closed t" + shows "compact (s \ t)" +proof (rule compactI) + fix C assume C: "\c\C. open c" and cover: "s \ t \ \C" + from C `closed t` have "\c\C \ {-t}. open c" by auto + moreover from cover have "s \ \(C \ {-t})" by auto + ultimately have "\D\C \ {-t}. finite D \ s \ \D" + using `compact s` unfolding compact_eq_heine_borel by auto + then guess D .. + then show "\D\C. finite D \ s \ t \ \D" + by (intro exI[of _ "D - {-t}"]) auto +qed + end +lemma (in t2_space) compact_imp_closed: + assumes "compact s" shows "closed s" +unfolding closed_def +proof (rule openI) + fix y assume "y \ - s" + let ?C = "\x\s. {u. open u \ x \ u \ eventually (\y. y \ u) (nhds y)}" + note `compact s` + moreover have "\u\?C. open u" by simp + moreover have "s \ \?C" + proof + fix x assume "x \ s" + with `y \ - s` have "x \ y" by clarsimp + hence "\u v. open u \ open v \ x \ u \ y \ v \ u \ v = {}" + by (rule hausdorff) + with `x \ s` show "x \ \?C" + unfolding eventually_nhds by auto + qed + ultimately obtain D where "D \ ?C" and "finite D" and "s \ \D" + by (rule compactE) + from `D \ ?C` have "\x\D. eventually (\y. y \ x) (nhds y)" by auto + with `finite D` have "eventually (\y. y \ \D) (nhds y)" + by (simp add: eventually_Ball_finite) + with `s \ \D` have "eventually (\y. y \ s) (nhds y)" + by (auto elim!: eventually_mono [rotated]) + thus "\t. open t \ y \ t \ t \ - s" + by (simp add: eventually_nhds subset_eq) +qed + +lemma compact_continuous_image: + assumes f: "continuous_on s f" and s: "compact s" + shows "compact (f ` s)" +proof (rule compactI) + fix C assume "\c\C. open c" and cover: "f`s \ \C" + with f have "\c\C. \A. open A \ A \ s = f -` c \ s" + unfolding continuous_on_open_invariant by blast + then guess A unfolding bchoice_iff .. note A = this + with cover have "\c\C. open (A c)" "s \ (\c\C. A c)" + by (fastforce simp add: subset_eq set_eq_iff)+ + from compactE_image[OF s this] obtain D where "D \ C" "finite D" "s \ (\c\D. A c)" . + with A show "\D \ C. finite D \ f`s \ \D" + by (intro exI[of _ D]) (fastforce simp add: subset_eq set_eq_iff)+ +qed + +lemma continuous_on_inv: + fixes f :: "'a::topological_space \ 'b::t2_space" + assumes "continuous_on s f" "compact s" "\x\s. g (f x) = x" + shows "continuous_on (f ` s) g" +unfolding continuous_on_topological +proof (clarsimp simp add: assms(3)) + fix x :: 'a and B :: "'a set" + assume "x \ s" and "open B" and "x \ B" + have 1: "\x\s. f x \ f ` (s - B) \ x \ s - B" + using assms(3) by (auto, metis) + have "continuous_on (s - B) f" + using `continuous_on s f` Diff_subset + by (rule continuous_on_subset) + moreover have "compact (s - B)" + using `open B` and `compact s` + unfolding Diff_eq by (intro compact_inter_closed closed_Compl) + ultimately have "compact (f ` (s - B))" + by (rule compact_continuous_image) + hence "closed (f ` (s - B))" + by (rule compact_imp_closed) + hence "open (- f ` (s - B))" + by (rule open_Compl) + moreover have "f x \ - f ` (s - B)" + using `x \ s` and `x \ B` by (simp add: 1) + moreover have "\y\s. f y \ - f ` (s - B) \ y \ B" + by (simp add: 1) + ultimately show "\A. open A \ f x \ A \ (\y\s. f y \ A \ y \ B)" + by fast +qed + +lemma continuous_on_inv_into: + fixes f :: "'a::topological_space \ 'b::t2_space" + assumes s: "continuous_on s f" "compact s" and f: "inj_on f s" + shows "continuous_on (f ` s) (the_inv_into s f)" + by (rule continuous_on_inv[OF s]) (auto simp: the_inv_into_f_f[OF f]) + lemma (in linorder_topology) compact_attains_sup: assumes "compact S" "S \ {}" shows "\s\S. \t\S. t \ s" @@ -1841,21 +1992,6 @@ by fastforce qed -lemma compact_continuous_image: - assumes f: "continuous_on s f" and s: "compact s" - shows "compact (f ` s)" -proof (rule compactI) - fix C assume "\c\C. open c" and cover: "f`s \ \C" - with f have "\c\C. \A. open A \ A \ s = f -` c \ s" - unfolding continuous_on_open_invariant by blast - then guess A unfolding bchoice_iff .. note A = this - with cover have "\c\C. open (A c)" "s \ (\c\C. A c)" - by (fastforce simp add: subset_eq set_eq_iff)+ - from compactE_image[OF s this] obtain D where "D \ C" "finite D" "s \ (\c\D. A c)" . - with A show "\D \ C. finite D \ f`s \ \D" - by (intro exI[of _ D]) (fastforce simp add: subset_eq set_eq_iff)+ -qed - lemma continuous_attains_sup: fixes f :: "'a::topological_space \ 'b::linorder_topology" shows "compact s \ s \ {} \ continuous_on s f \ (\x\s. \y\s. f y \ f x)"