1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| A.Asperti, C.Sacerdoti Coen, *)
8 (* ||A|| E.Tassi, S.Zacchiroli *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/nat/neper".
17 include "nat/iteration2.ma".
18 include "nat/div_and_mod_diseq.ma".
19 include "nat/binomial.ma".
22 theorem sigma_p_div_exp: \forall n,m.
23 sigma_p n (\lambda i.true) (\lambda i.m/(exp (S(S O)) i)) \le
24 ((S(S O))*m*(exp (S(S O)) n) - (S(S O))*m)/(exp (S(S O)) n).
28 |rewrite > true_to_sigma_p_Sn
29 [apply (trans_le ? (m/(S(S O))\sup(n1)+((S(S O))*m*(S(S O))\sup(n1)-(S(S O))*m)/(S(S O))\sup(n1)))
30 [apply le_plus_r.assumption
31 |rewrite > assoc_times in ⊢ (? ? (? (? % ?) ?)).
32 rewrite < distr_times_minus.
33 change in ⊢ (? ? (? ? %)) with ((S(S O))*(exp (S(S O)) n1)).
34 rewrite > sym_times in ⊢ (? ? (? % ?)).
35 rewrite > sym_times in ⊢ (? ? (? ? %)).
36 rewrite < lt_to_lt_to_eq_div_div_times_times
37 [apply (trans_le ? ((m+((S(S O))*m*((S(S O)))\sup(n1)-(S(S O))*m))/((S(S O)))\sup(n1)))
41 |change in ⊢ (? (? (? ? (? ? %)) ?) ?) with (m + (m +O)).
43 rewrite < eq_minus_minus_minus_plus.
45 rewrite > sym_times in ⊢ (? (? (? (? (? (? % ?) ?) ?) ?) ?) ?).
46 rewrite > assoc_times.
47 rewrite < plus_minus_m_m
49 |apply le_plus_to_minus_r.
50 rewrite > plus_n_O in ⊢ (? (? ? %) ?).
51 change in ⊢ (? % ?) with ((S(S O))*m).
54 rewrite > times_n_SO in ⊢ (? % ?).
70 theorem le_fact_exp: \forall i,m. i \le m \to m!≤ m \sup i*(m-i)!.
73 simplify.rewrite < plus_n_O.
76 apply (trans_le ? ((m)\sup(n)*(m-n)!))
78 apply lt_to_le.assumption
79 |rewrite > sym_times in ⊢ (? ? (? % ?)).
80 rewrite > assoc_times.
82 generalize in match H1.
85 apply (lt_to_not_le ? ? H2).
87 |rewrite > minus_Sn_m.
99 theorem le_fact_exp1: \forall n. S O < n \to (S(S O))*n!≤ n \sup n.
102 |change with ((S(S O))*((S n1)*(fact n1)) \le (S n1)*(exp (S n1) n1)).
103 rewrite < assoc_times.
104 rewrite < sym_times in ⊢ (? (? % ?) ?).
105 rewrite > assoc_times.
107 apply (trans_le ? (exp n1 n1))
109 |apply monotonic_exp1.
115 theorem le_exp_sigma_p_exp: \forall n. (exp (S n) n) \le
116 sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!).
118 rewrite > exp_S_sigma_p.
121 apply (trans_le ? ((exp n (n-i))*((n \sup i)/i!)))
122 [rewrite > sym_times.
125 rewrite < eq_div_div_div_times
128 |apply le_times_to_le_div2
138 |rewrite > (plus_minus_m_m ? i) in ⊢ (? ? (? (? ? %) ?))
139 [rewrite > exp_plus_times.
140 apply le_times_div_div_times.
148 theorem lt_exp_sigma_p_exp: \forall n. S O < n \to
150 sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!).
152 rewrite > exp_S_sigma_p.
155 apply (trans_le ? ((exp n (n-i))*((n \sup i)/i!)))
156 [rewrite > sym_times.
159 rewrite < eq_div_div_div_times
162 |apply le_times_to_le_div2
172 |rewrite > (plus_minus_m_m ? i) in ⊢ (? ? (? (? ? %) ?))
173 [rewrite > exp_plus_times.
174 apply le_times_div_div_times.
180 |apply (ex_intro ? ? n).
186 |rewrite < minus_n_n.
189 apply le_times_to_le_div
191 |rewrite > sym_times.
199 theorem le_exp_SSO_fact:\forall n.
200 exp (S(S O)) (pred n) \le n!.
203 |change with ((S(S O))\sup n1 ≤(S n1)*n1!).
204 apply (nat_case1 n1);intros
206 |change in ⊢ (? % ?) with ((S(S O))*exp (S(S O)) (pred (S m))).
208 [apply le_S_S.apply le_S_S.apply le_O_n
209 |rewrite < H1.assumption
215 theorem lt_SO_to_lt_exp_Sn_n_SSSO: \forall n. S O < n \to
216 (exp (S n) n) < (S(S(S O)))*(exp n n).
218 apply (lt_to_le_to_lt ? (sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!)))
219 [apply lt_exp_sigma_p_exp.assumption
220 |apply (trans_le ? (sigma_p (S n) (\lambda i.true) (\lambda i.(exp n n)/(exp (S(S O)) (pred i)))))
221 [apply le_sigma_p.intros.
222 apply le_times_to_le_div
225 |apply (trans_le ? ((S(S O))\sup (pred i)* n \sup n/i!))
226 [apply le_times_div_div_times.
228 |apply le_times_to_le_div2
230 |rewrite < sym_times.
232 apply le_exp_SSO_fact
236 |rewrite > eq_sigma_p_pred
239 change in ⊢ (? ? %) with ((exp n n)+(S(S O)*(exp n n))).
241 apply (trans_le ? (((S(S O))*(exp n n)*(exp (S(S O)) n) - (S(S O))*(exp n n))/(exp (S(S O)) n)))
242 [apply sigma_p_div_exp
243 |apply le_times_to_le_div2
255 theorem lt_exp_Sn_n_SSSO: \forall n.
256 (exp (S n) n) < (S(S(S O)))*(exp n n).
258 [simplify.apply le_S.apply le_n
261 |apply lt_SO_to_lt_exp_Sn_n_SSSO.
262 apply le_S_S.apply le_S_S.apply le_O_n
267 theorem lt_exp_Sn_m_SSSO: \forall n,m. O < m \to
269 (exp (S n) m) < (exp (S(S(S O))) (m/n)) *(exp n m).
271 elim H1.rewrite > H2.
272 rewrite < exp_exp_times.
273 rewrite < exp_exp_times.
274 rewrite > sym_times in ⊢ (? ? (? (? ? (? % ?)) ?)).
275 rewrite > lt_O_to_div_times
276 [rewrite > times_exp.
278 [apply (O_lt_times_to_O_lt ? n).
282 |apply lt_exp_Sn_n_SSSO
284 |apply (O_lt_times_to_O_lt ? n2).
290 theorem le_log_exp_Sn_log_exp_n: \forall n,m,p. O < m \to S O < p \to
292 log p (exp (S n) m) \le S((m/n)*S(log p (S(S(S O))))) + log p (exp n m).
294 apply (trans_le ? (log p (((S(S(S O))))\sup(m/n)*((n)\sup(m)))))
298 apply lt_exp_Sn_m_SSSO;assumption
300 |apply (trans_le ? (S(log p (exp (S(S(S O))) (m/n)) + log p (exp n m))))
303 |change in ⊢ (? ? %) with (S (m/n*S (log p (S(S(S O))))+log p ((n)\sup(m)))).
312 theorem le_log_exp_fact_sigma_p: \forall a,b,n,p. S O < p \to
313 O < a \to a \le b \to b \le n \to
314 log p (exp b n!) - log p (exp a n!) \le
315 sigma_p b (\lambda i.leb a i) (\lambda i.S((n!/i)*S(log p (S(S(S O)))))).
319 apply (lt_O_n_elim ? (lt_O_fact n)).intro.
321 |apply (bool_elim ? (leb a n1));intro
322 [rewrite > true_to_sigma_p_Sn
323 [apply (trans_le ? (S (n!/n1*S (log p (S(S(S O)))))+(log p ((n1)\sup(n!))-log p ((a)\sup(n!)))))
326 [apply le_plus_to_minus_r.
327 rewrite < plus_minus_m_m
329 apply le_log_exp_Sn_log_exp_n
333 [apply (trans_le ? ? ? H1);apply leb_true_to_le;assumption
334 |apply lt_to_le;assumption]]
338 [rewrite > Hcut;apply monotonic_exp1;constructor 2;
339 apply leb_true_to_le;assumption
342 |simplify;rewrite > exp_plus_times;rewrite < H6;
343 rewrite > sym_times;rewrite < times_n_O;reflexivity]]]]
346 |apply monotonic_exp1;apply leb_true_to_le;assumption]]
347 |rewrite > sym_plus;rewrite > sym_plus in \vdash (? ? %);apply le_minus_to_plus;
348 rewrite < minus_plus_m_m;apply H3;apply lt_to_le;assumption]
350 |lapply (not_le_to_lt ? ? (leb_false_to_not_le ? ? H5));
351 rewrite > eq_minus_n_m_O
355 |apply monotonic_exp1;assumption]]]]
358 (* theorem le_log_exp_Sn_log_exp_n: \forall n,m,a,p. O < m \to S O < p \to
360 log p (exp n m) - log p (exp a m) \le
361 sigma_p (S n) (\lambda i.leb (S a) i) (\lambda i.S((m/i)*S(log p (S(S(S O)))))).
364 [rewrite > false_to_sigma_p_Sn.
366 apply (lt_O_n_elim ? H).intro.
367 simplify.apply le_O_n
368 |apply (bool_elim ? (leb a n1));intro
369 [rewrite > true_to_sigma_p_Sn
370 [apply (trans_le ? (S (m/S n1*S (log p (S(S(S O)))))+(log p ((n1)\sup(m))-log p ((a)\sup(m)))))
373 [apply le_plus_to_minus_r.
374 rewrite < plus_minus_m_m
376 apply le_log_exp_Sn_log_exp_n.
380 theorem le_exp_sigma_p_exp_m: \forall m,n. (exp (S m) n) \le
381 sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!)).
383 rewrite > exp_S_sigma_p.
386 apply (trans_le ? ((exp m (n-i))*((n \sup i)/i!)))
387 [rewrite > sym_times.
390 rewrite < eq_div_div_div_times
393 |apply le_times_to_le_div2
403 |apply le_times_div_div_times.
408 theorem lt_exp_sigma_p_exp_m: \forall m,n. S O < n \to
410 sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!)).
412 rewrite > exp_S_sigma_p.
415 apply (trans_le ? ((exp m (n-i))*((n \sup i)/i!)))
416 [rewrite > sym_times.
419 rewrite < eq_div_div_div_times
422 |apply le_times_to_le_div2
432 |apply le_times_div_div_times.
435 |apply (ex_intro ? ? n).
441 |rewrite < minus_n_n.
444 apply le_times_to_le_div
446 |rewrite > sym_times.
455 theorem lt_SO_to_lt_exp_Sn_n_SSSO_bof: \forall m,n. S O < n \to
456 (exp (S m) n) < (S(S(S O)))*(exp m n).
458 apply (lt_to_le_to_lt ? (sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!))))
459 [apply lt_exp_sigma_p_exp_m.assumption
460 |apply (trans_le ? (sigma_p (S n) (\lambda i.true) (\lambda i.(exp n n)/(exp (S(S O)) (pred i)))))
461 [apply le_sigma_p.intros.
462 apply le_times_to_le_div
465 |apply (trans_le ? ((S(S O))\sup (pred i)* n \sup n/i!))
466 [apply le_times_div_div_times.
468 |apply le_times_to_le_div2
470 |rewrite < sym_times.
472 apply le_exp_SSO_fact
476 |rewrite > eq_sigma_p_pred
479 change in ⊢ (? ? %) with ((exp n n)+(S(S O)*(exp n n))).
481 apply (trans_le ? (((S(S O))*(exp n n)*(exp (S(S O)) n) - (S(S O))*(exp n n))/(exp (S(S O)) n)))
482 [apply sigma_p_div_exp
483 |apply le_times_to_le_div2