src/HOL/Ln.thy
changeset 29667 53103fc8ffa3
parent 28952 15a4b2cf8c34
child 30273 ecd6f0ca62ea
equal deleted inserted replaced
29549:7187373c6cb1 29667:53103fc8ffa3
   185 
   185 
   186 lemma ln_one_minus_pos_upper_bound: "0 <= x ==> x < 1 ==> ln (1 - x) <= - x"
   186 lemma ln_one_minus_pos_upper_bound: "0 <= x ==> x < 1 ==> ln (1 - x) <= - x"
   187 proof -
   187 proof -
   188   assume a: "0 <= (x::real)" and b: "x < 1"
   188   assume a: "0 <= (x::real)" and b: "x < 1"
   189   have "(1 - x) * (1 + x + x^2) = (1 - x^3)"
   189   have "(1 - x) * (1 + x + x^2) = (1 - x^3)"
   190     by (simp add: ring_simps power2_eq_square power3_eq_cube)
   190     by (simp add: algebra_simps power2_eq_square power3_eq_cube)
   191   also have "... <= 1"
   191   also have "... <= 1"
   192     by (auto simp add: a)
   192     by (auto simp add: a)
   193   finally have "(1 - x) * (1 + x + x ^ 2) <= 1" .
   193   finally have "(1 - x) * (1 + x + x ^ 2) <= 1" .
   194   moreover have "0 < 1 + x + x^2"
   194   moreover have "0 < 1 + x + x^2"
   195     apply (rule add_pos_nonneg)
   195     apply (rule add_pos_nonneg)
   323     apply (rule ln_add_one_self_le_self2)
   323     apply (rule ln_add_one_self_le_self2)
   324     apply (insert prems, auto)
   324     apply (insert prems, auto)
   325     done
   325     done
   326   also have "... <= 2 * x^2"
   326   also have "... <= 2 * x^2"
   327     apply (subgoal_tac "- (-x) - 2 * (-x)^2 <= ln (1 - (-x))")
   327     apply (subgoal_tac "- (-x) - 2 * (-x)^2 <= ln (1 - (-x))")
   328     apply (simp add: compare_rls)
   328     apply (simp add: algebra_simps)
   329     apply (rule ln_one_minus_pos_lower_bound)
   329     apply (rule ln_one_minus_pos_lower_bound)
   330     apply (insert prems, auto)
   330     apply (insert prems, auto)
   331     done 
   331     done
   332   finally show ?thesis .
   332   finally show ?thesis .
   333 qed
   333 qed
   334 
   334 
   335 lemma abs_ln_one_plus_x_minus_x_bound:
   335 lemma abs_ln_one_plus_x_minus_x_bound:
   336     "abs x <= 1 / 2 ==> abs(ln (1 + x) - x) <= 2 * x^2"
   336     "abs x <= 1 / 2 ==> abs(ln (1 + x) - x) <= 2 * x^2"
   373   apply (erule conjE, assumption)
   373   apply (erule conjE, assumption)
   374   apply force
   374   apply force
   375   apply simp
   375   apply simp
   376   apply (subst ln_div [THEN sym])
   376   apply (subst ln_div [THEN sym])
   377   apply arith
   377   apply arith
   378   apply (auto simp add: ring_simps add_frac_eq frac_eq_eq 
   378   apply (auto simp add: algebra_simps add_frac_eq frac_eq_eq 
   379     add_divide_distrib power2_eq_square)
   379     add_divide_distrib power2_eq_square)
   380   apply (rule mult_pos_pos, assumption)+
   380   apply (rule mult_pos_pos, assumption)+
   381   apply assumption
   381   apply assumption
   382 done
   382 done
   383 
   383 
   392     apply (subgoal_tac "0 < exp (1::real)")
   392     apply (subgoal_tac "0 < exp (1::real)")
   393     apply arith
   393     apply arith
   394     apply auto
   394     apply auto
   395     done
   395     done
   396   have "x * ln y - x * ln x = x * (ln y - ln x)"
   396   have "x * ln y - x * ln x = x * (ln y - ln x)"
   397     by (simp add: ring_simps)
   397     by (simp add: algebra_simps)
   398   also have "... = x * ln(y / x)"
   398   also have "... = x * ln(y / x)"
   399     apply (subst ln_div)
   399     apply (subst ln_div)
   400     apply (rule b, rule a, rule refl)
   400     apply (rule b, rule a, rule refl)
   401     done
   401     done
   402   also have "y / x = (x + (y - x)) / x"
   402   also have "y / x = (x + (y - x)) / x"