src/HOL/Lim.thy
author huffman
Wed Aug 17 11:06:39 2011 -0700 (2011-08-17)
changeset 44251 d101ed3177b6
parent 44233 aa74ce315bae
child 44253 c073a0bd8458
permissions -rw-r--r--
add lemma metric_tendsto_imp_tendsto
paulson@10751
     1
(*  Title       : Lim.thy
paulson@10751
     2
    Author      : Jacques D. Fleuriot
paulson@10751
     3
    Copyright   : 1998  University of Cambridge
paulson@14477
     4
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
paulson@10751
     5
*)
paulson@10751
     6
huffman@21165
     7
header{* Limits and Continuity *}
paulson@10751
     8
nipkow@15131
     9
theory Lim
haftmann@29197
    10
imports SEQ
nipkow@15131
    11
begin
paulson@14477
    12
huffman@22641
    13
text{*Standard Definitions*}
paulson@10751
    14
huffman@36661
    15
abbreviation
huffman@36662
    16
  LIM :: "['a::topological_space \<Rightarrow> 'b::topological_space, 'a, 'b] \<Rightarrow> bool"
wenzelm@21404
    17
        ("((_)/ -- (_)/ --> (_))" [60, 0, 60] 60) where
huffman@36661
    18
  "f -- a --> L \<equiv> (f ---> L) (at a)"
paulson@10751
    19
wenzelm@21404
    20
definition
huffman@36662
    21
  isCont :: "['a::topological_space \<Rightarrow> 'b::topological_space, 'a] \<Rightarrow> bool" where
wenzelm@19765
    22
  "isCont f a = (f -- a --> (f a))"
paulson@10751
    23
wenzelm@21404
    24
definition
huffman@31338
    25
  isUCont :: "['a::metric_space \<Rightarrow> 'b::metric_space] \<Rightarrow> bool" where
haftmann@37767
    26
  "isUCont f = (\<forall>r>0. \<exists>s>0. \<forall>x y. dist x y < s \<longrightarrow> dist (f x) (f y) < r)"
paulson@10751
    27
huffman@31392
    28
subsection {* Limits of Functions *}
huffman@31349
    29
huffman@36661
    30
lemma LIM_def: "f -- a --> L =
huffman@36661
    31
     (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & dist x a < s
huffman@36661
    32
        --> dist (f x) L < r)"
huffman@36661
    33
unfolding tendsto_iff eventually_at ..
paulson@10751
    34
huffman@31338
    35
lemma metric_LIM_I:
huffman@31338
    36
  "(\<And>r. 0 < r \<Longrightarrow> \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r)
huffman@31338
    37
    \<Longrightarrow> f -- a --> L"
huffman@31338
    38
by (simp add: LIM_def)
huffman@31338
    39
huffman@31338
    40
lemma metric_LIM_D:
huffman@31338
    41
  "\<lbrakk>f -- a --> L; 0 < r\<rbrakk>
huffman@31338
    42
    \<Longrightarrow> \<exists>s>0. \<forall>x. x \<noteq> a \<and> dist x a < s \<longrightarrow> dist (f x) L < r"
huffman@31338
    43
by (simp add: LIM_def)
paulson@14477
    44
paulson@14477
    45
lemma LIM_eq:
huffman@31338
    46
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
huffman@31338
    47
  shows "f -- a --> L =
huffman@20561
    48
     (\<forall>r>0.\<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)"
huffman@31338
    49
by (simp add: LIM_def dist_norm)
paulson@14477
    50
huffman@20552
    51
lemma LIM_I:
huffman@31338
    52
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
huffman@31338
    53
  shows "(!!r. 0<r ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r)
huffman@20552
    54
      ==> f -- a --> L"
huffman@20552
    55
by (simp add: LIM_eq)
huffman@20552
    56
paulson@14477
    57
lemma LIM_D:
huffman@31338
    58
  fixes a :: "'a::real_normed_vector" and L :: "'b::real_normed_vector"
huffman@31338
    59
  shows "[| f -- a --> L; 0<r |]
huffman@20561
    60
      ==> \<exists>s>0.\<forall>x. x \<noteq> a & norm (x-a) < s --> norm (f x - L) < r"
paulson@14477
    61
by (simp add: LIM_eq)
paulson@14477
    62
huffman@31338
    63
lemma LIM_offset:
huffman@36662
    64
  fixes a :: "'a::real_normed_vector"
huffman@31338
    65
  shows "f -- a --> L \<Longrightarrow> (\<lambda>x. f (x + k)) -- a - k --> L"
huffman@36662
    66
apply (rule topological_tendstoI)
huffman@36662
    67
apply (drule (2) topological_tendstoD)
huffman@36662
    68
apply (simp only: eventually_at dist_norm)
huffman@36662
    69
apply (clarify, rule_tac x=d in exI, safe)
huffman@20756
    70
apply (drule_tac x="x + k" in spec)
nipkow@29667
    71
apply (simp add: algebra_simps)
huffman@20756
    72
done
huffman@20756
    73
huffman@31338
    74
lemma LIM_offset_zero:
huffman@36662
    75
  fixes a :: "'a::real_normed_vector"
huffman@31338
    76
  shows "f -- a --> L \<Longrightarrow> (\<lambda>h. f (a + h)) -- 0 --> L"
huffman@21239
    77
by (drule_tac k="a" in LIM_offset, simp add: add_commute)
huffman@21239
    78
huffman@31338
    79
lemma LIM_offset_zero_cancel:
huffman@36662
    80
  fixes a :: "'a::real_normed_vector"
huffman@31338
    81
  shows "(\<lambda>h. f (a + h)) -- 0 --> L \<Longrightarrow> f -- a --> L"
huffman@21239
    82
by (drule_tac k="- a" in LIM_offset, simp)
huffman@21239
    83
