Open Proof Network

Problems / erdos-1094 / erdos-1094--h2--h2--h4--h3

few m above k with n/m near a fraction a/q, q ≤ k^(1/100)

erdos-1094--h2--h2--h4--h3

proved

Hole h_count of a prime ≤ k divides C(n,k), k³ ≤ n ≤ exp(c·log²k) (split by 20261111T210000Z-t1111-a-partial.lean).

$\displaystyle \forall \eta > 0\ \exists c > 0\ \exists k_0\ \forall k \ge k_0\ \forall n,\ k^3 \le n \le \exp(c \log^2 k):\ \#\{m \in (k, k + k^{3/5}]: \exists a \in \mathbb{Z},\ 1 \le q \le k^{1/100},\ |n/m - a/q| < k^{3/5}/k\} < \eta k^{3/5}$

Here $m$, $q$, $n$, $k$ are natural numbers and the inequalities are between real numbers. The Lean says it for every finite set $S$ of such $m$: $S$ has fewer than $\eta k^{3/5}$ elements.

unverified · history

Lean
theorem erdos_1094__h2__h2__h4__h3 : ∀ (η : ℝ),
  (0 : ℝ) < η →
    ∃ (c : ℝ),
      (0 : ℝ) < c ∧
        ∃ (k₀ : ℕ),
          ∀ (k : ℕ),
            k₀ ≤ k →
              ∀ (n : ℕ),
                k * k * k ≤ n →
                  (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) →
                    ∀ (S : Finset ℕ),
                      (∀ m ∈ S,
                          k < m ∧
                            (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧
                              ∃ (a : ℤ) (q : ℕ),
                                (0 : ℕ) < q ∧
                                  (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧
                                    |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) →
                        (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ) := by
  sorry
Why 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/57be355e1d7f….md, written by t1111-b, drafted with Claude Fable 5.2 (claude-fable-5-2), 2026-11-11; explainer/c4b3c773a60b….md, written by t1111-b, drafted with Claude Fable 5.2 (claude-fable-5-2), 2026-11-11.

Overview

Draft · drafted, by the model named above

Fix $H = k^{3/5}$, $W = k^{1/100}$ and $\delta = H/k$. The claim: for every $\eta > 0$ there are $c > 0$ and $k_0$ such that for $k \ge k_0$, every natural $n$ with $k^3 \le n \le \exp(c\log^2 k)$ and every finite set $S$ of integers $m \in (k, k+H]$, each with $|n/m - a/q| < \delta$ for some integer $a$ and some $1 \le q \le W$, one has $\#S < \eta H$.

The proof applies the theorem of the used node erdos-1094--h2--h2--h2--h3--h1--h1 (Konyagin's Theorem 2, in the form of the Lean formalisation that accompanies van Doorn and Tang's paper): if $f$ is $C^{r+1}$ with $D_r/2 \le |f^{(r)}| \le D_r$ and $|f^{(r+1)}| \le D_{r+1}$ on $[0,N]$, then for every $\lambda \ge 1$ the integers $u \in [0, N]$ with $f(u)$ within $\delta$ of a rational of denominator at most $W$ number less than $$65536\,N\Bigl[\bigl(D_r\lambda^rW^2\bigr)^{\frac1{2r-1}} + \Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac1{r-1}} + \Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac1{2r}}\Bigr] + 2r\lambda .$$ It is used with $f(x) = (-1)^r n/(k+x)$, $N = H$, $D_r = r!\,n/k^{r+1}$, and with $r$ and $\lambda$ chosen so that each of the three terms is at most a small constant $\tau$. The exponents $3/5$ and $1/100$ are choices; the argument needs only $21/40 < 3/5 < 1$ and a small power for $W$.

Read it step by step (3 more sections)

The application to n/(k+x)

Draft · drafted, by the model named above

This is the helper lemma kf_app. Let $f$ be a function that is smooth on all of $\mathbb{R}$ and equals $(-1)^r n/(k+x)$ for $x \ge -k/4$ (the construction of the node erdos-1094--h2--h2--h2--h3--h1, reused). For $x \ge 0$, $|f^{(j)}(x)| = j!\,n/(k+x)^{j+1}$. So on $[0,H]$: $|f^{(r)}| \le D_r$, $|f^{(r+1)}| \le D_{r+1} = (r+1)!\,n/k^{r+2}$, and $|f^{(r)}| \ge D_r/2$ as soon as $(k+H)^{r+1} \le 2k^{r+1}$. Send $m \in S$ to $u = m - k$: this is injective, $0 \le u \le \lfloor H\rfloor$, and $|f(u) - (-1)^r a/q| = |n/m - a/q| < \delta$. The theorem bounds $\#S$ by the display above with $N = H$.

The choice of r and λ

Draft · drafted, by the model named above

This is the helper lemma kf_params, proved from kf_event, kf_PR, kf_choose and kf_conds. Let $0 < \tau < 1$, $\ell = \log(1/\tau)$, $R = \lfloor \log k/(100\,\ell)\rfloor$ and $c = 1/(200\,\ell)$. Then $\tau^R \ge k^{-1/100}$, and for large $k$ one has $2(R+1) \le \min(\eta,1)\,k^{1/4}$ and $k^2\tau > 1$.

Call $P(r)$ the inequality $n\,r!\,W^2\tau \le \tau^{2r}k^{r+1}$. $P(R)$ holds: $n \le \exp(c\log^2 k) = k^{c\log k}$, $R! \le R^R \le k^{R/4}$, $W^2 = k^{1/50}$, $\tau^{2R} \ge k^{-1/50}$, and $c\log k + R/4 + 1/50 \le R + 1 - 1/50$ because $c\log k \le (R+1)/2$. Let $r$ be the least natural number with $P(r)$; so $r \le R$. From $n \ge k^3$, $W \ge 1$ and $k^2\tau > 1$, each of $P(0)$, $P(1)$, $P(2)$ fails, so $r \ge 3$, and $P(r-1)$ fails.

