wiedijk_100_theorems.sum_of_prime_reciprocals_diverges ⟷
Archive.Wiedijk100Theorems.SumOfPrimeReciprocalsDiverges
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-/
-import Topology.Instances.Ennreal
+import Topology.Instances.ENNReal
import Data.Nat.Squarefree
#align_import wiedijk_100_theorems.sum_of_prime_reciprocals_diverges from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
@@ -248,7 +248,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
calc
(card M : ℝ) ≤ 2 ^ k * x.sqrt := by exact_mod_cast card_le_two_pow_mul_sqrt
_ = 2 ^ k * ↑(2 ^ (k + 1)) := by rw [Nat.sqrt_eq]
- _ = x / 2 := by field_simp [x, mul_right_comm, ← pow_succ']
+ _ = x / 2 := by field_simp [x, mul_right_comm, ← pow_succ]
refine' lt_irrefl (x : ℝ) _
calc
(x : ℝ) = (card U : ℝ) + (card M : ℝ) := by assumption_mod_cast
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -91,7 +91,7 @@ theorem sum_lt_half_of_not_tendsto
intro n; split_ifs
· simp only [one_div, inv_nonneg, Nat.cast_nonneg]
· exact le_rfl
- rw [h0, ← summable_iff_not_tendsto_nat_atTop_of_nonneg hf, summable_iff_vanishing] at h
+ rw [h0, ← summable_iff_not_tendsto_nat_atTop_of_nonneg hf, summable_iff_vanishing] at h
obtain ⟨s, h⟩ := h (Set.Ioo (-1) (1 / 2)) (is_open_Ioo.mem_nhds (by norm_num))
obtain ⟨k, hk⟩ := exists_nat_subset_range s
use k
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -170,7 +170,7 @@ theorem card_le_two_pow {x k : ℕ} : card ({e ∈ m x k | Squarefree (e + 1)})
card M₁ ≤ card (image f K) := card_le_of_subset h
_ ≤ card K := card_image_le
_ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [K, card_powerset]
- _ ≤ 2 ^ card (range k) := (pow_le_pow one_le_two card_image_le)
+ _ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
_ = 2 ^ k := by rw [card_range k]
#align theorems_100.card_le_two_pow Theorems100.card_le_two_pow
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-/
-import Mathbin.Topology.Instances.Ennreal
-import Mathbin.Data.Nat.Squarefree
+import Topology.Instances.Ennreal
+import Data.Nat.Squarefree
#align_import wiedijk_100_theorems.sum_of_prime_reciprocals_diverges from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -128,7 +128,7 @@ theorem range_sdiff_eq_bUnion {x k : ℕ} : range x \ m x k = u x k :=
The number of `e < x` for which `e + 1` has a prime factor `p > k` is bounded by `x` times the sum
of reciprocals of primes in `(k, x]`.
-/
-theorem card_le_mul_sum {x k : ℕ} : (card (u x k) : ℝ) ≤ x * ∑ p in p x k, 1 / p :=
+theorem card_le_hMul_sum {x k : ℕ} : (card (u x k) : ℝ) ≤ x * ∑ p in p x k, 1 / p :=
by
let P := {p ∈ range (x + 1) | k < p ∧ Nat.Prime p}
let N p := {e ∈ range x | p ∣ e + 1}
@@ -138,7 +138,7 @@ theorem card_le_mul_sum {x k : ℕ} : (card (u x k) : ℝ) ≤ x * ∑ p in p x
_ ≤ ∑ p in P, x * (1 / p) := (sum_le_sum fun p hp => _)
_ = x * ∑ p in P, 1 / p := mul_sum.symm
simp only [mul_one_div, N, sep_def, filter_congr_decidable, Nat.card_multiples, Nat.cast_div_le]
-#align theorems_100.card_le_mul_sum Theorems100.card_le_mul_sum
+#align theorems_100.card_le_mul_sum Theorems100.card_le_hMul_sum
/--
The number of `e < x` for which `e + 1` is a squarefree product of primes smaller than or equal to
@@ -179,7 +179,7 @@ theorem card_le_two_pow {x k : ℕ} : card ({e ∈ m x k | Squarefree (e + 1)})
The number of `e < x` for which `e + 1` is a product of powers of primes smaller than or equal to
`k` is bounded by `2 ^ k * nat.sqrt x`.
-/
-theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (m x k) ≤ 2 ^ k * Nat.sqrt x :=
+theorem card_le_two_pow_hMul_sqrt {x k : ℕ} : card (m x k) ≤ 2 ^ k * Nat.sqrt x :=
by
let M₁ := {e ∈ M x k | Squarefree (e + 1)}
let M₂ := M (Nat.sqrt x) k
@@ -212,7 +212,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (m x k) ≤ 2 ^ k * Nat.sqrt
_ ≤ card K := card_image_le
_ = card M₁ * card M₂ := (card_product M₁ M₂)
_ ≤ 2 ^ k * x.sqrt := mul_le_mul' card_le_two_pow h2
-#align theorems_100.card_le_two_pow_mul_sqrt Theorems100.card_le_two_pow_mul_sqrt
+#align theorems_100.card_le_two_pow_mul_sqrt Theorems100.card_le_two_pow_hMul_sqrt
theorem Real.tendsto_sum_one_div_prime_atTop :
Tendsto (fun n => ∑ p in {p ∈ range n | Nat.Prime p}, 1 / (p : ℝ)) atTop atTop :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/63721b2c3eba6c325ecf8ae8cca27155a4f6306f
@@ -155,7 +155,7 @@ theorem card_le_two_pow {x k : ℕ} : card ({e ∈ m x k | Squarefree (e + 1)})
intro m hm
simp only [M₁, M, sep_def, mem_filter, mem_range, mem_powerset, mem_image, exists_prop] at hm ⊢
obtain ⟨⟨-, hmp⟩, hms⟩ := hm
- use (m + 1).factors
+ use(m + 1).factors
· rwa [Multiset.coe_nodup, ← Nat.squarefree_iff_nodup_factors m.succ_ne_zero]
refine' ⟨fun p => _, _⟩
· suffices p ∈ (m + 1).factors → ∃ a : ℕ, a < k ∧ a.succ = p by simpa
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-
-! This file was ported from Lean 3 source module wiedijk_100_theorems.sum_of_prime_reciprocals_diverges
-! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Topology.Instances.Ennreal
import Mathbin.Data.Nat.Squarefree
+#align_import wiedijk_100_theorems.sum_of_prime_reciprocals_diverges from "leanprover-community/mathlib"@"08b081ea92d80e3a41f899eea36ef6d56e0f1db0"
+
/-!
# Divergence of the Prime Reciprocal Series
mathlib commit https://github.com/leanprover-community/mathlib/commit/bf2428c9486c407ca38b5b3fb10b87dad0bc99fa
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
! This file was ported from Lean 3 source module wiedijk_100_theorems.sum_of_prime_reciprocals_diverges
-! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
+! leanprover-community/mathlib commit 08b081ea92d80e3a41f899eea36ef6d56e0f1db0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.Data.Nat.Squarefree
/-!
# Divergence of the Prime Reciprocal Series
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file proves Theorem 81 from the [100 Theorems List](https://www.cs.ru.nl/~freek/100/).
The theorem states that the sum of the reciprocals of all prime numbers diverges.
The formalization follows Erdős's proof by upper and lower estimates.
mathlib commit https://github.com/leanprover-community/mathlib/commit/893964fc28cefbcffc7cb784ed00a2895b4e65cf
@@ -3,8 +3,8 @@ Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-! This file was ported from Lean 3 source module «100-theorems-list».«81_sum_of_prime_reciprocals_diverges»
-! leanprover-community/mathlib commit 328375597f2c0dd00522d9c2e5a33b6a6128feeb
+! This file was ported from Lean 3 source module wiedijk_100_theorems.sum_of_prime_reciprocals_diverges
+! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -3,7 +3,7 @@ Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-/
-import Mathlib.Topology.Instances.ENNReal
+import Mathlib.Topology.Algebra.InfiniteSum.Real
import Mathlib.Data.Nat.Squarefree
#align_import wiedijk_100_theorems.sum_of_prime_reciprocals_diverges from "leanprover-community/mathlib"@"5563b1b49e86e135e8c7b556da5ad2f5ff881cad"
@@ -132,7 +132,7 @@ theorem card_le_mul_sum {x k : ℕ} : (card (U x k) : ℝ) ≤ x * ∑ p in P x
have h : card (Finset.biUnion P N) ≤ ∑ p in P, card (N p) := card_biUnion_le
calc
(card (Finset.biUnion P N) : ℝ) ≤ ∑ p in P, (card (N p) : ℝ) := by assumption_mod_cast
- _ ≤ ∑ p in P, x * (1 / (p : ℝ)) := (sum_le_sum fun p _ => ?_)
+ _ ≤ ∑ p in P, x * (1 / (p : ℝ)) := sum_le_sum fun p _ => ?_
_ = x * ∑ p in P, 1 / (p : ℝ) := by rw [mul_sum]
simp only [N, mul_one_div, Nat.card_multiples, Nat.cast_div_le]
#align theorems_100.card_le_mul_sum Theorems100.card_le_mul_sum
@@ -168,7 +168,7 @@ theorem card_le_two_pow {x k : ℕ} :
card M₁ ≤ card (image f K) := card_le_card h
_ ≤ card K := card_image_le
_ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [K, card_powerset]; rfl
- _ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
+ _ ≤ 2 ^ card (range k) := pow_le_pow_right one_le_two card_image_le
_ = 2 ^ k := by rw [card_range k]
#align theorems_100.card_le_two_pow Theorems100.card_le_two_pow
@@ -205,7 +205,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
calc
card (M x k) ≤ card (image f K) := card_le_card h1
_ ≤ card K := card_image_le
- _ = card M₁ * card M₂ := (card_product M₁ M₂)
+ _ = card M₁ * card M₂ := card_product M₁ M₂
_ ≤ 2 ^ k * x.sqrt := mul_le_mul' card_le_two_pow h2
#align theorems_100.card_le_two_pow_mul_sqrt Theorems100.card_le_two_pow_mul_sqrt
@@ -236,7 +236,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
have h3 :=
calc
(card U' : ℝ) ≤ x * ∑ p in P, 1 / (p : ℝ) := card_le_mul_sum
- _ < x * (1 / 2) := (mul_lt_mul_of_pos_left (h1 x) (by norm_num [x]))
+ _ < x * (1 / 2) := mul_lt_mul_of_pos_left (h1 x) (by norm_num [x])
_ = x / 2 := mul_one_div (x : ℝ) 2
have h4 :=
calc
@@ -246,7 +246,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
refine' lt_irrefl (x : ℝ) _
calc
(x : ℝ) = (card U' : ℝ) + (card M' : ℝ) := by assumption_mod_cast
- _ < x / 2 + x / 2 := (add_lt_add_of_lt_of_le h3 h4)
+ _ < x / 2 + x / 2 := add_lt_add_of_lt_of_le h3 h4
_ = x := add_halves (x : ℝ)
#align theorems_100.real.tendsto_sum_one_div_prime_at_top Theorems100.Real.tendsto_sum_one_div_prime_atTop
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^ in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n xand notnpowRec n x * xin the definition to make sure that definitional unfolding ofnpowRecis blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ and pow_succ' have switched their meanings.Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.@@ -242,7 +242,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
calc
(card M' : ℝ) ≤ 2 ^ k * x.sqrt := by exact mod_cast card_le_two_pow_mul_sqrt
_ = 2 ^ k * (2 ^ (k + 1) : ℕ) := by rw [Nat.sqrt_eq]
- _ = x / 2 := by field_simp [x, mul_right_comm, ← pow_succ']
+ _ = x / 2 := by field_simp [x, mul_right_comm, ← pow_succ]
refine' lt_irrefl (x : ℝ) _
calc
(x : ℝ) = (card U' : ℝ) + (card M' : ℝ) := by assumption_mod_cast
@@ -134,7 +134,7 @@ theorem card_le_mul_sum {x k : ℕ} : (card (U x k) : ℝ) ≤ x * ∑ p in P x
(card (Finset.biUnion P N) : ℝ) ≤ ∑ p in P, (card (N p) : ℝ) := by assumption_mod_cast
_ ≤ ∑ p in P, x * (1 / (p : ℝ)) := (sum_le_sum fun p _ => ?_)
_ = x * ∑ p in P, 1 / (p : ℝ) := by rw [mul_sum]
- simp only [mul_one_div, Nat.card_multiples, Nat.cast_div_le]
+ simp only [N, mul_one_div, Nat.card_multiples, Nat.cast_div_le]
#align theorems_100.card_le_mul_sum Theorems100.card_le_mul_sum
/--
@@ -150,7 +150,7 @@ theorem card_le_two_pow {x k : ℕ} :
-- It follows that `e` is one less than such a product.
have h : M₁ ⊆ image f K := by
intro m hm
- simp only [M, mem_filter, mem_range, mem_powerset, mem_image, exists_prop] at hm ⊢
+ simp only [f, K, M₁, M, mem_filter, mem_range, mem_powerset, mem_image, exists_prop] at hm ⊢
obtain ⟨⟨-, hmp⟩, hms⟩ := hm
use! (m + 1).factors
· rwa [Multiset.coe_nodup, ← Nat.squarefree_iff_nodup_factors m.succ_ne_zero]
@@ -167,7 +167,7 @@ theorem card_le_two_pow {x k : ℕ} :
calc
card M₁ ≤ card (image f K) := card_le_card h
_ ≤ card K := card_image_le
- _ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [card_powerset]; rfl
+ _ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [K, card_powerset]; rfl
_ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
_ = 2 ^ k := by rw [card_range k]
#align theorems_100.card_le_two_pow Theorems100.card_le_two_pow
@@ -186,7 +186,8 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
-- smaller than or equal to `k`.
have h1 : M x k ⊆ image f K := by
intro m hm
- simp only [M, mem_image, exists_prop, Prod.exists, mem_product, mem_filter, mem_range] at hm ⊢
+ simp only [f, K, M, M₁, M₂, mem_image, exists_prop, Prod.exists, mem_product,
+ mem_filter, mem_range] at hm ⊢
have hm' := m.zero_lt_succ
obtain ⟨a, b, hab₁, hab₂⟩ := Nat.sq_mul_squarefree_of_pos' hm'
obtain ⟨ham, hbm⟩ := Dvd.intro_left _ hab₁, Dvd.intro _ hab₁
@@ -200,7 +201,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
_ ≤ x.sqrt := Nat.sqrt_le_sqrt (Nat.succ_le_iff.mpr hm.1)
· exact hm.2 p ⟨hp.1, hp.2.trans (Nat.dvd_of_pow_dvd one_le_two hbm)⟩
have h2 : card M₂ ≤ Nat.sqrt x := by
- rw [← card_range (Nat.sqrt x)]; apply card_le_card; simp [M]
+ rw [← card_range (Nat.sqrt x)]; apply card_le_card; simp [M, M₂]
calc
card (M x k) ≤ card (image f K) := card_le_card h1
_ ≤ card K := card_image_le
@@ -235,13 +236,13 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
have h3 :=
calc
(card U' : ℝ) ≤ x * ∑ p in P, 1 / (p : ℝ) := card_le_mul_sum
- _ < x * (1 / 2) := (mul_lt_mul_of_pos_left (h1 x) (by norm_num))
+ _ < x * (1 / 2) := (mul_lt_mul_of_pos_left (h1 x) (by norm_num [x]))
_ = x / 2 := mul_one_div (x : ℝ) 2
have h4 :=
calc
(card M' : ℝ) ≤ 2 ^ k * x.sqrt := by exact mod_cast card_le_two_pow_mul_sqrt
_ = 2 ^ k * (2 ^ (k + 1) : ℕ) := by rw [Nat.sqrt_eq]
- _ = x / 2 := by field_simp [mul_right_comm, ← pow_succ']
+ _ = x / 2 := by field_simp [x, mul_right_comm, ← pow_succ']
refine' lt_irrefl (x : ℝ) _
calc
(x : ℝ) = (card U' : ℝ) + (card M' : ℝ) := by assumption_mod_cast
A bunch of lemmas in Algebra.BigOperators.Ring were not about rings. This PR moves them along with some lemmas from Data.Fintype.BigOperators to their correct place.
I create a new file with the content from #6605 to avoid importing Fin material in finset files as a result.
From LeanAPAP
@@ -133,7 +133,7 @@ theorem card_le_mul_sum {x k : ℕ} : (card (U x k) : ℝ) ≤ x * ∑ p in P x
calc
(card (Finset.biUnion P N) : ℝ) ≤ ∑ p in P, (card (N p) : ℝ) := by assumption_mod_cast
_ ≤ ∑ p in P, x * (1 / (p : ℝ)) := (sum_le_sum fun p _ => ?_)
- _ = x * ∑ p in P, 1 / (p : ℝ) := mul_sum.symm
+ _ = x * ∑ p in P, 1 / (p : ℝ) := by rw [mul_sum]
simp only [mul_one_div, Nat.card_multiples, Nat.cast_div_le]
#align theorems_100.card_le_mul_sum Theorems100.card_le_mul_sum
Finset lemma names (#8894)
Change a few lemma names that have historically bothered me.
Finset.card_le_of_subset → Finset.card_le_cardMultiset.card_le_of_le → Multiset.card_le_cardMultiset.card_lt_of_lt → Multiset.card_lt_cardSet.ncard_le_of_subset → Set.ncard_le_ncardFinset.image_filter → Finset.filter_imageCompleteLattice.finset_sup_compact_of_compact → CompleteLattice.isCompactElement_finset_sup@@ -165,7 +165,7 @@ theorem card_le_two_pow {x k : ℕ} :
-- The number of elements of `M x k` with `e + 1` squarefree is bounded by the number of subsets
-- of `[1, k]`.
calc
- card M₁ ≤ card (image f K) := card_le_of_subset h
+ card M₁ ≤ card (image f K) := card_le_card h
_ ≤ card K := card_image_le
_ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [card_powerset]; rfl
_ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
@@ -200,9 +200,9 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
_ ≤ x.sqrt := Nat.sqrt_le_sqrt (Nat.succ_le_iff.mpr hm.1)
· exact hm.2 p ⟨hp.1, hp.2.trans (Nat.dvd_of_pow_dvd one_le_two hbm)⟩
have h2 : card M₂ ≤ Nat.sqrt x := by
- rw [← card_range (Nat.sqrt x)]; apply card_le_of_subset; simp [M]
+ rw [← card_range (Nat.sqrt x)]; apply card_le_card; simp [M]
calc
- card (M x k) ≤ card (image f K) := card_le_of_subset h1
+ card (M x k) ≤ card (image f K) := card_le_card h1
_ ≤ card K := card_image_le
_ = card M₁ * card M₂ := (card_product M₁ M₂)
_ ≤ 2 ^ k * x.sqrt := mul_le_mul' card_le_two_pow h2
The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Orderpow_mono → pow_right_monopow_le_pow → pow_le_pow_rightpow_le_pow_of_le_left → pow_le_pow_leftpow_lt_pow_of_lt_left → pow_lt_pow_leftstrictMonoOn_pow → pow_left_strictMonoOnpow_strictMono_right → pow_right_strictMonopow_lt_pow → pow_lt_pow_rightpow_lt_pow_iff → pow_lt_pow_iff_rightpow_le_pow_iff → pow_le_pow_iff_rightself_lt_pow → lt_self_powstrictAnti_pow → pow_right_strictAntipow_lt_pow_iff_of_lt_one → pow_lt_pow_iff_right_of_lt_onepow_lt_pow_of_lt_one → pow_lt_pow_right_of_lt_onelt_of_pow_lt_pow → lt_of_pow_lt_pow_leftle_of_pow_le_pow → le_of_pow_le_pow_leftpow_lt_pow₀ → pow_lt_pow_right₀Algebra.GroupPower.CovariantClasspow_le_pow_of_le_left' → pow_le_pow_left'nsmul_le_nsmul_of_le_right → nsmul_le_nsmul_rightpow_lt_pow' → pow_lt_pow_right'nsmul_lt_nsmul → nsmul_lt_nsmul_leftpow_strictMono_left → pow_right_strictMono'nsmul_strictMono_right → nsmul_left_strictMonoStrictMono.pow_right' → StrictMono.pow_constStrictMono.nsmul_left → StrictMono.const_nsmulpow_strictMono_right' → pow_left_strictMononsmul_strictMono_left → nsmul_right_strictMonoMonotone.pow_right → Monotone.pow_constMonotone.nsmul_left → Monotone.const_nsmullt_of_pow_lt_pow' → lt_of_pow_lt_pow_left'lt_of_nsmul_lt_nsmul → lt_of_nsmul_lt_nsmul_rightpow_le_pow' → pow_le_pow_right'nsmul_le_nsmul → nsmul_le_nsmul_leftpow_le_pow_of_le_one' → pow_le_pow_right_of_le_one'nsmul_le_nsmul_of_nonpos → nsmul_le_nsmul_left_of_nonposle_of_pow_le_pow' → le_of_pow_le_pow_left'le_of_nsmul_le_nsmul' → le_of_nsmul_le_nsmul_right'pow_le_pow_iff' → pow_le_pow_iff_right'nsmul_le_nsmul_iff → nsmul_le_nsmul_iff_leftpow_lt_pow_iff' → pow_lt_pow_iff_right'nsmul_lt_nsmul_iff → nsmul_lt_nsmul_iff_leftData.Nat.PowNat.pow_lt_pow_of_lt_left → Nat.pow_lt_pow_leftNat.pow_le_iff_le_left → Nat.pow_le_pow_iff_leftNat.pow_lt_iff_lt_left → Nat.pow_lt_pow_iff_leftpow_le_pow_iff_leftpow_lt_pow_iff_leftpow_right_injectivepow_right_injNat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.self_le_pow was a duplicate of le_self_pow.Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.Nat.pow_right_strictMono is defeq to pow_right_strictMono.Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.0 < n or 1 ≤ n to n ≠ 0.Nat lemmas have been protected.@@ -168,7 +168,7 @@ theorem card_le_two_pow {x k : ℕ} :
card M₁ ≤ card (image f K) := card_le_of_subset h
_ ≤ card K := card_image_le
_ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [card_powerset]; rfl
- _ ≤ 2 ^ card (range k) := (pow_le_pow one_le_two card_image_le)
+ _ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
_ = 2 ^ k := by rw [card_range k]
#align theorems_100.card_le_two_pow Theorems100.card_le_two_pow
@@ -161,7 +161,7 @@ theorem card_le_two_pow {x k : ℕ} :
exact
⟨p.pred, (Nat.pred_lt (Nat.Prime.ne_zero hp.1)).trans_le ((hmp p) hp),
Nat.succ_pred_eq_of_pos (Nat.Prime.pos hp.1)⟩
- · simp [Nat.prod_factors m.succ_ne_zero, m.succ_sub_one]
+ · simp [Nat.prod_factors m.succ_ne_zero, m.add_one_sub_one]
-- The number of elements of `M x k` with `e + 1` squarefree is bounded by the number of subsets
-- of `[1, k]`.
calc
@@ -191,7 +191,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
obtain ⟨a, b, hab₁, hab₂⟩ := Nat.sq_mul_squarefree_of_pos' hm'
obtain ⟨ham, hbm⟩ := Dvd.intro_left _ hab₁, Dvd.intro _ hab₁
refine'
- ⟨a, b, ⟨⟨⟨_, fun p hp => _⟩, hab₂⟩, ⟨_, fun p hp => _⟩⟩, by simp_rw [hab₁, m.succ_sub_one]⟩
+ ⟨a, b, ⟨⟨⟨_, fun p hp => _⟩, hab₂⟩, ⟨_, fun p hp => _⟩⟩, by simp_rw [hab₁, m.add_one_sub_one]⟩
· exact (Nat.succ_le_succ_iff.mp (Nat.le_of_dvd hm' ham)).trans_lt hm.1
· exact hm.2 p ⟨hp.1, hp.2.trans ham⟩
· calc
exact_mod_cast tactic with mod_cast elaborator where possible (#8404)
We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -239,7 +239,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
_ = x / 2 := mul_one_div (x : ℝ) 2
have h4 :=
calc
- (card M' : ℝ) ≤ 2 ^ k * x.sqrt := by exact_mod_cast card_le_two_pow_mul_sqrt
+ (card M' : ℝ) ≤ 2 ^ k * x.sqrt := by exact mod_cast card_le_two_pow_mul_sqrt
_ = 2 ^ k * (2 ^ (k + 1) : ℕ) := by rw [Nat.sqrt_eq]
_ = x / 2 := by field_simp [mul_right_comm, ← pow_succ']
refine' lt_irrefl (x : ℝ) _
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).
This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true }) in some places, to recover the old behaviour@[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -240,7 +240,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
have h4 :=
calc
(card M' : ℝ) ≤ 2 ^ k * x.sqrt := by exact_mod_cast card_le_two_pow_mul_sqrt
- _ = 2 ^ k * ↑(2 ^ (k + 1)) := by rw [Nat.sqrt_eq]
+ _ = 2 ^ k * (2 ^ (k + 1) : ℕ) := by rw [Nat.sqrt_eq]
_ = x / 2 := by field_simp [mul_right_comm, ← pow_succ']
refine' lt_irrefl (x : ℝ) _
calc
@@ -144,7 +144,7 @@ The number of `e < x` for which `e + 1` is a squarefree product of primes smalle
theorem card_le_two_pow {x k : ℕ} :
card (Finset.filter (fun e => Squarefree (e + 1)) (M x k)) ≤ 2 ^ k := by
let M₁ := Finset.filter (fun e => Squarefree (e + 1)) (M x k)
- let f s := (Finset.prod s fun a => a) - 1
+ let f s := (∏ a in s, a) - 1
let K := powerset (image Nat.succ (range k))
-- Take `e` in `M x k`. If `e + 1` is squarefree, then it is the product of a subset of `[1, k]`.
-- It follows that `e` is one less than such a product.
use provide last constructor argument, introduce mathlib3-like flattening use! (#5350)
Changes:
use now by default discharges with try with_reducible use_discharger with a custom discharger tactic rather than try with_reducible rfl, which makes it be closer to exists and the use in mathlib3. It doesn't go so far as to do try with_reducible trivial since that involves the contradiction tactic.use (discharger := tacticSeq...)use evaluation loop will try refining after constructor failure, so it can be used to fill in all arguments rather than all but the last, like in mathlib3 (closes #5072) but with the caveat that it only works so long as the last argument is not an inductive type (like Eq).use!, which is nearly the same as the mathlib3 use and fills in constructor arguments along the nodes and leaves of the nested constructor expressions. This version tries refining before applying constructors, so it can be used like exact for the last argument.The difference between mathlib3 use and this use! is that (1) use! uses a different tactic to discharge goals (mathlib3 used trivial', which did reducible refl, but also contradiction, which we don't emulate) (2) it does not rewrite using exists_prop. Regarding 2, this feature seems to be less useful now that bounded existentials encode the bound using a conjunction rather than with nested existentials. We do have exists_prop as part of use_discharger however.
Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>
@@ -152,7 +152,7 @@ theorem card_le_two_pow {x k : ℕ} :
intro m hm
simp only [M, mem_filter, mem_range, mem_powerset, mem_image, exists_prop] at hm ⊢
obtain ⟨⟨-, hmp⟩, hms⟩ := hm
- use ⟨(m + 1).factors, ?_⟩
+ use! (m + 1).factors
· rwa [Multiset.coe_nodup, ← Nat.squarefree_iff_nodup_factors m.succ_ne_zero]
refine' ⟨fun p => _, _⟩
· suffices p ∈ (m + 1).factors → ∃ a : ℕ, a < k ∧ a.succ = p by simpa
@@ -2,15 +2,12 @@
Copyright (c) 2021 Manuel Candales. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Manuel Candales
-
-! This file was ported from Lean 3 source module wiedijk_100_theorems.sum_of_prime_reciprocals_diverges
-! leanprover-community/mathlib commit 5563b1b49e86e135e8c7b556da5ad2f5ff881cad
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Topology.Instances.ENNReal
import Mathlib.Data.Nat.Squarefree
+#align_import wiedijk_100_theorems.sum_of_prime_reciprocals_diverges from "leanprover-community/mathlib"@"5563b1b49e86e135e8c7b556da5ad2f5ff881cad"
+
/-!
# Divergence of the Prime Reciprocal Series
The unported dependencies are
algebra.order.moduleinit.corealgebra.order.monoid.cancel.defsalgebra.absalgebra.group_power.lemmasinit.data.list.basicalgebra.order.monoid.cancel.basicinit.data.list.defaulttopology.subset_propertiesinit.logicThe following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file