paulson@15228
    84
lemma LIM_const [simp]: "(%x. k) -- x --> k"
huffman@36661
    85
by (rule tendsto_const)
paulson@14477
    86
hoelzl@32650
    87
lemma LIM_cong_limit: "\<lbrakk> f -- x --> L ; K = L \<rbrakk> \<Longrightarrow> f -- x --> K" by simp
hoelzl@32650
    88
paulson@14477
    89
lemma LIM_add:
huffman@36662
    90
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
paulson@14477
    91
  assumes f: "f -- a --> L" and g: "g -- a --> M"
huffman@31338
    92
  shows "(\<lambda>x. f x + g x) -- a --> (L + M)"
huffman@36661
    93
using assms by (rule tendsto_add)
paulson@14477
    94
huffman@21257
    95
lemma LIM_add_zero:
huffman@36662
    96
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
    97
  shows "\<lbrakk>f -- a --> 0; g -- a --> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. f x + g x) -- a --> 0"
huffman@44194
    98
  by (rule tendsto_add_zero)
huffman@21257
    99
huffman@31338
   100
lemma LIM_minus:
huffman@36662
   101
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   102
  shows "f -- a --> L \<Longrightarrow> (\<lambda>x. - f x) -- a --> - L"
huffman@36661
   103
by (rule tendsto_minus)
paulson@14477
   104
huffman@31338
   105
(* TODO: delete *)
paulson@14477
   106
lemma LIM_add_minus:
huffman@36662
   107
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   108
  shows "[| f -- x --> l; g -- x --> m |] ==> (%x. f(x) + -g(x)) -- x --> (l + -m)"
huffman@20552
   109
by (intro LIM_add LIM_minus)
paulson@14477
   110
paulson@14477
   111
lemma LIM_diff:
huffman@36662
   112
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   113
  shows "\<lbrakk>f -- x --> l; g -- x --> m\<rbrakk> \<Longrightarrow> (\<lambda>x. f x - g x) -- x --> l - m"
huffman@36661
   114
by (rule tendsto_diff)
paulson@14477
   115
huffman@31338
   116
lemma LIM_zero:
huffman@36662
   117
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   118
  shows "f -- a --> l \<Longrightarrow> (\<lambda>x. f x - l) -- a --> 0"
huffman@36662
   119
unfolding tendsto_iff dist_norm by simp
huffman@21239
   120
huffman@31338
   121
lemma LIM_zero_cancel:
huffman@36662
   122
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   123
  shows "(\<lambda>x. f x - l) -- a --> 0 \<Longrightarrow> f -- a --> l"
huffman@36662
   124
unfolding tendsto_iff dist_norm by simp
huffman@21239
   125
huffman@31338
   126
lemma LIM_zero_iff:
huffman@31338
   127
  fixes f :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   128
  shows "(\<lambda>x. f x - l) -- a --> 0 = f -- a --> l"
huffman@36662
   129
unfolding tendsto_iff dist_norm by simp
huffman@21399
   130
huffman@31338
   131
lemma metric_LIM_imp_LIM:
huffman@21257
   132
  assumes f: "f -- a --> l"
huffman@31338
   133
  assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> dist (g x) m \<le> dist (f x) l"
huffman@21257
   134
  shows "g -- a --> m"
huffman@44251
   135
  by (rule metric_tendsto_imp_tendsto [OF f],
huffman@44251
   136
    auto simp add: eventually_at_topological le)
huffman@21257
   137
huffman@31338
   138
lemma LIM_imp_LIM:
huffman@36662
   139
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@36662
   140
  fixes g :: "'a::topological_space \<Rightarrow> 'c::real_normed_vector"
huffman@31338
   141
  assumes f: "f -- a --> l"
huffman@31338
   142
  assumes le: "\<And>x. x \<noteq> a \<Longrightarrow> norm (g x - m) \<le> norm (f x - l)"
huffman@31338
   143
  shows "g -- a --> m"
huffman@44251
   144
  by (rule metric_LIM_imp_LIM [OF f],
huffman@44251
   145
    simp add: dist_norm le)
huffman@31338
   146
huffman@31338
   147
lemma LIM_norm:
huffman@36662
   148
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   149
  shows "f -- a --> l \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> norm l"
huffman@36661
   150
by (rule tendsto_norm)
huffman@21257
   151
huffman@31338
   152
lemma LIM_norm_zero:
huffman@36662
   153
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   154
  shows "f -- a --> 0 \<Longrightarrow> (\<lambda>x. norm (f x)) -- a --> 0"
huffman@36662
   155
by (rule tendsto_norm_zero)
huffman@21257
   156
huffman@31338
   157
lemma LIM_norm_zero_cancel:
huffman@36662
   158
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   159
  shows "(\<lambda>x. norm (f x)) -- a --> 0 \<Longrightarrow> f -- a --> 0"
huffman@36662
   160
by (rule tendsto_norm_zero_cancel)
huffman@21257
   161
huffman@31338
   162
lemma LIM_norm_zero_iff:
huffman@36662
   163
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   164
  shows "(\<lambda>x. norm (f x)) -- a --> 0 = f -- a --> 0"
huffman@36662
   165
by (rule tendsto_norm_zero_iff)
huffman@21399
   166
huffman@22627
   167
lemma LIM_rabs: "f -- a --> (l::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> \<bar>l\<bar>"
huffman@44194
   168
  by (rule tendsto_rabs)
huffman@22627
   169
huffman@22627
   170
lemma LIM_rabs_zero: "f -- a --> (0::real) \<Longrightarrow> (\<lambda>x. \<bar>f x\<bar>) -- a --> 0"
huffman@44194
   171
  by (rule tendsto_rabs_zero)
huffman@22627
   172
huffman@22627
   173