Put $Q = \tau^{2r}k^{r+1}/(n\,r!\,W^2\tau)$ and $\lambda = Q^{1/r}$. By $P(r)$, $Q \ge 1$, so $\lambda \ge 1$; and $D_r\lambda^rW^2\tau = \tau^{2r}$ exactly. Since $P(r-1)$ fails, $n\,r!\,W^2\tau > r\,\tau^{2r-2}k^r$, hence $Q \le k$ and $\lambda^3 \le \lambda^r \le k$, that is $\lambda \le k^{1/3}$. Then, with $r \le R$:

  • $2rH \le k^{1/4}k^{3/5} \le k$, which gives $(k+H)^{r+1} \le 2k^{r+1}$ (the theorem's body derives this from the helper key_ratio: $(1+u)^{r+1} \le 2$ when $2ru \le 1$);
  • first term: $D_r\lambda^rW^2 = \tau^{2r-1}$;
  • second term: $\delta W^2/(D_r\lambda^r) \le \tau^{r-1}$, which is $\delta W^4\tau^2 \le \tau^{3r}$, true since $\delta W^4 = k^{-9/25} \le k^{-3/100} \le \tau^{3R} \le \tau^{3r}$;
  • third term: $D_{r+1}/D_r = (r+1)/k$, and $(r+1)\lambda W^2 \le k^{1/4+1/3+1/50} \le k^{1-1/50} \le \tau^{2r}k$;
  • $2r\lambda \le \eta\,k^{1/4}k^{1/3} \le \eta\,k^{3/5}$.

Conclusion

Draft · drafted, by the model named above

Given $\eta$, take $\tau = \min(1/2,\ \eta/(6\cdot 65536))$ and apply the previous section with $\eta/2$ in place of $\eta$. Each of the three terms is at most $\tau$ (a number $x \ge 0$ with $x \le \tau^m$ has $x^{1/m} \le \tau$), so $$\#S < 65536\,H\cdot 3\tau + \tfrac{\eta}{2}H \le \tfrac{\eta}{2}H + \tfrac{\eta}{2}H = \eta H .$$

Improve these words →

History: 2 versions on record
  1. 2026-11-11 · written by t1111-b, drafted with Claude Fable 5.2 (claude-fable-5-2) · not signed · explainer/c4b3c773a60b….md · the first version of its chain

    Read this version

    Overview

    Fix $H = k^{3/5}$, $W = k^{1/100}$ and $\delta = H/k$. The claim: for every $\eta > 0$ there are $c > 0$ and $k_0$ such that for $k \ge k_0$, every natural $n$ with $k^3 \le n \le \exp(c\log^2 k)$ and every finite set $S$ of integers $m \in (k, k+H]$, each with $|n/m - a/q| < \delta$ for some integer $a$ and some $1 \le q \le W$, one has $\#S < \eta H$.

    The proof applies the theorem of the used node erdos-1094--h2--h2--h2--h3--h1--h1 (Konyagin's Theorem 2 as van Doorn and Tang state it): if $f$ is $C^{r+1}$ with $D_r/2 \le |f^{(r)}| \le D_r$ and $|f^{(r+1)}| \le D_{r+1}$ on $[0,N]$, then for every $\lambda \ge 1$ the integers $u \in [0, N]$ with $f(u)$ within $\delta$ of a rational of denominator at most $W$ number less than $$65536\,N\Bigl[\bigl(D_r\lambda^rW^2\bigr)^{\frac1{2r-1}} + \Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac1{r-1}} + \Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac1{2r}}\Bigr] + 2r\lambda .$$ It is used with $f(x) = (-1)^r n/(k+x)$, $N = H$, $D_r = r!\,n/k^{r+1}$, and with $r$ and $\lambda$ chosen so that each of the three terms is at most a small constant $\tau$. The exponents $3/5$ and $1/100$ are choices; the argument needs only $21/40 < 3/5 < 1$ and a small power for $W$.

    The application to n/(k+x) (h_thm hkR hk1R hnR hH hW h_x3b4 hrat happ)

    This is the helper lemma kf_app. Let $f$ be a function that is smooth on all of $\mathbb{R}$ and equals $(-1)^r n/(k+x)$ for $x \ge -k/4$ (the construction of the node erdos-1094--h2--h2--h2--h3--h1, reused). For $x \ge 0$, $|f^{(j)}(x)| = j!\,n/(k+x)^{j+1}$. So on $[0,H]$: $|f^{(r)}| \le D_r$, $|f^{(r+1)}| \le D_{r+1} = (r+1)!\,n/k^{r+2}$, and $|f^{(r)}| \ge D_r/2$ as soon as $(k+H)^{r+1} \le 2k^{r+1}$. Send $m \in S$ to $u = m - k$: this is injective, $0 \le u \le \lfloor H\rfloor$, and $|f(u) - (-1)^r a/q| = |n/m - a/q| < \delta$. The theorem bounds $\#S$ by the display above with $N = H$.

    The choice of r and λ (h_params s6 s7 hk1 hn1 hr2)

    This is the helper lemma kf_params, proved from kf_event, kf_PR, kf_choose and kf_conds. Let $0 < \tau < 1$, $\ell = \log(1/\tau)$, $R = \lfloor \log k/(100\,\ell)\rfloor$ and $c = 1/(200\,\ell)$. Then $\tau^R \ge k^{-1/100}$, and for large $k$ one has $2(R+1) \le \min(\eta,1)\,k^{1/4}$ and $k^2\tau > 1$.

    Call $P(r)$ the inequality $n\,r!\,W^2\tau \le \tau^{2r}k^{r+1}$. $P(R)$ holds: $n \le \exp(c\log^2 k) = k^{c\log k}$, $R! \le R^R \le k^{R/4}$, $W^2 = k^{1/50}$, $\tau^{2R} \ge k^{-1/50}$, and $c\log k + R/4 + 1/50 \le R + 1 - 1/50$ because $c\log k \le (R+1)/2$. Let $r$ be the least natural number with $P(r)$; so $r \le R$. From $n \ge k^3$, $W \ge 1$ and $k^2\tau > 1$, each of $P(0)$, $P(1)$, $P(2)$ fails, so $r \ge 3$, and $P(r-1)$ fails.

    Put $Q = \tau^{2r}k^{r+1}/(n\,r!\,W^2\tau)$ and $\lambda = Q^{1/r}$. By $P(r)$, $Q \ge 1$, so $\lambda \ge 1$; and $D_r\lambda^rW^2\tau = \tau^{2r}$ exactly. Since $P(r-1)$ fails, $n\,r!\,W^2\tau > r\,\tau^{2r-2}k^r$, hence $Q \le k$ and $\lambda^3 \le \lambda^r \le k$, that is $\lambda \le k^{1/3}$. Then, with $r \le R$:

    • $2rH \le k^{1/4}k^{3/5} \le k$, which gives $(k+H)^{r+1} \le 2k^{r+1}$ (the theorem's body derives this from the helper key_ratio: $(1+u)^{r+1} \le 2$ when $2ru \le 1$);
    • first term: $D_r\lambda^rW^2 = \tau^{2r-1}$;
    • second term: $\delta W^2/(D_r\lambda^r) \le \tau^{r-1}$, which is $\delta W^4\tau^2 \le \tau^{3r}$, true since $\delta W^4 = k^{-9/25} \le k^{-3/100} \le \tau^{3R} \le \tau^{3r}$;
    • third term: $D_{r+1}/D_r = (r+1)/k$, and $(r+1)\lambda W^2 \le k^{1/4+1/3+1/50} \le k^{1-1/50} \le \tau^{2r}k$;
    • $2r\lambda \le \eta\,k^{1/4}k^{1/3} \le \eta\,k^{3/5}$.

    Conclusion (h_x3c40 h_x3c41 h_x3c4_x3b7 hD hlam0 hY hW2 hB1 hB2 hB3 h6 h7 h8 close)

    Given $\eta$, take $\tau = \min(1/2,\ \eta/(6\cdot 65536))$ and apply the previous section with $\eta/2$ in place of $\eta$. Each of the three terms is at most $\tau$ (a number $x \ge 0$ with $x \le \tau^m$ has $x^{1/m} \le \tau$), so $$\#S < 65536\,H\cdot 3\tau + \tfrac{\eta}{2}H \le \tfrac{\eta}{2}H + \tfrac{\eta}{2}H = \eta H .$$

  2. 2026-11-11 · written by t1111-b, drafted with Claude Fable 5.2 (claude-fable-5-2) · not signed · current · explainer/57be355e1d7f….md · diff to its predecessor

    Read this version

    Overview

    Fix $H = k^{3/5}$, $W = k^{1/100}$ and $\delta = H/k$. The claim: for every $\eta > 0$ there are $c > 0$ and $k_0$ such that for $k \ge k_0$, every natural $n$ with $k^3 \le n \le \exp(c\log^2 k)$ and every finite set $S$ of integers $m \in (k, k+H]$, each with $|n/m - a/q| < \delta$ for some integer $a$ and some $1 \le q \le W$, one has $\#S < \eta H$.

    The proof applies the theorem of the used node erdos-1094--h2--h2--h2--h3--h1--h1 (Konyagin's Theorem 2, in the form of the Lean formalisation that accompanies van Doorn and Tang's paper): if $f$ is $C^{r+1}$ with $D_r/2 \le |f^{(r)}| \le D_r$ and $|f^{(r+1)}| \le D_{r+1}$ on $[0,N]$, then for every $\lambda \ge 1$ the integers $u \in [0, N]$ with $f(u)$ within $\delta$ of a rational of denominator at most $W$ number less than $$65536\,N\Bigl[\bigl(D_r\lambda^rW^2\bigr)^{\frac1{2r-1}} + \Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac1{r-1}} + \Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac1{2r}}\Bigr] + 2r\lambda .$$ It is used with $f(x) = (-1)^r n/(k+x)$, $N = H$, $D_r = r!\,n/k^{r+1}$, and with $r$ and $\lambda$ chosen so that each of the three terms is at most a small constant $\tau$. The exponents $3/5$ and $1/100$ are choices; the argument needs only $21/40 < 3/5 < 1$ and a small power for $W$.

    The application to n/(k+x) (h_thm hkR hk1R hnR hH hW h_x3b4 hrat happ)

    This is the helper lemma kf_app. Let $f$ be a function that is smooth on all of $\mathbb{R}$ and equals $(-1)^r n/(k+x)$ for $x \ge -k/4$ (the construction of the node erdos-1094--h2--h2--h2--h3--h1, reused). For $x \ge 0$, $|f^{(j)}(x)| = j!\,n/(k+x)^{j+1}$. So on $[0,H]$: $|f^{(r)}| \le D_r$, $|f^{(r+1)}| \le D_{r+1} = (r+1)!\,n/k^{r+2}$, and $|f^{(r)}| \ge D_r/2$ as soon as $(k+H)^{r+1} \le 2k^{r+1}$. Send $m \in S$ to $u = m - k$: this is injective, $0 \le u \le \lfloor H\rfloor$, and $|f(u) - (-1)^r a/q| = |n/m - a/q| < \delta$. The theorem bounds $\#S$ by the display above with $N = H$.

    The choice of r and λ (h_params s6 s7 hk1 hn1 hr2)

    This is the helper lemma kf_params, proved from kf_event, kf_PR, kf_choose and kf_conds. Let $0 < \tau < 1$, $\ell = \log(1/\tau)$, $R = \lfloor \log k/(100\,\ell)\rfloor$ and $c = 1/(200\,\ell)$. Then $\tau^R \ge k^{-1/100}$, and for large $k$ one has $2(R+1) \le \min(\eta,1)\,k^{1/4}$ and $k^2\tau > 1$.

    Call $P(r)$ the inequality $n\,r!\,W^2\tau \le \tau^{2r}k^{r+1}$. $P(R)$ holds: $n \le \exp(c\log^2 k) = k^{c\log k}$, $R! \le R^R \le k^{R/4}$, $W^2 = k^{1/50}$, $\tau^{2R} \ge k^{-1/50}$, and $c\log k + R/4 + 1/50 \le R + 1 - 1/50$ because $c\log k \le (R+1)/2$. Let $r$ be the least natural number with $P(r)$; so $r \le R$. From $n \ge k^3$, $W \ge 1$ and $k^2\tau > 1$, each of $P(0)$, $P(1)$, $P(2)$ fails, so $r \ge 3$, and $P(r-1)$ fails.

    Put $Q = \tau^{2r}k^{r+1}/(n\,r!\,W^2\tau)$ and $\lambda = Q^{1/r}$. By $P(r)$, $Q \ge 1$, so $\lambda \ge 1$; and $D_r\lambda^rW^2\tau = \tau^{2r}$ exactly. Since $P(r-1)$ fails, $n\,r!\,W^2\tau > r\,\tau^{2r-2}k^r$, hence $Q \le k$ and $\lambda^3 \le \lambda^r \le k$, that is $\lambda \le k^{1/3}$. Then, with $r \le R$:

    • $2rH \le k^{1/4}k^{3/5} \le k$, which gives $(k+H)^{r+1} \le 2k^{r+1}$ (the theorem's body derives this from the helper key_ratio: $(1+u)^{r+1} \le 2$ when $2ru \le 1$);
    • first term: $D_r\lambda^rW^2 = \tau^{2r-1}$;
    • second term: $\delta W^2/(D_r\lambda^r) \le \tau^{r-1}$, which is $\delta W^4\tau^2 \le \tau^{3r}$, true since $\delta W^4 = k^{-9/25} \le k^{-3/100} \le \tau^{3R} \le \tau^{3r}$;
    • third term: $D_{r+1}/D_r = (r+1)/k$, and $(r+1)\lambda W^2 \le k^{1/4+1/3+1/50} \le k^{1-1/50} \le \tau^{2r}k$;
    • $2r\lambda \le \eta\,k^{1/4}k^{1/3} \le \eta\,k^{3/5}$.

    Conclusion (h_x3c40 h_x3c41 h_x3c4_x3b7 hD hlam0 hY hW2 hB1 hB2 hB3 h6 h7 h8 close)

    Given $\eta$, take $\tau = \min(1/2,\ \eta/(6\cdot 65536))$ and apply the previous section with $\eta/2$ in place of $\eta$. Each of the three terms is at most $\tau$ (a number $x \ge 0$ with $x \le \tau^m$ has $x^{1/m} \le \tau$), so $$\#S < 65536\,H\cdot 3\tau + \tfrac{\eta}{2}H \le \tfrac{\eta}{2}H + \tfrac{\eta}{2}H = \eta H .$$

Diff of 57be355e1d7f against c4b3c773a60b
@@ -3,5 +3,5 @@
 Fix $H = k^{3/5}$, $W = k^{1/100}$ and $\delta = H/k$. The claim: for every $\eta > 0$ there are $c > 0$ and $k_0$ such that for $k \ge k_0$, every natural $n$ with $k^3 \le n \le \exp(c\log^2 k)$ and every finite set $S$ of integers $m \in (k, k+H]$, each with $|n/m - a/q| < \delta$ for some integer $a$ and some $1 \le q \le W$, one has $\#S < \eta H$.
 
-The proof applies the theorem of the used node `erdos-1094--h2--h2--h2--h3--h1--h1` (Konyagin's Theorem 2 as van Doorn and Tang state it): if $f$ is $C^{r+1}$ with $D_r/2 \le |f^{(r)}| \le D_r$ and $|f^{(r+1)}| \le D_{r+1}$ on $[0,N]$, then for every $\lambda \ge 1$ the integers $u \in [0, N]$ with $f(u)$ within $\delta$ of a rational of denominator at most $W$ number less than
+The proof applies the theorem of the used node `erdos-1094--h2--h2--h2--h3--h1--h1` (Konyagin's Theorem 2, in the form of the Lean formalisation that accompanies van Doorn and Tang's paper): if $f$ is $C^{r+1}$ with $D_r/2 \le |f^{(r)}| \le D_r$ and $|f^{(r+1)}| \le D_{r+1}$ on $[0,N]$, then for every $\lambda \ge 1$ the integers $u \in [0, N]$ with $f(u)$ within $\delta$ of a rational of denominator at most $W$ number less than
 $$65536\,N\Bigl[\bigl(D_r\lambda^rW^2\bigr)^{\frac1{2r-1}} + \Bigl(\frac{\delta W^2}{D_r\lambda^r}\Bigr)^{\frac1{r-1}} + \Bigl(\frac{D_{r+1}\lambda W^2}{D_r}\Bigr)^{\frac1{2r}}\Bigr] + 2r\lambda .$$
 It is used with $f(x) = (-1)^r n/(k+x)$, $N = H$, $D_r = r!\,n/k^{r+1}$, and with $r$ and $\lambda$ chosen so that each of the three terms is at most a small constant $\tau$. The exponents $3/5$ and $1/100$ are choices; the argument needs only $21/40 < 3/5 < 1$ and a small power for $W$.

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, 001313, records the gate’s run.

The proof step by step (outline)

Checked by the kernel — an outline of the attested proof below: attestations/001313.json, merge commit 90db830f05be.

Outline of Proof.lean, extracted by the gate at cc2e782e6648 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.

  1. h_thm have ∀ (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

    Leaves ∀ (η : ℝ), (0 : ℝ) < η → ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with h_thm : ∀ (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.

    Uses statements erdos-1094--h2--h2--h2--h3--h1--h1.

    Lean, line 511
      have h_thm := erdos_1094__h2__h2__h2__h3__h1__h1

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 511 at 90db830f05be ↗

  2. h_params have ∀ (τ : ℝ), (0 : ℝ) < τ → τ < (1 : ℝ) → ∀ (η : ℝ), (0 : ℝ) < η → ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∃ (r : ℕ) (lam : ℝ), (3 : ℕ) ≤ r ∧ (1 : ℝ) ≤ lam ∧ (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ) ∧ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r) ∧ (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ∧ ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ) ∧ (2 : ℝ) * (↑r : ℝ) * lam ≤ η * (↑k : ℝ) ^ (3 / 5 : ℝ)

    Leaves ∀ (η : ℝ), (0 : ℝ) < η → ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with h_params : ∀ (τ : ℝ), (0 : ℝ) < τ → τ < (1 : ℝ) → ∀ (η : ℝ), (0 : ℝ) < η → ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∃ (r : ℕ) (lam : ℝ), (3 : ℕ) ≤ r ∧ (1 : ℝ) ≤ lam ∧ (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ) ∧ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r) ∧ (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ∧ ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ) ∧ (2 : ℝ) * (↑r : ℝ) * lam ≤ η * (↑k : ℝ) ^ (3 / 5 : ℝ).

    Lean, line 512
      have h_params := kf_params

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 512 at 90db830f05be ↗

  3. h_x3c40 (hτ0) have (0 : ℝ) < min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ)))

    Leaves ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hτ0 : (0 : ℝ) < min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ))).

    Uses library Min.min Returns the lesser of its two arguments. , lt_min.

    Lean, line 514
      have hτ0 : (0 : ℝ) < min (1 / 2 : ℝ) (η / (6 * 65536)) := lt_min (by norm_num) (by positivity)

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 514 at 90db830f05be ↗

  4. h_x3c41 (hτ1) have min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ))) < (1 : ℝ)

    Leaves ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hτ1 : min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ))) < (1 : ℝ).

    Uses library Min.min Returns the lesser of its two arguments. , lt_of_le_of_lt, min_le_left.

    Lean, line 515
      have hτ1 : min (1 / 2 : ℝ) (η / (6 * 65536)) < 1 := lt_of_le_of_lt (min_le_left _ _) (by norm_num)

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 515 at 90db830f05be ↗

  5. h_x3c4_x3b7 (hτη) have min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ))) ≤ η / ((6 : ℝ) * (65536 : ℝ))

    Leaves ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hτη : min (1 / 2 : ℝ) (η / ((6 : ℝ) * (65536 : ℝ))) ≤ η / ((6 : ℝ) * (65536 : ℝ)).

    Uses library Min.min Returns the lesser of its two arguments. , min_le_right.

    Lean, line 516
      have hτη : min (1 / 2 : ℝ) (η / (6 * 65536)) ≤ η / (6 * 65536) := min_le_right _ _

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 516 at 90db830f05be ↗

  6. s6 obtain ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∃ (r : ℕ) (lam : ℝ), (3 : ℕ) ≤ r ∧ (1 : ℝ) ≤ lam ∧ (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ) ∧ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r) ∧ (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ∧ ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ) ∧ (2 : ℝ) * (↑r : ℝ) * lam ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ)

    Leaves ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∀ (S : Finset ℕ), (∀ m ∈ S, k < m ∧ (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧ ∃ (a : ℤ) (q : ℕ), (0 : ℕ) < q ∧ (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧ |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) → (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with c : ℝ, hc : (0 : ℝ) < c, k0 : ℕ, hP : ∀ (k : ℕ), k0 ≤ k → ∀ (n : ℕ), k * k * k ≤ n → (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) → ∃ (r : ℕ) (lam : ℝ), (3 : ℕ) ≤ r ∧ (1 : ℝ) ≤ lam ∧ (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ) ∧ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r) ∧ (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ∧ ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ) ∧ (2 : ℝ) * (↑r : ℝ) * lam ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ).

    Lean, line 518
      obtain ⟨c, hc, k0, hP⟩ := h_params τ hτ0 hτ1 (η / 2) (by positivity)

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 518 at 90db830f05be ↗

  7. s7 obtain ∃ (r : ℕ) (lam : ℝ), (3 : ℕ) ≤ r ∧ (1 : ℝ) ≤ lam ∧ (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ) ∧ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r) ∧ (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ∧ ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ) ∧ (2 : ℝ) * (↑r : ℝ) * lam ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with r : ℕ, lam : ℝ, hr3 : (3 : ℕ) ≤ r, hlam : (1 : ℝ) ≤ lam, hrk : (2 : ℝ) * (↑r : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ (↑k : ℝ), hT1 : (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ ((2 : ℕ) * r), hT2 : (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ r * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r), hT3 : ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * (↑k : ℝ), hlast : (2 : ℝ) * (↑r : ℝ) * lam ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ).

    Uses library le_trans The relation ≤ on a preorder is transitive. , le_max_left.

    Lean, line 521
      obtain ⟨r, lam, hr3, hlam, hrk, hT1, hT2, hT3, hlast⟩ := hP k (le_trans (le_max_left _ _) hk) n hn hne

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 521 at 90db830f05be ↗

  8. hk1 have (1 : ℕ) ≤ k

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hk1 : (1 : ℕ) ≤ k.

    Uses library le_trans The relation ≤ on a preorder is transitive. , le_max_right.

    Lean, line 522
      have hk1 : 1 ≤ k := le_trans (le_max_right _ _) hk

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 522 at 90db830f05be ↗

  9. hn1 have (1 : ℕ) ≤ n

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hn1 : (1 : ℕ) ≤ n.

    Uses library le_trans The relation ≤ on a preorder is transitive. , Nat.mul_pos.

    Lean, line 523
      have hn1 : 1 ≤ n := le_trans (Nat.mul_pos (Nat.mul_pos hk1 hk1) hk1) hn

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 523 at 90db830f05be ↗

  10. hr2 have (2 : ℕ) ≤ r routine: omega

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hr2 : (2 : ℕ) ≤ r.

    Lean, line 524
      have hr2 : 2 ≤ r := by omega

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 524 at 90db830f05be ↗

  11. hkR have (0 : ℝ) < (↑k : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hkR : (0 : ℝ) < (↑k : ℝ).

    Lean, line 525
      have hkR : (0 : ℝ) < (k : ℝ) := by exact_mod_cast hk1

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 525 at 90db830f05be ↗

  12. hk1R have (1 : ℝ) ≤ (↑k : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hk1R : (1 : ℝ) ≤ (↑k : ℝ).

    Lean, line 526
      have hk1R : (1 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk1

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 526 at 90db830f05be ↗

  13. hnR have (0 : ℝ) < (↑n : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hnR : (0 : ℝ) < (↑n : ℝ).

    Lean, line 527
      have hnR : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn1

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 527 at 90db830f05be ↗

  14. hH have (0 : ℝ) < (↑k : ℝ) ^ (3 / 5 : ℝ) routine: positivity

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hH : (0 : ℝ) < (↑k : ℝ) ^ (3 / 5 : ℝ).

    Lean, line 528
      have hH : (0 : ℝ) < (k : ℝ) ^ (3 / 5 : ℝ) := by positivity

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 528 at 90db830f05be ↗

  15. hW have (1 : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hW : (1 : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ).

    Uses library Real.one_le_rpow.

    Lean, line 529
      have hW : (1 : ℝ) ≤ (k : ℝ) ^ (1 / 100 : ℝ) := Real.one_le_rpow hk1R (by norm_num)

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 529 at 90db830f05be ↗

  16. h_x3b4 (hδ) have (0 : ℝ) < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) routine: positivity

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hδ : (0 : ℝ) < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ).

    Lean, line 530
      have hδ : (0 : ℝ) < (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) := by positivity

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 530 at 90db830f05be ↗

  17. hrat have ((↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ) * (↑k : ℝ) ^ (r + (1 : ℕ))

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hrat : ((↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ) * (↑k : ℝ) ^ (r + (1 : ℕ)).

    Uses library mul_pow.

    Lean, lines 531–542
      have hrat : ((k : ℝ) + (k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + 1) ≤ 2 * (k : ℝ) ^ (r + 1) := by
        have hu : 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ≤ 1 := by
          rw [show 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) = (2 * (r : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ)) / (k : ℝ) by ring,
            div_le_one hkR]
          exact hrk
        have hkr := key_ratio r hr2 ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) hδ.le hu
        have e : (k : ℝ) + (k : ℝ) ^ (3 / 5 : ℝ) = (k : ℝ) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) := by
          field_simp
        rw [e, mul_pow]
        calc (k : ℝ) ^ (r + 1) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ^ (r + 1)
            ≤ (k : ℝ) ^ (r + 1) * 2 := mul_le_mul_of_nonneg_left hkr (by positivity)
          _ = 2 * (k : ℝ) ^ (r + 1) := by ring

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 531–542 at 90db830f05be ↗

    1. hrat.hu have (2 : ℝ) * (↑r : ℝ) * ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) ≤ (1 : ℝ)

      Leaves ((↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ) * (↑k : ℝ) ^ (r + (1 : ℕ)), with hu : (2 : ℝ) * (↑r : ℝ) * ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) ≤ (1 : ℝ).

      Uses library div_le_one.

      Lean, lines 532–535
          have hu : 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ≤ 1 := by
            rw [show 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) = (2 * (r : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ)) / (k : ℝ) by ring,
              div_le_one hkR]
            exact hrk

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 532–535 at 90db830f05be ↗

    2. hrat.hkr have ((1 : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ)

      Leaves ((↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ) * (↑k : ℝ) ^ (r + (1 : ℕ)), with hkr : ((1 : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ).

      Lean, line 536
          have hkr := key_ratio r hr2 ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) hδ.le hu

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 536 at 90db830f05be ↗

    3. hrat.e have (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) = (↑k : ℝ) * ((1 : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) routine: field_simp

      Leaves ((↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + (1 : ℕ)) ≤ (2 : ℝ) * (↑k : ℝ) ^ (r + (1 : ℕ)), with e : (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) = (↑k : ℝ) * ((1 : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)).

      Lean, lines 537–538
          have e : (k : ℝ) + (k : ℝ) ^ (3 / 5 : ℝ) = (k : ℝ) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) := by
            field_simp

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 537–538 at 90db830f05be ↗

    4. hrat.s4 calc (↑k : ℝ) ^ (r + (1 : ℕ)) * ((1 : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) ^ (r + (1 : ℕ)) ≤ (↑k : ℝ) ^ (r + (1 : ℕ)) * (2 : ℝ)

      Closes the goal.

      Uses library mul_le_mul_of_nonneg_left.

      Lean, lines 540–541
          calc (k : ℝ) ^ (r + 1) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ^ (r + 1)
              ≤ (k : ℝ) ^ (r + 1) * 2 := mul_le_mul_of_nonneg_left hkr (by positivity)

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 540–541 at 90db830f05be ↗

    5. hrat.s5 calc routine: ring

      Closes the goal.

      Lean, line 542
            _ = 2 * (k : ℝ) ^ (r + 1) := by ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 542 at 90db830f05be ↗

  18. happ have (↑S.card : ℝ) < (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * (((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with happ : (↑S.card : ℝ) < (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * (((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) + (2 : ℝ) * (↑r : ℝ) * lam.

    Lean, lines 543–544
      have happ := kf_app h_thm lam ((k : ℝ) ^ (3 / 5 : ℝ)) ((k : ℝ) ^ (1 / 100 : ℝ))
        ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) hlam hH hW hδ n k r hk1 hn1 hr2 hrat S hS

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 543–544 at 90db830f05be ↗

  19. hD have (0 : ℝ) < (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) routine: positivity

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hD : (0 : ℝ) < (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)).

    Lean, line 545
      have hD : (0 : ℝ) < (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) := by positivity

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 545 at 90db830f05be ↗

  20. hlam0 have (0 : ℝ) < lam routine: linarith

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hlam0 : (0 : ℝ) < lam.

    Lean, line 546
      have hlam0 : (0 : ℝ) < lam := by linarith

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 546 at 90db830f05be ↗

  21. hY have (0 : ℝ) < (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r routine: positivity

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hY : (0 : ℝ) < (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r.

    Lean, line 547
      have hY : (0 : ℝ) < (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r := by positivity

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 547 at 90db830f05be ↗

  22. hW2 have (0 : ℝ) < ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) routine: positivity

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hW2 : (0 : ℝ) < ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ).

    Lean, line 548
      have hW2 : (0 : ℝ) < ((k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) := by positivity

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 548 at 90db830f05be ↗

  23. hB1 have ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ ≤ τ

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hB1 : ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ ≤ τ.

    Lean, lines 549–561
      have hB1 : ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) ^
          ((2 * (r : ℝ) - 1)⁻¹) ≤ τ := by
        refine kf_root _ τ _ (2 * r - 1) (by omega) ?_ (by positivity) hτ0.le ?_
        · have h12 : 1 ≤ 2 * r := by omega
          rw [Nat.cast_sub h12]
          push_cast
          ring
        · have hp : τ ^ (2 * r) = τ ^ (2 * r - 1) * τ := by
            rw [← pow_succ]
            congr 1
            omega
          rw [hp] at hT1
          exact le_of_mul_le_mul_right hT1 hτ0

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 549–561 at 90db830f05be ↗

    1. hB1.s1 case

      Leaves (2 : ℝ) * (↑r : ℝ) - (1 : ℝ) = (↑((2 : ℕ) * r - (1 : ℕ)) : ℝ).

      Uses library Nat.cast_sub.

      Lean, lines 552–555
          · have h12 : 1 ≤ 2 * r := by omega
            rw [Nat.cast_sub h12]
            push_cast
            ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 552–555 at 90db830f05be ↗

      1. hB1.s1.h12 have (1 : ℕ) ≤ (2 : ℕ) * r routine: omega

        Leaves (2 : ℝ) * (↑r : ℝ) - (1 : ℝ) = (↑((2 : ℕ) * r - (1 : ℕ)) : ℝ), with h12 : (1 : ℕ) ≤ (2 : ℕ) * r.

        Lean, line 552
            · have h12 : 1 ≤ 2 * r := by omega

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 552 at 90db830f05be ↗

    2. hB1.s2 case

      Leaves (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r - (1 : ℕ)).

      Uses library le_of_mul_le_mul_right.

      Lean, lines 556–561
          · have hp : τ ^ (2 * r) = τ ^ (2 * r - 1) * τ := by
              rw [← pow_succ]
              congr 1
              omega
            rw [hp] at hT1
            exact le_of_mul_le_mul_right hT1 hτ0

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 556–561 at 90db830f05be ↗

      1. hB1.s2.hp have τ ^ ((2 : ℕ) * r) = τ ^ ((2 : ℕ) * r - (1 : ℕ)) * τ

        Leaves (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r - (1 : ℕ)), with hp : τ ^ ((2 : ℕ) * r) = τ ^ ((2 : ℕ) * r - (1 : ℕ)) * τ.

        Uses library pow_succ.

        Lean, lines 556–559
            · have hp : τ ^ (2 * r) = τ ^ (2 * r - 1) * τ := by
                rw [← pow_succ]
                congr 1
                omega

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 556–559 at 90db830f05be ↗

  24. hB2 have ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ ≤ τ

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hB2 : ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ ≤ τ.

    Lean, lines 562–579
      have hB2 : ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
          ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r)) ^ (((r : ℝ) - 1)⁻¹) ≤ τ := by
        refine kf_root _ τ _ (r - 1) (by omega) ?_ (by positivity) hτ0.le ?_
        · have h1r : 1 ≤ r := by omega
          rw [Nat.cast_sub h1r]
          push_cast
          ring
        · rw [div_le_iff₀ hY]
          have hp : τ ^ r = τ ^ (r - 1) * τ := by
            rw [← pow_succ]
            congr 1
            omega
          rw [hp] at hT2
          have hT2' : (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ ≤
              τ ^ (r - 1) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) * τ := by
            calc _ ≤ _ := hT2
              _ = _ := by ring
          exact le_of_mul_le_mul_right hT2' hτ0

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 562–579 at 90db830f05be ↗

    1. hB2.s1 case

      Leaves (↑r : ℝ) - (1 : ℝ) = (↑(r - (1 : ℕ)) : ℝ).

      Uses library Nat.cast_sub.

      Lean, lines 565–568
          · have h1r : 1 ≤ r := by omega
            rw [Nat.cast_sub h1r]
            push_cast
            ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 565–568 at 90db830f05be ↗

      1. hB2.s1.h1r have (1 : ℕ) ≤ r routine: omega

        Leaves (↑r : ℝ) - (1 : ℝ) = (↑(r - (1 : ℕ)) : ℝ), with h1r : (1 : ℕ) ≤ r.

        Lean, line 565
            · have h1r : 1 ≤ r := by omega

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 565 at 90db830f05be ↗

    2. hB2.s2 case

      Leaves (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) ≤ τ ^ (r - (1 : ℕ)).

      Uses library div_le_iff₀ See div_le_iff₀' for a version with multiplication on the other side. , le_of_mul_le_mul_right.

      Lean, lines 569–579
          · rw [div_le_iff₀ hY]
            have hp : τ ^ r = τ ^ (r - 1) * τ := by
              rw [← pow_succ]
              congr 1
              omega
            rw [hp] at hT2
            have hT2' : (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ ≤
                τ ^ (r - 1) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) * τ := by
              calc _ ≤ _ := hT2
                _ = _ := by ring
            exact le_of_mul_le_mul_right hT2' hτ0

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 569–579 at 90db830f05be ↗

      1. hB2.s2.hp have τ ^ r = τ ^ (r - (1 : ℕ)) * τ

        Leaves (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ (r - (1 : ℕ)) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r), with hp : τ ^ r = τ ^ (r - (1 : ℕ)) * τ.

        Uses library pow_succ.

        Lean, lines 570–573
              have hp : τ ^ r = τ ^ (r - 1) * τ := by
                rw [← pow_succ]
                congr 1
                omega

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 570–573 at 90db830f05be ↗

      2. hB2.s2.hT2' have (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ (r - (1 : ℕ)) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) * τ

        Leaves (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ (r - (1 : ℕ)) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r), with hT2' : (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ (r - (1 : ℕ)) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r) * τ.

        Lean, lines 575–578
              have hT2' : (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ ≤
                  τ ^ (r - 1) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) * τ := by
                calc _ ≤ _ := hT2
                  _ = _ := by ring

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 575–578 at 90db830f05be ↗

        1. hB2.s2.hT2'.s1 calc (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ (r - (1 : ℕ)) * τ * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)
        2. hB2.s2.hT2'.s2 calc routine: ring
  25. hB3 have ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ ≤ τ

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with hB3 : ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹ ≤ τ.

    Lean, lines 580–602
      have hB3 : ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
          ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1))) ^ ((2 * (r : ℝ))⁻¹) ≤ τ := by
        refine kf_root _ τ _ (2 * r) (by omega) ?_ (by positivity) hτ0.le ?_
        · push_cast
          ring
        · rw [div_le_iff₀ hD]
          have hf : ((r + 1)! : ℝ) = ((r : ℝ) + 1) * (r ! : ℝ) := by
            rw [Nat.factorial_succ]
            push_cast
            ring
          have e : (n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 =
              (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ)) := by
            rw [hf, pow_succ (k : ℝ) (r + 1)]
            field_simp
          rw [e]
          have h3 : (((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ) ≤ τ ^ (2 * r) := by
            rw [div_le_iff₀ hkR]
            exact hT3
          calc (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ))
              ≤ (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * τ ^ (2 * r) := mul_le_mul_of_nonneg_left h3 hD.le
            _ = τ ^ (2 * r) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1)) := by ring

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 580–602 at 90db830f05be ↗

    1. hB3.s1 case

      Leaves (2 : ℝ) * (↑r : ℝ) = (↑((2 : ℕ) * r) : ℝ).

      Lean, lines 583–584
          · push_cast
            ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 583–584 at 90db830f05be ↗

    2. hB3.s2 case

      Leaves (↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ))) ≤ τ ^ ((2 : ℕ) * r).

      Uses library div_le_iff₀ See div_le_iff₀' for a version with multiplication on the other side. .

      Lean, lines 585–602
          · rw [div_le_iff₀ hD]
            have hf : ((r + 1)! : ℝ) = ((r : ℝ) + 1) * (r ! : ℝ) := by
              rw [Nat.factorial_succ]
              push_cast
              ring
            have e : (n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 =
                (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                  ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ)) := by
              rw [hf, pow_succ (k : ℝ) (r + 1)]
              field_simp
            rw [e]
            have h3 : (((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ) ≤ τ ^ (2 * r) := by
              rw [div_le_iff₀ hkR]
              exact hT3
            calc (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                  ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ))
                ≤ (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * τ ^ (2 * r) := mul_le_mul_of_nonneg_left h3 hD.le
              _ = τ ^ (2 * r) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1)) := by ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 585–602 at 90db830f05be ↗

      1. hB3.s2.hf have (↑(r + (1 : ℕ))! : ℝ) = ((↑r : ℝ) + (1 : ℝ)) * (↑r ! : ℝ)

        Leaves (↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ))), with hf : (↑(r + (1 : ℕ))! : ℝ) = ((↑r : ℝ) + (1 : ℝ)) * (↑r ! : ℝ).

        Uses library Nat.factorial_succ.

        Lean, lines 586–589
              have hf : ((r + 1)! : ℝ) = ((r : ℝ) + 1) * (r ! : ℝ) := by
                rw [Nat.factorial_succ]
                push_cast
                ring

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 586–589 at 90db830f05be ↗

      2. hB3.s2.e have (↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) = (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * (((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ))

        Leaves (↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ ((2 : ℕ) * r) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ))), with e : (↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) = (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * (((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ)).

        Uses library pow_succ.

        Lean, lines 590–594
              have e : (n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 =
                  (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                    ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ)) := by
                rw [hf, pow_succ (k : ℝ) (r + 1)]
                field_simp

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 590–594 at 90db830f05be ↗

      3. hB3.s2.h3 have ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ) ≤ τ ^ ((2 : ℕ) * r)

        Leaves (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * (((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ)) ≤ τ ^ ((2 : ℕ) * r) * ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ))), with h3 : ((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ) ≤ τ ^ ((2 : ℕ) * r).

        Uses library div_le_iff₀ See div_le_iff₀' for a version with multiplication on the other side. .

        Lean, lines 596–598
              have h3 : (((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ) ≤ τ ^ (2 * r) := by
                rw [div_le_iff₀ hkR]
                exact hT3

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 596–598 at 90db830f05be ↗

      4. hB3.s2.s4 calc (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * (((↑r : ℝ) + (1 : ℝ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / (↑k : ℝ)) ≤ (↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * τ ^ ((2 : ℕ) * r)

        Closes the goal.

        Uses library mul_le_mul_of_nonneg_left.

        Lean, lines 599–601
              calc (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
                    ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ))
                  ≤ (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * τ ^ (2 * r) := mul_le_mul_of_nonneg_left h3 hD.le

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 599–601 at 90db830f05be ↗

      5. hB3.s2.s5 calc routine: ring

        Closes the goal.

        Lean, line 602
                _ = τ ^ (2 * r) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1)) := by ring

        targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 602 at 90db830f05be ↗

  26. h6 have (65536 : ℝ) * (3 : ℝ) * τ ≤ η / (2 : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with h6 : (65536 : ℝ) * (3 : ℝ) * τ ≤ η / (2 : ℝ).

    Lean, lines 603–606
      have h6 : (65536 : ℝ) * 3 * τ ≤ η / 2 := by
        have := mul_le_mul_of_nonneg_left hτη (by norm_num : (0 : ℝ) ≤ 65536 * 3)
        calc (65536 : ℝ) * 3 * τ ≤ 65536 * 3 * (η / (6 * 65536)) := this
          _ = η / 2 := by ring

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 603–606 at 90db830f05be ↗

    1. h6.this have (65536 : ℝ) * (3 : ℝ) * τ ≤ (65536 : ℝ) * (3 : ℝ) * (η / ((6 : ℝ) * (65536 : ℝ)))

      Leaves (65536 : ℝ) * (3 : ℝ) * τ ≤ η / (2 : ℝ), with this : (65536 : ℝ) * (3 : ℝ) * τ ≤ (65536 : ℝ) * (3 : ℝ) * (η / ((6 : ℝ) * (65536 : ℝ))).

      Uses library mul_le_mul_of_nonneg_left.

      Lean, line 604
          have := mul_le_mul_of_nonneg_left hτη (by norm_num : (0 : ℝ) ≤ 65536 * 3)

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 604 at 90db830f05be ↗

    2. h6.s2 calc (65536 : ℝ) * (3 : ℝ) * τ ≤ (65536 : ℝ) * (3 : ℝ) * (η / ((6 : ℝ) * (65536 : ℝ)))

      Closes the goal.

      Lean, line 605
          calc (65536 : ℝ) * 3 * τ ≤ 65536 * 3 * (η / (6 * 65536)) := this

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 605 at 90db830f05be ↗

    3. h6.s3 calc routine: ring
  27. h7 have (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * (((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) ≤ (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * ((3 : ℝ) * τ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with h7 : (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * (((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ)) ^ ((2 : ℝ) * (↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ) * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)) * lam ^ r)) ^ ((↑r : ℝ) - (1 : ℝ))⁻¹ + ((↑n : ℝ) * (↑(r + (1 : ℕ))! : ℝ) / (↑k : ℝ) ^ (r + (2 : ℕ)) * lam * ((↑k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) / ((↑n : ℝ) * (↑r ! : ℝ) / (↑k : ℝ) ^ (r + (1 : ℕ)))) ^ ((2 : ℝ) * (↑r : ℝ))⁻¹) ≤ (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * ((3 : ℝ) * τ).

    Uses library mul_le_mul_of_nonneg_left.

    Lean, lines 607–614
      have h7 : (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) *
          (((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) ^ ((2 * (r : ℝ) - 1)⁻¹) +
           ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
              ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r)) ^ (((r : ℝ) - 1)⁻¹) +
           ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
              ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1))) ^ ((2 * (r : ℝ))⁻¹)) ≤
          (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) :=
        mul_le_mul_of_nonneg_left (by linarith) (by positivity)

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 607–614 at 90db830f05be ↗

  28. h8 have (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * ((3 : ℝ) * τ) ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ)

    Leaves (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ), with h8 : (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * ((3 : ℝ) * τ) ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ).

    Lean, lines 615–617
      have h8 : (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) ≤ η / 2 * (k : ℝ) ^ (3 / 5 : ℝ) := by
        calc (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) = (65536 * 3 * τ) * (k : ℝ) ^ (3 / 5 : ℝ) := by ring
          _ ≤ η / 2 * (k : ℝ) ^ (3 / 5 : ℝ) := mul_le_mul_of_nonneg_right h6 hH.le

    targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, lines 615–617 at 90db830f05be ↗

    1. h8.s1 calc (65536 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ) * ((3 : ℝ) * τ) = (65536 : ℝ) * (3 : ℝ) * τ * (↑k : ℝ) ^ (3 / 5 : ℝ) routine: ring

      Closes the goal.

      Lean, line 616
          calc (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) = (65536 * 3 * τ) * (k : ℝ) ^ (3 / 5 : ℝ) := by ring

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 616 at 90db830f05be ↗

    2. h8.s2 calc (65536 : ℝ) * (3 : ℝ) * τ * (↑k : ℝ) ^ (3 / 5 : ℝ) ≤ η / (2 : ℝ) * (↑k : ℝ) ^ (3 / 5 : ℝ)

      Closes the goal.

      Uses library mul_le_mul_of_nonneg_right.

      Lean, line 617
            _ ≤ η / 2 * (k : ℝ) ^ (3 / 5 : ℝ) := mul_le_mul_of_nonneg_right h6 hH.le

      targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, line 617 at 90db830f05be ↗

  29. close term (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ)
The proof in Lean (Proof.lean)

Checked by the kernel — these bytes are the ones its attestation names: attestations/001313.json, merge commit 90db830f05be.

Proof.lean — its sha256 is the artifact_hash of the attestation below, so these are the bytes the gate checked. Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Proof.lean, sha256 937a60ab88a2.
import Mathlib
import Nodes.«erdos-1094--h2--h2--h4--h3».Context
import Nodes.«erdos-1094--h2--h2--h2--h3--h1--h1».Proof

open scoped Nat

/-! Hole `h_count` 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 noncomputable def smoothDenom (k x : ℝ) : ℝ :=
  k / 2 + (x + k / 2) * Real.smoothTransition ((4 * x + 2 * k) / k)

/-- The globally smooth modification of `f(x) = (-1)^r n / (k + x)`. -/
private noncomputable def fK (n k : ℝ) (r : ℕ) (x : ℝ) : ℝ := ((-1 : ℝ) ^ r * n) / smoothDenom k x

/-
`smoothDenom k` is positive everywhere when `k > 0`.
-/
private lemma smoothDenom_pos (k : ℝ) (hk : 0 < k) (x : ℝ) : 0 < smoothDenom k x := by
  unfold smoothDenom;
  by_cases h : x + k / 2 ≥ 0 <;> simp_all +decide;
  · exact add_pos_of_pos_of_nonneg ( half_pos hk ) ( mul_nonneg h ( Real.smoothTransition.nonneg _ ) );
  · rw [ Real.smoothTransition.zero_of_nonpos ] <;> nlinarith [ mul_div_cancel₀ ( 4 * x + 2 * k ) hk.ne' ]

/-
`smoothDenom k x = k + x` for `x ≥ -k/4`.
-/
private lemma smoothDenom_eq (k : ℝ) (hk : 0 < k) (x : ℝ) (hx : -k / 4 ≤ x) :
    smoothDenom k x = k + x := by
  unfold smoothDenom; rw [ Real.smoothTransition.one_of_one_le ( by rw [ le_div_iff₀ hk ] ; linarith ) ] ; ring;

/-
`smoothDenom k` is smooth.
-/
private lemma smoothDenom_contDiff (k : ℝ) (m : ℕ∞) :
    ContDiff ℝ (m : WithTop ℕ∞) (smoothDenom k) := by
  refine' ContDiff.add contDiff_const _;
  refine' ContDiff.mul ( contDiff_id.add contDiff_const ) _;
  exact ContDiff.comp ( Real.smoothTransition.contDiff ) ( by exact ContDiff.div_const ( by exact ContDiff.add ( contDiff_const.mul contDiff_id ) contDiff_const ) _ )

/-
`fK n k r` is smooth, given `k > 0`.
-/
private lemma fK_contDiff (n k : ℝ) (hk : 0 < k) (r : ℕ) (m : ℕ∞) :
    ContDiff ℝ (m : WithTop ℕ∞) (fK n k r) := by
  exact ContDiff.div ( contDiff_const ) ( smoothDenom_contDiff k m ) fun x => ne_of_gt ( smoothDenom_pos k hk x )

/-
The iterated derivatives of `fK` on `[0, ∞)` are given by the explicit formula
for `(-1)^r n / (k + x)`.
-/
private lemma iteratedDeriv_fK (n k : ℝ) (hk : 0 < k) (r j : ℕ) (x : ℝ) (hx : 0 ≤ x) :
    iteratedDeriv j (fK n k r) x
      = ((-1 : ℝ) ^ r * n) * ((-1) ^ j * (j ! : ℝ) * (k + x) ^ (-1 - (j : ℤ))) := by
  -- Apply the equality we've shown in the neighborhood to the specific point x.
  have h_eq_at_x : iteratedDeriv j (fK n k r) x = iteratedDeriv j (fun y => (-1 : ℝ) ^ r * n / (k + y)) x := by
    apply Filter.EventuallyEq.iteratedDeriv_eq
    generalize_proofs at *; (
    filter_upwards [ lt_mem_nhds ( show x > -k / 4 by linarith ) ] with y hy using by unfold fK; rw [ smoothDenom_eq k hk y ( by linarith ) ] ;)
  generalize_proofs at *; (
  -- Apply the chain rule to compute the derivative.
  have h_chain : iteratedDeriv j (fun y => (-1 : ℝ) ^ r * n / (k + y)) x = (-1 : ℝ) ^ r * n * iteratedDeriv j (fun y => 1 / (k + y)) x := by
    convert iteratedDeriv_const_mul ( ( -1 ) ^ r * n ) _ using 1 ; norm_num [ div_eq_mul_inv ];
    have hc : ContDiffAt ℝ (↑j) (fun y : ℝ => k + y) x := contDiffAt_const.add contDiffAt_id
    have h2 := hc.inv (by show k + x ≠ 0; intro h; linarith)
    have e : (fun y : ℝ => 1 / (k + y)) = (fun y => k + y)⁻¹ := by
      funext y; simp [one_div]
    rw [e]; exact h2
  generalize_proofs at *; (
  convert h_eq_at_x.trans h_chain using 1
  generalize_proofs at *; (
  -- By definition of $fK$, we know that its $j$-th derivative is given by the formula.
  have h_deriv : iteratedDeriv j (fun y => 1 / (k + y)) x = (-1 : ℝ) ^ j * (Nat.factorial j) * (k + x) ^ (-1 - j : ℤ) := by
    have hs : IsOpen {y : ℝ | (0:ℝ) < y} := isOpen_lt continuous_const continuous_id
    have hmem : k + x ∈ {y : ℝ | (0:ℝ) < y} := by simp; linarith
    have heq := iteratedDerivWithin_of_isOpen (n := j) (f := fun y : ℝ => 1/y) hs hmem
    rw [show (fun y : ℝ => 1 / (k + y)) = (fun z : ℝ => (fun y : ℝ => 1/y) (k + z)) from rfl,
        iteratedDeriv_comp_const_add]
    simp only []
    rw [← heq]
    exact iteratedDerivWithin_one_div j hs hmem
  generalize_proofs at *; (
  grind +splitIndPred))))

/-
Absolute value of the `r`-th derivative of `fK` on `[0, ∞)`.
-/
private lemma abs_iteratedDeriv_r (n k : ℝ) (hk : 0 < k) (hn : 0 < n) (r : ℕ) (x : ℝ)
    (hx : 0 ≤ x) :
    |iteratedDeriv r (fK n k r) x| = (n * (r ! : ℝ)) / (k + x) ^ (r + 1) := by
  rw [ iteratedDeriv_fK n k hk r r x hx ] ; norm_num [ abs_mul, abs_div, abs_pow, abs_of_pos hn, abs_of_pos ( add_pos_of_pos_of_nonneg hk hx ) ] ; ring_nf;
  rw [ show ( -1 - r : ℤ ) = - ( r + 1 ) by ring, zpow_neg ] ; norm_cast ; ring;

/-
Absolute value of the `(r+1)`-th derivative of `fK` on `[0, ∞)`.
-/
private lemma abs_iteratedDeriv_r1 (n k : ℝ) (hk : 0 < k) (hn : 0 < n) (r : ℕ) (x : ℝ)
    (hx : 0 ≤ x) :
    |iteratedDeriv (r + 1) (fK n k r) x| = (n * ((r + 1)! : ℝ)) / (k + x) ^ (r + 2) := by
  convert abs_iteratedDeriv_r n k hk hn ( r + 1 ) x hx using 1;
  unfold fK;
  norm_num [ pow_succ', div_eq_mul_inv ]

/-
The key ratio inequality: `(1 + u)^{r+1} ≤ 2` when `2 r u ≤ 1`.
-/
private lemma key_ratio (r : ℕ) (hr : 2 ≤ r) (u : ℝ) (hu : 0 ≤ u) (hru : 2 * (r : ℝ) * u ≤ 1) :
    (1 + u) ^ (r + 1) ≤ 2 := by
  -- For r ≥ 3, we have u ≤ 1/(2*r) ≤ 1/6, and (1+u)^4 ≤ 2.
  by_cases hr_ge_3 : r ≥ 3;
  · -- Using the exponential bound, we have $(1 + u)^{r+1} \leq \exp(u(r+1))$.
    have h_exp_bound : (1 + u) ^ (r + 1) ≤ Real.exp (u * (r + 1)) := by
      rw [ ← Real.rpow_natCast, Real.rpow_def_of_pos ( by positivity ) ];
      exact Real.exp_le_exp.mpr ( by push_cast; nlinarith [ Real.log_le_sub_one_of_pos ( by linarith : 0 < 1 + u ) ] );
    refine le_trans h_exp_bound ?_;
    rw [ ← Real.log_le_log_iff ( by positivity ) ( by positivity ), Real.log_exp ];
    exact le_trans ( by nlinarith [ show ( r : ℝ ) ≥ 3 by norm_cast ] ) ( Real.log_two_gt_d9.le );
  · interval_cases r ; norm_num at * ; nlinarith [ sq_nonneg u ]

private theorem kf_app
    (hK : ∀ (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) : ℕ∞) 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)
    (lam H W δ : ℝ) (hlam : 1 ≤ lam) (hH : 0 < H) (hW : 1 ≤ W) (hδ : 0 < δ)
    (n k r : ℕ) (hk : 1 ≤ k) (hn : 1 ≤ n) (hr2 : 2 ≤ r)
    (hrat : ((k : ℝ) + H) ^ (r + 1) ≤ 2 * (k : ℝ) ^ (r + 1))
    (S : Finset ℕ)
    (hS : ∀ m ∈ S, k < m ∧ (m : ℝ) ≤ (k : ℝ) + H ∧
      ∃ (a : ℤ) (q : ℕ), 0 < q ∧ (q : ℝ) ≤ W ∧ |(n : ℝ) / (m : ℝ) - (a : ℝ) / (q : ℝ)| < δ) :
    (S.card : ℝ) < (65536 : ℝ) * H *
      (((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * W ^ 2) ^ ((2 * (r : ℝ) - 1)⁻¹) +
       (δ * W ^ 2 / ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r)) ^ (((r : ℝ) - 1)⁻¹) +
       ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * W ^ 2 /
          ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1))) ^ ((2 * (r : ℝ))⁻¹)) +
      2 * (r : ℝ) * lam := by
  have hkR : (0 : ℝ) < (k : ℝ) := by exact_mod_cast hk
  have hnR : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn
  have hcard : (S.image (fun m : ℕ => (m : ℤ) - (k : ℤ))).card = S.card := by
    apply Finset.card_image_of_injective
    intro a b hab
    have hab' : (a : ℤ) - (k : ℤ) = (b : ℤ) - (k : ℤ) := hab
    omega
  have h1 : ∀ x ∈ Set.Icc (0 : ℝ) H, (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) / 2 ≤
      |iteratedDeriv r (fK (n : ℝ) (k : ℝ) r) x| := by
    intro x hx
    rw [abs_iteratedDeriv_r (n : ℝ) (k : ℝ) hkR hnR r x hx.1]
    have hx' : ((k : ℝ) + x) ^ (r + 1) ≤ 2 * (k : ℝ) ^ (r + 1) :=
      le_trans (pow_le_pow_left₀ (by linarith [hx.1]) (by linarith [hx.2]) _) hrat
    have hpos : (0 : ℝ) < ((k : ℝ) + x) ^ (r + 1) := pow_pos (by linarith [hx.1]) _
    calc (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) / 2
        = (n : ℝ) * (r ! : ℝ) / (2 * (k : ℝ) ^ (r + 1)) := by ring
      _ ≤ (n : ℝ) * (r ! : ℝ) / ((k : ℝ) + x) ^ (r + 1) :=
          div_le_div_of_nonneg_left (by positivity) hpos hx'
  have h2 : ∀ x ∈ Set.Icc (0 : ℝ) H, |iteratedDeriv r (fK (n : ℝ) (k : ℝ) r) x| ≤
      (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) := by
    intro x hx
    rw [abs_iteratedDeriv_r (n : ℝ) (k : ℝ) hkR hnR r x hx.1]
    exact div_le_div_of_nonneg_left (by positivity) (by positivity)
      (pow_le_pow_left₀ hkR.le (by linarith [hx.1]) _)
  have h3 : ∀ x ∈ Set.Icc (0 : ℝ) H, |iteratedDeriv (r + 1) (fK (n : ℝ) (k : ℝ) r) x| ≤
      (n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) := by
    intro x hx
    rw [abs_iteratedDeriv_r1 (n : ℝ) (k : ℝ) hkR hnR r x hx.1]
    exact div_le_div_of_nonneg_left (by positivity) (by positivity)
      (pow_le_pow_left₀ hkR.le (by linarith [hx.1]) _)
  have h4 : ∀ u ∈ S.image (fun m : ℕ => (m : ℤ) - (k : ℤ)), (0 : ℤ) ≤ u ∧ u ≤ ⌊H⌋ := by
    intro u hu
    obtain ⟨m, hm, rfl⟩ := Finset.mem_image.1 hu
    obtain ⟨hkm, hmH, -⟩ := hS m hm
    refine ⟨by omega, Int.le_floor.2 ?_⟩
    push_cast
    linarith
  have h5 : ∀ u ∈ S.image (fun m : ℕ => (m : ℤ) - (k : ℤ)), ∃ (v : ℤ) (w : ℕ), 0 < w ∧ (w : ℝ) ≤ W ∧
      |fK (n : ℝ) (k : ℝ) r (u : ℝ) - (v : ℝ) / (w : ℝ)| < δ := by
    intro u hu
    obtain ⟨m, hm, rfl⟩ := Finset.mem_image.1 hu
    obtain ⟨hkm, hmH, a, q, hq, hqW, hd⟩ := hS m hm
    have hkmR : (k : ℝ) < (m : ℝ) := by exact_mod_cast hkm
    refine ⟨(-1) ^ r * a, q, hq, hqW, ?_⟩
    have hu0 : (((m : ℤ) - (k : ℤ) : ℤ) : ℝ) = (m : ℝ) - (k : ℝ) := by push_cast; ring
    have e : fK (n : ℝ) (k : ℝ) r ((m : ℝ) - (k : ℝ)) = (-1 : ℝ) ^ r * (n : ℝ) / (m : ℝ) := by
      unfold fK
      rw [smoothDenom_eq (k : ℝ) hkR _ (by linarith)]
      congr 1
      ring
    rw [hu0, e]
    have e2 : (-1 : ℝ) ^ r * (n : ℝ) / (m : ℝ) - (((-1) ^ r * a : ℤ) : ℝ) / (q : ℝ) =
        (-1 : ℝ) ^ r * ((n : ℝ) / (m : ℝ) - (a : ℝ) / (q : ℝ)) := by
      push_cast
      ring
    rw [e2, abs_mul, abs_pow, abs_neg, abs_one, one_pow, one_mul]
    exact hd
  have hh := hK r hr2 H hH W hW δ hδ lam hlam ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1)) (by positivity)
    ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2)) (by positivity) (fK (n : ℝ) (k : ℝ) r)
    (fK_contDiff _ _ hkR _ _) h1 h2 h3 (S.image (fun m : ℕ => (m : ℤ) - (k : ℤ))) h4 h5
  rw [hcard] at hh
  exact hh

private lemma kf_root (x τ e : ℝ) (m : ℕ) (hm : 0 < m) (he : e = (m : ℝ)) (hx : 0 ≤ x) (hτ : 0 ≤ τ)
    (h : x ≤ τ ^ m) : x ^ (e⁻¹) ≤ τ := by
  subst he
  calc x ^ ((m : ℝ)⁻¹) ≤ (τ ^ m) ^ ((m : ℝ)⁻¹) :=
        Real.rpow_le_rpow hx h (inv_nonneg.2 (Nat.cast_nonneg m))
    _ = τ := Real.pow_rpow_inv_natCast hτ hm.ne'

private lemma kf_conds (x τ η : ℝ) (R r : ℕ) (lam Y : ℝ) (hx : 1 ≤ x) (hτ0 : 0 < τ) (hτ1 : τ < 1)
    (hη : 0 < η) (hrR : r ≤ R) (hlam1 : 1 ≤ lam) (hlam3 : lam ^ 3 ≤ x)
    (hE1 : 2 * ((R : ℝ) + 1) ≤ x ^ (1 / 4 : ℝ)) (hE2 : 2 * ((R : ℝ) + 1) ≤ η * x ^ (1 / 4 : ℝ))
    (hτR : x ^ (-(1 / 100) : ℝ) ≤ τ ^ R)
    (hY : Y * (x ^ (1 / 100 : ℝ)) ^ 2 * τ = τ ^ (2 * r)) :
    2 * (r : ℝ) * x ^ (3 / 5 : ℝ) ≤ x ∧
    x ^ (3 / 5 : ℝ) / x * (x ^ (1 / 100 : ℝ)) ^ 2 * τ ≤ τ ^ r * Y ∧
    ((r : ℝ) + 1) * lam * (x ^ (1 / 100 : ℝ)) ^ 2 ≤ τ ^ (2 * r) * x ∧
    2 * (r : ℝ) * lam ≤ η * x ^ (3 / 5 : ℝ) := by
  have hx0 : 0 < x := by linarith
  have hrR' : (r : ℝ) ≤ (R : ℝ) := by exact_mod_cast hrR
  have hr0 : (0 : ℝ) ≤ r := Nat.cast_nonneg r
  have hlam0 : (0 : ℝ) ≤ lam := by linarith
  have hpw : ∀ a b : ℝ, a ≤ b → x ^ a ≤ x ^ b := fun a b h => Real.rpow_le_rpow_of_exponent_le hx h
  have hadd : ∀ a b : ℝ, x ^ a * x ^ b = x ^ (a + b) := fun a b => (Real.rpow_add hx0 a b).symm
  have hW2 : (x ^ (1 / 100 : ℝ)) ^ 2 = x ^ (1 / 50 : ℝ) := by
    rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
  have hx3 : (x ^ (1 / 3 : ℝ)) ^ 3 = x := by
    rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
  have hlam : lam ≤ x ^ (1 / 3 : ℝ) := by
    by_contra h
    rw [not_le] at h
    have h3 := pow_lt_pow_left₀ h (by positivity) (by norm_num : (3 : ℕ) ≠ 0)
    linarith
  have hτ2 : x ^ (-(1 / 50) : ℝ) ≤ τ ^ (2 * r) :=
    calc x ^ (-(1 / 50) : ℝ) = (x ^ (-(1 / 100) : ℝ)) ^ 2 := by
          rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
      _ ≤ (τ ^ R) ^ 2 := pow_le_pow_left₀ (by positivity) hτR 2
      _ = τ ^ (2 * R) := by rw [← pow_mul, mul_comm]
      _ ≤ τ ^ (2 * r) := pow_le_pow_of_le_one hτ0.le hτ1.le (by omega)
  have hτ3 : x ^ (-(3 / 100) : ℝ) ≤ τ ^ (3 * r) :=
    calc x ^ (-(3 / 100) : ℝ) = (x ^ (-(1 / 100) : ℝ)) ^ 3 := by
          rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
      _ ≤ (τ ^ R) ^ 3 := pow_le_pow_left₀ (by positivity) hτR 3
      _ = τ ^ (3 * R) := by rw [← pow_mul, mul_comm]
      _ ≤ τ ^ (3 * r) := pow_le_pow_of_le_one hτ0.le hτ1.le (by omega)
  have hr14 : 2 * (r : ℝ) ≤ x ^ (1 / 4 : ℝ) := by linarith
  have hr14' : (r : ℝ) + 1 ≤ x ^ (1 / 4 : ℝ) := by linarith
  refine ⟨?_, ?_, ?_, ?_⟩
  · calc 2 * (r : ℝ) * x ^ (3 / 5 : ℝ) ≤ x ^ (1 / 4 : ℝ) * x ^ (3 / 5 : ℝ) :=
          mul_le_mul_of_nonneg_right hr14 (by positivity)
      _ = x ^ ((1 / 4 : ℝ) + (3 / 5 : ℝ)) := hadd _ _
      _ ≤ x ^ (1 : ℝ) := hpw _ _ (by norm_num)
      _ = x := Real.rpow_one x
  · have hδ : x ^ (3 / 5 : ℝ) / x = x ^ (-(2 / 5) : ℝ) := by
      rw [show (-(2 / 5) : ℝ) = 3 / 5 - 1 by norm_num, Real.rpow_sub hx0, Real.rpow_one]
    have key : (x ^ (3 / 5 : ℝ) / x * (x ^ (1 / 100 : ℝ)) ^ 2 * τ) * ((x ^ (1 / 100 : ℝ)) ^ 2 * τ) ≤
        (τ ^ r * Y) * ((x ^ (1 / 100 : ℝ)) ^ 2 * τ) := by
      have e1 : (τ ^ r * Y) * ((x ^ (1 / 100 : ℝ)) ^ 2 * τ) = τ ^ (3 * r) := by
        rw [show τ ^ r * Y * ((x ^ (1 / 100 : ℝ)) ^ 2 * τ) = τ ^ r * (Y * (x ^ (1 / 100 : ℝ)) ^ 2 * τ) by ring,
          hY, ← pow_add]
        congr 1
        omega
      rw [e1, hδ, hW2]
      have e2 : x ^ (-(2 / 5) : ℝ) * x ^ (1 / 50 : ℝ) * τ * (x ^ (1 / 50 : ℝ) * τ) =
          x ^ (-(9 / 25) : ℝ) * τ ^ 2 := by
        rw [show (-(9 / 25) : ℝ) = -(2 / 5) + 1 / 50 + 1 / 50 by norm_num, Real.rpow_add hx0,
          Real.rpow_add hx0]
        ring
      rw [e2]
      calc x ^ (-(9 / 25) : ℝ) * τ ^ 2 ≤ x ^ (-(3 / 100) : ℝ) * 1 :=
            mul_le_mul (hpw _ _ (by norm_num)) (pow_le_one₀ hτ0.le hτ1.le) (by positivity) (by positivity)
        _ = x ^ (-(3 / 100) : ℝ) := mul_one _
        _ ≤ τ ^ (3 * r) := hτ3
    exact le_of_mul_le_mul_right key (by positivity)
  · calc ((r : ℝ) + 1) * lam * (x ^ (1 / 100 : ℝ)) ^ 2
        ≤ x ^ (1 / 4 : ℝ) * x ^ (1 / 3 : ℝ) * x ^ (1 / 50 : ℝ) := by
          rw [hW2]
          exact mul_le_mul (mul_le_mul hr14' hlam hlam0 (by positivity)) le_rfl (by positivity) (by positivity)
      _ = x ^ ((1 / 4 : ℝ) + 1 / 3 + 1 / 50) := by rw [hadd, hadd]
      _ ≤ x ^ (-(1 / 50) + 1 : ℝ) := hpw _ _ (by norm_num)
      _ = x ^ (-(1 / 50) : ℝ) * x := by rw [Real.rpow_add hx0, Real.rpow_one]
      _ ≤ τ ^ (2 * r) * x := mul_le_mul_of_nonneg_right hτ2 hx0.le
  · have hR0 : (0 : ℝ) ≤ 2 * ((R : ℝ) + 1) := by positivity
    calc 2 * (r : ℝ) * lam ≤ (η * x ^ (1 / 4 : ℝ)) * x ^ (1 / 3 : ℝ) :=
          mul_le_mul (by linarith) hlam hlam0 (le_trans hR0 hE2)
      _ = η * x ^ ((1 / 4 : ℝ) + 1 / 3) := by rw [mul_assoc, hadd]
      _ ≤ η * x ^ (3 / 5 : ℝ) := mul_le_mul_of_nonneg_left (hpw _ _ (by norm_num)) hη.le

private lemma kf_choose (τ W2 : ℝ) (k n R : ℕ) (hτ0 : 0 < τ) (hτ1 : τ < 1) (hW : 1 ≤ W2)
    (hk : 1 ≤ k) (hkτ : 1 < (k : ℝ) ^ 2 * τ) (hn : k * k * k ≤ n)
    (hPR : (n : ℝ) * (R ! : ℝ) * W2 * τ ≤ τ ^ (2 * R) * (k : ℝ) ^ (R + 1)) :
    ∃ (r : ℕ) (lam : ℝ), 3 ≤ r ∧ r ≤ R ∧ 1 ≤ lam ∧ lam ^ 3 ≤ (k : ℝ) ∧
      (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * W2 * τ = τ ^ (2 * r) := by
  classical
  have hkR : (0 : ℝ) < (k : ℝ) := by exact_mod_cast hk
  have hk1R : (1 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk
  have hnR : (k : ℝ) ^ 3 ≤ (n : ℝ) := by
    have h : ((k * k * k : ℕ) : ℝ) ≤ (n : ℝ) := by exact_mod_cast hn
    push_cast at h
    calc (k : ℝ) ^ 3 = (k : ℝ) * k * k := by ring
      _ ≤ (n : ℝ) := h
  have hn0 : (0 : ℝ) < (n : ℝ) := lt_of_lt_of_le (by positivity) hnR
  have hW0 : (0 : ℝ) < W2 := by linarith
  have hbase : (k : ℝ) ^ 3 * τ ≤ (n : ℝ) * W2 * τ := by
    have h := mul_le_mul_of_nonneg_right (mul_le_mul hnR hW zero_le_one hn0.le) hτ0.le
    simpa using h
  have hex : ∃ r : ℕ, (n : ℝ) * (r ! : ℝ) * W2 * τ ≤ τ ^ (2 * r) * (k : ℝ) ^ (r + 1) := ⟨R, hPR⟩
  have hrP := Nat.find_spec hex
  have hrR : Nat.find hex ≤ R := Nat.find_min' hex hPR
  have hmin : ∀ m, m < Nat.find hex →
      ¬ ((n : ℝ) * (m ! : ℝ) * W2 * τ ≤ τ ^ (2 * m) * (k : ℝ) ^ (m + 1)) :=
    fun m hm => Nat.find_min hex hm
  generalize Nat.find hex = r at hrP hrR hmin
  have h3 : 3 ≤ r := by
    by_contra h
    have hr' : r = 0 ∨ r = 1 ∨ r = 2 := by omega
    rcases hr' with rfl | rfl | rfl
    · norm_num [Nat.factorial] at hrP
      nlinarith [mul_pos hkR (sub_pos.2 hkτ)]
    · norm_num [Nat.factorial] at hrP
      nlinarith [mul_pos (mul_pos hτ0 (pow_pos hkR 2)) (by linarith : (0 : ℝ) < (k : ℝ) - τ)]
    · norm_num [Nat.factorial] at hrP
      have t4 : τ ^ 4 ≤ τ := by
        calc τ ^ 4 ≤ τ ^ 1 := pow_le_pow_of_le_one hτ0.le hτ1.le (by norm_num)
          _ = τ := pow_one τ
      nlinarith [mul_le_mul_of_nonneg_right t4 (pow_pos hkR 3).le, mul_pos hτ0 (pow_pos hkR 3)]
  have hm := hmin (r - 1) (by omega)
  rw [not_le] at hm
  have hrr : r - 1 + 1 = r := by omega
  rw [hrr] at hm
  have hfact : (r ! : ℝ) = (r : ℝ) * ((r - 1)! : ℝ) := by
    have h := Nat.mul_factorial_pred (show r ≠ 0 by omega)
    exact_mod_cast h.symm
  have hden : (0 : ℝ) < (n : ℝ) * (r ! : ℝ) * W2 * τ := by positivity
  obtain ⟨Q, hQdef⟩ : ∃ Q : ℝ, Q = τ ^ (2 * r) * (k : ℝ) ^ (r + 1) / ((n : ℝ) * (r ! : ℝ) * W2 * τ) :=
    ⟨_, rfl⟩
  have hQ1 : 1 ≤ Q := by
    rw [hQdef, one_le_div hden]
    exact hrP
  have hQk : Q ≤ (k : ℝ) := by
    rw [hQdef, div_le_iff₀ hden]
    have e1 : τ ^ (2 * r) ≤ τ ^ (2 * (r - 1)) := pow_le_pow_of_le_one hτ0.le hτ1.le (by omega)
    have hr1 : (1 : ℝ) ≤ (r : ℝ) := by exact_mod_cast (by omega : 1 ≤ r)
    have hp : (0 : ℝ) ≤ (n : ℝ) * ((r - 1)! : ℝ) * W2 * τ := by positivity
    calc τ ^ (2 * r) * (k : ℝ) ^ (r + 1) ≤ τ ^ (2 * (r - 1)) * (k : ℝ) ^ (r + 1) :=
          mul_le_mul_of_nonneg_right e1 (by positivity)
      _ = (k : ℝ) * (τ ^ (2 * (r - 1)) * (k : ℝ) ^ r) := by ring
      _ ≤ (k : ℝ) * ((n : ℝ) * ((r - 1)! : ℝ) * W2 * τ) := mul_le_mul_of_nonneg_left hm.le hkR.le
      _ ≤ (k : ℝ) * ((n : ℝ) * (r ! : ℝ) * W2 * τ) := by
          apply mul_le_mul_of_nonneg_left _ hkR.le
          rw [hfact]
          nlinarith
  have hr0 : r ≠ 0 := by omega
  have hQ0 : 0 ≤ Q := by linarith
  have hl1 : 1 ≤ Q ^ ((r : ℝ)⁻¹) := Real.one_le_rpow hQ1 (by positivity)
  have hpow : (Q ^ ((r : ℝ)⁻¹)) ^ r = Q := Real.rpow_inv_natCast_pow hQ0 hr0
  refine ⟨r, Q ^ ((r : ℝ)⁻¹), h3, hrR, hl1, ?_, ?_⟩
  · calc (Q ^ ((r : ℝ)⁻¹)) ^ 3 ≤ (Q ^ ((r : ℝ)⁻¹)) ^ r := pow_le_pow_right₀ hl1 h3
      _ = Q := hpow
      _ ≤ (k : ℝ) := hQk
  · rw [hpow, hQdef]
    field_simp

private lemma kf_PR (τ c : ℝ) (k n R : ℕ) (hτ0 : 0 < τ) (hτ1 : τ < 1) (hk : 1 ≤ k)
    (hR14 : (R : ℝ) ≤ (k : ℝ) ^ (1 / 4 : ℝ)) (hτR : (k : ℝ) ^ (-(1 / 100) : ℝ) ≤ τ ^ R)
    (hcR : c * Real.log (k : ℝ) ≤ ((R : ℝ) + 1) / 2)
    (hne : (n : ℝ) ≤ Real.exp (c * Real.log (k : ℝ) ^ 2)) :
    (n : ℝ) * (R ! : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ ≤ τ ^ (2 * R) * (k : ℝ) ^ (R + 1) := by
  have hx0 : (0 : ℝ) < (k : ℝ) := by exact_mod_cast hk
  have hx1 : (1 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk
  have hR0 : (0 : ℝ) ≤ (R : ℝ) := Nat.cast_nonneg R
  have hW2 : ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 = (k : ℝ) ^ (1 / 50 : ℝ) := by
    rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
  have h1 : (n : ℝ) ≤ (k : ℝ) ^ (c * Real.log (k : ℝ)) := by
    rw [Real.rpow_def_of_pos hx0]
    have e : Real.log (k : ℝ) * (c * Real.log (k : ℝ)) = c * Real.log (k : ℝ) ^ 2 := by ring
    rw [e]
    exact hne
  have h2 : (R ! : ℝ) ≤ (k : ℝ) ^ ((1 / 4 : ℝ) * (R : ℝ)) := by
    calc (R ! : ℝ) ≤ (R : ℝ) ^ R := by exact_mod_cast Nat.factorial_le_pow R
      _ ≤ ((k : ℝ) ^ (1 / 4 : ℝ)) ^ R := pow_le_pow_left₀ hR0 hR14 R
      _ = (k : ℝ) ^ ((1 / 4 : ℝ) * (R : ℝ)) := by rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]
  have h3 : (k : ℝ) ^ (-(1 / 50) : ℝ) ≤ τ ^ (2 * R) :=
    calc (k : ℝ) ^ (-(1 / 50) : ℝ) = ((k : ℝ) ^ (-(1 / 100) : ℝ)) ^ 2 := by
          rw [← Real.rpow_natCast, ← Real.rpow_mul hx0.le]; norm_num
      _ ≤ (τ ^ R) ^ 2 := pow_le_pow_left₀ (by positivity) hτR 2
      _ = τ ^ (2 * R) := by rw [← pow_mul, mul_comm]
  have h4 : (k : ℝ) ^ (R + 1) = (k : ℝ) ^ ((R : ℝ) + 1) := by
    exact_mod_cast (Real.rpow_natCast (k : ℝ) (R + 1)).symm
  calc (n : ℝ) * (R ! : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ
      ≤ (k : ℝ) ^ (c * Real.log (k : ℝ)) * (k : ℝ) ^ ((1 / 4 : ℝ) * (R : ℝ)) * (k : ℝ) ^ (1 / 50 : ℝ) * 1 := by
        rw [hW2]
        exact mul_le_mul (mul_le_mul (mul_le_mul h1 h2 (by positivity) (by positivity)) le_rfl
          (by positivity) (by positivity)) hτ1.le hτ0.le (by positivity)
    _ = (k : ℝ) ^ (c * Real.log (k : ℝ) + (1 / 4 : ℝ) * (R : ℝ) + 1 / 50) := by
        rw [mul_one, ← Real.rpow_add hx0, ← Real.rpow_add hx0]
    _ ≤ (k : ℝ) ^ (-(1 / 50) + ((R : ℝ) + 1)) :=
        Real.rpow_le_rpow_of_exponent_le hx1 (by linarith)
    _ = (k : ℝ) ^ (-(1 / 50) : ℝ) * (k : ℝ) ^ (R + 1) := by rw [Real.rpow_add hx0, h4]
    _ ≤ τ ^ (2 * R) * (k : ℝ) ^ (R + 1) := mul_le_mul_of_nonneg_right h3 (by positivity)

private lemma kf_event (τ ρ μ : ℝ) (hτ0 : 0 < τ) (hρ : 0 < ρ) (hμ : 0 < μ) :
    ∃ k₀ : ℕ, ∀ k : ℕ, k₀ ≤ k → 2 ≤ k ∧ 1 < (k : ℝ) ^ 2 * τ ∧
      2 * (ρ * Real.log (k : ℝ) + 1) ≤ μ * (k : ℝ) ^ (1 / 4 : ℝ) := by
  have hlog : ∀ᶠ x : ℝ in Filter.atTop, ‖Real.log x‖ ≤ (μ / (4 * ρ)) * ‖x ^ (1 / 4 : ℝ)‖ :=
    (isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 4)).bound (by positivity)
  have hpw : ∀ᶠ x : ℝ in Filter.atTop, 4 / μ ≤ x ^ (1 / 4 : ℝ) :=
    (tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 4)).eventually_ge_atTop _
  have hsq : ∀ᶠ x : ℝ in Filter.atTop, 1 / τ + 2 ≤ x := Filter.eventually_ge_atTop _
  obtain ⟨X, hX⟩ := Filter.eventually_atTop.1 (hlog.and (hpw.and hsq))
  refine ⟨⌈X⌉₊ + 2, fun k hk => ?_⟩
  have hkX : X ≤ (k : ℝ) :=
    le_trans (Nat.le_ceil X) (by exact_mod_cast (by omega : ⌈X⌉₊ ≤ k))
  obtain ⟨h1, h2, h3⟩ := hX (k : ℝ) hkX
  have hk2 : 2 ≤ k := by omega
  have hkR : (2 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk2
  refine ⟨hk2, ?_, ?_⟩
  · have h : 1 / τ < (k : ℝ) := by linarith
    rw [div_lt_iff₀ hτ0] at h
    have h' := mul_lt_mul_of_pos_left h (by linarith : (0 : ℝ) < (k : ℝ))
    nlinarith [h']
  · rw [Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (Real.log_nonneg (by linarith)),
      abs_of_nonneg (by positivity)] at h1
    have a : ρ * Real.log (k : ℝ) ≤ μ / 4 * (k : ℝ) ^ (1 / 4 : ℝ) := by
      have h := mul_le_mul_of_nonneg_left h1 hρ.le
      calc ρ * Real.log (k : ℝ) ≤ ρ * (μ / (4 * ρ) * (k : ℝ) ^ (1 / 4 : ℝ)) := h
        _ = μ / 4 * (k : ℝ) ^ (1 / 4 : ℝ) := by field_simp
    have b : (1 : ℝ) ≤ μ / 4 * (k : ℝ) ^ (1 / 4 : ℝ) := by
      have h := mul_le_mul_of_nonneg_left h2 (by positivity : (0 : ℝ) ≤ μ / 4)
      calc (1 : ℝ) = μ / 4 * (4 / μ) := by field_simp
        _ ≤ μ / 4 * (k : ℝ) ^ (1 / 4 : ℝ) := h
    linarith

private lemma kf_params : ∀ (τ : ℝ), (0 : ℝ) < τ → τ < (1 : ℝ) → ∀ (η : ℝ), (0 : ℝ) < η →
    ∃ (c : ℝ), (0 : ℝ) < c ∧ ∃ (k₀ : ℕ), ∀ (k : ℕ), k₀ ≤ k → ∀ (n : ℕ), k * k * k ≤ n →
      (n : ℝ) ≤ Real.exp (c * Real.log (k : ℝ) ^ (2 : ℕ)) →
      ∃ (r : ℕ) (lam : ℝ), 3 ≤ r ∧ (1 : ℝ) ≤ lam ∧
        (2 : ℝ) * (r : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) ≤ (k : ℝ) ∧
        (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤ τ ^ (2 * r) ∧
        (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) * τ ≤
          τ ^ r * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) ∧
        ((r : ℝ) + (1 : ℝ)) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) ≤ τ ^ (2 * r) * (k : ℝ) ∧
        (2 : ℝ) * (r : ℝ) * lam ≤ η * (k : ℝ) ^ (3 / 5 : ℝ) := by
  intro τ hτ0 hτ1 η hη
  have hℓ : 0 < -Real.log τ := by linarith [Real.log_neg hτ0 hτ1]
  obtain ⟨ρ, hρdef⟩ : ∃ ρ : ℝ, ρ = 1 / (100 * (-Real.log τ)) := ⟨_, rfl⟩
  have hρ : 0 < ρ := by rw [hρdef]; positivity
  obtain ⟨k0, hk0⟩ := kf_event τ ρ (min η 1) hτ0 hρ (lt_min hη one_pos)
  refine ⟨ρ / 2, by positivity, k0, ?_⟩
  intro k hk n hn hne
  obtain ⟨hk2, hkτ, hE⟩ := hk0 k hk
  have hk1 : 1 ≤ k := by omega
  have hx1 : (1 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk1
  have hx0 : (0 : ℝ) < (k : ℝ) := by linarith
  have hL : 0 ≤ Real.log (k : ℝ) := Real.log_nonneg hx1
  have hq : 0 ≤ (k : ℝ) ^ (1 / 4 : ℝ) := by positivity
  have hRle : ((⌊ρ * Real.log (k : ℝ)⌋₊ : ℕ) : ℝ) ≤ ρ * Real.log (k : ℝ) := Nat.floor_le (by positivity)
  have hRlt : ρ * Real.log (k : ℝ) < ((⌊ρ * Real.log (k : ℝ)⌋₊ : ℕ) : ℝ) + 1 := Nat.lt_floor_add_one _
  generalize ⌊ρ * Real.log (k : ℝ)⌋₊ = R at hRle hRlt
  have hR0 : (0 : ℝ) ≤ (R : ℝ) := Nat.cast_nonneg R
  have hE1 : 2 * ((R : ℝ) + 1) ≤ (k : ℝ) ^ (1 / 4 : ℝ) := by
    have h : min η 1 * (k : ℝ) ^ (1 / 4 : ℝ) ≤ 1 * (k : ℝ) ^ (1 / 4 : ℝ) :=
      mul_le_mul_of_nonneg_right (min_le_right _ _) hq
    linarith
  have hE2 : 2 * ((R : ℝ) + 1) ≤ η * (k : ℝ) ^ (1 / 4 : ℝ) := by
    have h : min η 1 * (k : ℝ) ^ (1 / 4 : ℝ) ≤ η * (k : ℝ) ^ (1 / 4 : ℝ) :=
      mul_le_mul_of_nonneg_right (min_le_left _ _) hq
    linarith
  have hτR : (k : ℝ) ^ (-(1 / 100) : ℝ) ≤ τ ^ R := by
    rw [← Real.rpow_natCast τ R, Real.rpow_def_of_pos hx0, Real.rpow_def_of_pos hτ0]
    apply Real.exp_le_exp.2
    have h1 : (-Real.log τ) * (R : ℝ) ≤ (-Real.log τ) * (ρ * Real.log (k : ℝ)) :=
      mul_le_mul_of_nonneg_left hRle hℓ.le
    have h2 : (-Real.log τ) * (ρ * Real.log (k : ℝ)) = Real.log (k : ℝ) / 100 := by
      have hlt : Real.log τ ≠ 0 := ne_of_lt (Real.log_neg hτ0 hτ1)
      rw [hρdef]; field_simp
    nlinarith
  have hR14 : (R : ℝ) ≤ (k : ℝ) ^ (1 / 4 : ℝ) := by linarith
  have hPR := kf_PR τ (ρ / 2) k n R hτ0 hτ1 hk1 hR14 hτR (by linarith) hne
  obtain ⟨r, lam, h3, hrR, hlam1, hlam3, hY⟩ := kf_choose τ (((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) k n R hτ0 hτ1
    (one_le_pow₀ (Real.one_le_rpow hx1 (by norm_num))) hk1 hkτ hn hPR
  obtain ⟨c1, c2, c3, c4⟩ := kf_conds (k : ℝ) τ η R r lam
    ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) hx1 hτ0 hτ1 hη hrR hlam1 hlam3 hE1 hE2 hτR hY
  exact ⟨r, lam, h3, hlam1, c1, hY.le, c2, c3, c4⟩

theorem erdos_1094__h2__h2__h4__h3 : ∀ (η : ℝ),
  (0 : ℝ) < η →
    ∃ (c : ℝ),
      (0 : ℝ) < c ∧
        ∃ (k₀ : ℕ),
          ∀ (k : ℕ),
            k₀ ≤ k →
              ∀ (n : ℕ),
                k * k * k ≤ n →
                  (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) →
                    ∀ (S : Finset ℕ),
                      (∀ m ∈ S,
                          k < m ∧
                            (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧
                              ∃ (a : ℤ) (q : ℕ),
                                (0 : ℕ) < q ∧
                                  (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧
                                    |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) →
                        (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ) := by
  have h_thm := erdos_1094__h2__h2__h2__h3__h1__h1
  have h_params := kf_params
  intro η hη
  have hτ0 : (0 : ℝ) < min (1 / 2 : ℝ) (η / (6 * 65536)) := lt_min (by norm_num) (by positivity)
  have hτ1 : min (1 / 2 : ℝ) (η / (6 * 65536)) < 1 := lt_of_le_of_lt (min_le_left _ _) (by norm_num)
  have hτη : min (1 / 2 : ℝ) (η / (6 * 65536)) ≤ η / (6 * 65536) := min_le_right _ _
  generalize min (1 / 2 : ℝ) (η / (6 * 65536)) = τ at hτ0 hτ1 hτη
  obtain ⟨c, hc, k0, hP⟩ := h_params τ hτ0 hτ1 (η / 2) (by positivity)
  refine ⟨c, hc, max k0 1, ?_⟩
  intro k hk n hn hne S hS
  obtain ⟨r, lam, hr3, hlam, hrk, hT1, hT2, hT3, hlast⟩ := hP k (le_trans (le_max_left _ _) hk) n hn hne
  have hk1 : 1 ≤ k := le_trans (le_max_right _ _) hk
  have hn1 : 1 ≤ n := le_trans (Nat.mul_pos (Nat.mul_pos hk1 hk1) hk1) hn
  have hr2 : 2 ≤ r := by omega
  have hkR : (0 : ℝ) < (k : ℝ) := by exact_mod_cast hk1
  have hk1R : (1 : ℝ) ≤ (k : ℝ) := by exact_mod_cast hk1
  have hnR : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn1
  have hH : (0 : ℝ) < (k : ℝ) ^ (3 / 5 : ℝ) := by positivity
  have hW : (1 : ℝ) ≤ (k : ℝ) ^ (1 / 100 : ℝ) := Real.one_le_rpow hk1R (by norm_num)
  have hδ : (0 : ℝ) < (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) := by positivity
  have hrat : ((k : ℝ) + (k : ℝ) ^ (3 / 5 : ℝ)) ^ (r + 1) ≤ 2 * (k : ℝ) ^ (r + 1) := by
    have hu : 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ≤ 1 := by
      rw [show 2 * (r : ℝ) * ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) = (2 * (r : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ)) / (k : ℝ) by ring,
        div_le_one hkR]
      exact hrk
    have hkr := key_ratio r hr2 ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) hδ.le hu
    have e : (k : ℝ) + (k : ℝ) ^ (3 / 5 : ℝ) = (k : ℝ) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) := by
      field_simp
    rw [e, mul_pow]
    calc (k : ℝ) ^ (r + 1) * (1 + (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) ^ (r + 1)
        ≤ (k : ℝ) ^ (r + 1) * 2 := mul_le_mul_of_nonneg_left hkr (by positivity)
      _ = 2 * (k : ℝ) ^ (r + 1) := by ring
  have happ := kf_app h_thm lam ((k : ℝ) ^ (3 / 5 : ℝ)) ((k : ℝ) ^ (1 / 100 : ℝ))
    ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ)) hlam hH hW hδ n k r hk1 hn1 hr2 hrat S hS
  have hD : (0 : ℝ) < (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) := by positivity
  have hlam0 : (0 : ℝ) < lam := by linarith
  have hY : (0 : ℝ) < (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r := by positivity
  have hW2 : (0 : ℝ) < ((k : ℝ) ^ (1 / 100 : ℝ)) ^ (2 : ℕ) := by positivity
  have hB1 : ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) ^
      ((2 * (r : ℝ) - 1)⁻¹) ≤ τ := by
    refine kf_root _ τ _ (2 * r - 1) (by omega) ?_ (by positivity) hτ0.le ?_
    · have h12 : 1 ≤ 2 * r := by omega
      rw [Nat.cast_sub h12]
      push_cast
      ring
    · have hp : τ ^ (2 * r) = τ ^ (2 * r - 1) * τ := by
        rw [← pow_succ]
        congr 1
        omega
      rw [hp] at hT1
      exact le_of_mul_le_mul_right hT1 hτ0
  have hB2 : ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
      ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r)) ^ (((r : ℝ) - 1)⁻¹) ≤ τ := by
    refine kf_root _ τ _ (r - 1) (by omega) ?_ (by positivity) hτ0.le ?_
    · have h1r : 1 ≤ r := by omega
      rw [Nat.cast_sub h1r]
      push_cast
      ring
    · rw [div_le_iff₀ hY]
      have hp : τ ^ r = τ ^ (r - 1) * τ := by
        rw [← pow_succ]
        congr 1
        omega
      rw [hp] at hT2
      have hT2' : (k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 * τ ≤
          τ ^ (r - 1) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r) * τ := by
        calc _ ≤ _ := hT2
          _ = _ := by ring
      exact le_of_mul_le_mul_right hT2' hτ0
  have hB3 : ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
      ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1))) ^ ((2 * (r : ℝ))⁻¹) ≤ τ := by
    refine kf_root _ τ _ (2 * r) (by omega) ?_ (by positivity) hτ0.le ?_
    · push_cast
      ring
    · rw [div_le_iff₀ hD]
      have hf : ((r + 1)! : ℝ) = ((r : ℝ) + 1) * (r ! : ℝ) := by
        rw [Nat.factorial_succ]
        push_cast
        ring
      have e : (n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 =
          (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
            ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ)) := by
        rw [hf, pow_succ (k : ℝ) (r + 1)]
        field_simp
      rw [e]
      have h3 : (((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ) ≤ τ ^ (2 * r) := by
        rw [div_le_iff₀ hkR]
        exact hT3
      calc (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) *
            ((((r : ℝ) + 1) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) / (k : ℝ))
          ≤ (n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * τ ^ (2 * r) := mul_le_mul_of_nonneg_left h3 hD.le
        _ = τ ^ (2 * r) * ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1)) := by ring
  have h6 : (65536 : ℝ) * 3 * τ ≤ η / 2 := by
    have := mul_le_mul_of_nonneg_left hτη (by norm_num : (0 : ℝ) ≤ 65536 * 3)
    calc (65536 : ℝ) * 3 * τ ≤ 65536 * 3 * (η / (6 * 65536)) := this
      _ = η / 2 := by ring
  have h7 : (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) *
      (((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2) ^ ((2 * (r : ℝ) - 1)⁻¹) +
       ((k : ℝ) ^ (3 / 5 : ℝ) / (k : ℝ) * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
          ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1) * lam ^ r)) ^ (((r : ℝ) - 1)⁻¹) +
       ((n : ℝ) * ((r + 1)! : ℝ) / (k : ℝ) ^ (r + 2) * lam * ((k : ℝ) ^ (1 / 100 : ℝ)) ^ 2 /
          ((n : ℝ) * (r ! : ℝ) / (k : ℝ) ^ (r + 1))) ^ ((2 * (r : ℝ))⁻¹)) ≤
      (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) :=
    mul_le_mul_of_nonneg_left (by linarith) (by positivity)
  have h8 : (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) ≤ η / 2 * (k : ℝ) ^ (3 / 5 : ℝ) := by
    calc (65536 : ℝ) * (k : ℝ) ^ (3 / 5 : ℝ) * (3 * τ) = (65536 * 3 * τ) * (k : ℝ) ^ (3 / 5 : ℝ) := by ring
      _ ≤ η / 2 * (k : ℝ) ^ (3 / 5 : ℝ) := mul_le_mul_of_nonneg_right h6 hH.le
  linarith

