src/HOL/SEQ.thy
changeset 31336 e17f13cd1280
parent 31017 2c227493ea56
child 31349 2261c8781f73
equal deleted inserted replaced
31293:198eae6f5a35 31336:e17f13cd1280
    16   Zseq :: "[nat \<Rightarrow> 'a::real_normed_vector] \<Rightarrow> bool" where
    16   Zseq :: "[nat \<Rightarrow> 'a::real_normed_vector] \<Rightarrow> bool" where
    17     --{*Standard definition of sequence converging to zero*}
    17     --{*Standard definition of sequence converging to zero*}
    18   [code del]: "Zseq X = (\<forall>r>0. \<exists>no. \<forall>n\<ge>no. norm (X n) < r)"
    18   [code del]: "Zseq X = (\<forall>r>0. \<exists>no. \<forall>n\<ge>no. norm (X n) < r)"
    19 
    19 
    20 definition
    20 definition
    21   LIMSEQ :: "[nat => 'a::real_normed_vector, 'a] => bool"
    21   LIMSEQ :: "[nat \<Rightarrow> 'a::metric_space, 'a] \<Rightarrow> bool"
    22     ("((_)/ ----> (_))" [60, 60] 60) where
    22     ("((_)/ ----> (_))" [60, 60] 60) where
    23     --{*Standard definition of convergence of sequence*}
    23     --{*Standard definition of convergence of sequence*}
    24   [code del]: "X ----> L = (\<forall>r. 0 < r --> (\<exists>no. \<forall>n. no \<le> n --> norm (X n - L) < r))"
    24   [code del]: "X ----> L = (\<forall>r>0. \<exists>no. \<forall>n\<ge>no. dist (X n) L < r)"
    25 
    25 
    26 definition
    26 definition
    27   lim :: "(nat => 'a::real_normed_vector) => 'a" where
    27   lim :: "(nat \<Rightarrow> 'a::real_normed_vector) \<Rightarrow> 'a" where
    28     --{*Standard definition of limit using choice operator*}
    28     --{*Standard definition of limit using choice operator*}
    29   "lim X = (THE L. X ----> L)"
    29   "lim X = (THE L. X ----> L)"
    30 
    30 
    31 definition
    31 definition
    32   convergent :: "(nat => 'a::real_normed_vector) => bool" where
    32   convergent :: "(nat \<Rightarrow> 'a::metric_space) \<Rightarrow> bool" where
    33     --{*Standard definition of convergence*}
    33     --{*Standard definition of convergence*}
    34   "convergent X = (\<exists>L. X ----> L)"
    34   "convergent X = (\<exists>L. X ----> L)"
    35 
    35 
    36 definition
    36 definition
    37   Bseq :: "(nat => 'a::real_normed_vector) => bool" where
    37   Bseq :: "(nat => 'a::real_normed_vector) => bool" where
    60   subseq :: "(nat => nat) => bool" where
    60   subseq :: "(nat => nat) => bool" where
    61     --{*Definition of subsequence*}
    61     --{*Definition of subsequence*}
    62   [code del]:   "subseq f = (\<forall>m. \<forall>n>m. (f m) < (f n))"
    62   [code del]:   "subseq f = (\<forall>m. \<forall>n>m. (f m) < (f n))"
    63 
    63 
    64 definition
    64 definition
    65   Cauchy :: "(nat => 'a::real_normed_vector) => bool" where
    65   Cauchy :: "(nat \<Rightarrow> 'a::metric_space) \<Rightarrow> bool" where
    66     --{*Standard definition of the Cauchy condition*}
    66     --{*Standard definition of the Cauchy condition*}
    67   [code del]: "Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. norm (X m - X n) < e)"
    67   [code del]: "Cauchy X = (\<forall>e>0. \<exists>M. \<forall>m \<ge> M. \<forall>n \<ge> M. dist (X m) (X n) < e)"
    68 
    68 
    69 
    69 
    70 subsection {* Bounded Sequences *}
    70 subsection {* Bounded Sequences *}
    71 
    71 
    72 lemma BseqI': assumes K: "\<And>n. norm (X n) \<le> K" shows "Bseq X"
    72 lemma BseqI': assumes K: "\<And>n. norm (X n) \<le> K" shows "Bseq X"
   300 
   300 
   301 
   301 
   302 subsection {* Limits of Sequences *}
   302 subsection {* Limits of Sequences *}
   303 
   303 
   304 lemma LIMSEQ_iff:
   304 lemma LIMSEQ_iff:
   305       "(X ----> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. norm (X n - L) < r)"
   305   fixes L :: "'a::real_normed_vector"
   306 by (rule LIMSEQ_def)
   306   shows "(X ----> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. norm (X n - L) < r)"
       
   307 unfolding LIMSEQ_def dist_norm ..
   307 
   308 
   308 lemma LIMSEQ_Zseq_iff: "((\<lambda>n. X n) ----> L) = Zseq (\<lambda>n. X n - L)"
   309 lemma LIMSEQ_Zseq_iff: "((\<lambda>n. X n) ----> L) = Zseq (\<lambda>n. X n - L)"
   309 by (simp only: LIMSEQ_def Zseq_def)
   310 by (simp only: LIMSEQ_iff Zseq_def)
       
   311 
       
   312 lemma metric_LIMSEQ_I:
       
   313   "(\<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r) \<Longrightarrow> X ----> L"
       
   314 by (simp add: LIMSEQ_def)
       
   315 
       
   316 lemma metric_LIMSEQ_D:
       
   317   "\<lbrakk>X ----> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. dist (X n) L < r"
       
   318 by (simp add: LIMSEQ_def)
   310 
   319 
   311 lemma LIMSEQ_I:
   320 lemma LIMSEQ_I:
   312   "(\<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r) \<Longrightarrow> X ----> L"
   321   fixes L :: "'a::real_normed_vector"
   313 by (simp add: LIMSEQ_def)
   322   shows "(\<And>r. 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r) \<Longrightarrow> X ----> L"
       
   323 by (simp add: LIMSEQ_iff)
   314 
   324 
   315 lemma LIMSEQ_D:
   325 lemma LIMSEQ_D:
   316   "\<lbrakk>X ----> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r"
   326   fixes L :: "'a::real_normed_vector"
   317 by (simp add: LIMSEQ_def)
   327   shows "\<lbrakk>X ----> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r"
       
   328 by (simp add: LIMSEQ_iff)
   318 
   329 
   319 lemma LIMSEQ_const: "(\<lambda>n. k) ----> k"
   330 lemma LIMSEQ_const: "(\<lambda>n. k) ----> k"
   320 by (simp add: LIMSEQ_def)
   331 by (simp add: LIMSEQ_def)
   321 
   332 
   322 lemma LIMSEQ_const_iff: "(\<lambda>n. k) ----> l = (k = l)"
   333 lemma LIMSEQ_const_iff: "(\<lambda>n. k) ----> l \<longleftrightarrow> k = l"
   323 by (simp add: LIMSEQ_Zseq_iff Zseq_const_iff)
   334 apply (safe intro!: LIMSEQ_const)
   324 
   335 apply (rule ccontr)
   325 lemma LIMSEQ_norm: "X ----> a \<Longrightarrow> (\<lambda>n. norm (X n)) ----> norm a"
   336 apply (drule_tac r="dist k l" in metric_LIMSEQ_D)
   326 apply (simp add: LIMSEQ_def, safe)
   337 apply (simp add: zero_less_dist_iff)
       
   338 apply auto
       
   339 done
       
   340 
       
   341 lemma LIMSEQ_norm:
       
   342   fixes a :: "'a::real_normed_vector"
       
   343   shows "X ----> a \<Longrightarrow> (\<lambda>n. norm (X n)) ----> norm a"
       
   344 apply (simp add: LIMSEQ_iff, safe)
   327 apply (drule_tac x="r" in spec, safe)
   345 apply (drule_tac x="r" in spec, safe)
   328 apply (rule_tac x="no" in exI, safe)
   346 apply (rule_tac x="no" in exI, safe)
   329 apply (drule_tac x="n" in spec, safe)
   347 apply (drule_tac x="n" in spec, safe)
   330 apply (erule order_le_less_trans [OF norm_triangle_ineq3])
   348 apply (erule order_le_less_trans [OF norm_triangle_ineq3])
   331 done
   349 done
   332 
   350 
   333 lemma LIMSEQ_ignore_initial_segment:
   351 lemma LIMSEQ_ignore_initial_segment:
   334   "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a"
   352   "f ----> a \<Longrightarrow> (\<lambda>n. f (n + k)) ----> a"
   335 apply (rule LIMSEQ_I)
   353 apply (rule metric_LIMSEQ_I)
   336 apply (drule (1) LIMSEQ_D)
   354 apply (drule (1) metric_LIMSEQ_D)
   337 apply (erule exE, rename_tac N)
   355 apply (erule exE, rename_tac N)
   338 apply (rule_tac x=N in exI)
   356 apply (rule_tac x=N in exI)
   339 apply simp
   357 apply simp
   340 done
   358 done
   341 
   359 
   342 lemma LIMSEQ_offset:
   360 lemma LIMSEQ_offset:
   343   "(\<lambda>n. f (n + k)) ----> a \<Longrightarrow> f ----> a"
   361   "(\<lambda>n. f (n + k)) ----> a \<Longrightarrow> f ----> a"
   344 apply (rule LIMSEQ_I)
   362 apply (rule metric_LIMSEQ_I)
   345 apply (drule (1) LIMSEQ_D)
   363 apply (drule (1) metric_LIMSEQ_D)
   346 apply (erule exE, rename_tac N)
   364 apply (erule exE, rename_tac N)
   347 apply (rule_tac x="N + k" in exI)
   365 apply (rule_tac x="N + k" in exI)
   348 apply clarify
   366 apply clarify
   349 apply (drule_tac x="n - k" in spec)
   367 apply (drule_tac x="n - k" in spec)
   350 apply (simp add: le_diff_conv2)
   368 apply (simp add: le_diff_conv2)
   372 lemma minus_diff_minus:
   390 lemma minus_diff_minus:
   373   fixes a b :: "'a::ab_group_add"
   391   fixes a b :: "'a::ab_group_add"
   374   shows "(- a) - (- b) = - (a - b)"
   392   shows "(- a) - (- b) = - (a - b)"
   375 by simp
   393 by simp
   376 
   394 
   377 lemma LIMSEQ_add: "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) ----> a + b"
   395 lemma LIMSEQ_add:
       
   396   fixes a b :: "'a::real_normed_vector"
       
   397   shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n + Y n) ----> a + b"
   378 by (simp only: LIMSEQ_Zseq_iff add_diff_add Zseq_add)
   398 by (simp only: LIMSEQ_Zseq_iff add_diff_add Zseq_add)
   379 
   399 
   380 lemma LIMSEQ_minus: "X ----> a \<Longrightarrow> (\<lambda>n. - X n) ----> - a"
   400 lemma LIMSEQ_minus:
       
   401   fixes a :: "'a::real_normed_vector"
       
   402   shows "X ----> a \<Longrightarrow> (\<lambda>n. - X n) ----> - a"
   381 by (simp only: LIMSEQ_Zseq_iff minus_diff_minus Zseq_minus)
   403 by (simp only: LIMSEQ_Zseq_iff minus_diff_minus Zseq_minus)
   382 
   404 
   383 lemma LIMSEQ_minus_cancel: "(\<lambda>n. - X n) ----> - a \<Longrightarrow> X ----> a"
   405 lemma LIMSEQ_minus_cancel:
       
   406   fixes a :: "'a::real_normed_vector"
       
   407   shows "(\<lambda>n. - X n) ----> - a \<Longrightarrow> X ----> a"
   384 by (drule LIMSEQ_minus, simp)
   408 by (drule LIMSEQ_minus, simp)
   385 
   409 
   386 lemma LIMSEQ_diff: "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) ----> a - b"
   410 lemma LIMSEQ_diff:
       
   411   fixes a b :: "'a::real_normed_vector"
       
   412   shows "\<lbrakk>X ----> a; Y ----> b\<rbrakk> \<Longrightarrow> (\<lambda>n. X n - Y n) ----> a - b"
   387 by (simp add: diff_minus LIMSEQ_add LIMSEQ_minus)
   413 by (simp add: diff_minus LIMSEQ_add LIMSEQ_minus)
   388 
   414 
   389 lemma LIMSEQ_unique: "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b"
   415 lemma LIMSEQ_unique: "\<lbrakk>X ----> a; X ----> b\<rbrakk> \<Longrightarrow> a = b"
   390 by (drule (1) LIMSEQ_diff, simp add: LIMSEQ_const_iff)
   416 apply (rule ccontr)
       
   417 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff)
       
   418 apply (drule_tac r="dist a b / 2" in metric_LIMSEQ_D, simp add: zero_less_dist_iff)
       
   419 apply (clarify, rename_tac M N)
       
   420 apply (subgoal_tac "dist a b < dist a b / 2 + dist a b / 2", simp)
       
   421 apply (subgoal_tac "dist a b \<le> dist (X (max M N)) a + dist (X (max M N)) b")
       
   422 apply (erule le_less_trans, rule add_strict_mono, simp, simp)
       
   423 apply (subst dist_commute, rule dist_triangle)
       
   424 done
   391 
   425 
   392 lemma (in bounded_linear) LIMSEQ:
   426 lemma (in bounded_linear) LIMSEQ:
   393   "X ----> a \<Longrightarrow> (\<lambda>n. f (X n)) ----> f a"
   427   "X ----> a \<Longrightarrow> (\<lambda>n. f (X n)) ----> f a"
   394 by (simp only: LIMSEQ_Zseq_iff diff [symmetric] Zseq)
   428 by (simp only: LIMSEQ_Zseq_iff diff [symmetric] Zseq)
   395 
   429 
   490   fixes a :: "'a::{power, real_normed_algebra}"
   524   fixes a :: "'a::{power, real_normed_algebra}"
   491   shows "X ----> a \<Longrightarrow> (\<lambda>n. (X n) ^ m) ----> a ^ m"
   525   shows "X ----> a \<Longrightarrow> (\<lambda>n. (X n) ^ m) ----> a ^ m"
   492 by (induct m) (simp_all add: LIMSEQ_const LIMSEQ_mult)
   526 by (induct m) (simp_all add: LIMSEQ_const LIMSEQ_mult)
   493 
   527 
   494 lemma LIMSEQ_setsum:
   528 lemma LIMSEQ_setsum:
       
   529   fixes L :: "'a \<Rightarrow> 'b::real_normed_vector"
   495   assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
   530   assumes n: "\<And>n. n \<in> S \<Longrightarrow> X n ----> L n"
   496   shows "(\<lambda>m. \<Sum>n\<in>S. X n m) ----> (\<Sum>n\<in>S. L n)"
   531   shows "(\<lambda>m. \<Sum>n\<in>S. X n m) ----> (\<Sum>n\<in>S. L n)"
   497 proof (cases "finite S")
   532 proof (cases "finite S")
   498   case True
   533   case True
   499   thus ?thesis using n
   534   thus ?thesis using n
   532   case False
   567   case False
   533   thus ?thesis
   568   thus ?thesis
   534     by (simp add: setprod_def LIMSEQ_const)
   569     by (simp add: setprod_def LIMSEQ_const)
   535 qed
   570 qed
   536 
   571 
   537 lemma LIMSEQ_add_const: "f ----> a ==> (%n.(f n + b)) ----> a + b"
   572 lemma LIMSEQ_add_const:
       
   573   fixes a :: "'a::real_normed_vector"
       
   574   shows "f ----> a ==> (%n.(f n + b)) ----> a + b"
   538 by (simp add: LIMSEQ_add LIMSEQ_const)
   575 by (simp add: LIMSEQ_add LIMSEQ_const)
   539 
   576 
   540 (* FIXME: delete *)
   577 (* FIXME: delete *)
   541 lemma LIMSEQ_add_minus:
   578 lemma LIMSEQ_add_minus:
   542      "[| X ----> a; Y ----> b |] ==> (%n. X n + -Y n) ----> a + -b"
   579   fixes a b :: "'a::real_normed_vector"
       
   580   shows "[| X ----> a; Y ----> b |] ==> (%n. X n + -Y n) ----> a + -b"
   543 by (simp only: LIMSEQ_add LIMSEQ_minus)
   581 by (simp only: LIMSEQ_add LIMSEQ_minus)
   544 
   582 
   545 lemma LIMSEQ_diff_const: "f ----> a ==> (%n.(f n  - b)) ----> a - b"
   583 lemma LIMSEQ_diff_const:
       
   584   fixes a b :: "'a::real_normed_vector"
       
   585   shows "f ----> a ==> (%n.(f n  - b)) ----> a - b"
   546 by (simp add: LIMSEQ_diff LIMSEQ_const)
   586 by (simp add: LIMSEQ_diff LIMSEQ_const)
   547 
   587 
   548 lemma LIMSEQ_diff_approach_zero: 
   588 lemma LIMSEQ_diff_approach_zero:
   549   "g ----> L ==> (%x. f x - g x) ----> 0  ==>
   589   fixes L :: "'a::real_normed_vector"
   550      f ----> L"
   590   shows "g ----> L ==> (%x. f x - g x) ----> 0 ==> f ----> L"
   551   apply (drule LIMSEQ_add)
   591 by (drule (1) LIMSEQ_add, simp)
   552   apply assumption
   592 
   553   apply simp
   593 lemma LIMSEQ_diff_approach_zero2:
   554 done
   594   fixes L :: "'a::real_normed_vector"
   555 
   595   shows "f ----> L ==> (%x. f x - g x) ----> 0 ==> g ----> L";
   556 lemma LIMSEQ_diff_approach_zero2: 
   596 by (drule (1) LIMSEQ_diff, simp)
   557   "f ----> L ==> (%x. f x - g x) ----> 0  ==>
       
   558      g ----> L";
       
   559   apply (drule LIMSEQ_diff)
       
   560   apply assumption
       
   561   apply simp
       
   562 done
       
   563 
   597 
   564 text{*A sequence tends to zero iff its abs does*}
   598 text{*A sequence tends to zero iff its abs does*}
   565 lemma LIMSEQ_norm_zero: "((\<lambda>n. norm (X n)) ----> 0) = (X ----> 0)"
   599 lemma LIMSEQ_norm_zero:
   566 by (simp add: LIMSEQ_def)
   600   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
       
   601   shows "((\<lambda>n. norm (X n)) ----> 0) \<longleftrightarrow> (X ----> 0)"
       
   602 by (simp add: LIMSEQ_iff)
   567 
   603 
   568 lemma LIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----> 0) = (f ----> (0::real))"
   604 lemma LIMSEQ_rabs_zero: "((%n. \<bar>f n\<bar>) ----> 0) = (f ----> (0::real))"
   569 by (simp add: LIMSEQ_def)
   605 by (simp add: LIMSEQ_iff)
   570 
   606 
   571 lemma LIMSEQ_imp_rabs: "f ----> (l::real) ==> (%n. \<bar>f n\<bar>) ----> \<bar>l\<bar>"
   607 lemma LIMSEQ_imp_rabs: "f ----> (l::real) ==> (%n. \<bar>f n\<bar>) ----> \<bar>l\<bar>"
   572 by (drule LIMSEQ_norm, simp)
   608 by (drule LIMSEQ_norm, simp)
   573 
   609 
   574 text{*An unbounded sequence's inverse tends to 0*}
   610 text{*An unbounded sequence's inverse tends to 0*}
   651 by (auto simp add: convergent_def)
   687 by (auto simp add: convergent_def)
   652 
   688 
   653 lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
   689 lemma convergent_LIMSEQ_iff: "convergent X = (X ----> lim X)"
   654 by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
   690 by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
   655 
   691 
   656 lemma convergent_minus_iff: "(convergent X) = (convergent (%n. -(X n)))"
   692 lemma convergent_minus_iff:
       
   693   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
       
   694   shows "convergent X \<longleftrightarrow> convergent (\<lambda>n. - X n)"
   657 apply (simp add: convergent_def)
   695 apply (simp add: convergent_def)
   658 apply (auto dest: LIMSEQ_minus)
   696 apply (auto dest: LIMSEQ_minus)
   659 apply (drule LIMSEQ_minus, auto)
   697 apply (drule LIMSEQ_minus, auto)
   660 done
   698 done
   661 
   699 
  1117 done
  1155 done
  1118 
  1156 
  1119 
  1157 
  1120 subsection {* Cauchy Sequences *}
  1158 subsection {* Cauchy Sequences *}
  1121 
  1159 
       
  1160 lemma metric_CauchyI:
       
  1161   "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e) \<Longrightarrow> Cauchy X"
       
  1162 by (simp add: Cauchy_def)
       
  1163 
       
  1164 lemma metric_CauchyD:
       
  1165   "\<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (X m) (X n) < e"
       
  1166 by (simp add: Cauchy_def)
       
  1167 
       
  1168 lemma Cauchy_iff:
       
  1169   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
       
  1170   shows "Cauchy X \<longleftrightarrow> (\<forall>e>0. \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e)"
       
  1171 unfolding Cauchy_def dist_norm ..
       
  1172 
  1122 lemma CauchyI:
  1173 lemma CauchyI:
  1123   "(\<And>e. 0 < e \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e) \<Longrightarrow> Cauchy X"
  1174   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
  1124 by (simp add: Cauchy_def)
  1175   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"
       
  1176 by (simp add: Cauchy_iff)
  1125 
  1177 
  1126 lemma CauchyD:
  1178 lemma CauchyD:
  1127   "\<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e"
  1179   fixes X :: "nat \<Rightarrow> 'a::real_normed_vector"
  1128 by (simp add: Cauchy_def)
  1180   shows "\<lbrakk>Cauchy X; 0 < e\<rbrakk> \<Longrightarrow> \<exists>M. \<forall>m\<ge>M. \<forall>n\<ge>M. norm (X m - X n) < e"
       
  1181 by (simp add: Cauchy_iff)
  1129 
  1182 
  1130 lemma Cauchy_subseq_Cauchy:
  1183 lemma Cauchy_subseq_Cauchy:
  1131   "\<lbrakk> Cauchy X; subseq f \<rbrakk> \<Longrightarrow> Cauchy (X o f)"
  1184   "\<lbrakk> Cauchy X; subseq f \<rbrakk> \<Longrightarrow> Cauchy (X o f)"
  1132 apply (auto simp add: Cauchy_def) 
  1185 apply (auto simp add: Cauchy_def)
  1133 apply (drule_tac x=e in spec, clarify)  
  1186 apply (drule_tac x=e in spec, clarify)
  1134 apply (rule_tac x=M in exI, clarify) 
  1187 apply (rule_tac x=M in exI, clarify)
  1135 apply (blast intro: seq_suble le_trans dest!: spec) 
  1188 apply (blast intro: le_trans [OF _ seq_suble] dest!: spec)
  1136 done
  1189 done
  1137 
  1190 
  1138 subsubsection {* Cauchy Sequences are Bounded *}
  1191 subsubsection {* Cauchy Sequences are Bounded *}
  1139 
  1192 
  1140 text{*A Cauchy sequence is bounded -- this is the standard
  1193 text{*A Cauchy sequence is bounded -- this is the standard
  1147 apply (drule order_le_less_trans [OF norm_triangle_ineq2])
  1200 apply (drule order_le_less_trans [OF norm_triangle_ineq2])
  1148 apply simp
  1201 apply simp
  1149 done
  1202 done
  1150 
  1203 
  1151 lemma Cauchy_Bseq: "Cauchy X ==> Bseq X"
  1204 lemma Cauchy_Bseq: "Cauchy X ==> Bseq X"
  1152 apply (simp add: Cauchy_def)
  1205 apply (simp add: Cauchy_iff)
  1153 apply (drule spec, drule mp, rule zero_less_one, safe)
  1206 apply (drule spec, drule mp, rule zero_less_one, safe)
  1154 apply (drule_tac x="M" in spec, simp)
  1207 apply (drule_tac x="M" in spec, simp)
  1155 apply (drule lemmaCauchy)
  1208 apply (drule lemmaCauchy)
  1156 apply (rule_tac k="M" in Bseq_offset)
  1209 apply (rule_tac k="M" in Bseq_offset)
  1157 apply (simp add: Bseq_def)
  1210 apply (simp add: Bseq_def)
  1165 axclass banach \<subseteq> real_normed_vector
  1218 axclass banach \<subseteq> real_normed_vector
  1166   Cauchy_convergent: "Cauchy X \<Longrightarrow> convergent X"
  1219   Cauchy_convergent: "Cauchy X \<Longrightarrow> convergent X"
  1167 
  1220 
  1168 theorem LIMSEQ_imp_Cauchy:
  1221 theorem LIMSEQ_imp_Cauchy:
  1169   assumes X: "X ----> a" shows "Cauchy X"
  1222   assumes X: "X ----> a" shows "Cauchy X"
  1170 proof (rule CauchyI)
  1223 proof (rule metric_CauchyI)
  1171   fix e::real assume "0 < e"
  1224   fix e::real assume "0 < e"
  1172   hence "0 < e/2" by simp
  1225   hence "0 < e/2" by simp
  1173   with X have "\<exists>N. \<forall>n\<ge>N. norm (X n - a) < e/2" by (rule LIMSEQ_D)
  1226   with X have "\<exists>N. \<forall>n\<ge>N. dist (X n) a < e/2" by (rule metric_LIMSEQ_D)
  1174   then obtain N where N: "\<forall>n\<ge>N. norm (X n - a) < e/2" ..
  1227   then obtain N where N: "\<forall>n\<ge>N. dist (X n) a < e/2" ..
  1175   show "\<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. norm (X m - X n) < e"
  1228   show "\<exists>N. \<forall>m\<ge>N. \<forall>n\<ge>N. dist (X m) (X n) < e"
  1176   proof (intro exI allI impI)
  1229   proof (intro exI allI impI)
  1177     fix m assume "N \<le> m"
  1230     fix m assume "N \<le> m"
  1178     hence m: "norm (X m - a) < e/2" using N by fast
  1231     hence m: "dist (X m) a < e/2" using N by fast
  1179     fix n assume "N \<le> n"
  1232     fix n assume "N \<le> n"
  1180     hence n: "norm (X n - a) < e/2" using N by fast
  1233     hence n: "dist (X n) a < e/2" using N by fast
  1181     have "norm (X m - X n) = norm ((X m - a) - (X n - a))" by simp
  1234     have "dist (X m) (X n) \<le> dist (X m) a + dist (X n) a"
  1182     also have "\<dots> \<le> norm (X m - a) + norm (X n - a)"
  1235       by (rule dist_triangle2)
  1183       by (rule norm_triangle_ineq4)
  1236     also from m n have "\<dots> < e" by simp
  1184     also from m n have "\<dots> < e" by(simp add:field_simps)
  1237     finally show "dist (X m) (X n) < e" .
  1185     finally show "norm (X m - X n) < e" .
       
  1186   qed
  1238   qed
  1187 qed
  1239 qed
  1188 
  1240 
  1189 lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
  1241 lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
  1190 unfolding convergent_def
  1242 unfolding convergent_def
  1309 by (fast intro: Cauchy_convergent convergent_Cauchy)
  1361 by (fast intro: Cauchy_convergent convergent_Cauchy)
  1310 
  1362 
  1311 lemma convergent_subseq_convergent:
  1363 lemma convergent_subseq_convergent:
  1312   fixes X :: "nat \<Rightarrow> 'a::banach"
  1364   fixes X :: "nat \<Rightarrow> 'a::banach"
  1313   shows "\<lbrakk> convergent X; subseq f \<rbrakk> \<Longrightarrow> convergent (X o f)"
  1365   shows "\<lbrakk> convergent X; subseq f \<rbrakk> \<Longrightarrow> convergent (X o f)"
  1314   by (simp add: Cauchy_subseq_Cauchy Cauchy_convergent_iff [symmetric]) 
  1366   by (simp add: Cauchy_subseq_Cauchy Cauchy_convergent_iff [symmetric])
  1315 
  1367 
  1316 
  1368 
  1317 subsection {* Power Sequences *}
  1369 subsection {* Power Sequences *}
  1318 
  1370 
  1319 text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term
  1371 text{*The sequence @{term "x^n"} tends to 0 if @{term "0\<le>x"} and @{term