lemma LIM_rabs_zero_cancel: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) \<Longrightarrow> f -- a --> 0"
huffman@44194
   174
  by (rule tendsto_rabs_zero_cancel)
huffman@22627
   175
huffman@22627
   176
lemma LIM_rabs_zero_iff: "(\<lambda>x. \<bar>f x\<bar>) -- a --> (0::real) = f -- a --> 0"
huffman@44194
   177
  by (rule tendsto_rabs_zero_iff)
huffman@22627
   178
huffman@44205
   179
lemma trivial_limit_at:
huffman@36662
   180
  fixes a :: "'a::real_normed_algebra_1"
huffman@44205
   181
  shows "\<not> trivial_limit (at a)"  -- {* TODO: find a more appropriate class *}
huffman@44205
   182
unfolding trivial_limit_def
huffman@36662
   183
unfolding eventually_at dist_norm
huffman@36662
   184
by (clarsimp, rule_tac x="a + of_real (d/2)" in exI, simp)
huffman@36662
   185
huffman@20561
   186
lemma LIM_const_not_eq:
huffman@23076
   187
  fixes a :: "'a::real_normed_algebra_1"
huffman@44205
   188
  fixes k L :: "'b::t2_space"
huffman@23076
   189
  shows "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) -- a --> L"
huffman@44205
   190
by (simp add: tendsto_const_iff trivial_limit_at)
paulson@14477
   191
huffman@21786
   192
lemmas LIM_not_zero = LIM_const_not_eq [where L = 0]
huffman@21786
   193
huffman@20561
   194
lemma LIM_const_eq:
huffman@23076
   195
  fixes a :: "'a::real_normed_algebra_1"
huffman@44205
   196
  fixes k L :: "'b::t2_space"
huffman@23076
   197
  shows "(\<lambda>x. k) -- a --> L \<Longrightarrow> k = L"
huffman@44205
   198
  by (simp add: tendsto_const_iff trivial_limit_at)
paulson@14477
   199
huffman@20561
   200
lemma LIM_unique:
huffman@31338
   201
  fixes a :: "'a::real_normed_algebra_1" -- {* TODO: find a more appropriate class *}
huffman@44205
   202
  fixes L M :: "'b::t2_space"
huffman@23076
   203
  shows "\<lbrakk>f -- a --> L; f -- a --> M\<rbrakk> \<Longrightarrow> L = M"
huffman@44205
   204
  using trivial_limit_at by (rule tendsto_unique)
paulson@14477
   205
huffman@23069
   206
lemma LIM_ident [simp]: "(\<lambda>x. x) -- a --> a"
huffman@36661
   207
by (rule tendsto_ident_at)
paulson@14477
   208
paulson@14477
   209
text{*Limits are equal for functions equal except at limit point*}
paulson@14477
   210
lemma LIM_equal:
paulson@14477
   211
     "[| \<forall>x. x \<noteq> a --> (f x = g x) |] ==> (f -- a --> l) = (g -- a --> l)"
huffman@36662
   212
unfolding tendsto_def eventually_at_topological by simp
paulson@14477
   213
huffman@20796
   214
lemma LIM_cong:
huffman@20796
   215
  "\<lbrakk>a = b; \<And>x. x \<noteq> b \<Longrightarrow> f x = g x; l = m\<rbrakk>
huffman@21399
   216
   \<Longrightarrow> ((\<lambda>x. f x) -- a --> l) = ((\<lambda>x. g x) -- b --> m)"
huffman@36662
   217
by (simp add: LIM_equal)
huffman@20796
   218
huffman@31338
   219
lemma metric_LIM_equal2:
huffman@21282
   220
  assumes 1: "0 < R"
huffman@31338
   221
  assumes 2: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < R\<rbrakk> \<Longrightarrow> f x = g x"
huffman@21282
   222
  shows "g -- a --> l \<Longrightarrow> f -- a --> l"
huffman@36662
   223
apply (rule topological_tendstoI)
huffman@36662
   224
apply (drule (2) topological_tendstoD)
huffman@36662
   225
apply (simp add: eventually_at, safe)
huffman@36662
   226
apply (rule_tac x="min d R" in exI, safe)
huffman@21282
   227
apply (simp add: 1)
huffman@21282
   228
apply (simp add: 2)
huffman@21282
   229
done
huffman@21282
   230
huffman@31338
   231
lemma LIM_equal2:
huffman@36662
   232
  fixes f g :: "'a::real_normed_vector \<Rightarrow> 'b::topological_space"
huffman@31338
   233
  assumes 1: "0 < R"
huffman@31338
   234
  assumes 2: "\<And>x. \<lbrakk>x \<noteq> a; norm (x - a) < R\<rbrakk> \<Longrightarrow> f x = g x"
huffman@31338
   235
  shows "g -- a --> l \<Longrightarrow> f -- a --> l"
huffman@36662
   236
by (rule metric_LIM_equal2 [OF 1 2], simp_all add: dist_norm)
huffman@31338
   237
huffman@36662
   238
text{*Two uses in Transcendental.ML*} (* BH: no longer true; delete? *)
paulson@14477
   239
lemma LIM_trans:
huffman@31338
   240
  fixes f g :: "'a::metric_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   241
  shows "[| (%x. f(x) + -g(x)) -- a --> 0;  g -- a --> l |] ==> f -- a --> l"
paulson@14477
   242
apply (drule LIM_add, assumption)
paulson@14477
   243
apply (auto simp add: add_assoc)
paulson@14477
   244
done
paulson@14477
   245
huffman@21239
   246
lemma LIM_compose:
huffman@21239
   247
  assumes g: "g -- l --> g l"
huffman@21239
   248
  assumes f: "f -- a --> l"
huffman@21239
   249
  shows "(\<lambda>x. g (f x)) -- a --> g l"
huffman@44218
   250
  using assms by (rule tendsto_compose)
