src/HOL/Lim.thy
author huffman
Mon, 01 Jun 2009 07:57:37 -0700
changeset 31353 14a58e2ca374
parent 31349 2261c8781f73
child 31355 3d18766ddc4b
permissions -rw-r--r--
add [code del] declarations
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     1
(*  Title       : Lim.thy
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     2
    Author      : Jacques D. Fleuriot
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     3
    Copyright   : 1998  University of Cambridge
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
     4
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     5
*)
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     6
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
     7
header{* Limits and Continuity *}
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
     8
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15086
diff changeset
     9
theory Lim
29197
6d4cb27ed19c adapted HOL source structure to distribution layout
haftmann
parents: 28952
diff changeset
    10
imports SEQ
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15086
diff changeset
    11
begin
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    12
22641
a5dc96fad632 moved nonstandard limit stuff from Lim.thy into new theory HLim.thy
huffman
parents: 22637
diff changeset
    13
text{*Standard Definitions*}
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    14
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    15
definition
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    16
  at :: "'a::metric_space \<Rightarrow> 'a filter" where
31353
14a58e2ca374 add [code del] declarations
huffman
parents: 31349
diff changeset
    17
  [code del]: "at a = Abs_filter (\<lambda>P. \<exists>r>0. \<forall>x. x \<noteq> a \<and> dist x a < r \<longrightarrow> P x)"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    18
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    19
definition
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    20
  LIM :: "['a::metric_space \<Rightarrow> 'b::metric_space, 'a, 'b] \<Rightarrow> bool"
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21399
diff changeset
    21
        ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where
28562
4e74209f113e `code func` now just `code`
haftmann
parents: 27435
diff changeset
    22
  [code del]: "f -- a --> L =
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    23
     (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & dist x a < s
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    24
        --> dist (f x) L < r)"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    25
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21399
diff changeset
    26
definition
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    27
  isCont :: "['a::metric_space \<Rightarrow> 'b::metric_space, 'a] \<Rightarrow> bool" where
19765
dfe940911617 misc cleanup;
wenzelm
parents: 19023
diff changeset
    28
  "isCont f a = (f -- a --> (f a))"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    29
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21399
diff changeset
    30
definition
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    31
  isUCont :: "['a::metric_space \<Rightarrow> 'b::metric_space] \<Rightarrow> bool" where
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    32
  [code del]: "isUCont f = (\<forall>r>0. \<exists>s>0. \<forall>x y. dist x y < s \<longrightarrow> dist (f x) (f y) < r)"
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    33
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    34
subsection {* Neighborhood Filter *}
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    35
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    36
lemma eventually_at:
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    37
  "eventually P (at a) \<longleftrightarrow> (\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> P x)"
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    38
unfolding at_def
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    39
apply (rule eventually_Abs_filter)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    40
apply (rule_tac x=1 in exI, simp)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    41
apply (clarify, rule_tac x=r in exI, simp)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    42
apply (clarify, rename_tac r s)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    43
apply (rule_tac x="min r s" in exI, simp)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    44
done
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    45
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    46
lemma LIM_conv_tendsto: "(f -- a --> L) \<longleftrightarrow> tendsto f L (at a)"
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
    47
unfolding LIM_def tendsto_def eventually_at ..
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
    48
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
    49
