Problems / erdos-1094 / erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2
integer cosine sums with a small negative part
erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2
proved
Hole h_cos of core with the multiple of k the only k-smooth element (split by 20261203T134056Z-t1203r2-k-partial.lean).
$\displaystyle \forall q\ge2\ \exists C\in\mathbb N\ \forall\nu,\rho\in\mathbb N:\ 1\le\rho\le\nu^q \Rightarrow \exists a_1,\dots,a_\rho\in\mathbb N:\ \sum_{k=1}^{\rho} a_k=\rho,\ \forall x\in\mathbb R:\ \sum_{k=1}^{\rho} a_k\cos(kx)\ge -C\nu$
For each exponent $q$ there are, for every positive integer $\rho$, non-negative integers $a_1,\dots,a_\rho$ with sum $\rho$ whose cosine sum is bounded below by $-C\nu$ for every $\nu$ with $\rho\le\nu^q$, that is by about $-C\rho^{1/q}$, with $C$ depending on $q$ alone. Belov and Konyagin (Izv. Math. 60:6, 1996, Corollary 0.2) prove the stronger lower bound $-2^{32}(1+\log\rho)^5$. In the Lean, a : ℕ → ℕ is a sequence of which only the values at $1,\dots,\rho$ are used.
Lean
theorem erdos_1094__h2__h2__h5__h2__h2__h1__h2__h2 : ∀ (q : ℕ),
(2 : ℕ) ≤ q →
∃ (C : ℕ),
∀ (ν ρ : ℕ),
(1 : ℕ) ≤ ρ →
ρ ≤ ν ^ q →
∃ (a : ℕ → ℕ),
∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧
∀ (x : ℝ), -((↑C : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x) := 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 →
Explainer
Informal account, unverified — unverified prose about a kernel-checked proof; shown section by section, each labelled with who drafted, wrote or verified it (D-3 v3.31).
Unverified: explainer, its words from explainer/9da530e5b565….md, written by t1203r2-k, drafted with Claude Opus 5.5 (claude-opus-5-5) via claude-code, agent K3, 2026-12-03.
Draft · drafted, by the model named above
Statement and idea
For every integer $q\ge2$ there is $C$, depending on $q$ alone, such that for all positive integers $\rho$ and $\nu$ with $\rho\le\nu^q$ there are integers $a_1,\dots,a_\rho\ge0$ with
$$\sum_{k=1}^\rho a_k=\rho,\qquad \sum_{k=1}^\rho a_k\cos kx\ \ge\ -C\nu\quad(x\in\mathbb R).$$
Belov and Konyagin (Izv. Math. 60:6 (1996), Corollary 0.2) prove this with $2^{32}(1+\log\rho)^5$ in place of $C\nu$. The proof here is weaker and shorter. The polynomial is a sum of Dirichlet kernels whose orders are the integer parts of $s\mu^q/m^q$ for $m=\mu,\mu+1,\dots$, the kind of sequence their paper starts from (Theorem 0.1 there), with a fixed large $\mu$. The main step is a lower bound for $\sum_m\sin((w/m)^q)$, proved by comparing the sum with the increments of one explicit function.
Dirichlet kernels
Lemma cq_dirichlet. $2\sin\frac x2\sum_{k=1}^N\cos kx=\sin\bigl((N+\tfrac12)x\bigr)-\sin\frac x2$, by induction on $N$.
One step of the comparison
Let $w>0$, and for $u>0$ put
$$g(u)=\Bigl(\frac wu\Bigr)^q,\qquad P(u)=-\frac{u^{q+1}}{q\,w^q}\bigl(1-\cos g(u)\bigr).$$
Since $g'(u)=-q\,w^q/u^{q+1}$, differentiation gives (lemma cq_deriv)
$$P'(u)=\sin g(u)-\frac{q+1}{q\,g(u)}\bigl(1-\cos g(u)\bigr)\le\sin g(u).$$
Lemma cq_step. For $m>0$,
$$\sin g(m)\ \ge\ P(m+1)-P(m)-\bigl(g(m)-g(m+1)\bigr)+e_m,$$
where $e_m=\frac15$ if $1\le g(m+1)$ and $g(m)\le2$, and $e_m=0$ otherwise.
Proof. By the mean value theorem the increment of $P$ is $P'(c)$ for some $c\in(m,m+1)$. As $\sin$ is $1$-Lipschitz and $g$ decreases, $\sin g(c)\le\sin g(m)+g(m)-g(m+1)$. If $g(c)\in[1,2]$ the term subtracted in $P'(c)$ is at least $\frac12(1-\cos1)\ge\frac12\cdot\frac49>\frac15$.
The sum of sines
Lemma cq_main. There is $\mu\ge1$, depending on $q$, such that for all $w>0$ and integers $b\ge\mu$ with $b\ge w$,
$$\sum_{m=\mu}^{b-1}\sin g(m)\ \ge\ -b\,g(b).$$
Proof. If $g(\mu)\le3$ every term is $\sin$ of a number in $[0,3]$ and the sum is non-negative. Let $g(\mu)>3$. Put $c=1/(2q+1)$ and $B=(10/c)^q$, and let $\mu\ge\frac{10}c(B+2)$. As $(1+\frac1{2q})^q\le e^{1/2}<2$ and $(1+\frac1{2q})(1-c)=1$, we have $g(u)\le2$ for $u\ge(1-c)w$; so $\mu\le(1-c)w$. Let $a=\max(\mu,\lceil cw/10\rceil)$, which is at most $\lceil(1-c)w\rceil$.
The terms with $m<a$ contribute at least $-(a-\mu)\ge-(cw/10+1)$. For the terms with $a\le m<b$ add the inequalities of the last section. The differences telescope, and
- $P(a)\le0$ and $g(a)\le(10/c)^q=B$;
- $P(b)\ge-b\,g(b)/(2q)$, from $1-\cos g\le g^2/2$;
- $e_m=\frac15$ for every integer $m$ with $\lceil(1-c)w\rceil\le m<\lfloor w\rfloor$, and there are at least $cw-2$ of these.
In total the sum is at least $\frac15(cw-2)-\frac1{10}cw-1-B-b\,g(b)$, and $\frac1{10}cw\ge B+2$ because $w\ge\mu$.
The polynomial
Let $s\ge1$, let $N_m=\lfloor s\mu^q/m^q\rfloor$, and let $b$ satisfy $4^qs\mu^q\le b^q$.
Lemma cq_poly. For $0<x\le\pi$, $\ \sum_{m=\mu}^{b-1}\sum_{k=1}^{N_m}\cos kx\ge-4b$.
Proof. Choose $w$ with $w^q=sx\mu^q$. Then $w\le b$ because $x\le4\le4^q$, and $g(m)=x\cdot s\mu^q/m^q$. The number $N_m+\frac12$ differs from $s\mu^q/m^q$ by at most $\frac12$, so $\sin((N_m+\frac12)x)\ge\sin g(m)-\frac x2$. Also $g(b)\le x$. By the lemma on sines, $\sum_m\sin((N_m+\frac12)x)\ge-bx-\frac12bx$. By the first section, $2\sin\frac x2$ times the double sum is at least $-\frac32bx-b\sin\frac x2$. Since $\sin\frac x2\ge\frac x\pi\ge\frac x4$,
$$2\sin\frac x2\cdot\Bigl(\sum_{m}\sum_{k}\cos kx+4b\Bigr)\ge7b\sin\frac x2-\frac32bx\ge\frac14bx>0 .$$
All real x
Lemma cq_reduce. For real $x$ let $y=\arccos(\cos x)\in[0,\pi]$. Then $\cos kx=\cos ky$ for every integer $k\ge0$, both being the Chebyshev polynomial $T_k$ at $\cos x$. For $y=0$ the sums considered are non-negative.
The exact number of terms
Given $\rho\le\nu^q$ put $b=4\mu\nu$ and $R(s)=\sum_{m=\mu}^{b-1}N_m$, with $N_m$ formed from $s$. Then $R(0)=0$, $R(s)\ge s$ (the term $m=\mu$ is $s$) and $R(s+1)\le R(s)+b$, since $\mu^q\le m^q$ means that each $N_m$ grows by at most $1$. Let $s$ be the last integer with $R(s)\le\rho$ before $R$ first exceeds $\rho$. Then $\rho-R(s)\le b$ and $s\le\rho\le\nu^q$, so $4^qs\mu^q\le b^q$. Let
$$a_k=\#\{m:\mu\le m<b,\ k\le N_m\}+\bigl(\rho-R(s)\text{ if }k=1\bigr).$$
Every $N_m$ is at most $\rho$, so $\sum_{k\le\rho}a_k=R(s)+\rho-R(s)=\rho$, and
$$\sum_{k\le\rho}a_k\cos kx=\sum_m\sum_{k\le N_m}\cos kx+(\rho-R(s))\cos x\ge-4b-b=-20\mu\nu .$$
So $C=20\mu$ serves. For $s=0$ the double sum is empty and the bound is immediate.
History: 1 version on record
2026-12-03 · written by t1203r2-k, drafted with Claude Opus 5.5 (claude-opus-5-5) via claude-code, agent K3 · not signed · current · explainer/9da530e5b565….md · the first version of its chain
Read this version
Statement and idea
For every integer $q\ge2$ there is $C$, depending on $q$ alone, such that for all positive integers $\rho$ and $\nu$ with $\rho\le\nu^q$ there are integers $a_1,\dots,a_\rho\ge0$ with
$$\sum_{k=1}^\rho a_k=\rho,\qquad \sum_{k=1}^\rho a_k\cos kx\ \ge\ -C\nu\quad(x\in\mathbb R).$$
Belov and Konyagin (Izv. Math. 60:6 (1996), Corollary 0.2) prove this with $2^{32}(1+\log\rho)^5$ in place of $C\nu$. The proof here is weaker and shorter. The polynomial is a sum of Dirichlet kernels whose orders are the integer parts of $s\mu^q/m^q$ for $m=\mu,\mu+1,\dots$, the kind of sequence their paper starts from (Theorem 0.1 there), with a fixed large $\mu$. The main step is a lower bound for $\sum_m\sin((w/m)^q)$, proved by comparing the sum with the increments of one explicit function.
Dirichlet kernels
Lemma
cq_dirichlet. $2\sin\frac x2\sum_{k=1}^N\cos kx=\sin\bigl((N+\tfrac12)x\bigr)-\sin\frac x2$, by induction on $N$.One step of the comparison
Let $w>0$, and for $u>0$ put
$$g(u)=\Bigl(\frac wu\Bigr)^q,\qquad P(u)=-\frac{u^{q+1}}{q\,w^q}\bigl(1-\cos g(u)\bigr).$$
Since $g'(u)=-q\,w^q/u^{q+1}$, differentiation gives (lemma
cq_deriv)$$P'(u)=\sin g(u)-\frac{q+1}{q\,g(u)}\bigl(1-\cos g(u)\bigr)\le\sin g(u).$$
Lemma
cq_step. For $m>0$,$$\sin g(m)\ \ge\ P(m+1)-P(m)-\bigl(g(m)-g(m+1)\bigr)+e_m,$$
where $e_m=\frac15$ if $1\le g(m+1)$ and $g(m)\le2$, and $e_m=0$ otherwise.
Proof. By the mean value theorem the increment of $P$ is $P'(c)$ for some $c\in(m,m+1)$. As $\sin$ is $1$-Lipschitz and $g$ decreases, $\sin g(c)\le\sin g(m)+g(m)-g(m+1)$. If $g(c)\in[1,2]$ the term subtracted in $P'(c)$ is at least $\frac12(1-\cos1)\ge\frac12\cdot\frac49>\frac15$.
The sum of sines
Lemma
cq_main. There is $\mu\ge1$, depending on $q$, such that for all $w>0$ and integers $b\ge\mu$ with $b\ge w$,$$\sum_{m=\mu}^{b-1}\sin g(m)\ \ge\ -b\,g(b).$$
Proof. If $g(\mu)\le3$ every term is $\sin$ of a number in $[0,3]$ and the sum is non-negative. Let $g(\mu)>3$. Put $c=1/(2q+1)$ and $B=(10/c)^q$, and let $\mu\ge\frac{10}c(B+2)$. As $(1+\frac1{2q})^q\le e^{1/2}<2$ and $(1+\frac1{2q})(1-c)=1$, we have $g(u)\le2$ for $u\ge(1-c)w$; so $\mu\le(1-c)w$. Let $a=\max(\mu,\lceil cw/10\rceil)$, which is at most $\lceil(1-c)w\rceil$.
The terms with $m<a$ contribute at least $-(a-\mu)\ge-(cw/10+1)$. For the terms with $a\le m<b$ add the inequalities of the last section. The differences telescope, and
- $P(a)\le0$ and $g(a)\le(10/c)^q=B$;
- $P(b)\ge-b\,g(b)/(2q)$, from $1-\cos g\le g^2/2$;
- $e_m=\frac15$ for every integer $m$ with $\lceil(1-c)w\rceil\le m<\lfloor w\rfloor$, and there are at least $cw-2$ of these.
In total the sum is at least $\frac15(cw-2)-\frac1{10}cw-1-B-b\,g(b)$, and $\frac1{10}cw\ge B+2$ because $w\ge\mu$.
The polynomial
Let $s\ge1$, let $N_m=\lfloor s\mu^q/m^q\rfloor$, and let $b$ satisfy $4^qs\mu^q\le b^q$.
Lemma
cq_poly. For $0<x\le\pi$, $\ \sum_{m=\mu}^{b-1}\sum_{k=1}^{N_m}\cos kx\ge-4b$.Proof. Choose $w$ with $w^q=sx\mu^q$. Then $w\le b$ because $x\le4\le4^q$, and $g(m)=x\cdot s\mu^q/m^q$. The number $N_m+\frac12$ differs from $s\mu^q/m^q$ by at most $\frac12$, so $\sin((N_m+\frac12)x)\ge\sin g(m)-\frac x2$. Also $g(b)\le x$. By the lemma on sines, $\sum_m\sin((N_m+\frac12)x)\ge-bx-\frac12bx$. By the first section, $2\sin\frac x2$ times the double sum is at least $-\frac32bx-b\sin\frac x2$. Since $\sin\frac x2\ge\frac x\pi\ge\frac x4$,
$$2\sin\frac x2\cdot\Bigl(\sum_{m}\sum_{k}\cos kx+4b\Bigr)\ge7b\sin\frac x2-\frac32bx\ge\frac14bx>0 .$$
All real x
Lemma
cq_reduce. For real $x$ let $y=\arccos(\cos x)\in[0,\pi]$. Then $\cos kx=\cos ky$ for every integer $k\ge0$, both being the Chebyshev polynomial $T_k$ at $\cos x$. For $y=0$ the sums considered are non-negative.The exact number of terms
Given $\rho\le\nu^q$ put $b=4\mu\nu$ and $R(s)=\sum_{m=\mu}^{b-1}N_m$, with $N_m$ formed from $s$. Then $R(0)=0$, $R(s)\ge s$ (the term $m=\mu$ is $s$) and $R(s+1)\le R(s)+b$, since $\mu^q\le m^q$ means that each $N_m$ grows by at most $1$. Let $s$ be the last integer with $R(s)\le\rho$ before $R$ first exceeds $\rho$. Then $\rho-R(s)\le b$ and $s\le\rho\le\nu^q$, so $4^qs\mu^q\le b^q$. Let
$$a_k=\#\{m:\mu\le m<b,\ k\le N_m\}+\bigl(\rho-R(s)\text{ if }k=1\bigr).$$
Every $N_m$ is at most $\rho$, so $\sum_{k\le\rho}a_k=R(s)+\rho-R(s)=\rho$, and
$$\sum_{k\le\rho}a_k\cos kx=\sum_m\sum_{k\le N_m}\cos kx+(\rho-R(s))\cos x\ge-4b-b=-20\mu\nu .$$
So $C=20\mu$ serves. For $s=0$ the double sum is empty and the bound is immediate.
Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).
How it was proved
Proved by Proof.lean, checked by the kernel. Its attestation, 002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2, records the gate’s run.
The proof step by step (outline)
Checked by the kernel — an outline of the attested proof below: attestations/002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2.json, merge commit 9a0c8b0f096c.
Outline of Proof.lean, extracted by the gate at 029533477f5e 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.
s1obtain∃ (μ : ℕ), (0 : ℕ) < μ ∧ ∀ (w : ℝ), (0 : ℝ) < w → ∀ (b : ℕ), μ ≤ b → w ≤ (↑b : ℝ) → -((↑b : ℝ) * cq_g w q (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, Real.sin (cq_g w q (↑m : ℝ))Leaves
∃ (C : ℕ), ∀ (ν ρ : ℕ), (1 : ℕ) ≤ ρ → ρ ≤ ν ^ q → ∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑C : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withμ : ℕ,hμ : (0 : ℕ) < μ,hmain : ∀ (w : ℝ), (0 : ℝ) < w → ∀ (b : ℕ), μ ≤ b → w ≤ (↑b : ℝ) → -((↑b : ℝ) * cq_g w q (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, Real.sin (cq_g w q (↑m : ℝ)).Lean, line 387
obtain ⟨μ, hμ, hmain⟩ := cq_main q hq
h_x3bd(hν) have(0 : ℕ) < νLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhν : (0 : ℕ) < ν.Uses library
Nat.eq_zero_or_pos.Lean, lines 390–393
have hν : 0 < ν := by rcases Nat.eq_zero_or_pos ν with h | h · rw [h, zero_pow (by omega)] at hρν; omega · exact hh_x3bd.s1caseLeaves
(0 : ℕ) < ν, withh : ν = (0 : ℕ).Uses library
zero_pow.Lean, line 392
· rw [h, zero_pow (by omega)] at hρν; omega
h_x3bd.s2caseLeaves
(0 : ℕ) < ν, withh : ν > (0 : ℕ).
s3obtain∃ (b : ℕ), b = (4 : ℕ) * (μ * ν)Leaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withb : ℕ,hbdef : b = (4 : ℕ) * (μ * ν).Uses library
Exists.introExistential introduction. ,rflrfl : a = ais the unique constructor of the equality type. .Lean, line 394
obtain ⟨b, hbdef⟩ : ∃ b : ℕ, b = 4 * (μ * ν) := ⟨_, rfl⟩
h_x3bc_x3bd(hμν) haveμ ≤ μ * νLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhμν : μ ≤ μ * ν.Uses library
Nat.le_mul_of_pos_right.Lean, line 395
have hμν : μ ≤ μ * ν := Nat.le_mul_of_pos_right μ hν
hbhaveμ < broutine: omegaLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhb : μ < b.Lean, line 396
have hb : μ < b := by omega
hRshave∀ (s : ℕ), s ≤ R sLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhRs : ∀ (s : ℕ), s ≤ R s.Lean, lines 398–404
have hRs : ∀ s, s ≤ R s := by intro s have h1 : cq_N s μ q μ = s := Nat.mul_div_cancel _ (Nat.pow_pos hμ) have h2 := Finset.single_le_sum (f := fun m => cq_N s μ q m) (fun i _ => Nat.zero_le _) (Finset.mem_Ico.mpr ⟨le_refl μ, hb⟩) simp only [hR] omegahRs.h1havecq_N s μ q μ = sLeaves
s ≤ R s, withh1 : cq_N s μ q μ = s.Uses library
Nat.mul_div_cancel,Nat.pow_pos.Lean, line 400
have h1 : cq_N s μ q μ = s := Nat.mul_div_cancel _ (Nat.pow_pos hμ)
hRs.h2havecq_N s μ q μ ≤ ∑ x ∈ Finset.Ico μ b, cq_N s μ q xLeaves
s ≤ R s, withh2 : cq_N s μ q μ ≤ ∑ x ∈ Finset.Ico μ b, cq_N s μ q x.Uses library
Finset.single_le_sum,Nat.zero_le,Finset.mem_Ico,Iff.mprModus ponens for if and only if, reversed. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,le_reflThe relation≤on a preorder is reflexive. .Lean, lines 401–402
have h2 := Finset.single_le_sum (f := fun m => cq_N s μ q m) (fun i _ => Nat.zero_le _) (Finset.mem_Ico.mpr ⟨le_refl μ, hb⟩)
hR0haveR (0 : ℕ) = (0 : ℕ)routine: simpLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhR0 : R (0 : ℕ) = (0 : ℕ).Lean, line 405
have hR0 : R 0 = 0 := by simp [hR, cq_N]
hstephave∀ (s : ℕ), R (s + (1 : ℕ)) ≤ R s + bLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhstep : ∀ (s : ℕ), R (s + (1 : ℕ)) ≤ R s + b.Uses library
Finset.sum_add_distrib,Finset.sum_const,Nat.card_Ico,smul_eq_mul,mul_one.Lean, lines 406–421
have hstep : ∀ s, R (s + 1) ≤ R s + b := by intro s have h1 : ∀ m ∈ Finset.Ico μ b, cq_N (s + 1) μ q m ≤ cq_N s μ q m + 1 := by intro m hm have hmμ := (Finset.mem_Ico.mp hm).1 have hmq : 0 < m ^ q := Nat.pow_pos (hμ.trans_le hmμ) have h2 : μ ^ q ≤ m ^ q := Nat.pow_le_pow_left hmμ q unfold cq_N rw [← Nat.add_div_right _ hmq] apply Nat.div_le_div_right rw [add_mul, one_mul] omega have h2 := Finset.sum_le_sum h1 rw [Finset.sum_add_distrib, Finset.sum_const, Nat.card_Ico, smul_eq_mul, mul_one] at h2 simp only [hR] omegahstep.h1have∀ m ∈ Finset.Ico μ b, cq_N (s + (1 : ℕ)) μ q m ≤ cq_N s μ q m + (1 : ℕ)Leaves
R (s + (1 : ℕ)) ≤ R s + b, withh1 : ∀ m ∈ Finset.Ico μ b, cq_N (s + (1 : ℕ)) μ q m ≤ cq_N s μ q m + (1 : ℕ).Uses library
Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Nat.add_div_right,Nat.div_le_div_right,add_mulAlias ofright_distrib. ,one_mul.Lean, lines 408–417
have h1 : ∀ m ∈ Finset.Ico μ b, cq_N (s + 1) μ q m ≤ cq_N s μ q m + 1 := by intro m hm have hmμ := (Finset.mem_Ico.mp hm).1 have hmq : 0 < m ^ q := Nat.pow_pos (hμ.trans_le hmμ) have h2 : μ ^ q ≤ m ^ q := Nat.pow_le_pow_left hmμ q unfold cq_N rw [← Nat.add_div_right _ hmq] apply Nat.div_le_div_right rw [add_mul, one_mul] omegahstep.h1.hm_x3bc(hmμ) haveμ ≤ mLeaves
cq_N (s + (1 : ℕ)) μ q m ≤ cq_N s μ q m + (1 : ℕ), withhmμ : μ ≤ m.Uses library
Finset.mem_Ico,Iff.mpModus ponens for if and only if. .Lean, line 410
have hmμ := (Finset.mem_Ico.mp hm).1
hstep.h1.hmqhave(0 : ℕ) < m ^ qLeaves
cq_N (s + (1 : ℕ)) μ q m ≤ cq_N s μ q m + (1 : ℕ), withhmq : (0 : ℕ) < m ^ q.Uses library
Nat.pow_pos,LT.lt.trans_leAlias oflt_of_lt_of_le. .Lean, line 411
have hmq : 0 < m ^ q := Nat.pow_pos (hμ.trans_le hmμ)
hstep.h1.h2haveμ ^ q ≤ m ^ qLeaves
cq_N (s + (1 : ℕ)) μ q m ≤ cq_N s μ q m + (1 : ℕ), withh2 : μ ^ q ≤ m ^ q.Uses library
Nat.pow_le_pow_left.Lean, line 412
have h2 : μ ^ q ≤ m ^ q := Nat.pow_le_pow_left hmμ q
hstep.h2have∑ i ∈ Finset.Ico μ b, cq_N (s + (1 : ℕ)) μ q i ≤ ∑ i ∈ Finset.Ico μ b, (cq_N s μ q i + (1 : ℕ))Leaves
R (s + (1 : ℕ)) ≤ R s + b, withh2 : ∑ i ∈ Finset.Ico μ b, cq_N (s + (1 : ℕ)) μ q i ≤ ∑ i ∈ Finset.Ico μ b, (cq_N s μ q i + (1 : ℕ)).Uses library
Finset.sum_le_sumIn an ordered additive commutative monoid, if each summandf iof one finite sum is less than or equal to the corresponding summandg iof another finite sum, then∑ i ∈ s, f i ≤ ∑ i ∈ s, g i. .Lean, line 418
have h2 := Finset.sum_le_sum h1
hexhave∃ (s : ℕ), ρ < R sLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhex : ∃ (s : ℕ), ρ < R s.Uses library
Exists.introExistential introduction. ,Nat.lt_succ_self,LT.lt.trans_leAlias oflt_of_lt_of_le. .Lean, line 422
have hex : ∃ s, ρ < R s := ⟨ρ + 1, (Nat.lt_succ_self ρ).trans_le (hRs (ρ + 1))⟩
s10obtain∃ (s : ℕ), R s ≤ ρ ∧ ρ < R (s + (1 : ℕ))Leaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withs : ℕ,hs1 : R s ≤ ρ,hs2 : ρ < R (s + (1 : ℕ)).Uses library
Exists.introExistential introduction. .Lean, lines 423–430
obtain ⟨s, hs1, hs2⟩ : ∃ s, R s ≤ ρ ∧ ρ < R (s + 1) := by have h1 := Nat.find_spec hex have h0 : Nat.find hex ≠ 0 := by intro h; rw [h, hR0] at h1; omega obtain ⟨s, hs⟩ := Nat.exists_eq_succ_of_ne_zero h0 refine ⟨s, ?_, ?_⟩ · exact not_lt.mp (Nat.find_min hex (by omega)) · rw [hs] at h1; exact h1s10.h1haveρ < R (Nat.find hex)Leaves
∃ (s : ℕ), R s ≤ ρ ∧ ρ < R (s + (1 : ℕ)), withh1 : ρ < R (Nat.find hex).Uses library
Nat.find_spec.Lean, line 424
have h1 := Nat.find_spec hex
s10.h0haveNat.find hex ≠ (0 : ℕ)Leaves
∃ (s : ℕ), R s ≤ ρ ∧ ρ < R (s + (1 : ℕ)), withh0 : Nat.find hex ≠ (0 : ℕ).Uses library
Nat.findIfpis a (decidable) predicate onℕandhp : ∃ (n : ℕ), p nis a proof that there exists some natural number satisfyingp, thenNat.find hpis the smallest natural number satisfyingp. .Lean, lines 425–426
have h0 : Nat.find hex ≠ 0 := by intro h; rw [h, hR0] at h1; omegas10.s3obtain∃ (k : ℕ), Nat.find hex = k.succLeaves
∃ (s : ℕ), R s ≤ ρ ∧ ρ < R (s + (1 : ℕ)), withs : ℕ,hs : Nat.find hex = s.succ.Uses library
Nat.exists_eq_succ_of_ne_zero.Lean, line 427
obtain ⟨s, hs⟩ := Nat.exists_eq_succ_of_ne_zero h0
s10.s4caseLeaves
R s ≤ ρ.Uses library
not_lt,Iff.mpModus ponens for if and only if. ,Nat.find_min.Lean, line 429
· exact not_lt.mp (Nat.find_min hex (by omega))
s10.s5caseLeaves
ρ < R (s + (1 : ℕ)).Lean, line 430
· rw [hs] at h1; exact h1
hs_x3c1(hsρ) haves ≤ ρLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhsρ : s ≤ ρ.Uses library
LE.le.transAlias ofle_trans. .Lean, line 431
have hsρ : s ≤ ρ := (hRs s).trans hs1
hremhaveρ - R s ≤ bLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhrem : ρ - R s ≤ b.Lean, line 432
have hrem : ρ - R s ≤ b := by have := hstep s; omega
hrem.thishaveR (s + (1 : ℕ)) ≤ R s + bLeaves
ρ - R s ≤ b, withthis : R (s + (1 : ℕ)) ≤ R s + b.Lean, line 432
have hrem : ρ - R s ≤ b := by have := hstep s; omega
hNlehave∀ m ∈ Finset.Ico μ b, cq_N s μ q m ≤ ρLeaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhNle : ∀ m ∈ Finset.Ico μ b, cq_N s μ q m ≤ ρ.Uses library
Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.single_le_sum,Nat.zero_le,LE.le.transAlias ofle_trans. .Lean, lines 433–434
have hNle : ∀ m ∈ Finset.Ico μ b, cq_N s μ q m ≤ ρ := fun m hm => (Finset.single_le_sum (f := fun m => cq_N s μ q m) (fun i _ => Nat.zero_le _) hm).trans hs1hfilhave∀ m ∈ Finset.Ico μ b, {k ∈ Finset.Icc (1 : ℕ) ρ | k ≤ cq_N s μ q m} = Finset.Icc (1 : ℕ) (cq_N s μ q m)Leaves
∃ (a : ℕ → ℕ), ∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧ ∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhfil : ∀ m ∈ Finset.Ico μ b, {k ∈ Finset.Icc (1 : ℕ) ρ | k ≤ cq_N s μ q m} = Finset.Icc (1 : ℕ) (cq_N s μ q m).Uses library
Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.filterFinset.filter p sis the set of elements ofsthat satisfyp. ,Finset.mem_filter,Finset.mem_Icc.Lean, lines 435–440
have hfil : ∀ m ∈ Finset.Ico μ b, (Finset.Icc 1 ρ).filter (fun k => k ≤ cq_N s μ q m) = Finset.Icc 1 (cq_N s μ q m) := by intro m hm have := hNle m hm ext k simp only [Finset.mem_filter, Finset.mem_Icc] omegahfil.thishavecq_N s μ q m ≤ ρLeaves
{k ∈ Finset.Icc (1 : ℕ) ρ | k ≤ cq_N s μ q m} = Finset.Icc (1 : ℕ) (cq_N s μ q m), withthis : cq_N s μ q m ≤ ρ.Lean, line 437
have := hNle m hm
s15caseLeaves
∑ k ∈ Finset.Icc (1 : ℕ) ρ, (fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k = ρ.Uses library
Finset.sum_add_distrib,Finset.sum_ite_eq'A sum taken over a conditional whose condition is an equality test on the index and whose alternative is0has value either the term at that index or0. ,Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,if_pos,Finset.mem_Icc,Iff.mprModus ponens for if and only if, reversed. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,le_reflThe relation≤on a preorder is reflexive. .Lean, lines 442–452
· rw [Finset.sum_add_distrib, Finset.sum_ite_eq' (Finset.Icc 1 ρ) 1 (fun _ => ρ - R s), if_pos (Finset.mem_Icc.mpr ⟨le_refl 1, hρ⟩)] have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card = R s := by simp only [Finset.card_filter] rw [Finset.sum_comm] simp only [hR] apply Finset.sum_congr rfl intro m hm rw [← Finset.card_filter, hfil m hm, Nat.card_Icc] omega rw [h1]; omegas15.h1have∑ k ∈ Finset.Icc (1 : ℕ) ρ, {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card = R sLeaves
∑ x ∈ Finset.Icc (1 : ℕ) ρ, {m ∈ Finset.Ico μ b | x ≤ cq_N s μ q m}.card + (ρ - R s) = ρ, withh1 : ∑ k ∈ Finset.Icc (1 : ℕ) ρ, {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card = R s.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.filterFinset.filter p sis the set of elements ofsthat satisfyp. ,Finset.cards.cardis the number of elements ofs, aka its cardinality. ,Finset.card_filter,Finset.sum_comm,Finset.sum_congr,rflrfl : a = ais the unique constructor of the equality type. ,Nat.card_Icc.Lean, lines 444–451
have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card = R s := by simp only [Finset.card_filter] rw [Finset.sum_comm] simp only [hR] apply Finset.sum_congr rfl intro m hm rw [← Finset.card_filter, hfil m hm, Nat.card_Icc] omega
s16caseLeaves
∀ (x : ℝ), -((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x).Lean, lines 453–501
· intro x obtain ⟨y, hy0, hyπ, hxy⟩ := cq_reduce x have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) + ((ρ - R s : ℕ) : ℝ) * Real.cos y := by have h2 : ∀ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, (if k ≤ cq_N s μ q m then Real.cos ((k : ℝ) * y) else 0) + (if k = 1 then ((ρ - R s : ℕ) : ℝ) * Real.cos y else 0) := by intro k _ rw [hxy k, Nat.cast_add, add_mul, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] congr 1 split_ifs with hk · rw [hk, Nat.cast_one, one_mul] · simp rw [Finset.sum_congr rfl h2, Finset.sum_add_distrib, Finset.sum_comm, Finset.sum_ite_eq' (Finset.Icc 1 ρ) 1 (fun _ => ((ρ - R s : ℕ) : ℝ) * Real.cos y), if_pos (Finset.mem_Icc.mpr ⟨le_refl 1, hρ⟩)] congr 1 apply Finset.sum_congr rfl intro m hm rw [← Finset.sum_filter, hfil m hm] have h3 : -(b : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) * Real.cos y := by have h4 : ((ρ - R s : ℕ) : ℝ) ≤ b := by exact_mod_cast hrem have h5 : (0 : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) := Nat.cast_nonneg _ nlinarith [Real.neg_one_le_cos y] have hbR : (0 : ℝ) ≤ b := Nat.cast_nonneg b have h6 : -(4 * (b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by have hnonneg : (∀ k : ℕ, Real.cos ((k : ℝ) * y) = 1) ∨ s = 0 → 0 ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by rintro (h | h) · exact Finset.sum_nonneg fun m _ => Finset.sum_nonneg fun k _ => by rw [h k]; norm_num · have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N] simp [this] rcases hy0.eq_or_lt with h | h · have := hnonneg (Or.inl fun k => by rw [← h]; simp) linarith · rcases Nat.eq_zero_or_pos s with hs0 | hs0 · have := hnonneg (Or.inr hs0) linarith · refine cq_poly q hq μ hμ hmain s b hs0 hb.le ?_ y h hyπ calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν)) _ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; ring have h7 : (b : ℝ) * 5 = ((20 * μ : ℕ) : ℝ) * ν := by rw [hbdef]; push_cast; ring simp only rw [h1] linariths16.s1obtain∃ (y : ℝ), (0 : ℝ) ≤ y ∧ y ≤ Real.pi ∧ ∀ (k : ℕ), Real.cos ((↑k : ℝ) * x) = Real.cos ((↑k : ℝ) * y)Leaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withy : ℝ,hy0 : (0 : ℝ) ≤ y,hyπ : y ≤ Real.pi,hxy : ∀ (k : ℕ), Real.cos ((↑k : ℝ) * x) = Real.cos ((↑k : ℝ) * y).Lean, line 454
obtain ⟨y, hy0, hyπ, hxy⟩ := cq_reduce x
s16.h1have∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑({m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) : ℝ) * Real.cos ((↑k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y) + (↑(ρ - R s) : ℝ) * Real.cos yLeaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withh1 : ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑({m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) : ℝ) * Real.cos ((↑k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y) + (↑(ρ - R s) : ℝ) * Real.cos y.Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.filterFinset.filter p sis the set of elements ofsthat satisfyp. ,Finset.cards.cardis the number of elements ofs, aka its cardinality. ,Real.cosThe real cosine function, defined as the real part of the complex cosine ,Finset.sum_congr,rflrfl : a = ais the unique constructor of the equality type. ,Finset.sum_add_distrib,Finset.sum_comm,Finset.sum_ite_eq'A sum taken over a conditional whose condition is an equality test on the index and whose alternative is0has value either the term at that index or0. ,if_pos,Finset.mem_Icc,Iff.mprModus ponens for if and only if, reversed. ,And.introAnd.intro : a → b → a ∧ bis the constructor for the And operation. ,le_reflThe relation≤on a preorder is reflexive. ,Finset.sum_filter.Lean, lines 455–475
have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) + ((ρ - R s : ℕ) : ℝ) * Real.cos y := by have h2 : ∀ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, (if k ≤ cq_N s μ q m then Real.cos ((k : ℝ) * y) else 0) + (if k = 1 then ((ρ - R s : ℕ) : ℝ) * Real.cos y else 0) := by intro k _ rw [hxy k, Nat.cast_add, add_mul, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] congr 1 split_ifs with hk · rw [hk, Nat.cast_one, one_mul] · simp rw [Finset.sum_congr rfl h2, Finset.sum_add_distrib, Finset.sum_comm, Finset.sum_ite_eq' (Finset.Icc 1 ρ) 1 (fun _ => ((ρ - R s : ℕ) : ℝ) * Real.cos y), if_pos (Finset.mem_Icc.mpr ⟨le_refl 1, hρ⟩)] congr 1 apply Finset.sum_congr rfl intro m hm rw [← Finset.sum_filter, hfil m hm]s16.h1.h2have∀ k ∈ Finset.Icc (1 : ℕ) ρ, (↑({m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) : ℝ) * Real.cos ((↑k : ℝ) * x) = (∑ m ∈ Finset.Ico μ b, if k ≤ cq_N s μ q m then Real.cos ((↑k : ℝ) * y) else (0 : ℝ)) + if k = (1 : ℕ) then (↑(ρ - R s) : ℝ) * Real.cos y else (0 : ℝ)Leaves
∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑({m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) : ℝ) * Real.cos ((↑k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y) + (↑(ρ - R s) : ℝ) * Real.cos y, withh2 : ∀ k ∈ Finset.Icc (1 : ℕ) ρ, (↑({m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) : ℝ) * Real.cos ((↑k : ℝ) * x) = (∑ m ∈ Finset.Ico μ b, if k ≤ cq_N s μ q m then Real.cos ((↑k : ℝ) * y) else (0 : ℝ)) + if k = (1 : ℕ) then (↑(ρ - R s) : ℝ) * Real.cos y else (0 : ℝ).Uses library
Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.filterFinset.filter p sis the set of elements ofsthat satisfyp. ,Finset.cards.cardis the number of elements ofs, aka its cardinality. ,Real.cosThe real cosine function, defined as the real part of the complex cosine ,Nat.cast_add,add_mulAlias ofright_distrib. ,Finset.sum_filter,Finset.sum_const,nsmul_eq_mul.Lean, lines 459–468
have h2 : ∀ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) = ∑ m ∈ Finset.Ico μ b, (if k ≤ cq_N s μ q m then Real.cos ((k : ℝ) * y) else 0) + (if k = 1 then ((ρ - R s : ℕ) : ℝ) * Real.cos y else 0) := by intro k _ rw [hxy k, Nat.cast_add, add_mul, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] congr 1 split_ifs with hk · rw [hk, Nat.cast_one, one_mul] · simps16.h1.h2.s1caseLeaves
(↑(ρ - R s) : ℝ) * Real.cos ((↑k : ℝ) * y) = (↑(ρ - R s) : ℝ) * Real.cos y, withhk : k = (1 : ℕ).Uses library
Nat.cast_one,one_mul.Lean, line 467
· rw [hk, Nat.cast_one, one_mul]
s16.h1.h2.s2case routine: simpLeaves
(↑(0 : ℕ) : ℝ) * Real.cos ((↑k : ℝ) * y) = (0 : ℝ), withhk : ¬k = (1 : ℕ).
s16.h3have-(↑b : ℝ) ≤ (↑(ρ - R s) : ℝ) * Real.cos yLeaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withh3 : -(↑b : ℝ) ≤ (↑(ρ - R s) : ℝ) * Real.cos y.Uses library
Real.cosThe real cosine function, defined as the real part of the complex cosine ,Real.neg_one_le_cos.Lean, lines 476–479
have h3 : -(b : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) * Real.cos y := by have h4 : ((ρ - R s : ℕ) : ℝ) ≤ b := by exact_mod_cast hrem have h5 : (0 : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) := Nat.cast_nonneg _ nlinarith [Real.neg_one_le_cos y]s16.h3.h4have(↑(ρ - R s) : ℝ) ≤ (↑b : ℝ)Leaves
-(↑b : ℝ) ≤ (↑(ρ - R s) : ℝ) * Real.cos y, withh4 : (↑(ρ - R s) : ℝ) ≤ (↑b : ℝ).Lean, line 477
have h4 : ((ρ - R s : ℕ) : ℝ) ≤ b := by exact_mod_cast hrem
s16.h3.h5have(0 : ℝ) ≤ (↑(ρ - R s) : ℝ)Leaves
-(↑b : ℝ) ≤ (↑(ρ - R s) : ℝ) * Real.cos y, withh5 : (0 : ℝ) ≤ (↑(ρ - R s) : ℝ).Uses library
Nat.cast_nonnegSpecialisation ofNat.cast_nonneg', which seems to be easier for Lean to use. .Lean, line 478
have h5 : (0 : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) := Nat.cast_nonneg _
s16.hbRhave(0 : ℝ) ≤ (↑b : ℝ)Leaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withhbR : (0 : ℝ) ≤ (↑b : ℝ).Uses library
Nat.cast_nonnegSpecialisation ofNat.cast_nonneg', which seems to be easier for Lean to use. .Lean, line 480
have hbR : (0 : ℝ) ≤ b := Nat.cast_nonneg b
s16.h6have-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y)Leaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withh6 : -((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y).Uses library
Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. ,Real.cosThe real cosine function, defined as the real part of the complex cosine ,LE.le.eq_or_ltAlias ofeq_or_lt_of_le. .Lean, lines 481–497
have h6 : -(4 * (b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by have hnonneg : (∀ k : ℕ, Real.cos ((k : ℝ) * y) = 1) ∨ s = 0 → 0 ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by rintro (h | h) · exact Finset.sum_nonneg fun m _ => Finset.sum_nonneg fun k _ => by rw [h k]; norm_num · have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N] simp [this] rcases hy0.eq_or_lt with h | h · have := hnonneg (Or.inl fun k => by rw [← h]; simp) linarith · rcases Nat.eq_zero_or_pos s with hs0 | hs0 · have := hnonneg (Or.inr hs0) linarith · refine cq_poly q hq μ hμ hmain s b hs0 hb.le ?_ y h hyπ calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν)) _ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; rings16.h6.hnonneghave(∀ (k : ℕ), Real.cos ((↑k : ℝ) * y) = (1 : ℝ)) ∨ s = (0 : ℕ) → (0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y)Leaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withhnonneg : (∀ (k : ℕ), Real.cos ((↑k : ℝ) * y) = (1 : ℝ)) ∨ s = (0 : ℕ) → (0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y).Uses library
Real.cosThe real cosine function, defined as the real part of the complex cosine ,Finset.IcoThe finset $[a, b)$ of elementsxsuch thata ≤ xandx < b. ,Finset.IccThe finset $[a, b]$ of elementsxsuch thata ≤ xandx ≤ b. .Lean, lines 482–487
have hnonneg : (∀ k : ℕ, Real.cos ((k : ℝ) * y) = 1) ∨ s = 0 → 0 ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by rintro (h | h) · exact Finset.sum_nonneg fun m _ => Finset.sum_nonneg fun k _ => by rw [h k]; norm_num · have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N] simp [this]s16.h6.hnonneg.s1caseLeaves
(0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withh : ∀ (k : ℕ), Real.cos ((↑k : ℝ) * y) = (1 : ℝ).Uses library
Finset.sum_nonneg.Lean, line 485
· exact Finset.sum_nonneg fun m _ => Finset.sum_nonneg fun k _ => by rw [h k]; norm_num
s16.h6.hnonneg.s2caseLeaves
(0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withh : s = (0 : ℕ).Lean, lines 486–487
· have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N] simp [this]s16.h6.hnonneg.s2.thishave∀ (m : ℕ), cq_N s μ q m = (0 : ℕ)Leaves
(0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withthis : ∀ (m : ℕ), cq_N s μ q m = (0 : ℕ).Lean, line 486
· have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N]
s16.h6.s2caseLeaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withh : (0 : ℝ) = y.Lean, lines 489–490
· have := hnonneg (Or.inl fun k => by rw [← h]; simp) linariths16.h6.s2.thishave(0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y)Leaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withthis : (0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y).Uses library
Or.inlOr.inlis "left injection" into anOr. .Lean, line 489
· have := hnonneg (Or.inl fun k => by rw [← h]; simp)
s16.h6.s3caseLeaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withh : (0 : ℝ) < y.Uses library
Nat.eq_zero_or_pos.Lean, lines 491–497
· rcases Nat.eq_zero_or_pos s with hs0 | hs0 · have := hnonneg (Or.inr hs0) linarith · refine cq_poly q hq μ hμ hmain s b hs0 hb.le ?_ y h hyπ calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν)) _ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; rings16.h6.s3.s1caseLeaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withhs0 : s = (0 : ℕ).Lean, lines 492–493
· have := hnonneg (Or.inr hs0) linariths16.h6.s3.s1.thishave(0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y)Leaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withthis : (0 : ℝ) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y).Uses library
Or.inrOr.inris "right injection" into anOr. .Lean, line 492
· have := hnonneg (Or.inr hs0)
s16.h6.s3.s2caseLeaves
-((4 : ℝ) * (↑b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc (1 : ℕ) (cq_N s μ q m), Real.cos ((↑k : ℝ) * y), withhs0 : s > (0 : ℕ).Uses library
LT.lt.leAlias ofle_of_lt. .Lean, lines 494–497
· refine cq_poly q hq μ hμ hmain s b hs0 hb.le ?_ y h hyπ calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν)) _ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; rings16.h6.s3.s2.s1calc(4 : ℕ) ^ q * (s * μ ^ q) ≤ (4 : ℕ) ^ q * (ν ^ q * μ ^ q)Closes the goal.
Uses library
Nat.mul_le_mul_left,Nat.mul_le_mul_right,LE.le.transAlias ofle_trans. .Lean, lines 495–496
calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν))s16.h6.s3.s2.s2calcCloses the goal.
Uses library
mul_pow.Lean, line 497
_ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; ring
s16.h7have(↑b : ℝ) * (5 : ℝ) = (↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)Leaves
-((↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑((fun (k : ℕ) => {m ∈ Finset.Ico μ b | k ≤ cq_N s μ q m}.card + if k = (1 : ℕ) then ρ - R s else (0 : ℕ)) k) : ℝ) * Real.cos ((↑k : ℝ) * x), withh7 : (↑b : ℝ) * (5 : ℝ) = (↑((20 : ℕ) * μ) : ℝ) * (↑ν : ℝ).Lean, line 498
have h7 : (b : ℝ) * 5 = ((20 * μ : ℕ) : ℝ) * ν := by rw [hbdef]; push_cast; ring
The proof in Lean (Proof.lean)
Checked by the kernel — these bytes are the ones its attestation names: attestations/002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2.json, merge commit 9a0c8b0f096c.
artifact_hash of the attestation below, so these are the bytes the gate checked. Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2/Proof.lean, sha256 9d3e2cb014e0.import Mathlib
import Nodes.«erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2».Context
open scoped Nat
/-! Hole `h_cos` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/
private lemma cq_dirichlet (N : ℕ) (x : ℝ) :
2 * Real.sin (x / 2) * ∑ k ∈ Finset.Icc 1 N, Real.cos ((k : ℝ) * x) =
Real.sin (((N : ℝ) + 1 / 2) * x) - Real.sin (x / 2) := by
induction N with
| zero =>
have e : (((0 : ℕ) : ℝ) + 1 / 2) * x = x / 2 := by push_cast; ring
rw [e]; simp
| succ N ih =>
rw [Finset.sum_Icc_succ_top (by omega), mul_add, ih]
have e1 : (((N + 1 : ℕ) : ℝ) + 1 / 2) * x = ((N + 1 : ℕ) : ℝ) * x + x / 2 := by ring
have e2 : ((N : ℝ) + 1 / 2) * x = ((N + 1 : ℕ) : ℝ) * x - x / 2 := by push_cast; ring
rw [e1, e2, Real.sin_add, Real.sin_sub]
ring
private noncomputable def cq_g (w : ℝ) (q : ℕ) (u : ℝ) : ℝ := w ^ q * (u ^ q)⁻¹
private noncomputable def cq_P (w : ℝ) (q : ℕ) (u : ℝ) : ℝ :=
-(u ^ (q + 1) / (q * w ^ q)) * (1 - Real.cos (cq_g w q u))
private lemma cq_g_pos (w : ℝ) (hw : 0 < w) (q : ℕ) (u : ℝ) (hu : 0 < u) : 0 < cq_g w q u := by
unfold cq_g; positivity
private lemma cq_g_anti (w : ℝ) (hw : 0 < w) (q : ℕ) (u v : ℝ) (hu : 0 < u) (huv : u ≤ v) :
cq_g w q v ≤ cq_g w q u := by
unfold cq_g
have h1 : u ^ q ≤ v ^ q := pow_le_pow_left₀ hu.le huv q
exact mul_le_mul_of_nonneg_left (inv_anti₀ (by positivity) h1) (by positivity)
private lemma cq_deriv (w : ℝ) (hw : 0 < w) (q : ℕ) (hq : 2 ≤ q) (u : ℝ) (hu : 0 < u) :
HasDerivAt (cq_P w q) (Real.sin (cq_g w q u) -
((q : ℝ) + 1) / (q * cq_g w q u) * (1 - Real.cos (cq_g w q u))) u := by
have hq0 : (q : ℝ) ≠ 0 := by positivity
have h1 : HasDerivAt (fun u : ℝ => u ^ q) ((q : ℝ) * u ^ (q - 1)) u := hasDerivAt_pow q u
have h2 : HasDerivAt (cq_g w q) (w ^ q * (-((q : ℝ) * u ^ (q - 1)) / (u ^ q) ^ 2)) u :=
(h1.inv (by positivity)).const_mul (w ^ q)
have h3 : HasDerivAt (fun u : ℝ => -(u ^ (q + 1) / (q * w ^ q)))
(-((((q + 1 : ℕ) : ℝ) * u ^ (q + 1 - 1)) / (q * w ^ q))) u :=
((hasDerivAt_pow (q + 1) u).div_const _).neg
have h4 := h3.mul ((h2.cos).const_sub 1)
refine h4.congr_deriv ?_
have e : u ^ q = u ^ (q - 1) * u := by rw [← pow_succ]; congr 1; omega
unfold cq_g
rw [Nat.add_sub_cancel, pow_succ u q, e]
push_cast
field_simp
ring
/-- One step: `sin g(m)` dominates the increment of `P + g`, with a gain where `1 ≤ g ≤ 2`. -/
private lemma cq_step (w : ℝ) (hw : 0 < w) (q : ℕ) (hq : 2 ≤ q) (m : ℝ) (hm : 0 < m) (e : ℝ)
(he : e = 0 ∨ (e = 1 / 5 ∧ cq_g w q m ≤ 2 ∧ 1 ≤ cq_g w q (m + 1))) :
(cq_P w q (m + 1) + cq_g w q (m + 1)) - (cq_P w q m + cq_g w q m) + e ≤ Real.sin (cq_g w q m) := by
obtain ⟨c, hc, hc2⟩ := exists_hasDerivAt_eq_slope (cq_P w q) _ (show m < m + 1 by linarith)
(fun u hu => (cq_deriv w hw q hq u (lt_of_lt_of_le hm hu.1)).continuousAt.continuousWithinAt)
(fun u hu => cq_deriv w hw q hq u (hm.trans hu.1))
have hc0 : 0 < c := hm.trans hc.1
have hgc := cq_g_pos w hw q c hc0
have h1 := cq_g_anti w hw q m c hm hc.1.le
have h2 := cq_g_anti w hw q c (m + 1) hc0 hc.2.le
have e1 : m + 1 - m = 1 := by ring
rw [e1, div_one] at hc2
have hlip : Real.sin (cq_g w q c) - Real.sin (cq_g w q m) ≤ cq_g w q m - cq_g w q c := by
have h := Real.abs_sin_sub_sin_le (cq_g w q c) (cq_g w q m)
have h3 := le_abs_self (Real.sin (cq_g w q c) - Real.sin (cq_g w q m))
rw [abs_sub_comm (cq_g w q c), abs_of_nonneg (sub_nonneg.mpr h1)] at h
linarith
have hgain : e ≤ ((q : ℝ) + 1) / (q * cq_g w q c) * (1 - Real.cos (cq_g w q c)) := by
have hcos : 0 ≤ 1 - Real.cos (cq_g w q c) := by linarith [Real.cos_le_one (cq_g w q c)]
have hq0 : (0 : ℝ) < q := by exact_mod_cast (by omega : 0 < q)
rcases he with he | ⟨he, h3, h4⟩
· rw [he]; positivity
· have h5 : Real.cos (cq_g w q c) ≤ Real.cos 1 :=
Real.cos_le_cos_of_nonneg_of_le_pi (by norm_num) (by linarith [Real.pi_gt_three]) (by linarith)
have h6 := Real.cos_one_le
have h7 : 1 / 2 ≤ ((q : ℝ) + 1) / (q * cq_g w q c) := by
rw [div_le_div_iff₀ (by norm_num) (by positivity)]
nlinarith
rw [he]
nlinarith
linarith
private lemma cq_tele (F : ℕ → ℝ) (a b : ℕ) (hab : a ≤ b) :
∑ m ∈ Finset.Ico a b, (F (m + 1) - F m) = F b - F a := by
induction b, hab using Nat.le_induction with
| base => simp
| succ b hb ih => rw [Finset.sum_Ico_succ_top hb, ih]; ring
private lemma cq_half (q : ℕ) (hq : 2 ≤ q) (y : ℝ) (hy : 0 ≤ y) (h : y ≤ 1 + 1 / (2 * (q : ℝ))) : y ^ q ≤ 2 := by
have hq0 : (0 : ℝ) < q := by exact_mod_cast (by omega : 0 < q)
have h1 : y ≤ Real.exp (1 / (2 * (q : ℝ))) := by
linarith [Real.add_one_le_exp (1 / (2 * (q : ℝ)))]
have h2 : y ^ q ≤ Real.exp (1 / (2 * (q : ℝ))) ^ q := pow_le_pow_left₀ hy h1 q
rw [← Real.exp_nat_mul] at h2
have e : (q : ℝ) * (1 / (2 * (q : ℝ))) = 1 / 2 := by field_simp
rw [e] at h2
have h3 : Real.exp (1 / 2) ≤ 2 := by
have h4 : Real.exp (1 / 2) ^ (2 : ℕ) ≤ 2 ^ (2 : ℕ) := by
rw [← Real.exp_nat_mul]
have e2 : ((2 : ℕ) : ℝ) * (1 / 2) = 1 := by norm_num
rw [e2]
linarith [Real.exp_one_lt_d9]
exact le_of_pow_le_pow_left₀ (by norm_num) (by norm_num) h4
linarith
/-- The sum of `sin ((w/m)^q)` over `μ ≤ m < b` is almost nonnegative once `μ` is large. -/
private lemma cq_main (q : ℕ) (hq : 2 ≤ q) : ∃ μ : ℕ, 0 < μ ∧ ∀ (w : ℝ), 0 < w → ∀ b : ℕ, μ ≤ b → w ≤ b →
-((b : ℝ) * cq_g w q b) ≤ ∑ m ∈ Finset.Ico μ b, Real.sin (cq_g w q m) := by
have hqR : (2 : ℝ) ≤ q := by exact_mod_cast hq
obtain ⟨c, hc⟩ : ∃ c : ℝ, c = 1 / (2 * (q : ℝ) + 1) := ⟨_, rfl⟩
have hc0 : 0 < c := by rw [hc]; positivity
have hc1 : c ≤ 1 / 5 := by
rw [hc]; exact one_div_le_one_div_of_le (by norm_num) (by linarith)
have hcq : c * (2 * (q : ℝ) + 1) = 1 := by rw [hc]; field_simp
obtain ⟨B, hB⟩ : ∃ B : ℝ, B = (10 / c) ^ q := ⟨_, rfl⟩
have hB0 : 0 < B := by rw [hB]; positivity
refine ⟨⌈10 / c * (B + 2)⌉₊ + 1, by omega, ?_⟩
set μ := ⌈10 / c * (B + 2)⌉₊ + 1 with hμ
intro w hw b hb hwb
have hμ1 : 10 / c * (B + 2) ≤ (μ : ℝ) := by
rw [hμ]; push_cast
linarith [Nat.le_ceil (10 / c * (B + 2))]
have hμ0 : (0 : ℝ) < μ := by positivity
have hbR : (0 : ℝ) < b := lt_of_lt_of_le hμ0 (by exact_mod_cast hb)
have hgb := cq_g_pos w hw q b hbR
have hfrac : ∀ u : ℝ, 0 < u → cq_g w q u = (w / u) ^ q := by
intro u hu; unfold cq_g; rw [div_pow]; rfl
by_cases hsmall : cq_g w q μ ≤ 3
· have h0 : 0 ≤ ∑ m ∈ Finset.Ico μ b, Real.sin (cq_g w q m) := by
apply Finset.sum_nonneg
intro m hm
have hm1 : (μ : ℝ) ≤ m := by exact_mod_cast (Finset.mem_Ico.mp hm).1
have h1 := cq_g_anti w hw q μ m hμ0 hm1
have h2 := cq_g_pos w hw q m (hμ0.trans_le hm1)
exact Real.sin_nonneg_of_nonneg_of_le_pi h2.le (by linarith [Real.pi_gt_three])
have : 0 ≤ (b : ℝ) * cq_g w q b := by positivity
linarith
rw [not_le] at hsmall
have hμw : (μ : ℝ) ≤ w * (1 - c) := by
by_contra hcon
rw [not_le] at hcon
have h1 : w / μ ≤ 1 + 1 / (2 * (q : ℝ)) := by
rw [div_le_iff₀ hμ0]
have e : (1 + 1 / (2 * (q : ℝ))) * (1 - c) = 1 := by rw [hc]; field_simp; ring
have h2 : 0 < 1 + 1 / (2 * (q : ℝ)) := by positivity
have h3 := mul_le_mul_of_nonneg_left hcon.le h2.le
have h4 : (1 + 1 / (2 * (q : ℝ))) * (w * (1 - c)) = w := by
calc _ = w * ((1 + 1 / (2 * (q : ℝ))) * (1 - c)) := by ring
_ = w := by rw [e, mul_one]
linarith
have h2 := cq_half q hq (w / μ) (by positivity) h1
rw [hfrac μ hμ0] at hsmall
linarith
have hwμ : (μ : ℝ) ≤ w := by nlinarith
set P := ⌈w * (1 - c)⌉₊ with hP
set Q := ⌊w⌋₊ with hQ
set a := max μ ⌈c / 10 * w⌉₊ with ha
have hwc : 0 ≤ w * (1 - c) := by nlinarith
have haP : a ≤ P := by
apply max_le
· have := hμw.trans (Nat.le_ceil (w * (1 - c)))
exact_mod_cast this
· exact Nat.ceil_mono (by nlinarith)
have hQw : (Q : ℝ) ≤ w := Nat.floor_le hw.le
have hQb : Q ≤ b := by exact_mod_cast hQw.trans hwb
have hPw : (P : ℝ) < w * (1 - c) + 1 := Nat.ceil_lt_add_one hwc
have hQw2 : w < (Q : ℝ) + 1 := Nat.lt_floor_add_one w
have hab : a ≤ b := by
apply max_le hb
have : (⌈c / 10 * w⌉₊ : ℕ) ≤ b := by
rw [Nat.ceil_le]; nlinarith
exact this
have haμ : μ ≤ a := le_max_left _ _
have haR : (0 : ℝ) < a := hμ0.trans_le (by exact_mod_cast haμ)
have hga : cq_g w q a ≤ B := by
rw [hfrac a haR, hB]
apply pow_le_pow_left₀ (by positivity)
have h1 : c / 10 * w ≤ a := (Nat.le_ceil _).trans (by exact_mod_cast le_max_right _ _)
rw [div_le_div_iff₀ haR hc0]
linarith
have hcost : (a : ℝ) - μ ≤ c / 10 * w + 1 := by
have h1 : (⌈c / 10 * w⌉₊ : ℝ) < c / 10 * w + 1 := Nat.ceil_lt_add_one (by positivity)
rw [ha, Nat.cast_max]
rcases le_total (μ : ℝ) (⌈c / 10 * w⌉₊ : ℝ) with h | h
· rw [max_eq_right h]; linarith
· rw [max_eq_left h]
have : 0 < c / 10 * w := by positivity
linarith
have hfirst : -((a : ℝ) - μ) ≤ ∑ m ∈ Finset.Ico μ a, Real.sin (cq_g w q m) := by
have h := Finset.card_nsmul_le_sum (Finset.Ico μ a) (fun m : ℕ => Real.sin (cq_g w q m)) (-1)
(fun m _ => Real.neg_one_le_sin _)
rw [Nat.card_Ico, nsmul_eq_mul, Nat.cast_sub haμ] at h
linarith
set F : ℕ → ℝ := fun m => cq_P w q m + cq_g w q m with hF
have hsecond : F b - F a + ((Q : ℝ) - P) / 5 ≤ ∑ m ∈ Finset.Ico a b, Real.sin (cq_g w q m) := by
have h1 : ∑ m ∈ Finset.Ico a b, ((F (m + 1) - F m) + (if P ≤ m ∧ m < Q then (1 / 5 : ℝ) else 0)) ≤
∑ m ∈ Finset.Ico a b, Real.sin (cq_g w q m) := by
apply Finset.sum_le_sum
intro m hm
have hma : (a : ℝ) ≤ m := by exact_mod_cast (Finset.mem_Ico.mp hm).1
have hm0 : (0 : ℝ) < m := haR.trans_le hma
have h := cq_step w hw q hq m hm0 (if P ≤ m ∧ m < Q then (1 / 5 : ℝ) else 0) (by
by_cases hc3 : P ≤ m ∧ m < Q
· right
rw [if_pos hc3]
refine ⟨rfl, ?_, ?_⟩
· rw [hfrac m hm0]
apply cq_half q hq _ (by positivity)
have h2 : w * (1 - c) ≤ m := (Nat.le_ceil _).trans (by exact_mod_cast hc3.1)
rw [div_le_iff₀ hm0]
have e : (1 + 1 / (2 * (q : ℝ))) * (1 - c) = 1 := by rw [hc]; field_simp; ring
have h3 : 0 < 1 + 1 / (2 * (q : ℝ)) := by positivity
have h4 := mul_le_mul_of_nonneg_left h2 h3.le
have h5 : (1 + 1 / (2 * (q : ℝ))) * (w * (1 - c)) = w := by
calc _ = w * ((1 + 1 / (2 * (q : ℝ))) * (1 - c)) := by ring
_ = w := by rw [e, mul_one]
linarith
· rw [hfrac _ (by positivity)]
apply one_le_pow₀
rw [one_le_div (by positivity)]
have : ((m + 1 : ℕ) : ℝ) ≤ Q := by exact_mod_cast hc3.2
push_cast at this
linarith
· left; rw [if_neg hc3])
simp only [hF]
push_cast
linarith
rw [Finset.sum_add_distrib, cq_tele F a b hab, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul] at h1
have h2 : Finset.Ico P Q ⊆ (Finset.Ico a b).filter (fun m => P ≤ m ∧ m < Q) := by
intro m hm
rw [Finset.mem_Ico] at hm
rw [Finset.mem_filter, Finset.mem_Ico]
exact ⟨⟨haP.trans hm.1, hm.2.trans_le hQb⟩, hm⟩
have h3 := Finset.card_le_card h2
rw [Nat.card_Ico] at h3
have h4 : (Q : ℝ) - P ≤ (((Finset.Ico a b).filter (fun m => P ≤ m ∧ m < Q)).card : ℝ) := by
have h5 : Q ≤ ((Finset.Ico a b).filter (fun m => P ≤ m ∧ m < Q)).card + P := by omega
have h6 : (Q : ℝ) ≤ (((Finset.Ico a b).filter (fun m => P ≤ m ∧ m < Q)).card : ℝ) + P := by exact_mod_cast h5
linarith
linarith
have hFa : F a ≤ B := by
have h1 : cq_P w q a ≤ 0 := by
unfold cq_P
have h2 : 0 ≤ 1 - Real.cos (cq_g w q a) := by linarith [Real.cos_le_one (cq_g w q a)]
have h3 : 0 ≤ (a : ℝ) ^ (q + 1) / (q * w ^ q) := by positivity
nlinarith
simp only [hF]; linarith
have hFb : -((b : ℝ) * cq_g w q b) ≤ F b := by
have h1 : 1 - Real.cos (cq_g w q b) ≤ cq_g w q b ^ 2 / 2 := by
linarith [Real.one_sub_sq_div_two_le_cos (x := cq_g w q b)]
have h2 : 0 ≤ (b : ℝ) ^ (q + 1) / (q * w ^ q) := by positivity
have h3 := mul_le_mul_of_nonneg_left h1 h2
have h4 : (b : ℝ) ^ (q + 1) / (q * w ^ q) * (cq_g w q b ^ 2 / 2) = (b : ℝ) * cq_g w q b / (2 * q) := by
unfold cq_g
rw [pow_succ]
field_simp
have h5 : (b : ℝ) * cq_g w q b / (2 * q) ≤ (b : ℝ) * cq_g w q b :=
div_le_self (by positivity) (by linarith)
simp only [hF]
unfold cq_P
linarith
rw [← Finset.sum_Ico_consecutive _ haμ hab]
have hfin : B + 2 ≤ c / 10 * w := by
have h1 : 10 / c * (B + 2) ≤ w := hμ1.trans hwμ
have h2 := mul_le_mul_of_nonneg_left h1 (show 0 ≤ c / 10 by positivity)
have e : c / 10 * (10 / c * (B + 2)) = B + 2 := by field_simp
linarith
linarith
private def cq_N (s μ q m : ℕ) : ℕ := (s * μ ^ q) / m ^ q
/-- For `0 < x ≤ π`: the sum of Dirichlet kernels is at least `-4b`. -/
private lemma cq_poly (q : ℕ) (hq : 2 ≤ q) (μ : ℕ) (hμ : 0 < μ)
(hmain : ∀ (w : ℝ), 0 < w → ∀ b : ℕ, μ ≤ b → w ≤ b →
-((b : ℝ) * cq_g w q b) ≤ ∑ m ∈ Finset.Ico μ b, Real.sin (cq_g w q m))
(s b : ℕ) (hs : 0 < s) (hb : μ ≤ b) (hsb : 4 ^ q * (s * μ ^ q) ≤ b ^ q) (x : ℝ) (hx : 0 < x) (hxπ : x ≤ Real.pi) :
-(4 * (b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * x) := by
have hμR : (0 : ℝ) < μ := by exact_mod_cast hμ
have hsR : (0 : ℝ) < s := by exact_mod_cast hs
have hbR : (0 : ℝ) < b := hμR.trans_le (by exact_mod_cast hb)
have hq0 : (q : ℝ) ≠ 0 := by positivity
have hsbR : (4 : ℝ) ^ q * (s * (μ : ℝ) ^ q) ≤ (b : ℝ) ^ q := by exact_mod_cast hsb
have hpi4 : x ≤ 4 := hxπ.trans Real.pi_le_four
obtain ⟨z, hz0, hzq⟩ : ∃ z : ℝ, 0 < z ∧ z ^ q = s * x := by
refine ⟨(s * x) ^ (1 / (q : ℝ)), by positivity, ?_⟩
rw [← Real.rpow_natCast, ← Real.rpow_mul (by positivity), one_div_mul_cancel hq0, Real.rpow_one]
have hwq : (z * μ) ^ q = s * x * (μ : ℝ) ^ q := by rw [mul_pow, hzq]
have h4q : (4 : ℝ) ≤ 4 ^ q := by
calc (4 : ℝ) = 4 ^ 1 := by norm_num
_ ≤ 4 ^ q := pow_le_pow_right₀ (by norm_num) (by omega)
have hwb : z * μ ≤ b := by
apply le_of_pow_le_pow_left₀ (show q ≠ 0 by omega) hbR.le
rw [hwq]
calc (s : ℝ) * x * (μ : ℝ) ^ q = x * (s * (μ : ℝ) ^ q) := by ring
_ ≤ 4 ^ q * (s * (μ : ℝ) ^ q) := mul_le_mul_of_nonneg_right (hpi4.trans h4q) (by positivity)
_ ≤ (b : ℝ) ^ q := hsbR
have h1 := hmain (z * μ) (by positivity) b hb hwb
have hg : ∀ u : ℝ, cq_g (z * μ) q u = x * (s * (μ : ℝ) ^ q * (u ^ q)⁻¹) := by
intro u; unfold cq_g; rw [hwq]; ring
have htail : cq_g (z * μ) q b ≤ x := by
rw [hg]
have h2 : (s : ℝ) * (μ : ℝ) ^ q * ((b : ℝ) ^ q)⁻¹ ≤ 1 := by
rw [← div_eq_mul_inv, div_le_one (by positivity)]
have : 0 ≤ (s : ℝ) * (μ : ℝ) ^ q := by positivity
nlinarith
calc x * (s * (μ : ℝ) ^ q * ((b : ℝ) ^ q)⁻¹) ≤ x * 1 := mul_le_mul_of_nonneg_left h2 hx.le
_ = x := mul_one x
have hterm : ∀ m ∈ Finset.Ico μ b, Real.sin (cq_g (z * μ) q m) - x / 2 ≤
Real.sin (((cq_N s μ q m : ℝ) + 1 / 2) * x) := by
intro m hm
have hm0 : 0 < m := hμ.trans_le (Finset.mem_Ico.mp hm).1
have hmq : 0 < m ^ q := Nat.pow_pos hm0
have hmqR : (0 : ℝ) < (m : ℝ) ^ q := by exact_mod_cast hmq
set r : ℝ := s * (μ : ℝ) ^ q * ((m : ℝ) ^ q)⁻¹ with hr
have hr' : r * (m : ℝ) ^ q = s * (μ : ℝ) ^ q := by rw [hr]; field_simp
have hlo : (cq_N s μ q m : ℝ) ≤ r := by
have h2 : cq_N s μ q m * m ^ q ≤ s * μ ^ q := Nat.div_mul_le_self _ _
have h3 : (cq_N s μ q m : ℝ) * (m : ℝ) ^ q ≤ s * (μ : ℝ) ^ q := by exact_mod_cast h2
rw [← hr'] at h3
exact le_of_mul_le_mul_right h3 hmqR
have hhi : r ≤ (cq_N s μ q m : ℝ) + 1 := by
have h2 : s * μ ^ q < (cq_N s μ q m + 1) * m ^ q := by
have h := Nat.lt_mul_div_succ (s * μ ^ q) hmq
calc s * μ ^ q < m ^ q * (s * μ ^ q / m ^ q + 1) := h
_ = (cq_N s μ q m + 1) * m ^ q := mul_comm _ _
have h3 : (s : ℝ) * (μ : ℝ) ^ q < ((cq_N s μ q m : ℝ) + 1) * (m : ℝ) ^ q := by exact_mod_cast h2
rw [← hr'] at h3
exact (lt_of_mul_lt_mul_right h3 hmqR.le).le
have h4 := Real.abs_sin_sub_sin_le (cq_g (z * μ) q m) (((cq_N s μ q m : ℝ) + 1 / 2) * x)
have h5 := le_abs_self (Real.sin (cq_g (z * μ) q m) - Real.sin (((cq_N s μ q m : ℝ) + 1 / 2) * x))
have h6 : |cq_g (z * μ) q m - ((cq_N s μ q m : ℝ) + 1 / 2) * x| ≤ x / 2 := by
rw [hg, ← hr, abs_le]
constructor <;> nlinarith
linarith
have hsum := Finset.sum_le_sum hterm
rw [Finset.sum_sub_distrib, Finset.sum_const, Nat.card_Ico, nsmul_eq_mul, Nat.cast_sub hb] at hsum
have hD : 2 * Real.sin (x / 2) * ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * x) =
∑ m ∈ Finset.Ico μ b, Real.sin (((cq_N s μ q m : ℝ) + 1 / 2) * x) - ((b : ℝ) - μ) * Real.sin (x / 2) := by
rw [Finset.mul_sum, Finset.sum_congr rfl (fun m _ => cq_dirichlet (cq_N s μ q m) x),
Finset.sum_sub_distrib, Finset.sum_const, Nat.card_Ico, nsmul_eq_mul, Nat.cast_sub hb]
have hsin : x / 4 ≤ Real.sin (x / 2) := by
have h2 := Real.mul_le_sin (show 0 ≤ x / 2 by linarith) (by linarith)
have h3 : 1 / 4 ≤ 1 / Real.pi := one_div_le_one_div_of_le Real.pi_pos Real.pi_le_four
have h4 : 2 / Real.pi * (x / 2) = 1 / Real.pi * x := by ring
rw [h4] at h2
nlinarith
have hsin0 : 0 < Real.sin (x / 2) := by linarith
set T := ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * x) with hT
have h7 : (b : ℝ) * cq_g (z * μ) q b ≤ b * x := mul_le_mul_of_nonneg_left htail hbR.le
have h8 : ((b : ℝ) - μ) * (x / 2) ≤ b * (x / 2) := mul_le_mul_of_nonneg_right (by linarith) (by linarith)
have h9 : ((b : ℝ) - μ) * Real.sin (x / 2) ≤ b * Real.sin (x / 2) := mul_le_mul_of_nonneg_right (by linarith) hsin0.le
have h10 : (b : ℝ) * (x / 4) ≤ b * Real.sin (x / 2) := mul_le_mul_of_nonneg_left hsin hbR.le
have h11 : 0 ≤ 2 * Real.sin (x / 2) * (T + 4 * b) := by
have e : 2 * Real.sin (x / 2) * (T + 4 * b) = 2 * Real.sin (x / 2) * T + 8 * (b * Real.sin (x / 2)) := by ring
have h12 : 0 ≤ (b : ℝ) * x := by positivity
rw [e, hD]
linarith
have h12 : 0 ≤ T + 4 * b := nonneg_of_mul_nonneg_right h11 (by linarith)
linarith
private lemma cq_reduce (x : ℝ) : ∃ y : ℝ, 0 ≤ y ∧ y ≤ Real.pi ∧ ∀ k : ℕ, Real.cos ((k : ℝ) * x) = Real.cos ((k : ℝ) * y) := by
refine ⟨Real.arccos (Real.cos x), Real.arccos_nonneg _, Real.arccos_le_pi _, fun k => ?_⟩
have h : Real.cos (Real.arccos (Real.cos x)) = Real.cos x :=
Real.cos_arccos (Real.neg_one_le_cos x) (Real.cos_le_one x)
have h1 := Polynomial.Chebyshev.T_real_cos x (k : ℤ)
have h2 := Polynomial.Chebyshev.T_real_cos (Real.arccos (Real.cos x)) (k : ℤ)
rw [h] at h2
push_cast at h1 h2
rw [← h1, ← h2]
theorem erdos_1094__h2__h2__h5__h2__h2__h1__h2__h2 : ∀ (q : ℕ),
(2 : ℕ) ≤ q →
∃ (C : ℕ),
∀ (ν ρ : ℕ),
(1 : ℕ) ≤ ρ →
ρ ≤ ν ^ q →
∃ (a : ℕ → ℕ),
∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧
∀ (x : ℝ), -((↑C : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x) := by
intro q hq
obtain ⟨μ, hμ, hmain⟩ := cq_main q hq
refine ⟨20 * μ, ?_⟩
intro ν ρ hρ hρν
have hν : 0 < ν := by
rcases Nat.eq_zero_or_pos ν with h | h
· rw [h, zero_pow (by omega)] at hρν; omega
· exact h
obtain ⟨b, hbdef⟩ : ∃ b : ℕ, b = 4 * (μ * ν) := ⟨_, rfl⟩
have hμν : μ ≤ μ * ν := Nat.le_mul_of_pos_right μ hν
have hb : μ < b := by omega
set R : ℕ → ℕ := fun s => ∑ m ∈ Finset.Ico μ b, cq_N s μ q m with hR
have hRs : ∀ s, s ≤ R s := by
intro s
have h1 : cq_N s μ q μ = s := Nat.mul_div_cancel _ (Nat.pow_pos hμ)
have h2 := Finset.single_le_sum (f := fun m => cq_N s μ q m) (fun i _ => Nat.zero_le _)
(Finset.mem_Ico.mpr ⟨le_refl μ, hb⟩)
simp only [hR]
omega
have hR0 : R 0 = 0 := by simp [hR, cq_N]
have hstep : ∀ s, R (s + 1) ≤ R s + b := by
intro s
have h1 : ∀ m ∈ Finset.Ico μ b, cq_N (s + 1) μ q m ≤ cq_N s μ q m + 1 := by
intro m hm
have hmμ := (Finset.mem_Ico.mp hm).1
have hmq : 0 < m ^ q := Nat.pow_pos (hμ.trans_le hmμ)
have h2 : μ ^ q ≤ m ^ q := Nat.pow_le_pow_left hmμ q
unfold cq_N
rw [← Nat.add_div_right _ hmq]
apply Nat.div_le_div_right
rw [add_mul, one_mul]
omega
have h2 := Finset.sum_le_sum h1
rw [Finset.sum_add_distrib, Finset.sum_const, Nat.card_Ico, smul_eq_mul, mul_one] at h2
simp only [hR]
omega
have hex : ∃ s, ρ < R s := ⟨ρ + 1, (Nat.lt_succ_self ρ).trans_le (hRs (ρ + 1))⟩
obtain ⟨s, hs1, hs2⟩ : ∃ s, R s ≤ ρ ∧ ρ < R (s + 1) := by
have h1 := Nat.find_spec hex
have h0 : Nat.find hex ≠ 0 := by
intro h; rw [h, hR0] at h1; omega
obtain ⟨s, hs⟩ := Nat.exists_eq_succ_of_ne_zero h0
refine ⟨s, ?_, ?_⟩
· exact not_lt.mp (Nat.find_min hex (by omega))
· rw [hs] at h1; exact h1
have hsρ : s ≤ ρ := (hRs s).trans hs1
have hrem : ρ - R s ≤ b := by have := hstep s; omega
have hNle : ∀ m ∈ Finset.Ico μ b, cq_N s μ q m ≤ ρ := fun m hm =>
(Finset.single_le_sum (f := fun m => cq_N s μ q m) (fun i _ => Nat.zero_le _) hm).trans hs1
have hfil : ∀ m ∈ Finset.Ico μ b, (Finset.Icc 1 ρ).filter (fun k => k ≤ cq_N s μ q m) = Finset.Icc 1 (cq_N s μ q m) := by
intro m hm
have := hNle m hm
ext k
simp only [Finset.mem_filter, Finset.mem_Icc]
omega
refine ⟨fun k => ((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card + (if k = 1 then ρ - R s else 0), ?_, ?_⟩
· rw [Finset.sum_add_distrib, Finset.sum_ite_eq' (Finset.Icc 1 ρ) 1 (fun _ => ρ - R s),
if_pos (Finset.mem_Icc.mpr ⟨le_refl 1, hρ⟩)]
have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card = R s := by
simp only [Finset.card_filter]
rw [Finset.sum_comm]
simp only [hR]
apply Finset.sum_congr rfl
intro m hm
rw [← Finset.card_filter, hfil m hm, Nat.card_Icc]
omega
rw [h1]; omega
· intro x
obtain ⟨y, hy0, hyπ, hxy⟩ := cq_reduce x
have h1 : ∑ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card +
(if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) =
∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) +
((ρ - R s : ℕ) : ℝ) * Real.cos y := by
have h2 : ∀ k ∈ Finset.Icc 1 ρ, ((((Finset.Ico μ b).filter (fun m => k ≤ cq_N s μ q m)).card +
(if k = 1 then ρ - R s else 0) : ℕ) : ℝ) * Real.cos ((k : ℝ) * x) =
∑ m ∈ Finset.Ico μ b, (if k ≤ cq_N s μ q m then Real.cos ((k : ℝ) * y) else 0) +
(if k = 1 then ((ρ - R s : ℕ) : ℝ) * Real.cos y else 0) := by
intro k _
rw [hxy k, Nat.cast_add, add_mul, ← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul]
congr 1
split_ifs with hk
· rw [hk, Nat.cast_one, one_mul]
· simp
rw [Finset.sum_congr rfl h2, Finset.sum_add_distrib, Finset.sum_comm,
Finset.sum_ite_eq' (Finset.Icc 1 ρ) 1 (fun _ => ((ρ - R s : ℕ) : ℝ) * Real.cos y),
if_pos (Finset.mem_Icc.mpr ⟨le_refl 1, hρ⟩)]
congr 1
apply Finset.sum_congr rfl
intro m hm
rw [← Finset.sum_filter, hfil m hm]
have h3 : -(b : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) * Real.cos y := by
have h4 : ((ρ - R s : ℕ) : ℝ) ≤ b := by exact_mod_cast hrem
have h5 : (0 : ℝ) ≤ ((ρ - R s : ℕ) : ℝ) := Nat.cast_nonneg _
nlinarith [Real.neg_one_le_cos y]
have hbR : (0 : ℝ) ≤ b := Nat.cast_nonneg b
have h6 : -(4 * (b : ℝ)) ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by
have hnonneg : (∀ k : ℕ, Real.cos ((k : ℝ) * y) = 1) ∨ s = 0 →
0 ≤ ∑ m ∈ Finset.Ico μ b, ∑ k ∈ Finset.Icc 1 (cq_N s μ q m), Real.cos ((k : ℝ) * y) := by
rintro (h | h)
· exact Finset.sum_nonneg fun m _ => Finset.sum_nonneg fun k _ => by rw [h k]; norm_num
· have : ∀ m, cq_N s μ q m = 0 := by intro m; rw [h]; simp [cq_N]
simp [this]
rcases hy0.eq_or_lt with h | h
· have := hnonneg (Or.inl fun k => by rw [← h]; simp)
linarith
· rcases Nat.eq_zero_or_pos s with hs0 | hs0
· have := hnonneg (Or.inr hs0)
linarith
· refine cq_poly q hq μ hμ hmain s b hs0 hb.le ?_ y h hyπ
calc 4 ^ q * (s * μ ^ q) ≤ 4 ^ q * (ν ^ q * μ ^ q) :=
Nat.mul_le_mul_left _ (Nat.mul_le_mul_right _ (hsρ.trans hρν))
_ = b ^ q := by rw [hbdef, mul_pow, mul_pow]; ring
have h7 : (b : ℝ) * 5 = ((20 * μ : ℕ) : ℝ) * ν := by rw [hbdef]; push_cast; ring
simp only
rw [h1]
linarithWhat is known
Work on it
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--h5--h2--h2--h1--h2--h2».Context
open scoped Nat
/-! Hole `h_cos` 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__h5__h2__h2__h1__h2__h2 : ∀ (q : ℕ),
(2 : ℕ) ≤ q →
∃ (C : ℕ),
∀ (ν ρ : ℕ),
(1 : ℕ) ≤ ρ →
ρ ≤ ν ^ q →
∃ (a : ℕ → ℕ),
∑ k ∈ Finset.Icc (1 : ℕ) ρ, a k = ρ ∧
∀ (x : ℝ), -((↑C : ℝ) * (↑ν : ℝ)) ≤ ∑ k ∈ Finset.Icc (1 : ℕ) ρ, (↑(a k) : ℝ) * Real.cos ((↑k : ℝ) * x) := 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 t1203r2-k, drafted with claude-opus-5-5 with claude-fable-5-1 / claude-fable-5-2 (agents A, B, K1 shift 1), 2026-12-03; no one has read it against the Lean and signed it.
Draft · drafted, by the model named above
$\displaystyle \forall q\ge2\ \exists C\in\mathbb N\ \forall\nu,\rho\in\mathbb N:\ 1\le\rho\le\nu^q \Rightarrow \exists a_1,\dots,a_\rho\in\mathbb N:\ \sum_{k=1}^{\rho} a_k=\rho,\ \forall x\in\mathbb R:\ \sum_{k=1}^{\rho} a_k\cos(kx)\ge -C\nu$
For each exponent $q$ there are, for every positive integer $\rho$, non-negative integers $a_1,\dots,a_\rho$ with sum $\rho$ whose cosine sum is bounded below by $-C\nu$ for every $\nu$ with $\rho\le\nu^q$, that is by about $-C\rho^{1/q}$, with $C$ depending on $q$ alone. Belov and Konyagin (Izv. Math. 60:6, 1996, Corollary 0.2) prove the stronger lower bound $-2^{32}(1+\log\rho)^5$. In the Lean, a : ℕ → ℕ is a sequence of which only the values at $1,\dots,\rho$ are used.
Rendered from gloss/283a048b91a0….md · Improve these words →
Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2/Statement.lean. Origin: compiler-derived.
Attestation: pass, 7 of 7 checks
Checked by the kernel — the gate’s record of the run: attestations/002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2.json, merge commit 9a0c8b0f096c.
Verdict pass, from attestations/002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2.json.
- Submitter
t1203r2-k- 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/002857.erdos-1094--h2--h2--h5--h2--h2--h1--h2--h2.json, merge commit 9a0c8b0f096c.
7e83017d09b0.import Mathlib open scoped Nat theorem witness : ∃ (q : ℕ), (2 : ℕ) ≤ q := ⟨2, le_rfl⟩
No gloss yet: no one has written in words what this witness says (D-3 v3.30); the Lean above is the witness. How to write one →