huffman@21239
   251
huffman@36662
   252
lemma LIM_compose_eventually:
huffman@36662
   253
  assumes f: "f -- a --> b"
huffman@36662
   254
  assumes g: "g -- b --> c"
huffman@36662
   255
  assumes inj: "eventually (\<lambda>x. f x \<noteq> b) (at a)"
huffman@36662
   256
  shows "(\<lambda>x. g (f x)) -- a --> c"
huffman@36662
   257
proof (rule topological_tendstoI)
huffman@36662
   258
  fix C assume C: "open C" "c \<in> C"
huffman@36662
   259
  obtain B where B: "open B" "b \<in> B"
huffman@36662
   260
    and gC: "\<And>y. y \<in> B \<Longrightarrow> y \<noteq> b \<Longrightarrow> g y \<in> C"
huffman@36662
   261
    using topological_tendstoD [OF g C]
huffman@36662
   262
    unfolding eventually_at_topological by fast
huffman@36662
   263
  obtain A where A: "open A" "a \<in> A"
huffman@36662
   264
    and fB: "\<And>x. x \<in> A \<Longrightarrow> x \<noteq> a \<Longrightarrow> f x \<in> B"
huffman@36662
   265
    using topological_tendstoD [OF f B]
huffman@36662
   266
    unfolding eventually_at_topological by fast
huffman@36662
   267
  have "eventually (\<lambda>x. f x \<noteq> b \<longrightarrow> g (f x) \<in> C) (at a)"
huffman@36662
   268
  unfolding eventually_at_topological
huffman@36662
   269
  proof (intro exI conjI ballI impI)
huffman@36662
   270
    show "open A" and "a \<in> A" using A .
huffman@21239
   271
  next
huffman@36662
   272
    fix x assume "x \<in> A" and "x \<noteq> a" and "f x \<noteq> b"
huffman@36662
   273
    then show "g (f x) \<in> C" by (simp add: gC fB)
huffman@21239
   274
  qed
huffman@36662
   275
  with inj show "eventually (\<lambda>x. g (f x) \<in> C) (at a)"
huffman@36662
   276
    by (rule eventually_rev_mp)
huffman@21239
   277
qed
huffman@21239
   278
huffman@31338
   279
lemma metric_LIM_compose2:
huffman@31338
   280
  assumes f: "f -- a --> b"
huffman@31338
   281
  assumes g: "g -- b --> c"
huffman@31338
   282
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> b"
huffman@31338
   283
  shows "(\<lambda>x. g (f x)) -- a --> c"
huffman@36662
   284
using f g inj [folded eventually_at]
huffman@36662
   285
by (rule LIM_compose_eventually)
huffman@31338
   286
huffman@23040
   287
lemma LIM_compose2:
huffman@31338
   288
  fixes a :: "'a::real_normed_vector"
huffman@23040
   289
  assumes f: "f -- a --> b"
huffman@23040
   290
  assumes g: "g -- b --> c"
huffman@23040
   291
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> b"
huffman@23040
   292
  shows "(\<lambda>x. g (f x)) -- a --> c"
huffman@31338
   293
by (rule metric_LIM_compose2 [OF f g inj [folded dist_norm]])
huffman@23040
   294
huffman@21239
   295
lemma LIM_o: "\<lbrakk>g -- l --> g l; f -- a --> l\<rbrakk> \<Longrightarrow> (g \<circ> f) -- a --> g l"
huffman@21239
   296
unfolding o_def by (rule LIM_compose)
huffman@21239
   297
huffman@21282
   298
lemma real_LIM_sandwich_zero:
huffman@36662
   299
  fixes f g :: "'a::topological_space \<Rightarrow> real"
huffman@21282
   300
  assumes f: "f -- a --> 0"
huffman@21282
   301
  assumes 1: "\<And>x. x \<noteq> a \<Longrightarrow> 0 \<le> g x"
huffman@21282
   302
  assumes 2: "\<And>x. x \<noteq> a \<Longrightarrow> g x \<le> f x"
huffman@21282
   303
  shows "g -- a --> 0"
huffman@21282
   304
proof (rule LIM_imp_LIM [OF f])
huffman@21282
   305
  fix x assume x: "x \<noteq> a"
huffman@21282
   306
  have "norm (g x - 0) = g x" by (simp add: 1 x)
huffman@21282
   307
  also have "g x \<le> f x" by (rule 2 [OF x])
huffman@21282
   308
  also have "f x \<le> \<bar>f x\<bar>" by (rule abs_ge_self)
huffman@21282
   309
  also have "\<bar>f x\<bar> = norm (f x - 0)" by simp
huffman@21282
   310
  finally show "norm (g x - 0) \<le> norm (f x - 0)" .
huffman@21282
   311
qed
huffman@21282
   312
huffman@22442
   313
text {* Bounded Linear Operators *}
huffman@21282
   314
huffman@21282
   315
lemma (in bounded_linear) LIM:
huffman@21282
   316
  "g -- a --> l \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> f l"
huffman@36661
   317
by (rule tendsto)
huffman@31349
   318
huffman@21282
   319
lemma (in bounded_linear) LIM_zero:
huffman@21282
   320
  "g -- a --> 0 \<Longrightarrow> (\<lambda>x. f (g x)) -- a --> 0"
huffman@44194
   321
  by (rule tendsto_zero)
huffman@21282
   322
huffman@22442
   323
text {* Bounded Bilinear Operators *}
huffman@21282
   324
huffman@31349
   325
lemma (in bounded_bilinear) LIM:
huffman@31349
   326
  "\<lbrakk>f -- a --> L; g -- a --> M\<rbrakk> \<Longrightarrow> (\<lambda>x. f x ** g x) -- a --> L ** M"
huffman@36661
   327
by (rule tendsto)
huffman@31349
   328
