1 (* Title : Lim.thy |
|
2 ID : $Id$ |
|
3 Author : Jacques D. Fleuriot |
|
4 Copyright : 1998 University of Cambridge |
|
5 Conversion to Isar and new proofs by Lawrence C Paulson, 2004 |
|
6 *) |
|
7 |
|
8 header{* Limits and Continuity *} |
|
9 |
|
10 theory Lim |
|
11 imports SEQ |
|
12 begin |
|
13 |
|
14 text{*Standard Definitions*} |
|
15 |
|
16 definition |
|
17 LIM :: "['a::real_normed_vector => 'b::real_normed_vector, 'a, 'b] => bool" |
|
18 ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where |
|
19 [code del]: "f -- a --> L = |
|
20 (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s |
|
21 --> norm (f x - L) < r)" |
|
22 |
|
23 definition |
|
24 isCont :: "['a::real_normed_vector => 'b::real_normed_vector, 'a] => bool" where |
|
25 "isCont f a = (f -- a --> (f a))" |
|
26 |
|
27 definition |
|
28 isUCont :: "['a::real_normed_vector => 'b::real_normed_vector] => bool" where |
|
29 [code del]: "isUCont f = (\<forall>r>0. \<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r)" |
|
30 |
|
31 |
|
32 subsection {* Limits of Functions *} |
|
33 |
|
34 subsubsection {* Purely standard proofs *} |
|
35 |
|
36 lemma LIM_eq: |
|
37 "f -- a --> L = |
|
38 (\<forall>r>0.\<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)" |
|
39 by (simp add: LIM_def diff_minus) |
|
40 |
|
41 lemma LIM_I: |
|
42 "(!!r. 0<r ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r) |
|
43 ==> f -- a --> L" |
|
44 by (simp add: LIM_eq) |
|
45 |
|
46 lemma LIM_D: |
|
47 "[| f -- a --> L; 0<r |] |
|
48 ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r" |
|
49 by (simp add: LIM_eq) |
|
50 |
|
51 lemma LIM_offset: "f -- a --> L \<Longrightarrow> (\<lambda>x. f (x + k)) -- a - k --> L" |
|
52 apply (rule LIM_I) |
|
53 apply (drule_tac r="r" in LIM_D, safe) |
|
54 apply (rule_tac x="s" in exI, safe) |
|
55 apply (drule_tac x="x + k" in spec) |
|
56 apply (simp add: compare_rls) |
|
57 done |
|
58 |
|
59 lemma LIM_offset_zero: "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L" |
|
60 by (drule_tac k="a" in LIM_offset, simp add: add_commute) |
|
61 |
|
62 lemma LIM_offset_zero_cancel: "(\<lambda>h. f (a + h)) -- 0 --> L \<Longrightarrow> f -- a --> L" |
|
63 by (drule_tac k="- a" in LIM_offset, simp) |
|
64 |
|
65 lemma LIM_const [simp]: "(%x. k) -- x --> k" |
|
66 by (simp add: LIM_def) |
|
67 |
|
68 lemma LIM_add: |
|
69 fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_vector" |
|
70 assumes f: "f -- a --> L" and g: "g -- a --> M" |
|
71 shows "(%x. f x + g(x)) -- a --> (L + M)" |
|
72 proof (rule LIM_I) |
|
73 fix r :: real |
|
74 assume r: "0 < r" |
|
75 from LIM_D [OF f half_gt_zero [OF r]] |
|
76 obtain fs |
|
77 where fs: "0 < fs" |
|
78 and fs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < fs --> norm (f x - L) < r/2" |
|
79 by blast |
|
80 from LIM_D [OF g half_gt_zero [OF r]] |
|
81 obtain gs |
|
82 where gs: "0 < gs" |
|
83 and gs_lt: "\<forall>x. x \<noteq> a & norm (x-a) < gs --> norm (g x - M) < r/2" |
|
84 by blast |
|
85 show "\<exists>s>0.\<forall>x. x \<noteq> a \<and> norm (x-a) < s \<longrightarrow> norm (f x + g x - (L + M)) < r" |
|
86 proof (intro exI conjI strip) |
|
87 show "0 < min fs gs" by (simp add: fs gs) |
|
88 fix x :: 'a |
|
89 assume "x \<noteq> a \<and> norm (x-a) < min fs gs" |
|
90 hence "x \<noteq> a \<and> norm (x-a) < fs \<and> norm (x-a) < gs" by simp |
|
91 with fs_lt gs_lt |
|
92 have "norm (f x - L) < r/2" and "norm (g x - M) < r/2" by blast+ |
|
93 hence "norm (f x - L) + norm (g x - M) < r" by arith |
|
94 thus "norm (f x + g x - (L + M)) < r" |
|
95 by (blast intro: norm_diff_triangle_ineq order_le_less_trans) |
|
96 qed |
|
97 qed |
|
98 |
|
99 lemma LIM_add_zero: |
|
100 "\<lbrakk>f -- a --> 0; g -- a --> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) -- a --> 0" |
|
101 by (drule (1) LIM_add, simp) |
|
102 |
|
103 lemma minus_diff_minus: |
|
104 fixes a b :: "'a::ab_group_add" |
|
105 shows "(- a) - (- b) = - (a - b)" |
|
106 by simp |
|
107 |
|
108 lemma LIM_minus: "f -- a --> L ==> (%x. -f(x)) -- a --> -L" |
|
109 by (simp only: LIM_eq minus_diff_minus norm_minus_cancel) |
|
110 |
|
111 lemma LIM_add_minus: |
|
112 "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)" |
|
113 by (intro LIM_add LIM_minus) |
|
114 |
|
115 lemma LIM_diff: |
|
116 "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) - g(x)) -- x --> l-m" |
|
117 by (simp only: diff_minus LIM_add LIM_minus) |
|
118 |
|
119 lemma LIM_zero: "f -- a --> l \<Longrightarrow> (\<lambda>x. f x - l) -- a --> 0" |
|
120 by (simp add: LIM_def) |
|
121 |
|
122 lemma LIM_zero_cancel: "(\<lambda>x. f x - l) -- a --> 0 \<Longrightarrow> f -- a --> l" |
|
123 by (simp add: LIM_def) |
|
124 |
|
125 lemma LIM_zero_iff: "(\<lambda>x. f x - l) -- a --> 0 = f -- a --> l" |
|
126 by (simp add: LIM_def) |
|
127 |
|
128 lemma LIM_imp_LIM: |
|
129 assumes f: "f -- a --> l" |
|
130 assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> norm (g x - m) \<le> norm (f x - l)" |
|
131 shows "g -- a --> m" |
|
132 apply (rule LIM_I, drule LIM_D [OF f], safe) |
|
133 apply (rule_tac x="s" in exI, safe) |
|
134 apply (drule_tac x="x" in spec, safe) |
|
135 apply (erule (1) order_le_less_trans [OF le]) |
|
136 done |
|
137 |
|
138 lemma LIM_norm: "f -- a --> l \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> norm l" |
|
139 by (erule LIM_imp_LIM, simp add: norm_triangle_ineq3) |
|
140 |
|
141 lemma LIM_norm_zero: "f -- a --> 0 \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> 0" |
|
142 by (drule LIM_norm, simp) |
|
143 |
|
144 lemma LIM_norm_zero_cancel: "(\<lambda>x. norm (f x)) -- a --> 0 \<Longrightarrow> f -- a --> 0" |
|
145 by (erule LIM_imp_LIM, simp) |
|
146 |
|
147 lemma LIM_norm_zero_iff: "(\<lambda>x. norm (f x)) -- a --> 0 = f -- a --> 0" |
|
148 by (rule iffI [OF LIM_norm_zero_cancel LIM_norm_zero]) |
|
149 |
|
150 lemma LIM_rabs: "f -- a --> (l::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> \<bar>l\<bar>" |
|
151 by (fold real_norm_def, rule LIM_norm) |
|
152 |
|
153 lemma LIM_rabs_zero: "f -- a --> (0::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> 0" |
|
154 by (fold real_norm_def, rule LIM_norm_zero) |
|
155 |
|
156 lemma LIM_rabs_zero_cancel: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) \<Longrightarrow> f -- a --> 0" |
|
157 by (fold real_norm_def, rule LIM_norm_zero_cancel) |
|
158 |
|
159 lemma LIM_rabs_zero_iff: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) = f -- a --> 0" |
|
160 by (fold real_norm_def, rule LIM_norm_zero_iff) |
|
161 |
|
162 lemma LIM_const_not_eq: |
|
163 fixes a :: "'a::real_normed_algebra_1" |
|
164 shows "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) -- a --> L" |
|
165 apply (simp add: LIM_eq) |
|
166 apply (rule_tac x="norm (k - L)" in exI, simp, safe) |
|
167 apply (rule_tac x="a + of_real (s/2)" in exI, simp add: norm_of_real) |
|
168 done |
|
169 |
|
170 lemmas LIM_not_zero = LIM_const_not_eq [where L = 0] |
|
171 |
|
172 lemma LIM_const_eq: |
|
173 fixes a :: "'a::real_normed_algebra_1" |
|
174 shows "(\<lambda>x. k) -- a --> L \<Longrightarrow> k = L" |
|
175 apply (rule ccontr) |
|
176 apply (blast dest: LIM_const_not_eq) |
|
177 done |
|
178 |
|
179 lemma LIM_unique: |
|
180 fixes a :: "'a::real_normed_algebra_1" |
|
181 shows "\<lbrakk>f -- a --> L; f -- a --> M\<rbrakk> \<Longrightarrow> L = M" |
|
182 apply (drule (1) LIM_diff) |
|
183 apply (auto dest!: LIM_const_eq) |
|
184 done |
|
185 |
|
186 lemma LIM_ident [simp]: "(\<lambda>x. x) -- a --> a" |
|
187 by (auto simp add: LIM_def) |
|
188 |
|
189 text{*Limits are equal for functions equal except at limit point*} |
|
190 lemma LIM_equal: |
|
191 "[| \<forall>x. x \<noteq> a --> (f x = g x) |] ==> (f -- a --> l) = (g -- a --> l)" |
|
192 by (simp add: LIM_def) |
|
193 |
|
194 lemma LIM_cong: |
|
195 "\<lbrakk>a = b; \<And>x. x \<noteq> b \<Longrightarrow> f x = g x; l = m\<rbrakk> |
|
196 \<Longrightarrow> ((\<lambda>x. f x) -- a --> l) = ((\<lambda>x. g x) -- b --> m)" |
|
197 by (simp add: LIM_def) |
|
198 |
|
199 lemma LIM_equal2: |
|
200 assumes 1: "0 < R" |
|
201 assumes 2: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < R\<rbrakk> \<Longrightarrow> f x = g x" |
|
202 shows "g -- a --> l \<Longrightarrow> f -- a --> l" |
|
203 apply (unfold LIM_def, safe) |
|
204 apply (drule_tac x="r" in spec, safe) |
|
205 apply (rule_tac x="min s R" in exI, safe) |
|
206 apply (simp add: 1) |
|
207 apply (simp add: 2) |
|
208 done |
|
209 |
|
210 text{*Two uses in Hyperreal/Transcendental.ML*} |
|
211 lemma LIM_trans: |
|
212 "[| (%x. f(x) + -g(x)) -- a --> 0; g -- a --> l |] ==> f -- a --> l" |
|
213 apply (drule LIM_add, assumption) |
|
214 apply (auto simp add: add_assoc) |
|
215 done |
|
216 |
|
217 lemma LIM_compose: |
|
218 assumes g: "g -- l --> g l" |
|
219 assumes f: "f -- a --> l" |
|
220 shows "(\<lambda>x. g (f x)) -- a --> g l" |
|
221 proof (rule LIM_I) |
|
222 fix r::real assume r: "0 < r" |
|
223 obtain s where s: "0 < s" |
|
224 and less_r: "\<And>y. \<lbrakk>y \<noteq> l; norm (y - l) < s\<rbrakk> \<Longrightarrow> norm (g y - g l) < r" |
|
225 using LIM_D [OF g r] by fast |
|
226 obtain t where t: "0 < t" |
|
227 and less_s: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (f x - l) < s" |
|
228 using LIM_D [OF f s] by fast |
|
229 |
|
230 show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < t \<longrightarrow> norm (g (f x) - g l) < r" |
|
231 proof (rule exI, safe) |
|
232 show "0 < t" using t . |
|
233 next |
|
234 fix x assume "x \<noteq> a" and "norm (x - a) < t" |
|
235 hence "norm (f x - l) < s" by (rule less_s) |
|
236 thus "norm (g (f x) - g l) < r" |
|
237 using r less_r by (case_tac "f x = l", simp_all) |
|
238 qed |
|
239 qed |
|
240 |
|
241 lemma LIM_compose2: |
|
242 assumes f: "f -- a --> b" |
|
243 assumes g: "g -- b --> c" |
|
244 assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> b" |
|
245 shows "(\<lambda>x. g (f x)) -- a --> c" |
|
246 proof (rule LIM_I) |
|
247 fix r :: real |
|
248 assume r: "0 < r" |
|
249 obtain s where s: "0 < s" |
|
250 and less_r: "\<And>y. \<lbrakk>y \<noteq> b; norm (y - b) < s\<rbrakk> \<Longrightarrow> norm (g y - c) < r" |
|
251 using LIM_D [OF g r] by fast |
|
252 obtain t where t: "0 < t" |
|
253 and less_s: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (f x - b) < s" |
|
254 using LIM_D [OF f s] by fast |
|
255 obtain d where d: "0 < d" |
|
256 and neq_b: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < d\<rbrakk> \<Longrightarrow> f x \<noteq> b" |
|
257 using inj by fast |
|
258 |
|
259 show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < t \<longrightarrow> norm (g (f x) - c) < r" |
|
260 proof (safe intro!: exI) |
|
261 show "0 < min d t" using d t by simp |
|
262 next |
|
263 fix x |
|
264 assume "x \<noteq> a" and "norm (x - a) < min d t" |
|
265 hence "f x \<noteq> b" and "norm (f x - b) < s" |
|
266 using neq_b less_s by simp_all |
|
267 thus "norm (g (f x) - c) < r" |
|
268 by (rule less_r) |
|
269 qed |
|
270 qed |
|
271 |
|
272 lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l" |
|
273 unfolding o_def by (rule LIM_compose) |
|
274 |
|
275 lemma real_LIM_sandwich_zero: |
|
276 fixes f g :: "'a::real_normed_vector \<Rightarrow> real" |
|
277 assumes f: "f -- a --> 0" |
|
278 assumes 1: "\<And>x. x \<noteq> a \<Longrightarrow> 0 \<le> g x" |
|
279 assumes 2: "\<And>x. x \<noteq> a \<Longrightarrow> g x \<le> f x" |
|
280 shows "g -- a --> 0" |
|
281 proof (rule LIM_imp_LIM [OF f]) |
|
282 fix x assume x: "x \<noteq> a" |
|
283 have "norm (g x - 0) = g x" by (simp add: 1 x) |
|
284 also have "g x \<le> f x" by (rule 2 [OF x]) |
|
285 also have "f x \<le> \<bar>f x\<bar>" by (rule abs_ge_self) |
|
286 also have "\<bar>f x\<bar> = norm (f x - 0)" by simp |
|
287 finally show "norm (g x - 0) \<le> norm (f x - 0)" . |
|
288 qed |
|
289 |
|
290 text {* Bounded Linear Operators *} |
|
291 |
|
292 lemma (in bounded_linear) cont: "f -- a --> f a" |
|
293 proof (rule LIM_I) |
|
294 fix r::real assume r: "0 < r" |
|
295 obtain K where K: "0 < K" and norm_le: "\<And>x. norm (f x) \<le> norm x * K" |
|
296 using pos_bounded by fast |
|
297 show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x - f a) < r" |
|
298 proof (rule exI, safe) |
|
299 from r K show "0 < r / K" by (rule divide_pos_pos) |
|
300 next |
|
301 fix x assume x: "norm (x - a) < r / K" |
|
302 have "norm (f x - f a) = norm (f (x - a))" by (simp only: diff) |
|
303 also have "\<dots> \<le> norm (x - a) * K" by (rule norm_le) |
|
304 also from K x have "\<dots> < r" by (simp only: pos_less_divide_eq) |
|
305 finally show "norm (f x - f a) < r" . |
|
306 qed |
|
307 qed |
|
308 |
|
309 lemma (in bounded_linear) LIM: |
|
310 "g -- a --> l \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> f l" |
|
311 by (rule LIM_compose [OF cont]) |
|
312 |
|
313 lemma (in bounded_linear) LIM_zero: |
|
314 "g -- a --> 0 \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> 0" |
|
315 by (drule LIM, simp only: zero) |
|
316 |
|
317 text {* Bounded Bilinear Operators *} |
|
318 |
|
319 lemma (in bounded_bilinear) LIM_prod_zero: |
|
320 assumes f: "f -- a --> 0" |
|
321 assumes g: "g -- a --> 0" |
|
322 shows "(\<lambda>x. f x ** g x) -- a --> 0" |
|
323 proof (rule LIM_I) |
|
324 fix r::real assume r: "0 < r" |
|
325 obtain K where K: "0 < K" |
|
326 and norm_le: "\<And>x y. norm (x ** y) \<le> norm x * norm y * K" |
|
327 using pos_bounded by fast |
|
328 from K have K': "0 < inverse K" |
|
329 by (rule positive_imp_inverse_positive) |
|
330 obtain s where s: "0 < s" |
|
331 and norm_f: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < s\<rbrakk> \<Longrightarrow> norm (f x) < r" |
|
332 using LIM_D [OF f r] by auto |
|
333 obtain t where t: "0 < t" |
|
334 and norm_g: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (g x) < inverse K" |
|
335 using LIM_D [OF g K'] by auto |
|
336 show "\<exists>s>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < s \<longrightarrow> norm (f x ** g x - 0) < r" |
|
337 proof (rule exI, safe) |
|
338 from s t show "0 < min s t" by simp |
|
339 next |
|
340 fix x assume x: "x \<noteq> a" |
|
341 assume "norm (x - a) < min s t" |
|
342 hence xs: "norm (x - a) < s" and xt: "norm (x - a) < t" by simp_all |
|
343 from x xs have 1: "norm (f x) < r" by (rule norm_f) |
|
344 from x xt have 2: "norm (g x) < inverse K" by (rule norm_g) |
|
345 have "norm (f x ** g x) \<le> norm (f x) * norm (g x) * K" by (rule norm_le) |
|
346 also from 1 2 K have "\<dots> < r * inverse K * K" |
|
347 by (intro mult_strict_right_mono mult_strict_mono' norm_ge_zero) |
|
348 also from K have "r * inverse K * K = r" by simp |
|
349 finally show "norm (f x ** g x - 0) < r" by simp |
|
350 qed |
|
351 qed |
|
352 |
|
353 lemma (in bounded_bilinear) LIM_left_zero: |
|
354 "f -- a --> 0 \<Longrightarrow> (\<lambda>x. f x ** c) -- a --> 0" |
|
355 by (rule bounded_linear.LIM_zero [OF bounded_linear_left]) |
|
356 |
|
357 lemma (in bounded_bilinear) LIM_right_zero: |
|
358 "f -- a --> 0 \<Longrightarrow> (\<lambda>x. c ** f x) -- a --> 0" |
|
359 by (rule bounded_linear.LIM_zero [OF bounded_linear_right]) |
|
360 |
|
361 lemma (in bounded_bilinear) LIM: |
|
362 "\<lbrakk>f -- a --> L; g -- a --> M\<rbrakk> \<Longrightarrow> (\<lambda>x. f x ** g x) -- a --> L ** M" |
|
363 apply (drule LIM_zero) |
|
364 apply (drule LIM_zero) |
|
365 apply (rule LIM_zero_cancel) |
|
366 apply (subst prod_diff_prod) |
|
367 apply (rule LIM_add_zero) |
|
368 apply (rule LIM_add_zero) |
|
369 apply (erule (1) LIM_prod_zero) |
|
370 apply (erule LIM_left_zero) |
|
371 apply (erule LIM_right_zero) |
|
372 done |
|
373 |
|
374 lemmas LIM_mult = mult.LIM |
|
375 |
|
376 lemmas LIM_mult_zero = mult.LIM_prod_zero |
|
377 |
|
378 lemmas LIM_mult_left_zero = mult.LIM_left_zero |
|
379 |
|
380 lemmas LIM_mult_right_zero = mult.LIM_right_zero |
|
381 |
|
382 lemmas LIM_scaleR = scaleR.LIM |
|
383 |
|
384 lemmas LIM_of_real = of_real.LIM |
|
385 |
|
386 lemma LIM_power: |
|
387 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::{recpower,real_normed_algebra}" |
|
388 assumes f: "f -- a --> l" |
|
389 shows "(\<lambda>x. f x ^ n) -- a --> l ^ n" |
|
390 by (induct n, simp, simp add: power_Suc LIM_mult f) |
|
391 |
|
392 subsubsection {* Derived theorems about @{term LIM} *} |
|
393 |
|
394 lemma LIM_inverse_lemma: |
|
395 fixes x :: "'a::real_normed_div_algebra" |
|
396 assumes r: "0 < r" |
|
397 assumes x: "norm (x - 1) < min (1/2) (r/2)" |
|
398 shows "norm (inverse x - 1) < r" |
|
399 proof - |
|
400 from r have r2: "0 < r/2" by simp |
|
401 from x have 0: "x \<noteq> 0" by clarsimp |
|
402 from x have x': "norm (1 - x) < min (1/2) (r/2)" |
|
403 by (simp only: norm_minus_commute) |
|
404 hence less1: "norm (1 - x) < r/2" by simp |
|
405 have "norm (1::'a) - norm x \<le> norm (1 - x)" by (rule norm_triangle_ineq2) |
|
406 also from x' have "norm (1 - x) < 1/2" by simp |
|
407 finally have "1/2 < norm x" by simp |
|
408 hence "inverse (norm x) < inverse (1/2)" |
|
409 by (rule less_imp_inverse_less, simp) |
|
410 hence less2: "norm (inverse x) < 2" |
|
411 by (simp add: nonzero_norm_inverse 0) |
|
412 from less1 less2 r2 norm_ge_zero |
|
413 have "norm (1 - x) * norm (inverse x) < (r/2) * 2" |
|
414 by (rule mult_strict_mono) |
|
415 thus "norm (inverse x - 1) < r" |
|
416 by (simp only: norm_mult [symmetric] left_diff_distrib, simp add: 0) |
|
417 qed |
|
418 |
|
419 lemma LIM_inverse_fun: |
|
420 assumes a: "a \<noteq> (0::'a::real_normed_div_algebra)" |
|
421 shows "inverse -- a --> inverse a" |
|
422 proof (rule LIM_equal2) |
|
423 from a show "0 < norm a" by simp |
|
424 next |
|
425 fix x assume "norm (x - a) < norm a" |
|
426 hence "x \<noteq> 0" by auto |
|
427 with a show "inverse x = inverse (inverse a * x) * inverse a" |
|
428 by (simp add: nonzero_inverse_mult_distrib |
|
429 nonzero_imp_inverse_nonzero |
|
430 nonzero_inverse_inverse_eq mult_assoc) |
|
431 next |
|
432 have 1: "inverse -- 1 --> inverse (1::'a)" |
|
433 apply (rule LIM_I) |
|
434 apply (rule_tac x="min (1/2) (r/2)" in exI) |
|
435 apply (simp add: LIM_inverse_lemma) |
|
436 done |
|
437 have "(\<lambda>x. inverse a * x) -- a --> inverse a * a" |
|
438 by (intro LIM_mult LIM_ident LIM_const) |
|
439 hence "(\<lambda>x. inverse a * x) -- a --> 1" |
|
440 by (simp add: a) |
|
441 with 1 have "(\<lambda>x. inverse (inverse a * x)) -- a --> inverse 1" |
|
442 by (rule LIM_compose) |
|
443 hence "(\<lambda>x. inverse (inverse a * x)) -- a --> 1" |
|
444 by simp |
|
445 hence "(\<lambda>x. inverse (inverse a * x) * inverse a) -- a --> 1 * inverse a" |
|
446 by (intro LIM_mult LIM_const) |
|
447 thus "(\<lambda>x. inverse (inverse a * x) * inverse a) -- a --> inverse a" |
|
448 by simp |
|
449 qed |
|
450 |
|
451 lemma LIM_inverse: |
|
452 fixes L :: "'a::real_normed_div_algebra" |
|
453 shows "\<lbrakk>f -- a --> L; L \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (f x)) -- a --> inverse L" |
|
454 by (rule LIM_inverse_fun [THEN LIM_compose]) |
|
455 |
|
456 |
|
457 subsection {* Continuity *} |
|
458 |
|
459 subsubsection {* Purely standard proofs *} |
|
460 |
|
461 lemma LIM_isCont_iff: "(f -- a --> f a) = ((\<lambda>h. f (a + h)) -- 0 --> f a)" |
|
462 by (rule iffI [OF LIM_offset_zero LIM_offset_zero_cancel]) |
|
463 |
|
464 lemma isCont_iff: "isCont f x = (\<lambda>h. f (x + h)) -- 0 --> f x" |
|
465 by (simp add: isCont_def LIM_isCont_iff) |
|
466 |
|
467 lemma isCont_ident [simp]: "isCont (\<lambda>x. x) a" |
|
468 unfolding isCont_def by (rule LIM_ident) |
|
469 |
|
470 lemma isCont_const [simp]: "isCont (\<lambda>x. k) a" |
|
471 unfolding isCont_def by (rule LIM_const) |
|
472 |
|
473 lemma isCont_norm: "isCont f a \<Longrightarrow> isCont (\<lambda>x. norm (f x)) a" |
|
474 unfolding isCont_def by (rule LIM_norm) |
|
475 |
|
476 lemma isCont_rabs: "isCont f a \<Longrightarrow> isCont (\<lambda>x. \<bar>f x :: real\<bar>) a" |
|
477 unfolding isCont_def by (rule LIM_rabs) |
|
478 |
|
479 lemma isCont_add: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a" |
|
480 unfolding isCont_def by (rule LIM_add) |
|
481 |
|
482 lemma isCont_minus: "isCont f a \<Longrightarrow> isCont (\<lambda>x. - f x) a" |
|
483 unfolding isCont_def by (rule LIM_minus) |
|
484 |
|
485 lemma isCont_diff: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x - g x) a" |
|
486 unfolding isCont_def by (rule LIM_diff) |
|
487 |
|
488 lemma isCont_mult: |
|
489 fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra" |
|
490 shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x * g x) a" |
|
491 unfolding isCont_def by (rule LIM_mult) |
|
492 |
|
493 lemma isCont_inverse: |
|
494 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" |
|
495 shows "\<lbrakk>isCont f a; f a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. inverse (f x)) a" |
|
496 unfolding isCont_def by (rule LIM_inverse) |
|
497 |
|
498 lemma isCont_LIM_compose: |
|
499 "\<lbrakk>isCont g l; f -- a --> l\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) -- a --> g l" |
|
500 unfolding isCont_def by (rule LIM_compose) |
|
501 |
|
502 lemma isCont_LIM_compose2: |
|
503 assumes f [unfolded isCont_def]: "isCont f a" |
|
504 assumes g: "g -- f a --> l" |
|
505 assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> f a" |
|
506 shows "(\<lambda>x. g (f x)) -- a --> l" |
|
507 by (rule LIM_compose2 [OF f g inj]) |
|
508 |
|
509 lemma isCont_o2: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. g (f x)) a" |
|
510 unfolding isCont_def by (rule LIM_compose) |
|
511 |
|
512 lemma isCont_o: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (g o f) a" |
|
513 unfolding o_def by (rule isCont_o2) |
|
514 |
|
515 lemma (in bounded_linear) isCont: "isCont f a" |
|
516 unfolding isCont_def by (rule cont) |
|
517 |
|
518 lemma (in bounded_bilinear) isCont: |
|
519 "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x ** g x) a" |
|
520 unfolding isCont_def by (rule LIM) |
|
521 |
|
522 lemmas isCont_scaleR = scaleR.isCont |
|
523 |
|
524 lemma isCont_of_real: |
|
525 "isCont f a \<Longrightarrow> isCont (\<lambda>x. of_real (f x)) a" |
|
526 unfolding isCont_def by (rule LIM_of_real) |
|
527 |
|
528 lemma isCont_power: |
|
529 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::{recpower,real_normed_algebra}" |
|
530 shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x ^ n) a" |
|
531 unfolding isCont_def by (rule LIM_power) |
|
532 |
|
533 lemma isCont_abs [simp]: "isCont abs (a::real)" |
|
534 by (rule isCont_rabs [OF isCont_ident]) |
|
535 |
|
536 |
|
537 subsection {* Uniform Continuity *} |
|
538 |
|
539 lemma isUCont_isCont: "isUCont f ==> isCont f x" |
|
540 by (simp add: isUCont_def isCont_def LIM_def, force) |
|
541 |
|
542 lemma isUCont_Cauchy: |
|
543 "\<lbrakk>isUCont f; Cauchy X\<rbrakk> \<Longrightarrow> Cauchy (\<lambda>n. f (X n))" |
|
544 unfolding isUCont_def |
|
545 apply (rule CauchyI) |
|
546 apply (drule_tac x=e in spec, safe) |
|
547 apply (drule_tac e=s in CauchyD, safe) |
|
548 apply (rule_tac x=M in exI, simp) |
|
549 done |
|
550 |
|
551 lemma (in bounded_linear) isUCont: "isUCont f" |
|
552 unfolding isUCont_def |
|
553 proof (intro allI impI) |
|
554 fix r::real assume r: "0 < r" |
|
555 obtain K where K: "0 < K" and norm_le: "\<And>x. norm (f x) \<le> norm x * K" |
|
556 using pos_bounded by fast |
|
557 show "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r" |
|
558 proof (rule exI, safe) |
|
559 from r K show "0 < r / K" by (rule divide_pos_pos) |
|
560 next |
|
561 fix x y :: 'a |
|
562 assume xy: "norm (x - y) < r / K" |
|
563 have "norm (f x - f y) = norm (f (x - y))" by (simp only: diff) |
|
564 also have "\<dots> \<le> norm (x - y) * K" by (rule norm_le) |
|
565 also from K xy have "\<dots> < r" by (simp only: pos_less_divide_eq) |
|
566 finally show "norm (f x - f y) < r" . |
|
567 qed |
|
568 qed |
|
569 |
|
570 lemma (in bounded_linear) Cauchy: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. f (X n))" |
|
571 by (rule isUCont [THEN isUCont_Cauchy]) |
|
572 |
|
573 |
|
574 subsection {* Relation of LIM and LIMSEQ *} |
|
575 |
|
576 lemma LIMSEQ_SEQ_conv1: |
|
577 fixes a :: "'a::real_normed_vector" |
|
578 assumes X: "X -- a --> L" |
|
579 shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
580 proof (safe intro!: LIMSEQ_I) |
|
581 fix S :: "nat \<Rightarrow> 'a" |
|
582 fix r :: real |
|
583 assume rgz: "0 < r" |
|
584 assume as: "\<forall>n. S n \<noteq> a" |
|
585 assume S: "S ----> a" |
|
586 from LIM_D [OF X rgz] obtain s |
|
587 where sgz: "0 < s" |
|
588 and aux: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < s\<rbrakk> \<Longrightarrow> norm (X x - L) < r" |
|
589 by fast |
|
590 from LIMSEQ_D [OF S sgz] |
|
591 obtain no where "\<forall>n\<ge>no. norm (S n - a) < s" by blast |
|
592 hence "\<forall>n\<ge>no. norm (X (S n) - L) < r" by (simp add: aux as) |
|
593 thus "\<exists>no. \<forall>n\<ge>no. norm (X (S n) - L) < r" .. |
|
594 qed |
|
595 |
|
596 lemma LIMSEQ_SEQ_conv2: |
|
597 fixes a :: real |
|
598 assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
599 shows "X -- a --> L" |
|
600 proof (rule ccontr) |
|
601 assume "\<not> (X -- a --> L)" |
|
602 hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s --> norm (X x - L) < r)" by (unfold LIM_def) |
|
603 hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. \<not>(x \<noteq> a \<and> \<bar>x - a\<bar> < s --> norm (X x - L) < r)" by simp |
|
604 hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> norm (X x - L) \<ge> r)" by (simp add: linorder_not_less) |
|
605 then obtain r where rdef: "r > 0 \<and> (\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> norm (X x - L) \<ge> r))" by auto |
|
606 |
|
607 let ?F = "\<lambda>n::nat. SOME x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> norm (X x - L) \<ge> r" |
|
608 have "\<And>n. \<exists>x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> norm (X x - L) \<ge> r" |
|
609 using rdef by simp |
|
610 hence F: "\<And>n. ?F n \<noteq> a \<and> \<bar>?F n - a\<bar> < inverse (real (Suc n)) \<and> norm (X (?F n) - L) \<ge> r" |
|
611 by (rule someI_ex) |
|
612 hence F1: "\<And>n. ?F n \<noteq> a" |
|
613 and F2: "\<And>n. \<bar>?F n - a\<bar> < inverse (real (Suc n))" |
|
614 and F3: "\<And>n. norm (X (?F n) - L) \<ge> r" |
|
615 by fast+ |
|
616 |
|
617 have "?F ----> a" |
|
618 proof (rule LIMSEQ_I, unfold real_norm_def) |
|
619 fix e::real |
|
620 assume "0 < e" |
|
621 (* choose no such that inverse (real (Suc n)) < e *) |
|
622 then have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean) |
|
623 then obtain m where nodef: "inverse (real (Suc m)) < e" by auto |
|
624 show "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n - a\<bar> < e" |
|
625 proof (intro exI allI impI) |
|
626 fix n |
|
627 assume mlen: "m \<le> n" |
|
628 have "\<bar>?F n - a\<bar> < inverse (real (Suc n))" |
|
629 by (rule F2) |
|
630 also have "inverse (real (Suc n)) \<le> inverse (real (Suc m))" |
|
631 using mlen by auto |
|
632 also from nodef have |
|
633 "inverse (real (Suc m)) < e" . |
|
634 finally show "\<bar>?F n - a\<bar> < e" . |
|
635 qed |
|
636 qed |
|
637 |
|
638 moreover have "\<forall>n. ?F n \<noteq> a" |
|
639 by (rule allI) (rule F1) |
|
640 |
|
641 moreover from prems have "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by simp |
|
642 ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp |
|
643 |
|
644 moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)" |
|
645 proof - |
|
646 { |
|
647 fix no::nat |
|
648 obtain n where "n = no + 1" by simp |
|
649 then have nolen: "no \<le> n" by simp |
|
650 (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *) |
|
651 have "norm (X (?F n) - L) \<ge> r" |
|
652 by (rule F3) |
|
653 with nolen have "\<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> r" by fast |
|
654 } |
|
655 then have "(\<forall>no. \<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> r)" by simp |
|
656 with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> norm (X (?F n) - L) \<ge> e)" by auto |
|
657 thus ?thesis by (unfold LIMSEQ_def, auto simp add: linorder_not_less) |
|
658 qed |
|
659 ultimately show False by simp |
|
660 qed |
|
661 |
|
662 lemma LIMSEQ_SEQ_conv: |
|
663 "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> (a::real) \<longrightarrow> (\<lambda>n. X (S n)) ----> L) = |
|
664 (X -- a --> L)" |
|
665 proof |
|
666 assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" |
|
667 thus "X -- a --> L" by (rule LIMSEQ_SEQ_conv2) |
|
668 next |
|
669 assume "(X -- a --> L)" |
|
670 thus "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1) |
|
671 qed |
|
672 |
|
673 end |
|