src/HOL/SEQ.thy
 author huffman Sun Aug 14 13:04:57 2011 -0700 (2011-08-14) changeset 44208 1d2bf1f240ac parent 44206 5e4a1664106e child 44282 f0de18b62d63 permissions -rw-r--r--
generalize lemma convergent_subseq_convergent
```     1 (*  Title:      HOL/SEQ.thy
```
```     2     Author:     Jacques D. Fleuriot, University of Cambridge
```
```     3     Author:     Lawrence C Paulson
```
```     4     Author:     Jeremy Avigad
```
```     5     Author:     Brian Huffman
```
```     6
```
```     7 Convergence of sequences and series.
```
```     8 *)
```
```     9
```
```    10 header {* Sequences and Convergence *}
```
```    11
```
```    12 theory SEQ
```
```    13 imports Limits RComplete
```
```    14 begin
```
```    15
```
```    16 subsection {* Monotone sequences and subsequences *}
```
```    17
```
```    18 definition
```
```    19   monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```    20     --{*Definition of monotonicity.
```
```    21         The use of disjunction here complicates proofs considerably.
```
```    22         One alternative is to add a Boolean argument to indicate the direction.
```
```    23         Another is to develop the notions of increasing and decreasing first.*}
```
```    24   "monoseq X = ((\<forall>m. \<forall>n\<ge>m. X m \<le> X n) | (\<forall>m. \<forall>n\<ge>m. X n \<le> X m))"
```
```    25
```
```    26 definition
```
```    27   incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```    28     --{*Increasing sequence*}
```
```    29   "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X m \<le> X n)"
```
```    30
```
```    31 definition
```
```    32   decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool" where
```
```    33     --{*Decreasing sequence*}
```
```    34   "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
```
```    35
```
```    36 definition
```
```    37   subseq :: "(nat \<Rightarrow> nat) \<Rightarrow> bool" where
```
```    38     --{*Definition of subsequence*}
```
```    39   "subseq f \<longleftrightarrow> (\<forall>m. \<forall>n>m. f m < f n)"
```
```    40
```
```    41 lemma incseq_mono: "mono f \<longleftrightarrow> incseq f"
```
```    42   unfolding mono_def incseq_def by auto
```
```    43
```
```    44 lemma incseq_SucI:
```
```    45   "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
```
```    46   using lift_Suc_mono_le[of X]
```
```    47   by (auto simp: incseq_def)
```
```    48
```
```    49 lemma incseqD: "\<And>i j. incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
```
```    50   by (auto simp: incseq_def)
```
```    51
```
```    52 lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)"
```
```    53   using incseqD[of A i "Suc i"] by auto
```
```    54
```
```    55 lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))"
```
```    56   by (auto intro: incseq_SucI dest: incseq_SucD)
```
```    57
```
```    58 lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)"
```
```    59   unfolding incseq_def by auto
```
```    60
```
```    61 lemma decseq_SucI:
```
```    62   "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X"
```
```    63   using order.lift_Suc_mono_le[OF dual_order, of X]
```
```    64   by (auto simp: decseq_def)
```
```    65
```
```    66 lemma decseqD: "\<And>i j. decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i"
```
```    67   by (auto simp: decseq_def)
```
```    68
```
```    69 lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i"
```
```    70   using decseqD[of A i "Suc i"] by auto
```
```    71
```
```    72 lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)"
```
```    73   by (auto intro: decseq_SucI dest: decseq_SucD)
```
```    74
```
```    75 lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)"
```
```    76   unfolding decseq_def by auto
```
```    77
```
```    78 lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X"
```
```    79   unfolding monoseq_def incseq_def decseq_def ..
```
```    80
```
```    81 lemma monoseq_Suc:
```
```    82   "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)"
```
```    83   unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff ..
```
```    84
```
```    85 lemma monoI1: "\<forall>m. \<forall> n \<ge> m. X m \<le> X n ==> monoseq X"
```
```    86 by (simp add: monoseq_def)
```
```    87
```
```    88 lemma monoI2: "\<forall>m. \<forall> n \<ge> m. X n \<le> X m ==> monoseq X"
```
```    89 by (simp add: monoseq_def)
```
```    90
```
```    91 lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) ==> monoseq X"
```
```    92 by (simp add: monoseq_Suc)
```
```    93
```
```    94 lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
```
```    95 by (simp add: monoseq_Suc)
```
```    96
```
```    97 lemma monoseq_minus:
```
```    98   fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
```
```    99   assumes "monoseq a"
```
```   100   shows "monoseq (\<lambda> n. - a n)"
```
```   101 proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
```
```   102   case True
```
```   103   hence "\<forall> m. \<forall> n \<ge> m. - a n \<le> - a m" by auto
```
```   104   thus ?thesis by (rule monoI2)
```
```   105 next
```
```   106   case False
```
```   107   hence "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" using `monoseq a`[unfolded monoseq_def] by auto
```
```   108   thus ?thesis by (rule monoI1)
```
```   109 qed
```
```   110
```
```   111 text{*Subsequence (alternative definition, (e.g. Hoskins)*}
```
```   112
```
```   113 lemma subseq_Suc_iff: "subseq f = (\<forall>n. (f n) < (f (Suc n)))"
```
```   114 apply (simp add: subseq_def)
```
```   115 apply (auto dest!: less_imp_Suc_add)
```
```   116 apply (induct_tac k)
```
```   117 apply (auto intro: less_trans)
```
```   118 done
```
```   119
```
```   120 text{* for any sequence, there is a monotonic subsequence *}
```
```   121 lemma seq_monosub:
```
```   122   fixes s :: "nat => 'a::linorder"
```
```   123   shows "\<exists>f. subseq f \<and> monoseq (\<lambda> n. (s (f n)))"
```
```   124 proof cases
```
```   125   let "?P p n" = "p > n \<and> (\<forall>m\<ge>p. s m \<le> s p)"
```
```   126   assume *: "\<forall>n. \<exists>p. ?P p n"
```
```   127   def f \<equiv> "nat_rec (SOME p. ?P p 0) (\<lambda>_ n. SOME p. ?P p n)"
```
```   128   have f_0: "f 0 = (SOME p. ?P p 0)" unfolding f_def by simp
```
```   129   have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
```
```   130   have P_0: "?P (f 0) 0" unfolding f_0 using *[rule_format] by (rule someI2_ex) auto
```
```   131   have P_Suc: "\<And>i. ?P (f (Suc i)) (f i)" unfolding f_Suc using *[rule_format] by (rule someI2_ex) auto
```
```   132   then have "subseq f" unfolding subseq_Suc_iff by auto
```
```   133   moreover have "monoseq (\<lambda>n. s (f n))" unfolding monoseq_Suc
```
```   134   proof (intro disjI2 allI)
```
```   135     fix n show "s (f (Suc n)) \<le> s (f n)"
```
```   136     proof (cases n)
```
```   137       case 0 with P_Suc[of 0] P_0 show ?thesis by auto
```
```   138     next
```
```   139       case (Suc m)
```
```   140       from P_Suc[of n] Suc have "f (Suc m) \<le> f (Suc (Suc m))" by simp
```
```   141       with P_Suc Suc show ?thesis by simp
```
```   142     qed
```
```   143   qed
```
```   144   ultimately show ?thesis by auto
```
```   145 next
```
```   146   let "?P p m" = "m < p \<and> s m < s p"
```
```   147   assume "\<not> (\<forall>n. \<exists>p>n. (\<forall>m\<ge>p. s m \<le> s p))"
```
```   148   then obtain N where N: "\<And>p. p > N \<Longrightarrow> \<exists>m>p. s p < s m" by (force simp: not_le le_less)
```
```   149   def f \<equiv> "nat_rec (SOME p. ?P p (Suc N)) (\<lambda>_ n. SOME p. ?P p n)"
```
```   150   have f_0: "f 0 = (SOME p. ?P p (Suc N))" unfolding f_def by simp
```
```   151   have f_Suc: "\<And>i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat_rec_Suc ..
```
```   152   have P_0: "?P (f 0) (Suc N)"
```
```   153     unfolding f_0 some_eq_ex[of "\<lambda>p. ?P p (Suc N)"] using N[of "Suc N"] by auto
```
```   154   { fix i have "N < f i \<Longrightarrow> ?P (f (Suc i)) (f i)"
```
```   155       unfolding f_Suc some_eq_ex[of "\<lambda>p. ?P p (f i)"] using N[of "f i"] . }
```
```   156   note P' = this
```
```   157   { fix i have "N < f i \<and> ?P (f (Suc i)) (f i)"
```
```   158       by (induct i) (insert P_0 P', auto) }
```
```   159   then have "subseq f" "monoseq (\<lambda>x. s (f x))"
```
```   160     unfolding subseq_Suc_iff monoseq_Suc by (auto simp: not_le intro: less_imp_le)
```
```   161   then show ?thesis by auto
```
```   162 qed
```
```   163
```
```   164 lemma seq_suble: assumes sf: "subseq f" shows "n \<le> f n"
```
```   165 proof(induct n)
```
```   166   case 0 thus ?case by simp
```
```   167 next
```
```   168   case (Suc n)
```
```   169   from sf[unfolded subseq_Suc_iff, rule_format, of n] Suc.hyps
```
```   170   have "n < f (Suc n)" by arith
```
```   171   thus ?case by arith
```
```   172 qed
```
```   173
```
```   174 lemma incseq_imp_monoseq:  "incseq X \<Longrightarrow> monoseq X"
```
```   175   by (simp add: incseq_def monoseq_def)
```
```   176
```
```   177 lemma decseq_imp_monoseq:  "decseq X \<Longrightarrow> monoseq X"
```
```   178   by (simp add: decseq_def monoseq_def)
```
```   179
```
```   180 lemma decseq_eq_incseq:
```
```   181   fixes X :: "nat \<Rightarrow> 'a::ordered_ab_group_add" shows "decseq X = incseq (\<lambda>n. - X n)"
```
```   182   by (simp add: decseq_def incseq_def)
```
```   183
```
```   184 subsection {* Defintions of limits *}
```
```   185
```
```   186 abbreviation (in topological_space)
```
```   187   LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"
```
```   188     ("((_)/ ----> (_))" [60, 60] 60) where
```
```   189   "X ----> L \<equiv> (X ---> L) sequentially"
```
```   190
```
```   191 definition
```
```   192   lim :: "(nat \<Rightarrow> 'a::t2_space) \<Rightarrow> 'a" where
```
```   193     --{*Standard definition of limit using choice operator*}
```
```   194   "lim X = (THE L. X ----> L)"
```
```   195
```
```   196 definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" where
```
```   197   "convergent X = (\<exists>L. X ----> L)"
```
```   198
```
```   199 definition
```
```   200   Bseq :: "(nat => 'a::real_normed_vector) => bool" where
```
```   201     --{*Standard definition for bounded sequence*}
```
```   202   "Bseq X = (\<exists>K>0.\<forall>n. norm (X n) \<le> K)"
```
```   203
```
```   204 definition (in metric_space) Cauchy :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool" where
```
```   205   "Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. dist (X m) (X n) < e)"
```
```   206
```
```   207
```
```   208 subsection {* Bounded Sequences *}
```
```   209
```
```   210 lemma BseqI': assumes K: "\<And>n. norm (X n) \<le> K" shows "Bseq X"
```
```   211 unfolding Bseq_def
```
```   212 proof (intro exI conjI allI)
```
```   213   show "0 < max K 1" by simp
```
```   214 next
```
```   215   fix n::nat
```
```   216   have "norm (X n) \<le> K" by (rule K)
```
```   217   thus "norm (X n) \<le> max K 1" by simp
```
```   218 qed
```
```   219
```
```   220 lemma BseqE: "\<lbrakk>Bseq X; \<And>K. \<lbrakk>0 < K; \<forall>n. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q"
```
```   221 unfolding Bseq_def by auto
```
```   222
```
```   223 lemma BseqI2': assumes K: "\<forall>n\<ge>N. norm (X n) \<le> K" shows "Bseq X"
```
```   224 proof (rule BseqI')
```
```   225   let ?A = "norm ` X ` {..N}"
```
```   226   have 1: "finite ?A" by simp
```
```   227   fix n::nat
```
```   228   show "norm (X n) \<le> max K (Max ?A)"
```
```   229   proof (cases rule: linorder_le_cases)
```
```   230     assume "n \<ge> N"
```
```   231     hence "norm (X n) \<le> K" using K by simp
```
```   232     thus "norm (X n) \<le> max K (Max ?A)" by simp
```
```   233   next
```
```   234     assume "n \<le> N"
```
```   235     hence "norm (X n) \<in> ?A" by simp
```
```   236     with 1 have "norm (X n) \<le> Max ?A" by (rule Max_ge)
```
```   237     thus "norm (X n) \<le> max K (Max ?A)" by simp
```
```   238   qed
```
```   239 qed
```
```   240
```
```   241 lemma Bseq_ignore_initial_segment: "Bseq X \<Longrightarrow> Bseq (\<lambda>n. X (n + k))"
```
```   242 unfolding Bseq_def by auto
```
```   243
```
```   244 lemma Bseq_offset: "Bseq (\<lambda>n. X (n + k)) \<Longrightarrow> Bseq X"
```
```   245 apply (erule BseqE)
```
```   246 apply (rule_tac N="k" and K="K" in BseqI2')
```
```   247 apply clarify
```
```   248 apply (drule_tac x="n - k" in spec, simp)
```
```   249 done
```
```   250
```
```   251 lemma Bseq_conv_Bfun: "Bseq X \<longleftrightarrow> Bfun X sequentially"
```
```   252 unfolding Bfun_def eventually_sequentially
```
```   253 apply (rule iffI)
```
```   254 apply (simp add: Bseq_def)
```
```   255 apply (auto intro: BseqI2')
```
```   256 done
```
```   257
```
```   258
```
```   259 subsection {* Limits of Sequences *}
```
```   260
```
```   261 lemma [trans]: "X=Y ==> Y ----> z ==> X ----> z"
```
```   262   by simp
```
```   263
```
```   264 lemma LIMSEQ_def: "X ----> L = (\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (X n) L < r)"
```
```   265 unfolding tendsto_iff eventually_sequentially ..
```
```   266
```
```   267 lemma LIMSEQ_iff:
```
```   268   fixes L :: "'a::real_normed_vector"
```
```   269   shows "(X ----> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. norm (X n - L) < r)"
```
```   270 unfolding LIMSEQ_def dist_norm ..
```
```   271
```
```   272 lemma LIMSEQ_iff_nz: "X ----> L = (\<forall>r>0. \<exists>no>0. \<forall>n\<ge>no. dist (X n) L < r)"
```
```   273   unfolding LIMSEQ_def by (metis Suc_leD zero_less_Suc)
```
```   274
```
```   275 lemma LIMSEQ_Zfun_iff: "((\<lambda>n. X n) ----> L) = Zfun (\<lambda>n. X n - L) sequentially"
```
```   276 by (rule tendsto_Zfun_iff)
```
```   277
```
```   278 lemma metric_LIMSEQ_I:
```
```   279   "(\<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r) \<Longrightarrow> X ----> L"
```
```   280 by (simp add: LIMSEQ_def)
```
```   281
```
```   282 lemma metric_LIMSEQ_D:
```
```   283   "\<lbrakk>X ----> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r"
```
```   284 by (simp add: LIMSEQ_def)
```
```   285
```
```   286 lemma LIMSEQ_I:
```
```   287   fixes L :: "'a::real_normed_vector"
```
```   288   shows "(\<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r) \<Longrightarrow> X ----> L"
```
```   289 by (simp add: LIMSEQ_iff)
```
```   290
```
```   291 lemma LIMSEQ_D:
```
```   292   fixes L :: "'a::real_normed_vector"
```
```   293   shows "\<lbrakk>X ----> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r"
```
```   294 by (simp add: LIMSEQ_iff)
```
```   295
```
```   296 lemma LIMSEQ_const: "(\<lambda>n. k) ----> k"
```
```   297 by (rule tendsto_const)
```
```   298
```
```   299 lemma LIMSEQ_const_iff:
```
```   300   fixes k l :: "'a::t2_space"
```
```   301   shows "(\<lambda>n. k) ----> l \<longleftrightarrow> k = l"
```
```   302   using trivial_limit_sequentially by (rule tendsto_const_iff)
```
```   303
```
```   304 lemma LIMSEQ_norm:
```
```   305   fixes a :: "'a::real_normed_vector"
```
```   306   shows "X ----> a \<Longrightarrow> (\<lambda>n. norm (X n)) ----> norm a"
```
```   307 by (rule tendsto_norm)
```
```   308
```
```   309 lemma LIMSEQ_ignore_initial_segment:
```
```   310   "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a"
```
```   311 apply (rule topological_tendstoI)
```
```   312 apply (drule (2) topological_tendstoD)
```
```   313 apply (simp only: eventually_sequentially)
```
```   314 apply (erule exE, rename_tac N)
```
```   315 apply (rule_tac x=N in exI)
```
```   316 apply simp
```
```   317 done
```
```   318
```
```   319 lemma LIMSEQ_offset:
```
```   320   "(\<lambda>n. f (n + k)) ----> a \<Longrightarrow> f ----> a"
```
```   321 apply (rule topological_tendstoI)
```
```   322 apply (drule (2) topological_tendstoD)
```
```   323 apply (simp only: eventually_sequentially)
```
```   324 apply (erule exE, rename_tac N)
```
```   325 apply (rule_tac x="N + k" in exI)
```
```   326 apply clarify
```
```   327 apply (drule_tac x="n - k" in spec)
```
```   328 apply (simp add: le_diff_conv2)
```
```   329 done
```
```   330
```
```   331 lemma LIMSEQ_Suc: "f ----> l \<Longrightarrow> (\<lambda>n. f (Suc n)) ----> l"
```
```   332 by (drule_tac k="Suc 0" in LIMSEQ_ignore_initial_segment, simp)
```
```   333
```
```   334 lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) ----> l \<Longrightarrow> f ----> l"
```
```   335 by (rule_tac k="Suc 0" in LIMSEQ_offset, simp)
```
```   336
```
```   337 lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) ----> l = f ----> l"
```
```   338 by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
```
```   339
```
```   340 lemma LIMSEQ_linear: "\<lbrakk> X ----> x ; l > 0 \<rbrakk> \<Longrightarrow> (\<lambda> n. X (n * l)) ----> x"
```
```   341   unfolding tendsto_def eventually_sequentially
```
```   342   by (metis div_le_dividend div_mult_self1_is_m le_trans nat_mult_commute)
```
```   343
```
```   344 lemma LIMSEQ_add:
```
```   345   fixes a b :: "'a::real_normed_vector"
```
```   346   shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) ----> a + b"
```
```   347 by (rule tendsto_add)
```
```   348
```
```   349 lemma LIMSEQ_minus:
```
```   350   fixes a :: "'a::real_normed_vector"
```
```   351   shows "X ----> a \<Longrightarrow> (\<lambda>n. - X n) ----> - a"
```
```   352 by (rule tendsto_minus)
```
```   353
```
```   354 lemma LIMSEQ_minus_cancel:
```
```   355   fixes a :: "'a::real_normed_vector"
```
```   356   shows "(\<lambda>n. - X n) ----> - a \<Longrightarrow> X ----> a"
```
```   357 by (rule tendsto_minus_cancel)
```
```   358
```
```   359 lemma LIMSEQ_diff:
```
```   360   fixes a b :: "'a::real_normed_vector"
```
```   361   shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) ----> a - b"
```
```   362 by (rule tendsto_diff)
```
```   363
```
```   364 lemma LIMSEQ_unique:
```
```   365   fixes a b :: "'a::t2_space"
```
```   366   shows "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b"
```
```   367   using trivial_limit_sequentially by (rule tendsto_unique)
```
```   368
```
```   369 lemma (in bounded_linear) LIMSEQ:
```
```   370   "X ----> a \<Longrightarrow> (\<lambda>n. f (X n)) ----> f a"
```
```   371 by (rule tendsto)
```
```   372
```
```   373 lemma (in bounded_bilinear) LIMSEQ:
```
```   374   "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n ** Y n) ----> a ** b"
```
```   375 by (rule tendsto)
```
```   376
```
```   377 lemma LIMSEQ_mult:
```
```   378   fixes a b :: "'a::real_normed_algebra"
```
```   379   shows "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b"
```
```   380 by (rule mult.tendsto)
```
```   381
```
```   382 lemma increasing_LIMSEQ:
```
```   383   fixes f :: "nat \<Rightarrow> real"
```
```   384   assumes inc: "!!n. f n \<le> f (Suc n)"
```
```   385       and bdd: "!!n. f n \<le> l"
```
```   386       and en: "!!e. 0 < e \<Longrightarrow> \<exists>n. l \<le> f n + e"
```
```   387   shows "f ----> l"
```
```   388 proof (auto simp add: LIMSEQ_def)
```
```   389   fix e :: real
```
```   390   assume e: "0 < e"
```
```   391   then obtain N where "l \<le> f N + e/2"
```
```   392     by (metis half_gt_zero e en that)
```
```   393   hence N: "l < f N + e" using e
```
```   394     by simp
```
```   395   { fix k
```
```   396     have [simp]: "!!n. \<bar>f n - l\<bar> = l - f n"
```
```   397       by (simp add: bdd)
```
```   398     have "\<bar>f (N+k) - l\<bar> < e"
```
```   399     proof (induct k)
```
```   400       case 0 show ?case using N
```
```   401         by simp
```
```   402     next
```
```   403       case (Suc k) thus ?case using N inc [of "N+k"]
```
```   404         by simp
```
```   405     qed
```
```   406   } note 1 = this
```
```   407   { fix n
```
```   408     have "N \<le> n \<Longrightarrow> \<bar>f n - l\<bar> < e" using 1 [of "n-N"]
```
```   409       by simp
```
```   410   } note [intro] = this
```
```   411   show " \<exists>no. \<forall>n\<ge>no. dist (f n) l < e"
```
```   412     by (auto simp add: dist_real_def)
```
```   413   qed
```
```   414
```
```   415 lemma Bseq_inverse_lemma:
```
```   416   fixes x :: "'a::real_normed_div_algebra"
```
```   417   shows "\<lbrakk>r \<le> norm x; 0 < r\<rbrakk> \<Longrightarrow> norm (inverse x) \<le> inverse r"
```
```   418 apply (subst nonzero_norm_inverse, clarsimp)
```
```   419 apply (erule (1) le_imp_inverse_le)
```
```   420 done
```
```   421
```
```   422 lemma Bseq_inverse:
```
```   423   fixes a :: "'a::real_normed_div_algebra"
```
```   424   shows "\<lbrakk>X ----> a; a \<noteq> 0\<rbrakk> \<Longrightarrow> Bseq (\<lambda>n. inverse (X n))"
```
```   425 unfolding Bseq_conv_Bfun by (rule Bfun_inverse)
```
```   426
```
```   427 lemma LIMSEQ_inverse:
```
```   428   fixes a :: "'a::real_normed_div_algebra"
```
```   429   shows "\<lbrakk>X ----> a; a \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. inverse (X n)) ----> inverse a"
```
```   430 by (rule tendsto_inverse)
```
```   431
```
```   432 lemma LIMSEQ_divide:
```
```   433   fixes a b :: "'a::real_normed_field"
```
```   434   shows "\<lbrakk>X ----> a; Y ----> b; b \<noteq> 0\<rbrakk> \<Longrightarrow> (\<lambda>n. X n / Y n) ----> a / b"
```
```   435 by (rule tendsto_divide)
```
```   436
```
```   437 lemma LIMSEQ_pow:
```
```   438   fixes a :: "'a::{power, real_normed_algebra}"
```
```   439   shows "X ----> a \<Longrightarrow> (\<lambda>n. (X n) ^ m) ----> a ^ m"
```
```   440   by (rule tendsto_power)
```
```   441
```
```   442 lemma LIMSEQ_setsum:
```
```   443   fixes L :: "'a \<Rightarrow> 'b::real_normed_vector"
```
```   444   assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
```
```   445   shows "(\<lambda>m. \<Sum>n\<in>S. X n m) ----> (\<Sum>n\<in>S. L n)"
```
```   446 using assms by (rule tendsto_setsum)
```
```   447
```
```   448 lemma LIMSEQ_setprod:
```
```   449   fixes L :: "'a \<Rightarrow> 'b::{real_normed_algebra,comm_ring_1}"
```
```   450   assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
```
```   451   shows "(\<lambda>m. \<Prod>n\<in>S. X n m) ----> (\<Prod>n\<in>S. L n)"
```
```   452   using assms by (rule tendsto_setprod)
```
```   453
```
```   454 lemma LIMSEQ_add_const: (* FIXME: delete *)
```
```   455   fixes a :: "'a::real_normed_vector"
```
```   456   shows "f ----> a ==> (%n.(f n + b)) ----> a + b"
```
```   457 by (intro tendsto_intros)
```
```   458
```
```   459 (* FIXME: delete *)
```
```   460 lemma LIMSEQ_add_minus:
```
```   461   fixes a b :: "'a::real_normed_vector"
```
```   462   shows "[| X ----> a; Y ----> b |] ==> (%n. X n + -Y n) ----> a + -b"
```
```   463 by (intro tendsto_intros)
```
```   464
```
```   465 lemma LIMSEQ_diff_const: (* FIXME: delete *)
```
```   466   fixes a b :: "'a::real_normed_vector"
```
```   467   shows "f ----> a ==> (%n.(f n  - b)) ----> a - b"
```
```   468 by (intro tendsto_intros)
```
```   469
```
```   470 lemma LIMSEQ_diff_approach_zero:
```
```   471   fixes L :: "'a::real_normed_vector"
```
```   472   shows "g ----> L ==> (%x. f x - g x) ----> 0 ==> f ----> L"
```
```   473 by (drule (1) LIMSEQ_add, simp)
```
```   474
```
```   475 lemma LIMSEQ_diff_approach_zero2:
```
```   476   fixes L :: "'a::real_normed_vector"
```
```   477   shows "f ----> L ==> (%x. f x - g x) ----> 0 ==> g ----> L"
```
```   478 by (drule (1) LIMSEQ_diff, simp)
```
```   479
```
```   480 text{*A sequence tends to zero iff its abs does*}
```
```   481 lemma LIMSEQ_norm_zero:
```
```   482   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   483   shows "((\<lambda>n. norm (X n)) ----> 0) \<longleftrightarrow> (X ----> 0)"
```
```   484   by (rule tendsto_norm_zero_iff)
```
```   485
```
```   486 lemma LIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----> 0) = (f ----> (0::real))"
```
```   487   by (rule tendsto_rabs_zero_iff)
```
```   488
```
```   489 lemma LIMSEQ_imp_rabs: "f ----> (l::real) ==> (%n. \<bar>f n\<bar>) ----> \<bar>l\<bar>"
```
```   490   by (rule tendsto_rabs)
```
```   491
```
```   492 text{*An unbounded sequence's inverse tends to 0*}
```
```   493
```
```   494 lemma LIMSEQ_inverse_zero:
```
```   495   "\<forall>r::real. \<exists>N. \<forall>n\<ge>N. r < X n \<Longrightarrow> (\<lambda>n. inverse (X n)) ----> 0"
```
```   496 apply (rule LIMSEQ_I)
```
```   497 apply (drule_tac x="inverse r" in spec, safe)
```
```   498 apply (rule_tac x="N" in exI, safe)
```
```   499 apply (drule_tac x="n" in spec, safe)
```
```   500 apply (frule positive_imp_inverse_positive)
```
```   501 apply (frule (1) less_imp_inverse_less)
```
```   502 apply (subgoal_tac "0 < X n", simp)
```
```   503 apply (erule (1) order_less_trans)
```
```   504 done
```
```   505
```
```   506 text{*The sequence @{term "1/n"} tends to 0 as @{term n} tends to infinity*}
```
```   507
```
```   508 lemma LIMSEQ_inverse_real_of_nat: "(%n. inverse(real(Suc n))) ----> 0"
```
```   509 apply (rule LIMSEQ_inverse_zero, safe)
```
```   510 apply (cut_tac x = r in reals_Archimedean2)
```
```   511 apply (safe, rule_tac x = n in exI)
```
```   512 apply (auto simp add: real_of_nat_Suc)
```
```   513 done
```
```   514
```
```   515 text{*The sequence @{term "r + 1/n"} tends to @{term r} as @{term n} tends to
```
```   516 infinity is now easily proved*}
```
```   517
```
```   518 lemma LIMSEQ_inverse_real_of_nat_add:
```
```   519      "(%n. r + inverse(real(Suc n))) ----> r"
```
```   520 by (cut_tac LIMSEQ_add [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto)
```
```   521
```
```   522 lemma LIMSEQ_inverse_real_of_nat_add_minus:
```
```   523      "(%n. r + -inverse(real(Suc n))) ----> r"
```
```   524 by (cut_tac LIMSEQ_add_minus [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat], auto)
```
```   525
```
```   526 lemma LIMSEQ_inverse_real_of_nat_add_minus_mult:
```
```   527      "(%n. r*( 1 + -inverse(real(Suc n)))) ----> r"
```
```   528 by (cut_tac b=1 in
```
```   529         LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_inverse_real_of_nat_add_minus], auto)
```
```   530
```
```   531 lemma LIMSEQ_le_const:
```
```   532   "\<lbrakk>X ----> (x::real); \<exists>N. \<forall>n\<ge>N. a \<le> X n\<rbrakk> \<Longrightarrow> a \<le> x"
```
```   533 apply (rule ccontr, simp only: linorder_not_le)
```
```   534 apply (drule_tac r="a - x" in LIMSEQ_D, simp)
```
```   535 apply clarsimp
```
```   536 apply (drule_tac x="max N no" in spec, drule mp, rule le_maxI1)
```
```   537 apply (drule_tac x="max N no" in spec, drule mp, rule le_maxI2)
```
```   538 apply simp
```
```   539 done
```
```   540
```
```   541 lemma LIMSEQ_le_const2:
```
```   542   "\<lbrakk>X ----> (x::real); \<exists>N. \<forall>n\<ge>N. X n \<le> a\<rbrakk> \<Longrightarrow> x \<le> a"
```
```   543 apply (subgoal_tac "- a \<le> - x", simp)
```
```   544 apply (rule LIMSEQ_le_const)
```
```   545 apply (erule LIMSEQ_minus)
```
```   546 apply simp
```
```   547 done
```
```   548
```
```   549 lemma LIMSEQ_le:
```
```   550   "\<lbrakk>X ----> x; Y ----> y; \<exists>N. \<forall>n\<ge>N. X n \<le> Y n\<rbrakk> \<Longrightarrow> x \<le> (y::real)"
```
```   551 apply (subgoal_tac "0 \<le> y - x", simp)
```
```   552 apply (rule LIMSEQ_le_const)
```
```   553 apply (erule (1) LIMSEQ_diff)
```
```   554 apply (simp add: le_diff_eq)
```
```   555 done
```
```   556
```
```   557
```
```   558 subsection {* Convergence *}
```
```   559
```
```   560 lemma limI: "X ----> L ==> lim X = L"
```
```   561 apply (simp add: lim_def)
```
```   562 apply (blast intro: LIMSEQ_unique)
```
```   563 done
```
```   564
```
```   565 lemma convergentD: "convergent X ==> \<exists>L. (X ----> L)"
```
```   566 by (simp add: convergent_def)
```
```   567
```
```   568 lemma convergentI: "(X ----> L) ==> convergent X"
```
```   569 by (auto simp add: convergent_def)
```
```   570
```
```   571 lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
```
```   572 by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
```
```   573
```
```   574 lemma convergent_const: "convergent (\<lambda>n. c)"
```
```   575 by (rule convergentI, rule LIMSEQ_const)
```
```   576
```
```   577 lemma convergent_add:
```
```   578   fixes X Y :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   579   assumes "convergent (\<lambda>n. X n)"
```
```   580   assumes "convergent (\<lambda>n. Y n)"
```
```   581   shows "convergent (\<lambda>n. X n + Y n)"
```
```   582 using assms unfolding convergent_def by (fast intro: LIMSEQ_add)
```
```   583
```
```   584 lemma convergent_setsum:
```
```   585   fixes X :: "'a \<Rightarrow> nat \<Rightarrow> 'b::real_normed_vector"
```
```   586   assumes "\<And>i. i \<in> A \<Longrightarrow> convergent (\<lambda>n. X i n)"
```
```   587   shows "convergent (\<lambda>n. \<Sum>i\<in>A. X i n)"
```
```   588 proof (cases "finite A")
```
```   589   case True from this and assms show ?thesis
```
```   590     by (induct A set: finite) (simp_all add: convergent_const convergent_add)
```
```   591 qed (simp add: convergent_const)
```
```   592
```
```   593 lemma (in bounded_linear) convergent:
```
```   594   assumes "convergent (\<lambda>n. X n)"
```
```   595   shows "convergent (\<lambda>n. f (X n))"
```
```   596 using assms unfolding convergent_def by (fast intro: LIMSEQ)
```
```   597
```
```   598 lemma (in bounded_bilinear) convergent:
```
```   599   assumes "convergent (\<lambda>n. X n)" and "convergent (\<lambda>n. Y n)"
```
```   600   shows "convergent (\<lambda>n. X n ** Y n)"
```
```   601 using assms unfolding convergent_def by (fast intro: LIMSEQ)
```
```   602
```
```   603 lemma convergent_minus_iff:
```
```   604   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   605   shows "convergent X \<longleftrightarrow> convergent (\<lambda>n. - X n)"
```
```   606 apply (simp add: convergent_def)
```
```   607 apply (auto dest: LIMSEQ_minus)
```
```   608 apply (drule LIMSEQ_minus, auto)
```
```   609 done
```
```   610
```
```   611 lemma lim_le:
```
```   612   fixes x :: real
```
```   613   assumes f: "convergent f" and fn_le: "!!n. f n \<le> x"
```
```   614   shows "lim f \<le> x"
```
```   615 proof (rule classical)
```
```   616   assume "\<not> lim f \<le> x"
```
```   617   hence 0: "0 < lim f - x" by arith
```
```   618   have 1: "f----> lim f"
```
```   619     by (metis convergent_LIMSEQ_iff f)
```
```   620   thus ?thesis
```
```   621     proof (simp add: LIMSEQ_iff)
```
```   622       assume "\<forall>r>0. \<exists>no. \<forall>n\<ge>no. \<bar>f n - lim f\<bar> < r"
```
```   623       hence "\<exists>no. \<forall>n\<ge>no. \<bar>f n - lim f\<bar> < lim f - x"
```
```   624         by (metis 0)
```
```   625       from this obtain no where "\<forall>n\<ge>no. \<bar>f n - lim f\<bar> < lim f - x"
```
```   626         by blast
```
```   627       thus "lim f \<le> x"
```
```   628         by (metis 1 LIMSEQ_le_const2 fn_le)
```
```   629     qed
```
```   630 qed
```
```   631
```
```   632 lemma monoseq_le:
```
```   633   fixes a :: "nat \<Rightarrow> real"
```
```   634   assumes "monoseq a" and "a ----> x"
```
```   635   shows "((\<forall> n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n)) \<or>
```
```   636          ((\<forall> n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m))"
```
```   637 proof -
```
```   638   { fix x n fix a :: "nat \<Rightarrow> real"
```
```   639     assume "a ----> x" and "\<forall> m. \<forall> n \<ge> m. a m \<le> a n"
```
```   640     hence monotone: "\<And> m n. m \<le> n \<Longrightarrow> a m \<le> a n" by auto
```
```   641     have "a n \<le> x"
```
```   642     proof (rule ccontr)
```
```   643       assume "\<not> a n \<le> x" hence "x < a n" by auto
```
```   644       hence "0 < a n - x" by auto
```
```   645       from `a ----> x`[THEN LIMSEQ_D, OF this]
```
```   646       obtain no where "\<And>n'. no \<le> n' \<Longrightarrow> norm (a n' - x) < a n - x" by blast
```
```   647       hence "norm (a (max no n) - x) < a n - x" by auto
```
```   648       moreover
```
```   649       { fix n' have "n \<le> n' \<Longrightarrow> x < a n'" using monotone[where m=n and n=n'] and `x < a n` by auto }
```
```   650       hence "x < a (max no n)" by auto
```
```   651       ultimately
```
```   652       have "a (max no n) < a n" by auto
```
```   653       with monotone[where m=n and n="max no n"]
```
```   654       show False by (auto simp:max_def split:split_if_asm)
```
```   655     qed
```
```   656   } note top_down = this
```
```   657   { fix x n m fix a :: "nat \<Rightarrow> real"
```
```   658     assume "a ----> x" and "monoseq a" and "a m < x"
```
```   659     have "a n \<le> x \<and> (\<forall> m. \<forall> n \<ge> m. a m \<le> a n)"
```
```   660     proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
```
```   661       case True with top_down and `a ----> x` show ?thesis by auto
```
```   662     next
```
```   663       case False with `monoseq a`[unfolded monoseq_def] have "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" by auto
```
```   664       hence "- a m \<le> - x" using top_down[OF LIMSEQ_minus[OF `a ----> x`]] by blast
```
```   665       hence False using `a m < x` by auto
```
```   666       thus ?thesis ..
```
```   667     qed
```
```   668   } note when_decided = this
```
```   669
```
```   670   show ?thesis
```
```   671   proof (cases "\<exists> m. a m \<noteq> x")
```
```   672     case True then obtain m where "a m \<noteq> x" by auto
```
```   673     show ?thesis
```
```   674     proof (cases "a m < x")
```
```   675       case True with when_decided[OF `a ----> x` `monoseq a`, where m2=m]
```
```   676       show ?thesis by blast
```
```   677     next
```
```   678       case False hence "- a m < - x" using `a m \<noteq> x` by auto
```
```   679       with when_decided[OF LIMSEQ_minus[OF `a ----> x`] monoseq_minus[OF `monoseq a`], where m2=m]
```
```   680       show ?thesis by auto
```
```   681     qed
```
```   682   qed auto
```
```   683 qed
```
```   684
```
```   685 lemma LIMSEQ_subseq_LIMSEQ:
```
```   686   "\<lbrakk> X ----> L; subseq f \<rbrakk> \<Longrightarrow> (X o f) ----> L"
```
```   687 apply (rule topological_tendstoI)
```
```   688 apply (drule (2) topological_tendstoD)
```
```   689 apply (simp only: eventually_sequentially)
```
```   690 apply (clarify, rule_tac x=N in exI, clarsimp)
```
```   691 apply (blast intro: seq_suble le_trans dest!: spec)
```
```   692 done
```
```   693
```
```   694 lemma convergent_subseq_convergent:
```
```   695   "\<lbrakk>convergent X; subseq f\<rbrakk> \<Longrightarrow> convergent (X o f)"
```
```   696   unfolding convergent_def by (auto intro: LIMSEQ_subseq_LIMSEQ)
```
```   697
```
```   698
```
```   699 subsection {* Bounded Monotonic Sequences *}
```
```   700
```
```   701 text{*Bounded Sequence*}
```
```   702
```
```   703 lemma BseqD: "Bseq X ==> \<exists>K. 0 < K & (\<forall>n. norm (X n) \<le> K)"
```
```   704 by (simp add: Bseq_def)
```
```   705
```
```   706 lemma BseqI: "[| 0 < K; \<forall>n. norm (X n) \<le> K |] ==> Bseq X"
```
```   707 by (auto simp add: Bseq_def)
```
```   708
```
```   709 lemma lemma_NBseq_def:
```
```   710      "(\<exists>K > 0. \<forall>n. norm (X n) \<le> K) =
```
```   711       (\<exists>N. \<forall>n. norm (X n) \<le> real(Suc N))"
```
```   712 proof auto
```
```   713   fix K :: real
```
```   714   from reals_Archimedean2 obtain n :: nat where "K < real n" ..
```
```   715   then have "K \<le> real (Suc n)" by auto
```
```   716   assume "\<forall>m. norm (X m) \<le> K"
```
```   717   have "\<forall>m. norm (X m) \<le> real (Suc n)"
```
```   718   proof
```
```   719     fix m :: 'a
```
```   720     from `\<forall>m. norm (X m) \<le> K` have "norm (X m) \<le> K" ..
```
```   721     with `K \<le> real (Suc n)` show "norm (X m) \<le> real (Suc n)" by auto
```
```   722   qed
```
```   723   then show "\<exists>N. \<forall>n. norm (X n) \<le> real (Suc N)" ..
```
```   724 next
```
```   725   fix N :: nat
```
```   726   have "real (Suc N) > 0" by (simp add: real_of_nat_Suc)
```
```   727   moreover assume "\<forall>n. norm (X n) \<le> real (Suc N)"
```
```   728   ultimately show "\<exists>K>0. \<forall>n. norm (X n) \<le> K" by blast
```
```   729 qed
```
```   730
```
```   731
```
```   732 text{* alternative definition for Bseq *}
```
```   733 lemma Bseq_iff: "Bseq X = (\<exists>N. \<forall>n. norm (X n) \<le> real(Suc N))"
```
```   734 apply (simp add: Bseq_def)
```
```   735 apply (simp (no_asm) add: lemma_NBseq_def)
```
```   736 done
```
```   737
```
```   738 lemma lemma_NBseq_def2:
```
```   739      "(\<exists>K > 0. \<forall>n. norm (X n) \<le> K) = (\<exists>N. \<forall>n. norm (X n) < real(Suc N))"
```
```   740 apply (subst lemma_NBseq_def, auto)
```
```   741 apply (rule_tac x = "Suc N" in exI)
```
```   742 apply (rule_tac [2] x = N in exI)
```
```   743 apply (auto simp add: real_of_nat_Suc)
```
```   744  prefer 2 apply (blast intro: order_less_imp_le)
```
```   745 apply (drule_tac x = n in spec, simp)
```
```   746 done
```
```   747
```
```   748 (* yet another definition for Bseq *)
```
```   749 lemma Bseq_iff1a: "Bseq X = (\<exists>N. \<forall>n. norm (X n) < real(Suc N))"
```
```   750 by (simp add: Bseq_def lemma_NBseq_def2)
```
```   751
```
```   752 subsubsection{*Upper Bounds and Lubs of Bounded Sequences*}
```
```   753
```
```   754 lemma Bseq_isUb:
```
```   755   "!!(X::nat=>real). Bseq X ==> \<exists>U. isUb (UNIV::real set) {x. \<exists>n. X n = x} U"
```
```   756 by (auto intro: isUbI setleI simp add: Bseq_def abs_le_iff)
```
```   757
```
```   758
```
```   759 text{* Use completeness of reals (supremum property)
```
```   760    to show that any bounded sequence has a least upper bound*}
```
```   761
```
```   762 lemma Bseq_isLub:
```
```   763   "!!(X::nat=>real). Bseq X ==>
```
```   764    \<exists>U. isLub (UNIV::real set) {x. \<exists>n. X n = x} U"
```
```   765 by (blast intro: reals_complete Bseq_isUb)
```
```   766
```
```   767 subsubsection{*A Bounded and Monotonic Sequence Converges*}
```
```   768
```
```   769 lemma lemma_converg1:
```
```   770      "!!(X::nat=>real). [| \<forall>m. \<forall> n \<ge> m. X m \<le> X n;
```
```   771                   isLub (UNIV::real set) {x. \<exists>n. X n = x} (X ma)
```
```   772                |] ==> \<forall>n \<ge> ma. X n = X ma"
```
```   773 apply safe
```
```   774 apply (drule_tac y = "X n" in isLubD2)
```
```   775 apply (blast dest: order_antisym)+
```
```   776 done
```
```   777
```
```   778 lemma Bmonoseq_LIMSEQ: "\<forall>n. m \<le> n --> X n = X m ==> \<exists>L. (X ----> L)"
```
```   779 unfolding tendsto_def eventually_sequentially
```
```   780 apply (rule_tac x = "X m" in exI, safe)
```
```   781 apply (rule_tac x = m in exI, safe)
```
```   782 apply (drule spec, erule impE, auto)
```
```   783 done
```
```   784
```
```   785 lemma lemma_converg2:
```
```   786    "!!(X::nat=>real).
```
```   787     [| \<forall>m. X m ~= U;  isLub UNIV {x. \<exists>n. X n = x} U |] ==> \<forall>m. X m < U"
```
```   788 apply safe
```
```   789 apply (drule_tac y = "X m" in isLubD2)
```
```   790 apply (auto dest!: order_le_imp_less_or_eq)
```
```   791 done
```
```   792
```
```   793 lemma lemma_converg3: "!!(X ::nat=>real). \<forall>m. X m \<le> U ==> isUb UNIV {x. \<exists>n. X n = x} U"
```
```   794 by (rule setleI [THEN isUbI], auto)
```
```   795
```
```   796 text{* FIXME: @{term "U - T < U"} is redundant *}
```
```   797 lemma lemma_converg4: "!!(X::nat=> real).
```
```   798                [| \<forall>m. X m ~= U;
```
```   799                   isLub UNIV {x. \<exists>n. X n = x} U;
```
```   800                   0 < T;
```
```   801                   U + - T < U
```
```   802                |] ==> \<exists>m. U + -T < X m & X m < U"
```
```   803 apply (drule lemma_converg2, assumption)
```
```   804 apply (rule ccontr, simp)
```
```   805 apply (simp add: linorder_not_less)
```
```   806 apply (drule lemma_converg3)
```
```   807 apply (drule isLub_le_isUb, assumption)
```
```   808 apply (auto dest: order_less_le_trans)
```
```   809 done
```
```   810
```
```   811 text{*A standard proof of the theorem for monotone increasing sequence*}
```
```   812
```
```   813 lemma Bseq_mono_convergent:
```
```   814      "[| Bseq X; \<forall>m. \<forall>n \<ge> m. X m \<le> X n |] ==> convergent (X::nat=>real)"
```
```   815 apply (simp add: convergent_def)
```
```   816 apply (frule Bseq_isLub, safe)
```
```   817 apply (case_tac "\<exists>m. X m = U", auto)
```
```   818 apply (blast dest: lemma_converg1 Bmonoseq_LIMSEQ)
```
```   819 (* second case *)
```
```   820 apply (rule_tac x = U in exI)
```
```   821 apply (subst LIMSEQ_iff, safe)
```
```   822 apply (frule lemma_converg2, assumption)
```
```   823 apply (drule lemma_converg4, auto)
```
```   824 apply (rule_tac x = m in exI, safe)
```
```   825 apply (subgoal_tac "X m \<le> X n")
```
```   826  prefer 2 apply blast
```
```   827 apply (drule_tac x=n and P="%m. X m < U" in spec, arith)
```
```   828 done
```
```   829
```
```   830 lemma Bseq_minus_iff: "Bseq (%n. -(X n)) = Bseq X"
```
```   831 by (simp add: Bseq_def)
```
```   832
```
```   833 text{*Main monotonicity theorem*}
```
```   834 lemma Bseq_monoseq_convergent: "[| Bseq X; monoseq X |] ==> convergent (X::nat\<Rightarrow>real)"
```
```   835 apply (simp add: monoseq_def, safe)
```
```   836 apply (rule_tac [2] convergent_minus_iff [THEN ssubst])
```
```   837 apply (drule_tac [2] Bseq_minus_iff [THEN ssubst])
```
```   838 apply (auto intro!: Bseq_mono_convergent)
```
```   839 done
```
```   840
```
```   841 subsubsection{*Increasing and Decreasing Series*}
```
```   842
```
```   843 lemma incseq_le:
```
```   844   fixes X :: "nat \<Rightarrow> real"
```
```   845   assumes inc: "incseq X" and lim: "X ----> L" shows "X n \<le> L"
```
```   846   using monoseq_le [OF incseq_imp_monoseq [OF inc] lim]
```
```   847 proof
```
```   848   assume "(\<forall>n. X n \<le> L) \<and> (\<forall>m n. m \<le> n \<longrightarrow> X m \<le> X n)"
```
```   849   thus ?thesis by simp
```
```   850 next
```
```   851   assume "(\<forall>n. L \<le> X n) \<and> (\<forall>m n. m \<le> n \<longrightarrow> X n \<le> X m)"
```
```   852   hence const: "(!!m n. m \<le> n \<Longrightarrow> X n = X m)" using inc
```
```   853     by (auto simp add: incseq_def intro: order_antisym)
```
```   854   have X: "!!n. X n = X 0"
```
```   855     by (blast intro: const [of 0])
```
```   856   have "X = (\<lambda>n. X 0)"
```
```   857     by (blast intro: ext X)
```
```   858   hence "L = X 0" using LIMSEQ_const [of "X 0"]
```
```   859     by (auto intro: LIMSEQ_unique lim)
```
```   860   thus ?thesis
```
```   861     by (blast intro: eq_refl X)
```
```   862 qed
```
```   863
```
```   864 lemma decseq_le:
```
```   865   fixes X :: "nat \<Rightarrow> real" assumes dec: "decseq X" and lim: "X ----> L" shows "L \<le> X n"
```
```   866 proof -
```
```   867   have inc: "incseq (\<lambda>n. - X n)" using dec
```
```   868     by (simp add: decseq_eq_incseq)
```
```   869   have "- X n \<le> - L"
```
```   870     by (blast intro: incseq_le [OF inc] LIMSEQ_minus lim)
```
```   871   thus ?thesis
```
```   872     by simp
```
```   873 qed
```
```   874
```
```   875 subsubsection{*A Few More Equivalence Theorems for Boundedness*}
```
```   876
```
```   877 text{*alternative formulation for boundedness*}
```
```   878 lemma Bseq_iff2: "Bseq X = (\<exists>k > 0. \<exists>x. \<forall>n. norm (X(n) + -x) \<le> k)"
```
```   879 apply (unfold Bseq_def, safe)
```
```   880 apply (rule_tac [2] x = "k + norm x" in exI)
```
```   881 apply (rule_tac x = K in exI, simp)
```
```   882 apply (rule exI [where x = 0], auto)
```
```   883 apply (erule order_less_le_trans, simp)
```
```   884 apply (drule_tac x=n in spec, fold diff_minus)
```
```   885 apply (drule order_trans [OF norm_triangle_ineq2])
```
```   886 apply simp
```
```   887 done
```
```   888
```
```   889 text{*alternative formulation for boundedness*}
```
```   890 lemma Bseq_iff3: "Bseq X = (\<exists>k > 0. \<exists>N. \<forall>n. norm(X(n) + -X(N)) \<le> k)"
```
```   891 apply safe
```
```   892 apply (simp add: Bseq_def, safe)
```
```   893 apply (rule_tac x = "K + norm (X N)" in exI)
```
```   894 apply auto
```
```   895 apply (erule order_less_le_trans, simp)
```
```   896 apply (rule_tac x = N in exI, safe)
```
```   897 apply (drule_tac x = n in spec)
```
```   898 apply (rule order_trans [OF norm_triangle_ineq], simp)
```
```   899 apply (auto simp add: Bseq_iff2)
```
```   900 done
```
```   901
```
```   902 lemma BseqI2: "(\<forall>n. k \<le> f n & f n \<le> (K::real)) ==> Bseq f"
```
```   903 apply (simp add: Bseq_def)
```
```   904 apply (rule_tac x = " (\<bar>k\<bar> + \<bar>K\<bar>) + 1" in exI, auto)
```
```   905 apply (drule_tac x = n in spec, arith)
```
```   906 done
```
```   907
```
```   908
```
```   909 subsection {* Cauchy Sequences *}
```
```   910
```
```   911 lemma metric_CauchyI:
```
```   912   "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e) \<Longrightarrow> Cauchy X"
```
```   913 by (simp add: Cauchy_def)
```
```   914
```
```   915 lemma metric_CauchyD:
```
```   916   "\<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e"
```
```   917 by (simp add: Cauchy_def)
```
```   918
```
```   919 lemma Cauchy_iff:
```
```   920   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   921   shows "Cauchy X \<longleftrightarrow> (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e)"
```
```   922 unfolding Cauchy_def dist_norm ..
```
```   923
```
```   924 lemma Cauchy_iff2:
```
```   925      "Cauchy X =
```
```   926       (\<forall>j. (\<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. \<bar>X m - X n\<bar> < inverse(real (Suc j))))"
```
```   927 apply (simp add: Cauchy_iff, auto)
```
```   928 apply (drule reals_Archimedean, safe)
```
```   929 apply (drule_tac x = n in spec, auto)
```
```   930 apply (rule_tac x = M in exI, auto)
```
```   931 apply (drule_tac x = m in spec, simp)
```
```   932 apply (drule_tac x = na in spec, auto)
```
```   933 done
```
```   934
```
```   935 lemma CauchyI:
```
```   936   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   937   shows "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e) \<Longrightarrow> Cauchy X"
```
```   938 by (simp add: Cauchy_iff)
```
```   939
```
```   940 lemma CauchyD:
```
```   941   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
```
```   942   shows "\<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e"
```
```   943 by (simp add: Cauchy_iff)
```
```   944
```
```   945 lemma Cauchy_subseq_Cauchy:
```
```   946   "\<lbrakk> Cauchy X; subseq f \<rbrakk> \<Longrightarrow> Cauchy (X o f)"
```
```   947 apply (auto simp add: Cauchy_def)
```
```   948 apply (drule_tac x=e in spec, clarify)
```
```   949 apply (rule_tac x=M in exI, clarify)
```
```   950 apply (blast intro: le_trans [OF _ seq_suble] dest!: spec)
```
```   951 done
```
```   952
```
```   953 subsubsection {* Cauchy Sequences are Bounded *}
```
```   954
```
```   955 text{*A Cauchy sequence is bounded -- this is the standard
```
```   956   proof mechanization rather than the nonstandard proof*}
```
```   957
```
```   958 lemma lemmaCauchy: "\<forall>n \<ge> M. norm (X M - X n) < (1::real)
```
```   959           ==>  \<forall>n \<ge> M. norm (X n :: 'a::real_normed_vector) < 1 + norm (X M)"
```
```   960 apply (clarify, drule spec, drule (1) mp)
```
```   961 apply (simp only: norm_minus_commute)
```
```   962 apply (drule order_le_less_trans [OF norm_triangle_ineq2])
```
```   963 apply simp
```
```   964 done
```
```   965
```
```   966 lemma Cauchy_Bseq: "Cauchy X ==> Bseq X"
```
```   967 apply (simp add: Cauchy_iff)
```
```   968 apply (drule spec, drule mp, rule zero_less_one, safe)
```
```   969 apply (drule_tac x="M" in spec, simp)
```
```   970 apply (drule lemmaCauchy)
```
```   971 apply (rule_tac k="M" in Bseq_offset)
```
```   972 apply (simp add: Bseq_def)
```
```   973 apply (rule_tac x="1 + norm (X M)" in exI)
```
```   974 apply (rule conjI, rule order_less_le_trans [OF zero_less_one], simp)
```
```   975 apply (simp add: order_less_imp_le)
```
```   976 done
```
```   977
```
```   978 subsubsection {* Cauchy Sequences are Convergent *}
```
```   979
```
```   980 class complete_space = metric_space +
```
```   981   assumes Cauchy_convergent: "Cauchy X \<Longrightarrow> convergent X"
```
```   982
```
```   983 class banach = real_normed_vector + complete_space
```
```   984
```
```   985 theorem LIMSEQ_imp_Cauchy:
```
```   986   assumes X: "X ----> a" shows "Cauchy X"
```
```   987 proof (rule metric_CauchyI)
```
```   988   fix e::real assume "0 < e"
```
```   989   hence "0 < e/2" by simp
```
```   990   with X have "\<exists>N. \<forall>n\<ge>N. dist (X n) a < e/2" by (rule metric_LIMSEQ_D)
```
```   991   then obtain N where N: "\<forall>n\<ge>N. dist (X n) a < e/2" ..
```
```   992   show "\<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m) (X n) < e"
```
```   993   proof (intro exI allI impI)
```
```   994     fix m assume "N \<le> m"
```
```   995     hence m: "dist (X m) a < e/2" using N by fast
```
```   996     fix n assume "N \<le> n"
```
```   997     hence n: "dist (X n) a < e/2" using N by fast
```
```   998     have "dist (X m) (X n) \<le> dist (X m) a + dist (X n) a"
```
```   999       by (rule dist_triangle2)
```
```  1000     also from m n have "\<dots> < e" by simp
```
```  1001     finally show "dist (X m) (X n) < e" .
```
```  1002   qed
```
```  1003 qed
```
```  1004
```
```  1005 lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
```
```  1006 unfolding convergent_def
```
```  1007 by (erule exE, erule LIMSEQ_imp_Cauchy)
```
```  1008
```
```  1009 lemma Cauchy_convergent_iff:
```
```  1010   fixes X :: "nat \<Rightarrow> 'a::complete_space"
```
```  1011   shows "Cauchy X = convergent X"
```
```  1012 by (fast intro: Cauchy_convergent convergent_Cauchy)
```
```  1013
```
```  1014 text {*
```
```  1015 Proof that Cauchy sequences converge based on the one from
```
```  1016 http://pirate.shu.edu/~wachsmut/ira/numseq/proofs/cauconv.html
```
```  1017 *}
```
```  1018
```
```  1019 text {*
```
```  1020   If sequence @{term "X"} is Cauchy, then its limit is the lub of
```
```  1021   @{term "{r::real. \<exists>N. \<forall>n\<ge>N. r < X n}"}
```
```  1022 *}
```
```  1023
```
```  1024 lemma isUb_UNIV_I: "(\<And>y. y \<in> S \<Longrightarrow> y \<le> u) \<Longrightarrow> isUb UNIV S u"
```
```  1025 by (simp add: isUbI setleI)
```
```  1026
```
```  1027 locale real_Cauchy =
```
```  1028   fixes X :: "nat \<Rightarrow> real"
```
```  1029   assumes X: "Cauchy X"
```
```  1030   fixes S :: "real set"
```
```  1031   defines S_def: "S \<equiv> {x::real. \<exists>N. \<forall>n\<ge>N. x < X n}"
```
```  1032
```
```  1033 lemma real_CauchyI:
```
```  1034   assumes "Cauchy X"
```
```  1035   shows "real_Cauchy X"
```
```  1036   proof qed (fact assms)
```
```  1037
```
```  1038 lemma (in real_Cauchy) mem_S: "\<forall>n\<ge>N. x < X n \<Longrightarrow> x \<in> S"
```
```  1039 by (unfold S_def, auto)
```
```  1040
```
```  1041 lemma (in real_Cauchy) bound_isUb:
```
```  1042   assumes N: "\<forall>n\<ge>N. X n < x"
```
```  1043   shows "isUb UNIV S x"
```
```  1044 proof (rule isUb_UNIV_I)
```
```  1045   fix y::real assume "y \<in> S"
```
```  1046   hence "\<exists>M. \<forall>n\<ge>M. y < X n"
```
```  1047     by (simp add: S_def)
```
```  1048   then obtain M where "\<forall>n\<ge>M. y < X n" ..
```
```  1049   hence "y < X (max M N)" by simp
```
```  1050   also have "\<dots> < x" using N by simp
```
```  1051   finally show "y \<le> x"
```
```  1052     by (rule order_less_imp_le)
```
```  1053 qed
```
```  1054
```
```  1055 lemma (in real_Cauchy) isLub_ex: "\<exists>u. isLub UNIV S u"
```
```  1056 proof (rule reals_complete)
```
```  1057   obtain N where "\<forall>m\<ge>N. \<forall>n\<ge>N. norm (X m - X n) < 1"
```
```  1058     using CauchyD [OF X zero_less_one] by auto
```
```  1059   hence N: "\<forall>n\<ge>N. norm (X n - X N) < 1" by simp
```
```  1060   show "\<exists>x. x \<in> S"
```
```  1061   proof
```
```  1062     from N have "\<forall>n\<ge>N. X N - 1 < X n"
```
```  1063       by (simp add: abs_diff_less_iff)
```
```  1064     thus "X N - 1 \<in> S" by (rule mem_S)
```
```  1065   qed
```
```  1066   show "\<exists>u. isUb UNIV S u"
```
```  1067   proof
```
```  1068     from N have "\<forall>n\<ge>N. X n < X N + 1"
```
```  1069       by (simp add: abs_diff_less_iff)
```
```  1070     thus "isUb UNIV S (X N + 1)"
```
```  1071       by (rule bound_isUb)
```
```  1072   qed
```
```  1073 qed
```
```  1074
```
```  1075 lemma (in real_Cauchy) isLub_imp_LIMSEQ:
```
```  1076   assumes x: "isLub UNIV S x"
```
```  1077   shows "X ----> x"
```
```  1078 proof (rule LIMSEQ_I)
```
```  1079   fix r::real assume "0 < r"
```
```  1080   hence r: "0 < r/2" by simp
```
```  1081   obtain N where "\<forall>n\<ge>N. \<forall>m\<ge>N. norm (X n - X m) < r/2"
```
```  1082     using CauchyD [OF X r] by auto
```
```  1083   hence "\<forall>n\<ge>N. norm (X n - X N) < r/2" by simp
```
```  1084   hence N: "\<forall>n\<ge>N. X N - r/2 < X n \<and> X n < X N + r/2"
```
```  1085     by (simp only: real_norm_def abs_diff_less_iff)
```
```  1086
```
```  1087   from N have "\<forall>n\<ge>N. X N - r/2 < X n" by fast
```
```  1088   hence "X N - r/2 \<in> S" by (rule mem_S)
```
```  1089   hence 1: "X N - r/2 \<le> x" using x isLub_isUb isUbD by fast
```
```  1090
```
```  1091   from N have "\<forall>n\<ge>N. X n < X N + r/2" by fast
```
```  1092   hence "isUb UNIV S (X N + r/2)" by (rule bound_isUb)
```
```  1093   hence 2: "x \<le> X N + r/2" using x isLub_le_isUb by fast
```
```  1094
```
```  1095   show "\<exists>N. \<forall>n\<ge>N. norm (X n - x) < r"
```
```  1096   proof (intro exI allI impI)
```
```  1097     fix n assume n: "N \<le> n"
```
```  1098     from N n have "X n < X N + r/2" and "X N - r/2 < X n" by simp+
```
```  1099     thus "norm (X n - x) < r" using 1 2
```
```  1100       by (simp add: abs_diff_less_iff)
```
```  1101   qed
```
```  1102 qed
```
```  1103
```
```  1104 lemma (in real_Cauchy) LIMSEQ_ex: "\<exists>x. X ----> x"
```
```  1105 proof -
```
```  1106   obtain x where "isLub UNIV S x"
```
```  1107     using isLub_ex by fast
```
```  1108   hence "X ----> x"
```
```  1109     by (rule isLub_imp_LIMSEQ)
```
```  1110   thus ?thesis ..
```
```  1111 qed
```
```  1112
```
```  1113 lemma real_Cauchy_convergent:
```
```  1114   fixes X :: "nat \<Rightarrow> real"
```
```  1115   shows "Cauchy X \<Longrightarrow> convergent X"
```
```  1116 unfolding convergent_def
```
```  1117 by (rule real_Cauchy.LIMSEQ_ex)
```
```  1118  (rule real_CauchyI)
```
```  1119
```
```  1120 instance real :: banach
```
```  1121 by intro_classes (rule real_Cauchy_convergent)
```
```  1122
```
```  1123
```
```  1124 subsection {* Power Sequences *}
```
```  1125
```
```  1126 text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term
```
```  1127 "x<1"}.  Proof will use (NS) Cauchy equivalence for convergence and
```
```  1128   also fact that bounded and monotonic sequence converges.*}
```
```  1129
```
```  1130 lemma Bseq_realpow: "[| 0 \<le> (x::real); x \<le> 1 |] ==> Bseq (%n. x ^ n)"
```
```  1131 apply (simp add: Bseq_def)
```
```  1132 apply (rule_tac x = 1 in exI)
```
```  1133 apply (simp add: power_abs)
```
```  1134 apply (auto dest: power_mono)
```
```  1135 done
```
```  1136
```
```  1137 lemma monoseq_realpow: fixes x :: real shows "[| 0 \<le> x; x \<le> 1 |] ==> monoseq (%n. x ^ n)"
```
```  1138 apply (clarify intro!: mono_SucI2)
```
```  1139 apply (cut_tac n = n and N = "Suc n" and a = x in power_decreasing, auto)
```
```  1140 done
```
```  1141
```
```  1142 lemma convergent_realpow:
```
```  1143   "[| 0 \<le> (x::real); x \<le> 1 |] ==> convergent (%n. x ^ n)"
```
```  1144 by (blast intro!: Bseq_monoseq_convergent Bseq_realpow monoseq_realpow)
```
```  1145
```
```  1146 lemma LIMSEQ_inverse_realpow_zero_lemma:
```
```  1147   fixes x :: real
```
```  1148   assumes x: "0 \<le> x"
```
```  1149   shows "real n * x + 1 \<le> (x + 1) ^ n"
```
```  1150 apply (induct n)
```
```  1151 apply simp
```
```  1152 apply simp
```
```  1153 apply (rule order_trans)
```
```  1154 prefer 2
```
```  1155 apply (erule mult_left_mono)
```
```  1156 apply (rule add_increasing [OF x], simp)
```
```  1157 apply (simp add: real_of_nat_Suc)
```
```  1158 apply (simp add: ring_distribs)
```
```  1159 apply (simp add: mult_nonneg_nonneg x)
```
```  1160 done
```
```  1161
```
```  1162 lemma LIMSEQ_inverse_realpow_zero:
```
```  1163   "1 < (x::real) \<Longrightarrow> (\<lambda>n. inverse (x ^ n)) ----> 0"
```
```  1164 proof (rule LIMSEQ_inverse_zero [rule_format])
```
```  1165   fix y :: real
```
```  1166   assume x: "1 < x"
```
```  1167   hence "0 < x - 1" by simp
```
```  1168   hence "\<forall>y. \<exists>N::nat. y < real N * (x - 1)"
```
```  1169     by (rule reals_Archimedean3)
```
```  1170   hence "\<exists>N::nat. y < real N * (x - 1)" ..
```
```  1171   then obtain N::nat where "y < real N * (x - 1)" ..
```
```  1172   also have "\<dots> \<le> real N * (x - 1) + 1" by simp
```
```  1173   also have "\<dots> \<le> (x - 1 + 1) ^ N"
```
```  1174     by (rule LIMSEQ_inverse_realpow_zero_lemma, cut_tac x, simp)
```
```  1175   also have "\<dots> = x ^ N" by simp
```
```  1176   finally have "y < x ^ N" .
```
```  1177   hence "\<forall>n\<ge>N. y < x ^ n"
```
```  1178     apply clarify
```
```  1179     apply (erule order_less_le_trans)
```
```  1180     apply (erule power_increasing)
```
```  1181     apply (rule order_less_imp_le [OF x])
```
```  1182     done
```
```  1183   thus "\<exists>N. \<forall>n\<ge>N. y < x ^ n" ..
```
```  1184 qed
```
```  1185
```
```  1186 lemma LIMSEQ_realpow_zero:
```
```  1187   "\<lbrakk>0 \<le> (x::real); x < 1\<rbrakk> \<Longrightarrow> (\<lambda>n. x ^ n) ----> 0"
```
```  1188 proof (cases)
```
```  1189   assume "x = 0"
```
```  1190   hence "(\<lambda>n. x ^ Suc n) ----> 0" by (simp add: LIMSEQ_const)
```
```  1191   thus ?thesis by (rule LIMSEQ_imp_Suc)
```
```  1192 next
```
```  1193   assume "0 \<le> x" and "x \<noteq> 0"
```
```  1194   hence x0: "0 < x" by simp
```
```  1195   assume x1: "x < 1"
```
```  1196   from x0 x1 have "1 < inverse x"
```
```  1197     by (rule one_less_inverse)
```
```  1198   hence "(\<lambda>n. inverse (inverse x ^ n)) ----> 0"
```
```  1199     by (rule LIMSEQ_inverse_realpow_zero)
```
```  1200   thus ?thesis by (simp add: power_inverse)
```
```  1201 qed
```
```  1202
```
```  1203 lemma LIMSEQ_power_zero:
```
```  1204   fixes x :: "'a::{real_normed_algebra_1}"
```
```  1205   shows "norm x < 1 \<Longrightarrow> (\<lambda>n. x ^ n) ----> 0"
```
```  1206 apply (drule LIMSEQ_realpow_zero [OF norm_ge_zero])
```
```  1207 apply (simp only: LIMSEQ_Zfun_iff, erule Zfun_le)
```
```  1208 apply (simp add: power_abs norm_power_ineq)
```
```  1209 done
```
```  1210
```
```  1211 lemma LIMSEQ_divide_realpow_zero:
```
```  1212   "1 < (x::real) ==> (%n. a / (x ^ n)) ----> 0"
```
```  1213 apply (cut_tac a = a and x1 = "inverse x" in
```
```  1214         LIMSEQ_mult [OF LIMSEQ_const LIMSEQ_realpow_zero])
```
```  1215 apply (auto simp add: divide_inverse power_inverse)
```
```  1216 apply (simp add: inverse_eq_divide pos_divide_less_eq)
```
```  1217 done
```
```  1218
```
```  1219 text{*Limit of @{term "c^n"} for @{term"\<bar>c\<bar> < 1"}*}
```
```  1220
```
```  1221 lemma LIMSEQ_rabs_realpow_zero: "\<bar>c\<bar> < (1::real) ==> (%n. \<bar>c\<bar> ^ n) ----> 0"
```
```  1222 by (rule LIMSEQ_realpow_zero [OF abs_ge_zero])
```
```  1223
```
```  1224 lemma LIMSEQ_rabs_realpow_zero2: "\<bar>c\<bar> < (1::real) ==> (%n. c ^ n) ----> 0"
```
```  1225 apply (rule LIMSEQ_rabs_zero [THEN iffD1])
```
```  1226 apply (auto intro: LIMSEQ_rabs_realpow_zero simp add: power_abs)
```
```  1227 done
```
```  1228
```
```  1229 end
```