src/HOL/Hyperreal/SEQ.thy
author avigad
Wed Jul 13 19:49:07 2005 +0200 (2005-07-13)
changeset 16819 00d8f9300d13
parent 15539 333a88244569
child 17298 ad73fb6144cf
permissions -rw-r--r--
Additions to the Real (and Hyperreal) libraries:
RealDef.thy: lemmas relating nats, ints, and reals
reversed direction of real_of_int_mult, etc. (now they agree with nat versions)
SEQ.thy and Series.thy: various additions
RComplete.thy: lemmas involving floor and ceiling
introduced natfloor and natceiling
Log.thy: various additions
paulson@10751
     1
(*  Title       : SEQ.thy
paulson@10751
     2
    Author      : Jacques D. Fleuriot
paulson@10751
     3
    Copyright   : 1998  University of Cambridge
paulson@10751
     4
    Description : Convergence of sequences and series
paulson@15082
     5
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
avigad@16819
     6
    Additional contributions by Jeremy Avigad
paulson@15082
     7
*)
paulson@10751
     8
nipkow@15131
     9
theory SEQ
nipkow@15236
    10
imports NatStar
nipkow@15131
    11
begin
paulson@10751
    12
paulson@10751
    13
constdefs
paulson@10751
    14
paulson@15082
    15
  LIMSEQ :: "[nat=>real,real] => bool"    ("((_)/ ----> (_))" [60, 60] 60)
paulson@15082
    16
    --{*Standard definition of convergence of sequence*}
paulson@15082
    17
  "X ----> L == (\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> \<bar>X n + -L\<bar> < r))"
paulson@10751
    18
paulson@15082
    19
  NSLIMSEQ :: "[nat=>real,real] => bool"    ("((_)/ ----NS> (_))" [60, 60] 60)
paulson@15082
    20
    --{*Nonstandard definition of convergence of sequence*}
paulson@15082
    21
  "X ----NS> L == (\<forall>N \<in> HNatInfinite. ( *fNat* X) N \<approx> hypreal_of_real L)"
paulson@15082
    22
paulson@15082
    23
  lim :: "(nat => real) => real"
paulson@15082
    24
    --{*Standard definition of limit using choice operator*}
paulson@10751
    25
  "lim X == (@L. (X ----> L))"
paulson@10751
    26
paulson@15082
    27
  nslim :: "(nat => real) => real"
paulson@15082
    28
    --{*Nonstandard definition of limit using choice operator*}
paulson@10751
    29
  "nslim X == (@L. (X ----NS> L))"
paulson@10751
    30
paulson@15082
    31
  convergent :: "(nat => real) => bool"
paulson@15082
    32
    --{*Standard definition of convergence*}
paulson@15082
    33
  "convergent X == (\<exists>L. (X ----> L))"
paulson@10751
    34
paulson@15082
    35
  NSconvergent :: "(nat => real) => bool"
paulson@15082
    36
    --{*Nonstandard definition of convergence*}
paulson@15082
    37
  "NSconvergent X == (\<exists>L. (X ----NS> L))"
paulson@15082
    38
paulson@15082
    39
  Bseq :: "(nat => real) => bool"
paulson@15082
    40
    --{*Standard definition for bounded sequence*}
nipkow@15360
    41
  "Bseq X == \<exists>K>0.\<forall>n. \<bar>X n\<bar> \<le> K"
paulson@10751
    42
paulson@15082
    43
  NSBseq :: "(nat=>real) => bool"
paulson@15082
    44
    --{*Nonstandard definition for bounded sequence*}
paulson@15082
    45
  "NSBseq X == (\<forall>N \<in> HNatInfinite. ( *fNat* X) N : HFinite)"
paulson@15082
    46
paulson@15082
    47
  monoseq :: "(nat=>real)=>bool"
paulson@15082
    48
    --{*Definition for monotonicity*}
nipkow@15360
    49
  "monoseq X == (\<forall>m. \<forall>n\<ge>m. X m \<le> X n) | (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
paulson@10751
    50
paulson@15082
    51
  subseq :: "(nat => nat) => bool"
paulson@15082
    52
    --{*Definition of subsequence*}
nipkow@15360
    53
  "subseq f == \<forall>m. \<forall>n>m. (f m) < (f n)"
paulson@10751
    54
paulson@15082
    55
  Cauchy :: "(nat => real) => bool"
paulson@15082
    56
    --{*Standard definition of the Cauchy condition*}
nipkow@15360
    57
  "Cauchy X == \<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. abs((X m) + -(X n)) < e"
paulson@10751
    58
paulson@15082
    59
  NSCauchy :: "(nat => real) => bool"
paulson@15082
    60
    --{*Nonstandard definition*}
paulson@15082
    61
  "NSCauchy X == (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite.
paulson@15082
    62
                      ( *fNat* X) M \<approx> ( *fNat* X) N)"
paulson@15082
    63
paulson@15082
    64
paulson@15082
    65
paulson@15082
    66
text{* Example of an hypersequence (i.e. an extended standard sequence)
paulson@15082
    67
   whose term with an hypernatural suffix is an infinitesimal i.e.
paulson@15082
    68
   the whn'nth term of the hypersequence is a member of Infinitesimal*}
paulson@15082
    69
paulson@15082
    70
lemma SEQ_Infinitesimal:
paulson@15082
    71
      "( *fNat* (%n::nat. inverse(real(Suc n)))) whn : Infinitesimal"
paulson@15082
    72
apply (simp add: hypnat_omega_def Infinitesimal_FreeUltrafilterNat_iff starfunNat)
paulson@15082
    73
apply (rule bexI, rule_tac [2] lemma_hyprel_refl)
paulson@15229
    74
apply (simp add: real_of_nat_Suc_gt_zero FreeUltrafilterNat_inverse_real_of_posnat)
paulson@15082
    75
done
paulson@15082
    76
paulson@15082
    77
paulson@15082
    78
subsection{*LIMSEQ and NSLIMSEQ*}
paulson@15082
    79
paulson@15082
    80
lemma LIMSEQ_iff:
nipkow@15360
    81
      "(X ----> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. \<bar>X n + -L\<bar> < r)"
paulson@15082
    82
by (simp add: LIMSEQ_def)
paulson@15082
    83
paulson@15082
    84
lemma NSLIMSEQ_iff:
paulson@15082
    85
    "(X ----NS> L) = (\<forall>N \<in> HNatInfinite. ( *fNat* X) N \<approx> hypreal_of_real L)"
paulson@15082
    86
by (simp add: NSLIMSEQ_def)
paulson@15082
    87
paulson@15082
    88
paulson@15082
    89
text{*LIMSEQ ==> NSLIMSEQ*}
paulson@15082
    90
paulson@15082
    91
lemma LIMSEQ_NSLIMSEQ:
paulson@15082
    92
      "X ----> L ==> X ----NS> L"
paulson@15082
    93
apply (simp add: LIMSEQ_def NSLIMSEQ_def)
paulson@15082
    94
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff)
paulson@15082
    95
apply (rule_tac z = N in eq_Abs_hypnat)
paulson@15082
    96
apply (rule approx_minus_iff [THEN iffD2])
paulson@15082
    97
apply (auto simp add: starfunNat mem_infmal_iff [symmetric] hypreal_of_real_def
paulson@15082
    98
              hypreal_minus hypreal_add Infinitesimal_FreeUltrafilterNat_iff)
paulson@15082
    99
apply (rule bexI [OF _ lemma_hyprel_refl], safe)
paulson@15082
   100
apply (drule_tac x = u in spec, safe)
paulson@15082
   101
apply (drule_tac x = no in spec, fuf)
paulson@15082
   102
apply (blast dest: less_imp_le)
paulson@15082
   103
done
paulson@15082
   104
paulson@15082
   105
paulson@15082
   106
text{*NSLIMSEQ ==> LIMSEQ*}
paulson@15082
   107
paulson@15082
   108
lemma lemma_NSLIMSEQ1: "!!(f::nat=>nat). \<forall>n. n \<le> f n
paulson@15082
   109
           ==> {n. f n = 0} = {0} | {n. f n = 0} = {}"
paulson@15082
   110
apply auto
paulson@15082
   111
apply (drule_tac x = xa in spec)
paulson@15082
   112
apply (drule_tac [2] x = x in spec, auto)
paulson@15082
   113
done
paulson@15082
   114
paulson@15082
   115
lemma lemma_NSLIMSEQ2: "{n. f n \<le> Suc u} = {n. f n \<le> u} Un {n. f n = Suc u}"
paulson@15082
   116
by (auto simp add: le_Suc_eq)
paulson@15082
   117
paulson@15082
   118
lemma lemma_NSLIMSEQ3:
paulson@15082
   119
     "!!(f::nat=>nat). \<forall>n. n \<le> f n ==> {n. f n = Suc u} \<le> {n. n \<le> Suc u}"
paulson@15082
   120
apply auto
paulson@15082
   121
apply (drule_tac x = x in spec, auto)
paulson@15082
   122
done
paulson@15082
   123
paulson@15082
   124
text{* the following sequence @{term "f(n)"} defines a hypernatural *}
paulson@15082
   125
lemma NSLIMSEQ_finite_set:
paulson@15082
   126
     "!!(f::nat=>nat). \<forall>n. n \<le> f n ==> finite {n. f n \<le> u}"
paulson@15082
   127
apply (induct u)
paulson@15082
   128
apply (auto simp add: lemma_NSLIMSEQ2)
paulson@15082
   129
apply (auto intro: lemma_NSLIMSEQ3 [THEN finite_subset] finite_atMost [unfolded atMost_def])
paulson@15082
   130
apply (drule lemma_NSLIMSEQ1, safe)
paulson@15082
   131
apply (simp_all (no_asm_simp)) 
paulson@15082
   132
done
paulson@15082
   133
paulson@15082
   134
lemma Compl_less_set: "- {n. u < (f::nat=>nat) n} = {n. f n \<le> u}"
paulson@15082
   135
by (auto dest: less_le_trans simp add: le_def)
paulson@15082
   136
paulson@15082
   137
text{* the index set is in the free ultrafilter *}
paulson@15082
   138
lemma FreeUltrafilterNat_NSLIMSEQ:
paulson@15082
   139
     "!!(f::nat=>nat). \<forall>n. n \<le> f n ==> {n. u < f n} : FreeUltrafilterNat"
paulson@15082
   140
apply (rule FreeUltrafilterNat_Compl_iff2 [THEN iffD2])
paulson@15082
   141
apply (rule FreeUltrafilterNat_finite)
paulson@15082
   142
apply (auto dest: NSLIMSEQ_finite_set simp add: Compl_less_set)
paulson@15082
   143
done
paulson@15082
   144
paulson@15082
   145
text{* thus, the sequence defines an infinite hypernatural! *}
paulson@15082
   146
lemma HNatInfinite_NSLIMSEQ: "\<forall>n. n \<le> f n
paulson@15082
   147
          ==> Abs_hypnat (hypnatrel `` {f}) : HNatInfinite"
paulson@15082
   148
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff)
paulson@15082
   149
apply (rule bexI [OF _ lemma_hypnatrel_refl], safe)
paulson@15082
   150
apply (erule FreeUltrafilterNat_NSLIMSEQ)
paulson@15082
   151
done
paulson@15082
   152
paulson@15082
   153
lemma lemmaLIM:
paulson@15082
   154
     "{n. X (f n) + - L = Y n} Int {n. \<bar>Y n\<bar> < r} \<le>
paulson@15082
   155
      {n. \<bar>X (f n) + - L\<bar> < r}"
paulson@15082
   156
by auto
paulson@15082
   157
paulson@15082
   158
lemma lemmaLIM2:
paulson@15082
   159
  "{n. \<bar>X (f n) + - L\<bar> < r} Int {n. r \<le> abs (X (f n) + - (L::real))} = {}"
paulson@15082
   160
by auto
paulson@15082
   161
paulson@15082
   162
lemma lemmaLIM3: "[| 0 < r; \<forall>n. r \<le> \<bar>X (f n) + - L\<bar>;
paulson@15082
   163
           ( *fNat* X) (Abs_hypnat (hypnatrel `` {f})) +
paulson@15082
   164
           - hypreal_of_real  L \<approx> 0 |] ==> False"
paulson@15082
   165
