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 (* \ / Matita is distributed under the terms of the *)
11 (* v GNU Lesser General Public License Version 2.1 *)
13 (**************************************************************************)
15 include "nat/binomial.ma".
16 include "nat/sqrt.ma".
18 theorem le_times_SSO_n_exp_SSO_n: \forall n.
25 change in ⊢ (? % ?) with (2 + (2*(S n2))).
26 change in ⊢ (? ? %) with (exp 2 (S n2)+(exp 2 (S n2) + O)).
29 [rewrite > exp_n_SO in ⊢ (? % ?).
32 |apply le_S_S.apply le_O_n
40 theorem le_times_n_exp: \forall a,n. exp 2 a \le n \to
41 exp 2 a*n \le exp 2 n.
43 [rewrite < exp_plus_times.
46 |rewrite > plus_n_O in ⊢ (? (? ? %) ?).
47 change in ⊢ (? % ?) with (2*a).
48 apply le_times_SSO_n_exp_SSO_n
50 |rewrite > sym_times.simplify.
53 [apply (trans_le ? n1)
55 |apply (trans_le ? (2*n1))
58 |apply le_times_SSO_n_exp_SSO_n
67 theorem lt_times_SSO_n_exp_SSO_n: \forall n. 2 < n \to
70 [apply leb_true_to_le.reflexivity.
72 change in ⊢ (? % ?) with (2 + (2*n1)).
73 simplify in ⊢ (? ? %).
75 apply (lt_to_le_to_lt ? (2+(exp 2 n1)))
76 [apply lt_plus_r.assumption
78 rewrite > exp_n_SO in ⊢ (? % ?).
82 [apply le_S_S.apply le_O_n
90 theorem le_exp_n_SSO_exp_SSO_n:\forall n. 3 < n \to
104 |rewrite > plus_n_O in ⊢ (? (? (? ? %)) ?).
105 change in ⊢ (? (? %) ?) with (2*n1).
106 apply lt_times_SSO_n_exp_SSO_n.
114 theorem le_exp_n_SSO_exp_SSO_n1:\forall n. S O < n \to
115 exp (4*n) 2 \le exp 2 (3*n).
117 [apply leb_true_to_le.reflexivity
118 |cut (exp (S n1) 2 \le 3*(exp n1 2))
119 [apply (trans_le ? (3*exp (4*n1) 2))
120 [rewrite < times_exp.
122 rewrite < assoc_times.
123 rewrite > sym_times in ⊢ (? ? (? % ?)).
124 rewrite > assoc_times.
127 |apply (trans_le ? (8*exp 2 (3*n1)))
129 [apply leb_true_to_le.reflexivity
132 |change in ⊢ (? (? % ?) ?) with (exp 2 3).
133 rewrite < exp_plus_times.
136 |simplify.rewrite < plus_n_Sm.
137 rewrite < plus_n_Sm.rewrite < plus_n_Sm.
142 |rewrite > exp_Sn_SSO.
143 change in ⊢ (? ? %) with ((exp n1 2) + ((exp n1 2) + ((exp n1 2) + O))).
146 rewrite > assoc_plus.
153 apply lt_to_le.assumption
159 (* a strict version *)
160 theorem lt_exp_n_SSO_exp_SSO_n:\forall n. 4 < n \to
163 [apply leb_true_to_le.reflexivity.
166 rewrite < times_n_SO.
167 rewrite < times_n_Sm.
168 rewrite < assoc_plus.
171 apply (lt_to_le_to_lt ? ((exp 2 n1)+S (n1+n1)))
176 rewrite > plus_n_O in ⊢ (? (? (? ? %)) ?).
177 change in ⊢ (? (? %) ?) with (2*n1).
178 apply lt_times_SSO_n_exp_SSO_n.
179 apply lt_to_le.apply lt_to_le.
185 theorem le_times_exp_n_SSO_exp_SSO_n:\forall a,n. 1 < a \to 4*a \le n \to
186 exp 2 a*exp n 2 \le exp 2 n.
188 [apply (trans_le ? ((exp 2 a)*(exp 2 (3*a))))
190 apply le_exp_n_SSO_exp_SSO_n1.
192 |rewrite < exp_plus_times.
198 |apply (trans_le ? ((exp 2 a)*(2*(exp n1 2))))
201 rewrite < times_n_SO.
202 rewrite < sym_times.simplify.
204 rewrite < assoc_plus.
208 apply (trans_le ? (3*n1))
209 [simplify.rewrite > plus_n_SO.
210 rewrite > assoc_plus.
214 apply (trans_le ? (4*2))
215 [apply leb_true_to_le.reflexivity
216 |apply (trans_le ? (4*a))
217 [apply le_times_r.assumption
222 apply (trans_le ? (4*2))
223 [apply leb_true_to_le.reflexivity
224 |apply (trans_le ? (4*a))
225 [apply le_times_r.assumption
230 |rewrite < assoc_times.
231 rewrite < sym_times in ⊢ (? (? % ?) ?).
232 rewrite > assoc_times.
233 change in ⊢ (? ? %) with (2*exp 2 n1).
240 (* the same for log and sqrt
241 theorem le_times_log_sqrt:\forall a,n. 1 < a \to exp 2 (8*a) \le n \to
242 exp 2 a*log 2 n \le sqrt n.
246 |apply le_to_leb_true.
249 rewrite > exp_exp_times.
250 apply (trans_le ? (exp 2 (log 2 n)))
251 [apply le_times_exp_n_SSO_exp_SSO_n.