Problems / erdos-1094 / erdos-1094--h2--h2--h2--h2
medium range k^(2−21/40)/2 < n ≤ k²/log²k
erdos-1094--h2--h2--h2--h2
proved
Hole h_medium of erdos-1094--h2--h2--h2 (split by 20261014T111800Z-t1014-x-partial.lean).
$\displaystyle \neg\,\text{BHP}\ \ \lor\ \ \exists k_0\in\mathbb{N}\ \forall k\ge k_0\ \forall n\in\mathbb{Z}:\ \ \tfrac12\,k^{2-21/40}<n\le\frac{k^2}{(\log k)^2}\ \Longrightarrow\ \exists p\text{ prime},\ k<p<k+3k^{21/40},\ \ p\mid\prod_{i=1}^{k}(n-i)$
Either the Baker–Harman–Pintz short-interval prime count fails, or for all large $k$ and every integer $n$ with $\tfrac12 k^{2-21/40}<n\le k^2/(\log k)^2$, some prime $p$ in $(k,\,k+3k^{21/40})$ divides $(n-1)(n-2)\cdots(n-k)$. Here BHP is the Baker–Harman–Pintz short-interval prime count $\exists C>0\ \exists k_0\ \forall k\ge k_0:\ C\,k^{21/40}/\log k\le\#\{p\text{ prime}:k<p<k+k^{21/40}\}$, the primes counted as the integers of the interval $(\lfloor k\rfloor,\lceil k+k^{21/40}\rceil)$ that are positive, prime in absolute value and lie strictly between $k$ and $k+k^{21/40}$ over the reals. $n$ ranges over $\mathbb{Z}$ and the product $\prod_{i=1}^{k}(n-i)$ is taken in $\mathbb{Z}$; the bounds on $n$ and $p$ are over the reals with $21/40$ a real exponent, and $\log$ is the natural logarithm.
Lean
theorem erdos_1094__h2__h2__h2__h2 : (¬∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)) ∨
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
∀ (n : ℤ),
(1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) →
(↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) →
∃ (p : ℕ),
Nat.Prime p ∧
(↑k : ℝ) < (↑p : ℝ) ∧
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧
(↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)) := by
sorryWhy does it end in sorry?
A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
How it was proved
Proved by Proof.lean, checked by the kernel. Its attestation, 000553, records the gate’s run.
The proof step by step (outline)
Checked by the kernel — an outline of the attested proof below: attestations/000553.json, merge commit e2362ca10626.
Outline of Proof.lean, extracted by the gate at 067497e74a8b from the proof’s elaboration: each step is a claim the proof establishes and the goal it leaves. Open a step for what it uses and its Lean lines.
h_counthave∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)Leaves
(¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ)) ∨ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withh_count : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Uses statements erdos-1094--h2--h2--h2--h2--h1; library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,roundround xroundsxto the nearest integer, breaking ties towards positive infinity. .Lean, lines 31–38
have h_count : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2 : ℝ) * (k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → (((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ (21 / 40 : ℝ)⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ (21 / 40 : ℝ) ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - (21 / 40 : ℝ)))).card : ℝ) < 3 + 56 * (k : ℝ) ^ (2 * (21 / 40 : ℝ) - 1) + (k : ℝ) ^ (21 / 40 : ℝ) * (Real.log k) ^ (-(2 : ℝ)) := erdos_1094__h2__h2__h2__h2__h1targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 31–38 at
e2362ca10626↗s2caseLeaves
(¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ)) ∨ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withhB0 : ¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ).Uses library
Or.inlOr.inlis "left injection" into anOr. .Lean, line 51
· exact Or.inl hB0
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 51 at
e2362ca10626↗theta_poshave(0 : ℝ) < thetaLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtheta_pos : (0 : ℝ) < theta.Lean, lines 57–59
have theta_pos : (0 : ℝ) < theta := by clear * - simp only [theta]; norm_numtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 57–59 at
e2362ca10626↗theta_lt_onehavetheta < (1 : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtheta_lt_one : theta < (1 : ℝ).Lean, lines 60–62
have theta_lt_one : theta < 1 := by clear * - simp only [theta]; norm_numtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 60–62 at
e2362ca10626↗dvd_Pprod_of_factorhave∀ (k : ℕ) (n p : ℤ), ∀ i ∈ Finset.Icc (1 : ℕ) k, p ∣ n - (↑i : ℤ) → p ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withdvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ), ∀ i ∈ Finset.Icc (1 : ℕ) k, p ∣ n - (↑i : ℤ) → p ∣ Pprod k n.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.dvd_prod_of_mem.Lean, lines 63–67
have dvd_Pprod_of_factor : ∀ (k : ℕ) (n : ℤ) (p : ℤ) (i : ℕ) (hi : i ∈ Finset.Icc 1 k) (hp : p ∣ (n - (i : ℤ))), p ∣ Pprod k n := by intro k n p i hi hp clear * - k n p i hi hp simp only [Pprod] exact hp.trans (Finset.dvd_prod_of_mem (fun i : ℕ => (n - (i : ℤ))) hi)targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 63–67 at
e2362ca10626↗dvd_from_farhave∀ (k : ℕ) (n : ℤ) (p : ℕ), (1 : ℕ) ≤ k → (0 : ℕ) < p → (↑k : ℝ) < (↑p : ℝ) → (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta → (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| → (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withdvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ), (1 : ℕ) ≤ k → (0 : ℕ) < p → (↑k : ℝ) < (↑p : ℝ) → (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta → (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| → (↑p : ℤ) ∣ Pprod k n.Uses library
roundround xroundsxto the nearest integer, breaking ties towards positive infinity. .Lean, lines 68–105
have dvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ) (hk1 : 1 ≤ k) (hp0 : 0 < p) (hkp : (k : ℝ) < p) (hpk : (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta) (hfar : 1 / (k : ℝ) ^ (1 - theta) ≤ |(n : ℝ) / (p : ℝ) - round ((n : ℝ) / (p : ℝ))|), (p : ℤ) ∣ Pprod k n := by intro k n p hk1 hp0 hkp hpk hfar clear * - dvd_Pprod_of_factor theta_pos theta_lt_one k n p hk1 hp0 hkp hpk hfar -- Set `i := n % (p : ℤ)` and `j := i.toNat`. set i := n % (p : ℤ) set j := i.toNat have hj : (j : ℤ) = i := by exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity; -- From `hfar`, we have `(p:ℝ)/(k:ℝ)^(1-theta) ≤ (min i (p-i) : ℝ)`. have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ]; have hp' : (0:ℝ) < p := by exact_mod_cast hp0 have h1 := mul_le_mul_of_nonneg_left hfar hp'.le rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1 have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp rw [e1, e2] at h1 calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring _ ≤ _ := h1 -- So `1 ≤ i ≤ k`. have h_i_bounds : 1 ≤ i ∧ i ≤ k := by have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity; constructor <;> norm_num at *; · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] ); · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith ); convert dvd_Pprod_of_factor k n ( p : ℤ ) j _ _ using 1; · grind; · exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 68–105 at
e2362ca10626↗dvd_from_far.hjhave(↑j : ℤ) = iLeaves
(↑p : ℤ) ∣ Pprod k n, withhj : (↑j : ℤ) = i.Uses library
Int.toNat_of_nonneg,Int.emod_nonneg.Lean, lines 74–75
have hj : (j : ℤ) = i := by exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 74–75 at
e2362ca10626↗dvd_from_far.h_frachave(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ))Leaves
(↑p : ℤ) ∣ Pprod k n, withh_frac : (↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)).Uses library
Min.minReturns the lesser of its two arguments. ,mul_min_of_nonneg.Lean, lines 77–92
have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ]; have hp' : (0:ℝ) < p := by exact_mod_cast hp0 have h1 := mul_le_mul_of_nonneg_left hfar hp'.le rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1 have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp rw [e1, e2] at h1 calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring _ ≤ _ := h1targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 77–92 at
e2362ca10626↗dvd_from_far.h_frac.h_frachave|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ))Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withh_frac : |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)).Uses library
roundround xroundsxto the nearest integer, breaking ties towards positive infinity. ,Min.minReturns the lesser of its two arguments. ,abs_sub_round_eq_min.Lean, lines 78–84
have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ];targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 78–84 at
e2362ca10626↗dvd_from_far.h_frac.h_frac.h_frachaveInt.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑i : ℝ) / (↑p : ℝ)Leaves
|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)), withh_frac : Int.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑i : ℝ) / (↑p : ℝ).Uses library
Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Int.fract_eq_iff,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,Int.emod_nonneg,Int.emod_lt_of_pos,Int.emod_add_mul_ediv.Lean, lines 79–83
have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 79–83 at
e2362ca10626↗
dvd_from_far.h_frac.hp'have(0 : ℝ) < (↑p : ℝ)Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withhp' : (0 : ℝ) < (↑p : ℝ).Lean, line 85
have hp' : (0:ℝ) < p := by exact_mod_cast hp0
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 85 at
e2362ca10626↗dvd_from_far.h_frac.h1have(↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ (↑p : ℝ) * |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withh1 : (↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ (↑p : ℝ) * |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|.Uses library
mul_le_mul_of_nonneg_left.Lean, line 86
have h1 := mul_le_mul_of_nonneg_left hfar hp'.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 86 at
e2362ca10626↗dvd_from_far.h_frac.e1have(↑p : ℝ) * ((↑i : ℝ) / (↑p : ℝ)) = (↑i : ℝ)routine: field_simpLeaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withe1 : (↑p : ℝ) * ((↑i : ℝ) / (↑p : ℝ)) = (↑i : ℝ).Lean, line 88
have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 88 at
e2362ca10626↗dvd_from_far.h_frac.e2have(↑p : ℝ) * ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)) = (↑p : ℝ) - (↑i : ℝ)routine: field_simpLeaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withe2 : (↑p : ℝ) * ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)) = (↑p : ℝ) - (↑i : ℝ).Lean, line 89
have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 89 at
e2362ca10626↗dvd_from_far.h_frac.s6calc(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) = (↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta))routine: ringCloses the goal.
Lean, line 91
calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 91 at
e2362ca10626↗dvd_from_far.h_frac.s7calc(↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ))Closes the goal.
Lean, line 92
_ ≤ _ := h1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 92 at
e2362ca10626↗
dvd_from_far.h_i_boundshave(1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ)Leaves
(↑p : ℤ) ∣ Pprod k n, withh_i_bounds : (1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ).Lean, lines 94–102
have h_i_bounds : 1 ≤ i ∧ i ≤ k := by have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity; constructor <;> norm_num at *; · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] ); · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 94–102 at
e2362ca10626↗dvd_from_far.h_i_bounds.h_i_boundshave(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) > (↑k : ℝ) ^ thetaLeaves
(1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ), withh_i_bounds : (↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) > (↑k : ℝ) ^ theta.Uses library
gt_iff_lt,lt_div_iff₀Seelt_div_iff₀'for a version with multiplication on the other side. .Lean, lines 95–99
have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 95–99 at
e2362ca10626↗dvd_from_far.h_i_bounds.h_i_bounds.s1caseLeaves
(↑k : ℝ) ^ (21 / 40 : ℝ) * (↑k : ℝ) ^ (19 / 40 : ℝ) < (↑p : ℝ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ).Uses library
Real.rpow_add,Lean.Grind.Config.extAllIfextAllistrue,grinduses any extensionality theorems available in the environment. .Lean, lines 97–98
· rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 97–98 at
e2362ca10626↗dvd_from_far.h_i_bounds.h_i_bounds.s2case routine: positivityLeaves
(0 : ℝ) < (↑k : ℝ) ^ (19 / 40 : ℝ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ).Lean, line 99
· positivity;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 99 at
e2362ca10626↗
dvd_from_far.h_i_bounds.s2caseLeaves
(1 : ℤ) ≤ i, withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ),h_i_bounds : (↑k : ℝ) ^ (21 / 40 : ℝ) < (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ).Uses library
Int.le_of_lt_add_one,Int.cast_lt,Real.one_le_rpow,div_nonneg.Lean, line 101
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] );
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 101 at
e2362ca10626↗dvd_from_far.h_i_bounds.s3caseLeaves
i ≤ (↑k : ℤ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ),h_i_bounds : (↑k : ℝ) ^ (21 / 40 : ℝ) < (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ).Uses library
Int.le_of_lt_add_one,Int.cast_lt.Lean, line 102
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 102 at
e2362ca10626↗
dvd_from_far.s4caseLeaves
j ∈ Finset.Icc (1 : ℕ) k.Lean, line 104
· grind;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 104 at
e2362ca10626↗dvd_from_far.s5caseLeaves
(↑p : ℤ) ∣ n - (↑j : ℤ).Uses library
Exists.introExistential introduction. ,Int.emod_add_mul_ediv.Lean, line 105
· exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 105 at
e2362ca10626↗
exists_far_primehave∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → (↑(badSet k n).card : ℝ) < (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withexists_far_prime : ∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → (↑(badSet k n).card : ℝ) < (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Lean, lines 109–135
have exists_far_prime : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (hcount : ((badSet k n).card : ℝ) < (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro k n hk1 hcount clear * - dvd_from_far k n hk1 hcount by_contra hne push_neg at hne have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by intro p hp rw [Finset.mem_filter] at hp obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq] simp only [badSet, Finset.mem_filter, Finset.mem_Ioo] refine ⟨⟨?_, ?_⟩, hpb, ?_⟩ · exact_mod_cast hkp · have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omega · by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar) have hc := Finset.card_le_card hsub have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2 linarithtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 109–135 at
e2362ca10626↗exists_far_prime.hsubhave{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta} ⊆ badSet k nLeaves
False, withhsub : {p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta} ⊆ badSet k n.Uses library
Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,Finset.mem_filter,Finset.mem_Ioo,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 114–131
have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by intro p hp rw [Finset.mem_filter] at hp obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq] simp only [badSet, Finset.mem_filter, Finset.mem_Ioo] refine ⟨⟨?_, ?_⟩, hpb, ?_⟩ · exact_mod_cast hkp · have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omega · by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 114–131 at
e2362ca10626↗exists_far_prime.hsub.s1obtainp ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ∧ (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ thetaLeaves
p ∈ badSet k n, withhpI : p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉,hp0 : (0 : ℤ) < p,hpr : Nat.Prime p.natAbs,hkp : (↑k : ℝ) < (↑p : ℝ),hpb : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta.Lean, line 117
obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 117 at
e2362ca10626↗exists_far_prime.hsub.hqhave(↑p.natAbs : ℤ) = pLeaves
p ∈ badSet k n, withhq : (↑p.natAbs : ℤ) = p.Uses library
Int.natAbs_of_nonneg.Lean, line 118
have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 118 at
e2362ca10626↗exists_far_prime.hsub.hqRhave(↑p.natAbs : ℝ) = (↑p : ℝ)Leaves
p ∈ badSet k n, withhqR : (↑p.natAbs : ℝ) = (↑p : ℝ).Uses library
Int.cast_natCast.Lean, line 119
have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq]
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 119 at
e2362ca10626↗exists_far_prime.hsub.s4caseLeaves
(↑k : ℤ) < p.Lean, line 122
· exact_mod_cast hkp
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 122 at
e2362ca10626↗exists_far_prime.hsub.s5caseLeaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ).Lean, lines 123–127
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omegatargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 123–127 at
e2362ca10626↗exists_far_prime.hsub.s5.h1havep < ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉Leaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ), withh1 : p < ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉.Uses library
Finset.mem_Ioo.Lean, line 123
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 123 at
e2362ca10626↗exists_far_prime.hsub.s5.h2have⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ≤ (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (1 : ℤ)Leaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ), withh2 : ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ≤ (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (1 : ℤ).Uses library
Int.ceil_le,Int.lt_floor_add_one.Lean, lines 124–126
have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)]targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 124–126 at
e2362ca10626↗
exists_far_prime.hsub.s6caseLeaves
|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta).Lean, lines 128–131
· by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 128–131 at
e2362ca10626↗
exists_far_prime.hchave{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta}.card ≤ (badSet k n).cardLeaves
False, withhc : {p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta}.card ≤ (badSet k n).card.Uses library
Finset.card_le_card.Lean, line 132
have hc := Finset.card_le_card hsub
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 132 at
e2362ca10626↗exists_far_prime.hc2haveprimeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta) ≤ (badSet k n).cardLeaves
False, withhc2 : primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta) ≤ (badSet k n).card.Lean, line 133
have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 133 at
e2362ca10626↗exists_far_prime.hc'have(↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) ≤ (↑(badSet k n).card : ℝ)Leaves
False, withhc' : (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) ≤ (↑(badSet k n).card : ℝ).Lean, line 134
have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 134 at
e2362ca10626↗
tendsto_log_rpow_mul_rpow_neghave∀ (b c : ℝ), (0 : ℝ) < c → Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ))Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ), (0 : ℝ) < c → Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. ,Filter.eventually_gt_atTop,div_eq_mul_invDividing by an element is the same as multiplying by its inverse. ,Real.rpow_negSee alsorpow_neg_eq_inv_rpowfor a version withx⁻¹ ^ yin the RHS. .Lean, lines 136–143
have tendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ) (hc : 0 < c), Filter.Tendsto (fun x : ℝ => (Real.log x) ^ b * x ^ (-c)) Filter.atTop (nhds 0) := by intro b c hc clear * - b c hc -- Use the fact that `Real.log x ^ b` is little-o of `x ^ c` as `x` tends to infinity. have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) := isLittleO_log_rpow_rpow_atTop b hc convert h_log.tendsto_div_nhds_zero.congr' _ using 1; filter_upwards [ Filter.eventually_gt_atTop 0 ] with x hx using by rw [ div_eq_mul_inv, Real.rpow_neg hx.le ] ;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 136–143 at
e2362ca10626↗tendsto_log_rpow_mul_rpow_neg.h_loghave(fun (x : ℝ) => Real.log x ^ b) =o[Filter.atTop] fun (x : ℝ) => x ^ cLeaves
Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ)), withh_log : (fun (x : ℝ) => Real.log x ^ b) =o[Filter.atTop] fun (x : ℝ) => x ^ c.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,isLittleO_log_rpow_rpow_atTop.Lean, lines 140–141
have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) := isLittleO_log_rpow_rpow_atTop b hctargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 140–141 at
e2362ca10626↗
poly_log_lthave∀ (A α β tt : ℝ), α < tt → ∀ (C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withpoly_log_lt : ∀ (A α β tt : ℝ), α < tt → ∀ (C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,gt_mem_nhds,Filter.eventually_gt_atTop,div_lt_iff₀Seediv_lt_iff₀'for a version with multiplication on the other side. ,div_pos,Real.rpow_pos_of_pos,Nat.cast_posSpecialisation ofNat.cast_pos', which seems to be easier for Lean to use. ,Real.log_pos,Nat.one_lt_cast.Lean, lines 144–159
have poly_log_lt : ∀ (A α β tt : ℝ) (hα : α < tt) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop, A * (k : ℝ) ^ α * (Real.log k) ^ β ≤ C * (k : ℝ) ^ tt / Real.log k := by intro A α β tt hα C hC clear * - tendsto_log_rpow_mul_rpow_neg A α β tt hα C hC -- Let's choose any $C > 0$ and derive a contradiction. have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by -- Simplify the expression inside the limit. suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring; have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_; · convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring; · linarith; filter_upwards [ h_lim.eventually ( gt_mem_nhds hC ), Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂; rw [ div_lt_iff₀ ( div_pos ( Real.rpow_pos_of_pos ( Nat.cast_pos.mpr hk₂.le ) _ ) ( Real.log_pos ( Nat.one_lt_cast.mpr hk₂ ) ) ) ] at hk₁ ; ring_nf at hk₁ ⊢ ; linarithtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 144–159 at
e2362ca10626↗poly_log_lt.h_limhaveFilter.Tendsto (fun (k : ℕ) => A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β / ((↑k : ℝ) ^ tt / Real.log (↑k : ℝ))) Filter.atTop (nhds (0 : ℝ))Leaves
∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withh_lim : Filter.Tendsto (fun (k : ℕ) => A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β / ((↑k : ℝ) ^ tt / Real.log (↑k : ℝ))) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. .Lean, lines 149–157
have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by -- Simplify the expression inside the limit. suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring; have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_; · convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring; · linarith;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 149–157 at
e2362ca10626↗poly_log_lt.h_lim.h_simpsufficesFilter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ))Leaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. ,Filter.eventually_gt_atTop,Real.rpow_sub,Real.rpow_add,Real.log_pos,Nat.one_lt_cast,Real.rpow_one.Lean, lines 151–154
suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 151–154 at
e2362ca10626↗poly_log_lt.h_lim.thishaveFilter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ))Leaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)), withthis : Filter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ)).Lean, line 155
have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 155 at
e2362ca10626↗poly_log_lt.h_lim.s3caseLeaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)), withthis : Filter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.Tendsto.comp,tendsto_natCast_atTop_atTop.Lean, line 156
· convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 156 at
e2362ca10626↗poly_log_lt.h_lim.s4case routine: linarithLeaves
(0 : ℝ) < tt - α.Lean, line 157
· linarith;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 157 at
e2362ca10626↗
poly_log_lt_eqhave∀ (A tt C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withpoly_log_lt_eq : ∀ (A tt C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_gt_atTop,Real.rpow_negSee alsorpow_neg_eq_inv_rpowfor a version withx⁻¹ ^ yin the RHS. ,Real.rpow_two,div_le_div_iff_of_pos_right,div_le_iff₀Seediv_le_iff₀'for a version with multiplication on the other side. ,mul_le_mul_of_nonneg_right.Lean, lines 160–174
have poly_log_lt_eq : ∀ (A tt : ℝ) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop, A * (k : ℝ) ^ tt * (Real.log k) ^ (-(2 : ℝ)) ≤ C * (k : ℝ) ^ tt / Real.log k := by intro A tt C hC clear * - A tt C hC -- We'll use that $A \leq C \cdot \log k$ for sufficiently large $k$. have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩; filter_upwards [ h_log_bound, Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂; have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂) have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _ rw [Real.rpow_neg hl.le, Real.rpow_two] have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by field_simp rw [e, div_le_div_iff_of_pos_right hl, div_le_iff₀ hl] nlinarith [mul_le_mul_of_nonneg_right hk₁ hp]targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 160–174 at
e2362ca10626↗poly_log_lt_eq.h_log_boundhave∀ᶠ (k : ℕ) in Filter.atTop, A ≤ C * Real.log (↑k : ℝ)Leaves
∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withh_log_bound : ∀ᶠ (k : ℕ) in Filter.atTop, A ≤ C * Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop,Exists.introExistential introduction. ,Real.expThe real exponential function, defined as the real part of the complex exponential ,Nat.le_ceil,Real.log_exp,Real.log_le_log,le_of_lt,Nat.lt_of_ceil_lt,mul_div_cancel₀.Lean, lines 165–166
have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 165–166 at
e2362ca10626↗poly_log_lt_eq.hlhave(0 : ℝ) < Real.log (↑k : ℝ)Leaves
A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withhl : (0 : ℝ) < Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Real.log_pos.Lean, line 168
have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 168 at
e2362ca10626↗poly_log_lt_eq.hphave(0 : ℝ) ≤ (↑k : ℝ) ^ ttLeaves
A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withhp : (0 : ℝ) ≤ (↑k : ℝ) ^ tt.Uses library
Real.rpow_nonneg,Nat.cast_nonnegSpecialisation ofNat.cast_nonneg', which seems to be easier for Lean to use. .Lean, line 169
have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 169 at
e2362ca10626↗poly_log_lt_eq.ehaveA * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ = A * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ) / Real.log (↑k : ℝ)routine: field_simpLeaves
A * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withe : A * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ = A * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ) / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 171–172
have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by field_simptargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 171–172 at
e2362ca10626↗
konyagin_finishhave∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → ∀ (C : ℝ), C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withkonyagin_finish : ∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → ∀ (C : ℝ), C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. .Lean, lines 175–183
have konyagin_finish : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (C : ℝ) (hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)) (hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro k n hk1 C hbhp hcard clear * - exists_far_prime k n hk1 C hbhp hcard obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp) refine ⟨p, hp, hpk, ?_, hdvd⟩ have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _ linarithtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 175–183 at
e2362ca10626↗konyagin_finish.s1obtain∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withp : ℕ,hp : Nat.Prime p,hpk : (↑k : ℝ) < (↑p : ℝ),hpb : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta,hdvd : (↑p : ℤ) ∣ Pprod k n.Uses library
lt_of_lt_of_le.Lean, line 180
obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 180 at
e2362ca10626↗konyagin_finish.thishave(0 : ℝ) ≤ (↑k : ℝ) ^ thetaLeaves
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta, withthis : (0 : ℝ) ≤ (↑k : ℝ) ^ theta.Uses library
Real.rpow_nonneg.Lean, line 182
have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 182 at
e2362ca10626↗
med_rhs_lehave∀ (C : ℝ), (0 : ℝ) < C → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withmed_rhs_le : ∀ (C : ℝ), (0 : ℝ) < C → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. ,Max.maxReturns the greater of its two arguments. .Lean, lines 185–206
have med_rhs_le : ∀ (C : ℝ) (hC : 0 < C), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → g_med k ≤ C * (k : ℝ) ^ theta / Real.log k := by intro C hC clear * - poly_log_lt poly_log_lt_eq theta_pos theta_lt_one C hC -- Apply `poly_log_lt` three times to get each term's bound, then combine them. have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop; have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ] have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ]; obtain ⟨a1, h1'⟩ := h1 obtain ⟨a2, h2'⟩ := h2 obtain ⟨a3, h3'⟩ := h3 refine ⟨max a1 (max a2 a3), fun k hk => ?_⟩ have x1 := h1' k (le_trans (le_max_left _ _) hk) have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk) have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk) simp only [g_med] have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring linarithtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 185–206 at
e2362ca10626↗med_rhs_le.h1have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh1 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 189–190
have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 189–190 at
e2362ca10626↗med_rhs_le.h1.thishave∀ᶠ (k : ℕ) in Filter.atTop, (3 : ℝ) * (↑k : ℝ) ^ (0 : ℝ) * Real.log (↑k : ℝ) ^ (0 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withthis : ∀ᶠ (k : ℕ) in Filter.atTop, (3 : ℝ) * (↑k : ℝ) ^ (0 : ℝ) * Real.log (↑k : ℝ) ^ (0 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 190
have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 190 at
e2362ca10626↗
med_rhs_le.h2have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh2 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop.Lean, lines 191–193
have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ]targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 191–193 at
e2362ca10626↗med_rhs_le.h3have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh3 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop.Lean, lines 194–196
have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ];targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 194–196 at
e2362ca10626↗med_rhs_le.s4obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha1 : ℕ,h1' : ∀ (k : ℕ), a1 ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 197
obtain ⟨a1, h1'⟩ := h1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 197 at
e2362ca10626↗med_rhs_le.s5obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha2 : ℕ,h2' : ∀ (k : ℕ), a2 ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 198
obtain ⟨a2, h2'⟩ := h2
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 198 at
e2362ca10626↗med_rhs_le.s6obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha3 : ℕ,h3' : ∀ (k : ℕ), a3 ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 199
obtain ⟨a3, h3'⟩ := h3
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 199 at
e2362ca10626↗med_rhs_le.x1have(3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx1 : (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left.Lean, line 201
have x1 := h1' k (le_trans (le_max_left _ _) hk)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 201 at
e2362ca10626↗med_rhs_le.x2have(56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx2 : (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left,le_max_right.Lean, line 202
have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 202 at
e2362ca10626↗med_rhs_le.x3have(↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx3 : (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right.Lean, line 203
have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 203 at
e2362ca10626↗med_rhs_le.ehaveC * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) = (3 : ℝ) * (C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ))routine: ringLeaves
(3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) + (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withe : C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) = (3 : ℝ) * (C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, line 205
have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 205 at
e2362ca10626↗
med_card_boundhave∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med kLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withmed_card_bound : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. .Lean, lines 209–222
have med_card_bound : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ((badSet k n).card : ℝ) < g_med k := by obtain ⟨k₀, hk₀⟩ := h_count refine ⟨k₀, fun k hk n h1 h2 => ?_⟩ have hc := hk₀ k hk n h1 h2 have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by simp only [badSet] apply Finset.filter_congr intro x hx rw [Finset.mem_Ioo] at hx exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩ rw [e] exact hctargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 209–222 at
e2362ca10626↗med_card_bound.s1obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k, withk₀ : ℕ,hk₀ : ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Lean, line 210
obtain ⟨k₀, hk₀⟩ := h_count
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 210 at
e2362ca10626↗med_card_bound.hchave(↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)Leaves
(↑(badSet k n).card : ℝ) < g_med k, withhc : (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Lean, line 212
have hc := hk₀ k hk n h1 h2
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 212 at
e2362ca10626↗med_card_bound.ehavebadSet k n = {m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)}Leaves
(↑(badSet k n).card : ℝ) < g_med k, withe : badSet k n = {m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)}.Uses library
Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,roundround xroundsxto the nearest integer, breaking ties towards positive infinity. ,Finset.filter_congr,Finset.mem_Ioo,Iff.introIfa → bandb → athenaandbare equivalent. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 213–220
have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by simp only [badSet] apply Finset.filter_congr intro x hx rw [Finset.mem_Ioo] at hx exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 213–220 at
e2362ca10626↗
case_mediumhaveBHP → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withcase_medium : BHP → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. ,Max.maxReturns the greater of its two arguments. .Lean, lines 223–245
have case_medium : ∀ (hB : BHP), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro hB clear * - med_card_bound med_rhs_le konyagin_finish hB obtain ⟨C, hC, kb, hb⟩ := hB obtain ⟨k1, hk1card⟩ := med_card_bound obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC refine ⟨max (max kb k1) (max k2 2), ?_⟩ intro k hk n hlow hhigh have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk have hk1 : 1 ≤ k := by omega have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by exact hb k hkb have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k := lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2) exact konyagin_finish k n hk1 C hbhp hcardtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 223–245 at
e2362ca10626↗case_medium.s1obtainBHPLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withC : ℝ,hC : (0 : ℝ) < C,kb : ℕ,hb : ∀ (k : ℕ), kb ≤ k → C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ).Lean, line 230
obtain ⟨C, hC, kb, hb⟩ := hB
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 230 at
e2362ca10626↗case_medium.s2obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med kLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withk1 : ℕ,hk1card : ∀ (k : ℕ), k1 ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k.Lean, line 231
obtain ⟨k1, hk1card⟩ := med_card_bound
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 231 at
e2362ca10626↗case_medium.s3obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withk2 : ℕ,hk2rhs : ∀ (k : ℕ), k2 ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 232
obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 232 at
e2362ca10626↗case_medium.hkbhavekb ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhkb : kb ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left.Lean, line 235
have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 235 at
e2362ca10626↗case_medium.hki1havek1 ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhki1 : k1 ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right,le_max_left.Lean, line 236
have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 236 at
e2362ca10626↗case_medium.hki2havek2 ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhki2 : k2 ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left,le_max_right.Lean, line 237
have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 237 at
e2362ca10626↗case_medium.hk2lehave(2 : ℕ) ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhk2le : (2 : ℕ) ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right.Lean, line 238
have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 238 at
e2362ca10626↗case_medium.hk1have(1 : ℕ) ≤ kroutine: omegaLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhk1 : (1 : ℕ) ≤ k.Lean, line 239
have hk1 : 1 ≤ k := by omega
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 239 at
e2362ca10626↗case_medium.hbhphaveC * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ)Leaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhbhp : C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 240–242
have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by exact hb k hkbtargets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 240–242 at
e2362ca10626↗case_medium.hcardhave(↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhcard : (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,lt_of_lt_of_le.Lean, lines 243–244
have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k := lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2)targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, lines 243–244 at
e2362ca10626↗
s15obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withk₀ : ℕ,hk₀ : ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Lean, line 247
obtain ⟨k₀, hk₀⟩ := case_medium hB0
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 247 at
e2362ca10626↗closeterm∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ))Closes the goal.
Uses library
Exists.introExistential introduction. .Lean, line 248
exact ⟨k₀, hk₀⟩
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, line 248 at
e2362ca10626↗
The proof in Lean (Proof.lean)
Checked by the kernel — these bytes are the ones its attestation names: attestations/000553.json, merge commit e2362ca10626.
artifact_hash of the attestation below, so these are the bytes the gate checked. Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Proof.lean, sha256 3d61e4edce58.import Mathlib
import Nodes.«erdos-1094--h2--h2--h2--h2».Context
open scoped Nat
/-! Hole `h_medium` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_1094__h2__h2__h2__h2 : (¬∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)) ∨
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
∀ (n : ℤ),
(1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) →
(↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) →
∃ (p : ℕ),
Nat.Prime p ∧
(↑k : ℝ) < (↑p : ℝ) ∧
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧
(↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)) := by
have h_count : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2 : ℝ) * (k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
(((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ (21 / 40 : ℝ)⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ (21 / 40 : ℝ) ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - (21 / 40 : ℝ)))).card : ℝ) <
3 + 56 * (k : ℝ) ^ (2 * (21 / 40 : ℝ) - 1) + (k : ℝ) ^ (21 / 40 : ℝ) * (Real.log k) ^ (-(2 : ℝ)) :=
erdos_1094__h2__h2__h2__h2__h1
by_cases hB0 : ∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)
swap
· exact Or.inl hB0
refine Or.inr ?_
let Pprod := fun (k : ℕ) (n : ℤ) => ((∏ i ∈ Finset.Icc 1 k, (n - (i : ℤ))) : ℤ)
let theta : ℝ := 21 / 40
let primeCard := fun (a b : ℝ) => ((((Finset.Ioo ⌊a⌋ ⌈b⌉).filter
(fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ a < (p : ℝ) ∧ (p : ℝ) < b)).card) : ℕ)
have theta_pos : (0 : ℝ) < theta := by
clear * -
simp only [theta]; norm_num
have theta_lt_one : theta < 1 := by
clear * -
simp only [theta]; norm_num
have dvd_Pprod_of_factor : ∀ (k : ℕ) (n : ℤ) (p : ℤ) (i : ℕ) (hi : i ∈ Finset.Icc 1 k) (hp : p ∣ (n - (i : ℤ))), p ∣ Pprod k n := by
intro k n p i hi hp
clear * - k n p i hi hp
simp only [Pprod]
exact hp.trans (Finset.dvd_prod_of_mem (fun i : ℕ => (n - (i : ℤ))) hi)
have dvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ) (hk1 : 1 ≤ k) (hp0 : 0 < p) (hkp : (k : ℝ) < p) (hpk : (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta) (hfar : 1 / (k : ℝ) ^ (1 - theta) ≤ |(n : ℝ) / (p : ℝ) - round ((n : ℝ) / (p : ℝ))|), (p : ℤ) ∣ Pprod k n := by
intro k n p hk1 hp0 hkp hpk hfar
clear * - dvd_Pprod_of_factor theta_pos theta_lt_one k n p hk1 hp0 hkp hpk hfar
-- Set `i := n % (p : ℤ)` and `j := i.toNat`.
set i := n % (p : ℤ)
set j := i.toNat
have hj : (j : ℤ) = i := by
exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity;
-- From `hfar`, we have `(p:ℝ)/(k:ℝ)^(1-theta) ≤ (min i (p-i) : ℝ)`.
have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by
have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by
have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by
rw [ Int.fract_eq_iff ];
field_simp;
norm_cast;
exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩;
rw [ ← h_frac, abs_sub_round_eq_min ];
have hp' : (0:ℝ) < p := by exact_mod_cast hp0
have h1 := mul_le_mul_of_nonneg_left hfar hp'.le
rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1
have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp
have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp
rw [e1, e2] at h1
calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring
_ ≤ _ := h1
-- So `1 ≤ i ≤ k`.
have h_i_bounds : 1 ≤ i ∧ i ≤ k := by
have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by
rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *;
· rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ];
grind +extAll;
· positivity;
constructor <;> norm_num at *;
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] );
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );
convert dvd_Pprod_of_factor k n ( p : ℤ ) j _ _ using 1;
· grind;
· exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩
let badSet := fun (k : ℕ) (n : ℤ) => (((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta))) : Finset ℤ)
have exists_far_prime : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (hcount : ((badSet k n).card : ℝ) < (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by
intro k n hk1 hcount
clear * - dvd_from_far k n hk1 hcount
by_contra hne
push_neg at hne
have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by
intro p hp
rw [Finset.mem_filter] at hp
obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp
have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le
have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq]
simp only [badSet, Finset.mem_filter, Finset.mem_Ioo]
refine ⟨⟨?_, ?_⟩, hpb, ?_⟩
· exact_mod_cast hkp
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2
have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by
rw [Int.ceil_le]; push_cast
linarith [Int.lt_floor_add_one ((k:ℝ)^theta)]
omega
· by_contra hfar
push_neg at hfar
apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb)
exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)
have hc := Finset.card_le_card hsub
have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc
have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2
linarith
have tendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ) (hc : 0 < c), Filter.Tendsto (fun x : ℝ => (Real.log x) ^ b * x ^ (-c)) Filter.atTop (nhds 0) := by
intro b c hc
clear * - b c hc
-- Use the fact that `Real.log x ^ b` is little-o of `x ^ c` as `x` tends to infinity.
have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) :=
isLittleO_log_rpow_rpow_atTop b hc
convert h_log.tendsto_div_nhds_zero.congr' _ using 1;
filter_upwards [ Filter.eventually_gt_atTop 0 ] with x hx using by rw [ div_eq_mul_inv, Real.rpow_neg hx.le ] ;
have poly_log_lt : ∀ (A α β tt : ℝ) (hα : α < tt) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ α * (Real.log k) ^ β ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A α β tt hα C hC
clear * - tendsto_log_rpow_mul_rpow_neg A α β tt hα C hC
-- Let's choose any $C > 0$ and derive a contradiction.
have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by
-- Simplify the expression inside the limit.
suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by
refine h_simp.congr' ?_;
filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf;
rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring;
have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_;
· convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring;
· linarith;
filter_upwards [ h_lim.eventually ( gt_mem_nhds hC ), Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
rw [ div_lt_iff₀ ( div_pos ( Real.rpow_pos_of_pos ( Nat.cast_pos.mpr hk₂.le ) _ ) ( Real.log_pos ( Nat.one_lt_cast.mpr hk₂ ) ) ) ] at hk₁ ; ring_nf at hk₁ ⊢ ; linarith
have poly_log_lt_eq : ∀ (A tt : ℝ) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ tt * (Real.log k) ^ (-(2 : ℝ)) ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A tt C hC
clear * - A tt C hC
-- We'll use that $A \leq C \cdot \log k$ for sufficiently large $k$.
have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by
exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩;
filter_upwards [ h_log_bound, Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂)
have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _
rw [Real.rpow_neg hl.le, Real.rpow_two]
have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by
field_simp
rw [e, div_le_div_iff_of_pos_right hl, div_le_iff₀ hl]
nlinarith [mul_le_mul_of_nonneg_right hk₁ hp]
have konyagin_finish : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (C : ℝ) (hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)) (hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro k n hk1 C hbhp hcard
clear * - exists_far_prime k n hk1 C hbhp hcard
obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp)
refine ⟨p, hp, hpk, ?_, hdvd⟩
have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _
linarith
let g_med := fun (k : ℕ) => ((3 + 56 * (k : ℝ) ^ (2 * theta - 1) + (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ))) : ℝ)
have med_rhs_le : ∀ (C : ℝ) (hC : 0 < C), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → g_med k ≤ C * (k : ℝ) ^ theta / Real.log k := by
intro C hC
clear * - poly_log_lt poly_log_lt_eq theta_pos theta_lt_one C hC
-- Apply `poly_log_lt` three times to get each term's bound, then combine them.
have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;
have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ]
have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ];
obtain ⟨a1, h1'⟩ := h1
obtain ⟨a2, h2'⟩ := h2
obtain ⟨a3, h3'⟩ := h3
refine ⟨max a1 (max a2 a3), fun k hk => ?_⟩
have x1 := h1' k (le_trans (le_max_left _ _) hk)
have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk)
have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk)
simp only [g_med]
have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring
linarith
let BHP : Prop := ∃ C : ℝ, 0 < C ∧ ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k →
C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)
have med_card_bound : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ((badSet k n).card : ℝ) < g_med k := by
obtain ⟨k₀, hk₀⟩ := h_count
refine ⟨k₀, fun k hk n h1 h2 => ?_⟩
have hc := hk₀ k hk n h1 h2
have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by
simp only [badSet]
apply Finset.filter_congr
intro x hx
rw [Finset.mem_Ioo] at hx
exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩
rw [e]
exact hc
have case_medium : ∀ (hB : BHP), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro hB
clear * - med_card_bound med_rhs_le konyagin_finish hB
obtain ⟨C, hC, kb, hb⟩ := hB
obtain ⟨k1, hk1card⟩ := med_card_bound
obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC
refine ⟨max (max kb k1) (max k2 2), ?_⟩
intro k hk n hlow hhigh
have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk
have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk
have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk
have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk
have hk1 : 1 ≤ k := by omega
have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by
exact hb k hkb
have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k :=
lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2)
exact konyagin_finish k n hk1 C hbhp hcard
obtain ⟨k₀, hk₀⟩ := case_medium hB0
exact ⟨k₀, hk₀⟩How it was split
Proved from this hole by 20261014T181000Z-t1014-r-partial.lean (merged in 806f1f948eb3, attestation 000526).
h_count→ erdos-1094--h2--h2--h2--h2--h1 (proved)$\displaystyle \exists k_0\in\mathbb{N}\ \forall k\ge k_0\ \forall n\in\mathbb{Z}:\ \ \tfrac12\,k^{2-21/40}<n\le\frac{k^2}{(\log k)^2}\ \Longrightarrow\ \#\Bigl\{m\in\mathbb{Z}:\ k<m<k+k^{21/40},\ \Bigl|\frac{n}{m}-\operatorname{round}\!\Bigl(\frac{n}{m}\Bigr)\Bigr|<\frac{1}{k^{1-21/40}}\Bigr\}<3+56\,k^{2\cdot 21/40-1}+\frac{k^{21/40}}{(\log k)^{2}}$
Read the partial proof (Lean)
theorem erdos_1094__h2__h2__h2__h2 : (¬∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)) ∨
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
∀ (n : ℤ),
(1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) →
(↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) →
∃ (p : ℕ),
Nat.Prime p ∧
(↑k : ℝ) < (↑p : ℝ) ∧
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧
(↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)) := by
have h_count : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2 : ℝ) * (k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
(((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ (21 / 40 : ℝ)⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ (21 / 40 : ℝ) ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - (21 / 40 : ℝ)))).card : ℝ) <
3 + 56 * (k : ℝ) ^ (2 * (21 / 40 : ℝ) - 1) + (k : ℝ) ^ (21 / 40 : ℝ) * (Real.log k) ^ (-(2 : ℝ)) := by
sorry
by_cases hB0 : ∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)
swap
· exact Or.inl hB0
refine Or.inr ?_
let Pprod := fun (k : ℕ) (n : ℤ) => ((∏ i ∈ Finset.Icc 1 k, (n - (i : ℤ))) : ℤ)
let theta : ℝ := 21 / 40
let primeCard := fun (a b : ℝ) => ((((Finset.Ioo ⌊a⌋ ⌈b⌉).filter
(fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ a < (p : ℝ) ∧ (p : ℝ) < b)).card) : ℕ)
have theta_pos : (0 : ℝ) < theta := by
clear * -
simp only [theta]; norm_num
have theta_lt_one : theta < 1 := by
clear * -
simp only [theta]; norm_num
have dvd_Pprod_of_factor : ∀ (k : ℕ) (n : ℤ) (p : ℤ) (i : ℕ) (hi : i ∈ Finset.Icc 1 k) (hp : p ∣ (n - (i : ℤ))), p ∣ Pprod k n := by
intro k n p i hi hp
clear * - k n p i hi hp
simp only [Pprod]
exact hp.trans (Finset.dvd_prod_of_mem (fun i : ℕ => (n - (i : ℤ))) hi)
have dvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ) (hk1 : 1 ≤ k) (hp0 : 0 < p) (hkp : (k : ℝ) < p) (hpk : (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta) (hfar : 1 / (k : ℝ) ^ (1 - theta) ≤ |(n : ℝ) / (p : ℝ) - round ((n : ℝ) / (p : ℝ))|), (p : ℤ) ∣ Pprod k n := by
intro k n p hk1 hp0 hkp hpk hfar
clear * - dvd_Pprod_of_factor theta_pos theta_lt_one k n p hk1 hp0 hkp hpk hfar
-- Set `i := n % (p : ℤ)` and `j := i.toNat`.
set i := n % (p : ℤ)
set j := i.toNat
have hj : (j : ℤ) = i := by
exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity;
-- From `hfar`, we have `(p:ℝ)/(k:ℝ)^(1-theta) ≤ (min i (p-i) : ℝ)`.
have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by
have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by
have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by
rw [ Int.fract_eq_iff ];
field_simp;
norm_cast;
exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩;
rw [ ← h_frac, abs_sub_round_eq_min ];
have hp' : (0:ℝ) < p := by exact_mod_cast hp0
have h1 := mul_le_mul_of_nonneg_left hfar hp'.le
rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1
have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp
have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp
rw [e1, e2] at h1
calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring
_ ≤ _ := h1
-- So `1 ≤ i ≤ k`.
have h_i_bounds : 1 ≤ i ∧ i ≤ k := by
have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by
rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *;
· rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ];
grind +extAll;
· positivity;
constructor <;> norm_num at *;
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] );
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );
convert dvd_Pprod_of_factor k n ( p : ℤ ) j _ _ using 1;
· grind;
· exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩
let badSet := fun (k : ℕ) (n : ℤ) => (((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta))) : Finset ℤ)
have exists_far_prime : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (hcount : ((badSet k n).card : ℝ) < (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by
intro k n hk1 hcount
clear * - dvd_from_far k n hk1 hcount
by_contra hne
push_neg at hne
have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by
intro p hp
rw [Finset.mem_filter] at hp
obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp
have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le
have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq]
simp only [badSet, Finset.mem_filter, Finset.mem_Ioo]
refine ⟨⟨?_, ?_⟩, hpb, ?_⟩
· exact_mod_cast hkp
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2
have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by
rw [Int.ceil_le]; push_cast
linarith [Int.lt_floor_add_one ((k:ℝ)^theta)]
omega
· by_contra hfar
push_neg at hfar
apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb)
exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)
have hc := Finset.card_le_card hsub
have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc
have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2
linarith
have tendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ) (hc : 0 < c), Filter.Tendsto (fun x : ℝ => (Real.log x) ^ b * x ^ (-c)) Filter.atTop (nhds 0) := by
intro b c hc
clear * - b c hc
-- Use the fact that `Real.log x ^ b` is little-o of `x ^ c` as `x` tends to infinity.
have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) :=
isLittleO_log_rpow_rpow_atTop b hc
convert h_log.tendsto_div_nhds_zero.congr' _ using 1;
filter_upwards [ Filter.eventually_gt_atTop 0 ] with x hx using by rw [ div_eq_mul_inv, Real.rpow_neg hx.le ] ;
have poly_log_lt : ∀ (A α β tt : ℝ) (hα : α < tt) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ α * (Real.log k) ^ β ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A α β tt hα C hC
clear * - tendsto_log_rpow_mul_rpow_neg A α β tt hα C hC
-- Let's choose any $C > 0$ and derive a contradiction.
have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by
-- Simplify the expression inside the limit.
suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by
refine h_simp.congr' ?_;
filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf;
rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring;
have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_;
· convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring;
· linarith;
filter_upwards [ h_lim.eventually ( gt_mem_nhds hC ), Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
rw [ div_lt_iff₀ ( div_pos ( Real.rpow_pos_of_pos ( Nat.cast_pos.mpr hk₂.le ) _ ) ( Real.log_pos ( Nat.one_lt_cast.mpr hk₂ ) ) ) ] at hk₁ ; ring_nf at hk₁ ⊢ ; linarith
have poly_log_lt_eq : ∀ (A tt : ℝ) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ tt * (Real.log k) ^ (-(2 : ℝ)) ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A tt C hC
clear * - A tt C hC
-- We'll use that $A \leq C \cdot \log k$ for sufficiently large $k$.
have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by
exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩;
filter_upwards [ h_log_bound, Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂)
have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _
rw [Real.rpow_neg hl.le, Real.rpow_two]
have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by
field_simp
rw [e, div_le_div_iff_of_pos_right hl, div_le_iff₀ hl]
nlinarith [mul_le_mul_of_nonneg_right hk₁ hp]
have konyagin_finish : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (C : ℝ) (hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)) (hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro k n hk1 C hbhp hcard
clear * - exists_far_prime k n hk1 C hbhp hcard
obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp)
refine ⟨p, hp, hpk, ?_, hdvd⟩
have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _
linarith
let g_med := fun (k : ℕ) => ((3 + 56 * (k : ℝ) ^ (2 * theta - 1) + (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ))) : ℝ)
have med_rhs_le : ∀ (C : ℝ) (hC : 0 < C), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → g_med k ≤ C * (k : ℝ) ^ theta / Real.log k := by
intro C hC
clear * - poly_log_lt poly_log_lt_eq theta_pos theta_lt_one C hC
-- Apply `poly_log_lt` three times to get each term's bound, then combine them.
have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;
have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ]
have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ];
obtain ⟨a1, h1'⟩ := h1
obtain ⟨a2, h2'⟩ := h2
obtain ⟨a3, h3'⟩ := h3
refine ⟨max a1 (max a2 a3), fun k hk => ?_⟩
have x1 := h1' k (le_trans (le_max_left _ _) hk)
have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk)
have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk)
simp only [g_med]
have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring
linarith
let BHP : Prop := ∃ C : ℝ, 0 < C ∧ ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k →
C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)
have med_card_bound : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ((badSet k n).card : ℝ) < g_med k := by
obtain ⟨k₀, hk₀⟩ := h_count
refine ⟨k₀, fun k hk n h1 h2 => ?_⟩
have hc := hk₀ k hk n h1 h2
have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by
simp only [badSet]
apply Finset.filter_congr
intro x hx
rw [Finset.mem_Ioo] at hx
exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩
rw [e]
exact hc
have case_medium : ∀ (hB : BHP), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro hB
clear * - med_card_bound med_rhs_le konyagin_finish hB
obtain ⟨C, hC, kb, hb⟩ := hB
obtain ⟨k1, hk1card⟩ := med_card_bound
obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC
refine ⟨max (max kb k1) (max k2 2), ?_⟩
intro k hk n hlow hhigh
have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk
have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk
have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk
have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk
have hk1 : 1 ≤ k := by omega
have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by
exact hb k hkb
have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k :=
lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2)
exact konyagin_finish k n hk1 C hbhp hcard
obtain ⟨k₀, hk₀⟩ := case_medium hB0
exact ⟨k₀, hk₀⟩The gate replayed this file at its merge, each hole a sorry (D-12 #5); the whole file: targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/attempts/20261014T181000Z-t1014-r-partial.lean
What is known
Work on it
No explainer yet. This proof written as a journal would print it, labelled unverified, is the next thing a writer could add, by pull request (D-3, D-36; the guide shows how).
How to contribute → · Pull requests in flight ↗ · See it in the problem’s graph →
Record
Statement: the Lean file and its words (1 version)
Statement not audited — only a problem’s root statement is audited for fidelity (D-9); the kernel checks a proof against this Lean as written.
import Mathlib
import Nodes.«erdos-1094--h2--h2--h2--h2».Context
open scoped Nat
/-! Hole `h_medium` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_1094__h2__h2__h2__h2 : (¬∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)) ∨
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
∀ (n : ℤ),
(1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) →
(↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) →
∃ (p : ℕ),
Nat.Prime p ∧
(↑k : ℝ) < (↑p : ℝ) ∧
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧
(↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)) := by
sorryA statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →
In words, unverified — what this statement says; written by f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-10-18; no one has read it against the Lean and signed it.
Draft · drafted, by the model named above
$\displaystyle \neg\,\text{BHP}\ \ \lor\ \ \exists k_0\in\mathbb{N}\ \forall k\ge k_0\ \forall n\in\mathbb{Z}:\ \ \tfrac12\,k^{2-21/40}<n\le\frac{k^2}{(\log k)^2}\ \Longrightarrow\ \exists p\text{ prime},\ k<p<k+3k^{21/40},\ \ p\mid\prod_{i=1}^{k}(n-i)$
Either the Baker–Harman–Pintz short-interval prime count fails, or for all large $k$ and every integer $n$ with $\tfrac12 k^{2-21/40}<n\le k^2/(\log k)^2$, some prime $p$ in $(k,\,k+3k^{21/40})$ divides $(n-1)(n-2)\cdots(n-k)$. Here BHP is the Baker–Harman–Pintz short-interval prime count $\exists C>0\ \exists k_0\ \forall k\ge k_0:\ C\,k^{21/40}/\log k\le\#\{p\text{ prime}:k<p<k+k^{21/40}\}$, the primes counted as the integers of the interval $(\lfloor k\rfloor,\lceil k+k^{21/40}\rceil)$ that are positive, prime in absolute value and lie strictly between $k$ and $k+k^{21/40}$ over the reals. $n$ ranges over $\mathbb{Z}$ and the product $\prod_{i=1}^{k}(n-i)$ is taken in $\mathbb{Z}$; the bounds on $n$ and $p$ are over the reals with $21/40$ a real exponent, and $\log$ is the natural logarithm.
Rendered from gloss/4349cf1d2074….md · Improve these words →
Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/Statement.lean. Origin: skeleton-hole.
Depends on (1), each in words
Depends on, each in words where someone has written them:
- erdos-1094--h2--h2--h2--h2--h1: $\exists k_0\in\mathbb{N}\ \forall k\ge k_0\ \forall n\in\mathbb{Z}:\ \ \tfrac12\,k^{2-21/40}<n\le\frac{k^2}{(\log k)^2}\ \Longrightarrow\ \#\Bigl\{m\in\mathbb{Z}:\ k<m<k+k^{21/40},\ \Bigl|\frac{n}{m}-\operatorname{round}\!\Bigl(\frac{n}{m}\Bigr)\Bigr|<\frac{1}{k^{1-21/40}}\Bigr\}<3+56\,k^{2\cdot 21/40-1}+\frac{k^{21/40}}{(\log k)^{2}}$ · used by the proof
Attestation: pass, 7 of 7 checks
Checked by the kernel — the gate’s record of the run: attestations/000553.json, merge commit e2362ca10626.
Verdict pass, from attestations/000553.json.
- Submitter
t1015c-a13- Toolchain
- leanprover/lean4:v4.33.1 (hash
f54d0bc916bf76a7fae460ce9d078ccd1f74aeb4fd12c4b6546bca28b6aa1c63) - Mathlib
- 0df444a360eaa60ab8c11dca51a86af692955474
- Reviewer
- none needed (intermediate)
| Step | Check | Result |
|---|---|---|
| 1 | toolchain | pass |
| 2 | paths | pass |
| 4 | kernel-replay | pass |
| 5 | axioms | pass |
| 6 | hazards | pass |
| 7 | witness | pass |
| 8 | deps | pass |
Witness
Checked by the kernel — step 7 passed in the run its attestation records: attestations/000553.json, merge commit e2362ca10626.
1aa8a1c1b9f3.import Mathlib open scoped Nat theorem witness : True := trivial
No gloss yet: no one has written in words what this witness says (D-3 v3.30); the Lean above is the witness. How to write one →
Attempts (1)
1 recorded. Routes refuted: none. Failure classes: none.
Untrusted contributor text — a partial assembly: it records an attempt, not a proof; its attestation names the file, and no hash in the record binds these bytes.
Untrusted: partial assembly (D-12 #5), by t1014-r; merged in 806f1f948eb3 under attestations/000526.json, whose step 2 took this file as a partial. A partial records an attempt, not a proof: the gate replayed it with its holes left as sorry. Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h2/attempts/20261014T181000Z-t1014-r-partial.lean.
Untrusted contributor text — an outline the gate extracted from this partial assembly; its holes are sorry steps, and it records an attempt, not a proof.
Outline of 20261014T181000Z-t1014-r-partial.lean, extracted by the gate at 15d1d4647b94 from the proof’s elaboration: each step is a claim the proof establishes and the goal it leaves. Open a step for what it uses and its Lean lines.
h_counthole∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)holeLeaves
(¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ)) ∨ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withh_count : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,roundround xroundsxto the nearest integer, breaking ties towards positive infinity. .Left open as a hole; its statement is erdos-1094--h2--h2--h2--h2--h1 (proved).
Lean, lines 31–38
have h_count : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2 : ℝ) * (k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → (((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ (21 / 40 : ℝ)⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ (21 / 40 : ℝ) ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - (21 / 40 : ℝ)))).card : ℝ) < 3 + 56 * (k : ℝ) ^ (2 * (21 / 40 : ℝ) - 1) + (k : ℝ) ^ (21 / 40 : ℝ) * (Real.log k) ^ (-(2 : ℝ)) := by sorrys2caseLeaves
(¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ)) ∨ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withhB0 : ¬∃ (C : ℝ), (0 : ℝ) < C ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤ (↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card : ℝ).Uses library
Or.inlOr.inlis "left injection" into anOr. .Lean, line 51
· exact Or.inl hB0
theta_poshave(0 : ℝ) < thetaLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtheta_pos : (0 : ℝ) < theta.Lean, lines 57–59
have theta_pos : (0 : ℝ) < theta := by clear * - simp only [theta]; norm_numtheta_lt_onehavetheta < (1 : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtheta_lt_one : theta < (1 : ℝ).Lean, lines 60–62
have theta_lt_one : theta < 1 := by clear * - simp only [theta]; norm_numdvd_Pprod_of_factorhave∀ (k : ℕ) (n p : ℤ), ∀ i ∈ Finset.Icc (1 : ℕ) k, p ∣ n - (↑i : ℤ) → p ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withdvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ), ∀ i ∈ Finset.Icc (1 : ℕ) k, p ∣ n - (↑i : ℤ) → p ∣ Pprod k n.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.dvd_prod_of_mem.Lean, lines 63–67
have dvd_Pprod_of_factor : ∀ (k : ℕ) (n : ℤ) (p : ℤ) (i : ℕ) (hi : i ∈ Finset.Icc 1 k) (hp : p ∣ (n - (i : ℤ))), p ∣ Pprod k n := by intro k n p i hi hp clear * - k n p i hi hp simp only [Pprod] exact hp.trans (Finset.dvd_prod_of_mem (fun i : ℕ => (n - (i : ℤ))) hi)dvd_from_farhave∀ (k : ℕ) (n : ℤ) (p : ℕ), (1 : ℕ) ≤ k → (0 : ℕ) < p → (↑k : ℝ) < (↑p : ℝ) → (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta → (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| → (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withdvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ), (1 : ℕ) ≤ k → (0 : ℕ) < p → (↑k : ℝ) < (↑p : ℝ) → (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta → (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| → (↑p : ℤ) ∣ Pprod k n.Uses library
roundround xroundsxto the nearest integer, breaking ties towards positive infinity. .Lean, lines 68–105
have dvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ) (hk1 : 1 ≤ k) (hp0 : 0 < p) (hkp : (k : ℝ) < p) (hpk : (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta) (hfar : 1 / (k : ℝ) ^ (1 - theta) ≤ |(n : ℝ) / (p : ℝ) - round ((n : ℝ) / (p : ℝ))|), (p : ℤ) ∣ Pprod k n := by intro k n p hk1 hp0 hkp hpk hfar clear * - dvd_Pprod_of_factor theta_pos theta_lt_one k n p hk1 hp0 hkp hpk hfar -- Set `i := n % (p : ℤ)` and `j := i.toNat`. set i := n % (p : ℤ) set j := i.toNat have hj : (j : ℤ) = i := by exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity; -- From `hfar`, we have `(p:ℝ)/(k:ℝ)^(1-theta) ≤ (min i (p-i) : ℝ)`. have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ]; have hp' : (0:ℝ) < p := by exact_mod_cast hp0 have h1 := mul_le_mul_of_nonneg_left hfar hp'.le rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1 have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp rw [e1, e2] at h1 calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring _ ≤ _ := h1 -- So `1 ≤ i ≤ k`. have h_i_bounds : 1 ≤ i ∧ i ≤ k := by have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity; constructor <;> norm_num at *; · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] ); · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith ); convert dvd_Pprod_of_factor k n ( p : ℤ ) j _ _ using 1; · grind; · exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩dvd_from_far.hjhave(↑j : ℤ) = iLeaves
(↑p : ℤ) ∣ Pprod k n, withhj : (↑j : ℤ) = i.Uses library
Int.toNat_of_nonneg,Int.emod_nonneg.Lean, lines 74–75
have hj : (j : ℤ) = i := by exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity;dvd_from_far.h_frachave(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ))Leaves
(↑p : ℤ) ∣ Pprod k n, withh_frac : (↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)).Uses library
Min.minReturns the lesser of its two arguments. ,mul_min_of_nonneg.Lean, lines 77–92
have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ]; have hp' : (0:ℝ) < p := by exact_mod_cast hp0 have h1 := mul_le_mul_of_nonneg_left hfar hp'.le rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1 have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp rw [e1, e2] at h1 calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring _ ≤ _ := h1dvd_from_far.h_frac.h_frachave|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ))Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withh_frac : |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)).Uses library
roundround xroundsxto the nearest integer, breaking ties towards positive infinity. ,Min.minReturns the lesser of its two arguments. ,abs_sub_round_eq_min.Lean, lines 78–84
have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩; rw [ ← h_frac, abs_sub_round_eq_min ];dvd_from_far.h_frac.h_frac.h_frachaveInt.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑i : ℝ) / (↑p : ℝ)Leaves
|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| = min ((↑i : ℝ) / (↑p : ℝ)) ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)), withh_frac : Int.fract ((↑n : ℝ) / (↑p : ℝ)) = (↑i : ℝ) / (↑p : ℝ).Uses library
Int.fractInt.fract athe fractional part ofa, isaminus its floor. ,Int.fract_eq_iff,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,Int.emod_nonneg,Int.emod_lt_of_pos,Int.emod_add_mul_ediv.Lean, lines 79–83
have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by rw [ Int.fract_eq_iff ]; field_simp; norm_cast; exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩;
dvd_from_far.h_frac.hp'have(0 : ℝ) < (↑p : ℝ)Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withhp' : (0 : ℝ) < (↑p : ℝ).Lean, line 85
have hp' : (0:ℝ) < p := by exact_mod_cast hp0
dvd_from_far.h_frac.h1have(↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ (↑p : ℝ) * |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|Leaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withh1 : (↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ (↑p : ℝ) * |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|.Uses library
mul_le_mul_of_nonneg_left.Lean, line 86
have h1 := mul_le_mul_of_nonneg_left hfar hp'.le
dvd_from_far.h_frac.e1have(↑p : ℝ) * ((↑i : ℝ) / (↑p : ℝ)) = (↑i : ℝ)routine: field_simpLeaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withe1 : (↑p : ℝ) * ((↑i : ℝ) / (↑p : ℝ)) = (↑i : ℝ).Lean, line 88
have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp
dvd_from_far.h_frac.e2have(↑p : ℝ) * ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)) = (↑p : ℝ) - (↑i : ℝ)routine: field_simpLeaves
(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ)), withe2 : (↑p : ℝ) * ((1 : ℝ) - (↑i : ℝ) / (↑p : ℝ)) = (↑p : ℝ) - (↑i : ℝ).Lean, line 89
have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp
dvd_from_far.h_frac.s6calc(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) = (↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta))routine: ringCloses the goal.
Lean, line 91
calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring
dvd_from_far.h_frac.s7calc(↑p : ℝ) * ((1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)) ≤ min (↑i : ℝ) ((↑p : ℝ) - (↑i : ℝ))Closes the goal.
dvd_from_far.h_i_boundshave(1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ)Leaves
(↑p : ℤ) ∣ Pprod k n, withh_i_bounds : (1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ).Lean, lines 94–102
have h_i_bounds : 1 ≤ i ∧ i ≤ k := by have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity; constructor <;> norm_num at *; · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] ); · exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );dvd_from_far.h_i_bounds.h_i_boundshave(↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) > (↑k : ℝ) ^ thetaLeaves
(1 : ℤ) ≤ i ∧ i ≤ (↑k : ℤ), withh_i_bounds : (↑p : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta) > (↑k : ℝ) ^ theta.Uses library
gt_iff_lt,lt_div_iff₀Seelt_div_iff₀'for a version with multiplication on the other side. .Lean, lines 95–99
have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *; · rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll; · positivity;dvd_from_far.h_i_bounds.h_i_bounds.s1caseLeaves
(↑k : ℝ) ^ (21 / 40 : ℝ) * (↑k : ℝ) ^ (19 / 40 : ℝ) < (↑p : ℝ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ).Uses library
Real.rpow_add,Lean.Grind.Config.extAllIfextAllistrue,grinduses any extensionality theorems available in the environment. .Lean, lines 97–98
· rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ]; grind +extAll;dvd_from_far.h_i_bounds.h_i_bounds.s2case routine: positivityLeaves
(0 : ℝ) < (↑k : ℝ) ^ (19 / 40 : ℝ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ).
dvd_from_far.h_i_bounds.s2caseLeaves
(1 : ℤ) ≤ i, withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ),h_i_bounds : (↑k : ℝ) ^ (21 / 40 : ℝ) < (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ).Uses library
Int.le_of_lt_add_one,Int.cast_lt,Real.one_le_rpow,div_nonneg.Lean, line 101
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] );
dvd_from_far.h_i_bounds.s3caseLeaves
i ≤ (↑k : ℤ), withtheta_pos : True,theta_lt_one : True,dvd_Pprod_of_factor : ∀ (k : ℕ) (n p : ℤ) (i : ℕ), (1 : ℕ) ≤ i → i ≤ k → p ∣ n - (↑i : ℤ) → p ∣ Pprod k n,hkp : k < p,hpk : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ),hfar : ((↑k : ℝ) ^ (19 / 40 : ℝ))⁻¹ ≤ |(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)|,h_frac : (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑i : ℝ) ∧ (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ) ≤ (↑p : ℝ) - (↑i : ℝ),h_i_bounds : (↑k : ℝ) ^ (21 / 40 : ℝ) < (↑p : ℝ) / (↑k : ℝ) ^ (19 / 40 : ℝ).Uses library
Int.le_of_lt_add_one,Int.cast_lt.Lean, line 102
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );
dvd_from_far.s4caseLeaves
j ∈ Finset.Icc (1 : ℕ) k.dvd_from_far.s5caseLeaves
(↑p : ℤ) ∣ n - (↑j : ℤ).Uses library
Exists.introExistential introduction. ,Int.emod_add_mul_ediv.Lean, line 105
· exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩
exists_far_primehave∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → (↑(badSet k n).card : ℝ) < (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withexists_far_prime : ∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → (↑(badSet k n).card : ℝ) < (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Lean, lines 109–135
have exists_far_prime : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (hcount : ((badSet k n).card : ℝ) < (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro k n hk1 hcount clear * - dvd_from_far k n hk1 hcount by_contra hne push_neg at hne have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by intro p hp rw [Finset.mem_filter] at hp obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq] simp only [badSet, Finset.mem_filter, Finset.mem_Ioo] refine ⟨⟨?_, ?_⟩, hpb, ?_⟩ · exact_mod_cast hkp · have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omega · by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar) have hc := Finset.card_le_card hsub have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2 linarithexists_far_prime.hsubhave{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta} ⊆ badSet k nLeaves
False, withhsub : {p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta} ⊆ badSet k n.Uses library
Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,Finset.mem_filter,Finset.mem_Ioo,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 114–131
have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by intro p hp rw [Finset.mem_filter] at hp obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq] simp only [badSet, Finset.mem_filter, Finset.mem_Ioo] refine ⟨⟨?_, ?_⟩, hpb, ?_⟩ · exact_mod_cast hkp · have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omega · by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)exists_far_prime.hsub.s1obtainp ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ∧ (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ thetaLeaves
p ∈ badSet k n, withhpI : p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉,hp0 : (0 : ℤ) < p,hpr : Nat.Prime p.natAbs,hkp : (↑k : ℝ) < (↑p : ℝ),hpb : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta.Lean, line 117
obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp
exists_far_prime.hsub.hqhave(↑p.natAbs : ℤ) = pLeaves
p ∈ badSet k n, withhq : (↑p.natAbs : ℤ) = p.Uses library
Int.natAbs_of_nonneg.Lean, line 118
have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le
exists_far_prime.hsub.hqRhave(↑p.natAbs : ℝ) = (↑p : ℝ)Leaves
p ∈ badSet k n, withhqR : (↑p.natAbs : ℝ) = (↑p : ℝ).Uses library
Int.cast_natCast.Lean, line 119
have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq]
exists_far_prime.hsub.s4caseLeaves
(↑k : ℤ) < p.Lean, line 122
· exact_mod_cast hkp
exists_far_prime.hsub.s5caseLeaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ).Lean, lines 123–127
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2 have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)] omegaexists_far_prime.hsub.s5.h1havep < ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉Leaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ), withh1 : p < ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉.Uses library
Finset.mem_Ioo.Lean, line 123
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2
exists_far_prime.hsub.s5.h2have⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ≤ (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (1 : ℤ)Leaves
p < (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ), withh2 : ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ ≤ (↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (1 : ℤ).Uses library
Int.ceil_le,Int.lt_floor_add_one.Lean, lines 124–126
have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by rw [Int.ceil_le]; push_cast linarith [Int.lt_floor_add_one ((k:ℝ)^theta)]
exists_far_prime.hsub.s6caseLeaves
|(↑n : ℝ) / (↑p : ℝ) - (↑(round ((↑n : ℝ) / (↑p : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta).Lean, lines 128–131
· by_contra hfar push_neg at hfar apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)
exists_far_prime.hchave{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta}.card ≤ (badSet k n).cardLeaves
False, withhc : {p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ theta⌉ | (0 : ℤ) < p ∧ Nat.Prime p.natAbs ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta}.card ≤ (badSet k n).card.Uses library
Finset.card_le_card.Lean, line 132
have hc := Finset.card_le_card hsub
exists_far_prime.hc2haveprimeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta) ≤ (badSet k n).cardLeaves
False, withhc2 : primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta) ≤ (badSet k n).card.Lean, line 133
have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc
exists_far_prime.hc'have(↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) ≤ (↑(badSet k n).card : ℝ)Leaves
False, withhc' : (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) ≤ (↑(badSet k n).card : ℝ).Lean, line 134
have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2
tendsto_log_rpow_mul_rpow_neghave∀ (b c : ℝ), (0 : ℝ) < c → Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ))Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withtendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ), (0 : ℝ) < c → Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. ,Filter.eventually_gt_atTop,div_eq_mul_invDividing by an element is the same as multiplying by its inverse. ,Real.rpow_negSee alsorpow_neg_eq_inv_rpowfor a version withx⁻¹ ^ yin the RHS. .Lean, lines 136–143
have tendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ) (hc : 0 < c), Filter.Tendsto (fun x : ℝ => (Real.log x) ^ b * x ^ (-c)) Filter.atTop (nhds 0) := by intro b c hc clear * - b c hc -- Use the fact that `Real.log x ^ b` is little-o of `x ^ c` as `x` tends to infinity. have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) := isLittleO_log_rpow_rpow_atTop b hc convert h_log.tendsto_div_nhds_zero.congr' _ using 1; filter_upwards [ Filter.eventually_gt_atTop 0 ] with x hx using by rw [ div_eq_mul_inv, Real.rpow_neg hx.le ] ;tendsto_log_rpow_mul_rpow_neg.h_loghave(fun (x : ℝ) => Real.log x ^ b) =o[Filter.atTop] fun (x : ℝ) => x ^ cLeaves
Filter.Tendsto (fun (x : ℝ) => Real.log x ^ b * x ^ (-c)) Filter.atTop (nhds (0 : ℝ)), withh_log : (fun (x : ℝ) => Real.log x ^ b) =o[Filter.atTop] fun (x : ℝ) => x ^ c.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,isLittleO_log_rpow_rpow_atTop.Lean, lines 140–141
have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) := isLittleO_log_rpow_rpow_atTop b hc
poly_log_lthave∀ (A α β tt : ℝ), α < tt → ∀ (C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withpoly_log_lt : ∀ (A α β tt : ℝ), α < tt → ∀ (C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,gt_mem_nhds,Filter.eventually_gt_atTop,div_lt_iff₀Seediv_lt_iff₀'for a version with multiplication on the other side. ,div_pos,Real.rpow_pos_of_pos,Nat.cast_posSpecialisation ofNat.cast_pos', which seems to be easier for Lean to use. ,Real.log_pos,Nat.one_lt_cast.Lean, lines 144–159
have poly_log_lt : ∀ (A α β tt : ℝ) (hα : α < tt) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop, A * (k : ℝ) ^ α * (Real.log k) ^ β ≤ C * (k : ℝ) ^ tt / Real.log k := by intro A α β tt hα C hC clear * - tendsto_log_rpow_mul_rpow_neg A α β tt hα C hC -- Let's choose any $C > 0$ and derive a contradiction. have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by -- Simplify the expression inside the limit. suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring; have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_; · convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring; · linarith; filter_upwards [ h_lim.eventually ( gt_mem_nhds hC ), Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂; rw [ div_lt_iff₀ ( div_pos ( Real.rpow_pos_of_pos ( Nat.cast_pos.mpr hk₂.le ) _ ) ( Real.log_pos ( Nat.one_lt_cast.mpr hk₂ ) ) ) ] at hk₁ ; ring_nf at hk₁ ⊢ ; linarithpoly_log_lt.h_limhaveFilter.Tendsto (fun (k : ℕ) => A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β / ((↑k : ℝ) ^ tt / Real.log (↑k : ℝ))) Filter.atTop (nhds (0 : ℝ))Leaves
∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withh_lim : Filter.Tendsto (fun (k : ℕ) => A * (↑k : ℝ) ^ α * Real.log (↑k : ℝ) ^ β / ((↑k : ℝ) ^ tt / Real.log (↑k : ℝ))) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. .Lean, lines 149–157
have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by -- Simplify the expression inside the limit. suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring; have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_; · convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring; · linarith;poly_log_lt.h_lim.h_simpsufficesFilter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ))Leaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.TendstoFilter.Tendstois the generic "limit of a function" predicate. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,nhdsA set is called a neighborhood ofxif it contains an open set aroundx. ,Filter.eventually_gt_atTop,Real.rpow_sub,Real.rpow_add,Real.log_pos,Nat.one_lt_cast,Real.rpow_one.Lean, lines 151–154
suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by refine h_simp.congr' ?_; filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf; rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring;poly_log_lt.h_lim.thishaveFilter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ))Leaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)), withthis : Filter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ)).Lean, line 155
have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_;
poly_log_lt.h_lim.s3caseLeaves
Filter.Tendsto (fun (k : ℕ) => A * Real.log (↑k : ℝ) ^ (β + (1 : ℝ)) * (↑k : ℝ) ^ (α - tt)) Filter.atTop (nhds (0 : ℝ)), withthis : Filter.Tendsto (fun (x : ℝ) => Real.log x ^ (β + (1 : ℝ)) * x ^ (-(tt - α))) Filter.atTop (nhds (0 : ℝ)).Uses library
Filter.Tendsto.comp,tendsto_natCast_atTop_atTop.Lean, line 156
· convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring;
poly_log_lt.h_lim.s4case routine: linarithLeaves
(0 : ℝ) < tt - α.
poly_log_lt_eqhave∀ (A tt C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withpoly_log_lt_eq : ∀ (A tt C : ℝ), (0 : ℝ) < C → ∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_gt_atTop,Real.rpow_negSee alsorpow_neg_eq_inv_rpowfor a version withx⁻¹ ^ yin the RHS. ,Real.rpow_two,div_le_div_iff_of_pos_right,div_le_iff₀Seediv_le_iff₀'for a version with multiplication on the other side. ,mul_le_mul_of_nonneg_right.Lean, lines 160–174
have poly_log_lt_eq : ∀ (A tt : ℝ) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop, A * (k : ℝ) ^ tt * (Real.log k) ^ (-(2 : ℝ)) ≤ C * (k : ℝ) ^ tt / Real.log k := by intro A tt C hC clear * - A tt C hC -- We'll use that $A \leq C \cdot \log k$ for sufficiently large $k$. have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩; filter_upwards [ h_log_bound, Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂; have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂) have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _ rw [Real.rpow_neg hl.le, Real.rpow_two] have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by field_simp rw [e, div_le_div_iff_of_pos_right hl, div_le_iff₀ hl] nlinarith [mul_le_mul_of_nonneg_right hk₁ hp]poly_log_lt_eq.h_log_boundhave∀ᶠ (k : ℕ) in Filter.atTop, A ≤ C * Real.log (↑k : ℝ)Leaves
∀ᶠ (k : ℕ) in Filter.atTop, A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withh_log_bound : ∀ᶠ (k : ℕ) in Filter.atTop, A ≤ C * Real.log (↑k : ℝ).Uses library
Filter.atTopatTopis the filter representing the limit→ ∞on an ordered set. ,Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop,Exists.introExistential introduction. ,Real.expThe real exponential function, defined as the real part of the complex exponential ,Nat.le_ceil,Real.log_exp,Real.log_le_log,le_of_lt,Nat.lt_of_ceil_lt,mul_div_cancel₀.Lean, lines 165–166
have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩;poly_log_lt_eq.hlhave(0 : ℝ) < Real.log (↑k : ℝ)Leaves
A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withhl : (0 : ℝ) < Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Real.log_pos.Lean, line 168
have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂)
poly_log_lt_eq.hphave(0 : ℝ) ≤ (↑k : ℝ) ^ ttLeaves
A * (↑k : ℝ) ^ tt * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withhp : (0 : ℝ) ≤ (↑k : ℝ) ^ tt.Uses library
Real.rpow_nonneg,Nat.cast_nonnegSpecialisation ofNat.cast_nonneg', which seems to be easier for Lean to use. .Lean, line 169
have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _
poly_log_lt_eq.ehaveA * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ = A * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ) / Real.log (↑k : ℝ)routine: field_simpLeaves
A * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ ≤ C * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ), withe : A * (↑k : ℝ) ^ tt * (Real.log (↑k : ℝ) ^ (2 : ℕ))⁻¹ = A * (↑k : ℝ) ^ tt / Real.log (↑k : ℝ) / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 171–172
have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by field_simp
konyagin_finishhave∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → ∀ (C : ℝ), C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withkonyagin_finish : ∀ (k : ℕ) (n : ℤ), (1 : ℕ) ≤ k → ∀ (C : ℝ), C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ) → (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. .Lean, lines 175–183
have konyagin_finish : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (C : ℝ) (hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)) (hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro k n hk1 C hbhp hcard clear * - exists_far_prime k n hk1 C hbhp hcard obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp) refine ⟨p, hp, hpk, ?_, hdvd⟩ have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _ linarithkonyagin_finish.s1obtain∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withp : ℕ,hp : Nat.Prime p,hpk : (↑k : ℝ) < (↑p : ℝ),hpb : (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta,hdvd : (↑p : ℤ) ∣ Pprod k n.Uses library
lt_of_lt_of_le.Lean, line 180
obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp)
konyagin_finish.thishave(0 : ℝ) ≤ (↑k : ℝ) ^ thetaLeaves
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta, withthis : (0 : ℝ) ≤ (↑k : ℝ) ^ theta.Uses library
Real.rpow_nonneg.Lean, line 182
have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _
med_rhs_lehave∀ (C : ℝ), (0 : ℝ) < C → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withmed_rhs_le : ∀ (C : ℝ), (0 : ℝ) < C → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. ,Max.maxReturns the greater of its two arguments. .Lean, lines 185–206
have med_rhs_le : ∀ (C : ℝ) (hC : 0 < C), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → g_med k ≤ C * (k : ℝ) ^ theta / Real.log k := by intro C hC clear * - poly_log_lt poly_log_lt_eq theta_pos theta_lt_one C hC -- Apply `poly_log_lt` three times to get each term's bound, then combine them. have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop; have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ] have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ]; obtain ⟨a1, h1'⟩ := h1 obtain ⟨a2, h2'⟩ := h2 obtain ⟨a3, h3'⟩ := h3 refine ⟨max a1 (max a2 a3), fun k hk => ?_⟩ have x1 := h1' k (le_trans (le_max_left _ _) hk) have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk) have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk) simp only [g_med] have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring linarithmed_rhs_le.h1have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh1 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 189–190
have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;med_rhs_le.h1.thishave∀ᶠ (k : ℕ) in Filter.atTop, (3 : ℝ) * (↑k : ℝ) ^ (0 : ℝ) * Real.log (↑k : ℝ) ^ (0 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withthis : ∀ᶠ (k : ℕ) in Filter.atTop, (3 : ℝ) * (↑k : ℝ) ^ (0 : ℝ) * Real.log (↑k : ℝ) ^ (0 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 190
have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;
med_rhs_le.h2have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh2 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop.Lean, lines 191–193
have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ]med_rhs_le.h3have∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withh3 : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Filter.eventually_atTop.Lean, lines 194–196
have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1; norm_num [ Filter.eventually_atTop ];med_rhs_le.s4obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha1 : ℕ,h1' : ∀ (k : ℕ), a1 ≤ k → (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 197
obtain ⟨a1, h1'⟩ := h1
med_rhs_le.s5obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha2 : ℕ,h2' : ∀ (k : ℕ), a2 ≤ k → (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 198
obtain ⟨a2, h2'⟩ := h2
med_rhs_le.s6obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), witha3 : ℕ,h3' : ∀ (k : ℕ), a3 ≤ k → (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 199
obtain ⟨a3, h3'⟩ := h3
med_rhs_le.x1have(3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx1 : (3 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left.Lean, line 201
have x1 := h1' k (le_trans (le_max_left _ _) hk)
med_rhs_le.x2have(56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx2 : (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left,le_max_right.Lean, line 202
have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk)
med_rhs_le.x3have(↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withx3 : (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right.Lean, line 203
have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk)
med_rhs_le.ehaveC * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) = (3 : ℝ) * (C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ))routine: ringLeaves
(3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * theta - (1 : ℝ)) + (↑k : ℝ) ^ theta * Real.log (↑k : ℝ) ^ (-2 : ℝ) ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ), withe : C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) = (3 : ℝ) * (C / (3 : ℝ) * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, line 205
have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring
med_card_boundhave∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med kLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withmed_card_bound : ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. .Lean, lines 209–222
have med_card_bound : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ((badSet k n).card : ℝ) < g_med k := by obtain ⟨k₀, hk₀⟩ := h_count refine ⟨k₀, fun k hk n h1 h2 => ?_⟩ have hc := hk₀ k hk n h1 h2 have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by simp only [badSet] apply Finset.filter_congr intro x hx rw [Finset.mem_Ioo] at hx exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩ rw [e] exact hcmed_card_bound.s1obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k, withk₀ : ℕ,hk₀ : ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Lean, line 210
obtain ⟨k₀, hk₀⟩ := h_count
med_card_bound.hchave(↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ)Leaves
(↑(badSet k n).card : ℝ) < g_med k, withhc : (↑{m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ (21 / 40 : ℝ)⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - (21 / 40 : ℝ))}.card : ℝ) < (3 : ℝ) + (56 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) * (21 / 40 : ℝ) - (1 : ℝ)) + (↑k : ℝ) ^ (21 / 40 : ℝ) * Real.log (↑k : ℝ) ^ (-2 : ℝ).Lean, line 212
have hc := hk₀ k hk n h1 h2
med_card_bound.ehavebadSet k n = {m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)}Leaves
(↑(badSet k n).card : ℝ) < g_med k, withe : badSet k n = {m ∈ Finset.Ioo (↑k : ℤ) ((↑k : ℤ) + ⌊(↑k : ℝ) ^ theta⌋ + (2 : ℤ)) | (↑k : ℤ) < m ∧ (↑m : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ theta ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑(round ((↑n : ℝ) / (↑m : ℝ))) : ℝ)| < (1 : ℝ) / (↑k : ℝ) ^ ((1 : ℝ) - theta)}.Uses library
Finset.IooThe finset $(a, b)$ of elementsxsuch thata < xandx < b. ,roundround xroundsxto the nearest integer, breaking ties towards positive infinity. ,Finset.filter_congr,Finset.mem_Ioo,Iff.introIfa → bandb → athenaandbare equivalent. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 213–220
have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter (fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ |(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by simp only [badSet] apply Finset.filter_congr intro x hx rw [Finset.mem_Ioo] at hx exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩
case_mediumhaveBHP → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withcase_medium : BHP → ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,Exists.introExistential introduction. ,Max.maxReturns the greater of its two arguments. .Lean, lines 223–245
have case_medium : ∀ (hB : BHP), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by intro hB clear * - med_card_bound med_rhs_le konyagin_finish hB obtain ⟨C, hC, kb, hb⟩ := hB obtain ⟨k1, hk1card⟩ := med_card_bound obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC refine ⟨max (max kb k1) (max k2 2), ?_⟩ intro k hk n hlow hhigh have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk have hk1 : 1 ≤ k := by omega have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by exact hb k hkb have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k := lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2) exact konyagin_finish k n hk1 C hbhp hcardcase_medium.s1obtainBHPLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withC : ℝ,hC : (0 : ℝ) < C,kb : ℕ,hb : ∀ (k : ℕ), kb ≤ k → C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ).Lean, line 230
obtain ⟨C, hC, kb, hb⟩ := hB
case_medium.s2obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med kLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withk1 : ℕ,hk1card : ∀ (k : ℕ), k1 ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → (↑(badSet k n).card : ℝ) < g_med k.Lean, line 231
obtain ⟨k1, hk1card⟩ := med_card_bound
case_medium.s3obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withk2 : ℕ,hk2rhs : ∀ (k : ℕ), k2 ≤ k → g_med k ≤ C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Lean, line 232
obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC
case_medium.hkbhavekb ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhkb : kb ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left.Lean, line 235
have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk
case_medium.hki1havek1 ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhki1 : k1 ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right,le_max_left.Lean, line 236
have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk
case_medium.hki2havek2 ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhki2 : k2 ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_left,le_max_right.Lean, line 237
have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk
case_medium.hk2lehave(2 : ℕ) ≤ kLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhk2le : (2 : ℕ) ≤ k.Uses library
le_transThe relation≤on a preorder is transitive. ,le_max_right.Lean, line 238
have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk
case_medium.hk1have(1 : ℕ) ≤ kroutine: omegaLeaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhk1 : (1 : ℕ) ≤ k.Lean, line 239
have hk1 : 1 ≤ k := by omega
case_medium.hbhphaveC * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ)Leaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhbhp : C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ) ≤ (↑(primeCard (↑k : ℝ) ((↑k : ℝ) + (↑k : ℝ) ^ theta)) : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. .Lean, lines 240–242
have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by exact hb k hkbcase_medium.hcardhave(↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ)Leaves
∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n, withhcard : (↑(badSet k n).card : ℝ) < C * (↑k : ℝ) ^ theta / Real.log (↑k : ℝ).Uses library
Real.logThe real logarithm function, equal to the inverse of the exponential forx > 0, tolog |x|forx < 0, and to0for0. ,lt_of_lt_of_le.Lean, lines 243–244
have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k := lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2)
s15obtain∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k nLeaves
∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)), withk₀ : ℕ,hk₀ : ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - theta) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ theta ∧ (↑p : ℤ) ∣ Pprod k n.Lean, line 247
obtain ⟨k₀, hk₀⟩ := case_medium hB0
closeterm∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℤ), (1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) → (↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) → ∃ (p : ℕ), Nat.Prime p ∧ (↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧ (↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ))Closes the goal.
Uses library
Exists.introExistential introduction. .
import Mathlib
import Nodes.«erdos-1094--h2--h2--h2--h2».Context
open scoped Nat
/-! Hole `h_medium` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
theorem erdos_1094__h2__h2__h2__h2 : (¬∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)) ∨
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
∀ (n : ℤ),
(1 / 2 : ℝ) * (↑k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (↑n : ℝ) →
(↑n : ℝ) ≤ (↑k : ℝ) ^ (2 : ℕ) / Real.log (↑k : ℝ) ^ (2 : ℕ) →
∃ (p : ℕ),
Nat.Prime p ∧
(↑k : ℝ) < (↑p : ℝ) ∧
(↑p : ℝ) < (↑k : ℝ) + (3 : ℝ) * (↑k : ℝ) ^ (21 / 40 : ℝ) ∧
(↑p : ℤ) ∣ ∏ i ∈ Finset.Icc (1 : ℕ) k, (n - (↑i : ℤ)) := by
have h_count : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2 : ℝ) * (k : ℝ) ^ ((2 : ℝ) - (21 / 40 : ℝ)) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
(((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ (21 / 40 : ℝ)⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ (21 / 40 : ℝ) ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - (21 / 40 : ℝ)))).card : ℝ) <
3 + 56 * (k : ℝ) ^ (2 * (21 / 40 : ℝ) - 1) + (k : ℝ) ^ (21 / 40 : ℝ) * (Real.log k) ^ (-(2 : ℝ)) := by
sorry
by_cases hB0 : ∃ (C : ℝ),
(0 : ℝ) < C ∧
∃ (k₀ : ℕ),
∀ (k : ℕ),
k₀ ≤ k →
C * (↑k : ℝ) ^ (21 / 40 : ℝ) / Real.log (↑k : ℝ) ≤
(↑{p ∈ Finset.Ioo ⌊(↑k : ℝ)⌋ ⌈(↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)⌉ |
(0 : ℤ) < p ∧
Nat.Prime p.natAbs ∧
(↑k : ℝ) < (↑p : ℝ) ∧ (↑p : ℝ) < (↑k : ℝ) + (↑k : ℝ) ^ (21 / 40 : ℝ)}.card :
ℝ)
swap
· exact Or.inl hB0
refine Or.inr ?_
let Pprod := fun (k : ℕ) (n : ℤ) => ((∏ i ∈ Finset.Icc 1 k, (n - (i : ℤ))) : ℤ)
let theta : ℝ := 21 / 40
let primeCard := fun (a b : ℝ) => ((((Finset.Ioo ⌊a⌋ ⌈b⌉).filter
(fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ a < (p : ℝ) ∧ (p : ℝ) < b)).card) : ℕ)
have theta_pos : (0 : ℝ) < theta := by
clear * -
simp only [theta]; norm_num
have theta_lt_one : theta < 1 := by
clear * -
simp only [theta]; norm_num
have dvd_Pprod_of_factor : ∀ (k : ℕ) (n : ℤ) (p : ℤ) (i : ℕ) (hi : i ∈ Finset.Icc 1 k) (hp : p ∣ (n - (i : ℤ))), p ∣ Pprod k n := by
intro k n p i hi hp
clear * - k n p i hi hp
simp only [Pprod]
exact hp.trans (Finset.dvd_prod_of_mem (fun i : ℕ => (n - (i : ℤ))) hi)
have dvd_from_far : ∀ (k : ℕ) (n : ℤ) (p : ℕ) (hk1 : 1 ≤ k) (hp0 : 0 < p) (hkp : (k : ℝ) < p) (hpk : (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta) (hfar : 1 / (k : ℝ) ^ (1 - theta) ≤ |(n : ℝ) / (p : ℝ) - round ((n : ℝ) / (p : ℝ))|), (p : ℤ) ∣ Pprod k n := by
intro k n p hk1 hp0 hkp hpk hfar
clear * - dvd_Pprod_of_factor theta_pos theta_lt_one k n p hk1 hp0 hkp hpk hfar
-- Set `i := n % (p : ℤ)` and `j := i.toNat`.
set i := n % (p : ℤ)
set j := i.toNat
have hj : (j : ℤ) = i := by
exact Int.toNat_of_nonneg <| Int.emod_nonneg _ <| by positivity;
-- From `hfar`, we have `(p:ℝ)/(k:ℝ)^(1-theta) ≤ (min i (p-i) : ℝ)`.
have h_frac : (p : ℝ) / (k : ℝ) ^ (1 - theta) ≤ min (i : ℝ) ((p : ℝ) - i) := by
have h_frac : |(n : ℝ) / p - round ((n : ℝ) / p)| = min ((i : ℝ) / p) (1 - (i : ℝ) / p) := by
have h_frac : Int.fract ((n : ℝ) / p) = (i : ℝ) / p := by
rw [ Int.fract_eq_iff ];
field_simp;
norm_cast;
exact ⟨ by norm_num; exact Int.emod_nonneg _ ( by positivity ), Int.emod_lt_of_pos _ ( by positivity ), n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩;
rw [ ← h_frac, abs_sub_round_eq_min ];
have hp' : (0:ℝ) < p := by exact_mod_cast hp0
have h1 := mul_le_mul_of_nonneg_left hfar hp'.le
rw [h_frac, mul_min_of_nonneg _ _ hp'.le] at h1
have e1 : (p:ℝ) * ((i:ℝ)/p) = i := by field_simp
have e2 : (p:ℝ) * (1 - (i:ℝ)/p) = p - i := by field_simp
rw [e1, e2] at h1
calc (p:ℝ) / (k:ℝ)^(1-theta) = p * (1 / (k:ℝ)^(1-theta)) := by ring
_ ≤ _ := h1
-- So `1 ≤ i ≤ k`.
have h_i_bounds : 1 ≤ i ∧ i ≤ k := by
have h_i_bounds : (p : ℝ) / (k : ℝ) ^ (1 - theta) > (k : ℝ) ^ theta := by
rw [ gt_iff_lt, lt_div_iff₀ ] <;> norm_num at *;
· rw [ ← Real.rpow_add ] <;> norm_num ; linarith [ ( by norm_cast : ( k : ℝ ) + 1 ≤ p ) ];
grind +extAll;
· positivity;
constructor <;> norm_num at *;
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith [ show ( k : ℝ ) ^ theta ≥ 1 by exact Real.one_le_rpow ( mod_cast hk1 ) ( by exact div_nonneg ( by norm_num ) ( by norm_num ) ) ] );
· exact Int.le_of_lt_add_one ( by rw [ ← @Int.cast_lt ℝ ] ; push_cast; linarith );
convert dvd_Pprod_of_factor k n ( p : ℤ ) j _ _ using 1;
· grind;
· exact ⟨ n / p, by linarith [ Int.emod_add_mul_ediv n p ] ⟩
let badSet := fun (k : ℕ) (n : ℤ) => (((Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta))) : Finset ℤ)
have exists_far_prime : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (hcount : ((badSet k n).card : ℝ) < (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧ (p : ℤ) ∣ Pprod k n := by
intro k n hk1 hcount
clear * - dvd_from_far k n hk1 hcount
by_contra hne
push_neg at hne
have hsub : ((Finset.Ioo ⌊(k:ℝ)⌋ ⌈(k:ℝ) + (k:ℝ)^theta⌉).filter (fun p : ℤ => 0 < p ∧ (p.natAbs).Prime ∧ (k:ℝ) < (p : ℝ) ∧ (p : ℝ) < (k:ℝ) + (k:ℝ)^theta)) ⊆ badSet k n := by
intro p hp
rw [Finset.mem_filter] at hp
obtain ⟨hpI, hp0, hpr, hkp, hpb⟩ := hp
have hq : ((p.natAbs : ℕ) : ℤ) = p := Int.natAbs_of_nonneg hp0.le
have hqR : ((p.natAbs : ℕ) : ℝ) = (p : ℝ) := by rw [← Int.cast_natCast, hq]
simp only [badSet, Finset.mem_filter, Finset.mem_Ioo]
refine ⟨⟨?_, ?_⟩, hpb, ?_⟩
· exact_mod_cast hkp
· have h1 : p < ⌈(k:ℝ) + (k:ℝ)^theta⌉ := (Finset.mem_Ioo.mp hpI).2
have h2 : ⌈(k:ℝ) + (k:ℝ)^theta⌉ ≤ (k:ℤ) + ⌊(k:ℝ)^theta⌋ + 1 := by
rw [Int.ceil_le]; push_cast
linarith [Int.lt_floor_add_one ((k:ℝ)^theta)]
omega
· by_contra hfar
push_neg at hfar
apply hne p.natAbs hpr (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb)
exact dvd_from_far k n p.natAbs hk1 (by omega) (by rw [hqR]; exact hkp) (by rw [hqR]; exact hpb) (by rw [hqR]; exact hfar)
have hc := Finset.card_le_card hsub
have hc2 : primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) ≤ (badSet k n).card := hc
have hc' : (primeCard (k:ℝ) ((k:ℝ) + (k:ℝ)^theta) : ℝ) ≤ ((badSet k n).card : ℝ) := by exact_mod_cast hc2
linarith
have tendsto_log_rpow_mul_rpow_neg : ∀ (b c : ℝ) (hc : 0 < c), Filter.Tendsto (fun x : ℝ => (Real.log x) ^ b * x ^ (-c)) Filter.atTop (nhds 0) := by
intro b c hc
clear * - b c hc
-- Use the fact that `Real.log x ^ b` is little-o of `x ^ c` as `x` tends to infinity.
have h_log : (fun x : ℝ => Real.log x ^ b) =o[Filter.atTop] (fun x : ℝ => x ^ c) :=
isLittleO_log_rpow_rpow_atTop b hc
convert h_log.tendsto_div_nhds_zero.congr' _ using 1;
filter_upwards [ Filter.eventually_gt_atTop 0 ] with x hx using by rw [ div_eq_mul_inv, Real.rpow_neg hx.le ] ;
have poly_log_lt : ∀ (A α β tt : ℝ) (hα : α < tt) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ α * (Real.log k) ^ β ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A α β tt hα C hC
clear * - tendsto_log_rpow_mul_rpow_neg A α β tt hα C hC
-- Let's choose any $C > 0$ and derive a contradiction.
have h_lim : Filter.Tendsto (fun k : ℕ => (A * (k : ℝ) ^ α * (Real.log k) ^ β) / ((k : ℝ) ^ tt / (Real.log k))) Filter.atTop (nhds 0) := by
-- Simplify the expression inside the limit.
suffices h_simp : Filter.Tendsto (fun k : ℕ => A * (Real.log k) ^ (β + 1) * (k : ℝ) ^ (α - tt)) Filter.atTop (nhds 0) by
refine h_simp.congr' ?_;
filter_upwards [ Filter.eventually_gt_atTop 1 ] with k hk ; rw [ Real.rpow_sub ( by positivity ) ] ; ring_nf;
rw [ Real.rpow_add ( Real.log_pos ( Nat.one_lt_cast.mpr hk ) ), Real.rpow_one ] ; norm_num ; ring;
have := @tendsto_log_rpow_mul_rpow_neg ( β + 1 ) ( tt - α ) ?_;
· convert this.const_mul A |> Filter.Tendsto.comp <| tendsto_natCast_atTop_atTop using 2 <;> norm_num ; ring;
· linarith;
filter_upwards [ h_lim.eventually ( gt_mem_nhds hC ), Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
rw [ div_lt_iff₀ ( div_pos ( Real.rpow_pos_of_pos ( Nat.cast_pos.mpr hk₂.le ) _ ) ( Real.log_pos ( Nat.one_lt_cast.mpr hk₂ ) ) ) ] at hk₁ ; ring_nf at hk₁ ⊢ ; linarith
have poly_log_lt_eq : ∀ (A tt : ℝ) (C : ℝ) (hC : 0 < C), ∀ᶠ k : ℕ in Filter.atTop,
A * (k : ℝ) ^ tt * (Real.log k) ^ (-(2 : ℝ)) ≤ C * (k : ℝ) ^ tt / Real.log k := by
intro A tt C hC
clear * - A tt C hC
-- We'll use that $A \leq C \cdot \log k$ for sufficiently large $k$.
have h_log_bound : ∀ᶠ k : ℕ in Filter.atTop, A ≤ C * Real.log k := by
exact Filter.eventually_atTop.mpr ⟨ ⌈Real.exp ( A / C ) ⌉₊ + 1, fun k hk => by nlinarith [ Nat.le_ceil ( Real.exp ( A / C ) ), Real.log_exp ( A / C ), Real.log_le_log ( by positivity ) ( show ( k :ℝ ) ≥ Real.exp ( A / C ) by exact le_of_lt ( Nat.lt_of_ceil_lt hk ) ), mul_div_cancel₀ A hC.ne' ] ⟩;
filter_upwards [ h_log_bound, Filter.eventually_gt_atTop 1 ] with k hk₁ hk₂;
have hl : 0 < Real.log k := Real.log_pos (by exact_mod_cast hk₂)
have hp : 0 ≤ (k:ℝ)^tt := Real.rpow_nonneg (Nat.cast_nonneg _) _
rw [Real.rpow_neg hl.le, Real.rpow_two]
have e : A * (k:ℝ)^tt * (Real.log k ^ 2)⁻¹ = A * (k:ℝ)^tt / Real.log k / Real.log k := by
field_simp
rw [e, div_le_div_iff_of_pos_right hl, div_le_iff₀ hl]
nlinarith [mul_le_mul_of_nonneg_right hk₁ hp]
have konyagin_finish : ∀ (k : ℕ) (n : ℤ) (hk1 : 1 ≤ k) (C : ℝ) (hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)) (hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k), ∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro k n hk1 C hbhp hcard
clear * - exists_far_prime k n hk1 C hbhp hcard
obtain ⟨p, hp, hpk, hpb, hdvd⟩ := exists_far_prime k n hk1 (lt_of_lt_of_le hcard hbhp)
refine ⟨p, hp, hpk, ?_, hdvd⟩
have : (0 : ℝ) ≤ (k : ℝ) ^ theta := Real.rpow_nonneg (by positivity) _
linarith
let g_med := fun (k : ℕ) => ((3 + 56 * (k : ℝ) ^ (2 * theta - 1) + (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ))) : ℝ)
have med_rhs_le : ∀ (C : ℝ) (hC : 0 < C), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → g_med k ≤ C * (k : ℝ) ^ theta / Real.log k := by
intro C hC
clear * - poly_log_lt poly_log_lt_eq theta_pos theta_lt_one C hC
-- Apply `poly_log_lt` three times to get each term's bound, then combine them.
have h1 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 3 ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
have := poly_log_lt 3 0 0 theta theta_pos ( C / 3 ) ( by linarith ) ; aesop;
have h2 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 56 * (k : ℝ) ^ (2 * theta - 1) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt 56 ( 2 * theta - 1 ) 0 theta ( by linarith [ theta_pos, theta_lt_one ] ) ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ]
have h3 : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → (k : ℝ) ^ theta * (Real.log k) ^ (-(2 : ℝ)) ≤ (C / 3) * (k : ℝ) ^ theta / Real.log k := by
convert poly_log_lt_eq 1 theta ( C / 3 ) ( by linarith ) using 1;
norm_num [ Filter.eventually_atTop ];
obtain ⟨a1, h1'⟩ := h1
obtain ⟨a2, h2'⟩ := h2
obtain ⟨a3, h3'⟩ := h3
refine ⟨max a1 (max a2 a3), fun k hk => ?_⟩
have x1 := h1' k (le_trans (le_max_left _ _) hk)
have x2 := h2' k (le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk)
have x3 := h3' k (le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk)
simp only [g_med]
have e : C * (k:ℝ) ^ theta / Real.log k = 3 * (C / 3 * (k:ℝ) ^ theta / Real.log k) := by ring
linarith
let BHP : Prop := ∃ C : ℝ, 0 < C ∧ ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k →
C * (k : ℝ) ^ theta / Real.log k ≤ (primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ)
have med_card_bound : ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ, (1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) → (n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 → ((badSet k n).card : ℝ) < g_med k := by
obtain ⟨k₀, hk₀⟩ := h_count
refine ⟨k₀, fun k hk n h1 h2 => ?_⟩
have hc := hk₀ k hk n h1 h2
have e : badSet k n = (Finset.Ioo (k : ℤ) ((k : ℤ) + ⌊(k : ℝ) ^ theta⌋ + 2)).filter
(fun m : ℤ => (k : ℤ) < m ∧ (m : ℝ) < (k : ℝ) + (k : ℝ) ^ theta ∧
|(n : ℝ) / (m : ℝ) - round ((n : ℝ) / (m : ℝ))| < 1 / (k : ℝ) ^ (1 - theta)) := by
simp only [badSet]
apply Finset.filter_congr
intro x hx
rw [Finset.mem_Ioo] at hx
exact ⟨fun h => ⟨hx.1, h⟩, fun h => h.2⟩
rw [e]
exact hc
have case_medium : ∀ (hB : BHP), ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → ∀ n : ℤ,
(1 / 2) * (k : ℝ) ^ (2 - theta) < (n : ℝ) →
(n : ℝ) ≤ (k : ℝ) ^ 2 / (Real.log k) ^ 2 →
∃ p : ℕ, p.Prime ∧ (k : ℝ) < p ∧ (p : ℝ) < (k : ℝ) + 3 * (k : ℝ) ^ theta ∧
(p : ℤ) ∣ Pprod k n := by
intro hB
clear * - med_card_bound med_rhs_le konyagin_finish hB
obtain ⟨C, hC, kb, hb⟩ := hB
obtain ⟨k1, hk1card⟩ := med_card_bound
obtain ⟨k2, hk2rhs⟩ := med_rhs_le C hC
refine ⟨max (max kb k1) (max k2 2), ?_⟩
intro k hk n hlow hhigh
have hkb : kb ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_left _ _)) hk
have hki1 : k1 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_left _ _)) hk
have hki2 : k2 ≤ k := le_trans (le_trans (le_max_left _ _) (le_max_right _ _)) hk
have hk2le : 2 ≤ k := le_trans (le_trans (le_max_right _ _) (le_max_right _ _)) hk
have hk1 : 1 ≤ k := by omega
have hbhp : C * (k : ℝ) ^ theta / Real.log k ≤
(primeCard (k : ℝ) ((k : ℝ) + (k : ℝ) ^ theta) : ℝ) := by
exact hb k hkb
have hcard : ((badSet k n).card : ℝ) < C * (k : ℝ) ^ theta / Real.log k :=
lt_of_lt_of_le (hk1card k hki1 n hlow hhigh) (hk2rhs k hki2)
exact konyagin_finish k n hk1 C hbhp hcard
obtain ⟨k₀, hk₀⟩ := case_medium hB0
exact ⟨k₀, hk₀⟩