huffman@21282
   329
lemma (in bounded_bilinear) LIM_prod_zero:
huffman@31338
   330
  fixes a :: "'d::metric_space"
huffman@21282
   331
  assumes f: "f -- a --> 0"
huffman@21282
   332
  assumes g: "g -- a --> 0"
huffman@21282
   333
  shows "(\<lambda>x. f x ** g x) -- a --> 0"
huffman@44194
   334
  using f g by (rule tendsto_zero)
huffman@21282
   335
huffman@21282
   336
lemma (in bounded_bilinear) LIM_left_zero:
huffman@21282
   337
  "f -- a --> 0 \<Longrightarrow> (\<lambda>x. f x ** c) -- a --> 0"
huffman@44194
   338
  by (rule tendsto_left_zero)
huffman@21282
   339
huffman@21282
   340
lemma (in bounded_bilinear) LIM_right_zero:
huffman@21282
   341
  "f -- a --> 0 \<Longrightarrow> (\<lambda>x. c ** f x) -- a --> 0"
huffman@44194
   342
  by (rule tendsto_right_zero)
huffman@21282
   343
huffman@23127
   344
lemmas LIM_mult = mult.LIM
huffman@21282
   345
huffman@23127
   346
lemmas LIM_mult_zero = mult.LIM_prod_zero
huffman@21282
   347
huffman@23127
   348
lemmas LIM_mult_left_zero = mult.LIM_left_zero
huffman@21282
   349
huffman@23127
   350
lemmas LIM_mult_right_zero = mult.LIM_right_zero
huffman@21282
   351
huffman@23127
   352
lemmas LIM_scaleR = scaleR.LIM
huffman@21282
   353
huffman@23127
   354
lemmas LIM_of_real = of_real.LIM
huffman@22627
   355
huffman@22627
   356
lemma LIM_power:
huffman@36665
   357
  fixes f :: "'a::topological_space \<Rightarrow> 'b::{power,real_normed_algebra}"
huffman@22627
   358
  assumes f: "f -- a --> l"
huffman@22627
   359
  shows "(\<lambda>x. f x ^ n) -- a --> l ^ n"
huffman@44194
   360
  using assms by (rule tendsto_power)
huffman@22627
   361
huffman@31355
   362
lemma LIM_inverse:
huffman@31355
   363
  fixes L :: "'a::real_normed_div_algebra"
huffman@31355
   364
  shows "\<lbrakk>f -- a --> L; L \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (f x)) -- a --> inverse L"
huffman@31355
   365
by (rule tendsto_inverse)
huffman@22637
   366
huffman@22637
   367
lemma LIM_inverse_fun:
huffman@22637
   368
  assumes a: "a \<noteq> (0::'a::real_normed_div_algebra)"
huffman@22637
   369
  shows "inverse -- a --> inverse a"
huffman@31355
   370
by (rule LIM_inverse [OF LIM_ident a])
huffman@22637
   371
huffman@29885
   372
lemma LIM_sgn:
huffman@36665
   373
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   374
  shows "\<lbrakk>f -- a --> l; l \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>x. sgn (f x)) -- a --> sgn l"
huffman@44194
   375
  by (rule tendsto_sgn)
huffman@29885
   376
paulson@14477
   377
huffman@20755
   378
subsection {* Continuity *}
paulson@14477
   379
huffman@31338
   380
lemma LIM_isCont_iff:
huffman@36665
   381
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::topological_space"
huffman@31338
   382
  shows "(f -- a --> f a) = ((\<lambda>h. f (a + h)) -- 0 --> f a)"
huffman@21239
   383
by (rule iffI [OF LIM_offset_zero LIM_offset_zero_cancel])
huffman@21239
   384
huffman@31338
   385
lemma isCont_iff:
huffman@36665
   386
  fixes f :: "'a::real_normed_vector \<Rightarrow> 'b::topological_space"
huffman@31338
   387
  shows "isCont f x = (\<lambda>h. f (x + h)) -- 0 --> f x"
huffman@21239
   388
by (simp add: isCont_def LIM_isCont_iff)
huffman@21239
   389
huffman@23069
   390
lemma isCont_ident [simp]: "isCont (\<lambda>x. x) a"
huffman@23069
   391
  unfolding isCont_def by (rule LIM_ident)
huffman@21239
   392
huffman@21786
   393
lemma isCont_const [simp]: "isCont (\<lambda>x. k) a"
huffman@21282
   394
  unfolding isCont_def by (rule LIM_const)
huffman@21239
   395
huffman@44233
   396
lemma isCont_norm [simp]:
huffman@36665
   397
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   398
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. norm (f x)) a"
huffman@21786
   399
  unfolding isCont_def by (rule LIM_norm)
huffman@21786
   400
huffman@44233
   401
lemma isCont_rabs [simp]:
huffman@44233
   402
  fixes f :: "'a::topological_space \<Rightarrow> real"
huffman@44233
   403
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. \<bar>f x\<bar>) a"
huffman@22627
   404
  unfolding isCont_def by (rule LIM_rabs)
huffman@22627
   405
huffman@44233
   406
lemma isCont_add [simp]:
huffman@36665
   407
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   408
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a"
huffman@21282
   409
  unfolding isCont_def by (rule LIM_add)
huffman@21239
   410
huffman@44233
   411
lemma isCont_minus [simp]:
huffman@36665
   412
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   413
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. - f x) a"
huffman@21282
   414
  unfolding isCont_def by (rule LIM_minus)
huffman@21239
   415
huffman@44233
   416
lemma isCont_diff [simp]:
huffman@36665
   417
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   418
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x - g x) a"
huffman@21282
   419
  unfolding isCont_def by (rule LIM_diff)
huffman@21239
   420
huffman@44233
   421
lemma isCont_mult [simp]:
huffman@36665
   422
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_algebra"
huffman@21786
   423
  shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x * g x) a"
