Problems / erdos-1094 / erdos-1094--h2--h2--h2--h3--h1--h1
Konyagin's theorem: points where f is near a rational
erdos-1094--h2--h2--h2--h3--h1--h1
proved
Hole h_thm of erdos-1094--h2--h2--h2--h3--h1 (split by 20261015T023339Z-t1015-r-partial.lean).
$\displaystyle |S|<65536\,N\Bigl[(D_r\lambda^rW^2)^{\frac{1}{2r-1}}+\Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac{1}{r-1}}+\Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac{1}{2r}}\Bigr]+2r\lambda$
For every $r\ge 2$, $N>0$, $W\ge 1$, $\delta>0$, $\lambda\ge 1$, $D_r>0$, $D_{r+1}>0$ and every $f:\mathbb{R}\to\mathbb{R}$ of class $C^{r+1}$ with $D_r/2\le|f^{(r)}(x)|\le D_r$ and $|f^{(r+1)}(x)|\le D_{r+1}$ for all $x\in[0,N]$, every finite set $S$ of integers in $[0,\lfloor N\rfloor]$ each of whose points $u$ has $|f(u)-v/w|<\delta$ for some integer $v$ and natural $w$ with $0<w\le W$ satisfies the displayed bound: Konyagin's theorem on the integer points at which a function with controlled $r$-th and $(r+1)$-th derivatives is close to a rational of bounded denominator. The Lean names $\lambda$ lam, $D_{r+1}$ D_r1 and the derivatives iteratedDeriv; $|S|$ is cast to $\mathbb{R}$, the exponents $\tfrac{1}{2r-1}$, $\tfrac{1}{r-1}$, $\tfrac{1}{2r}$ are real powers and $W^2$ a natural one.
Lean
theorem erdos_1094__h2__h2__h2__h3__h1__h1 : ∀ (r : ℕ),
(2 : ℕ) ≤ r →
∀ (N : ℝ),
(0 : ℝ) < N →
∀ (W : ℝ),
(1 : ℝ) ≤ W →
∀ (δ : ℝ),
(0 : ℝ) < δ →
∀ (lam : ℝ),
(1 : ℝ) ≤ lam →
∀ (D_r : ℝ),
(0 : ℝ) < D_r →
∀ (D_r1 : ℝ),
(0 : ℝ) < D_r1 →
∀ (f : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f →
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) →
∀ (S : Finset ℤ),
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) →
(∀ u ∈ S,
∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
(↑S.card : ℝ) <
(65536 : ℝ) * N *
((D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam := 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, 000568, records the gate’s run.
The proof step by step (outline)
Checked by the kernel — an outline of the attested proof below: attestations/000568.json, merge commit 3e4a866f1f30.
Outline of Proof.lean, extracted by the gate at f878b4d44120 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.
hflhave(0 : ℤ) ≤ ⌊N⌋Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhfl : (0 : ℤ) ≤ ⌊N⌋.Uses library
Int.floor_nonneg.Lean, line 43
have hfl : (0 : ℤ) ≤ ⌊N⌋ := Int.floor_nonneg.mpr hN.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 43 at
3e4a866f1f30↗hsubhaveS ⊆ Finset.Icc (0 : ℤ) ⌊N⌋Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.mem_Icc,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 44–46
have hsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋ := fun u hu => by obtain ⟨a, b⟩ := hS u hu exact Finset.mem_Icc.mpr ⟨a, b⟩hsub.s1obtain(0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋Leaves
u ∈ Finset.Icc (0 : ℤ) ⌊N⌋, witha : (0 : ℤ) ≤ u,b : u ≤ ⌊N⌋.Lean, line 45
obtain ⟨a, b⟩ := hS u hu
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 45 at
3e4a866f1f30↗
hcardZhave(↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhcardZ : (↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ).Uses library
Int.card_Icc.Lean, lines 47–50
have hcardZ : (S.card : ℤ) ≤ ⌊N⌋ + 1 := by have := Finset.card_le_card hsub rw [Int.card_Icc] at this omegahcardZ.thishaveS.card ≤ (Finset.Icc (0 : ℤ) ⌊N⌋).cardLeaves
(↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ), withthis : S.card ≤ (Finset.Icc (0 : ℤ) ⌊N⌋).card.Uses library
Finset.card_le_card.Lean, line 48
have := Finset.card_le_card hsub
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 48 at
3e4a866f1f30↗
hcardhave(↑S.card : ℝ) ≤ N + (1 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhcard : (↑S.card : ℝ) ≤ N + (1 : ℝ).Uses library
Int.floor_le.Lean, lines 51–54
have hcard : (S.card : ℝ) ≤ N + 1 := by have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ push_cast at h' linarith [Int.floor_le N]hcard.h'have(↑(↑S.card : ℤ) : ℝ) ≤ (↑(⌊N⌋ + (1 : ℤ)) : ℝ)Leaves
(↑S.card : ℝ) ≤ N + (1 : ℝ), withh' : (↑(↑S.card : ℤ) : ℝ) ≤ (↑(⌊N⌋ + (1 : ℤ)) : ℝ).Lean, line 52
have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 52 at
3e4a866f1f30↗
hr2have(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhr2 : (4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam.Lean, lines 55–57
have hr2 : (4 : ℝ) ≤ 2 * (r : ℝ) * lam := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarithhr2.thishave(2 : ℝ) ≤ (↑r : ℝ)Leaves
(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam, withthis : (2 : ℝ) ≤ (↑r : ℝ).Lean, line 56
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 56 at
3e4a866f1f30↗
s6caseLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX : (1 : ℝ) ≤ (65536 : ℝ) * X.Lean, lines 59–60
· have : N ≤ 65536 * N * X := by nlinarith linariths6.thishaveN ≤ (65536 : ℝ) * N * Xroutine: nlinarithLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withthis : N ≤ (65536 : ℝ) * N * X.Lean, line 59
· have : N ≤ 65536 * N * X := by nlinarith
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 59 at
3e4a866f1f30↗
s7caseLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX : ¬(1 : ℝ) ≤ (65536 : ℝ) * X.Uses library
Finset.sum_const,Finset.card_range,nsmul_eq_mul.Lean, lines 61–261
· push_neg at hX -- the remaining (hard) case, for a scale parameter in `[1, 2)` have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 → ∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → 65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 → (↑S'.card : ℝ) < 65536 * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam' := by intro N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3 S' hS' hS2' hlt exact erdos_1094__h2__h2__h2__h3__h1__h1__h1 r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1 f hf h1 h2 h3 S hS hS2 (not_le.mpr hX) N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3 S' hS' hS2' hlt -- reduction of a general scale `lam` to a scale in `[1, 2)` via residue classes set q : ℕ := ⌊lam⌋₊ with hqdef have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam) have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1 have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith) have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam set lam' : ℝ := lam / q with hlam' have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith have hl2 : lam' < 2 := by rw [hlam', div_lt_iff₀ hqpos] have : (1 : ℝ) ≤ q := by exact_mod_cast hq1 linarith have hX0 : 0 ≤ X := by rw [hXdef] have := hDr.le; have := hDr1.le; have := hδ.le have hl0 : 0 ≤ lam := by linarith positivity have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X := by have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne'] have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring rw [hXdef, e2, mul_assoc D_r, e1] have hclass : ∀ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) < 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by intro c hc have hcq : c < q := Finset.mem_range.mp hc set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omega have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omega set T' := T.image (fun u => u / (q : ℤ)) with hT' have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu] have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarith have hNq : 0 ≤ 65536 * (N / q) * X := by positivity by_cases hNc : (c : ℝ) < N · set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linarith · push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linarith have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat) (t := Finset.range q)] · push_cast; rfl · intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omega have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass rw [← hsum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] at hlt have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam') = 65536 * N * X + 2 * (r : ℝ) * lam := by rw [hlam']; field_simp linariths7.corehave∀ (N' : ℝ), (0 : ℝ) < N' → ∀ (lam' : ℝ), (1 : ℝ) ≤ lam' → lam' < (2 : ℝ) → ∀ (D' : ℝ), (0 : ℝ) < D' → ∀ (D1' : ℝ), (0 : ℝ) < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → (65536 : ℝ) * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < (1 : ℝ) → (↑S'.card : ℝ) < (65536 : ℝ) * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withcore : ∀ (N' : ℝ), (0 : ℝ) < N' → ∀ (lam' : ℝ), (1 : ℝ) ≤ lam' → lam' < (2 : ℝ) → ∀ (D' : ℝ), (0 : ℝ) < D' → ∀ (D1' : ℝ), (0 : ℝ) < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → (65536 : ℝ) * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < (1 : ℝ) → (↑S'.card : ℝ) < (65536 : ℝ) * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'.Uses statements erdos-1094--h2--h2--h2--h3--h1--h1--h1; library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,WithTopAttach⊤to a type. ,Set.IccIcc a bis the left-closed right-closed interval $[a, b]$. ,iteratedDerivThen-th iterated derivative of a function from𝕜toF, as a function from𝕜toF. ,FinsetFinset αis the type of finite sets of elements ofα. ,not_le.Lean, lines 63–83
have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 → ∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → 65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 → (↑S'.card : ℝ) < 65536 * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam' := by intro N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3 S' hS' hS2' hlt exact erdos_1094__h2__h2__h2__h3__h1__h1__h1 r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1 f hf h1 h2 h3 S hS hS2 (not_le.mpr hX) N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3 S' hS' hS2' hlts7.hq1have(1 : ℕ) ≤ qLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhq1 : (1 : ℕ) ≤ q.Uses library
Nat.le_floor.Lean, line 86
have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 86 at
3e4a866f1f30↗s7.hqposhave(0 : ℝ) < (↑q : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqpos : (0 : ℝ) < (↑q : ℝ).Lean, line 87
have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 87 at
3e4a866f1f30↗s7.hqlehave(↑q : ℝ) ≤ lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqle : (↑q : ℝ) ≤ lam.Uses library
Nat.floor_le.Lean, line 88
have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 88 at
3e4a866f1f30↗s7.hqlthavelam < (↑q : ℝ) + (1 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqlt : lam < (↑q : ℝ) + (1 : ℝ).Uses library
Nat.lt_floor_add_one.Lean, line 89
have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 89 at
3e4a866f1f30↗s7.hl1have(1 : ℝ) ≤ lam'Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhl1 : (1 : ℝ) ≤ lam'.Uses library
le_div_iff₀Seele_div_iff₀'for a version with multiplication on the other side. .Lean, line 91
have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 91 at
3e4a866f1f30↗s7.hl2havelam' < (2 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhl2 : lam' < (2 : ℝ).Uses library
div_lt_iff₀Seediv_lt_iff₀'for a version with multiplication on the other side. .Lean, lines 92–95
have hl2 : lam' < 2 := by rw [hlam', div_lt_iff₀ hqpos] have : (1 : ℝ) ≤ q := by exact_mod_cast hq1 linariths7.hl2.thishave(1 : ℝ) ≤ (↑q : ℝ)Leaves
lam < (2 : ℝ) * (↑q : ℝ), withthis : (1 : ℝ) ≤ (↑q : ℝ).Lean, line 94
have : (1 : ℝ) ≤ q := by exact_mod_cast hq1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 94 at
3e4a866f1f30↗
s7.hX0have(0 : ℝ) ≤ XLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX0 : (0 : ℝ) ≤ X.Lean, lines 96–100
have hX0 : 0 ≤ X := by rw [hXdef] have := hDr.le; have := hDr1.le; have := hδ.le have hl0 : 0 ≤ lam := by linarith positivitys7.hX0.s1have(0 : ℝ) ≤ D_rLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ D_r.Lean, line 98
have := hDr.le; have := hDr1.le; have := hδ.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 98 at
3e4a866f1f30↗s7.hX0.s2have(0 : ℝ) ≤ D_r1Leaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ D_r1.Lean, line 98
have := hDr.le; have := hDr1.le; have := hδ.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 98 at
3e4a866f1f30↗s7.hX0.s3have(0 : ℝ) ≤ δLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ δ.Lean, line 98
have := hDr.le; have := hDr1.le; have := hδ.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 98 at
3e4a866f1f30↗s7.hX0.hl0have(0 : ℝ) ≤ lamroutine: linarithLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withhl0 : (0 : ℝ) ≤ lam.Lean, line 99
have hl0 : 0 ≤ lam := by linarith
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 99 at
3e4a866f1f30↗
s7.hXinvhave(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = XLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhXinv : (D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X.Uses library
mul_assoc.Lean, lines 101–110
have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X := by have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne'] have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring rw [hXdef, e2, mul_assoc D_r, e1]s7.hXinv.e1have(↑q : ℝ) ^ r * lam' ^ r = lam ^ rLeaves
(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X, withe1 : (↑q : ℝ) ^ r * lam' ^ r = lam ^ r.Uses library
mul_pow,mul_div_cancel₀.Lean, lines 105–106
have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne']s7.hXinv.e2haveD_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_rLeaves
(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X, withe2 : D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r.Lean, lines 107–109
have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring
s7.hclasshave∀ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhclass : ∀ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam'.Uses library
Finset.rangerange nis the set of natural numbers less thann. .Lean, lines 111–244
have hclass : ∀ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) < 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by intro c hc have hcq : c < q := Finset.mem_range.mp hc set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omega have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omega set T' := T.image (fun u => u / (q : ℤ)) with hT' have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu] have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarith have hNq : 0 ≤ 65536 * (N / q) * X := by positivity by_cases hNc : (c : ℝ) < N · set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linarith · push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linariths7.hclass.hcqhavec < qLeaves
(↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhcq : c < q.Uses library
Finset.mem_range.Lean, line 115
have hcq : c < q := Finset.mem_range.mp hc
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 115 at
3e4a866f1f30↗s7.hclass.hqZhave(0 : ℤ) < (↑q : ℤ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhqZ : (0 : ℤ) < (↑q : ℤ).Lean, line 117
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 117 at
3e4a866f1f30↗s7.hclass.hmemhave∀ u ∈ T, u ∈ S ∧ u % (↑q : ℤ) = (↑c : ℤ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhmem : ∀ u ∈ T, u ∈ S ∧ u % (↑q : ℤ) = (↑c : ℤ).Uses library
Finset.mem_filter,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 118–123
have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omegas7.hclass.hmem.h0have(0 : ℤ) ≤ u % (↑q : ℤ)Leaves
u % (↑q : ℤ) = (↑c : ℤ), withh0 : (0 : ℤ) ≤ u % (↑q : ℤ).Uses library
Int.emod_nonneg.Lean, line 122
have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne'
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 122 at
3e4a866f1f30↗
s7.hclass.hdecomphave∀ u ∈ T, u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhdecomp : ∀ u ∈ T, u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, lines 124–128
have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omegas7.hclass.hdecomp.thishaveu % (↑q : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)) = uLeaves
u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)), withthis : u % (↑q : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)) = u.Uses library
Int.emod_add_mul_ediv.Lean, line 126
have := Int.emod_add_mul_ediv u q
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 126 at
3e4a866f1f30↗
s7.hclass.hcardThaveT'.card = T.cardLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhcardT : T'.card = T.card.Uses library
Finset.card_image_of_injOn.Lean, lines 130–134
have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu]s7.hclass.hlam'poshave(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhlam'pos : (4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam'.Lean, lines 135–137
have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinariths7.hclass.hlam'pos.thishave(2 : ℝ) ≤ (↑r : ℝ)Leaves
(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam', withthis : (2 : ℝ) ≤ (↑r : ℝ).Lean, line 136
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 136 at
3e4a866f1f30↗
s7.hclass.hNqhave(0 : ℝ) ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * Xroutine: positivityLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNq : (0 : ℝ) ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * X.Lean, line 138
have hNq : 0 ≤ 65536 * (N / q) * X := by positivity
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 138 at
3e4a866f1f30↗s7.hclass.s8caseLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNc : (↑c : ℝ) < N.Lean, lines 140–222
· set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linariths7.hclass.s8.hN'poshave(0 : ℝ) < N'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhN'pos : (0 : ℝ) < N'.Uses library
div_pos.Lean, line 141
have hN'pos : 0 < N' := div_pos (by linarith) hqpos
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 141 at
3e4a866f1f30↗s7.hclass.s8.hgfunhave∀ k ≤ r + (1 : ℕ), ∀ (t : ℝ), iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhgfun : ∀ k ≤ r + (1 : ℕ), ∀ (t : ℝ), iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t).Uses library
iteratedDerivThen-th iterated derivative of a function from𝕜toF, as a function from𝕜toF. ,rflrfl : a = ais the unique constructor of the equality type. ,iteratedDeriv_comp_const_addThe iterated derivative commutes with shifting the function by a constant on the left. .Lean, lines 143–153
have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add]s7.hclass.s8.hgfun.hf1haveContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withhf1 : ContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z).Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,contDiff_constConstants areC^∞. ,contDiff_idThe identity isC^n. .Lean, lines 146–148
have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id)s7.hclass.s8.hgfun.hf1.thishaveContDiff ℝ (↑k : WithTop ℕ∞) fLeaves
ContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z), withthis : ContDiff ℝ (↑k : WithTop ℕ∞) f.Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. .Lean, line 147
have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 147 at
3e4a866f1f30↗
s7.hclass.s8.hgfun.thishave(iteratedDeriv k fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) = fun (x : ℝ) => (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * x)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withthis : (iteratedDeriv k fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) = fun (x : ℝ) => (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * x).Uses library
iteratedDeriv_comp_const_mul.Lean, line 149
have := iteratedDeriv_comp_const_mul hf1 (q : ℝ)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 149 at
3e4a866f1f30↗s7.hclass.s8.hgfun.h2haveiteratedDeriv k (fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) t = (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * t)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withh2 : iteratedDeriv k (fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) t = (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * t).Uses library
congrFunCongruence in the function part of an application: Iff = gthenf a = g a. .Lean, line 150
have h2 := congrFun this t
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 150 at
3e4a866f1f30↗
s7.hclass.s8.hgChaveContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) gLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g.Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,WithTopAttach⊤to a type. ,contDiff_constConstants areC^∞. ,contDiff_idThe identity isC^n. .Lean, lines 154–155
have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id))s7.hclass.s8.hIcchave∀ x ∈ Set.Icc (0 : ℝ) N', (↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) NLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) N.Uses library
Set.IccIcc a bis the left-closed right-closed interval $[a, b]$. .Lean, lines 156–163
have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linariths7.hclass.s8.hIcc.s1obtainx ∈ Set.Icc (0 : ℝ) N'Leaves
(↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) N, withhx0 : (0 : ℝ) ≤ x,hx1 : x ≤ N'.Lean, line 158
obtain ⟨hx0, hx1⟩ := hx
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 158 at
3e4a866f1f30↗s7.hclass.s8.hIcc.s2case routine: positivityLeaves
(0 : ℝ) ≤ (↑c : ℝ) + (↑q : ℝ) * x.Lean, line 160
· positivity
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 160 at
3e4a866f1f30↗s7.hclass.s8.hIcc.s3caseLeaves
(↑c : ℝ) + (↑q : ℝ) * x ≤ N.Uses library
mul_div_cancel₀.Lean, lines 161–163
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linariths7.hclass.s8.hIcc.s3.thishave(↑q : ℝ) * x ≤ (↑q : ℝ) * N'Leaves
(↑c : ℝ) + (↑q : ℝ) * x ≤ N, withthis : (↑q : ℝ) * x ≤ (↑q : ℝ) * N'.Uses library
mul_le_mul_of_nonneg_left.Lean, line 161
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 161 at
3e4a866f1f30↗
s7.hclass.s8.hqrhave(0 : ℝ) < (↑q : ℝ) ^ rLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhqr : (0 : ℝ) < (↑q : ℝ) ^ r.Uses library
pow_pos.Lean, line 164
have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 164 at
3e4a866f1f30↗s7.hclass.s8.keyhave(↑T'.card : ℝ) < (65536 : ℝ) * N' * ((D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withkey : (↑T'.card : ℝ) < (65536 : ℝ) * N' * ((D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'.Uses library
abs_mul,abs_of_pos,le_rflA version ofle_reflwhere the argument is implicit ,pow_pos,Finset.mem_image,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,Int.ediv_nonneg,Int.le_floor,le_div_iff₀Seele_div_iff₀'for a version with multiplication on the other side. ,Exists.introExistential introduction. .Lean, lines 165–213
have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX)s7.hclass.s8.key.s1haveD_r / (2 : ℝ) ≤ |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|Leaves
D_r * (↑q : ℝ) ^ r / (2 : ℝ) ≤ (↑q : ℝ) ^ r * |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|, withthis : D_r / (2 : ℝ) ≤ |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|.Lean, line 170
have := h1 _ (hIcc x hx)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 170 at
3e4a866f1f30↗s7.hclass.s8.key.s2have|iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_rLeaves
(↑q : ℝ) ^ r * |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r * (↑q : ℝ) ^ r, withthis : |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r.Lean, line 175
have := h2 _ (hIcc x hx)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 175 at
3e4a866f1f30↗s7.hclass.s8.key.s3have|iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1Leaves
(↑q : ℝ) ^ (r + (1 : ℕ)) * |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)), withthis : |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1.Lean, line 180
have := h3 _ (hIcc x hx)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 180 at
3e4a866f1f30↗s7.hclass.s8.key.s4have(0 : ℝ) < (↑q : ℝ) ^ (r + (1 : ℕ))Leaves
(↑q : ℝ) ^ (r + (1 : ℕ)) * |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)), withthis : (0 : ℝ) < (↑q : ℝ) ^ (r + (1 : ℕ)).Uses library
pow_pos.Lean, line 181
have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 181 at
3e4a866f1f30↗s7.hclass.s8.key.s5obtain∃ a ∈ T, a / (↑q : ℤ) = tLeaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withu : ℤ,hu : u ∈ T.Lean, line 187
obtain ⟨u, hu, rfl⟩ := ht
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 187 at
3e4a866f1f30↗s7.hclass.s8.key.huShaveu ∈ SLeaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withhuS : u ∈ S.Lean, line 188
have huS := (hmem u hu).1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 188 at
3e4a866f1f30↗s7.hclass.s8.key.s7obtain(0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋Leaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withhu0 : (0 : ℤ) ≤ u,hu1 : u ≤ ⌊N⌋.Lean, line 189
obtain ⟨hu0, hu1⟩ := hS u huS
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 189 at
3e4a866f1f30↗s7.hclass.s8.key.s8haveu = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withhdu : u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, line 193
have hdu := hdecomp u hu
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 193 at
3e4a866f1f30↗s7.hclass.s8.key.s9have(↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ)Leaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withhreal : (↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ).Lean, lines 194–197
have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact thiss7.hclass.s8.key.s9.thishave(↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ)Leaves
(↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ), withthis : (↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ).Uses library
congrArgCongruence in the function argument: ifa₁ = a₂thenf a₁ = f a₂for any (nondependent) functionf. .Lean, line 195
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 195 at
3e4a866f1f30↗
s7.hclass.s8.key.s10have(↑u : ℝ) ≤ NLeaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withthis : (↑u : ℝ) ≤ N.Uses library
le_transThe relation≤on a preorder is transitive. ,Int.floor_le.Lean, line 198
have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 198 at
3e4a866f1f30↗s7.hclass.s8.key.s11obtain∃ a ∈ T, a / (↑q : ℤ) = tLeaves
∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withu : ℤ,hu : u ∈ T.Lean, line 203
obtain ⟨u, hu, rfl⟩ := ht
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 203 at
3e4a866f1f30↗s7.hclass.s8.key.s12obtain∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δLeaves
∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withv : ℤ,w : ℕ,hw0 : (0 : ℕ) < w,hwW : (↑w : ℝ) ≤ W,hvw : |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ.Lean, line 204
obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 204 at
3e4a866f1f30↗s7.hclass.s8.key.s13haveu = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
|g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withhdu : u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, line 206
have hdu := hdecomp u hu
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 206 at
3e4a866f1f30↗s7.hclass.s8.key.s14have(↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ)Leaves
|g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withhreal : (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ).Lean, lines 207–210
have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symms7.hclass.s8.key.s14.thishave(↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ)Leaves
(↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ), withthis : (↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ).Uses library
congrArgCongruence in the function argument: ifa₁ = a₂thenf a₁ = f a₂for any (nondependent) functionf. .Lean, line 208
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 208 at
3e4a866f1f30↗
s7.hclass.s8.thishave(65536 : ℝ) * N' * X ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * XLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withthis : (65536 : ℝ) * N' * X ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * X.Uses library
mul_le_mul_of_nonneg_right,mul_le_mul_of_nonneg_left,div_le_div_of_nonneg_right.Lean, lines 215–221
have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linariths7.hclass.s8.this.thishave(0 : ℝ) ≤ (↑c : ℝ)routine: positivityLeaves
N - (↑c : ℝ) ≤ N, withthis : (0 : ℝ) ≤ (↑c : ℝ).Lean, line 220
have : (0 : ℝ) ≤ c := by positivity
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 220 at
3e4a866f1f30↗
s7.hclass.s9caseLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNc : ¬(↑c : ℝ) < N.Lean, lines 223–244
· push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linariths7.hclass.s9.hlehaveT.card ≤ (1 : ℕ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhle : T.card ≤ (1 : ℕ).Uses library
Finset.card_le_one.Lean, lines 225–242
have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu']s7.hclass.s9.hle.keyhave∀ x ∈ T, x = (↑c : ℤ)Leaves
u = u', withkey : ∀ x ∈ T, x = (↑c : ℤ).Lean, lines 228–241
have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omegas7.hclass.s9.hle.key.hxShavex ∈ SLeaves
x = (↑c : ℤ), withhxS : x ∈ S.Lean, line 230
have hxS := (hmem x hx).1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 230 at
3e4a866f1f30↗s7.hclass.s9.hle.key.s2obtain(0 : ℤ) ≤ x ∧ x ≤ ⌊N⌋Leaves
x = (↑c : ℤ), withhx0 : (0 : ℤ) ≤ x,hx1 : x ≤ ⌊N⌋.Lean, line 231
obtain ⟨hx0, hx1⟩ := hS x hxS
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 231 at
3e4a866f1f30↗s7.hclass.s9.hle.key.hdxhavex = (↑c : ℤ) + (↑q : ℤ) * (x / (↑q : ℤ))Leaves
x = (↑c : ℤ), withhdx : x = (↑c : ℤ) + (↑q : ℤ) * (x / (↑q : ℤ)).Lean, line 232
have hdx := hdecomp x hx
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 232 at
3e4a866f1f30↗s7.hclass.s9.hle.key.hxNhave(↑x : ℝ) ≤ NLeaves
x = (↑c : ℤ), withhxN : (↑x : ℝ) ≤ N.Uses library
le_transThe relation≤on a preorder is transitive. ,Int.floor_le.Lean, line 233
have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N)
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 233 at
3e4a866f1f30↗s7.hclass.s9.hle.key.hxchavex ≤ (↑c : ℤ)Leaves
x = (↑c : ℤ), withhxc : x ≤ (↑c : ℤ).Lean, lines 234–236
have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast thiss7.hclass.s9.hle.key.hxc.thishave(↑x : ℝ) ≤ (↑c : ℝ)Leaves
x ≤ (↑c : ℤ), withthis : (↑x : ℝ) ≤ (↑c : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. .Lean, line 235
have : (x : ℝ) ≤ c := le_trans hxN hNc
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 235 at
3e4a866f1f30↗
s7.hclass.s9.hle.key.hcq'have(↑c : ℤ) < (↑q : ℤ)Leaves
x = (↑c : ℤ), withhcq' : (↑c : ℤ) < (↑q : ℤ).Lean, line 237
have hcq' : (c : ℤ) < q := by exact_mod_cast hcq
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 237 at
3e4a866f1f30↗s7.hclass.s9.hle.key.hdvdhave(↑q : ℤ) ∣ x - (↑c : ℤ)Leaves
x = (↑c : ℤ), withhdvd : (↑q : ℤ) ∣ x - (↑c : ℤ).Uses library
Exists.introExistential introduction. .Lean, line 238
have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 238 at
3e4a866f1f30↗s7.hclass.s9.hle.key.habshave|x - (↑c : ℤ)| < (↑q : ℤ)Leaves
x = (↑c : ℤ), withhabs : |x - (↑c : ℤ)| < (↑q : ℤ).Uses library
abs_lt.Lean, line 239
have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 239 at
3e4a866f1f30↗s7.hclass.s9.hle.key.thishavex - (↑c : ℤ) = (0 : ℤ)Leaves
x = (↑c : ℤ), withthis : x - (↑c : ℤ) = (0 : ℤ).Uses library
Int.eq_zero_of_abs_lt_dvd.Lean, line 240
have := Int.eq_zero_of_abs_lt_dvd hdvd habs
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 240 at
3e4a866f1f30↗
s7.hclass.s9.thishave(↑T.card : ℝ) ≤ (1 : ℝ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withthis : (↑T.card : ℝ) ≤ (1 : ℝ).Lean, line 243
have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 243 at
3e4a866f1f30↗
s7.hsumhave(↑S.card : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhsum : (↑S.card : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ).Uses library
Finset.rangerange nis the set of natural numbers less thann. ,Finset.card_eq_sum_card_fiberwise.Lean, lines 245–255
have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat) (t := Finset.range q)] · push_cast; rfl · intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omegas7.hsum.s1caseLeaves
(↑(∑ b ∈ Finset.range q, {a ∈ S | (a % (↑q : ℤ)).toNat = b}.card) : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ).Lean, line 249
· push_cast; rfl
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 249 at
3e4a866f1f30↗s7.hsum.s2caseLeaves
Set.MapsTo (fun (u : ℤ) => (u % (↑q : ℤ)).toNat) (↑S : Set ℤ) (↑(Finset.range q) : Set ℕ).Uses library
Finset.coe_range,Set.mem_Iio.Lean, lines 250–255
· intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omegas7.hsum.s2.hqZhave(0 : ℤ) < (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withhqZ : (0 : ℤ) < (↑q : ℤ).Lean, line 252
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 252 at
3e4a866f1f30↗s7.hsum.s2.h1have(0 : ℤ) ≤ u % (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withh1 : (0 : ℤ) ≤ u % (↑q : ℤ).Uses library
Int.emod_nonneg.Lean, line 253
have h1 := Int.emod_nonneg u hqZ.ne'
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 253 at
3e4a866f1f30↗s7.hsum.s2.h2haveu % (↑q : ℤ) < (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withh2 : u % (↑q : ℤ) < (↑q : ℤ).Uses library
Int.emod_lt_of_pos.Lean, line 254
have h2 := Int.emod_lt_of_pos u hqZ
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 254 at
3e4a866f1f30↗
s7.hlthave∑ i ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = i}.card : ℝ) < ∑ i ∈ Finset.range q, ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam')Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhlt : ∑ i ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = i}.card : ℝ) < ∑ i ∈ Finset.range q, ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam').Uses library
Finset.sum_lt_sum_of_nonemptyIn an ordered additive commutative monoid, if each summandf iof one nontrivial finite sum is strictly less than the corresponding summandg iof another nontrivial finite sum, thens.sum f < s.sum g. ,Finset.nonempty_range_iff.Lean, line 256
have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass
targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Proof.lean, line 256 at
3e4a866f1f30↗s7.thishave(↑q : ℝ) * ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam') = (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withthis : (↑q : ℝ) * ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam') = (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam.Lean, lines 258–260
have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam') = 65536 * N * X + 2 * (r : ℝ) * lam := by rw [hlam']; field_simp
The proof in Lean (Proof.lean)
Checked by the kernel — these bytes are the ones its attestation names: attestations/000568.json, merge commit 3e4a866f1f30.
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--h3--h1--h1/Proof.lean, sha256 9b838fd95097.import Mathlib
import Nodes.«erdos-1094--h2--h2--h2--h3--h1--h1».Context
open scoped Nat
/-! Hole `h_thm` 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__h3__h1__h1 : ∀ (r : ℕ),
(2 : ℕ) ≤ r →
∀ (N : ℝ),
(0 : ℝ) < N →
∀ (W : ℝ),
(1 : ℝ) ≤ W →
∀ (δ : ℝ),
(0 : ℝ) < δ →
∀ (lam : ℝ),
(1 : ℝ) ≤ lam →
∀ (D_r : ℝ),
(0 : ℝ) < D_r →
∀ (D_r1 : ℝ),
(0 : ℝ) < D_r1 →
∀ (f : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f →
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) →
∀ (S : Finset ℤ),
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) →
(∀ u ∈ S,
∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
(↑S.card : ℝ) <
(65536 : ℝ) * N *
((D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam := by
intro r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1 f hf h1 h2 h3 S hS hS2
set X : ℝ := (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ with hXdef
have hfl : (0 : ℤ) ≤ ⌊N⌋ := Int.floor_nonneg.mpr hN.le
have hsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋ := fun u hu => by
obtain ⟨a, b⟩ := hS u hu
exact Finset.mem_Icc.mpr ⟨a, b⟩
have hcardZ : (S.card : ℤ) ≤ ⌊N⌋ + 1 := by
have := Finset.card_le_card hsub
rw [Int.card_Icc] at this
omega
have hcard : (S.card : ℝ) ≤ N + 1 := by
have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ
push_cast at h'
linarith [Int.floor_le N]
have hr2 : (4 : ℝ) ≤ 2 * (r : ℝ) * lam := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
by_cases hX : 1 ≤ 65536 * X
· have : N ≤ 65536 * N * X := by nlinarith
linarith
· push_neg at hX
-- the remaining (hard) case, for a scale parameter in `[1, 2)`
have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 →
∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g →
(∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') →
∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) →
(∀ u ∈ S', ∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 →
(↑S'.card : ℝ) < 65536 * N' *
((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam' := by
intro N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3 S' hS' hS2' hlt
exact erdos_1094__h2__h2__h2__h3__h1__h1__h1 r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1
f hf h1 h2 h3 S hS hS2 (not_le.mpr hX) N' hN' lam' hl1' hl2' D' hD' D1' hD1' g hg g1 g2 g3
S' hS' hS2' hlt
-- reduction of a general scale `lam` to a scale in `[1, 2)` via residue classes
set q : ℕ := ⌊lam⌋₊ with hqdef
have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam)
have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1
have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith)
have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam
set lam' : ℝ := lam / q with hlam'
have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith
have hl2 : lam' < 2 := by
rw [hlam', div_lt_iff₀ hqpos]
have : (1 : ℝ) ≤ q := by exact_mod_cast hq1
linarith
have hX0 : 0 ≤ X := by
rw [hXdef]
have := hDr.le; have := hDr1.le; have := hδ.le
have hl0 : 0 ≤ lam := by linarith
positivity
have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹
= X := by
have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by
rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne']
have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)
= D_r1 * lam * W ^ (2 : ℕ) / D_r := by
rw [hlam']; field_simp; ring
rw [hXdef, e2, mul_assoc D_r, e1]
have hclass : ∀ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ)
< 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by
intro c hc
have hcq : c < q := Finset.mem_range.mp hc
set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by
intro u hu
rw [hT, Finset.mem_filter] at hu
refine ⟨hu.1, ?_⟩
have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne'
omega
have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by
intro u hu
have := Int.emod_add_mul_ediv u q
rw [(hmem u hu).2] at this
omega
set T' := T.image (fun u => u / (q : ℤ)) with hT'
have hcardT : T'.card = T.card := by
apply Finset.card_image_of_injOn
intro u hu u' hu' huu
simp only at huu
rw [hdecomp u hu, hdecomp u' hu', huu]
have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
have hNq : 0 ≤ 65536 * (N / q) * X := by positivity
by_cases hNc : (c : ℝ) < N
· set N' : ℝ := (N - c) / q with hN'
have hN'pos : 0 < N' := div_pos (by linarith) hqpos
set g : ℝ → ℝ := fun t => f (c + q * t) with hg
have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t
= (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by
intro k hk t
have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by
have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk)
exact this.comp (contDiff_const.add contDiff_id)
have := iteratedDeriv_comp_const_mul hf1 (q : ℝ)
have h2 := congrFun this t
try simp only at h2
rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2,
iteratedDeriv_comp_const_add]
have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g :=
hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id))
have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by
intro x hx
obtain ⟨hx0, hx1⟩ := hx
constructor
· positivity
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le
rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this
linarith
have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r
have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity)
(D_r1 * q ^ (r + 1)) (by positivity) g hgC
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h1 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h2 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)]
have := h3 _ (hIcc x hx)
have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _
nlinarith)
T'
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
have huS := (hmem u hu).1
obtain ⟨hu0, hu1⟩ := hS u huS
refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩
apply Int.le_floor.mpr
rw [hN', le_div_iff₀ hqpos]
have hdu := hdecomp u hu
have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this
have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N)
linarith)
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1
refine ⟨v, w, hw0, hwW, ?_⟩
have hdu := hdecomp u hu
have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this.symm
simp only [hg, hreal]
exact hvw)
(by rw [hXinv]; exact hX)
rw [hXinv, hcardT] at key
have : 65536 * N' * X ≤ 65536 * (N / q) * X := by
apply mul_le_mul_of_nonneg_right _ hX0
apply mul_le_mul_of_nonneg_left _ (by norm_num)
rw [hN']
apply div_le_div_of_nonneg_right _ hqpos.le
have : (0 : ℝ) ≤ c := by positivity
linarith
linarith
· push_neg at hNc
-- the class contains at most the single point `c`
have hle : T.card ≤ 1 := by
rw [Finset.card_le_one]
intro u hu u' hu'
have key : ∀ x ∈ T, x = c := by
intro x hx
have hxS := (hmem x hx).1
obtain ⟨hx0, hx1⟩ := hS x hxS
have hdx := hdecomp x hx
have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N)
have hxc : x ≤ c := by
have : (x : ℝ) ≤ c := le_trans hxN hNc
exact_mod_cast this
have hcq' : (c : ℤ) < q := by exact_mod_cast hcq
have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩
have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega
have := Int.eq_zero_of_abs_lt_dvd hdvd habs
omega
rw [key u hu, key u' hu']
have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle
linarith
have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by
rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat)
(t := Finset.range q)]
· push_cast; rfl
· intro u _
simp only [Finset.coe_range, Set.mem_Iio]
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have h1 := Int.emod_nonneg u hqZ.ne'
have h2 := Int.emod_lt_of_pos u hqZ
omega
have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass
rw [← hsum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] at hlt
have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam')
= 65536 * N * X + 2 * (r : ℝ) * lam := by
rw [hlam']; field_simp
linarithHow it was split
Proved from this hole by 20261015T063320Z-opn-prove-aristotle-1015-partial.lean (merged in 56c054dd0646, attestation 000534).
core→ erdos-1094--h2--h2--h2--h3--h1--h1--h1 (proved)$\displaystyle 65536\,X'<1\ \Longrightarrow\ |S'|<65536\,N'X'+2r\lambda',\qquad X'=(D'\lambda'^{\,r}W^2)^{\frac{1}{2r-1}}+\Bigl(\frac{\delta W^2}{D'\lambda'^{\,r}}\Bigr)^{\frac{1}{r-1}}+\Bigl(\frac{D_1'\lambda' W^2}{D'}\Bigr)^{\frac{1}{2r}}$
Read the partial proof (Lean)
theorem erdos_1094__h2__h2__h2__h3__h1__h1 : ∀ (r : ℕ),
(2 : ℕ) ≤ r →
∀ (N : ℝ),
(0 : ℝ) < N →
∀ (W : ℝ),
(1 : ℝ) ≤ W →
∀ (δ : ℝ),
(0 : ℝ) < δ →
∀ (lam : ℝ),
(1 : ℝ) ≤ lam →
∀ (D_r : ℝ),
(0 : ℝ) < D_r →
∀ (D_r1 : ℝ),
(0 : ℝ) < D_r1 →
∀ (f : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f →
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) →
∀ (S : Finset ℤ),
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) →
(∀ u ∈ S,
∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
(↑S.card : ℝ) <
(65536 : ℝ) * N *
((D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam := by
intro r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1 f hf h1 h2 h3 S hS hS2
set X : ℝ := (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ with hXdef
have hfl : (0 : ℤ) ≤ ⌊N⌋ := Int.floor_nonneg.mpr hN.le
have hsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋ := fun u hu => by
obtain ⟨a, b⟩ := hS u hu
exact Finset.mem_Icc.mpr ⟨a, b⟩
have hcardZ : (S.card : ℤ) ≤ ⌊N⌋ + 1 := by
have := Finset.card_le_card hsub
rw [Int.card_Icc] at this
omega
have hcard : (S.card : ℝ) ≤ N + 1 := by
have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ
push_cast at h'
linarith [Int.floor_le N]
have hr2 : (4 : ℝ) ≤ 2 * (r : ℝ) * lam := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
by_cases hX : 1 ≤ 65536 * X
· have : N ≤ 65536 * N * X := by nlinarith
linarith
· push_neg at hX
-- the remaining (hard) case, for a scale parameter in `[1, 2)`
have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 →
∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g →
(∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') →
∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) →
(∀ u ∈ S', ∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 →
(↑S'.card : ℝ) < 65536 * N' *
((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam' := by
sorry
-- reduction of a general scale `lam` to a scale in `[1, 2)` via residue classes
set q : ℕ := ⌊lam⌋₊ with hqdef
have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam)
have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1
have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith)
have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam
set lam' : ℝ := lam / q with hlam'
have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith
have hl2 : lam' < 2 := by
rw [hlam', div_lt_iff₀ hqpos]
have : (1 : ℝ) ≤ q := by exact_mod_cast hq1
linarith
have hX0 : 0 ≤ X := by
rw [hXdef]
have := hDr.le; have := hDr1.le; have := hδ.le
have hl0 : 0 ≤ lam := by linarith
positivity
have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹
= X := by
have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by
rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne']
have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)
= D_r1 * lam * W ^ (2 : ℕ) / D_r := by
rw [hlam']; field_simp; ring
rw [hXdef, e2, mul_assoc D_r, e1]
have hclass : ∀ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ)
< 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by
intro c hc
have hcq : c < q := Finset.mem_range.mp hc
set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by
intro u hu
rw [hT, Finset.mem_filter] at hu
refine ⟨hu.1, ?_⟩
have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne'
omega
have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by
intro u hu
have := Int.emod_add_mul_ediv u q
rw [(hmem u hu).2] at this
omega
set T' := T.image (fun u => u / (q : ℤ)) with hT'
have hcardT : T'.card = T.card := by
apply Finset.card_image_of_injOn
intro u hu u' hu' huu
simp only at huu
rw [hdecomp u hu, hdecomp u' hu', huu]
have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
have hNq : 0 ≤ 65536 * (N / q) * X := by positivity
by_cases hNc : (c : ℝ) < N
· set N' : ℝ := (N - c) / q with hN'
have hN'pos : 0 < N' := div_pos (by linarith) hqpos
set g : ℝ → ℝ := fun t => f (c + q * t) with hg
have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t
= (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by
intro k hk t
have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by
have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk)
exact this.comp (contDiff_const.add contDiff_id)
have := iteratedDeriv_comp_const_mul hf1 (q : ℝ)
have h2 := congrFun this t
try simp only at h2
rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2,
iteratedDeriv_comp_const_add]
have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g :=
hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id))
have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by
intro x hx
obtain ⟨hx0, hx1⟩ := hx
constructor
· positivity
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le
rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this
linarith
have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r
have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity)
(D_r1 * q ^ (r + 1)) (by positivity) g hgC
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h1 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h2 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)]
have := h3 _ (hIcc x hx)
have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _
nlinarith)
T'
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
have huS := (hmem u hu).1
obtain ⟨hu0, hu1⟩ := hS u huS
refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩
apply Int.le_floor.mpr
rw [hN', le_div_iff₀ hqpos]
have hdu := hdecomp u hu
have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this
have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N)
linarith)
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1
refine ⟨v, w, hw0, hwW, ?_⟩
have hdu := hdecomp u hu
have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this.symm
simp only [hg, hreal]
exact hvw)
(by rw [hXinv]; exact hX)
rw [hXinv, hcardT] at key
have : 65536 * N' * X ≤ 65536 * (N / q) * X := by
apply mul_le_mul_of_nonneg_right _ hX0
apply mul_le_mul_of_nonneg_left _ (by norm_num)
rw [hN']
apply div_le_div_of_nonneg_right _ hqpos.le
have : (0 : ℝ) ≤ c := by positivity
linarith
linarith
· push_neg at hNc
-- the class contains at most the single point `c`
have hle : T.card ≤ 1 := by
rw [Finset.card_le_one]
intro u hu u' hu'
have key : ∀ x ∈ T, x = c := by
intro x hx
have hxS := (hmem x hx).1
obtain ⟨hx0, hx1⟩ := hS x hxS
have hdx := hdecomp x hx
have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N)
have hxc : x ≤ c := by
have : (x : ℝ) ≤ c := le_trans hxN hNc
exact_mod_cast this
have hcq' : (c : ℤ) < q := by exact_mod_cast hcq
have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩
have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega
have := Int.eq_zero_of_abs_lt_dvd hdvd habs
omega
rw [key u hu, key u' hu']
have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle
linarith
have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by
rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat)
(t := Finset.range q)]
· push_cast; rfl
· intro u _
simp only [Finset.coe_range, Set.mem_Iio]
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have h1 := Int.emod_nonneg u hqZ.ne'
have h2 := Int.emod_lt_of_pos u hqZ
omega
have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass
rw [← hsum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] at hlt
have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam')
= 65536 * N * X + 2 * (r : ℝ) * lam := by
rw [hlam']; field_simp
linarithThe 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--h3--h1--h1/attempts/20261015T063320Z-opn-prove-aristotle-1015-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--h3--h1--h1».Context
open scoped Nat
/-! Hole `h_thm` 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__h3__h1__h1 : ∀ (r : ℕ),
(2 : ℕ) ≤ r →
∀ (N : ℝ),
(0 : ℝ) < N →
∀ (W : ℝ),
(1 : ℝ) ≤ W →
∀ (δ : ℝ),
(0 : ℝ) < δ →
∀ (lam : ℝ),
(1 : ℝ) ≤ lam →
∀ (D_r : ℝ),
(0 : ℝ) < D_r →
∀ (D_r1 : ℝ),
(0 : ℝ) < D_r1 →
∀ (f : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f →
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) →
∀ (S : Finset ℤ),
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) →
(∀ u ∈ S,
∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
(↑S.card : ℝ) <
(65536 : ℝ) * N *
((D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam := 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 |S|<65536\,N\Bigl[(D_r\lambda^rW^2)^{\frac{1}{2r-1}}+\Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac{1}{r-1}}+\Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac{1}{2r}}\Bigr]+2r\lambda$
For every $r\ge 2$, $N>0$, $W\ge 1$, $\delta>0$, $\lambda\ge 1$, $D_r>0$, $D_{r+1}>0$ and every $f:\mathbb{R}\to\mathbb{R}$ of class $C^{r+1}$ with $D_r/2\le|f^{(r)}(x)|\le D_r$ and $|f^{(r+1)}(x)|\le D_{r+1}$ for all $x\in[0,N]$, every finite set $S$ of integers in $[0,\lfloor N\rfloor]$ each of whose points $u$ has $|f(u)-v/w|<\delta$ for some integer $v$ and natural $w$ with $0<w\le W$ satisfies the displayed bound: Konyagin's theorem on the integer points at which a function with controlled $r$-th and $(r+1)$-th derivatives is close to a rational of bounded denominator. The Lean names $\lambda$ lam, $D_{r+1}$ D_r1 and the derivatives iteratedDeriv; $|S|$ is cast to $\mathbb{R}$, the exponents $\tfrac{1}{2r-1}$, $\tfrac{1}{r-1}$, $\tfrac{1}{2r}$ are real powers and $W^2$ a natural one.
Rendered from gloss/31f46fdae880….md · Improve these words →
Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h2--h3--h1--h1/Statement.lean. Origin: compiler-derived.
Depends on (1), each in words
Depends on, each in words where someone has written them:
- erdos-1094--h2--h2--h2--h3--h1--h1--h1: $65536\,X'<1\ \Longrightarrow\ |S'|<65536\,N'X'+2r\lambda',\qquad X'=(D'\lambda'^{\,r}W^2)^{\frac{1}{2r-1}}+\Bigl(\frac{\delta W^2}{D'\lambda'^{\,r}}\Bigr)^{\frac{1}{r-1}}+\Bigl(\frac{D_1'\lambda' W^2}{D'}\Bigr)^{\frac{1}{2r}}$ · used by the proof
Attestation: pass, 7 of 7 checks
Checked by the kernel — the gate’s record of the run: attestations/000568.json, merge commit 3e4a866f1f30.
Verdict pass, from attestations/000568.json.
- Submitter
t1015c-a07- 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/000568.json, merge commit 3e4a866f1f30.
61709288f2d1.import Mathlib
open scoped Nat
theorem witness : ∃ (r : ℕ) (N : ℝ) (W : ℝ) (δ : ℝ) (lam : ℝ) (D_r : ℝ) (D_r1 : ℝ) (f : ℝ → ℝ) (S : Finset ℤ),
(2 : ℕ) ≤ r ∧
(0 : ℝ) < N ∧
(1 : ℝ) ≤ W ∧
(0 : ℝ) < δ ∧
(1 : ℝ) ≤ lam ∧
(0 : ℝ) < D_r ∧
(0 : ℝ) < D_r1 ∧
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f ∧
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) ∧
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) ∧
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) ∧
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) ∧
∀ u ∈ S,
∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ := by
have t1 : deriv (fun x : ℝ => x ^ 2) = fun x => 2 * x := by
funext x; simp
have t2 : deriv (fun x : ℝ => 2 * x) = fun _ => 2 := by
funext x; simp
have t3 : deriv (fun _ : ℝ => (2:ℝ)) = fun _ => 0 := by
funext x; simp
have d2 : iteratedDeriv 2 (fun x : ℝ => x ^ 2) = fun _ => 2 := by
rw [iteratedDeriv_succ, iteratedDeriv_one, t1, t2]
have d3 : iteratedDeriv (2 + 1) (fun x : ℝ => x ^ 2) = fun _ => 0 := by
rw [iteratedDeriv_succ, d2, t3]
refine ⟨2, 1, 1, 1, 1, 2, 1, fun x => x ^ 2, ∅, le_refl _, one_pos, le_refl _, one_pos, le_refl _,
two_pos, one_pos, by fun_prop, ?_, ?_, ?_, by simp, by simp⟩
· intro x _; rw [d2]; norm_num
· intro x _; rw [d2]; norm_num
· intro x _; rw [d3]; norm_numNo 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 opn-prove-aristotle-1015; merged in 56c054dd0646 under attestations/000534.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--h3--h1--h1/attempts/20261015T063320Z-opn-prove-aristotle-1015-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 20261015T063320Z-opn-prove-aristotle-1015-partial.lean, extracted by the gate at 7e153a12f0ce 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.
hflhave(0 : ℤ) ≤ ⌊N⌋Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhfl : (0 : ℤ) ≤ ⌊N⌋.Uses library
Int.floor_nonneg.Lean, line 43
have hfl : (0 : ℤ) ≤ ⌊N⌋ := Int.floor_nonneg.mpr hN.le
hsubhaveS ⊆ Finset.Icc (0 : ℤ) ⌊N⌋Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.mem_Icc,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 44–46
have hsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋ := fun u hu => by obtain ⟨a, b⟩ := hS u hu exact Finset.mem_Icc.mpr ⟨a, b⟩hsub.s1obtain(0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋Leaves
u ∈ Finset.Icc (0 : ℤ) ⌊N⌋, witha : (0 : ℤ) ≤ u,b : u ≤ ⌊N⌋.Lean, line 45
obtain ⟨a, b⟩ := hS u hu
hcardZhave(↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhcardZ : (↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ).Uses library
Int.card_Icc.Lean, lines 47–50
have hcardZ : (S.card : ℤ) ≤ ⌊N⌋ + 1 := by have := Finset.card_le_card hsub rw [Int.card_Icc] at this omegahcardZ.thishaveS.card ≤ (Finset.Icc (0 : ℤ) ⌊N⌋).cardLeaves
(↑S.card : ℤ) ≤ ⌊N⌋ + (1 : ℤ), withthis : S.card ≤ (Finset.Icc (0 : ℤ) ⌊N⌋).card.Uses library
Finset.card_le_card.Lean, line 48
have := Finset.card_le_card hsub
hcardhave(↑S.card : ℝ) ≤ N + (1 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhcard : (↑S.card : ℝ) ≤ N + (1 : ℝ).Uses library
Int.floor_le.Lean, lines 51–54
have hcard : (S.card : ℝ) ≤ N + 1 := by have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ push_cast at h' linarith [Int.floor_le N]hcard.h'have(↑(↑S.card : ℤ) : ℝ) ≤ (↑(⌊N⌋ + (1 : ℤ)) : ℝ)Leaves
(↑S.card : ℝ) ≤ N + (1 : ℝ), withh' : (↑(↑S.card : ℤ) : ℝ) ≤ (↑(⌊N⌋ + (1 : ℤ)) : ℝ).Lean, line 52
have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ
hr2have(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhr2 : (4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam.Lean, lines 55–57
have hr2 : (4 : ℝ) ≤ 2 * (r : ℝ) * lam := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarithhr2.thishave(2 : ℝ) ≤ (↑r : ℝ)Leaves
(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam, withthis : (2 : ℝ) ≤ (↑r : ℝ).Lean, line 56
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
s6caseLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX : (1 : ℝ) ≤ (65536 : ℝ) * X.Lean, lines 59–60
· have : N ≤ 65536 * N * X := by nlinarith linariths6.thishaveN ≤ (65536 : ℝ) * N * Xroutine: nlinarithLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withthis : N ≤ (65536 : ℝ) * N * X.Lean, line 59
· have : N ≤ 65536 * N * X := by nlinarith
s7caseLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX : ¬(1 : ℝ) ≤ (65536 : ℝ) * X.Uses library
Finset.sum_const,Finset.card_range,nsmul_eq_mul.Lean, lines 61–258
· push_neg at hX -- the remaining (hard) case, for a scale parameter in `[1, 2)` have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 → ∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → 65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 → (↑S'.card : ℝ) < 65536 * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam' := by sorry -- reduction of a general scale `lam` to a scale in `[1, 2)` via residue classes set q : ℕ := ⌊lam⌋₊ with hqdef have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam) have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1 have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith) have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam set lam' : ℝ := lam / q with hlam' have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith have hl2 : lam' < 2 := by rw [hlam', div_lt_iff₀ hqpos] have : (1 : ℝ) ≤ q := by exact_mod_cast hq1 linarith have hX0 : 0 ≤ X := by rw [hXdef] have := hDr.le; have := hDr1.le; have := hδ.le have hl0 : 0 ≤ lam := by linarith positivity have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X := by have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne'] have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring rw [hXdef, e2, mul_assoc D_r, e1] have hclass : ∀ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) < 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by intro c hc have hcq : c < q := Finset.mem_range.mp hc set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omega have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omega set T' := T.image (fun u => u / (q : ℤ)) with hT' have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu] have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarith have hNq : 0 ≤ 65536 * (N / q) * X := by positivity by_cases hNc : (c : ℝ) < N · set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linarith · push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linarith have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat) (t := Finset.range q)] · push_cast; rfl · intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omega have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass rw [← hsum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] at hlt have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam') = 65536 * N * X + 2 * (r : ℝ) * lam := by rw [hlam']; field_simp linariths7.corehole∀ (N' : ℝ), (0 : ℝ) < N' → ∀ (lam' : ℝ), (1 : ℝ) ≤ lam' → lam' < (2 : ℝ) → ∀ (D' : ℝ), (0 : ℝ) < D' → ∀ (D1' : ℝ), (0 : ℝ) < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → (65536 : ℝ) * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < (1 : ℝ) → (↑S'.card : ℝ) < (65536 : ℝ) * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'holeLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withcore : ∀ (N' : ℝ), (0 : ℝ) < N' → ∀ (lam' : ℝ), (1 : ℝ) ≤ lam' → lam' < (2 : ℝ) → ∀ (D' : ℝ), (0 : ℝ) < D' → ∀ (D1' : ℝ), (0 : ℝ) < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → (65536 : ℝ) * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < (1 : ℝ) → (↑S'.card : ℝ) < (65536 : ℝ) * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'.Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,WithTopAttach⊤to a type. ,Set.IccIcc a bis the left-closed right-closed interval $[a, b]$. ,iteratedDerivThen-th iterated derivative of a function from𝕜toF, as a function from𝕜toF. ,FinsetFinset αis the type of finite sets of elements ofα. .Left open as a hole; its statement is erdos-1094--h2--h2--h2--h3--h1--h1--h1 (proved).
Lean, lines 63–80
have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 → ∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ), ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g → (∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') → (∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') → ∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) → (∀ u ∈ S', ∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) → 65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 → (↑S'.card : ℝ) < 65536 * N' * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam' := by sorrys7.hq1have(1 : ℕ) ≤ qLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhq1 : (1 : ℕ) ≤ q.Uses library
Nat.le_floor.Lean, line 83
have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam)
s7.hqposhave(0 : ℝ) < (↑q : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqpos : (0 : ℝ) < (↑q : ℝ).Lean, line 84
have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1
s7.hqlehave(↑q : ℝ) ≤ lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqle : (↑q : ℝ) ≤ lam.Uses library
Nat.floor_le.Lean, line 85
have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith)
s7.hqlthavelam < (↑q : ℝ) + (1 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhqlt : lam < (↑q : ℝ) + (1 : ℝ).Uses library
Nat.lt_floor_add_one.Lean, line 86
have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam
s7.hl1have(1 : ℝ) ≤ lam'Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhl1 : (1 : ℝ) ≤ lam'.Uses library
le_div_iff₀Seele_div_iff₀'for a version with multiplication on the other side. .Lean, line 88
have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith
s7.hl2havelam' < (2 : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhl2 : lam' < (2 : ℝ).Uses library
div_lt_iff₀Seediv_lt_iff₀'for a version with multiplication on the other side. .Lean, lines 89–92
have hl2 : lam' < 2 := by rw [hlam', div_lt_iff₀ hqpos] have : (1 : ℝ) ≤ q := by exact_mod_cast hq1 linariths7.hl2.thishave(1 : ℝ) ≤ (↑q : ℝ)Leaves
lam < (2 : ℝ) * (↑q : ℝ), withthis : (1 : ℝ) ≤ (↑q : ℝ).Lean, line 91
have : (1 : ℝ) ≤ q := by exact_mod_cast hq1
s7.hX0have(0 : ℝ) ≤ XLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhX0 : (0 : ℝ) ≤ X.Lean, lines 93–97
have hX0 : 0 ≤ X := by rw [hXdef] have := hDr.le; have := hDr1.le; have := hδ.le have hl0 : 0 ≤ lam := by linarith positivitys7.hX0.s1have(0 : ℝ) ≤ D_rLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ D_r.Lean, line 95
have := hDr.le; have := hDr1.le; have := hδ.le
s7.hX0.s2have(0 : ℝ) ≤ D_r1Leaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ D_r1.Lean, line 95
have := hDr.le; have := hDr1.le; have := hδ.le
s7.hX0.s3have(0 : ℝ) ≤ δLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withthis : (0 : ℝ) ≤ δ.Lean, line 95
have := hDr.le; have := hDr1.le; have := hδ.le
s7.hX0.hl0have(0 : ℝ) ≤ lamroutine: linarithLeaves
(0 : ℝ) ≤ (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹, withhl0 : (0 : ℝ) ≤ lam.Lean, line 96
have hl0 : 0 ≤ lam := by linarith
s7.hXinvhave(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = XLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhXinv : (D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X.Uses library
mul_assoc.Lean, lines 98–107
have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X := by have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne'] have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring rw [hXdef, e2, mul_assoc D_r, e1]s7.hXinv.e1have(↑q : ℝ) ^ r * lam' ^ r = lam ^ rLeaves
(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X, withe1 : (↑q : ℝ) ^ r * lam' ^ r = lam ^ r.Uses library
mul_pow,mul_div_cancel₀.Lean, lines 102–103
have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne']s7.hXinv.e2haveD_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_rLeaves
(D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ = X, withe2 : D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r.Lean, lines 104–106
have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r) = D_r1 * lam * W ^ (2 : ℕ) / D_r := by rw [hlam']; field_simp; ring
s7.hclasshave∀ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhclass : ∀ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam'.Uses library
Finset.rangerange nis the set of natural numbers less thann. .Lean, lines 108–241
have hclass : ∀ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) < 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by intro c hc have hcq : c < q := Finset.mem_range.mp hc set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omega have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omega set T' := T.image (fun u => u / (q : ℤ)) with hT' have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu] have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinarith have hNq : 0 ≤ 65536 * (N / q) * X := by positivity by_cases hNc : (c : ℝ) < N · set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linarith · push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linariths7.hclass.hcqhavec < qLeaves
(↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhcq : c < q.Uses library
Finset.mem_range.Lean, line 112
have hcq : c < q := Finset.mem_range.mp hc
s7.hclass.hqZhave(0 : ℤ) < (↑q : ℤ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhqZ : (0 : ℤ) < (↑q : ℤ).Lean, line 114
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
s7.hclass.hmemhave∀ u ∈ T, u ∈ S ∧ u % (↑q : ℤ) = (↑c : ℤ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhmem : ∀ u ∈ T, u ∈ S ∧ u % (↑q : ℤ) = (↑c : ℤ).Uses library
Finset.mem_filter,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. .Lean, lines 115–120
have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by intro u hu rw [hT, Finset.mem_filter] at hu refine ⟨hu.1, ?_⟩ have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne' omegas7.hclass.hmem.h0have(0 : ℤ) ≤ u % (↑q : ℤ)Leaves
u % (↑q : ℤ) = (↑c : ℤ), withh0 : (0 : ℤ) ≤ u % (↑q : ℤ).Uses library
Int.emod_nonneg.Lean, line 119
have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne'
s7.hclass.hdecomphave∀ u ∈ T, u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhdecomp : ∀ u ∈ T, u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, lines 121–125
have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by intro u hu have := Int.emod_add_mul_ediv u q rw [(hmem u hu).2] at this omegas7.hclass.hdecomp.thishaveu % (↑q : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)) = uLeaves
u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)), withthis : u % (↑q : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)) = u.Uses library
Int.emod_add_mul_ediv.Lean, line 123
have := Int.emod_add_mul_ediv u q
s7.hclass.hcardThaveT'.card = T.cardLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhcardT : T'.card = T.card.Uses library
Finset.card_image_of_injOn.Lean, lines 127–131
have hcardT : T'.card = T.card := by apply Finset.card_image_of_injOn intro u hu u' hu' huu simp only at huu rw [hdecomp u hu, hdecomp u' hu', huu]s7.hclass.hlam'poshave(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhlam'pos : (4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam'.Lean, lines 132–134
have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by have : (2 : ℝ) ≤ r := by exact_mod_cast hr nlinariths7.hclass.hlam'pos.thishave(2 : ℝ) ≤ (↑r : ℝ)Leaves
(4 : ℝ) ≤ (2 : ℝ) * (↑r : ℝ) * lam', withthis : (2 : ℝ) ≤ (↑r : ℝ).Lean, line 133
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
s7.hclass.hNqhave(0 : ℝ) ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * Xroutine: positivityLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNq : (0 : ℝ) ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * X.Lean, line 135
have hNq : 0 ≤ 65536 * (N / q) * X := by positivity
s7.hclass.s8caseLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNc : (↑c : ℝ) < N.Lean, lines 137–219
· set N' : ℝ := (N - c) / q with hN' have hN'pos : 0 < N' := div_pos (by linarith) hqpos set g : ℝ → ℝ := fun t => f (c + q * t) with hg have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add] have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id)) have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linarith have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX) rw [hXinv, hcardT] at key have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linarith linariths7.hclass.s8.hN'poshave(0 : ℝ) < N'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhN'pos : (0 : ℝ) < N'.Uses library
div_pos.Lean, line 138
have hN'pos : 0 < N' := div_pos (by linarith) hqpos
s7.hclass.s8.hgfunhave∀ k ≤ r + (1 : ℕ), ∀ (t : ℝ), iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhgfun : ∀ k ≤ r + (1 : ℕ), ∀ (t : ℝ), iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t).Uses library
iteratedDerivThen-th iterated derivative of a function from𝕜toF, as a function from𝕜toF. ,rflrfl : a = ais the unique constructor of the equality type. ,iteratedDeriv_comp_const_addThe iterated derivative commutes with shifting the function by a constant on the left. .Lean, lines 140–150
have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t = (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by intro k hk t have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id) have := iteratedDeriv_comp_const_mul hf1 (q : ℝ) have h2 := congrFun this t try simp only at h2 rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2, iteratedDeriv_comp_const_add]s7.hclass.s8.hgfun.hf1haveContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withhf1 : ContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z).Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,contDiff_constConstants areC^∞. ,contDiff_idThe identity isC^n. .Lean, lines 143–145
have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk) exact this.comp (contDiff_const.add contDiff_id)s7.hclass.s8.hgfun.hf1.thishaveContDiff ℝ (↑k : WithTop ℕ∞) fLeaves
ContDiff ℝ (↑k : WithTop ℕ∞) fun (z : ℝ) => f ((↑c : ℝ) + z), withthis : ContDiff ℝ (↑k : WithTop ℕ∞) f.Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. .Lean, line 144
have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk)
s7.hclass.s8.hgfun.thishave(iteratedDeriv k fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) = fun (x : ℝ) => (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * x)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withthis : (iteratedDeriv k fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) = fun (x : ℝ) => (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * x).Uses library
iteratedDeriv_comp_const_mul.Lean, line 146
have := iteratedDeriv_comp_const_mul hf1 (q : ℝ)
s7.hclass.s8.hgfun.h2haveiteratedDeriv k (fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) t = (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * t)Leaves
iteratedDeriv k g t = (↑q : ℝ) ^ k * iteratedDeriv k f ((↑c : ℝ) + (↑q : ℝ) * t), withh2 : iteratedDeriv k (fun (x : ℝ) => f ((↑c : ℝ) + (↑q : ℝ) * x)) t = (↑q : ℝ) ^ k * iteratedDeriv k (fun (z : ℝ) => f ((↑c : ℝ) + z)) ((↑q : ℝ) * t).Uses library
congrFunCongruence in the function part of an application: Iff = gthenf a = g a. .Lean, line 147
have h2 := congrFun this t
s7.hclass.s8.hgChaveContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) gLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g.Uses library
ContDiffA function is continuously differentiable up tonif it admits derivatives up to ordern, which are continuous. ,WithTopAttach⊤to a type. ,contDiff_constConstants areC^∞. ,contDiff_idThe identity isC^n. .Lean, lines 151–152
have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g := hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id))s7.hclass.s8.hIcchave∀ x ∈ Set.Icc (0 : ℝ) N', (↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) NLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) N.Uses library
Set.IccIcc a bis the left-closed right-closed interval $[a, b]$. .Lean, lines 153–160
have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by intro x hx obtain ⟨hx0, hx1⟩ := hx constructor · positivity · have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linariths7.hclass.s8.hIcc.s1obtainx ∈ Set.Icc (0 : ℝ) N'Leaves
(↑c : ℝ) + (↑q : ℝ) * x ∈ Set.Icc (0 : ℝ) N, withhx0 : (0 : ℝ) ≤ x,hx1 : x ≤ N'.Lean, line 155
obtain ⟨hx0, hx1⟩ := hx
s7.hclass.s8.hIcc.s2case routine: positivityLeaves
(0 : ℝ) ≤ (↑c : ℝ) + (↑q : ℝ) * x.s7.hclass.s8.hIcc.s3caseLeaves
(↑c : ℝ) + (↑q : ℝ) * x ≤ N.Uses library
mul_div_cancel₀.Lean, lines 158–160
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this linariths7.hclass.s8.hIcc.s3.thishave(↑q : ℝ) * x ≤ (↑q : ℝ) * N'Leaves
(↑c : ℝ) + (↑q : ℝ) * x ≤ N, withthis : (↑q : ℝ) * x ≤ (↑q : ℝ) * N'.Uses library
mul_le_mul_of_nonneg_left.Lean, line 158
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le
s7.hclass.s8.hqrhave(0 : ℝ) < (↑q : ℝ) ^ rLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhqr : (0 : ℝ) < (↑q : ℝ) ^ r.Uses library
pow_pos.Lean, line 161
have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r
s7.hclass.s8.keyhave(↑T'.card : ℝ) < (65536 : ℝ) * N' * ((D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withkey : (↑T'.card : ℝ) < (65536 : ℝ) * N' * ((D_r * (↑q : ℝ) ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + (δ * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + (D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)) * lam' * W ^ (2 : ℕ) / (D_r * (↑q : ℝ) ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam'.Uses library
abs_mul,abs_of_pos,le_rflA version ofle_reflwhere the argument is implicit ,pow_pos,Finset.mem_image,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,Int.ediv_nonneg,Int.le_floor,le_div_iff₀Seele_div_iff₀'for a version with multiplication on the other side. ,Exists.introExistential introduction. .Lean, lines 162–210
have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity) (D_r1 * q ^ (r + 1)) (by positivity) g hgC (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h1 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun r (by omega), abs_mul, abs_of_pos hqr] have := h2 _ (hIcc x hx) nlinarith) (by intro x hx rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)] have := h3 _ (hIcc x hx) have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _ nlinarith) T' (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht have huS := (hmem u hu).1 obtain ⟨hu0, hu1⟩ := hS u huS refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩ apply Int.le_floor.mpr rw [hN', le_div_iff₀ hqpos] have hdu := hdecomp u hu have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N) linarith) (by intro t ht rw [hT', Finset.mem_image] at ht obtain ⟨u, hu, rfl⟩ := ht obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1 refine ⟨v, w, hw0, hwW, ?_⟩ have hdu := hdecomp u hu have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symm simp only [hg, hreal] exact hvw) (by rw [hXinv]; exact hX)s7.hclass.s8.key.s1haveD_r / (2 : ℝ) ≤ |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|Leaves
D_r * (↑q : ℝ) ^ r / (2 : ℝ) ≤ (↑q : ℝ) ^ r * |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|, withthis : D_r / (2 : ℝ) ≤ |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)|.Lean, line 167
have := h1 _ (hIcc x hx)
s7.hclass.s8.key.s2have|iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_rLeaves
(↑q : ℝ) ^ r * |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r * (↑q : ℝ) ^ r, withthis : |iteratedDeriv r f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r.Lean, line 172
have := h2 _ (hIcc x hx)
s7.hclass.s8.key.s3have|iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1Leaves
(↑q : ℝ) ^ (r + (1 : ℕ)) * |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)), withthis : |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1.Lean, line 177
have := h3 _ (hIcc x hx)
s7.hclass.s8.key.s4have(0 : ℝ) < (↑q : ℝ) ^ (r + (1 : ℕ))Leaves
(↑q : ℝ) ^ (r + (1 : ℕ)) * |iteratedDeriv (r + (1 : ℕ)) f ((↑c : ℝ) + (↑q : ℝ) * x)| ≤ D_r1 * (↑q : ℝ) ^ (r + (1 : ℕ)), withthis : (0 : ℝ) < (↑q : ℝ) ^ (r + (1 : ℕ)).Uses library
pow_pos.Lean, line 178
have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _
s7.hclass.s8.key.s5obtain∃ a ∈ T, a / (↑q : ℤ) = tLeaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withu : ℤ,hu : u ∈ T.Lean, line 184
obtain ⟨u, hu, rfl⟩ := ht
s7.hclass.s8.key.huShaveu ∈ SLeaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withhuS : u ∈ S.Lean, line 185
have huS := (hmem u hu).1
s7.hclass.s8.key.s7obtain(0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋Leaves
(0 : ℤ) ≤ u / (↑q : ℤ) ∧ u / (↑q : ℤ) ≤ ⌊N'⌋, withhu0 : (0 : ℤ) ≤ u,hu1 : u ≤ ⌊N⌋.Lean, line 186
obtain ⟨hu0, hu1⟩ := hS u huS
s7.hclass.s8.key.s8haveu = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withhdu : u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, line 190
have hdu := hdecomp u hu
s7.hclass.s8.key.s9have(↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ)Leaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withhreal : (↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ).Lean, lines 191–194
have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact thiss7.hclass.s8.key.s9.thishave(↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ)Leaves
(↑u : ℝ) = (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ), withthis : (↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ).Uses library
congrArgCongruence in the function argument: ifa₁ = a₂thenf a₁ = f a₂for any (nondependent) functionf. .Lean, line 192
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
s7.hclass.s8.key.s10have(↑u : ℝ) ≤ NLeaves
(↑(u / (↑q : ℤ)) : ℝ) * (↑q : ℝ) ≤ N - (↑c : ℝ), withthis : (↑u : ℝ) ≤ N.Uses library
le_transThe relation≤on a preorder is transitive. ,Int.floor_le.Lean, line 195
have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N)
s7.hclass.s8.key.s11obtain∃ a ∈ T, a / (↑q : ℤ) = tLeaves
∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withu : ℤ,hu : u ∈ T.Lean, line 200
obtain ⟨u, hu, rfl⟩ := ht
s7.hclass.s8.key.s12obtain∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δLeaves
∃ (v : ℤ) (w : ℕ), (0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withv : ℤ,w : ℕ,hw0 : (0 : ℕ) < w,hwW : (↑w : ℝ) ≤ W,hvw : |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ.Lean, line 201
obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1
s7.hclass.s8.key.s13haveu = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))Leaves
|g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withhdu : u = (↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ)).Lean, line 203
have hdu := hdecomp u hu
s7.hclass.s8.key.s14have(↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ)Leaves
|g (↑(u / (↑q : ℤ)) : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ, withhreal : (↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ).Lean, lines 204–207
have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by have := congrArg (fun z : ℤ => (z : ℝ)) hdu push_cast at this exact this.symms7.hclass.s8.key.s14.thishave(↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ)Leaves
(↑c : ℝ) + (↑q : ℝ) * (↑(u / (↑q : ℤ)) : ℝ) = (↑u : ℝ), withthis : (↑u : ℝ) = (↑((↑c : ℤ) + (↑q : ℤ) * (u / (↑q : ℤ))) : ℝ).Uses library
congrArgCongruence in the function argument: ifa₁ = a₂thenf a₁ = f a₂for any (nondependent) functionf. .Lean, line 205
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
s7.hclass.s8.thishave(65536 : ℝ) * N' * X ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * XLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withthis : (65536 : ℝ) * N' * X ≤ (65536 : ℝ) * (N / (↑q : ℝ)) * X.Uses library
mul_le_mul_of_nonneg_right,mul_le_mul_of_nonneg_left,div_le_div_of_nonneg_right.Lean, lines 212–218
have : 65536 * N' * X ≤ 65536 * (N / q) * X := by apply mul_le_mul_of_nonneg_right _ hX0 apply mul_le_mul_of_nonneg_left _ (by norm_num) rw [hN'] apply div_le_div_of_nonneg_right _ hqpos.le have : (0 : ℝ) ≤ c := by positivity linariths7.hclass.s8.this.thishave(0 : ℝ) ≤ (↑c : ℝ)routine: positivityLeaves
N - (↑c : ℝ) ≤ N, withthis : (0 : ℝ) ≤ (↑c : ℝ).Lean, line 217
have : (0 : ℝ) ≤ c := by positivity
s7.hclass.s9caseLeaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhNc : ¬(↑c : ℝ) < N.Lean, lines 220–241
· push_neg at hNc -- the class contains at most the single point `c` have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu'] have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle linariths7.hclass.s9.hlehaveT.card ≤ (1 : ℕ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withhle : T.card ≤ (1 : ℕ).Uses library
Finset.card_le_one.Lean, lines 222–239
have hle : T.card ≤ 1 := by rw [Finset.card_le_one] intro u hu u' hu' have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omega rw [key u hu, key u' hu']s7.hclass.s9.hle.keyhave∀ x ∈ T, x = (↑c : ℤ)Leaves
u = u', withkey : ∀ x ∈ T, x = (↑c : ℤ).Lean, lines 225–238
have key : ∀ x ∈ T, x = c := by intro x hx have hxS := (hmem x hx).1 obtain ⟨hx0, hx1⟩ := hS x hxS have hdx := hdecomp x hx have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N) have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast this have hcq' : (c : ℤ) < q := by exact_mod_cast hcq have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩ have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega have := Int.eq_zero_of_abs_lt_dvd hdvd habs omegas7.hclass.s9.hle.key.hxShavex ∈ SLeaves
x = (↑c : ℤ), withhxS : x ∈ S.Lean, line 227
have hxS := (hmem x hx).1
s7.hclass.s9.hle.key.s2obtain(0 : ℤ) ≤ x ∧ x ≤ ⌊N⌋Leaves
x = (↑c : ℤ), withhx0 : (0 : ℤ) ≤ x,hx1 : x ≤ ⌊N⌋.Lean, line 228
obtain ⟨hx0, hx1⟩ := hS x hxS
s7.hclass.s9.hle.key.hdxhavex = (↑c : ℤ) + (↑q : ℤ) * (x / (↑q : ℤ))Leaves
x = (↑c : ℤ), withhdx : x = (↑c : ℤ) + (↑q : ℤ) * (x / (↑q : ℤ)).Lean, line 229
have hdx := hdecomp x hx
s7.hclass.s9.hle.key.hxNhave(↑x : ℝ) ≤ NLeaves
x = (↑c : ℤ), withhxN : (↑x : ℝ) ≤ N.Uses library
le_transThe relation≤on a preorder is transitive. ,Int.floor_le.Lean, line 230
have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N)
s7.hclass.s9.hle.key.hxchavex ≤ (↑c : ℤ)Leaves
x = (↑c : ℤ), withhxc : x ≤ (↑c : ℤ).Lean, lines 231–233
have hxc : x ≤ c := by have : (x : ℝ) ≤ c := le_trans hxN hNc exact_mod_cast thiss7.hclass.s9.hle.key.hxc.thishave(↑x : ℝ) ≤ (↑c : ℝ)Leaves
x ≤ (↑c : ℤ), withthis : (↑x : ℝ) ≤ (↑c : ℝ).Uses library
le_transThe relation≤on a preorder is transitive. .Lean, line 232
have : (x : ℝ) ≤ c := le_trans hxN hNc
s7.hclass.s9.hle.key.hcq'have(↑c : ℤ) < (↑q : ℤ)Leaves
x = (↑c : ℤ), withhcq' : (↑c : ℤ) < (↑q : ℤ).Lean, line 234
have hcq' : (c : ℤ) < q := by exact_mod_cast hcq
s7.hclass.s9.hle.key.hdvdhave(↑q : ℤ) ∣ x - (↑c : ℤ)Leaves
x = (↑c : ℤ), withhdvd : (↑q : ℤ) ∣ x - (↑c : ℤ).Uses library
Exists.introExistential introduction. .Lean, line 235
have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩
s7.hclass.s9.hle.key.habshave|x - (↑c : ℤ)| < (↑q : ℤ)Leaves
x = (↑c : ℤ), withhabs : |x - (↑c : ℤ)| < (↑q : ℤ).Uses library
abs_lt.Lean, line 236
have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega
s7.hclass.s9.hle.key.thishavex - (↑c : ℤ) = (0 : ℤ)Leaves
x = (↑c : ℤ), withthis : x - (↑c : ℤ) = (0 : ℤ).Uses library
Int.eq_zero_of_abs_lt_dvd.Lean, line 237
have := Int.eq_zero_of_abs_lt_dvd hdvd habs
s7.hclass.s9.thishave(↑T.card : ℝ) ≤ (1 : ℝ)Leaves
(↑T.card : ℝ) < (65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam', withthis : (↑T.card : ℝ) ≤ (1 : ℝ).Lean, line 240
have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle
s7.hsumhave(↑S.card : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ)Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhsum : (↑S.card : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ).Uses library
Finset.rangerange nis the set of natural numbers less thann. ,Finset.card_eq_sum_card_fiberwise.Lean, lines 242–252
have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q, ((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat) (t := Finset.range q)] · push_cast; rfl · intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omegas7.hsum.s1caseLeaves
(↑(∑ b ∈ Finset.range q, {a ∈ S | (a % (↑q : ℤ)).toNat = b}.card) : ℝ) = ∑ c ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = c}.card : ℝ).s7.hsum.s2caseLeaves
Set.MapsTo (fun (u : ℤ) => (u % (↑q : ℤ)).toNat) (↑S : Set ℤ) (↑(Finset.range q) : Set ℕ).Uses library
Finset.coe_range,Set.mem_Iio.Lean, lines 247–252
· intro u _ simp only [Finset.coe_range, Set.mem_Iio] have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1 have h1 := Int.emod_nonneg u hqZ.ne' have h2 := Int.emod_lt_of_pos u hqZ omegas7.hsum.s2.hqZhave(0 : ℤ) < (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withhqZ : (0 : ℤ) < (↑q : ℤ).Lean, line 249
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
s7.hsum.s2.h1have(0 : ℤ) ≤ u % (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withh1 : (0 : ℤ) ≤ u % (↑q : ℤ).Uses library
Int.emod_nonneg.Lean, line 250
have h1 := Int.emod_nonneg u hqZ.ne'
s7.hsum.s2.h2haveu % (↑q : ℤ) < (↑q : ℤ)Leaves
(u % (↑q : ℤ)).toNat < q, withh2 : u % (↑q : ℤ) < (↑q : ℤ).Uses library
Int.emod_lt_of_pos.Lean, line 251
have h2 := Int.emod_lt_of_pos u hqZ
s7.hlthave∑ i ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = i}.card : ℝ) < ∑ i ∈ Finset.range q, ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam')Leaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withhlt : ∑ i ∈ Finset.range q, (↑{u ∈ S | (u % (↑q : ℤ)).toNat = i}.card : ℝ) < ∑ i ∈ Finset.range q, ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam').Uses library
Finset.sum_lt_sum_of_nonemptyIn an ordered additive commutative monoid, if each summandf iof one nontrivial finite sum is strictly less than the corresponding summandg iof another nontrivial finite sum, thens.sum f < s.sum g. ,Finset.nonempty_range_iff.Lean, line 253
have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass
s7.thishave(↑q : ℝ) * ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam') = (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lamLeaves
(↑S.card : ℝ) < (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam, withthis : (↑q : ℝ) * ((65536 : ℝ) * (N / (↑q : ℝ)) * X + (2 : ℝ) * (↑r : ℝ) * lam') = (65536 : ℝ) * N * X + (2 : ℝ) * (↑r : ℝ) * lam.Lean, lines 255–257
have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam') = 65536 * N * X + 2 * (r : ℝ) * lam := by rw [hlam']; field_simp
import Mathlib
import Nodes.«erdos-1094--h2--h2--h2--h3--h1--h1».Context
open scoped Nat
/-! Hole `h_thm` 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__h3__h1__h1 : ∀ (r : ℕ),
(2 : ℕ) ≤ r →
∀ (N : ℝ),
(0 : ℝ) < N →
∀ (W : ℝ),
(1 : ℝ) ≤ W →
∀ (δ : ℝ),
(0 : ℝ) < δ →
∀ (lam : ℝ),
(1 : ℝ) ≤ lam →
∀ (D_r : ℝ),
(0 : ℝ) < D_r →
∀ (D_r1 : ℝ),
(0 : ℝ) < D_r1 →
∀ (f : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) f →
(∀ x ∈ Set.Icc (0 : ℝ) N, D_r / (2 : ℝ) ≤ |iteratedDeriv r f x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv r f x| ≤ D_r) →
(∀ x ∈ Set.Icc (0 : ℝ) N, |iteratedDeriv (r + (1 : ℕ)) f x| ≤ D_r1) →
∀ (S : Finset ℤ),
(∀ u ∈ S, (0 : ℤ) ≤ u ∧ u ≤ ⌊N⌋) →
(∀ u ∈ S,
∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |f (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
(↑S.card : ℝ) <
(65536 : ℝ) * N *
((D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam := by
intro r hr N hN W hW δ hδ lam hlam D_r hDr D_r1 hDr1 f hf h1 h2 h3 S hS hS2
set X : ℝ := (D_r * lam ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * lam * W ^ (2 : ℕ) / D_r) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ with hXdef
have hfl : (0 : ℤ) ≤ ⌊N⌋ := Int.floor_nonneg.mpr hN.le
have hsub : S ⊆ Finset.Icc (0 : ℤ) ⌊N⌋ := fun u hu => by
obtain ⟨a, b⟩ := hS u hu
exact Finset.mem_Icc.mpr ⟨a, b⟩
have hcardZ : (S.card : ℤ) ≤ ⌊N⌋ + 1 := by
have := Finset.card_le_card hsub
rw [Int.card_Icc] at this
omega
have hcard : (S.card : ℝ) ≤ N + 1 := by
have h' : ((S.card : ℤ) : ℝ) ≤ ((⌊N⌋ + 1 : ℤ) : ℝ) := by exact_mod_cast hcardZ
push_cast at h'
linarith [Int.floor_le N]
have hr2 : (4 : ℝ) ≤ 2 * (r : ℝ) * lam := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
by_cases hX : 1 ≤ 65536 * X
· have : N ≤ 65536 * N * X := by nlinarith
linarith
· push_neg at hX
-- the remaining (hard) case, for a scale parameter in `[1, 2)`
have core : ∀ (N' : ℝ), 0 < N' → ∀ (lam' : ℝ), 1 ≤ lam' → lam' < 2 →
∀ (D' : ℝ), 0 < D' → ∀ (D1' : ℝ), 0 < D1' → ∀ (g : ℝ → ℝ),
ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g →
(∀ x ∈ Set.Icc (0 : ℝ) N', D' / (2 : ℝ) ≤ |iteratedDeriv r g x|) →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv r g x| ≤ D') →
(∀ x ∈ Set.Icc (0 : ℝ) N', |iteratedDeriv (r + (1 : ℕ)) g x| ≤ D1') →
∀ (S' : Finset ℤ), (∀ u ∈ S', (0 : ℤ) ≤ u ∧ u ≤ ⌊N'⌋) →
(∀ u ∈ S', ∃ (v : ℤ) (w : ℕ),
(0 : ℕ) < w ∧ (↑w : ℝ) ≤ W ∧ |g (↑u : ℝ) - (↑v : ℝ) / (↑w : ℝ)| < δ) →
65536 * ((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) < 1 →
(↑S'.card : ℝ) < 65536 * N' *
((D' * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D' * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D1' * lam' * W ^ (2 : ℕ) / D') ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) +
(2 : ℝ) * (↑r : ℝ) * lam' := by
sorry
-- reduction of a general scale `lam` to a scale in `[1, 2)` via residue classes
set q : ℕ := ⌊lam⌋₊ with hqdef
have hq1 : 1 ≤ q := Nat.le_floor (by exact_mod_cast hlam)
have hqpos : (0 : ℝ) < q := by exact_mod_cast hq1
have hqle : (q : ℝ) ≤ lam := Nat.floor_le (by linarith)
have hqlt : lam < q + 1 := Nat.lt_floor_add_one lam
set lam' : ℝ := lam / q with hlam'
have hl1 : 1 ≤ lam' := by rw [hlam', le_div_iff₀ hqpos]; linarith
have hl2 : lam' < 2 := by
rw [hlam', div_lt_iff₀ hqpos]
have : (1 : ℝ) ≤ q := by exact_mod_cast hq1
linarith
have hX0 : 0 ≤ X := by
rw [hXdef]
have := hDr.le; have := hDr1.le; have := hδ.le
have hl0 : 0 ≤ lam := by linarith
positivity
have hXinv : (D_r * q ^ r * lam' ^ r * W ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ +
(δ * W ^ (2 : ℕ) / (D_r * q ^ r * lam' ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ +
(D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹
= X := by
have e1 : (q : ℝ) ^ r * lam' ^ r = lam ^ r := by
rw [← mul_pow, hlam', mul_div_cancel₀ _ hqpos.ne']
have e2 : D_r1 * q ^ (r + 1) * lam' * W ^ (2 : ℕ) / (D_r * q ^ r)
= D_r1 * lam * W ^ (2 : ℕ) / D_r := by
rw [hlam']; field_simp; ring
rw [hXdef, e2, mul_assoc D_r, e1]
have hclass : ∀ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ)
< 65536 * (N / q) * X + 2 * (r : ℝ) * lam' := by
intro c hc
have hcq : c < q := Finset.mem_range.mp hc
set T := S.filter (fun u => (u % (q : ℤ)).toNat = c) with hT
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have hmem : ∀ u ∈ T, u ∈ S ∧ u % (q : ℤ) = c := by
intro u hu
rw [hT, Finset.mem_filter] at hu
refine ⟨hu.1, ?_⟩
have h0 : 0 ≤ u % (q : ℤ) := Int.emod_nonneg _ hqZ.ne'
omega
have hdecomp : ∀ u ∈ T, u = c + q * (u / q) := by
intro u hu
have := Int.emod_add_mul_ediv u q
rw [(hmem u hu).2] at this
omega
set T' := T.image (fun u => u / (q : ℤ)) with hT'
have hcardT : T'.card = T.card := by
apply Finset.card_image_of_injOn
intro u hu u' hu' huu
simp only at huu
rw [hdecomp u hu, hdecomp u' hu', huu]
have hlam'pos : (4 : ℝ) ≤ 2 * (r : ℝ) * lam' := by
have : (2 : ℝ) ≤ r := by exact_mod_cast hr
nlinarith
have hNq : 0 ≤ 65536 * (N / q) * X := by positivity
by_cases hNc : (c : ℝ) < N
· set N' : ℝ := (N - c) / q with hN'
have hN'pos : 0 < N' := div_pos (by linarith) hqpos
set g : ℝ → ℝ := fun t => f (c + q * t) with hg
have hgfun : ∀ k : ℕ, k ≤ r + 1 → ∀ t, iteratedDeriv k g t
= (q : ℝ) ^ k * iteratedDeriv k f (c + q * t) := by
intro k hk t
have hf1 : ContDiff ℝ k (fun z => f (c + z)) := by
have : ContDiff ℝ k f := hf.of_le (by exact_mod_cast hk)
exact this.comp (contDiff_const.add contDiff_id)
have := iteratedDeriv_comp_const_mul hf1 (q : ℝ)
have h2 := congrFun this t
try simp only at h2
rw [show g = fun x => (fun z => f (c + z)) (q * x) from rfl, h2,
iteratedDeriv_comp_const_add]
have hgC : ContDiff ℝ (↑(↑(r + (1 : ℕ)) : ℕ∞) : WithTop ℕ∞) g :=
hf.comp (contDiff_const.add (contDiff_const.mul contDiff_id))
have hIcc : ∀ x ∈ Set.Icc (0 : ℝ) N', (c : ℝ) + q * x ∈ Set.Icc (0 : ℝ) N := by
intro x hx
obtain ⟨hx0, hx1⟩ := hx
constructor
· positivity
· have : (q : ℝ) * x ≤ q * N' := mul_le_mul_of_nonneg_left hx1 hqpos.le
rw [hN', mul_div_cancel₀ _ hqpos.ne'] at this
linarith
have hqr : (0 : ℝ) < (q : ℝ) ^ r := pow_pos hqpos r
have key := core N' hN'pos lam' hl1 hl2 (D_r * q ^ r) (by positivity)
(D_r1 * q ^ (r + 1)) (by positivity) g hgC
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h1 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun r (by omega), abs_mul, abs_of_pos hqr]
have := h2 _ (hIcc x hx)
nlinarith)
(by
intro x hx
rw [hgfun (r + 1) le_rfl, abs_mul, abs_of_pos (pow_pos hqpos _)]
have := h3 _ (hIcc x hx)
have : (0 : ℝ) < (q : ℝ) ^ (r + 1) := pow_pos hqpos _
nlinarith)
T'
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
have huS := (hmem u hu).1
obtain ⟨hu0, hu1⟩ := hS u huS
refine ⟨Int.ediv_nonneg hu0 hqZ.le, ?_⟩
apply Int.le_floor.mpr
rw [hN', le_div_iff₀ hqpos]
have hdu := hdecomp u hu
have hreal : (u : ℝ) = c + q * ((u / q : ℤ) : ℝ) := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this
have : (u : ℝ) ≤ N := le_trans (by exact_mod_cast hu1) (Int.floor_le N)
linarith)
(by
intro t ht
rw [hT', Finset.mem_image] at ht
obtain ⟨u, hu, rfl⟩ := ht
obtain ⟨v, w, hw0, hwW, hvw⟩ := hS2 u (hmem u hu).1
refine ⟨v, w, hw0, hwW, ?_⟩
have hdu := hdecomp u hu
have hreal : (c : ℝ) + q * ((u / q : ℤ) : ℝ) = u := by
have := congrArg (fun z : ℤ => (z : ℝ)) hdu
push_cast at this
exact this.symm
simp only [hg, hreal]
exact hvw)
(by rw [hXinv]; exact hX)
rw [hXinv, hcardT] at key
have : 65536 * N' * X ≤ 65536 * (N / q) * X := by
apply mul_le_mul_of_nonneg_right _ hX0
apply mul_le_mul_of_nonneg_left _ (by norm_num)
rw [hN']
apply div_le_div_of_nonneg_right _ hqpos.le
have : (0 : ℝ) ≤ c := by positivity
linarith
linarith
· push_neg at hNc
-- the class contains at most the single point `c`
have hle : T.card ≤ 1 := by
rw [Finset.card_le_one]
intro u hu u' hu'
have key : ∀ x ∈ T, x = c := by
intro x hx
have hxS := (hmem x hx).1
obtain ⟨hx0, hx1⟩ := hS x hxS
have hdx := hdecomp x hx
have hxN : (x : ℝ) ≤ N := le_trans (by exact_mod_cast hx1) (Int.floor_le N)
have hxc : x ≤ c := by
have : (x : ℝ) ≤ c := le_trans hxN hNc
exact_mod_cast this
have hcq' : (c : ℤ) < q := by exact_mod_cast hcq
have hdvd : (q : ℤ) ∣ x - c := ⟨x / q, by omega⟩
have habs : |x - (c : ℤ)| < q := by rw [abs_lt]; constructor <;> omega
have := Int.eq_zero_of_abs_lt_dvd hdvd habs
omega
rw [key u hu, key u' hu']
have : (T.card : ℝ) ≤ 1 := by exact_mod_cast hle
linarith
have hsum : (S.card : ℝ) = ∑ c ∈ Finset.range q,
((S.filter (fun u => (u % (q : ℤ)).toNat = c)).card : ℝ) := by
rw [Finset.card_eq_sum_card_fiberwise (f := fun u => (u % (q : ℤ)).toNat)
(t := Finset.range q)]
· push_cast; rfl
· intro u _
simp only [Finset.coe_range, Set.mem_Iio]
have hqZ : (0 : ℤ) < q := by exact_mod_cast hq1
have h1 := Int.emod_nonneg u hqZ.ne'
have h2 := Int.emod_lt_of_pos u hqZ
omega
have hlt := Finset.sum_lt_sum_of_nonempty (Finset.nonempty_range_iff.mpr (by omega)) hclass
rw [← hsum, Finset.sum_const, Finset.card_range, nsmul_eq_mul] at hlt
have : (q : ℝ) * (65536 * (N / q) * X + 2 * (r : ℝ) * lam')
= 65536 * N * X + 2 * (r : ℝ) * lam := by
rw [hlam']; field_simp
linarith