subsection {* Limits of Functions *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    50
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    51
lemma metric_LIM_I:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    52
  "(\<And>r. 0 < r \<Longrightarrow> \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    53
    \<Longrightarrow> f -- a --> L"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    54
by (simp add: LIM_def)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    55
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    56
lemma metric_LIM_D:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    57
  "\<lbrakk>f -- a --> L; 0 < r\<rbrakk>
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    58
    \<Longrightarrow> \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    59
by (simp add: LIM_def)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    60
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    61
lemma LIM_eq:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    62
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    63
  shows "f -- a --> L =
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    64
     (\<forall>r>0.\<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    65
by (simp add: LIM_def dist_norm)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    66
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    67
lemma LIM_I:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    68
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    69
  shows "(!!r. 0<r ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    70
      ==> f -- a --> L"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    71
by (simp add: LIM_eq)
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
    72
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    73
lemma LIM_D:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    74
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    75
  shows "[| f -- a --> L; 0<r |]
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
    76
      ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    77
by (simp add: LIM_eq)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
    78
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    79
lemma LIM_offset:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    80
  fixes a :: "'a::real_normed_vector" and L :: "'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    81
  shows "f -- a --> L \<Longrightarrow> (\<lambda>x. f (x + k)) -- a - k --> L"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    82
unfolding LIM_def dist_norm
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    83
apply clarify
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    84
apply (drule_tac x="r" in spec, safe)
20756
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    85
apply (rule_tac x="s" in exI, safe)
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    86
apply (drule_tac x="x + k" in spec)
29667
53103fc8ffa3 Replaced group_ and ring_simps by algebra_simps;
nipkow
parents: 29197
diff changeset
    87
apply (simp add: algebra_simps)
20756
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    88
done
fec7f5834ffe more reorganizing sections
huffman
parents: 20755
diff changeset
    89
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    90
lemma LIM_offset_zero:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    91
  fixes a :: "'a::real_normed_vector" and L :: "'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    92
  shows "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    93
by (drule_tac k="a" in LIM_offset, simp add: add_commute)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    94
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    95
lemma LIM_offset_zero_cancel:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    96
  fixes a :: "'a::real_normed_vector" and L :: "'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
    97
  shows "(\<lambda>h. f (a + h)) -- 0 --> L \<Longrightarrow> f -- a --> L"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    98
by (drule_tac k="- a" in LIM_offset, simp)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
    99
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   100
lemma LIM_const [simp]: "(%x. k) -- x --> k"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   101
by (simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   102
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   103
lemma LIM_add:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   104
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   105
  assumes f: "f -- a --> L" and g: "g -- a --> M"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   106
  shows "(\<lambda>x. f x + g x) -- a --> (L + M)"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   107
using assms unfolding LIM_conv_tendsto by (rule tendsto_add)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   108
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   109
lemma LIM_add_zero:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   110
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   111
  shows "\<lbrakk>f -- a --> 0; g -- a --> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) -- a --> 0"
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   112
by (drule (1) LIM_add, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   113
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   114
lemma minus_diff_minus:
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   115
  fixes a b :: "'a::ab_group_add"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   116
  shows "(- a) - (- b) = - (a - b)"
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   117
by simp
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   118
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   119
lemma LIM_minus:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   120
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   121
  shows "f -- a --> L \<Longrightarrow> (\<lambda>x. - f x) -- a --> - L"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   122
unfolding LIM_conv_tendsto by (rule tendsto_minus)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   123
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   124
(* TODO: delete *)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   125
lemma LIM_add_minus:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   126
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   127
  shows "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)"
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   128
by (intro LIM_add LIM_minus)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   129
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   130
lemma LIM_diff:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   131
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   132
  shows "\<lbrakk>f -- x --> l; g -- x --> m\<rbrakk> \<Longrightarrow> (\<lambda>x. f x - g x) -- x --> l - m"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   133
unfolding LIM_conv_tendsto by (rule tendsto_diff)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   134
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   135
lemma LIM_zero:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   136
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   137
  shows "f -- a --> l \<Longrightarrow> (\<lambda>x. f x - l) -- a --> 0"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   138
by (simp add: LIM_def dist_norm)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   139
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   140
lemma LIM_zero_cancel:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   141
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   142
  shows "(\<lambda>x. f x - l) -- a --> 0 \<Longrightarrow> f -- a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   143
by (simp add: LIM_def dist_norm)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   144
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   145
lemma LIM_zero_iff:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   146
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   147
  shows "(\<lambda>x. f x - l) -- a --> 0 = f -- a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   148
by (simp add: LIM_def dist_norm)
21399
700ae58d2273 add lemmas LIM_zero_iff, LIM_norm_zero_iff
huffman
parents: 21282
diff changeset
   149
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   150
lemma metric_LIM_imp_LIM:
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   151
  assumes f: "f -- a --> l"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   152
  assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> dist (g x) m \<le> dist (f x) l"
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   153
  shows "g -- a --> m"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   154
apply (rule metric_LIM_I, drule metric_LIM_D [OF f], safe)
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   155
apply (rule_tac x="s" in exI, safe)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   156
apply (drule_tac x="x" in spec, safe)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   157
apply (erule (1) order_le_less_trans [OF le])
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   158
done
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   159
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   160
lemma LIM_imp_LIM:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   161
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   162
  fixes g :: "'a::metric_space \<Rightarrow> 'c::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   163
  assumes f: "f -- a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   164
  assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> norm (g x - m) \<le> norm (f x - l)"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   165
  shows "g -- a --> m"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   166
apply (rule metric_LIM_imp_LIM [OF f])
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   167
apply (simp add: dist_norm le)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   168
done
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   169
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   170
lemma LIM_norm:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   171
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   172
  shows "f -- a --> l \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> norm l"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   173
unfolding LIM_conv_tendsto by (rule tendsto_norm)
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   174
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   175
lemma LIM_norm_zero:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   176
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   177
  shows "f -- a --> 0 \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> 0"
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   178
by (drule LIM_norm, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   179
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   180
lemma LIM_norm_zero_cancel:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   181
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   182
  shows "(\<lambda>x. norm (f x)) -- a --> 0 \<Longrightarrow> f -- a --> 0"
21257
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   183
by (erule LIM_imp_LIM, simp)
b7f090c5057d added LIM_norm and related lemmas
huffman
parents: 21239
diff changeset
   184
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   185
lemma LIM_norm_zero_iff:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   186
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   187
  shows "(\<lambda>x. norm (f x)) -- a --> 0 = f -- a --> 0"
21399
700ae58d2273 add lemmas LIM_zero_iff, LIM_norm_zero_iff
huffman
parents: 21282
diff changeset
   188
by (rule iffI [OF LIM_norm_zero_cancel LIM_norm_zero])
700ae58d2273 add lemmas LIM_zero_iff, LIM_norm_zero_iff
huffman
parents: 21282
diff changeset
   189
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   190
lemma LIM_rabs: "f -- a --> (l::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> \<bar>l\<bar>"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   191
by (fold real_norm_def, rule LIM_norm)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   192
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   193
lemma LIM_rabs_zero: "f -- a --> (0::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> 0"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   194
by (fold real_norm_def, rule LIM_norm_zero)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   195
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   196
lemma LIM_rabs_zero_cancel: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) \<Longrightarrow> f -- a --> 0"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   197
by (fold real_norm_def, rule LIM_norm_zero_cancel)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   198
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   199
lemma LIM_rabs_zero_iff: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) = f -- a --> 0"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   200
by (fold real_norm_def, rule LIM_norm_zero_iff)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   201
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   202
lemma LIM_const_not_eq:
23076
1b2acb3ccb29 generalize uniqueness of limits to class real_normed_algebra_1
huffman
parents: 23069
diff changeset
   203
  fixes a :: "'a::real_normed_algebra_1"
1b2acb3ccb29 generalize uniqueness of limits to class real_normed_algebra_1
huffman
parents: 23069
diff changeset
   204
  shows "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) -- a --> L"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   205
apply (simp add: LIM_def)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   206
apply (rule_tac x="dist k L" in exI, simp add: zero_less_dist_iff, safe)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   207
apply (rule_tac x="a + of_real (s/2)" in exI, simp add: dist_norm)
20552
2c31dd358c21 generalized types of many constants to work over arbitrary vector spaces;
huffman
parents: 20432
diff changeset
   208
done
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   209
21786
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   210
lemmas LIM_not_zero = LIM_const_not_eq [where L = 0]
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   211
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   212
lemma LIM_const_eq:
23076
1b2acb3ccb29 generalize uniqueness of limits to class real_normed_algebra_1
huffman
parents: 23069
diff changeset
   213
  fixes a :: "'a::real_normed_algebra_1"
1b2acb3ccb29 generalize uniqueness of limits to class real_normed_algebra_1
huffman
parents: 23069
diff changeset
   214
  shows "(\<lambda>x. k) -- a --> L \<Longrightarrow> k = L"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   215
apply (rule ccontr)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   216
apply (blast dest: LIM_const_not_eq)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   217
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   218
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   219
lemma LIM_unique:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   220
  fixes a :: "'a::real_normed_algebra_1" -- {* TODO: find a more appropriate class *}
23076
1b2acb3ccb29 generalize uniqueness of limits to class real_normed_algebra_1
huffman
parents: 23069
diff changeset
   221
  shows "\<lbrakk>f -- a --> L; f -- a --> M\<rbrakk> \<Longrightarrow> L = M"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   222
apply (rule ccontr)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   223
apply (drule_tac r="dist L M / 2" in metric_LIM_D, simp add: zero_less_dist_iff)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   224
apply (drule_tac r="dist L M / 2" in metric_LIM_D, simp add: zero_less_dist_iff)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   225
apply (clarify, rename_tac r s)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   226
apply (subgoal_tac "min r s \<noteq> 0")
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   227
apply (subgoal_tac "dist L M < dist L M / 2 + dist L M / 2", simp)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   228
apply (subgoal_tac "dist L M \<le> dist (f (a + of_real (min r s / 2))) L +
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   229
                               dist (f (a + of_real (min r s / 2))) M")
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   230
apply (erule le_less_trans, rule add_strict_mono)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   231
apply (drule spec, erule mp, simp add: dist_norm)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   232
apply (drule spec, erule mp, simp add: dist_norm)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   233
apply (subst dist_commute, rule dist_triangle)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   234
apply simp
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   235
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   236
23069
cdfff0241c12 rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents: 23040
diff changeset
   237
lemma LIM_ident [simp]: "(\<lambda>x. x) -- a --> a"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   238
by (auto simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   239
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   240
text{*Limits are equal for functions equal except at limit point*}
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   241
lemma LIM_equal:
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   242
     "[| \<forall>x. x \<noteq> a --> (f x = g x) |] ==> (f -- a --> l) = (g -- a --> l)"
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   243
by (simp add: LIM_def)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   244
20796
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   245
lemma LIM_cong:
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   246
  "\<lbrakk>a = b; \<And>x. x \<noteq> b \<Longrightarrow> f x = g x; l = m\<rbrakk>
21399
700ae58d2273 add lemmas LIM_zero_iff, LIM_norm_zero_iff
huffman
parents: 21282
diff changeset
   247
   \<Longrightarrow> ((\<lambda>x. f x) -- a --> l) = ((\<lambda>x. g x) -- b --> m)"
20796
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   248
by (simp add: LIM_def)
257e01fab4b7 generalize proofs of DERIV_isCont and DERIV_mult
huffman
parents: 20795
diff changeset
   249
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   250
lemma metric_LIM_equal2:
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   251
  assumes 1: "0 < R"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   252
  assumes 2: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < R\<rbrakk> \<Longrightarrow> f x = g x"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   253
  shows "g -- a --> l \<Longrightarrow> f -- a --> l"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   254
apply (unfold LIM_def, safe)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   255
apply (drule_tac x="r" in spec, safe)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   256
apply (rule_tac x="min s R" in exI, safe)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   257
apply (simp add: 1)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   258
apply (simp add: 2)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   259
done
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   260
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   261
lemma LIM_equal2:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   262
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   263
  assumes 1: "0 < R"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   264
  assumes 2: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < R\<rbrakk> \<Longrightarrow> f x = g x"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   265
  shows "g -- a --> l \<Longrightarrow> f -- a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   266
apply (unfold LIM_def dist_norm, safe)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   267
apply (drule_tac x="r" in spec, safe)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   268
apply (rule_tac x="min s R" in exI, safe)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   269
apply (simp add: 1)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   270
apply (simp add: 2)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   271
done
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   272
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   273
text{*Two uses in Transcendental.ML*}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   274
lemma LIM_trans:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   275
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   276
  shows "[| (%x. f(x) + -g(x)) -- a --> 0;  g -- a --> l |] ==> f -- a --> l"
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   277
apply (drule LIM_add, assumption)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   278
apply (auto simp add: add_assoc)
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   279
done
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   280
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   281
lemma LIM_compose:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   282
  assumes g: "g -- l --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   283
  assumes f: "f -- a --> l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   284
  shows "(\<lambda>x. g (f x)) -- a --> g l"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   285
proof (rule metric_LIM_I)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   286
  fix r::real assume r: "0 < r"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   287
  obtain s where s: "0 < s"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   288
    and less_r: "\<And>y. \<lbrakk>y \<noteq> l; dist y l < s\<rbrakk> \<Longrightarrow> dist (g y) (g l) < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   289
    using metric_LIM_D [OF g r] by fast
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   290
  obtain t where t: "0 < t"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   291
    and less_s: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < t\<rbrakk> \<Longrightarrow> dist (f x) l < s"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   292
    using metric_LIM_D [OF f s] by fast
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   293
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   294
  show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> dist x a < t \<longrightarrow> dist (g (f x)) (g l) < r"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   295
  proof (rule exI, safe)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   296
    show "0 < t" using t .
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   297
  next
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   298
    fix x assume "x \<noteq> a" and "dist x a < t"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   299
    hence "dist (f x) l < s" by (rule less_s)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   300
    thus "dist (g (f x)) (g l) < r"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   301
      using r less_r by (case_tac "f x = l", simp_all)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   302
  qed
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   303
qed
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   304
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   305
lemma metric_LIM_compose2:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   306
  assumes f: "f -- a --> b"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   307
  assumes g: "g -- b --> c"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   308
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> b"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   309
  shows "(\<lambda>x. g (f x)) -- a --> c"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   310
proof (rule metric_LIM_I)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   311
  fix r :: real
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   312
  assume r: "0 < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   313
  obtain s where s: "0 < s"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   314
    and less_r: "\<And>y. \<lbrakk>y \<noteq> b; dist y b < s\<rbrakk> \<Longrightarrow> dist (g y) c < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   315
    using metric_LIM_D [OF g r] by fast
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   316
  obtain t where t: "0 < t"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   317
    and less_s: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < t\<rbrakk> \<Longrightarrow> dist (f x) b < s"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   318
    using metric_LIM_D [OF f s] by fast
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   319
  obtain d where d: "0 < d"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   320
    and neq_b: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < d\<rbrakk> \<Longrightarrow> f x \<noteq> b"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   321
    using inj by fast
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   322
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   323
  show "\<exists>t>0. \<forall>x. x \<noteq> a \<and> dist x a < t \<longrightarrow> dist (g (f x)) c < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   324
  proof (safe intro!: exI)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   325
    show "0 < min d t" using d t by simp
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   326
  next
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   327
    fix x
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   328
    assume "x \<noteq> a" and "dist x a < min d t"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   329
    hence "f x \<noteq> b" and "dist (f x) b < s"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   330
      using neq_b less_s by simp_all
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   331
    thus "dist (g (f x)) c < r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   332
      by (rule less_r)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   333
  qed
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   334
qed
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   335
23040
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   336
lemma LIM_compose2:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   337
  fixes a :: "'a::real_normed_vector"
23040
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   338
  assumes f: "f -- a --> b"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   339
  assumes g: "g -- b --> c"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   340
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> b"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   341
  shows "(\<lambda>x. g (f x)) -- a --> c"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   342
by (rule metric_LIM_compose2 [OF f g inj [folded dist_norm]])
23040
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   343
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   344
lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l"
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   345
unfolding o_def by (rule LIM_compose)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   346
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   347
lemma real_LIM_sandwich_zero:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   348
  fixes f g :: "'a::metric_space \<Rightarrow> real"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   349
  assumes f: "f -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   350
  assumes 1: "\<And>x. x \<noteq> a \<Longrightarrow> 0 \<le> g x"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   351
  assumes 2: "\<And>x. x \<noteq> a \<Longrightarrow> g x \<le> f x"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   352
  shows "g -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   353
proof (rule LIM_imp_LIM [OF f])
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   354
  fix x assume x: "x \<noteq> a"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   355
  have "norm (g x - 0) = g x" by (simp add: 1 x)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   356
  also have "g x \<le> f x" by (rule 2 [OF x])
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   357
  also have "f x \<le> \<bar>f x\<bar>" by (rule abs_ge_self)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   358
  also have "\<bar>f x\<bar> = norm (f x - 0)" by simp
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   359
  finally show "norm (g x - 0) \<le> norm (f x - 0)" .
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   360
qed
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   361
22442
15d9ed9b5051 move bounded (bi)linear operator locales from Lim.thy to RealVector.thy
huffman
parents: 21810
diff changeset
   362
text {* Bounded Linear Operators *}
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   363
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   364
lemma (in bounded_linear) LIM:
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   365
  "g -- a --> l \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> f l"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   366
unfolding LIM_conv_tendsto by (rule tendsto)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   367
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   368
lemma (in bounded_linear) cont: "f -- a --> f a"
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   369
by (rule LIM [OF LIM_ident])
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   370
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   371
lemma (in bounded_linear) LIM_zero:
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   372
  "g -- a --> 0 \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   373
by (drule LIM, simp only: zero)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   374
22442
15d9ed9b5051 move bounded (bi)linear operator locales from Lim.thy to RealVector.thy
huffman
parents: 21810
diff changeset
   375
text {* Bounded Bilinear Operators *}
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   376
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   377
lemma (in bounded_bilinear) LIM:
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   378
  "\<lbrakk>f -- a --> L; g -- a --> M\<rbrakk> \<Longrightarrow> (\<lambda>x. f x ** g x) -- a --> L ** M"
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   379
unfolding LIM_conv_tendsto by (rule tendsto)
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   380
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   381
lemma (in bounded_bilinear) LIM_prod_zero:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   382
  fixes a :: "'d::metric_space"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   383
  assumes f: "f -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   384
  assumes g: "g -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   385
  shows "(\<lambda>x. f x ** g x) -- a --> 0"
31349
2261c8781f73 new theory of filters and limits; prove LIMSEQ and LIM lemmas using filters
huffman
parents: 31338
diff changeset
   386
using LIM [OF f g] by (simp add: zero_left)
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   387
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   388
lemma (in bounded_bilinear) LIM_left_zero:
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   389
  "f -- a --> 0 \<Longrightarrow> (\<lambda>x. f x ** c) -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   390
by (rule bounded_linear.LIM_zero [OF bounded_linear_left])
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   391
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   392
lemma (in bounded_bilinear) LIM_right_zero:
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   393
  "f -- a --> 0 \<Longrightarrow> (\<lambda>x. c ** f x) -- a --> 0"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   394
by (rule bounded_linear.LIM_zero [OF bounded_linear_right])
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   395
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   396
lemmas LIM_mult = mult.LIM
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   397
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   398
lemmas LIM_mult_zero = mult.LIM_prod_zero
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   399
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   400
lemmas LIM_mult_left_zero = mult.LIM_left_zero
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   401
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   402
lemmas LIM_mult_right_zero = mult.LIM_right_zero
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   403
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   404
lemmas LIM_scaleR = scaleR.LIM
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   405
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   406
lemmas LIM_of_real = of_real.LIM
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   407
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   408
lemma LIM_power:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   409
  fixes f :: "'a::metric_space \<Rightarrow> 'b::{power,real_normed_algebra}"
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   410
  assumes f: "f -- a --> l"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   411
  shows "(\<lambda>x. f x ^ n) -- a --> l ^ n"
30273
ecd6f0ca62ea declare power_Suc [simp]; remove redundant type-specific versions of power_Suc
huffman
parents: 29885
diff changeset
   412
by (induct n, simp, simp add: LIM_mult f)
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   413
22641
a5dc96fad632 moved nonstandard limit stuff from Lim.thy into new theory HLim.thy
huffman
parents: 22637
diff changeset
   414
subsubsection {* Derived theorems about @{term LIM} *}
a5dc96fad632 moved nonstandard limit stuff from Lim.thy into new theory HLim.thy
huffman
parents: 22637
diff changeset
   415
22637
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   416
lemma LIM_inverse_lemma:
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   417
  fixes x :: "'a::real_normed_div_algebra"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   418
  assumes r: "0 < r"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   419
  assumes x: "norm (x - 1) < min (1/2) (r/2)"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   420
  shows "norm (inverse x - 1) < r"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   421
proof -
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   422
  from r have r2: "0 < r/2" by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   423
  from x have 0: "x \<noteq> 0" by clarsimp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   424
  from x have x': "norm (1 - x) < min (1/2) (r/2)"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   425
    by (simp only: norm_minus_commute)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   426
  hence less1: "norm (1 - x) < r/2" by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   427
  have "norm (1::'a) - norm x \<le> norm (1 - x)" by (rule norm_triangle_ineq2)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   428
  also from x' have "norm (1 - x) < 1/2" by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   429
  finally have "1/2 < norm x" by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   430
  hence "inverse (norm x) < inverse (1/2)"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   431
    by (rule less_imp_inverse_less, simp)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   432
  hence less2: "norm (inverse x) < 2"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   433
    by (simp add: nonzero_norm_inverse 0)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   434
  from less1 less2 r2 norm_ge_zero
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   435
  have "norm (1 - x) * norm (inverse x) < (r/2) * 2"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   436
    by (rule mult_strict_mono)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   437
  thus "norm (inverse x - 1) < r"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   438
    by (simp only: norm_mult [symmetric] left_diff_distrib, simp add: 0)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   439
qed
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   440
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   441
lemma LIM_inverse_fun:
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   442
  assumes a: "a \<noteq> (0::'a::real_normed_div_algebra)"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   443
  shows "inverse -- a --> inverse a"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   444
proof (rule LIM_equal2)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   445
  from a show "0 < norm a" by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   446
next
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   447
  fix x assume "norm (x - a) < norm a"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   448
  hence "x \<noteq> 0" by auto
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   449
  with a show "inverse x = inverse (inverse a * x) * inverse a"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   450
    by (simp add: nonzero_inverse_mult_distrib
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   451
                  nonzero_imp_inverse_nonzero
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   452
                  nonzero_inverse_inverse_eq mult_assoc)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   453
next
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   454
  have 1: "inverse -- 1 --> inverse (1::'a)"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   455
    apply (rule LIM_I)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   456
    apply (rule_tac x="min (1/2) (r/2)" in exI)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   457
    apply (simp add: LIM_inverse_lemma)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   458
    done
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   459
  have "(\<lambda>x. inverse a * x) -- a --> inverse a * a"
23069
cdfff0241c12 rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents: 23040
diff changeset
   460
    by (intro LIM_mult LIM_ident LIM_const)
22637
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   461
  hence "(\<lambda>x. inverse a * x) -- a --> 1"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   462
    by (simp add: a)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   463
  with 1 have "(\<lambda>x. inverse (inverse a * x)) -- a --> inverse 1"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   464
    by (rule LIM_compose)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   465
  hence "(\<lambda>x. inverse (inverse a * x)) -- a --> 1"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   466
    by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   467
  hence "(\<lambda>x. inverse (inverse a * x) * inverse a) -- a --> 1 * inverse a"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   468
    by (intro LIM_mult LIM_const)
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   469
  thus "(\<lambda>x. inverse (inverse a * x) * inverse a) -- a --> inverse a"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   470
    by simp
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   471
qed
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   472
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   473
lemma LIM_inverse:
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   474
  fixes L :: "'a::real_normed_div_algebra"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   475
  shows "\<lbrakk>f -- a --> L; L \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (f x)) -- a --> inverse L"
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   476
by (rule LIM_inverse_fun [THEN LIM_compose])
3f158760b68f new standard proof of lemma LIM_inverse
huffman
parents: 22631
diff changeset
   477
29885
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   478
lemma LIM_sgn:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   479
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   480
  shows "\<lbrakk>f -- a --> l; l \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. sgn (f x)) -- a --> sgn l"
29885
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   481
unfolding sgn_div_norm
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   482
by (simp add: LIM_scaleR LIM_inverse LIM_norm)
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   483
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   484
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   485
subsection {* Continuity *}
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   486
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   487
lemma LIM_isCont_iff:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   488
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   489
  shows "(f -- a --> f a) = ((\<lambda>h. f (a + h)) -- 0 --> f a)"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   490
by (rule iffI [OF LIM_offset_zero LIM_offset_zero_cancel])
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   491
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   492
lemma isCont_iff:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   493
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::metric_space"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   494
  shows "isCont f x = (\<lambda>h. f (x + h)) -- 0 --> f x"
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   495
by (simp add: isCont_def LIM_isCont_iff)
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   496
23069
cdfff0241c12 rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents: 23040
diff changeset
   497
lemma isCont_ident [simp]: "isCont (\<lambda>x. x) a"
cdfff0241c12 rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents: 23040
diff changeset
   498
  unfolding isCont_def by (rule LIM_ident)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   499
21786
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   500
lemma isCont_const [simp]: "isCont (\<lambda>x. k) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   501
  unfolding isCont_def by (rule LIM_const)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   502
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   503
lemma isCont_norm:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   504
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   505
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. norm (f x)) a"
21786
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   506
  unfolding isCont_def by (rule LIM_norm)
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   507
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   508
lemma isCont_rabs: "isCont f a \<Longrightarrow> isCont (\<lambda>x. \<bar>f x :: real\<bar>) a"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   509
  unfolding isCont_def by (rule LIM_rabs)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   510
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   511
lemma isCont_add:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   512
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   513
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   514
  unfolding isCont_def by (rule LIM_add)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   515
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   516
lemma isCont_minus:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   517
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   518
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. - f x) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   519
  unfolding isCont_def by (rule LIM_minus)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   520
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   521
lemma isCont_diff:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   522
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   523
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x - g x) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   524
  unfolding isCont_def by (rule LIM_diff)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   525
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   526
lemma isCont_mult:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   527
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_algebra"
21786
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   528
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x * g x) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   529
  unfolding isCont_def by (rule LIM_mult)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   530
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   531
lemma isCont_inverse:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   532
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_div_algebra"
21786
66da6af2b0c9 cleaned up; generalized some proofs
huffman
parents: 21733
diff changeset
   533
  shows "\<lbrakk>isCont f a; f a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. inverse (f x)) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   534
  unfolding isCont_def by (rule LIM_inverse)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   535
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   536
lemma isCont_LIM_compose:
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   537
  "\<lbrakk>isCont g l; f -- a --> l\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) -- a --> g l"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   538
  unfolding isCont_def by (rule LIM_compose)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   539
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   540
lemma metric_isCont_LIM_compose2:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   541
  assumes f [unfolded isCont_def]: "isCont f a"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   542
  assumes g: "g -- f a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   543
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> f a"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   544
  shows "(\<lambda>x. g (f x)) -- a --> l"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   545
by (rule metric_LIM_compose2 [OF f g inj])
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   546
23040
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   547
lemma isCont_LIM_compose2:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   548
  fixes a :: "'a::real_normed_vector"
23040
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   549
  assumes f [unfolded isCont_def]: "isCont f a"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   550
  assumes g: "g -- f a --> l"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   551
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> f a"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   552
  shows "(\<lambda>x. g (f x)) -- a --> l"
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   553
by (rule LIM_compose2 [OF f g inj])
d329182b5966 add lemmas LIM_compose2, isCont_LIM_compose2
huffman
parents: 23012
diff changeset
   554
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   555
lemma isCont_o2: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   556
  unfolding isCont_def by (rule LIM_compose)
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   557
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   558
lemma isCont_o: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (g o f) a"
21282
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   559
  unfolding o_def by (rule isCont_o2)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   560
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   561
lemma (in bounded_linear) isCont: "isCont f a"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   562
  unfolding isCont_def by (rule cont)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   563
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   564
lemma (in bounded_bilinear) isCont:
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   565
  "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x ** g x) a"
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   566
  unfolding isCont_def by (rule LIM)
dd647b4d7952 added bounded_linear and bounded_bilinear locales
huffman
parents: 21257
diff changeset
   567
23127
56ee8105c002 simplify names of locale interpretations
huffman
parents: 23118
diff changeset
   568
lemmas isCont_scaleR = scaleR.isCont
21239
d4fbe2c87ef1 LIM_compose -> isCont_LIM_compose;
huffman
parents: 21165
diff changeset
   569
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   570
lemma isCont_of_real:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   571
  "isCont f a \<Longrightarrow> isCont (\<lambda>x. of_real (f x)::'b::real_normed_algebra_1) a"
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   572
  unfolding isCont_def by (rule LIM_of_real)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   573
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   574
lemma isCont_power:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   575
  fixes f :: "'a::metric_space \<Rightarrow> 'b::{power,real_normed_algebra}"
22627
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   576
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x ^ n) a"
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   577
  unfolding isCont_def by (rule LIM_power)