What 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--h4--h3».Context

open scoped Nat

/-! Hole `h_count` 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__h4__h3 : ∀ (η : ℝ),
  (0 : ℝ) < η →
    ∃ (c : ℝ),
      (0 : ℝ) < c ∧
        ∃ (k₀ : ℕ),
          ∀ (k : ℕ),
            k₀ ≤ k →
              ∀ (n : ℕ),
                k * k * k ≤ n →
                  (↑n : ℝ) ≤ Real.exp (c * Real.log (↑k : ℝ) ^ (2 : ℕ)) →
                    ∀ (S : Finset ℕ),
                      (∀ m ∈ S,
                          k < m ∧
                            (↑m : ℝ) ≤ (↑k : ℝ) + (↑k : ℝ) ^ (3 / 5 : ℝ) ∧
                              ∃ (a : ℤ) (q : ℕ),
                                (0 : ℕ) < q ∧
                                  (↑q : ℝ) ≤ (↑k : ℝ) ^ (1 / 100 : ℝ) ∧
                                    |(↑n : ℝ) / (↑m : ℝ) - (↑a : ℝ) / (↑q : ℝ)| < (↑k : ℝ) ^ (3 / 5 : ℝ) / (↑k : ℝ)) →
                        (↑S.card : ℝ) < η * (↑k : ℝ) ^ (3 / 5 : ℝ) := by
  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 →