huffman@21282
   424
  unfolding isCont_def by (rule LIM_mult)
huffman@21239
   425
huffman@44233
   426
lemma isCont_inverse [simp]:
huffman@36665
   427
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_div_algebra"
huffman@21786
   428
  shows "\<lbrakk>isCont f a; f a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. inverse (f x)) a"
huffman@21282
   429
  unfolding isCont_def by (rule LIM_inverse)
huffman@21239
   430
huffman@44233
   431
lemma isCont_divide [simp]:
huffman@44233
   432
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::real_normed_field"
huffman@44233
   433
  shows "\<lbrakk>isCont f a; isCont g a; g a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x / g x) a"
huffman@44233
   434
  unfolding isCont_def by (rule tendsto_divide)
huffman@44233
   435
huffman@21239
   436
lemma isCont_LIM_compose:
huffman@21239
   437
  "\<lbrakk>isCont g l; f -- a --> l\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) -- a --> g l"
huffman@21282
   438
  unfolding isCont_def by (rule LIM_compose)
huffman@21239
   439
huffman@31338
   440
lemma metric_isCont_LIM_compose2:
huffman@31338
   441
  assumes f [unfolded isCont_def]: "isCont f a"
huffman@31338
   442
  assumes g: "g -- f a --> l"
huffman@31338
   443
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> f a"
huffman@31338
   444
  shows "(\<lambda>x. g (f x)) -- a --> l"
huffman@31338
   445
by (rule metric_LIM_compose2 [OF f g inj])
huffman@31338
   446
huffman@23040
   447
lemma isCont_LIM_compose2:
huffman@31338
   448
  fixes a :: "'a::real_normed_vector"
huffman@23040
   449
  assumes f [unfolded isCont_def]: "isCont f a"
huffman@23040
   450
  assumes g: "g -- f a --> l"
huffman@23040
   451
  assumes inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> norm (x - a) < d \<longrightarrow> f x \<noteq> f a"
huffman@23040
   452
  shows "(\<lambda>x. g (f x)) -- a --> l"
huffman@23040
   453
by (rule LIM_compose2 [OF f g inj])
huffman@23040
   454
huffman@21239
   455
lemma isCont_o2: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
huffman@21282
   456
  unfolding isCont_def by (rule LIM_compose)
huffman@21239
   457
huffman@21239
   458
lemma isCont_o: "\<lbrakk>isCont f a; isCont g (f a)\<rbrakk> \<Longrightarrow> isCont (g o f) a"
huffman@21282
   459
  unfolding o_def by (rule isCont_o2)
huffman@21282
   460
huffman@44233
   461
lemma (in bounded_linear) isCont:
huffman@44233
   462
  "isCont g a \<Longrightarrow> isCont (\<lambda>x. f (g x)) a"
huffman@44233
   463
  unfolding isCont_def by (rule LIM)
huffman@21282
   464
huffman@21282
   465
lemma (in bounded_bilinear) isCont:
huffman@21282
   466
  "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x ** g x) a"
huffman@21282
   467
  unfolding isCont_def by (rule LIM)
huffman@21282
   468
huffman@44233
   469
lemmas isCont_scaleR [simp] = scaleR.isCont
huffman@21239
   470
huffman@44233
   471
lemma isCont_of_real [simp]:
huffman@31338
   472
  "isCont f a \<Longrightarrow> isCont (\<lambda>x. of_real (f x)::'b::real_normed_algebra_1) a"
huffman@44233
   473
  by (rule of_real.isCont)
huffman@22627
   474
huffman@44233
   475
lemma isCont_power [simp]:
huffman@36665
   476
  fixes f :: "'a::topological_space \<Rightarrow> 'b::{power,real_normed_algebra}"
huffman@22627
   477
  shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x ^ n) a"
huffman@22627
   478
  unfolding isCont_def by (rule LIM_power)
huffman@22627
   479
huffman@44233
   480
lemma isCont_sgn [simp]:
huffman@36665
   481
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
huffman@31338
   482
  shows "\<lbrakk>isCont f a; f a \<noteq> 0\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. sgn (f x)) a"
huffman@29885
   483
  unfolding isCont_def by (rule LIM_sgn)
huffman@29885
   484
huffman@44233
   485
lemma isCont_setsum [simp]:
huffman@44233
   486
  fixes f :: "'a \<Rightarrow> 'b::topological_space \<Rightarrow> 'c::real_normed_vector"
huffman@44233
   487
  fixes A :: "'a set"
huffman@44233
   488
  shows "\<forall>i\<in>A. isCont (f i) a \<Longrightarrow> isCont (\<lambda>x. \<Sum>i\<in>A. f i x) a"
huffman@44233
   489
  unfolding isCont_def by (simp add: tendsto_setsum)
paulson@15228
   490
huffman@44233
   491
lemmas isCont_intros =
huffman@44233
   492
  isCont_ident isCont_const isCont_norm isCont_rabs isCont_add isCont_minus
huffman@44233
   493
  isCont_diff isCont_mult isCont_inverse isCont_divide isCont_scaleR
huffman@44233
   494
  isCont_of_real isCont_power isCont_sgn isCont_setsum
hoelzl@29803
   495
hoelzl@29803
   496
lemma LIM_less_bound: fixes f :: "real \<Rightarrow> real" assumes "b < x"
hoelzl@29803
   497
  and all_le: "\<forall> x' \<in> { b <..< x}. 0 \<le> f x'" and isCont: "isCont f x"
hoelzl@29803
   498
  shows "0 \<le> f x"
hoelzl@29803
   499
proof (rule ccontr)
hoelzl@29803
   500
  assume "\<not> 0 \<le> f x" hence "f x < 0" by auto
hoelzl@29803
   501
  hence "0 < - f x / 2" by auto