2b093ba973bc new LIM/isCont lemmas for abs, of_real, and power
huffman
parents: 22613
diff changeset
   578
29885
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   579
lemma isCont_sgn:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   580
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   581
  shows "\<lbrakk>isCont f a; f a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. sgn (f x)) a"
29885
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   582
  unfolding isCont_def by (rule LIM_sgn)
379e43e513c2 add lemmas about sgn
huffman
parents: 29803
diff changeset
   583
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   584
lemma isCont_abs [simp]: "isCont abs (a::real)"
23069
cdfff0241c12 rename lemmas LIM_ident, isCont_ident, DERIV_ident
huffman
parents: 23040
diff changeset
   585
by (rule isCont_rabs [OF isCont_ident])
15228
4d332d10fa3d revised simprules for division
paulson
parents: 15195
diff changeset
   586
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   587
lemma isCont_setsum:
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   588
  fixes f :: "'a \<Rightarrow> 'b::metric_space \<Rightarrow> 'c::real_normed_vector"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   589
  fixes A :: "'a set" assumes "finite A"
29803
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   590
  shows "\<forall> i \<in> A. isCont (f i) x \<Longrightarrow> isCont (\<lambda> x. \<Sum> i \<in> A. f i x) x"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   591
  using `finite A`
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   592
proof induct
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   593
  case (insert a F) show "isCont (\<lambda> x. \<Sum> i \<in> (insert a F). f i x) x" 
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   594
    unfolding setsum_insert[OF `finite F` `a \<notin> F`] by (rule isCont_add, auto simp add: insert)
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   595
qed auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   596
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   597
lemma LIM_less_bound: fixes f :: "real \<Rightarrow> real" assumes "b < x"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   598
  and all_le: "\<forall> x' \<in> { b <..< x}. 0 \<le> f x'" and isCont: "isCont f x"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   599
  shows "0 \<le> f x"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   600