In words, unverified — what this statement says; written by t1111-a, drafted with claude-fable-5-2, 2026-11-11; no one has read it against the Lean and signed it.

Draft · drafted, by the model named above

$\displaystyle \forall \eta > 0\ \exists c > 0\ \exists k_0\ \forall k \ge k_0\ \forall n,\ k^3 \le n \le \exp(c \log^2 k):\ \#\{m \in (k, k + k^{3/5}]: \exists a \in \mathbb{Z},\ 1 \le q \le k^{1/100},\ |n/m - a/q| < k^{3/5}/k\} < \eta k^{3/5}$

Here $m$, $q$, $n$, $k$ are natural numbers and the inequalities are between real numbers. The Lean says it for every finite set $S$ of such $m$: $S$ has fewer than $\eta k^{3/5}$ elements.

Rendered from gloss/a48ebc3b7589….md · Improve these words →

Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Statement.lean. Origin: compiler-derived.

Attestation: pass, 7 of 7 checks

Checked by the kernel — the gate’s record of the run: attestations/001313.json, merge commit 90db830f05be.

Verdict pass, from attestations/001313.json.

Submitter
t1111-b
Toolchain
leanprover/lean4:v4.33.1 (hash f54d0bc916bf76a7fae460ce9d078ccd1f74aeb4fd12c4b6546bca28b6aa1c63)
Mathlib
0df444a360eaa60ab8c11dca51a86af692955474
Reviewer
none needed (intermediate)
StepCheckResult
1toolchainpass
2pathspass
4kernel-replaypass
5axiomspass
6hazardspass
7witnesspass
8depspass
Witness

Checked by the kernel — step 7 passed in the run its attestation records: attestations/001313.json, merge commit 90db830f05be.

Witness.lean — checked at step 7 of the run recorded below: pass. Rendered from targets/erdos-1094/nodes/erdos-1094--h2--h2--h4--h3/Witness.lean, sha256 96d2eaf4a33c.
import Mathlib

open scoped Nat

theorem witness : ∃ η : ℝ, (0 : ℝ) < η := ⟨1, one_pos⟩

In words, unverified — what this witness says; written by t1112-b, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-11-12; no one has read it against the Lean and signed it.

Draft · drafted, by the model named above

$\displaystyle \exists\, \eta \in \mathbb{R},\ 0 < \eta$

The witness exhibits a positive real number, because the only hypothesis of the statement that precedes its existential quantifier is $0 < \eta$: the statement reads $\forall \eta > 0,\ \exists c > 0,\ \exists k_0,\ \ldots$, and everything from $\exists c$ on belongs to the conclusion. The Lean witness is $\eta = 1$ with one_pos.

It says only that the statement is not vacuous in $\eta$; nothing about the sets $S$ of near-rational points it bounds.

Rendered from gloss/f0dabdad23aa….md · Improve these words →

How to read this page