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