proof (rule ccontr)
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   601
  assume "\<not> 0 \<le> f x" hence "f x < 0" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   602
  hence "0 < - f x / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   603
  from isCont[unfolded isCont_def, THEN LIM_D, OF this]
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   604
  obtain s where "s > 0" and s_D: "\<And>x'. \<lbrakk> x' \<noteq> x ; \<bar> x' - x \<bar> < s \<rbrakk> \<Longrightarrow> \<bar> f x' - f x \<bar> < - f x / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   605
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   606
  let ?x = "x - min (s / 2) ((x - b) / 2)"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   607
  have "?x < x" and "\<bar> ?x - x \<bar> < s"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   608
    using `b < x` and `0 < s` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   609
  have "b < ?x"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   610
  proof (cases "s < x - b")
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   611
    case True thus ?thesis using `0 < s` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   612
  next
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   613
    case False hence "s / 2 \<ge> (x - b) / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   614
    from inf_absorb2[OF this, unfolded inf_real_def]
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   615
    have "?x = (x + b) / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   616
    thus ?thesis using `b < x` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   617
  qed
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   618
  hence "0 \<le> f ?x" using all_le `?x < x` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   619
  moreover have "\<bar>f ?x - f x\<bar> < - f x / 2"
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   620
    using s_D[OF _ `\<bar> ?x - x \<bar> < s`] `?x < x` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   621
  hence "f ?x - f x < - f x / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   622
  hence "f ?x < f x / 2" by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   623
  hence "f ?x < 0" using `f x < 0` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   624
  thus False using `0 \<le> f ?x` by auto