apply (auto simp add: starfunNat mem_infmal_iff [symmetric] hypreal_of_real_def hypreal_minus hypreal_add Infinitesimal_FreeUltrafilterNat_iff)
paulson@15082
   166
apply (rename_tac "Y")
paulson@15082
   167
apply (drule_tac x = r in spec, safe)
paulson@15082
   168
apply (drule FreeUltrafilterNat_Int, assumption)
paulson@15082
   169
apply (drule lemmaLIM [THEN [2] FreeUltrafilterNat_subset])
paulson@15082
   170
apply (drule FreeUltrafilterNat_all)
paulson@15082
   171
apply (erule_tac V = "{n. \<bar>Y n\<bar> < r} : FreeUltrafilterNat" in thin_rl)
paulson@15082
   172
apply (drule FreeUltrafilterNat_Int, assumption)
nipkow@15539
   173
apply (simp add: lemmaLIM2)
paulson@15082
   174
done
paulson@15082
   175
paulson@15082
   176
lemma NSLIMSEQ_LIMSEQ: "X ----NS> L ==> X ----> L"
paulson@15082
   177
apply (simp add: LIMSEQ_def NSLIMSEQ_def)
paulson@15082
   178
apply (rule ccontr, simp, safe)
paulson@15082
   179
txt{* skolemization step *}
paulson@15082
   180
apply (drule choice, safe)
paulson@15082
   181
apply (drule_tac x = "Abs_hypnat (hypnatrel``{f}) " in bspec)
paulson@15082
   182
apply (drule_tac [2] approx_minus_iff [THEN iffD1])
paulson@15082
   183
apply (simp_all add: linorder_not_less)
paulson@15082
   184
apply (blast intro: HNatInfinite_NSLIMSEQ)
paulson@15082
   185
apply (blast intro: lemmaLIM3)
paulson@15082
   186
done
paulson@15082
   187
paulson@15082
   188
text{* Now, the all-important result is trivially proved! *}
paulson@15082
   189
theorem LIMSEQ_NSLIMSEQ_iff: "(f ----> L) = (f ----NS> L)"
paulson@15082
   190
by (blast intro: LIMSEQ_NSLIMSEQ NSLIMSEQ_LIMSEQ)
paulson@15082
   191
paulson@15082
   192
paulson@15082
   193
subsection{*Theorems About Sequences*}
paulson@15082
   194
paulson@15082
   195
lemma NSLIMSEQ_const: "(%n. k) ----NS> k"
paulson@15082
   196
by (simp add: NSLIMSEQ_def)
paulson@15082
   197
paulson@15082
   198
lemma LIMSEQ_const: "(%n. k) ----> k"
paulson@15082
   199
by (simp add: LIMSEQ_def)
paulson@15082
   200
paulson@15082
   201
lemma NSLIMSEQ_add:
paulson@15082
   202
      "[| X ----NS> a; Y ----NS> b |] ==> (%n. X n + Y n) ----NS> a + b"
paulson@15082
   203
by (auto intro: approx_add simp add: NSLIMSEQ_def starfunNat_add [symmetric])
paulson@15082
   204
paulson@15082
   205
lemma LIMSEQ_add: "[| X ----> a; Y ----> b |] ==> (%n. X n + Y n) ----> a + b"
paulson@15082
   206
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_add)
paulson@15082
   207
avigad@16819
   208
lemma LIMSEQ_add_const: "f ----> a ==> (%n.(f n + b)) ----> a + b"
avigad@16819
   209
  apply (subgoal_tac "%n. (f n + b) == %n. (f n + (%n. b) n)")
avigad@16819
   210
  apply (subgoal_tac "(%n. b) ----> b")
avigad@16819
   211
  apply (auto simp add: LIMSEQ_add LIMSEQ_const)
avigad@16819
   212
done
avigad@16819
   213
avigad@16819
   214
lemma NSLIMSEQ_add_const: "f ----NS> a ==> (%n.(f n + b)) ----NS> a + b"
avigad@16819
   215
by (simp add: LIMSEQ_NSLIMSEQ_iff [THEN sym] LIMSEQ_add_const)
avigad@16819
   216
paulson@15082
   217
lemma NSLIMSEQ_mult:
paulson@15082
   218
      "[| X ----NS> a; Y ----NS> b |] ==> (%n. X n * Y n) ----NS> a * b"
paulson@15082
   219
by (auto intro!: approx_mult_HFinite 
nipkow@15539
   220
        simp add: NSLIMSEQ_def starfunNat_mult [symmetric])
paulson@15082
   221
paulson@15082
   222
lemma LIMSEQ_mult: "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b"
paulson@15082
   223
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_mult)
paulson@15082
   224
paulson@15082
   225
lemma NSLIMSEQ_minus: "X ----NS> a ==> (%n. -(X n)) ----NS> -a"
paulson@15082
   226
by (auto simp add: NSLIMSEQ_def starfunNat_minus [symmetric])
paulson@15082
   227
paulson@15082
   228
lemma LIMSEQ_minus: "X ----> a ==> (%n. -(X n)) ----> -a"
paulson@15082
   229
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_minus)
paulson@15082
   230
paulson@15082
   231
lemma LIMSEQ_minus_cancel: "(%n. -(X n)) ----> -a ==> X ----> a"
paulson@15082
   232
by (drule LIMSEQ_minus, simp)
paulson@15082
   233
paulson@15082
   234
lemma NSLIMSEQ_minus_cancel: "(%n. -(X n)) ----NS> -a ==> X ----NS> a"
paulson@15082
   235
by (drule NSLIMSEQ_minus, simp)
paulson@15082
   236
paulson@15082
   237
lemma NSLIMSEQ_add_minus:
paulson@15082
   238
     "[| X ----NS> a; Y ----NS> b |] ==> (%n. X n + -Y n) ----NS> a + -b"
paulson@15082
   239
by (simp add: NSLIMSEQ_add NSLIMSEQ_minus [of Y])
paulson@15082
   240
paulson@15082
   241
lemma LIMSEQ_add_minus:
paulson@15082
   242
     "[| X ----> a; Y ----> b |] ==> (%n. X n + -Y n) ----> a + -b"
paulson@15082
   243
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_add_minus)
paulson@15082
   244
paulson@15082
   245
lemma LIMSEQ_diff: "[| X ----> a; Y ----> b |] ==> (%n. X n - Y n) ----> a - b"
paulson@15082
   246
apply (simp add: diff_minus)
paulson@15082
   247
apply (blast intro: LIMSEQ_add_minus)
paulson@15082
   248
done
paulson@15082
   249
paulson@15082
   250
lemma NSLIMSEQ_diff:
paulson@15082
   251
     "[| X ----NS> a; Y ----NS> b |] ==> (%n. X n - Y n) ----NS> a - b"
paulson@15082
   252
apply (simp add: diff_minus)
paulson@15082
   253
apply (blast intro: NSLIMSEQ_add_minus)
paulson@15082
   254
done
paulson@15082
   255
avigad@16819
   256
lemma LIMSEQ_diff_const: "f ----> a ==> (%n.(f n  - b)) ----> a - b"
avigad@16819
   257
  apply (subgoal_tac "%n. (f n - b) == %n. (f n - (%n. b) n)")
avigad@16819
   258
  apply (subgoal_tac "(%n. b) ----> b")
avigad@16819
   259
  apply (auto simp add: LIMSEQ_diff LIMSEQ_const)
avigad@16819
   260
done
avigad@16819
   261
avigad@16819
   262
lemma NSLIMSEQ_diff_const: "f ----NS> a ==> (%n.(f n - b)) ----NS> a - b"
avigad@16819
   263
by (simp add: LIMSEQ_NSLIMSEQ_iff [THEN sym] LIMSEQ_diff_const)
avigad@16819
   264
paulson@15082
   265
text{*Proof is like that of @{text NSLIM_inverse}.*}
paulson@15082
   266
lemma NSLIMSEQ_inverse:
paulson@15082
   267
     "[| X ----NS> a;  a ~= 0 |] ==> (%n. inverse(X n)) ----NS> inverse(a)"
paulson@15082
   268
by (simp add: NSLIMSEQ_def starfunNat_inverse [symmetric] 
paulson@15082
   269
              hypreal_of_real_approx_inverse)
paulson@15082
   270
paulson@15082
   271
paulson@15082
   272
text{*Standard version of theorem*}
paulson@15082
   273
lemma LIMSEQ_inverse:
paulson@15082
   274
     "[| X ----> a; a ~= 0 |] ==> (%n. inverse(X n)) ----> inverse(a)"
paulson@15082
   275
by (simp add: NSLIMSEQ_inverse LIMSEQ_NSLIMSEQ_iff)
paulson@15082
   276
paulson@15082
   277
lemma NSLIMSEQ_mult_inverse:
paulson@15082
   278
     "[| X ----NS> a;  Y ----NS> b;  b ~= 0 |] ==> (%n. X n / Y n) ----NS> a/b"
paulson@15082
   279
by (simp add: NSLIMSEQ_mult NSLIMSEQ_inverse divide_inverse)
paulson@15082
   280
paulson@15082
   281
lemma LIMSEQ_divide:
paulson@15082
   282
     "[| X ----> a;  Y ----> b;  b ~= 0 |] ==> (%n. X n / Y n) ----> a/b"
paulson@15082
   283
by (simp add: LIMSEQ_mult LIMSEQ_inverse divide_inverse)
paulson@15082
   284
paulson@15082
   285
text{*Uniqueness of limit*}
paulson@15082
   286
lemma NSLIMSEQ_unique: "[| X ----NS> a; X ----NS> b |] ==> a = b"
paulson@15082
   287
apply (simp add: NSLIMSEQ_def)
paulson@15082
   288
apply (drule HNatInfinite_whn [THEN [2] bspec])+
paulson@15082
   289
apply (auto dest: approx_trans3)
paulson@15082
   290
done
paulson@15082
   291
paulson@15082
   292
lemma LIMSEQ_unique: "[| X ----> a; X ----> b |] ==> a = b"
paulson@15082
   293
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_unique)
paulson@15082
   294
nipkow@15312
   295
lemma LIMSEQ_setsum:
nipkow@15312
   296
  assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
nipkow@15312
   297
  shows "(\<lambda>m. \<Sum>n\<in>S. X n m) ----> (\<Sum>n\<in>S. L n)"
nipkow@15312
   298
proof (cases "finite S")
nipkow@15312
   299
  case True
nipkow@15312
   300
  thus ?thesis using n
nipkow@15312
   301
  proof (induct)
nipkow@15312
   302
    case empty
nipkow@15312
   303
    show ?case
nipkow@15312
   304
      by (simp add: LIMSEQ_const)
nipkow@15312
   305
  next
nipkow@15312
   306
    case insert
nipkow@15312
   307
    thus ?case
nipkow@15312
   308
      by (simp add: LIMSEQ_add)
nipkow@15312
   309
  qed
nipkow@15312
   310
next
nipkow@15312
   311
  case False
nipkow@15312
   312
  thus ?thesis
nipkow@15312
   313
    by (simp add: setsum_def LIMSEQ_const)
nipkow@15312
   314
qed
nipkow@15312
   315
avigad@16819
   316
lemma LIMSEQ_setprod:
avigad@16819
   317
  assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
avigad@16819
   318
  shows "(\<lambda>m. \<Prod>n\<in>S. X n m) ----> (\<Prod>n\<in>S. L n)"
avigad@16819
   319
proof (cases "finite S")
avigad@16819
   320
  case True
avigad@16819
   321
  thus ?thesis using n
avigad@16819
   322
  proof (induct)
avigad@16819
   323
    case empty
avigad@16819
   324
    show ?case
avigad@16819
   325
      by (simp add: LIMSEQ_const)
avigad@16819
   326
  next
avigad@16819
   327
    case insert
avigad@16819
   328
    thus ?case
avigad@16819
   329
      by (simp add: LIMSEQ_mult)
avigad@16819
   330
  qed
avigad@16819
   331
next
avigad@16819
   332
  case False
avigad@16819
   333
  thus ?thesis
avigad@16819
   334
    by (simp add: setprod_def LIMSEQ_const)
avigad@16819
   335
qed
avigad@16819
   336
avigad@16819
   337
lemma LIMSEQ_ignore_initial_segment: "f ----> a 
avigad@16819
   338
  ==> (%n. f(n + k)) ----> a"