hoelzl@29803
   502
  from isCont[unfolded isCont_def, THEN LIM_D, OF this]
hoelzl@29803
   503
  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
hoelzl@29803
   504
hoelzl@29803
   505
  let ?x = "x - min (s / 2) ((x - b) / 2)"
hoelzl@29803
   506
  have "?x < x" and "\<bar> ?x - x \<bar> < s"
hoelzl@29803
   507
    using `b < x` and `0 < s` by auto
hoelzl@29803
   508
  have "b < ?x"
hoelzl@29803
   509
  proof (cases "s < x - b")
hoelzl@29803
   510
    case True thus ?thesis using `0 < s` by auto
hoelzl@29803
   511
  next
hoelzl@29803
   512
    case False hence "s / 2 \<ge> (x - b) / 2" by auto
haftmann@32642
   513
    hence "?x = (x + b) / 2" by (simp add: field_simps min_max.inf_absorb2)
hoelzl@29803
   514
    thus ?thesis using `b < x` by auto
hoelzl@29803
   515
  qed
hoelzl@29803
   516
  hence "0 \<le> f ?x" using all_le `?x < x` by auto
hoelzl@29803
   517
  moreover have "\<bar>f ?x - f x\<bar> < - f x / 2"
hoelzl@29803
   518
    using s_D[OF _ `\<bar> ?x - x \<bar> < s`] `?x < x` by auto
hoelzl@29803
   519
  hence "f ?x - f x < - f x / 2" by auto
hoelzl@29803
   520
  hence "f ?x < f x / 2" by auto
hoelzl@29803
   521
  hence "f ?x < 0" using `f x < 0` by auto
hoelzl@29803
   522
  thus False using `0 \<le> f ?x` by auto
hoelzl@29803
   523
qed
huffman@31338
   524
paulson@14477
   525
huffman@20755
   526
subsection {* Uniform Continuity *}
huffman@20755
   527
paulson@14477
   528
lemma isUCont_isCont: "isUCont f ==> isCont f x"
huffman@23012
   529
by (simp add: isUCont_def isCont_def LIM_def, force)
paulson@14477
   530
huffman@23118
   531
lemma isUCont_Cauchy:
huffman@23118
   532
  "\<lbrakk>isUCont f; Cauchy X\<rbrakk> \<Longrightarrow> Cauchy (\<lambda>n. f (X n))"
huffman@23118
   533
unfolding isUCont_def
huffman@31338
   534
apply (rule metric_CauchyI)
huffman@23118
   535
apply (drule_tac x=e in spec, safe)
huffman@31338
   536
apply (drule_tac e=s in metric_CauchyD, safe)
huffman@23118
   537
apply (rule_tac x=M in exI, simp)
huffman@23118
   538
done
huffman@23118
   539
huffman@23118
   540
lemma (in bounded_linear) isUCont: "isUCont f"
huffman@31338
   541
unfolding isUCont_def dist_norm
huffman@23118
   542
proof (intro allI impI)
huffman@23118
   543
  fix r::real assume r: "0 < r"
huffman@23118
   544
  obtain K where K: "0 < K" and norm_le: "\<And>x. norm (f x) \<le> norm x * K"
huffman@23118
   545
    using pos_bounded by fast
huffman@23118
   546
  show "\<exists>s>0. \<forall>x y. norm (x - y) < s \<longrightarrow> norm (f x - f y) < r"
huffman@23118
   547
  proof (rule exI, safe)
huffman@23118
   548
    from r K show "0 < r / K" by (rule divide_pos_pos)
huffman@23118
   549
  next
huffman@23118
   550
    fix x y :: 'a
huffman@23118
   551
    assume xy: "norm (x - y) < r / K"
huffman@23118
   552
    have "norm (f x - f y) = norm (f (x - y))" by (simp only: diff)
huffman@23118
   553
    also have "\<dots> \<le> norm (x - y) * K" by (rule norm_le)
huffman@23118
   554
    also from K xy have "\<dots> < r" by (simp only: pos_less_divide_eq)
huffman@23118
   555
    finally show "norm (f x - f y) < r" .
huffman@23118
   556
  qed
huffman@23118
   557
qed
huffman@23118
   558
huffman@23118
   559
lemma (in bounded_linear) Cauchy: "Cauchy X \<Longrightarrow> Cauchy (\<lambda>n. f (X n))"
huffman@23118
   560
by (rule isUCont [THEN isUCont_Cauchy])
huffman@23118
   561
paulson@14477
   562
huffman@21165
   563
subsection {* Relation of LIM and LIMSEQ *}
kleing@19023
   564
kleing@19023
   565
lemma LIMSEQ_SEQ_conv1:
huffman@36662
   566
  fixes a :: "'a::metric_space" and L :: "'b::metric_space"
huffman@21165
   567
  assumes X: "X -- a --> L"
kleing@19023
   568
  shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
huffman@31338
   569
proof (safe intro!: metric_LIMSEQ_I)
huffman@21165
   570
  fix S :: "nat \<Rightarrow> 'a"
huffman@21165
   571
  fix r :: real
huffman@21165
   572
  assume rgz: "0 < r"
huffman@21165
   573
  assume as: "\<forall>n. S n \<noteq> a"
huffman@21165
   574
  assume S: "S ----> a"
huffman@31338
   575
  from metric_LIM_D [OF X rgz] obtain s
huffman@21165
   576
    where sgz: "0 < s"
huffman@31338
   577
    and aux: "\<And>x. \<lbrakk>x \<noteq> a; dist x a < s\<rbrakk> \<Longrightarrow> dist (X x) L < r"
huffman@21165
   578
    by fast
huffman@31338
   579
  from metric_LIMSEQ_D [OF S sgz]
huffman@31338
   580
  obtain no where "\<forall>n\<ge>no. dist (S n) a < s" by blast