c56a5571f60a Added derivation lemmas for power series and theorems for the pi, arcus tangens and logarithm series
hoelzl
parents: 29667
diff changeset
   625
qed
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   626
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   627
20755
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   628
subsection {* Uniform Continuity *}
956a0377a408 reorganize sections
huffman
parents: 20754
diff changeset
   629
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   630
lemma isUCont_isCont: "isUCont f ==> isCont f x"
23012
496b42cf588d remove dependence on Hilbert_Choice.thy
huffman
parents: 22641
diff changeset
   631
by (simp add: isUCont_def isCont_def LIM_def, force)
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   632
23118
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   633
lemma isUCont_Cauchy:
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   634
  "\<lbrakk>isUCont f; Cauchy X\<rbrakk> \<Longrightarrow> Cauchy (\<lambda>n. f (X n))"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   635
unfolding isUCont_def
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   636
apply (rule metric_CauchyI)
23118
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   637
apply (drule_tac x=e in spec, safe)
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   638
apply (drule_tac e=s in metric_CauchyD, safe)
23118
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   639
apply (rule_tac x=M in exI, simp)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   640
done
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   641
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   642
lemma (in bounded_linear) isUCont: "isUCont f"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   643
unfolding isUCont_def dist_norm
23118
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   644
proof (intro allI impI)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   645
  fix r::real assume r: "0 < r"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   646
  obtain K where K: "0 < K" and norm_le: "\<And>x. norm (f x) \<le> norm x * K"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   647
    using pos_bounded by fast
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   648
  show "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   649
  proof (rule exI, safe)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   650
    from r K show "0 < r / K" by (rule divide_pos_pos)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   651
  next
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   652
    fix x y :: 'a
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   653
    assume xy: "norm (x - y) < r / K"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   654
    have "norm (f x - f y) = norm (f (x - y))" by (simp only: diff)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   655
    also have "\<dots> \<le> norm (x - y) * K" by (rule norm_le)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   656
    also from K xy have "\<dots> < r" by (simp only: pos_less_divide_eq)
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   657
    finally show "norm (f x - f y) < r" .
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   658
  qed
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   659
qed
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   660
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   661
lemma (in bounded_linear) Cauchy: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. f (X n))"
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   662
by (rule isUCont [THEN isUCont_Cauchy])
ce3cf072ae14 add isUCont lemmas
huffman
parents: 23076
diff changeset
   663