avigad@16819
   339
  apply (unfold LIMSEQ_def) 
avigad@16819
   340
  apply (clarify)
avigad@16819
   341
  apply (drule_tac x = r in spec)
avigad@16819
   342
  apply (clarify)
avigad@16819
   343
  apply (rule_tac x = "no + k" in exI)
avigad@16819
   344
  by auto
avigad@16819
   345
avigad@16819
   346
lemma LIMSEQ_offset: "(%x. f (x + k)) ----> a ==>
avigad@16819
   347
    f ----> a"
avigad@16819
   348
  apply (unfold LIMSEQ_def)
avigad@16819
   349
  apply clarsimp
avigad@16819
   350
  apply (drule_tac x = r in spec)
avigad@16819
   351
  apply clarsimp
avigad@16819
   352
  apply (rule_tac x = "no + k" in exI)
avigad@16819
   353
  apply clarsimp
avigad@16819
   354
  apply (drule_tac x = "n - k" in spec)
avigad@16819
   355
  apply (frule mp)
avigad@16819
   356
  apply arith
avigad@16819
   357
  apply simp
avigad@16819
   358
done
avigad@16819
   359
avigad@16819
   360
lemma LIMSEQ_diff_approach_zero: 
avigad@16819
   361
  "g ----> L ==> (%x. f x - g x) ----> 0  ==>
avigad@16819
   362
     f ----> L"
avigad@16819
   363
  apply (drule LIMSEQ_add)
avigad@16819
   364
  apply assumption
avigad@16819
   365
  apply simp
avigad@16819
   366
done
avigad@16819
   367
avigad@16819
   368
lemma LIMSEQ_diff_approach_zero2: 
avigad@16819
   369
  "f ----> L ==> (%x. f x - g x) ----> 0  ==>
avigad@16819
   370
     g ----> L";
avigad@16819
   371
  apply (drule LIMSEQ_diff)
avigad@16819
   372
  apply assumption
avigad@16819
   373
  apply simp
avigad@16819
   374
done
avigad@16819
   375
paulson@15082
   376
paulson@15082
   377
subsection{*Nslim and Lim*}
paulson@15082
   378
paulson@15082
   379
lemma limI: "X ----> L ==> lim X = L"
paulson@15082
   380
apply (simp add: lim_def)
paulson@15082
   381
apply (blast intro: LIMSEQ_unique)
paulson@15082
   382
done
paulson@15082
   383
paulson@15082
   384
lemma nslimI: "X ----NS> L ==> nslim X = L"
paulson@15082
   385
apply (simp add: nslim_def)
paulson@15082
   386
apply (blast intro: NSLIMSEQ_unique)
paulson@15082
   387
done
paulson@15082
   388
paulson@15082
   389
lemma lim_nslim_iff: "lim X = nslim X"
paulson@15082
   390
by (simp add: lim_def nslim_def LIMSEQ_NSLIMSEQ_iff)
paulson@15082
   391
paulson@15082
   392
paulson@15082
   393
subsection{*Convergence*}
paulson@15082
   394
paulson@15082
   395
lemma convergentD: "convergent X ==> \<exists>L. (X ----> L)"
paulson@15082
   396
by (simp add: convergent_def)
paulson@15082
   397
paulson@15082
   398
lemma convergentI: "(X ----> L) ==> convergent X"
paulson@15082
   399
by (auto simp add: convergent_def)
paulson@15082
   400
paulson@15082
   401
lemma NSconvergentD: "NSconvergent X ==> \<exists>L. (X ----NS> L)"
paulson@15082
   402
by (simp add: NSconvergent_def)
paulson@15082
   403
paulson@15082
   404
lemma NSconvergentI: "(X ----NS> L) ==> NSconvergent X"
paulson@15082
   405
by (auto simp add: NSconvergent_def)
paulson@15082
   406
paulson@15082
   407
lemma convergent_NSconvergent_iff: "convergent X = NSconvergent X"
paulson@15082
   408
by (simp add: convergent_def NSconvergent_def LIMSEQ_NSLIMSEQ_iff)
paulson@15082
   409
paulson@15082
   410
lemma NSconvergent_NSLIMSEQ_iff: "NSconvergent X = (X ----NS> nslim X)"
paulson@15082
   411
by (auto intro: someI simp add: NSconvergent_def nslim_def)
paulson@15082
   412
paulson@15082
   413
lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
paulson@15082
   414
by (auto intro: someI simp add: convergent_def lim_def)
paulson@15082
   415
paulson@15082
   416
text{*Subsequence (alternative definition, (e.g. Hoskins)*}
paulson@15082
   417
paulson@15082
   418
lemma subseq_Suc_iff: "subseq f = (\<forall>n. (f n) < (f (Suc n)))"
paulson@15082
   419
apply (simp add: subseq_def)
paulson@15082
   420
apply (auto dest!: less_imp_Suc_add)
paulson@15082
   421
apply (induct_tac k)
paulson@15082
   422
apply (auto intro: less_trans)
paulson@15082
   423
done
paulson@15082
   424
paulson@15082
   425
paulson@15082
   426
subsection{*Monotonicity*}
paulson@15082
   427
paulson@15082
   428
lemma monoseq_Suc:
paulson@15082
   429
   "monoseq X = ((\<forall>n. X n \<le> X (Suc n))
paulson@15082
   430
                 | (\<forall>n. X (Suc n) \<le> X n))"
paulson@15082
   431
apply (simp add: monoseq_def)
paulson@15082
   432
apply (auto dest!: le_imp_less_or_eq)
paulson@15082
   433
apply (auto intro!: lessI [THEN less_imp_le] dest!: less_imp_Suc_add)
paulson@15082
   434
apply (induct_tac "ka")
paulson@15082
   435
apply (auto intro: order_trans)
paulson@15082
   436
apply (erule swap) 
paulson@15082
   437
apply (induct_tac "k")
paulson@15082
   438
apply (auto intro: order_trans)
paulson@15082
   439
done
paulson@15082
   440
nipkow@15360
   441
lemma monoI1: "\<forall>m. \<forall> n \<ge> m. X m \<le> X n ==> monoseq X"
paulson@15082
   442
by (simp add: monoseq_def)
paulson@15082
   443
nipkow@15360
   444
lemma monoI2: "\<forall>m. \<forall> n \<ge> m. X n \<le> X m ==> monoseq X"
paulson@15082
   445
by (simp add: monoseq_def)
paulson@15082
   446
paulson@15082
   447
lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) ==> monoseq X"
paulson@15082
   448
by (simp add: monoseq_Suc)
paulson@15082
   449
paulson@15082
   450
lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
paulson@15082
   451
by (simp add: monoseq_Suc)
paulson@15082
   452
paulson@15082
   453
paulson@15082
   454
subsection{*Bounded Sequence*}
paulson@15082
   455
paulson@15082
   456
lemma BseqD: "Bseq X ==> \<exists>K. 0 < K & (\<forall>n. \<bar>X n\<bar> \<le> K)"
paulson@15082
   457
by (simp add: Bseq_def)
paulson@15082
   458
paulson@15082
   459
lemma BseqI: "[| 0 < K; \<forall>n. \<bar>X n\<bar> \<le> K |] ==> Bseq X"
paulson@15082
   460
by (auto simp add: Bseq_def)
paulson@15082
   461
paulson@15082
   462
lemma lemma_NBseq_def:
nipkow@15360
   463
     "(\<exists>K > 0. \<forall>n. \<bar>X n\<bar> \<le> K) =
paulson@15082
   464
      (\<exists>N. \<forall>n. \<bar>X n\<bar> \<le> real(Suc N))"
paulson@15082
   465
apply auto
paulson@15082
   466
 prefer 2 apply force
paulson@15082
   467
apply (cut_tac x = K in reals_Archimedean2, clarify)
paulson@15082
   468
apply (rule_tac x = n in exI, clarify)
paulson@15082
   469
apply (drule_tac x = na in spec)
paulson@15082
   470
apply (auto simp add: real_of_nat_Suc)
paulson@15082
   471
done
paulson@15082
   472
paulson@15082
   473
text{* alternative definition for Bseq *}
paulson@15082
   474
lemma Bseq_iff: "Bseq X = (\<exists>N. \<forall>n. \<bar>X n\<bar> \<le> real(Suc N))"
paulson@15082
   475
apply (simp add: Bseq_def)
paulson@15082
   476
apply (simp (no_asm) add: lemma_NBseq_def)
paulson@15082
   477
done
paulson@15082
   478
paulson@15082
   479
lemma lemma_NBseq_def2:
nipkow@15360
   480
     "(\<exists>K > 0. \<forall>n. \<bar>X n\<bar> \<le> K) = (\<exists>N. \<forall>n. \<bar>X n\<bar> < real(Suc N))"
paulson@15082
   481
apply (subst lemma_NBseq_def, auto)
paulson@15082
   482
apply (rule_tac x = "Suc N" in exI)
paulson@15082
   483
apply (rule_tac [2] x = N in exI)
paulson@15082
   484
apply (auto simp add: real_of_nat_Suc)
paulson@15082
   485
 prefer 2 apply (blast intro: order_less_imp_le)
paulson@15082
   486
apply (drule_tac x = n in spec, simp)
paulson@15082
   487
done
paulson@15082
   488
paulson@15082
   489
(* yet another definition for Bseq *)
paulson@15082
   490
lemma Bseq_iff1a: "Bseq X = (\<exists>N. \<forall>n. \<bar>X n\<bar> < real(Suc N))"
paulson@15082
   491
by (simp add: Bseq_def lemma_NBseq_def2)
paulson@15082
   492
paulson@15082
   493
lemma NSBseqD: "[| NSBseq X;  N: HNatInfinite |] ==> ( *fNat* X) N : HFinite"
paulson@15082
   494
by (simp add: NSBseq_def)
paulson@15082
   495
paulson@15082
   496
lemma NSBseqI: "\<forall>N \<in> HNatInfinite. ( *fNat* X) N : HFinite ==> NSBseq X"
paulson@15082
   497
by (simp add: NSBseq_def)
paulson@15082
   498
paulson@15082
   499
text{*The standard definition implies the nonstandard definition*}
paulson@15082
   500
paulson@15082
   501
lemma lemma_Bseq: "\<forall>n. \<bar>X n\<bar> \<le> K ==> \<forall>n. abs(X((f::nat=>nat) n)) \<le> K"
paulson@15082
   502
by auto
paulson@15082
   503
paulson@15082
   504
lemma Bseq_NSBseq: "Bseq X ==> NSBseq X"
paulson@15082
   505
apply (simp add: Bseq_def NSBseq_def, safe)
paulson@15082
   506
apply (rule_tac z = N in eq_Abs_hypnat)
paulson@15082
   507
apply (auto simp add: starfunNat HFinite_FreeUltrafilterNat_iff 
paulson@15082
   508
                      HNatInfinite_FreeUltrafilterNat_iff)
paulson@15082
   509
apply (rule bexI [OF _ lemma_hyprel_refl]) 
paulson@15082
   510
apply (drule_tac f = Xa in lemma_Bseq)
paulson@15082
   511
apply (rule_tac x = "K+1" in exI)
paulson@15082
   512
apply (drule_tac P="%n. ?f n \<le> K" in FreeUltrafilterNat_all, ultra)
paulson@15082
   513
done
paulson@15082
   514
paulson@15082
   515
text{*The nonstandard definition implies the standard definition*}
paulson@15082
   516
paulson@15082
   517
(* similar to NSLIM proof in REALTOPOS *)
paulson@15082
   518
paulson@15082
   519
text{* We need to get rid of the real variable and do so by proving the
paulson@15082
   520
   following, which relies on the Archimedean property of the reals.
paulson@15082
   521
   When we skolemize we then get the required function @{term "f::nat=>nat"}.
paulson@15082
   522
   Otherwise, we would be stuck with a skolem function @{term "f::real=>nat"}
paulson@15082
   523
   which woulid be useless.*}
paulson@15082
   524
paulson@15082
   525
lemma lemmaNSBseq:
nipkow@15360
   526
     "\<forall>K > 0. \<exists>n. K < \<bar>X n\<bar>
paulson@15082
   527
      ==> \<forall>N. \<exists>n. real(Suc N) < \<bar>X n\<bar>"
paulson@15082
   528
