| author | wenzelm | 
| Mon, 06 Feb 2006 21:00:00 +0100 | |
| changeset 18960 | 9881ff995ff5 | 
| parent 17013 | 74bc935273ea | 
| child 19765 | dfe940911617 | 
| permissions | -rwxr-xr-x | 
| 16959 | 1  | 
(* Title: Ln.thy  | 
2  | 
Author: Jeremy Avigad  | 
|
| 16963 | 3  | 
ID: $Id$  | 
| 16959 | 4  | 
*)  | 
5  | 
||
6  | 
header {* Properties of ln *}
 | 
|
7  | 
||
8  | 
theory Ln  | 
|
9  | 
||
10  | 
imports Transcendental  | 
|
11  | 
begin  | 
|
12  | 
||
13  | 
lemma exp_first_two_terms: "exp x = 1 + x + suminf (%n.  | 
|
14  | 
inverse(real (fact (n+2))) * (x ^ (n+2)))"  | 
|
15  | 
proof -  | 
|
16  | 
have "exp x = suminf (%n. inverse(real (fact n)) * (x ^ n))"  | 
|
17  | 
by (unfold exp_def, simp)  | 
|
18  | 
  also from summable_exp have "... = (SUM n : {0..<2}. 
 | 
|
19  | 
inverse(real (fact n)) * (x ^ n)) + suminf (%n.  | 
|
20  | 
inverse(real (fact (n+2))) * (x ^ (n+2)))" (is "_ = ?a + _")  | 
|
21  | 
by (rule suminf_split_initial_segment)  | 
|
22  | 
also have "?a = 1 + x"  | 
|
23  | 
by (simp add: numerals)  | 
|
24  | 
finally show ?thesis .  | 
|
25  | 
qed  | 
|
26  | 
||
27  | 
lemma exp_tail_after_first_two_terms_summable:  | 
|
28  | 
"summable (%n. inverse(real (fact (n+2))) * (x ^ (n+2)))"  | 
|
29  | 
proof -  | 
|
30  | 
note summable_exp  | 
|
31  | 
thus ?thesis  | 
|
32  | 
by (frule summable_ignore_initial_segment)  | 
|
33  | 
qed  | 
|
34  | 
||
35  | 
lemma aux1: assumes a: "0 <= x" and b: "x <= 1"  | 
|
36  | 
shows "inverse (real (fact (n + 2))) * x ^ (n + 2) <= (x^2/2) * ((1/2)^n)"  | 
|
37  | 
proof (induct n)  | 
|
38  | 
show "inverse (real (fact (0 + 2))) * x ^ (0 + 2) <=  | 
|
39  | 
x ^ 2 / 2 * (1 / 2) ^ 0"  | 
|
40  | 
apply (simp add: power2_eq_square)  | 
|
41  | 
apply (subgoal_tac "real (Suc (Suc 0)) = 2")  | 
|
42  | 
apply (erule ssubst)  | 
|
43  | 
apply simp  | 
|
44  | 
apply simp  | 
|
45  | 
done  | 
|
46  | 
next  | 
|
47  | 
fix n  | 
|
48  | 
assume c: "inverse (real (fact (n + 2))) * x ^ (n + 2)  | 
|
49  | 
<= x ^ 2 / 2 * (1 / 2) ^ n"  | 
|
50  | 
show "inverse (real (fact (Suc n + 2))) * x ^ (Suc n + 2)  | 
|
51  | 
<= x ^ 2 / 2 * (1 / 2) ^ Suc n"  | 
|
52  | 
proof -  | 
|
53  | 
have "inverse(real (fact (Suc n + 2))) <=  | 
|
54  | 
(1 / 2) *inverse (real (fact (n+2)))"  | 
|
55  | 
proof -  | 
|
56  | 
have "Suc n + 2 = Suc (n + 2)" by simp  | 
|
57  | 
then have "fact (Suc n + 2) = Suc (n + 2) * fact (n + 2)"  | 
|
58  | 
by simp  | 
|
59  | 
then have "real(fact (Suc n + 2)) = real(Suc (n + 2) * fact (n + 2))"  | 
|
60  | 
apply (rule subst)  | 
|
61  | 
apply (rule refl)  | 
|
62  | 
done  | 
|
63  | 
also have "... = real(Suc (n + 2)) * real(fact (n + 2))"  | 
|
64  | 
by (rule real_of_nat_mult)  | 
|
65  | 
finally have "real (fact (Suc n + 2)) =  | 
|
66  | 
real (Suc (n + 2)) * real (fact (n + 2))" .  | 
|
67  | 
then have "inverse(real (fact (Suc n + 2))) =  | 
|
68  | 
inverse(real (Suc (n + 2))) * inverse(real (fact (n + 2)))"  | 
|
69  | 
apply (rule ssubst)  | 
|
70  | 
apply (rule inverse_mult_distrib)  | 
|
71  | 
done  | 
|
72  | 
also have "... <= (1/2) * inverse(real (fact (n + 2)))"  | 
|
73  | 
apply (rule mult_right_mono)  | 
|
74  | 
apply (subst inverse_eq_divide)  | 
|
75  | 
apply simp  | 
|
76  | 
apply (rule inv_real_of_nat_fact_ge_zero)  | 
|
77  | 
done  | 
|
78  | 
finally show ?thesis .  | 
|
79  | 
qed  | 
|
80  | 
moreover have "x ^ (Suc n + 2) <= x ^ (n + 2)"  | 
|
81  | 
apply (simp add: mult_compare_simps)  | 
|
82  | 
apply (simp add: prems)  | 
|
83  | 
apply (subgoal_tac "0 <= x * (x * x^n)")  | 
|
84  | 
apply force  | 
|
85  | 
apply (rule mult_nonneg_nonneg, rule a)+  | 
|
86  | 
apply (rule zero_le_power, rule a)  | 
|
87  | 
done  | 
|
88  | 
ultimately have "inverse (real (fact (Suc n + 2))) * x ^ (Suc n + 2) <=  | 
|
89  | 
(1 / 2 * inverse (real (fact (n + 2)))) * x ^ (n + 2)"  | 
|
90  | 
apply (rule mult_mono)  | 
|
91  | 
apply (rule mult_nonneg_nonneg)  | 
|
92  | 
apply simp  | 
|
93  | 
apply (subst inverse_nonnegative_iff_nonnegative)  | 
|
94  | 
apply (rule real_of_nat_fact_ge_zero)  | 
|
95  | 
apply (rule zero_le_power)  | 
|
96  | 
apply assumption  | 
|
97  | 
done  | 
|
98  | 
also have "... = 1 / 2 * (inverse (real (fact (n + 2))) * x ^ (n + 2))"  | 
|
99  | 
by simp  | 
|
100  | 
also have "... <= 1 / 2 * (x ^ 2 / 2 * (1 / 2) ^ n)"  | 
|
101  | 
apply (rule mult_left_mono)  | 
|
102  | 
apply (rule prems)  | 
|
103  | 
apply simp  | 
|
104  | 
done  | 
|
105  | 
also have "... = x ^ 2 / 2 * (1 / 2 * (1 / 2) ^ n)"  | 
|
106  | 
by auto  | 
|
107  | 
also have "(1::real) / 2 * (1 / 2) ^ n = (1 / 2) ^ (Suc n)"  | 
|
108  | 
by (rule realpow_Suc [THEN sym])  | 
|
109  | 
finally show ?thesis .  | 
|
110  | 
qed  | 
|
111  | 
qed  | 
|
112  | 
||
113  | 
lemma aux2: "(%n. x ^ 2 / 2 * (1 / 2) ^ n) sums x^2"  | 
|
114  | 
proof -  | 
|
115  | 
have "(%n. (1 / 2)^n) sums (1 / (1 - (1/2)))"  | 
|
116  | 
apply (rule geometric_sums)  | 
|
117  | 
by (simp add: abs_interval_iff)  | 
|
118  | 
also have "(1::real) / (1 - 1/2) = 2"  | 
|
119  | 
by simp  | 
|
120  | 
finally have "(%n. (1 / 2)^n) sums 2" .  | 
|
121  | 
then have "(%n. x ^ 2 / 2 * (1 / 2) ^ n) sums (x^2 / 2 * 2)"  | 
|
122  | 
by (rule sums_mult)  | 
|
123  | 
also have "x^2 / 2 * 2 = x^2"  | 
|
124  | 
by simp  | 
|
125  | 
finally show ?thesis .  | 
|
126  | 
qed  | 
|
127  | 
||
128  | 
lemma exp_bound: "0 <= x ==> x <= 1 ==> exp x <= 1 + x + x^2"  | 
|
129  | 
proof -  | 
|
130  | 
assume a: "0 <= x"  | 
|
131  | 
assume b: "x <= 1"  | 
|
132  | 
have c: "exp x = 1 + x + suminf (%n. inverse(real (fact (n+2))) *  | 
|
133  | 
(x ^ (n+2)))"  | 
|
134  | 
by (rule exp_first_two_terms)  | 
|
135  | 
moreover have "suminf (%n. inverse(real (fact (n+2))) * (x ^ (n+2))) <= x^2"  | 
|
136  | 
proof -  | 
|
137  | 
have "suminf (%n. inverse(real (fact (n+2))) * (x ^ (n+2))) <=  | 
|
138  | 
suminf (%n. (x^2/2) * ((1/2)^n))"  | 
|
139  | 
apply (rule summable_le)  | 
|
140  | 
apply (auto simp only: aux1 prems)  | 
|
141  | 
apply (rule exp_tail_after_first_two_terms_summable)  | 
|
142  | 
by (rule sums_summable, rule aux2)  | 
|
143  | 
also have "... = x^2"  | 
|
144  | 
by (rule sums_unique [THEN sym], rule aux2)  | 
|
145  | 
finally show ?thesis .  | 
|
146  | 
qed  | 
|
147  | 
ultimately show ?thesis  | 
|
148  | 
by auto  | 
|
149  | 
qed  | 
|
150  | 
||
151  | 
lemma aux3: "(0::real) <= x ==> (1 + x + x^2)/(1 + x^2) <= 1 + x"  | 
|
152  | 
apply (subst pos_divide_le_eq)  | 
|
153  | 
apply (simp add: zero_compare_simps)  | 
|
154  | 
apply (simp add: ring_eq_simps zero_compare_simps)  | 
|
155  | 
done  | 
|
156  | 
||
157  | 
lemma aux4: "0 <= x ==> x <= 1 ==> exp (x - x^2) <= 1 + x"  | 
|
158  | 
proof -  | 
|
159  | 
assume a: "0 <= x" and b: "x <= 1"  | 
|
160  | 
have "exp (x - x^2) = exp x / exp (x^2)"  | 
|
161  | 
by (rule exp_diff)  | 
|
162  | 
also have "... <= (1 + x + x^2) / exp (x ^2)"  | 
|
163  | 
apply (rule divide_right_mono)  | 
|
164  | 
apply (rule exp_bound)  | 
|
165  | 
apply (rule a, rule b)  | 
|
166  | 
apply simp  | 
|
167  | 
done  | 
|
168  | 
also have "... <= (1 + x + x^2) / (1 + x^2)"  | 
|
169  | 
apply (rule divide_left_mono)  | 
|
| 
17013
 