14477
cc61fd03e589 conversion of Hyperreal/Lim to new-style
paulson
parents: 14387
diff changeset
   664
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   665
subsection {* Relation of LIM and LIMSEQ *}
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   666
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   667
lemma LIMSEQ_SEQ_conv1:
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   668
  fixes a :: "'a::metric_space"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   669
  assumes X: "X -- a --> L"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   670
  shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   671
proof (safe intro!: metric_LIMSEQ_I)
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   672
  fix S :: "nat \<Rightarrow> 'a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   673
  fix r :: real
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   674
  assume rgz: "0 < r"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   675
  assume as: "\<forall>n. S n \<noteq> a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   676
  assume S: "S ----> a"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   677
  from metric_LIM_D [OF X rgz] obtain s
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   678
    where sgz: "0 < s"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   679
    and aux: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < s\<rbrakk> \<Longrightarrow> dist (X x) L < r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   680
    by fast
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   681
  from metric_LIMSEQ_D [OF S sgz]
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   682
  obtain no where "\<forall>n\<ge>no. dist (S n) a < s" by blast
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   683
  hence "\<forall>n\<ge>no. dist (X (S n)) L < r" by (simp add: aux as)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   684
  thus "\<exists>no. \<forall>n\<ge>no. dist (X (S n)) L < r" ..
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   685
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   686
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   687
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   688
lemma LIMSEQ_SEQ_conv2:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   689
  fixes a :: real
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   690
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   691
  shows "X -- a --> L"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   692
