src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 60141 833adf7db7d8
parent 60040 1fa1023b13b9
child 60150 bd773c47ad0b
equal deleted inserted replaced
60140:a948ee5fb5f4 60141:833adf7db7d8
   703     apply clarsimp
   703     apply clarsimp
   704     apply (rule_tac x="d - dist x a" in exI)
   704     apply (rule_tac x="d - dist x a" in exI)
   705     apply (clarsimp simp add: less_diff_eq)
   705     apply (clarsimp simp add: less_diff_eq)
   706     by (metis dist_commute dist_triangle_lt)
   706     by (metis dist_commute dist_triangle_lt)
   707   assume ?rhs then have 2: "S = U \<inter> T"
   707   assume ?rhs then have 2: "S = U \<inter> T"
   708     unfolding T_def 
   708     unfolding T_def
   709     by auto (metis dist_self)
   709     by auto (metis dist_self)
   710   from 1 2 show ?lhs
   710   from 1 2 show ?lhs
   711     unfolding openin_open open_dist by fast
   711     unfolding openin_open open_dist by fast
   712 qed
   712 qed
   713 
   713 
  1748   using islimpt_in_closure
  1748   using islimpt_in_closure
  1749   by (metis trivial_limit_within)
  1749   by (metis trivial_limit_within)
  1750 
  1750 
  1751 text {* Some property holds "sufficiently close" to the limit point. *}
  1751 text {* Some property holds "sufficiently close" to the limit point. *}
  1752 
  1752 
  1753 lemma eventually_at2:
       
  1754   "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d \<longrightarrow> P x)"
       
  1755   unfolding eventually_at dist_nz by auto
       
  1756 
       
  1757 lemma eventually_happens: "eventually P net \<Longrightarrow> trivial_limit net \<or> (\<exists>x. P x)"
  1753 lemma eventually_happens: "eventually P net \<Longrightarrow> trivial_limit net \<or> (\<exists>x. P x)"
  1758   unfolding trivial_limit_def
  1754   unfolding trivial_limit_def
  1759   by (auto elim: eventually_rev_mp)
  1755   by (auto elim: eventually_rev_mp)
  1760 
  1756 
  1761 lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
  1757 lemma trivial_limit_eventually: "trivial_limit net \<Longrightarrow> eventually P net"
  2049   fixes x :: "'a::{t2_space,perfect_space}"
  2045   fixes x :: "'a::{t2_space,perfect_space}"
  2050   assumes "x \<in> interior S"
  2046   assumes "x \<in> interior S"
  2051   shows "netlimit (at x within S) = x"
  2047   shows "netlimit (at x within S) = x"
  2052   using assms by (metis at_within_interior netlimit_at)
  2048   using assms by (metis at_within_interior netlimit_at)
  2053 
  2049 
  2054 text{* Transformation of limit. *}
       
  2055 
       
  2056 lemma Lim_transform:
       
  2057   fixes f g :: "'a::type \<Rightarrow> 'b::real_normed_vector"
       
  2058   assumes "((\<lambda>x. f x - g x) ---> 0) net" "(f ---> l) net"
       
  2059   shows "(g ---> l) net"
       
  2060   using tendsto_diff [OF assms(2) assms(1)] by simp
       
  2061 
       
  2062 lemma Lim_transform_eventually:
       
  2063   "eventually (\<lambda>x. f x = g x) net \<Longrightarrow> (f ---> l) net \<Longrightarrow> (g ---> l) net"
       
  2064   apply (rule topological_tendstoI)
       
  2065   apply (drule (2) topological_tendstoD)
       
  2066   apply (erule (1) eventually_elim2, simp)
       
  2067   done
       
  2068 
       
  2069 lemma Lim_transform_within:
       
  2070   assumes "0 < d"
       
  2071     and "\<forall>x'\<in>S. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"
       
  2072     and "(f ---> l) (at x within S)"
       
  2073   shows "(g ---> l) (at x within S)"
       
  2074 proof (rule Lim_transform_eventually)
       
  2075   show "eventually (\<lambda>x. f x = g x) (at x within S)"
       
  2076     using assms(1,2) by (auto simp: dist_nz eventually_at)
       
  2077   show "(f ---> l) (at x within S)" by fact
       
  2078 qed
       
  2079 
       
  2080 lemma Lim_transform_at:
       
  2081   assumes "0 < d"
       
  2082     and "\<forall>x'. 0 < dist x' x \<and> dist x' x < d \<longrightarrow> f x' = g x'"
       
  2083     and "(f ---> l) (at x)"
       
  2084   shows "(g ---> l) (at x)"
       
  2085   using _ assms(3)
       
  2086 proof (rule Lim_transform_eventually)
       
  2087   show "eventually (\<lambda>x. f x = g x) (at x)"
       
  2088     unfolding eventually_at2
       
  2089     using assms(1,2) by auto
       
  2090 qed
       
  2091 
       
  2092 text{* Common case assuming being away from some crucial point like 0. *}
       
  2093 
       
  2094 lemma Lim_transform_away_within:
       
  2095   fixes a b :: "'a::t1_space"
       
  2096   assumes "a \<noteq> b"
       
  2097     and "\<forall>x\<in>S. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
       
  2098     and "(f ---> l) (at a within S)"
       
  2099   shows "(g ---> l) (at a within S)"
       
  2100 proof (rule Lim_transform_eventually)
       
  2101   show "(f ---> l) (at a within S)" by fact
       
  2102   show "eventually (\<lambda>x. f x = g x) (at a within S)"
       
  2103     unfolding eventually_at_topological
       
  2104     by (rule exI [where x="- {b}"], simp add: open_Compl assms)
       
  2105 qed
       
  2106 
       
  2107 lemma Lim_transform_away_at:
       
  2108   fixes a b :: "'a::t1_space"
       
  2109   assumes ab: "a\<noteq>b"
       
  2110     and fg: "\<forall>x. x \<noteq> a \<and> x \<noteq> b \<longrightarrow> f x = g x"
       
  2111     and fl: "(f ---> l) (at a)"
       
  2112   shows "(g ---> l) (at a)"
       
  2113   using Lim_transform_away_within[OF ab, of UNIV f g l] fg fl by simp
       
  2114 
       
  2115 text{* Alternatively, within an open set. *}
       
  2116 
       
  2117 lemma Lim_transform_within_open:
       
  2118   assumes "open S" and "a \<in> S"
       
  2119     and "\<forall>x\<in>S. x \<noteq> a \<longrightarrow> f x = g x"
       
  2120     and "(f ---> l) (at a)"
       
  2121   shows "(g ---> l) (at a)"
       
  2122 proof (rule Lim_transform_eventually)
       
  2123   show "eventually (\<lambda>x. f x = g x) (at a)"
       
  2124     unfolding eventually_at_topological
       
  2125     using assms(1,2,3) by auto
       
  2126   show "(f ---> l) (at a)" by fact
       
  2127 qed
       
  2128 
       
  2129 text{* A congruence rule allowing us to transform limits assuming not at point. *}
       
  2130 
       
  2131 (* FIXME: Only one congruence rule for tendsto can be used at a time! *)
       
  2132 
       
  2133 lemma Lim_cong_within(*[cong add]*):
       
  2134   assumes "a = b"
       
  2135     and "x = y"
       
  2136     and "S = T"
       
  2137     and "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x"
       
  2138   shows "(f ---> x) (at a within S) \<longleftrightarrow> (g ---> y) (at b within T)"
       
  2139   unfolding tendsto_def eventually_at_topological
       
  2140   using assms by simp
       
  2141 
       
  2142 lemma Lim_cong_at(*[cong add]*):
       
  2143   assumes "a = b" "x = y"
       
  2144     and "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x"
       
  2145   shows "((\<lambda>x. f x) ---> x) (at a) \<longleftrightarrow> ((g ---> y) (at a))"
       
  2146   unfolding tendsto_def eventually_at_topological
       
  2147   using assms by simp
       
  2148 
  2050 
  2149 text{* Useful lemmas on closure and set of possible sequential limits.*}
  2051 text{* Useful lemmas on closure and set of possible sequential limits.*}
  2150 
  2052 
  2151 lemma closure_sequential:
  2053 lemma closure_sequential:
  2152   fixes l :: "'a::first_countable_topology"
  2054   fixes l :: "'a::first_countable_topology"