74bc935273ea
renamed exp_ge_add_one_self2 to exp_ge_add_one_self
 
avigad 
parents: 
16963 
diff
changeset
 | 
170  | 
apply (auto simp add: exp_ge_add_one_self_aux)  | 
| 16959 | 171  | 
apply (rule add_nonneg_nonneg)  | 
172  | 
apply (insert prems, auto)  | 
|
173  | 
apply (rule mult_pos_pos)  | 
|
174  | 
apply auto  | 
|
175  | 
apply (rule add_pos_nonneg)  | 
|
176  | 
apply auto  | 
|
177  | 
done  | 
|
178  | 
also from a have "... <= 1 + x"  | 
|
179  | 
by (rule aux3)  | 
|
180  | 
finally show ?thesis .  | 
|
181  | 
qed  | 
|
182  | 
||
183  | 
lemma ln_one_plus_pos_lower_bound: "0 <= x ==> x <= 1 ==>  | 
|
184  | 
x - x^2 <= ln (1 + x)"  | 
|
185  | 
proof -  | 
|
186  | 
assume a: "0 <= x" and b: "x <= 1"  | 
|
187  | 
then have "exp (x - x^2) <= 1 + x"  | 
|
188  | 
by (rule aux4)  | 
|
189  | 
also have "... = exp (ln (1 + x))"  | 
|
190  | 
proof -  | 
|
191  | 
from a have "0 < 1 + x" by auto  | 
|
192  | 
thus ?thesis  | 
|
193  | 
by (auto simp only: exp_ln_iff [THEN sym])  | 
|
194  | 
qed  | 
|
195  | 
finally have "exp (x - x ^ 2) <= exp (ln (1 + x))" .  | 
|
196  | 
thus ?thesis by (auto simp only: exp_le_cancel_iff)  | 
|
197  | 
qed  | 
|
198  | 
||
199  | 
lemma ln_one_minus_pos_upper_bound: "0 <= x ==> x < 1 ==> ln (1 - x) <= - x"  | 
|
200  | 
proof -  | 
|
201  | 
assume a: "0 <= (x::real)" and b: "x < 1"  | 
|
202  | 
have "(1 - x) * (1 + x + x^2) = (1 - x^3)"  | 
|
203  | 
by (simp add: ring_eq_simps power2_eq_square power3_eq_cube)  | 
|
204  | 
also have "... <= 1"  | 
|
205  | 
by (auto intro: zero_le_power simp add: a)  | 
|
206  | 
finally have "(1 - x) * (1 + x + x ^ 2) <= 1" .  | 
|
207  | 
moreover have "0 < 1 + x + x^2"  | 
|
208  | 
apply (rule add_pos_nonneg)  | 
|
209  | 
apply (insert a, auto)  | 
|
210  | 
done  | 
|
211  | 
ultimately have "1 - x <= 1 / (1 + x + x^2)"  | 
|
212  | 
by (elim mult_imp_le_div_pos)  | 
|
213  | 
also have "... <= 1 / exp x"  | 
|
214  | 
apply (rule divide_left_mono)  | 
|
215  | 
apply (rule exp_bound, rule a)  | 
|
216  | 
apply (insert prems, auto)  | 
|
217  | 
apply (rule mult_pos_pos)  | 
|
218  | 
apply (rule add_pos_nonneg)  | 
|
219  | 
apply auto  | 
|
220  | 
done  | 
|
221  | 
also have "... = exp (-x)"  | 
|
222  | 
by (auto simp add: exp_minus real_divide_def)  | 
|
223  | 
finally have "1 - x <= exp (- x)" .  | 
|
224  | 
also have "1 - x = exp (ln (1 - x))"  | 
|
225  | 
proof -  | 
|
226  | 
have "0 < 1 - x"  | 
|
227  | 
by (insert b, auto)  | 
|
228  | 
thus ?thesis  | 
|
229  | 
by (auto simp only: exp_ln_iff [THEN sym])  | 
|
230  | 
qed  | 
|
231  | 
finally have "exp (ln (1 - x)) <= exp (- x)" .  | 
|
232  | 
thus ?thesis by (auto simp only: exp_le_cancel_iff)  | 
|
233  | 
qed  | 
|
234  | 
||
235  | 
lemma aux5: "x < 1 ==> ln(1 - x) = - ln(1 + x / (1 - x))"  | 
|
236  | 
proof -  | 
|
237  | 
assume a: "x < 1"  | 
|
238  | 
have "ln(1 - x) = - ln(1 / (1 - x))"  | 
|
239  | 
proof -  | 
|
240  | 
have "ln(1 - x) = - (- ln (1 - x))"  | 
|
241  | 
by auto  | 
|
242  | 
also have "- ln(1 - x) = ln 1 - ln(1 - x)"  | 
|
243  | 
by simp  | 
|
244  | 
also have "... = ln(1 / (1 - x))"  | 
|
245  | 
apply (rule ln_div [THEN sym])  | 
|
246  | 
by (insert a, auto)  | 
|
247  | 
finally show ?thesis .  | 
|
248  | 
qed  | 
|
249  | 
also have " 1 / (1 - x) = 1 + x / (1 - x)"  | 
|
250  | 
proof -  | 
|
251  | 
have "1 / (1 - x) = (1 - x + x) / (1 - x)"  | 
|
252  | 
by auto  | 
|
253  | 
also have "... = (1 - x) / (1 - x) + x / (1 - x)"  | 
|
254  | 
by (rule add_divide_distrib)  | 
|
255  | 
also have "... = 1 + x / (1-x)"  | 
|
256  | 
apply (subst add_right_cancel)  | 
|
257  | 
apply (insert a, simp)  | 
|
258  | 
done  | 
|
259  | 
finally show ?thesis .  | 
|
260  | 
qed  | 
|
261  | 
finally show ?thesis .  | 
|
262  | 
qed  | 
|
263  | 
||
264  | 
lemma ln_one_minus_pos_lower_bound: "0 <= x ==> x <= (1 / 2) ==>  | 
|
265  | 
- x - 2 * x^2 <= ln (1 - x)"  | 
|
266  | 
proof -  | 
|
267  | 
assume a: "0 <= x" and b: "x <= (1 / 2)"  | 
|
268  | 
from b have c: "x < 1"  | 
|
269  | 
by auto  | 
|
270  | 
then have "ln (1 - x) = - ln (1 + x / (1 - x))"  | 
|
271  | 
by (rule aux5)  | 
|
272  | 
also have "- (x / (1 - x)) <= ..."  | 
|
273  | 
proof -  | 
|
274  | 
have "ln (1 + x / (1 - x)) <= x / (1 - x)"  | 
|
275  | 
apply (rule ln_add_one_self_le_self)  | 
|
276  | 
apply (rule divide_nonneg_pos)  | 
|
277  | 
by (insert a c, auto)  | 
|
278  | 
thus ?thesis  | 
|
279  | 
by auto  | 
|
280  | 
qed  | 
|
281  | 
also have "- (x / (1 - x)) = -x / (1 - x)"  | 
|
282  | 
by auto  | 
|
283  | 
finally have d: "- x / (1 - x) <= ln (1 - x)" .  | 
|
284  | 
have e: "-x - 2 * x^2 <= - x / (1 - x)"  | 
|
285  | 
apply (rule mult_imp_le_div_pos)  | 
|
286  | 
apply (insert prems, force)  | 
|
287  | 
apply (auto simp add: ring_eq_simps power2_eq_square)  | 
|
288  | 
apply (subgoal_tac "- (x * x) + x * (x * (x * 2)) = x^2 * (2 * x - 1)")  | 
|
289  | 
apply (erule ssubst)  | 
|
290  | 
apply (rule mult_nonneg_nonpos)  | 
|
291  | 
apply auto  | 
|
292  | 
apply (auto simp add: ring_eq_simps power2_eq_square)  | 
|
293  | 
done  | 
|
294  | 
from e d show "- x - 2 * x^2 <= ln (1 - x)"  | 
|
295  | 
by (rule order_trans)  | 
|
296  | 
qed  | 
|
297  | 
||
| 
17013
 