proof (rule ccontr)
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   693
  assume "\<not> (X -- a --> L)"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   694
  hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s --> dist (X x) L < r)"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   695
    unfolding LIM_def dist_norm .
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   696
  hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. \<not>(x \<noteq> a \<and> \<bar>x - a\<bar> < s --> dist (X x) L < r)" by simp
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   697
  hence "\<exists>r > 0. \<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> dist (X x) L \<ge> r)" by (simp add: not_less)
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   698
  then obtain r where rdef: "r > 0 \<and> (\<forall>s > 0. \<exists>x. (x \<noteq> a \<and> \<bar>x - a\<bar> < s \<and> dist (X x) L \<ge> r))" by auto
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   699
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   700
  let ?F = "\<lambda>n::nat. SOME x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> dist (X x) L \<ge> r"
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   701
  have "\<And>n. \<exists>x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> dist (X x) L \<ge> r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   702
    using rdef by simp
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   703
  hence F: "\<And>n. ?F n \<noteq> a \<and> \<bar>?F n - a\<bar> < inverse (real (Suc n)) \<and> dist (X (?F n)) L \<ge> r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   704
    by (rule someI_ex)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   705
  hence F1: "\<And>n. ?F n \<noteq> a"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   706
    and F2: "\<And>n. \<bar>?F n - a\<bar> < inverse (real (Suc n))"
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   707
    and F3: "\<And>n. dist (X (?F n)) L \<ge> r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   708
    by fast+
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   709
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   710
  have "?F ----> a"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   711
  proof (rule LIMSEQ_I, unfold real_norm_def)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   712
      fix e::real
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   713
      assume "0 < e"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   714
        (* choose no such that inverse (real (Suc n)) < e *)
