New lemmas connected with the reals and infinite series
authorpaulson
Mon, 05 Oct 2009 17:27:46 +0100
changeset 328776f09346c7c08
parent 32876 c34b072518c9
child 32878 f8d995b5dd60
New lemmas connected with the reals and infinite series
src/HOL/Real.thy
src/HOL/SEQ.thy
src/HOL/Series.thy
     1.1 --- a/src/HOL/Real.thy	Mon Oct 05 16:41:06 2009 +0100
     1.2 +++ b/src/HOL/Real.thy	Mon Oct 05 17:27:46 2009 +0100
     1.3 @@ -2,4 +2,28 @@
     1.4  imports RComplete RealVector
     1.5  begin
     1.6  
     1.7 +lemma field_le_epsilon:
     1.8 +  fixes x y :: "'a:: {number_ring,division_by_zero,ordered_field}"
     1.9 +  assumes e: "(!!e. 0 < e ==> x \<le> y + e)"
    1.10 +  shows "x \<le> y"
    1.11 +proof (rule ccontr)
    1.12 +  assume xy: "\<not> x \<le> y"
    1.13 +  hence "(x-y)/2 > 0"
    1.14 +    by (metis half_gt_zero le_iff_diff_le_0 linorder_not_le local.xy)
    1.15 +  hence "x \<le> y + (x - y) / 2"
    1.16 +    by (rule e [of "(x-y)/2"])
    1.17 +  also have "... = (x - y + 2*y)/2"
    1.18 +    by auto
    1.19 +       (metis add_less_cancel_left add_numeral_0_right class_semiring.add_c xy e
    1.20 +           diff_add_cancel gt_half_sum less_half_sum linorder_not_le number_of_Pls)
    1.21 +  also have "... = (x + y) / 2" 
    1.22 +    by auto
    1.23 +  also have "... < x" using xy 
    1.24 +    by auto
    1.25 +  finally have "x<x" .
    1.26 +  thus False
    1.27 +    by auto 
    1.28 +qed
    1.29 +
    1.30 +
    1.31  end
     2.1 --- a/src/HOL/SEQ.thy	Mon Oct 05 16:41:06 2009 +0100
     2.2 +++ b/src/HOL/SEQ.thy	Mon Oct 05 17:27:46 2009 +0100
     2.3 @@ -193,6 +193,9 @@
     2.4  
     2.5  subsection {* Limits of Sequences *}
     2.6  
     2.7 +lemma [trans]: "X=Y ==> Y ----> z ==> X ----> z"
     2.8 +  by simp
     2.9 +
    2.10  lemma LIMSEQ_conv_tendsto: "(X ----> L) \<longleftrightarrow> (X ---> L) sequentially"
    2.11  unfolding LIMSEQ_def tendsto_iff eventually_sequentially ..
    2.12  
    2.13 @@ -315,6 +318,39 @@
    2.14    shows "[| X ----> a; Y ----> b |] ==> (%n. X n * Y n) ----> a * b"
    2.15  by (rule mult.LIMSEQ)
    2.16  
    2.17 +lemma increasing_LIMSEQ:
    2.18 +  fixes f :: "nat \<Rightarrow> real"
    2.19 +  assumes inc: "!!n. f n \<le> f (Suc n)"
    2.20 +      and bdd: "!!n. f n \<le> l"
    2.21 +      and en: "!!e. 0 < e \<Longrightarrow> \<exists>n. l \<le> f n + e"
    2.22 +  shows "f ----> l"
    2.23 +proof (auto simp add: LIMSEQ_def)
    2.24 +  fix e :: real
    2.25 +  assume e: "0 < e"
    2.26 +  then obtain N where "l \<le> f N + e/2"
    2.27 +    by (metis half_gt_zero e en that)
    2.28 +  hence N: "l < f N + e" using e
    2.29 +    by simp
    2.30 +  { fix k
    2.31 +    have [simp]: "!!n. \<bar>f n - l\<bar> = l - f n"
    2.32 +      by (simp add: bdd) 
    2.33 +    have "\<bar>f (N+k) - l\<bar> < e"
    2.34 +    proof (induct k)
    2.35 +      case 0 show ?case using N
    2.36 +	by simp   
    2.37 +    next
    2.38 +      case (Suc k) thus ?case using N inc [of "N+k"]
    2.39 +	by simp
    2.40 +    qed 
    2.41 +  } note 1 = this
    2.42 +  { fix n
    2.43 +    have "N \<le> n \<Longrightarrow> \<bar>f n - l\<bar> < e" using 1 [of "n-N"]
    2.44 +      by simp 
    2.45 +  } note [intro] = this
    2.46 +  show " \<exists>no. \<forall>n\<ge>no. dist (f n) l < e"
    2.47 +    by (auto simp add: dist_real_def) 
    2.48 +  qed
    2.49 +
    2.50  lemma Bseq_inverse_lemma:
    2.51    fixes x :: "'a::real_normed_div_algebra"
    2.52    shows "\<lbrakk>r \<le> norm x; 0 < r\<rbrakk> \<Longrightarrow> norm (inverse x) \<le> inverse r"
     3.1 --- a/src/HOL/Series.thy	Mon Oct 05 16:41:06 2009 +0100
     3.2 +++ b/src/HOL/Series.thy	Mon Oct 05 17:27:46 2009 +0100
     3.3 @@ -32,6 +32,9 @@
     3.4    "\<Sum>i. b" == "CONST suminf (%i. b)"
     3.5  
     3.6  
     3.7 +lemma [trans]: "f=g ==> g sums z ==> f sums z"
     3.8 +  by simp
     3.9 +
    3.10  lemma sumr_diff_mult_const:
    3.11   "setsum f {0..<n} - (real n*r) = setsum (%i. f i - r) {0..<n::nat}"
    3.12  by (simp add: diff_minus setsum_addf real_of_nat_def)