apply safe
paulson@15082
   529
apply (cut_tac n = N in real_of_nat_Suc_gt_zero, blast)
paulson@15082
   530
done
paulson@15082
   531
nipkow@15360
   532
lemma lemmaNSBseq2: "\<forall>K > 0. \<exists>n. K < \<bar>X n\<bar>
paulson@15082
   533
                     ==> \<exists>f. \<forall>N. real(Suc N) < \<bar>X (f N)\<bar>"
paulson@15082
   534
apply (drule lemmaNSBseq)
paulson@15082
   535
apply (drule choice, blast)
paulson@15082
   536
done
paulson@15082
   537
paulson@15082
   538
lemma real_seq_to_hypreal_HInfinite:
paulson@15082
   539
     "\<forall>N. real(Suc N) < \<bar>X (f N)\<bar>
paulson@15082
   540
      ==>  Abs_hypreal(hyprel``{X o f}) : HInfinite"
paulson@15082
   541
apply (auto simp add: HInfinite_FreeUltrafilterNat_iff o_def)
paulson@15082
   542
apply (rule bexI [OF _ lemma_hyprel_refl], clarify)  
paulson@15082
   543
apply (cut_tac u = u in FreeUltrafilterNat_nat_gt_real)
paulson@15082
   544
apply (drule FreeUltrafilterNat_all)
paulson@15082
   545
apply (erule FreeUltrafilterNat_Int [THEN FreeUltrafilterNat_subset])
paulson@15082
   546
apply (auto simp add: real_of_nat_Suc)
paulson@15082
   547
done
paulson@15082
   548
paulson@15082
   549
text{* Now prove that we can get out an infinite hypernatural as well
paulson@15082
   550
     defined using the skolem function  @{term "f::nat=>nat"} above*}
paulson@15082
   551
paulson@15082
   552
lemma lemma_finite_NSBseq:
paulson@15082
   553
     "{n. f n \<le> Suc u & real(Suc n) < \<bar>X (f n)\<bar>} \<le>
paulson@15082
   554
      {n. f n \<le> u & real(Suc n) < \<bar>X (f n)\<bar>} Un
paulson@15082
   555
      {n. real(Suc n) < \<bar>X (Suc u)\<bar>}"
paulson@15082
   556
by (auto dest!: le_imp_less_or_eq)
paulson@15082
   557
paulson@15082
   558
lemma lemma_finite_NSBseq2:
paulson@15082
   559
     "finite {n. f n \<le> (u::nat) &  real(Suc n) < \<bar>X(f n)\<bar>}"
paulson@15251
   560
apply (induct "u")
paulson@15082
   561
apply (rule_tac [2] lemma_finite_NSBseq [THEN finite_subset])
paulson@15082
   562
apply (rule_tac B = "{n. real (Suc n) < \<bar>X 0\<bar> }" in finite_subset)
paulson@15082
   563
apply (auto intro: finite_real_of_nat_less_real 
paulson@15082
   564
            simp add: real_of_nat_Suc less_diff_eq [symmetric])
paulson@15082
   565
done
paulson@15082
   566
paulson@15082
   567
lemma HNatInfinite_skolem_f:
paulson@15082
   568
     "\<forall>N. real(Suc N) < \<bar>X (f N)\<bar>
paulson@15082
   569
      ==> Abs_hypnat(hypnatrel``{f}) : HNatInfinite"
paulson@15082
   570
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff)
paulson@15082
   571
apply (rule bexI [OF _ lemma_hypnatrel_refl], safe)
paulson@15082
   572
apply (rule ccontr, drule FreeUltrafilterNat_Compl_mem)
paulson@15082
   573
apply (rule lemma_finite_NSBseq2 [THEN FreeUltrafilterNat_finite, THEN notE]) 
paulson@15082
   574
apply (subgoal_tac "{n. f n \<le> u & real (Suc n) < \<bar>X (f n)\<bar>} =
paulson@15082
   575
                    {n. f n \<le> u} \<inter> {N. real (Suc N) < \<bar>X (f N)\<bar>}")
paulson@15082
   576
apply (erule ssubst) 
paulson@15082
   577
 apply (auto simp add: linorder_not_less Compl_def)
paulson@15082
   578
done
paulson@15082
   579
paulson@15082
   580
lemma NSBseq_Bseq: "NSBseq X ==> Bseq X"
paulson@15082
   581
apply (simp add: Bseq_def NSBseq_def)
paulson@15082
   582
apply (rule ccontr)
paulson@15082
   583
apply (auto simp add: linorder_not_less [symmetric])
paulson@15082
   584
apply (drule lemmaNSBseq2, safe)
paulson@15082
   585
apply (frule_tac X = X and f = f in real_seq_to_hypreal_HInfinite)
paulson@15082
   586
apply (drule HNatInfinite_skolem_f [THEN [2] bspec])
paulson@15082
   587
apply (auto simp add: starfunNat o_def HFinite_HInfinite_iff)
paulson@15082
   588
done
paulson@15082
   589
paulson@15082
   590
text{* Equivalence of nonstandard and standard definitions
paulson@15082
   591
  for a bounded sequence*}
paulson@15082
   592
lemma Bseq_NSBseq_iff: "(Bseq X) = (NSBseq X)"
paulson@15082
   593
by (blast intro!: NSBseq_Bseq Bseq_NSBseq)
paulson@15082
   594
paulson@15082
   595
text{*A convergent sequence is bounded: 
paulson@15082
   596
 Boundedness as a necessary condition for convergence. 
paulson@15082
   597
 The nonstandard version has no existential, as usual *}
paulson@15082
   598
paulson@15082
   599
lemma NSconvergent_NSBseq: "NSconvergent X ==> NSBseq X"
paulson@15082
   600
apply (simp add: NSconvergent_def NSBseq_def NSLIMSEQ_def)
paulson@15082
   601
apply (blast intro: HFinite_hypreal_of_real approx_sym approx_HFinite)
paulson@15082
   602
done
paulson@15082
   603
paulson@15082
   604
text{*Standard Version: easily now proved using equivalence of NS and
paulson@15082
   605
 standard definitions *}
paulson@15082
   606
lemma convergent_Bseq: "convergent X ==> Bseq X"
paulson@15082
   607
by (simp add: NSconvergent_NSBseq convergent_NSconvergent_iff Bseq_NSBseq_iff)
paulson@15082
   608
paulson@15082
   609
paulson@15082
   610
subsection{*Upper Bounds and Lubs of Bounded Sequences*}
paulson@15082
   611
paulson@15082
   612
lemma Bseq_isUb:
paulson@15082
   613
  "!!(X::nat=>real). Bseq X ==> \<exists>U. isUb (UNIV::real set) {x. \<exists>n. X n = x} U"
paulson@15082
   614
by (auto intro: isUbI setleI simp add: Bseq_def abs_le_interval_iff)
paulson@15082
   615
paulson@15082
   616
paulson@15082
   617
text{* Use completeness of reals (supremum property)
paulson@15082
   618
   to show that any bounded sequence has a least upper bound*}
paulson@15082
   619
paulson@15082
   620
lemma Bseq_isLub:
paulson@15082
   621
  "!!(X::nat=>real). Bseq X ==>
paulson@15082
   622
   \<exists>U. isLub (UNIV::real set) {x. \<exists>n. X n = x} U"
paulson@15082
   623
by (blast intro: reals_complete Bseq_isUb)
paulson@15082
   624
paulson@15082
   625
lemma NSBseq_isUb: "NSBseq X ==> \<exists>U. isUb UNIV {x. \<exists>n. X n = x} U"
paulson@15082
   626
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isUb)
paulson@15082
   627
paulson@15082
   628
lemma NSBseq_isLub: "NSBseq X ==> \<exists>U. isLub UNIV {x. \<exists>n. X n = x} U"
paulson@15082
   629
by (simp add: Bseq_NSBseq_iff [symmetric] Bseq_isLub)
paulson@15082
   630
paulson@15082
   631
paulson@15082
   632
subsection{*A Bounded and Monotonic Sequence Converges*}
paulson@15082
   633
paulson@15082
   634
lemma lemma_converg1:
nipkow@15360
   635
     "!!(X::nat=>real). [| \<forall>m. \<forall> n \<ge> m. X m \<le> X n;
paulson@15082
   636
                  isLub (UNIV::real set) {x. \<exists>n. X n = x} (X ma)
nipkow@15360
   637
               |] ==> \<forall>n \<ge> ma. X n = X ma"
paulson@15082
   638
apply safe
paulson@15082
   639
apply (drule_tac y = "X n" in isLubD2)
paulson@15082
   640
apply (blast dest: order_antisym)+
paulson@15082
   641
done
paulson@15082
   642
paulson@15082
   643
text{* The best of both worlds: Easier to prove this result as a standard
paulson@15082
   644
   theorem and then use equivalence to "transfer" it into the
paulson@15082
   645
   equivalent nonstandard form if needed!*}
paulson@15082
   646
paulson@15082
   647
lemma Bmonoseq_LIMSEQ: "\<forall>n. m \<le> n --> X n = X m ==> \<exists>L. (X ----> L)"
paulson@15082
   648
apply (simp add: LIMSEQ_def)
paulson@15082
   649
apply (rule_tac x = "X m" in exI, safe)
paulson@15082
   650
apply (rule_tac x = m in exI, safe)
paulson@15082
   651
apply (drule spec, erule impE, auto)
paulson@15082
   652
done
paulson@15082
   653
paulson@15082
   654
text{*Now, the same theorem in terms of NS limit *}
nipkow@15360
   655
lemma Bmonoseq_NSLIMSEQ: "\<forall>n \<ge> m. X n = X m ==> \<exists>L. (X ----NS> L)"
paulson@15082
   656
by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff)
paulson@15082
   657
paulson@15082
   658
lemma lemma_converg2:
paulson@15082
   659
   "!!(X::nat=>real).
paulson@15082
   660
    [| \<forall>m. X m ~= U;  isLub UNIV {x. \<exists>n. X n = x} U |] ==> \<forall>m. X m < U"
paulson@15082
   661
apply safe
paulson@15082
   662
apply (drule_tac y = "X m" in isLubD2)
paulson@15082
   663
apply (auto dest!: order_le_imp_less_or_eq)
paulson@15082
   664
done
paulson@15082
   665
paulson@15082
   666
lemma lemma_converg3: "!!(X ::nat=>real). \<forall>m. X m \<le> U ==> isUb UNIV {x. \<exists>n. X n = x} U"
paulson@15082
   667
by (rule setleI [THEN isUbI], auto)
paulson@15082
   668
paulson@15082
   669
text{* FIXME: @{term "U - T < U"} is redundant *}
paulson@15082
   670
lemma lemma_converg4: "!!(X::nat=> real).
paulson@15082
   671
               [| \<forall>m. X m ~= U;
paulson@15082
   672
                  isLub UNIV {x. \<exists>n. X n = x} U;
paulson@15082
   673
                  0 < T;
paulson@15082
   674
                  U + - T < U
paulson@15082
   675
               |] ==> \<exists>m. U + -T < X m & X m < U"
paulson@15082
   676
apply (drule lemma_converg2, assumption)
paulson@15082
   677
apply (rule ccontr, simp)
paulson@15082
   678
apply (simp add: linorder_not_less)
paulson@15082
   679
apply (drule lemma_converg3)
paulson@15082
   680
apply (drule isLub_le_isUb, assumption)
paulson@15082
   681
apply (auto dest: order_less_le_trans)
paulson@15082
   682
done
paulson@15082
   683
paulson@15082
   684
text{*A standard proof of the theorem for monotone increasing sequence*}
paulson@15082
   685
paulson@15082
   686
lemma Bseq_mono_convergent:
nipkow@15360
   687
     "[| Bseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> convergent X"
paulson@15082
   688
apply (simp add: convergent_def)
paulson@15082
   689
apply (frule Bseq_isLub, safe)
paulson@15082
   690
apply (case_tac "\<exists>m. X m = U", auto)
paulson@15082
   691
apply (blast dest: lemma_converg1 Bmonoseq_LIMSEQ)
paulson@15082
   692
(* second case *)
paulson@15082
   693
apply (rule_tac x = U in exI)
paulson@15082
   694
apply (subst LIMSEQ_iff, safe)
paulson@15082
   695