23441
ee218296d635 avoid using implicit prems in assumption
huffman
parents: 23127
diff changeset
   715
      then have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   716
      then obtain m where nodef: "inverse (real (Suc m)) < e" by auto
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   717
      show "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n - a\<bar> < e"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   718
      proof (intro exI allI impI)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   719
        fix n
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   720
        assume mlen: "m \<le> n"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   721
        have "\<bar>?F n - a\<bar> < inverse (real (Suc n))"
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   722
          by (rule F2)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   723
        also have "inverse (real (Suc n)) \<le> inverse (real (Suc m))"
23441
ee218296d635 avoid using implicit prems in assumption
huffman
parents: 23127
diff changeset
   724
          using mlen by auto
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   725
        also from nodef have
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   726
          "inverse (real (Suc m)) < e" .
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   727
        finally show "\<bar>?F n - a\<bar> < e" .
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   728
      qed
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   729
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   730
  
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   731
  moreover have "\<forall>n. ?F n \<noteq> a"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   732
    by (rule allI) (rule F1)
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   733
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   734
  moreover from prems have "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   735
  ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   736
  
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   737
  moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)"
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   738
  proof -
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   739
    {
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   740
      fix no::nat
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   741
      obtain n where "n = no + 1" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   742
      then have nolen: "no \<le> n" by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   743
        (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *)
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   744
      have "dist (X (?F n)) L \<ge> r"
21165
8fb49f668511 moved DERIV stuff from Lim.thy to new Deriv.thy; cleaned up LIMSEQ_SEQ proofs
huffman
parents: 21141
diff changeset
   745
        by (rule F3)
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   746
      with nolen have "\<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r" by fast
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   747
    }
31338
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   748
    then have "(\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r)" by simp
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   749
    with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> e)" by auto
d41a8ba25b67 generalize constants from Lim.thy to class metric_space
huffman
parents: 31336
diff changeset
   750
    thus ?thesis by (unfold LIMSEQ_def, auto simp add: not_less)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   751
  qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   752
  ultimately show False by simp
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   753
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   754
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   755
lemma LIMSEQ_SEQ_conv:
20561
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   756
  "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> (a::real) \<longrightarrow> (\<lambda>n. X (S n)) ----> L) =
6a6d8004322f generalize type of (NS)LIM to work on functions with vector space domain types
huffman
parents: 20552
diff changeset
   757
   (X -- a --> L)"
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   758
proof
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   759
  assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
23441
ee218296d635 avoid using implicit prems in assumption
huffman
parents: 23127
diff changeset
   760
  thus "X -- a --> L" by (rule LIMSEQ_SEQ_conv2)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   761
next
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   762
  assume "(X -- a --> L)"
23441
ee218296d635 avoid using implicit prems in assumption
huffman
parents: 23127
diff changeset
   763
  thus "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1)
19023
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   764
qed
5652a536b7e8 * include generalised MVT in HyperReal (contributed by Benjamin Porter)
kleing
parents: 17318
diff changeset
   765
10751
a81ea5d3dd41 separation of HOL-Hyperreal from HOL-Real
paulson
parents:
diff changeset
   766
end