src/HOL/SEQ.thy
changeset 29803 c56a5571f60a
parent 29667 53103fc8ffa3
child 30082 43c5b7bfc791
child 30240 5b25fee0362c
equal deleted inserted replaced
29802:d201a838d0f7 29803:c56a5571f60a
   343 lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) ----> l \<Longrightarrow> f ----> l"
   343 lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) ----> l \<Longrightarrow> f ----> l"
   344 by (rule_tac k="1" in LIMSEQ_offset, simp)
   344 by (rule_tac k="1" in LIMSEQ_offset, simp)
   345 
   345 
   346 lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) ----> l = f ----> l"
   346 lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) ----> l = f ----> l"
   347 by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
   347 by (blast intro: LIMSEQ_imp_Suc LIMSEQ_Suc)
       
   348 
       
   349 lemma LIMSEQ_linear: "\<lbrakk> X ----> x ; l > 0 \<rbrakk> \<Longrightarrow> (\<lambda> n. X (n * l)) ----> x"
       
   350   unfolding LIMSEQ_def
       
   351   by (metis div_le_dividend div_mult_self1_is_m le_trans nat_mult_commute)
       
   352 
   348 
   353 
   349 lemma add_diff_add:
   354 lemma add_diff_add:
   350   fixes a b c d :: "'a::ab_group_add"
   355   fixes a b c d :: "'a::ab_group_add"
   351   shows "(a + c) - (b + d) = (a - b) + (c - d)"
   356   shows "(a + c) - (b + d) = (a - b) + (c - d)"
   352 by simp
   357 by simp
   676 by (simp add: monoseq_Suc)
   681 by (simp add: monoseq_Suc)
   677 
   682 
   678 lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
   683 lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n ==> monoseq X"
   679 by (simp add: monoseq_Suc)
   684 by (simp add: monoseq_Suc)
   680 
   685 
       
   686 lemma monoseq_minus: assumes "monoseq a"
       
   687   shows "monoseq (\<lambda> n. - a n)"
       
   688 proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
       
   689   case True
       
   690   hence "\<forall> m. \<forall> n \<ge> m. - a n \<le> - a m" by auto
       
   691   thus ?thesis by (rule monoI2)
       
   692 next
       
   693   case False
       
   694   hence "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" using `monoseq a`[unfolded monoseq_def] by auto
       
   695   thus ?thesis by (rule monoI1)
       
   696 qed
       
   697 
       
   698 lemma monoseq_le: assumes "monoseq a" and "a ----> x"
       
   699   shows "((\<forall> n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n)) \<or> 
       
   700          ((\<forall> n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m))"
       
   701 proof -
       
   702   { fix x n fix a :: "nat \<Rightarrow> real"
       
   703     assume "a ----> x" and "\<forall> m. \<forall> n \<ge> m. a m \<le> a n"
       
   704     hence monotone: "\<And> m n. m \<le> n \<Longrightarrow> a m \<le> a n" by auto
       
   705     have "a n \<le> x"
       
   706     proof (rule ccontr)
       
   707       assume "\<not> a n \<le> x" hence "x < a n" by auto
       
   708       hence "0 < a n - x" by auto
       
   709       from `a ----> x`[THEN LIMSEQ_D, OF this]
       
   710       obtain no where "\<And>n'. no \<le> n' \<Longrightarrow> norm (a n' - x) < a n - x" by blast
       
   711       hence "norm (a (max no n) - x) < a n - x" by auto
       
   712       moreover
       
   713       { fix n' have "n \<le> n' \<Longrightarrow> x < a n'" using monotone[where m=n and n=n'] and `x < a n` by auto }
       
   714       hence "x < a (max no n)" by auto
       
   715       ultimately
       
   716       have "a (max no n) < a n" by auto
       
   717       with monotone[where m=n and n="max no n"]
       
   718       show False by auto
       
   719     qed
       
   720   } note top_down = this
       
   721   { fix x n m fix a :: "nat \<Rightarrow> real"
       
   722     assume "a ----> x" and "monoseq a" and "a m < x"
       
   723     have "a n \<le> x \<and> (\<forall> m. \<forall> n \<ge> m. a m \<le> a n)"
       
   724     proof (cases "\<forall> m. \<forall> n \<ge> m. a m \<le> a n")
       
   725       case True with top_down and `a ----> x` show ?thesis by auto
       
   726     next
       
   727       case False with `monoseq a`[unfolded monoseq_def] have "\<forall> m. \<forall> n \<ge> m. - a m \<le> - a n" by auto
       
   728       hence "- a m \<le> - x" using top_down[OF LIMSEQ_minus[OF `a ----> x`]] by blast
       
   729       hence False using `a m < x` by auto
       
   730       thus ?thesis ..
       
   731     qed
       
   732   } note when_decided = this
       
   733 
       
   734   show ?thesis
       
   735   proof (cases "\<exists> m. a m \<noteq> x")
       
   736     case True then obtain m where "a m \<noteq> x" by auto
       
   737     show ?thesis
       
   738     proof (cases "a m < x")
       
   739       case True with when_decided[OF `a ----> x` `monoseq a`, where m2=m]
       
   740       show ?thesis by blast
       
   741     next
       
   742       case False hence "- a m < - x" using `a m \<noteq> x` by auto
       
   743       with when_decided[OF LIMSEQ_minus[OF `a ----> x`] monoseq_minus[OF `monoseq a`], where m2=m]
       
   744       show ?thesis by auto
       
   745     qed
       
   746   qed auto
       
   747 qed
       
   748 
   681 text{*Bounded Sequence*}
   749 text{*Bounded Sequence*}
   682 
   750 
   683 lemma BseqD: "Bseq X ==> \<exists>K. 0 < K & (\<forall>n. norm (X n) \<le> K)"
   751 lemma BseqD: "Bseq X ==> \<exists>K. 0 < K & (\<forall>n. norm (X n) \<le> K)"
   684 by (simp add: Bseq_def)
   752 by (simp add: Bseq_def)
   685 
   753