src/HOL/Nonstandard_Analysis/HSeries.thy
author paulson <lp15@cam.ac.uk>
Wed, 26 Apr 2017 15:53:35 +0100
changeset 65583 8d53b3bebab4
parent 64604 2bf8cfc98c4d
child 68644 242d298526a3
permissions -rw-r--r--
Further new material. The simprule status of some exp and ln identities was reverted.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62479
716336f19aa9 clarified session;
wenzelm
parents: 61982
diff changeset
     1
(*  Title:      HOL/Nonstandard_Analysis/HSeries.thy
716336f19aa9 clarified session;
wenzelm
parents: 61982
diff changeset
     2
    Author:     Jacques D. Fleuriot
716336f19aa9 clarified session;
wenzelm
parents: 61982
diff changeset
     3
    Copyright:  1998  University of Cambridge
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     4
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 58878
diff changeset
     5
Converted to Isar and polished by lcp
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 58878
diff changeset
     6
*)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     7
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
     8
section \<open>Finite Summation and Infinite Series for Hyperreals\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     9
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    10
theory HSeries
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    11
  imports HSEQ
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    12
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    13
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    14
definition sumhr :: "hypnat \<times> hypnat \<times> (nat \<Rightarrow> real) \<Rightarrow> hypreal"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    15
  where "sumhr = (\<lambda>(M,N,f). starfun2 (\<lambda>m n. sum f {m..<n}) M N)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    16
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    17
definition NSsums :: "(nat \<Rightarrow> real) \<Rightarrow> real \<Rightarrow> bool"  (infixr "NSsums" 80)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    18
  where "f NSsums s = (\<lambda>n. sum f {..<n}) \<longlonglongrightarrow>\<^sub>N\<^sub>S s"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    19
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    20
definition NSsummable :: "(nat \<Rightarrow> real) \<Rightarrow> bool"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    21
  where "NSsummable f \<longleftrightarrow> (\<exists>s. f NSsums s)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    22
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    23
definition NSsuminf :: "(nat \<Rightarrow> real) \<Rightarrow> real"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    24
  where "NSsuminf f = (THE s. f NSsums s)"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    25
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    26
lemma sumhr_app: "sumhr (M, N, f) = ( *f2* (\<lambda>m n. sum f {m..<n})) M N"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    27
  by (simp add: sumhr_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    28
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    29
text \<open>Base case in definition of @{term sumr}.\<close>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    30
lemma sumhr_zero [simp]: "\<And>m. sumhr (m, 0, f) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    31
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    32
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    33
text \<open>Recursive case in definition of @{term sumr}.\<close>
61609
77b453bd616f Coercion "real" now has type nat => real only and is no longer overloaded. Type class "real_of" is gone. Many duplicate theorems removed.
paulson <lp15@cam.ac.uk>
parents: 58878
diff changeset
    34
lemma sumhr_if:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    35
  "\<And>m n. sumhr (m, n + 1, f) = (if n + 1 \<le> m then 0 else sumhr (m, n, f) + ( *f* f) n)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    36
  unfolding sumhr_app by transfer simp
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    37
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    38
lemma sumhr_Suc_zero [simp]: "\<And>n. sumhr (n + 1, n, f) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    39
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    40
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    41
lemma sumhr_eq_bounds [simp]: "\<And>n. sumhr (n, n, f) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    42
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    43
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    44
lemma sumhr_Suc [simp]: "\<And>m. sumhr (m, m + 1, f) = ( *f* f) m"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    45
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    46
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    47
lemma sumhr_add_lbound_zero [simp]: "\<And>k m. sumhr (m + k, k, f) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    48
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    49
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    50
lemma sumhr_add: "\<And>m n. sumhr (m, n, f) + sumhr (m, n, g) = sumhr (m, n, \<lambda>i. f i + g i)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    51
  unfolding sumhr_app by transfer (rule sum.distrib [symmetric])
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    52
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    53
lemma sumhr_mult: "\<And>m n. hypreal_of_real r * sumhr (m, n, f) = sumhr (m, n, \<lambda>n. r * f n)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    54
  unfolding sumhr_app by transfer (rule sum_distrib_left)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    55
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    56
lemma sumhr_split_add: "\<And>n p. n < p \<Longrightarrow> sumhr (0, n, f) + sumhr (n, p, f) = sumhr (0, p, f)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    57
  unfolding sumhr_app by transfer (simp add: sum_add_nat_ivl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    58
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    59
lemma sumhr_split_diff: "n < p \<Longrightarrow> sumhr (0, p, f) - sumhr (0, n, f) = sumhr (n, p, f)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    60
  by (drule sumhr_split_add [symmetric, where f = f]) simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    61
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    62
lemma sumhr_hrabs: "\<And>m n. \<bar>sumhr (m, n, f)\<bar> \<le> sumhr (m, n, \<lambda>i. \<bar>f i\<bar>)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    63
  unfolding sumhr_app by transfer (rule sum_abs)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    64
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    65
text \<open>Other general version also needed.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    66
lemma sumhr_fun_hypnat_eq:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    67
  "(\<forall>r. m \<le> r \<and> r < n \<longrightarrow> f r = g r) \<longrightarrow>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    68
    sumhr (hypnat_of_nat m, hypnat_of_nat n, f) =
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    69
    sumhr (hypnat_of_nat m, hypnat_of_nat n, g)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    70
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    71
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    72
lemma sumhr_const: "\<And>n. sumhr (0, n, \<lambda>i. r) = hypreal_of_hypnat n * hypreal_of_real r"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    73
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    74
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    75
lemma sumhr_less_bounds_zero [simp]: "\<And>m n. n < m \<Longrightarrow> sumhr (m, n, f) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    76
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    77
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    78
lemma sumhr_minus: "\<And>m n. sumhr (m, n, \<lambda>i. - f i) = - sumhr (m, n, f)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    79
  unfolding sumhr_app by transfer (rule sum_negf)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    80
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    81
lemma sumhr_shift_bounds:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    82
  "\<And>m n. sumhr (m + hypnat_of_nat k, n + hypnat_of_nat k, f) =
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    83
    sumhr (m, n, \<lambda>i. f (i + k))"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    84
  unfolding sumhr_app by transfer (rule sum_shift_bounds_nat_ivl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    85
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    86
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    87
subsection \<open>Nonstandard Sums\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    88
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    89
text \<open>Infinite sums are obtained by summing to some infinite hypernatural
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    90
  (such as @{term whn}).\<close>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    91
lemma sumhr_hypreal_of_hypnat_omega: "sumhr (0, whn, \<lambda>i. 1) = hypreal_of_hypnat whn"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    92
  by (simp add: sumhr_const)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    93
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    94
lemma sumhr_hypreal_omega_minus_one: "sumhr(0, whn, \<lambda>i. 1) = \<omega> - 1"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    95
  apply (simp add: sumhr_const)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    96
    (* FIXME: need lemma: hypreal_of_hypnat whn = \<omega> - 1 *)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    97
    (* maybe define \<omega> = hypreal_of_hypnat whn + 1 *)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    98
  apply (unfold star_class_defs omega_def hypnat_omega_def of_hypnat_def star_of_def)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
    99
  apply (simp add: starfun_star_n starfun2_star_n)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   100
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   101
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   102
lemma sumhr_minus_one_realpow_zero [simp]: "\<And>N. sumhr (0, N + N, \<lambda>i. (-1) ^ (i + 1)) = 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   103
  unfolding sumhr_app
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   104
  apply transfer
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   105
  apply (simp del: power_Suc add: mult_2 [symmetric])
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   106
  apply (induct_tac N)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   107
   apply simp_all
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   108
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   109
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   110
lemma sumhr_interval_const:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   111
  "(\<forall>n. m \<le> Suc n \<longrightarrow> f n = r) \<and> m \<le> na \<Longrightarrow>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   112
    sumhr (hypnat_of_nat m, hypnat_of_nat na, f) = hypreal_of_nat (na - m) * hypreal_of_real r"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   113
  unfolding sumhr_app by transfer simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   114
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   115
lemma starfunNat_sumr: "\<And>N. ( *f* (\<lambda>n. sum f {0..<n})) N = sumhr (0, N, f)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   116
  unfolding sumhr_app by transfer (rule refl)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   117
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   118
lemma sumhr_hrabs_approx [simp]: "sumhr (0, M, f) \<approx> sumhr (0, N, f) \<Longrightarrow> \<bar>sumhr (M, N, f)\<bar> \<approx> 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   119
  using linorder_less_linear [where x = M and y = N]
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   120
  apply auto
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   121
  apply (drule approx_sym [THEN approx_minus_iff [THEN iffD1]])
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   122
  apply (auto dest: approx_hrabs simp add: sumhr_split_diff)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   123
  done
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   124
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   125
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   126
subsection \<open>Infinite sums: Standard and NS theorems\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   127
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   128
lemma sums_NSsums_iff: "f sums l \<longleftrightarrow> f NSsums l"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   129
  by (simp add: sums_def NSsums_def LIMSEQ_NSLIMSEQ_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   130
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   131
lemma summable_NSsummable_iff: "summable f \<longleftrightarrow> NSsummable f"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   132
  by (simp add: summable_def NSsummable_def sums_NSsums_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   133
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   134
lemma suminf_NSsuminf_iff: "suminf f = NSsuminf f"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   135
  by (simp add: suminf_def NSsuminf_def sums_NSsums_iff)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   136
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   137
lemma NSsums_NSsummable: "f NSsums l \<Longrightarrow> NSsummable f"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   138
  unfolding NSsums_def NSsummable_def by blast
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   139
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   140
lemma NSsummable_NSsums: "NSsummable f \<Longrightarrow> f NSsums (NSsuminf f)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   141
  unfolding NSsummable_def NSsuminf_def NSsums_def
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   142
  by (blast intro: theI NSLIMSEQ_unique)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   143
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   144
lemma NSsums_unique: "f NSsums s \<Longrightarrow> s = NSsuminf f"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   145
  by (simp add: suminf_NSsuminf_iff [symmetric] sums_NSsums_iff sums_unique)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   146
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   147
lemma NSseries_zero: "\<forall>m. n \<le> Suc m \<longrightarrow> f m = 0 \<Longrightarrow> f NSsums (sum f {..<n})"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   148
  by (auto simp add: sums_NSsums_iff [symmetric] not_le[symmetric] intro!: sums_finite)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   149
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   150
lemma NSsummable_NSCauchy:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   151
  "NSsummable f \<longleftrightarrow> (\<forall>M \<in> HNatInfinite. \<forall>N \<in> HNatInfinite. \<bar>sumhr (M, N, f)\<bar> \<approx> 0)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   152
  apply (auto simp add: summable_NSsummable_iff [symmetric]
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   153
      summable_iff_convergent convergent_NSconvergent_iff atLeast0LessThan[symmetric]
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   154
      NSCauchy_NSconvergent_iff [symmetric] NSCauchy_def starfunNat_sumr)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   155
  apply (cut_tac x = M and y = N in linorder_less_linear)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   156
  apply auto
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   157
   apply (rule approx_minus_iff [THEN iffD2, THEN approx_sym])
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   158
   apply (rule_tac [2] approx_minus_iff [THEN iffD2])
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   159
   apply (auto dest: approx_hrabs_zero_cancel simp: sumhr_split_diff atLeast0LessThan[symmetric])
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   160
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   161
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   162
text \<open>Terms of a convergent series tend to zero.\<close>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   163
lemma NSsummable_NSLIMSEQ_zero: "NSsummable f \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   164
  apply (auto simp add: NSLIMSEQ_def NSsummable_NSCauchy)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   165
  apply (drule bspec)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   166
   apply auto
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   167
  apply (drule_tac x = "N + 1 " in bspec)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   168
   apply (auto intro: HNatInfinite_add_one approx_hrabs_zero_cancel)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   169
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   170
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   171
text \<open>Nonstandard comparison test.\<close>
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   172
lemma NSsummable_comparison_test: "\<exists>N. \<forall>n. N \<le> n \<longrightarrow> \<bar>f n\<bar> \<le> g n \<Longrightarrow> NSsummable g \<Longrightarrow> NSsummable f"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   173
  apply (fold summable_NSsummable_iff)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   174
  apply (rule summable_comparison_test, simp, assumption)
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   175
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   176
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   177
lemma NSsummable_rabs_comparison_test:
64604
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   178
  "\<exists>N. \<forall>n. N \<le> n \<longrightarrow> \<bar>f n\<bar> \<le> g n \<Longrightarrow> NSsummable g \<Longrightarrow> NSsummable (\<lambda>k. \<bar>f k\<bar>)"
2bf8cfc98c4d misc tuning and modernization;
wenzelm
parents: 64267
diff changeset
   179
  by (rule NSsummable_comparison_test) auto
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   180
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   181
end