src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 51351 dd1dd470690b
parent 51350 490f34774a9a
child 51361 21e5b6efb317
equal deleted inserted replaced
51350:490f34774a9a 51351:dd1dd470690b
   954   by (simp add: Bex_def conj_commute conj_left_commute)
   954   by (simp add: Bex_def conj_commute conj_left_commute)
   955 
   955 
   956 lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
   956 lemma islimpt_UNIV_iff: "x islimpt UNIV \<longleftrightarrow> \<not> open {x}"
   957   unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
   957   unfolding islimpt_def by (safe, fast, case_tac "T = {x}", fast, fast)
   958 
   958 
       
   959 lemma islimpt_punctured: "x islimpt S = x islimpt (S-{x})"
       
   960   unfolding islimpt_def by blast
       
   961 
   959 text {* A perfect space has no isolated points. *}
   962 text {* A perfect space has no isolated points. *}
   960 
   963 
   961 lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV"
   964 lemma islimpt_UNIV [simp, intro]: "(x::'a::perfect_space) islimpt UNIV"
   962   unfolding islimpt_UNIV_iff by (rule not_open_singleton)
   965   unfolding islimpt_UNIV_iff by (rule not_open_singleton)
   963 
   966 
  1237     apply auto
  1240     apply auto
  1238     done
  1241     done
  1239 qed
  1242 qed
  1240 
  1243 
  1241 
  1244 
       
  1245 lemma islimpt_in_closure: "(x islimpt S) = (x:closure(S-{x}))"
       
  1246   unfolding closure_def using islimpt_punctured by blast
       
  1247 
       
  1248 
  1242 subsection {* Frontier (aka boundary) *}
  1249 subsection {* Frontier (aka boundary) *}
  1243 
  1250 
  1244 definition "frontier S = closure S - interior S"
  1251 definition "frontier S = closure S - interior S"
  1245 
  1252 
  1246 lemma frontier_closed: "closed(frontier S)"
  1253 lemma frontier_closed: "closed(frontier S)"
  1325   apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)
  1332   apply (subgoal_tac "\<exists>x::'a. x \<noteq> 0", clarify)
  1326    apply (rule_tac x="scaleR (b / norm x) x" in exI, simp)
  1333    apply (rule_tac x="scaleR (b / norm x) x" in exI, simp)
  1327   apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def])
  1334   apply (cut_tac islimpt_UNIV [of "0::'a", unfolded islimpt_def])
  1328   apply (drule_tac x=UNIV in spec, simp)
  1335   apply (drule_tac x=UNIV in spec, simp)
  1329   done
  1336   done
       
  1337 
       
  1338 lemma not_trivial_limit_within: "~trivial_limit (at x within S) = (x:closure(S-{x}))"
       
  1339   using islimpt_in_closure by (metis trivial_limit_within)
  1330 
  1340 
  1331 text {* Some property holds "sufficiently close" to the limit point. *}
  1341 text {* Some property holds "sufficiently close" to the limit point. *}
  1332 
  1342 
  1333 lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
  1343 lemma eventually_at: (* FIXME: this replaces Limits.eventually_at *)
  1334   "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
  1344   "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
  1814 
  1824 
  1815 lemma closed_approachable:
  1825 lemma closed_approachable:
  1816   fixes S :: "'a::metric_space set"
  1826   fixes S :: "'a::metric_space set"
  1817   shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"
  1827   shows "closed S ==> (\<forall>e>0. \<exists>y\<in>S. dist y x < e) \<longleftrightarrow> x \<in> S"
  1818   by (metis closure_closed closure_approachable)
  1828   by (metis closure_closed closure_approachable)
       
  1829 
       
  1830 lemma closure_contains_Inf:
       
  1831   fixes S :: "real set"
       
  1832   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
       
  1833   shows "Inf S \<in> closure S"
       
  1834   unfolding closure_approachable
       
  1835 proof safe
       
  1836   have *: "\<forall>x\<in>S. Inf S \<le> x"
       
  1837     using Inf_lower_EX[of _ S] assms by metis
       
  1838 
       
  1839   fix e :: real assume "0 < e"
       
  1840   then obtain x where x: "x \<in> S" "x < Inf S + e"
       
  1841     using Inf_close `S \<noteq> {}` by auto
       
  1842   moreover then have "x > Inf S - e" using * by auto
       
  1843   ultimately have "abs (x - Inf S) < e" by (simp add: abs_diff_less_iff)
       
  1844   then show "\<exists>x\<in>S. dist x (Inf S) < e"
       
  1845     using x by (auto simp: dist_norm)
       
  1846 qed
       
  1847 
       
  1848 lemma closed_contains_Inf:
       
  1849   fixes S :: "real set"
       
  1850   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
       
  1851     and "closed S"
       
  1852   shows "Inf S \<in> S"
       
  1853   by (metis closure_contains_Inf closure_closed assms)
       
  1854 
       
  1855 
       
  1856 lemma not_trivial_limit_within_ball:
       
  1857   "(\<not> trivial_limit (at x within S)) = (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
       
  1858   (is "?lhs = ?rhs")
       
  1859 proof -
       
  1860   { assume "?lhs"
       
  1861     { fix e :: real
       
  1862       assume "e>0"
       
  1863       then obtain y where "y:(S-{x}) & dist y x < e"
       
  1864         using `?lhs` not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
       
  1865         by auto
       
  1866       then have "y : (S Int ball x e - {x})"
       
  1867         unfolding ball_def by (simp add: dist_commute)
       
  1868       then have "S Int ball x e - {x} ~= {}" by blast
       
  1869     } then have "?rhs" by auto
       
  1870   }
       
  1871   moreover
       
  1872   { assume "?rhs"
       
  1873     { fix e :: real
       
  1874       assume "e>0"
       
  1875       then obtain y where "y : (S Int ball x e - {x})" using `?rhs` by blast
       
  1876       then have "y:(S-{x}) & dist y x < e"
       
  1877         unfolding ball_def by (simp add: dist_commute)
       
  1878       then have "EX y:(S-{x}). dist y x < e" by auto
       
  1879     }
       
  1880     then have "?lhs"
       
  1881       using not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"] by auto
       
  1882   }
       
  1883   ultimately show ?thesis by auto
       
  1884 qed
  1819 
  1885 
  1820 subsection {* Infimum Distance *}
  1886 subsection {* Infimum Distance *}
  1821 
  1887 
  1822 definition "infdist x A = (if A = {} then 0 else Inf {dist x a|a. a \<in> A})"
  1888 definition "infdist x A = (if A = {} then 0 else Inf {dist x a|a. a \<in> A})"
  1823 
  1889 
  3831 
  3897 
  3832 lemma continuous_at_within:
  3898 lemma continuous_at_within:
  3833   assumes "continuous (at x) f"  shows "continuous (at x within s) f"
  3899   assumes "continuous (at x) f"  shows "continuous (at x within s) f"
  3834   using assms unfolding continuous_at continuous_within
  3900   using assms unfolding continuous_at continuous_within
  3835   by (rule Lim_at_within)
  3901   by (rule Lim_at_within)
       
  3902 
  3836 
  3903 
  3837 text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
  3904 text{* Derive the epsilon-delta forms, which we often use as "definitions" *}
  3838 
  3905 
  3839 lemma continuous_within_eps_delta:
  3906 lemma continuous_within_eps_delta:
  3840   "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'\<in> s.  dist x' x < d --> dist (f x') (f x) < e)"
  3907   "continuous (at x within s) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'\<in> s.  dist x' x < d --> dist (f x') (f x) < e)"
  4383 
  4450 
  4384 lemma continuous_at_open:
  4451 lemma continuous_at_open:
  4385   shows "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))"
  4452   shows "continuous (at x) f \<longleftrightarrow> (\<forall>t. open t \<and> f x \<in> t --> (\<exists>s. open s \<and> x \<in> s \<and> (\<forall>x' \<in> s. (f x') \<in> t)))"
  4386 unfolding continuous_within_topological [of x UNIV f, unfolded within_UNIV]
  4453 unfolding continuous_within_topological [of x UNIV f, unfolded within_UNIV]
  4387 unfolding imp_conjL by (intro all_cong imp_cong ex_cong conj_cong refl) auto
  4454 unfolding imp_conjL by (intro all_cong imp_cong ex_cong conj_cong refl) auto
       
  4455 
       
  4456 lemma continuous_imp_tendsto:
       
  4457   assumes "continuous (at x0) f" and "x ----> x0"
       
  4458   shows "(f \<circ> x) ----> (f x0)"
       
  4459 proof (rule topological_tendstoI)
       
  4460   fix S
       
  4461   assume "open S" "f x0 \<in> S"
       
  4462   then obtain T where T_def: "open T" "x0 \<in> T" "\<forall>x\<in>T. f x \<in> S"
       
  4463      using assms continuous_at_open by metis
       
  4464   then have "eventually (\<lambda>n. x n \<in> T) sequentially"
       
  4465     using assms T_def by (auto simp: tendsto_def)
       
  4466   then show "eventually (\<lambda>n. (f \<circ> x) n \<in> S) sequentially"
       
  4467     using T_def by (auto elim!: eventually_elim1)
       
  4468 qed
  4388 
  4469 
  4389 lemma continuous_on_open:
  4470 lemma continuous_on_open:
  4390   shows "continuous_on s f \<longleftrightarrow>
  4471   shows "continuous_on s f \<longleftrightarrow>
  4391         (\<forall>t. openin (subtopology euclidean (f ` s)) t
  4472         (\<forall>t. openin (subtopology euclidean (f ` s)) t
  4392             --> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")
  4473             --> openin (subtopology euclidean s) {x \<in> s. f x \<in> t})" (is "?lhs = ?rhs")