apply (frule lemma_converg2, assumption)
paulson@15082
   696
apply (drule lemma_converg4, auto)
paulson@15082
   697
apply (rule_tac x = m in exI, safe)
paulson@15082
   698
apply (subgoal_tac "X m \<le> X n")
paulson@15082
   699
 prefer 2 apply blast
paulson@15082
   700
apply (drule_tac x=n and P="%m. X m < U" in spec, arith)
paulson@15082
   701
done
paulson@15082
   702
paulson@15082
   703
text{*Nonstandard version of the theorem*}
paulson@15082
   704
paulson@15082
   705
lemma NSBseq_mono_NSconvergent:
nipkow@15360
   706
     "[| NSBseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> NSconvergent X"
paulson@15082
   707
by (auto intro: Bseq_mono_convergent 
paulson@15082
   708
         simp add: convergent_NSconvergent_iff [symmetric] 
paulson@15082
   709
                   Bseq_NSBseq_iff [symmetric])
paulson@15082
   710
paulson@15082
   711
lemma convergent_minus_iff: "(convergent X) = (convergent (%n. -(X n)))"
paulson@15082
   712
apply (simp add: convergent_def)
paulson@15082
   713
apply (auto dest: LIMSEQ_minus)
paulson@15082
   714
apply (drule LIMSEQ_minus, auto)
paulson@15082
   715
done
paulson@15082
   716
paulson@15082
   717
lemma Bseq_minus_iff: "Bseq (%n. -(X n)) = Bseq X"
paulson@15082
   718
by (simp add: Bseq_def)
paulson@15082
   719
paulson@15082
   720
text{*Main monotonicity theorem*}
paulson@15082
   721
lemma Bseq_monoseq_convergent: "[| Bseq X; monoseq X |] ==> convergent X"
paulson@15082
   722
apply (simp add: monoseq_def, safe)
paulson@15082
   723
apply (rule_tac [2] convergent_minus_iff [THEN ssubst])
paulson@15082
   724
apply (drule_tac [2] Bseq_minus_iff [THEN ssubst])
paulson@15082
   725
apply (auto intro!: Bseq_mono_convergent)
paulson@15082
   726
done
paulson@15082
   727
paulson@15082
   728
paulson@15082
   729
subsection{*A Few More Equivalence Theorems for Boundedness*}
paulson@15082
   730
paulson@15082
   731
text{*alternative formulation for boundedness*}
nipkow@15360
   732
lemma Bseq_iff2: "Bseq X = (\<exists>k > 0. \<exists>x. \<forall>n. \<bar>X(n) + -x\<bar> \<le> k)"
paulson@15082
   733
apply (unfold Bseq_def, safe)
paulson@15082
   734
apply (rule_tac [2] x = "k + \<bar>x\<bar> " in exI)
nipkow@15360
   735
apply (rule_tac x = K in exI, simp)
paulson@15221
   736
apply (rule exI [where x = 0], auto)
paulson@15221
   737
apply (drule_tac x=n in spec, arith)+
paulson@15082
   738
done
paulson@15082
   739
paulson@15082
   740
text{*alternative formulation for boundedness*}
nipkow@15360
   741
lemma Bseq_iff3: "Bseq X = (\<exists>k > 0. \<exists>N. \<forall>n. abs(X(n) + -X(N)) \<le> k)"
paulson@15082
   742
apply safe
paulson@15082
   743
apply (simp add: Bseq_def, safe)
paulson@15082
   744
apply (rule_tac x = "K + \<bar>X N\<bar> " in exI)
paulson@15082
   745
apply auto
paulson@15082
   746
apply arith
paulson@15082
   747
apply (rule_tac x = N in exI, safe)
paulson@15082
   748
apply (drule_tac x = n in spec, arith)
paulson@15082
   749
apply (auto simp add: Bseq_iff2)
paulson@15082
   750
done
paulson@15082
   751
paulson@15082
   752
lemma BseqI2: "(\<forall>n. k \<le> f n & f n \<le> K) ==> Bseq f"
paulson@15082
   753
apply (simp add: Bseq_def)
paulson@15221
   754
apply (rule_tac x = " (\<bar>k\<bar> + \<bar>K\<bar>) + 1" in exI, auto)
paulson@15082
   755
apply (drule_tac [2] x = n in spec, arith+)
paulson@15082
   756
done
paulson@15082
   757
paulson@15082
   758
paulson@15082
   759
subsection{*Equivalence Between NS and Standard Cauchy Sequences*}
paulson@15082
   760
paulson@15082
   761
subsubsection{*Standard Implies Nonstandard*}
paulson@15082
   762
paulson@15082
   763
lemma lemmaCauchy1:
paulson@15082
   764
     "Abs_hypnat (hypnatrel `` {x}) : HNatInfinite
paulson@15082
   765
      ==> {n. M \<le> x n} : FreeUltrafilterNat"
paulson@15082
   766
apply (auto simp add: HNatInfinite_FreeUltrafilterNat_iff)
paulson@15082
   767
apply (drule_tac x = M in spec, ultra)
paulson@15082
   768
done
paulson@15082
   769
paulson@15082
   770
lemma lemmaCauchy2:
paulson@15082
   771
     "{n. \<forall>m n. M \<le> m & M \<le> (n::nat) --> \<bar>X m + - X n\<bar> < u} Int
paulson@15082
   772
      {n. M \<le> xa n} Int {n. M \<le> x n} \<le>
paulson@15082
   773
      {n. abs (X (xa n) + - X (x n)) < u}"
paulson@15082
   774
by blast
paulson@15082
   775
paulson@15082
   776
lemma Cauchy_NSCauchy: "Cauchy X ==> NSCauchy X"
paulson@15082
   777
apply (simp add: Cauchy_def NSCauchy_def, safe)
paulson@15082
   778
apply (rule_tac z = M in eq_Abs_hypnat)
paulson@15082
   779
apply (rule_tac z = N in eq_Abs_hypnat)
paulson@15082
   780
apply (rule approx_minus_iff [THEN iffD2])
paulson@15082
   781
apply (rule mem_infmal_iff [THEN iffD1])
paulson@15082
   782
apply (auto simp add: starfunNat hypreal_minus hypreal_add Infinitesimal_FreeUltrafilterNat_iff)
paulson@15082
   783
apply (rule bexI, auto)
paulson@15082
   784
apply (drule spec, auto)
paulson@15082
   785
apply (drule_tac M = M in lemmaCauchy1)
paulson@15082
   786
apply (drule_tac M = M in lemmaCauchy1)
paulson@15082
   787
apply (rule_tac x1 = xa in lemmaCauchy2 [THEN [2] FreeUltrafilterNat_subset])
paulson@15082
   788
apply (rule FreeUltrafilterNat_Int)
nipkow@15539
   789
apply (auto intro: FreeUltrafilterNat_Int)
paulson@15082
   790
done
paulson@15082
   791
paulson@15082
   792
subsubsection{*Nonstandard Implies Standard*}
paulson@15082
   793
paulson@15082
   794
lemma NSCauchy_Cauchy: "NSCauchy X ==> Cauchy X"
paulson@15082
   795
apply (auto simp add: Cauchy_def NSCauchy_def)
paulson@15082
   796
apply (rule ccontr, simp)
paulson@15082
   797
apply (auto dest!: choice HNatInfinite_NSLIMSEQ simp add: all_conj_distrib)  
paulson@15082
   798
apply (drule bspec, assumption)
paulson@15082
   799
apply (drule_tac x = "Abs_hypnat (hypnatrel `` {fa}) " in bspec); 
paulson@15082
   800
apply (auto simp add: starfunNat)
paulson@15082
   801
apply (drule approx_minus_iff [THEN iffD1])
paulson@15082
   802
apply (drule mem_infmal_iff [THEN iffD2])
paulson@15082
   803
apply (auto simp add: hypreal_minus hypreal_add Infinitesimal_FreeUltrafilterNat_iff)
paulson@15082
   804
apply (rename_tac "Y")
paulson@15082
   805
apply (drule_tac x = e in spec, auto)
paulson@15082
   806
apply (drule FreeUltrafilterNat_Int, assumption)
paulson@15082
   807
apply (subgoal_tac "{n. \<bar>X (f n) + - X (fa n)\<bar> < e} \<in> \<U>") 
paulson@15082
   808
 prefer 2 apply (erule FreeUltrafilterNat_subset, force) 
paulson@15082
   809
apply (rule FreeUltrafilterNat_empty [THEN notE]) 
paulson@15082
   810
apply (subgoal_tac
paulson@15082
   811
         "{n. abs (X (f n) + - X (fa n)) < e} Int 
paulson@15082
   812
          {M. ~ abs (X (f M) + - X (fa M)) < e}  =  {}")
paulson@15082
   813
apply auto  
paulson@15082
   814
done
paulson@15082
   815
paulson@15082
   816
paulson@15082
   817
theorem NSCauchy_Cauchy_iff: "NSCauchy X = Cauchy X"
paulson@15082
   818
by (blast intro!: NSCauchy_Cauchy Cauchy_NSCauchy)
paulson@15082
   819
paulson@15082
   820
text{*A Cauchy sequence is bounded -- this is the standard
paulson@15082
   821
  proof mechanization rather than the nonstandard proof*}
paulson@15082
   822
nipkow@15360
   823
lemma lemmaCauchy: "\<forall>n \<ge> M. \<bar>X M + - X n\<bar> < (1::real)
nipkow@15360
   824
          ==>  \<forall>n \<ge> M. \<bar>X n\<bar> < 1 + \<bar>X M\<bar>"
paulson@15082
   825
apply safe
paulson@15082
   826
apply (drule spec, auto, arith)
paulson@15082
   827
done
paulson@15082
   828
paulson@15082
   829
lemma less_Suc_cancel_iff: "(n < Suc M) = (n \<le> M)"
paulson@15082
   830
by auto
paulson@15082
   831
paulson@15082
   832
text{* FIXME: Long. Maximal element in subsequence *}
paulson@15082
   833
lemma SUP_rabs_subseq:
nipkow@15360
   834
     "\<exists>m \<le> M. \<forall>n \<le> M. \<bar>(X::nat=> real) n\<bar> \<le> \<bar>X m\<bar>"
paulson@15082
   835
apply (induct M)
paulson@15082
   836
apply (rule_tac x = 0 in exI, simp, safe)
nipkow@15236
   837
apply (cut_tac x = "\<bar>X (Suc M)\<bar>" and y = "\<bar>X m\<bar> " in linorder_less_linear)
paulson@15082
   838
apply safe
paulson@15082
   839
apply (rule_tac x = m in exI)
paulson@15082
   840
apply (rule_tac [2] x = m in exI)
nipkow@15236
   841
apply (rule_tac [3] x = "Suc M" in exI, simp_all, safe)
nipkow@15236
   842
apply (erule_tac [!] m1 = n in le_imp_less_or_eq [THEN disjE]) 
paulson@15082
   843
apply (simp_all add: less_Suc_cancel_iff)
paulson@15082
   844
apply (blast intro: order_le_less_trans [THEN order_less_imp_le])
paulson@15082
   845
done
paulson@15082
   846
paulson@15082
   847
lemma lemma_Nat_covered:
paulson@15082
   848
     "[| \<forall>m::nat. m \<le> M --> P M m;
nipkow@15360
   849
         \<forall>m \<ge> M. P M m |]
paulson@15082
   850
      ==> \<forall>m. P M m"
paulson@15082
   851
by (auto elim: less_asym simp add: le_def)
paulson@15082
   852
paulson@15082
   853
paulson@15082
   854
lemma lemma_trans1:
nipkow@15360
   855
     "[| \<forall>n \<le> M. \<bar>(X::nat=>real) n\<bar> \<le> a;  a < b |]
nipkow@15360
   856
      ==> \<forall>n \<le> M. \<bar>X n\<bar> \<le> b"
paulson@15082
   857
by (blast intro: order_le_less_trans [THEN order_less_imp_le])
paulson@15082
   858
paulson@15082
   859
lemma lemma_trans2:
nipkow@15360
   860
     "[| \<forall>n \<ge> M. \<bar>(X::nat=>real) n\<bar> < a; a < b |]
nipkow@15360
   861
      ==> \<forall>n \<ge> M. \<bar>X n\<bar>\<le> b"
paulson@15082
   862
