1120 next |
1120 next |
1121 assume ?rhs |
1121 assume ?rhs |
1122 thus ?lhs by (rule Lim_at_within) |
1122 thus ?lhs by (rule Lim_at_within) |
1123 qed |
1123 qed |
1124 |
1124 |
|
1125 lemma Lim_within_LIMSEQ: |
|
1126 fixes a :: real and L :: "'a::metric_space" |
|
1127 assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
1128 shows "(X ---> L) (at a within T)" |
|
1129 proof (rule ccontr) |
|
1130 assume "\<not> (X ---> L) (at a within T)" |
|
1131 hence "\<exists>r>0. \<forall>s>0. \<exists>x\<in>T. x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> r \<le> dist (X x) L" |
|
1132 unfolding tendsto_iff eventually_within dist_norm by (simp add: not_less[symmetric]) |
|
1133 then obtain r where r: "r > 0" "\<And>s. s > 0 \<Longrightarrow> \<exists>x\<in>T-{a}. \<bar>x - a\<bar> < s \<and> dist (X x) L \<ge> r" by blast |
|
1134 |
|
1135 let ?F = "\<lambda>n::nat. SOME x. x \<in> T \<and> x \<noteq> a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> dist (X x) L \<ge> r" |
|
1136 have "\<And>n. \<exists>x. x \<in> T \<and> x \<noteq> a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> dist (X x) L \<ge> r" |
|
1137 using r by (simp add: Bex_def) |
|
1138 hence F: "\<And>n. ?F n \<in> T \<and> ?F n \<noteq> a \<and> \<bar>?F n - a\<bar> < inverse (real (Suc n)) \<and> dist (X (?F n)) L \<ge> r" |
|
1139 by (rule someI_ex) |
|
1140 hence F1: "\<And>n. ?F n \<in> T \<and> ?F n \<noteq> a" |
|
1141 and F2: "\<And>n. \<bar>?F n - a\<bar> < inverse (real (Suc n))" |
|
1142 and F3: "\<And>n. dist (X (?F n)) L \<ge> r" |
|
1143 by fast+ |
|
1144 |
|
1145 have "?F ----> a" |
|
1146 proof (rule LIMSEQ_I, unfold real_norm_def) |
|
1147 fix e::real |
|
1148 assume "0 < e" |
|
1149 (* choose no such that inverse (real (Suc n)) < e *) |
|
1150 then have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean) |
|
1151 then obtain m where nodef: "inverse (real (Suc m)) < e" by auto |
|
1152 show "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n - a\<bar> < e" |
|
1153 proof (intro exI allI impI) |
|
1154 fix n |
|
1155 assume mlen: "m \<le> n" |
|
1156 have "\<bar>?F n - a\<bar> < inverse (real (Suc n))" |
|
1157 by (rule F2) |
|
1158 also have "inverse (real (Suc n)) \<le> inverse (real (Suc m))" |
|
1159 using mlen by auto |
|
1160 also from nodef have |
|
1161 "inverse (real (Suc m)) < e" . |
|
1162 finally show "\<bar>?F n - a\<bar> < e" . |
|
1163 qed |
|
1164 qed |
|
1165 moreover note `\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L` |
|
1166 ultimately have "(\<lambda>n. X (?F n)) ----> L" using F1 by simp |
|
1167 |
|
1168 moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)" |
|
1169 proof - |
|
1170 { |
|
1171 fix no::nat |
|
1172 obtain n where "n = no + 1" by simp |
|
1173 then have nolen: "no \<le> n" by simp |
|
1174 (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *) |
|
1175 have "dist (X (?F n)) L \<ge> r" |
|
1176 by (rule F3) |
|
1177 with nolen have "\<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r" by fast |
|
1178 } |
|
1179 then have "(\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r)" by simp |
|
1180 with r have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> e)" by auto |
|
1181 thus ?thesis by (unfold LIMSEQ_def, auto simp add: not_less) |
|
1182 qed |
|
1183 ultimately show False by simp |
|
1184 qed |
|
1185 |
|
1186 lemma Lim_right_bound: |
|
1187 fixes f :: "real \<Rightarrow> real" |
|
1188 assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b" |
|
1189 assumes bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a" |
|
1190 shows "(f ---> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))" |
|
1191 proof cases |
|
1192 assume "{x<..} \<inter> I = {}" then show ?thesis by (simp add: Lim_within_empty) |
|
1193 next |
|
1194 assume [simp]: "{x<..} \<inter> I \<noteq> {}" |
|
1195 show ?thesis |
|
1196 proof (rule Lim_within_LIMSEQ, safe) |
|
1197 fix S assume S: "\<forall>n. S n \<noteq> x \<and> S n \<in> {x <..} \<inter> I" "S ----> x" |
|
1198 |
|
1199 show "(\<lambda>n. f (S n)) ----> Inf (f ` ({x<..} \<inter> I))" |
|
1200 proof (rule LIMSEQ_I, rule ccontr) |
|
1201 fix r :: real assume "0 < r" |
|
1202 with Inf_close[of "f ` ({x<..} \<inter> I)" r] |
|
1203 obtain y where y: "x < y" "y \<in> I" "f y < Inf (f ` ({x <..} \<inter> I)) + r" by auto |
|
1204 from `x < y` have "0 < y - x" by auto |
|
1205 from S(2)[THEN LIMSEQ_D, OF this] |
|
1206 obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> \<bar>S n - x\<bar> < y - x" by auto |
|
1207 |
|
1208 assume "\<not> (\<exists>N. \<forall>n\<ge>N. norm (f (S n) - Inf (f ` ({x<..} \<inter> I))) < r)" |
|
1209 moreover have "\<And>n. Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)" |
|
1210 using S bnd by (intro Inf_lower[where z=K]) auto |
|
1211 ultimately obtain n where n: "N \<le> n" "r + Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)" |
|
1212 by (auto simp: not_less field_simps) |
|
1213 with N[OF n(1)] mono[OF _ `y \<in> I`, of "S n"] S(1)[THEN spec, of n] y |
|
1214 show False by auto |
|
1215 qed |
|
1216 qed |
|
1217 qed |
|
1218 |
1125 text{* Another limit point characterization. *} |
1219 text{* Another limit point characterization. *} |
1126 |
1220 |
1127 lemma islimpt_sequential: |
1221 lemma islimpt_sequential: |
1128 fixes x :: "'a::metric_space" |
1222 fixes x :: "'a::metric_space" |
1129 shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)" |
1223 shows "x islimpt S \<longleftrightarrow> (\<exists>f. (\<forall>n::nat. f n \<in> S -{x}) \<and> (f ---> x) sequentially)" |
1503 text{* A congruence rule allowing us to transform limits assuming not at point. *} |
1597 text{* A congruence rule allowing us to transform limits assuming not at point. *} |
1504 |
1598 |
1505 (* FIXME: Only one congruence rule for tendsto can be used at a time! *) |
1599 (* FIXME: Only one congruence rule for tendsto can be used at a time! *) |
1506 |
1600 |
1507 lemma Lim_cong_within(*[cong add]*): |
1601 lemma Lim_cong_within(*[cong add]*): |
1508 assumes "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x" |
1602 assumes "a = b" "x = y" "S = T" |
1509 shows "((\<lambda>x. f x) ---> l) (at a within S) \<longleftrightarrow> ((g ---> l) (at a within S))" |
1603 assumes "\<And>x. x \<noteq> b \<Longrightarrow> x \<in> T \<Longrightarrow> f x = g x" |
|
1604 shows "(f ---> x) (at a within S) \<longleftrightarrow> (g ---> y) (at b within T)" |
1510 unfolding tendsto_def Limits.eventually_within eventually_at_topological |
1605 unfolding tendsto_def Limits.eventually_within eventually_at_topological |
1511 using assms by simp |
1606 using assms by simp |
1512 |
1607 |
1513 lemma Lim_cong_at(*[cong add]*): |
1608 lemma Lim_cong_at(*[cong add]*): |
|
1609 assumes "a = b" "x = y" |
1514 assumes "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x" |
1610 assumes "\<And>x. x \<noteq> a \<Longrightarrow> f x = g x" |
1515 shows "((\<lambda>x. f x) ---> l) (at a) \<longleftrightarrow> ((g ---> l) (at a))" |
1611 shows "((\<lambda>x. f x) ---> x) (at a) \<longleftrightarrow> ((g ---> y) (at a))" |
1516 unfolding tendsto_def eventually_at_topological |
1612 unfolding tendsto_def eventually_at_topological |
1517 using assms by simp |
1613 using assms by simp |
1518 |
1614 |
1519 text{* Useful lemmas on closure and set of possible sequential limits.*} |
1615 text{* Useful lemmas on closure and set of possible sequential limits.*} |
1520 |
1616 |