@@ -4,7 +4,7 @@ Require Import Utf8 Arith.
4
4
Import List List.ListNotations.
5
5
Require Import Reals.
6
6
7
- Require Import Psatz Misc Primes Totient Primisc Prod Harmonic.
7
+ Require Import Psatz Misc Primes Totient Primisc Prod Harmonic Log .
8
8
Require Import Interval.Tactic .
9
9
Require Import Logic.FunctionalExtensionality.
10
10
@@ -236,16 +236,69 @@ Proof.
236
236
apply Nat.log2_le_pow2. lia.
237
237
remember (S n) as m.
238
238
rewrite <- prime_divisor_pow_prod by lia.
239
- simpl. apply prod_le_const.
240
- Admitted .
239
+ rewrite <- prod_const_f with (f := (fun _ => 2%nat)) by (intros; easy).
240
+ apply prod_le. intros.
241
+ specialize (in_prime_divisors_power_ge_1 _ _ H) as G.
242
+ apply prime_divisors_decomp in H.
243
+ specialize (in_prime_decomp_ge_2 _ _ H) as T.
244
+ split. lia.
245
+ assert (a ^ 1 <= a ^ (pow_in_n m a))%nat by (apply Nat.pow_le_mono_r; lia).
246
+ simpl in H0. rewrite Nat.mul_1_r in H0. lia.
247
+ Qed .
241
248
242
249
Inductive entrywise_le : list nat → list nat → Prop :=
243
250
| entrywise_le_nil : entrywise_le [] []
244
251
| entrywise_le_cons x1 l1 x2 l2 (Hlex : x1 ≤ x2) (Hlel : entrywise_le l1 l2): entrywise_le (x1 :: l1) (x2 :: l2).
245
252
253
+ Print prime_divisors.
254
+
255
+ Lemma entrywise_le_extend :
256
+ forall a1 a2 l1 l2, (a1 <= a2)%nat -> entrywise_le l1 l2 -> entrywise_le (l1 ++ [a1]) (l2 ++ [a2]).
257
+ Proof .
258
+ intros. induction H0. simpl. constructor. easy. constructor.
259
+ do 2 rewrite <- app_comm_cons. constructor; easy.
260
+ Qed .
261
+
262
+ Lemma seq_extend :
263
+ forall n x, seq x (S n) = seq x n ++ [(x + n)%nat].
264
+ Proof .
265
+ induction n; intros. simpl. rewrite Nat.add_0_r. easy.
266
+ replace (seq x (S (S n))) with (x :: seq (S x) (S n)) by easy.
267
+ rewrite IHn. simpl. replace (x + S n)%nat with (S (x + n))%nat by lia.
268
+ easy.
269
+ Qed .
270
+
271
+ Lemma filter_seq_extend :
272
+ forall n f, (filter f (seq 1 (S n))) = if (f (S n)) then (filter f (seq 1 n) ++ [S n]) else filter f (seq 1 n).
273
+ Proof .
274
+ intros. rewrite seq_extend. rewrite filter_app. simpl.
275
+ destruct (f (S n)). easy. apply app_nil_r.
276
+ Qed .
277
+
278
+ Lemma filter_length :
279
+ forall {A} f (l : list A), (length (filter f l) <= length l)%nat.
280
+ Proof .
281
+ intros. induction l. simpl. lia.
282
+ simpl. destruct (f a). simpl. lia. lia.
283
+ Qed .
284
+
285
+ Lemma filter_seq_le :
286
+ forall n f, entrywise_le (seq 1 (length (filter f (seq 1 n)))) (filter f (seq 1 n)).
287
+ Proof .
288
+ induction n; intros. simpl. constructor.
289
+ rewrite filter_seq_extend. destruct (f (S n)).
290
+ rewrite app_length. simpl.
291
+ replace (length (filter f (seq 1 n)) + 1)%nat with (S (length (filter f (seq 1 n)))) by lia.
292
+ rewrite seq_extend. apply entrywise_le_extend.
293
+ specialize (filter_length f (seq 1 n)) as G. rewrite seq_length in G. lia.
294
+ easy. easy.
295
+ Qed .
296
+
246
297
Lemma seq_entrywise_le_prime_divisors :
247
- ∀ n, entrywise_le (seq 1 (length (prime_divisors n))) (prime_divisors n).
248
- Admitted .
298
+ ∀ n, entrywise_le (seq 1 (length (prime_divisors n))) (prime_divisors n).
299
+ Proof .
300
+ intros. apply filter_seq_le.
301
+ Qed .
249
302
250
303
Lemma Rprod_increasing_f :
251
304
∀ (l1 l2 : list nat) (f : nat → R),
@@ -322,16 +375,28 @@ Proof.
322
375
Qed .
323
376
324
377
Lemma final_log_bound :
325
- ∀ n, 4 ≤ n →
326
- Nat.log2 (Nat.log2 n) + 1 <= - / 2 * ln (0.001 / Nat.log2 n).
327
- Admitted .
378
+ ∀ n, 2 ≤ n →
379
+ Nat.log2 (Nat.log2 n) + 1 <= - / 2 * ln (exp (-2) / Nat.log2 n ^ 4).
380
+ Proof .
381
+ intros.
382
+ assert (0 < Nat.log2 n)%nat by (apply Nat.log2_pos; lia).
383
+ rewrite Rcomplements.ln_div.
384
+ rewrite ln_exp.
385
+ rewrite Rcomplements.ln_pow.
386
+ replace (INR 4) with 4 by (simpl; lra).
387
+ replace (- / 2 * (-2 - 4 * ln (Nat.log2 n))) with (1 + 2 * ln (Nat.log2 n)) by field.
388
+ specialize (log_bound _ H0) as G. lra.
389
+ replace 0 with (INR 0) by easy. apply lt_INR; easy.
390
+ apply exp_pos.
391
+ replace 0 with (INR 0) by easy. rewrite <- pow_INR. apply lt_INR. simpl. nia.
392
+ Qed .
328
393
329
394
Theorem φ_lower_bound :
330
- ∃ (N0 : nat) ( c : R),
331
- (∀ n, N0 ≤ n → φ n / n >= c / Nat.log2 n) ∧ c > 0.
395
+ ∃ (c : R),
396
+ (∀ n, 2 ≤ n → φ n / n >= c / (( Nat.log2 n) ^ 4) ) ∧ c > 0.
332
397
Proof .
333
- exists 4%nat. exists 0.001 . split.
334
- intros.
398
+ exists (exp (-2)) . split.
399
+ intros.
335
400
rewrite <- (prime_divisor_pow_prod n) at 2.
336
401
rewrite φ_prime_divisors_power.
337
402
repeat rewrite prod_INR_Rprod.
@@ -362,15 +427,15 @@ Proof.
362
427
replace (/ i + - / j) with (/ i - / j) by reflexivity.
363
428
apply Rge_le. apply Rge_minus. apply Rle_ge. apply Raux.Rinv_le; auto.
364
429
{
365
- replace 0 with (INR 0%nat) by auto.
430
+ replace 0 with (INR 0%nat) by auto.
366
431
apply lt_INR. destruct H0. apply le_seq in H0. lia.
367
432
eapply lt_le_trans with 2%nat. lia. apply prime_ge_2.
368
433
eapply in_prime_decomp_is_prime. apply prime_divisors_decomp.
369
434
apply H0.
370
435
}
371
436
rewrite map_ext_in with _ _ _ (λ x : nat, (-2) * / x) _ by auto.
372
437
rewrite Rsum_distr_f.
373
- replace (ln (?[c] / Nat.log2 n)) with (-2 * (-/2 * ln (0.001 / Nat.log2 n))). (* 0.001 can be any constant *)
438
+ replace (ln (exp (-2) / ( Nat.log2 n ^ 4))) with (-2 * (-/2 * ln (exp (-2) / ( Nat.log2 n ^ 4 )))).
374
439
apply Rmult_le_ge_compat_neg_l. lra. eapply Rle_trans.
375
440
simpl. rewrite map_ext_in with _ _ _ (λ x : nat, 1 / x) _.
376
441
apply harmonic_upper_bound.
@@ -386,12 +451,18 @@ Proof.
386
451
(* side conditions *)
387
452
- assert (0 < Nat.log2 n).
388
453
{ replace 0 with (INR 0%nat) by auto. apply lt_INR.
454
+ apply Nat.log2_pos. lia.
455
+ (*
389
456
eapply Nat.lt_trans. constructor.
390
457
eapply Nat.lt_le_trans. auto.
391
458
replace 2%nat with (Nat.log2 4) by auto.
392
- apply Nat.log2_le_mono. auto. }
393
- unfold Rdiv at 1. apply Rmult_lt_0_compat.
394
- lra. apply Rinv_0_lt_compat. auto.
459
+ apply Nat.log2_le_mono. auto.
460
+ *)
461
+ }
462
+ unfold Rdiv at 1. apply Rmult_lt_0_compat.
463
+ apply exp_pos. apply Rinv_0_lt_compat.
464
+ replace 0 with (INR 0) in * by easy. apply INR_lt in H0.
465
+ rewrite <- pow_INR. apply lt_INR. simpl. nia.
395
466
- unfold not. intros. apply map_eq_nil in H0.
396
467
apply prime_divisors_nil_iff in H0. lia.
397
468
- intros. apply map_in_exists in H0 as (y & Hy0 & Hy1).
@@ -432,7 +503,7 @@ Proof.
432
503
now apply pow_nonzero.
433
504
- lia.
434
505
- lia.
435
- - lra.
506
+ - specialize (exp_pos (-2)). lra.
436
507
Qed .
437
508
438
- Local Close Scope R_scope.
509
+ Local Close Scope R_scope.
0 commit comments