by (blast intro: order_less_trans [THEN order_less_imp_le])
paulson@15082
   863
paulson@15082
   864
lemma lemma_trans3:
nipkow@15360
   865
     "[| \<forall>n \<le> M. \<bar>X n\<bar> \<le> a; a = b |]
nipkow@15360
   866
      ==> \<forall>n \<le> M. \<bar>X n\<bar> \<le> b"
paulson@15082
   867
by auto
paulson@15082
   868
nipkow@15360
   869
lemma lemma_trans4: "\<forall>n \<ge> M. \<bar>(X::nat=>real) n\<bar> < a
nipkow@15360
   870
              ==>  \<forall>n \<ge> M. \<bar>X n\<bar> \<le> a"
paulson@15082
   871
by (blast intro: order_less_imp_le)
paulson@15082
   872
paulson@15082
   873
paulson@15082
   874
text{*Proof is more involved than outlines sketched by various authors
paulson@15082
   875
 would suggest*}
paulson@15082
   876
paulson@15082
   877
lemma Cauchy_Bseq: "Cauchy X ==> Bseq X"
paulson@15082
   878
apply (simp add: Cauchy_def Bseq_def)
paulson@15082
   879
apply (drule_tac x = 1 in spec)
paulson@15082
   880
apply (erule zero_less_one [THEN [2] impE], safe)
paulson@15082
   881
apply (drule_tac x = M in spec, simp)
paulson@15082
   882
apply (drule lemmaCauchy)
paulson@15082
   883
apply (cut_tac M = M and X = X in SUP_rabs_subseq, safe)
paulson@15082
   884
apply (cut_tac x = "\<bar>X m\<bar> " and y = "1 + \<bar>X M\<bar> " in linorder_less_linear)
paulson@15082
   885
apply safe
paulson@15082
   886
apply (drule lemma_trans1, assumption)
paulson@15082
   887
apply (drule_tac [3] lemma_trans2, erule_tac [3] asm_rl)
paulson@15082
   888
apply (drule_tac [2] lemma_trans3, erule_tac [2] asm_rl)
paulson@15082
   889
apply (drule_tac [3] abs_add_one_gt_zero [THEN order_less_trans])
paulson@15082
   890
apply (drule lemma_trans4)
paulson@15082
   891
apply (drule_tac [2] lemma_trans4)
paulson@15082
   892
apply (rule_tac x = "1 + \<bar>X M\<bar> " in exI)
paulson@15082
   893
apply (rule_tac [2] x = "1 + \<bar>X M\<bar> " in exI)
paulson@15082
   894
apply (rule_tac [3] x = "\<bar>X m\<bar> " in exI)
paulson@15085
   895
apply (auto elim!: lemma_Nat_covered)
paulson@15082
   896
done
paulson@15082
   897
paulson@15082
   898
text{*A Cauchy sequence is bounded -- nonstandard version*}
paulson@15082
   899
paulson@15082
   900
lemma NSCauchy_NSBseq: "NSCauchy X ==> NSBseq X"
paulson@15082
   901
by (simp add: Cauchy_Bseq Bseq_NSBseq_iff [symmetric] NSCauchy_Cauchy_iff)
paulson@15082
   902
paulson@15082
   903
paulson@15082
   904
text{*Equivalence of Cauchy criterion and convergence:
paulson@15082
   905
  We will prove this using our NS formulation which provides a
paulson@15082
   906
  much easier proof than using the standard definition. We do not
paulson@15082
   907
  need to use properties of subsequences such as boundedness,
paulson@15082
   908
  monotonicity etc... Compare with Harrison's corresponding proof
paulson@15082
   909
  in HOL which is much longer and more complicated. Of course, we do
paulson@15082
   910
  not have problems which he encountered with guessing the right
paulson@15082
   911
  instantiations for his 'espsilon-delta' proof(s) in this case
paulson@15082
   912
  since the NS formulations do not involve existential quantifiers.*}
paulson@15082
   913
paulson@15082
   914
lemma NSCauchy_NSconvergent_iff: "NSCauchy X = NSconvergent X"
paulson@15082
   915
apply (simp add: NSconvergent_def NSLIMSEQ_def, safe)
paulson@15082
   916
apply (frule NSCauchy_NSBseq)
paulson@15082
   917
apply (auto intro: approx_trans2 simp add: NSBseq_def NSCauchy_def)
paulson@15082
   918
apply (drule HNatInfinite_whn [THEN [2] bspec])
paulson@15082
   919
apply (drule HNatInfinite_whn [THEN [2] bspec])
paulson@15082
   920
apply (auto dest!: st_part_Ex simp add: SReal_iff)
paulson@15082
   921
apply (blast intro: approx_trans3)
paulson@15082
   922
done
paulson@15082
   923
paulson@15082
   924
text{*Standard proof for free*}
paulson@15082
   925
lemma Cauchy_convergent_iff: "Cauchy X = convergent X"
paulson@15082
   926
by (simp add: NSCauchy_Cauchy_iff [symmetric] convergent_NSconvergent_iff NSCauchy_NSconvergent_iff)
paulson@15082
   927
paulson@15082
   928
paulson@15082
   929
text{*We can now try and derive a few properties of sequences,
paulson@15082
   930
     starting with the limit comparison property for sequences.*}
paulson@15082
   931
paulson@15082
   932
lemma NSLIMSEQ_le:
paulson@15082
   933
       "[| f ----NS> l; g ----NS> m;
nipkow@15360
   934
           \<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n)
nipkow@15360
   935
        |] ==> l \<le> m"
paulson@15082
   936
apply (simp add: NSLIMSEQ_def, safe)
paulson@15082
   937
apply (drule starfun_le_mono)
paulson@15082
   938
apply (drule HNatInfinite_whn [THEN [2] bspec])+
paulson@15082
   939
apply (drule_tac x = whn in spec)
paulson@15082
   940
apply (drule bex_Infinitesimal_iff2 [THEN iffD2])+
paulson@15082
   941
apply clarify
paulson@15082
   942
apply (auto intro: hypreal_of_real_le_add_Infininitesimal_cancel2)
paulson@15082
   943
done
paulson@15082
   944
paulson@15082
   945
(* standard version *)
paulson@15082
   946
lemma LIMSEQ_le:
nipkow@15360
   947
     "[| f ----> l; g ----> m; \<exists>N. \<forall>n \<ge> N. f(n) \<le> g(n) |]
paulson@15082
   948
      ==> l \<le> m"
paulson@15082
   949
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_le)
paulson@15082
   950
paulson@15082
   951
lemma LIMSEQ_le_const: "[| X ----> r; \<forall>n. a \<le> X n |] ==> a \<le> r"
paulson@15082
   952
apply (rule LIMSEQ_le)
paulson@15082
   953
apply (rule LIMSEQ_const, auto)
paulson@15082
   954
done
paulson@15082
   955
paulson@15082
   956
lemma NSLIMSEQ_le_const: "[| X ----NS> r; \<forall>n. a \<le> X n |] ==> a \<le> r"
paulson@15082
   957
by (simp add: LIMSEQ_NSLIMSEQ_iff LIMSEQ_le_const)
paulson@15082
   958
paulson@15082
   959
lemma LIMSEQ_le_const2: "[| X ----> r; \<forall>n. X n \<le> a |] ==> r \<le> a"
paulson@15082
   960
apply (rule LIMSEQ_le)
paulson@15082
   961
apply (rule_tac [2] LIMSEQ_const, auto)
paulson@15082
   962
done
paulson@15082
   963
paulson@15082
   964
lemma NSLIMSEQ_le_const2: "[| X ----NS> r; \<forall>n. X n \<le> a |] ==> r \<le> a"
paulson@15082
   965
by (simp add: LIMSEQ_NSLIMSEQ_iff LIMSEQ_le_const2)
paulson@15082
   966
paulson@15082
   967
text{*Shift a convergent series by 1:
paulson@15082
   968
  By the equivalence between Cauchiness and convergence and because
paulson@15082
   969
  the successor of an infinite hypernatural is also infinite.*}
paulson@15082
   970
paulson@15082
   971
lemma NSLIMSEQ_Suc: "f ----NS> l ==> (%n. f(Suc n)) ----NS> l"
paulson@15082
   972
apply (frule NSconvergentI [THEN NSCauchy_NSconvergent_iff [THEN iffD2]])
paulson@15082
   973
apply (auto simp add: NSCauchy_def NSLIMSEQ_def starfunNat_shift_one)
paulson@15082
   974
apply (drule bspec, assumption)
paulson@15082
   975
apply (drule bspec, assumption)
paulson@15082
   976
apply (drule Nats_1 [THEN [2] HNatInfinite_SHNat_add])
paulson@15082
   977
apply (blast intro: approx_trans3)
paulson@15082
   978
done
paulson@15082
   979
paulson@15082
   980
text{* standard version *}
paulson@15082
   981
lemma LIMSEQ_Suc: "f ----> l ==> (%n. f(Suc n)) ----> l"
paulson@15082
   982
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_Suc)
paulson@15082
   983
paulson@15082
   984
lemma NSLIMSEQ_imp_Suc: "(%n. f(Suc n)) ----NS> l ==> f ----NS> l"
paulson@15082
   985
apply (frule NSconvergentI [THEN NSCauchy_NSconvergent_iff [THEN iffD2]])
paulson@15082
   986
apply (auto simp add: NSCauchy_def NSLIMSEQ_def starfunNat_shift_one)
paulson@15082
   987
apply (drule bspec, assumption)
paulson@15082
   988
apply (drule bspec, assumption)
paulson@15082
   989
apply (frule Nats_1 [THEN [2] HNatInfinite_SHNat_diff])
paulson@15082
   990
apply (drule_tac x="N - 1" in bspec) 
paulson@15082
   991
apply (auto intro: approx_trans3)
paulson@15082
   992
done
paulson@15082
   993
paulson@15082
   994
lemma LIMSEQ_imp_Suc: "(%n. f(Suc n)) ----> l ==> f ----> l"
paulson@15082
   995
apply (simp add: LIMSEQ_NSLIMSEQ_iff)
paulson@15082
   996
apply (erule NSLIMSEQ_imp_Suc)
paulson@15082
   997
done
paulson@15082
   998
paulson@15082
   999
lemma LIMSEQ_Suc_iff: "((%n. f(Suc n)) ----> l) = (f ----> l)"
paulson@15082
  1000
by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
paulson@15082
  1001
paulson@15082
  1002
lemma NSLIMSEQ_Suc_iff: "((%n. f(Suc n)) ----NS> l) = (f ----NS> l)"
paulson@15082
  1003
by (blast intro: NSLIMSEQ_imp_Suc NSLIMSEQ_Suc)
paulson@15082
  1004
paulson@15082
  1005
text{*A sequence tends to zero iff its abs does*}
paulson@15082
  1006
lemma LIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----> 0) = (f ----> 0)"
paulson@15082
  1007
by (simp add: LIMSEQ_def)
paulson@15082
  1008
paulson@15082
  1009
text{*We prove the NS version from the standard one, since the NS proof
paulson@15082
  1010
   seems more complicated than the standard one above!*}
paulson@15082
  1011
lemma NSLIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----NS> 0) = (f ----NS> 0)"
paulson@15082
  1012
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_rabs_zero)
paulson@15082
  1013
paulson@15082
  1014
text{*Generalization to other limits*}
paulson@15082
  1015
lemma NSLIMSEQ_imp_rabs: "f ----NS> l ==> (%n. \<bar>f n\<bar>) ----NS> \<bar>l\<bar>"
paulson@15082
  1016
apply (simp add: NSLIMSEQ_def)
paulson@15082
  1017
apply (auto intro: approx_hrabs 
paulson@15082
  1018
            simp add: starfunNat_rabs hypreal_of_real_hrabs [symmetric])
paulson@15082
  1019
done
paulson@15082
  1020
paulson@15082
  1021
text{* standard version *}
paulson@15082
  1022
lemma LIMSEQ_imp_rabs: "f ----> l ==> (%n. \<bar>f n\<bar>) ----> \<bar>l\<bar>"
paulson@15082
  1023
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_imp_rabs)
paulson@15082
  1024
paulson@15082
  1025