huffman@31338
   581
  hence "\<forall>n\<ge>no. dist (X (S n)) L < r" by (simp add: aux as)
huffman@31338
   582
  thus "\<exists>no. \<forall>n\<ge>no. dist (X (S n)) L < r" ..
kleing@19023
   583
qed
kleing@19023
   584
huffman@31338
   585
kleing@19023
   586
lemma LIMSEQ_SEQ_conv2:
huffman@36662
   587
  fixes a :: real and L :: "'a::metric_space"
kleing@19023
   588
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
kleing@19023
   589
  shows "X -- a --> L"
kleing@19023
   590
proof (rule ccontr)
kleing@19023
   591
  assume "\<not> (X -- a --> L)"
huffman@31338
   592
  hence "\<not> (\<forall>r > 0. \<exists>s > 0. \<forall>x. x \<noteq> a & norm (x - a) < s --> dist (X x) L < r)"
huffman@31338
   593
    unfolding LIM_def dist_norm .
huffman@31338
   594
  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
huffman@31338
   595
  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)
huffman@31338
   596
  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
kleing@19023
   597
huffman@31338
   598
  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"
huffman@31338
   599
  have "\<And>n. \<exists>x. x\<noteq>a \<and> \<bar>x - a\<bar> < inverse (real (Suc n)) \<and> dist (X x) L \<ge> r"
huffman@21165
   600
    using rdef by simp
huffman@31338
   601
  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"
huffman@21165
   602
    by (rule someI_ex)
huffman@21165
   603
  hence F1: "\<And>n. ?F n \<noteq> a"
huffman@21165
   604
    and F2: "\<And>n. \<bar>?F n - a\<bar> < inverse (real (Suc n))"
huffman@31338
   605
    and F3: "\<And>n. dist (X (?F n)) L \<ge> r"
huffman@21165
   606
    by fast+
huffman@21165
   607
kleing@19023
   608
  have "?F ----> a"
huffman@21165
   609
  proof (rule LIMSEQ_I, unfold real_norm_def)
kleing@19023
   610
      fix e::real
kleing@19023
   611
      assume "0 < e"
kleing@19023
   612
        (* choose no such that inverse (real (Suc n)) < e *)
huffman@23441
   613
      then have "\<exists>no. inverse (real (Suc no)) < e" by (rule reals_Archimedean)
kleing@19023
   614
      then obtain m where nodef: "inverse (real (Suc m)) < e" by auto
huffman@21165
   615
      show "\<exists>no. \<forall>n. no \<le> n --> \<bar>?F n - a\<bar> < e"
huffman@21165
   616
      proof (intro exI allI impI)
kleing@19023
   617
        fix n
kleing@19023
   618
        assume mlen: "m \<le> n"
huffman@21165
   619
        have "\<bar>?F n - a\<bar> < inverse (real (Suc n))"
huffman@21165
   620
          by (rule F2)
huffman@21165
   621
        also have "inverse (real (Suc n)) \<le> inverse (real (Suc m))"
huffman@23441
   622
          using mlen by auto
huffman@21165
   623
        also from nodef have
kleing@19023
   624
          "inverse (real (Suc m)) < e" .
huffman@21165
   625
        finally show "\<bar>?F n - a\<bar> < e" .
huffman@21165
   626
      qed
kleing@19023
   627
  qed
kleing@19023
   628
  
kleing@19023
   629
  moreover have "\<forall>n. ?F n \<noteq> a"
huffman@21165
   630
    by (rule allI) (rule F1)
huffman@21165
   631
wenzelm@41550
   632
  moreover note `\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L`
kleing@19023
   633
  ultimately have "(\<lambda>n. X (?F n)) ----> L" by simp
kleing@19023
   634
  
kleing@19023
   635
  moreover have "\<not> ((\<lambda>n. X (?F n)) ----> L)"
kleing@19023
   636
  proof -
kleing@19023
   637
    {
kleing@19023
   638
      fix no::nat
kleing@19023
   639
      obtain n where "n = no + 1" by simp
kleing@19023
   640
      then have nolen: "no \<le> n" by simp
kleing@19023
   641
        (* We prove this by showing that for any m there is an n\<ge>m such that |X (?F n) - L| \<ge> r *)
huffman@31338
   642
      have "dist (X (?F n)) L \<ge> r"
huffman@21165
   643
        by (rule F3)
huffman@31338
   644
      with nolen have "\<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r" by fast
kleing@19023
   645
    }
huffman@31338
   646
    then have "(\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> r)" by simp
huffman@31338
   647
    with rdef have "\<exists>e>0. (\<forall>no. \<exists>n. no \<le> n \<and> dist (X (?F n)) L \<ge> e)" by auto
huffman@31338
   648
    thus ?thesis by (unfold LIMSEQ_def, auto simp add: not_less)
kleing@19023
   649
  qed
kleing@19023
   650
  ultimately show False by simp
kleing@19023
   651
qed
kleing@19023
   652
kleing@19023
   653
lemma LIMSEQ_SEQ_conv:
huffman@20561
   654
  "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> (a::real) \<longrightarrow> (\<lambda>n. X (S n)) ----> L) =
huffman@36662
   655
   (X -- a --> (L::'a::metric_space))"
kleing@19023
   656
proof
kleing@19023
   657
  assume "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L"
huffman@23441
   658
  thus "X -- a --> L" by (rule LIMSEQ_SEQ_conv2)
kleing@19023
   659
next
kleing@19023
   660
  assume "(X -- a --> L)"
huffman@23441
   661
  thus "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S ----> a \<longrightarrow> (\<lambda>n. X (S n)) ----> L" by (rule LIMSEQ_SEQ_conv1)
kleing@19023
   662
qed
kleing@19023
   663
paulson@10751
   664
end