64 apply (drule_tac r="r" in LIM_D, safe) |
64 apply (drule_tac r="r" in LIM_D, safe) |
65 apply (rule_tac x="s" in exI, safe) |
65 apply (rule_tac x="s" in exI, safe) |
66 apply (drule_tac x="x + k" in spec) |
66 apply (drule_tac x="x + k" in spec) |
67 apply (simp add: compare_rls) |
67 apply (simp add: compare_rls) |
68 done |
68 done |
|
69 |
|
70 lemma LIM_offset_zero: "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L" |
|
71 by (drule_tac k="a" in LIM_offset, simp add: add_commute) |
|
72 |
|
73 lemma LIM_offset_zero_cancel: "(\<lambda>h. f (a + h)) -- 0 --> L \<Longrightarrow> f -- a --> L" |
|
74 by (drule_tac k="- a" in LIM_offset, simp) |
69 |
75 |
70 lemma LIM_const [simp]: "(%x. k) -- x --> k" |
76 lemma LIM_const [simp]: "(%x. k) -- x --> k" |
71 by (simp add: LIM_def) |
77 by (simp add: LIM_def) |
72 |
78 |
73 lemma LIM_add: |
79 lemma LIM_add: |
114 by (intro LIM_add LIM_minus) |
120 by (intro LIM_add LIM_minus) |
115 |
121 |
116 lemma LIM_diff: |
122 lemma LIM_diff: |
117 "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) - g(x)) -- x --> l-m" |
123 "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) - g(x)) -- x --> l-m" |
118 by (simp only: diff_minus LIM_add LIM_minus) |
124 by (simp only: diff_minus LIM_add LIM_minus) |
|
125 |
|
126 lemma LIM_zero: "f -- a --> l \<Longrightarrow> (\<lambda>x. f x - l) -- a --> 0" |
|
127 by (simp add: LIM_def) |
|
128 |
|
129 lemma LIM_zero_cancel: "(\<lambda>x. f x - l) -- a --> 0 \<Longrightarrow> f -- a --> l" |
|
130 by (simp add: LIM_def) |
119 |
131 |
120 lemma LIM_const_not_eq: |
132 lemma LIM_const_not_eq: |
121 fixes a :: "'a::real_normed_div_algebra" |
133 fixes a :: "'a::real_normed_div_algebra" |
122 shows "k \<noteq> L ==> ~ ((%x. k) -- a --> L)" |
134 shows "k \<noteq> L ==> ~ ((%x. k) -- a --> L)" |
123 apply (simp add: LIM_eq) |
135 apply (simp add: LIM_eq) |
189 "[| (%x. f(x) + -g(x)) -- a --> 0; g -- a --> l |] ==> f -- a --> l" |
201 "[| (%x. f(x) + -g(x)) -- a --> 0; g -- a --> l |] ==> f -- a --> l" |
190 apply (drule LIM_add, assumption) |
202 apply (drule LIM_add, assumption) |
191 apply (auto simp add: add_assoc) |
203 apply (auto simp add: add_assoc) |
192 done |
204 done |
193 |
205 |
|
206 lemma LIM_compose: |
|
207 assumes g: "g -- l --> g l" |
|
208 assumes f: "f -- a --> l" |
|
209 shows "(\<lambda>x. g (f x)) -- a --> g l" |
|
210 proof (rule LIM_I) |
|
211 fix r::real assume r: "0 < r" |
|
212 obtain s where s: "0 < s" |
|
213 and less_r: "\<And>y. \<lbrakk>y \<noteq> l; norm (y - l) < s\<rbrakk> \<Longrightarrow> norm (g y - g l) < r" |
|
214 using LIM_D [OF g r] by fast |
|
215 obtain t where t: "0 < t" |
|
216 and less_s: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (f x - l) < s" |
|
217 using LIM_D [OF f s] by fast |
|
218 |
|
219 show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < t \<longrightarrow> norm (g (f x) - g l) < r" |
|
220 proof (rule exI, safe) |
|
221 show "0 < t" using t . |
|
222 next |
|
223 fix x assume "x \<noteq> a" and "norm (x - a) < t" |
|
224 hence "norm (f x - l) < s" by (rule less_s) |
|
225 thus "norm (g (f x) - g l) < r" |
|
226 using r less_r by (case_tac "f x = l", simp_all) |
|
227 qed |
|
228 qed |
|
229 |
|
230 lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l" |
|
231 unfolding o_def by (rule LIM_compose) |
|
232 |
194 subsubsection {* Purely nonstandard proofs *} |
233 subsubsection {* Purely nonstandard proofs *} |
195 |
234 |
196 lemma NSLIM_I: |
235 lemma NSLIM_I: |
197 "(\<And>x. \<lbrakk>x \<noteq> star_of a; x \<approx> star_of a\<rbrakk> \<Longrightarrow> starfun f x \<approx> star_of L) |
236 "(\<And>x. \<lbrakk>x \<noteq> star_of a; x \<approx> star_of a\<rbrakk> \<Longrightarrow> starfun f x \<approx> star_of L) |
198 \<Longrightarrow> f -- a --NS> L" |
237 \<Longrightarrow> f -- a --NS> L" |
389 by (simp add: LIM_NSLIM_iff NSLIM_inverse) |
428 by (simp add: LIM_NSLIM_iff NSLIM_inverse) |
390 |
429 |
391 lemma LIM_zero2: "f -- a --> l ==> (%x. f(x) + -l) -- a --> 0" |
430 lemma LIM_zero2: "f -- a --> l ==> (%x. f(x) + -l) -- a --> 0" |
392 by (simp add: LIM_NSLIM_iff NSLIM_zero) |
431 by (simp add: LIM_NSLIM_iff NSLIM_zero) |
393 |
432 |
394 lemma LIM_zero_cancel: "(%x. f(x) - l) -- x --> 0 ==> f -- x --> l" |
|
395 apply (drule_tac g = "%x. l" and M = l in LIM_add) |
|
396 apply (auto simp add: diff_minus add_assoc) |
|
397 done |
|
398 |
|
399 lemma LIM_unique2: |
433 lemma LIM_unique2: |
400 fixes a :: real |
434 fixes a :: real |
401 shows "[| f -- a --> L; f -- a --> M |] ==> L = M" |
435 shows "[| f -- a --> L; f -- a --> M |] ==> L = M" |
402 by (simp add: LIM_NSLIM_iff NSLIM_unique) |
436 by (simp add: LIM_NSLIM_iff NSLIM_unique) |
403 |
437 |
409 shows "[| f -- x --> 0; g -- x --> 0 |] ==> (%x. f(x)*g(x)) -- x --> 0" |
443 shows "[| f -- x --> 0; g -- x --> 0 |] ==> (%x. f(x)*g(x)) -- x --> 0" |
410 by (drule LIM_mult2, auto) |
444 by (drule LIM_mult2, auto) |
411 |
445 |
412 |
446 |
413 subsection {* Continuity *} |
447 subsection {* Continuity *} |
|
448 |
|
449 subsubsection {* Purely standard proofs *} |
|
450 |
|
451 lemma LIM_isCont_iff: "(f -- a --> f a) = ((\<lambda>h. f (a + h)) -- 0 --> f a)" |
|
452 by (rule iffI [OF LIM_offset_zero LIM_offset_zero_cancel]) |
|
453 |
|
454 lemma isCont_iff: "isCont f x = (\<lambda>h. f (x + h)) -- 0 --> f x" |
|
455 by (simp add: isCont_def LIM_isCont_iff) |
|
456 |
|
457 lemma isCont_Id: "isCont (\<lambda>x. x) a" |
|
458 unfolding isCont_def by (rule LIM_self) |
|
459 |
|
460 lemma isCont_const [simp]: "isCont (%x. k) a" |
|
461 unfolding isCont_def by (rule LIM_const) |
|
462 |
|
463 lemma isCont_add: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a" |
|
464 unfolding isCont_def by (rule LIM_add) |
|
465 |
|
466 lemma isCont_minus: "isCont f a \<Longrightarrow> isCont (\<lambda>x. - f x) a" |
|
467 unfolding isCont_def by (rule LIM_minus) |
|
468 |
|
469 lemma isCont_diff: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x - g x) a" |
|
470 unfolding isCont_def by (rule LIM_diff) |
|
471 |
|
472 lemma isCont_mult: |
|
473 fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra" |
|
474 shows "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a" |
|
475 unfolding isCont_def by (rule LIM_mult2) |
|
476 |
|
477 lemma isCont_inverse: |
|
478 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" |
|
479 shows "[| isCont f x; f x \<noteq> 0 |] ==> isCont (%x. inverse (f x)) x" |
|
480 unfolding isCont_def by (rule LIM_inverse) |
|
481 |
|
482 lemma isCont_LIM_compose: |
|
483 "\<lbrakk>isCont g l; f -- a --> l\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) -- a --> g l" |
|
484 unfolding isCont_def by (rule LIM_compose) |
|
485 |
|
486 lemma isCont_o2: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. g (f x)) a" |
|
487 unfolding isCont_def by (rule LIM_compose) |
|
488 |
|
489 lemma isCont_o: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (g o f) a" |
|
490 unfolding o_def by (rule isCont_o2) |
|
491 |
|
492 subsubsection {* Nonstandard proofs *} |
414 |
493 |
415 lemma isNSContD: "[| isNSCont f a; y \<approx> hypreal_of_real a |] ==> ( *f* f) y \<approx> hypreal_of_real (f a)" |
494 lemma isNSContD: "[| isNSCont f a; y \<approx> hypreal_of_real a |] ==> ( *f* f) y \<approx> hypreal_of_real (f a)" |
416 by (simp add: isNSCont_def) |
495 by (simp add: isNSCont_def) |
417 |
496 |
418 lemma isNSCont_NSLIM: "isNSCont f a ==> f -- a --NS> (f a) " |
497 lemma isNSCont_NSLIM: "isNSCont f a ==> f -- a --NS> (f a) " |
464 done |
543 done |
465 |
544 |
466 lemma NSLIM_isCont_iff: "(f -- a --NS> f a) = ((%h. f(a + h)) -- 0 --NS> f a)" |
545 lemma NSLIM_isCont_iff: "(f -- a --NS> f a) = ((%h. f(a + h)) -- 0 --NS> f a)" |
467 by (rule NSLIM_h_iff) |
546 by (rule NSLIM_h_iff) |
468 |
547 |
469 lemma LIM_isCont_iff: "(f -- a --> f a) = ((%h. f(a + h)) -- 0 --> f(a))" |
|
470 by (simp add: LIM_NSLIM_iff NSLIM_isCont_iff) |
|
471 |
|
472 lemma isCont_iff: "(isCont f x) = ((%h. f(x + h)) -- 0 --> f(x))" |
|
473 by (simp add: isCont_def LIM_isCont_iff) |
|
474 |
|
475 text{*Immediate application of nonstandard criterion for continuity can offer |
|
476 very simple proofs of some standard property of continuous functions*} |
|
477 text{*sum continuous*} |
|
478 lemma isCont_add: "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) + g(x)) a" |
|
479 by (auto intro: approx_add simp add: isNSCont_isCont_iff [symmetric] isNSCont_def) |
|
480 |
|
481 text{*mult continuous*} |
|
482 lemma isCont_mult: |
|
483 fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_algebra" |
|
484 shows "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) * g(x)) a" |
|
485 by (auto intro!: starfun_mult_HFinite_approx |
|
486 simp del: starfun_mult [symmetric] |
|
487 simp add: isNSCont_isCont_iff [symmetric] isNSCont_def) |
|
488 |
|
489 text{*composition of continuous functions |
|
490 Note very short straightforard proof!*} |
|
491 lemma isCont_o: "[| isCont f a; isCont g (f a) |] ==> isCont (g o f) a" |
|
492 by (auto simp add: isNSCont_isCont_iff [symmetric] isNSCont_def starfun_o [symmetric]) |
|
493 |
|
494 lemma isCont_o2: "[| isCont f a; isCont g (f a) |] ==> isCont (%x. g (f x)) a" |
|
495 by (auto dest: isCont_o simp add: o_def) |
|
496 |
|
497 lemma isNSCont_minus: "isNSCont f a ==> isNSCont (%x. - f x) a" |
548 lemma isNSCont_minus: "isNSCont f a ==> isNSCont (%x. - f x) a" |
498 by (simp add: isNSCont_def) |
549 by (simp add: isNSCont_def) |
499 |
|
500 lemma isCont_minus: "isCont f a ==> isCont (%x. - f x) a" |
|
501 by (auto simp add: isNSCont_isCont_iff [symmetric] isNSCont_minus) |
|
502 |
|
503 lemma isCont_inverse: |
|
504 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" |
|
505 shows "[| isCont f x; f x \<noteq> 0 |] ==> isCont (%x. inverse (f x)) x" |
|
506 apply (simp add: isCont_def) |
|
507 apply (blast intro: LIM_inverse) |
|
508 done |
|
509 |
550 |
510 lemma isNSCont_inverse: |
551 lemma isNSCont_inverse: |
511 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" |
552 fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::real_normed_div_algebra" |
512 shows "[| isNSCont f x; f x \<noteq> 0 |] ==> isNSCont (%x. inverse (f x)) x" |
553 shows "[| isNSCont f x; f x \<noteq> 0 |] ==> isNSCont (%x. inverse (f x)) x" |
513 by (auto intro: isCont_inverse simp add: isNSCont_isCont_iff) |
554 by (auto intro: isCont_inverse simp add: isNSCont_isCont_iff) |
514 |
|
515 lemma isCont_diff: |
|
516 "[| isCont f a; isCont g a |] ==> isCont (%x. f(x) - g(x)) a" |
|
517 apply (simp add: diff_minus) |
|
518 apply (auto intro: isCont_add isCont_minus) |
|
519 done |
|
520 |
|
521 lemma isCont_Id: "isCont (\<lambda>x. x) a" |
|
522 by (simp only: isCont_def LIM_self) |
|
523 |
|
524 lemma isCont_const [simp]: "isCont (%x. k) a" |
|
525 by (simp add: isCont_def) |
|
526 |
555 |
527 lemma isNSCont_const [simp]: "isNSCont (%x. k) a" |
556 lemma isNSCont_const [simp]: "isNSCont (%x. k) a" |
528 by (simp add: isNSCont_def) |
557 by (simp add: isNSCont_def) |
529 |
558 |
530 lemma isNSCont_abs [simp]: "isNSCont abs (a::real)" |
559 lemma isNSCont_abs [simp]: "isNSCont abs (a::real)" |
645 qed |
674 qed |
646 thus "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r" |
675 thus "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r" |
647 by transfer |
676 by transfer |
648 qed |
677 qed |
649 |
678 |
650 lemma LIM_compose: |
|
651 assumes g: "isCont g l" |
|
652 assumes f: "f -- a --> l" |
|
653 shows "(\<lambda>x. g (f x)) -- a --> g l" |
|
654 proof (rule LIM_I) |
|
655 fix r::real assume r: "0 < r" |
|
656 obtain s where s: "0 < s" |
|
657 and less_r: "\<And>y. \<lbrakk>y \<noteq> l; norm (y - l) < s\<rbrakk> \<Longrightarrow> norm (g y - g l) < r" |
|
658 using LIM_D [OF g [unfolded isCont_def] r] by fast |
|
659 obtain t where t: "0 < t" |
|
660 and less_s: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < t\<rbrakk> \<Longrightarrow> norm (f x - l) < s" |
|
661 using LIM_D [OF f s] by fast |
|
662 |
|
663 show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < t \<longrightarrow> norm (g (f x) - g l) < r" |
|
664 proof (rule exI, safe) |
|
665 show "0 < t" using t . |
|
666 next |
|
667 fix x assume "x \<noteq> a" and "norm (x - a) < t" |
|
668 hence "norm (f x - l) < s" by (rule less_s) |
|
669 thus "norm (g (f x) - g l) < r" |
|
670 using r less_r by (case_tac "f x = l", simp_all) |
|
671 qed |
|
672 qed |
|
673 |
|
674 subsection {* Relation of LIM and LIMSEQ *} |
679 subsection {* Relation of LIM and LIMSEQ *} |
675 |
680 |
676 lemma LIMSEQ_SEQ_conv1: |
681 lemma LIMSEQ_SEQ_conv1: |
677 fixes a :: "'a::real_normed_vector" |
682 fixes a :: "'a::real_normed_vector" |
678 assumes X: "X -- a --> L" |
683 assumes X: "X -- a --> L" |