text{*An unbounded sequence's inverse tends to 0*}
paulson@15082
  1026
paulson@15082
  1027
text{* standard proof seems easier *}
paulson@15082
  1028
lemma LIMSEQ_inverse_zero:
nipkow@15360
  1029
      "\<forall>y. \<exists>N. \<forall>n \<ge> N. y < f(n) ==> (%n. inverse(f n)) ----> 0"
paulson@15082
  1030
apply (simp add: LIMSEQ_def, safe)
paulson@15082
  1031
apply (drule_tac x = "inverse r" in spec, safe)
paulson@15082
  1032
apply (rule_tac x = N in exI, safe)
paulson@15082
  1033
apply (drule spec, auto)
paulson@15082
  1034
apply (frule positive_imp_inverse_positive)
paulson@15082
  1035
apply (frule order_less_trans, assumption)
paulson@15082
  1036
apply (frule_tac a = "f n" in positive_imp_inverse_positive)
paulson@15082
  1037
apply (simp add: abs_if) 
paulson@15082
  1038
apply (rule_tac t = r in inverse_inverse_eq [THEN subst])
paulson@15082
  1039
apply (auto intro: inverse_less_iff_less [THEN iffD2]
paulson@15082
  1040
            simp del: inverse_inverse_eq)
paulson@15082
  1041
done
paulson@15082
  1042
paulson@15082
  1043
lemma NSLIMSEQ_inverse_zero:
nipkow@15360
  1044
     "\<forall>y. \<exists>N. \<forall>n \<ge> N. y < f(n)
paulson@15082
  1045
      ==> (%n. inverse(f n)) ----NS> 0"
paulson@15082
  1046
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_zero)
paulson@15082
  1047
paulson@15082
  1048
text{*The sequence @{term "1/n"} tends to 0 as @{term n} tends to infinity*}
paulson@15082
  1049
paulson@15082
  1050
lemma LIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) ----> 0"
paulson@15082
  1051
apply (rule LIMSEQ_inverse_zero, safe)
paulson@15082
  1052
apply (cut_tac x = y in reals_Archimedean2)
paulson@15082
  1053
apply (safe, rule_tac x = n in exI)
paulson@15082
  1054
apply (auto simp add: real_of_nat_Suc)
paulson@15082
  1055
done
paulson@15082
  1056
paulson@15082
  1057
lemma NSLIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) ----NS> 0"
paulson@15082
  1058
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat)
paulson@15082
  1059
paulson@15082
  1060
text{*The sequence @{term "r + 1/n"} tends to @{term r} as @{term n} tends to
paulson@15082
  1061
infinity is now easily proved*}
paulson@15082
  1062
paulson@15082
  1063
lemma LIMSEQ_inverse_real_of_nat_add:
paulson@15082
  1064
     "(%n. r + inverse(real(Suc n))) ----> r"
paulson@15082
  1065
by (cut_tac LIMSEQ_add [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto)
paulson@15082
  1066
paulson@15082
  1067
lemma NSLIMSEQ_inverse_real_of_nat_add:
paulson@15082
  1068
     "(%n. r + inverse(real(Suc n))) ----NS> r"
paulson@15082
  1069
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add)
paulson@15082
  1070
paulson@15082
  1071
lemma LIMSEQ_inverse_real_of_nat_add_minus:
paulson@15082
  1072
     "(%n. r + -inverse(real(Suc n))) ----> r"
paulson@15082
  1073
by (cut_tac LIMSEQ_add_minus [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto)
paulson@15082
  1074
paulson@15082
  1075
lemma NSLIMSEQ_inverse_real_of_nat_add_minus:
paulson@15082
  1076
     "(%n. r + -inverse(real(Suc n))) ----NS> r"
paulson@15082
  1077
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add_minus)
paulson@15082
  1078
paulson@15082
  1079
lemma LIMSEQ_inverse_real_of_nat_add_minus_mult:
paulson@15082
  1080
     "(%n. r*( 1 + -inverse(real(Suc n)))) ----> r"
paulson@15082
  1081
by (cut_tac b=1 in
paulson@15082
  1082
        LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat_add_minus], auto)
paulson@15082
  1083
paulson@15082
  1084
lemma NSLIMSEQ_inverse_real_of_nat_add_minus_mult:
paulson@15082
  1085
     "(%n. r*( 1 + -inverse(real(Suc n)))) ----NS> r"
paulson@15082
  1086
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat_add_minus_mult)
paulson@15082
  1087
paulson@15082
  1088
paulson@15082
  1089
text{* Real Powers*}
paulson@15082
  1090
paulson@15082
  1091
lemma NSLIMSEQ_pow [rule_format]:
paulson@15082
  1092
     "(X ----NS> a) --> ((%n. (X n) ^ m) ----NS> a ^ m)"
paulson@15251
  1093
apply (induct "m")
paulson@15082
  1094
apply (auto intro: NSLIMSEQ_mult NSLIMSEQ_const)
paulson@15082
  1095
done
paulson@15082
  1096
paulson@15082
  1097
lemma LIMSEQ_pow: "X ----> a ==> (%n. (X n) ^ m) ----> a ^ m"
paulson@15082
  1098
by (simp add: LIMSEQ_NSLIMSEQ_iff NSLIMSEQ_pow)
paulson@15082
  1099
paulson@15082
  1100
text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term
paulson@15082
  1101
"x<1"}.  Proof will use (NS) Cauchy equivalence for convergence and
paulson@15082
  1102
  also fact that bounded and monotonic sequence converges.*}
paulson@15082
  1103
paulson@15082
  1104
lemma Bseq_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> Bseq (%n. x ^ n)"
paulson@15082
  1105
apply (simp add: Bseq_def)
paulson@15082
  1106
apply (rule_tac x = 1 in exI)
paulson@15082
  1107
apply (simp add: power_abs)
paulson@15082
  1108
apply (auto dest: power_mono intro: order_less_imp_le simp add: abs_if)
paulson@15082
  1109
done
paulson@15082
  1110
paulson@15082
  1111
lemma monoseq_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> monoseq (%n. x ^ n)"
paulson@15082
  1112
apply (clarify intro!: mono_SucI2)
paulson@15082
  1113
apply (cut_tac n = n and N = "Suc n" and a = x in power_decreasing, auto)
paulson@15082
  1114
done
paulson@15082
  1115
paulson@15082
  1116
lemma convergent_realpow: "[| 0 \<le> x; x \<le> 1 |] ==> convergent (%n. x ^ n)"
paulson@15082
  1117
by (blast intro!: Bseq_monoseq_convergent Bseq_realpow monoseq_realpow)
paulson@15082
  1118
paulson@15082
  1119
text{* We now use NS criterion to bring proof of theorem through *}
paulson@15082
  1120
paulson@15082
  1121
lemma NSLIMSEQ_realpow_zero: "[| 0 \<le> x; x < 1 |] ==> (%n. x ^ n) ----NS> 0"
paulson@15082
  1122
apply (simp add: NSLIMSEQ_def)
paulson@15082
  1123
apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff)
paulson@15082
  1124
apply (frule NSconvergentD)
paulson@15082
  1125
apply (auto simp add: NSLIMSEQ_def NSCauchy_NSconvergent_iff [symmetric] NSCauchy_def starfunNat_pow)
paulson@15082
  1126
apply (frule HNatInfinite_add_one)
paulson@15082
  1127
apply (drule bspec, assumption)
paulson@15082
  1128
apply (drule bspec, assumption)
paulson@15082
  1129
apply (drule_tac x = "N + (1::hypnat) " in bspec, assumption)
paulson@15082
  1130
apply (simp add: hyperpow_add)
paulson@15082
  1131
apply (drule approx_mult_subst_SReal, assumption)
paulson@15082
  1132
apply (drule approx_trans3, assumption)
paulson@15082
  1133
apply (auto simp del: hypreal_of_real_mult simp add: hypreal_of_real_mult [symmetric])
paulson@15082
  1134
done
paulson@15082
  1135
paulson@15082
  1136
text{* standard version *}
paulson@15082
  1137
lemma LIMSEQ_realpow_zero: "[| 0 \<le> x; x < 1 |] ==> (%n. x ^ n) ----> 0"
paulson@15082
  1138
by (simp add: NSLIMSEQ_realpow_zero LIMSEQ_NSLIMSEQ_iff)
paulson@15082
  1139
paulson@15082
  1140
lemma LIMSEQ_divide_realpow_zero: "1 < x ==> (%n. a / (x ^ n)) ----> 0"
paulson@15082
  1141
apply (cut_tac a = a and x1 = "inverse x" in
paulson@15082
  1142
        LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_realpow_zero])
paulson@15082
  1143
apply (auto simp add: divide_inverse power_inverse)
paulson@15082
  1144
apply (simp add: inverse_eq_divide pos_divide_less_eq)
paulson@15082
  1145
done
paulson@15082
  1146
paulson@15102
  1147
text{*Limit of @{term "c^n"} for @{term"\<bar>c\<bar> < 1"}*}
paulson@15082
  1148
paulson@15082
  1149
lemma LIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < 1 ==> (%n. \<bar>c\<bar> ^ n) ----> 0"
paulson@15082
  1150
by (blast intro!: LIMSEQ_realpow_zero abs_ge_zero)
paulson@15082
  1151
paulson@15082
  1152
lemma NSLIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < 1 ==> (%n. \<bar>c\<bar> ^ n) ----NS> 0"
paulson@15082
  1153
by (simp add: LIMSEQ_rabs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric])
paulson@15082
  1154
paulson@15082
  1155
lemma LIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < 1 ==> (%n. c ^ n) ----> 0"
paulson@15082
  1156
apply (rule LIMSEQ_rabs_zero [THEN iffD1])
paulson@15082
  1157
apply (auto intro: LIMSEQ_rabs_realpow_zero simp add: power_abs)
paulson@15082
  1158
done
paulson@15082
  1159
paulson@15082
  1160
lemma NSLIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < 1 ==> (%n. c ^ n) ----NS> 0"
paulson@15082
  1161
by (simp add: LIMSEQ_rabs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric])
paulson@15082
  1162
paulson@15082
  1163
subsection{*Hyperreals and Sequences*}
paulson@15082
  1164
paulson@15082
  1165
text{*A bounded sequence is a finite hyperreal*}
paulson@15082
  1166
lemma NSBseq_HFinite_hypreal: "NSBseq X ==> Abs_hypreal(hyprel``{X}) : HFinite"
paulson@15082
  1167
by (auto intro!: bexI lemma_hyprel_refl 
paulson@15082
  1168
            intro: FreeUltrafilterNat_all [THEN FreeUltrafilterNat_subset]
paulson@15082
  1169
            simp add: HFinite_FreeUltrafilterNat_iff Bseq_NSBseq_iff [symmetric]
paulson@15082
  1170
                      Bseq_iff1a)
paulson@15082
  1171
paulson@15082
  1172
text{*A sequence converging to zero defines an infinitesimal*}
paulson@15082
  1173
lemma NSLIMSEQ_zero_Infinitesimal_hypreal:
paulson@15082
  1174
      "X ----NS> 0 ==> Abs_hypreal(hyprel``{X}) : Infinitesimal"
paulson@15082
  1175
apply (simp add: NSLIMSEQ_def)
paulson@15082
  1176
apply (drule_tac x = whn in bspec)
paulson@15082
  1177
apply (simp add: HNatInfinite_whn)
paulson@15082
  1178
apply (auto simp add: hypnat_omega_def mem_infmal_iff [symmetric] starfunNat)
paulson@15082
  1179
done
paulson@15082
  1180
paulson@15082
  1181
(***---------------------------------------------------------------
paulson@15082
  1182
    Theorems proved by Harrison in HOL that we do not need
paulson@15082
  1183
    in order to prove equivalence between Cauchy criterion
paulson@15082
  1184
    and convergence:
paulson@15082
  1185
 -- Show that every sequence contains a monotonic subsequence
paulson@15082
  1186
Goal "\<exists>f. subseq f & monoseq (%n. s (f n))"
paulson@15082
  1187
 -- Show that a subsequence of a bounded sequence is bounded
paulson@15082
  1188
Goal "Bseq X ==> Bseq (%n. X (f n))";
paulson@15082
  1189
 -- Show we can take subsequential terms arbitrarily far
paulson@15082
  1190
    up a sequence
paulson@15082
  1191
Goal "subseq f ==> n \<le> f(n)";
paulson@15082
  1192
Goal "subseq f ==> \<exists>n. N1 \<le> n & N2 \<le> f(n)";
paulson@15082
  1193
 ---------------------------------------------------------------***)
