src/HOL/Ln.thy
changeset 47242 1caeecc72aea
parent 44305 3bdc02eb1637
child 47244 a7f85074c169
     1.1 --- a/src/HOL/Ln.thy	Sat Mar 31 19:10:58 2012 +0200
     1.2 +++ b/src/HOL/Ln.thy	Sat Mar 31 20:09:24 2012 +0200
     1.3 @@ -32,68 +32,22 @@
     1.4  
     1.5  lemma aux1: assumes a: "0 <= x" and b: "x <= 1"
     1.6      shows "inverse (fact ((n::nat) + 2)) * x ^ (n + 2) <= (x^2/2) * ((1/2)^n)"
     1.7 -proof (induct n)
     1.8 -  show "inverse (fact ((0::nat) + 2)) * x ^ (0 + 2) <= 
     1.9 -      x ^ 2 / 2 * (1 / 2) ^ 0"
    1.10 -    by (simp add: real_of_nat_Suc power2_eq_square)
    1.11 -next
    1.12 -  fix n :: nat
    1.13 -  assume c: "inverse (fact (n + 2)) * x ^ (n + 2)
    1.14 -       <= x ^ 2 / 2 * (1 / 2) ^ n"
    1.15 -  show "inverse (fact (Suc n + 2)) * x ^ (Suc n + 2)
    1.16 -           <= x ^ 2 / 2 * (1 / 2) ^ Suc n"
    1.17 -  proof -
    1.18 -    have "inverse(fact (Suc n + 2)) <= (1/2) * inverse (fact (n+2))"
    1.19 -    proof -
    1.20 -      have "Suc n + 2 = Suc (n + 2)" by simp
    1.21 -      then have "fact (Suc n + 2) = Suc (n + 2) * fact (n + 2)" 
    1.22 -        by simp
    1.23 -      then have "real(fact (Suc n + 2)) = real(Suc (n + 2) * fact (n + 2))" 
    1.24 -        apply (rule subst)
    1.25 -        apply (rule refl)
    1.26 -        done
    1.27 -      also have "... = real(Suc (n + 2)) * real(fact (n + 2))"
    1.28 -        by (rule real_of_nat_mult)
    1.29 -      finally have "real (fact (Suc n + 2)) = 
    1.30 -         real (Suc (n + 2)) * real (fact (n + 2))" .
    1.31 -      then have "inverse(fact (Suc n + 2)) = 
    1.32 -         inverse(Suc (n + 2)) * inverse(fact (n + 2))"
    1.33 -        apply (rule ssubst)
    1.34 -        apply (rule inverse_mult_distrib)
    1.35 -        done
    1.36 -      also have "... <= (1/2) * inverse(fact (n + 2))"
    1.37 -        apply (rule mult_right_mono)
    1.38 -        apply (subst inverse_eq_divide)
    1.39 -        apply simp
    1.40 -        apply (simp del: fact_Suc)
    1.41 -        done
    1.42 -      finally show ?thesis .
    1.43 -    qed
    1.44 -    moreover have "x ^ (Suc n + 2) <= x ^ (n + 2)"
    1.45 -      by (simp add: mult_left_le_one_le mult_nonneg_nonneg a b)
    1.46 -    ultimately have "inverse (fact (Suc n + 2)) *  x ^ (Suc n + 2) <=
    1.47 -        (1 / 2 * inverse (fact (n + 2))) * x ^ (n + 2)"
    1.48 -      apply (rule mult_mono)
    1.49 -      apply (rule mult_nonneg_nonneg)
    1.50 -      apply simp
    1.51 -      apply (subst inverse_nonnegative_iff_nonnegative)
    1.52 -      apply (rule real_of_nat_ge_zero)
    1.53 -      apply (rule zero_le_power)
    1.54 -      apply (rule a)
    1.55 -      done
    1.56 -    also have "... = 1 / 2 * (inverse (fact (n + 2)) * x ^ (n + 2))"
    1.57 -      by simp
    1.58 -    also have "... <= 1 / 2 * (x ^ 2 / 2 * (1 / 2) ^ n)"
    1.59 -      apply (rule mult_left_mono)
    1.60 -      apply (rule c)
    1.61 -      apply simp
    1.62 -      done
    1.63 -    also have "... = x ^ 2 / 2 * (1 / 2 * (1 / 2) ^ n)"
    1.64 -      by auto
    1.65 -    also have "(1::real) / 2 * (1 / 2) ^ n = (1 / 2) ^ (Suc n)"
    1.66 -      by (rule power_Suc [THEN sym])
    1.67 -    finally show ?thesis .
    1.68 -  qed
    1.69 +proof -
    1.70 +  have "2 * 2 ^ n \<le> fact (n + 2)"
    1.71 +    by (induct n, simp, simp)
    1.72 +  hence "real ((2::nat) * 2 ^ n) \<le> real (fact (n + 2))"
    1.73 +    by (simp only: real_of_nat_le_iff)
    1.74 +  hence "2 * 2 ^ n \<le> real (fact (n + 2))"
    1.75 +    by simp
    1.76 +  hence "inverse (fact (n + 2)) \<le> inverse (2 * 2 ^ n)"
    1.77 +    by (rule le_imp_inverse_le) simp
    1.78 +  hence "inverse (fact (n + 2)) \<le> 1/2 * (1/2)^n"
    1.79 +    by (simp add: inverse_mult_distrib power_inverse)
    1.80 +  hence "inverse (fact (n + 2)) * (x^n * x\<twosuperior>) \<le> 1/2 * (1/2)^n * (1 * x\<twosuperior>)"
    1.81 +    by (rule mult_mono)
    1.82 +      (rule mult_mono, simp_all add: power_le_one a b mult_nonneg_nonneg)
    1.83 +  thus ?thesis
    1.84 +    unfolding power_add by (simp add: mult_ac del: fact_Suc)
    1.85  qed
    1.86  
    1.87  lemma aux2: "(%n. (x::real) ^ 2 / 2 * (1 / 2) ^ n) sums x^2"