74bc935273ea
renamed exp_ge_add_one_self2 to exp_ge_add_one_self
 
avigad 
parents: 
16963 
diff
changeset
 | 
298  | 
lemma exp_ge_add_one_self [simp]: "1 + x <= exp x"  | 
| 16959 | 299  | 
apply (case_tac "0 <= x")  | 
| 
17013
 
74bc935273ea
renamed exp_ge_add_one_self2 to exp_ge_add_one_self
 
avigad 
parents: 
16963 
diff
changeset
 | 
300  | 
apply (erule exp_ge_add_one_self_aux)  | 
| 16959 | 301  | 
apply (case_tac "x <= -1")  | 
302  | 
apply (subgoal_tac "1 + x <= 0")  | 
|
303  | 
apply (erule order_trans)  | 
|
304  | 
apply simp  | 
|
305  | 
apply simp  | 
|
306  | 
apply (subgoal_tac "1 + x = exp(ln (1 + x))")  | 
|
307  | 
apply (erule ssubst)  | 
|
308  | 
apply (subst exp_le_cancel_iff)  | 
|
309  | 
apply (subgoal_tac "ln (1 - (- x)) <= - (- x)")  | 
|
310  | 
apply simp  | 
|
311  | 
apply (rule ln_one_minus_pos_upper_bound)  | 
|
312  | 
apply auto  | 
|
313  | 
apply (rule sym)  | 
|
314  | 
apply (subst exp_ln_iff)  | 
|
315  | 
apply auto  | 
|
316  | 
done  | 
|
317  | 
||
318  | 
lemma ln_add_one_self_le_self2: "-1 < x ==> ln(1 + x) <= x"  | 
|
319  | 
apply (subgoal_tac "x = ln (exp x)")  | 
|
320  | 
apply (erule ssubst)back  | 
|
321  | 
apply (subst ln_le_cancel_iff)  | 
|
322  | 
apply auto  | 
|
323  | 
done  | 
|
324  | 
||
325  | 
lemma abs_ln_one_plus_x_minus_x_bound_nonneg:  | 
|
326  | 
"0 <= x ==> x <= 1 ==> abs(ln (1 + x) - x) <= x^2"  | 
|
327  | 
proof -  | 
|
328  | 
assume "0 <= x"  | 
|
329  | 
assume "x <= 1"  | 
|
330  | 
have "ln (1 + x) <= x"  | 
|
331  | 
by (rule ln_add_one_self_le_self)  | 
|
332  | 
then have "ln (1 + x) - x <= 0"  | 
|
333  | 
by simp  | 
|
334  | 
then have "abs(ln(1 + x) - x) = - (ln(1 + x) - x)"  | 
|
335  | 
by (rule abs_of_nonpos)  | 
|
336  | 
also have "... = x - ln (1 + x)"  | 
|
337  | 
by simp  | 
|
338  | 
also have "... <= x^2"  | 
|
339  | 
proof -  | 
|
340  | 
from prems have "x - x^2 <= ln (1 + x)"  | 
|
341  | 
by (intro ln_one_plus_pos_lower_bound)  | 
|
342  | 
thus ?thesis  | 
|
343  | 
by simp  | 
|
344  | 
qed  | 
|
345  | 
finally show ?thesis .  | 
|
346  | 
qed  | 
|
347  | 
||
348  | 
lemma abs_ln_one_plus_x_minus_x_bound_nonpos:  | 
|
349  | 
"-(1 / 2) <= x ==> x <= 0 ==> abs(ln (1 + x) - x) <= 2 * x^2"  | 
|
350  | 
proof -  | 
|
351  | 
assume "-(1 / 2) <= x"  | 
|
352  | 
assume "x <= 0"  | 
|
353  | 
have "abs(ln (1 + x) - x) = x - ln(1 - (-x))"  | 
|
354  | 
apply (subst abs_of_nonpos)  | 
|
355  | 
apply simp  | 
|
356  | 
apply (rule ln_add_one_self_le_self2)  | 
|
357  | 
apply (insert prems, auto)  | 
|
358  | 
done  | 
|
359  | 
also have "... <= 2 * x^2"  | 
|
360  | 
apply (subgoal_tac "- (-x) - 2 * (-x)^2 <= ln (1 - (-x))")  | 
|
361  | 
apply (simp add: compare_rls)  | 
|
362  | 
apply (rule ln_one_minus_pos_lower_bound)  | 
|
363  | 
apply (insert prems, auto)  | 
|
364  | 
done  | 
|
365  | 
finally show ?thesis .  | 
|
366  | 
qed  | 
|
367  | 
||
368  | 
lemma abs_ln_one_plus_x_minus_x_bound:  | 
|
369  | 
"abs x <= 1 / 2 ==> abs(ln (1 + x) - x) <= 2 * x^2"  | 
|
370  | 
apply (case_tac "0 <= x")  | 
|
371  | 
apply (rule order_trans)  | 
|
372  | 
apply (rule abs_ln_one_plus_x_minus_x_bound_nonneg)  | 
|
373  | 
apply auto  | 
|
374  | 
apply (rule abs_ln_one_plus_x_minus_x_bound_nonpos)  | 
|
375  | 
apply auto  | 
|
376  | 
done  | 
|
377  | 
||
378  | 
lemma DERIV_ln: "0 < x ==> DERIV ln x :> 1 / x"  | 
|
379  | 
apply (unfold deriv_def, unfold LIM_def, clarsimp)  | 
|
380  | 
apply (rule exI)  | 
|
381  | 
apply (rule conjI)  | 
|
382  | 
prefer 2  | 
|
383  | 
apply clarsimp  | 
|
384  | 
apply (subgoal_tac "(ln (x + xa) + - ln x) / xa + - (1 / x) =  | 
|
385  | 
(ln (1 + xa / x) - xa / x) / xa")  | 
|
386  | 
apply (erule ssubst)  | 
|
387  | 
apply (subst abs_divide)  | 
|
388  | 
apply (rule mult_imp_div_pos_less)  | 
|
389  | 
apply force  | 
|
390  | 
apply (rule order_le_less_trans)  | 
|
391  | 
apply (rule abs_ln_one_plus_x_minus_x_bound)  | 
|
392  | 
apply (subst abs_divide)  | 
|
393  | 
apply (subst abs_of_pos, assumption)  | 
|
394  | 
apply (erule mult_imp_div_pos_le)  | 
|
395  | 
apply (subgoal_tac "abs xa < min (x / 2) (r * x^2 / 2)")  | 
|
396  | 
apply force  | 
|
397  | 
apply assumption  | 
|
398  | 
apply (simp add: power2_eq_square mult_compare_simps)  | 
|
399  | 
apply (rule mult_imp_div_pos_less)  | 
|
400  | 
apply (rule mult_pos_pos, assumption, assumption)  | 
|
401  | 
apply (subgoal_tac "xa * xa = abs xa * abs xa")  | 
|
402  | 
apply (erule ssubst)  | 
|
403  | 
apply (subgoal_tac "abs xa * (abs xa * 2) < abs xa * (r * (x * x))")  | 
|
404  | 
apply (simp only: mult_ac)  | 
|
405  | 
apply (rule mult_strict_left_mono)  | 
|
406  | 
apply (erule conjE, assumption)  | 
|
407  | 
apply force  | 
|
408  | 
apply simp  | 
|
409  | 
apply (subst diff_minus [THEN sym])+  | 
|
410  | 
apply (subst ln_div [THEN sym])  | 
|
411  | 
apply arith  | 
|
412  | 
apply (auto simp add: ring_eq_simps add_frac_eq frac_eq_eq  | 
|
413  | 
add_divide_distrib power2_eq_square)  | 
|
414  | 
apply (rule mult_pos_pos, assumption)+  | 
|
415  | 
apply assumption  | 
|
416  | 
done  | 
|
417  | 
||
418  | 
lemma ln_x_over_x_mono: "exp 1 <= x ==> x <= y ==> (ln y / y) <= (ln x / x)"  | 
|
419  | 
proof -  | 
|
420  | 
assume "exp 1 <= x" and "x <= y"  | 
|
421  | 
have a: "0 < x" and b: "0 < y"  | 
|
422  | 
apply (insert prems)  | 
|
423  | 
apply (subgoal_tac "0 < exp 1")  | 
|
424  | 
apply arith  | 
|
425  | 
apply auto  | 
|
426  | 
apply (subgoal_tac "0 < exp 1")  | 
|
427  | 
apply arith  | 
|
428  | 
apply auto  | 
|
429  | 
done  | 
|
430  | 
have "x * ln y - x * ln x = x * (ln y - ln x)"  | 
|
431  | 
by (simp add: ring_eq_simps)  | 
|
432  | 
also have "... = x * ln(y / x)"  | 
|
433  | 
apply (subst ln_div)  | 
|
434  | 
apply (rule b, rule a, rule refl)  | 
|
435  | 
done  | 
|
436  | 
also have "y / x = (x + (y - x)) / x"  | 
|
437  | 
by simp  | 
|
438  | 
also have "... = 1 + (y - x) / x"  | 
|
439  | 
apply (simp only: add_divide_distrib)  | 
|
440  | 
apply (simp add: prems)  | 
|
441  | 
apply (insert a, arith)  | 
|
442  | 
done  | 
|
443  | 
also have "x * ln(1 + (y - x) / x) <= x * ((y - x) / x)"  | 
|
444  | 
apply (rule mult_left_mono)  | 
|
445  | 
apply (rule ln_add_one_self_le_self)  | 
|
446  | 
apply (rule divide_nonneg_pos)  | 
|
447  | 
apply (insert prems a, simp_all)  | 
|
448  | 
done  | 
|
449  | 
also have "... = y - x"  | 
|
450  | 
by (insert a, simp)  | 
|
451  | 
also have "... = (y - x) * ln (exp 1)"  | 
|
452  | 
by simp  | 
|
453  | 
also have "... <= (y - x) * ln x"  | 
|
454  | 
apply (rule mult_left_mono)  | 
|
455  | 
apply (subst ln_le_cancel_iff)  | 
|
456  | 
apply force  | 
|
457  | 
apply (rule a)  | 
|
458  | 
apply (rule prems)  | 
|
459  | 
apply (insert prems, simp)  | 
|
460  | 
done  | 
|
461  | 
also have "... = y * ln x - x * ln x"  | 
|
462  | 
by (rule left_diff_distrib)  | 
|
463  | 
finally have "x * ln y <= y * ln x"  | 
|
464  | 
by arith  | 
|
465  | 
then have "ln y <= (y * ln x) / x"  | 
|
466  | 
apply (subst pos_le_divide_eq)  | 
|
467  | 
apply (rule a)  | 
|
468  | 
apply (simp add: mult_ac)  | 
|
469  | 
done  | 
|
470  | 
also have "... = y * (ln x / x)"  | 
|
471  | 
by simp  | 
|
472  | 
finally show ?thesis  | 
|
473  | 
apply (subst pos_divide_le_eq)  | 
|
474  | 
apply (rule b)  | 
|
475  | 
apply (simp add: mult_ac)  | 
|
476  | 
done  | 
|
477  | 
qed  | 
|
478  | 
||
479  | 
end  | 
|
480  |