paulson@15082
  1194
paulson@15241
  1195
paulson@15082
  1196
ML
paulson@15082
  1197
{*
paulson@15082
  1198
val Cauchy_def = thm"Cauchy_def";
paulson@15082
  1199
val SEQ_Infinitesimal = thm "SEQ_Infinitesimal";
paulson@15082
  1200
val LIMSEQ_iff = thm "LIMSEQ_iff";
paulson@15082
  1201
val NSLIMSEQ_iff = thm "NSLIMSEQ_iff";
paulson@15082
  1202
val LIMSEQ_NSLIMSEQ = thm "LIMSEQ_NSLIMSEQ";
paulson@15082
  1203
val NSLIMSEQ_finite_set = thm "NSLIMSEQ_finite_set";
paulson@15082
  1204
val Compl_less_set = thm "Compl_less_set";
paulson@15082
  1205
val FreeUltrafilterNat_NSLIMSEQ = thm "FreeUltrafilterNat_NSLIMSEQ";
paulson@15082
  1206
val HNatInfinite_NSLIMSEQ = thm "HNatInfinite_NSLIMSEQ";
paulson@15082
  1207
val NSLIMSEQ_LIMSEQ = thm "NSLIMSEQ_LIMSEQ";
paulson@15082
  1208
val LIMSEQ_NSLIMSEQ_iff = thm "LIMSEQ_NSLIMSEQ_iff";
paulson@15082
  1209
val NSLIMSEQ_const = thm "NSLIMSEQ_const";
paulson@15082
  1210
val LIMSEQ_const = thm "LIMSEQ_const";
paulson@15082
  1211
val NSLIMSEQ_add = thm "NSLIMSEQ_add";
paulson@15082
  1212
val LIMSEQ_add = thm "LIMSEQ_add";
paulson@15082
  1213
val NSLIMSEQ_mult = thm "NSLIMSEQ_mult";
paulson@15082
  1214
val LIMSEQ_mult = thm "LIMSEQ_mult";
paulson@15082
  1215
val NSLIMSEQ_minus = thm "NSLIMSEQ_minus";
paulson@15082
  1216
val LIMSEQ_minus = thm "LIMSEQ_minus";
paulson@15082
  1217
val LIMSEQ_minus_cancel = thm "LIMSEQ_minus_cancel";
paulson@15082
  1218
val NSLIMSEQ_minus_cancel = thm "NSLIMSEQ_minus_cancel";
paulson@15082
  1219
val NSLIMSEQ_add_minus = thm "NSLIMSEQ_add_minus";
paulson@15082
  1220
val LIMSEQ_add_minus = thm "LIMSEQ_add_minus";
paulson@15082
  1221
val LIMSEQ_diff = thm "LIMSEQ_diff";
paulson@15082
  1222
val NSLIMSEQ_diff = thm "NSLIMSEQ_diff";
paulson@15082
  1223
val NSLIMSEQ_inverse = thm "NSLIMSEQ_inverse";
paulson@15082
  1224
val LIMSEQ_inverse = thm "LIMSEQ_inverse";
paulson@15082
  1225
val NSLIMSEQ_mult_inverse = thm "NSLIMSEQ_mult_inverse";
paulson@15082
  1226
val LIMSEQ_divide = thm "LIMSEQ_divide";
paulson@15082
  1227
val NSLIMSEQ_unique = thm "NSLIMSEQ_unique";
paulson@15082
  1228
val LIMSEQ_unique = thm "LIMSEQ_unique";
paulson@15082
  1229
val limI = thm "limI";
paulson@15082
  1230
val nslimI = thm "nslimI";
paulson@15082
  1231
val lim_nslim_iff = thm "lim_nslim_iff";
paulson@15082
  1232
val convergentD = thm "convergentD";
paulson@15082
  1233
val convergentI = thm "convergentI";
paulson@15082
  1234
val NSconvergentD = thm "NSconvergentD";
paulson@15082
  1235
val NSconvergentI = thm "NSconvergentI";
paulson@15082
  1236
val convergent_NSconvergent_iff = thm "convergent_NSconvergent_iff";
paulson@15082
  1237
val NSconvergent_NSLIMSEQ_iff = thm "NSconvergent_NSLIMSEQ_iff";
paulson@15082
  1238
val convergent_LIMSEQ_iff = thm "convergent_LIMSEQ_iff";
paulson@15082
  1239
val subseq_Suc_iff = thm "subseq_Suc_iff";
paulson@15082
  1240
val monoseq_Suc = thm "monoseq_Suc";
paulson@15082
  1241
val monoI1 = thm "monoI1";
paulson@15082
  1242
val monoI2 = thm "monoI2";
paulson@15082
  1243
val mono_SucI1 = thm "mono_SucI1";
paulson@15082
  1244
val mono_SucI2 = thm "mono_SucI2";
paulson@15082
  1245
val BseqD = thm "BseqD";
paulson@15082
  1246
val BseqI = thm "BseqI";
paulson@15082
  1247
val Bseq_iff = thm "Bseq_iff";
paulson@15082
  1248
val Bseq_iff1a = thm "Bseq_iff1a";
paulson@15082
  1249
val NSBseqD = thm "NSBseqD";
paulson@15082
  1250
val NSBseqI = thm "NSBseqI";
paulson@15082
  1251
val Bseq_NSBseq = thm "Bseq_NSBseq";
paulson@15082
  1252
val real_seq_to_hypreal_HInfinite = thm "real_seq_to_hypreal_HInfinite";
paulson@15082
  1253
val HNatInfinite_skolem_f = thm "HNatInfinite_skolem_f";
paulson@15082
  1254
val NSBseq_Bseq = thm "NSBseq_Bseq";
paulson@15082
  1255
val Bseq_NSBseq_iff = thm "Bseq_NSBseq_iff";
paulson@15082
  1256
val NSconvergent_NSBseq = thm "NSconvergent_NSBseq";
paulson@15082
  1257
val convergent_Bseq = thm "convergent_Bseq";
paulson@15082
  1258
val Bseq_isUb = thm "Bseq_isUb";
paulson@15082
  1259
val Bseq_isLub = thm "Bseq_isLub";
paulson@15082
  1260
val NSBseq_isUb = thm "NSBseq_isUb";
paulson@15082
  1261
val NSBseq_isLub = thm "NSBseq_isLub";
paulson@15082
  1262
val Bmonoseq_LIMSEQ = thm "Bmonoseq_LIMSEQ";
paulson@15082
  1263
val Bmonoseq_NSLIMSEQ = thm "Bmonoseq_NSLIMSEQ";
paulson@15082
  1264
val Bseq_mono_convergent = thm "Bseq_mono_convergent";
paulson@15082
  1265
val NSBseq_mono_NSconvergent = thm "NSBseq_mono_NSconvergent";
paulson@15082
  1266
val convergent_minus_iff = thm "convergent_minus_iff";
paulson@15082
  1267
val Bseq_minus_iff = thm "Bseq_minus_iff";
paulson@15082
  1268
val Bseq_monoseq_convergent = thm "Bseq_monoseq_convergent";
paulson@15082
  1269
val Bseq_iff2 = thm "Bseq_iff2";
paulson@15082
  1270
val Bseq_iff3 = thm "Bseq_iff3";
paulson@15082
  1271
val BseqI2 = thm "BseqI2";
paulson@15082
  1272
val Cauchy_NSCauchy = thm "Cauchy_NSCauchy";
paulson@15082
  1273
val NSCauchy_Cauchy = thm "NSCauchy_Cauchy";
paulson@15082
  1274
val NSCauchy_Cauchy_iff = thm "NSCauchy_Cauchy_iff";
paulson@15082
  1275
val less_Suc_cancel_iff = thm "less_Suc_cancel_iff";
paulson@15082
  1276
val SUP_rabs_subseq = thm "SUP_rabs_subseq";
paulson@15082
  1277
val Cauchy_Bseq = thm "Cauchy_Bseq";
paulson@15082
  1278
val NSCauchy_NSBseq = thm "NSCauchy_NSBseq";
paulson@15082
  1279
val NSCauchy_NSconvergent_iff = thm "NSCauchy_NSconvergent_iff";
paulson@15082
  1280
val Cauchy_convergent_iff = thm "Cauchy_convergent_iff";
paulson@15082
  1281
val NSLIMSEQ_le = thm "NSLIMSEQ_le";
paulson@15082
  1282
val LIMSEQ_le = thm "LIMSEQ_le";
paulson@15082
  1283
val LIMSEQ_le_const = thm "LIMSEQ_le_const";
paulson@15082
  1284
val NSLIMSEQ_le_const = thm "NSLIMSEQ_le_const";
paulson@15082
  1285
val LIMSEQ_le_const2 = thm "LIMSEQ_le_const2";
paulson@15082
  1286
val NSLIMSEQ_le_const2 = thm "NSLIMSEQ_le_const2";
paulson@15082
  1287
val NSLIMSEQ_Suc = thm "NSLIMSEQ_Suc";
paulson@15082
  1288
val LIMSEQ_Suc = thm "LIMSEQ_Suc";
paulson@15082
  1289
val NSLIMSEQ_imp_Suc = thm "NSLIMSEQ_imp_Suc";
paulson@15082
  1290
val LIMSEQ_imp_Suc = thm "LIMSEQ_imp_Suc";
paulson@15082
  1291
val LIMSEQ_Suc_iff = thm "LIMSEQ_Suc_iff";
paulson@15082
  1292
val NSLIMSEQ_Suc_iff = thm "NSLIMSEQ_Suc_iff";
paulson@15082
  1293
val LIMSEQ_rabs_zero = thm "LIMSEQ_rabs_zero";
paulson@15082
  1294
val NSLIMSEQ_rabs_zero = thm "NSLIMSEQ_rabs_zero";
paulson@15082
  1295
val NSLIMSEQ_imp_rabs = thm "NSLIMSEQ_imp_rabs";
paulson@15082
  1296
val LIMSEQ_imp_rabs = thm "LIMSEQ_imp_rabs";
paulson@15082
  1297
val LIMSEQ_inverse_zero = thm "LIMSEQ_inverse_zero";
paulson@15082
  1298
val NSLIMSEQ_inverse_zero = thm "NSLIMSEQ_inverse_zero";
paulson@15082
  1299
val LIMSEQ_inverse_real_of_nat = thm "LIMSEQ_inverse_real_of_nat";
paulson@15082
  1300
val NSLIMSEQ_inverse_real_of_nat = thm "NSLIMSEQ_inverse_real_of_nat";
paulson@15082
  1301
val LIMSEQ_inverse_real_of_nat_add = thm "LIMSEQ_inverse_real_of_nat_add";
paulson@15082
  1302
val NSLIMSEQ_inverse_real_of_nat_add = thm "NSLIMSEQ_inverse_real_of_nat_add";
paulson@15082
  1303
val LIMSEQ_inverse_real_of_nat_add_minus = thm "LIMSEQ_inverse_real_of_nat_add_minus";
paulson@15082
  1304
val NSLIMSEQ_inverse_real_of_nat_add_minus = thm "NSLIMSEQ_inverse_real_of_nat_add_minus";
paulson@15082
  1305
val LIMSEQ_inverse_real_of_nat_add_minus_mult = thm "LIMSEQ_inverse_real_of_nat_add_minus_mult";
paulson@15082
  1306
val NSLIMSEQ_inverse_real_of_nat_add_minus_mult = thm "NSLIMSEQ_inverse_real_of_nat_add_minus_mult";
paulson@15082
  1307
val NSLIMSEQ_pow = thm "NSLIMSEQ_pow";
paulson@15082
  1308
val LIMSEQ_pow = thm "LIMSEQ_pow";
paulson@15082
  1309
val Bseq_realpow = thm "Bseq_realpow";
paulson@15082
  1310
val monoseq_realpow = thm "monoseq_realpow";
paulson@15082
  1311
val convergent_realpow = thm "convergent_realpow";
paulson@15082
  1312
val NSLIMSEQ_realpow_zero = thm "NSLIMSEQ_realpow_zero";
paulson@15082
  1313
*}
paulson@15082
  1314
paulson@15241
  1315
paulson@10751
  1316
end