Open Proof Network

Problems / erdos-1050 / proof 1

Proof 1 of 1

Proof 1 · root · by t1001-1050a, merged in e80916551a30.

The statement

Statement not audited — fidelity mechanical-only; QA pass incomplete; no signer yet.

theorem Opn.erdos_1050 :
    Irrational (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 1) - 3)) := 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 →

Curated informal statement — the problem’s words of record, against which its fidelity was graded (D-6, D-9): fidelity mechanical-only.

Erdős Problem 1050. The series $\sum_{n=1}^\infty \frac{1}{2^n - 3}$ is irrational. The source sum runs over $n \ge 1$; as a tsum over ℕ (which starts at $0$) it is reindexed $n \mapsto n + 1$, i.e. $\sum_{n=0}^\infty 1/(2^{n+1} - 3)$.

In words, unverified — what this statement says; written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06; no one has read it against the Lean and signed it. A gloss of a root is not its words of record: the curated statement above is (D-9).

Draft · drafted, by the model named above

This file states the theorem Opn.erdos_1050: the real number $\displaystyle \sum_{n=0}^{\infty} \frac{1}{2^{n+1}-3}$ is irrational.

In detail:

  • The sum is Lean's ∑' over all natural numbers $n = 0, 1, 2, \dots$ (Mathlib's unconditional sum, a tsum). Each term is the real number $1/(2^{n+1}-3)$, computed in $\mathbb{R}$. The terms are $-1, 1, \tfrac{1}{5}, \tfrac{1}{13}, \tfrac{1}{29}, \dots$; the first, at $n = 0$, is $1/(2-3) = -1$.
  • Re-indexed with $m = n+1$, this is the sum $\sum_{m \ge 1} 1/(2^m - 3)$ of Erdős problem 1050. The file's own comment says the statement is imported, as stated, from google-deepmind/formal-conjectures (FormalConjectures/ErdosProblems/1050.lean, Apache-2.0).
  • Irrational x is Mathlib's predicate: $x$ is not equal to $p/q$, read as a real number, for any rational $p/q$.
  • Two Lean conventions do not come into play here, but a reader should know the file leans on neither. Division by zero is defined to be $0$ in Lean; no denominator $2^{n+1}-3$ is zero (it is $-1$ at $n = 0$ and at least $1$ afterwards). And ∑' of a family that is not summable is defined to be $0$; the statement itself does not assert that the series converges, so the claim is about the tsum as Lean defines it. (The series does converge absolutely, since its terms are eventually bounded by a multiple of $2^{-n}$, so the tsum is the ordinary sum; the merged proof checks summability in its step hT.)

The statement has no hypotheses and no free variables. The file imports all of Mathlib; its body is sorry, the placeholder a statement file carries in place of a proof.

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

Fidelity: statement unchecked Nobody other than its author has yet judged whether the Lean says what the conjecture says. The kernel cannot decide this; a person must. protocol: fidelity: mechanical-only . Rendered from targets/erdos-1050/nodes/erdos-1050/Statement.lean.

The proof, dependencies first

3 statements on this proof. Each statement comes before the statements whose proofs use it. A step’s outline is folded; open it for its goal, what it uses and its Lean lines. How to read a proof page →

  1. erdos-1050--h1-v2--h3 proved

    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.

    theorem erdos_1050__h1_v2__h3 : ∀ (Qc : ℕ → ℕ → ℚ),
      (Qc = fun (n k : ℕ) =>
          ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
              ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
            ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) →
        ∀ (Qx : ℕ → ℚ),
          (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) →
            ∀ (Aq : ℕ → ℚ),
              (Aq = fun (n : ℕ) =>
                  ∑ k ∈ Finset.range (n + (1 : ℕ)),
                      (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                        ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                    Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) →
                ∀ (n : ℕ),
                  ∃ (d : ℕ),
                    (0 : ℕ) < d ∧
                      (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧
                        (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n := 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 f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-10-18; no one has read it against the Lean and signed it.

    Draft · drafted, by the model named above

    $\displaystyle \forall n\in\mathbb{N}\ \ \exists d\in\mathbb{N}:\qquad d>0,\quad d^2\le 2^{3n^2},\quad d\,Q_x(n)\in\mathbb{Z},\quad d\,A_q(n)\in\mathbb{Z}$

    For every natural number $n$ there is a natural number $d>0$ with $d^2\le 2^{3n\cdot n}$ (compared as real numbers) such that $d\,Q_x(n)$ and $d\,A_q(n)$ are integers (each written as: some $z\in\mathbb{Z}$ equals that rational), so $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$ of size at most $2^{3n^2/2}$. The functions $Q_c:\mathbb{N}\times\mathbb{N}\to\mathbb{Q}$, $Q_x:\mathbb{N}\to\mathbb{Q}$ and $A_q:\mathbb{N}\to\mathbb{Q}$ are fixed by hypotheses as $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$, $Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\,(3/2^n)^k$ and $A_q(n)=\sum_{k=0}^{n}\bigl(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\bigr)(3/2^n)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$. Exponents are natural numbers (subtraction in them stops at $0$, $k(k-1)/2$ is natural-number division), division is in $\mathbb{Q}$ with $x/0=0$ so the $j=k$ term of the inner sum of $A_q$ is $0$, and where these functions are used $k\le n$, so no other exponent is truncated.

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

    History: 4 versions on record, 1 withdrawn
    1. 2026-10-06 · written by t1006-w3, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · gloss/b4cf913714f6….md · the first version of its chain

      Read this version

      This file states the theorem erdos_1050__h1_v2__h3, which the gate wrote from the hole hden of a merged partial proof.

      The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following formulas, so these are the only functions it speaks about:

      • $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\displaystyle\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$;
      • $Q_x(n)=\displaystyle\sum_{k=0}^{n}Q_c(n,k)\,\Big(\frac{3}{2^n}\Big)^k$;
      • $A_q(n)=\displaystyle\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$.

      Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used below, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.

      The conclusion: for every natural number $n$ there is a natural number $d$ such that

      • $d>0$;
      • $d^2\le 2^{3n^2}$ (compared as real numbers);
      • $d\,Q_x(n)$ is an integer, and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number).

      So $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.

    2. 2026-10-06 · written by t1006-w3, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · withdrawn · gloss/d9dbd43701b0….md · diff to its predecessor

      Read this version

      This file states the theorem erdos_1050__h1_v2__h3, which the gate wrote from the hole hden of a merged partial proof.

      The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following three formulas, so these are the only functions it speaks about: $$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1},$$ $$Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\Big(\frac{3}{2^n}\Big)^k,$$ $$A_q(n)=\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}.$$

      Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used here, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.

      The conclusion: for every natural number $n$ there is a natural number $d$ with $d>0$ and $d^2\le 2^{3n^2}$ (compared as real numbers) such that $d\,Q_x(n)$ is an integer and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number). So $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.

    3. 2026-10-06 · written by t1006-w3, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · gloss/30a6d33d96aa….md · diff to its predecessor

      Read this version

      This file states the theorem erdos_1050__h1_v2__h3, which the gate wrote from the hole hden of a merged partial proof.

      The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following three formulas, so these are the only functions it speaks about: $$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1},$$ $$Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\Big(\frac{3}{2^n}\Big)^k,$$ $$A_q(n)=\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}.$$

      Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used here, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.

      The conclusion: for every natural number $n$ there is a natural number $d$ with $d>0$ and $d^2\le 2^{3n^2}$ (compared as real numbers) such that $d\,Q_x(n)$ is an integer and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number). Thus $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.

    4. 2026-10-18 · written by f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1) · not signed · current · gloss/45b53c635f7e….md · diff to its predecessor

      Read this version

      $\displaystyle \forall n\in\mathbb{N}\ \ \exists d\in\mathbb{N}:\qquad d>0,\quad d^2\le 2^{3n^2},\quad d\,Q_x(n)\in\mathbb{Z},\quad d\,A_q(n)\in\mathbb{Z}$

      For every natural number $n$ there is a natural number $d>0$ with $d^2\le 2^{3n\cdot n}$ (compared as real numbers) such that $d\,Q_x(n)$ and $d\,A_q(n)$ are integers (each written as: some $z\in\mathbb{Z}$ equals that rational), so $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$ of size at most $2^{3n^2/2}$. The functions $Q_c:\mathbb{N}\times\mathbb{N}\to\mathbb{Q}$, $Q_x:\mathbb{N}\to\mathbb{Q}$ and $A_q:\mathbb{N}\to\mathbb{Q}$ are fixed by hypotheses as $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$, $Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\,(3/2^n)^k$ and $A_q(n)=\sum_{k=0}^{n}\bigl(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\bigr)(3/2^n)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$. Exponents are natural numbers (subtraction in them stops at $0$, $k(k-1)/2$ is natural-number division), division is in $\mathbb{Q}$ with $x/0=0$ so the $j=k$ term of the inner sum of $A_q$ is $0$, and where these functions are used $k\le n$, so no other exponent is truncated.

    Diff of d9dbd43701b0 against b4cf913714f6
    @@ -1,17 +1,10 @@
     This file states the theorem `erdos_1050__h1_v2__h3`, which the gate wrote from the hole `hden` of a merged partial proof.
     
    -The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following formulas, so these are the only functions it speaks about:
    +The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following three formulas, so these are the only functions it speaks about:
    +$$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1},$$
    +$$Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\Big(\frac{3}{2^n}\Big)^k,$$
    +$$A_q(n)=\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}.$$
     
    -- $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\displaystyle\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$;
    -- $Q_x(n)=\displaystyle\sum_{k=0}^{n}Q_c(n,k)\,\Big(\frac{3}{2^n}\Big)^k$;
    -- $A_q(n)=\displaystyle\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$.
    +Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used here, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.
     
    -Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used below, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.
    -
    -The conclusion: for every natural number $n$ there is a natural number $d$ such that
    -
    -- $d>0$;
    -- $d^2\le 2^{3n^2}$ (compared as real numbers);
    -- $d\,Q_x(n)$ is an integer, and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number).
    -
    -So $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.
    +The conclusion: for every natural number $n$ there is a natural number $d$ with $d>0$ and $d^2\le 2^{3n^2}$ (compared as real numbers) such that $d\,Q_x(n)$ is an integer and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number). So $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.
    Diff of 30a6d33d96aa against b4cf913714f6
    @@ -1,17 +1,10 @@
     This file states the theorem `erdos_1050__h1_v2__h3`, which the gate wrote from the hole `hden` of a merged partial proof.
     
    -The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following formulas, so these are the only functions it speaks about:
    +The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following three formulas, so these are the only functions it speaks about:
    +$$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1},$$
    +$$Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\Big(\frac{3}{2^n}\Big)^k,$$
    +$$A_q(n)=\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}.$$
     
    -- $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\displaystyle\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$;
    -- $Q_x(n)=\displaystyle\sum_{k=0}^{n}Q_c(n,k)\,\Big(\frac{3}{2^n}\Big)^k$;
    -- $A_q(n)=\displaystyle\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$.
    +Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used here, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.
     
    -Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used below, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.
    -
    -The conclusion: for every natural number $n$ there is a natural number $d$ such that
    -
    -- $d>0$;
    -- $d^2\le 2^{3n^2}$ (compared as real numbers);
    -- $d\,Q_x(n)$ is an integer, and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number).
    -
    -So $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.
    +The conclusion: for every natural number $n$ there is a natural number $d$ with $d>0$ and $d^2\le 2^{3n^2}$ (compared as real numbers) such that $d\,Q_x(n)$ is an integer and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number). Thus $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.
    Diff of 45b53c635f7e against 30a6d33d96aa
    @@ -1,10 +1,3 @@
    -This file states the theorem `erdos_1050__h1_v2__h3`, which the gate wrote from the hole `hden` of a merged partial proof.
    +$$\forall n\in\mathbb{N}\ \ \exists d\in\mathbb{N}:\qquad d>0,\quad d^2\le 2^{3n^2},\quad d\,Q_x(n)\in\mathbb{Z},\quad d\,A_q(n)\in\mathbb{Z}$$
     
    -The statement is about three functions $Q_c:\mathbb N\times\mathbb N\to\mathbb Q$, $Q_x:\mathbb N\to\mathbb Q$ and $A_q:\mathbb N\to\mathbb Q$. It takes as hypotheses that they are given by the following three formulas, so these are the only functions it speaks about:
    -$$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1},$$
    -$$Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\Big(\frac{3}{2^n}\Big)^k,$$
    -$$A_q(n)=\sum_{k=0}^{n}\Big(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}.$$
    -
    -Exponents are natural numbers: subtraction in them is truncated at $0$, and $k(k-1)/2$ is natural-number division (with $k-1=0$ when $k=0$). Where these functions are used here, $k\le n$, so no other exponent is truncated. Division is Lean's division of rationals, in which $x/0=0$: the term $j=k$ of the inner sum in $A_q$ has denominator $2^0-1=0$ and so contributes $0$.
    -
    -The conclusion: for every natural number $n$ there is a natural number $d$ with $d>0$ and $d^2\le 2^{3n^2}$ (compared as real numbers) such that $d\,Q_x(n)$ is an integer and $d\,A_q(n)$ is an integer (each written as: some $z\in\mathbb Z$ equals that rational number). Thus $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$, and $d\le 2^{3n^2/2}$.
    +For every natural number $n$ there is a natural number $d>0$ with $d^2\le 2^{3n\cdot n}$ (compared as real numbers) such that $d\,Q_x(n)$ and $d\,A_q(n)$ are integers (each written as: some $z\in\mathbb{Z}$ equals that rational), so $d$ is a common denominator of $Q_x(n)$ and $A_q(n)$ of size at most $2^{3n^2/2}$. The functions $Q_c:\mathbb{N}\times\mathbb{N}\to\mathbb{Q}$, $Q_x:\mathbb{N}\to\mathbb{Q}$ and $A_q:\mathbb{N}\to\mathbb{Q}$ are fixed by hypotheses as $Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i=0}^{k-1}\frac{2^{n-i}-1}{2^{i+1}-1}\prod_{i=0}^{n-1}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$, $Q_x(n)=\sum_{k=0}^{n}Q_c(n,k)\,(3/2^n)^k$ and $A_q(n)=\sum_{k=0}^{n}\bigl(\sum_{j=0}^{k}\frac{Q_c(n,j)}{2^{k-j}-1}\bigr)(3/2^n)^k+Q_x(n)\sum_{j=0}^{n-1}\frac{3}{2^{j+1}-3}$. Exponents are natural numbers (subtraction in them stops at $0$, $k(k-1)/2$ is natural-number division), division is in $\mathbb{Q}$ with $x/0=0$ so the $j=k$ term of the inner sum of $A_q$ is $0$, and where these functions are used $k\le n$, so no other exponent is truncated.

    Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).

    Checked by the kernel — an outline of the proof attested in attestations/000292.json, merge commit 2987e49b6fb3.

    Outline of Proof.lean, extracted by the gate at 82834c4684b8 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. id1_test have ∀ (n j : ℕ), j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with id1_test : ∀ (n j : ℕ), j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. .

      Lean, lines 26–37
        have id1_test : ∀ (n j : ℕ) (hj : j ≤ n),
            (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - 1)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
              ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1) := by
          intro n j hj
          induction j with
          | zero => simp
          | succ j ih =>
            have ih' := ih (by omega)
            rw [Finset.prod_range_succ, ← ih']
            obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩
            rw [hm, Finset.prod_range_succ, show n - (j + 1) = m by omega]
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 26–37 at 2987e49b6fb3 ↗

      1. id1_test.s1 case routine: simp

        Leaves (∏ i ∈ Finset.range (0 : ℕ), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (0 : ℕ)), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with hj : (0 : ℕ) ≤ n.

        Uses library Nat.zero Zero, the smallest natural number. .

        Lean, line 31
            | zero => simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 31 at 2987e49b6fb3 ↗

      2. id1_test.s2 case

        Leaves (∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with j : ℕ, ih : j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), hj : j + (1 : ℕ) ≤ n.

        Uses library Nat.succ The successor of a natural number n. , Finset.prod_range_succ.

        Lean, lines 32–37
            | succ j ih =>
              have ih' := ih (by omega)
              rw [Finset.prod_range_succ, ← ih']
              obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩
              rw [hm, Finset.prod_range_succ, show n - (j + 1) = m by omega]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 32–37 at 2987e49b6fb3 ↗

        1. id1_test.s2.ih' have (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

          Leaves (∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with ih' : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 33
                have ih' := ih (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 33 at 2987e49b6fb3 ↗

        2. id1_test.s2.s2 obtain ∃ (m : ℕ), n - j = m + (1 : ℕ)

          Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (n - x) - (1 : ℚ))) * ((2 : ℚ) ^ (n - j) - (1 : ℚ)) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with m : ℕ, hm : n - j = m + (1 : ℕ).

          Uses library Exists.intro Existential introduction. .

          Lean, line 35
                obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 35 at 2987e49b6fb3 ↗

    2. lower_test have ∀ (j : ℕ), ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with lower_test : ∀ (j : ℕ), ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum, Finset.prod_range_reflect.

      Lean, lines 38–52
        have lower_test : ∀ (j : ℕ),
            ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) =
              2 ^ (j * (j - 1) / 2) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1) := by
          intro j
          have h1 : ∀ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) = 2 ^ i * (2 ^ (j - 1 - i + 1) - 1) := by
            intro i hi
            have hi' := Finset.mem_range.mp hi
            rw [mul_sub, ← pow_add, show i + (j - 1 - i + 1) = j by omega]
            ring
          rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum,
            Finset.prod_range_reflect (fun s => ((2 : ℚ) ^ (s + 1) - 1)) j]
          congr 1
          congr 1
          have := Finset.sum_range_id_mul_two j
          omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 38–52 at 2987e49b6fb3 ↗

      1. lower_test.h1 have ∀ i ∈ Finset.range j, (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ))

        Leaves ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ i ∈ Finset.range j, (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , mul_sub Alias of mul_sub_left_distrib. , pow_add.

        Lean, lines 42–46
            have h1 : ∀ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) = 2 ^ i * (2 ^ (j - 1 - i + 1) - 1) := by
              intro i hi
              have hi' := Finset.mem_range.mp hi
              rw [mul_sub, ← pow_add, show i + (j - 1 - i + 1) = j by omega]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 42–46 at 2987e49b6fb3 ↗

        1. lower_test.h1.hi' have i < j

          Leaves (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ)), with hi' : i < j.

          Uses library Finset.mem_range.

          Lean, line 44
                have hi' := Finset.mem_range.mp hi

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 44 at 2987e49b6fb3 ↗

      2. lower_test.this have (∑ i ∈ Finset.range j, i) * (2 : ℕ) = j * (j - (1 : ℕ))

        Leaves ∑ i ∈ Finset.range j, i = j * (j - (1 : ℕ)) / (2 : ℕ), with this : (∑ i ∈ Finset.range j, i) * (2 : ℕ) = j * (j - (1 : ℕ)).

        Uses library Finset.sum_range_id_mul_two Gauss' summation formula .

        Lean, line 51
            have := Finset.sum_range_id_mul_two j

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 51 at 2987e49b6fb3 ↗

    3. upper_test have ∀ (j n : ℕ), j ≤ n → ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with upper_test : ∀ (j n : ℕ), j ≤ n → ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Finset.prod_Ico_eq_prod_range, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range, pow_mul.

      Lean, lines 53–65
        have upper_test : ∀ (j n : ℕ) (hj : j ≤ n),
            ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - 2 ^ i) =
              (-1) ^ (n - j) * 2 ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
          intro j n hj
          have e : Finset.Ioc j n = Finset.Ico (j + 1) (n + 1) := by
            ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
          rw [e, Finset.prod_Ico_eq_prod_range, show n + 1 - (j + 1) = n - j by omega]
          have h1 : ∀ t ∈ Finset.range (n - j), ((2 : ℚ) ^ j - 2 ^ (j + 1 + t)) = (-1) * 2 ^ j * (2 ^ (t + 1) - 1) := by
            intro t _
            rw [show j + 1 + t = j + (t + 1) by ring, pow_add]
            ring
          rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
            Finset.prod_const, Finset.card_range, ← pow_mul]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 53–65 at 2987e49b6fb3 ↗

      1. upper_test.e have Finset.Ioc j n = Finset.Ico (j + (1 : ℕ)) (n + (1 : ℕ))

        Leaves ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with e : Finset.Ioc j n = Finset.Ico (j + (1 : ℕ)) (n + (1 : ℕ)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ioc, Finset.mem_Ico.

        Lean, lines 57–58
            have e : Finset.Ioc j n = Finset.Ico (j + 1) (n + 1) := by
              ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 57–58 at 2987e49b6fb3 ↗

      2. upper_test.h1 have ∀ t ∈ Finset.range (n - j), (2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (t + (1 : ℕ)) - (1 : ℚ))

        Leaves ∏ k ∈ Finset.range (n - j), ((2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + k)) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ t ∈ Finset.range (n - j), (2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (t + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , pow_add.

        Lean, lines 60–63
            have h1 : ∀ t ∈ Finset.range (n - j), ((2 : ℚ) ^ j - 2 ^ (j + 1 + t)) = (-1) * 2 ^ j * (2 ^ (t + 1) - 1) := by
              intro t _
              rw [show j + 1 + t = j + (t + 1) by ring, pow_add]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 60–63 at 2987e49b6fb3 ↗

    4. rhs_test have ∀ (j n : ℕ), j ≤ n → (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with rhs_test : ∀ (j n : ℕ), j ≤ n → (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Finset.prod_Ico_eq_prod_range, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range, pow_mul, Finset.prod_range_add.

      Lean, lines 66–82
        have rhs_test : ∀ (j n : ℕ) (hj : j ≤ n),
            (∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K)) *
              ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
              (-1) ^ n * 2 ^ (j * n) * ∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
          intro j n hj
          have e : Finset.Ioc n (2 * n) = Finset.Ico (n + 1) (2 * n + 1) := by
            ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
          rw [e, Finset.prod_Ico_eq_prod_range, show 2 * n + 1 - (n + 1) = n by omega]
          have h1 : ∀ t ∈ Finset.range n, ((2 : ℚ) ^ j - 2 ^ (n + 1 + t)) =
              (-1) * 2 ^ j * (2 ^ ((n - j) + t + 1) - 1) := by
            intro t _
            rw [show n + 1 + t = j + ((n - j) + t + 1) by omega, pow_add]
            ring
          rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
            Finset.prod_const, Finset.card_range, ← pow_mul,
            show 2 * n - j = (n - j) + n by omega, Finset.prod_range_add]
          ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 66–82 at 2987e49b6fb3 ↗

      1. rhs_test.e have Finset.Ioc n ((2 : ℕ) * n) = Finset.Ico (n + (1 : ℕ)) ((2 : ℕ) * n + (1 : ℕ))

        Leaves (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with e : Finset.Ioc n ((2 : ℕ) * n) = Finset.Ico (n + (1 : ℕ)) ((2 : ℕ) * n + (1 : ℕ)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ioc, Finset.mem_Ico.

        Lean, lines 71–72
            have e : Finset.Ioc n (2 * n) = Finset.Ico (n + 1) (2 * n + 1) := by
              ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 71–72 at 2987e49b6fb3 ↗

      2. rhs_test.h1 have ∀ t ∈ Finset.range n, (2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (n - j + t + (1 : ℕ)) - (1 : ℚ))

        Leaves (∏ k ∈ Finset.range n, ((2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + k))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ t ∈ Finset.range n, (2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (n - j + t + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , pow_add.

        Lean, lines 74–78
            have h1 : ∀ t ∈ Finset.range n, ((2 : ℚ) ^ j - 2 ^ (n + 1 + t)) =
                (-1) * 2 ^ j * (2 ^ ((n - j) + t + 1) - 1) := by
              intro t _
              rw [show n + 1 + t = j + ((n - j) + t + 1) by omega, pow_add]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 74–78 at 2987e49b6fb3 ↗

    5. id1_full have ∀ (n j : ℕ), j ≤ n → (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with id1_full : ∀ (n j : ℕ), j ≤ n → (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K).

      Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.prod_union, mul_right_cancel₀, pow_add.

      Lean, lines 83–126
        have id1_full : ∀ (n j : ℕ) (hj : j ≤ n),
            (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) *
                  ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
              2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
            ∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K) := by
          intro n j hj
          have hPne : ∀ m : ℕ, ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + 1) - 1) ≠ 0 := by
            intro m
            refine Finset.prod_ne_zero_iff.mpr (fun s _ => ?_)
            have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
            linarith
          have hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
              (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) /
                ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1)) := by
            rw [Finset.prod_div_distrib, ← id1_test n j hj]
            field_simp [hPne]
          have hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
              (∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1)) /
                ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) := by
            rw [Finset.prod_div_distrib, ← id1_test (2 * n - j) n (by omega), show 2 * n - j - n = n - j by omega]
            field_simp [hPne]
          have hsplit : (Finset.range (n + 1)).erase j = Finset.range j ∪ Finset.Ioc j n := by
            ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega
          have hdisj : Disjoint (Finset.range j) (Finset.Ioc j n) := by
            rw [Finset.disjoint_left]
            intro x hx hx'
            simp only [Finset.mem_range, Finset.mem_Ioc] at hx hx'
            omega
          have hR := rhs_test j n hj
          obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hj
          have hsign : (-1 : ℚ) ^ (j + m) = (-1) ^ j * (-1) ^ (j + m - j) := by
            rw [← pow_add]; congr 1; omega
          have ha : 2 * (j * (j - 1) / 2) = j * (j - 1) := Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
          have hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j) := by
            rw [show j + m - j = m by omega]
            rcases j with _ | i
            · simp
            · simp only [Nat.add_sub_cancel] at ha ⊢
              nlinarith [ha]
          rw [hG1, hG2, hsplit, Finset.prod_union hdisj, lower_test, upper_test j (j + m) hj]
          apply mul_right_cancel₀ (hPne (j + m - j))
          rw [hR, hsign, hexp, pow_add, pow_add, pow_add]
          field_simp [hPne]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 83–126 at 2987e49b6fb3 ↗

      1. id1_full.hPne have ∀ (m : ℕ), ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ)

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hPne : ∀ (m : ℕ), ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_ne_zero_iff.

        Lean, lines 90–94
            have hPne : ∀ m : ℕ, ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + 1) - 1) ≠ 0 := by
              intro m
              refine Finset.prod_ne_zero_iff.mpr (fun s _ => ?_)
              have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
              linarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 90–94 at 2987e49b6fb3 ↗

        1. id1_full.hPne.this have (1 : ℚ) < (2 : ℚ) ^ (s + (1 : ℕ))

          Leaves (2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (s + (1 : ℕ)).

          Uses library one_lt_pow₀.

          Lean, line 93
                have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 93 at 2987e49b6fb3 ↗

      2. id1_full.hG1 have ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)))

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_div_distrib.

        Lean, lines 95–99
            have hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) /
                  ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1)) := by
              rw [Finset.prod_div_distrib, ← id1_test n j hj]
              field_simp [hPne]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 95–99 at 2987e49b6fb3 ↗

      3. id1_full.hG2 have ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)))

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_div_distrib.

        Lean, lines 100–104
            have hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                (∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1)) /
                  ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) := by
              rw [Finset.prod_div_distrib, ← id1_test (2 * n - j) n (by omega), show 2 * n - j - n = n - j by omega]
              field_simp [hPne]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 100–104 at 2987e49b6fb3 ↗

      4. id1_full.hsplit have (Finset.range (n + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j n

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hsplit : (Finset.range (n + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j n.

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc.

        Lean, lines 105–106
            have hsplit : (Finset.range (n + 1)).erase j = Finset.range j ∪ Finset.Ioc j n := by
              ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 105–106 at 2987e49b6fb3 ↗

      5. id1_full.hdisj have Disjoint (Finset.range j) (Finset.Ioc j n)

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hdisj : Disjoint (Finset.range j) (Finset.Ioc j n).

        Uses library Disjoint Two elements of a lattice are disjoint if their inf is the bottom element. , Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.disjoint_left, Finset.mem_range, Finset.mem_Ioc.

        Lean, lines 107–111
            have hdisj : Disjoint (Finset.range j) (Finset.Ioc j n) := by
              rw [Finset.disjoint_left]
              intro x hx hx'
              simp only [Finset.mem_range, Finset.mem_Ioc] at hx hx'
              omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 107–111 at 2987e49b6fb3 ↗

      6. id1_full.hR have (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hR : (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Lean, line 112
            have hR := rhs_test j n hj

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 112 at 2987e49b6fb3 ↗

      7. id1_full.s7 obtain ∃ (k : ℕ), n = j + k

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with m : ℕ, hj : j ≤ j + m, hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range (j + m), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))), hG2 : ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * (j + m) - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range (j + m), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))), hsplit : (Finset.range (j + m + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j (j + m), hdisj : Disjoint (Finset.range j) (Finset.Ioc j (j + m)), hR : (∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ (j + m) * (2 : ℚ) ^ (j * (j + m)) * ∏ s ∈ Finset.range ((2 : ℕ) * (j + m) - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Uses library Nat.exists_eq_add_of_le.

        Lean, line 113
            obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hj

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 113 at 2987e49b6fb3 ↗

      8. id1_full.hsign have (-1 : ℚ) ^ (j + m) = (-1 : ℚ) ^ j * (-1 : ℚ) ^ (j + m - j)

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hsign : (-1 : ℚ) ^ (j + m) = (-1 : ℚ) ^ j * (-1 : ℚ) ^ (j + m - j).

        Uses library pow_add.

        Lean, lines 114–115
            have hsign : (-1 : ℚ) ^ (j + m) = (-1) ^ j * (-1) ^ (j + m - j) := by
              rw [← pow_add]; congr 1; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 114–115 at 2987e49b6fb3 ↗

      9. id1_full.ha have (2 : ℕ) * (j * (j - (1 : ℕ)) / (2 : ℕ)) = j * (j - (1 : ℕ))

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with ha : (2 : ℕ) * (j * (j - (1 : ℕ)) / (2 : ℕ)) = j * (j - (1 : ℕ)).

        Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_pred_self.

        Lean, line 116
            have ha : 2 * (j * (j - 1) / 2) = j * (j - 1) := Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 116 at 2987e49b6fb3 ↗

      10. id1_full.hexp have j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j)

        Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j).

        Lean, lines 117–122
            have hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j) := by
              rw [show j + m - j = m by omega]
              rcases j with _ | i
              · simp
              · simp only [Nat.add_sub_cancel] at ha ⊢
                nlinarith [ha]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 117–122 at 2987e49b6fb3 ↗

        1. id1_full.hexp.s1 case routine: simp

          Leaves (0 : ℕ) * ((0 : ℕ) + m) = (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) + (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) * m.

          Lean, line 120
                · simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 120 at 2987e49b6fb3 ↗

        2. id1_full.hexp.s2 case routine: simp, nlinarith

          Leaves (i + (1 : ℕ)) * (i + (1 : ℕ) + m) = (i + (1 : ℕ)) * (i + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (i + (1 : ℕ)) + (i + (1 : ℕ)) * (i + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (i + (1 : ℕ)) * m.

          Uses library Nat.add_sub_cancel.

          Lean, lines 121–122
                · simp only [Nat.add_sub_cancel] at ha ⊢
                  nlinarith [ha]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 121–122 at 2987e49b6fb3 ↗

    6. lagr_eval have ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with lagr_eval : ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.C C a is the constant polynomial a. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq.

      Lean, lines 128–161
        have lagr_eval : ∀ (n : ℕ) (x : ℕ → ℚ) (hx : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j)
          (N : ℚ[X]) (hNdeg : N.degree ≤ n) (r : ℕ → ℚ)
          (hr : ∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j)),
            N = ∑ j ∈ Finset.range (n + 1), C (r j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)) := by
          intro n x hx N hNdeg r hr
          have hinj : Set.InjOn x (Finset.range (n + 1) : Set ℕ) := by
            intro i hi j hj h
            simp only [Finset.coe_range, Set.mem_Iio] at hi hj
            exact hx i (by omega) j (by omega) h
          apply Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq ((Finset.range (n + 1)).image x)
          · rw [Finset.card_image_of_injOn hinj, Finset.card_range]
            refine lt_of_le_of_lt (Polynomial.degree_sub_le _ _) (max_lt ?_ ?_)
            · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)
            · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
              rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
              intro j hj
              refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
              refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
              have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                  Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                simp
              rw [this, zero_add]
              exact_mod_cast Nat.lt_succ_self n
          · intro y hy
            obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy
            have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega
            rw [← hr k hk', Polynomial.eval_finset_sum, Finset.sum_eq_single k]
            · simp [Polynomial.eval_prod]
            · intro j hj hjk
              simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                Polynomial.eval_X]
              rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]
            · intro h; exact absurd hk h

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 128–161 at 2987e49b6fb3 ↗

      1. lagr_eval.hinj have Set.InjOn x (↑(Finset.range (n + (1 : ℕ))) : Set ℕ)

        Leaves N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)), with hinj : Set.InjOn x (↑(Finset.range (n + (1 : ℕ))) : Set ℕ).

        Uses library Set.InjOn f is injective on s if the restriction of f to s is injective. , Finset.range range n is the set of natural numbers less than n. , Set A set is a collection of elements of some type α. , Finset.coe_range, Set.mem_Iio.

        Lean, lines 133–136
            have hinj : Set.InjOn x (Finset.range (n + 1) : Set ℕ) := by
              intro i hi j hj h
              simp only [Finset.coe_range, Set.mem_Iio] at hi hj
              exact hx i (by omega) j (by omega) h

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 133–136 at 2987e49b6fb3 ↗

      2. lagr_eval.s2 case

        Leaves (N - ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).degree < (↑(Finset.image x (Finset.range (n + (1 : ℕ)))).card : WithBot ℕ).

        Uses library Finset.card_image_of_injOn, Finset.card_range, lt_of_le_of_lt, Polynomial.degree_sub_le, max_lt.

        Lean, lines 138–151
            · rw [Finset.card_image_of_injOn hinj, Finset.card_range]
              refine lt_of_le_of_lt (Polynomial.degree_sub_le _ _) (max_lt ?_ ?_)
              · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)
              · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                intro j hj
                refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                  rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                    Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                  simp
                rw [this, zero_add]
                exact_mod_cast Nat.lt_succ_self n

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 138–151 at 2987e49b6fb3 ↗

        1. lagr_eval.s2.s1 case

          Leaves N.degree < (↑(n + (1 : ℕ)) : WithBot ℕ).

          Uses library lt_of_le_of_lt, Nat.lt_succ_self.

          Lean, line 140
                · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 140 at 2987e49b6fb3 ↗

        2. lagr_eval.s2.s2 case

          Leaves (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).degree < (↑(n + (1 : ℕ)) : WithBot ℕ).

          Uses library lt_of_le_of_lt, Polynomial.degree_sum_le, Finset.sup_lt_iff, WithBot.bot_lt_coe, Polynomial.degree_mul_le, add_le_add, Polynomial.degree_C_le, Polynomial.degree_prod_le, zero_add, Nat.lt_succ_self.

          Lean, lines 141–151
                · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                  rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                  intro j hj
                  refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                  refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                  have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                    rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                      Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                    simp
                  rw [this, zero_add]
                  exact_mod_cast Nat.lt_succ_self n

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 141–151 at 2987e49b6fb3 ↗

          1. lagr_eval.s2.s2.this have ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree = (↑n : WithBot ℕ)

            Leaves (0 : WithBot ℕ) + ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree < (↑(n + (1 : ℕ)) : WithBot ℕ), with this : ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree = (↑n : WithBot ℕ).

            Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , WithBot Attach ⊥ to a type. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.degree_X_sub_C, Finset.sum_const, Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. , Finset.card_range, Nat.add_sub_cancel.

            Lean, lines 146–149
                    have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                      rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                        Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                      simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 146–149 at 2987e49b6fb3 ↗

      3. lagr_eval.s3 case

        Leaves ∀ x_1 ∈ Finset.image x (Finset.range (n + (1 : ℕ))), Polynomial.eval x_1 N = Polynomial.eval x_1 (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).

        Uses library Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Finset.sum_eq_single.

        Lean, lines 152–161
            · intro y hy
              obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy
              have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega
              rw [← hr k hk', Polynomial.eval_finset_sum, Finset.sum_eq_single k]
              · simp [Polynomial.eval_prod]
              · intro j hj hjk
                simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                  Polynomial.eval_X]
                rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]
              · intro h; exact absurd hk h

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 152–161 at 2987e49b6fb3 ↗

        1. lagr_eval.s3.s1 obtain ∃ a ∈ Finset.range (n + (1 : ℕ)), x a = y

          Leaves Polynomial.eval (x k) N = Polynomial.eval (x k) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))), with k : ℕ, hk : k ∈ Finset.range (n + (1 : ℕ)), hy : x k ∈ Finset.image x (Finset.range (n + (1 : ℕ))).

          Uses library Finset.mem_image.

          Lean, line 153
                obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 153 at 2987e49b6fb3 ↗

        2. lagr_eval.s3.hk' have k ≤ n

          Leaves Polynomial.eval (x k) N = Polynomial.eval (x k) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))), with hk' : k ≤ n.

          Lean, line 154
                have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 154 at 2987e49b6fb3 ↗

          1. lagr_eval.s3.hk'.this have k < n + (1 : ℕ)

            Leaves k ≤ n, with this : k < n + (1 : ℕ).

            Uses library Finset.mem_range.

            Lean, line 154
                  have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 154 at 2987e49b6fb3 ↗

        3. lagr_eval.s3.s3 case routine: simp

          Leaves r k * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (x k - x i) = Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r k) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).

          Uses library Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod .

          Lean, line 156
                · simp [Polynomial.eval_prod]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 156 at 2987e49b6fb3 ↗

        4. lagr_eval.s3.s4 case

          Leaves ∀ b ∈ Finset.range (n + (1 : ℕ)), b ≠ k → Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r b) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase b, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) = (0 : ℚ).

          Uses library Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Finset.prod_eq_zero, Finset.mem_erase, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , Ne.symm, MulZeroClass.mul_zero Zero is a right absorbing element for multiplication .

          Lean, lines 157–160
                · intro j hj hjk
                  simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                    Polynomial.eval_X]
                  rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 157–160 at 2987e49b6fb3 ↗

        5. lagr_eval.s3.s5 case

          Leaves k ∉ Finset.range (n + (1 : ℕ)) → Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r k) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) = (0 : ℚ).

          Uses library absurd Anything follows from two contradictory hypotheses. .

          Lean, line 161
                · intro h; exact absurd hk h

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 161 at 2987e49b6fb3 ↗

    7. deriv_prod_eval have ∀ (S : Finset ℕ) (x : ℕ → ℚ) (z : ℚ), Polynomial.eval z ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) (∏ i ∈ S, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = ∑ l ∈ S, ∏ i ∈ S.erase l, (z - x i)

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with deriv_prod_eval : ∀ (S : Finset ℕ) (x : ℕ → ℚ) (z : ℚ), Polynomial.eval z ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) (∏ i ∈ S, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = ∑ l ∈ S, ∏ i ∈ S.erase l, (z - x i).

      Uses library Finset Finset α is the type of finite sets of elements of α. , Polynomial.derivative derivative p is the formal derivative of the polynomial p , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , Polynomial.derivative_prod_finset, Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod .

      Lean, lines 163–168
        have deriv_prod_eval : ∀ (S : Finset ℕ) (x : ℕ → ℚ) (z : ℚ),
            (derivative (∏ i ∈ S, (X - C (x i)))).eval z = ∑ l ∈ S, ∏ i ∈ S.erase l, (z - x i) := by
          intro S x z
          rw [Polynomial.derivative_prod_finset, Polynomial.eval_finset_sum]
          refine Finset.sum_congr rfl (fun l _ => ?_)
          simp [Polynomial.eval_prod]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 163–168 at 2987e49b6fb3 ↗

    8. deriv_prod_eval_node have ∀ (S : Finset ℕ) (x : ℕ → ℚ), ∀ k ∈ S, Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) (∏ i ∈ S, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = ∏ i ∈ S.erase k, (x k - x i)

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with deriv_prod_eval_node : ∀ (S : Finset ℕ) (x : ℕ → ℚ), ∀ k ∈ S, Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) (∏ i ∈ S, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = ∏ i ∈ S.erase k, (x k - x i).

      Uses library Finset Finset α is the type of finite sets of elements of α. , Polynomial.derivative derivative p is the formal derivative of the polynomial p , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , Finset.sum_eq_single.

      Lean, lines 170–176
        have deriv_prod_eval_node : ∀ (S : Finset ℕ) (x : ℕ → ℚ) (k : ℕ) (hk : k ∈ S),
            (derivative (∏ i ∈ S, (X - C (x i)))).eval (x k) = ∏ i ∈ S.erase k, (x k - x i) := by
          intro S x k hk
          rw [deriv_prod_eval, Finset.sum_eq_single k]
          · intro l hl hlk
            exact Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hlk, hk⟩) (by ring)
          · intro h; exact absurd hk h

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 170–176 at 2987e49b6fb3 ↗

      1. deriv_prod_eval_node.s1 case

        Leaves ∀ b ∈ S, b ≠ k → ∏ i ∈ S.erase b, (x k - x i) = (0 : ℚ).

        Uses library Finset.prod_eq_zero, Finset.mem_erase, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , Ne.symm.

        Lean, lines 174–175
            · intro l hl hlk
              exact Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hlk, hk⟩) (by ring)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 174–175 at 2987e49b6fb3 ↗

      2. deriv_prod_eval_node.s2 case

        Leaves k ∉ S → ∏ i ∈ S.erase k, (x k - x i) = (0 : ℚ).

        Uses library absurd Anything follows from two contradictory hypotheses. .

        Lean, line 176
            · intro h; exact absurd hk h

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 176 at 2987e49b6fb3 ↗

    9. lagr_deriv have ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → ∀ k ≤ n, Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, r j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) + r k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i)

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with lagr_deriv : ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → ∀ k ≤ n, Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, r j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) + r k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i).

      Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.derivative derivative p is the formal derivative of the polynomial p , Polynomial.derivative_sum, Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Finset.add_sum_erase Taking a sum over s : Finset ι is the same as adding the value on a single element f a to the sum over s.erase a. , add_comm.

      Lean, lines 178–194
        have lagr_deriv : ∀ (n : ℕ) (x : ℕ → ℚ) (hx : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j)
          (N : ℚ[X]) (hNdeg : N.degree ≤ n) (r : ℕ → ℚ)
          (hr : ∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j))
          (k : ℕ) (hk : k ≤ n),
            (derivative N).eval (x k) =
              ∑ j ∈ (Finset.range (n + 1)).erase k, r j * ∏ i ∈ ((Finset.range (n + 1)).erase j).erase k, (x k - x i) +
              r k * ∑ l ∈ (Finset.range (n + 1)).erase k, ∏ i ∈ ((Finset.range (n + 1)).erase k).erase l, (x k - x i) := by
          intro n x hx N hNdeg r hr k hk
          have hkmem : k ∈ Finset.range (n + 1) := Finset.mem_range.mpr (by omega)
          conv_lhs => rw [lagr_eval n x hx N hNdeg r hr]
          rw [Polynomial.derivative_sum, Polynomial.eval_finset_sum, ← Finset.add_sum_erase _ _ hkmem, add_comm]
          congr 1
          · refine Finset.sum_congr rfl (fun j hj => ?_)
            have hjk : j ≠ k := Finset.ne_of_mem_erase hj
            rw [Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C,
              deriv_prod_eval_node _ x k (Finset.mem_erase.mpr ⟨Ne.symm hjk, hkmem⟩)]
          · rw [Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C, deriv_prod_eval]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 178–194 at 2987e49b6fb3 ↗

      1. lagr_deriv.hkmem have k ∈ Finset.range (n + (1 : ℕ))

        Leaves Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, r j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) + r k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i), with hkmem : k ∈ Finset.range (n + (1 : ℕ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.mem_range.

        Lean, line 186
            have hkmem : k ∈ Finset.range (n + 1) := Finset.mem_range.mpr (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 186 at 2987e49b6fb3 ↗

      2. lagr_deriv.s2 case

        Leaves ∑ x_1 ∈ (Finset.range (n + (1 : ℕ))).erase k, Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) ((Polynomial.C : ℚ → Polynomial ℚ) (r x_1) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase x_1, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, r j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i).

        Uses library Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C, Finset.mem_erase, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , Ne.symm.

        Lean, lines 190–193
            · refine Finset.sum_congr rfl (fun j hj => ?_)
              have hjk : j ≠ k := Finset.ne_of_mem_erase hj
              rw [Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C,
                deriv_prod_eval_node _ x k (Finset.mem_erase.mpr ⟨Ne.symm hjk, hkmem⟩)]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 190–193 at 2987e49b6fb3 ↗

        1. lagr_deriv.s2.hjk have j ≠ k

          Leaves Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) ((Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = r j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i), with hjk : j ≠ k.

          Uses library Finset.ne_of_mem_erase.

          Lean, line 191
                have hjk : j ≠ k := Finset.ne_of_mem_erase hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 191 at 2987e49b6fb3 ↗

      3. lagr_deriv.s3 case

        Leaves Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) ((Polynomial.C : ℚ → Polynomial ℚ) (r k) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))) = r k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i).

        Uses library Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C.

        Lean, line 194
            · rw [Polynomial.derivative_C_mul, Polynomial.eval_mul, Polynomial.eval_C, deriv_prod_eval]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 194 at 2987e49b6fb3 ↗

    10. formula3 have ∀ (n k : ℕ), k ≤ n → ∀ (Qc : ℕ → ℕ → ℚ), (∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) → ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with formula3 : ∀ (n k : ℕ), k ≤ n → ∀ (Qc : ℕ → ℕ → ℚ), (∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) → ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.sum_union, Finset.sum_range_succ, Nat.sub_self, pow_zero, sub_self, div_zero, add_zero.

      Lean, lines 196–307
        have formula3 : ∀ (n k : ℕ) (hk : k ≤ n) (Qc : ℕ → ℕ → ℚ)
          (hQc : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
            ∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K)),
            ∑ j ∈ Finset.range (k + 1), Qc n j / ((2 : ℚ) ^ (k - j) - 1) =
              Qc n k * 2 ^ k * (∑ K ∈ Finset.Ioc n (2 * n), 1 / ((2 : ℚ) ^ k - 2 ^ K) -
                ∑ i ∈ (Finset.range (n + 1)).erase k, 1 / ((2 : ℚ) ^ k - 2 ^ i)) -
              ∑ j ∈ Finset.Ioc k n, Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
          intro n k hk Qc hQc
          set x : ℕ → ℚ := fun i => (2 : ℚ) ^ i with hxdef
          have hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j := by
            intro i _ j _ h
            have h' : (2 : ℚ) ^ i = 2 ^ j := h
            exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast h')
          have hxne : ∀ a b : ℕ, a ≠ b → (2 : ℚ) ^ a - 2 ^ b ≠ 0 := by
            intro a b hab h
            apply hab
            exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast (sub_eq_zero.mp h))
          set S := (Finset.range (n + 1)).erase k with hS
          set T := Finset.Ioc n (2 * n) with hT
          set N : ℚ[X] := ∏ K ∈ T, (X - C ((2 : ℚ) ^ K)) with hN
          have hNdeg : N.degree ≤ n := by
            rw [hN, Polynomial.degree_prod]
            rw [Finset.sum_congr rfl (fun K _ => Polynomial.degree_X_sub_C ((2 : ℚ) ^ K)), Finset.sum_const, hT,
              Nat.card_Ioc]
            simp
            omega
          have hkmem : k ∈ Finset.range (n + 1) := Finset.mem_range.mpr (by omega)
          have hr : ∀ j ≤ n, (Qc n j * 2 ^ j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j) := by
            intro j hj
            rw [hN, Polynomial.eval_prod]
            simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, hxdef]
            exact hQc j hj
          have hD := lagr_deriv n x hxinj N hNdeg (fun j => Qc n j * 2 ^ j) hr k hk
          have hD2 : (derivative N).eval (x k) = ∑ K ∈ T, ∏ a ∈ T.erase K, (x k - 2 ^ a) := by
            rw [hN, deriv_prod_eval]
          set P := ∏ i ∈ S, (x k - x i) with hP
          have hPne : P ≠ 0 := by
            rw [hP]
            refine Finset.prod_ne_zero_iff.mpr (fun i hi => hxne k i (Ne.symm (Finset.ne_of_mem_erase hi)))
          have hNk : N.eval (x k) = (Qc n k * 2 ^ k) * P := by
            rw [← hr k hk]
          have hNk' : N.eval (x k) = ∏ K ∈ T, (x k - 2 ^ K) := by
            rw [hN, Polynomial.eval_prod]
            simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C]
          -- (a)
          have ha : ∀ j ∈ S, ∏ i ∈ ((Finset.range (n + 1)).erase j).erase k, (x k - x i) = P / (x k - x j) := by
            intro j hj
            have hne : x k - x j ≠ 0 := hxne k j (Ne.symm (Finset.ne_of_mem_erase hj))
            rw [Finset.erase_right_comm, eq_div_iff hne, mul_comm, hP, Finset.mul_prod_erase S (fun i => x k - x i) hj]
          have hb : ∀ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = P / (x k - x l) := by
            intro l hl
            have hne : x k - x l ≠ 0 := hxne k l (Ne.symm (Finset.ne_of_mem_erase hl))
            rw [eq_div_iff hne, mul_comm, hP, Finset.mul_prod_erase S (fun i => x k - x i) hl]
          have hc : ∀ K ∈ T, ∏ a ∈ T.erase K, (x k - 2 ^ a) = N.eval (x k) / (x k - 2 ^ K) := by
            intro K hK
            have hKn : n < K := (Finset.mem_Ioc.mp hK).1
            have hne : x k - 2 ^ K ≠ 0 := hxne k K (by omega)
            rw [eq_div_iff hne, mul_comm, hNk', Finset.mul_prod_erase T (fun a => x k - 2 ^ a) hK]
          rw [← hS] at hD
          rw [hD2, Finset.sum_congr rfl hc] at hD
          have hD3 : ∑ j ∈ S, Qc n j * 2 ^ j * ∏ i ∈ ((Finset.range (n + 1)).erase j).erase k, (x k - x i) =
              ∑ j ∈ S, Qc n j * 2 ^ j * (P / (x k - x j)) :=
            Finset.sum_congr rfl (fun j hj => by rw [ha j hj])
          have hD4 : ∑ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = ∑ l ∈ S, P / (x k - x l) :=
            Finset.sum_congr rfl hb
          rw [hD3, hD4, hNk] at hD
          -- key: sum over S of r_j / (x k - x j) = r_k * beta
          have key : ∑ j ∈ S, (Qc n j * 2 ^ j) / (x k - x j) =
              (Qc n k * 2 ^ k) * (∑ K ∈ T, 1 / (x k - 2 ^ K) - ∑ i ∈ S, 1 / (x k - x i)) := by
            have e1 : ∑ K ∈ T, Qc n k * 2 ^ k * P / (x k - 2 ^ K) = P * ((Qc n k * 2 ^ k) * ∑ K ∈ T, 1 / (x k - 2 ^ K)) := by
              rw [Finset.mul_sum, Finset.mul_sum]; refine Finset.sum_congr rfl (fun K _ => by ring)
            have e2 : ∑ j ∈ S, Qc n j * 2 ^ j * (P / (x k - x j)) = P * ∑ j ∈ S, (Qc n j * 2 ^ j) / (x k - x j) := by
              rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)
            have e3 : ∑ l ∈ S, P / (x k - x l) = P * ∑ i ∈ S, 1 / (x k - x i) := by
              rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)
            rw [e1, e2, e3] at hD
            apply mul_left_cancel₀ hPne
            linear_combination -hD
          -- split S into range k and Ioc k n
          have hsplit : S = Finset.range k ∪ Finset.Ioc k n := by
            rw [hS]; ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega
          have hdisj : Disjoint (Finset.range k) (Finset.Ioc k n) := by
            rw [Finset.disjoint_left]; intro a ha ha'
            simp only [Finset.mem_range, Finset.mem_Ioc] at ha ha'; omega
          rw [hsplit, Finset.sum_union hdisj] at key
          have hlow : ∀ j ∈ Finset.range k, (Qc n j * 2 ^ j) / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - 1) := by
            intro j hj
            have hjk : j < k := Finset.mem_range.mp hj
            have hne : (2 : ℚ) ^ (k - j) - 1 ≠ 0 := by
              have : (1 : ℚ) < 2 ^ (k - j) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)
            simp only [hxdef]
            rw [div_eq_div_iff hne2 hne, show k = j + (k - j) by omega, pow_add]
            simp only [show j + (k - j) - j = k - j by omega]
            ring
          have hhigh : ∀ j ∈ Finset.Ioc k n, (Qc n j * 2 ^ j) / (x k - x j) = Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
            intro j hj
            have hkj : k < j := (Finset.mem_Ioc.mp hj).1
            have hne : (1 : ℚ) - 2 ^ (j - k) ≠ 0 := by
              have : (1 : ℚ) < 2 ^ (j - k) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)
            simp only [hxdef]
            rw [div_eq_div_iff hne2 hne, show j = k + (j - k) by omega, pow_add]
            simp only [show k + (j - k) - k = j - k by omega]
            ring
          rw [Finset.sum_congr rfl hlow, Finset.sum_congr rfl hhigh] at key
          rw [Finset.sum_range_succ, Nat.sub_self, pow_zero, sub_self, div_zero, add_zero]
          simp only [hxdef] at key
          rw [← hsplit] at key
          linear_combination key

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 196–307 at 2987e49b6fb3 ↗

      1. formula3.hxinj have ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j.

        Uses library Nat.pow_right_injective, le_refl The relation ≤ on a preorder is reflexive. .

        Lean, lines 205–208
            have hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j := by
              intro i _ j _ h
              have h' : (2 : ℚ) ^ i = 2 ^ j := h
              exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast h')

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 205–208 at 2987e49b6fb3 ↗

        1. formula3.hxinj.h' have (2 : ℚ) ^ i = (2 : ℚ) ^ j

          Leaves i = j, with h' : (2 : ℚ) ^ i = (2 : ℚ) ^ j.

          Lean, line 207
                have h' : (2 : ℚ) ^ i = 2 ^ j := h

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 207 at 2987e49b6fb3 ↗

      2. formula3.hxne have ∀ (a b : ℕ), a ≠ b → (2 : ℚ) ^ a - (2 : ℚ) ^ b ≠ (0 : ℚ)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hxne : ∀ (a b : ℕ), a ≠ b → (2 : ℚ) ^ a - (2 : ℚ) ^ b ≠ (0 : ℚ).

        Uses library Nat.pow_right_injective, le_refl The relation ≤ on a preorder is reflexive. , sub_eq_zero.

        Lean, lines 209–212
            have hxne : ∀ a b : ℕ, a ≠ b → (2 : ℚ) ^ a - 2 ^ b ≠ 0 := by
              intro a b hab h
              apply hab
              exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast (sub_eq_zero.mp h))

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 209–212 at 2987e49b6fb3 ↗

      3. formula3.hNdeg have N.degree ≤ (↑n : WithBot ℕ)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hNdeg : N.degree ≤ (↑n : WithBot ℕ).

        Uses library Polynomial.degree_prod The degree of a product of polynomials is equal to the sum of the degrees, where the degree of the zero polynomial is ⊥. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.degree_X_sub_C, Finset.sum_const, Nat.card_Ioc.

        Lean, lines 216–221
            have hNdeg : N.degree ≤ n := by
              rw [hN, Polynomial.degree_prod]
              rw [Finset.sum_congr rfl (fun K _ => Polynomial.degree_X_sub_C ((2 : ℚ) ^ K)), Finset.sum_const, hT,
                Nat.card_Ioc]
              simp
              omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 216–221 at 2987e49b6fb3 ↗

      4. formula3.hkmem have k ∈ Finset.range (n + (1 : ℕ))

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hkmem : k ∈ Finset.range (n + (1 : ℕ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.mem_range.

        Lean, line 222
            have hkmem : k ∈ Finset.range (n + 1) := Finset.mem_range.mpr (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 222 at 2987e49b6fb3 ↗

      5. formula3.hr have ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hr : ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N.

        Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C.

        Lean, lines 223–227
            have hr : ∀ j ≤ n, (Qc n j * 2 ^ j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j) := by
              intro j hj
              rw [hN, Polynomial.eval_prod]
              simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, hxdef]
              exact hQc j hj

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 223–227 at 2987e49b6fb3 ↗

      6. formula3.hD have Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) + Qc n k * (2 : ℚ) ^ k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hD : Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ j ∈ (Finset.range (n + (1 : ℕ))).erase k, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) + Qc n k * (2 : ℚ) ^ k * ∑ l ∈ (Finset.range (n + (1 : ℕ))).erase k, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase k).erase l, (x k - x i).

        Lean, line 228
            have hD := lagr_deriv n x hxinj N hNdeg (fun j => Qc n j * 2 ^ j) hr k hk

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 228 at 2987e49b6fb3 ↗

      7. formula3.hD2 have Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ K ∈ T, ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hD2 : Polynomial.eval (x k) ((Polynomial.derivative : Polynomial ℚ → Polynomial ℚ) N) = ∑ K ∈ T, ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a).

        Uses library Polynomial.derivative derivative p is the formal derivative of the polynomial p .

        Lean, lines 229–230
            have hD2 : (derivative N).eval (x k) = ∑ K ∈ T, ∏ a ∈ T.erase K, (x k - 2 ^ a) := by
              rw [hN, deriv_prod_eval]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 229–230 at 2987e49b6fb3 ↗

      8. formula3.hPne have P ≠ (0 : ℚ)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hPne : P ≠ (0 : ℚ).

        Uses library Finset.prod_ne_zero_iff, Ne.symm, Finset.ne_of_mem_erase.

        Lean, lines 232–234
            have hPne : P ≠ 0 := by
              rw [hP]
              refine Finset.prod_ne_zero_iff.mpr (fun i hi => hxne k i (Ne.symm (Finset.ne_of_mem_erase hi)))

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 232–234 at 2987e49b6fb3 ↗

      9. formula3.hNk have Polynomial.eval (x k) N = Qc n k * (2 : ℚ) ^ k * P

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hNk : Polynomial.eval (x k) N = Qc n k * (2 : ℚ) ^ k * P.

        Lean, lines 235–236
            have hNk : N.eval (x k) = (Qc n k * 2 ^ k) * P := by
              rw [← hr k hk]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 235–236 at 2987e49b6fb3 ↗

      10. formula3.hNk' have Polynomial.eval (x k) N = ∏ K ∈ T, (x k - (2 : ℚ) ^ K)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hNk' : Polynomial.eval (x k) N = ∏ K ∈ T, (x k - (2 : ℚ) ^ K).

        Uses library Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C.

        Lean, lines 237–239
            have hNk' : N.eval (x k) = ∏ K ∈ T, (x k - 2 ^ K) := by
              rw [hN, Polynomial.eval_prod]
              simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 237–239 at 2987e49b6fb3 ↗

      11. formula3.ha have ∀ j ∈ S, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) = P / (x k - x j)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with ha : ∀ j ∈ S, ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) = P / (x k - x j).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.erase_right_comm, eq_div_iff, mul_comm, Finset.mul_prod_erase Taking a product over s : Finset ι is the same as multiplying the value on a single element f a by the product of s.erase a. .

        Lean, lines 241–244
            have ha : ∀ j ∈ S, ∏ i ∈ ((Finset.range (n + 1)).erase j).erase k, (x k - x i) = P / (x k - x j) := by
              intro j hj
              have hne : x k - x j ≠ 0 := hxne k j (Ne.symm (Finset.ne_of_mem_erase hj))
              rw [Finset.erase_right_comm, eq_div_iff hne, mul_comm, hP, Finset.mul_prod_erase S (fun i => x k - x i) hj]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 241–244 at 2987e49b6fb3 ↗

        1. formula3.ha.hne have x k - x j ≠ (0 : ℚ)

          Leaves ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) = P / (x k - x j), with hne : x k - x j ≠ (0 : ℚ).

          Uses library Ne.symm, Finset.ne_of_mem_erase.

          Lean, line 243
                have hne : x k - x j ≠ 0 := hxne k j (Ne.symm (Finset.ne_of_mem_erase hj))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 243 at 2987e49b6fb3 ↗

      12. formula3.hb have ∀ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = P / (x k - x l)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hb : ∀ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = P / (x k - x l).

        Uses library eq_div_iff, mul_comm, Finset.mul_prod_erase Taking a product over s : Finset ι is the same as multiplying the value on a single element f a by the product of s.erase a. .

        Lean, lines 245–248
            have hb : ∀ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = P / (x k - x l) := by
              intro l hl
              have hne : x k - x l ≠ 0 := hxne k l (Ne.symm (Finset.ne_of_mem_erase hl))
              rw [eq_div_iff hne, mul_comm, hP, Finset.mul_prod_erase S (fun i => x k - x i) hl]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 245–248 at 2987e49b6fb3 ↗

        1. formula3.hb.hne have x k - x l ≠ (0 : ℚ)

          Leaves ∏ i ∈ S.erase l, (x k - x i) = P / (x k - x l), with hne : x k - x l ≠ (0 : ℚ).

          Uses library Ne.symm, Finset.ne_of_mem_erase.

          Lean, line 247
                have hne : x k - x l ≠ 0 := hxne k l (Ne.symm (Finset.ne_of_mem_erase hl))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 247 at 2987e49b6fb3 ↗

      13. formula3.hc have ∀ K ∈ T, ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a) = Polynomial.eval (x k) N / (x k - (2 : ℚ) ^ K)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hc : ∀ K ∈ T, ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a) = Polynomial.eval (x k) N / (x k - (2 : ℚ) ^ K).

        Uses library eq_div_iff, mul_comm, Finset.mul_prod_erase Taking a product over s : Finset ι is the same as multiplying the value on a single element f a by the product of s.erase a. .

        Lean, lines 249–253
            have hc : ∀ K ∈ T, ∏ a ∈ T.erase K, (x k - 2 ^ a) = N.eval (x k) / (x k - 2 ^ K) := by
              intro K hK
              have hKn : n < K := (Finset.mem_Ioc.mp hK).1
              have hne : x k - 2 ^ K ≠ 0 := hxne k K (by omega)
              rw [eq_div_iff hne, mul_comm, hNk', Finset.mul_prod_erase T (fun a => x k - 2 ^ a) hK]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 249–253 at 2987e49b6fb3 ↗

        1. formula3.hc.hKn have n < K

          Leaves ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a) = Polynomial.eval (x k) N / (x k - (2 : ℚ) ^ K), with hKn : n < K.

          Uses library Finset.mem_Ioc.

          Lean, line 251
                have hKn : n < K := (Finset.mem_Ioc.mp hK).1

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 251 at 2987e49b6fb3 ↗

        2. formula3.hc.hne have x k - (2 : ℚ) ^ K ≠ (0 : ℚ)

          Leaves ∏ a ∈ T.erase K, (x k - (2 : ℚ) ^ a) = Polynomial.eval (x k) N / (x k - (2 : ℚ) ^ K), with hne : x k - (2 : ℚ) ^ K ≠ (0 : ℚ).

          Lean, line 252
                have hne : x k - 2 ^ K ≠ 0 := hxne k K (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 252 at 2987e49b6fb3 ↗

      14. formula3.hD3 have ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) = ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * (P / (x k - x j))

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hD3 : ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ ((Finset.range (n + (1 : ℕ))).erase j).erase k, (x k - x i) = ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * (P / (x k - x j)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

        Lean, lines 256–258
            have hD3 : ∑ j ∈ S, Qc n j * 2 ^ j * ∏ i ∈ ((Finset.range (n + 1)).erase j).erase k, (x k - x i) =
                ∑ j ∈ S, Qc n j * 2 ^ j * (P / (x k - x j)) :=
              Finset.sum_congr rfl (fun j hj => by rw [ha j hj])

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 256–258 at 2987e49b6fb3 ↗

      15. formula3.hD4 have ∑ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = ∑ l ∈ S, P / (x k - x l)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hD4 : ∑ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = ∑ l ∈ S, P / (x k - x l).

        Uses library Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

        Lean, lines 259–260
            have hD4 : ∑ l ∈ S, ∏ i ∈ S.erase l, (x k - x i) = ∑ l ∈ S, P / (x k - x l) :=
              Finset.sum_congr rfl hb

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 259–260 at 2987e49b6fb3 ↗

      16. formula3.key have ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / (x k - x i))

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with key : ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / (x k - x i)).

        Uses library mul_left_cancel₀.

        Lean, lines 263–273
            have key : ∑ j ∈ S, (Qc n j * 2 ^ j) / (x k - x j) =
                (Qc n k * 2 ^ k) * (∑ K ∈ T, 1 / (x k - 2 ^ K) - ∑ i ∈ S, 1 / (x k - x i)) := by
              have e1 : ∑ K ∈ T, Qc n k * 2 ^ k * P / (x k - 2 ^ K) = P * ((Qc n k * 2 ^ k) * ∑ K ∈ T, 1 / (x k - 2 ^ K)) := by
                rw [Finset.mul_sum, Finset.mul_sum]; refine Finset.sum_congr rfl (fun K _ => by ring)
              have e2 : ∑ j ∈ S, Qc n j * 2 ^ j * (P / (x k - x j)) = P * ∑ j ∈ S, (Qc n j * 2 ^ j) / (x k - x j) := by
                rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)
              have e3 : ∑ l ∈ S, P / (x k - x l) = P * ∑ i ∈ S, 1 / (x k - x i) := by
                rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)
              rw [e1, e2, e3] at hD
              apply mul_left_cancel₀ hPne
              linear_combination -hD

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 263–273 at 2987e49b6fb3 ↗

        1. formula3.key.e1 have ∑ K ∈ T, Qc n k * (2 : ℚ) ^ k * P / (x k - (2 : ℚ) ^ K) = P * (Qc n k * (2 : ℚ) ^ k * ∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K))

          Leaves ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / (x k - x i)), with e1 : ∑ K ∈ T, Qc n k * (2 : ℚ) ^ k * P / (x k - (2 : ℚ) ^ K) = P * (Qc n k * (2 : ℚ) ^ k * ∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K)).

          Uses library Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, lines 265–266
                have e1 : ∑ K ∈ T, Qc n k * 2 ^ k * P / (x k - 2 ^ K) = P * ((Qc n k * 2 ^ k) * ∑ K ∈ T, 1 / (x k - 2 ^ K)) := by
                  rw [Finset.mul_sum, Finset.mul_sum]; refine Finset.sum_congr rfl (fun K _ => by ring)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 265–266 at 2987e49b6fb3 ↗

        2. formula3.key.e2 have ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * (P / (x k - x j)) = P * ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j)

          Leaves ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / (x k - x i)), with e2 : ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j * (P / (x k - x j)) = P * ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j).

          Uses library Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, lines 267–268
                have e2 : ∑ j ∈ S, Qc n j * 2 ^ j * (P / (x k - x j)) = P * ∑ j ∈ S, (Qc n j * 2 ^ j) / (x k - x j) := by
                  rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 267–268 at 2987e49b6fb3 ↗

        3. formula3.key.e3 have ∑ l ∈ S, P / (x k - x l) = P * ∑ i ∈ S, (1 : ℚ) / (x k - x i)

          Leaves ∑ j ∈ S, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / (x k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / (x k - x i)), with e3 : ∑ l ∈ S, P / (x k - x l) = P * ∑ i ∈ S, (1 : ℚ) / (x k - x i).

          Uses library Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, lines 269–270
                have e3 : ∑ l ∈ S, P / (x k - x l) = P * ∑ i ∈ S, 1 / (x k - x i) := by
                  rw [Finset.mul_sum]; refine Finset.sum_congr rfl (fun j _ => by ring)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 269–270 at 2987e49b6fb3 ↗

      17. formula3.hsplit have S = Finset.range k ∪ Finset.Ioc k n

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hsplit : S = Finset.range k ∪ Finset.Ioc k n.

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc.

        Lean, lines 275–276
            have hsplit : S = Finset.range k ∪ Finset.Ioc k n := by
              rw [hS]; ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 275–276 at 2987e49b6fb3 ↗

      18. formula3.hdisj have Disjoint (Finset.range k) (Finset.Ioc k n)

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hdisj : Disjoint (Finset.range k) (Finset.Ioc k n).

        Uses library Disjoint Two elements of a lattice are disjoint if their inf is the bottom element. , Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.disjoint_left, Finset.mem_range, Finset.mem_Ioc.

        Lean, lines 277–279
            have hdisj : Disjoint (Finset.range k) (Finset.Ioc k n) := by
              rw [Finset.disjoint_left]; intro a ha ha'
              simp only [Finset.mem_range, Finset.mem_Ioc] at ha ha'; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 277–279 at 2987e49b6fb3 ↗

      19. formula3.hlow have ∀ j ∈ Finset.range k, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hlow : ∀ j ∈ Finset.range k, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , div_eq_div_iff, pow_add.

        Lean, lines 281–291
            have hlow : ∀ j ∈ Finset.range k, (Qc n j * 2 ^ j) / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - 1) := by
              intro j hj
              have hjk : j < k := Finset.mem_range.mp hj
              have hne : (2 : ℚ) ^ (k - j) - 1 ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (k - j) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)
              simp only [hxdef]
              rw [div_eq_div_iff hne2 hne, show k = j + (k - j) by omega, pow_add]
              simp only [show j + (k - j) - j = k - j by omega]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 281–291 at 2987e49b6fb3 ↗

        1. formula3.hlow.hjk have j < k

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hjk : j < k.

          Uses library Finset.mem_range.

          Lean, line 283
                have hjk : j < k := Finset.mem_range.mp hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 283 at 2987e49b6fb3 ↗

        2. formula3.hlow.hne have (2 : ℚ) ^ (k - j) - (1 : ℚ) ≠ (0 : ℚ)

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hne : (2 : ℚ) ^ (k - j) - (1 : ℚ) ≠ (0 : ℚ).

          Lean, lines 284–286
                have hne : (2 : ℚ) ^ (k - j) - 1 ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (k - j) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 284–286 at 2987e49b6fb3 ↗

          1. formula3.hlow.hne.this have (1 : ℚ) < (2 : ℚ) ^ (k - j)

            Leaves (2 : ℚ) ^ (k - j) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (k - j).

            Uses library one_lt_pow₀.

            Lean, line 285
                    have : (1 : ℚ) < 2 ^ (k - j) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 285 at 2987e49b6fb3 ↗

        3. formula3.hlow.hne2 have (2 : ℚ) ^ k - (2 : ℚ) ^ j ≠ (0 : ℚ)

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hne2 : (2 : ℚ) ^ k - (2 : ℚ) ^ j ≠ (0 : ℚ).

          Lean, line 287
                have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 287 at 2987e49b6fb3 ↗

      20. formula3.hhigh have ∀ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))

        Leaves ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ T, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ S, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hhigh : ∀ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , div_eq_div_iff, pow_add.

        Lean, lines 292–302
            have hhigh : ∀ j ∈ Finset.Ioc k n, (Qc n j * 2 ^ j) / (x k - x j) = Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
              intro j hj
              have hkj : k < j := (Finset.mem_Ioc.mp hj).1
              have hne : (1 : ℚ) - 2 ^ (j - k) ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (j - k) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)
              simp only [hxdef]
              rw [div_eq_div_iff hne2 hne, show j = k + (j - k) by omega, pow_add]
              simp only [show k + (j - k) - k = j - k by omega]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 292–302 at 2987e49b6fb3 ↗

        1. formula3.hhigh.hkj have k < j

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hkj : k < j.

          Uses library Finset.mem_Ioc.

          Lean, line 294
                have hkj : k < j := (Finset.mem_Ioc.mp hj).1

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 294 at 2987e49b6fb3 ↗

        2. formula3.hhigh.hne have (1 : ℚ) - (2 : ℚ) ^ (j - k) ≠ (0 : ℚ)

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hne : (1 : ℚ) - (2 : ℚ) ^ (j - k) ≠ (0 : ℚ).

          Lean, lines 295–297
                have hne : (1 : ℚ) - 2 ^ (j - k) ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (j - k) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 295–297 at 2987e49b6fb3 ↗

          1. formula3.hhigh.hne.this have (1 : ℚ) < (2 : ℚ) ^ (j - k)

            Leaves (1 : ℚ) - (2 : ℚ) ^ (j - k) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (j - k).

            Uses library one_lt_pow₀.

            Lean, line 296
                    have : (1 : ℚ) < 2 ^ (j - k) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 296 at 2987e49b6fb3 ↗

        3. formula3.hhigh.hne2 have (2 : ℚ) ^ k - (2 : ℚ) ^ j ≠ (0 : ℚ)

          Leaves Qc n j * (2 : ℚ) ^ j / (x k - x j) = Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)), with hne2 : (2 : ℚ) ^ k - (2 : ℚ) ^ j ≠ (0 : ℚ).

          Lean, line 298
                have hne2 : (2 : ℚ) ^ k - 2 ^ j ≠ 0 := hxne k j (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 298 at 2987e49b6fb3 ↗

    11. hform have ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (n k : ℕ), k ≤ n → ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hform : ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (n k : ℕ), k ≤ n → ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

      Lean, lines 308–319
        have hform : ∀ (Qc : ℕ → ℕ → ℚ),
          (Qc = fun (n k : ℕ) =>
              ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                  ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) →
          ∀ (n k : ℕ), k ≤ n →
            ∑ j ∈ Finset.range (k + 1), Qc n j / ((2 : ℚ) ^ (k - j) - 1) =
              Qc n k * 2 ^ k * (∑ K ∈ Finset.Ioc n (2 * n), 1 / ((2 : ℚ) ^ k - 2 ^ K) -
                ∑ i ∈ (Finset.range (n + 1)).erase k, 1 / ((2 : ℚ) ^ k - 2 ^ i)) -
              ∑ j ∈ Finset.Ioc k n, Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
          intro Qc hQc n k hk
          exact formula3 n k hk Qc (fun j hj => by subst hQc; exact id1_full n j hj)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 308–319 at 2987e49b6fb3 ↗

    12. gauss have ∀ (n k : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with gauss : ∀ (n k : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. .

      Lean, lines 321–380
        have gauss : ∀ n k : ℕ,
            ∃ z : ℤ, (z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1) := by
          intro n k
          have hD : ∀ j : ℕ, ((2 : ℚ) ^ (j + 1) - 1) ≠ 0 := by
            intro j
            have h1 : (1 : ℚ) < 2 ^ (j + 1) := one_lt_pow₀ (by norm_num) (by omega)
            exact ne_of_gt (sub_pos.mpr h1)
          have hDk : ∀ k : ℕ, (∏ i ∈ Finset.range k, ((2 : ℚ) ^ (i + 1) - 1)) ≠ 0 := by
            intro k
            exact Finset.prod_ne_zero_iff.mpr (fun i _ => hD i)
          have key : ∀ m j : ℕ,
              (∏ i ∈ Finset.range (j + 1), ((2 : ℚ) ^ (m + 1 - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) =
                (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) +
                2 ^ (j + 1) *
                  ∏ i ∈ Finset.range (j + 1), ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1) := by
            intro m j
            simp only [Finset.prod_div_distrib]
            rw [Finset.prod_range_succ' (fun i => (2 : ℚ) ^ (m + 1 - i) - 1)]
            have hshift : ∀ i : ℕ, m + 1 - (i + 1) = m - i := fun i => by omega
            simp only [hshift, Nat.sub_zero]
            rw [Finset.prod_range_succ (fun i => (2 : ℚ) ^ (m - i) - 1),
              Finset.prod_range_succ (fun i => (2 : ℚ) ^ (i + 1) - 1)]
            have hDj := hDk j
            have hj := hD j
            by_cases hjm : j ≤ m
            · have e : (2 : ℚ) ^ (m + 1) = 2 ^ (m - j) * 2 ^ (j + 1) := by
                rw [← pow_add]
                congr 1
                omega
              rw [e]
              field_simp
              ring
            · have hz : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1)) = 0 :=
                Finset.prod_eq_zero (i := m) (Finset.mem_range.mpr (by omega)) (by simp)
              rw [hz]
              simp
          have main : ∀ m j : ℕ, ∃ z : ℤ,
              (z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1) := by
            intro m
            induction m with
            | zero =>
              intro j
              cases j with
              | zero => exact ⟨1, by simp⟩
              | succ j =>
                refine ⟨0, ?_⟩
                rw [Finset.prod_eq_zero (i := 0) (by simp) (by simp)]
                simp
            | succ m ih =>
              intro j
              cases j with
              | zero => exact ⟨1, by simp⟩
              | succ j =>
                obtain ⟨a, ha⟩ := ih j
                obtain ⟨b, hb⟩ := ih (j + 1)
                refine ⟨a + 2 ^ (j + 1) * b, ?_⟩
                rw [key, ← ha, ← hb]
                push_cast
                ring
          exact main n k

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 321–380 at 2987e49b6fb3 ↗

      1. gauss.hD have ∀ (j : ℕ), (2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

        Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with hD : ∀ (j : ℕ), (2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

        Uses library ne_of_gt, sub_pos.

        Lean, lines 324–327
            have hD : ∀ j : ℕ, ((2 : ℚ) ^ (j + 1) - 1) ≠ 0 := by
              intro j
              have h1 : (1 : ℚ) < 2 ^ (j + 1) := one_lt_pow₀ (by norm_num) (by omega)
              exact ne_of_gt (sub_pos.mpr h1)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 324–327 at 2987e49b6fb3 ↗

        1. gauss.hD.h1 have (1 : ℚ) < (2 : ℚ) ^ (j + (1 : ℕ))

          Leaves (2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with h1 : (1 : ℚ) < (2 : ℚ) ^ (j + (1 : ℕ)).

          Uses library one_lt_pow₀.

          Lean, line 326
                have h1 : (1 : ℚ) < 2 ^ (j + 1) := one_lt_pow₀ (by norm_num) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 326 at 2987e49b6fb3 ↗

      2. gauss.hDk have ∀ (k : ℕ), ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ)

        Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with hDk : ∀ (k : ℕ), ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_ne_zero_iff.

        Lean, lines 328–330
            have hDk : ∀ k : ℕ, (∏ i ∈ Finset.range k, ((2 : ℚ) ^ (i + 1) - 1)) ≠ 0 := by
              intro k
              exact Finset.prod_ne_zero_iff.mpr (fun i _ => hD i)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 328–330 at 2987e49b6fb3 ↗

      3. gauss.key have ∀ (m j : ℕ), ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

        Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with key : ∀ (m j : ℕ), ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_div_distrib, Finset.prod_range_succ', Nat.sub_zero, Finset.prod_range_succ.

        Lean, lines 331–356
            have key : ∀ m j : ℕ,
                (∏ i ∈ Finset.range (j + 1), ((2 : ℚ) ^ (m + 1 - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) =
                  (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) +
                  2 ^ (j + 1) *
                    ∏ i ∈ Finset.range (j + 1), ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1) := by
              intro m j
              simp only [Finset.prod_div_distrib]
              rw [Finset.prod_range_succ' (fun i => (2 : ℚ) ^ (m + 1 - i) - 1)]
              have hshift : ∀ i : ℕ, m + 1 - (i + 1) = m - i := fun i => by omega
              simp only [hshift, Nat.sub_zero]
              rw [Finset.prod_range_succ (fun i => (2 : ℚ) ^ (m - i) - 1),
                Finset.prod_range_succ (fun i => (2 : ℚ) ^ (i + 1) - 1)]
              have hDj := hDk j
              have hj := hD j
              by_cases hjm : j ≤ m
              · have e : (2 : ℚ) ^ (m + 1) = 2 ^ (m - j) * 2 ^ (j + 1) := by
                  rw [← pow_add]
                  congr 1
                  omega
                rw [e]
                field_simp
                ring
              · have hz : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1)) = 0 :=
                  Finset.prod_eq_zero (i := m) (Finset.mem_range.mpr (by omega)) (by simp)
                rw [hz]
                simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 331–356 at 2987e49b6fb3 ↗

        1. gauss.key.hshift have ∀ (i : ℕ), m + (1 : ℕ) - (i + (1 : ℕ)) = m - i

          Leaves (∏ k ∈ Finset.range j, ((2 : ℚ) ^ (m + (1 : ℕ) - (k + (1 : ℕ))) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ) - (0 : ℕ)) - (1 : ℚ)) / ∏ x ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))), with hshift : ∀ (i : ℕ), m + (1 : ℕ) - (i + (1 : ℕ)) = m - i.

          Lean, line 339
                have hshift : ∀ i : ℕ, m + 1 - (i + 1) = m - i := fun i => by omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 339 at 2987e49b6fb3 ↗

        2. gauss.key.hDj have ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ)

          Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))), with hDj : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ).

          Lean, line 343
                have hDj := hDk j

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 343 at 2987e49b6fb3 ↗

        3. gauss.key.hj have (2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

          Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))), with hj : (2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

          Lean, line 344
                have hj := hD j

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 344 at 2987e49b6fb3 ↗

        4. gauss.key.s4 case

          Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))).

          Lean, lines 346–352
                · have e : (2 : ℚ) ^ (m + 1) = 2 ^ (m - j) * 2 ^ (j + 1) := by
                    rw [← pow_add]
                    congr 1
                    omega
                  rw [e]
                  field_simp
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 346–352 at 2987e49b6fb3 ↗

          1. gauss.key.s4.e have (2 : ℚ) ^ (m + (1 : ℕ)) = (2 : ℚ) ^ (m - j) * (2 : ℚ) ^ (j + (1 : ℕ))

            Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))), with e : (2 : ℚ) ^ (m + (1 : ℕ)) = (2 : ℚ) ^ (m - j) * (2 : ℚ) ^ (j + (1 : ℕ)).

            Uses library pow_add.

            Lean, lines 346–349
                  · have e : (2 : ℚ) ^ (m + 1) = 2 ^ (m - j) * 2 ^ (j + 1) := by
                      rw [← pow_add]
                      congr 1
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 346–349 at 2987e49b6fb3 ↗

        5. gauss.key.s5 case

          Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))).

          Lean, lines 353–356
                · have hz : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1)) = 0 :=
                    Finset.prod_eq_zero (i := m) (Finset.mem_range.mpr (by omega)) (by simp)
                  rw [hz]
                  simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 353–356 at 2987e49b6fb3 ↗

          1. gauss.key.s5.hz have ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) = (0 : ℚ)

            Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m + (1 : ℕ)) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ))) = (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) / ∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ)) + (2 : ℚ) ^ (j + (1 : ℕ)) * ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (m - x) - (1 : ℚ))) * ((2 : ℚ) ^ (m - j) - (1 : ℚ)) / ((∏ x ∈ Finset.range j, ((2 : ℚ) ^ (x + (1 : ℕ)) - (1 : ℚ))) * ((2 : ℚ) ^ (j + (1 : ℕ)) - (1 : ℚ)))), with hz : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) = (0 : ℚ).

            Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_eq_zero, Finset.mem_range.

            Lean, lines 353–354
                  · have hz : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1)) = 0 :=
                      Finset.prod_eq_zero (i := m) (Finset.mem_range.mpr (by omega)) (by simp)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 353–354 at 2987e49b6fb3 ↗

      4. gauss.main have ∀ (m j : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

        Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with main : ∀ (m j : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. .

        Lean, lines 357–379
            have main : ∀ m j : ℕ, ∃ z : ℤ,
                (z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1) := by
              intro m
              induction m with
              | zero =>
                intro j
                cases j with
                | zero => exact ⟨1, by simp⟩
                | succ j =>
                  refine ⟨0, ?_⟩
                  rw [Finset.prod_eq_zero (i := 0) (by simp) (by simp)]
                  simp
              | succ m ih =>
                intro j
                cases j with
                | zero => exact ⟨1, by simp⟩
                | succ j =>
                  obtain ⟨a, ha⟩ := ih j
                  obtain ⟨b, hb⟩ := ih (j + 1)
                  refine ⟨a + 2 ^ (j + 1) * b, ?_⟩
                  rw [key, ← ha, ← hb]
                  push_cast
                  ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 357–379 at 2987e49b6fb3 ↗

        1. gauss.main.s1 case

          Leaves ∀ (j : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ ((0 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Uses library Nat.zero Zero, the smallest natural number. .

          Lean, lines 361–368
                | zero =>
                  intro j
                  cases j with
                  | zero => exact ⟨1, by simp⟩
                  | succ j =>
                    refine ⟨0, ?_⟩
                    rw [Finset.prod_eq_zero (i := 0) (by simp) (by simp)]
                    simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 361–368 at 2987e49b6fb3 ↗

          1. gauss.main.s1.s1 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (0 : ℕ), ((2 : ℚ) ^ ((0 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

            Uses library Nat.zero Zero, the smallest natural number. , Exists.intro Existential introduction. .

            Lean, line 364
                    | zero => exact ⟨1, by simp⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 364 at 2987e49b6fb3 ↗

          2. gauss.main.s1.s2 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ ((0 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with j : ℕ.

            Uses library Nat.succ The successor of a natural number n. , Exists.intro Existential introduction. , Finset.prod_eq_zero.

            Lean, lines 365–368
                    | succ j =>
                      refine ⟨0, ?_⟩
                      rw [Finset.prod_eq_zero (i := 0) (by simp) (by simp)]
                      simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 365–368 at 2987e49b6fb3 ↗

        2. gauss.main.s2 case

          Leaves ∀ (j : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with m : ℕ, ih : ∀ (j : ℕ), ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Uses library Nat.succ The successor of a natural number n. .

          Lean, lines 369–379
                | succ m ih =>
                  intro j
                  cases j with
                  | zero => exact ⟨1, by simp⟩
                  | succ j =>
                    obtain ⟨a, ha⟩ := ih j
                    obtain ⟨b, hb⟩ := ih (j + 1)
                    refine ⟨a + 2 ^ (j + 1) * b, ?_⟩
                    rw [key, ← ha, ← hb]
                    push_cast
                    ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 369–379 at 2987e49b6fb3 ↗

          1. gauss.main.s2.s1 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (0 : ℕ), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

            Uses library Nat.zero Zero, the smallest natural number. , Exists.intro Existential introduction. .

            Lean, line 372
                    | zero => exact ⟨1, by simp⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 372 at 2987e49b6fb3 ↗

          2. gauss.main.s2.s2 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with j : ℕ.

            Uses library Nat.succ The successor of a natural number n. , Exists.intro Existential introduction. .

            Lean, lines 373–379
                    | succ j =>
                      obtain ⟨a, ha⟩ := ih j
                      obtain ⟨b, hb⟩ := ih (j + 1)
                      refine ⟨a + 2 ^ (j + 1) * b, ?_⟩
                      rw [key, ← ha, ← hb]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 373–379 at 2987e49b6fb3 ↗

            1. gauss.main.s2.s2.s1 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

              Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with a : ℤ, ha : (↑a : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

              Lean, line 374
                        obtain ⟨a, ha⟩ := ih j

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 374 at 2987e49b6fb3 ↗

            2. gauss.main.s2.s2.s2 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

              Leaves ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m + (1 : ℕ) - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), with b : ℤ, hb : (↑b : ℚ) = ∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

              Lean, line 375
                        obtain ⟨b, hb⟩ := ih (j + 1)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 375 at 2987e49b6fb3 ↗

    13. hodd have ∀ (n k : ℕ), k ≤ n → ∀ (c : ℕ → ℤ), ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), (↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hodd : ∀ (n k : ℕ), k ≤ n → ∀ (c : ℕ → ℤ), ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), (↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 381–429
        have hodd : ∀ (n k : ℕ), k ≤ n → ∀ (c : ℕ → ℤ),
            ∃ z : ℤ, (z : ℚ) = (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
              ∑ j ∈ Finset.range (k + 1), (c j : ℚ) / ((2 : ℚ) ^ (k - j) - 1) := by
          intro n k hk c
          have hint : ∀ j ∈ Finset.range (k + 1), ∃ z : ℤ,
              (z : ℚ) = (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                ((c j : ℚ) / ((2 : ℚ) ^ (k - j) - 1)) := by
            intro j hj
            have hjk : j ≤ k := Nat.lt_succ_iff.mp (Finset.mem_range.mp hj)
            by_cases hjeq : j = k
            · subst hjeq
              exact ⟨0, by simp⟩
            · obtain ⟨d, hd⟩ : ∃ d, k - j = d + 1 := ⟨k - j - 1, by omega⟩
              rw [hd]
              have hdn : d + 1 ≤ n := by omega
              have ht : 1 ≤ n / (d + 1) := (Nat.one_le_div_iff (by omega)).mpr hdn
              have hP1 : (d + 1) * (n / (d + 1)) ≤ n := Nat.mul_div_le n (d + 1)
              have hP2 : n < (d + 1) * (n / (d + 1)) + (d + 1) := by
                have := Nat.lt_mul_div_succ n (show 0 < d + 1 by omega)
                rw [Nat.mul_succ] at this
                exact this
              have hP3 : (d + 1) ≤ (d + 1) * (n / (d + 1)) := Nat.le_mul_of_pos_right _ ht
              have hmem : (d + 1) * (n / (d + 1)) ∈ Finset.Ioc (n / 2) n := by
                rw [Finset.mem_Ioc]
                generalize (d + 1) * (n / (d + 1)) = P at hP1 hP2 hP3 ⊢
                omega
              have hdvd : ((2 : ℤ) ^ (d + 1) - 1) ∣ ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1) := by
                refine dvd_trans ?_ (Finset.dvd_prod_of_mem _ hmem)
                have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ (d + 1)) 1 (n / (d + 1))
                rw [one_pow, ← pow_mul] at this
                exact this
              obtain ⟨q, hq⟩ := hdvd
              have hne : ((2 : ℚ) ^ (d + 1) - 1) ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              refine ⟨c j * q, ?_⟩
              have hcast : (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) =
                  (((2 : ℤ) ^ (d + 1) - 1 : ℤ) : ℚ) * (q : ℚ) := by
                rw [← Int.cast_mul, ← hq]
                push_cast
                rfl
              rw [hcast]
              push_cast
              field_simp
          choose! g hg using hint
          refine ⟨∑ j ∈ Finset.range (k + 1), g j, ?_⟩
          push_cast
          rw [Finset.mul_sum]
          exact Finset.sum_congr rfl hg

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 381–429 at 2987e49b6fb3 ↗

      1. hodd.hint have ∀ j ∈ Finset.range (k + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ)))

        Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), (↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hint : ∀ j ∈ Finset.range (k + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

        Lean, lines 385–424
            have hint : ∀ j ∈ Finset.range (k + 1), ∃ z : ℤ,
                (z : ℚ) = (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                  ((c j : ℚ) / ((2 : ℚ) ^ (k - j) - 1)) := by
              intro j hj
              have hjk : j ≤ k := Nat.lt_succ_iff.mp (Finset.mem_range.mp hj)
              by_cases hjeq : j = k
              · subst hjeq
                exact ⟨0, by simp⟩
              · obtain ⟨d, hd⟩ : ∃ d, k - j = d + 1 := ⟨k - j - 1, by omega⟩
                rw [hd]
                have hdn : d + 1 ≤ n := by omega
                have ht : 1 ≤ n / (d + 1) := (Nat.one_le_div_iff (by omega)).mpr hdn
                have hP1 : (d + 1) * (n / (d + 1)) ≤ n := Nat.mul_div_le n (d + 1)
                have hP2 : n < (d + 1) * (n / (d + 1)) + (d + 1) := by
                  have := Nat.lt_mul_div_succ n (show 0 < d + 1 by omega)
                  rw [Nat.mul_succ] at this
                  exact this
                have hP3 : (d + 1) ≤ (d + 1) * (n / (d + 1)) := Nat.le_mul_of_pos_right _ ht
                have hmem : (d + 1) * (n / (d + 1)) ∈ Finset.Ioc (n / 2) n := by
                  rw [Finset.mem_Ioc]
                  generalize (d + 1) * (n / (d + 1)) = P at hP1 hP2 hP3 ⊢
                  omega
                have hdvd : ((2 : ℤ) ^ (d + 1) - 1) ∣ ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1) := by
                  refine dvd_trans ?_ (Finset.dvd_prod_of_mem _ hmem)
                  have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ (d + 1)) 1 (n / (d + 1))
                  rw [one_pow, ← pow_mul] at this
                  exact this
                obtain ⟨q, hq⟩ := hdvd
                have hne : ((2 : ℚ) ^ (d + 1) - 1) ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith
                refine ⟨c j * q, ?_⟩
                have hcast : (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) =
                    (((2 : ℤ) ^ (d + 1) - 1 : ℤ) : ℚ) * (q : ℚ) := by
                  rw [← Int.cast_mul, ← hq]
                  push_cast
                  rfl
                rw [hcast]
                push_cast
                field_simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 385–424 at 2987e49b6fb3 ↗

        1. hodd.hint.hjk have j ≤ k

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))), with hjk : j ≤ k.

          Uses library Nat.lt_succ_iff, Finset.mem_range.

          Lean, line 389
                have hjk : j ≤ k := Nat.lt_succ_iff.mp (Finset.mem_range.mp hj)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 389 at 2987e49b6fb3 ↗

        2. hodd.hint.s2 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))).

          Uses library Exists.intro Existential introduction. .

          Lean, lines 391–392
                · subst hjeq
                  exact ⟨0, by simp⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 391–392 at 2987e49b6fb3 ↗

        3. hodd.hint.s3 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))).

          Uses library Exists.intro Existential introduction. .

          Lean, lines 393–424
                · obtain ⟨d, hd⟩ : ∃ d, k - j = d + 1 := ⟨k - j - 1, by omega⟩
                  rw [hd]
                  have hdn : d + 1 ≤ n := by omega
                  have ht : 1 ≤ n / (d + 1) := (Nat.one_le_div_iff (by omega)).mpr hdn
                  have hP1 : (d + 1) * (n / (d + 1)) ≤ n := Nat.mul_div_le n (d + 1)
                  have hP2 : n < (d + 1) * (n / (d + 1)) + (d + 1) := by
                    have := Nat.lt_mul_div_succ n (show 0 < d + 1 by omega)
                    rw [Nat.mul_succ] at this
                    exact this
                  have hP3 : (d + 1) ≤ (d + 1) * (n / (d + 1)) := Nat.le_mul_of_pos_right _ ht
                  have hmem : (d + 1) * (n / (d + 1)) ∈ Finset.Ioc (n / 2) n := by
                    rw [Finset.mem_Ioc]
                    generalize (d + 1) * (n / (d + 1)) = P at hP1 hP2 hP3 ⊢
                    omega
                  have hdvd : ((2 : ℤ) ^ (d + 1) - 1) ∣ ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1) := by
                    refine dvd_trans ?_ (Finset.dvd_prod_of_mem _ hmem)
                    have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ (d + 1)) 1 (n / (d + 1))
                    rw [one_pow, ← pow_mul] at this
                    exact this
                  obtain ⟨q, hq⟩ := hdvd
                  have hne : ((2 : ℚ) ^ (d + 1) - 1) ≠ 0 := by
                    have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                    linarith
                  refine ⟨c j * q, ?_⟩
                  have hcast : (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) =
                      (((2 : ℤ) ^ (d + 1) - 1 : ℤ) : ℚ) * (q : ℚ) := by
                    rw [← Int.cast_mul, ← hq]
                    push_cast
                    rfl
                  rw [hcast]
                  push_cast
                  field_simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 393–424 at 2987e49b6fb3 ↗

          1. hodd.hint.s3.s1 obtain ∃ (d : ℕ), k - j = d + (1 : ℕ)

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))), with d : ℕ, hd : k - j = d + (1 : ℕ).

            Uses library Exists.intro Existential introduction. .

            Lean, line 393
                  · obtain ⟨d, hd⟩ : ∃ d, k - j = d + 1 := ⟨k - j - 1, by omega⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 393 at 2987e49b6fb3 ↗

          2. hodd.hint.s3.hdn have d + (1 : ℕ) ≤ n routine: omega

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hdn : d + (1 : ℕ) ≤ n.

            Lean, line 395
                    have hdn : d + 1 ≤ n := by omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 395 at 2987e49b6fb3 ↗

          3. hodd.hint.s3.ht have (1 : ℕ) ≤ n / (d + (1 : ℕ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with ht : (1 : ℕ) ≤ n / (d + (1 : ℕ)).

            Uses library Nat.one_le_div_iff.

            Lean, line 396
                    have ht : 1 ≤ n / (d + 1) := (Nat.one_le_div_iff (by omega)).mpr hdn

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 396 at 2987e49b6fb3 ↗

          4. hodd.hint.s3.hP1 have (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) ≤ n

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hP1 : (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) ≤ n.

            Uses library Nat.mul_div_le.

            Lean, line 397
                    have hP1 : (d + 1) * (n / (d + 1)) ≤ n := Nat.mul_div_le n (d + 1)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 397 at 2987e49b6fb3 ↗

          5. hodd.hint.s3.hP2 have n < (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) + (d + (1 : ℕ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hP2 : n < (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) + (d + (1 : ℕ)).

            Uses library Nat.mul_succ.

            Lean, lines 398–401
                    have hP2 : n < (d + 1) * (n / (d + 1)) + (d + 1) := by
                      have := Nat.lt_mul_div_succ n (show 0 < d + 1 by omega)
                      rw [Nat.mul_succ] at this
                      exact this

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 398–401 at 2987e49b6fb3 ↗

            1. hodd.hint.s3.hP2.this have n < (d + (1 : ℕ)) * (n / (d + (1 : ℕ)) + (1 : ℕ))

              Leaves n < (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) + (d + (1 : ℕ)), with this : n < (d + (1 : ℕ)) * (n / (d + (1 : ℕ)) + (1 : ℕ)).

              Uses library Nat.lt_mul_div_succ.

              Lean, line 399
                        have := Nat.lt_mul_div_succ n (show 0 < d + 1 by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 399 at 2987e49b6fb3 ↗

          6. hodd.hint.s3.hP3 have d + (1 : ℕ) ≤ (d + (1 : ℕ)) * (n / (d + (1 : ℕ)))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hP3 : d + (1 : ℕ) ≤ (d + (1 : ℕ)) * (n / (d + (1 : ℕ))).

            Uses library Nat.le_mul_of_pos_right.

            Lean, line 402
                    have hP3 : (d + 1) ≤ (d + 1) * (n / (d + 1)) := Nat.le_mul_of_pos_right _ ht

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 402 at 2987e49b6fb3 ↗

          7. hodd.hint.s3.hmem have (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) ∈ Finset.Ioc (n / (2 : ℕ)) n

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hmem : (d + (1 : ℕ)) * (n / (d + (1 : ℕ))) ∈ Finset.Ioc (n / (2 : ℕ)) n.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.mem_Ioc.

            Lean, lines 403–406
                    have hmem : (d + 1) * (n / (d + 1)) ∈ Finset.Ioc (n / 2) n := by
                      rw [Finset.mem_Ioc]
                      generalize (d + 1) * (n / (d + 1)) = P at hP1 hP2 hP3 ⊢
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 403–406 at 2987e49b6fb3 ↗

          8. hodd.hint.s3.hdvd have (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℤ) ^ m - (1 : ℤ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hdvd : (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℤ) ^ m - (1 : ℤ)).

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , dvd_trans, Finset.dvd_prod_of_mem, one_pow, pow_mul.

            Lean, lines 407–411
                    have hdvd : ((2 : ℤ) ^ (d + 1) - 1) ∣ ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1) := by
                      refine dvd_trans ?_ (Finset.dvd_prod_of_mem _ hmem)
                      have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ (d + 1)) 1 (n / (d + 1))
                      rw [one_pow, ← pow_mul] at this
                      exact this

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 407–411 at 2987e49b6fb3 ↗

            1. hodd.hint.s3.hdvd.this have (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ ((2 : ℤ) ^ (d + (1 : ℕ))) ^ (n / (d + (1 : ℕ))) - (1 : ℤ) ^ (n / (d + (1 : ℕ)))

              Leaves (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ (2 : ℤ) ^ ((d + (1 : ℕ)) * (n / (d + (1 : ℕ)))) - (1 : ℤ), with this : (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ ((2 : ℤ) ^ (d + (1 : ℕ))) ^ (n / (d + (1 : ℕ))) - (1 : ℤ) ^ (n / (d + (1 : ℕ))).

              Uses library sub_dvd_pow_sub_pow.

              Lean, line 409
                        have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ (d + 1)) 1 (n / (d + 1))

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 409 at 2987e49b6fb3 ↗

          9. hodd.hint.s3.s9 obtain (2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ) ∣ ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℤ) ^ m - (1 : ℤ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with q : ℤ, hq : ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℤ) ^ m - (1 : ℤ)) = ((2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ)) * q.

            Lean, line 412
                    obtain ⟨q, hq⟩ := hdvd

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 412 at 2987e49b6fb3 ↗

          10. hodd.hint.s3.hne have (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hne : (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

            Lean, lines 413–415
                    have hne : ((2 : ℚ) ^ (d + 1) - 1) ≠ 0 := by
                      have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                      linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 413–415 at 2987e49b6fb3 ↗

            1. hodd.hint.s3.hne.this have (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ))

              Leaves (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ)).

              Uses library one_lt_pow₀.

              Lean, line 414
                        have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 414 at 2987e49b6fb3 ↗

          11. hodd.hint.s3.hcast have ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ)) = (↑((2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ)) : ℚ) * (↑q : ℚ)

            Leaves (↑(c j * q) : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ((↑(c j) : ℚ) / ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))), with hcast : ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ)) = (↑((2 : ℤ) ^ (d + (1 : ℕ)) - (1 : ℤ)) : ℚ) * (↑q : ℚ).

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Int.cast_mul.

            Lean, lines 417–421
                    have hcast : (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) =
                        (((2 : ℤ) ^ (d + 1) - 1 : ℤ) : ℚ) * (q : ℚ) := by
                      rw [← Int.cast_mul, ← hq]
                      push_cast
                      rfl

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 417–421 at 2987e49b6fb3 ↗

    14. combine have ∀ (p M : ℚ) (a : ℕ) (Ω A B m : ℤ), Odd Ω → (↑Ω : ℚ) * p = (2 : ℚ) ^ a * (↑A : ℚ) → (↑B : ℚ) = M * p → (↑m : ℚ) = M → ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with combine : ∀ (p M : ℚ) (a : ℕ) (Ω A B m : ℤ), Odd Ω → (↑Ω : ℚ) * p = (2 : ℚ) ^ a * (↑A : ℚ) → (↑B : ℚ) = M * p → (↑m : ℚ) = M → ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p.

      Uses library Odd An element a of a semiring is odd if there exists k such a = 2*k + 1. , Exists.intro Existential introduction. .

      Lean, lines 430–449
        have combine : ∀ (p M : ℚ) (a : ℕ) (Ω A B m : ℤ), Odd Ω →
            (Ω : ℚ) * p = 2 ^ a * A → (B : ℚ) = M * p → (m : ℚ) = M →
            ∃ z : ℤ, (z : ℚ) * 2 ^ a = M * p := by
          intro p M a Ω A B m hΩ h1 h2 hm
          have hint : Ω * B = 2 ^ a * (m * A) := by
            have : ((Ω * B : ℤ) : ℚ) = ((2 ^ a * (m * A) : ℤ) : ℚ) := by
              push_cast
              rw [h2, ← hm]
              linear_combination (m : ℚ) * h1
            exact_mod_cast this
          obtain ⟨t, ht⟩ := hΩ
          have hcop : IsCoprime ((2 : ℤ) ^ a) Ω := by
            apply IsCoprime.pow_left
            exact ⟨-t, 1, by rw [ht]; ring⟩
          have hdvd : (2 : ℤ) ^ a ∣ B * Ω := ⟨m * A, by rw [mul_comm, hint]⟩
          obtain ⟨c, hc⟩ := hcop.dvd_of_dvd_mul_right hdvd
          refine ⟨c, ?_⟩
          rw [← h2, hc]
          push_cast
          ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 430–449 at 2987e49b6fb3 ↗

      1. combine.hint have Ω * B = (2 : ℤ) ^ a * (m * A)

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p, with hint : Ω * B = (2 : ℤ) ^ a * (m * A).

        Lean, lines 434–439
            have hint : Ω * B = 2 ^ a * (m * A) := by
              have : ((Ω * B : ℤ) : ℚ) = ((2 ^ a * (m * A) : ℤ) : ℚ) := by
                push_cast
                rw [h2, ← hm]
                linear_combination (m : ℚ) * h1
              exact_mod_cast this

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 434–439 at 2987e49b6fb3 ↗

        1. combine.hint.this have (↑(Ω * B) : ℚ) = (↑((2 : ℤ) ^ a * (m * A)) : ℚ)

          Leaves Ω * B = (2 : ℤ) ^ a * (m * A), with this : (↑(Ω * B) : ℚ) = (↑((2 : ℤ) ^ a * (m * A)) : ℚ).

          Lean, lines 435–438
                have : ((Ω * B : ℤ) : ℚ) = ((2 ^ a * (m * A) : ℤ) : ℚ) := by
                  push_cast
                  rw [h2, ← hm]
                  linear_combination (m : ℚ) * h1

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 435–438 at 2987e49b6fb3 ↗

      2. combine.s2 obtain Odd Ω

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p, with t : ℤ, ht : Ω = (2 : ℤ) * t + (1 : ℤ).

        Lean, line 440
            obtain ⟨t, ht⟩ := hΩ

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 440 at 2987e49b6fb3 ↗

      3. combine.hcop have IsCoprime ((2 : ℤ) ^ a) Ω

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p, with hcop : IsCoprime ((2 : ℤ) ^ a) Ω.

        Uses library IsCoprime The proposition that x and y are coprime, defined to be the existence of a and b such that a * x + b * y = 1. , IsCoprime.pow_left, Exists.intro Existential introduction. .

        Lean, lines 441–443
            have hcop : IsCoprime ((2 : ℤ) ^ a) Ω := by
              apply IsCoprime.pow_left
              exact ⟨-t, 1, by rw [ht]; ring⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 441–443 at 2987e49b6fb3 ↗

      4. combine.hdvd have (2 : ℤ) ^ a ∣ B * Ω

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p, with hdvd : (2 : ℤ) ^ a ∣ B * Ω.

        Uses library Exists.intro Existential introduction. , mul_comm.

        Lean, line 444
            have hdvd : (2 : ℤ) ^ a ∣ B * Ω := ⟨m * A, by rw [mul_comm, hint]⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 444 at 2987e49b6fb3 ↗

      5. combine.s5 obtain (2 : ℤ) ^ a ∣ B

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ a = M * p, with c : ℤ, hc : B = (2 : ℤ) ^ a * c.

        Lean, line 445
            obtain ⟨c, hc⟩ := hcop.dvd_of_dvd_mul_right hdvd

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 445 at 2987e49b6fb3 ↗

    15. hcore have ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (n k : ℕ), k ≤ n → ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hcore : ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (n k : ℕ), k ≤ n → ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. .

      Lean, lines 450–582
        have hcore : ∀ (Qc : ℕ → ℕ → ℚ),
          (Qc = fun (n k : ℕ) =>
              ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                  ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) →
          ∀ (n k : ℕ), k ≤ n →
            ∃ z : ℤ, (z : ℚ) * (2 : ℚ) ^ (k * (k - 1) / 2) =
              (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) := by
          intro Qc hQc n k hk
          have hQcint : ∀ j : ℕ, ∃ g : ℤ, Qc n j = 2 ^ (j * (j - 1) / 2) * g := by
            intro j
            obtain ⟨a, ha⟩ := gauss n j
            obtain ⟨b, hb⟩ := gauss (2 * n - j) n
            refine ⟨(-1) ^ j * a * b, ?_⟩
            rw [hQc]
            simp only []
            rw [← ha, ← hb]
            push_cast
            ring
          choose g hg using hQcint
          -- the odd product
          have hΩdiv : ∀ s : ℕ, 1 ≤ s → s ≤ 2 * n → ∃ w : ℤ,
              (w : ℚ) * ((2 : ℚ) ^ s - 1) = ((∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1) : ℤ) : ℚ) := by
            intro s h1 h2
            refine ⟨∏ t ∈ (Finset.Icc 1 (2 * n)).erase s, ((2 : ℤ) ^ t - 1), ?_⟩
            rw [← Finset.prod_erase_mul _ _ (Finset.mem_Icc.mpr ⟨h1, h2⟩)]
            push_cast
            ring
          have hΩodd : Odd (∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1)) := by
            apply Finset.prod_induction _ (fun x : ℤ => Odd x)
            · intro x y hx hy
              exact hx.mul hy
            · exact odd_one
            · intro t ht
              have ht1 : t ≠ 0 := by
                have := (Finset.mem_Icc.mp ht).1
                omega
              exact Even.sub_odd ((Int.even_pow).mpr ⟨even_two, ht1⟩) odd_one
          -- one term 2^a / (2^a - 2^b), times the odd product, is an integer
          have key1 : ∀ a b : ℕ, a ≠ b → a ≤ 2 * n → b ≤ 2 * n → ∃ w : ℤ,
              (w : ℚ) = ((∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1) : ℤ) : ℚ) * 2 ^ a * (1 / ((2 : ℚ) ^ a - 2 ^ b)) := by
            intro a b hab ha hb
            rcases Nat.lt_or_gt_of_ne hab with hlt | hgt
            · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hlt
              obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
              refine ⟨-w, ?_⟩
              have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have h2a : (2 : ℚ) ^ a ≠ 0 := by positivity
              rw [← hw, show a + d + 1 = a + (d + 1) by ring, show (2 : ℚ) ^ (a + (d + 1)) = 2 ^ a * 2 ^ (d + 1) from pow_add _ _ _]
              have : (2 : ℚ) ^ a - 2 ^ a * 2 ^ (d + 1) = -(2 ^ a * (2 ^ (d + 1) - 1)) := by ring
              rw [this]
              field_simp
              push_cast
              ring
            · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hgt
              obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
              refine ⟨w * 2 ^ (d + 1), ?_⟩
              have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have h2b : (2 : ℚ) ^ b ≠ 0 := by positivity
              rw [← hw, show b + d + 1 = b + (d + 1) by ring, show (2 : ℚ) ^ (b + (d + 1)) = 2 ^ b * 2 ^ (d + 1) from pow_add _ _ _]
              have : (2 : ℚ) ^ b * 2 ^ (d + 1) - 2 ^ b = 2 ^ b * (2 ^ (d + 1) - 1) := by ring
              rw [this]
              field_simp
              push_cast
              ring
          set Ω : ℤ := ∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1) with hΩ
          have hK : ∀ K ∈ Finset.Ioc n (2 * n), ∃ w : ℤ,
              (w : ℚ) = (Ω : ℚ) * 2 ^ k * (1 / ((2 : ℚ) ^ k - 2 ^ K)) := by
            intro K hK'
            have := Finset.mem_Ioc.mp hK'
            exact key1 k K (by omega) (by omega) (by omega)
          have hI : ∀ i ∈ (Finset.range (n + 1)).erase k, ∃ w : ℤ,
              (w : ℚ) = (Ω : ℚ) * 2 ^ k * (1 / ((2 : ℚ) ^ k - 2 ^ i)) := by
            intro i hi
            have h1 := Finset.ne_of_mem_erase hi
            have h2 := Finset.mem_range.mp (Finset.mem_of_mem_erase hi)
            exact key1 k i (Ne.symm h1) (by omega) (by omega)
          have hT : ∀ j ∈ Finset.Ioc k n, ∃ w : ℤ,
              (w : ℚ) * 2 ^ (k * (k - 1) / 2) = (Ω : ℚ) * (Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k))) := by
            intro j hj
            have hj' := Finset.mem_Ioc.mp hj
            obtain ⟨d, hd⟩ : ∃ d, j - k = d + 1 := ⟨j - k - 1, by omega⟩
            obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
            have hmono : k * (k - 1) / 2 ≤ j * (j - 1) / 2 :=
              Nat.div_le_div_right (Nat.mul_le_mul (by omega) (by omega))
            obtain ⟨e, he⟩ := Nat.exists_eq_add_of_le hmono
            refine ⟨-(w * g j * 2 ^ e * 2 ^ (d + 1)), ?_⟩
            have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
              have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            have hne' : (1 : ℚ) - 2 ^ (d + 1) ≠ 0 := by
              intro h
              apply hne
              linarith
            rw [hd, hg j, he, ← hw, show (2 : ℚ) ^ (k * (k - 1) / 2 + e) = 2 ^ (k * (k - 1) / 2) * 2 ^ e from pow_add _ _ _]
            field_simp
            push_cast
            ring
          choose! fK hfK using hK
          choose! fI hfI using hI
          choose! fT hfT using hT
          have h2adic : (Ω : ℚ) * ∑ j ∈ Finset.range (k + 1), Qc n j / ((2 : ℚ) ^ (k - j) - 1) =
              2 ^ (k * (k - 1) / 2) * ((g k * (∑ K ∈ Finset.Ioc n (2 * n), fK K -
                ∑ i ∈ (Finset.range (n + 1)).erase k, fI i) - ∑ j ∈ Finset.Ioc k n, fT j : ℤ) : ℚ) := by
            rw [hform Qc hQc n k hk]
            push_cast
            rw [Finset.sum_congr rfl hfK, Finset.sum_congr rfl hfI, ← Finset.mul_sum, ← Finset.mul_sum]
            have htail : (2 : ℚ) ^ (k * (k - 1) / 2) * ∑ j ∈ Finset.Ioc k n, (fT j : ℚ) =
                (Ω : ℚ) * ∑ j ∈ Finset.Ioc k n, Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
              rw [Finset.mul_sum, Finset.mul_sum]
              refine Finset.sum_congr rfl (fun j hj => ?_)
              rw [mul_comm]
              exact hfT j hj
            rw [hg k]
            simp only [one_div] at htail ⊢
            linear_combination htail
          -- the odd half
          obtain ⟨B, hB⟩ := hodd n k hk (fun j => 2 ^ (j * (j - 1) / 2) * g j)
          have hB' : (B : ℚ) = (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
              ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) := by
            rw [hB]
            congr 1
            refine Finset.sum_congr rfl (fun j _ => ?_)
            rw [hg j]
            push_cast
            ring
          exact combine _ _ _ Ω _ B (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1)) hΩodd h2adic hB'
            (by push_cast; rfl)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 450–582 at 2987e49b6fb3 ↗

      1. hcore.hQcint have ∀ (j : ℕ), ∃ (g : ℤ), Qc n j = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * (↑g : ℚ)

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hQcint : ∀ (j : ℕ), ∃ (g : ℤ), Qc n j = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * (↑g : ℚ).

        Uses library Exists.intro Existential introduction. .

        Lean, lines 460–469
            have hQcint : ∀ j : ℕ, ∃ g : ℤ, Qc n j = 2 ^ (j * (j - 1) / 2) * g := by
              intro j
              obtain ⟨a, ha⟩ := gauss n j
              obtain ⟨b, hb⟩ := gauss (2 * n - j) n
              refine ⟨(-1) ^ j * a * b, ?_⟩
              rw [hQc]
              simp only []
              rw [← ha, ← hb]
              push_cast
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 460–469 at 2987e49b6fb3 ↗

        1. hcore.hQcint.s1 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

          Leaves ∃ (g : ℤ), Qc n j = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * (↑g : ℚ), with a : ℤ, ha : (↑a : ℚ) = ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 462
                obtain ⟨a, ha⟩ := gauss n j

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 462 at 2987e49b6fb3 ↗

        2. hcore.hQcint.s2 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

          Leaves ∃ (g : ℤ), Qc n j = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * (↑g : ℚ), with b : ℤ, hb : (↑b : ℚ) = ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 463
                obtain ⟨b, hb⟩ := gauss (2 * n - j) n

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 463 at 2987e49b6fb3 ↗

      2. hcore.h_x3a9div (hΩdiv) have ∀ (s : ℕ), (1 : ℕ) ≤ s → s ≤ (2 : ℕ) * n → ∃ (w : ℤ), (↑w : ℚ) * ((2 : ℚ) ^ s - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ)

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hΩdiv : ∀ (s : ℕ), (1 : ℕ) ≤ s → s ≤ (2 : ℕ) * n → ∃ (w : ℤ), (↑w : ℚ) * ((2 : ℚ) ^ s - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ).

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , Finset.prod_erase_mul A variant of Finset.mul_prod_erase with the multiplication swapped. , Finset.mem_Icc, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, lines 472–478
            have hΩdiv : ∀ s : ℕ, 1 ≤ s → s ≤ 2 * n → ∃ w : ℤ,
                (w : ℚ) * ((2 : ℚ) ^ s - 1) = ((∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1) : ℤ) : ℚ) := by
              intro s h1 h2
              refine ⟨∏ t ∈ (Finset.Icc 1 (2 * n)).erase s, ((2 : ℤ) ^ t - 1), ?_⟩
              rw [← Finset.prod_erase_mul _ _ (Finset.mem_Icc.mpr ⟨h1, h2⟩)]
              push_cast
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 472–478 at 2987e49b6fb3 ↗

      3. hcore.h_x3a9odd (hΩodd) have Odd (∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ)))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hΩodd : Odd (∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))).

        Uses library Odd An element a of a semiring is odd if there exists k such a = 2*k + 1. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_induction To prove a property of a product, it suffices to prove that the property is multiplicative and holds on factors. .

        Lean, lines 479–488
            have hΩodd : Odd (∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1)) := by
              apply Finset.prod_induction _ (fun x : ℤ => Odd x)
              · intro x y hx hy
                exact hx.mul hy
              · exact odd_one
              · intro t ht
                have ht1 : t ≠ 0 := by
                  have := (Finset.mem_Icc.mp ht).1
                  omega
                exact Even.sub_odd ((Int.even_pow).mpr ⟨even_two, ht1⟩) odd_one

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 479–488 at 2987e49b6fb3 ↗

        1. hcore.h_x3a9odd.s1 case

          Leaves ∀ (a b : ℤ), Odd a → Odd b → Odd (a * b).

          Lean, lines 481–482
                · intro x y hx hy
                  exact hx.mul hy

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 481–482 at 2987e49b6fb3 ↗

        2. hcore.h_x3a9odd.s2 case

          Leaves Odd (1 : ℤ).

          Uses library odd_one.

          Lean, line 483
                · exact odd_one

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 483 at 2987e49b6fb3 ↗

        3. hcore.h_x3a9odd.s3 case

          Leaves ∀ x ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), Odd ((2 : ℤ) ^ x - (1 : ℤ)).

          Uses library Even.sub_odd, Int.even_pow, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , even_two, odd_one.

          Lean, lines 484–488
                · intro t ht
                  have ht1 : t ≠ 0 := by
                    have := (Finset.mem_Icc.mp ht).1
                    omega
                  exact Even.sub_odd ((Int.even_pow).mpr ⟨even_two, ht1⟩) odd_one

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 484–488 at 2987e49b6fb3 ↗

          1. hcore.h_x3a9odd.s3.ht1 have t ≠ (0 : ℕ)

            Leaves Odd ((2 : ℤ) ^ t - (1 : ℤ)), with ht1 : t ≠ (0 : ℕ).

            Lean, lines 485–487
                    have ht1 : t ≠ 0 := by
                      have := (Finset.mem_Icc.mp ht).1
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 485–487 at 2987e49b6fb3 ↗

            1. hcore.h_x3a9odd.s3.ht1.this have (1 : ℕ) ≤ t

              Leaves t ≠ (0 : ℕ), with this : (1 : ℕ) ≤ t.

              Uses library Finset.mem_Icc.

              Lean, line 486
                        have := (Finset.mem_Icc.mp ht).1

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 486 at 2987e49b6fb3 ↗

      4. hcore.key1 have ∀ (a b : ℕ), a ≠ b → a ≤ (2 : ℕ) * n → b ≤ (2 : ℕ) * n → ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ b))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with key1 : ∀ (a b : ℕ), a ≠ b → a ≤ (2 : ℕ) * n → b ≤ (2 : ℕ) * n → ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ b)).

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Nat.lt_or_gt_of_ne.

        Lean, lines 490–519
            have key1 : ∀ a b : ℕ, a ≠ b → a ≤ 2 * n → b ≤ 2 * n → ∃ w : ℤ,
                (w : ℚ) = ((∏ t ∈ Finset.Icc 1 (2 * n), ((2 : ℤ) ^ t - 1) : ℤ) : ℚ) * 2 ^ a * (1 / ((2 : ℚ) ^ a - 2 ^ b)) := by
              intro a b hab ha hb
              rcases Nat.lt_or_gt_of_ne hab with hlt | hgt
              · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hlt
                obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
                refine ⟨-w, ?_⟩
                have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith
                have h2a : (2 : ℚ) ^ a ≠ 0 := by positivity
                rw [← hw, show a + d + 1 = a + (d + 1) by ring, show (2 : ℚ) ^ (a + (d + 1)) = 2 ^ a * 2 ^ (d + 1) from pow_add _ _ _]
                have : (2 : ℚ) ^ a - 2 ^ a * 2 ^ (d + 1) = -(2 ^ a * (2 ^ (d + 1) - 1)) := by ring
                rw [this]
                field_simp
                push_cast
                ring
              · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hgt
                obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
                refine ⟨w * 2 ^ (d + 1), ?_⟩
                have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith
                have h2b : (2 : ℚ) ^ b ≠ 0 := by positivity
                rw [← hw, show b + d + 1 = b + (d + 1) by ring, show (2 : ℚ) ^ (b + (d + 1)) = 2 ^ b * 2 ^ (d + 1) from pow_add _ _ _]
                have : (2 : ℚ) ^ b * 2 ^ (d + 1) - 2 ^ b = 2 ^ b * (2 ^ (d + 1) - 1) := by ring
                rw [this]
                field_simp
                push_cast
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 490–519 at 2987e49b6fb3 ↗

        1. hcore.key1.s1 case

          Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ b)).

          Uses library Exists.intro Existential introduction. , pow_add.

          Lean, lines 494–506
                · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hlt
                  obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
                  refine ⟨-w, ?_⟩
                  have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                    have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                    linarith
                  have h2a : (2 : ℚ) ^ a ≠ 0 := by positivity
                  rw [← hw, show a + d + 1 = a + (d + 1) by ring, show (2 : ℚ) ^ (a + (d + 1)) = 2 ^ a * 2 ^ (d + 1) from pow_add _ _ _]
                  have : (2 : ℚ) ^ a - 2 ^ a * 2 ^ (d + 1) = -(2 ^ a * (2 ^ (d + 1) - 1)) := by ring
                  rw [this]
                  field_simp
                  push_cast
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 494–506 at 2987e49b6fb3 ↗

          1. hcore.key1.s1.s1 obtain ∃ (k : ℕ), b = a + k + (1 : ℕ)

            Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ (a + d + (1 : ℕ)))), with d : ℕ, hab : a ≠ a + d + (1 : ℕ), hb : a + d + (1 : ℕ) ≤ (2 : ℕ) * n, hlt : a < a + d + (1 : ℕ).

            Uses library Nat.exists_eq_add_of_lt.

            Lean, line 494
                  · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hlt

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 494 at 2987e49b6fb3 ↗

          2. hcore.key1.s1.s2 obtain ∃ (w : ℤ), (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ)

            Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ (a + d + (1 : ℕ)))), with w : ℤ, hw : (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ).

            Lean, line 495
                    obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 495 at 2987e49b6fb3 ↗

          3. hcore.key1.s1.hne have (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

            Leaves (↑(-w) : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ (a + d + (1 : ℕ)))), with hne : (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

            Lean, lines 497–499
                    have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                      have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                      linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 497–499 at 2987e49b6fb3 ↗

            1. hcore.key1.s1.hne.this have (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ))

              Leaves (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ)).

              Uses library one_lt_pow₀.

              Lean, line 498
                        have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 498 at 2987e49b6fb3 ↗

          4. hcore.key1.s1.h2a have (2 : ℚ) ^ a ≠ (0 : ℚ) routine: positivity

            Leaves (↑(-w) : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ (a + d + (1 : ℕ)))), with h2a : (2 : ℚ) ^ a ≠ (0 : ℚ).

            Lean, line 500
                    have h2a : (2 : ℚ) ^ a ≠ 0 := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 500 at 2987e49b6fb3 ↗

          5. hcore.key1.s1.this have (2 : ℚ) ^ a - (2 : ℚ) ^ a * (2 : ℚ) ^ (d + (1 : ℕ)) = -((2 : ℚ) ^ a * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))) routine: ring

            Leaves (↑(-w) : ℚ) = (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ a * (2 : ℚ) ^ (d + (1 : ℕ)))), with this : (2 : ℚ) ^ a - (2 : ℚ) ^ a * (2 : ℚ) ^ (d + (1 : ℕ)) = -((2 : ℚ) ^ a * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ))).

            Lean, line 502
                    have : (2 : ℚ) ^ a - 2 ^ a * 2 ^ (d + 1) = -(2 ^ a * (2 ^ (d + 1) - 1)) := by ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 502 at 2987e49b6fb3 ↗

        2. hcore.key1.s2 case

          Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ a * ((1 : ℚ) / ((2 : ℚ) ^ a - (2 : ℚ) ^ b)).

          Uses library Exists.intro Existential introduction. , pow_add.

          Lean, lines 507–519
                · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hgt
                  obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
                  refine ⟨w * 2 ^ (d + 1), ?_⟩
                  have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                    have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                    linarith
                  have h2b : (2 : ℚ) ^ b ≠ 0 := by positivity
                  rw [← hw, show b + d + 1 = b + (d + 1) by ring, show (2 : ℚ) ^ (b + (d + 1)) = 2 ^ b * 2 ^ (d + 1) from pow_add _ _ _]
                  have : (2 : ℚ) ^ b * 2 ^ (d + 1) - 2 ^ b = 2 ^ b * (2 ^ (d + 1) - 1) := by ring
                  rw [this]
                  field_simp
                  push_cast
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 507–519 at 2987e49b6fb3 ↗

          1. hcore.key1.s2.s1 obtain ∃ (k : ℕ), a = b + k + (1 : ℕ)

            Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ (b + d + (1 : ℕ)) * ((1 : ℚ) / ((2 : ℚ) ^ (b + d + (1 : ℕ)) - (2 : ℚ) ^ b)), with d : ℕ, hab : b + d + (1 : ℕ) ≠ b, ha : b + d + (1 : ℕ) ≤ (2 : ℕ) * n, hgt : b + d + (1 : ℕ) > b.

            Uses library Nat.exists_eq_add_of_lt.

            Lean, line 507
                  · obtain ⟨d, rfl⟩ := Nat.exists_eq_add_of_lt hgt

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 507 at 2987e49b6fb3 ↗

          2. hcore.key1.s2.s2 obtain ∃ (w : ℤ), (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ)

            Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ (b + d + (1 : ℕ)) * ((1 : ℚ) / ((2 : ℚ) ^ (b + d + (1 : ℕ)) - (2 : ℚ) ^ b)), with w : ℤ, hw : (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ).

            Lean, line 508
                    obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 508 at 2987e49b6fb3 ↗

          3. hcore.key1.s2.hne have (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

            Leaves (↑(w * (2 : ℤ) ^ (d + (1 : ℕ))) : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ (b + d + (1 : ℕ)) * ((1 : ℚ) / ((2 : ℚ) ^ (b + d + (1 : ℕ)) - (2 : ℚ) ^ b)), with hne : (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

            Lean, lines 510–512
                    have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                      have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                      linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 510–512 at 2987e49b6fb3 ↗

            1. hcore.key1.s2.hne.this have (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ))

              Leaves (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ)).

              Uses library one_lt_pow₀.

              Lean, line 511
                        have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 511 at 2987e49b6fb3 ↗

          4. hcore.key1.s2.h2b have (2 : ℚ) ^ b ≠ (0 : ℚ) routine: positivity

            Leaves (↑(w * (2 : ℤ) ^ (d + (1 : ℕ))) : ℚ) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) ((2 : ℕ) * n), ((2 : ℤ) ^ t - (1 : ℤ))) : ℚ) * (2 : ℚ) ^ (b + d + (1 : ℕ)) * ((1 : ℚ) / ((2 : ℚ) ^ (b + d + (1 : ℕ)) - (2 : ℚ) ^ b)), with h2b : (2 : ℚ) ^ b ≠ (0 : ℚ).

            Lean, line 513
                    have h2b : (2 : ℚ) ^ b ≠ 0 := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 513 at 2987e49b6fb3 ↗

          5. hcore.key1.s2.this have (2 : ℚ) ^ b * (2 : ℚ) ^ (d + (1 : ℕ)) - (2 : ℚ) ^ b = (2 : ℚ) ^ b * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) routine: ring

            Leaves (↑(w * (2 : ℤ) ^ (d + (1 : ℕ))) : ℚ) = (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) * ((2 : ℚ) ^ b * (2 : ℚ) ^ (d + (1 : ℕ))) * ((1 : ℚ) / ((2 : ℚ) ^ b * (2 : ℚ) ^ (d + (1 : ℕ)) - (2 : ℚ) ^ b)), with this : (2 : ℚ) ^ b * (2 : ℚ) ^ (d + (1 : ℕ)) - (2 : ℚ) ^ b = (2 : ℚ) ^ b * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)).

            Lean, line 515
                    have : (2 : ℚ) ^ b * 2 ^ (d + 1) - 2 ^ b = 2 ^ b * (2 ^ (d + 1) - 1) := by ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 515 at 2987e49b6fb3 ↗

      5. hcore.hK have ∀ K ∈ Finset.Ioc n ((2 : ℕ) * n), ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hK : ∀ K ∈ Finset.Ioc n ((2 : ℕ) * n), ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

        Lean, lines 521–525
            have hK : ∀ K ∈ Finset.Ioc n (2 * n), ∃ w : ℤ,
                (w : ℚ) = (Ω : ℚ) * 2 ^ k * (1 / ((2 : ℚ) ^ k - 2 ^ K)) := by
              intro K hK'
              have := Finset.mem_Ioc.mp hK'
              exact key1 k K (by omega) (by omega) (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 521–525 at 2987e49b6fb3 ↗

        1. hcore.hK.this have n < K ∧ K ≤ (2 : ℕ) * n

          Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K)), with this : n < K ∧ K ≤ (2 : ℕ) * n.

          Uses library Finset.mem_Ioc.

          Lean, line 524
                have := Finset.mem_Ioc.mp hK'

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 524 at 2987e49b6fb3 ↗

      6. hcore.hI have ∀ i ∈ (Finset.range (n + (1 : ℕ))).erase k, ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hI : ∀ i ∈ (Finset.range (n + (1 : ℕ))).erase k, ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Ne.symm.

        Lean, lines 526–531
            have hI : ∀ i ∈ (Finset.range (n + 1)).erase k, ∃ w : ℤ,
                (w : ℚ) = (Ω : ℚ) * 2 ^ k * (1 / ((2 : ℚ) ^ k - 2 ^ i)) := by
              intro i hi
              have h1 := Finset.ne_of_mem_erase hi
              have h2 := Finset.mem_range.mp (Finset.mem_of_mem_erase hi)
              exact key1 k i (Ne.symm h1) (by omega) (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 526–531 at 2987e49b6fb3 ↗

        1. hcore.hI.h1 have i ≠ k

          Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)), with h1 : i ≠ k.

          Uses library Finset.ne_of_mem_erase.

          Lean, line 529
                have h1 := Finset.ne_of_mem_erase hi

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 529 at 2987e49b6fb3 ↗

        2. hcore.hI.h2 have i < n + (1 : ℕ)

          Leaves ∃ (w : ℤ), (↑w : ℚ) = (↑Ω : ℚ) * (2 : ℚ) ^ k * ((1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)), with h2 : i < n + (1 : ℕ).

          Uses library Finset.mem_range, Finset.mem_of_mem_erase.

          Lean, line 530
                have h2 := Finset.mem_range.mp (Finset.mem_of_mem_erase hi)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 530 at 2987e49b6fb3 ↗

      7. hcore.hT have ∀ j ∈ Finset.Ioc k n, ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hT : ∀ j ∈ Finset.Ioc k n, ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Exists.intro Existential introduction. , pow_add.

        Lean, lines 532–552
            have hT : ∀ j ∈ Finset.Ioc k n, ∃ w : ℤ,
                (w : ℚ) * 2 ^ (k * (k - 1) / 2) = (Ω : ℚ) * (Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k))) := by
              intro j hj
              have hj' := Finset.mem_Ioc.mp hj
              obtain ⟨d, hd⟩ : ∃ d, j - k = d + 1 := ⟨j - k - 1, by omega⟩
              obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)
              have hmono : k * (k - 1) / 2 ≤ j * (j - 1) / 2 :=
                Nat.div_le_div_right (Nat.mul_le_mul (by omega) (by omega))
              obtain ⟨e, he⟩ := Nat.exists_eq_add_of_le hmono
              refine ⟨-(w * g j * 2 ^ e * 2 ^ (d + 1)), ?_⟩
              have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hne' : (1 : ℚ) - 2 ^ (d + 1) ≠ 0 := by
                intro h
                apply hne
                linarith
              rw [hd, hg j, he, ← hw, show (2 : ℚ) ^ (k * (k - 1) / 2 + e) = 2 ^ (k * (k - 1) / 2) * 2 ^ e from pow_add _ _ _]
              field_simp
              push_cast
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 532–552 at 2987e49b6fb3 ↗

        1. hcore.hT.hj' have k < j ∧ j ≤ n

          Leaves ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with hj' : k < j ∧ j ≤ n.

          Uses library Finset.mem_Ioc.

          Lean, line 535
                have hj' := Finset.mem_Ioc.mp hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 535 at 2987e49b6fb3 ↗

        2. hcore.hT.s2 obtain ∃ (d : ℕ), j - k = d + (1 : ℕ)

          Leaves ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with d : ℕ, hd : j - k = d + (1 : ℕ).

          Uses library Exists.intro Existential introduction. .

          Lean, line 536
                obtain ⟨d, hd⟩ : ∃ d, j - k = d + 1 := ⟨j - k - 1, by omega⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 536 at 2987e49b6fb3 ↗

        3. hcore.hT.s3 obtain ∃ (w : ℤ), (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑Ω : ℚ)

          Leaves ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with w : ℤ, hw : (↑w : ℚ) * ((2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ)) = (↑Ω : ℚ).

          Lean, line 537
                obtain ⟨w, hw⟩ := hΩdiv (d + 1) (by omega) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 537 at 2987e49b6fb3 ↗

        4. hcore.hT.hmono have k * (k - (1 : ℕ)) / (2 : ℕ) ≤ j * (j - (1 : ℕ)) / (2 : ℕ)

          Leaves ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with hmono : k * (k - (1 : ℕ)) / (2 : ℕ) ≤ j * (j - (1 : ℕ)) / (2 : ℕ).

          Uses library Nat.div_le_div_right, Nat.mul_le_mul.

          Lean, lines 538–539
                have hmono : k * (k - 1) / 2 ≤ j * (j - 1) / 2 :=
                  Nat.div_le_div_right (Nat.mul_le_mul (by omega) (by omega))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 538–539 at 2987e49b6fb3 ↗

        5. hcore.hT.s5 obtain ∃ (k_1 : ℕ), j * (j - (1 : ℕ)) / (2 : ℕ) = k * (k - (1 : ℕ)) / (2 : ℕ) + k_1

          Leaves ∃ (w : ℤ), (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with e : ℕ, he : j * (j - (1 : ℕ)) / (2 : ℕ) = k * (k - (1 : ℕ)) / (2 : ℕ) + e.

          Uses library Nat.exists_eq_add_of_le.

          Lean, line 540
                obtain ⟨e, he⟩ := Nat.exists_eq_add_of_le hmono

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 540 at 2987e49b6fb3 ↗

        6. hcore.hT.hne have (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ)

          Leaves (↑(-(w * g j * (2 : ℤ) ^ e * (2 : ℤ) ^ (d + (1 : ℕ)))) : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with hne : (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ).

          Lean, lines 542–544
                have hne : (2 : ℚ) ^ (d + 1) - 1 ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 542–544 at 2987e49b6fb3 ↗

          1. hcore.hT.hne.this have (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ))

            Leaves (2 : ℚ) ^ (d + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (d + (1 : ℕ)).

            Uses library one_lt_pow₀.

            Lean, line 543
                    have : (1 : ℚ) < 2 ^ (d + 1) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 543 at 2987e49b6fb3 ↗

        7. hcore.hT.hne' have (1 : ℚ) - (2 : ℚ) ^ (d + (1 : ℕ)) ≠ (0 : ℚ)

          Leaves (↑(-(w * g j * (2 : ℤ) ^ e * (2 : ℤ) ^ (d + (1 : ℕ)))) : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (↑Ω : ℚ) * (Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))), with hne' : (1 : ℚ) - (2 : ℚ) ^ (d + (1 : ℕ)) ≠ (0 : ℚ).

          Lean, lines 545–548
                have hne' : (1 : ℚ) - 2 ^ (d + 1) ≠ 0 := by
                  intro h
                  apply hne
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 545–548 at 2987e49b6fb3 ↗

      8. hcore.h2adic have (↑Ω : ℚ) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * (↑(g k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), fK K - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, fI i) - ∑ j ∈ Finset.Ioc k n, fT j) : ℚ)

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with h2adic : (↑Ω : ℚ) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) = (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * (↑(g k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), fK K - ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, fI i) - ∑ j ∈ Finset.Ioc k n, fT j) : ℚ).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.mul_sum, one_div.

        Lean, lines 556–570
            have h2adic : (Ω : ℚ) * ∑ j ∈ Finset.range (k + 1), Qc n j / ((2 : ℚ) ^ (k - j) - 1) =
                2 ^ (k * (k - 1) / 2) * ((g k * (∑ K ∈ Finset.Ioc n (2 * n), fK K -
                  ∑ i ∈ (Finset.range (n + 1)).erase k, fI i) - ∑ j ∈ Finset.Ioc k n, fT j : ℤ) : ℚ) := by
              rw [hform Qc hQc n k hk]
              push_cast
              rw [Finset.sum_congr rfl hfK, Finset.sum_congr rfl hfI, ← Finset.mul_sum, ← Finset.mul_sum]
              have htail : (2 : ℚ) ^ (k * (k - 1) / 2) * ∑ j ∈ Finset.Ioc k n, (fT j : ℚ) =
                  (Ω : ℚ) * ∑ j ∈ Finset.Ioc k n, Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
                rw [Finset.mul_sum, Finset.mul_sum]
                refine Finset.sum_congr rfl (fun j hj => ?_)
                rw [mul_comm]
                exact hfT j hj
              rw [hg k]
              simp only [one_div] at htail ⊢
              linear_combination htail

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 556–570 at 2987e49b6fb3 ↗

        1. hcore.h2adic.htail have (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∑ j ∈ Finset.Ioc k n, (↑(fT j) : ℚ) = (↑Ω : ℚ) * ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))

          Leaves (↑Ω : ℚ) * (Qc n k * (2 : ℚ) ^ k * (∑ K ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K) - ∑ K ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ K)) - ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k))) = (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ((↑(g k) : ℚ) * ((↑Ω : ℚ) * (2 : ℚ) ^ k * ∑ i ∈ Finset.Ioc n ((2 : ℕ) * n), (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i) - (↑Ω : ℚ) * (2 : ℚ) ^ k * ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (1 : ℚ) / ((2 : ℚ) ^ k - (2 : ℚ) ^ i)) - ∑ x ∈ Finset.Ioc k n, (↑(fT x) : ℚ)), with htail : (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∑ j ∈ Finset.Ioc k n, (↑(fT j) : ℚ) = (↑Ω : ℚ) * ∑ j ∈ Finset.Ioc k n, Qc n j * (2 : ℚ) ^ (j - k) / ((1 : ℚ) - (2 : ℚ) ^ (j - k)).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , mul_comm.

          Lean, lines 562–567
                have htail : (2 : ℚ) ^ (k * (k - 1) / 2) * ∑ j ∈ Finset.Ioc k n, (fT j : ℚ) =
                    (Ω : ℚ) * ∑ j ∈ Finset.Ioc k n, Qc n j * 2 ^ (j - k) / (1 - 2 ^ (j - k)) := by
                  rw [Finset.mul_sum, Finset.mul_sum]
                  refine Finset.sum_congr rfl (fun j hj => ?_)
                  rw [mul_comm]
                  exact hfT j hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 562–567 at 2987e49b6fb3 ↗

      9. hcore.s9 obtain ∃ (z : ℤ), (↑z : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), (↑((2 : ℤ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * g j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with B : ℤ, hB : (↑B : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), (↑((2 : ℤ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * g j) : ℚ) / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

        Lean, line 572
            obtain ⟨B, hB⟩ := hodd n k hk (fun j => 2 ^ (j * (j - 1) / 2) * g j)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 572 at 2987e49b6fb3 ↗

      10. hcore.hB' have (↑B : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

        Leaves ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)), with hB' : (↑B : ℚ) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

        Lean, lines 573–580
            have hB' : (B : ℚ) = (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)) := by
              rw [hB]
              congr 1
              refine Finset.sum_congr rfl (fun j _ => ?_)
              rw [hg j]
              push_cast
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 573–580 at 2987e49b6fb3 ↗

    16. hcnall have ∀ (n : ℕ), ∃ (z : ℤ), (↑z : ℚ) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))

      Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hcnall : ∀ (n : ℕ), ∃ (z : ℤ), (↑z : ℚ) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)).

      Uses library Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 584–617
        have hcnall : ∀ n : ℕ, ∃ z : ℤ, (z : ℚ) = (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
            ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + 1) - 3) := by
          intro n
          have hint : ∀ j ∈ Finset.range n, ∃ z : ℤ,
              (z : ℚ) = (∏ i ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (i + 1) - 3)) * ((3 : ℚ) / ((2 : ℚ) ^ (j + 1) - 3)) := by
            intro j hj
            by_cases h2 : j < 2
            · have hj' : j = 0 ∨ j = 1 := by omega
              rcases hj' with rfl | rfl
              · refine ⟨-3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                have e : (3 : ℚ) / ((2 : ℚ) ^ (0 + 1) - 3) = -3 := by norm_num
                rw [e]
                push_cast
                ring
              · refine ⟨3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                have e : (3 : ℚ) / ((2 : ℚ) ^ (1 + 1) - 3) = 3 := by norm_num
                rw [e]
                push_cast
                ring
            · have hmem : j ∈ Finset.Ico 2 n := Finset.mem_Ico.mpr ⟨by omega, Finset.mem_range.mp hj⟩
              have hne : ((2 : ℚ) ^ (j + 1) - 3) ≠ 0 := by
                have h8 : (8 : ℚ) ≤ 2 ^ (j + 1) := by
                  calc (8 : ℚ) = 2 ^ 3 := by norm_num
                    _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                linarith
              refine ⟨3 * ∏ i ∈ (Finset.Ico 2 n).erase j, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
              rw [← Finset.mul_prod_erase _ _ hmem]
              push_cast
              field_simp
          choose! g hg using hint
          refine ⟨∑ j ∈ Finset.range n, g j, ?_⟩
          push_cast
          rw [Finset.mul_sum]
          exact Finset.sum_congr rfl hg

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 584–617 at 2987e49b6fb3 ↗

      1. hcnall.hint have ∀ j ∈ Finset.range n, ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))

        Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)), with hint : ∀ j ∈ Finset.range n, ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

        Lean, lines 587–612
            have hint : ∀ j ∈ Finset.range n, ∃ z : ℤ,
                (z : ℚ) = (∏ i ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (i + 1) - 3)) * ((3 : ℚ) / ((2 : ℚ) ^ (j + 1) - 3)) := by
              intro j hj
              by_cases h2 : j < 2
              · have hj' : j = 0 ∨ j = 1 := by omega
                rcases hj' with rfl | rfl
                · refine ⟨-3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                  have e : (3 : ℚ) / ((2 : ℚ) ^ (0 + 1) - 3) = -3 := by norm_num
                  rw [e]
                  push_cast
                  ring
                · refine ⟨3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                  have e : (3 : ℚ) / ((2 : ℚ) ^ (1 + 1) - 3) = 3 := by norm_num
                  rw [e]
                  push_cast
                  ring
              · have hmem : j ∈ Finset.Ico 2 n := Finset.mem_Ico.mpr ⟨by omega, Finset.mem_range.mp hj⟩
                have hne : ((2 : ℚ) ^ (j + 1) - 3) ≠ 0 := by
                  have h8 : (8 : ℚ) ≤ 2 ^ (j + 1) := by
                    calc (8 : ℚ) = 2 ^ 3 := by norm_num
                      _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                  linarith
                refine ⟨3 * ∏ i ∈ (Finset.Ico 2 n).erase j, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                rw [← Finset.mul_prod_erase _ _ hmem]
                push_cast
                field_simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 587–612 at 2987e49b6fb3 ↗

        1. hcnall.hint.s1 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))).

          Lean, lines 591–602
                · have hj' : j = 0 ∨ j = 1 := by omega
                  rcases hj' with rfl | rfl
                  · refine ⟨-3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                    have e : (3 : ℚ) / ((2 : ℚ) ^ (0 + 1) - 3) = -3 := by norm_num
                    rw [e]
                    push_cast
                    ring
                  · refine ⟨3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                    have e : (3 : ℚ) / ((2 : ℚ) ^ (1 + 1) - 3) = 3 := by norm_num
                    rw [e]
                    push_cast
                    ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 591–602 at 2987e49b6fb3 ↗

          1. hcnall.hint.s1.hj' have j = (0 : ℕ) ∨ j = (1 : ℕ) routine: omega

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))), with hj' : j = (0 : ℕ) ∨ j = (1 : ℕ).

            Lean, line 591
                  · have hj' : j = 0 ∨ j = 1 := by omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 591 at 2987e49b6fb3 ↗

          2. hcnall.hint.s1.s2 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ ((0 : ℕ) + (1 : ℕ)) - (3 : ℚ))).

            Uses library Exists.intro Existential introduction. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

            Lean, lines 593–597
                    · refine ⟨-3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                      have e : (3 : ℚ) / ((2 : ℚ) ^ (0 + 1) - 3) = -3 := by norm_num
                      rw [e]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 593–597 at 2987e49b6fb3 ↗

            1. hcnall.hint.s1.s2.e have (3 : ℚ) / ((2 : ℚ) ^ ((0 : ℕ) + (1 : ℕ)) - (3 : ℚ)) = (-3 : ℚ) routine: norm_num

              Leaves (↑((-3 : ℤ) * ∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℤ) ^ (i + (1 : ℕ)) - (3 : ℤ))) : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ ((0 : ℕ) + (1 : ℕ)) - (3 : ℚ))), with e : (3 : ℚ) / ((2 : ℚ) ^ ((0 : ℕ) + (1 : ℕ)) - (3 : ℚ)) = (-3 : ℚ).

              Lean, line 594
                        have e : (3 : ℚ) / ((2 : ℚ) ^ (0 + 1) - 3) = -3 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 594 at 2987e49b6fb3 ↗

          3. hcnall.hint.s1.s3 case

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ ((1 : ℕ) + (1 : ℕ)) - (3 : ℚ))).

            Uses library Exists.intro Existential introduction. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

            Lean, lines 598–602
                    · refine ⟨3 * ∏ i ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                      have e : (3 : ℚ) / ((2 : ℚ) ^ (1 + 1) - 3) = 3 := by norm_num
                      rw [e]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 598–602 at 2987e49b6fb3 ↗

            1. hcnall.hint.s1.s3.e have (3 : ℚ) / ((2 : ℚ) ^ ((1 : ℕ) + (1 : ℕ)) - (3 : ℚ)) = (3 : ℚ) routine: norm_num

              Leaves (↑((3 : ℤ) * ∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℤ) ^ (i + (1 : ℕ)) - (3 : ℤ))) : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ ((1 : ℕ) + (1 : ℕ)) - (3 : ℚ))), with e : (3 : ℚ) / ((2 : ℚ) ^ ((1 : ℕ) + (1 : ℕ)) - (3 : ℚ)) = (3 : ℚ).

              Lean, line 599
                        have e : (3 : ℚ) / ((2 : ℚ) ^ (1 + 1) - 3) = 3 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 599 at 2987e49b6fb3 ↗

        2. hcnall.hint.s2 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))).

          Uses library Exists.intro Existential introduction. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mul_prod_erase Taking a product over s : Finset ι is the same as multiplying the value on a single element f a by the product of s.erase a. .

          Lean, lines 603–612
                · have hmem : j ∈ Finset.Ico 2 n := Finset.mem_Ico.mpr ⟨by omega, Finset.mem_range.mp hj⟩
                  have hne : ((2 : ℚ) ^ (j + 1) - 3) ≠ 0 := by
                    have h8 : (8 : ℚ) ≤ 2 ^ (j + 1) := by
                      calc (8 : ℚ) = 2 ^ 3 := by norm_num
                        _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                    linarith
                  refine ⟨3 * ∏ i ∈ (Finset.Ico 2 n).erase j, ((2 : ℤ) ^ (i + 1) - 3), ?_⟩
                  rw [← Finset.mul_prod_erase _ _ hmem]
                  push_cast
                  field_simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 603–612 at 2987e49b6fb3 ↗

          1. hcnall.hint.s2.hmem have j ∈ Finset.Ico (2 : ℕ) n

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))), with hmem : j ∈ Finset.Ico (2 : ℕ) n.

            Uses library Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ico, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , Finset.mem_range.

            Lean, line 603
                  · have hmem : j ∈ Finset.Ico 2 n := Finset.mem_Ico.mpr ⟨by omega, Finset.mem_range.mp hj⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 603 at 2987e49b6fb3 ↗

          2. hcnall.hint.s2.hne have (2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ) ≠ (0 : ℚ)

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (∏ i ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (i + (1 : ℕ)) - (3 : ℚ))) * ((3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))), with hne : (2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ) ≠ (0 : ℚ).

            Lean, lines 604–608
                    have hne : ((2 : ℚ) ^ (j + 1) - 3) ≠ 0 := by
                      have h8 : (8 : ℚ) ≤ 2 ^ (j + 1) := by
                        calc (8 : ℚ) = 2 ^ 3 := by norm_num
                          _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                      linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 604–608 at 2987e49b6fb3 ↗

            1. hcnall.hint.s2.hne.h8 have (8 : ℚ) ≤ (2 : ℚ) ^ (j + (1 : ℕ))

              Leaves (2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ) ≠ (0 : ℚ), with h8 : (8 : ℚ) ≤ (2 : ℚ) ^ (j + (1 : ℕ)).

              Lean, lines 605–607
                        have h8 : (8 : ℚ) ≤ 2 ^ (j + 1) := by
                          calc (8 : ℚ) = 2 ^ 3 := by norm_num
                            _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 605–607 at 2987e49b6fb3 ↗

              1. hcnall.hint.s2.hne.h8.s1 calc (8 : ℚ) = (2 : ℚ) ^ (3 : ℕ) routine: norm_num

                Closes the goal.

                Lean, line 606
                            calc (8 : ℚ) = 2 ^ 3 := by norm_num

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 606 at 2987e49b6fb3 ↗

              2. hcnall.hint.s2.hne.h8.s2 calc (2 : ℚ) ^ (3 : ℕ) ≤ (2 : ℚ) ^ (j + (1 : ℕ))

                Closes the goal.

                Uses library pow_le_pow_right₀.

                Lean, line 607
                              _ ≤ 2 ^ (j + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 607 at 2987e49b6fb3 ↗

    17. hb have (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n)

      Leaves ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hb : (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n).

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

      Lean, lines 619–688
        have hb :
          ((2 ^ (n * (n + 1) / 2) * (if n = 5 then 409045 else if n = 7 then 1298717875 else
                (∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) * ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℕ) : ℝ) ^ 2 ≤
            (2 : ℝ) ^ (3 * n * n) := by
          have key : (2 ^ (n * (n + 1) / 2) * (if n = 5 then 409045 else if n = 7 then 1298717875 else
                  (∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) * ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ)) ^ 2 ≤
              2 ^ (3 * n * n) := by
            rcases (show n ≤ 9 ∨ 10 ≤ n by omega) with hn | hn
            · revert n
              decide +kernel
            · rw [if_neg (by omega), if_neg (by omega)]
              have hP1 : ∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) ≤ 2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) := by
                rw [← Finset.prod_pow_eq_pow_sum]
                exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
              have hP2 : ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) ≤ 2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)) := by
                rw [← Finset.prod_pow_eq_pow_sum]
                exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
              obtain ⟨c, hc⟩ : ∃ c, n = n / 2 + c + 1 := ⟨n - n / 2 - 1, by omega⟩
              obtain ⟨d, hd⟩ : ∃ d, n = d + 3 := ⟨n - 3, by omega⟩
              have hS1 : (∑ m ∈ Finset.Ioc (n / 2) n, m) * 2 = 2 * (c + 1) * (n / 2 + 1) + (c + 1) * c := by
                have e : Finset.Ioc (n / 2) n = Finset.Ico (n / 2 + 1) (n + 1) := by
                  ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
                rw [e, Finset.sum_Ico_eq_sum_range, show n + 1 - (n / 2 + 1) = c + 1 by omega,
                  Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul,
                  Finset.sum_range_id_mul_two]
                simp only [Nat.add_sub_cancel]
                ring
              have hS2 : (∑ j ∈ Finset.Ico 2 n, (j + 1)) * 2 = 6 * (d + 1) + (d + 1) * d := by
                rw [Finset.sum_Ico_eq_sum_range, show n - 2 = d + 1 by omega]
                have : ∀ k ∈ Finset.range (d + 1), 2 + k + 1 = 3 + k := fun k _ => by omega
                rw [Finset.sum_congr rfl this, Finset.sum_add_distrib, Finset.sum_const, Finset.card_range,
                  smul_eq_mul, add_mul, Finset.sum_range_id_mul_two]
                simp only [Nat.add_sub_cancel]
                ring
              have hT : n * (n + 1) / 2 * 2 = n * (n + 1) :=
                Nat.div_mul_cancel (Nat.even_mul_succ_self n).two_dvd
              have hexp : 2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                  2 * (∑ j ∈ Finset.Ico 2 n, (j + 1)) ≤ 3 * n * n := by
                have arith : ∀ e r A B T : ℕ, r ≤ 1 → 3 ≤ e →
                    A * 2 = 2 * (e + 1 + r + 1) * (e + 2 + 1) + (e + 1 + r + 1) * (e + 1 + r) →
                    B * 2 = 6 * (2 * e + 1 + r + 1) + (2 * e + 1 + r + 1) * (2 * e + 1 + r) →
                    T * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) →
                    2 * T + 2 * A + 2 * B ≤ 3 * (2 * e + 4 + r) * (2 * e + 4 + r) := by
                  intro e r A B T hr he hA hB hT
                  have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he
                  rcases (show r = 0 ∨ r = 1 by omega) with rfl | rfl
                  · ring_nf at hA hB hT hsq ⊢
                    omega
                  · ring_nf at hA hB hT hsq ⊢
                    omega
                obtain ⟨e, he⟩ : ∃ e, n / 2 = e + 2 := ⟨n / 2 - 2, by omega⟩
                obtain ⟨r, hr1, hr⟩ : ∃ r, r ≤ 1 ∧ n = 2 * e + 4 + r := ⟨n - (2 * e + 4), by omega, by omega⟩
                have hc' : c = e + 1 + r := by omega
                have hd' : d = 2 * e + 1 + r := by omega
                rw [he, hc'] at hS1
                rw [hd'] at hS2
                have hT' : n * (n + 1) / 2 * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) := by rw [hT, hr]
                have := arith e r _ _ _ hr1 (by omega) hS1 hS2 hT'
                rw [he]
                rw [hr] at this ⊢
                exact this
              calc (2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                      ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3))) ^ 2
                  ≤ (2 ^ (n * (n + 1) / 2) * (2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) *
                      2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)))) ^ 2 := by gcongr
                _ = 2 ^ (2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                      2 * (∑ j ∈ Finset.Ico 2 n, (j + 1))) := by
                  rw [← pow_add, ← pow_add, ← pow_mul]; congr 1; ring
                _ ≤ 2 ^ (3 * n * n) := Nat.pow_le_pow_right (by norm_num) hexp
          exact_mod_cast key

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 619–688 at 2987e49b6fb3 ↗

      1. hb.key have ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n)

        Leaves (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n), with key : ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

        Lean, lines 623–687
            have key : (2 ^ (n * (n + 1) / 2) * (if n = 5 then 409045 else if n = 7 then 1298717875 else
                    (∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) * ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ)) ^ 2 ≤
                2 ^ (3 * n * n) := by
              rcases (show n ≤ 9 ∨ 10 ≤ n by omega) with hn | hn
              · revert n
                decide +kernel
              · rw [if_neg (by omega), if_neg (by omega)]
                have hP1 : ∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) ≤ 2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) := by
                  rw [← Finset.prod_pow_eq_pow_sum]
                  exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
                have hP2 : ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) ≤ 2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)) := by
                  rw [← Finset.prod_pow_eq_pow_sum]
                  exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
                obtain ⟨c, hc⟩ : ∃ c, n = n / 2 + c + 1 := ⟨n - n / 2 - 1, by omega⟩
                obtain ⟨d, hd⟩ : ∃ d, n = d + 3 := ⟨n - 3, by omega⟩
                have hS1 : (∑ m ∈ Finset.Ioc (n / 2) n, m) * 2 = 2 * (c + 1) * (n / 2 + 1) + (c + 1) * c := by
                  have e : Finset.Ioc (n / 2) n = Finset.Ico (n / 2 + 1) (n + 1) := by
                    ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
                  rw [e, Finset.sum_Ico_eq_sum_range, show n + 1 - (n / 2 + 1) = c + 1 by omega,
                    Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul,
                    Finset.sum_range_id_mul_two]
                  simp only [Nat.add_sub_cancel]
                  ring
                have hS2 : (∑ j ∈ Finset.Ico 2 n, (j + 1)) * 2 = 6 * (d + 1) + (d + 1) * d := by
                  rw [Finset.sum_Ico_eq_sum_range, show n - 2 = d + 1 by omega]
                  have : ∀ k ∈ Finset.range (d + 1), 2 + k + 1 = 3 + k := fun k _ => by omega
                  rw [Finset.sum_congr rfl this, Finset.sum_add_distrib, Finset.sum_const, Finset.card_range,
                    smul_eq_mul, add_mul, Finset.sum_range_id_mul_two]
                  simp only [Nat.add_sub_cancel]
                  ring
                have hT : n * (n + 1) / 2 * 2 = n * (n + 1) :=
                  Nat.div_mul_cancel (Nat.even_mul_succ_self n).two_dvd
                have hexp : 2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                    2 * (∑ j ∈ Finset.Ico 2 n, (j + 1)) ≤ 3 * n * n := by
                  have arith : ∀ e r A B T : ℕ, r ≤ 1 → 3 ≤ e →
                      A * 2 = 2 * (e + 1 + r + 1) * (e + 2 + 1) + (e + 1 + r + 1) * (e + 1 + r) →
                      B * 2 = 6 * (2 * e + 1 + r + 1) + (2 * e + 1 + r + 1) * (2 * e + 1 + r) →
                      T * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) →
                      2 * T + 2 * A + 2 * B ≤ 3 * (2 * e + 4 + r) * (2 * e + 4 + r) := by
                    intro e r A B T hr he hA hB hT
                    have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he
                    rcases (show r = 0 ∨ r = 1 by omega) with rfl | rfl
                    · ring_nf at hA hB hT hsq ⊢
                      omega
                    · ring_nf at hA hB hT hsq ⊢
                      omega
                  obtain ⟨e, he⟩ : ∃ e, n / 2 = e + 2 := ⟨n / 2 - 2, by omega⟩
                  obtain ⟨r, hr1, hr⟩ : ∃ r, r ≤ 1 ∧ n = 2 * e + 4 + r := ⟨n - (2 * e + 4), by omega, by omega⟩
                  have hc' : c = e + 1 + r := by omega
                  have hd' : d = 2 * e + 1 + r := by omega
                  rw [he, hc'] at hS1
                  rw [hd'] at hS2
                  have hT' : n * (n + 1) / 2 * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) := by rw [hT, hr]
                  have := arith e r _ _ _ hr1 (by omega) hS1 hS2 hT'
                  rw [he]
                  rw [hr] at this ⊢
                  exact this
                calc (2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                        ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3))) ^ 2
                    ≤ (2 ^ (n * (n + 1) / 2) * (2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) *
                        2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)))) ^ 2 := by gcongr
                  _ = 2 ^ (2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                        2 * (∑ j ∈ Finset.Ico 2 n, (j + 1))) := by
                    rw [← pow_add, ← pow_add, ← pow_mul]; congr 1; ring
                  _ ≤ 2 ^ (3 * n * n) := Nat.pow_le_pow_right (by norm_num) hexp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 623–687 at 2987e49b6fb3 ↗

        1. hb.key.s1 case

          Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n).

          Uses library Lean.Parser.Tactic.DecideConfig.kernel If true (default: false), then use only kernel reduction when reducing the Decidable instance. .

          Lean, lines 627–628
                · revert n
                  decide +kernel

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 627–628 at 2987e49b6fb3 ↗

        2. hb.key.s2 case

          Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n).

          Uses library if_neg.

          Lean, lines 629–687
                · rw [if_neg (by omega), if_neg (by omega)]
                  have hP1 : ∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) ≤ 2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) := by
                    rw [← Finset.prod_pow_eq_pow_sum]
                    exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
                  have hP2 : ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) ≤ 2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)) := by
                    rw [← Finset.prod_pow_eq_pow_sum]
                    exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)
                  obtain ⟨c, hc⟩ : ∃ c, n = n / 2 + c + 1 := ⟨n - n / 2 - 1, by omega⟩
                  obtain ⟨d, hd⟩ : ∃ d, n = d + 3 := ⟨n - 3, by omega⟩
                  have hS1 : (∑ m ∈ Finset.Ioc (n / 2) n, m) * 2 = 2 * (c + 1) * (n / 2 + 1) + (c + 1) * c := by
                    have e : Finset.Ioc (n / 2) n = Finset.Ico (n / 2 + 1) (n + 1) := by
                      ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
                    rw [e, Finset.sum_Ico_eq_sum_range, show n + 1 - (n / 2 + 1) = c + 1 by omega,
                      Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul,
                      Finset.sum_range_id_mul_two]
                    simp only [Nat.add_sub_cancel]
                    ring
                  have hS2 : (∑ j ∈ Finset.Ico 2 n, (j + 1)) * 2 = 6 * (d + 1) + (d + 1) * d := by
                    rw [Finset.sum_Ico_eq_sum_range, show n - 2 = d + 1 by omega]
                    have : ∀ k ∈ Finset.range (d + 1), 2 + k + 1 = 3 + k := fun k _ => by omega
                    rw [Finset.sum_congr rfl this, Finset.sum_add_distrib, Finset.sum_const, Finset.card_range,
                      smul_eq_mul, add_mul, Finset.sum_range_id_mul_two]
                    simp only [Nat.add_sub_cancel]
                    ring
                  have hT : n * (n + 1) / 2 * 2 = n * (n + 1) :=
                    Nat.div_mul_cancel (Nat.even_mul_succ_self n).two_dvd
                  have hexp : 2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                      2 * (∑ j ∈ Finset.Ico 2 n, (j + 1)) ≤ 3 * n * n := by
                    have arith : ∀ e r A B T : ℕ, r ≤ 1 → 3 ≤ e →
                        A * 2 = 2 * (e + 1 + r + 1) * (e + 2 + 1) + (e + 1 + r + 1) * (e + 1 + r) →
                        B * 2 = 6 * (2 * e + 1 + r + 1) + (2 * e + 1 + r + 1) * (2 * e + 1 + r) →
                        T * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) →
                        2 * T + 2 * A + 2 * B ≤ 3 * (2 * e + 4 + r) * (2 * e + 4 + r) := by
                      intro e r A B T hr he hA hB hT
                      have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he
                      rcases (show r = 0 ∨ r = 1 by omega) with rfl | rfl
                      · ring_nf at hA hB hT hsq ⊢
                        omega
                      · ring_nf at hA hB hT hsq ⊢
                        omega
                    obtain ⟨e, he⟩ : ∃ e, n / 2 = e + 2 := ⟨n / 2 - 2, by omega⟩
                    obtain ⟨r, hr1, hr⟩ : ∃ r, r ≤ 1 ∧ n = 2 * e + 4 + r := ⟨n - (2 * e + 4), by omega, by omega⟩
                    have hc' : c = e + 1 + r := by omega
                    have hd' : d = 2 * e + 1 + r := by omega
                    rw [he, hc'] at hS1
                    rw [hd'] at hS2
                    have hT' : n * (n + 1) / 2 * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) := by rw [hT, hr]
                    have := arith e r _ _ _ hr1 (by omega) hS1 hS2 hT'
                    rw [he]
                    rw [hr] at this ⊢
                    exact this
                  calc (2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                          ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3))) ^ 2
                      ≤ (2 ^ (n * (n + 1) / 2) * (2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) *
                          2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)))) ^ 2 := by gcongr
                    _ = 2 ^ (2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                          2 * (∑ j ∈ Finset.Ico 2 n, (j + 1))) := by
                      rw [← pow_add, ← pow_add, ← pow_mul]; congr 1; ring
                    _ ≤ 2 ^ (3 * n * n) := Nat.pow_le_pow_right (by norm_num) hexp

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 629–687 at 2987e49b6fb3 ↗

          1. hb.key.s2.hP1 have ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ)) ≤ (2 : ℕ) ^ ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hP1 : ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ)) ≤ (2 : ℕ) ^ ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.prod_pow_eq_pow_sum, Finset.prod_le_prod' In an ordered commutative monoid, if each factor f i of one finite product is less than or equal to the corresponding factor g i of another finite product, then ∏ i ∈ s, f i ≤ ∏ i ∈ s, g i. , Nat.sub_le.

            Lean, lines 630–632
                    have hP1 : ∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) ≤ 2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) := by
                      rw [← Finset.prod_pow_eq_pow_sum]
                      exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 630–632 at 2987e49b6fb3 ↗

          2. hb.key.s2.hP2 have ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)) ≤ (2 : ℕ) ^ ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ))

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hP2 : ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)) ≤ (2 : ℕ) ^ ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)).

            Uses library Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.prod_pow_eq_pow_sum, Finset.prod_le_prod' In an ordered commutative monoid, if each factor f i of one finite product is less than or equal to the corresponding factor g i of another finite product, then ∏ i ∈ s, f i ≤ ∏ i ∈ s, g i. , Nat.sub_le.

            Lean, lines 633–635
                    have hP2 : ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) ≤ 2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)) := by
                      rw [← Finset.prod_pow_eq_pow_sum]
                      exact Finset.prod_le_prod' (fun m _ => Nat.sub_le _ _)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 633–635 at 2987e49b6fb3 ↗

          3. hb.key.s2.s3 obtain ∃ (c : ℕ), n = n / (2 : ℕ) + c + (1 : ℕ)

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with c : ℕ, hc : n = n / (2 : ℕ) + c + (1 : ℕ).

            Uses library Exists.intro Existential introduction. .

            Lean, line 636
                    obtain ⟨c, hc⟩ : ∃ c, n = n / 2 + c + 1 := ⟨n - n / 2 - 1, by omega⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 636 at 2987e49b6fb3 ↗

          4. hb.key.s2.s4 obtain ∃ (d : ℕ), n = d + (3 : ℕ)

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with d : ℕ, hd : n = d + (3 : ℕ).

            Uses library Exists.intro Existential introduction. .

            Lean, line 637
                    obtain ⟨d, hd⟩ : ∃ d, n = d + 3 := ⟨n - 3, by omega⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 637 at 2987e49b6fb3 ↗

          5. hb.key.s2.hS1 have (∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m) * (2 : ℕ) = (2 : ℕ) * (c + (1 : ℕ)) * (n / (2 : ℕ) + (1 : ℕ)) + (c + (1 : ℕ)) * c

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hS1 : (∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m) * (2 : ℕ) = (2 : ℕ) * (c + (1 : ℕ)) * (n / (2 : ℕ) + (1 : ℕ)) + (c + (1 : ℕ)) * c.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.sum_Ico_eq_sum_range, Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul Alias of right_distrib. , Finset.sum_range_id_mul_two Gauss' summation formula , Nat.add_sub_cancel.

            Lean, lines 638–645
                    have hS1 : (∑ m ∈ Finset.Ioc (n / 2) n, m) * 2 = 2 * (c + 1) * (n / 2 + 1) + (c + 1) * c := by
                      have e : Finset.Ioc (n / 2) n = Finset.Ico (n / 2 + 1) (n + 1) := by
                        ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
                      rw [e, Finset.sum_Ico_eq_sum_range, show n + 1 - (n / 2 + 1) = c + 1 by omega,
                        Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul,
                        Finset.sum_range_id_mul_two]
                      simp only [Nat.add_sub_cancel]
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 638–645 at 2987e49b6fb3 ↗

            1. hb.key.s2.hS1.e have Finset.Ioc (n / (2 : ℕ)) n = Finset.Ico (n / (2 : ℕ) + (1 : ℕ)) (n + (1 : ℕ))

              Leaves (∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m) * (2 : ℕ) = (2 : ℕ) * (c + (1 : ℕ)) * (n / (2 : ℕ) + (1 : ℕ)) + (c + (1 : ℕ)) * c, with e : Finset.Ioc (n / (2 : ℕ)) n = Finset.Ico (n / (2 : ℕ) + (1 : ℕ)) (n + (1 : ℕ)).

              Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ioc, Finset.mem_Ico.

              Lean, lines 639–640
                        have e : Finset.Ioc (n / 2) n = Finset.Ico (n / 2 + 1) (n + 1) := by
                          ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 639–640 at 2987e49b6fb3 ↗

          6. hb.key.s2.hS2 have (∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ))) * (2 : ℕ) = (6 : ℕ) * (d + (1 : ℕ)) + (d + (1 : ℕ)) * d

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hS2 : (∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ))) * (2 : ℕ) = (6 : ℕ) * (d + (1 : ℕ)) + (d + (1 : ℕ)) * d.

            Uses library Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.sum_Ico_eq_sum_range, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.sum_add_distrib, Finset.sum_const, Finset.card_range, smul_eq_mul, add_mul Alias of right_distrib. , Finset.sum_range_id_mul_two Gauss' summation formula , Nat.add_sub_cancel.

            Lean, lines 646–652
                    have hS2 : (∑ j ∈ Finset.Ico 2 n, (j + 1)) * 2 = 6 * (d + 1) + (d + 1) * d := by
                      rw [Finset.sum_Ico_eq_sum_range, show n - 2 = d + 1 by omega]
                      have : ∀ k ∈ Finset.range (d + 1), 2 + k + 1 = 3 + k := fun k _ => by omega
                      rw [Finset.sum_congr rfl this, Finset.sum_add_distrib, Finset.sum_const, Finset.card_range,
                        smul_eq_mul, add_mul, Finset.sum_range_id_mul_two]
                      simp only [Nat.add_sub_cancel]
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 646–652 at 2987e49b6fb3 ↗

            1. hb.key.s2.hS2.this have ∀ k ∈ Finset.range (d + (1 : ℕ)), (2 : ℕ) + k + (1 : ℕ) = (3 : ℕ) + k

              Leaves (∑ k ∈ Finset.range (d + (1 : ℕ)), ((2 : ℕ) + k + (1 : ℕ))) * (2 : ℕ) = (6 : ℕ) * (d + (1 : ℕ)) + (d + (1 : ℕ)) * d, with this : ∀ k ∈ Finset.range (d + (1 : ℕ)), (2 : ℕ) + k + (1 : ℕ) = (3 : ℕ) + k.

              Uses library Finset.range range n is the set of natural numbers less than n. .

              Lean, line 648
                        have : ∀ k ∈ Finset.range (d + 1), 2 + k + 1 = 3 + k := fun k _ => by omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 648 at 2987e49b6fb3 ↗

          7. hb.key.s2.hT have n * (n + (1 : ℕ)) / (2 : ℕ) * (2 : ℕ) = n * (n + (1 : ℕ))

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hT : n * (n + (1 : ℕ)) / (2 : ℕ) * (2 : ℕ) = n * (n + (1 : ℕ)).

            Uses library Nat.div_mul_cancel, Nat.even_mul_succ_self.

            Lean, lines 653–654
                    have hT : n * (n + 1) / 2 * 2 = n * (n + 1) :=
                      Nat.div_mul_cancel (Nat.even_mul_succ_self n).two_dvd

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 653–654 at 2987e49b6fb3 ↗

          8. hb.key.s2.hexp have (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n

            Leaves ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n), with hexp : (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

            Lean, lines 655–679
                    have hexp : 2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                        2 * (∑ j ∈ Finset.Ico 2 n, (j + 1)) ≤ 3 * n * n := by
                      have arith : ∀ e r A B T : ℕ, r ≤ 1 → 3 ≤ e →
                          A * 2 = 2 * (e + 1 + r + 1) * (e + 2 + 1) + (e + 1 + r + 1) * (e + 1 + r) →
                          B * 2 = 6 * (2 * e + 1 + r + 1) + (2 * e + 1 + r + 1) * (2 * e + 1 + r) →
                          T * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) →
                          2 * T + 2 * A + 2 * B ≤ 3 * (2 * e + 4 + r) * (2 * e + 4 + r) := by
                        intro e r A B T hr he hA hB hT
                        have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he
                        rcases (show r = 0 ∨ r = 1 by omega) with rfl | rfl
                        · ring_nf at hA hB hT hsq ⊢
                          omega
                        · ring_nf at hA hB hT hsq ⊢
                          omega
                      obtain ⟨e, he⟩ : ∃ e, n / 2 = e + 2 := ⟨n / 2 - 2, by omega⟩
                      obtain ⟨r, hr1, hr⟩ : ∃ r, r ≤ 1 ∧ n = 2 * e + 4 + r := ⟨n - (2 * e + 4), by omega, by omega⟩
                      have hc' : c = e + 1 + r := by omega
                      have hd' : d = 2 * e + 1 + r := by omega
                      rw [he, hc'] at hS1
                      rw [hd'] at hS2
                      have hT' : n * (n + 1) / 2 * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) := by rw [hT, hr]
                      have := arith e r _ _ _ hr1 (by omega) hS1 hS2 hT'
                      rw [he]
                      rw [hr] at this ⊢
                      exact this

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 655–679 at 2987e49b6fb3 ↗

            1. hb.key.s2.hexp.arith have ∀ (e r A B T : ℕ), r ≤ (1 : ℕ) → (3 : ℕ) ≤ e → A * (2 : ℕ) = (2 : ℕ) * (e + (1 : ℕ) + r + (1 : ℕ)) * (e + (2 : ℕ) + (1 : ℕ)) + (e + (1 : ℕ) + r + (1 : ℕ)) * (e + (1 : ℕ) + r) → B * (2 : ℕ) = (6 : ℕ) * ((2 : ℕ) * e + (1 : ℕ) + r + (1 : ℕ)) + ((2 : ℕ) * e + (1 : ℕ) + r + (1 : ℕ)) * ((2 : ℕ) * e + (1 : ℕ) + r) → T * (2 : ℕ) = ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r + (1 : ℕ)) → (2 : ℕ) * T + (2 : ℕ) * A + (2 : ℕ) * B ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r)

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with arith : ∀ (e r A B T : ℕ), r ≤ (1 : ℕ) → (3 : ℕ) ≤ e → A * (2 : ℕ) = (2 : ℕ) * (e + (1 : ℕ) + r + (1 : ℕ)) * (e + (2 : ℕ) + (1 : ℕ)) + (e + (1 : ℕ) + r + (1 : ℕ)) * (e + (1 : ℕ) + r) → B * (2 : ℕ) = (6 : ℕ) * ((2 : ℕ) * e + (1 : ℕ) + r + (1 : ℕ)) + ((2 : ℕ) * e + (1 : ℕ) + r + (1 : ℕ)) * ((2 : ℕ) * e + (1 : ℕ) + r) → T * (2 : ℕ) = ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r + (1 : ℕ)) → (2 : ℕ) * T + (2 : ℕ) * A + (2 : ℕ) * B ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r).

              Lean, lines 657–668
                        have arith : ∀ e r A B T : ℕ, r ≤ 1 → 3 ≤ e →
                            A * 2 = 2 * (e + 1 + r + 1) * (e + 2 + 1) + (e + 1 + r + 1) * (e + 1 + r) →
                            B * 2 = 6 * (2 * e + 1 + r + 1) + (2 * e + 1 + r + 1) * (2 * e + 1 + r) →
                            T * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) →
                            2 * T + 2 * A + 2 * B ≤ 3 * (2 * e + 4 + r) * (2 * e + 4 + r) := by
                          intro e r A B T hr he hA hB hT
                          have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he
                          rcases (show r = 0 ∨ r = 1 by omega) with rfl | rfl
                          · ring_nf at hA hB hT hsq ⊢
                            omega
                          · ring_nf at hA hB hT hsq ⊢
                            omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 657–668 at 2987e49b6fb3 ↗

              1. hb.key.s2.hexp.arith.hsq have (3 : ℕ) * e ≤ e * e

                Leaves (2 : ℕ) * T + (2 : ℕ) * A + (2 : ℕ) * B ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r), with hsq : (3 : ℕ) * e ≤ e * e.

                Uses library Nat.mul_le_mul_right.

                Lean, line 663
                            have hsq : 3 * e ≤ e * e := Nat.mul_le_mul_right e he

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 663 at 2987e49b6fb3 ↗

              2. hb.key.s2.hexp.arith.s2 case

                Leaves (2 : ℕ) * T + (2 : ℕ) * A + (2 : ℕ) * B ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + (0 : ℕ)) * ((2 : ℕ) * e + (4 : ℕ) + (0 : ℕ)).

                Lean, lines 665–666
                            · ring_nf at hA hB hT hsq ⊢
                              omega

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 665–666 at 2987e49b6fb3 ↗

              3. hb.key.s2.hexp.arith.s3 case

                Leaves (2 : ℕ) * T + (2 : ℕ) * A + (2 : ℕ) * B ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + (1 : ℕ)) * ((2 : ℕ) * e + (4 : ℕ) + (1 : ℕ)).

                Lean, lines 667–668
                            · ring_nf at hA hB hT hsq ⊢
                              omega

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 667–668 at 2987e49b6fb3 ↗

            2. hb.key.s2.hexp.s2 obtain ∃ (e : ℕ), n / (2 : ℕ) = e + (2 : ℕ)

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with e : ℕ, he : n / (2 : ℕ) = e + (2 : ℕ).

              Uses library Exists.intro Existential introduction. .

              Lean, line 669
                        obtain ⟨e, he⟩ : ∃ e, n / 2 = e + 2 := ⟨n / 2 - 2, by omega⟩

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 669 at 2987e49b6fb3 ↗

            3. hb.key.s2.hexp.s3 obtain ∃ r ≤ (1 : ℕ), n = (2 : ℕ) * e + (4 : ℕ) + r

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with r : ℕ, hr1 : r ≤ (1 : ℕ), hr : n = (2 : ℕ) * e + (4 : ℕ) + r.

              Uses library Exists.intro Existential introduction. .

              Lean, line 670
                        obtain ⟨r, hr1, hr⟩ : ∃ r, r ≤ 1 ∧ n = 2 * e + 4 + r := ⟨n - (2 * e + 4), by omega, by omega⟩

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 670 at 2987e49b6fb3 ↗

            4. hb.key.s2.hexp.hc' have c = e + (1 : ℕ) + r routine: omega

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with hc' : c = e + (1 : ℕ) + r.

              Lean, line 671
                        have hc' : c = e + 1 + r := by omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 671 at 2987e49b6fb3 ↗

            5. hb.key.s2.hexp.hd' have d = (2 : ℕ) * e + (1 : ℕ) + r routine: omega

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with hd' : d = (2 : ℕ) * e + (1 : ℕ) + r.

              Lean, line 672
                        have hd' : d = 2 * e + 1 + r := by omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 672 at 2987e49b6fb3 ↗

            6. hb.key.s2.hexp.hT' have n * (n + (1 : ℕ)) / (2 : ℕ) * (2 : ℕ) = ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r + (1 : ℕ))

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with hT' : n * (n + (1 : ℕ)) / (2 : ℕ) * (2 : ℕ) = ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r + (1 : ℕ)).

              Lean, line 675
                        have hT' : n * (n + 1) / 2 * 2 = (2 * e + 4 + r) * (2 * e + 4 + r + 1) := by rw [hT, hr]

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 675 at 2987e49b6fb3 ↗

            7. hb.key.s2.hexp.this have (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (e + (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r)

              Leaves (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * n * n, with this : (2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (e + (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)) ≤ (3 : ℕ) * ((2 : ℕ) * e + (4 : ℕ) + r) * ((2 : ℕ) * e + (4 : ℕ) + r).

              Lean, line 676
                        have := arith e r _ _ _ hr1 (by omega) hS1 hS2 hT'

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 676 at 2987e49b6fb3 ↗

          9. hb.key.s2.s9 calc ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) ^ (2 : ℕ) ≤ ((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (((2 : ℕ) ^ ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m) * (2 : ℕ) ^ ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ)))) ^ (2 : ℕ)

            Closes the goal.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

            Lean, lines 680–683
                    calc (2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                            ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3))) ^ 2
                        ≤ (2 ^ (n * (n + 1) / 2) * (2 ^ (∑ m ∈ Finset.Ioc (n / 2) n, m) *
                            2 ^ (∑ j ∈ Finset.Ico 2 n, (j + 1)))) ^ 2 := by gcongr

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 680–683 at 2987e49b6fb3 ↗

          10. hb.key.s2.s10 calc

            Closes the goal.

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , pow_add, pow_mul.

            Lean, lines 684–686
                      _ = 2 ^ (2 * (n * (n + 1) / 2) + 2 * (∑ m ∈ Finset.Ioc (n / 2) n, m) +
                            2 * (∑ j ∈ Finset.Ico 2 n, (j + 1))) := by
                        rw [← pow_add, ← pow_add, ← pow_mul]; congr 1; ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 684–686 at 2987e49b6fb3 ↗

          11. hb.key.s2.s11 calc (2 : ℕ) ^ ((2 : ℕ) * (n * (n + (1 : ℕ)) / (2 : ℕ)) + (2 : ℕ) * ∑ m ∈ Finset.Ioc (n / (2 : ℕ)) n, m + (2 : ℕ) * ∑ j ∈ Finset.Ico (2 : ℕ) n, (j + (1 : ℕ))) ≤ (2 : ℕ) ^ ((3 : ℕ) * n * n)

            Closes the goal.

            Uses library Nat.pow_le_pow_right.

            Lean, line 687
                      _ ≤ 2 ^ (3 * n * n) := Nat.pow_le_pow_right (by norm_num) hexp

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 687 at 2987e49b6fb3 ↗

    18. hqx have ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k

      Leaves ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hqx : ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k.

      Uses library Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 689–726
        have hqx : ∃ z : ℤ, (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) *
            ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := by
          have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
              (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
            intro k hk
            have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
            obtain ⟨a, ha⟩ := gauss n k
            obtain ⟨b, hb⟩ := gauss (2 * n - k) n
            obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hkn
            have hexp : (k + m) * (k + m + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + (k + m) * k := by
              have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
              have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
              have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
              rcases k with _ | j
              · simp
              · simp only [Nat.add_sub_cancel] at e2 ⊢
                ring_nf at e1 e2 e3 ⊢
                omega
            refine ⟨(-1) ^ k * 3 ^ k * 2 ^ (m * (m + 1) / 2) * a * b, ?_⟩
            have hpow : (2 : ℚ) ^ ((k + m) * (k + m + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ (k + m)) ^ k := by
              rw [← pow_add, ← pow_mul, ← pow_add, hexp]
            have h2 : ((2 : ℚ) ^ (k + m)) ≠ 0 := by positivity
            rw [hQc]
            simp only []
            rw [← ha, ← hb]
            push_cast
            rw [div_pow, mul_div_assoc']
            field_simp
            linear_combination -(a : ℚ) * b * hpow
          choose! g hg using hterm
          refine ⟨∑ k ∈ Finset.range (n + 1), g k, ?_⟩
          push_cast
          rw [Finset.mul_sum]
          exact Finset.sum_congr rfl (fun k hk => hg k hk)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 689–726 at 2987e49b6fb3 ↗

      1. hqx.hterm have ∀ k ∈ Finset.range (n + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k)

        Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k, with hterm : ∀ k ∈ Finset.range (n + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k).

        Uses library Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , div_pow, mul_div_assoc'.

        Lean, lines 691–721
            have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
                (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
              intro k hk
              have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
              obtain ⟨a, ha⟩ := gauss n k
              obtain ⟨b, hb⟩ := gauss (2 * n - k) n
              obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hkn
              have hexp : (k + m) * (k + m + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + (k + m) * k := by
                have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                  Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                  Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                  Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                rcases k with _ | j
                · simp
                · simp only [Nat.add_sub_cancel] at e2 ⊢
                  ring_nf at e1 e2 e3 ⊢
                  omega
              refine ⟨(-1) ^ k * 3 ^ k * 2 ^ (m * (m + 1) / 2) * a * b, ?_⟩
              have hpow : (2 : ℚ) ^ ((k + m) * (k + m + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                  (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ (k + m)) ^ k := by
                rw [← pow_add, ← pow_mul, ← pow_add, hexp]
              have h2 : ((2 : ℚ) ^ (k + m)) ≠ 0 := by positivity
              rw [hQc]
              simp only []
              rw [← ha, ← hb]
              push_cast
              rw [div_pow, mul_div_assoc']
              field_simp
              linear_combination -(a : ℚ) * b * hpow

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 691–721 at 2987e49b6fb3 ↗

        1. hqx.hterm.hkn have k ≤ n

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with hkn : k ≤ n.

          Uses library Nat.lt_succ_iff, Finset.mem_range.

          Lean, line 694
                have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 694 at 2987e49b6fb3 ↗

        2. hqx.hterm.s2 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with a : ℤ, ha : (↑a : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 695
                obtain ⟨a, ha⟩ := gauss n k

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 695 at 2987e49b6fb3 ↗

        3. hqx.hterm.s3 obtain ∃ (z : ℤ), (↑z : ℚ) = ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with b : ℤ, hb : (↑b : ℚ) = ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 696
                obtain ⟨b, hb⟩ := gauss (2 * n - k) n

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 696 at 2987e49b6fb3 ↗

        4. hqx.hterm.s4 obtain ∃ (k_1 : ℕ), n = k + k_1

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (Qc (k + m) k * ((3 : ℚ) / (2 : ℚ) ^ (k + m)) ^ k), with m : ℕ, hb : (↑((2 : ℕ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * if k + m = (5 : ℕ) then (409045 : ℕ) else if k + m = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc ((k + m) / (2 : ℕ)) (k + m), ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) (k + m), ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * (k + m) * (k + m)), hk : k ∈ Finset.range (k + m + (1 : ℕ)), hkn : k ≤ k + m, ha : (↑a : ℚ) = ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (k + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)), hb : (↑b : ℚ) = ∏ i ∈ Finset.range (k + m), ((2 : ℚ) ^ ((2 : ℕ) * (k + m) - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

          Uses library Nat.exists_eq_add_of_le.

          Lean, line 697
                obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hkn

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 697 at 2987e49b6fb3 ↗

        5. hqx.hterm.hexp have (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (Qc (k + m) k * ((3 : ℚ) / (2 : ℚ) ^ (k + m)) ^ k), with hexp : (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k.

          Lean, lines 698–709
                have hexp : (k + m) * (k + m + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + (k + m) * k := by
                  have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                  have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                  have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                  rcases k with _ | j
                  · simp
                  · simp only [Nat.add_sub_cancel] at e2 ⊢
                    ring_nf at e1 e2 e3 ⊢
                    omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 698–709 at 2987e49b6fb3 ↗

          1. hqx.hterm.hexp.e1 have (2 : ℕ) * ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) = (k + m) * (k + m + (1 : ℕ))

            Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e1 : (2 : ℕ) * ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) = (k + m) * (k + m + (1 : ℕ)).

            Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_succ_self.

            Lean, lines 699–700
                    have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 699–700 at 2987e49b6fb3 ↗

          2. hqx.hterm.hexp.e2 have (2 : ℕ) * (k * (k - (1 : ℕ)) / (2 : ℕ)) = k * (k - (1 : ℕ))

            Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e2 : (2 : ℕ) * (k * (k - (1 : ℕ)) / (2 : ℕ)) = k * (k - (1 : ℕ)).

            Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_pred_self.

            Lean, lines 701–702
                    have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 701–702 at 2987e49b6fb3 ↗

          3. hqx.hterm.hexp.e3 have (2 : ℕ) * (m * (m + (1 : ℕ)) / (2 : ℕ)) = m * (m + (1 : ℕ))

            Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e3 : (2 : ℕ) * (m * (m + (1 : ℕ)) / (2 : ℕ)) = m * (m + (1 : ℕ)).

            Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_succ_self.

            Lean, lines 703–704
                    have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 703–704 at 2987e49b6fb3 ↗

          4. hqx.hterm.hexp.s4 case routine: simp

            Leaves ((0 : ℕ) + m) * ((0 : ℕ) + m + (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + ((0 : ℕ) + m) * (0 : ℕ).

            Lean, line 706
                    · simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 706 at 2987e49b6fb3 ↗

          5. hqx.hterm.hexp.s5 case

            Leaves (j + (1 : ℕ) + m) * (j + (1 : ℕ) + m + (1 : ℕ)) / (2 : ℕ) + (j + (1 : ℕ)) * (j + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (j + (1 : ℕ) + m) * (j + (1 : ℕ)).

            Uses library Nat.add_sub_cancel.

            Lean, lines 707–709
                    · simp only [Nat.add_sub_cancel] at e2 ⊢
                      ring_nf at e1 e2 e3 ⊢
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 707–709 at 2987e49b6fb3 ↗

        6. hqx.hterm.hpow have (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (2 : ℚ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * ((2 : ℚ) ^ (k + m)) ^ k

          Leaves (↑((-1 : ℤ) ^ k * (3 : ℤ) ^ k * (2 : ℤ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * a * b) : ℚ) = (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (Qc (k + m) k * ((3 : ℚ) / (2 : ℚ) ^ (k + m)) ^ k), with hpow : (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (2 : ℚ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * ((2 : ℚ) ^ (k + m)) ^ k.

          Uses library pow_add, pow_mul.

          Lean, lines 711–713
                have hpow : (2 : ℚ) ^ ((k + m) * (k + m + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                    (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ (k + m)) ^ k := by
                  rw [← pow_add, ← pow_mul, ← pow_add, hexp]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 711–713 at 2987e49b6fb3 ↗

        7. hqx.hterm.h2 have (2 : ℚ) ^ (k + m) ≠ (0 : ℚ) routine: positivity

          Leaves (↑((-1 : ℤ) ^ k * (3 : ℤ) ^ k * (2 : ℤ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * a * b) : ℚ) = (2 : ℚ) ^ ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) * (Qc (k + m) k * ((3 : ℚ) / (2 : ℚ) ^ (k + m)) ^ k), with h2 : (2 : ℚ) ^ (k + m) ≠ (0 : ℚ).

          Lean, line 714
                have h2 : ((2 : ℚ) ^ (k + m)) ≠ 0 := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 714 at 2987e49b6fb3 ↗

    19. hE have (0 : ℕ) < if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))

      Leaves ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hE : (0 : ℕ) < if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)).

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

      Lean, lines 727–744
        have hE : 0 < (if n = 5 then 409045 else if n = 7 then 1298717875 else
                (∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) * ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) := by
          split_ifs
          · norm_num
          · norm_num
          · refine Nat.mul_pos (Finset.prod_pos fun m hm => ?_) (Finset.prod_pos fun j hj => ?_)
            · have hm1 : 1 ≤ m := by
                have := (Finset.mem_Ioc.mp hm).1
                omega
              have : 2 ≤ 2 ^ m := by
                calc 2 = 2 ^ 1 := by norm_num
                  _ ≤ 2 ^ m := Nat.pow_le_pow_right (by norm_num) hm1
              omega
            · have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
              have : 8 ≤ 2 ^ (j + 1) := by
                calc 8 = 2 ^ 3 := by norm_num
                  _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
              omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 727–744 at 2987e49b6fb3 ↗

      1. hE.s1 case routine: norm_num

        Leaves (0 : ℕ) < (409045 : ℕ).

        Lean, line 730
            · norm_num

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 730 at 2987e49b6fb3 ↗

      2. hE.s2 case routine: norm_num

        Leaves (0 : ℕ) < (1298717875 : ℕ).

        Lean, line 731
            · norm_num

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 731 at 2987e49b6fb3 ↗

      3. hE.s3 case

        Leaves (0 : ℕ) < (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)).

        Uses library Nat.mul_pos, Finset.prod_pos.

        Lean, lines 732–744
            · refine Nat.mul_pos (Finset.prod_pos fun m hm => ?_) (Finset.prod_pos fun j hj => ?_)
              · have hm1 : 1 ≤ m := by
                  have := (Finset.mem_Ioc.mp hm).1
                  omega
                have : 2 ≤ 2 ^ m := by
                  calc 2 = 2 ^ 1 := by norm_num
                    _ ≤ 2 ^ m := Nat.pow_le_pow_right (by norm_num) hm1
                omega
              · have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                have : 8 ≤ 2 ^ (j + 1) := by
                  calc 8 = 2 ^ 3 := by norm_num
                    _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 732–744 at 2987e49b6fb3 ↗

        1. hE.s3.s1 case

          Leaves (0 : ℕ) < (2 : ℕ) ^ m - (1 : ℕ).

          Lean, lines 733–739
                · have hm1 : 1 ≤ m := by
                    have := (Finset.mem_Ioc.mp hm).1
                    omega
                  have : 2 ≤ 2 ^ m := by
                    calc 2 = 2 ^ 1 := by norm_num
                      _ ≤ 2 ^ m := Nat.pow_le_pow_right (by norm_num) hm1
                  omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 733–739 at 2987e49b6fb3 ↗

          1. hE.s3.s1.hm1 have (1 : ℕ) ≤ m

            Leaves (0 : ℕ) < (2 : ℕ) ^ m - (1 : ℕ), with hm1 : (1 : ℕ) ≤ m.

            Lean, lines 733–735
                  · have hm1 : 1 ≤ m := by
                      have := (Finset.mem_Ioc.mp hm).1
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 733–735 at 2987e49b6fb3 ↗

            1. hE.s3.s1.hm1.this have n / (2 : ℕ) < m

              Leaves (1 : ℕ) ≤ m, with this : n / (2 : ℕ) < m.

              Uses library Finset.mem_Ioc.

              Lean, line 734
                        have := (Finset.mem_Ioc.mp hm).1

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 734 at 2987e49b6fb3 ↗

          2. hE.s3.s1.this have (2 : ℕ) ≤ (2 : ℕ) ^ m

            Leaves (0 : ℕ) < (2 : ℕ) ^ m - (1 : ℕ), with this : (2 : ℕ) ≤ (2 : ℕ) ^ m.

            Lean, lines 736–738
                    have : 2 ≤ 2 ^ m := by
                      calc 2 = 2 ^ 1 := by norm_num
                        _ ≤ 2 ^ m := Nat.pow_le_pow_right (by norm_num) hm1

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 736–738 at 2987e49b6fb3 ↗

            1. hE.s3.s1.this.s1 calc (2 : ℕ) = (2 : ℕ) ^ (1 : ℕ) routine: norm_num

              Closes the goal.

              Lean, line 737
                        calc 2 = 2 ^ 1 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 737 at 2987e49b6fb3 ↗

            2. hE.s3.s1.this.s2 calc (2 : ℕ) ^ (1 : ℕ) ≤ (2 : ℕ) ^ m

              Closes the goal.

              Uses library Nat.pow_le_pow_right.

              Lean, line 738
                          _ ≤ 2 ^ m := Nat.pow_le_pow_right (by norm_num) hm1

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 738 at 2987e49b6fb3 ↗

        2. hE.s3.s2 case

          Leaves (0 : ℕ) < (2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ).

          Lean, lines 740–744
                · have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                  have : 8 ≤ 2 ^ (j + 1) := by
                    calc 8 = 2 ^ 3 := by norm_num
                      _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                  omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 740–744 at 2987e49b6fb3 ↗

          1. hE.s3.s2.hj2 have (2 : ℕ) ≤ j

            Leaves (0 : ℕ) < (2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ), with hj2 : (2 : ℕ) ≤ j.

            Uses library Finset.mem_Ico.

            Lean, line 740
                  · have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 740 at 2987e49b6fb3 ↗

          2. hE.s3.s2.this have (8 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ))

            Leaves (0 : ℕ) < (2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ), with this : (8 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ)).

            Lean, lines 741–743
                    have : 8 ≤ 2 ^ (j + 1) := by
                      calc 8 = 2 ^ 3 := by norm_num
                        _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 741–743 at 2987e49b6fb3 ↗

            1. hE.s3.s2.this.s1 calc (8 : ℕ) = (2 : ℕ) ^ (3 : ℕ) routine: norm_num

              Closes the goal.

              Lean, line 742
                        calc 8 = 2 ^ 3 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 742 at 2987e49b6fb3 ↗

            2. hE.s3.s2.this.s2 calc (2 : ℕ) ^ (3 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ))

              Closes the goal.

              Uses library Nat.pow_le_pow_right.

              Lean, line 743
                          _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 743 at 2987e49b6fb3 ↗

    20. hAqint have ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n

      Leaves ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with hAqint : ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n.

      Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. .

      Lean, lines 745–837
        have hAqint : ∃ z : ℤ, (z : ℚ) = ((2 ^ (n * (n + 1) / 2) * (if n = 5 then 409045 else if n = 7 then 1298717875 else
              (∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) * ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℕ) : ℚ) * Aq n := by
          by_cases h5 : n = 5
          · subst h5
            refine ⟨1380067124193819576, ?_⟩
            rw [if_pos rfl]
            subst hQc hQx hAq
            decide +kernel
          · by_cases h7 : n = 7
            · subst h7
              refine ⟨674036225808261890798679141926088, ?_⟩
              rw [if_neg (by norm_num), if_pos rfl]
              subst hQc hQx hAq
              decide +kernel
            · rw [if_neg h5, if_neg h7]
              have hM : ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) : ℕ) : ℚ) =
                  ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1) := by
                rw [Nat.cast_prod]
                refine Finset.prod_congr rfl (fun m _ => ?_)
                rw [Nat.cast_sub Nat.one_le_two_pow]
                push_cast
                ring
              have hC : ((∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℚ) =
                  ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3) := by
                rw [Nat.cast_prod]
                refine Finset.prod_congr rfl (fun j hj => ?_)
                have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                have h3 : 3 ≤ 2 ^ (j + 1) := by
                  calc 3 ≤ 2 ^ 2 := by norm_num
                    _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                rw [Nat.cast_sub h3]
                push_cast
                ring
              have hd : ((2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                  ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3)) : ℕ) : ℚ) =
                  (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                    ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) := by
                rw [Nat.cast_mul, Nat.cast_mul, hM, hC]
                push_cast
                ring
              obtain ⟨zcn, hzcn⟩ := hcnall n
              obtain ⟨zq', hzq'⟩ := hqx
              have hQxn : Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := by
                rw [hQx]
              have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
                  (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                    ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                    ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                      ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
                intro k hk
                have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
                obtain ⟨w, hw⟩ := hcore Qc hQc n k hkn
                obtain ⟨m, hm⟩ := Nat.exists_eq_add_of_le hkn
                have hexp : n * (n + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + n * k := by
                  rw [hm]
                  have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                  have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                  have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                    Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                  rcases k with _ | j
                  · simp
                  · simp only [Nat.add_sub_cancel] at e2 ⊢
                    ring_nf at e1 e2 e3 ⊢
                    omega
                have hpow : (2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                    (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ n) ^ k := by
                  rw [← pow_add, ← pow_mul, ← pow_add, hexp]
                have h2n : ((2 : ℚ) ^ n) ^ k ≠ 0 := by positivity
                refine ⟨(∏ j ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (j + 1) - 3)) * w * 3 ^ k * 2 ^ (m * (m + 1) / 2), ?_⟩
                have e1 : (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                    ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                    ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                      ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) =
                    (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) * 3 ^ k *
                      (((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                        ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                        (2 : ℚ) ^ (n * (n + 1) / 2)) / ((2 : ℚ) ^ n) ^ k := by
                  rw [div_pow]
                  ring
                rw [e1, ← hw, show (w : ℚ) * (2 : ℚ) ^ (k * (k - 1) / 2) * (2 : ℚ) ^ (n * (n + 1) / 2) =
                  (w : ℚ) * ((2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2)) by ring, hpow]
                push_cast
                field_simp
              choose! g hg using hterm
              refine ⟨∑ k ∈ Finset.range (n + 1), g k +
                (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1)) * zq' * zcn, ?_⟩
              rw [hd, hAq]
              beta_reduce
              push_cast
              rw [mul_add, Finset.mul_sum, Finset.sum_congr rfl hg, hzcn, hzq', ← hQxn]
              ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 745–837 at 2987e49b6fb3 ↗

      1. hAqint.s1 case

        Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n.

        Uses library Exists.intro Existential introduction. , if_pos, rfl rfl : a = a is the unique constructor of the equality type. , Lean.Parser.Tactic.DecideConfig.kernel If true (default: false), then use only kernel reduction when reducing the Decidable instance. .

        Lean, lines 748–752
            · subst h5
              refine ⟨1380067124193819576, ?_⟩
              rw [if_pos rfl]
              subst hQc hQx hAq
              decide +kernel

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 748–752 at 2987e49b6fb3 ↗

      2. hAqint.s2 case

        Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n.

        Lean, lines 753–837
            · by_cases h7 : n = 7
              · subst h7
                refine ⟨674036225808261890798679141926088, ?_⟩
                rw [if_neg (by norm_num), if_pos rfl]
                subst hQc hQx hAq
                decide +kernel
              · rw [if_neg h5, if_neg h7]
                have hM : ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) : ℕ) : ℚ) =
                    ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1) := by
                  rw [Nat.cast_prod]
                  refine Finset.prod_congr rfl (fun m _ => ?_)
                  rw [Nat.cast_sub Nat.one_le_two_pow]
                  push_cast
                  ring
                have hC : ((∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℚ) =
                    ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3) := by
                  rw [Nat.cast_prod]
                  refine Finset.prod_congr rfl (fun j hj => ?_)
                  have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                  have h3 : 3 ≤ 2 ^ (j + 1) := by
                    calc 3 ≤ 2 ^ 2 := by norm_num
                      _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                  rw [Nat.cast_sub h3]
                  push_cast
                  ring
                have hd : ((2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                    ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3)) : ℕ) : ℚ) =
                    (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                      ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) := by
                  rw [Nat.cast_mul, Nat.cast_mul, hM, hC]
                  push_cast
                  ring
                obtain ⟨zcn, hzcn⟩ := hcnall n
                obtain ⟨zq', hzq'⟩ := hqx
                have hQxn : Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := by
                  rw [hQx]
                have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
                    (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                      ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                      ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                        ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
                  intro k hk
                  have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
                  obtain ⟨w, hw⟩ := hcore Qc hQc n k hkn
                  obtain ⟨m, hm⟩ := Nat.exists_eq_add_of_le hkn
                  have hexp : n * (n + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + n * k := by
                    rw [hm]
                    have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                    have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                    have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                      Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                    rcases k with _ | j
                    · simp
                    · simp only [Nat.add_sub_cancel] at e2 ⊢
                      ring_nf at e1 e2 e3 ⊢
                      omega
                  have hpow : (2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                      (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ n) ^ k := by
                    rw [← pow_add, ← pow_mul, ← pow_add, hexp]
                  have h2n : ((2 : ℚ) ^ n) ^ k ≠ 0 := by positivity
                  refine ⟨(∏ j ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (j + 1) - 3)) * w * 3 ^ k * 2 ^ (m * (m + 1) / 2), ?_⟩
                  have e1 : (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                      ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                      ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                        ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) =
                      (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) * 3 ^ k *
                        (((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                          ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                          (2 : ℚ) ^ (n * (n + 1) / 2)) / ((2 : ℚ) ^ n) ^ k := by
                    rw [div_pow]
                    ring
                  rw [e1, ← hw, show (w : ℚ) * (2 : ℚ) ^ (k * (k - 1) / 2) * (2 : ℚ) ^ (n * (n + 1) / 2) =
                    (w : ℚ) * ((2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2)) by ring, hpow]
                  push_cast
                  field_simp
                choose! g hg using hterm
                refine ⟨∑ k ∈ Finset.range (n + 1), g k +
                  (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1)) * zq' * zcn, ?_⟩
                rw [hd, hAq]
                beta_reduce
                push_cast
                rw [mul_add, Finset.mul_sum, Finset.sum_congr rfl hg, hzcn, hzq', ← hQxn]
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 753–837 at 2987e49b6fb3 ↗

        1. hAqint.s2.s1 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n.

          Uses library Exists.intro Existential introduction. , if_neg, if_pos, rfl rfl : a = a is the unique constructor of the equality type. , Lean.Parser.Tactic.DecideConfig.kernel If true (default: false), then use only kernel reduction when reducing the Decidable instance. .

          Lean, lines 754–758
                · subst h7
                  refine ⟨674036225808261890798679141926088, ?_⟩
                  rw [if_neg (by norm_num), if_pos rfl]
                  subst hQc hQx hAq
                  decide +kernel

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 754–758 at 2987e49b6fb3 ↗

        2. hAqint.s2.s2 case

          Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * if n = (5 : ℕ) then (409045 : ℕ) else if n = (7 : ℕ) then (1298717875 : ℕ) else (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) * Aq n.

          Uses library if_neg, Exists.intro Existential introduction. , Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , mul_add Alias of left_distrib. , Finset.mul_sum, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, lines 759–837
                · rw [if_neg h5, if_neg h7]
                  have hM : ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) : ℕ) : ℚ) =
                      ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1) := by
                    rw [Nat.cast_prod]
                    refine Finset.prod_congr rfl (fun m _ => ?_)
                    rw [Nat.cast_sub Nat.one_le_two_pow]
                    push_cast
                    ring
                  have hC : ((∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℚ) =
                      ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3) := by
                    rw [Nat.cast_prod]
                    refine Finset.prod_congr rfl (fun j hj => ?_)
                    have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                    have h3 : 3 ≤ 2 ^ (j + 1) := by
                      calc 3 ≤ 2 ^ 2 := by norm_num
                        _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                    rw [Nat.cast_sub h3]
                    push_cast
                    ring
                  have hd : ((2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                      ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3)) : ℕ) : ℚ) =
                      (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                        ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) := by
                    rw [Nat.cast_mul, Nat.cast_mul, hM, hC]
                    push_cast
                    ring
                  obtain ⟨zcn, hzcn⟩ := hcnall n
                  obtain ⟨zq', hzq'⟩ := hqx
                  have hQxn : Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := by
                    rw [hQx]
                  have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
                      (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                        ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                        ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                          ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
                    intro k hk
                    have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
                    obtain ⟨w, hw⟩ := hcore Qc hQc n k hkn
                    obtain ⟨m, hm⟩ := Nat.exists_eq_add_of_le hkn
                    have hexp : n * (n + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + n * k := by
                      rw [hm]
                      have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                        Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                      have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                        Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                      have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                        Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                      rcases k with _ | j
                      · simp
                      · simp only [Nat.add_sub_cancel] at e2 ⊢
                        ring_nf at e1 e2 e3 ⊢
                        omega
                    have hpow : (2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                        (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ n) ^ k := by
                      rw [← pow_add, ← pow_mul, ← pow_add, hexp]
                    have h2n : ((2 : ℚ) ^ n) ^ k ≠ 0 := by positivity
                    refine ⟨(∏ j ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (j + 1) - 3)) * w * 3 ^ k * 2 ^ (m * (m + 1) / 2), ?_⟩
                    have e1 : (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                        ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                        ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                          ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) =
                        (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) * 3 ^ k *
                          (((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                            ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                            (2 : ℚ) ^ (n * (n + 1) / 2)) / ((2 : ℚ) ^ n) ^ k := by
                      rw [div_pow]
                      ring
                    rw [e1, ← hw, show (w : ℚ) * (2 : ℚ) ^ (k * (k - 1) / 2) * (2 : ℚ) ^ (n * (n + 1) / 2) =
                      (w : ℚ) * ((2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2)) by ring, hpow]
                    push_cast
                    field_simp
                  choose! g hg using hterm
                  refine ⟨∑ k ∈ Finset.range (n + 1), g k +
                    (∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℤ) ^ m - 1)) * zq' * zcn, ?_⟩
                  rw [hd, hAq]
                  beta_reduce
                  push_cast
                  rw [mul_add, Finset.mul_sum, Finset.sum_congr rfl hg, hzcn, hzq', ← hQxn]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 759–837 at 2987e49b6fb3 ↗

          1. hAqint.s2.s2.hM have (↑(∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) : ℚ) = ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with hM : (↑(∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) : ℚ) = ∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ)).

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Nat.cast_prod, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Nat.cast_sub, Nat.one_le_two_pow.

            Lean, lines 760–766
                    have hM : ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1) : ℕ) : ℚ) =
                        ∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1) := by
                      rw [Nat.cast_prod]
                      refine Finset.prod_congr rfl (fun m _ => ?_)
                      rw [Nat.cast_sub Nat.one_le_two_pow]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 760–766 at 2987e49b6fb3 ↗

          2. hAqint.s2.s2.hC have (↑(∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) = ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with hC : (↑(∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ))) : ℚ) = ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)).

            Uses library Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Nat.cast_prod, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Nat.cast_sub.

            Lean, lines 767–777
                    have hC : ((∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3) : ℕ) : ℚ) =
                        ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3) := by
                      rw [Nat.cast_prod]
                      refine Finset.prod_congr rfl (fun j hj => ?_)
                      have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1
                      have h3 : 3 ≤ 2 ^ (j + 1) := by
                        calc 3 ≤ 2 ^ 2 := by norm_num
                          _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)
                      rw [Nat.cast_sub h3]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 767–777 at 2987e49b6fb3 ↗

            1. hAqint.s2.s2.hC.hj2 have (2 : ℕ) ≤ j

              Leaves (↑((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)) : ℚ) = (2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ), with hj2 : (2 : ℕ) ≤ j.

              Uses library Finset.mem_Ico.

              Lean, line 771
                        have hj2 : 2 ≤ j := (Finset.mem_Ico.mp hj).1

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 771 at 2987e49b6fb3 ↗

            2. hAqint.s2.s2.hC.h3 have (3 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ))

              Leaves (↑((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)) : ℚ) = (2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ), with h3 : (3 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ)).

              Lean, lines 772–774
                        have h3 : 3 ≤ 2 ^ (j + 1) := by
                          calc 3 ≤ 2 ^ 2 := by norm_num
                            _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 772–774 at 2987e49b6fb3 ↗

              1. hAqint.s2.s2.hC.h3.s1 calc (3 : ℕ) ≤ (2 : ℕ) ^ (2 : ℕ) routine: norm_num

                Closes the goal.

                Lean, line 773
                            calc 3 ≤ 2 ^ 2 := by norm_num

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 773 at 2987e49b6fb3 ↗

              2. hAqint.s2.s2.hC.h3.s2 calc (2 : ℕ) ^ (2 : ℕ) ≤ (2 : ℕ) ^ (j + (1 : ℕ))

                Closes the goal.

                Uses library Nat.pow_le_pow_right.

                Lean, line 774
                              _ ≤ 2 ^ (j + 1) := Nat.pow_le_pow_right (by norm_num) (by omega)

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 774 at 2987e49b6fb3 ↗

          3. hAqint.s2.s2.hd have (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with hd : (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))).

            Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Nat.cast_mul.

            Lean, lines 778–784
                    have hd : ((2 ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, (2 ^ m - 1)) *
                        ∏ j ∈ Finset.Ico 2 n, (2 ^ (j + 1) - 3)) : ℕ) : ℚ) =
                        (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                          ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) := by
                      rw [Nat.cast_mul, Nat.cast_mul, hM, hC]
                      push_cast
                      ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 778–784 at 2987e49b6fb3 ↗

          4. hAqint.s2.s2.s4 obtain ∃ (z : ℤ), (↑z : ℚ) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with zcn : ℤ, hzcn : (↑zcn : ℚ) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)).

            Lean, line 785
                    obtain ⟨zcn, hzcn⟩ := hcnall n

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 785 at 2987e49b6fb3 ↗

          5. hAqint.s2.s2.s5 obtain ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with zq' : ℤ, hzq' : (↑zq' : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k.

            Lean, line 786
                    obtain ⟨zq', hzq'⟩ := hqx

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 786 at 2987e49b6fb3 ↗

          6. hAqint.s2.s2.hQxn have Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with hQxn : Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k.

            Uses library Finset.range range n is the set of natural numbers less than n. .

            Lean, lines 787–788
                    have hQxn : Qx n = ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := by
                      rw [hQx]

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 787–788 at 2987e49b6fb3 ↗

          7. hAqint.s2.s2.hterm have ∀ k ∈ Finset.range (n + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k)

            Leaves ∃ (z : ℤ), (↑z : ℚ) = (↑((2 : ℕ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℕ) ^ m - (1 : ℕ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℕ) ^ (j + (1 : ℕ)) - (3 : ℕ)))) : ℚ) * Aq n, with hterm : ∀ k ∈ Finset.range (n + (1 : ℕ)), ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k).

            Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Exists.intro Existential introduction. .

            Lean, lines 789–829
                    have hterm : ∀ k ∈ Finset.range (n + 1), ∃ z : ℤ,
                        (z : ℚ) = (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                          ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                          ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                            ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) := by
                      intro k hk
                      have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)
                      obtain ⟨w, hw⟩ := hcore Qc hQc n k hkn
                      obtain ⟨m, hm⟩ := Nat.exists_eq_add_of_le hkn
                      have hexp : n * (n + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + n * k := by
                        rw [hm]
                        have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                          Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                        have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                          Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                        have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                          Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                        rcases k with _ | j
                        · simp
                        · simp only [Nat.add_sub_cancel] at e2 ⊢
                          ring_nf at e1 e2 e3 ⊢
                          omega
                      have hpow : (2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                          (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ n) ^ k := by
                        rw [← pow_add, ← pow_mul, ← pow_add, hexp]
                      have h2n : ((2 : ℚ) ^ n) ^ k ≠ 0 := by positivity
                      refine ⟨(∏ j ∈ Finset.Ico 2 n, ((2 : ℤ) ^ (j + 1) - 3)) * w * 3 ^ k * 2 ^ (m * (m + 1) / 2), ?_⟩
                      have e1 : (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                          ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                          ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                            ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) =
                          (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) * 3 ^ k *
                            (((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                              ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                              (2 : ℚ) ^ (n * (n + 1) / 2)) / ((2 : ℚ) ^ n) ^ k := by
                        rw [div_pow]
                        ring
                      rw [e1, ← hw, show (w : ℚ) * (2 : ℚ) ^ (k * (k - 1) / 2) * (2 : ℚ) ^ (n * (n + 1) / 2) =
                        (w : ℚ) * ((2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2)) by ring, hpow]
                      push_cast
                      field_simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 789–829 at 2987e49b6fb3 ↗

            1. hAqint.s2.s2.hterm.hkn have k ≤ n

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with hkn : k ≤ n.

              Uses library Nat.lt_succ_iff, Finset.mem_range.

              Lean, line 795
                        have hkn : k ≤ n := Nat.lt_succ_iff.mp (Finset.mem_range.mp hk)

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 795 at 2987e49b6fb3 ↗

            2. hAqint.s2.s2.hterm.s2 obtain ∃ (z : ℤ), (↑z : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with w : ℤ, hw : (↑w : ℚ) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ)).

              Lean, line 796
                        obtain ⟨w, hw⟩ := hcore Qc hQc n k hkn

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 796 at 2987e49b6fb3 ↗

            3. hAqint.s2.s2.hterm.s3 obtain ∃ (k_1 : ℕ), n = k + k_1

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with m : ℕ, hm : n = k + m.

              Uses library Nat.exists_eq_add_of_le.

              Lean, line 797
                        obtain ⟨m, hm⟩ := Nat.exists_eq_add_of_le hkn

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 797 at 2987e49b6fb3 ↗

            4. hAqint.s2.s2.hterm.hexp have n * (n + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + n * k

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with hexp : n * (n + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + n * k.

              Lean, lines 798–810
                        have hexp : n * (n + 1) / 2 + k * (k - 1) / 2 = m * (m + 1) / 2 + n * k := by
                          rw [hm]
                          have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                            Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                          have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                            Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
                          have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                            Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)
                          rcases k with _ | j
                          · simp
                          · simp only [Nat.add_sub_cancel] at e2 ⊢
                            ring_nf at e1 e2 e3 ⊢
                            omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 798–810 at 2987e49b6fb3 ↗

              1. hAqint.s2.s2.hterm.hexp.e1 have (2 : ℕ) * ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) = (k + m) * (k + m + (1 : ℕ))

                Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e1 : (2 : ℕ) * ((k + m) * (k + m + (1 : ℕ)) / (2 : ℕ)) = (k + m) * (k + m + (1 : ℕ)).

                Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_succ_self.

                Lean, lines 800–801
                            have e1 : 2 * ((k + m) * (k + m + 1) / 2) = (k + m) * (k + m + 1) :=
                              Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 800–801 at 2987e49b6fb3 ↗

              2. hAqint.s2.s2.hterm.hexp.e2 have (2 : ℕ) * (k * (k - (1 : ℕ)) / (2 : ℕ)) = k * (k - (1 : ℕ))

                Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e2 : (2 : ℕ) * (k * (k - (1 : ℕ)) / (2 : ℕ)) = k * (k - (1 : ℕ)).

                Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_pred_self.

                Lean, lines 802–803
                            have e2 : 2 * (k * (k - 1) / 2) = k * (k - 1) :=
                              Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 802–803 at 2987e49b6fb3 ↗

              3. hAqint.s2.s2.hterm.hexp.e3 have (2 : ℕ) * (m * (m + (1 : ℕ)) / (2 : ℕ)) = m * (m + (1 : ℕ))

                Leaves (k + m) * (k + m + (1 : ℕ)) / (2 : ℕ) + k * (k - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (k + m) * k, with e3 : (2 : ℕ) * (m * (m + (1 : ℕ)) / (2 : ℕ)) = m * (m + (1 : ℕ)).

                Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_succ_self.

                Lean, lines 804–805
                            have e3 : 2 * (m * (m + 1) / 2) = m * (m + 1) :=
                              Nat.two_mul_div_two_of_even (Nat.even_mul_succ_self _)

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 804–805 at 2987e49b6fb3 ↗

              4. hAqint.s2.s2.hterm.hexp.s4 case routine: simp

                Leaves ((0 : ℕ) + m) * ((0 : ℕ) + m + (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + ((0 : ℕ) + m) * (0 : ℕ).

                Lean, line 807
                            · simp

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 807 at 2987e49b6fb3 ↗

              5. hAqint.s2.s2.hterm.hexp.s5 case

                Leaves (j + (1 : ℕ) + m) * (j + (1 : ℕ) + m + (1 : ℕ)) / (2 : ℕ) + (j + (1 : ℕ)) * (j + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) = m * (m + (1 : ℕ)) / (2 : ℕ) + (j + (1 : ℕ) + m) * (j + (1 : ℕ)).

                Uses library Nat.add_sub_cancel.

                Lean, lines 808–810
                            · simp only [Nat.add_sub_cancel] at e2 ⊢
                              ring_nf at e1 e2 e3 ⊢
                              omega

                targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 808–810 at 2987e49b6fb3 ↗

            5. hAqint.s2.s2.hterm.hpow have (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (2 : ℚ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * ((2 : ℚ) ^ n) ^ k

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with hpow : (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) = (2 : ℚ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ)) * ((2 : ℚ) ^ n) ^ k.

              Uses library pow_add, pow_mul.

              Lean, lines 811–813
                        have hpow : (2 : ℚ) ^ (n * (n + 1) / 2) * (2 : ℚ) ^ (k * (k - 1) / 2) =
                            (2 : ℚ) ^ (m * (m + 1) / 2) * ((2 : ℚ) ^ n) ^ k := by
                          rw [← pow_add, ← pow_mul, ← pow_add, hexp]

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 811–813 at 2987e49b6fb3 ↗

            6. hAqint.s2.s2.hterm.h2n have ((2 : ℚ) ^ n) ^ k ≠ (0 : ℚ) routine: positivity

              Leaves ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with h2n : ((2 : ℚ) ^ n) ^ k ≠ (0 : ℚ).

              Lean, line 814
                        have h2n : ((2 : ℚ) ^ n) ^ k ≠ 0 := by positivity

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 814 at 2987e49b6fb3 ↗

            7. hAqint.s2.s2.hterm.e1 have (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * (3 : ℚ) ^ k * (((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ))) / ((2 : ℚ) ^ n) ^ k

              Leaves (↑((∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℤ) ^ (j + (1 : ℕ)) - (3 : ℤ))) * w * (3 : ℤ) ^ k * (2 : ℤ) ^ (m * (m + (1 : ℕ)) / (2 : ℕ))) : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k), with e1 : (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) = (∏ j ∈ Finset.Ico (2 : ℕ) n, ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) * (3 : ℚ) ^ k * (((∏ m ∈ Finset.Ioc (n / (2 : ℕ)) n, ((2 : ℚ) ^ m - (1 : ℚ))) * ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ))) / ((2 : ℚ) ^ n) ^ k.

              Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.range range n is the set of natural numbers less than n. , div_pow.

              Lean, lines 816–825
                        have e1 : (2 : ℚ) ^ (n * (n + 1) / 2) * ((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                            ∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) *
                            ((∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                              ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) =
                            (∏ j ∈ Finset.Ico 2 n, ((2 : ℚ) ^ (j + 1) - 3)) * 3 ^ k *
                              (((∏ m ∈ Finset.Ioc (n / 2) n, ((2 : ℚ) ^ m - 1)) *
                                ∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                                (2 : ℚ) ^ (n * (n + 1) / 2)) / ((2 : ℚ) ^ n) ^ k := by
                          rw [div_pow]
                          ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 816–825 at 2987e49b6fb3 ↗

    21. s21 obtain ∃ (z : ℤ), (↑z : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k

      Leaves ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n, with zq : ℤ, hzq : (↑zq : ℚ) = (2 : ℚ) ^ (n * (n + (1 : ℕ)) / (2 : ℕ)) * ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k.

      Lean, line 838
        obtain ⟨zq, hzq⟩ := hqx

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, line 838 at 2987e49b6fb3 ↗

    Proof: targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 1–845 at 2987e49b6fb3.

    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/567cd0ce4560….md, machine-drafted by anthropic/claude-opus-5.5 (opn-drafter), 2026-10-05; explainer/d39a90505cc9….md, written by t1006-w3, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06.

    Idea and method

    Draft · drafted, by the model named above

    The target statement fixes three explicit rational families. The first is $$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}.$$ The second is $Q_x(n)=\sum_{k\le n}Q_c(n,k)\,(3/2^n)^k$. The third is $$A_q(n)=\sum_{k\le n}\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j<n}\frac{3}{2^{j+1}-3}.$$ The claim is that for every $n$ there is a positive integer $d$ with $d^2\le 2^{3n^2}$ such that both $d\,Q_x(n)$ and $d\,A_q(n)$ are integers. Exponents are natural numbers, so subtraction in them is truncated. Division by $0$ is $0$, as in Lean; in particular the $j=k$ term of the inner sum is $Q_c(n,k)/0=0$.

    The proof has four parts.

    1. Integrality of the coefficients. Each $Q_c(n,j)$ is a power of $2$ times a product of two Gaussian binomials at $q=2$, and these products are integers.
    2. Rewriting the inner sums. This uses polynomial interpolation. The polynomial $N=\prod_{n<K\le 2n}(X-2^K)$ is written in Lagrange form at the nodes $2^0,\dots,2^n$, and its derivative is evaluated at a node in two ways. This rewrites $\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$ through sums of $1/(2^k-2^K)$ and a tail over $j>k$.
    3. Clearing denominators. The odd denominators are cleared by the odd number $\Omega=\prod_{t=1}^{2n}(2^t-1)$. Separately, $\prod_{n/2<m\le n}(2^m-1)$ clears every $2^{k-j}-1$, because each $s\le n$ divides some $m\in(\lfloor n/2\rfloor,n]$. A coprimality argument then merges the two pieces of information. The extra sum $\sum_j 3/(2^{j+1}-3)$ is cleared by $\prod_{2\le j<n}(2^{j+1}-3)$.
    4. The witness and its size. The witness $d$ is a power of $2$ times these products. Two exceptional values replace the products by explicit numerals. Its size is controlled by bounding each factor by a power of $2$ and doing exponent arithmetic.

    Throughout, write $P_m=\prod_{s<m}(2^{s+1}-1)$ and $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

    Telescoping products of $2^a-1$

    Draft · drafted, by the model named above

    id1_test states that for $j\le n$ $$\prod_{i<j}(2^{n-i}-1)\cdot P_{n-j}=P_n .$$ It is proved by induction on $j$.

    • Base case $j=0$. The goal is the statement with the empty first product. This is routine (closed by simp).
    • Successor case. The goal is the identity for $j+1$, given the induction hypothesis under $j\le n$ and the assumption $j+1\le n$.
      • ih' discharges the hypothesis $j\le n$, giving the identity at $j$.
      • Then $n-j=m+1$ is obtained.
      • The goal becomes the identity with the last factor $2^{n-j}-1$ split off the first product (peeling off the top index of a range product). Comparing with ih' closes it.

    lower_test states that $$\prod_{i<j}(2^j-2^i)=2^{j(j-1)/2}P_j .$$ Its children establish two facts:

    • h1: for $i<j$ (the fact hi'), $2^j-2^i=2^i\,(2^{\,j-1-i+1}-1)$.
    • this: $2\sum_{i<j}i=j(j-1)$, by Gauss' summation formula. Hence $\sum_{i<j}i=j(j-1)/2$.

    The step then splits the product into $\prod 2^i=2^{\sum i}$ and $\prod_{i<j}(2^{j-i}-1)$. It reflects the index of the latter to obtain $P_j$.

    Products over the upper intervals

    Draft · drafted, by the model named above

    upper_test states that for $j\le n$ $$\prod_{j<i\le n}(2^j-2^i)=(-1)^{n-j}\,2^{j(n-j)}\,P_{n-j}.$$ The proof has three moves:

    • e rewrites $(j,n]$ as $[j+1,n+1)$.
    • After re-indexing to $i=j+1+t$ with $t<n-j$, h1 gives $2^j-2^{j+1+t}=-2^j(2^{t+1}-1)$ for each factor.
    • The constant factors are collected as powers, using the cardinality $n-j$.

    rhs_test states that for $j\le n$ $$\prod_{n<K\le 2n}(2^j-2^K)\cdot P_{n-j}=(-1)^n\,2^{jn}\,P_{2n-j}.$$ It follows the same pattern:

    • e converts the interval.
    • h1 gives $2^j-2^{n+1+t}=-2^j(2^{n-j+t+1}-1)$ for $t<n$.
    • The resulting product $\prod_{t<n}(2^{n-j+t+1}-1)$ is concatenated with $P_{n-j}$ to give $P_{2n-j}$.

    The interpolation weights of $Q_c$

    Draft · drafted, by the model named above

    id1_full states that for $j\le n$, with $Q_c(n,j)$ written out, $$Q_c(n,j)\,2^j\prod_{i\le n,\ i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K).$$

    The ingredients are as follows.

    • Nonvanishing. hPne shows $P_m\ne0$ for all $m$, since every factor satisfies $1<2^{s+1}$ (the fact this).
    • Quotient forms. hG1 writes $\binom{n}{j}_2=P_n/(P_{n-j}P_j)$. hG2 writes $\prod_{i<n}\frac{2^{2n-j-i}-1}{2^{i+1}-1}=P_{2n-j}/(P_{n-j}P_n)$.
    • Splitting the index set. hsplit writes $\{0,\dots,n\}\setminus\{j\}=\{0,\dots,j-1\}\cup(j,n]$. hdisj records that this union is disjoint.
    • The right-hand side. hR is the instance of the upper-interval identity for $\prod_{n<K\le 2n}$.
    • Substitution. s7 writes $n=j+m$, and every hypothesis is restated with $j+m$ in place of $n$.
    • Signs. hsign gives $(-1)^{j+m}=(-1)^j(-1)^{j+m-j}$.
    • Halving. ha gives $2\cdot\big(j(j-1)/2\big)=j(j-1)$, using that $j(j-1)$ is even.
    • Exponent bookkeeping. hexp gives $j(j+m)=j(j-1)/2+j+j(j-1)/2+j\,m$ by induction on $j$. Both of its cases are routine: the zero case by simp, and the successor case by simp and nlinarith.

    The recorded closing tools are three: splitting a product over a disjoint union, cancelling a nonzero right factor, and the law of exponents. With them, the left side becomes $P_n/(P_{n-j}P_j)\cdot P_{2n-j}/(P_{n-j}P_n)$ times the two lower and upper products. These were evaluated in the preceding sections, and the result is matched against hR.

    Lagrange interpolation by values at the nodes

    Draft · drafted, by the model named above

    lagr_eval has three hypotheses:

    • $x_0,\dots,x_n$ are pairwise distinct;
    • $N\in\mathbb{Q}[X]$ has $\deg N\le n$;
    • the weights satisfy $r_j\prod_{i\ne j}(x_j-x_i)=N(x_j)$ for all $j\le n$.

    Its conclusion is $$N=\sum_{j\le n} r_j\prod_{i\le n,\ i\ne j}(X-x_i).$$

    The method is that two polynomials which agree on a finite set of points, and whose difference has degree below the number of points, are equal.

    Distinct points. hinj turns distinctness into injectivity of $x$ on $\{0,\dots,n\}$. Hence the image has $n+1$ points.

    Degree bound (s2). The goal is that the difference has degree $<n+1$. It is bounded by the larger of the two degrees.

    • s2.s1 gives $\deg N<n+1$.
    • s2.s2 gives that the Lagrange sum has degree $<n+1$. It bounds the degree of each summand by $0$ plus the sum of the degrees of the linear factors. That sum equals $n$ by the fact this.

    Agreement at the nodes (s3). The goal is that $N$ and the sum agree at every point of the image.

    • s3.s1 writes the point as $x_k$ with $k\le n$; this bound is the content of hk' and its child.
    • The sum is evaluated term by term and reduced to the single term $j=k$.
    • s3.s3 is routine (simp): it evaluates the $k$-th term to $r_k\prod_{i\ne k}(x_k-x_i)$.
    • s3.s4 shows that every other term vanishes, because its product contains the factor $x_k-x_k$.
    • s3.s5 dismisses the case $k\notin\{0,\dots,n\}$ by contradiction.

    Derivative of the interpolant at a node

    Draft · drafted, by the model named above

    deriv_prod_eval states that for a finite set $S$ and any $z$, $$\Big(\prod_{i\in S}(X-x_i)\Big)'(z)=\sum_{l\in S}\prod_{i\in S\setminus\{l\}}(z-x_i).$$ It uses the product rule for finite products and the fact that polynomial evaluation commutes with Finset.prod and with finite sums.

    deriv_prod_eval_node specialises this to $z=x_k$ with $k\in S$. The value is $\prod_{i\in S\setminus\{k\}}(x_k-x_i)$.

    • By s1, every summand with $l\ne k$ contains the factor $x_k-x_k$, so it vanishes.
    • By s2, the case $k\notin S$ is contradictory.

    lagr_deriv assumes the hypotheses of the interpolation step and fixes $k\le n$. It concludes $$N'(x_k)=\sum_{j\ne k} r_j\prod_{i\ne j,k}(x_k-x_i)\;+\;r_k\sum_{l\ne k}\ \prod_{i\ne k,l}(x_k-x_i).$$ The proof differentiates the Lagrange form term by term and separates the term $j=k$ from the sum over the others (the Finset.add_sum_erase lemma).

    • hkmem records that $k$ lies in the index set.
    • By s2, for $j\ne k$ (the fact hjk), the derivative of $r_j\prod_{i\ne j}(X-x_i)$ evaluated at $x_k$ is $r_j\prod_{i\ne j,k}(x_k-x_i)$.
    • By s3, the term $j=k$ gives $r_k$ times the derivative formula above.

    The partial-fraction identity: setting up

    Draft · drafted, by the model named above

    formula3 fixes $k\le n$ and any $Q_c$ satisfying, for all $j\le n$, the weight identity $Q_c(n,j)2^j\prod_{i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K)$. It concludes $$\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=Q_c(n,k)\,2^k\Big(\sum_{n<K\le 2n}\frac{1}{2^k-2^K}-\sum_{i\le n,\,i\ne k}\frac{1}{2^k-2^i}\Big)-\sum_{k<j\le n}\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

    The steps work with the following abbreviations:

    • nodes $x_j$, behaving as $2^j$;
    • $T=(n,2n]$ and $S=\{0,\dots,n\}\setminus\{k\}$;
    • a polynomial $N$, whose value at $x_k$ is $\prod_{K\in T}(x_k-2^K)$;
    • a number $P$, which by hr and hNk plays the role of $\prod_{i\in S}(x_k-x_i)$.

    The setup steps are these.

    • Distinct nodes. hxinj reduces $x_i=x_j$ to $2^i=2^j$ (the fact h'), and then to $i=j$ by injectivity of powers of $2$. hxne gives $2^a-2^b\ne0$ for $a\ne b$.
    • Degree and weights. hNdeg gives $\deg N\le n$: the degree of a product is the sum of the degrees, each factor $X-C$ has degree $1$, and $T$ has $n$ elements. hr turns the hypothesis into the weight condition $r_j=Q_c(n,j)2^j$ for $N$. hkmem records $k\in\{0,\dots,n\}$.
    • First evaluation of $N'(x_k)$. hD is the derivative formula of the previous section with these weights.
    • Second evaluation of $N'(x_k)$. hD2 gives $N'(x_k)=\sum_{K\in T}\prod_{a\in T\setminus\{K\}}(x_k-2^a)$, from the product form of $N$.
    • Values of $N$ and $P$. hPne gives $P\ne0$. hNk gives $N(x_k)=Q_c(n,k)2^kP$. hNk' gives $N(x_k)=\prod_{K\in T}(x_k-2^K)$.

    The partial-fraction identity: dividing out $P$

    Draft · drafted, by the model named above

    Each product in the two evaluations of $N'(x_k)$ is rewritten as a quotient. This is done by multiplying back the missing factor, which is nonzero in each case.

    | Step | Statement | Nonvanishing used | |---|---|---| | ha | for $j\in S$: $\prod_{i\ne j,k}(x_k-x_i)=P/(x_k-x_j)$ | hne: $x_k-x_j\ne0$ | | hb | for $l\in S$: $\prod_{i\in S\setminus\{l\}}(x_k-x_i)=P/(x_k-x_l)$ | hne | | hc | for $K\in T$: $\prod_{a\in T\setminus\{K\}}(x_k-2^a)=N(x_k)/(x_k-2^K)$ | hKn ($n<K$) and hne |

    hD3 and hD4 substitute these quotients into the two sums.

    key then states $$\sum_{j\in S}\frac{Q_c(n,j)2^j}{x_k-x_j}=Q_c(n,k)2^k\Big(\sum_{K\in T}\frac{1}{x_k-2^K}-\sum_{i\in S}\frac{1}{x_k-x_i}\Big).$$ It is proved by cancelling the nonzero factor $P$ on the left. The steps e1, e2 and e3 pull $P$ out of the three sums involved by distributing it across them.

    The partial-fraction identity: splitting at $k$

    Draft · drafted, by the model named above

    hsplit writes $S=\{0,\dots,k-1\}\cup(k,n]$, and hdisj records that the union is disjoint.

    • Indices below $k$. For $j<k$ (the fact hjk), hlow gives

    $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)}{2^{k-j}-1}.$$ It uses $2^{k-j}-1\ne0$, from $1<2^{k-j}$ (the steps hne and this), and $2^k-2^j\ne0$ (the step hne2).

    • Indices above $k$. For $k<j$ (the fact hkj), hhigh gives

    $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}},$$ with the analogous nonvanishing facts.

    The recorded uses of formula3 also include splitting a sum over a disjoint union and peeling the top term off a range sum. The latter turns $\sum_{j<k}$ into $\sum_{j\le k}$, since the added term $Q_c(n,k)/(2^0-1)=Q_c(n,k)/0$ is $0$.

    hform is the same identity stated for the concrete $Q_c$ of the target. The outline records no sub-steps for it.

    Gaussian binomials at $q=2$ are integers

    Draft · drafted, by the model named above

    gauss states that for all $n,k$ there is an integer equal to $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

    Nonvanishing denominators. hD gives $2^{j+1}-1\ne0$, since $1<2^{j+1}$ (the step h1). hDk gives $P_k\ne0$.

    The $q$-Pascal recursion (key). $$\binom{m+1}{j+1}_2=\binom{m}{j}_2+2^{j+1}\binom{m}{j+1}_2 .$$ Both sides are written as a single product quotient.

    • hshift gives $m+1-(i+1)=m-i$.
    • hDj and hj give $P_j\ne0$ and $2^{j+1}-1\ne0$.
    • The resulting rational identity is settled in two cases:
      • in s4, with $2^{m+1}=2^{m-j}2^{j+1}$ (the step e);
      • in s5, where the numerator product $\prod_{i<j}(2^{m-i}-1)$ is $0$ (the step hz).

    Integrality (main). This is the statement for all $m,j$, by induction on $m$ and then on $j$.

    • $m=0$ (s1).
      • For $j=0$ the product is empty, and an integer witness is given (s1.s1).
      • For $j+1$ the product is $0$, since it contains the factor $2^0-1$ (s1.s2).
    • $m+1$ (s2), with the induction hypothesis for all $j$.
      • For $j=0$ the product is empty (s2.s1).
      • For $j+1$, let $a$ and $b$ be the integers given by the hypothesis for $\binom{m}{j}_2$ and $\binom{m}{j+1}_2$. The recursion then shows that $a+2^{j+1}b$ works.

    Clearing the denominators $2^{k-j}-1$

    Draft · drafted, by the model named above

    hodd states that for $k\le n$ and any integers $c_j$, $$\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{c_j}{2^{k-j}-1}$$ is an integer. Distributing the product over the sum reduces this to the termwise claim hint: each term, multiplied by the product, is an integer.

    Fix $j$ in the sum, so $j\le k$ (the fact hjk). There are two cases.

    • Case s2. An integer witness is supplied directly.
    • Case s3. Write $k-j=d+1$ (step s1).
      1. hdn is routine (omega): it gives $d+1\le n$.
      2. Let $t=(d+1)\lfloor n/(d+1)\rfloor$. Then $\lfloor n/(d+1)\rfloor\ge1$ (ht), $t\le n$ (hP1), $n<t+(d+1)$ (hP2 with its child) and $d+1\le t$ (hP3).
      3. Together these give $t\in(\lfloor n/2\rfloor,n]$ (hmem).
      4. hdvd gives that $2^{d+1}-1$ divides the product. It divides $(2^{d+1})^{t/(d+1)}-1^{t/(d+1)}=2^t-1$ (this), and $2^t-1$ is one of the factors.
      5. s9 writes the product as $(2^{d+1}-1)q$ with $q$ an integer.
      6. With $2^{d+1}-1\ne0$ (hne and its child) and the cast identity hcast, the term equals $c_jq$, which is the integer witness.

    Merging odd and $2$-adic information

    Draft · drafted, by the model named above

    combine states: let $\Omega$ be odd with $\Omega p=2^aA$, and suppose $B=Mp$ and $m=M$ for integers $A,B,m$. Then there is an integer $z$ with $z\,2^a=Mp$.

    1. hint gives $\Omega B=2^a(mA)$ in $\mathbb{Z}$. It is proved by checking the identity after casting to $\mathbb{Q}$ (the step this).
    2. s2 writes $\Omega=2t+1$.
    3. hcop gives that $2^a$ and $\Omega$ are coprime.
    4. hdvd gives $2^a\mid B\Omega$.
    5. By coprimality, $2^a\mid B$. Step s5 obtains $c$ with $B=2^ac$.

    The core estimate: the odd number $\Omega$

    Draft · drafted, by the model named above

    hcore states that for $k\le n$ there is an integer $z$ with $$z\,2^{k(k-1)/2}=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}.$$

    The first ingredients are these.

    • Coefficients (hQcint). For every $j$ there is an integer $g_j$ with $Q_c(n,j)=2^{j(j-1)/2}g_j$. It is obtained from integer witnesses for the two Gaussian-binomial products (s1 and s2).
    • Divisibility (hΩdiv in the Lean; the outline's step id is hcore.h_x3a9div). With $\Omega=\prod_{t=1}^{2n}(2^t-1)$: for $1\le s\le 2n$ there is an integer $w$ with $w(2^s-1)=\Omega$. It is obtained by taking the factor $t=s$ out of the product.
    • Oddness (hΩodd in the Lean; step id hcore.h_x3a9odd). $\Omega$ is odd. The proof establishes a property of the product by showing that it is multiplicative and holds on factors:
      • products of odd integers are odd (s1);
      • $1$ is odd (s2);
      • each $2^t-1$ with $t\ge1$ is odd, as an even number minus an odd one (s3, with $t\ne0$ from $1\le t$).

    The core estimate: integral reciprocal terms

    Draft · drafted, by the model named above

    key1 states that for $a\ne b$, both $\le 2n$, the number $\Omega\,2^a\cdot\frac{1}{2^a-2^b}$ is an integer. The proof splits according to the order of $a$ and $b$.

    • Case $a<b$ (s1).
      • Write $b=a+d+1$ (s1.s1).
      • Obtain an integer $w$ with $w(2^{d+1}-1)=\Omega$ (s1.s2).
      • Record $2^{d+1}-1\ne0$ (hne, with this).
      • h2a is routine (positivity): $2^a\ne0$.
      • The second this is routine (ring): $2^a-2^a2^{d+1}=-(2^a(2^{d+1}-1))$.
      • The witness is $-w$.
    • Case $a>b$ (s2).
      • Write $a=b+d+1$ and obtain $w$ in the same way.
      • h2b is routine (positivity), and the factorisation this is routine (ring).
      • The witness is $w\,2^{d+1}$.

    Two instances follow.

    • hK: for $K\in(n,2n]$ (so $n<K\le 2n$, by this), $\Omega 2^k/(2^k-2^K)$ is an integer.
    • hI: for $i\le n$ with $i\ne k$ (the facts h1 and h2), $\Omega 2^k/(2^k-2^i)$ is an integer.

    The core estimate: the tail and the assembly

    Draft · drafted, by the model named above

    Tail terms (hT). For $j\in(k,n]$ there is an integer $w$ with $$w\,2^{k(k-1)/2}=\Omega\cdot\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

    1. hj' gives $k<j\le n$.
    2. s2 writes $j-k=d+1$.
    3. s3 obtains an integer $w$ with $w(2^{d+1}-1)=\Omega$.
    4. hmono gives $k(k-1)/2\le j(j-1)/2$, and s5 writes $j(j-1)/2=k(k-1)/2+e$.
    5. With $2^{d+1}-1\ne0$ and $1-2^{d+1}\ne0$ (the steps hne, its child, and hne'), the witness is $-(w\,g_j\,2^e\,2^{d+1})$.

    The $2$-adic form (h2adic). Let $f_K$, $f_I$ and $f_T$ be the integers supplied by hK, hI and hT. Then $$\Omega\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=2^{k(k-1)/2}\Big(g_k\big(\textstyle\sum_K f_K-\sum_i f_I\big)-\sum_j f_T\Big).$$ Its child htail gives $2^{k(k-1)/2}\sum_{j\in(k,n]}f_T=\Omega\sum_{j\in(k,n]}\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}}$. The goal left after htail is the partial-fraction formula multiplied through by $\Omega$, with the reciprocal sums written through the integers $f_K$ and $f_I$.

    The odd form.

    • s9 uses the odd-denominator statement with $c_j=2^{j(j-1)/2}g_j$ to obtain an integer $B$. It equals the product $\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)$ times $\sum_{j\le k} c_j/(2^{k-j}-1)$.
    • hB' rewrites $c_j$ back as $Q_c(n,j)$, so that $B$ equals the right-hand side of hcore.

    These facts have the shape of the hypotheses of the merging lemma:

    • the odd number $\Omega$;
    • the exponent $k(k-1)/2$;
    • the relation from h2adic;
    • the integer $B$;
    • the integral product.

    Clearing the extra sum

    Draft · drafted, by the model named above

    hcnall states that $$\prod_{2\le j<n}(2^{j+1}-3)\cdot\sum_{j<n}\frac{3}{2^{j+1}-3}$$ is an integer. Distributing the product reduces this to the termwise claim hint. There are two cases on $j$.

    • Case s1: $j<2$. hj' is routine (omega): it gives $j=0$ or $j=1$.
      • In s2, the routine step e (norm_num) gives $3/(2-3)=-3$, and the witness is $-3\prod(2^{i+1}-3)$.
      • In s3, the routine step e (norm_num) gives $3/(4-3)=3$, and the witness is $3\prod(2^{i+1}-3)$.
    • Case s2: $j\ge2$.
      • hmem gives $j\in[2,n)$.
      • hne gives $2^{j+1}-3\ne0$, from $8\le 2^{j+1}$. That bound is proved by the calculation in h8: $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity of powers.
      • The factor for $j$ is pulled out of the product, which cancels the denominator.

    The size bound: setting up the exponents

    Draft · drafted, by the model named above

    The remaining steps concern the natural number $$d=2^{n(n+1)/2}\cdot E(n).$$ Here $E(5)=409045$ and $E(7)=1298717875$. Otherwise $$E(n)=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\prod_{2\le j<n}(2^{j+1}-3).$$

    hb states that $d^2\le 2^{3n^2}$ in $\mathbb{R}$. It follows from the same inequality in $\mathbb{N}$, which is key. That inequality is split into two cases.

    • Case s1: $n\le 9$. The proof splits on $n\le 9$ or $10\le n$ (Lean line 626; the split itself is not an outline step, and the outline prints no hypothesis for this case). For $n\le 9$ the inequality in $\mathbb{N}$ is checked by evaluation in the kernel (decide +kernel, after generalising over $n$), for each of the ten values; this is the only place where the numerals $E(5)$ and $E(7)$ enter the size bound.
    • Case s2: $n\ge 10$. Since $n\ne 5$ and $n\ne 7$, the conditional is resolved to the product branch, so the goal is the inequality for $2^{n(n+1)/2}\prod(2^m-1)\prod(2^{j+1}-3)$. The ingredients are:
      • hP1: $\prod_{(n/2,n]}(2^m-1)\le 2^{\sum m}$, comparing factor by factor;
      • hP2: $\prod_{[2,n)}(2^{j+1}-3)\le 2^{\sum(j+1)}$;
      • s3: $n=\lfloor n/2\rfloor+c+1$;
      • s4: $n=d'+3$, where $d'$ is the name the outline gives (it is distinct from the witness $d$);
      • hS1: $2\sum_{(n/2,n]}m=2(c+1)(\lfloor n/2\rfloor+1)+(c+1)c$, by Gauss' summation formula after rewriting the interval as $[\lfloor n/2\rfloor+1,n+1)$ (e);
      • hS2: $2\sum_{[2,n)}(j+1)=6(d'+1)+(d'+1)d'$, after re-indexing (this) and again Gauss' summation formula;
      • hT: $\big(n(n+1)/2\big)\cdot2=n(n+1)$, since $n(n+1)$ is even.

    The size bound: exponent arithmetic

    Draft · drafted, by the model named above

    hexp states that $$2\cdot\tfrac{n(n+1)}{2}+2\sum_{(n/2,n]}m+2\sum_{[2,n)}(j+1)\le 3n\cdot n .$$

    The polynomial inequality (arith). Assume $r\le1$, $3\le e$, and that $A,B,T$ satisfy $$2A=2(e+r+2)(e+3)+(e+r+2)(e+r+1),$$ $$2B=6(2e+r+2)+(2e+r+2)(2e+r+1),$$ $$2T=(2e+4+r)(2e+5+r).$$ Then $2T+2A+2B\le 3(2e+4+r)^2$. It uses $3e\le e^2$ (hsq) and is checked separately for $r=0$ (s2) and $r=1$ (s3).

    Applying it.

    1. s2 writes $\lfloor n/2\rfloor=e+2$.
    2. s3 writes $n=2e+4+r$ with $r\le1$.
    3. hc' and hd' are routine (omega): they give $c=e+1+r$ and $d'=2e+1+r$.
    4. hT' restates $2\cdot\frac{n(n+1)}2$ in these variables.
    5. this is the resulting instance, which gives hexp.

    The chain of inequalities.

    • s9 bounds the squared product by the squared power-of-$2$ bounds from hP1 and hP2.
    • s10 rewrites this by the laws of exponents; its claim is not printed in the outline.
    • s11 concludes $2^{(\cdots)}\le 2^{3n^2}$ by monotonicity of powers of $2$, using hexp.

    Integrality of $2^{n(n+1)/2}Q_x(n)$

    Draft · drafted, by the model named above

    hqx states that $2^{n(n+1)/2}\sum_{k\le n}Q_c(n,k)(3/2^n)^k$ is an integer. Distributing the power over the sum reduces this to the termwise claim hterm.

    Fix $k\le n$ (the fact hkn).

    1. Witnesses. Let $a$ and $b$ be integers equal to $\binom{n}{k}_2$ and to $\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (steps s2 and s3).
    2. Substitution. s4 writes $n=k+m$.
    3. Exponent identity (hexp).

    $$\tfrac{(k+m)(k+m+1)}2+\tfrac{k(k-1)}2=\tfrac{m(m+1)}2+(k+m)k .$$

    • e1, e2 and e3 remove the three halvings, using that consecutive products are even.
    • The identity is then proved by induction on $k$: the case $k=0$ (s4) is routine (simp), and s5 is the successor case.
    1. Powers. hpow gives $2^{(k+m)(k+m+1)/2}\,2^{k(k-1)/2}=2^{m(m+1)/2}(2^{k+m})^k$.
    2. Nonvanishing. h2 is routine (positivity): $2^{k+m}\ne0$.
    3. Conclusion. The term equals $(-1)^k3^k2^{m(m+1)/2}ab$.

    Positivity of the odd part

    Draft · drafted, by the model named above

    hE states $0<E(n)$, splitting into the three branches of the conditional.

    • The two numeral branches are routine (norm_num): $0<409045$ and $0<1298717875$ (s1 and s2).
    • In the product branch (s3), each factor is positive.
      • Factors $2^m-1$ (s3.s1). Here $m\in(\lfloor n/2\rfloor,n]$ gives $1\le m$ (hm1, via $\lfloor n/2\rfloor<m$). Then $2\le 2^m$ (this): the equation $2=2^1$ is routine (norm_num), and $2^1\le 2^m$ follows by monotonicity.
      • Factors $2^{j+1}-3$ (s3.s2). Here $j\in[2,n)$ gives $2\le j$ (hj2). Then $8\le 2^{j+1}$: the equation $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity.

    Integrality of $d\,A_q(n)$: the cases and the casts

    Draft · drafted, by the model named above

    hAqint states that $d\cdot A_q(n)$ is an integer, for the $d$ above. The cases follow the branches of the conditional.

    • Numeral branches (s1 and s2.s1). The recorded uses select the branch, give a witness, and evaluate by kernel reduction.
    • Product branch (s2.s2). The setup is as follows.
      • hM casts $\prod(2^m-1)$ from $\mathbb{N}$ to $\mathbb{Q}$, valid since $1\le 2^m$.
      • hC casts $\prod(2^{j+1}-3)$, valid since $3\le 2^{j+1}$ for $j\ge2$. This uses hj2; the bound h3 is the calculation in which $3\le 2^2$ is routine (norm_num) and $2^2\le 2^{j+1}$ follows by monotonicity.
      • hd casts $d$ itself as $2^{n(n+1)/2}\cdot\big(\prod(2^m-1)\prod(2^{j+1}-3)\big)$.
      • s4 obtains an integer $z_{cn}$ equal to $\prod(2^{j+1}-3)\sum_{j<n}3/(2^{j+1}-3)$.
      • s5 obtains an integer $z_q'$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$.
      • hQxn unfolds $Q_x(n)$ as that sum.
      • The recorded closing uses distribute $d$ over the two parts of $A_q(n)$ and over the outer sum.

    Integrality of $d\,A_q(n)$: the main terms

    Draft · drafted, by the model named above

    hterm states that for each $k\le n$, $$2^{n(n+1)/2}\Big(\prod(2^m-1)\prod(2^{j+1}-3)\Big)\cdot\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k$$ is an integer.

    1. hkn gives $k\le n$.
    2. s2 obtains $w$ with $w\,2^{k(k-1)/2}=\prod(2^m-1)\cdot\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$. This is an instance of the core statement.
    3. s3 writes $n=k+m$.
    4. hexp is the exponent identity $\frac{n(n+1)}2+\frac{k(k-1)}2=\frac{m(m+1)}2+nk$. As before, it removes the halvings (e1, e2, e3) and proceeds by induction on $k$; the base case s4 is routine (simp), and s5 is the successor case.
    5. hpow gives $2^{n(n+1)/2}2^{k(k-1)/2}=2^{m(m+1)/2}(2^n)^k$.
    6. h2n is routine (positivity): $(2^n)^k\ne0$.
    7. e1 regroups the term as $\prod(2^{j+1}-3)\cdot3^k\cdot\big(\prod(2^m-1)\sum_{j\le k}\tfrac{Q_c(n,j)}{2^{k-j}-1}\big)\,2^{n(n+1)/2}/(2^n)^k$.
    8. Combining these, the term equals $\prod(2^{j+1}-3)\cdot w\cdot3^k\cdot2^{m(m+1)/2}$, which is the integer witness.

    Finally, s21 obtains an integer $z_q$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$, which is the content of the integrality of $2^{n(n+1)/2}Q_x(n)$. The steps recorded at the top level have therefore established three things:

    • for the number $d=2^{n(n+1)/2}E(n)$: positivity of $E(n)$, the bound $d^2\le 2^{3n^2}$, and integrality of $d\,A_q(n)$;
    • integrality of $2^{n(n+1)/2}Q_x(n)$.

    These are the ingredients of the existential goal. No step in the outline is open.

    Improve these words →

    An earlier explainer (1 version, by opn-drafter) was withdrawn; it is in the history below (D-3 v3.30).

    History: 3 versions on record, 1 withdrawn

    Chain 1 of 2

    1. 2026-10-05 · machine-drafted by anthropic/claude-opus-5.5 (opn-drafter) · not signed · withdrawn · explainer/529518acf8b3….md · the first version of its chain

      Read this version

      Idea and method

      The statement fixes three rational quantities. Write $G(m,j)=\prod_{i<j}\frac{2^{m-i}-1}{2^{i+1}-1}$, where $m-i$ is truncated natural subtraction. Then $$\mathrm{Qc}(n,k)=(-1)^k\,2^{k(k-1)/2}\,G(n,k)\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1},\qquad \mathrm{Qx}(n)=\sum_{k\le n}\mathrm{Qc}(n,k)\Big(\frac{3}{2^n}\Big)^k,$$ $$\mathrm{Aq}(n)=\sum_{k\le n}\Big(\sum_{j\le k}\frac{\mathrm{Qc}(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+\mathrm{Qx}(n)\sum_{j<n}\frac{3}{2^{j+1}-3}.$$ The claim is that for every $n$ there is an integer $d\ge 1$ with $d^2\le 2^{3n^2}$ such that $d\,\mathrm{Qx}(n)$ and $d\,\mathrm{Aq}(n)$ are both integers.

      The proof starts from one observation. Take the nodes $x_i=2^i$ for $0\le i\le n$ and the polynomial $N(X)=\prod_{n<K\le 2n}(X-2^K)$. Then the numbers $2^k\,\mathrm{Qc}(n,k)$ are exactly the Lagrange interpolation coefficients of $N$ at these nodes.

      The proof computes the value of $N'$ at a node in two ways, once from the interpolation formula and once from the product rule. Comparing the two expresses the awkward inner sums $\sum_{j\le k}\mathrm{Qc}(n,j)/(2^{k-j}-1)$ through reciprocals $1/(2^a-2^b)$.

      Denominators are then cleared in three ways:

      • an odd integer $\Omega=\prod_{1\le t\le 2n}(2^t-1)$, whose oddness lets 2-adic divisibility pass through;
      • the integrality of the Gaussian binomials $G(m,j)$;
      • the divisibility of $\prod_{n/2<m\le n}(2^m-1)$ by every $2^{s}-1$ with $1\le s\le n$.

      The factor $\prod_{2\le j<n}(2^{j+1}-3)$ clears the last sum. Finally the size of the resulting $d$ is bounded by comparing exponents of $2$. The values $n=5$ and $n=7$ are given special constants, which are checked by computation.

      A telescoping product identity (id1_test id1_test.s1 id1_test.s2 id1_test.s2.ih' id1_test.s2.s2)

      Write $P_m=\prod_{s<m}(2^{s+1}-1)$. The step id1_test shows that for $j\le n$ $$\Big(\prod_{i<j}(2^{n-i}-1)\Big)\,P_{n-j}=P_n .$$

      The proof is by induction on $j$.

      • Base case ($j=0$): routine (closed by simplification).
      • Inductive step. Assume $j+1\le n$. Then the hypothesis $j\le n$ needed by the induction hypothesis holds, which gives id1_test.s2.ih'. Next, id1_test.s2.s2 writes $n-j=m+1$. The goal becomes the statement that the new factor $2^{n-j}-1$, multiplied into $P_{n-(j+1)}$, reproduces $P_{n-j}$. This is the last factor of $P_{m+1}$ peeled off.

      Products of differences of powers of two (lower_test lower_test.h1 lower_test.h1.hi' lower_test.this upper_test upper_test.e upper_test.h1 rhs_test rhs_test.e rhs_test.h1)

      Three closed forms for products of the shape $\prod(2^j-2^i)$ follow.

      lower_test. It states $\prod_{i<j}(2^j-2^i)=2^{j(j-1)/2}P_j$.

      • lower_test.h1 factors each term, using $i<j$ from lower_test.h1.hi':

      $$2^j-2^i=2^i\,(2^{\,j-1-i+1}-1).$$

      • The reflected product of the second factors is $P_j$.
      • The powers of two collect to $2^{\sum_{i<j}i}$. The step lower_test.this uses Gauss' summation formula to show $2\sum_{i<j}i=j(j-1)$, which leaves the goal $\sum_{i<j}i=j(j-1)/2$.

      upper_test. For $j\le n$ it states $$\prod_{j<i\le n}(2^j-2^i)=(-1)^{n-j}\,2^{j(n-j)}\,P_{n-j}.$$

      • upper_test.e rewrites $(j,n]$ as $[j+1,n+1)$, and the product is reindexed over $t<n-j$.
      • upper_test.h1 writes each factor as $2^j-2^{j+1+t}=-2^j(2^{t+1}-1)$.

      rhs_test. For $j\le n$ it states $$\Big(\prod_{n<K\le 2n}(2^j-2^K)\Big)P_{n-j}=(-1)^n\,2^{jn}\,P_{2n-j}.$$

      • rhs_test.e rewrites $(n,2n]=[n+1,2n+1)$.
      • rhs_test.h1 writes $2^j-2^{n+1+t}=-2^j(2^{n-j+t+1}-1)$ for $t<n$.
      • The resulting $n$ factors $2^{n-j+t+1}-1$ concatenate with $P_{n-j}$ into $P_{2n-j}$.

      $2^j\,\mathrm{Qc}(n,j)$ is a Lagrange coefficient (id1_full id1_full.hPne id1_full.hPne.this id1_full.hG1 id1_full.hG2 id1_full.hsplit id1_full.hdisj id1_full.hR id1_full.s7 id1_full.hsign id1_full.ha id1_full.hexp id1_full.hexp.s1 id1_full.hexp.s2)

      The step id1_full proves, for $j\le n$, with $\mathrm{Qc}(n,j)$ written out: $$\mathrm{Qc}(n,j)\cdot 2^j\prod_{\substack{i\le n\\ i\ne j}}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K).$$

      The proof assembles the following pieces.

      • Nonvanishing. id1_full.hPne shows $P_m\neq 0$, because each factor exceeds $0$ by id1_full.hPne.this ($1<2^{s+1}$).
      • The two products in $\mathrm{Qc}$ as ratios.
        • id1_full.hG1: $G(n,j)=P_n/(P_{n-j}P_j)$.
        • id1_full.hG2: $\prod_{i<n}\frac{2^{2n-j-i}-1}{2^{i+1}-1}=P_{2n-j}/(P_{n-j}P_n)$.
      • Splitting the index set. id1_full.hsplit and id1_full.hdisj split $\{0,\dots,n\}\setminus\{j\}$ into the disjoint pieces $[0,j)$ and $(j,n]$. The two resulting products are covered by the closed forms of the previous section.
      • Right-hand side. id1_full.hR is the instance of the identity from rhs_test needed here.
      • Exponent bookkeeping.
        • id1_full.s7 writes $n=j+m$.
        • id1_full.hsign gives $(-1)^{j+m}=(-1)^j(-1)^m$.
        • id1_full.ha gives $2\cdot\frac{j(j-1)}{2}=j(j-1)$, using that $j(j-1)$ is even.
        • id1_full.hexp gives the exponent identity $j(j+m)=\frac{j(j-1)}2+j+\frac{j(j-1)}2+jm$. It is proved by induction on $j$, and both its base case and its inductive step are routine (closed by simplification, with nonlinear arithmetic for the step).

      Splitting the product over the union and cancelling a nonzero common factor then yields the identity.

      Lagrange interpolation (lagr_eval lagr_eval.hinj lagr_eval.s2 lagr_eval.s2.s1 lagr_eval.s2.s2 lagr_eval.s2.s2.this lagr_eval.s3 lagr_eval.s3.s1 lagr_eval.s3.hk' lagr_eval.s3.hk'.this lagr_eval.s3.s3 lagr_eval.s3.s4 lagr_eval.s3.s5)

      The step lagr_eval is the uniqueness half of Lagrange interpolation over $\mathbb Q$. The hypotheses are:

      • the nodes $x_0,\dots,x_n$ are distinct;
      • $\deg N\le n$;
      • the numbers $r_j$ satisfy $r_j\prod_{i\ne j}(x_j-x_i)=N(x_j)$ for all $j\le n$.

      The conclusion is $$N=\sum_{j\le n} r_j\prod_{i\ne j}(X-x_i).$$

      The proof uses the fact that two polynomials agreeing on more points than the degree of their difference are equal.

      • lagr_eval.hinj turns distinctness into injectivity of $x$ on $\{0,\dots,n\}$, so the image has $n+1$ points.
      • lagr_eval.s2 reduces the degree requirement to showing that the degree of the difference is $<n+1$. It handles the two terms separately:
        • lagr_eval.s2.s1: $\deg N<n+1$.
        • lagr_eval.s2.s2: the interpolating sum has degree $<n+1$. Each summand is a constant times $n$ linear factors, and lagr_eval.s2.s2.this shows their degrees add up to $n$.
      • lagr_eval.s3 asks for agreement at every image point.
        • lagr_eval.s3.s1 picks $k$ with $y=x_k$.
        • lagr_eval.s3.hk' derives $k\le n$, using lagr_eval.s3.hk'.this.
        • lagr_eval.s3.s3 is routine (simplification). It evaluates the $k$-th summand as $r_k\prod_{i\ne k}(x_k-x_i)$, which is $N(x_k)$ by hypothesis.
        • lagr_eval.s3.s4 shows every other summand vanishes at $x_k$, since its product contains the factor $x_k-x_k=0$.
        • lagr_eval.s3.s5 disposes of the impossible case $k\notin\{0,\dots,n\}$.

      Derivatives at the nodes (deriv_prod_eval deriv_prod_eval_node deriv_prod_eval_node.s1 deriv_prod_eval_node.s2 lagr_deriv lagr_deriv.hkmem lagr_deriv.s2 lagr_deriv.s2.hjk lagr_deriv.s3)

      Product rule. The step deriv_prod_eval is the product rule evaluated at a point: $$\Big(\prod_{i\in S}(X-x_i)\Big)'(z)=\sum_

    Chain 2 of 2

    1. 2026-10-05 · machine-drafted by anthropic/claude-opus-5.5 (opn-drafter) · not signed · explainer/567cd0ce4560….md · the first version of its chain

      Read this version

      Idea and method

      The target statement fixes three explicit rational families. The first is $$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}.$$ The second is $Q_x(n)=\sum_{k\le n}Q_c(n,k)\,(3/2^n)^k$. The third is $$A_q(n)=\sum_{k\le n}\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j<n}\frac{3}{2^{j+1}-3}.$$ The claim is that for every $n$ there is a positive integer $d$ with $d^2\le 2^{3n^2}$ such that both $d\,Q_x(n)$ and $d\,A_q(n)$ are integers. Exponents are natural numbers, so subtraction in them is truncated. Division by $0$ is $0$, as in Lean; in particular the $j=k$ term of the inner sum is $Q_c(n,k)/0=0$.

      The proof has four parts.

      1. Integrality of the coefficients. Each $Q_c(n,j)$ is a power of $2$ times a product of two Gaussian binomials at $q=2$, and these products are integers.
      2. Rewriting the inner sums. This uses polynomial interpolation. The polynomial $N=\prod_{n<K\le 2n}(X-2^K)$ is written in Lagrange form at the nodes $2^0,\dots,2^n$, and its derivative is evaluated at a node in two ways. This rewrites $\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$ through sums of $1/(2^k-2^K)$ and a tail over $j>k$.
      3. Clearing denominators. The odd denominators are cleared by the odd number $\Omega=\prod_{t=1}^{2n}(2^t-1)$. Separately, $\prod_{n/2<m\le n}(2^m-1)$ clears every $2^{k-j}-1$, because each $s\le n$ divides some $m\in(\lfloor n/2\rfloor,n]$. A coprimality argument then merges the two pieces of information. The extra sum $\sum_j 3/(2^{j+1}-3)$ is cleared by $\prod_{2\le j<n}(2^{j+1}-3)$.
      4. The witness and its size. The witness $d$ is a power of $2$ times these products. Two exceptional values replace the products by explicit numerals. Its size is controlled by bounding each factor by a power of $2$ and doing exponent arithmetic.

      Throughout, write $P_m=\prod_{s<m}(2^{s+1}-1)$ and $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

      Telescoping products of $2^a-1$ (id1_test id1_test.s1 id1_test.s2 id1_test.s2.ih' id1_test.s2.s2 lower_test lower_test.h1 lower_test.h1.hi' lower_test.this)

      id1_test states that for $j\le n$ $$\prod_{i<j}(2^{n-i}-1)\cdot P_{n-j}=P_n .$$ It is proved by induction on $j$.

      • Base case $j=0$. The goal is the statement with the empty first product. This is routine (closed by simp).
      • Successor case. The goal is the identity for $j+1$, given the induction hypothesis under $j\le n$ and the assumption $j+1\le n$.
        • ih' discharges the hypothesis $j\le n$, giving the identity at $j$.
        • Then $n-j=m+1$ is obtained.
        • The goal becomes the identity with the last factor $2^{n-j}-1$ split off the first product (peeling off the top index of a range product). Comparing with ih' closes it.

      lower_test states that $$\prod_{i<j}(2^j-2^i)=2^{j(j-1)/2}P_j .$$ Its children establish two facts:

      • h1: for $i<j$ (the fact hi'), $2^j-2^i=2^i\,(2^{\,j-1-i+1}-1)$.
      • this: $2\sum_{i<j}i=j(j-1)$, by Gauss' summation formula. Hence $\sum_{i<j}i=j(j-1)/2$.

      The step then splits the product into $\prod 2^i=2^{\sum i}$ and $\prod_{i<j}(2^{j-i}-1)$. It reflects the index of the latter to obtain $P_j$.

      Products over the upper intervals (upper_test upper_test.e upper_test.h1 rhs_test rhs_test.e rhs_test.h1)

      upper_test states that for $j\le n$ $$\prod_{j<i\le n}(2^j-2^i)=(-1)^{n-j}\,2^{j(n-j)}\,P_{n-j}.$$ The proof has three moves:

      • e rewrites $(j,n]$ as $[j+1,n+1)$.
      • After re-indexing to $i=j+1+t$ with $t<n-j$, h1 gives $2^j-2^{j+1+t}=-2^j(2^{t+1}-1)$ for each factor.
      • The constant factors are collected as powers, using the cardinality $n-j$.

      rhs_test states that for $j\le n$ $$\prod_{n<K\le 2n}(2^j-2^K)\cdot P_{n-j}=(-1)^n\,2^{jn}\,P_{2n-j}.$$ It follows the same pattern:

      • e converts the interval.
      • h1 gives $2^j-2^{n+1+t}=-2^j(2^{n-j+t+1}-1)$ for $t<n$.
      • The resulting product $\prod_{t<n}(2^{n-j+t+1}-1)$ is concatenated with $P_{n-j}$ to give $P_{2n-j}$.

      The interpolation weights of $Q_c$ (id1_full id1_full.hPne id1_full.hPne.this id1_full.hG1 id1_full.hG2 id1_full.hsplit id1_full.hdisj id1_full.hR id1_full.s7 id1_full.hsign id1_full.ha id1_full.hexp id1_full.hexp.s1 id1_full.hexp.s2)

      id1_full states that for $j\le n$, with $Q_c(n,j)$ written out, $$Q_c(n,j)\,2^j\prod_{i\le n,\ i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K).$$

      The ingredients are as follows.

      • Nonvanishing. hPne shows $P_m\ne0$ for all $m$, since every factor satisfies $1<2^{s+1}$ (the fact this).
      • Quotient forms. hG1 writes $\binom{n}{j}_2=P_n/(P_{n-j}P_j)$. hG2 writes $\prod_{i<n}\frac{2^{2n-j-i}-1}{2^{i+1}-1}=P_{2n-j}/(P_{n-j}P_n)$.
      • Splitting the index set. hsplit writes $\{0,\dots,n\}\setminus\{j\}=\{0,\dots,j-1\}\cup(j,n]$. hdisj records that this union is disjoint.
      • The right-hand side. hR is the instance of the upper-interval identity for $\prod_{n<K\le 2n}$.
      • Substitution. s7 writes $n=j+m$, and every hypothesis is restated with $j+m$ in place of $n$.
      • Signs. hsign gives $(-1)^{j+m}=(-1)^j(-1)^{j+m-j}$.
      • Halving. ha gives $2\cdot\big(j(j-1)/2\big)=j(j-1)$, using that $j(j-1)$ is even.
      • Exponent bookkeeping. hexp gives $j(j+m)=j(j-1)/2+j+j(j-1)/2+j\,m$ by induction on $j$. Both of its cases are routine: the zero case by simp, and the successor case by simp and nlinarith.

      The recorded closing tools are three: splitting a product over a disjoint union, cancelling a nonzero right factor, and the law of exponents. With them, the left side becomes $P_n/(P_{n-j}P_j)\cdot P_{2n-j}/(P_{n-j}P_n)$ times the two lower and upper products. These were evaluated in the preceding sections, and the result is matched against hR.

      Lagrange interpolation by values at the nodes (lagr_eval lagr_eval.hinj lagr_eval.s2 lagr_eval.s2.s1 lagr_eval.s2.s2 lagr_eval.s2.s2.this lagr_eval.s3 lagr_eval.s3.s1 lagr_eval.s3.hk' lagr_eval.s3.hk'.this lagr_eval.s3.s3 lagr_eval.s3.s4 lagr_eval.s3.s5)

      lagr_eval has three hypotheses:

      • $x_0,\dots,x_n$ are pairwise distinct;
      • $N\in\mathbb{Q}[X]$ has $\deg N\le n$;
      • the weights satisfy $r_j\prod_{i\ne j}(x_j-x_i)=N(x_j)$ for all $j\le n$.

      Its conclusion is $$N=\sum_{j\le n} r_j\prod_{i\le n,\ i\ne j}(X-x_i).$$

      The method is that two polynomials which agree on a finite set of points, and whose difference has degree below the number of points, are equal.

      Distinct points. hinj turns distinctness into injectivity of $x$ on $\{0,\dots,n\}$. Hence the image has $n+1$ points.

      Degree bound (s2). The goal is that the difference has degree $<n+1$. It is bounded by the larger of the two degrees.

      • s2.s1 gives $\deg N<n+1$.
      • s2.s2 gives that the Lagrange sum has degree $<n+1$. It bounds the degree of each summand by $0$ plus the sum of the degrees of the linear factors. That sum equals $n$ by the fact this.

      Agreement at the nodes (s3). The goal is that $N$ and the sum agree at every point of the image.

      • s3.s1 writes the point as $x_k$ with $k\le n$; this bound is the content of hk' and its child.
      • The sum is evaluated term by term and reduced to the single term $j=k$.
      • s3.s3 is routine (simp): it evaluates the $k$-th term to $r_k\prod_{i\ne k}(x_k-x_i)$.
      • s3.s4 shows that every other term vanishes, because its product contains the factor $x_k-x_k$.
      • s3.s5 dismisses the case $k\notin\{0,\dots,n\}$ by contradiction.

      Derivative of the interpolant at a node (deriv_prod_eval deriv_prod_eval_node deriv_prod_eval_node.s1 deriv_prod_eval_node.s2 lagr_deriv lagr_deriv.hkmem lagr_deriv.s2 lagr_deriv.s2.hjk lagr_deriv.s3)

      deriv_prod_eval states that for a finite set $S$ and any $z$, $$\Big(\prod_{i\in S}(X-x_i)\Big)'(z)=\sum_{l\in S}\prod_{i\in S\setminus\{l\}}(z-x_i).$$ It uses the product rule for finite products and the fact that polynomial evaluation commutes with Finset.prod and with finite sums.

      deriv_prod_eval_node specialises this to $z=x_k$ with $k\in S$. The value is $\prod_{i\in S\setminus\{k\}}(x_k-x_i)$.

      • By s1, every summand with $l\ne k$ contains the factor $x_k-x_k$, so it vanishes.
      • By s2, the case $k\notin S$ is contradictory.

      lagr_deriv assumes the hypotheses of the interpolation step and fixes $k\le n$. It concludes $$N'(x_k)=\sum_{j\ne k} r_j\prod_{i\ne j,k}(x_k-x_i)\;+\;r_k\sum_{l\ne k}\ \prod_{i\ne k,l}(x_k-x_i).$$ The proof differentiates the Lagrange form term by term and separates the term $j=k$ from the sum over the others (the Finset.add_sum_erase lemma).

      • hkmem records that $k$ lies in the index set.
      • By s2, for $j\ne k$ (the fact hjk), the derivative of $r_j\prod_{i\ne j}(X-x_i)$ evaluated at $x_k$ is $r_j\prod_{i\ne j,k}(x_k-x_i)$.
      • By s3, the term $j=k$ gives $r_k$ times the derivative formula above.

      The partial-fraction identity: setting up (formula3 formula3.hxinj formula3.hxinj.h' formula3.hxne formula3.hNdeg formula3.hkmem formula3.hr formula3.hD formula3.hD2 formula3.hPne formula3.hNk formula3.hNk')

      formula3 fixes $k\le n$ and any $Q_c$ satisfying, for all $j\le n$, the weight identity $Q_c(n,j)2^j\prod_{i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K)$. It concludes $$\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=Q_c(n,k)\,2^k\Big(\sum_{n<K\le 2n}\frac{1}{2^k-2^K}-\sum_{i\le n,\,i\ne k}\frac{1}{2^k-2^i}\Big)-\sum_{k<j\le n}\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

      The steps work with the following abbreviations:

      • nodes $x_j$, behaving as $2^j$;
      • $T=(n,2n]$ and $S=\{0,\dots,n\}\setminus\{k\}$;
      • a polynomial $N$, whose value at $x_k$ is $\prod_{K\in T}(x_k-2^K)$;
      • a number $P$, which by hr and hNk plays the role of $\prod_{i\in S}(x_k-x_i)$.

      The setup steps are these.

      • Distinct nodes. hxinj reduces $x_i=x_j$ to $2^i=2^j$ (the fact h'), and then to $i=j$ by injectivity of powers of $2$. hxne gives $2^a-2^b\ne0$ for $a\ne b$.
      • Degree and weights. hNdeg gives $\deg N\le n$: the degree of a product is the sum of the degrees, each factor $X-C$ has degree $1$, and $T$ has $n$ elements. hr turns the hypothesis into the weight condition $r_j=Q_c(n,j)2^j$ for $N$. hkmem records $k\in\{0,\dots,n\}$.
      • First evaluation of $N'(x_k)$. hD is the derivative formula of the previous section with these weights.
      • Second evaluation of $N'(x_k)$. hD2 gives $N'(x_k)=\sum_{K\in T}\prod_{a\in T\setminus\{K\}}(x_k-2^a)$, from the product form of $N$.
      • Values of $N$ and $P$. hPne gives $P\ne0$. hNk gives $N(x_k)=Q_c(n,k)2^kP$. hNk' gives $N(x_k)=\prod_{K\in T}(x_k-2^K)$.

      The partial-fraction identity: dividing out $P$ (formula3.ha formula3.ha.hne formula3.hb formula3.hb.hne formula3.hc formula3.hc.hKn formula3.hc.hne formula3.hD3 formula3.hD4 formula3.key formula3.key.e1 formula3.key.e2 formula3.key.e3)

      Each product in the two evaluations of $N'(x_k)$ is rewritten as a quotient. This is done by multiplying back the missing factor, which is nonzero in each case.

      | Step | Statement | Nonvanishing used | |---|---|---| | ha | for $j\in S$: $\prod_{i\ne j,k}(x_k-x_i)=P/(x_k-x_j)$ | hne: $x_k-x_j\ne0$ | | hb | for $l\in S$: $\prod_{i\in S\setminus\{l\}}(x_k-x_i)=P/(x_k-x_l)$ | hne | | hc | for $K\in T$: $\prod_{a\in T\setminus\{K\}}(x_k-2^a)=N(x_k)/(x_k-2^K)$ | hKn ($n<K$) and hne |

      hD3 and hD4 substitute these quotients into the two sums.

      key then states $$\sum_{j\in S}\frac{Q_c(n,j)2^j}{x_k-x_j}=Q_c(n,k)2^k\Big(\sum_{K\in T}\frac{1}{x_k-2^K}-\sum_{i\in S}\frac{1}{x_k-x_i}\Big).$$ It is proved by cancelling the nonzero factor $P$ on the left. The steps e1, e2 and e3 pull $P$ out of the three sums involved by distributing it across them.

      The partial-fraction identity: splitting at $k$ (formula3.hsplit formula3.hdisj formula3.hlow formula3.hlow.hjk formula3.hlow.hne formula3.hlow.hne.this formula3.hlow.hne2 formula3.hhigh formula3.hhigh.hkj formula3.hhigh.hne formula3.hhigh.hne.this formula3.hhigh.hne2 hform)

      hsplit writes $S=\{0,\dots,k-1\}\cup(k,n]$, and hdisj records that the union is disjoint.

      • Indices below $k$. For $j<k$ (the fact hjk), hlow gives

      $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)}{2^{k-j}-1}.$$ It uses $2^{k-j}-1\ne0$, from $1<2^{k-j}$ (the steps hne and this), and $2^k-2^j\ne0$ (the step hne2).

      • Indices above $k$. For $k<j$ (the fact hkj), hhigh gives

      $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}},$$ with the analogous nonvanishing facts.

      The recorded uses of formula3 also include splitting a sum over a disjoint union and peeling the top term off a range sum. The latter turns $\sum_{j<k}$ into $\sum_{j\le k}$, since the added term $Q_c(n,k)/(2^0-1)=Q_c(n,k)/0$ is $0$.

      hform is the same identity stated for the concrete $Q_c$ of the target. The outline records no sub-steps for it.

      Gaussian binomials at $q=2$ are integers (gauss gauss.hD gauss.hD.h1 gauss.hDk gauss.key gauss.key.hshift gauss.key.hDj gauss.key.hj gauss.key.s4 gauss.key.s4.e gauss.key.s5 gauss.key.s5.hz gauss.main gauss.main.s1 gauss.main.s1.s1 gauss.main.s1.s2 gauss.main.s2 gauss.main.s2.s1 gauss.main.s2.s2 gauss.main.s2.s2.s1 gauss.main.s2.s2.s2)

      gauss states that for all $n,k$ there is an integer equal to $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

      Nonvanishing denominators. hD gives $2^{j+1}-1\ne0$, since $1<2^{j+1}$ (the step h1). hDk gives $P_k\ne0$.

      The $q$-Pascal recursion (key). $$\binom{m+1}{j+1}_2=\binom{m}{j}_2+2^{j+1}\binom{m}{j+1}_2 .$$ Both sides are written as a single product quotient.

      • hshift gives $m+1-(i+1)=m-i$.
      • hDj and hj give $P_j\ne0$ and $2^{j+1}-1\ne0$.
      • The resulting rational identity is settled in two cases:
        • in s4, with $2^{m+1}=2^{m-j}2^{j+1}$ (the step e);
        • in s5, where the numerator product $\prod_{i<j}(2^{m-i}-1)$ is $0$ (the step hz).

      Integrality (main). This is the statement for all $m,j$, by induction on $m$ and then on $j$.

      • $m=0$ (s1).
        • For $j=0$ the product is empty, and an integer witness is given (s1.s1).
        • For $j+1$ the product is $0$, since it contains the factor $2^0-1$ (s1.s2).
      • $m+1$ (s2), with the induction hypothesis for all $j$.
        • For $j=0$ the product is empty (s2.s1).
        • For $j+1$, let $a$ and $b$ be the integers given by the hypothesis for $\binom{m}{j}_2$ and $\binom{m}{j+1}_2$. The recursion then shows that $a+2^{j+1}b$ works.

      Clearing the denominators $2^{k-j}-1$ (hodd hodd.hint hodd.hint.hjk hodd.hint.s2 hodd.hint.s3 hodd.hint.s3.s1 hodd.hint.s3.hdn hodd.hint.s3.ht hodd.hint.s3.hP1 hodd.hint.s3.hP2 hodd.hint.s3.hP2.this hodd.hint.s3.hP3 hodd.hint.s3.hmem hodd.hint.s3.hdvd hodd.hint.s3.hdvd.this hodd.hint.s3.s9 hodd.hint.s3.hne hodd.hint.s3.hne.this hodd.hint.s3.hcast)

      hodd states that for $k\le n$ and any integers $c_j$, $$\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{c_j}{2^{k-j}-1}$$ is an integer. Distributing the product over the sum reduces this to the termwise claim hint: each term, multiplied by the product, is an integer.

      Fix $j$ in the sum, so $j\le k$ (the fact hjk). There are two cases.

      • Case s2. An integer witness is supplied directly.
      • Case s3. Write $k-j=d+1$ (step s1).
        1. hdn is routine (omega): it gives $d+1\le n$.
        2. Let $t=(d+1)\lfloor n/(d+1)\rfloor$. Then $\lfloor n/(d+1)\rfloor\ge1$ (ht), $t\le n$ (hP1), $n<t+(d+1)$ (hP2 with its child) and $d+1\le t$ (hP3).
        3. Together these give $t\in(\lfloor n/2\rfloor,n]$ (hmem).
        4. hdvd gives that $2^{d+1}-1$ divides the product. It divides $(2^{d+1})^{t/(d+1)}-1^{t/(d+1)}=2^t-1$ (this), and $2^t-1$ is one of the factors.
        5. s9 writes the product as $(2^{d+1}-1)q$ with $q$ an integer.
        6. With $2^{d+1}-1\ne0$ (hne and its child) and the cast identity hcast, the term equals $c_jq$, which is the integer witness.

      Merging odd and $2$-adic information (combine combine.hint combine.hint.this combine.s2 combine.hcop combine.hdvd combine.s5)

      combine states: let $\Omega$ be odd with $\Omega p=2^aA$, and suppose $B=Mp$ and $m=M$ for integers $A,B,m$. Then there is an integer $z$ with $z\,2^a=Mp$.

      1. hint gives $\Omega B=2^a(mA)$ in $\mathbb{Z}$. It is proved by checking the identity after casting to $\mathbb{Q}$ (the step this).
      2. s2 writes $\Omega=2t+1$.
      3. hcop gives that $2^a$ and $\Omega$ are coprime.
      4. hdvd gives $2^a\mid B\Omega$.
      5. By coprimality, $2^a\mid B$. Step s5 obtains $c$ with $B=2^ac$.

      The core estimate: the odd number $\Omega$ (hcore hcore.hQcint hcore.hQcint.s1 hcore.hQcint.s2 hcore.h_x3a9div hcore.h_x3a9odd hcore.h_x3a9odd.s1 hcore.h_x3a9odd.s2 hcore.h_x3a9odd.s3 hcore.h_x3a9odd.s3.ht1 hcore.h_x3a9odd.s3.ht1.this)

      hcore states that for $k\le n$ there is an integer $z$ with $$z\,2^{k(k-1)/2}=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}.$$

      The first ingredients are these.

      • Coefficients (hQcint). For every $j$ there is an integer $g_j$ with $Q_c(n,j)=2^{j(j-1)/2}g_j$. It is obtained from integer witnesses for the two Gaussian-binomial products (s1 and s2).
      • Divisibility (hΩdiv). With $\Omega=\prod_{t=1}^{2n}(2^t-1)$: for $1\le s\le 2n$ there is an integer $w$ with $w(2^s-1)=\Omega$. It is obtained by taking the factor $t=s$ out of the product.
      • Oddness (hΩodd). $\Omega$ is odd. The proof establishes a property of the product by showing that it is multiplicative and holds on factors:
        • products of odd integers are odd (s1);
        • $1$ is odd (s2);
        • each $2^t-1$ with $t\ge1$ is odd, as an even number minus an odd one (s3, with $t\ne0$ from $1\le t$).

      The core estimate: integral reciprocal terms (hcore.key1 hcore.key1.s1 hcore.key1.s1.s1 hcore.key1.s1.s2 hcore.key1.s1.hne hcore.key1.s1.hne.this hcore.key1.s1.h2a hcore.key1.s1.this hcore.key1.s2 hcore.key1.s2.s1 hcore.key1.s2.s2 hcore.key1.s2.hne hcore.key1.s2.hne.this hcore.key1.s2.h2b hcore.key1.s2.this hcore.hK hcore.hK.this hcore.hI hcore.hI.h1 hcore.hI.h2)

      key1 states that for $a\ne b$, both $\le 2n$, the number $\Omega\,2^a\cdot\frac{1}{2^a-2^b}$ is an integer. The proof splits according to the order of $a$ and $b$.

      • Case $a<b$ (s1).
        • Write $b=a+d+1$ (s1.s1).
        • Obtain an integer $w$ with $w(2^{d+1}-1)=\Omega$ (s1.s2).
        • Record $2^{d+1}-1\ne0$ (hne, with this).
        • h2a is routine (positivity): $2^a\ne0$.
        • The second this is routine (ring): $2^a-2^a2^{d+1}=-(2^a(2^{d+1}-1))$.
        • The witness is $-w$.
      • Case $a>b$ (s2).
        • Write $a=b+d+1$ and obtain $w$ in the same way.
        • h2b is routine (positivity), and the factorisation this is routine (ring).
        • The witness is $w\,2^{d+1}$.

      Two instances follow.

      • hK: for $K\in(n,2n]$ (so $n<K\le 2n$, by this), $\Omega 2^k/(2^k-2^K)$ is an integer.
      • hI: for $i\le n$ with $i\ne k$ (the facts h1 and h2), $\Omega 2^k/(2^k-2^i)$ is an integer.

      The core estimate: the tail and the assembly (hcore.hT hcore.hT.hj' hcore.hT.s2 hcore.hT.s3 hcore.hT.hmono hcore.hT.s5 hcore.hT.hne hcore.hT.hne.this hcore.hT.hne' hcore.h2adic hcore.h2adic.htail hcore.s9 hcore.hB')

      Tail terms (hT). For $j\in(k,n]$ there is an integer $w$ with $$w\,2^{k(k-1)/2}=\Omega\cdot\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

      1. hj' gives $k<j\le n$.
      2. s2 writes $j-k=d+1$.
      3. s3 obtains an integer $w$ with $w(2^{d+1}-1)=\Omega$.
      4. hmono gives $k(k-1)/2\le j(j-1)/2$, and s5 writes $j(j-1)/2=k(k-1)/2+e$.
      5. With $2^{d+1}-1\ne0$ and $1-2^{d+1}\ne0$ (the steps hne, its child, and hne'), the witness is $-(w\,g_j\,2^e\,2^{d+1})$.

      The $2$-adic form (h2adic). Let $f_K$, $f_I$ and $f_T$ be the integers supplied by hK, hI and hT. Then $$\Omega\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=2^{k(k-1)/2}\Big(g_k\big(\textstyle\sum_K f_K-\sum_i f_I\big)-\sum_j f_T\Big).$$ Its child htail gives $2^{k(k-1)/2}\sum_{j\in(k,n]}f_T=\Omega\sum_{j\in(k,n]}\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}}$. The goal left after htail is the partial-fraction formula multiplied through by $\Omega$, with the reciprocal sums written through the integers $f_K$ and $f_I$.

      The odd form.

      • s9 uses the odd-denominator statement with $c_j=2^{j(j-1)/2}g_j$ to obtain an integer $B$. It equals the product $\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)$ times $\sum_{j\le k} c_j/(2^{k-j}-1)$.
      • hB' rewrites $c_j$ back as $Q_c(n,j)$, so that $B$ equals the right-hand side of hcore.

      These facts have the shape of the hypotheses of the merging lemma:

      • the odd number $\Omega$;
      • the exponent $k(k-1)/2$;
      • the relation from h2adic;
      • the integer $B$;
      • the integral product.

      Clearing the extra sum (hcnall hcnall.hint hcnall.hint.s1 hcnall.hint.s1.hj' hcnall.hint.s1.s2 hcnall.hint.s1.s2.e hcnall.hint.s1.s3 hcnall.hint.s1.s3.e hcnall.hint.s2 hcnall.hint.s2.hmem hcnall.hint.s2.hne hcnall.hint.s2.hne.h8 hcnall.hint.s2.hne.h8.s1 hcnall.hint.s2.hne.h8.s2)

      hcnall states that $$\prod_{2\le j<n}(2^{j+1}-3)\cdot\sum_{j<n}\frac{3}{2^{j+1}-3}$$ is an integer. Distributing the product reduces this to the termwise claim hint. There are two cases on $j$.

      • Case s1: $j<2$. hj' is routine (omega): it gives $j=0$ or $j=1$.
        • In s2, the routine step e (norm_num) gives $3/(2-3)=-3$, and the witness is $-3\prod(2^{i+1}-3)$.
        • In s3, the routine step e (norm_num) gives $3/(4-3)=3$, and the witness is $3\prod(2^{i+1}-3)$.
      • Case s2: $j\ge2$.
        • hmem gives $j\in[2,n)$.
        • hne gives $2^{j+1}-3\ne0$, from $8\le 2^{j+1}$. That bound is proved by the calculation in h8: $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity of powers.
        • The factor for $j$ is pulled out of the product, which cancels the denominator.

      The size bound: setting up the exponents (hb hb.key hb.key.s1 hb.key.s2 hb.key.s2.hP1 hb.key.s2.hP2 hb.key.s2.s3 hb.key.s2.s4 hb.key.s2.hS1 hb.key.s2.hS1.e hb.key.s2.hS2 hb.key.s2.hS2.this hb.key.s2.hT)

      The remaining steps concern the natural number $$d=2^{n(n+1)/2}\cdot E(n).$$ Here $E(5)=409045$ and $E(7)=1298717875$. Otherwise $$E(n)=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\prod_{2\le j<n}(2^{j+1}-3).$$

      hb states that $d^2\le 2^{3n^2}$ in $\mathbb{R}$. It follows from the same inequality in $\mathbb{N}$, which is key. That inequality is split into two cases.

      • Case s1. The goal is closed by kernel evaluation of the decidable statement (the recorded use is the kernel-reduction option). The outline does not print which values of $n$ this case covers.
      • Case s2. The conditional is resolved to the product branch, so the goal is the inequality for $2^{n(n+1)/2}\prod(2^m-1)\prod(2^{j+1}-3)$. The ingredients are:
        • hP1: $\prod_{(n/2,n]}(2^m-1)\le 2^{\sum m}$, comparing factor by factor;
        • hP2: $\prod_{[2,n)}(2^{j+1}-3)\le 2^{\sum(j+1)}$;
        • s3: $n=\lfloor n/2\rfloor+c+1$;
        • s4: $n=d'+3$, where $d'$ is the name the outline gives (it is distinct from the witness $d$);
        • hS1: $2\sum_{(n/2,n]}m=2(c+1)(\lfloor n/2\rfloor+1)+(c+1)c$, by Gauss' summation formula after rewriting the interval as $[\lfloor n/2\rfloor+1,n+1)$ (e);
        • hS2: $2\sum_{[2,n)}(j+1)=6(d'+1)+(d'+1)d'$, after re-indexing (this) and again Gauss' summation formula;
        • hT: $\big(n(n+1)/2\big)\cdot2=n(n+1)$, since $n(n+1)$ is even.

      The size bound: exponent arithmetic (hb.key.s2.hexp hb.key.s2.hexp.arith hb.key.s2.hexp.arith.hsq hb.key.s2.hexp.arith.s2 hb.key.s2.hexp.arith.s3 hb.key.s2.hexp.s2 hb.key.s2.hexp.s3 hb.key.s2.hexp.hc' hb.key.s2.hexp.hd' hb.key.s2.hexp.hT' hb.key.s2.hexp.this hb.key.s2.s9 hb.key.s2.s10 hb.key.s2.s11)

      hexp states that $$2\cdot\tfrac{n(n+1)}{2}+2\sum_{(n/2,n]}m+2\sum_{[2,n)}(j+1)\le 3n\cdot n .$$

      The polynomial inequality (arith). Assume $r\le1$, $3\le e$, and that $A,B,T$ satisfy $$2A=2(e+r+2)(e+3)+(e+r+2)(e+r+1),$$ $$2B=6(2e+r+2)+(2e+r+2)(2e+r+1),$$ $$2T=(2e+4+r)(2e+5+r).$$ Then $2T+2A+2B\le 3(2e+4+r)^2$. It uses $3e\le e^2$ (hsq) and is checked separately for $r=0$ (s2) and $r=1$ (s3).

      Applying it.

      1. s2 writes $\lfloor n/2\rfloor=e+2$.
      2. s3 writes $n=2e+4+r$ with $r\le1$.
      3. hc' and hd' are routine (omega): they give $c=e+1+r$ and $d'=2e+1+r$.
      4. hT' restates $2\cdot\frac{n(n+1)}2$ in these variables.
      5. this is the resulting instance, which gives hexp.

      The chain of inequalities.

      • s9 bounds the squared product by the squared power-of-$2$ bounds from hP1 and hP2.
      • s10 rewrites this by the laws of exponents; its claim is not printed in the outline.
      • s11 concludes $2^{(\cdots)}\le 2^{3n^2}$ by monotonicity of powers of $2$, using hexp.

      Integrality of $2^{n(n+1)/2}Q_x(n)$ (hqx hqx.hterm hqx.hterm.hkn hqx.hterm.s2 hqx.hterm.s3 hqx.hterm.s4 hqx.hterm.hexp hqx.hterm.hexp.e1 hqx.hterm.hexp.e2 hqx.hterm.hexp.e3 hqx.hterm.hexp.s4 hqx.hterm.hexp.s5 hqx.hterm.hpow hqx.hterm.h2)

      hqx states that $2^{n(n+1)/2}\sum_{k\le n}Q_c(n,k)(3/2^n)^k$ is an integer. Distributing the power over the sum reduces this to the termwise claim hterm.

      Fix $k\le n$ (the fact hkn).

      1. Witnesses. Let $a$ and $b$ be integers equal to $\binom{n}{k}_2$ and to $\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (steps s2 and s3).
      2. Substitution. s4 writes $n=k+m$.
      3. Exponent identity (hexp).

      $$\tfrac{(k+m)(k+m+1)}2+\tfrac{k(k-1)}2=\tfrac{m(m+1)}2+(k+m)k .$$

      • e1, e2 and e3 remove the three halvings, using that consecutive products are even.
      • The identity is then proved by induction on $k$: the case $k=0$ (s4) is routine (simp), and s5 is the successor case.
      1. Powers. hpow gives $2^{(k+m)(k+m+1)/2}\,2^{k(k-1)/2}=2^{m(m+1)/2}(2^{k+m})^k$.
      2. Nonvanishing. h2 is routine (positivity): $2^{k+m}\ne0$.
      3. Conclusion. The term equals $(-1)^k3^k2^{m(m+1)/2}ab$.

      Positivity of the odd part (hE hE.s1 hE.s2 hE.s3 hE.s3.s1 hE.s3.s1.hm1 hE.s3.s1.hm1.this hE.s3.s1.this hE.s3.s1.this.s1 hE.s3.s1.this.s2 hE.s3.s2 hE.s3.s2.hj2 hE.s3.s2.this hE.s3.s2.this.s1 hE.s3.s2.this.s2)

      hE states $0<E(n)$, splitting into the three branches of the conditional.

      • The two numeral branches are routine (norm_num): $0<409045$ and $0<1298717875$ (s1 and s2).
      • In the product branch (s3), each factor is positive.
        • Factors $2^m-1$ (s3.s1). Here $m\in(\lfloor n/2\rfloor,n]$ gives $1\le m$ (hm1, via $\lfloor n/2\rfloor<m$). Then $2\le 2^m$ (this): the equation $2=2^1$ is routine (norm_num), and $2^1\le 2^m$ follows by monotonicity.
        • Factors $2^{j+1}-3$ (s3.s2). Here $j\in[2,n)$ gives $2\le j$ (hj2). Then $8\le 2^{j+1}$: the equation $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity.

      Integrality of $d\,A_q(n)$: the cases and the casts (hAqint hAqint.s1 hAqint.s2 hAqint.s2.s1 hAqint.s2.s2 hAqint.s2.s2.hM hAqint.s2.s2.hC hAqint.s2.s2.hC.hj2 hAqint.s2.s2.hC.h3 hAqint.s2.s2.hC.h3.s1 hAqint.s2.s2.hC.h3.s2 hAqint.s2.s2.hd hAqint.s2.s2.s4 hAqint.s2.s2.s5 hAqint.s2.s2.hQxn)

      hAqint states that $d\cdot A_q(n)$ is an integer, for the $d$ above. The cases follow the branches of the conditional.

      • Numeral branches (s1 and s2.s1). The recorded uses select the branch, give a witness, and evaluate by kernel reduction.
      • Product branch (s2.s2). The setup is as follows.
        • hM casts $\prod(2^m-1)$ from $\mathbb{N}$ to $\mathbb{Q}$, valid since $1\le 2^m$.
        • hC casts $\prod(2^{j+1}-3)$, valid since $3\le 2^{j+1}$ for $j\ge2$. This uses hj2; the bound h3 is the calculation in which $3\le 2^2$ is routine (norm_num) and $2^2\le 2^{j+1}$ follows by monotonicity.
        • hd casts $d$ itself as $2^{n(n+1)/2}\cdot\big(\prod(2^m-1)\prod(2^{j+1}-3)\big)$.
        • s4 obtains an integer $z_{cn}$ equal to $\prod(2^{j+1}-3)\sum_{j<n}3/(2^{j+1}-3)$.
        • s5 obtains an integer $z_q'$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$.
        • hQxn unfolds $Q_x(n)$ as that sum.
        • The recorded closing uses distribute $d$ over the two parts of $A_q(n)$ and over the outer sum.

      Integrality of $d\,A_q(n)$: the main terms (hAqint.s2.s2.hterm hAqint.s2.s2.hterm.hkn hAqint.s2.s2.hterm.s2 hAqint.s2.s2.hterm.s3 hAqint.s2.s2.hterm.hexp hAqint.s2.s2.hterm.hexp.e1 hAqint.s2.s2.hterm.hexp.e2 hAqint.s2.s2.hterm.hexp.e3 hAqint.s2.s2.hterm.hexp.s4 hAqint.s2.s2.hterm.hexp.s5 hAqint.s2.s2.hterm.hpow hAqint.s2.s2.hterm.h2n hAqint.s2.s2.hterm.e1 s21)

      hterm states that for each $k\le n$, $$2^{n(n+1)/2}\Big(\prod(2^m-1)\prod(2^{j+1}-3)\Big)\cdot\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k$$ is an integer.

      1. hkn gives $k\le n$.
      2. s2 obtains $w$ with $w\,2^{k(k-1)/2}=\prod(2^m-1)\cdot\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$. This is an instance of the core statement.
      3. s3 writes $n=k+m$.
      4. hexp is the exponent identity $\frac{n(n+1)}2+\frac{k(k-1)}2=\frac{m(m+1)}2+nk$. As before, it removes the halvings (e1, e2, e3) and proceeds by induction on $k$; the base case s4 is routine (simp), and s5 is the successor case.
      5. hpow gives $2^{n(n+1)/2}2^{k(k-1)/2}=2^{m(m+1)/2}(2^n)^k$.
      6. h2n is routine (positivity): $(2^n)^k\ne0$.
      7. e1 regroups the term as $\prod(2^{j+1}-3)\cdot3^k\cdot\big(\prod(2^m-1)\sum_{j\le k}\tfrac{Q_c(n,j)}{2^{k-j}-1}\big)\,2^{n(n+1)/2}/(2^n)^k$.
      8. Combining these, the term equals $\prod(2^{j+1}-3)\cdot w\cdot3^k\cdot2^{m(m+1)/2}$, which is the integer witness.

      Finally, s21 obtains an integer $z_q$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$, which is the content of the integrality of $2^{n(n+1)/2}Q_x(n)$. The steps recorded at the top level have therefore established three things:

      • for the number $d=2^{n(n+1)/2}E(n)$: positivity of $E(n)$, the bound $d^2\le 2^{3n^2}$, and integrality of $d\,A_q(n)$;
      • integrality of $2^{n(n+1)/2}Q_x(n)$.

      These are the ingredients of the existential goal. No step in the outline is open.

    2. 2026-10-06 · written by t1006-w3, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · current · explainer/d39a90505cc9….md · diff to its predecessor

      Read this version

      Idea and method

      The target statement fixes three explicit rational families. The first is $$Q_c(n,k)=(-1)^k\,2^{k(k-1)/2}\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}\;\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}.$$ The second is $Q_x(n)=\sum_{k\le n}Q_c(n,k)\,(3/2^n)^k$. The third is $$A_q(n)=\sum_{k\le n}\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k+Q_x(n)\sum_{j<n}\frac{3}{2^{j+1}-3}.$$ The claim is that for every $n$ there is a positive integer $d$ with $d^2\le 2^{3n^2}$ such that both $d\,Q_x(n)$ and $d\,A_q(n)$ are integers. Exponents are natural numbers, so subtraction in them is truncated. Division by $0$ is $0$, as in Lean; in particular the $j=k$ term of the inner sum is $Q_c(n,k)/0=0$.

      The proof has four parts.

      1. Integrality of the coefficients. Each $Q_c(n,j)$ is a power of $2$ times a product of two Gaussian binomials at $q=2$, and these products are integers.
      2. Rewriting the inner sums. This uses polynomial interpolation. The polynomial $N=\prod_{n<K\le 2n}(X-2^K)$ is written in Lagrange form at the nodes $2^0,\dots,2^n$, and its derivative is evaluated at a node in two ways. This rewrites $\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$ through sums of $1/(2^k-2^K)$ and a tail over $j>k$.
      3. Clearing denominators. The odd denominators are cleared by the odd number $\Omega=\prod_{t=1}^{2n}(2^t-1)$. Separately, $\prod_{n/2<m\le n}(2^m-1)$ clears every $2^{k-j}-1$, because each $s\le n$ divides some $m\in(\lfloor n/2\rfloor,n]$. A coprimality argument then merges the two pieces of information. The extra sum $\sum_j 3/(2^{j+1}-3)$ is cleared by $\prod_{2\le j<n}(2^{j+1}-3)$.
      4. The witness and its size. The witness $d$ is a power of $2$ times these products. Two exceptional values replace the products by explicit numerals. Its size is controlled by bounding each factor by a power of $2$ and doing exponent arithmetic.

      Throughout, write $P_m=\prod_{s<m}(2^{s+1}-1)$ and $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

      Telescoping products of $2^a-1$ (id1_test id1_test.s1 id1_test.s2 id1_test.s2.ih' id1_test.s2.s2 lower_test lower_test.h1 lower_test.h1.hi' lower_test.this)

      id1_test states that for $j\le n$ $$\prod_{i<j}(2^{n-i}-1)\cdot P_{n-j}=P_n .$$ It is proved by induction on $j$.

      • Base case $j=0$. The goal is the statement with the empty first product. This is routine (closed by simp).
      • Successor case. The goal is the identity for $j+1$, given the induction hypothesis under $j\le n$ and the assumption $j+1\le n$.
        • ih' discharges the hypothesis $j\le n$, giving the identity at $j$.
        • Then $n-j=m+1$ is obtained.
        • The goal becomes the identity with the last factor $2^{n-j}-1$ split off the first product (peeling off the top index of a range product). Comparing with ih' closes it.

      lower_test states that $$\prod_{i<j}(2^j-2^i)=2^{j(j-1)/2}P_j .$$ Its children establish two facts:

      • h1: for $i<j$ (the fact hi'), $2^j-2^i=2^i\,(2^{\,j-1-i+1}-1)$.
      • this: $2\sum_{i<j}i=j(j-1)$, by Gauss' summation formula. Hence $\sum_{i<j}i=j(j-1)/2$.

      The step then splits the product into $\prod 2^i=2^{\sum i}$ and $\prod_{i<j}(2^{j-i}-1)$. It reflects the index of the latter to obtain $P_j$.

      Products over the upper intervals (upper_test upper_test.e upper_test.h1 rhs_test rhs_test.e rhs_test.h1)

      upper_test states that for $j\le n$ $$\prod_{j<i\le n}(2^j-2^i)=(-1)^{n-j}\,2^{j(n-j)}\,P_{n-j}.$$ The proof has three moves:

      • e rewrites $(j,n]$ as $[j+1,n+1)$.
      • After re-indexing to $i=j+1+t$ with $t<n-j$, h1 gives $2^j-2^{j+1+t}=-2^j(2^{t+1}-1)$ for each factor.
      • The constant factors are collected as powers, using the cardinality $n-j$.

      rhs_test states that for $j\le n$ $$\prod_{n<K\le 2n}(2^j-2^K)\cdot P_{n-j}=(-1)^n\,2^{jn}\,P_{2n-j}.$$ It follows the same pattern:

      • e converts the interval.
      • h1 gives $2^j-2^{n+1+t}=-2^j(2^{n-j+t+1}-1)$ for $t<n$.
      • The resulting product $\prod_{t<n}(2^{n-j+t+1}-1)$ is concatenated with $P_{n-j}$ to give $P_{2n-j}$.

      The interpolation weights of $Q_c$ (id1_full id1_full.hPne id1_full.hPne.this id1_full.hG1 id1_full.hG2 id1_full.hsplit id1_full.hdisj id1_full.hR id1_full.s7 id1_full.hsign id1_full.ha id1_full.hexp id1_full.hexp.s1 id1_full.hexp.s2)

      id1_full states that for $j\le n$, with $Q_c(n,j)$ written out, $$Q_c(n,j)\,2^j\prod_{i\le n,\ i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K).$$

      The ingredients are as follows.

      • Nonvanishing. hPne shows $P_m\ne0$ for all $m$, since every factor satisfies $1<2^{s+1}$ (the fact this).
      • Quotient forms. hG1 writes $\binom{n}{j}_2=P_n/(P_{n-j}P_j)$. hG2 writes $\prod_{i<n}\frac{2^{2n-j-i}-1}{2^{i+1}-1}=P_{2n-j}/(P_{n-j}P_n)$.
      • Splitting the index set. hsplit writes $\{0,\dots,n\}\setminus\{j\}=\{0,\dots,j-1\}\cup(j,n]$. hdisj records that this union is disjoint.
      • The right-hand side. hR is the instance of the upper-interval identity for $\prod_{n<K\le 2n}$.
      • Substitution. s7 writes $n=j+m$, and every hypothesis is restated with $j+m$ in place of $n$.
      • Signs. hsign gives $(-1)^{j+m}=(-1)^j(-1)^{j+m-j}$.
      • Halving. ha gives $2\cdot\big(j(j-1)/2\big)=j(j-1)$, using that $j(j-1)$ is even.
      • Exponent bookkeeping. hexp gives $j(j+m)=j(j-1)/2+j+j(j-1)/2+j\,m$ by induction on $j$. Both of its cases are routine: the zero case by simp, and the successor case by simp and nlinarith.

      The recorded closing tools are three: splitting a product over a disjoint union, cancelling a nonzero right factor, and the law of exponents. With them, the left side becomes $P_n/(P_{n-j}P_j)\cdot P_{2n-j}/(P_{n-j}P_n)$ times the two lower and upper products. These were evaluated in the preceding sections, and the result is matched against hR.

      Lagrange interpolation by values at the nodes (lagr_eval lagr_eval.hinj lagr_eval.s2 lagr_eval.s2.s1 lagr_eval.s2.s2 lagr_eval.s2.s2.this lagr_eval.s3 lagr_eval.s3.s1 lagr_eval.s3.hk' lagr_eval.s3.hk'.this lagr_eval.s3.s3 lagr_eval.s3.s4 lagr_eval.s3.s5)

      lagr_eval has three hypotheses:

      • $x_0,\dots,x_n$ are pairwise distinct;
      • $N\in\mathbb{Q}[X]$ has $\deg N\le n$;
      • the weights satisfy $r_j\prod_{i\ne j}(x_j-x_i)=N(x_j)$ for all $j\le n$.

      Its conclusion is $$N=\sum_{j\le n} r_j\prod_{i\le n,\ i\ne j}(X-x_i).$$

      The method is that two polynomials which agree on a finite set of points, and whose difference has degree below the number of points, are equal.

      Distinct points. hinj turns distinctness into injectivity of $x$ on $\{0,\dots,n\}$. Hence the image has $n+1$ points.

      Degree bound (s2). The goal is that the difference has degree $<n+1$. It is bounded by the larger of the two degrees.

      • s2.s1 gives $\deg N<n+1$.
      • s2.s2 gives that the Lagrange sum has degree $<n+1$. It bounds the degree of each summand by $0$ plus the sum of the degrees of the linear factors. That sum equals $n$ by the fact this.

      Agreement at the nodes (s3). The goal is that $N$ and the sum agree at every point of the image.

      • s3.s1 writes the point as $x_k$ with $k\le n$; this bound is the content of hk' and its child.
      • The sum is evaluated term by term and reduced to the single term $j=k$.
      • s3.s3 is routine (simp): it evaluates the $k$-th term to $r_k\prod_{i\ne k}(x_k-x_i)$.
      • s3.s4 shows that every other term vanishes, because its product contains the factor $x_k-x_k$.
      • s3.s5 dismisses the case $k\notin\{0,\dots,n\}$ by contradiction.

      Derivative of the interpolant at a node (deriv_prod_eval deriv_prod_eval_node deriv_prod_eval_node.s1 deriv_prod_eval_node.s2 lagr_deriv lagr_deriv.hkmem lagr_deriv.s2 lagr_deriv.s2.hjk lagr_deriv.s3)

      deriv_prod_eval states that for a finite set $S$ and any $z$, $$\Big(\prod_{i\in S}(X-x_i)\Big)'(z)=\sum_{l\in S}\prod_{i\in S\setminus\{l\}}(z-x_i).$$ It uses the product rule for finite products and the fact that polynomial evaluation commutes with Finset.prod and with finite sums.

      deriv_prod_eval_node specialises this to $z=x_k$ with $k\in S$. The value is $\prod_{i\in S\setminus\{k\}}(x_k-x_i)$.

      • By s1, every summand with $l\ne k$ contains the factor $x_k-x_k$, so it vanishes.
      • By s2, the case $k\notin S$ is contradictory.

      lagr_deriv assumes the hypotheses of the interpolation step and fixes $k\le n$. It concludes $$N'(x_k)=\sum_{j\ne k} r_j\prod_{i\ne j,k}(x_k-x_i)\;+\;r_k\sum_{l\ne k}\ \prod_{i\ne k,l}(x_k-x_i).$$ The proof differentiates the Lagrange form term by term and separates the term $j=k$ from the sum over the others (the Finset.add_sum_erase lemma).

      • hkmem records that $k$ lies in the index set.
      • By s2, for $j\ne k$ (the fact hjk), the derivative of $r_j\prod_{i\ne j}(X-x_i)$ evaluated at $x_k$ is $r_j\prod_{i\ne j,k}(x_k-x_i)$.
      • By s3, the term $j=k$ gives $r_k$ times the derivative formula above.

      The partial-fraction identity: setting up (formula3 formula3.hxinj formula3.hxinj.h' formula3.hxne formula3.hNdeg formula3.hkmem formula3.hr formula3.hD formula3.hD2 formula3.hPne formula3.hNk formula3.hNk')

      formula3 fixes $k\le n$ and any $Q_c$ satisfying, for all $j\le n$, the weight identity $Q_c(n,j)2^j\prod_{i\ne j}(2^j-2^i)=\prod_{n<K\le 2n}(2^j-2^K)$. It concludes $$\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=Q_c(n,k)\,2^k\Big(\sum_{n<K\le 2n}\frac{1}{2^k-2^K}-\sum_{i\le n,\,i\ne k}\frac{1}{2^k-2^i}\Big)-\sum_{k<j\le n}\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

      The steps work with the following abbreviations:

      • nodes $x_j$, behaving as $2^j$;
      • $T=(n,2n]$ and $S=\{0,\dots,n\}\setminus\{k\}$;
      • a polynomial $N$, whose value at $x_k$ is $\prod_{K\in T}(x_k-2^K)$;
      • a number $P$, which by hr and hNk plays the role of $\prod_{i\in S}(x_k-x_i)$.

      The setup steps are these.

      • Distinct nodes. hxinj reduces $x_i=x_j$ to $2^i=2^j$ (the fact h'), and then to $i=j$ by injectivity of powers of $2$. hxne gives $2^a-2^b\ne0$ for $a\ne b$.
      • Degree and weights. hNdeg gives $\deg N\le n$: the degree of a product is the sum of the degrees, each factor $X-C$ has degree $1$, and $T$ has $n$ elements. hr turns the hypothesis into the weight condition $r_j=Q_c(n,j)2^j$ for $N$. hkmem records $k\in\{0,\dots,n\}$.
      • First evaluation of $N'(x_k)$. hD is the derivative formula of the previous section with these weights.
      • Second evaluation of $N'(x_k)$. hD2 gives $N'(x_k)=\sum_{K\in T}\prod_{a\in T\setminus\{K\}}(x_k-2^a)$, from the product form of $N$.
      • Values of $N$ and $P$. hPne gives $P\ne0$. hNk gives $N(x_k)=Q_c(n,k)2^kP$. hNk' gives $N(x_k)=\prod_{K\in T}(x_k-2^K)$.

      The partial-fraction identity: dividing out $P$ (formula3.ha formula3.ha.hne formula3.hb formula3.hb.hne formula3.hc formula3.hc.hKn formula3.hc.hne formula3.hD3 formula3.hD4 formula3.key formula3.key.e1 formula3.key.e2 formula3.key.e3)

      Each product in the two evaluations of $N'(x_k)$ is rewritten as a quotient. This is done by multiplying back the missing factor, which is nonzero in each case.

      | Step | Statement | Nonvanishing used | |---|---|---| | ha | for $j\in S$: $\prod_{i\ne j,k}(x_k-x_i)=P/(x_k-x_j)$ | hne: $x_k-x_j\ne0$ | | hb | for $l\in S$: $\prod_{i\in S\setminus\{l\}}(x_k-x_i)=P/(x_k-x_l)$ | hne | | hc | for $K\in T$: $\prod_{a\in T\setminus\{K\}}(x_k-2^a)=N(x_k)/(x_k-2^K)$ | hKn ($n<K$) and hne |

      hD3 and hD4 substitute these quotients into the two sums.

      key then states $$\sum_{j\in S}\frac{Q_c(n,j)2^j}{x_k-x_j}=Q_c(n,k)2^k\Big(\sum_{K\in T}\frac{1}{x_k-2^K}-\sum_{i\in S}\frac{1}{x_k-x_i}\Big).$$ It is proved by cancelling the nonzero factor $P$ on the left. The steps e1, e2 and e3 pull $P$ out of the three sums involved by distributing it across them.

      The partial-fraction identity: splitting at $k$ (formula3.hsplit formula3.hdisj formula3.hlow formula3.hlow.hjk formula3.hlow.hne formula3.hlow.hne.this formula3.hlow.hne2 formula3.hhigh formula3.hhigh.hkj formula3.hhigh.hne formula3.hhigh.hne.this formula3.hhigh.hne2 hform)

      hsplit writes $S=\{0,\dots,k-1\}\cup(k,n]$, and hdisj records that the union is disjoint.

      • Indices below $k$. For $j<k$ (the fact hjk), hlow gives

      $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)}{2^{k-j}-1}.$$ It uses $2^{k-j}-1\ne0$, from $1<2^{k-j}$ (the steps hne and this), and $2^k-2^j\ne0$ (the step hne2).

      • Indices above $k$. For $k<j$ (the fact hkj), hhigh gives

      $$\frac{Q_c(n,j)2^j}{2^k-2^j}=\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}},$$ with the analogous nonvanishing facts.

      The recorded uses of formula3 also include splitting a sum over a disjoint union and peeling the top term off a range sum. The latter turns $\sum_{j<k}$ into $\sum_{j\le k}$, since the added term $Q_c(n,k)/(2^0-1)=Q_c(n,k)/0$ is $0$.

      hform is the same identity stated for the concrete $Q_c$ of the target. The outline records no sub-steps for it.

      Gaussian binomials at $q=2$ are integers (gauss gauss.hD gauss.hD.h1 gauss.hDk gauss.key gauss.key.hshift gauss.key.hDj gauss.key.hj gauss.key.s4 gauss.key.s4.e gauss.key.s5 gauss.key.s5.hz gauss.main gauss.main.s1 gauss.main.s1.s1 gauss.main.s1.s2 gauss.main.s2 gauss.main.s2.s1 gauss.main.s2.s2 gauss.main.s2.s2.s1 gauss.main.s2.s2.s2)

      gauss states that for all $n,k$ there is an integer equal to $\binom{n}{k}_2=\prod_{i<k}\frac{2^{n-i}-1}{2^{i+1}-1}$.

      Nonvanishing denominators. hD gives $2^{j+1}-1\ne0$, since $1<2^{j+1}$ (the step h1). hDk gives $P_k\ne0$.

      The $q$-Pascal recursion (key). $$\binom{m+1}{j+1}_2=\binom{m}{j}_2+2^{j+1}\binom{m}{j+1}_2 .$$ Both sides are written as a single product quotient.

      • hshift gives $m+1-(i+1)=m-i$.
      • hDj and hj give $P_j\ne0$ and $2^{j+1}-1\ne0$.
      • The resulting rational identity is settled in two cases:
        • in s4, with $2^{m+1}=2^{m-j}2^{j+1}$ (the step e);
        • in s5, where the numerator product $\prod_{i<j}(2^{m-i}-1)$ is $0$ (the step hz).

      Integrality (main). This is the statement for all $m,j$, by induction on $m$ and then on $j$.

      • $m=0$ (s1).
        • For $j=0$ the product is empty, and an integer witness is given (s1.s1).
        • For $j+1$ the product is $0$, since it contains the factor $2^0-1$ (s1.s2).
      • $m+1$ (s2), with the induction hypothesis for all $j$.
        • For $j=0$ the product is empty (s2.s1).
        • For $j+1$, let $a$ and $b$ be the integers given by the hypothesis for $\binom{m}{j}_2$ and $\binom{m}{j+1}_2$. The recursion then shows that $a+2^{j+1}b$ works.

      Clearing the denominators $2^{k-j}-1$ (hodd hodd.hint hodd.hint.hjk hodd.hint.s2 hodd.hint.s3 hodd.hint.s3.s1 hodd.hint.s3.hdn hodd.hint.s3.ht hodd.hint.s3.hP1 hodd.hint.s3.hP2 hodd.hint.s3.hP2.this hodd.hint.s3.hP3 hodd.hint.s3.hmem hodd.hint.s3.hdvd hodd.hint.s3.hdvd.this hodd.hint.s3.s9 hodd.hint.s3.hne hodd.hint.s3.hne.this hodd.hint.s3.hcast)

      hodd states that for $k\le n$ and any integers $c_j$, $$\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{c_j}{2^{k-j}-1}$$ is an integer. Distributing the product over the sum reduces this to the termwise claim hint: each term, multiplied by the product, is an integer.

      Fix $j$ in the sum, so $j\le k$ (the fact hjk). There are two cases.

      • Case s2. An integer witness is supplied directly.
      • Case s3. Write $k-j=d+1$ (step s1).
        1. hdn is routine (omega): it gives $d+1\le n$.
        2. Let $t=(d+1)\lfloor n/(d+1)\rfloor$. Then $\lfloor n/(d+1)\rfloor\ge1$ (ht), $t\le n$ (hP1), $n<t+(d+1)$ (hP2 with its child) and $d+1\le t$ (hP3).
        3. Together these give $t\in(\lfloor n/2\rfloor,n]$ (hmem).
        4. hdvd gives that $2^{d+1}-1$ divides the product. It divides $(2^{d+1})^{t/(d+1)}-1^{t/(d+1)}=2^t-1$ (this), and $2^t-1$ is one of the factors.
        5. s9 writes the product as $(2^{d+1}-1)q$ with $q$ an integer.
        6. With $2^{d+1}-1\ne0$ (hne and its child) and the cast identity hcast, the term equals $c_jq$, which is the integer witness.

      Merging odd and $2$-adic information (combine combine.hint combine.hint.this combine.s2 combine.hcop combine.hdvd combine.s5)

      combine states: let $\Omega$ be odd with $\Omega p=2^aA$, and suppose $B=Mp$ and $m=M$ for integers $A,B,m$. Then there is an integer $z$ with $z\,2^a=Mp$.

      1. hint gives $\Omega B=2^a(mA)$ in $\mathbb{Z}$. It is proved by checking the identity after casting to $\mathbb{Q}$ (the step this).
      2. s2 writes $\Omega=2t+1$.
      3. hcop gives that $2^a$ and $\Omega$ are coprime.
      4. hdvd gives $2^a\mid B\Omega$.
      5. By coprimality, $2^a\mid B$. Step s5 obtains $c$ with $B=2^ac$.

      The core estimate: the odd number $\Omega$ (hcore hcore.hQcint hcore.hQcint.s1 hcore.hQcint.s2 hcore.h_x3a9div hcore.h_x3a9odd hcore.h_x3a9odd.s1 hcore.h_x3a9odd.s2 hcore.h_x3a9odd.s3 hcore.h_x3a9odd.s3.ht1 hcore.h_x3a9odd.s3.ht1.this)

      hcore states that for $k\le n$ there is an integer $z$ with $$z\,2^{k(k-1)/2}=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}.$$

      The first ingredients are these.

      • Coefficients (hQcint). For every $j$ there is an integer $g_j$ with $Q_c(n,j)=2^{j(j-1)/2}g_j$. It is obtained from integer witnesses for the two Gaussian-binomial products (s1 and s2).
      • Divisibility (hΩdiv in the Lean; the outline's step id is hcore.h_x3a9div). With $\Omega=\prod_{t=1}^{2n}(2^t-1)$: for $1\le s\le 2n$ there is an integer $w$ with $w(2^s-1)=\Omega$. It is obtained by taking the factor $t=s$ out of the product.
      • Oddness (hΩodd in the Lean; step id hcore.h_x3a9odd). $\Omega$ is odd. The proof establishes a property of the product by showing that it is multiplicative and holds on factors:
        • products of odd integers are odd (s1);
        • $1$ is odd (s2);
        • each $2^t-1$ with $t\ge1$ is odd, as an even number minus an odd one (s3, with $t\ne0$ from $1\le t$).

      The core estimate: integral reciprocal terms (hcore.key1 hcore.key1.s1 hcore.key1.s1.s1 hcore.key1.s1.s2 hcore.key1.s1.hne hcore.key1.s1.hne.this hcore.key1.s1.h2a hcore.key1.s1.this hcore.key1.s2 hcore.key1.s2.s1 hcore.key1.s2.s2 hcore.key1.s2.hne hcore.key1.s2.hne.this hcore.key1.s2.h2b hcore.key1.s2.this hcore.hK hcore.hK.this hcore.hI hcore.hI.h1 hcore.hI.h2)

      key1 states that for $a\ne b$, both $\le 2n$, the number $\Omega\,2^a\cdot\frac{1}{2^a-2^b}$ is an integer. The proof splits according to the order of $a$ and $b$.

      • Case $a<b$ (s1).
        • Write $b=a+d+1$ (s1.s1).
        • Obtain an integer $w$ with $w(2^{d+1}-1)=\Omega$ (s1.s2).
        • Record $2^{d+1}-1\ne0$ (hne, with this).
        • h2a is routine (positivity): $2^a\ne0$.
        • The second this is routine (ring): $2^a-2^a2^{d+1}=-(2^a(2^{d+1}-1))$.
        • The witness is $-w$.
      • Case $a>b$ (s2).
        • Write $a=b+d+1$ and obtain $w$ in the same way.
        • h2b is routine (positivity), and the factorisation this is routine (ring).
        • The witness is $w\,2^{d+1}$.

      Two instances follow.

      • hK: for $K\in(n,2n]$ (so $n<K\le 2n$, by this), $\Omega 2^k/(2^k-2^K)$ is an integer.
      • hI: for $i\le n$ with $i\ne k$ (the facts h1 and h2), $\Omega 2^k/(2^k-2^i)$ is an integer.

      The core estimate: the tail and the assembly (hcore.hT hcore.hT.hj' hcore.hT.s2 hcore.hT.s3 hcore.hT.hmono hcore.hT.s5 hcore.hT.hne hcore.hT.hne.this hcore.hT.hne' hcore.h2adic hcore.h2adic.htail hcore.s9 hcore.hB')

      Tail terms (hT). For $j\in(k,n]$ there is an integer $w$ with $$w\,2^{k(k-1)/2}=\Omega\cdot\frac{Q_c(n,j)\,2^{j-k}}{1-2^{j-k}}.$$

      1. hj' gives $k<j\le n$.
      2. s2 writes $j-k=d+1$.
      3. s3 obtains an integer $w$ with $w(2^{d+1}-1)=\Omega$.
      4. hmono gives $k(k-1)/2\le j(j-1)/2$, and s5 writes $j(j-1)/2=k(k-1)/2+e$.
      5. With $2^{d+1}-1\ne0$ and $1-2^{d+1}\ne0$ (the steps hne, its child, and hne'), the witness is $-(w\,g_j\,2^e\,2^{d+1})$.

      The $2$-adic form (h2adic). Let $f_K$, $f_I$ and $f_T$ be the integers supplied by hK, hI and hT. Then $$\Omega\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}=2^{k(k-1)/2}\Big(g_k\big(\textstyle\sum_K f_K-\sum_i f_I\big)-\sum_j f_T\Big).$$ Its child htail gives $2^{k(k-1)/2}\sum_{j\in(k,n]}f_T=\Omega\sum_{j\in(k,n]}\frac{Q_c(n,j)2^{j-k}}{1-2^{j-k}}$. The goal left after htail is the partial-fraction formula multiplied through by $\Omega$, with the reciprocal sums written through the integers $f_K$ and $f_I$.

      The odd form.

      • s9 uses the odd-denominator statement with $c_j=2^{j(j-1)/2}g_j$ to obtain an integer $B$. It equals the product $\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)$ times $\sum_{j\le k} c_j/(2^{k-j}-1)$.
      • hB' rewrites $c_j$ back as $Q_c(n,j)$, so that $B$ equals the right-hand side of hcore.

      These facts have the shape of the hypotheses of the merging lemma:

      • the odd number $\Omega$;
      • the exponent $k(k-1)/2$;
      • the relation from h2adic;
      • the integer $B$;
      • the integral product.

      Clearing the extra sum (hcnall hcnall.hint hcnall.hint.s1 hcnall.hint.s1.hj' hcnall.hint.s1.s2 hcnall.hint.s1.s2.e hcnall.hint.s1.s3 hcnall.hint.s1.s3.e hcnall.hint.s2 hcnall.hint.s2.hmem hcnall.hint.s2.hne hcnall.hint.s2.hne.h8 hcnall.hint.s2.hne.h8.s1 hcnall.hint.s2.hne.h8.s2)

      hcnall states that $$\prod_{2\le j<n}(2^{j+1}-3)\cdot\sum_{j<n}\frac{3}{2^{j+1}-3}$$ is an integer. Distributing the product reduces this to the termwise claim hint. There are two cases on $j$.

      • Case s1: $j<2$. hj' is routine (omega): it gives $j=0$ or $j=1$.
        • In s2, the routine step e (norm_num) gives $3/(2-3)=-3$, and the witness is $-3\prod(2^{i+1}-3)$.
        • In s3, the routine step e (norm_num) gives $3/(4-3)=3$, and the witness is $3\prod(2^{i+1}-3)$.
      • Case s2: $j\ge2$.
        • hmem gives $j\in[2,n)$.
        • hne gives $2^{j+1}-3\ne0$, from $8\le 2^{j+1}$. That bound is proved by the calculation in h8: $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity of powers.
        • The factor for $j$ is pulled out of the product, which cancels the denominator.

      The size bound: setting up the exponents (hb hb.key hb.key.s1 hb.key.s2 hb.key.s2.hP1 hb.key.s2.hP2 hb.key.s2.s3 hb.key.s2.s4 hb.key.s2.hS1 hb.key.s2.hS1.e hb.key.s2.hS2 hb.key.s2.hS2.this hb.key.s2.hT)

      The remaining steps concern the natural number $$d=2^{n(n+1)/2}\cdot E(n).$$ Here $E(5)=409045$ and $E(7)=1298717875$. Otherwise $$E(n)=\prod_{\lfloor n/2\rfloor<m\le n}(2^m-1)\cdot\prod_{2\le j<n}(2^{j+1}-3).$$

      hb states that $d^2\le 2^{3n^2}$ in $\mathbb{R}$. It follows from the same inequality in $\mathbb{N}$, which is key. That inequality is split into two cases.

      • Case s1: $n\le 9$. The proof splits on $n\le 9$ or $10\le n$ (Lean line 626; the split itself is not an outline step, and the outline prints no hypothesis for this case). For $n\le 9$ the inequality in $\mathbb{N}$ is checked by evaluation in the kernel (decide +kernel, after generalising over $n$), for each of the ten values; this is the only place where the numerals $E(5)$ and $E(7)$ enter the size bound.
      • Case s2: $n\ge 10$. Since $n\ne 5$ and $n\ne 7$, the conditional is resolved to the product branch, so the goal is the inequality for $2^{n(n+1)/2}\prod(2^m-1)\prod(2^{j+1}-3)$. The ingredients are:
        • hP1: $\prod_{(n/2,n]}(2^m-1)\le 2^{\sum m}$, comparing factor by factor;
        • hP2: $\prod_{[2,n)}(2^{j+1}-3)\le 2^{\sum(j+1)}$;
        • s3: $n=\lfloor n/2\rfloor+c+1$;
        • s4: $n=d'+3$, where $d'$ is the name the outline gives (it is distinct from the witness $d$);
        • hS1: $2\sum_{(n/2,n]}m=2(c+1)(\lfloor n/2\rfloor+1)+(c+1)c$, by Gauss' summation formula after rewriting the interval as $[\lfloor n/2\rfloor+1,n+1)$ (e);
        • hS2: $2\sum_{[2,n)}(j+1)=6(d'+1)+(d'+1)d'$, after re-indexing (this) and again Gauss' summation formula;
        • hT: $\big(n(n+1)/2\big)\cdot2=n(n+1)$, since $n(n+1)$ is even.

      The size bound: exponent arithmetic (hb.key.s2.hexp hb.key.s2.hexp.arith hb.key.s2.hexp.arith.hsq hb.key.s2.hexp.arith.s2 hb.key.s2.hexp.arith.s3 hb.key.s2.hexp.s2 hb.key.s2.hexp.s3 hb.key.s2.hexp.hc' hb.key.s2.hexp.hd' hb.key.s2.hexp.hT' hb.key.s2.hexp.this hb.key.s2.s9 hb.key.s2.s10 hb.key.s2.s11)

      hexp states that $$2\cdot\tfrac{n(n+1)}{2}+2\sum_{(n/2,n]}m+2\sum_{[2,n)}(j+1)\le 3n\cdot n .$$

      The polynomial inequality (arith). Assume $r\le1$, $3\le e$, and that $A,B,T$ satisfy $$2A=2(e+r+2)(e+3)+(e+r+2)(e+r+1),$$ $$2B=6(2e+r+2)+(2e+r+2)(2e+r+1),$$ $$2T=(2e+4+r)(2e+5+r).$$ Then $2T+2A+2B\le 3(2e+4+r)^2$. It uses $3e\le e^2$ (hsq) and is checked separately for $r=0$ (s2) and $r=1$ (s3).

      Applying it.

      1. s2 writes $\lfloor n/2\rfloor=e+2$.
      2. s3 writes $n=2e+4+r$ with $r\le1$.
      3. hc' and hd' are routine (omega): they give $c=e+1+r$ and $d'=2e+1+r$.
      4. hT' restates $2\cdot\frac{n(n+1)}2$ in these variables.
      5. this is the resulting instance, which gives hexp.

      The chain of inequalities.

      • s9 bounds the squared product by the squared power-of-$2$ bounds from hP1 and hP2.
      • s10 rewrites this by the laws of exponents; its claim is not printed in the outline.
      • s11 concludes $2^{(\cdots)}\le 2^{3n^2}$ by monotonicity of powers of $2$, using hexp.

      Integrality of $2^{n(n+1)/2}Q_x(n)$ (hqx hqx.hterm hqx.hterm.hkn hqx.hterm.s2 hqx.hterm.s3 hqx.hterm.s4 hqx.hterm.hexp hqx.hterm.hexp.e1 hqx.hterm.hexp.e2 hqx.hterm.hexp.e3 hqx.hterm.hexp.s4 hqx.hterm.hexp.s5 hqx.hterm.hpow hqx.hterm.h2)

      hqx states that $2^{n(n+1)/2}\sum_{k\le n}Q_c(n,k)(3/2^n)^k$ is an integer. Distributing the power over the sum reduces this to the termwise claim hterm.

      Fix $k\le n$ (the fact hkn).

      1. Witnesses. Let $a$ and $b$ be integers equal to $\binom{n}{k}_2$ and to $\prod_{i<n}\frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (steps s2 and s3).
      2. Substitution. s4 writes $n=k+m$.
      3. Exponent identity (hexp).

      $$\tfrac{(k+m)(k+m+1)}2+\tfrac{k(k-1)}2=\tfrac{m(m+1)}2+(k+m)k .$$

      • e1, e2 and e3 remove the three halvings, using that consecutive products are even.
      • The identity is then proved by induction on $k$: the case $k=0$ (s4) is routine (simp), and s5 is the successor case.
      1. Powers. hpow gives $2^{(k+m)(k+m+1)/2}\,2^{k(k-1)/2}=2^{m(m+1)/2}(2^{k+m})^k$.
      2. Nonvanishing. h2 is routine (positivity): $2^{k+m}\ne0$.
      3. Conclusion. The term equals $(-1)^k3^k2^{m(m+1)/2}ab$.

      Positivity of the odd part (hE hE.s1 hE.s2 hE.s3 hE.s3.s1 hE.s3.s1.hm1 hE.s3.s1.hm1.this hE.s3.s1.this hE.s3.s1.this.s1 hE.s3.s1.this.s2 hE.s3.s2 hE.s3.s2.hj2 hE.s3.s2.this hE.s3.s2.this.s1 hE.s3.s2.this.s2)

      hE states $0<E(n)$, splitting into the three branches of the conditional.

      • The two numeral branches are routine (norm_num): $0<409045$ and $0<1298717875$ (s1 and s2).
      • In the product branch (s3), each factor is positive.
        • Factors $2^m-1$ (s3.s1). Here $m\in(\lfloor n/2\rfloor,n]$ gives $1\le m$ (hm1, via $\lfloor n/2\rfloor<m$). Then $2\le 2^m$ (this): the equation $2=2^1$ is routine (norm_num), and $2^1\le 2^m$ follows by monotonicity.
        • Factors $2^{j+1}-3$ (s3.s2). Here $j\in[2,n)$ gives $2\le j$ (hj2). Then $8\le 2^{j+1}$: the equation $8=2^3$ is routine (norm_num), and $2^3\le 2^{j+1}$ follows by monotonicity.

      Integrality of $d\,A_q(n)$: the cases and the casts (hAqint hAqint.s1 hAqint.s2 hAqint.s2.s1 hAqint.s2.s2 hAqint.s2.s2.hM hAqint.s2.s2.hC hAqint.s2.s2.hC.hj2 hAqint.s2.s2.hC.h3 hAqint.s2.s2.hC.h3.s1 hAqint.s2.s2.hC.h3.s2 hAqint.s2.s2.hd hAqint.s2.s2.s4 hAqint.s2.s2.s5 hAqint.s2.s2.hQxn)

      hAqint states that $d\cdot A_q(n)$ is an integer, for the $d$ above. The cases follow the branches of the conditional.

      • Numeral branches (s1 and s2.s1). The recorded uses select the branch, give a witness, and evaluate by kernel reduction.
      • Product branch (s2.s2). The setup is as follows.
        • hM casts $\prod(2^m-1)$ from $\mathbb{N}$ to $\mathbb{Q}$, valid since $1\le 2^m$.
        • hC casts $\prod(2^{j+1}-3)$, valid since $3\le 2^{j+1}$ for $j\ge2$. This uses hj2; the bound h3 is the calculation in which $3\le 2^2$ is routine (norm_num) and $2^2\le 2^{j+1}$ follows by monotonicity.
        • hd casts $d$ itself as $2^{n(n+1)/2}\cdot\big(\prod(2^m-1)\prod(2^{j+1}-3)\big)$.
        • s4 obtains an integer $z_{cn}$ equal to $\prod(2^{j+1}-3)\sum_{j<n}3/(2^{j+1}-3)$.
        • s5 obtains an integer $z_q'$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$.
        • hQxn unfolds $Q_x(n)$ as that sum.
        • The recorded closing uses distribute $d$ over the two parts of $A_q(n)$ and over the outer sum.

      Integrality of $d\,A_q(n)$: the main terms (hAqint.s2.s2.hterm hAqint.s2.s2.hterm.hkn hAqint.s2.s2.hterm.s2 hAqint.s2.s2.hterm.s3 hAqint.s2.s2.hterm.hexp hAqint.s2.s2.hterm.hexp.e1 hAqint.s2.s2.hterm.hexp.e2 hAqint.s2.s2.hterm.hexp.e3 hAqint.s2.s2.hterm.hexp.s4 hAqint.s2.s2.hterm.hexp.s5 hAqint.s2.s2.hterm.hpow hAqint.s2.s2.hterm.h2n hAqint.s2.s2.hterm.e1 s21)

      hterm states that for each $k\le n$, $$2^{n(n+1)/2}\Big(\prod(2^m-1)\prod(2^{j+1}-3)\Big)\cdot\Big(\sum_{j\le k}\frac{Q_c(n,j)}{2^{k-j}-1}\Big)\Big(\frac{3}{2^n}\Big)^k$$ is an integer.

      1. hkn gives $k\le n$.
      2. s2 obtains $w$ with $w\,2^{k(k-1)/2}=\prod(2^m-1)\cdot\sum_{j\le k}Q_c(n,j)/(2^{k-j}-1)$. This is an instance of the core statement.
      3. s3 writes $n=k+m$.
      4. hexp is the exponent identity $\frac{n(n+1)}2+\frac{k(k-1)}2=\frac{m(m+1)}2+nk$. As before, it removes the halvings (e1, e2, e3) and proceeds by induction on $k$; the base case s4 is routine (simp), and s5 is the successor case.
      5. hpow gives $2^{n(n+1)/2}2^{k(k-1)/2}=2^{m(m+1)/2}(2^n)^k$.
      6. h2n is routine (positivity): $(2^n)^k\ne0$.
      7. e1 regroups the term as $\prod(2^{j+1}-3)\cdot3^k\cdot\big(\prod(2^m-1)\sum_{j\le k}\tfrac{Q_c(n,j)}{2^{k-j}-1}\big)\,2^{n(n+1)/2}/(2^n)^k$.
      8. Combining these, the term equals $\prod(2^{j+1}-3)\cdot w\cdot3^k\cdot2^{m(m+1)/2}$, which is the integer witness.

      Finally, s21 obtains an integer $z_q$ equal to $2^{n(n+1)/2}\sum_kQ_c(n,k)(3/2^n)^k$, which is the content of the integrality of $2^{n(n+1)/2}Q_x(n)$. The steps recorded at the top level have therefore established three things:

      • for the number $d=2^{n(n+1)/2}E(n)$: positivity of $E(n)$, the bound $d^2\le 2^{3n^2}$, and integrality of $d\,A_q(n)$;
      • integrality of $2^{n(n+1)/2}Q_x(n)$.

      These are the ingredients of the existential goal. No step in the outline is open.

    Diff of d39a90505cc9 against 567cd0ce4560
    @@ -231,6 +231,6 @@
     
     - **Coefficients (`hQcint`).** For every $j$ there is an integer $g_j$ with $Q_c(n,j)=2^{j(j-1)/2}g_j$. It is obtained from integer witnesses for the two Gaussian-binomial products (`s1` and `s2`).
    -- **Divisibility (`hΩdiv`).** With $\Omega=\prod_{t=1}^{2n}(2^t-1)$: for $1\le s\le 2n$ there is an integer $w$ with $w(2^s-1)=\Omega$. It is obtained by taking the factor $t=s$ out of the product.
    -- **Oddness (`hΩodd`).** $\Omega$ is odd. The proof establishes a property of the product by showing that it is multiplicative and holds on factors:
    +- **Divisibility (`hΩdiv` in the Lean; the outline's step id is `hcore.h_x3a9div`).** With $\Omega=\prod_{t=1}^{2n}(2^t-1)$: for $1\le s\le 2n$ there is an integer $w$ with $w(2^s-1)=\Omega$. It is obtained by taking the factor $t=s$ out of the product.
    +- **Oddness (`hΩodd` in the Lean; step id `hcore.h_x3a9odd`).** $\Omega$ is odd. The proof establishes a property of the product by showing that it is multiplicative and holds on factors:
       - products of odd integers are odd (`s1`);
       - $1$ is odd (`s2`);
    @@ -309,6 +309,6 @@
     `hb` states that $d^2\le 2^{3n^2}$ in $\mathbb{R}$. It follows from the same inequality in $\mathbb{N}$, which is `key`. That inequality is split into two cases.
     
    -- **Case `s1`.** The goal is closed by kernel evaluation of the decidable statement (the recorded use is the kernel-reduction option). The outline does not print which values of $n$ this case covers.
    -- **Case `s2`.** The conditional is resolved to the product branch, so the goal is the inequality for $2^{n(n+1)/2}\prod(2^m-1)\prod(2^{j+1}-3)$. The ingredients are:
    +- **Case `s1`: $n\le 9$.** The proof splits on $n\le 9$ or $10\le n$ (Lean line 626; the split itself is not an outline step, and the outline prints no hypothesis for this case). For $n\le 9$ the inequality in $\mathbb{N}$ is checked by evaluation in the kernel (`decide +kernel`, after generalising over $n$), for each of the ten values; this is the only place where the numerals $E(5)$ and $E(7)$ enter the size bound.
    +- **Case `s2`: $n\ge 10$.** Since $n\ne 5$ and $n\ne 7$, the conditional is resolved to the product branch, so the goal is the inequality for $2^{n(n+1)/2}\prod(2^m-1)\prod(2^{j+1}-3)$. The ingredients are:
       - `hP1`: $\prod_{(n/2,n]}(2^m-1)\le 2^{\sum m}$, comparing factor by factor;
       - `hP2`: $\prod_{[2,n)}(2^{j+1}-3)\le 2^{\sum(j+1)}$;

    Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).

  2. erdos-1050--h1-v2 proved

    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.

    theorem erdos_1050__h1 : ∃ a b : ℕ → ℤ,
        (∀ n : ℕ, (b n : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n ≠ 0) ∧
        Filter.Tendsto
          (fun n : ℕ => (b n : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n)
          Filter.atTop (nhds 0) := 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 f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1), 2026-10-18; no one has read it against the Lean and signed it.

    Draft · drafted, by the model named above

    $\displaystyle \exists\, a,b:\mathbb{N}\to\mathbb{Z}\ \ \bigl(\forall n\in\mathbb{N},\ b_n\,T-a_n\neq 0\bigr)\ \wedge\ \lim_{n\to\infty}\bigl(b_n\,T-a_n\bigr)=0,\qquad T=\sum_{m=0}^{\infty}\frac{1}{2^{m+3}-3}$

    There are two sequences of integers $a_n$, $b_n$ such that $b_n T - a_n$ is never zero and converges to $0$ in $\mathbb{R}$ (Filter.Tendsto … Filter.atTop (nhds 0)), where $T$ is the real number $\sum_{m\ge 0} 1/(2^{m+3}-3) = \tfrac15+\tfrac1{13}+\tfrac1{29}+\cdots$. The sum is Lean's ∑' over all natural numbers (the file also calls the summation variable n; it is a separate bound variable), which is $0$ for a non-summable family, and $a_n$, $b_n$ are read as real numbers; no hypothesis is assumed and irrationality is not mentioned.

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

    History: 2 versions on record
    1. 2026-10-06 · written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · gloss/181e0dc24de2….md · the first version of its chain

      Read this version

      This file states the theorem erdos_1050__h1. Write $\displaystyle T = \sum_{m=0}^{\infty} \frac{1}{2^{m+3}-3} = \frac15 + \frac1{13} + \frac1{29} + \cdots,$ a real number (Lean's ∑' over all natural numbers $m$, with real division). The statement says:

      there are two sequences of integers $a, b : \mathbb{N} \to \mathbb{Z}$ such that

      1. for every natural number $n$, $b_n T - a_n \neq 0$ (the integers $a_n, b_n$ are read as real numbers here), and
      2. $b_n T - a_n \to 0$ as $n \to \infty$ (Mathlib's Filter.Tendsto … Filter.atTop (nhds 0): the sequence converges to $0$ in $\mathbb{R}$).

      Nothing else is assumed: the statement has no hypotheses.

      Reading notes:

      • In the Lean text the summation variable inside ∑' is also called n. It is a separate bound variable, so $T$ does not depend on the outer $n$; above it is renamed $m$.
      • No denominator $2^{m+3}-3$ is zero (the smallest is $5$), so Lean's convention that division by zero gives $0$ never applies. The statement does not itself assert that the series converges, and Lean defines the tsum of a non-summable family to be $0$; this series converges (its terms are at most $\tfrac15 \cdot 2^{-m}$), so $T$ is its ordinary sum.
      • The file does not mention irrationality. A pair of sequences as above is the classical criterion for $T$ to be irrational, which is how the root node erdos-1050 uses this statement.
      • Per its comment, this node is a hole named borwein of a merged partial proof of the root, revised (D-8) to restore the binder types and real-number ascriptions that an earlier gate-written version had dropped; it supersedes node erdos-1050--h1. The file imports Mathlib and its body is sorry, the placeholder a statement file carries in place of a proof.
    2. 2026-10-18 · written by f29-words, drafted with Claude Fable 5.1 (claude-fable-5-1) · not signed · current · gloss/9946779b2a48….md · diff to its predecessor

      Read this version

      $\displaystyle \exists\, a,b:\mathbb{N}\to\mathbb{Z}\ \ \bigl(\forall n\in\mathbb{N},\ b_n\,T-a_n\neq 0\bigr)\ \wedge\ \lim_{n\to\infty}\bigl(b_n\,T-a_n\bigr)=0,\qquad T=\sum_{m=0}^{\infty}\frac{1}{2^{m+3}-3}$

      There are two sequences of integers $a_n$, $b_n$ such that $b_n T - a_n$ is never zero and converges to $0$ in $\mathbb{R}$ (Filter.Tendsto … Filter.atTop (nhds 0)), where $T$ is the real number $\sum_{m\ge 0} 1/(2^{m+3}-3) = \tfrac15+\tfrac1{13}+\tfrac1{29}+\cdots$. The sum is Lean's ∑' over all natural numbers (the file also calls the summation variable n; it is a separate bound variable), which is $0$ for a non-summable family, and $a_n$, $b_n$ are read as real numbers; no hypothesis is assumed and irrationality is not mentioned.

    Diff of 9946779b2a48 against 181e0dc24de2
    @@ -1,17 +1,3 @@
    -This file states the theorem `erdos_1050__h1`. Write
    -$\displaystyle T = \sum_{m=0}^{\infty} \frac{1}{2^{m+3}-3} = \frac15 + \frac1{13} + \frac1{29} + \cdots,$
    -a real number (Lean's `∑'` over all natural numbers $m$, with real division). The statement says:
    +$$\exists\, a,b:\mathbb{N}\to\mathbb{Z}\ \ \bigl(\forall n\in\mathbb{N},\ b_n\,T-a_n\neq 0\bigr)\ \wedge\ \lim_{n\to\infty}\bigl(b_n\,T-a_n\bigr)=0,\qquad T=\sum_{m=0}^{\infty}\frac{1}{2^{m+3}-3}$$
     
    -there are two sequences of integers $a, b : \mathbb{N} \to \mathbb{Z}$ such that
    -
    -1. for every natural number $n$, $b_n T - a_n \neq 0$ (the integers $a_n, b_n$ are read as real numbers here), and
    -2. $b_n T - a_n \to 0$ as $n \to \infty$ (Mathlib's `Filter.Tendsto … Filter.atTop (nhds 0)`: the sequence converges to $0$ in $\mathbb{R}$).
    -
    -Nothing else is assumed: the statement has no hypotheses.
    -
    -Reading notes:
    -
    -- In the Lean text the summation variable inside `∑'` is also called `n`. It is a separate bound variable, so $T$ does not depend on the outer $n$; above it is renamed $m$.
    -- No denominator $2^{m+3}-3$ is zero (the smallest is $5$), so Lean's convention that division by zero gives $0$ never applies. The statement does not itself assert that the series converges, and Lean defines the `tsum` of a non-summable family to be $0$; this series converges (its terms are at most $\tfrac15 \cdot 2^{-m}$), so $T$ is its ordinary sum.
    -- The file does not mention irrationality. A pair of sequences as above is the classical criterion for $T$ to be irrational, which is how the root node `erdos-1050` uses this statement.
    -- Per its comment, this node is a hole named `borwein` of a merged partial proof of the root, revised (D-8) to restore the binder types and real-number ascriptions that an earlier gate-written version had dropped; it supersedes node `erdos-1050--h1`. The file imports Mathlib and its body is `sorry`, the placeholder a statement file carries in place of a proof.
    +There are two sequences of integers $a_n$, $b_n$ such that $b_n T - a_n$ is never zero and converges to $0$ in $\mathbb{R}$ (`Filter.Tendsto … Filter.atTop (nhds 0)`), where $T$ is the real number $\sum_{m\ge 0} 1/(2^{m+3}-3) = \tfrac15+\tfrac1{13}+\tfrac1{29}+\cdots$. The sum is Lean's `∑'` over all natural numbers (the file also calls the summation variable `n`; it is a separate bound variable), which is $0$ for a non-summable family, and $a_n$, $b_n$ are read as real numbers; no hypothesis is assumed and irrationality is not mentioned.

    Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).

    Checked by the kernel — an outline of the proof attested in attestations/000319.json, merge commit 879b5c03f7df.

    Outline of Proof.lean, extracted by the gate at 82834c4684b8 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. hrem_all have ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with hrem_all : ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

      Uses library Finset.range range n is the set of natural numbers less than n. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

      Lean, lines 15–724
        have hrem_all : ∀ (Qc : ℕ → ℕ → ℚ),
            (Qc = fun (n k : ℕ) =>
                ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                    ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                  ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) →
              ∀ (Qx : ℕ → ℚ),
                (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) →
                  ∀ (Aq : ℕ → ℚ),
                    (Aq = fun (n : ℕ) =>
                        ∑ k ∈ Finset.range (n + (1 : ℕ)),
                            (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                              ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                          Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) →
                      (∀ (n : ℕ),
                          ∃ (d : ℕ),
                            (0 : ℕ) < d ∧
                              (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧
                                (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) →
                        ∀ (n : ℕ),
                          (0 : ℝ) <
                              (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) -
                                (↑(Aq n) : ℝ) ∧
                            ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) -
                                    (↑(Aq n) : ℝ)) ^
                                  (2 : ℕ) *
                                (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤
                              (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) := by
          open Polynomial in
          have id1_test : ∀ (n j : ℕ) (hj : j ≤ n),
              (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - 1)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
                ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1) := by
            intro n j hj
            induction j with
            | zero => simp
            | succ j ih =>
              have ih' := ih (by omega)
              rw [Finset.prod_range_succ, ← ih']
              obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩
              rw [hm, Finset.prod_range_succ, show n - (j + 1) = m by omega]
              ring
          open Polynomial in
          have lower_test : ∀ (j : ℕ),
              ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) =
                2 ^ (j * (j - 1) / 2) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1) := by
            intro j
            have h1 : ∀ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) = 2 ^ i * (2 ^ (j - 1 - i + 1) - 1) := by
              intro i hi
              have hi' := Finset.mem_range.mp hi
              rw [mul_sub, ← pow_add, show i + (j - 1 - i + 1) = j by omega]
              ring
            rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum,
              Finset.prod_range_reflect (fun s => ((2 : ℚ) ^ (s + 1) - 1)) j]
            congr 1
            congr 1
            have := Finset.sum_range_id_mul_two j
            omega
          open Polynomial in
          have upper_test : ∀ (j n : ℕ) (hj : j ≤ n),
              ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - 2 ^ i) =
                (-1) ^ (n - j) * 2 ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
            intro j n hj
            have e : Finset.Ioc j n = Finset.Ico (j + 1) (n + 1) := by
              ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
            rw [e, Finset.prod_Ico_eq_prod_range, show n + 1 - (j + 1) = n - j by omega]
            have h1 : ∀ t ∈ Finset.range (n - j), ((2 : ℚ) ^ j - 2 ^ (j + 1 + t)) = (-1) * 2 ^ j * (2 ^ (t + 1) - 1) := by
              intro t _
              rw [show j + 1 + t = j + (t + 1) by ring, pow_add]
              ring
            rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
              Finset.prod_const, Finset.card_range, ← pow_mul]
          open Polynomial in
          have rhs_test : ∀ (j n : ℕ) (hj : j ≤ n),
              (∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K)) *
                ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
                (-1) ^ n * 2 ^ (j * n) * ∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
            intro j n hj
            have e : Finset.Ioc n (2 * n) = Finset.Ico (n + 1) (2 * n + 1) := by
              ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
            rw [e, Finset.prod_Ico_eq_prod_range, show 2 * n + 1 - (n + 1) = n by omega]
            have h1 : ∀ t ∈ Finset.range n, ((2 : ℚ) ^ j - 2 ^ (n + 1 + t)) =
                (-1) * 2 ^ j * (2 ^ ((n - j) + t + 1) - 1) := by
              intro t _
              rw [show n + 1 + t = j + ((n - j) + t + 1) by omega, pow_add]
              ring
            rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
              Finset.prod_const, Finset.card_range, ← pow_mul,
              show 2 * n - j = (n - j) + n by omega, Finset.prod_range_add]
            ring
          open Polynomial in
          have id1_full : ∀ (n j : ℕ) (hj : j ≤ n),
              (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) *
                    ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                  ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
              ∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K) := by
            intro n j hj
            have hPne : ∀ m : ℕ, ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + 1) - 1) ≠ 0 := by
              intro m
              refine Finset.prod_ne_zero_iff.mpr (fun s _ => ?_)
              have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            have hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) /
                  ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1)) := by
              rw [Finset.prod_div_distrib, ← id1_test n j hj]
              field_simp [hPne]
            have hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                (∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1)) /
                  ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) := by
              rw [Finset.prod_div_distrib, ← id1_test (2 * n - j) n (by omega), show 2 * n - j - n = n - j by omega]
              field_simp [hPne]
            have hsplit : (Finset.range (n + 1)).erase j = Finset.range j ∪ Finset.Ioc j n := by
              ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega
            have hdisj : Disjoint (Finset.range j) (Finset.Ioc j n) := by
              rw [Finset.disjoint_left]
              intro x hx hx'
              simp only [Finset.mem_range, Finset.mem_Ioc] at hx hx'
              omega
            have hR := rhs_test j n hj
            obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hj
            have hsign : (-1 : ℚ) ^ (j + m) = (-1) ^ j * (-1) ^ (j + m - j) := by
              rw [← pow_add]; congr 1; omega
            have ha : 2 * (j * (j - 1) / 2) = j * (j - 1) := Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
            have hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j) := by
              rw [show j + m - j = m by omega]
              rcases j with _ | i
              · simp
              · simp only [Nat.add_sub_cancel] at ha ⊢
                nlinarith [ha]
            rw [hG1, hG2, hsplit, Finset.prod_union hdisj, lower_test, upper_test j (j + m) hj]
            apply mul_right_cancel₀ (hPne (j + m - j))
            rw [hR, hsign, hexp, pow_add, pow_add, pow_add]
            field_simp [hPne]
          clear id1_test lower_test upper_test rhs_test
          open Polynomial in
          have lagr_eval : ∀ (n : ℕ) (x : ℕ → ℚ) (hx : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j)
            (N : ℚ[X]) (hNdeg : N.degree ≤ n) (r : ℕ → ℚ)
            (hr : ∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j)),
              N = ∑ j ∈ Finset.range (n + 1), C (r j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)) := by
            intro n x hx N hNdeg r hr
            have hinj : Set.InjOn x (Finset.range (n + 1) : Set ℕ) := by
              intro i hi j hj h
              simp only [Finset.coe_range, Set.mem_Iio] at hi hj
              exact hx i (by omega) j (by omega) h
            apply Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq ((Finset.range (n + 1)).image x)
            · rw [Finset.card_image_of_injOn hinj, Finset.card_range]
              refine lt_of_le_of_lt (Polynomial.degree_sub_le _ _) (max_lt ?_ ?_)
              · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)
              · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                intro j hj
                refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                  rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                    Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                  simp
                rw [this, zero_add]
                exact_mod_cast Nat.lt_succ_self n
            · intro y hy
              obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy
              have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega
              rw [← hr k hk', Polynomial.eval_finset_sum, Finset.sum_eq_single k]
              · simp [Polynomial.eval_prod]
              · intro j hj hjk
                simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                  Polynomial.eval_X]
                rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]
              · intro h; exact absurd hk h
          open Polynomial in
          have tail_coeff : ∀ (n K : ℕ) (hK : n < K) (Qc : ℕ → ℕ → ℚ)
            (hQc : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
              ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ L)),
              ∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) =
                (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℚ) ^ K - 2 ^ i) := by
            intro n K hK Qc hQc
            set x : ℕ → ℚ := fun i => (2 : ℚ) ^ i with hxdef
            have hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j := by
              intro i _ j _ h
              have h' : (2 : ℚ) ^ i = 2 ^ j := h
              exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast h')
            have hxne : ∀ a b : ℕ, a ≠ b → (2 : ℚ) ^ a - 2 ^ b ≠ 0 := by
              intro a b hab h
              apply hab
              exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast (sub_eq_zero.mp h))
            set N : ℚ[X] := ∏ L ∈ Finset.Ioc n (2 * n), (X - C ((2 : ℚ) ^ L)) with hN
            have hNdeg : N.degree ≤ n := by
              rw [hN, Polynomial.degree_prod]
              rw [Finset.sum_congr rfl (fun L _ => Polynomial.degree_X_sub_C ((2 : ℚ) ^ L)), Finset.sum_const,
                Nat.card_Ioc]
              simp
              omega
            have hr : ∀ j ≤ n, (Qc n j * 2 ^ j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j) := by
              intro j hj
              rw [hN, Polynomial.eval_prod]
              simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, hxdef]
              exact hQc j hj
            have hL := lagr_eval n x hxinj N hNdeg (fun j => Qc n j * 2 ^ j) hr
            have hev := congrArg (Polynomial.eval ((2 : ℚ) ^ K)) hL
            rw [Polynomial.eval_finset_sum] at hev
            have hNK : N.eval ((2 : ℚ) ^ K) = ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ K - 2 ^ L) := by
              rw [hN, Polynomial.eval_prod]
              simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C]
            have hD : ∏ i ∈ Finset.range (n + 1), ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
              Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by have := Finset.mem_range.mp hi; omega))
            rw [hNK] at hev
            rw [hev, Finset.sum_div]
            refine Finset.sum_congr rfl (fun j hj => ?_)
            have hjn : j < n + 1 := Finset.mem_range.mp hj
            have hne1 : (2 : ℚ) ^ K - 2 ^ j ≠ 0 := hxne K j (by omega)
            have hne2 : (2 : ℚ) ^ (K - j) - 1 ≠ 0 := by
              have : (1 : ℚ) < 2 ^ (K - j) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
              Polynomial.eval_X, hxdef]
            rw [← Finset.mul_prod_erase (Finset.range (n + 1)) (fun i => (2 : ℚ) ^ K - 2 ^ i) hj]
            have hE : ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
              Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by
                have := Finset.mem_range.mp (Finset.mem_of_mem_erase hi); omega))
            have hpow : (2 : ℚ) ^ K = 2 ^ j * 2 ^ (K - j) := by rw [← pow_add]; congr 1; omega
            field_simp
            rw [hpow]
            ring
          clear lagr_eval
          open Polynomial in
          have tail3 : ∀ (n : ℕ) (hn : 1 ≤ n),
              ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) = ∑' s : ℕ, ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) := by
            intro n hn
            set f : ℕ → ℕ → ℝ := fun m s => ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * ((1 : ℝ) / 2 ^ (s + 1)) ^ m with hf
            have key : ∀ m s, f m s = ((3 : ℝ) / 2 ^ (m + n + 1)) ^ (s + 1) := by
              intro m s
              simp only [hf]
              rw [div_pow, div_pow, div_pow, one_pow, ← pow_mul, ← pow_mul, ← pow_mul,
                show (m + n + 1) * (s + 1) = (n + 1) * (s + 1) + (s + 1) * m by ring, pow_add]
              field_simp
              exact pow_add _ _ _
            have hpos : ∀ m s, 0 ≤ f m s := fun m s => by rw [key]; positivity
            have h4 : ∀ m : ℕ, (4 : ℝ) ≤ 2 ^ (m + n + 1) := by
              intro m
              calc (4 : ℝ) = 2 ^ 2 := by norm_num
                _ ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
            have inner1 : ∀ m, HasSum (f m) ((3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
              intro m
              have hr0 : 0 ≤ (3 : ℝ) / 2 ^ (m + n + 1) := by positivity
              have hr1 : (3 : ℝ) / 2 ^ (m + n + 1) < 1 := by
                rw [div_lt_one (by positivity)]; linarith [h4 m]
              have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left ((3 : ℝ) / 2 ^ (m + n + 1))
              have hfun : f m = fun s => (3 : ℝ) / 2 ^ (m + n + 1) * ((3 : ℝ) / 2 ^ (m + n + 1)) ^ s := by
                funext s; rw [key]; ring
              have hne : (2 : ℝ) ^ (m + n + 1) - 3 ≠ 0 := by linarith [h4 m]
              have hne2 : (2 : ℝ) ^ (m + n + 1) ≠ 0 := by positivity
              have hval : (3 : ℝ) / (2 ^ (m + n + 1) - 3) =
                  3 / 2 ^ (m + n + 1) * (1 - 3 / 2 ^ (m + n + 1))⁻¹ := by
                field_simp
              rw [hfun, hval]
              exact hg
            have inner2 : ∀ s, HasSum (fun m => f m s) (((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1)) := by
              intro s
              have hr0 : 0 ≤ (1 : ℝ) / 2 ^ (s + 1) := by positivity
              have hr1 : (1 : ℝ) / 2 ^ (s + 1) < 1 := by
                rw [div_lt_one (by positivity)]
                exact one_lt_pow₀ (by norm_num) (by omega)
              have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left (((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1))
              have hne : (2 : ℝ) ^ (s + 1) - 1 ≠ 0 := by
                have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hval : ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) =
                  ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * (1 - 1 / 2 ^ (s + 1))⁻¹ := by
                rw [div_pow, div_pow, ← pow_mul, ← pow_mul, show (n + 1) * (s + 1) = n * (s + 1) + (s + 1) by ring, pow_add]
                field_simp
                exact pow_add _ _ _
              rw [hval]
              exact hg
            have hsum1 : Summable (fun m : ℕ => (3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
              refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
              · have := h4 m; exact div_nonneg (by norm_num) (by linarith)
              · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                calc (3 : ℝ) / (2 ^ (m + n + 1) - 3) ≤ 3 / 2 ^ m :=
                      div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                  _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring
            have hU : Summable (Function.uncurry f) := by
              refine (summable_prod_of_nonneg (fun p => hpos p.1 p.2)).mpr ⟨fun m => (inner1 m).summable, ?_⟩
              exact hsum1.congr (fun m => ((inner1 m).tsum_eq).symm)
            have hcomm := hU.tsum_comm' (fun m => (inner1 m).summable) (fun s => (inner2 s).summable)
            rw [show (∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3)) = ∑' m, ∑' s, f m s from
              tsum_congr (fun m => ((inner1 m).tsum_eq).symm)]
            rw [← hcomm]
            exact tsum_congr (fun s => (inner2 s).tsum_eq)
          open Polynomial in
          have split3T : ∀ (n : ℕ),
              3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) =
                ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) + ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) := by
            intro n
            set g : ℕ → ℝ := fun m => (3 : ℝ) / (2 ^ (m + 1) - 3) with hg
            have hsum : Summable (fun m => g (m + 1)) := by
              refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
              · have : (4 : ℝ) ≤ 2 ^ (m + 1 + 1) := by
                  calc (4 : ℝ) = 2 ^ 2 := by norm_num
                    _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                simp only [hg]; exact div_nonneg (by norm_num) (by linarith)
              · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + 1 + 1) := le_of_eq (by ring_nf)
                have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                simp only [hg]
                calc (3 : ℝ) / (2 ^ (m + 1 + 1) - 3) ≤ 3 / 2 ^ m :=
                      div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                  _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring
            have hs : Summable g := (summable_nat_add_iff 1).mp hsum
            have e1 := hs.sum_add_tsum_nat_add n
            have e2 := hs.sum_add_tsum_nat_add 2
            have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑' m, g (m + 2) := by
              rw [← tsum_mul_left]
              refine tsum_congr (fun m => ?_)
              simp only [hg]
              rw [show m + 2 + 1 = m + 3 by ring]
              ring
            have hfirst : ∑ i ∈ Finset.range 2, g i = 0 := by
              simp only [hg, Finset.sum_range_succ, Finset.sum_range_zero]
              norm_num
            rw [h3T]
            have htail : ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) = ∑' m, g (m + n) := by
              refine tsum_congr (fun m => ?_)
              simp only [hg]
            rw [htail]
            have hrange : ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) = ∑ i ∈ Finset.range n, g i := by
              simp only [hg]
            rw [hrange, e1]
            rw [← e2, hfirst, zero_add]
          open Polynomial in
          have cauchy_fin : ∀ (n : ℕ) (q a : ℕ → ℝ) (x A : ℝ) (hA : HasSum (fun s => a s * x ^ (s + 1)) A),
              HasSum (fun K => ∑ j ∈ Finset.range (n + 1), if j < K then q j * a (K - j - 1) * x ^ K else 0)
                ((∑ j ∈ Finset.range (n + 1), q j * x ^ j) * A) := by
            intro n q a x A hA
            rw [Finset.sum_mul]
            apply hasSum_sum
            intro j _
            have h := hA.mul_left (q j * x ^ j)
            rw [← hasSum_nat_add_iff' (j + 1)]
            have hz : ∑ i ∈ Finset.range (j + 1), (if j < i then q j * a (i - j - 1) * x ^ i else 0) = 0 :=
              Finset.sum_eq_zero (fun i hi => by
                have := Finset.mem_range.mp hi
                rw [if_neg (by omega)])
            rw [hz, sub_zero]
            have hfun : (fun s => if j < s + (j + 1) then q j * a (s + (j + 1) - j - 1) * x ^ (s + (j + 1)) else 0) =
                fun s => q j * x ^ j * (a s * x ^ (s + 1)) := by
              funext s
              rw [if_pos (by omega), show s + (j + 1) - j - 1 = s by omega, show s + (j + 1) = j + (s + 1) by ring, pow_add]
              ring
            rw [hfun]
            exact h
          open Polynomial in
          have h4_series : ∀ (Qc : ℕ → ℕ → ℚ) (hQc : (Qc = fun (n k : ℕ) =>
              ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                  ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)))) (Qx : ℕ → ℚ) (hQx : (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k))
            (Aq : ℕ → ℚ) (hAq : (Aq = fun (n : ℕ) =>
                      ∑ k ∈ Finset.range (n + (1 : ℕ)),
                          (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                            ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                        Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))) (n : ℕ) (hn : 1 ≤ n),
              HasSum (fun K : ℕ => if 2 * n < K then
                  ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                    ((3 : ℝ) / 2 ^ n) ^ K else 0)
                ((Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ)) := by
            intro Qc hQc Qx hQx Aq hAq n hn
            set x : ℝ := (3 : ℝ) / 2 ^ n with hxdef
            have hx0 : 0 ≤ x := by positivity
            have hx2 : x / 2 < 1 := by
              have : (2 : ℝ) ≤ 2 ^ n := by
                calc (2 : ℝ) = 2 ^ 1 := by norm_num
                  _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
              rw [hxdef, div_div, div_lt_one (by positivity)]; linarith
            set a : ℕ → ℝ := fun s => (1 : ℝ) / (2 ^ (s + 1) - 1) with hadef
            have hapos : ∀ s, 0 < (2 : ℝ) ^ (s + 1) - 1 := fun s => by
              have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
              linarith
            have hAsum : Summable (fun s => a s * x ^ (s + 1)) := by
              refine Summable.of_nonneg_of_le (fun s => ?_) (fun s => ?_) ((summable_geometric_of_lt_one (by positivity) hx2).mul_left x)
              · simp only [hadef]; exact mul_nonneg (div_nonneg (by norm_num) (le_of_lt (hapos s))) (by positivity)
              · simp only [hadef]
                have h1 : (2 : ℝ) ^ s ≤ 2 ^ (s + 1) - 1 := by
                  have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)
                  rw [pow_succ]; linarith
                have hxs : 0 ≤ x ^ (s + 1) := by positivity
                calc 1 / (2 ^ (s + 1) - 1) * x ^ (s + 1) ≤ 1 / 2 ^ s * x ^ (s + 1) := by
                      gcongr
                  _ = x * (x / 2) ^ s := by
                    have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                      intro y; rw [div_pow, pow_succ]; field_simp
                    exact e x
            set A := ∑' s, a s * x ^ (s + 1) with hAdef
            have hA : HasSum (fun s => a s * x ^ (s + 1)) A := hAsum.hasSum
            -- 3T = c + A
            have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) + A := by
              rw [split3T n, tail3 n hn, hAdef]
              congr 1
              refine tsum_congr (fun s => ?_)
              simp only [hadef, hxdef]
              ring
            have hQxR : (Qx n : ℝ) = ∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j := by
              rw [hQx]; push_cast; rfl
            have hAqR : (Aq n : ℝ) = ∑ k ∈ Finset.range (n + 1),
                (∑ j ∈ Finset.range (k + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (k - j) - 1)) * x ^ k +
                (Qx n : ℝ) * ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) := by
              rw [hAq]; push_cast; rfl
            have hC := cauchy_fin n (fun j => (Qc n j : ℝ)) a x A hA
            set P : ℝ := ∑ k ∈ Finset.range (n + 1),
                (∑ j ∈ Finset.range (k + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (k - j) - 1)) * x ^ k with hPdef
            have hP : HasSum (fun K => if K < n + 1 then
                (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) P := by
              have h0 : HasSum (fun K => if K < n + 1 then
                  (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0)
                  (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                    (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) :=
                hasSum_sum_of_ne_finset_zero (fun b hb => by rw [if_neg (by simpa using hb)])
              have h1 : (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                    (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) = P := by
                rw [hPdef]
                exact Finset.sum_congr rfl (fun K hK => by rw [if_pos (Finset.mem_range.mp hK)])
              rw [h1] at h0
              exact h0
            have hD := hC.sub hP
            have hval : (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) =
                (∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j) * A - P := by
              rw [h3T, hAqR, hQxR]; ring
            rw [hval]
            have hid1 : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
                ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ L) := fun j hj => by subst hQc; exact id1_full n j hj
            have hfun : (fun K : ℕ => if 2 * n < K then
                  ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                    ((3 : ℝ) / 2 ^ n) ^ K else 0) =
                fun K => (∑ j ∈ Finset.range (n + 1), if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) -
                  (if K < n + 1 then (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) := by
              funext K
              symm
              by_cases hK : K < n + 1
              · rw [if_pos hK, if_neg (by omega)]
                rw [Finset.sum_range_succ (fun j => (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) K, Nat.sub_self, pow_zero, sub_self,
                  div_zero, add_zero]
                have hsplit : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                    ∑ j ∈ Finset.range K, (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1) * x ^ K := by
                  rw [← Finset.sum_range_add_sum_Ico _ (show K ≤ n + 1 by omega)]
                  rw [Finset.sum_eq_zero (s := Finset.Ico K (n + 1)) (fun j hj => by
                    rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]
                  refine Finset.sum_congr rfl (fun j hj => ?_)
                  have hjK := Finset.mem_range.mp hj
                  rw [if_pos hjK]
                  simp only [hadef]
                  rw [show K - j - 1 + 1 = K - j by omega]
                  ring
                rw [hsplit, Finset.sum_mul, sub_self]
              · rw [if_neg hK, sub_zero]
                have hS : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                    ((∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) : ℚ) : ℝ) * x ^ K := by
                  push_cast
                  rw [Finset.sum_mul]
                  refine Finset.sum_congr rfl (fun j hj => ?_)
                  have hjK : j < K := by have := Finset.mem_range.mp hj; omega
                  rw [if_pos hjK]
                  simp only [hadef]
                  rw [show K - j - 1 + 1 = K - j by omega]
                  ring
                rw [hS, tail_coeff n K (by omega) Qc hid1]
                push_cast
                by_cases h2 : 2 * n < K
                · rw [if_pos h2]
                · rw [if_neg h2]
                  rw [Finset.prod_eq_zero (i := K) (Finset.mem_Ioc.mpr ⟨by omega, by omega⟩) (sub_self _)]
                  simp
            rw [hfun]
            exact hD
          clear split3T tail3 cauchy_fin tail_coeff id1_full
          open Polynomial in
          have prod_one_sub_ge : ∀ (s : Finset ℕ) (a : ℕ → ℝ) (h0 : ∀ i ∈ s, 0 ≤ a i) (h1 : ∀ i ∈ s, a i ≤ 1),
              1 - ∑ i ∈ s, a i ≤ ∏ i ∈ s, (1 - a i) := by
            intro s a h0 h1
            induction s using Finset.induction_on with
            | empty => simp
            | insert j s hj ih =>
              rw [Finset.sum_insert hj, Finset.prod_insert hj]
              have ih' := ih (fun i hi => h0 i (Finset.mem_insert_of_mem hi)) (fun i hi => h1 i (Finset.mem_insert_of_mem hi))
              have haj0 := h0 j (Finset.mem_insert_self j s)
              have haj1 := h1 j (Finset.mem_insert_self j s)
              have hP : 0 ≤ ∏ i ∈ s, (1 - a i) :=
                Finset.prod_nonneg (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
              have hP1 : ∏ i ∈ s, (1 - a i) ≤ 1 :=
                Finset.prod_le_one (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                  (fun i hi => by linarith [h0 i (Finset.mem_insert_of_mem hi)])
              nlinarith
          open Polynomial in
          have nd_bound : ∀ (n K : ℕ) (hn : 1 ≤ n) (hK : 2 * n + 1 ≤ K),
              0 < (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) ∧
              (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)
                ≤ 2 * (1 / 2) ^ K := by
            intro n K hn hK
            have hlt : ∀ i, i < K → (0 : ℝ) < 2 ^ K - 2 ^ i := fun i hi => by
              have : (2 : ℝ) ^ i < 2 ^ K := pow_lt_pow_right₀ (by norm_num) hi
              linarith
            have hNpos : 0 < ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) :=
              Finset.prod_pos (fun L hL => hlt L (by have := Finset.mem_Ioc.mp hL; omega))
            have hDpos : 0 < ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) :=
              Finset.prod_pos (fun i hi => hlt i (by have := Finset.mem_range.mp hi; omega))
            refine ⟨div_pos hNpos hDpos, ?_⟩
            have hN : ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := by
              have := Finset.prod_le_prod (s := Finset.Ioc n (2 * n)) (f := fun L => (2 : ℝ) ^ K - 2 ^ L) (g := fun _ => (2 : ℝ) ^ K)
                (fun L hL => le_of_lt (hlt L (by have := Finset.mem_Ioc.mp hL; omega))) (fun L _ => by
                  have : (0 : ℝ) < 2 ^ L := by positivity
                  linarith)
              rw [Finset.prod_const, Nat.card_Ioc, show 2 * n - n = n by omega] at this
              exact this
            have hD : (2 ^ K) ^ (n + 1) / 2 ≤ ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by
              have hfac : ∀ i ∈ Finset.range (n + 1), (2 : ℝ) ^ K - 2 ^ i = 2 ^ K * (1 - (1 / 2) ^ (K - i)) := by
                intro i hi
                have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega
                have e : (2 : ℝ) ^ K = 2 ^ i * 2 ^ (K - i) := by rw [← pow_add]; congr 1; omega
                rw [mul_sub, mul_one, one_div_pow, mul_one_div, e]
                field_simp
              rw [Finset.prod_congr rfl hfac, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range]
              have hsum : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) ≤ 1 / 2 := by
                have e : ∀ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) = (1 / 2) ^ (K - n) * (1 / 2) ^ (n - i) := by
                  intro i hi
                  have := Finset.mem_range.mp hi
                  rw [← pow_add]; congr 1; omega
                rw [Finset.sum_congr rfl e, ← Finset.mul_sum]
                have hg : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (n - i) ≤ 2 := by
                  have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)
                  simp only [Nat.add_sub_cancel] at hr
                  rw [hr]
                  exact sum_geometric_two_le (n + 1)
                have hk : ((1 : ℝ) / 2) ^ (K - n) ≤ (1 / 2) ^ 2 :=
                  pow_le_pow_of_le_one (by norm_num) (by norm_num) (by omega)
                have hpos : 0 ≤ ((1 : ℝ) / 2) ^ (K - n) := by positivity
                nlinarith
              have hprod := prod_one_sub_ge (Finset.range (n + 1)) (fun i => ((1 : ℝ) / 2) ^ (K - i))
                (fun i _ => by positivity) (fun i _ => pow_le_one₀ (by norm_num) (by norm_num))
              have h2K : (0 : ℝ) < (2 ^ K) ^ (n + 1) := by positivity
              nlinarith
            rw [div_le_iff₀ hDpos]
            have h2K : (2 : ℝ) ^ K * (1 / 2) ^ K = 1 := by rw [← mul_pow]; norm_num
            have e2 : 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ (n + 1) / 2) = (2 ^ K) ^ n := by
              rw [pow_succ]
              calc 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ n * 2 ^ K / 2) = (2 ^ K * (1 / 2) ^ K) * (2 ^ K) ^ n := by ring
                _ = (2 ^ K) ^ n := by rw [h2K, one_mul]
            calc ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := hN
              _ = 2 * (1 / 2) ^ K * ((2 ^ K) ^ (n + 1) / 2) := e2.symm
              _ ≤ 2 * (1 / 2) ^ K * ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by gcongr
          clear prod_one_sub_ge
          open Polynomial in
          have ineq_pow : ∀ (n : ℕ) (hn : 2 ≤ n),
              9 * 81 ^ n ≤ 256 ^ n := by
            intro n hn
            induction n with
            | zero => omega
            | succ m ih =>
              rcases (show m = 1 ∨ 2 ≤ m by omega) with rfl | hm
              · norm_num
              · have := ih hm
                rw [pow_succ, pow_succ]
                omega
          open Polynomial in
          have h4_big : ∀ (Qc : ℕ → ℕ → ℚ) (hQc : (Qc = fun (n k : ℕ) =>
              ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                  ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)))) (Qx : ℕ → ℚ) (hQx : (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k))
            (Aq : ℕ → ℚ) (hAq : (Aq = fun (n : ℕ) =>
                      ∑ k ∈ Finset.range (n + (1 : ℕ)),
                          (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                            ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                        Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))) (n : ℕ) (hn : 2 ≤ n),
              (0 : ℝ) < (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) ∧
              ((Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ)) ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤
                (2 : ℝ) ^ (2 * n + 4) := by
            intro Qc hQc Qx hQx Aq hAq n hn
            have hS := h4_series Qc hQc Qx hQx Aq hAq n (by omega)
            set r := (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) with hr
            set x : ℝ := (3 : ℝ) / 2 ^ n with hxdef
            have hx0 : 0 < x := by positivity
            have hx2 : x / 2 ≤ 3 / 8 := by
              have : (4 : ℝ) ≤ 2 ^ n := by
                calc (4 : ℝ) = 2 ^ 2 := by norm_num
                  _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
              rw [hxdef, div_div, div_le_div_iff₀ (by positivity) (by norm_num)]; linarith
            set G : ℕ → ℝ := fun K => if 2 * n < K then
                  ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                    x ^ K else 0 with hG
            have hGnn : ∀ K, 0 ≤ G K := by
              intro K; simp only [hG]
              split_ifs with h
              · exact mul_nonneg (le_of_lt (nd_bound n K (by omega) (by omega)).1) (by positivity)
              · exact le_refl 0
            have hGpos : 0 < G (2 * n + 1) := by
              simp only [hG]; rw [if_pos (by omega)]
              exact mul_pos (nd_bound n (2 * n + 1) (by omega) (by omega)).1 (by positivity)
            refine ⟨?_, ?_⟩
            · exact hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1) (fun K => hGnn K) hGpos hasSum_zero hS
            · set H : ℕ → ℝ := fun K => if 2 * n < K then 2 * (x / 2) ^ K else 0 with hH
              have hGH : ∀ K, G K ≤ H K := by
                intro K; simp only [hG, hH]
                split_ifs with h
                · have hb := (nd_bound n K (by omega) (by omega)).2
                  calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                        ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                        gcongr
                    _ = 2 * (x / 2) ^ K := by ring
                · exact le_refl 0
              have hq : x / 2 < 1 := by linarith
              have hHsum : HasSum H (2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹) := by
                rw [← hasSum_nat_add_iff' (2 * n + 1)]
                have hz : ∑ i ∈ Finset.range (2 * n + 1), H i = 0 :=
                  Finset.sum_eq_zero (fun i hi => by
                    simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])
                rw [hz, sub_zero]
                have hgeo := (hasSum_geometric_of_lt_one (by positivity) hq).mul_left (2 * (x / 2) ^ (2 * n + 1))
                have hfun : (fun s => H (s + (2 * n + 1))) = fun s => 2 * (x / 2) ^ (2 * n + 1) * (x / 2) ^ s := by
                  funext s; simp only [hH]; rw [if_pos (by omega), pow_add]; ring
                rw [hfun]
                exact hgeo
              have hrle : r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hasSum_le hGH hS hHsum
              have hr0 : 0 ≤ r := le_of_lt (hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1)
                (fun K => hGnn K) hGpos hasSum_zero hS)
              have hr8 : r ≤ 8 * (x / 2) ^ (2 * n + 1) := by
                have hinv : (1 - x / 2)⁻¹ ≤ 4 := by
                  rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith
                have hp : 0 ≤ 2 * (x / 2) ^ (2 * n + 1) := by positivity
                calc r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hrle
                  _ ≤ 2 * (x / 2) ^ (2 * n + 1) * 4 := by gcongr
                  _ = 8 * (x / 2) ^ (2 * n + 1) := by ring
              have hsq : r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := pow_le_pow_left₀ hr0 hr8 2
              have hnat : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                have e1 : (2 : ℕ) ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) = 2 ^ (4 * n * n) * (64 * 256 ^ n) := by
                  rw [← pow_mul, ← pow_add, show (256 : ℕ) = 2 ^ 8 by norm_num, ← pow_mul,
                    show (64 : ℕ) = 2 ^ 6 by norm_num, ← pow_add, ← pow_add]
                  congr 1; ring
                have e2 : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) = 2 ^ (4 * n * n) * (64 * (9 * 81 ^ n)) := by
                  rw [show (81 : ℕ) = 3 ^ 4 by norm_num, ← pow_mul, pow_add]; ring
                rw [e1, e2]
                have := ineq_pow n hn
                gcongr
              have hreal : (64 : ℝ) * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                exact_mod_cast hnat
              have hx2' : x / 2 = 3 / 2 ^ (n + 1) := by rw [hxdef, pow_succ]; field_simp
              have hsq' : r ^ 2 ≤ 64 * (x / 2) ^ (4 * n + 2) := by
                calc r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := hsq
                  _ = 64 * (x / 2) ^ (4 * n + 2) := by ring
              have hkey : (x / 2) ^ (4 * n + 2) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) = 3 ^ (4 * n + 2) := by
                rw [← mul_pow, hx2', div_mul_cancel₀ _ (by positivity)]
              have hP : (0 : ℝ) < ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := by positivity
              have hmain : 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) := by
                refine le_of_mul_le_mul_right ?_ hP
                calc 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2)
                    = 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) := by rw [← hkey]; ring
                  _ ≤ 2 ^ (2 * n + 4) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := hreal
              calc r ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ 64 * (x / 2) ^ (4 * n + 2) * 2 ^ (4 * n * n) := by gcongr
                _ ≤ 2 ^ (2 * n + 4) := hmain
          open Polynomial in
          clear h4_series nd_bound ineq_pow
          have T_facts : Summable (fun m : ℕ => (1 : ℝ) / (2 ^ (m + 3) - 3)) ∧
              0 < ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ∧ ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ 2 / 5 := by
            have h5 : ∀ m : ℕ, 5 * (2 : ℝ) ^ m ≤ 2 ^ (m + 3) - 3 := by
              intro m
              have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
              have e : (2 : ℝ) ^ (m + 3) = 8 * 2 ^ m := by rw [pow_add]; norm_num; ring
              rw [e]; linarith
            have hpos : ∀ m : ℕ, 0 < (2 : ℝ) ^ (m + 3) - 3 := fun m => by
              have := h5 m; have : (0 : ℝ) < 2 ^ m := by positivity
              linarith
            have hle : ∀ m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ (1 / 5) * (1 / 2) ^ m := by
              intro m
              have e : (1 / 5 : ℝ) * (1 / 2) ^ m = 1 / (5 * 2 ^ m) := by
                rw [one_div_pow]; field_simp
              rw [e]
              exact one_div_le_one_div_of_le (by positivity) (h5 m)
            have hs : Summable (fun m : ℕ => (1 : ℝ) / (2 ^ (m + 3) - 3)) :=
              Summable.of_nonneg_of_le (fun m => le_of_lt (one_div_pos.mpr (hpos m))) hle
                (summable_geometric_two.mul_left (1 / 5))
            refine ⟨hs, ?_, ?_⟩
            · exact hs.tsum_pos (fun m => le_of_lt (one_div_pos.mpr (hpos m))) 0 (one_div_pos.mpr (hpos 0))
            · calc ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ ∑' m : ℕ, (1 / 5 : ℝ) * (1 / 2) ^ m :=
                    hs.tsum_le_tsum hle (summable_geometric_two.mul_left (1 / 5))
                _ = 2 / 5 := by rw [tsum_mul_left, tsum_geometric_two]; norm_num
          obtain ⟨_, hTpos, hTle⟩ := T_facts
          intro Qc hQc Qx hQx Aq hAq _ n
          match n with
          | 0 =>
            have hQx0 : Qx 0 = 1 := by rw [hQx, hQc]; simp
            have hAq0 : Aq 0 = 0 := by rw [hAq]; simp
            rw [hQx0, hAq0]
            push_cast
            set T := ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) with hT
            refine ⟨by linarith, ?_⟩
            have e : ((1 : ℝ) * (3 * T) - 0) ^ 2 * (2 : ℝ) ^ (4 * 0 * 0) = 9 * (T * T) := by ring
            rw [e]
            norm_num
            nlinarith
          | 1 =>
            -- Qx 1 = 3 - 3/2 = 3/2 and Aq 1 = 3 * (3/2) + (3/2) * (3/(2-3)) = 0, so the remainder is (9/2) T.
            have hQx1 : Qx 1 = 3 / 2 := by
              rw [hQx, hQc]; norm_num [Finset.sum_range_succ, Finset.prod_range_succ]
            have hAq1 : Aq 1 = 0 := by
              rw [hAq]; simp only [hQx1]; rw [hQc]
              norm_num [Finset.sum_range_succ, Finset.prod_range_succ]
            rw [hQx1, hAq1]
            push_cast
            set T := ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) with hT
            refine ⟨by nlinarith, ?_⟩
            norm_num
            nlinarith
          | n + 2 => exact h4_big Qc hQc Qx hQx Aq hAq (n + 2) (by omega)

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 15–724 at 879b5c03f7df ↗

      1. hrem_all.id1_test have ∀ (n j : ℕ), j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with id1_test : ∀ (n j : ℕ), j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. .

        Lean, lines 43–54
            have id1_test : ∀ (n j : ℕ) (hj : j ≤ n),
                (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - 1)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
                  ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1) := by
              intro n j hj
              induction j with
              | zero => simp
              | succ j ih =>
                have ih' := ih (by omega)
                rw [Finset.prod_range_succ, ← ih']
                obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩
                rw [hm, Finset.prod_range_succ, show n - (j + 1) = m by omega]
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 43–54 at 879b5c03f7df ↗

        1. hrem_all.id1_test.s1 case routine: simp

          Leaves (∏ i ∈ Finset.range (0 : ℕ), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (0 : ℕ)), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with hj : (0 : ℕ) ≤ n.

          Uses library Nat.zero Zero, the smallest natural number. .

          Lean, line 48
                | zero => simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 48 at 879b5c03f7df ↗

        2. hrem_all.id1_test.s2 case

          Leaves (∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with j : ℕ, ih : j ≤ n → (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), hj : j + (1 : ℕ) ≤ n.

          Uses library Nat.succ The successor of a natural number n. , Finset.prod_range_succ.

          Lean, lines 49–54
                | succ j ih =>
                  have ih' := ih (by omega)
                  rw [Finset.prod_range_succ, ← ih']
                  obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩
                  rw [hm, Finset.prod_range_succ, show n - (j + 1) = m by omega]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 49–54 at 879b5c03f7df ↗

          1. hrem_all.id1_test.s2.ih' have (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

            Leaves (∏ i ∈ Finset.range (j + (1 : ℕ)), ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with ih' : (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

            Lean, line 50
                    have ih' := ih (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 50 at 879b5c03f7df ↗

          2. hrem_all.id1_test.s2.s2 obtain ∃ (m : ℕ), n - j = m + (1 : ℕ)

            Leaves (∏ x ∈ Finset.range j, ((2 : ℚ) ^ (n - x) - (1 : ℚ))) * ((2 : ℚ) ^ (n - j) - (1 : ℚ)) * ∏ s ∈ Finset.range (n - (j + (1 : ℕ))), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with m : ℕ, hm : n - j = m + (1 : ℕ).

            Uses library Exists.intro Existential introduction. .

            Lean, line 52
                    obtain ⟨m, hm⟩ : ∃ m, n - j = m + 1 := ⟨n - j - 1, by omega⟩

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 52 at 879b5c03f7df ↗

      2. hrem_all.lower_test have ∀ (j : ℕ), ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with lower_test : ∀ (j : ℕ), ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum, Finset.prod_range_reflect.

        Lean, lines 56–70
            have lower_test : ∀ (j : ℕ),
                ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) =
                  2 ^ (j * (j - 1) / 2) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1) := by
              intro j
              have h1 : ∀ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) = 2 ^ i * (2 ^ (j - 1 - i + 1) - 1) := by
                intro i hi
                have hi' := Finset.mem_range.mp hi
                rw [mul_sub, ← pow_add, show i + (j - 1 - i + 1) = j by omega]
                ring
              rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum,
                Finset.prod_range_reflect (fun s => ((2 : ℚ) ^ (s + 1) - 1)) j]
              congr 1
              congr 1
              have := Finset.sum_range_id_mul_two j
              omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 56–70 at 879b5c03f7df ↗

        1. hrem_all.lower_test.h1 have ∀ i ∈ Finset.range j, (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ))

          Leaves ∏ i ∈ Finset.range j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ i ∈ Finset.range j, (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ)).

          Uses library Finset.range range n is the set of natural numbers less than n. , mul_sub Alias of mul_sub_left_distrib. , pow_add.

          Lean, lines 60–64
                have h1 : ∀ i ∈ Finset.range j, ((2 : ℚ) ^ j - 2 ^ i) = 2 ^ i * (2 ^ (j - 1 - i + 1) - 1) := by
                  intro i hi
                  have hi' := Finset.mem_range.mp hi
                  rw [mul_sub, ← pow_add, show i + (j - 1 - i + 1) = j by omega]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 60–64 at 879b5c03f7df ↗

          1. hrem_all.lower_test.h1.hi' have i < j

            Leaves (2 : ℚ) ^ j - (2 : ℚ) ^ i = (2 : ℚ) ^ i * ((2 : ℚ) ^ (j - (1 : ℕ) - i + (1 : ℕ)) - (1 : ℚ)), with hi' : i < j.

            Uses library Finset.mem_range.

            Lean, line 62
                    have hi' := Finset.mem_range.mp hi

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 62 at 879b5c03f7df ↗

        2. hrem_all.lower_test.this have (∑ i ∈ Finset.range j, i) * (2 : ℕ) = j * (j - (1 : ℕ))

          Leaves ∑ i ∈ Finset.range j, i = j * (j - (1 : ℕ)) / (2 : ℕ), with this : (∑ i ∈ Finset.range j, i) * (2 : ℕ) = j * (j - (1 : ℕ)).

          Uses library Finset.sum_range_id_mul_two Gauss' summation formula .

          Lean, line 69
                have := Finset.sum_range_id_mul_two j

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 69 at 879b5c03f7df ↗

      3. hrem_all.upper_test have ∀ (j n : ℕ), j ≤ n → ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with upper_test : ∀ (j n : ℕ), j ≤ n → ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Finset.prod_Ico_eq_prod_range, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range, pow_mul.

        Lean, lines 72–84
            have upper_test : ∀ (j n : ℕ) (hj : j ≤ n),
                ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - 2 ^ i) =
                  (-1) ^ (n - j) * 2 ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
              intro j n hj
              have e : Finset.Ioc j n = Finset.Ico (j + 1) (n + 1) := by
                ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
              rw [e, Finset.prod_Ico_eq_prod_range, show n + 1 - (j + 1) = n - j by omega]
              have h1 : ∀ t ∈ Finset.range (n - j), ((2 : ℚ) ^ j - 2 ^ (j + 1 + t)) = (-1) * 2 ^ j * (2 ^ (t + 1) - 1) := by
                intro t _
                rw [show j + 1 + t = j + (t + 1) by ring, pow_add]
                ring
              rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
                Finset.prod_const, Finset.card_range, ← pow_mul]

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 72–84 at 879b5c03f7df ↗

        1. hrem_all.upper_test.e have Finset.Ioc j n = Finset.Ico (j + (1 : ℕ)) (n + (1 : ℕ))

          Leaves ∏ i ∈ Finset.Ioc j n, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with e : Finset.Ioc j n = Finset.Ico (j + (1 : ℕ)) (n + (1 : ℕ)).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ioc, Finset.mem_Ico.

          Lean, lines 76–77
                have e : Finset.Ioc j n = Finset.Ico (j + 1) (n + 1) := by
                  ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 76–77 at 879b5c03f7df ↗

        2. hrem_all.upper_test.h1 have ∀ t ∈ Finset.range (n - j), (2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (t + (1 : ℕ)) - (1 : ℚ))

          Leaves ∏ k ∈ Finset.range (n - j), ((2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + k)) = (-1 : ℚ) ^ (n - j) * (2 : ℚ) ^ (j * (n - j)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ t ∈ Finset.range (n - j), (2 : ℚ) ^ j - (2 : ℚ) ^ (j + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (t + (1 : ℕ)) - (1 : ℚ)).

          Uses library Finset.range range n is the set of natural numbers less than n. , pow_add.

          Lean, lines 79–82
                have h1 : ∀ t ∈ Finset.range (n - j), ((2 : ℚ) ^ j - 2 ^ (j + 1 + t)) = (-1) * 2 ^ j * (2 ^ (t + 1) - 1) := by
                  intro t _
                  rw [show j + 1 + t = j + (t + 1) by ring, pow_add]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 79–82 at 879b5c03f7df ↗

      4. hrem_all.rhs_test have ∀ (j n : ℕ), j ≤ n → (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with rhs_test : ∀ (j n : ℕ), j ≤ n → (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , Finset.prod_Ico_eq_prod_range, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range, pow_mul, Finset.prod_range_add.

        Lean, lines 86–102
            have rhs_test : ∀ (j n : ℕ) (hj : j ≤ n),
                (∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K)) *
                  ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1) =
                  (-1) ^ n * 2 ^ (j * n) * ∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1) := by
              intro j n hj
              have e : Finset.Ioc n (2 * n) = Finset.Ico (n + 1) (2 * n + 1) := by
                ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega
              rw [e, Finset.prod_Ico_eq_prod_range, show 2 * n + 1 - (n + 1) = n by omega]
              have h1 : ∀ t ∈ Finset.range n, ((2 : ℚ) ^ j - 2 ^ (n + 1 + t)) =
                  (-1) * 2 ^ j * (2 ^ ((n - j) + t + 1) - 1) := by
                intro t _
                rw [show n + 1 + t = j + ((n - j) + t + 1) by omega, pow_add]
                ring
              rw [Finset.prod_congr rfl h1, Finset.prod_mul_distrib, Finset.prod_mul_distrib, Finset.prod_const,
                Finset.prod_const, Finset.card_range, ← pow_mul,
                show 2 * n - j = (n - j) + n by omega, Finset.prod_range_add]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 86–102 at 879b5c03f7df ↗

        1. hrem_all.rhs_test.e have Finset.Ioc n ((2 : ℕ) * n) = Finset.Ico (n + (1 : ℕ)) ((2 : ℕ) * n + (1 : ℕ))

          Leaves (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with e : Finset.Ioc n ((2 : ℕ) * n) = Finset.Ico (n + (1 : ℕ)) ((2 : ℕ) * n + (1 : ℕ)).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , Finset.mem_Ioc, Finset.mem_Ico.

          Lean, lines 91–92
                have e : Finset.Ioc n (2 * n) = Finset.Ico (n + 1) (2 * n + 1) := by
                  ext x; simp only [Finset.mem_Ioc, Finset.mem_Ico]; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 91–92 at 879b5c03f7df ↗

        2. hrem_all.rhs_test.h1 have ∀ t ∈ Finset.range n, (2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (n - j + t + (1 : ℕ)) - (1 : ℚ))

          Leaves (∏ k ∈ Finset.range n, ((2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + k))) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)), with h1 : ∀ t ∈ Finset.range n, (2 : ℚ) ^ j - (2 : ℚ) ^ (n + (1 : ℕ) + t) = (-1 : ℚ) * (2 : ℚ) ^ j * ((2 : ℚ) ^ (n - j + t + (1 : ℕ)) - (1 : ℚ)).

          Uses library Finset.range range n is the set of natural numbers less than n. , pow_add.

          Lean, lines 94–98
                have h1 : ∀ t ∈ Finset.range n, ((2 : ℚ) ^ j - 2 ^ (n + 1 + t)) =
                    (-1) * 2 ^ j * (2 ^ ((n - j) + t + 1) - 1) := by
                  intro t _
                  rw [show n + 1 + t = j + ((n - j) + t + 1) by omega, pow_add]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 94–98 at 879b5c03f7df ↗

      5. hrem_all.id1_full have ∀ (n j : ℕ), j ≤ n → (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with id1_full : ∀ (n j : ℕ), j ≤ n → (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.prod_union, mul_right_cancel₀, pow_add.

        Lean, lines 104–147
            have id1_full : ∀ (n j : ℕ) (hj : j ≤ n),
                (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) *
                      ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                    ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                  2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
                ∏ K ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ K) := by
              intro n j hj
              have hPne : ∀ m : ℕ, ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + 1) - 1) ≠ 0 := by
                intro m
                refine Finset.prod_ne_zero_iff.mpr (fun s _ => ?_)
                have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                  (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) /
                    ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1)) := by
                rw [Finset.prod_div_distrib, ← id1_test n j hj]
                field_simp [hPne]
              have hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                  (∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1)) /
                    ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) := by
                rw [Finset.prod_div_distrib, ← id1_test (2 * n - j) n (by omega), show 2 * n - j - n = n - j by omega]
                field_simp [hPne]
              have hsplit : (Finset.range (n + 1)).erase j = Finset.range j ∪ Finset.Ioc j n := by
                ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega
              have hdisj : Disjoint (Finset.range j) (Finset.Ioc j n) := by
                rw [Finset.disjoint_left]
                intro x hx hx'
                simp only [Finset.mem_range, Finset.mem_Ioc] at hx hx'
                omega
              have hR := rhs_test j n hj
              obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hj
              have hsign : (-1 : ℚ) ^ (j + m) = (-1) ^ j * (-1) ^ (j + m - j) := by
                rw [← pow_add]; congr 1; omega
              have ha : 2 * (j * (j - 1) / 2) = j * (j - 1) := Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)
              have hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j) := by
                rw [show j + m - j = m by omega]
                rcases j with _ | i
                · simp
                · simp only [Nat.add_sub_cancel] at ha ⊢
                  nlinarith [ha]
              rw [hG1, hG2, hsplit, Finset.prod_union hdisj, lower_test, upper_test j (j + m) hj]
              apply mul_right_cancel₀ (hPne (j + m - j))
              rw [hR, hsign, hexp, pow_add, pow_add, pow_add]
              field_simp [hPne]

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 104–147 at 879b5c03f7df ↗

        1. hrem_all.id1_full.hPne have ∀ (m : ℕ), ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ)

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hPne : ∀ (m : ℕ), ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) ≠ (0 : ℚ).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_ne_zero_iff.

          Lean, lines 111–115
                have hPne : ∀ m : ℕ, ∏ s ∈ Finset.range m, ((2 : ℚ) ^ (s + 1) - 1) ≠ 0 := by
                  intro m
                  refine Finset.prod_ne_zero_iff.mpr (fun s _ => ?_)
                  have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 111–115 at 879b5c03f7df ↗

          1. hrem_all.id1_full.hPne.this have (1 : ℚ) < (2 : ℚ) ^ (s + (1 : ℕ))

            Leaves (2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (s + (1 : ℕ)).

            Uses library one_lt_pow₀.

            Lean, line 114
                    have : (1 : ℚ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 114 at 879b5c03f7df ↗

        2. hrem_all.id1_full.hG1 have ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)))

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_div_distrib.

          Lean, lines 116–120
                have hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                    (∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) /
                      ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + 1) - 1)) := by
                  rw [Finset.prod_div_distrib, ← id1_test n j hj]
                  field_simp [hPne]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 116–120 at 879b5c03f7df ↗

        3. hrem_all.id1_full.hG2 have ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)))

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_div_distrib.

          Lean, lines 121–125
                have hG2 : ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) =
                    (∏ s ∈ Finset.range (2 * n - j), ((2 : ℚ) ^ (s + 1) - 1)) /
                      ((∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + 1) - 1)) * ∏ s ∈ Finset.range n, ((2 : ℚ) ^ (s + 1) - 1)) := by
                  rw [Finset.prod_div_distrib, ← id1_test (2 * n - j) n (by omega), show 2 * n - j - n = n - j by omega]
                  field_simp [hPne]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 121–125 at 879b5c03f7df ↗

        4. hrem_all.id1_full.hsplit have (Finset.range (n + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j n

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hsplit : (Finset.range (n + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j n.

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc.

          Lean, lines 126–127
                have hsplit : (Finset.range (n + 1)).erase j = Finset.range j ∪ Finset.Ioc j n := by
                  ext x; simp only [Finset.mem_erase, Finset.mem_range, Finset.mem_union, Finset.mem_Ioc]; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 126–127 at 879b5c03f7df ↗

        5. hrem_all.id1_full.hdisj have Disjoint (Finset.range j) (Finset.Ioc j n)

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hdisj : Disjoint (Finset.range j) (Finset.Ioc j n).

          Uses library Disjoint Two elements of a lattice are disjoint if their inf is the bottom element. , Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.disjoint_left, Finset.mem_range, Finset.mem_Ioc.

          Lean, lines 128–132
                have hdisj : Disjoint (Finset.range j) (Finset.Ioc j n) := by
                  rw [Finset.disjoint_left]
                  intro x hx hx'
                  simp only [Finset.mem_range, Finset.mem_Ioc] at hx hx'
                  omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 128–132 at 879b5c03f7df ↗

        6. hrem_all.id1_full.hR have (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hR : (∏ K ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ n * (2 : ℚ) ^ (j * n) * ∏ s ∈ Finset.range ((2 : ℕ) * n - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

          Lean, line 133
                have hR := rhs_test j n hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 133 at 879b5c03f7df ↗

        7. hrem_all.id1_full.s7 obtain ∃ (k : ℕ), n = j + k

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with m : ℕ, hj : j ≤ j + m, hG1 : ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range (j + m), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range j, ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))), hG2 : ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)) = (∏ s ∈ Finset.range ((2 : ℕ) * (j + m) - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) / ((∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))) * ∏ s ∈ Finset.range (j + m), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ))), hsplit : (Finset.range (j + m + (1 : ℕ))).erase j = Finset.range j ∪ Finset.Ioc j (j + m), hdisj : Disjoint (Finset.range j) (Finset.Ioc j (j + m)), hR : (∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K)) * ∏ s ∈ Finset.range (j + m - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)) = (-1 : ℚ) ^ (j + m) * (2 : ℚ) ^ (j * (j + m)) * ∏ s ∈ Finset.range ((2 : ℕ) * (j + m) - j), ((2 : ℚ) ^ (s + (1 : ℕ)) - (1 : ℚ)).

          Uses library Nat.exists_eq_add_of_le.

          Lean, line 134
                obtain ⟨m, rfl⟩ := Nat.exists_eq_add_of_le hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 134 at 879b5c03f7df ↗

        8. hrem_all.id1_full.hsign have (-1 : ℚ) ^ (j + m) = (-1 : ℚ) ^ j * (-1 : ℚ) ^ (j + m - j)

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hsign : (-1 : ℚ) ^ (j + m) = (-1 : ℚ) ^ j * (-1 : ℚ) ^ (j + m - j).

          Uses library pow_add.

          Lean, lines 135–136
                have hsign : (-1 : ℚ) ^ (j + m) = (-1) ^ j * (-1) ^ (j + m - j) := by
                  rw [← pow_add]; congr 1; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 135–136 at 879b5c03f7df ↗

        9. hrem_all.id1_full.ha have (2 : ℕ) * (j * (j - (1 : ℕ)) / (2 : ℕ)) = j * (j - (1 : ℕ))

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with ha : (2 : ℕ) * (j * (j - (1 : ℕ)) / (2 : ℕ)) = j * (j - (1 : ℕ)).

          Uses library Nat.two_mul_div_two_of_even, Nat.even_mul_pred_self.

          Lean, line 137
                have ha : 2 * (j * (j - 1) / 2) = j * (j - 1) := Nat.two_mul_div_two_of_even (Nat.even_mul_pred_self _)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 137 at 879b5c03f7df ↗

        10. hrem_all.id1_full.hexp have j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j)

          Leaves (((-1 : ℚ) ^ j * (2 : ℚ) ^ (j * (j - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range j, ((2 : ℚ) ^ (j + m - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range (j + m), ((2 : ℚ) ^ ((2 : ℕ) * (j + m) - j - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (j + m + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ K ∈ Finset.Ioc (j + m) ((2 : ℕ) * (j + m)), ((2 : ℚ) ^ j - (2 : ℚ) ^ K), with hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j).

          Lean, lines 138–143
                have hexp : j * (j + m) = j * (j - (1 : ℕ)) / (2 : ℕ) + j + j * (j - (1 : ℕ)) / (2 : ℕ) + j * (j + m - j) := by
                  rw [show j + m - j = m by omega]
                  rcases j with _ | i
                  · simp
                  · simp only [Nat.add_sub_cancel] at ha ⊢
                    nlinarith [ha]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 138–143 at 879b5c03f7df ↗

          1. hrem_all.id1_full.hexp.s1 case routine: simp

            Leaves (0 : ℕ) * ((0 : ℕ) + m) = (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) + (0 : ℕ) * ((0 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (0 : ℕ) * m.

            Lean, line 141
                    · simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 141 at 879b5c03f7df ↗

          2. hrem_all.id1_full.hexp.s2 case routine: simp, nlinarith

            Leaves (i + (1 : ℕ)) * (i + (1 : ℕ) + m) = (i + (1 : ℕ)) * (i + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (i + (1 : ℕ)) + (i + (1 : ℕ)) * (i + (1 : ℕ) - (1 : ℕ)) / (2 : ℕ) + (i + (1 : ℕ)) * m.

            Uses library Nat.add_sub_cancel.

            Lean, lines 142–143
                    · simp only [Nat.add_sub_cancel] at ha ⊢
                      nlinarith [ha]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 142–143 at 879b5c03f7df ↗

      6. hrem_all.lagr_eval have ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with lagr_eval : ∀ (n : ℕ) (x : ℕ → ℚ), (∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j) → ∀ (N : Polynomial ℚ), N.degree ≤ (↑n : WithBot ℕ) → ∀ (r : ℕ → ℚ), (∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N) → N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.C C a is the constant polynomial a. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq.

        Lean, lines 150–183
            have lagr_eval : ∀ (n : ℕ) (x : ℕ → ℚ) (hx : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j)
              (N : ℚ[X]) (hNdeg : N.degree ≤ n) (r : ℕ → ℚ)
              (hr : ∀ j ≤ n, r j * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j)),
                N = ∑ j ∈ Finset.range (n + 1), C (r j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)) := by
              intro n x hx N hNdeg r hr
              have hinj : Set.InjOn x (Finset.range (n + 1) : Set ℕ) := by
                intro i hi j hj h
                simp only [Finset.coe_range, Set.mem_Iio] at hi hj
                exact hx i (by omega) j (by omega) h
              apply Polynomial.eq_of_degree_sub_lt_of_eval_finset_eq ((Finset.range (n + 1)).image x)
              · rw [Finset.card_image_of_injOn hinj, Finset.card_range]
                refine lt_of_le_of_lt (Polynomial.degree_sub_le _ _) (max_lt ?_ ?_)
                · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)
                · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                  rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                  intro j hj
                  refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                  refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                  have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                    rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                      Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                    simp
                  rw [this, zero_add]
                  exact_mod_cast Nat.lt_succ_self n
              · intro y hy
                obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy
                have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega
                rw [← hr k hk', Polynomial.eval_finset_sum, Finset.sum_eq_single k]
                · simp [Polynomial.eval_prod]
                · intro j hj hjk
                  simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                    Polynomial.eval_X]
                  rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]
                · intro h; exact absurd hk h

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 150–183 at 879b5c03f7df ↗

        1. hrem_all.lagr_eval.hinj have Set.InjOn x (↑(Finset.range (n + (1 : ℕ))) : Set ℕ)

          Leaves N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)), with hinj : Set.InjOn x (↑(Finset.range (n + (1 : ℕ))) : Set ℕ).

          Uses library Set.InjOn f is injective on s if the restriction of f to s is injective. , Finset.range range n is the set of natural numbers less than n. , Set A set is a collection of elements of some type α. , Finset.coe_range, Set.mem_Iio.

          Lean, lines 155–158
                have hinj : Set.InjOn x (Finset.range (n + 1) : Set ℕ) := by
                  intro i hi j hj h
                  simp only [Finset.coe_range, Set.mem_Iio] at hi hj
                  exact hx i (by omega) j (by omega) h

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 155–158 at 879b5c03f7df ↗

        2. hrem_all.lagr_eval.s2 case

          Leaves (N - ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).degree < (↑(Finset.image x (Finset.range (n + (1 : ℕ)))).card : WithBot ℕ).

          Uses library Finset.card_image_of_injOn, Finset.card_range, lt_of_le_of_lt, Polynomial.degree_sub_le, max_lt.

          Lean, lines 160–173
                · rw [Finset.card_image_of_injOn hinj, Finset.card_range]
                  refine lt_of_le_of_lt (Polynomial.degree_sub_le _ _) (max_lt ?_ ?_)
                  · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)
                  · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                    rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                    intro j hj
                    refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                    refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                    have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                      rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                        Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                      simp
                    rw [this, zero_add]
                    exact_mod_cast Nat.lt_succ_self n

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 160–173 at 879b5c03f7df ↗

          1. hrem_all.lagr_eval.s2.s1 case

            Leaves N.degree < (↑(n + (1 : ℕ)) : WithBot ℕ).

            Uses library lt_of_le_of_lt, Nat.lt_succ_self.

            Lean, line 162
                    · exact lt_of_le_of_lt hNdeg (by exact_mod_cast Nat.lt_succ_self n)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 162 at 879b5c03f7df ↗

          2. hrem_all.lagr_eval.s2.s2 case

            Leaves (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).degree < (↑(n + (1 : ℕ)) : WithBot ℕ).

            Uses library lt_of_le_of_lt, Polynomial.degree_sum_le, Finset.sup_lt_iff, WithBot.bot_lt_coe, Polynomial.degree_mul_le, add_le_add, Polynomial.degree_C_le, Polynomial.degree_prod_le, zero_add, Nat.lt_succ_self.

            Lean, lines 163–173
                    · refine lt_of_le_of_lt (Polynomial.degree_sum_le _ _) ?_
                      rw [Finset.sup_lt_iff (by exact WithBot.bot_lt_coe _)]
                      intro j hj
                      refine lt_of_le_of_lt (Polynomial.degree_mul_le _ _) ?_
                      refine lt_of_le_of_lt (add_le_add (Polynomial.degree_C_le) (Polynomial.degree_prod_le _ _)) ?_
                      have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                        rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                          Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                        simp
                      rw [this, zero_add]
                      exact_mod_cast Nat.lt_succ_self n

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 163–173 at 879b5c03f7df ↗

            1. hrem_all.lagr_eval.s2.s2.this have ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree = (↑n : WithBot ℕ)

              Leaves (0 : WithBot ℕ) + ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree < (↑(n + (1 : ℕ)) : WithBot ℕ), with this : ∑ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).degree = (↑n : WithBot ℕ).

              Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , WithBot Attach ⊥ to a type. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.degree_X_sub_C, Finset.sum_const, Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. , Finset.card_range, Nat.add_sub_cancel.

              Lean, lines 168–171
                        have : ∑ i ∈ (Finset.range (n + 1)).erase j, (X - C (x i)).degree = ((n : ℕ) : WithBot ℕ) := by
                          rw [Finset.sum_congr rfl (fun i _ => Polynomial.degree_X_sub_C (x i)), Finset.sum_const,
                            Finset.card_erase_of_mem hj, Finset.card_range, Nat.add_sub_cancel]
                          simp

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 168–171 at 879b5c03f7df ↗

        3. hrem_all.lagr_eval.s3 case

          Leaves ∀ x_1 ∈ Finset.image x (Finset.range (n + (1 : ℕ))), Polynomial.eval x_1 N = Polynomial.eval x_1 (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).

          Uses library Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Finset.sum_eq_single.

          Lean, lines 174–183
                · intro y hy
                  obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy
                  have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega
                  rw [← hr k hk', Polynomial.eval_finset_sum, Finset.sum_eq_single k]
                  · simp [Polynomial.eval_prod]
                  · intro j hj hjk
                    simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                      Polynomial.eval_X]
                    rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]
                  · intro h; exact absurd hk h

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 174–183 at 879b5c03f7df ↗

          1. hrem_all.lagr_eval.s3.s1 obtain ∃ a ∈ Finset.range (n + (1 : ℕ)), x a = y

            Leaves Polynomial.eval (x k) N = Polynomial.eval (x k) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))), with k : ℕ, hk : k ∈ Finset.range (n + (1 : ℕ)), hy : x k ∈ Finset.image x (Finset.range (n + (1 : ℕ))).

            Uses library Finset.mem_image.

            Lean, line 175
                    obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hy

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 175 at 879b5c03f7df ↗

          2. hrem_all.lagr_eval.s3.hk' have k ≤ n

            Leaves Polynomial.eval (x k) N = Polynomial.eval (x k) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (r j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))), with hk' : k ≤ n.

            Lean, line 176
                    have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 176 at 879b5c03f7df ↗

            1. hrem_all.lagr_eval.s3.hk'.this have k < n + (1 : ℕ)

              Leaves k ≤ n, with this : k < n + (1 : ℕ).

              Uses library Finset.mem_range.

              Lean, line 176
                      have hk' : k ≤ n := by have := Finset.mem_range.mp hk; omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 176 at 879b5c03f7df ↗

          3. hrem_all.lagr_eval.s3.s3 case routine: simp

            Leaves r k * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (x k - x i) = Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r k) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).

            Uses library Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod .

            Lean, line 178
                    · simp [Polynomial.eval_prod]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 178 at 879b5c03f7df ↗

          4. hrem_all.lagr_eval.s3.s4 case

            Leaves ∀ b ∈ Finset.range (n + (1 : ℕ)), b ≠ k → Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r b) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase b, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) = (0 : ℚ).

            Uses library Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Finset.prod_eq_zero, Finset.mem_erase, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , Ne.symm, MulZeroClass.mul_zero Zero is a right absorbing element for multiplication .

            Lean, lines 179–182
                    · intro j hj hjk
                      simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                        Polynomial.eval_X]
                      rw [Finset.prod_eq_zero (i := k) (Finset.mem_erase.mpr ⟨Ne.symm hjk, hk⟩) (by ring), mul_zero]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 179–182 at 879b5c03f7df ↗

          5. hrem_all.lagr_eval.s3.s5 case

            Leaves k ∉ Finset.range (n + (1 : ℕ)) → Polynomial.eval (x k) ((Polynomial.C : ℚ → Polynomial ℚ) (r k) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase k, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) = (0 : ℚ).

            Uses library absurd Anything follows from two contradictory hypotheses. .

            Lean, line 183
                    · intro h; exact absurd hk h

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 183 at 879b5c03f7df ↗

      7. hrem_all.tail_coeff have ∀ (n K : ℕ), n < K → ∀ (Qc : ℕ → ℕ → ℚ), (∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ L)) → ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with tail_coeff : ∀ (n K : ℕ), n < K → ∀ (Qc : ℕ → ℕ → ℚ), (∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ L)) → ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.C C a is the constant polynomial a. , Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Finset.sum_div, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Finset.mul_prod_erase Taking a product over s : Finset ι is the same as multiplying the value on a single element f a by the product of s.erase a. .

        Lean, lines 185–237
            have tail_coeff : ∀ (n K : ℕ) (hK : n < K) (Qc : ℕ → ℕ → ℚ)
              (hQc : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
                ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ L)),
                ∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) =
                  (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℚ) ^ K - 2 ^ i) := by
              intro n K hK Qc hQc
              set x : ℕ → ℚ := fun i => (2 : ℚ) ^ i with hxdef
              have hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j := by
                intro i _ j _ h
                have h' : (2 : ℚ) ^ i = 2 ^ j := h
                exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast h')
              have hxne : ∀ a b : ℕ, a ≠ b → (2 : ℚ) ^ a - 2 ^ b ≠ 0 := by
                intro a b hab h
                apply hab
                exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast (sub_eq_zero.mp h))
              set N : ℚ[X] := ∏ L ∈ Finset.Ioc n (2 * n), (X - C ((2 : ℚ) ^ L)) with hN
              have hNdeg : N.degree ≤ n := by
                rw [hN, Polynomial.degree_prod]
                rw [Finset.sum_congr rfl (fun L _ => Polynomial.degree_X_sub_C ((2 : ℚ) ^ L)), Finset.sum_const,
                  Nat.card_Ioc]
                simp
                omega
              have hr : ∀ j ≤ n, (Qc n j * 2 ^ j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j) := by
                intro j hj
                rw [hN, Polynomial.eval_prod]
                simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, hxdef]
                exact hQc j hj
              have hL := lagr_eval n x hxinj N hNdeg (fun j => Qc n j * 2 ^ j) hr
              have hev := congrArg (Polynomial.eval ((2 : ℚ) ^ K)) hL
              rw [Polynomial.eval_finset_sum] at hev
              have hNK : N.eval ((2 : ℚ) ^ K) = ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ K - 2 ^ L) := by
                rw [hN, Polynomial.eval_prod]
                simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C]
              have hD : ∏ i ∈ Finset.range (n + 1), ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
                Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by have := Finset.mem_range.mp hi; omega))
              rw [hNK] at hev
              rw [hev, Finset.sum_div]
              refine Finset.sum_congr rfl (fun j hj => ?_)
              have hjn : j < n + 1 := Finset.mem_range.mp hj
              have hne1 : (2 : ℚ) ^ K - 2 ^ j ≠ 0 := hxne K j (by omega)
              have hne2 : (2 : ℚ) ^ (K - j) - 1 ≠ 0 := by
                have : (1 : ℚ) < 2 ^ (K - j) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              simp only [Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_prod, Polynomial.eval_sub,
                Polynomial.eval_X, hxdef]
              rw [← Finset.mul_prod_erase (Finset.range (n + 1)) (fun i => (2 : ℚ) ^ K - 2 ^ i) hj]
              have hE : ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
                Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by
                  have := Finset.mem_range.mp (Finset.mem_of_mem_erase hi); omega))
              have hpow : (2 : ℚ) ^ K = 2 ^ j * 2 ^ (K - j) := by rw [← pow_add]; congr 1; omega
              field_simp
              rw [hpow]
              ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 185–237 at 879b5c03f7df ↗

        1. hrem_all.tail_coeff.hxinj have ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j.

          Uses library Nat.pow_right_injective, le_refl The relation ≤ on a preorder is reflexive. .

          Lean, lines 192–195
                have hxinj : ∀ i ≤ n, ∀ j ≤ n, x i = x j → i = j := by
                  intro i _ j _ h
                  have h' : (2 : ℚ) ^ i = 2 ^ j := h
                  exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast h')

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 192–195 at 879b5c03f7df ↗

          1. hrem_all.tail_coeff.hxinj.h' have (2 : ℚ) ^ i = (2 : ℚ) ^ j

            Leaves i = j, with h' : (2 : ℚ) ^ i = (2 : ℚ) ^ j.

            Lean, line 194
                    have h' : (2 : ℚ) ^ i = 2 ^ j := h

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 194 at 879b5c03f7df ↗

        2. hrem_all.tail_coeff.hxne have ∀ (a b : ℕ), a ≠ b → (2 : ℚ) ^ a - (2 : ℚ) ^ b ≠ (0 : ℚ)

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hxne : ∀ (a b : ℕ), a ≠ b → (2 : ℚ) ^ a - (2 : ℚ) ^ b ≠ (0 : ℚ).

          Uses library Nat.pow_right_injective, le_refl The relation ≤ on a preorder is reflexive. , sub_eq_zero.

          Lean, lines 196–199
                have hxne : ∀ a b : ℕ, a ≠ b → (2 : ℚ) ^ a - 2 ^ b ≠ 0 := by
                  intro a b hab h
                  apply hab
                  exact Nat.pow_right_injective (le_refl 2) (by exact_mod_cast (sub_eq_zero.mp h))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 196–199 at 879b5c03f7df ↗

        3. hrem_all.tail_coeff.hNdeg have N.degree ≤ (↑n : WithBot ℕ)

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hNdeg : N.degree ≤ (↑n : WithBot ℕ).

          Uses library Polynomial.degree_prod The degree of a product of polynomials is equal to the sum of the degrees, where the degree of the zero polynomial is ⊥. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.degree_X_sub_C, Finset.sum_const, Nat.card_Ioc.

          Lean, lines 201–206
                have hNdeg : N.degree ≤ n := by
                  rw [hN, Polynomial.degree_prod]
                  rw [Finset.sum_congr rfl (fun L _ => Polynomial.degree_X_sub_C ((2 : ℚ) ^ L)), Finset.sum_const,
                    Nat.card_Ioc]
                  simp
                  omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 201–206 at 879b5c03f7df ↗

        4. hrem_all.tail_coeff.hr have ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hr : ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (x j - x i) = Polynomial.eval (x j) N.

          Uses library Finset.range range n is the set of natural numbers less than n. , Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C.

          Lean, lines 207–211
                have hr : ∀ j ≤ n, (Qc n j * 2 ^ j) * ∏ i ∈ (Finset.range (n + 1)).erase j, (x j - x i) = N.eval (x j) := by
                  intro j hj
                  rw [hN, Polynomial.eval_prod]
                  simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C, hxdef]
                  exact hQc j hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 207–211 at 879b5c03f7df ↗

        5. hrem_all.tail_coeff.hL have N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hL : N = ∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)).

          Lean, line 212
                have hL := lagr_eval n x hxinj N hNdeg (fun j => Qc n j * 2 ^ j) hr

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 212 at 879b5c03f7df ↗

        6. hrem_all.tail_coeff.hev have Polynomial.eval ((2 : ℚ) ^ K) N = Polynomial.eval ((2 : ℚ) ^ K) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i)))

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hev : Polynomial.eval ((2 : ℚ) ^ K) N = Polynomial.eval ((2 : ℚ) ^ K) (∑ j ∈ Finset.range (n + (1 : ℕ)), (Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))).

          Uses library congrArg Congruence in the function argument: if a₁ = a₂ then f a₁ = f a₂ for any (nondependent) function f. , Polynomial.eval eval x p is the evaluation of the polynomial p at x .

          Lean, line 213
                have hev := congrArg (Polynomial.eval ((2 : ℚ) ^ K)) hL

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 213 at 879b5c03f7df ↗

        7. hrem_all.tail_coeff.hNK have Polynomial.eval ((2 : ℚ) ^ K) N = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hNK : Polynomial.eval ((2 : ℚ) ^ K) N = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C.

          Lean, lines 215–217
                have hNK : N.eval ((2 : ℚ) ^ K) = ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ K - 2 ^ L) := by
                  rw [hN, Polynomial.eval_prod]
                  simp only [Polynomial.eval_sub, Polynomial.eval_X, Polynomial.eval_C]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 215–217 at 879b5c03f7df ↗

        8. hrem_all.tail_coeff.hD have ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i) ≠ (0 : ℚ)

          Leaves ∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ K - (2 : ℚ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hD : ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i) ≠ (0 : ℚ).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_ne_zero_iff.

          Lean, lines 218–219
                have hD : ∏ i ∈ Finset.range (n + 1), ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
                  Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by have := Finset.mem_range.mp hi; omega))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 218–219 at 879b5c03f7df ↗

          1. hrem_all.tail_coeff.hD.this have i < n + (1 : ℕ)

            Leaves K ≠ i, with this : i < n + (1 : ℕ).

            Uses library Finset.mem_range.

            Lean, line 219
                    Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by have := Finset.mem_range.mp hi; omega))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 219 at 879b5c03f7df ↗

        9. hrem_all.tail_coeff.hjn have j < n + (1 : ℕ)

          Leaves Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = Polynomial.eval ((2 : ℚ) ^ K) ((Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hjn : j < n + (1 : ℕ).

          Uses library Finset.mem_range.

          Lean, line 223
                have hjn : j < n + 1 := Finset.mem_range.mp hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 223 at 879b5c03f7df ↗

        10. hrem_all.tail_coeff.hne1 have (2 : ℚ) ^ K - (2 : ℚ) ^ j ≠ (0 : ℚ)

          Leaves Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = Polynomial.eval ((2 : ℚ) ^ K) ((Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hne1 : (2 : ℚ) ^ K - (2 : ℚ) ^ j ≠ (0 : ℚ).

          Lean, line 224
                have hne1 : (2 : ℚ) ^ K - 2 ^ j ≠ 0 := hxne K j (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 224 at 879b5c03f7df ↗

        11. hrem_all.tail_coeff.hne2 have (2 : ℚ) ^ (K - j) - (1 : ℚ) ≠ (0 : ℚ)

          Leaves Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = Polynomial.eval ((2 : ℚ) ^ K) ((Polynomial.C : ℚ → Polynomial ℚ) (Qc n j * (2 : ℚ) ^ j) * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, (Polynomial.X - (Polynomial.C : ℚ → Polynomial ℚ) (x i))) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℚ) ^ K - (2 : ℚ) ^ i), with hne2 : (2 : ℚ) ^ (K - j) - (1 : ℚ) ≠ (0 : ℚ).

          Lean, lines 225–227
                have hne2 : (2 : ℚ) ^ (K - j) - 1 ≠ 0 := by
                  have : (1 : ℚ) < 2 ^ (K - j) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 225–227 at 879b5c03f7df ↗

          1. hrem_all.tail_coeff.hne2.this have (1 : ℚ) < (2 : ℚ) ^ (K - j)

            Leaves (2 : ℚ) ^ (K - j) - (1 : ℚ) ≠ (0 : ℚ), with this : (1 : ℚ) < (2 : ℚ) ^ (K - j).

            Uses library one_lt_pow₀.

            Lean, line 226
                    have : (1 : ℚ) < 2 ^ (K - j) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 226 at 879b5c03f7df ↗

        12. hrem_all.tail_coeff.hE have ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ i) ≠ (0 : ℚ)

          Leaves Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (Qc n j * (2 : ℚ) ^ j * ∏ x ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ x)) / (((2 : ℚ) ^ K - (2 : ℚ) ^ j) * ∏ x ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ x)), with hE : ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ i) ≠ (0 : ℚ).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_ne_zero_iff.

          Lean, lines 231–233
                have hE : ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ K - 2 ^ i) ≠ 0 :=
                  Finset.prod_ne_zero_iff.mpr (fun i hi => hxne K i (by
                    have := Finset.mem_range.mp (Finset.mem_of_mem_erase hi); omega))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 231–233 at 879b5c03f7df ↗

          1. hrem_all.tail_coeff.hE.this have i < n + (1 : ℕ)

            Leaves K ≠ i, with this : i < n + (1 : ℕ).

            Uses library Finset.mem_range, Finset.mem_of_mem_erase.

            Lean, line 233
                      have := Finset.mem_range.mp (Finset.mem_of_mem_erase hi); omega))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 233 at 879b5c03f7df ↗

        13. hrem_all.tail_coeff.hpow have (2 : ℚ) ^ K = (2 : ℚ) ^ j * (2 : ℚ) ^ (K - j)

          Leaves Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ)) = (Qc n j * (2 : ℚ) ^ j * ∏ x ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ x)) / (((2 : ℚ) ^ K - (2 : ℚ) ^ j) * ∏ x ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ K - (2 : ℚ) ^ x)), with hpow : (2 : ℚ) ^ K = (2 : ℚ) ^ j * (2 : ℚ) ^ (K - j).

          Uses library pow_add.

          Lean, line 234
                have hpow : (2 : ℚ) ^ K = 2 ^ j * 2 ^ (K - j) := by rw [← pow_add]; congr 1; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 234 at 879b5c03f7df ↗

      8. hrem_all.tail3 have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with tail3 : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)).

        Uses library tsum_congr.

        Lean, lines 240–304
            have tail3 : ∀ (n : ℕ) (hn : 1 ≤ n),
                ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) = ∑' s : ℕ, ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) := by
              intro n hn
              set f : ℕ → ℕ → ℝ := fun m s => ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * ((1 : ℝ) / 2 ^ (s + 1)) ^ m with hf
              have key : ∀ m s, f m s = ((3 : ℝ) / 2 ^ (m + n + 1)) ^ (s + 1) := by
                intro m s
                simp only [hf]
                rw [div_pow, div_pow, div_pow, one_pow, ← pow_mul, ← pow_mul, ← pow_mul,
                  show (m + n + 1) * (s + 1) = (n + 1) * (s + 1) + (s + 1) * m by ring, pow_add]
                field_simp
                exact pow_add _ _ _
              have hpos : ∀ m s, 0 ≤ f m s := fun m s => by rw [key]; positivity
              have h4 : ∀ m : ℕ, (4 : ℝ) ≤ 2 ^ (m + n + 1) := by
                intro m
                calc (4 : ℝ) = 2 ^ 2 := by norm_num
                  _ ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
              have inner1 : ∀ m, HasSum (f m) ((3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
                intro m
                have hr0 : 0 ≤ (3 : ℝ) / 2 ^ (m + n + 1) := by positivity
                have hr1 : (3 : ℝ) / 2 ^ (m + n + 1) < 1 := by
                  rw [div_lt_one (by positivity)]; linarith [h4 m]
                have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left ((3 : ℝ) / 2 ^ (m + n + 1))
                have hfun : f m = fun s => (3 : ℝ) / 2 ^ (m + n + 1) * ((3 : ℝ) / 2 ^ (m + n + 1)) ^ s := by
                  funext s; rw [key]; ring
                have hne : (2 : ℝ) ^ (m + n + 1) - 3 ≠ 0 := by linarith [h4 m]
                have hne2 : (2 : ℝ) ^ (m + n + 1) ≠ 0 := by positivity
                have hval : (3 : ℝ) / (2 ^ (m + n + 1) - 3) =
                    3 / 2 ^ (m + n + 1) * (1 - 3 / 2 ^ (m + n + 1))⁻¹ := by
                  field_simp
                rw [hfun, hval]
                exact hg
              have inner2 : ∀ s, HasSum (fun m => f m s) (((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1)) := by
                intro s
                have hr0 : 0 ≤ (1 : ℝ) / 2 ^ (s + 1) := by positivity
                have hr1 : (1 : ℝ) / 2 ^ (s + 1) < 1 := by
                  rw [div_lt_one (by positivity)]
                  exact one_lt_pow₀ (by norm_num) (by omega)
                have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left (((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1))
                have hne : (2 : ℝ) ^ (s + 1) - 1 ≠ 0 := by
                  have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith
                have hval : ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) =
                    ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * (1 - 1 / 2 ^ (s + 1))⁻¹ := by
                  rw [div_pow, div_pow, ← pow_mul, ← pow_mul, show (n + 1) * (s + 1) = n * (s + 1) + (s + 1) by ring, pow_add]
                  field_simp
                  exact pow_add _ _ _
                rw [hval]
                exact hg
              have hsum1 : Summable (fun m : ℕ => (3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
                refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
                · have := h4 m; exact div_nonneg (by norm_num) (by linarith)
                · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                  have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                  have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                  calc (3 : ℝ) / (2 ^ (m + n + 1) - 3) ≤ 3 / 2 ^ m :=
                        div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                    _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring
              have hU : Summable (Function.uncurry f) := by
                refine (summable_prod_of_nonneg (fun p => hpos p.1 p.2)).mpr ⟨fun m => (inner1 m).summable, ?_⟩
                exact hsum1.congr (fun m => ((inner1 m).tsum_eq).symm)
              have hcomm := hU.tsum_comm' (fun m => (inner1 m).summable) (fun s => (inner2 s).summable)
              rw [show (∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3)) = ∑' m, ∑' s, f m s from
                tsum_congr (fun m => ((inner1 m).tsum_eq).symm)]
              rw [← hcomm]
              exact tsum_congr (fun s => (inner2 s).tsum_eq)

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 240–304 at 879b5c03f7df ↗

        1. hrem_all.tail3.key have ∀ (m s : ℕ), f m s = ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ (s + (1 : ℕ))

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with key : ∀ (m s : ℕ), f m s = ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ (s + (1 : ℕ)).

          Uses library div_pow, one_pow, pow_mul, pow_add.

          Lean, lines 244–250
                have key : ∀ m s, f m s = ((3 : ℝ) / 2 ^ (m + n + 1)) ^ (s + 1) := by
                  intro m s
                  simp only [hf]
                  rw [div_pow, div_pow, div_pow, one_pow, ← pow_mul, ← pow_mul, ← pow_mul,
                    show (m + n + 1) * (s + 1) = (n + 1) * (s + 1) + (s + 1) * m by ring, pow_add]
                  field_simp
                  exact pow_add _ _ _

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 244–250 at 879b5c03f7df ↗

        2. hrem_all.tail3.hpos have ∀ (m s : ℕ), (0 : ℝ) ≤ f m s

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with hpos : ∀ (m s : ℕ), (0 : ℝ) ≤ f m s.

          Lean, line 251
                have hpos : ∀ m s, 0 ≤ f m s := fun m s => by rw [key]; positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 251 at 879b5c03f7df ↗

        3. hrem_all.tail3.h4 have ∀ (m : ℕ), (4 : ℝ) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ))

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with h4 : ∀ (m : ℕ), (4 : ℝ) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ)).

          Lean, lines 252–255
                have h4 : ∀ m : ℕ, (4 : ℝ) ≤ 2 ^ (m + n + 1) := by
                  intro m
                  calc (4 : ℝ) = 2 ^ 2 := by norm_num
                    _ ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 252–255 at 879b5c03f7df ↗

          1. hrem_all.tail3.h4.s1 calc (4 : ℝ) = (2 : ℝ) ^ (2 : ℕ) routine: norm_num

            Closes the goal.

            Lean, line 254
                    calc (4 : ℝ) = 2 ^ 2 := by norm_num

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 254 at 879b5c03f7df ↗

          2. hrem_all.tail3.h4.s2 calc (2 : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ))

            Closes the goal.

            Uses library pow_le_pow_right₀.

            Lean, line 255
                      _ ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 255 at 879b5c03f7df ↗

        4. hrem_all.tail3.inner1 have ∀ (m : ℕ), HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)))

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with inner1 : ∀ (m : ℕ), HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))).

          Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. .

          Lean, lines 256–270
                have inner1 : ∀ m, HasSum (f m) ((3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
                  intro m
                  have hr0 : 0 ≤ (3 : ℝ) / 2 ^ (m + n + 1) := by positivity
                  have hr1 : (3 : ℝ) / 2 ^ (m + n + 1) < 1 := by
                    rw [div_lt_one (by positivity)]; linarith [h4 m]
                  have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left ((3 : ℝ) / 2 ^ (m + n + 1))
                  have hfun : f m = fun s => (3 : ℝ) / 2 ^ (m + n + 1) * ((3 : ℝ) / 2 ^ (m + n + 1)) ^ s := by
                    funext s; rw [key]; ring
                  have hne : (2 : ℝ) ^ (m + n + 1) - 3 ≠ 0 := by linarith [h4 m]
                  have hne2 : (2 : ℝ) ^ (m + n + 1) ≠ 0 := by positivity
                  have hval : (3 : ℝ) / (2 ^ (m + n + 1) - 3) =
                      3 / 2 ^ (m + n + 1) * (1 - 3 / 2 ^ (m + n + 1))⁻¹ := by
                    field_simp
                  rw [hfun, hval]
                  exact hg

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 256–270 at 879b5c03f7df ↗

          1. hrem_all.tail3.inner1.hr0 have (0 : ℝ) ≤ (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) routine: positivity

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hr0 : (0 : ℝ) ≤ (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)).

            Lean, line 258
                    have hr0 : 0 ≤ (3 : ℝ) / 2 ^ (m + n + 1) := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 258 at 879b5c03f7df ↗

          2. hrem_all.tail3.inner1.hr1 have (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) < (1 : ℝ)

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hr1 : (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) < (1 : ℝ).

            Uses library div_lt_one.

            Lean, lines 259–260
                    have hr1 : (3 : ℝ) / 2 ^ (m + n + 1) < 1 := by
                      rw [div_lt_one (by positivity)]; linarith [h4 m]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 259–260 at 879b5c03f7df ↗

          3. hrem_all.tail3.inner1.hg have HasSum (fun (i : ℕ) => (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ i) ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((1 : ℝ) - (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)))⁻¹)

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hg : HasSum (fun (i : ℕ) => (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ i) ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((1 : ℝ) - (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)))⁻¹).

            Uses library hasSum_geometric_of_lt_one.

            Lean, line 261
                    have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left ((3 : ℝ) / 2 ^ (m + n + 1))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 261 at 879b5c03f7df ↗

          4. hrem_all.tail3.inner1.hfun have f m = fun (s : ℕ) => (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ s

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hfun : f m = fun (s : ℕ) => (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ))) ^ s.

            Lean, lines 262–263
                    have hfun : f m = fun s => (3 : ℝ) / 2 ^ (m + n + 1) * ((3 : ℝ) / 2 ^ (m + n + 1)) ^ s := by
                      funext s; rw [key]; ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 262–263 at 879b5c03f7df ↗

          5. hrem_all.tail3.inner1.hne have (2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ) ≠ (0 : ℝ) routine: linarith

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hne : (2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ) ≠ (0 : ℝ).

            Lean, line 264
                    have hne : (2 : ℝ) ^ (m + n + 1) - 3 ≠ 0 := by linarith [h4 m]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 264 at 879b5c03f7df ↗

          6. hrem_all.tail3.inner1.hne2 have (2 : ℝ) ^ (m + n + (1 : ℕ)) ≠ (0 : ℝ) routine: positivity

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hne2 : (2 : ℝ) ^ (m + n + (1 : ℕ)) ≠ (0 : ℝ).

            Lean, line 265
                    have hne2 : (2 : ℝ) ^ (m + n + 1) ≠ 0 := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 265 at 879b5c03f7df ↗

          7. hrem_all.tail3.inner1.hval have (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((1 : ℝ) - (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)))⁻¹ routine: field_simp

            Leaves HasSum (f m) ((3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))), with hval : (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)) * ((1 : ℝ) - (3 : ℝ) / (2 : ℝ) ^ (m + n + (1 : ℕ)))⁻¹.

            Lean, lines 266–268
                    have hval : (3 : ℝ) / (2 ^ (m + n + 1) - 3) =
                        3 / 2 ^ (m + n + 1) * (1 - 3 / 2 ^ (m + n + 1))⁻¹ := by
                      field_simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 266–268 at 879b5c03f7df ↗

        5. hrem_all.tail3.inner2 have ∀ (s : ℕ), HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)))

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with inner2 : ∀ (s : ℕ), HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))).

          Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. .

          Lean, lines 271–287
                have inner2 : ∀ s, HasSum (fun m => f m s) (((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1)) := by
                  intro s
                  have hr0 : 0 ≤ (1 : ℝ) / 2 ^ (s + 1) := by positivity
                  have hr1 : (1 : ℝ) / 2 ^ (s + 1) < 1 := by
                    rw [div_lt_one (by positivity)]
                    exact one_lt_pow₀ (by norm_num) (by omega)
                  have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left (((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1))
                  have hne : (2 : ℝ) ^ (s + 1) - 1 ≠ 0 := by
                    have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                    linarith
                  have hval : ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) =
                      ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * (1 - 1 / 2 ^ (s + 1))⁻¹ := by
                    rw [div_pow, div_pow, ← pow_mul, ← pow_mul, show (n + 1) * (s + 1) = n * (s + 1) + (s + 1) by ring, pow_add]
                    field_simp
                    exact pow_add _ _ _
                  rw [hval]
                  exact hg

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 271–287 at 879b5c03f7df ↗

          1. hrem_all.tail3.inner2.hr0 have (0 : ℝ) ≤ (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)) routine: positivity

            Leaves HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))), with hr0 : (0 : ℝ) ≤ (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)).

            Lean, line 273
                    have hr0 : 0 ≤ (1 : ℝ) / 2 ^ (s + 1) := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 273 at 879b5c03f7df ↗

          2. hrem_all.tail3.inner2.hr1 have (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)) < (1 : ℝ)

            Leaves HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))), with hr1 : (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)) < (1 : ℝ).

            Uses library div_lt_one, one_lt_pow₀.

            Lean, lines 274–276
                    have hr1 : (1 : ℝ) / 2 ^ (s + 1) < 1 := by
                      rw [div_lt_one (by positivity)]
                      exact one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 274–276 at 879b5c03f7df ↗

          3. hrem_all.tail3.inner2.hg have HasSum (fun (i : ℕ) => ((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ))) ^ i) (((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) - (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)))⁻¹)

            Leaves HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))), with hg : HasSum (fun (i : ℕ) => ((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ))) ^ i) (((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) - (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)))⁻¹).

            Uses library hasSum_geometric_of_lt_one.

            Lean, line 277
                    have hg := (hasSum_geometric_of_lt_one hr0 hr1).mul_left (((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 277 at 879b5c03f7df ↗

          4. hrem_all.tail3.inner2.hne have (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ) ≠ (0 : ℝ)

            Leaves HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))), with hne : (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ) ≠ (0 : ℝ).

            Lean, lines 278–280
                    have hne : (2 : ℝ) ^ (s + 1) - 1 ≠ 0 := by
                      have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                      linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 278–280 at 879b5c03f7df ↗

            1. hrem_all.tail3.inner2.hne.this have (1 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ))

              Leaves (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ) ≠ (0 : ℝ), with this : (1 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ)).

              Uses library one_lt_pow₀.

              Lean, line 279
                        have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 279 at 879b5c03f7df ↗

          5. hrem_all.tail3.inner2.hval have ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)) = ((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) - (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)))⁻¹

            Leaves HasSum (fun (m : ℕ) => f m s) (((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ))), with hval : ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)) = ((3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))) ^ (s + (1 : ℕ)) * ((1 : ℝ) - (1 : ℝ) / (2 : ℝ) ^ (s + (1 : ℕ)))⁻¹.

            Uses library div_pow, pow_mul, pow_add.

            Lean, lines 281–285
                    have hval : ((3 : ℝ) / 2 ^ n) ^ (s + 1) / (2 ^ (s + 1) - 1) =
                        ((3 : ℝ) / 2 ^ (n + 1)) ^ (s + 1) * (1 - 1 / 2 ^ (s + 1))⁻¹ := by
                      rw [div_pow, div_pow, ← pow_mul, ← pow_mul, show (n + 1) * (s + 1) = n * (s + 1) + (s + 1) by ring, pow_add]
                      field_simp
                      exact pow_add _ _ _

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 281–285 at 879b5c03f7df ↗

        6. hrem_all.tail3.hsum1 have Summable fun (m : ℕ) => (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with hsum1 : Summable fun (m : ℕ) => (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)).

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Summable.of_nonneg_of_le Comparison test of convergence of series of non-negative real numbers. , summable_geometric_two.

          Lean, lines 288–296
                have hsum1 : Summable (fun m : ℕ => (3 : ℝ) / (2 ^ (m + n + 1) - 3)) := by
                  refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
                  · have := h4 m; exact div_nonneg (by norm_num) (by linarith)
                  · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                    have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                    have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                    calc (3 : ℝ) / (2 ^ (m + n + 1) - 3) ≤ 3 / 2 ^ m :=
                          div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                      _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 288–296 at 879b5c03f7df ↗

          1. hrem_all.tail3.hsum1.s1 case

            Leaves (0 : ℝ) ≤ (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)).

            Uses library div_nonneg.

            Lean, line 290
                    · have := h4 m; exact div_nonneg (by norm_num) (by linarith)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 290 at 879b5c03f7df ↗

            1. hrem_all.tail3.hsum1.s1.this have (4 : ℝ) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ))

              Leaves (0 : ℝ) ≤ (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with this : (4 : ℝ) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ)).

              Lean, line 290
                      · have := h4 m; exact div_nonneg (by norm_num) (by linarith)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 290 at 879b5c03f7df ↗

          2. hrem_all.tail3.hsum1.s2 case

            Leaves (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m.

            Lean, lines 291–296
                    · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                      have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                      have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                      calc (3 : ℝ) / (2 ^ (m + n + 1) - 3) ≤ 3 / 2 ^ m :=
                            div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                        _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 291–296 at 879b5c03f7df ↗

            1. hrem_all.tail3.hsum1.s2.hpow have (2 : ℝ) ^ (m + (2 : ℕ)) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ))

              Leaves (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with hpow : (2 : ℝ) ^ (m + (2 : ℕ)) ≤ (2 : ℝ) ^ (m + n + (1 : ℕ)).

              Uses library pow_le_pow_right₀.

              Lean, line 291
                      · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + n + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 291 at 879b5c03f7df ↗

            2. hrem_all.tail3.hsum1.s2.h1 have (1 : ℝ) ≤ (2 : ℝ) ^ m

              Leaves (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with h1 : (1 : ℝ) ≤ (2 : ℝ) ^ m.

              Uses library one_le_pow₀.

              Lean, line 292
                        have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 292 at 879b5c03f7df ↗

            3. hrem_all.tail3.hsum1.s2.h2 have (2 : ℝ) ^ (m + (2 : ℕ)) = (4 : ℝ) * (2 : ℝ) ^ m

              Leaves (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with h2 : (2 : ℝ) ^ (m + (2 : ℕ)) = (4 : ℝ) * (2 : ℝ) ^ m.

              Uses library pow_add.

              Lean, line 293
                        have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 293 at 879b5c03f7df ↗

            4. hrem_all.tail3.hsum1.s2.s4 calc (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) / (2 : ℝ) ^ m

              Closes the goal.

              Uses library div_le_div_of_nonneg_left.

              Lean, lines 294–295
                        calc (3 : ℝ) / (2 ^ (m + n + 1) - 3) ≤ 3 / 2 ^ m :=
                              div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 294–295 at 879b5c03f7df ↗

            5. hrem_all.tail3.hsum1.s2.s5 calc

              Closes the goal.

              Uses library one_div_pow.

              Lean, line 296
                          _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 296 at 879b5c03f7df ↗

        7. hrem_all.tail3.hU have Summable (Function.uncurry f)

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with hU : Summable (Function.uncurry f).

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Function.uncurry Transforms a two-parameter function into an equivalent function from pairs. , summable_prod_of_nonneg, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

          Lean, lines 297–299
                have hU : Summable (Function.uncurry f) := by
                  refine (summable_prod_of_nonneg (fun p => hpos p.1 p.2)).mpr ⟨fun m => (inner1 m).summable, ?_⟩
                  exact hsum1.congr (fun m => ((inner1 m).tsum_eq).symm)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 297–299 at 879b5c03f7df ↗

        8. hrem_all.tail3.hcomm have ∑' (c : ℕ) (b : ℕ), f b c = ∑' (b : ℕ) (c : ℕ), f b c

          Leaves ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (s : ℕ), ((3 : ℝ) / (2 : ℝ) ^ n) ^ (s + (1 : ℕ)) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)), with hcomm : ∑' (c : ℕ) (b : ℕ), f b c = ∑' (b : ℕ) (c : ℕ), f b c.

          Lean, line 300
                have hcomm := hU.tsum_comm' (fun m => (inner1 m).summable) (fun s => (inner2 s).summable)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 300 at 879b5c03f7df ↗

      9. hrem_all.split3T have ∀ (n : ℕ), (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with split3T : ∀ (n : ℕ), (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , zero_add.

        Lean, lines 306–344
            have split3T : ∀ (n : ℕ),
                3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) =
                  ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) + ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) := by
              intro n
              set g : ℕ → ℝ := fun m => (3 : ℝ) / (2 ^ (m + 1) - 3) with hg
              have hsum : Summable (fun m => g (m + 1)) := by
                refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
                · have : (4 : ℝ) ≤ 2 ^ (m + 1 + 1) := by
                    calc (4 : ℝ) = 2 ^ 2 := by norm_num
                      _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                  simp only [hg]; exact div_nonneg (by norm_num) (by linarith)
                · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + 1 + 1) := le_of_eq (by ring_nf)
                  have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                  have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                  simp only [hg]
                  calc (3 : ℝ) / (2 ^ (m + 1 + 1) - 3) ≤ 3 / 2 ^ m :=
                        div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                    _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring
              have hs : Summable g := (summable_nat_add_iff 1).mp hsum
              have e1 := hs.sum_add_tsum_nat_add n
              have e2 := hs.sum_add_tsum_nat_add 2
              have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑' m, g (m + 2) := by
                rw [← tsum_mul_left]
                refine tsum_congr (fun m => ?_)
                simp only [hg]
                rw [show m + 2 + 1 = m + 3 by ring]
                ring
              have hfirst : ∑ i ∈ Finset.range 2, g i = 0 := by
                simp only [hg, Finset.sum_range_succ, Finset.sum_range_zero]
                norm_num
              rw [h3T]
              have htail : ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) = ∑' m, g (m + n) := by
                refine tsum_congr (fun m => ?_)
                simp only [hg]
              rw [htail]
              have hrange : ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) = ∑ i ∈ Finset.range n, g i := by
                simp only [hg]
              rw [hrange, e1]
              rw [← e2, hfirst, zero_add]

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 306–344 at 879b5c03f7df ↗

        1. hrem_all.split3T.hsum have Summable fun (m : ℕ) => g (m + (1 : ℕ))

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with hsum : Summable fun (m : ℕ) => g (m + (1 : ℕ)).

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Summable.of_nonneg_of_le Comparison test of convergence of series of non-negative real numbers. , summable_geometric_two.

          Lean, lines 311–323
                have hsum : Summable (fun m => g (m + 1)) := by
                  refine Summable.of_nonneg_of_le (fun m => ?_) (fun m => ?_) ((summable_geometric_two).mul_left 3)
                  · have : (4 : ℝ) ≤ 2 ^ (m + 1 + 1) := by
                      calc (4 : ℝ) = 2 ^ 2 := by norm_num
                        _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                    simp only [hg]; exact div_nonneg (by norm_num) (by linarith)
                  · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + 1 + 1) := le_of_eq (by ring_nf)
                    have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                    have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                    simp only [hg]
                    calc (3 : ℝ) / (2 ^ (m + 1 + 1) - 3) ≤ 3 / 2 ^ m :=
                          div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                      _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 311–323 at 879b5c03f7df ↗

          1. hrem_all.split3T.hsum.s1 case

            Leaves (0 : ℝ) ≤ g (m + (1 : ℕ)).

            Uses library div_nonneg.

            Lean, lines 313–316
                    · have : (4 : ℝ) ≤ 2 ^ (m + 1 + 1) := by
                        calc (4 : ℝ) = 2 ^ 2 := by norm_num
                          _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)
                      simp only [hg]; exact div_nonneg (by norm_num) (by linarith)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 313–316 at 879b5c03f7df ↗

            1. hrem_all.split3T.hsum.s1.this have (4 : ℝ) ≤ (2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ))

              Leaves (0 : ℝ) ≤ g (m + (1 : ℕ)), with this : (4 : ℝ) ≤ (2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ)).

              Lean, lines 313–315
                      · have : (4 : ℝ) ≤ 2 ^ (m + 1 + 1) := by
                          calc (4 : ℝ) = 2 ^ 2 := by norm_num
                            _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 313–315 at 879b5c03f7df ↗

              1. hrem_all.split3T.hsum.s1.this.s1 calc (4 : ℝ) = (2 : ℝ) ^ (2 : ℕ) routine: norm_num

                Closes the goal.

                Lean, line 314
                            calc (4 : ℝ) = 2 ^ 2 := by norm_num

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 314 at 879b5c03f7df ↗

              2. hrem_all.split3T.hsum.s1.this.s2 calc (2 : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ))

                Closes the goal.

                Uses library pow_le_pow_right₀.

                Lean, line 315
                              _ ≤ 2 ^ (m + 1 + 1) := pow_le_pow_right₀ (by norm_num) (by omega)

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 315 at 879b5c03f7df ↗

          2. hrem_all.split3T.hsum.s2 case

            Leaves g (m + (1 : ℕ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m.

            Lean, lines 317–323
                    · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + 1 + 1) := le_of_eq (by ring_nf)
                      have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                      have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring
                      simp only [hg]
                      calc (3 : ℝ) / (2 ^ (m + 1 + 1) - 3) ≤ 3 / 2 ^ m :=
                            div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)
                        _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 317–323 at 879b5c03f7df ↗

            1. hrem_all.split3T.hsum.s2.hpow have (2 : ℝ) ^ (m + (2 : ℕ)) ≤ (2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ))

              Leaves g (m + (1 : ℕ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with hpow : (2 : ℝ) ^ (m + (2 : ℕ)) ≤ (2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ)).

              Uses library le_of_eq.

              Lean, line 317
                      · have hpow : (2 : ℝ) ^ (m + 2) ≤ 2 ^ (m + 1 + 1) := le_of_eq (by ring_nf)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 317 at 879b5c03f7df ↗

            2. hrem_all.split3T.hsum.s2.h1 have (1 : ℝ) ≤ (2 : ℝ) ^ m

              Leaves g (m + (1 : ℕ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with h1 : (1 : ℝ) ≤ (2 : ℝ) ^ m.

              Uses library one_le_pow₀.

              Lean, line 318
                        have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 318 at 879b5c03f7df ↗

            3. hrem_all.split3T.hsum.s2.h2 have (2 : ℝ) ^ (m + (2 : ℕ)) = (4 : ℝ) * (2 : ℝ) ^ m

              Leaves g (m + (1 : ℕ)) ≤ (3 : ℝ) * (1 / 2 : ℝ) ^ m, with h2 : (2 : ℝ) ^ (m + (2 : ℕ)) = (4 : ℝ) * (2 : ℝ) ^ m.

              Uses library pow_add.

              Lean, line 319
                        have h2 : (2 : ℝ) ^ (m + 2) = 4 * 2 ^ m := by rw [pow_add]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 319 at 879b5c03f7df ↗

            4. hrem_all.split3T.hsum.s2.s4 calc (3 : ℝ) / ((2 : ℝ) ^ (m + (1 : ℕ) + (1 : ℕ)) - (3 : ℝ)) ≤ (3 : ℝ) / (2 : ℝ) ^ m

              Closes the goal.

              Uses library div_le_div_of_nonneg_left.

              Lean, lines 321–322
                        calc (3 : ℝ) / (2 ^ (m + 1 + 1) - 3) ≤ 3 / 2 ^ m :=
                              div_le_div_of_nonneg_left (by norm_num) (by positivity) (by linarith)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 321–322 at 879b5c03f7df ↗

            5. hrem_all.split3T.hsum.s2.s5 calc

              Closes the goal.

              Uses library one_div_pow.

              Lean, line 323
                          _ = 3 * (1 / 2) ^ m := by rw [one_div_pow]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 323 at 879b5c03f7df ↗

        2. hrem_all.split3T.hs have Summable g

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with hs : Summable g.

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , summable_nat_add_iff.

          Lean, line 324
                have hs : Summable g := (summable_nat_add_iff 1).mp hsum

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 324 at 879b5c03f7df ↗

        3. hrem_all.split3T.e1 have ∑ i ∈ Finset.range n, g i + ∑' (i : ℕ), g (i + n) = ∑' (i : ℕ), g i

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with e1 : ∑ i ∈ Finset.range n, g i + ∑' (i : ℕ), g (i + n) = ∑' (i : ℕ), g i.

          Lean, line 325
                have e1 := hs.sum_add_tsum_nat_add n

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 325 at 879b5c03f7df ↗

        4. hrem_all.split3T.e2 have ∑ i ∈ Finset.range (2 : ℕ), g i + ∑' (i : ℕ), g (i + (2 : ℕ)) = ∑' (i : ℕ), g i

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with e2 : ∑ i ∈ Finset.range (2 : ℕ), g i + ∑' (i : ℕ), g (i + (2 : ℕ)) = ∑' (i : ℕ), g i.

          Lean, line 326
                have e2 := hs.sum_add_tsum_nat_add 2

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 326 at 879b5c03f7df ↗

        5. hrem_all.split3T.h3T have (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑' (m : ℕ), g (m + (2 : ℕ))

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with h3T : (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑' (m : ℕ), g (m + (2 : ℕ)).

          Uses library tsum_mul_left, tsum_congr.

          Lean, lines 327–332
                have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑' m, g (m + 2) := by
                  rw [← tsum_mul_left]
                  refine tsum_congr (fun m => ?_)
                  simp only [hg]
                  rw [show m + 2 + 1 = m + 3 by ring]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 327–332 at 879b5c03f7df ↗

        6. hrem_all.split3T.hfirst have ∑ i ∈ Finset.range (2 : ℕ), g i = (0 : ℝ) routine: simp, norm_num

          Leaves (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with hfirst : ∑ i ∈ Finset.range (2 : ℕ), g i = (0 : ℝ).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_range_succ, Finset.sum_range_zero.

          Lean, lines 333–335
                have hfirst : ∑ i ∈ Finset.range 2, g i = 0 := by
                  simp only [hg, Finset.sum_range_succ, Finset.sum_range_zero]
                  norm_num

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 333–335 at 879b5c03f7df ↗

        7. hrem_all.split3T.htail have ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (m : ℕ), g (m + n)

          Leaves ∑' (m : ℕ), g (m + (2 : ℕ)) = (Finset.range n).sum g + ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)), with htail : ∑' (m : ℕ), (3 : ℝ) / ((2 : ℝ) ^ (m + n + (1 : ℕ)) - (3 : ℝ)) = ∑' (m : ℕ), g (m + n).

          Uses library tsum_congr.

          Lean, lines 337–339
                have htail : ∑' m : ℕ, (3 : ℝ) / (2 ^ (m + n + 1) - 3) = ∑' m, g (m + n) := by
                  refine tsum_congr (fun m => ?_)
                  simp only [hg]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 337–339 at 879b5c03f7df ↗

        8. hrem_all.split3T.hrange have ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) = ∑ i ∈ Finset.range n, g i routine: simp

          Leaves ∑' (m : ℕ), g (m + (2 : ℕ)) = (Finset.range n).sum g + ∑' (m : ℕ), g (m + n), with hrange : ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) = ∑ i ∈ Finset.range n, g i.

          Uses library Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 341–342
                have hrange : ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) = ∑ i ∈ Finset.range n, g i := by
                  simp only [hg]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 341–342 at 879b5c03f7df ↗

      10. hrem_all.cauchy_fin have ∀ (n : ℕ) (q a : ℕ → ℝ) (x A : ℝ), HasSum (fun (s : ℕ) => a s * x ^ (s + (1 : ℕ))) A → HasSum (fun (K : ℕ) => ∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then q j * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), q j * x ^ j) * A)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with cauchy_fin : ∀ (n : ℕ) (q a : ℕ → ℝ) (x A : ℝ), HasSum (fun (s : ℕ) => a s * x ^ (s + (1 : ℕ))) A → HasSum (fun (K : ℕ) => ∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then q j * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), q j * x ^ j) * A).

        Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. , Finset.range range n is the set of natural numbers less than n. , Finset.sum_mul, hasSum_sum, hasSum_nat_add_iff', sub_zero.

        Lean, lines 346–366
            have cauchy_fin : ∀ (n : ℕ) (q a : ℕ → ℝ) (x A : ℝ) (hA : HasSum (fun s => a s * x ^ (s + 1)) A),
                HasSum (fun K => ∑ j ∈ Finset.range (n + 1), if j < K then q j * a (K - j - 1) * x ^ K else 0)
                  ((∑ j ∈ Finset.range (n + 1), q j * x ^ j) * A) := by
              intro n q a x A hA
              rw [Finset.sum_mul]
              apply hasSum_sum
              intro j _
              have h := hA.mul_left (q j * x ^ j)
              rw [← hasSum_nat_add_iff' (j + 1)]
              have hz : ∑ i ∈ Finset.range (j + 1), (if j < i then q j * a (i - j - 1) * x ^ i else 0) = 0 :=
                Finset.sum_eq_zero (fun i hi => by
                  have := Finset.mem_range.mp hi
                  rw [if_neg (by omega)])
              rw [hz, sub_zero]
              have hfun : (fun s => if j < s + (j + 1) then q j * a (s + (j + 1) - j - 1) * x ^ (s + (j + 1)) else 0) =
                  fun s => q j * x ^ j * (a s * x ^ (s + 1)) := by
                funext s
                rw [if_pos (by omega), show s + (j + 1) - j - 1 = s by omega, show s + (j + 1) = j + (s + 1) by ring, pow_add]
                ring
              rw [hfun]
              exact h

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 346–366 at 879b5c03f7df ↗

        1. hrem_all.cauchy_fin.h have HasSum (fun (i : ℕ) => q j * x ^ j * (a i * x ^ (i + (1 : ℕ)))) (q j * x ^ j * A)

          Leaves HasSum (fun (b : ℕ) => if j < b then q j * a (b - j - (1 : ℕ)) * x ^ b else (0 : ℝ)) (q j * x ^ j * A), with h : HasSum (fun (i : ℕ) => q j * x ^ j * (a i * x ^ (i + (1 : ℕ)))) (q j * x ^ j * A).

          Lean, line 353
                have h := hA.mul_left (q j * x ^ j)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 353 at 879b5c03f7df ↗

        2. hrem_all.cauchy_fin.hz have (∑ i ∈ Finset.range (j + (1 : ℕ)), if j < i then q j * a (i - j - (1 : ℕ)) * x ^ i else (0 : ℝ)) = (0 : ℝ)

          Leaves HasSum (fun (n : ℕ) => if j < n + (j + (1 : ℕ)) then q j * a (n + (j + (1 : ℕ)) - j - (1 : ℕ)) * x ^ (n + (j + (1 : ℕ))) else (0 : ℝ)) (q j * x ^ j * A - ∑ i ∈ Finset.range (j + (1 : ℕ)), if j < i then q j * a (i - j - (1 : ℕ)) * x ^ i else (0 : ℝ)), with hz : (∑ i ∈ Finset.range (j + (1 : ℕ)), if j < i then q j * a (i - j - (1 : ℕ)) * x ^ i else (0 : ℝ)) = (0 : ℝ).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_eq_zero, if_neg.

          Lean, lines 355–358
                have hz : ∑ i ∈ Finset.range (j + 1), (if j < i then q j * a (i - j - 1) * x ^ i else 0) = 0 :=
                  Finset.sum_eq_zero (fun i hi => by
                    have := Finset.mem_range.mp hi
                    rw [if_neg (by omega)])

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 355–358 at 879b5c03f7df ↗

          1. hrem_all.cauchy_fin.hz.this have i < j + (1 : ℕ)

            Leaves (if j < i then q j * a (i - j - (1 : ℕ)) * x ^ i else (0 : ℝ)) = (0 : ℝ), with this : i < j + (1 : ℕ).

            Uses library Finset.mem_range.

            Lean, line 357
                      have := Finset.mem_range.mp hi

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 357 at 879b5c03f7df ↗

        3. hrem_all.cauchy_fin.hfun have (fun (s : ℕ) => if j < s + (j + (1 : ℕ)) then q j * a (s + (j + (1 : ℕ)) - j - (1 : ℕ)) * x ^ (s + (j + (1 : ℕ))) else (0 : ℝ)) = fun (s : ℕ) => q j * x ^ j * (a s * x ^ (s + (1 : ℕ)))

          Leaves HasSum (fun (n : ℕ) => if j < n + (j + (1 : ℕ)) then q j * a (n + (j + (1 : ℕ)) - j - (1 : ℕ)) * x ^ (n + (j + (1 : ℕ))) else (0 : ℝ)) (q j * x ^ j * A), with hfun : (fun (s : ℕ) => if j < s + (j + (1 : ℕ)) then q j * a (s + (j + (1 : ℕ)) - j - (1 : ℕ)) * x ^ (s + (j + (1 : ℕ))) else (0 : ℝ)) = fun (s : ℕ) => q j * x ^ j * (a s * x ^ (s + (1 : ℕ))).

          Uses library if_pos, pow_add.

          Lean, lines 360–364
                have hfun : (fun s => if j < s + (j + 1) then q j * a (s + (j + 1) - j - 1) * x ^ (s + (j + 1)) else 0) =
                    fun s => q j * x ^ j * (a s * x ^ (s + 1)) := by
                  funext s
                  rw [if_pos (by omega), show s + (j + 1) - j - 1 = s by omega, show s + (j + 1) = j + (s + 1) by ring, pow_add]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 360–364 at 879b5c03f7df ↗

      11. hrem_all.h4_series have ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), (1 : ℕ) ≤ n → HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with h4_series : ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), (1 : ℕ) ≤ n → HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

        Lean, lines 368–487
            have h4_series : ∀ (Qc : ℕ → ℕ → ℚ) (hQc : (Qc = fun (n k : ℕ) =>
                ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                    ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                  ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)))) (Qx : ℕ → ℚ) (hQx : (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k))
              (Aq : ℕ → ℚ) (hAq : (Aq = fun (n : ℕ) =>
                        ∑ k ∈ Finset.range (n + (1 : ℕ)),
                            (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                              ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                          Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))) (n : ℕ) (hn : 1 ≤ n),
                HasSum (fun K : ℕ => if 2 * n < K then
                    ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                      ((3 : ℝ) / 2 ^ n) ^ K else 0)
                  ((Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ)) := by
              intro Qc hQc Qx hQx Aq hAq n hn
              set x : ℝ := (3 : ℝ) / 2 ^ n with hxdef
              have hx0 : 0 ≤ x := by positivity
              have hx2 : x / 2 < 1 := by
                have : (2 : ℝ) ≤ 2 ^ n := by
                  calc (2 : ℝ) = 2 ^ 1 := by norm_num
                    _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
                rw [hxdef, div_div, div_lt_one (by positivity)]; linarith
              set a : ℕ → ℝ := fun s => (1 : ℝ) / (2 ^ (s + 1) - 1) with hadef
              have hapos : ∀ s, 0 < (2 : ℝ) ^ (s + 1) - 1 := fun s => by
                have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                linarith
              have hAsum : Summable (fun s => a s * x ^ (s + 1)) := by
                refine Summable.of_nonneg_of_le (fun s => ?_) (fun s => ?_) ((summable_geometric_of_lt_one (by positivity) hx2).mul_left x)
                · simp only [hadef]; exact mul_nonneg (div_nonneg (by norm_num) (le_of_lt (hapos s))) (by positivity)
                · simp only [hadef]
                  have h1 : (2 : ℝ) ^ s ≤ 2 ^ (s + 1) - 1 := by
                    have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)
                    rw [pow_succ]; linarith
                  have hxs : 0 ≤ x ^ (s + 1) := by positivity
                  calc 1 / (2 ^ (s + 1) - 1) * x ^ (s + 1) ≤ 1 / 2 ^ s * x ^ (s + 1) := by
                        gcongr
                    _ = x * (x / 2) ^ s := by
                      have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                        intro y; rw [div_pow, pow_succ]; field_simp
                      exact e x
              set A := ∑' s, a s * x ^ (s + 1) with hAdef
              have hA : HasSum (fun s => a s * x ^ (s + 1)) A := hAsum.hasSum
              -- 3T = c + A
              have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) + A := by
                rw [split3T n, tail3 n hn, hAdef]
                congr 1
                refine tsum_congr (fun s => ?_)
                simp only [hadef, hxdef]
                ring
              have hQxR : (Qx n : ℝ) = ∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j := by
                rw [hQx]; push_cast; rfl
              have hAqR : (Aq n : ℝ) = ∑ k ∈ Finset.range (n + 1),
                  (∑ j ∈ Finset.range (k + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (k - j) - 1)) * x ^ k +
                  (Qx n : ℝ) * ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) := by
                rw [hAq]; push_cast; rfl
              have hC := cauchy_fin n (fun j => (Qc n j : ℝ)) a x A hA
              set P : ℝ := ∑ k ∈ Finset.range (n + 1),
                  (∑ j ∈ Finset.range (k + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (k - j) - 1)) * x ^ k with hPdef
              have hP : HasSum (fun K => if K < n + 1 then
                  (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) P := by
                have h0 : HasSum (fun K => if K < n + 1 then
                    (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0)
                    (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                      (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) :=
                  hasSum_sum_of_ne_finset_zero (fun b hb => by rw [if_neg (by simpa using hb)])
                have h1 : (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                      (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) = P := by
                  rw [hPdef]
                  exact Finset.sum_congr rfl (fun K hK => by rw [if_pos (Finset.mem_range.mp hK)])
                rw [h1] at h0
                exact h0
              have hD := hC.sub hP
              have hval : (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) =
                  (∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j) * A - P := by
                rw [h3T, hAqR, hQxR]; ring
              rw [hval]
              have hid1 : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
                  ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ L) := fun j hj => by subst hQc; exact id1_full n j hj
              have hfun : (fun K : ℕ => if 2 * n < K then
                    ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                      ((3 : ℝ) / 2 ^ n) ^ K else 0) =
                  fun K => (∑ j ∈ Finset.range (n + 1), if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) -
                    (if K < n + 1 then (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) := by
                funext K
                symm
                by_cases hK : K < n + 1
                · rw [if_pos hK, if_neg (by omega)]
                  rw [Finset.sum_range_succ (fun j => (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) K, Nat.sub_self, pow_zero, sub_self,
                    div_zero, add_zero]
                  have hsplit : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                      ∑ j ∈ Finset.range K, (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1) * x ^ K := by
                    rw [← Finset.sum_range_add_sum_Ico _ (show K ≤ n + 1 by omega)]
                    rw [Finset.sum_eq_zero (s := Finset.Ico K (n + 1)) (fun j hj => by
                      rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]
                    refine Finset.sum_congr rfl (fun j hj => ?_)
                    have hjK := Finset.mem_range.mp hj
                    rw [if_pos hjK]
                    simp only [hadef]
                    rw [show K - j - 1 + 1 = K - j by omega]
                    ring
                  rw [hsplit, Finset.sum_mul, sub_self]
                · rw [if_neg hK, sub_zero]
                  have hS : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                      ((∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) : ℚ) : ℝ) * x ^ K := by
                    push_cast
                    rw [Finset.sum_mul]
                    refine Finset.sum_congr rfl (fun j hj => ?_)
                    have hjK : j < K := by have := Finset.mem_range.mp hj; omega
                    rw [if_pos hjK]
                    simp only [hadef]
                    rw [show K - j - 1 + 1 = K - j by omega]
                    ring
                  rw [hS, tail_coeff n K (by omega) Qc hid1]
                  push_cast
                  by_cases h2 : 2 * n < K
                  · rw [if_pos h2]
                  · rw [if_neg h2]
                    rw [Finset.prod_eq_zero (i := K) (Finset.mem_Ioc.mpr ⟨by omega, by omega⟩) (sub_self _)]
                    simp
              rw [hfun]
              exact hD

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 368–487 at 879b5c03f7df ↗

        1. hrem_all.h4_series.hx0 have (0 : ℝ) ≤ x routine: positivity

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hx0 : (0 : ℝ) ≤ x.

          Lean, line 383
                have hx0 : 0 ≤ x := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 383 at 879b5c03f7df ↗

        2. hrem_all.h4_series.hx2 have x / (2 : ℝ) < (1 : ℝ)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hx2 : x / (2 : ℝ) < (1 : ℝ).

          Uses library div_div, div_lt_one.

          Lean, lines 384–388
                have hx2 : x / 2 < 1 := by
                  have : (2 : ℝ) ≤ 2 ^ n := by
                    calc (2 : ℝ) = 2 ^ 1 := by norm_num
                      _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
                  rw [hxdef, div_div, div_lt_one (by positivity)]; linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 384–388 at 879b5c03f7df ↗

          1. hrem_all.h4_series.hx2.this have (2 : ℝ) ≤ (2 : ℝ) ^ n

            Leaves x / (2 : ℝ) < (1 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ n.

            Lean, lines 385–387
                    have : (2 : ℝ) ≤ 2 ^ n := by
                      calc (2 : ℝ) = 2 ^ 1 := by norm_num
                        _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 385–387 at 879b5c03f7df ↗

            1. hrem_all.h4_series.hx2.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ) routine: norm_num

              Closes the goal.

              Lean, line 386
                        calc (2 : ℝ) = 2 ^ 1 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 386 at 879b5c03f7df ↗

            2. hrem_all.h4_series.hx2.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ n

              Closes the goal.

              Uses library pow_le_pow_right₀.

              Lean, line 387
                          _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 387 at 879b5c03f7df ↗

        3. hrem_all.h4_series.hapos have ∀ (s : ℕ), (0 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hapos : ∀ (s : ℕ), (0 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ).

          Lean, lines 390–392
                have hapos : ∀ s, 0 < (2 : ℝ) ^ (s + 1) - 1 := fun s => by
                  have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 390–392 at 879b5c03f7df ↗

          1. hrem_all.h4_series.hapos.this have (1 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ))

            Leaves (0 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ), with this : (1 : ℝ) < (2 : ℝ) ^ (s + (1 : ℕ)).

            Uses library one_lt_pow₀.

            Lean, line 391
                    have : (1 : ℝ) < 2 ^ (s + 1) := one_lt_pow₀ (by norm_num) (by omega)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 391 at 879b5c03f7df ↗

        4. hrem_all.h4_series.hAsum have Summable fun (s : ℕ) => a s * x ^ (s + (1 : ℕ))

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hAsum : Summable fun (s : ℕ) => a s * x ^ (s + (1 : ℕ)).

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Summable.of_nonneg_of_le Comparison test of convergence of series of non-negative real numbers. , summable_geometric_of_lt_one.

          Lean, lines 393–406
                have hAsum : Summable (fun s => a s * x ^ (s + 1)) := by
                  refine Summable.of_nonneg_of_le (fun s => ?_) (fun s => ?_) ((summable_geometric_of_lt_one (by positivity) hx2).mul_left x)
                  · simp only [hadef]; exact mul_nonneg (div_nonneg (by norm_num) (le_of_lt (hapos s))) (by positivity)
                  · simp only [hadef]
                    have h1 : (2 : ℝ) ^ s ≤ 2 ^ (s + 1) - 1 := by
                      have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)
                      rw [pow_succ]; linarith
                    have hxs : 0 ≤ x ^ (s + 1) := by positivity
                    calc 1 / (2 ^ (s + 1) - 1) * x ^ (s + 1) ≤ 1 / 2 ^ s * x ^ (s + 1) := by
                          gcongr
                      _ = x * (x / 2) ^ s := by
                        have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                          intro y; rw [div_pow, pow_succ]; field_simp
                        exact e x

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 393–406 at 879b5c03f7df ↗

          1. hrem_all.h4_series.hAsum.s1 case

            Leaves (0 : ℝ) ≤ a s * x ^ (s + (1 : ℕ)).

            Uses library mul_nonneg Alias of Left.mul_nonneg. , div_nonneg, le_of_lt.

            Lean, line 395
                    · simp only [hadef]; exact mul_nonneg (div_nonneg (by norm_num) (le_of_lt (hapos s))) (by positivity)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 395 at 879b5c03f7df ↗

          2. hrem_all.h4_series.hAsum.s2 case

            Leaves a s * x ^ (s + (1 : ℕ)) ≤ x * (x / (2 : ℝ)) ^ s.

            Lean, lines 396–406
                    · simp only [hadef]
                      have h1 : (2 : ℝ) ^ s ≤ 2 ^ (s + 1) - 1 := by
                        have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)
                        rw [pow_succ]; linarith
                      have hxs : 0 ≤ x ^ (s + 1) := by positivity
                      calc 1 / (2 ^ (s + 1) - 1) * x ^ (s + 1) ≤ 1 / 2 ^ s * x ^ (s + 1) := by
                            gcongr
                        _ = x * (x / 2) ^ s := by
                          have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                            intro y; rw [div_pow, pow_succ]; field_simp
                          exact e x

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 396–406 at 879b5c03f7df ↗

            1. hrem_all.h4_series.hAsum.s2.h1 have (2 : ℝ) ^ s ≤ (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)

              Leaves (1 : ℝ) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)) * x ^ (s + (1 : ℕ)) ≤ x * (x / (2 : ℝ)) ^ s, with h1 : (2 : ℝ) ^ s ≤ (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ).

              Uses library pow_succ.

              Lean, lines 397–399
                        have h1 : (2 : ℝ) ^ s ≤ 2 ^ (s + 1) - 1 := by
                          have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)
                          rw [pow_succ]; linarith

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 397–399 at 879b5c03f7df ↗

              1. hrem_all.h4_series.hAsum.s2.h1.this have (1 : ℝ) ≤ (2 : ℝ) ^ s

                Leaves (2 : ℝ) ^ s ≤ (2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ), with this : (1 : ℝ) ≤ (2 : ℝ) ^ s.

                Uses library one_le_pow₀.

                Lean, line 398
                            have : (1 : ℝ) ≤ 2 ^ s := one_le_pow₀ (by norm_num)

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 398 at 879b5c03f7df ↗

            2. hrem_all.h4_series.hAsum.s2.hxs have (0 : ℝ) ≤ x ^ (s + (1 : ℕ)) routine: positivity

              Leaves (1 : ℝ) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)) * x ^ (s + (1 : ℕ)) ≤ x * (x / (2 : ℝ)) ^ s, with hxs : (0 : ℝ) ≤ x ^ (s + (1 : ℕ)).

              Lean, line 400
                        have hxs : 0 ≤ x ^ (s + 1) := by positivity

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 400 at 879b5c03f7df ↗

            3. hrem_all.h4_series.hAsum.s2.s3 calc (1 : ℝ) / ((2 : ℝ) ^ (s + (1 : ℕ)) - (1 : ℝ)) * x ^ (s + (1 : ℕ)) ≤ (1 : ℝ) / (2 : ℝ) ^ s * x ^ (s + (1 : ℕ))

              Closes the goal.

              Lean, lines 401–402
                        calc 1 / (2 ^ (s + 1) - 1) * x ^ (s + 1) ≤ 1 / 2 ^ s * x ^ (s + 1) := by
                              gcongr

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 401–402 at 879b5c03f7df ↗

            4. hrem_all.h4_series.hAsum.s2.s4 calc

              Closes the goal.

              Lean, lines 403–406
                          _ = x * (x / 2) ^ s := by
                            have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                              intro y; rw [div_pow, pow_succ]; field_simp
                            exact e x

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 403–406 at 879b5c03f7df ↗

              1. hrem_all.h4_series.hAsum.s2.s4.e have ∀ (y : ℝ), (1 : ℝ) / (2 : ℝ) ^ s * y ^ (s + (1 : ℕ)) = y * (y / (2 : ℝ)) ^ s

                Leaves (1 : ℝ) / (2 : ℝ) ^ s * x ^ (s + (1 : ℕ)) = x * (x / (2 : ℝ)) ^ s, with e : ∀ (y : ℝ), (1 : ℝ) / (2 : ℝ) ^ s * y ^ (s + (1 : ℕ)) = y * (y / (2 : ℝ)) ^ s.

                Uses library div_pow, pow_succ.

                Lean, lines 404–405
                              have e : ∀ y : ℝ, 1 / 2 ^ s * y ^ (s + 1) = y * (y / 2) ^ s := by
                                intro y; rw [div_pow, pow_succ]; field_simp

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 404–405 at 879b5c03f7df ↗

        5. hrem_all.h4_series.hA have HasSum (fun (s : ℕ) => a s * x ^ (s + (1 : ℕ))) A

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hA : HasSum (fun (s : ℕ) => a s * x ^ (s + (1 : ℕ))) A.

          Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. .

          Lean, line 408
                have hA : HasSum (fun s => a s * x ^ (s + 1)) A := hAsum.hasSum

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 408 at 879b5c03f7df ↗

        6. hrem_all.h4_series.h3T have (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) + A

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with h3T : (3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) = ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)) + A.

          Uses library Finset.range range n is the set of natural numbers less than n. , tsum_congr.

          Lean, lines 410–415
                have h3T : 3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) = ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) + A := by
                  rw [split3T n, tail3 n hn, hAdef]
                  congr 1
                  refine tsum_congr (fun s => ?_)
                  simp only [hadef, hxdef]
                  ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 410–415 at 879b5c03f7df ↗

        7. hrem_all.h4_series.hQxR have (↑(Qx n) : ℝ) = ∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hQxR : (↑(Qx n) : ℝ) = ∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j.

          Uses library Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 416–417
                have hQxR : (Qx n : ℝ) = ∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j := by
                  rw [hQx]; push_cast; rfl

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 416–417 at 879b5c03f7df ↗

        8. hrem_all.h4_series.hAqR have (↑(Aq n) : ℝ) = ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (k - j) - (1 : ℝ))) * x ^ k + (↑(Qx n) : ℝ) * ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ))

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hAqR : (↑(Aq n) : ℝ) = ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (k - j) - (1 : ℝ))) * x ^ k + (↑(Qx n) : ℝ) * ∑ j ∈ Finset.range n, (3 : ℝ) / ((2 : ℝ) ^ (j + (1 : ℕ)) - (3 : ℝ)).

          Uses library Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 418–421
                have hAqR : (Aq n : ℝ) = ∑ k ∈ Finset.range (n + 1),
                    (∑ j ∈ Finset.range (k + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (k - j) - 1)) * x ^ k +
                    (Qx n : ℝ) * ∑ j ∈ Finset.range n, (3 : ℝ) / (2 ^ (j + 1) - 3) := by
                  rw [hAq]; push_cast; rfl

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 418–421 at 879b5c03f7df ↗

        9. hrem_all.h4_series.hC have HasSum (fun (K : ℕ) => ∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hC : HasSum (fun (K : ℕ) => ∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A).

          Lean, line 422
                have hC := cauchy_fin n (fun j => (Qc n j : ℝ)) a x A hA

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 422 at 879b5c03f7df ↗

        10. hrem_all.h4_series.hP have HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) P

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hP : HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) P.

          Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. , Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 425–437
                have hP : HasSum (fun K => if K < n + 1 then
                    (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) P := by
                  have h0 : HasSum (fun K => if K < n + 1 then
                      (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0)
                      (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                        (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) :=
                    hasSum_sum_of_ne_finset_zero (fun b hb => by rw [if_neg (by simpa using hb)])
                  have h1 : (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                        (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) = P := by
                    rw [hPdef]
                    exact Finset.sum_congr rfl (fun K hK => by rw [if_pos (Finset.mem_range.mp hK)])
                  rw [h1] at h0
                  exact h0

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 425–437 at 879b5c03f7df ↗

          1. hrem_all.h4_series.hP.h0 have HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) (∑ K ∈ Finset.range (n + (1 : ℕ)), if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ))

            Leaves HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) P, with h0 : HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) (∑ K ∈ Finset.range (n + (1 : ℕ)), if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)).

            Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. , Finset.range range n is the set of natural numbers less than n. , hasSum_sum_of_ne_finset_zero If a function f vanishes outside of a finite set s, then it HasSum ∑ b ∈ s, f b. , if_neg.

            Lean, lines 427–431
                    have h0 : HasSum (fun K => if K < n + 1 then
                        (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0)
                        (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                          (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) :=
                      hasSum_sum_of_ne_finset_zero (fun b hb => by rw [if_neg (by simpa using hb)])

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 427–431 at 879b5c03f7df ↗

          2. hrem_all.h4_series.hP.h1 have (∑ K ∈ Finset.range (n + (1 : ℕ)), if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) = P

            Leaves HasSum (fun (K : ℕ) => if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) P, with h1 : (∑ K ∈ Finset.range (n + (1 : ℕ)), if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) = P.

            Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , if_pos, Finset.mem_range.

            Lean, lines 432–435
                    have h1 : (∑ K ∈ Finset.range (n + 1), if K < n + 1 then
                          (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) = P := by
                      rw [hPdef]
                      exact Finset.sum_congr rfl (fun K hK => by rw [if_pos (Finset.mem_range.mp hK)])

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 432–435 at 879b5c03f7df ↗

        11. hrem_all.h4_series.hD have HasSum (fun (b : ℕ) => (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < b then (↑(Qc n j) : ℝ) * a (b - j - (1 : ℕ)) * x ^ b else (0 : ℝ)) - if b < n + (1 : ℕ) then (∑ j ∈ Finset.range (b + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (b - j) - (1 : ℝ))) * x ^ b else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hD : HasSum (fun (b : ℕ) => (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < b then (↑(Qc n j) : ℝ) * a (b - j - (1 : ℕ)) * x ^ b else (0 : ℝ)) - if b < n + (1 : ℕ) then (∑ j ∈ Finset.range (b + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (b - j) - (1 : ℝ))) * x ^ b else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P).

          Lean, line 438
                have hD := hC.sub hP

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 438 at 879b5c03f7df ↗

        12. hrem_all.h4_series.hval have (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) = (∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hval : (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) = (∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P.

          Uses library Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 439–441
                have hval : (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) =
                    (∑ j ∈ Finset.range (n + 1), (Qc n j : ℝ) * x ^ j) * A - P := by
                  rw [h3T, hAqR, hQxR]; ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 439–441 at 879b5c03f7df ↗

        13. hrem_all.h4_series.hid1 have ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ L)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P), with hid1 : ∀ j ≤ n, Qc n j * (2 : ℚ) ^ j * ∏ i ∈ (Finset.range (n + (1 : ℕ))).erase j, ((2 : ℚ) ^ j - (2 : ℚ) ^ i) = ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℚ) ^ j - (2 : ℚ) ^ L).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

          Lean, lines 443–444
                have hid1 : ∀ j ≤ n, Qc n j * 2 ^ j * ∏ i ∈ (Finset.range (n + 1)).erase j, ((2 : ℚ) ^ j - 2 ^ i) =
                    ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℚ) ^ j - 2 ^ L) := fun j hj => by subst hQc; exact id1_full n j hj

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 443–444 at 879b5c03f7df ↗

        14. hrem_all.h4_series.hfun have (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) = fun (K : ℕ) => (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) - if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)

          Leaves HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K else (0 : ℝ)) ((∑ j ∈ Finset.range (n + (1 : ℕ)), (↑(Qc n j) : ℝ) * x ^ j) * A - P), with hfun : (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) = fun (K : ℕ) => (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) - if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. .

          Lean, lines 445–485
                have hfun : (fun K : ℕ => if 2 * n < K then
                      ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                        ((3 : ℝ) / 2 ^ n) ^ K else 0) =
                    fun K => (∑ j ∈ Finset.range (n + 1), if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) -
                      (if K < n + 1 then (∑ j ∈ Finset.range (K + 1), (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) * x ^ K else 0) := by
                  funext K
                  symm
                  by_cases hK : K < n + 1
                  · rw [if_pos hK, if_neg (by omega)]
                    rw [Finset.sum_range_succ (fun j => (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) K, Nat.sub_self, pow_zero, sub_self,
                      div_zero, add_zero]
                    have hsplit : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                        ∑ j ∈ Finset.range K, (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1) * x ^ K := by
                      rw [← Finset.sum_range_add_sum_Ico _ (show K ≤ n + 1 by omega)]
                      rw [Finset.sum_eq_zero (s := Finset.Ico K (n + 1)) (fun j hj => by
                        rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]
                      refine Finset.sum_congr rfl (fun j hj => ?_)
                      have hjK := Finset.mem_range.mp hj
                      rw [if_pos hjK]
                      simp only [hadef]
                      rw [show K - j - 1 + 1 = K - j by omega]
                      ring
                    rw [hsplit, Finset.sum_mul, sub_self]
                  · rw [if_neg hK, sub_zero]
                    have hS : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                        ((∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) : ℚ) : ℝ) * x ^ K := by
                      push_cast
                      rw [Finset.sum_mul]
                      refine Finset.sum_congr rfl (fun j hj => ?_)
                      have hjK : j < K := by have := Finset.mem_range.mp hj; omega
                      rw [if_pos hjK]
                      simp only [hadef]
                      rw [show K - j - 1 + 1 = K - j by omega]
                      ring
                    rw [hS, tail_coeff n K (by omega) Qc hid1]
                    push_cast
                    by_cases h2 : 2 * n < K
                    · rw [if_pos h2]
                    · rw [if_neg h2]
                      rw [Finset.prod_eq_zero (i := K) (Finset.mem_Ioc.mpr ⟨by omega, by omega⟩) (sub_self _)]
                      simp

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 445–485 at 879b5c03f7df ↗

          1. hrem_all.h4_series.hfun.s1 case

            Leaves ((∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) - if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) = if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ).

            Uses library if_pos, if_neg, Finset.sum_range_succ, Nat.sub_self, pow_zero, sub_self, div_zero, add_zero, Finset.sum_mul.

            Lean, lines 453–467
                    · rw [if_pos hK, if_neg (by omega)]
                      rw [Finset.sum_range_succ (fun j => (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1)) K, Nat.sub_self, pow_zero, sub_self,
                        div_zero, add_zero]
                      have hsplit : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                          ∑ j ∈ Finset.range K, (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1) * x ^ K := by
                        rw [← Finset.sum_range_add_sum_Ico _ (show K ≤ n + 1 by omega)]
                        rw [Finset.sum_eq_zero (s := Finset.Ico K (n + 1)) (fun j hj => by
                          rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]
                        refine Finset.sum_congr rfl (fun j hj => ?_)
                        have hjK := Finset.mem_range.mp hj
                        rw [if_pos hjK]
                        simp only [hadef]
                        rw [show K - j - 1 + 1 = K - j by omega]
                        ring
                      rw [hsplit, Finset.sum_mul, sub_self]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 453–467 at 879b5c03f7df ↗

            1. hrem_all.h4_series.hfun.s1.hsplit have (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = ∑ j ∈ Finset.range K, (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ)) * x ^ K

              Leaves (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) - (∑ x ∈ Finset.range K, (↑(Qc n x) : ℝ) / ((2 : ℝ) ^ (K - x) - (1 : ℝ))) * x ^ K = (0 : ℝ), with hsplit : (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = ∑ j ∈ Finset.range K, (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ)) * x ^ K.

              Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_range_add_sum_Ico, Finset.sum_eq_zero, Finset.Ico The finset $[a, b)$ of elements x such that a ≤ x and x < b. , if_neg, add_zero, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , if_pos.

              Lean, lines 456–466
                        have hsplit : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                            ∑ j ∈ Finset.range K, (Qc n j : ℝ) / ((2 : ℝ) ^ (K - j) - 1) * x ^ K := by
                          rw [← Finset.sum_range_add_sum_Ico _ (show K ≤ n + 1 by omega)]
                          rw [Finset.sum_eq_zero (s := Finset.Ico K (n + 1)) (fun j hj => by
                            rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]
                          refine Finset.sum_congr rfl (fun j hj => ?_)
                          have hjK := Finset.mem_range.mp hj
                          rw [if_pos hjK]
                          simp only [hadef]
                          rw [show K - j - 1 + 1 = K - j by omega]
                          ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 456–466 at 879b5c03f7df ↗

              1. hrem_all.h4_series.hfun.s1.hsplit.this have K ≤ j ∧ j < n + (1 : ℕ)

                Leaves ¬j < K, with this : K ≤ j ∧ j < n + (1 : ℕ).

                Uses library Finset.mem_Ico.

                Lean, line 460
                              rw [if_neg (by have := Finset.mem_Ico.mp hj; omega)]), add_zero]

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 460 at 879b5c03f7df ↗

              2. hrem_all.h4_series.hfun.s1.hsplit.hjK have j < K

                Leaves (if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ)) * x ^ K, with hjK : j < K.

                Uses library Finset.mem_range.

                Lean, line 462
                            have hjK := Finset.mem_range.mp hj

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 462 at 879b5c03f7df ↗

          2. hrem_all.h4_series.hfun.s2 case

            Leaves ((∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) - if K < n + (1 : ℕ) then (∑ j ∈ Finset.range (K + (1 : ℕ)), (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ))) * x ^ K else (0 : ℝ)) = if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ).

            Uses library if_neg, sub_zero.

            Lean, lines 468–485
                    · rw [if_neg hK, sub_zero]
                      have hS : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                          ((∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) : ℚ) : ℝ) * x ^ K := by
                        push_cast
                        rw [Finset.sum_mul]
                        refine Finset.sum_congr rfl (fun j hj => ?_)
                        have hjK : j < K := by have := Finset.mem_range.mp hj; omega
                        rw [if_pos hjK]
                        simp only [hadef]
                        rw [show K - j - 1 + 1 = K - j by omega]
                        ring
                      rw [hS, tail_coeff n K (by omega) Qc hid1]
                      push_cast
                      by_cases h2 : 2 * n < K
                      · rw [if_pos h2]
                      · rw [if_neg h2]
                        rw [Finset.prod_eq_zero (i := K) (Finset.mem_Ioc.mpr ⟨by omega, by omega⟩) (sub_self _)]
                        simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 468–485 at 879b5c03f7df ↗

            1. hrem_all.h4_series.hfun.s2.hS have (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = (↑(∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ))) : ℝ) * x ^ K

              Leaves (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ), with hS : (∑ j ∈ Finset.range (n + (1 : ℕ)), if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = (↑(∑ j ∈ Finset.range (n + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (K - j) - (1 : ℚ))) : ℝ) * x ^ K.

              Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_mul, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , if_pos.

              Lean, lines 469–478
                        have hS : ∑ j ∈ Finset.range (n + 1), (if j < K then (Qc n j : ℝ) * a (K - j - 1) * x ^ K else 0) =
                            ((∑ j ∈ Finset.range (n + 1), Qc n j / ((2 : ℚ) ^ (K - j) - 1) : ℚ) : ℝ) * x ^ K := by
                          push_cast
                          rw [Finset.sum_mul]
                          refine Finset.sum_congr rfl (fun j hj => ?_)
                          have hjK : j < K := by have := Finset.mem_range.mp hj; omega
                          rw [if_pos hjK]
                          simp only [hadef]
                          rw [show K - j - 1 + 1 = K - j by omega]
                          ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 469–478 at 879b5c03f7df ↗

              1. hrem_all.h4_series.hfun.s2.hS.hjK have j < K

                Leaves (if j < K then (↑(Qc n j) : ℝ) * a (K - j - (1 : ℕ)) * x ^ K else (0 : ℝ)) = (↑(Qc n j) : ℝ) / ((2 : ℝ) ^ (K - j) - (1 : ℝ)) * x ^ K, with hjK : j < K.

                Lean, line 474
                            have hjK : j < K := by have := Finset.mem_range.mp hj; omega

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 474 at 879b5c03f7df ↗

                1. hrem_all.h4_series.hfun.s2.hS.hjK.this have j < n + (1 : ℕ)

                  Leaves j < K, with this : j < n + (1 : ℕ).

                  Uses library Finset.mem_range.

                  Lean, line 474
                              have hjK : j < K := by have := Finset.mem_range.mp hj; omega

                  targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 474 at 879b5c03f7df ↗

            2. hrem_all.h4_series.hfun.s2.s2 case

              Leaves ((∏ x ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ x)) / ∏ x ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ x)) * x ^ K = if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ).

              Uses library if_pos.

              Lean, line 482
                        · rw [if_pos h2]

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 482 at 879b5c03f7df ↗

            3. hrem_all.h4_series.hfun.s2.s3 case

              Leaves ((∏ x ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ x)) / ∏ x ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ x)) * x ^ K = if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ).

              Uses library if_neg, Finset.prod_eq_zero, Finset.mem_Ioc, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , sub_self.

              Lean, lines 483–485
                        · rw [if_neg h2]
                          rw [Finset.prod_eq_zero (i := K) (Finset.mem_Ioc.mpr ⟨by omega, by omega⟩) (sub_self _)]
                          simp

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 483–485 at 879b5c03f7df ↗

      12. hrem_all.prod_one_sub_ge have ∀ (s : Finset ℕ) (a : ℕ → ℝ), (∀ i ∈ s, (0 : ℝ) ≤ a i) → (∀ i ∈ s, a i ≤ (1 : ℝ)) → (1 : ℝ) - ∑ i ∈ s, a i ≤ ∏ i ∈ s, ((1 : ℝ) - a i)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with prod_one_sub_ge : ∀ (s : Finset ℕ) (a : ℕ → ℝ), (∀ i ∈ s, (0 : ℝ) ≤ a i) → (∀ i ∈ s, a i ≤ (1 : ℝ)) → (1 : ℝ) - ∑ i ∈ s, a i ≤ ∏ i ∈ s, ((1 : ℝ) - a i).

        Uses library Finset Finset α is the type of finite sets of elements of α. , Finset.induction_on To prove a proposition about an arbitrary Finset α, it suffices to prove it for the empty Finset, and to show that if it holds for some Finset α, then it holds for the Finset obtained by inserting a new element. .

        Lean, lines 490–505
            have prod_one_sub_ge : ∀ (s : Finset ℕ) (a : ℕ → ℝ) (h0 : ∀ i ∈ s, 0 ≤ a i) (h1 : ∀ i ∈ s, a i ≤ 1),
                1 - ∑ i ∈ s, a i ≤ ∏ i ∈ s, (1 - a i) := by
              intro s a h0 h1
              induction s using Finset.induction_on with
              | empty => simp
              | insert j s hj ih =>
                rw [Finset.sum_insert hj, Finset.prod_insert hj]
                have ih' := ih (fun i hi => h0 i (Finset.mem_insert_of_mem hi)) (fun i hi => h1 i (Finset.mem_insert_of_mem hi))
                have haj0 := h0 j (Finset.mem_insert_self j s)
                have haj1 := h1 j (Finset.mem_insert_self j s)
                have hP : 0 ≤ ∏ i ∈ s, (1 - a i) :=
                  Finset.prod_nonneg (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                have hP1 : ∏ i ∈ s, (1 - a i) ≤ 1 :=
                  Finset.prod_le_one (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                    (fun i hi => by linarith [h0 i (Finset.mem_insert_of_mem hi)])
                nlinarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 490–505 at 879b5c03f7df ↗

        1. hrem_all.prod_one_sub_ge.s1 case printed form did not read back: shown as its Lean lines only
        2. hrem_all.prod_one_sub_ge.s2 case

          Leaves (1 : ℝ) - ∑ i ∈ insert j s, a i ≤ ∏ i ∈ insert j s, ((1 : ℝ) - a i), with j : ℕ, s : Finset ℕ, hj : j ∉ s, ih : (∀ i ∈ s, (0 : ℝ) ≤ a i) → (∀ i ∈ s, a i ≤ (1 : ℝ)) → (1 : ℝ) - ∑ i ∈ s, a i ≤ ∏ i ∈ s, ((1 : ℝ) - a i), h0 : ∀ i ∈ insert j s, (0 : ℝ) ≤ a i, h1 : ∀ i ∈ insert j s, a i ≤ (1 : ℝ).

          Uses library Finset.sum_insert, Finset.prod_insert.

          Lean, lines 495–505
                | insert j s hj ih =>
                  rw [Finset.sum_insert hj, Finset.prod_insert hj]
                  have ih' := ih (fun i hi => h0 i (Finset.mem_insert_of_mem hi)) (fun i hi => h1 i (Finset.mem_insert_of_mem hi))
                  have haj0 := h0 j (Finset.mem_insert_self j s)
                  have haj1 := h1 j (Finset.mem_insert_self j s)
                  have hP : 0 ≤ ∏ i ∈ s, (1 - a i) :=
                    Finset.prod_nonneg (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                  have hP1 : ∏ i ∈ s, (1 - a i) ≤ 1 :=
                    Finset.prod_le_one (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                      (fun i hi => by linarith [h0 i (Finset.mem_insert_of_mem hi)])
                  nlinarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 495–505 at 879b5c03f7df ↗

          1. hrem_all.prod_one_sub_ge.s2.ih' have (1 : ℝ) - ∑ i ∈ s, a i ≤ ∏ i ∈ s, ((1 : ℝ) - a i)

            Leaves (1 : ℝ) - (a j + ∑ x ∈ s, a x) ≤ ((1 : ℝ) - a j) * ∏ x ∈ s, ((1 : ℝ) - a x), with ih' : (1 : ℝ) - ∑ i ∈ s, a i ≤ ∏ i ∈ s, ((1 : ℝ) - a i).

            Uses library Finset.mem_insert_of_mem.

            Lean, line 497
                    have ih' := ih (fun i hi => h0 i (Finset.mem_insert_of_mem hi)) (fun i hi => h1 i (Finset.mem_insert_of_mem hi))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 497 at 879b5c03f7df ↗

          2. hrem_all.prod_one_sub_ge.s2.haj0 have (0 : ℝ) ≤ a j

            Leaves (1 : ℝ) - (a j + ∑ x ∈ s, a x) ≤ ((1 : ℝ) - a j) * ∏ x ∈ s, ((1 : ℝ) - a x), with haj0 : (0 : ℝ) ≤ a j.

            Uses library Finset.mem_insert_self.

            Lean, line 498
                    have haj0 := h0 j (Finset.mem_insert_self j s)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 498 at 879b5c03f7df ↗

          3. hrem_all.prod_one_sub_ge.s2.haj1 have a j ≤ (1 : ℝ)

            Leaves (1 : ℝ) - (a j + ∑ x ∈ s, a x) ≤ ((1 : ℝ) - a j) * ∏ x ∈ s, ((1 : ℝ) - a x), with haj1 : a j ≤ (1 : ℝ).

            Uses library Finset.mem_insert_self.

            Lean, line 499
                    have haj1 := h1 j (Finset.mem_insert_self j s)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 499 at 879b5c03f7df ↗

          4. hrem_all.prod_one_sub_ge.s2.hP have (0 : ℝ) ≤ ∏ i ∈ s, ((1 : ℝ) - a i)

            Leaves (1 : ℝ) - (a j + ∑ x ∈ s, a x) ≤ ((1 : ℝ) - a j) * ∏ x ∈ s, ((1 : ℝ) - a x), with hP : (0 : ℝ) ≤ ∏ i ∈ s, ((1 : ℝ) - a i).

            Uses library Finset.prod_nonneg, Finset.mem_insert_of_mem.

            Lean, lines 500–501
                    have hP : 0 ≤ ∏ i ∈ s, (1 - a i) :=
                      Finset.prod_nonneg (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 500–501 at 879b5c03f7df ↗

          5. hrem_all.prod_one_sub_ge.s2.hP1 have ∏ i ∈ s, ((1 : ℝ) - a i) ≤ (1 : ℝ)

            Leaves (1 : ℝ) - (a j + ∑ x ∈ s, a x) ≤ ((1 : ℝ) - a j) * ∏ x ∈ s, ((1 : ℝ) - a x), with hP1 : ∏ i ∈ s, ((1 : ℝ) - a i) ≤ (1 : ℝ).

            Uses library Finset.prod_le_one If each f i, i ∈ s belongs to [0, 1], then their product is less than or equal to one. , Finset.mem_insert_of_mem.

            Lean, lines 502–504
                    have hP1 : ∏ i ∈ s, (1 - a i) ≤ 1 :=
                      Finset.prod_le_one (fun i hi => by linarith [h1 i (Finset.mem_insert_of_mem hi)])
                        (fun i hi => by linarith [h0 i (Finset.mem_insert_of_mem hi)])

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 502–504 at 879b5c03f7df ↗

      13. hrem_all.nd_bound have ∀ (n K : ℕ), (1 : ℕ) ≤ n → (2 : ℕ) * n + (1 : ℕ) ≤ K → (0 : ℝ) < (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ∧ (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with nd_bound : ∀ (n K : ℕ), (1 : ℕ) ≤ n → (2 : ℕ) * n + (1 : ℕ) ≤ K → (0 : ℝ) < (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ∧ (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K.

        Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. , div_pos, div_le_iff₀ See div_le_iff₀' for a version with multiplication on the other side. .

        Lean, lines 507–562
            have nd_bound : ∀ (n K : ℕ) (hn : 1 ≤ n) (hK : 2 * n + 1 ≤ K),
                0 < (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) ∧
                (∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)
                  ≤ 2 * (1 / 2) ^ K := by
              intro n K hn hK
              have hlt : ∀ i, i < K → (0 : ℝ) < 2 ^ K - 2 ^ i := fun i hi => by
                have : (2 : ℝ) ^ i < 2 ^ K := pow_lt_pow_right₀ (by norm_num) hi
                linarith
              have hNpos : 0 < ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) :=
                Finset.prod_pos (fun L hL => hlt L (by have := Finset.mem_Ioc.mp hL; omega))
              have hDpos : 0 < ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) :=
                Finset.prod_pos (fun i hi => hlt i (by have := Finset.mem_range.mp hi; omega))
              refine ⟨div_pos hNpos hDpos, ?_⟩
              have hN : ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := by
                have := Finset.prod_le_prod (s := Finset.Ioc n (2 * n)) (f := fun L => (2 : ℝ) ^ K - 2 ^ L) (g := fun _ => (2 : ℝ) ^ K)
                  (fun L hL => le_of_lt (hlt L (by have := Finset.mem_Ioc.mp hL; omega))) (fun L _ => by
                    have : (0 : ℝ) < 2 ^ L := by positivity
                    linarith)
                rw [Finset.prod_const, Nat.card_Ioc, show 2 * n - n = n by omega] at this
                exact this
              have hD : (2 ^ K) ^ (n + 1) / 2 ≤ ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by
                have hfac : ∀ i ∈ Finset.range (n + 1), (2 : ℝ) ^ K - 2 ^ i = 2 ^ K * (1 - (1 / 2) ^ (K - i)) := by
                  intro i hi
                  have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega
                  have e : (2 : ℝ) ^ K = 2 ^ i * 2 ^ (K - i) := by rw [← pow_add]; congr 1; omega
                  rw [mul_sub, mul_one, one_div_pow, mul_one_div, e]
                  field_simp
                rw [Finset.prod_congr rfl hfac, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range]
                have hsum : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) ≤ 1 / 2 := by
                  have e : ∀ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) = (1 / 2) ^ (K - n) * (1 / 2) ^ (n - i) := by
                    intro i hi
                    have := Finset.mem_range.mp hi
                    rw [← pow_add]; congr 1; omega
                  rw [Finset.sum_congr rfl e, ← Finset.mul_sum]
                  have hg : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (n - i) ≤ 2 := by
                    have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)
                    simp only [Nat.add_sub_cancel] at hr
                    rw [hr]
                    exact sum_geometric_two_le (n + 1)
                  have hk : ((1 : ℝ) / 2) ^ (K - n) ≤ (1 / 2) ^ 2 :=
                    pow_le_pow_of_le_one (by norm_num) (by norm_num) (by omega)
                  have hpos : 0 ≤ ((1 : ℝ) / 2) ^ (K - n) := by positivity
                  nlinarith
                have hprod := prod_one_sub_ge (Finset.range (n + 1)) (fun i => ((1 : ℝ) / 2) ^ (K - i))
                  (fun i _ => by positivity) (fun i _ => pow_le_one₀ (by norm_num) (by norm_num))
                have h2K : (0 : ℝ) < (2 ^ K) ^ (n + 1) := by positivity
                nlinarith
              rw [div_le_iff₀ hDpos]
              have h2K : (2 : ℝ) ^ K * (1 / 2) ^ K = 1 := by rw [← mul_pow]; norm_num
              have e2 : 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ (n + 1) / 2) = (2 ^ K) ^ n := by
                rw [pow_succ]
                calc 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ n * 2 ^ K / 2) = (2 ^ K * (1 / 2) ^ K) * (2 ^ K) ^ n := by ring
                  _ = (2 ^ K) ^ n := by rw [h2K, one_mul]
              calc ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := hN
                _ = 2 * (1 / 2) ^ K * ((2 ^ K) ^ (n + 1) / 2) := e2.symm
                _ ≤ 2 * (1 / 2) ^ K * ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by gcongr

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 507–562 at 879b5c03f7df ↗

        1. hrem_all.nd_bound.hlt have ∀ i < K, (0 : ℝ) < (2 : ℝ) ^ K - (2 : ℝ) ^ i

          Leaves (0 : ℝ) < (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ∧ (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K, with hlt : ∀ i < K, (0 : ℝ) < (2 : ℝ) ^ K - (2 : ℝ) ^ i.

          Lean, lines 512–514
                have hlt : ∀ i, i < K → (0 : ℝ) < 2 ^ K - 2 ^ i := fun i hi => by
                  have : (2 : ℝ) ^ i < 2 ^ K := pow_lt_pow_right₀ (by norm_num) hi
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 512–514 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.hlt.this have (2 : ℝ) ^ i < (2 : ℝ) ^ K

            Leaves (0 : ℝ) < (2 : ℝ) ^ K - (2 : ℝ) ^ i, with this : (2 : ℝ) ^ i < (2 : ℝ) ^ K.

            Uses library pow_lt_pow_right₀.

            Lean, line 513
                    have : (2 : ℝ) ^ i < 2 ^ K := pow_lt_pow_right₀ (by norm_num) hi

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 513 at 879b5c03f7df ↗

        2. hrem_all.nd_bound.hNpos have (0 : ℝ) < ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)

          Leaves (0 : ℝ) < (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ∧ (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K, with hNpos : (0 : ℝ) < ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L).

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.prod_pos.

          Lean, lines 515–516
                have hNpos : 0 < ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) :=
                  Finset.prod_pos (fun L hL => hlt L (by have := Finset.mem_Ioc.mp hL; omega))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 515–516 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.hNpos.this have n < L ∧ L ≤ (2 : ℕ) * n

            Leaves L < K, with this : n < L ∧ L ≤ (2 : ℕ) * n.

            Uses library Finset.mem_Ioc.

            Lean, line 516
                    Finset.prod_pos (fun L hL => hlt L (by have := Finset.mem_Ioc.mp hL; omega))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 516 at 879b5c03f7df ↗

        3. hrem_all.nd_bound.hDpos have (0 : ℝ) < ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)

          Leaves (0 : ℝ) < (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ∧ (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K, with hDpos : (0 : ℝ) < ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_pos.

          Lean, lines 517–518
                have hDpos : 0 < ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) :=
                  Finset.prod_pos (fun i hi => hlt i (by have := Finset.mem_range.mp hi; omega))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 517–518 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.hDpos.this have i < n + (1 : ℕ)

            Leaves i < K, with this : i < n + (1 : ℕ).

            Uses library Finset.mem_range.

            Lean, line 518
                    Finset.prod_pos (fun i hi => hlt i (by have := Finset.mem_range.mp hi; omega))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 518 at 879b5c03f7df ↗

        4. hrem_all.nd_bound.hN have ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ ((2 : ℝ) ^ K) ^ n

          Leaves (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K, with hN : ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ ((2 : ℝ) ^ K) ^ n.

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.prod_const, Nat.card_Ioc.

          Lean, lines 520–526
                have hN : ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := by
                  have := Finset.prod_le_prod (s := Finset.Ioc n (2 * n)) (f := fun L => (2 : ℝ) ^ K - 2 ^ L) (g := fun _ => (2 : ℝ) ^ K)
                    (fun L hL => le_of_lt (hlt L (by have := Finset.mem_Ioc.mp hL; omega))) (fun L _ => by
                      have : (0 : ℝ) < 2 ^ L := by positivity
                      linarith)
                  rw [Finset.prod_const, Nat.card_Ioc, show 2 * n - n = n by omega] at this
                  exact this

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 520–526 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.hN.this have ∏ i ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ ∏ i ∈ Finset.Ioc n ((2 : ℕ) * n), (2 : ℝ) ^ K

            Leaves ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ ((2 : ℝ) ^ K) ^ n, with this : ∏ i ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ ∏ i ∈ Finset.Ioc n ((2 : ℕ) * n), (2 : ℝ) ^ K.

            Uses library Finset.prod_le_prod If all f i, i ∈ s, are nonnegative and each f i is less than or equal to g i, then the product of f i is less than or equal to the product of g i. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , le_of_lt.

            Lean, lines 521–524
                    have := Finset.prod_le_prod (s := Finset.Ioc n (2 * n)) (f := fun L => (2 : ℝ) ^ K - 2 ^ L) (g := fun _ => (2 : ℝ) ^ K)
                      (fun L hL => le_of_lt (hlt L (by have := Finset.mem_Ioc.mp hL; omega))) (fun L _ => by
                        have : (0 : ℝ) < 2 ^ L := by positivity
                        linarith)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 521–524 at 879b5c03f7df ↗

            1. hrem_all.nd_bound.hN.this.s1 have n < L ∧ L ≤ (2 : ℕ) * n

              Leaves L < K, with this : n < L ∧ L ≤ (2 : ℕ) * n.

              Uses library Finset.mem_Ioc.

              Lean, line 522
                        (fun L hL => le_of_lt (hlt L (by have := Finset.mem_Ioc.mp hL; omega))) (fun L _ => by

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 522 at 879b5c03f7df ↗

            2. hrem_all.nd_bound.hN.this.s2 have (0 : ℝ) < (2 : ℝ) ^ L routine: positivity

              Leaves (2 : ℝ) ^ K - (2 : ℝ) ^ L ≤ (2 : ℝ) ^ K, with this : (0 : ℝ) < (2 : ℝ) ^ L.

              Lean, line 523
                          have : (0 : ℝ) < 2 ^ L := by positivity

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 523 at 879b5c03f7df ↗

        5. hrem_all.nd_bound.hD have ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)

          Leaves (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K, with hD : ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i).

          Uses library Finset.range range n is the set of natural numbers less than n. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range.

          Lean, lines 527–553
                have hD : (2 ^ K) ^ (n + 1) / 2 ≤ ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by
                  have hfac : ∀ i ∈ Finset.range (n + 1), (2 : ℝ) ^ K - 2 ^ i = 2 ^ K * (1 - (1 / 2) ^ (K - i)) := by
                    intro i hi
                    have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega
                    have e : (2 : ℝ) ^ K = 2 ^ i * 2 ^ (K - i) := by rw [← pow_add]; congr 1; omega
                    rw [mul_sub, mul_one, one_div_pow, mul_one_div, e]
                    field_simp
                  rw [Finset.prod_congr rfl hfac, Finset.prod_mul_distrib, Finset.prod_const, Finset.card_range]
                  have hsum : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) ≤ 1 / 2 := by
                    have e : ∀ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) = (1 / 2) ^ (K - n) * (1 / 2) ^ (n - i) := by
                      intro i hi
                      have := Finset.mem_range.mp hi
                      rw [← pow_add]; congr 1; omega
                    rw [Finset.sum_congr rfl e, ← Finset.mul_sum]
                    have hg : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (n - i) ≤ 2 := by
                      have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)
                      simp only [Nat.add_sub_cancel] at hr
                      rw [hr]
                      exact sum_geometric_two_le (n + 1)
                    have hk : ((1 : ℝ) / 2) ^ (K - n) ≤ (1 / 2) ^ 2 :=
                      pow_le_pow_of_le_one (by norm_num) (by norm_num) (by omega)
                    have hpos : 0 ≤ ((1 : ℝ) / 2) ^ (K - n) := by positivity
                    nlinarith
                  have hprod := prod_one_sub_ge (Finset.range (n + 1)) (fun i => ((1 : ℝ) / 2) ^ (K - i))
                    (fun i _ => by positivity) (fun i _ => pow_le_one₀ (by norm_num) (by norm_num))
                  have h2K : (0 : ℝ) < (2 ^ K) ^ (n + 1) := by positivity
                  nlinarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 527–553 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.hD.hfac have ∀ i ∈ Finset.range (n + (1 : ℕ)), (2 : ℝ) ^ K - (2 : ℝ) ^ i = (2 : ℝ) ^ K * ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i))

            Leaves ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i), with hfac : ∀ i ∈ Finset.range (n + (1 : ℕ)), (2 : ℝ) ^ K - (2 : ℝ) ^ i = (2 : ℝ) ^ K * ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i)).

            Uses library Finset.range range n is the set of natural numbers less than n. , mul_sub Alias of mul_sub_left_distrib. , mul_one, one_div_pow, mul_one_div.

            Lean, lines 528–533
                    have hfac : ∀ i ∈ Finset.range (n + 1), (2 : ℝ) ^ K - 2 ^ i = 2 ^ K * (1 - (1 / 2) ^ (K - i)) := by
                      intro i hi
                      have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega
                      have e : (2 : ℝ) ^ K = 2 ^ i * 2 ^ (K - i) := by rw [← pow_add]; congr 1; omega
                      rw [mul_sub, mul_one, one_div_pow, mul_one_div, e]
                      field_simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 528–533 at 879b5c03f7df ↗

            1. hrem_all.nd_bound.hD.hfac.hiK have i ≤ K

              Leaves (2 : ℝ) ^ K - (2 : ℝ) ^ i = (2 : ℝ) ^ K * ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i)), with hiK : i ≤ K.

              Lean, line 530
                        have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 530 at 879b5c03f7df ↗

              1. hrem_all.nd_bound.hD.hfac.hiK.this have i < n + (1 : ℕ)

                Leaves i ≤ K, with this : i < n + (1 : ℕ).

                Uses library Finset.mem_range.

                Lean, line 530
                          have hiK : i ≤ K := by have := Finset.mem_range.mp hi; omega

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 530 at 879b5c03f7df ↗

            2. hrem_all.nd_bound.hD.hfac.e have (2 : ℝ) ^ K = (2 : ℝ) ^ i * (2 : ℝ) ^ (K - i)

              Leaves (2 : ℝ) ^ K - (2 : ℝ) ^ i = (2 : ℝ) ^ K * ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i)), with e : (2 : ℝ) ^ K = (2 : ℝ) ^ i * (2 : ℝ) ^ (K - i).

              Uses library pow_add.

              Lean, line 531
                        have e : (2 : ℝ) ^ K = 2 ^ i * 2 ^ (K - i) := by rw [← pow_add]; congr 1; omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 531 at 879b5c03f7df ↗

          2. hrem_all.nd_bound.hD.hsum have ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) ≤ (1 / 2 : ℝ)

            Leaves ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) * ∏ x ∈ Finset.range (n + (1 : ℕ)), ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - x)), with hsum : ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) ≤ (1 / 2 : ℝ).

            Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.mul_sum.

            Lean, lines 535–549
                    have hsum : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) ≤ 1 / 2 := by
                      have e : ∀ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) = (1 / 2) ^ (K - n) * (1 / 2) ^ (n - i) := by
                        intro i hi
                        have := Finset.mem_range.mp hi
                        rw [← pow_add]; congr 1; omega
                      rw [Finset.sum_congr rfl e, ← Finset.mul_sum]
                      have hg : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (n - i) ≤ 2 := by
                        have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)
                        simp only [Nat.add_sub_cancel] at hr
                        rw [hr]
                        exact sum_geometric_two_le (n + 1)
                      have hk : ((1 : ℝ) / 2) ^ (K - n) ≤ (1 / 2) ^ 2 :=
                        pow_le_pow_of_le_one (by norm_num) (by norm_num) (by omega)
                      have hpos : 0 ≤ ((1 : ℝ) / 2) ^ (K - n) := by positivity
                      nlinarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 535–549 at 879b5c03f7df ↗

            1. hrem_all.nd_bound.hD.hsum.e have ∀ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) = (1 / 2 : ℝ) ^ (K - n) * (1 / 2 : ℝ) ^ (n - i)

              Leaves ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) ≤ (1 / 2 : ℝ), with e : ∀ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) = (1 / 2 : ℝ) ^ (K - n) * (1 / 2 : ℝ) ^ (n - i).

              Uses library Finset.range range n is the set of natural numbers less than n. , pow_add.

              Lean, lines 536–539
                        have e : ∀ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (K - i) = (1 / 2) ^ (K - n) * (1 / 2) ^ (n - i) := by
                          intro i hi
                          have := Finset.mem_range.mp hi
                          rw [← pow_add]; congr 1; omega

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 536–539 at 879b5c03f7df ↗

              1. hrem_all.nd_bound.hD.hsum.e.this have i < n + (1 : ℕ)

                Leaves (1 / 2 : ℝ) ^ (K - i) = (1 / 2 : ℝ) ^ (K - n) * (1 / 2 : ℝ) ^ (n - i), with this : i < n + (1 : ℕ).

                Uses library Finset.mem_range.

                Lean, line 538
                            have := Finset.mem_range.mp hi

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 538 at 879b5c03f7df ↗

            2. hrem_all.nd_bound.hD.hsum.hg have ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (2 : ℝ)

              Leaves (1 / 2 : ℝ) ^ (K - n) * ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (1 / 2 : ℝ), with hg : ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (2 : ℝ).

              Uses library Finset.range range n is the set of natural numbers less than n. , Nat.add_sub_cancel, sum_geometric_two_le.

              Lean, lines 541–545
                        have hg : ∑ i ∈ Finset.range (n + 1), ((1 : ℝ) / 2) ^ (n - i) ≤ 2 := by
                          have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)
                          simp only [Nat.add_sub_cancel] at hr
                          rw [hr]
                          exact sum_geometric_two_le (n + 1)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 541–545 at 879b5c03f7df ↗

              1. hrem_all.nd_bound.hD.hsum.hg.hr have ∑ j ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n + (1 : ℕ) - (1 : ℕ) - j) = ∑ j ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ j

                Leaves ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (2 : ℝ), with hr : ∑ j ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n + (1 : ℕ) - (1 : ℕ) - j) = ∑ j ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ j.

                Uses library Finset.sum_range_reflect.

                Lean, line 542
                            have hr := Finset.sum_range_reflect (fun i => ((1 : ℝ) / 2) ^ i) (n + 1)

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 542 at 879b5c03f7df ↗

            3. hrem_all.nd_bound.hD.hsum.hk have (1 / 2 : ℝ) ^ (K - n) ≤ (1 / 2 : ℝ) ^ (2 : ℕ)

              Leaves (1 / 2 : ℝ) ^ (K - n) * ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (1 / 2 : ℝ), with hk : (1 / 2 : ℝ) ^ (K - n) ≤ (1 / 2 : ℝ) ^ (2 : ℕ).

              Uses library pow_le_pow_of_le_one.

              Lean, lines 546–547
                        have hk : ((1 : ℝ) / 2) ^ (K - n) ≤ (1 / 2) ^ 2 :=
                          pow_le_pow_of_le_one (by norm_num) (by norm_num) (by omega)

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 546–547 at 879b5c03f7df ↗

            4. hrem_all.nd_bound.hD.hsum.hpos have (0 : ℝ) ≤ (1 / 2 : ℝ) ^ (K - n) routine: positivity

              Leaves (1 / 2 : ℝ) ^ (K - n) * ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (n - i) ≤ (1 / 2 : ℝ), with hpos : (0 : ℝ) ≤ (1 / 2 : ℝ) ^ (K - n).

              Lean, line 548
                        have hpos : 0 ≤ ((1 : ℝ) / 2) ^ (K - n) := by positivity

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 548 at 879b5c03f7df ↗

          3. hrem_all.nd_bound.hD.hprod have (1 : ℝ) - ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) ≤ ∏ i ∈ Finset.range (n + (1 : ℕ)), ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i))

            Leaves ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) * ∏ x ∈ Finset.range (n + (1 : ℕ)), ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - x)), with hprod : (1 : ℝ) - ∑ i ∈ Finset.range (n + (1 : ℕ)), (1 / 2 : ℝ) ^ (K - i) ≤ ∏ i ∈ Finset.range (n + (1 : ℕ)), ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - i)).

            Uses library Finset.range range n is the set of natural numbers less than n. , pow_le_one₀.

            Lean, lines 550–551
                    have hprod := prod_one_sub_ge (Finset.range (n + 1)) (fun i => ((1 : ℝ) / 2) ^ (K - i))
                      (fun i _ => by positivity) (fun i _ => pow_le_one₀ (by norm_num) (by norm_num))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 550–551 at 879b5c03f7df ↗

          4. hrem_all.nd_bound.hD.h2K have (0 : ℝ) < ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) routine: positivity

            Leaves ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ) ≤ ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) * ∏ x ∈ Finset.range (n + (1 : ℕ)), ((1 : ℝ) - (1 / 2 : ℝ) ^ (K - x)), with h2K : (0 : ℝ) < ((2 : ℝ) ^ K) ^ (n + (1 : ℕ)).

            Lean, line 552
                    have h2K : (0 : ℝ) < (2 ^ K) ^ (n + 1) := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 552 at 879b5c03f7df ↗

        6. hrem_all.nd_bound.h2K have (2 : ℝ) ^ K * (1 / 2 : ℝ) ^ K = (1 : ℝ)

          Leaves ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K * ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i), with h2K : (2 : ℝ) ^ K * (1 / 2 : ℝ) ^ K = (1 : ℝ).

          Uses library mul_pow.

          Lean, line 555
                have h2K : (2 : ℝ) ^ K * (1 / 2) ^ K = 1 := by rw [← mul_pow]; norm_num

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 555 at 879b5c03f7df ↗

        7. hrem_all.nd_bound.e2 have (2 : ℝ) * (1 / 2 : ℝ) ^ K * (((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ)) = ((2 : ℝ) ^ K) ^ n

          Leaves ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K * ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i), with e2 : (2 : ℝ) * (1 / 2 : ℝ) ^ K * (((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ)) = ((2 : ℝ) ^ K) ^ n.

          Uses library pow_succ.

          Lean, lines 556–559
                have e2 : 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ (n + 1) / 2) = (2 ^ K) ^ n := by
                  rw [pow_succ]
                  calc 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ n * 2 ^ K / 2) = (2 ^ K * (1 / 2) ^ K) * (2 ^ K) ^ n := by ring
                    _ = (2 ^ K) ^ n := by rw [h2K, one_mul]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 556–559 at 879b5c03f7df ↗

          1. hrem_all.nd_bound.e2.s1 calc (2 : ℝ) * (1 / 2 : ℝ) ^ K * (((2 : ℝ) ^ K) ^ n * (2 : ℝ) ^ K / (2 : ℝ)) = (2 : ℝ) ^ K * (1 / 2 : ℝ) ^ K * ((2 : ℝ) ^ K) ^ n routine: ring

            Closes the goal.

            Lean, line 558
                    calc 2 * (1 / 2 : ℝ) ^ K * ((2 ^ K) ^ n * 2 ^ K / 2) = (2 ^ K * (1 / 2) ^ K) * (2 ^ K) ^ n := by ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 558 at 879b5c03f7df ↗

          2. hrem_all.nd_bound.e2.s2 calc

            Closes the goal.

            Uses library one_mul.

            Lean, line 559
                      _ = (2 ^ K) ^ n := by rw [h2K, one_mul]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 559 at 879b5c03f7df ↗

        8. hrem_all.nd_bound.s8 calc ∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L) ≤ ((2 : ℝ) ^ K) ^ n

          Closes the goal.

          Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. .

          Lean, line 560
                calc ∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L) ≤ (2 ^ K) ^ n := hN

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 560 at 879b5c03f7df ↗

        9. hrem_all.nd_bound.s9 calc ((2 : ℝ) ^ K) ^ n = (2 : ℝ) * (1 / 2 : ℝ) ^ K * (((2 : ℝ) ^ K) ^ (n + (1 : ℕ)) / (2 : ℝ))

          Closes the goal.

          Lean, line 561
                  _ = 2 * (1 / 2) ^ K * ((2 ^ K) ^ (n + 1) / 2) := e2.symm

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 561 at 879b5c03f7df ↗

        10. hrem_all.nd_bound.s10 calc

          Closes the goal.

          Uses library Finset.range range n is the set of natural numbers less than n. .

          Lean, line 562
                  _ ≤ 2 * (1 / 2) ^ K * ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i) := by gcongr

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 562 at 879b5c03f7df ↗

      14. hrem_all.ineq_pow have ∀ (n : ℕ), (2 : ℕ) ≤ n → (9 : ℕ) * (81 : ℕ) ^ n ≤ (256 : ℕ) ^ n

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with ineq_pow : ∀ (n : ℕ), (2 : ℕ) ≤ n → (9 : ℕ) * (81 : ℕ) ^ n ≤ (256 : ℕ) ^ n.

        Lean, lines 565–575
            have ineq_pow : ∀ (n : ℕ) (hn : 2 ≤ n),
                9 * 81 ^ n ≤ 256 ^ n := by
              intro n hn
              induction n with
              | zero => omega
              | succ m ih =>
                rcases (show m = 1 ∨ 2 ≤ m by omega) with rfl | hm
                · norm_num
                · have := ih hm
                  rw [pow_succ, pow_succ]
                  omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 565–575 at 879b5c03f7df ↗

        1. hrem_all.ineq_pow.s1 case routine: omega

          Leaves (9 : ℕ) * (81 : ℕ) ^ (0 : ℕ) ≤ (256 : ℕ) ^ (0 : ℕ), with hn : (2 : ℕ) ≤ (0 : ℕ).

          Uses library Nat.zero Zero, the smallest natural number. .

          Lean, line 569
                | zero => omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 569 at 879b5c03f7df ↗

        2. hrem_all.ineq_pow.s2 case

          Leaves (9 : ℕ) * (81 : ℕ) ^ (m + (1 : ℕ)) ≤ (256 : ℕ) ^ (m + (1 : ℕ)), with m : ℕ, ih : (2 : ℕ) ≤ m → (9 : ℕ) * (81 : ℕ) ^ m ≤ (256 : ℕ) ^ m, hn : (2 : ℕ) ≤ m + (1 : ℕ).

          Uses library Nat.succ The successor of a natural number n. .

          Lean, lines 570–575
                | succ m ih =>
                  rcases (show m = 1 ∨ 2 ≤ m by omega) with rfl | hm
                  · norm_num
                  · have := ih hm
                    rw [pow_succ, pow_succ]
                    omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 570–575 at 879b5c03f7df ↗

          1. hrem_all.ineq_pow.s2.s1 case routine: norm_num

            Leaves (9 : ℕ) * (81 : ℕ) ^ ((1 : ℕ) + (1 : ℕ)) ≤ (256 : ℕ) ^ ((1 : ℕ) + (1 : ℕ)).

            Lean, line 572
                    · norm_num

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 572 at 879b5c03f7df ↗

          2. hrem_all.ineq_pow.s2.s2 case

            Leaves (9 : ℕ) * (81 : ℕ) ^ (m + (1 : ℕ)) ≤ (256 : ℕ) ^ (m + (1 : ℕ)).

            Uses library pow_succ.

            Lean, lines 573–575
                    · have := ih hm
                      rw [pow_succ, pow_succ]
                      omega

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 573–575 at 879b5c03f7df ↗

            1. hrem_all.ineq_pow.s2.s2.this have (9 : ℕ) * (81 : ℕ) ^ m ≤ (256 : ℕ) ^ m

              Leaves (9 : ℕ) * (81 : ℕ) ^ (m + (1 : ℕ)) ≤ (256 : ℕ) ^ (m + (1 : ℕ)), with this : (9 : ℕ) * (81 : ℕ) ^ m ≤ (256 : ℕ) ^ m.

              Lean, line 573
                      · have := ih hm

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 573 at 879b5c03f7df ↗

      15. hrem_all.h4_big have ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), (2 : ℕ) ≤ n → (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with h4_big : ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → ∀ (n : ℕ), (2 : ℕ) ≤ n → (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

        Uses library Finset.range range n is the set of natural numbers less than n. , Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, lines 577–670
            have h4_big : ∀ (Qc : ℕ → ℕ → ℚ) (hQc : (Qc = fun (n k : ℕ) =>
                ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) *
                    ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) *
                  ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)))) (Qx : ℕ → ℚ) (hQx : (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k))
              (Aq : ℕ → ℚ) (hAq : (Aq = fun (n : ℕ) =>
                        ∑ k ∈ Finset.range (n + (1 : ℕ)),
                            (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) *
                              ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
                          Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)))) (n : ℕ) (hn : 2 ≤ n),
                (0 : ℝ) < (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) ∧
                ((Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ)) ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤
                  (2 : ℝ) ^ (2 * n + 4) := by
              intro Qc hQc Qx hQx Aq hAq n hn
              have hS := h4_series Qc hQc Qx hQx Aq hAq n (by omega)
              set r := (Qx n : ℝ) * (3 * ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3)) - (Aq n : ℝ) with hr
              set x : ℝ := (3 : ℝ) / 2 ^ n with hxdef
              have hx0 : 0 < x := by positivity
              have hx2 : x / 2 ≤ 3 / 8 := by
                have : (4 : ℝ) ≤ 2 ^ n := by
                  calc (4 : ℝ) = 2 ^ 2 := by norm_num
                    _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
                rw [hxdef, div_div, div_le_div_iff₀ (by positivity) (by norm_num)]; linarith
              set G : ℕ → ℝ := fun K => if 2 * n < K then
                    ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) / ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) *
                      x ^ K else 0 with hG
              have hGnn : ∀ K, 0 ≤ G K := by
                intro K; simp only [hG]
                split_ifs with h
                · exact mul_nonneg (le_of_lt (nd_bound n K (by omega) (by omega)).1) (by positivity)
                · exact le_refl 0
              have hGpos : 0 < G (2 * n + 1) := by
                simp only [hG]; rw [if_pos (by omega)]
                exact mul_pos (nd_bound n (2 * n + 1) (by omega) (by omega)).1 (by positivity)
              refine ⟨?_, ?_⟩
              · exact hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1) (fun K => hGnn K) hGpos hasSum_zero hS
              · set H : ℕ → ℝ := fun K => if 2 * n < K then 2 * (x / 2) ^ K else 0 with hH
                have hGH : ∀ K, G K ≤ H K := by
                  intro K; simp only [hG, hH]
                  split_ifs with h
                  · have hb := (nd_bound n K (by omega) (by omega)).2
                    calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                          ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                          gcongr
                      _ = 2 * (x / 2) ^ K := by ring
                  · exact le_refl 0
                have hq : x / 2 < 1 := by linarith
                have hHsum : HasSum H (2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹) := by
                  rw [← hasSum_nat_add_iff' (2 * n + 1)]
                  have hz : ∑ i ∈ Finset.range (2 * n + 1), H i = 0 :=
                    Finset.sum_eq_zero (fun i hi => by
                      simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])
                  rw [hz, sub_zero]
                  have hgeo := (hasSum_geometric_of_lt_one (by positivity) hq).mul_left (2 * (x / 2) ^ (2 * n + 1))
                  have hfun : (fun s => H (s + (2 * n + 1))) = fun s => 2 * (x / 2) ^ (2 * n + 1) * (x / 2) ^ s := by
                    funext s; simp only [hH]; rw [if_pos (by omega), pow_add]; ring
                  rw [hfun]
                  exact hgeo
                have hrle : r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hasSum_le hGH hS hHsum
                have hr0 : 0 ≤ r := le_of_lt (hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1)
                  (fun K => hGnn K) hGpos hasSum_zero hS)
                have hr8 : r ≤ 8 * (x / 2) ^ (2 * n + 1) := by
                  have hinv : (1 - x / 2)⁻¹ ≤ 4 := by
                    rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith
                  have hp : 0 ≤ 2 * (x / 2) ^ (2 * n + 1) := by positivity
                  calc r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hrle
                    _ ≤ 2 * (x / 2) ^ (2 * n + 1) * 4 := by gcongr
                    _ = 8 * (x / 2) ^ (2 * n + 1) := by ring
                have hsq : r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := pow_le_pow_left₀ hr0 hr8 2
                have hnat : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                  have e1 : (2 : ℕ) ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) = 2 ^ (4 * n * n) * (64 * 256 ^ n) := by
                    rw [← pow_mul, ← pow_add, show (256 : ℕ) = 2 ^ 8 by norm_num, ← pow_mul,
                      show (64 : ℕ) = 2 ^ 6 by norm_num, ← pow_add, ← pow_add]
                    congr 1; ring
                  have e2 : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) = 2 ^ (4 * n * n) * (64 * (9 * 81 ^ n)) := by
                    rw [show (81 : ℕ) = 3 ^ 4 by norm_num, ← pow_mul, pow_add]; ring
                  rw [e1, e2]
                  have := ineq_pow n hn
                  gcongr
                have hreal : (64 : ℝ) * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                  exact_mod_cast hnat
                have hx2' : x / 2 = 3 / 2 ^ (n + 1) := by rw [hxdef, pow_succ]; field_simp
                have hsq' : r ^ 2 ≤ 64 * (x / 2) ^ (4 * n + 2) := by
                  calc r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := hsq
                    _ = 64 * (x / 2) ^ (4 * n + 2) := by ring
                have hkey : (x / 2) ^ (4 * n + 2) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) = 3 ^ (4 * n + 2) := by
                  rw [← mul_pow, hx2', div_mul_cancel₀ _ (by positivity)]
                have hP : (0 : ℝ) < ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := by positivity
                have hmain : 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) := by
                  refine le_of_mul_le_mul_right ?_ hP
                  calc 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2)
                      = 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) := by rw [← hkey]; ring
                    _ ≤ 2 ^ (2 * n + 4) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := hreal
                calc r ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ 64 * (x / 2) ^ (4 * n + 2) * 2 ^ (4 * n * n) := by gcongr
                  _ ≤ 2 ^ (2 * n + 4) := hmain

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 577–670 at 879b5c03f7df ↗

        1. hrem_all.h4_big.hS have HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ))

          Leaves (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hS : HasSum (fun (K : ℕ) => if (2 : ℕ) * n < K then ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * ((3 : ℝ) / (2 : ℝ) ^ n) ^ K else (0 : ℝ)) ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)).

          Lean, line 590
                have hS := h4_series Qc hQc Qx hQx Aq hAq n (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 590 at 879b5c03f7df ↗

        2. hrem_all.h4_big.hx0 have (0 : ℝ) < x routine: positivity

          Leaves (0 : ℝ) < r ∧ r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hx0 : (0 : ℝ) < x.

          Lean, line 593
                have hx0 : 0 < x := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 593 at 879b5c03f7df ↗

        3. hrem_all.h4_big.hx2 have x / (2 : ℝ) ≤ (3 / 8 : ℝ)

          Leaves (0 : ℝ) < r ∧ r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hx2 : x / (2 : ℝ) ≤ (3 / 8 : ℝ).

          Uses library div_div, div_le_div_iff₀.

          Lean, lines 594–598
                have hx2 : x / 2 ≤ 3 / 8 := by
                  have : (4 : ℝ) ≤ 2 ^ n := by
                    calc (4 : ℝ) = 2 ^ 2 := by norm_num
                      _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn
                  rw [hxdef, div_div, div_le_div_iff₀ (by positivity) (by norm_num)]; linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 594–598 at 879b5c03f7df ↗

          1. hrem_all.h4_big.hx2.this have (4 : ℝ) ≤ (2 : ℝ) ^ n

            Leaves x / (2 : ℝ) ≤ (3 / 8 : ℝ), with this : (4 : ℝ) ≤ (2 : ℝ) ^ n.

            Lean, lines 595–597
                    have : (4 : ℝ) ≤ 2 ^ n := by
                      calc (4 : ℝ) = 2 ^ 2 := by norm_num
                        _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 595–597 at 879b5c03f7df ↗

            1. hrem_all.h4_big.hx2.this.s1 calc (4 : ℝ) = (2 : ℝ) ^ (2 : ℕ) routine: norm_num

              Closes the goal.

              Lean, line 596
                        calc (4 : ℝ) = 2 ^ 2 := by norm_num

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 596 at 879b5c03f7df ↗

            2. hrem_all.h4_big.hx2.this.s2 calc (2 : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ n

              Closes the goal.

              Uses library pow_le_pow_right₀.

              Lean, line 597
                          _ ≤ 2 ^ n := pow_le_pow_right₀ (by norm_num) hn

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 597 at 879b5c03f7df ↗

        4. hrem_all.h4_big.hGnn have ∀ (K : ℕ), (0 : ℝ) ≤ G K

          Leaves (0 : ℝ) < r ∧ r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hGnn : ∀ (K : ℕ), (0 : ℝ) ≤ G K.

          Lean, lines 602–606
                have hGnn : ∀ K, 0 ≤ G K := by
                  intro K; simp only [hG]
                  split_ifs with h
                  · exact mul_nonneg (le_of_lt (nd_bound n K (by omega) (by omega)).1) (by positivity)
                  · exact le_refl 0

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 602–606 at 879b5c03f7df ↗

          1. hrem_all.h4_big.hGnn.s1 case

            Leaves (0 : ℝ) ≤ ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ L ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) * x ^ K.

            Uses library mul_nonneg Alias of Left.mul_nonneg. , le_of_lt.

            Lean, line 605
                    · exact mul_nonneg (le_of_lt (nd_bound n K (by omega) (by omega)).1) (by positivity)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 605 at 879b5c03f7df ↗

          2. hrem_all.h4_big.hGnn.s2 case

            Leaves (0 : ℝ) ≤ (0 : ℝ).

            Uses library le_refl The relation ≤ on a preorder is reflexive. .

            Lean, line 606
                    · exact le_refl 0

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 606 at 879b5c03f7df ↗

        5. hrem_all.h4_big.hGpos have (0 : ℝ) < G ((2 : ℕ) * n + (1 : ℕ))

          Leaves (0 : ℝ) < r ∧ r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hGpos : (0 : ℝ) < G ((2 : ℕ) * n + (1 : ℕ)).

          Uses library if_pos, mul_pos Alias of Left.mul_pos. .

          Lean, lines 607–609
                have hGpos : 0 < G (2 * n + 1) := by
                  simp only [hG]; rw [if_pos (by omega)]
                  exact mul_pos (nd_bound n (2 * n + 1) (by omega) (by omega)).1 (by positivity)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 607–609 at 879b5c03f7df ↗

        6. hrem_all.h4_big.s6 case

          Leaves (0 : ℝ) < r.

          Uses library hasSum_lt, hasSum_zero Constant zero function has sum 0 .

          Lean, line 611
                · exact hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1) (fun K => hGnn K) hGpos hasSum_zero hS

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 611 at 879b5c03f7df ↗

        7. hrem_all.h4_big.s7 case

          Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

          Lean, lines 612–670
                · set H : ℕ → ℝ := fun K => if 2 * n < K then 2 * (x / 2) ^ K else 0 with hH
                  have hGH : ∀ K, G K ≤ H K := by
                    intro K; simp only [hG, hH]
                    split_ifs with h
                    · have hb := (nd_bound n K (by omega) (by omega)).2
                      calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                            ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                            gcongr
                        _ = 2 * (x / 2) ^ K := by ring
                    · exact le_refl 0
                  have hq : x / 2 < 1 := by linarith
                  have hHsum : HasSum H (2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹) := by
                    rw [← hasSum_nat_add_iff' (2 * n + 1)]
                    have hz : ∑ i ∈ Finset.range (2 * n + 1), H i = 0 :=
                      Finset.sum_eq_zero (fun i hi => by
                        simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])
                    rw [hz, sub_zero]
                    have hgeo := (hasSum_geometric_of_lt_one (by positivity) hq).mul_left (2 * (x / 2) ^ (2 * n + 1))
                    have hfun : (fun s => H (s + (2 * n + 1))) = fun s => 2 * (x / 2) ^ (2 * n + 1) * (x / 2) ^ s := by
                      funext s; simp only [hH]; rw [if_pos (by omega), pow_add]; ring
                    rw [hfun]
                    exact hgeo
                  have hrle : r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hasSum_le hGH hS hHsum
                  have hr0 : 0 ≤ r := le_of_lt (hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1)
                    (fun K => hGnn K) hGpos hasSum_zero hS)
                  have hr8 : r ≤ 8 * (x / 2) ^ (2 * n + 1) := by
                    have hinv : (1 - x / 2)⁻¹ ≤ 4 := by
                      rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith
                    have hp : 0 ≤ 2 * (x / 2) ^ (2 * n + 1) := by positivity
                    calc r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hrle
                      _ ≤ 2 * (x / 2) ^ (2 * n + 1) * 4 := by gcongr
                      _ = 8 * (x / 2) ^ (2 * n + 1) := by ring
                  have hsq : r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := pow_le_pow_left₀ hr0 hr8 2
                  have hnat : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                    have e1 : (2 : ℕ) ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) = 2 ^ (4 * n * n) * (64 * 256 ^ n) := by
                      rw [← pow_mul, ← pow_add, show (256 : ℕ) = 2 ^ 8 by norm_num, ← pow_mul,
                        show (64 : ℕ) = 2 ^ 6 by norm_num, ← pow_add, ← pow_add]
                      congr 1; ring
                    have e2 : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) = 2 ^ (4 * n * n) * (64 * (9 * 81 ^ n)) := by
                      rw [show (81 : ℕ) = 3 ^ 4 by norm_num, ← pow_mul, pow_add]; ring
                    rw [e1, e2]
                    have := ineq_pow n hn
                    gcongr
                  have hreal : (64 : ℝ) * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                    exact_mod_cast hnat
                  have hx2' : x / 2 = 3 / 2 ^ (n + 1) := by rw [hxdef, pow_succ]; field_simp
                  have hsq' : r ^ 2 ≤ 64 * (x / 2) ^ (4 * n + 2) := by
                    calc r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := hsq
                      _ = 64 * (x / 2) ^ (4 * n + 2) := by ring
                  have hkey : (x / 2) ^ (4 * n + 2) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) = 3 ^ (4 * n + 2) := by
                    rw [← mul_pow, hx2', div_mul_cancel₀ _ (by positivity)]
                  have hP : (0 : ℝ) < ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := by positivity
                  have hmain : 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) := by
                    refine le_of_mul_le_mul_right ?_ hP
                    calc 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2)
                        = 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) := by rw [← hkey]; ring
                      _ ≤ 2 ^ (2 * n + 4) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := hreal
                  calc r ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ 64 * (x / 2) ^ (4 * n + 2) * 2 ^ (4 * n * n) := by gcongr
                    _ ≤ 2 ^ (2 * n + 4) := hmain

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 612–670 at 879b5c03f7df ↗

          1. hrem_all.h4_big.s7.hGH have ∀ (K : ℕ), G K ≤ H K

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hGH : ∀ (K : ℕ), G K ≤ H K.

            Lean, lines 613–621
                    have hGH : ∀ K, G K ≤ H K := by
                      intro K; simp only [hG, hH]
                      split_ifs with h
                      · have hb := (nd_bound n K (by omega) (by omega)).2
                        calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                              ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                              gcongr
                          _ = 2 * (x / 2) ^ K := by ring
                      · exact le_refl 0

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 613–621 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hGH.s1 case

              Leaves ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ L ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) * x ^ K ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ K.

              Lean, lines 616–620
                        · have hb := (nd_bound n K (by omega) (by omega)).2
                          calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                                ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                                gcongr
                            _ = 2 * (x / 2) ^ K := by ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 616–620 at 879b5c03f7df ↗

              1. hrem_all.h4_big.s7.hGH.s1.hb have (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K

                Leaves ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ L ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) * x ^ K ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ K, with hb : (∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i) ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K.

                Lean, line 616
                          · have hb := (nd_bound n K (by omega) (by omega)).2

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 616 at 879b5c03f7df ↗

              2. hrem_all.h4_big.s7.hGH.s1.s2 calc ((∏ L ∈ Finset.Ioc n ((2 : ℕ) * n), ((2 : ℝ) ^ K - (2 : ℝ) ^ L)) / ∏ i ∈ Finset.range (n + (1 : ℕ)), ((2 : ℝ) ^ K - (2 : ℝ) ^ i)) * x ^ K ≤ (2 : ℝ) * (1 / 2 : ℝ) ^ K * x ^ K

                Closes the goal.

                Uses library Finset.Ioc The finset $(a, b]$ of elements x such that a < x and x ≤ b. , Finset.range range n is the set of natural numbers less than n. .

                Lean, lines 617–619
                            calc ((∏ L ∈ Finset.Ioc n (2 * n), ((2 : ℝ) ^ K - 2 ^ L)) /
                                  ∏ i ∈ Finset.range (n + 1), ((2 : ℝ) ^ K - 2 ^ i)) * x ^ K ≤ 2 * (1 / 2) ^ K * x ^ K := by
                                  gcongr

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 617–619 at 879b5c03f7df ↗

              3. hrem_all.h4_big.s7.hGH.s1.s3 calc routine: ring

                Closes the goal.

                Lean, line 620
                              _ = 2 * (x / 2) ^ K := by ring

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 620 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hGH.s2 case

              Leaves (0 : ℝ) ≤ (0 : ℝ).

              Uses library le_refl The relation ≤ on a preorder is reflexive. .

              Lean, line 621
                        · exact le_refl 0

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 621 at 879b5c03f7df ↗

          2. hrem_all.h4_big.s7.hq have x / (2 : ℝ) < (1 : ℝ) routine: linarith

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hq : x / (2 : ℝ) < (1 : ℝ).

            Lean, line 622
                    have hq : x / 2 < 1 := by linarith

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 622 at 879b5c03f7df ↗

          3. hrem_all.h4_big.s7.hHsum have HasSum H ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹)

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hHsum : HasSum H ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹).

            Uses library HasSum HasSum f a L means that the (potentially infinite) sum of the f b for b : β converges to a along the SummationFilter L. , hasSum_nat_add_iff', sub_zero.

            Lean, lines 623–633
                    have hHsum : HasSum H (2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹) := by
                      rw [← hasSum_nat_add_iff' (2 * n + 1)]
                      have hz : ∑ i ∈ Finset.range (2 * n + 1), H i = 0 :=
                        Finset.sum_eq_zero (fun i hi => by
                          simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])
                      rw [hz, sub_zero]
                      have hgeo := (hasSum_geometric_of_lt_one (by positivity) hq).mul_left (2 * (x / 2) ^ (2 * n + 1))
                      have hfun : (fun s => H (s + (2 * n + 1))) = fun s => 2 * (x / 2) ^ (2 * n + 1) * (x / 2) ^ s := by
                        funext s; simp only [hH]; rw [if_pos (by omega), pow_add]; ring
                      rw [hfun]
                      exact hgeo

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 623–633 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hHsum.hz have ∑ i ∈ Finset.range ((2 : ℕ) * n + (1 : ℕ)), H i = (0 : ℝ)

              Leaves HasSum (fun (n_1 : ℕ) => H (n_1 + ((2 : ℕ) * n + (1 : ℕ)))) ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹ - ∑ i ∈ Finset.range ((2 : ℕ) * n + (1 : ℕ)), H i), with hz : ∑ i ∈ Finset.range ((2 : ℕ) * n + (1 : ℕ)), H i = (0 : ℝ).

              Uses library Finset.range range n is the set of natural numbers less than n. , Finset.sum_eq_zero, if_neg.

              Lean, lines 625–627
                        have hz : ∑ i ∈ Finset.range (2 * n + 1), H i = 0 :=
                          Finset.sum_eq_zero (fun i hi => by
                            simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 625–627 at 879b5c03f7df ↗

              1. hrem_all.h4_big.s7.hHsum.hz.this have i < (2 : ℕ) * n + (1 : ℕ)

                Leaves ¬(2 : ℕ) * n < i, with this : i < (2 : ℕ) * n + (1 : ℕ).

                Uses library Finset.mem_range.

                Lean, line 627
                              simp only [hH]; rw [if_neg (by have := Finset.mem_range.mp hi; omega)])

                targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 627 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hHsum.hgeo have HasSum (fun (i : ℕ) => (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * (x / (2 : ℝ)) ^ i) ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹)

              Leaves HasSum (fun (n_1 : ℕ) => H (n_1 + ((2 : ℕ) * n + (1 : ℕ)))) ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹), with hgeo : HasSum (fun (i : ℕ) => (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * (x / (2 : ℝ)) ^ i) ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹).

              Uses library hasSum_geometric_of_lt_one.

              Lean, line 629
                        have hgeo := (hasSum_geometric_of_lt_one (by positivity) hq).mul_left (2 * (x / 2) ^ (2 * n + 1))

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 629 at 879b5c03f7df ↗

            3. hrem_all.h4_big.s7.hHsum.hfun have (fun (s : ℕ) => H (s + ((2 : ℕ) * n + (1 : ℕ)))) = fun (s : ℕ) => (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * (x / (2 : ℝ)) ^ s

              Leaves HasSum (fun (n_1 : ℕ) => H (n_1 + ((2 : ℕ) * n + (1 : ℕ)))) ((2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹), with hfun : (fun (s : ℕ) => H (s + ((2 : ℕ) * n + (1 : ℕ)))) = fun (s : ℕ) => (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * (x / (2 : ℝ)) ^ s.

              Uses library if_pos, pow_add.

              Lean, lines 630–631
                        have hfun : (fun s => H (s + (2 * n + 1))) = fun s => 2 * (x / 2) ^ (2 * n + 1) * (x / 2) ^ s := by
                          funext s; simp only [hH]; rw [if_pos (by omega), pow_add]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 630–631 at 879b5c03f7df ↗

          4. hrem_all.h4_big.s7.hrle have r ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hrle : r ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹.

            Uses library hasSum_le.

            Lean, line 634
                    have hrle : r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hasSum_le hGH hS hHsum

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 634 at 879b5c03f7df ↗

          5. hrem_all.h4_big.s7.hr0 have (0 : ℝ) ≤ r

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hr0 : (0 : ℝ) ≤ r.

            Uses library le_of_lt, hasSum_lt, hasSum_zero Constant zero function has sum 0 .

            Lean, lines 635–636
                    have hr0 : 0 ≤ r := le_of_lt (hasSum_lt (f := fun _ => (0 : ℝ)) (g := G) (i := 2 * n + 1)
                      (fun K => hGnn K) hGpos hasSum_zero hS)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 635–636 at 879b5c03f7df ↗

          6. hrem_all.h4_big.s7.hr8 have r ≤ (8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hr8 : r ≤ (8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)).

            Lean, lines 637–643
                    have hr8 : r ≤ 8 * (x / 2) ^ (2 * n + 1) := by
                      have hinv : (1 - x / 2)⁻¹ ≤ 4 := by
                        rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith
                      have hp : 0 ≤ 2 * (x / 2) ^ (2 * n + 1) := by positivity
                      calc r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hrle
                        _ ≤ 2 * (x / 2) ^ (2 * n + 1) * 4 := by gcongr
                        _ = 8 * (x / 2) ^ (2 * n + 1) := by ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 637–643 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hr8.hinv have ((1 : ℝ) - x / (2 : ℝ))⁻¹ ≤ (4 : ℝ)

              Leaves r ≤ (8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)), with hinv : ((1 : ℝ) - x / (2 : ℝ))⁻¹ ≤ (4 : ℝ).

              Uses library inv_le_comm₀ See also inv_le_of_inv_le₀ for a one-sided implication with one fewer assumption. .

              Lean, lines 638–639
                        have hinv : (1 - x / 2)⁻¹ ≤ 4 := by
                          rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 638–639 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hr8.hp have (0 : ℝ) ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) routine: positivity

              Leaves r ≤ (8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)), with hp : (0 : ℝ) ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)).

              Lean, line 640
                        have hp : 0 ≤ 2 * (x / 2) ^ (2 * n + 1) := by positivity

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 640 at 879b5c03f7df ↗

            3. hrem_all.h4_big.s7.hr8.s3 calc r ≤ (2 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ)) * ((1 : ℝ) - x / (2 : ℝ))⁻¹

              Closes the goal.

              Lean, line 641
                        calc r ≤ 2 * (x / 2) ^ (2 * n + 1) * (1 - x / 2)⁻¹ := hrle

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 641 at 879b5c03f7df ↗

            4. hrem_all.h4_big.s7.hr8.s4 calc

              Closes the goal.

              Lean, line 642
                          _ ≤ 2 * (x / 2) ^ (2 * n + 1) * 4 := by gcongr

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 642 at 879b5c03f7df ↗

            5. hrem_all.h4_big.s7.hr8.s5 calc routine: ring

              Closes the goal.

              Lean, line 643
                          _ = 8 * (x / 2) ^ (2 * n + 1) := by ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 643 at 879b5c03f7df ↗

          7. hrem_all.h4_big.s7.hsq have r ^ (2 : ℕ) ≤ ((8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ))) ^ (2 : ℕ)

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hsq : r ^ (2 : ℕ) ≤ ((8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ))) ^ (2 : ℕ).

            Uses library pow_le_pow_left₀.

            Lean, line 644
                    have hsq : r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := pow_le_pow_left₀ hr0 hr8 2

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 644 at 879b5c03f7df ↗

          8. hrem_all.h4_big.s7.hnat have (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hnat : (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)).

            Lean, lines 645–654
                    have hnat : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                      have e1 : (2 : ℕ) ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) = 2 ^ (4 * n * n) * (64 * 256 ^ n) := by
                        rw [← pow_mul, ← pow_add, show (256 : ℕ) = 2 ^ 8 by norm_num, ← pow_mul,
                          show (64 : ℕ) = 2 ^ 6 by norm_num, ← pow_add, ← pow_add]
                        congr 1; ring
                      have e2 : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) = 2 ^ (4 * n * n) * (64 * (9 * 81 ^ n)) := by
                        rw [show (81 : ℕ) = 3 ^ 4 by norm_num, ← pow_mul, pow_add]; ring
                      rw [e1, e2]
                      have := ineq_pow n hn
                      gcongr

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 645–654 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hnat.e1 have (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) = (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * (256 : ℕ) ^ n)

              Leaves (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)), with e1 : (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) = (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * (256 : ℕ) ^ n).

              Uses library pow_mul, pow_add.

              Lean, lines 646–649
                        have e1 : (2 : ℕ) ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) = 2 ^ (4 * n * n) * (64 * 256 ^ n) := by
                          rw [← pow_mul, ← pow_add, show (256 : ℕ) = 2 ^ 8 by norm_num, ← pow_mul,
                            show (64 : ℕ) = 2 ^ 6 by norm_num, ← pow_add, ← pow_add]
                          congr 1; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 646–649 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hnat.e2 have (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) = (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * ((9 : ℕ) * (81 : ℕ) ^ n))

              Leaves (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℕ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℕ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)), with e2 : (64 : ℕ) * (3 : ℕ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℕ) ^ ((4 : ℕ) * n * n) = (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * ((9 : ℕ) * (81 : ℕ) ^ n)).

              Uses library pow_mul, pow_add.

              Lean, lines 650–651
                        have e2 : 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) = 2 ^ (4 * n * n) * (64 * (9 * 81 ^ n)) := by
                          rw [show (81 : ℕ) = 3 ^ 4 by norm_num, ← pow_mul, pow_add]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 650–651 at 879b5c03f7df ↗

            3. hrem_all.h4_big.s7.hnat.this have (9 : ℕ) * (81 : ℕ) ^ n ≤ (256 : ℕ) ^ n

              Leaves (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * ((9 : ℕ) * (81 : ℕ) ^ n)) ≤ (2 : ℕ) ^ ((4 : ℕ) * n * n) * ((64 : ℕ) * (256 : ℕ) ^ n), with this : (9 : ℕ) * (81 : ℕ) ^ n ≤ (256 : ℕ) ^ n.

              Lean, line 653
                        have := ineq_pow n hn

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 653 at 879b5c03f7df ↗

          9. hrem_all.h4_big.s7.hreal have (64 : ℝ) * (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hreal : (64 : ℝ) * (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)).

            Lean, lines 655–656
                    have hreal : (64 : ℝ) * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) * (2 ^ (n + 1)) ^ (4 * n + 2) := by
                      exact_mod_cast hnat

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 655–656 at 879b5c03f7df ↗

          10. hrem_all.h4_big.s7.hx2' have x / (2 : ℝ) = (3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hx2' : x / (2 : ℝ) = (3 : ℝ) / (2 : ℝ) ^ (n + (1 : ℕ)).

            Uses library pow_succ.

            Lean, line 657
                    have hx2' : x / 2 = 3 / 2 ^ (n + 1) := by rw [hxdef, pow_succ]; field_simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 657 at 879b5c03f7df ↗

          11. hrem_all.h4_big.s7.hsq' have r ^ (2 : ℕ) ≤ (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hsq' : r ^ (2 : ℕ) ≤ (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)).

            Lean, lines 658–660
                    have hsq' : r ^ 2 ≤ 64 * (x / 2) ^ (4 * n + 2) := by
                      calc r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := hsq
                        _ = 64 * (x / 2) ^ (4 * n + 2) := by ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 658–660 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hsq'.s1 calc r ^ (2 : ℕ) ≤ ((8 : ℝ) * (x / (2 : ℝ)) ^ ((2 : ℕ) * n + (1 : ℕ))) ^ (2 : ℕ)

              Closes the goal.

              Lean, line 659
                        calc r ^ 2 ≤ (8 * (x / 2) ^ (2 * n + 1)) ^ 2 := hsq

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 659 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hsq'.s2 calc routine: ring

              Closes the goal.

              Lean, line 660
                          _ = 64 * (x / 2) ^ (4 * n + 2) := by ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 660 at 879b5c03f7df ↗

          12. hrem_all.h4_big.s7.hkey have (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) = (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hkey : (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) = (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ)).

            Uses library mul_pow, div_mul_cancel₀.

            Lean, lines 661–662
                    have hkey : (x / 2) ^ (4 * n + 2) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) = 3 ^ (4 * n + 2) := by
                      rw [← mul_pow, hx2', div_mul_cancel₀ _ (by positivity)]

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 661–662 at 879b5c03f7df ↗

          13. hrem_all.h4_big.s7.hP have (0 : ℝ) < ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) routine: positivity

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hP : (0 : ℝ) < ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)).

            Lean, line 663
                    have hP : (0 : ℝ) < ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 663 at 879b5c03f7df ↗

          14. hrem_all.h4_big.s7.hmain have (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

            Leaves r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hmain : (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

            Uses library le_of_mul_le_mul_right.

            Lean, lines 664–668
                    have hmain : 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) ≤ 2 ^ (2 * n + 4) := by
                      refine le_of_mul_le_mul_right ?_ hP
                      calc 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2)
                          = 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) := by rw [← hkey]; ring
                        _ ≤ 2 ^ (2 * n + 4) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := hreal

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 664–668 at 879b5c03f7df ↗

            1. hrem_all.h4_big.s7.hmain.s1 calc (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ)) = (64 : ℝ) * (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n)

              Closes the goal.

              Lean, lines 666–667
                        calc 64 * (x / 2) ^ (4 * n + 2) * (2 : ℝ) ^ (4 * n * n) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2)
                            = 64 * 3 ^ (4 * n + 2) * 2 ^ (4 * n * n) := by rw [← hkey]; ring

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 666–667 at 879b5c03f7df ↗

            2. hrem_all.h4_big.s7.hmain.s2 calc (64 : ℝ) * (3 : ℝ) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * ((2 : ℝ) ^ (n + (1 : ℕ))) ^ ((4 : ℕ) * n + (2 : ℕ))

              Closes the goal.

              Lean, line 668
                          _ ≤ 2 ^ (2 * n + 4) * ((2 : ℝ) ^ (n + 1)) ^ (4 * n + 2) := hreal

              targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 668 at 879b5c03f7df ↗

          15. hrem_all.h4_big.s7.s15 calc r ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n)

            Closes the goal.

            Lean, line 669
                    calc r ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ 64 * (x / 2) ^ (4 * n + 2) * 2 ^ (4 * n * n) := by gcongr

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 669 at 879b5c03f7df ↗

          16. hrem_all.h4_big.s7.s16 calc (64 : ℝ) * (x / (2 : ℝ)) ^ ((4 : ℕ) * n + (2 : ℕ)) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

            Closes the goal.

            Lean, line 670
                      _ ≤ 2 ^ (2 * n + 4) := hmain

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 670 at 879b5c03f7df ↗

      16. hrem_all.T_facts have (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with T_facts : (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ).

        Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, lines 673–696
            have T_facts : Summable (fun m : ℕ => (1 : ℝ) / (2 ^ (m + 3) - 3)) ∧
                0 < ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ∧ ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ 2 / 5 := by
              have h5 : ∀ m : ℕ, 5 * (2 : ℝ) ^ m ≤ 2 ^ (m + 3) - 3 := by
                intro m
                have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                have e : (2 : ℝ) ^ (m + 3) = 8 * 2 ^ m := by rw [pow_add]; norm_num; ring
                rw [e]; linarith
              have hpos : ∀ m : ℕ, 0 < (2 : ℝ) ^ (m + 3) - 3 := fun m => by
                have := h5 m; have : (0 : ℝ) < 2 ^ m := by positivity
                linarith
              have hle : ∀ m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ (1 / 5) * (1 / 2) ^ m := by
                intro m
                have e : (1 / 5 : ℝ) * (1 / 2) ^ m = 1 / (5 * 2 ^ m) := by
                  rw [one_div_pow]; field_simp
                rw [e]
                exact one_div_le_one_div_of_le (by positivity) (h5 m)
              have hs : Summable (fun m : ℕ => (1 : ℝ) / (2 ^ (m + 3) - 3)) :=
                Summable.of_nonneg_of_le (fun m => le_of_lt (one_div_pos.mpr (hpos m))) hle
                  (summable_geometric_two.mul_left (1 / 5))
              refine ⟨hs, ?_, ?_⟩
              · exact hs.tsum_pos (fun m => le_of_lt (one_div_pos.mpr (hpos m))) 0 (one_div_pos.mpr (hpos 0))
              · calc ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ ∑' m : ℕ, (1 / 5 : ℝ) * (1 / 2) ^ m :=
                      hs.tsum_le_tsum hle (summable_geometric_two.mul_left (1 / 5))
                  _ = 2 / 5 := by rw [tsum_mul_left, tsum_geometric_two]; norm_num

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 673–696 at 879b5c03f7df ↗

        1. hrem_all.T_facts.h5 have ∀ (m : ℕ), (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)

          Leaves (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ), with h5 : ∀ (m : ℕ), (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ).

          Lean, lines 675–679
                have h5 : ∀ m : ℕ, 5 * (2 : ℝ) ^ m ≤ 2 ^ (m + 3) - 3 := by
                  intro m
                  have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)
                  have e : (2 : ℝ) ^ (m + 3) = 8 * 2 ^ m := by rw [pow_add]; norm_num; ring
                  rw [e]; linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 675–679 at 879b5c03f7df ↗

          1. hrem_all.T_facts.h5.h1 have (1 : ℝ) ≤ (2 : ℝ) ^ m

            Leaves (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ), with h1 : (1 : ℝ) ≤ (2 : ℝ) ^ m.

            Uses library one_le_pow₀.

            Lean, line 677
                    have h1 : (1 : ℝ) ≤ 2 ^ m := one_le_pow₀ (by norm_num)

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 677 at 879b5c03f7df ↗

          2. hrem_all.T_facts.h5.e have (2 : ℝ) ^ (m + (3 : ℕ)) = (8 : ℝ) * (2 : ℝ) ^ m

            Leaves (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ), with e : (2 : ℝ) ^ (m + (3 : ℕ)) = (8 : ℝ) * (2 : ℝ) ^ m.

            Uses library pow_add.

            Lean, line 678
                    have e : (2 : ℝ) ^ (m + 3) = 8 * 2 ^ m := by rw [pow_add]; norm_num; ring

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 678 at 879b5c03f7df ↗

        2. hrem_all.T_facts.hpos have ∀ (m : ℕ), (0 : ℝ) < (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)

          Leaves (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ), with hpos : ∀ (m : ℕ), (0 : ℝ) < (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ).

          Lean, lines 680–682
                have hpos : ∀ m : ℕ, 0 < (2 : ℝ) ^ (m + 3) - 3 := fun m => by
                  have := h5 m; have : (0 : ℝ) < 2 ^ m := by positivity
                  linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 680–682 at 879b5c03f7df ↗

          1. hrem_all.T_facts.hpos.s1 have (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)

            Leaves (0 : ℝ) < (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ), with this : (5 : ℝ) * (2 : ℝ) ^ m ≤ (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ).

            Lean, line 681
                    have := h5 m; have : (0 : ℝ) < 2 ^ m := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 681 at 879b5c03f7df ↗

          2. hrem_all.T_facts.hpos.s2 have (0 : ℝ) < (2 : ℝ) ^ m routine: positivity

            Leaves (0 : ℝ) < (2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ), with this : (0 : ℝ) < (2 : ℝ) ^ m.

            Lean, line 681
                    have := h5 m; have : (0 : ℝ) < 2 ^ m := by positivity

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 681 at 879b5c03f7df ↗

        3. hrem_all.T_facts.hle have ∀ (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (1 / 5 : ℝ) * (1 / 2 : ℝ) ^ m

          Leaves (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ), with hle : ∀ (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (1 / 5 : ℝ) * (1 / 2 : ℝ) ^ m.

          Uses library one_div_le_one_div_of_le.

          Lean, lines 683–688
                have hle : ∀ m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ (1 / 5) * (1 / 2) ^ m := by
                  intro m
                  have e : (1 / 5 : ℝ) * (1 / 2) ^ m = 1 / (5 * 2 ^ m) := by
                    rw [one_div_pow]; field_simp
                  rw [e]
                  exact one_div_le_one_div_of_le (by positivity) (h5 m)

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 683–688 at 879b5c03f7df ↗

          1. hrem_all.T_facts.hle.e have (1 / 5 : ℝ) * (1 / 2 : ℝ) ^ m = (1 : ℝ) / ((5 : ℝ) * (2 : ℝ) ^ m)

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

            Uses library one_div_pow.

            Lean, lines 685–686
                    have e : (1 / 5 : ℝ) * (1 / 2) ^ m = 1 / (5 * 2 ^ m) := by
                      rw [one_div_pow]; field_simp

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 685–686 at 879b5c03f7df ↗

        4. hrem_all.T_facts.hs have Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))

          Leaves (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ), with hs : Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)).

          Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Summable.of_nonneg_of_le Comparison test of convergence of series of non-negative real numbers. , le_of_lt, one_div_pos, summable_geometric_two.

          Lean, lines 689–691
                have hs : Summable (fun m : ℕ => (1 : ℝ) / (2 ^ (m + 3) - 3)) :=
                  Summable.of_nonneg_of_le (fun m => le_of_lt (one_div_pos.mpr (hpos m))) hle
                    (summable_geometric_two.mul_left (1 / 5))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 689–691 at 879b5c03f7df ↗

        5. hrem_all.T_facts.s5 case

          Leaves (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)).

          Uses library le_of_lt, one_div_pos.

          Lean, line 693
                · exact hs.tsum_pos (fun m => le_of_lt (one_div_pos.mpr (hpos m))) 0 (one_div_pos.mpr (hpos 0))

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 693 at 879b5c03f7df ↗

        6. hrem_all.T_facts.s6 case

          Leaves ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ).

          Lean, lines 694–696
                · calc ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ ∑' m : ℕ, (1 / 5 : ℝ) * (1 / 2) ^ m :=
                        hs.tsum_le_tsum hle (summable_geometric_two.mul_left (1 / 5))
                    _ = 2 / 5 := by rw [tsum_mul_left, tsum_geometric_two]; norm_num

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 694–696 at 879b5c03f7df ↗

          1. hrem_all.T_facts.s6.s1 calc ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ ∑' (m : ℕ), (1 / 5 : ℝ) * (1 / 2 : ℝ) ^ m

            Closes the goal.

            Uses library summable_geometric_two.

            Lean, lines 694–695
                  · calc ∑' m : ℕ, (1 : ℝ) / (2 ^ (m + 3) - 3) ≤ ∑' m : ℕ, (1 / 5 : ℝ) * (1 / 2) ^ m :=
                          hs.tsum_le_tsum hle (summable_geometric_two.mul_left (1 / 5))

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 694–695 at 879b5c03f7df ↗

          2. hrem_all.T_facts.s6.s2 calc

            Closes the goal.

            Uses library tsum_mul_left, tsum_geometric_two.

            Lean, line 696
                      _ = 2 / 5 := by rw [tsum_mul_left, tsum_geometric_two]; norm_num

            targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 696 at 879b5c03f7df ↗

      17. hrem_all.s17 obtain (Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ))) ∧ (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ∧ ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ)

        Leaves ∀ (Qc : ℕ → ℕ → ℚ), (Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) → ∀ (Qx : ℕ → ℚ), (Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k) → ∀ (Aq : ℕ → ℚ), (Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))) → (∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n) → ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with left✝ : Summable fun (m : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)), hTpos : (0 : ℝ) < ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)), hTle : ∑' (m : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (m + (3 : ℕ)) - (3 : ℝ)) ≤ (2 / 5 : ℝ).

        Lean, line 697
            obtain ⟨_, hTpos, hTle⟩ := T_facts

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 697 at 879b5c03f7df ↗

      18. hrem_all.hQx0 have Qx (0 : ℕ) = (1 : ℚ)

        Leaves (0 : ℝ) < (↑(Qx (0 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (0 : ℕ)) : ℝ) ∧ ((↑(Qx (0 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (0 : ℕ)) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (0 : ℕ) * (0 : ℕ)) ≤ (2 : ℝ) ^ ((2 : ℕ) * (0 : ℕ) + (4 : ℕ)), with hQx0 : Qx (0 : ℕ) = (1 : ℚ).

        Lean, line 701
              have hQx0 : Qx 0 = 1 := by rw [hQx, hQc]; simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 701 at 879b5c03f7df ↗

      19. hrem_all.hAq0 have Aq (0 : ℕ) = (0 : ℚ)

        Leaves (0 : ℝ) < (↑(Qx (0 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (0 : ℕ)) : ℝ) ∧ ((↑(Qx (0 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (0 : ℕ)) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (0 : ℕ) * (0 : ℕ)) ≤ (2 : ℝ) ^ ((2 : ℕ) * (0 : ℕ) + (4 : ℕ)), with hAq0 : Aq (0 : ℕ) = (0 : ℚ).

        Lean, line 702
              have hAq0 : Aq 0 = 0 := by rw [hAq]; simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 702 at 879b5c03f7df ↗

      20. hrem_all.e have ((1 : ℝ) * ((3 : ℝ) * T) - (0 : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (0 : ℕ) * (0 : ℕ)) = (9 : ℝ) * (T * T) routine: ring

        Leaves ((1 : ℝ) * ((3 : ℝ) * T) - (0 : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ (0 : ℕ) ≤ (2 : ℝ) ^ (4 : ℕ), with e : ((1 : ℝ) * ((3 : ℝ) * T) - (0 : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (0 : ℕ) * (0 : ℕ)) = (9 : ℝ) * (T * T).

        Lean, line 707
              have e : ((1 : ℝ) * (3 * T) - 0) ^ 2 * (2 : ℝ) ^ (4 * 0 * 0) = 9 * (T * T) := by ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 707 at 879b5c03f7df ↗

      21. hrem_all.hQx1 have Qx (1 : ℕ) = (3 / 2 : ℚ)

        Leaves (0 : ℝ) < (↑(Qx (1 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (1 : ℕ)) : ℝ) ∧ ((↑(Qx (1 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (1 : ℕ)) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (1 : ℕ) * (1 : ℕ)) ≤ (2 : ℝ) ^ ((2 : ℕ) * (1 : ℕ) + (4 : ℕ)), with hQx1 : Qx (1 : ℕ) = (3 / 2 : ℚ).

        Uses library Finset.sum_range_succ, Finset.prod_range_succ.

        Lean, lines 713–714
              have hQx1 : Qx 1 = 3 / 2 := by
                rw [hQx, hQc]; norm_num [Finset.sum_range_succ, Finset.prod_range_succ]

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 713–714 at 879b5c03f7df ↗

      22. hrem_all.hAq1 have Aq (1 : ℕ) = (0 : ℚ)

        Leaves (0 : ℝ) < (↑(Qx (1 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (1 : ℕ)) : ℝ) ∧ ((↑(Qx (1 : ℕ)) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq (1 : ℕ)) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * (1 : ℕ) * (1 : ℕ)) ≤ (2 : ℝ) ^ ((2 : ℕ) * (1 : ℕ) + (4 : ℕ)), with hAq1 : Aq (1 : ℕ) = (0 : ℚ).

        Uses library Finset.sum_range_succ, Finset.prod_range_succ.

        Lean, lines 715–717
              have hAq1 : Aq 1 = 0 := by
                rw [hAq]; simp only [hQx1]; rw [hQc]
                norm_num [Finset.sum_range_succ, Finset.prod_range_succ]

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 715–717 at 879b5c03f7df ↗

    2. s2 obtain ∃ (Qc : ℕ → ℕ → ℚ), Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with Qc : ℕ → ℕ → ℚ, hQc : Qc = fun (n k : ℕ) => ((-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - (1 : ℕ)) / (2 : ℕ)) * ∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ))) * ∏ i ∈ Finset.range n, ((2 : ℚ) ^ ((2 : ℕ) * n - k - i) - (1 : ℚ)) / ((2 : ℚ) ^ (i + (1 : ℕ)) - (1 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 729–732
        obtain ⟨Qc, hQc⟩ : ∃ Qc : ℕ → ℕ → ℚ, Qc = fun n k => (-1 : ℚ) ^ k * (2 : ℚ) ^ (k * (k - 1) / 2) *
            (∏ i ∈ Finset.range k, ((2 : ℚ) ^ (n - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) *
            (∏ i ∈ Finset.range n, ((2 : ℚ) ^ (2 * n - k - i) - 1) / ((2 : ℚ) ^ (i + 1) - 1)) :=
          ⟨_, rfl⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 729–732 at 879b5c03f7df ↗

    3. s3 obtain ∃ (Qx : ℕ → ℚ), Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with Qx : ℕ → ℚ, hQx : Qx = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k.

      Uses library Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 733–734
        obtain ⟨Qx, hQx⟩ : ∃ Qx : ℕ → ℚ, Qx = fun n =>
            ∑ k ∈ Finset.range (n + 1), Qc n k * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k := ⟨_, rfl⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 733–734 at 879b5c03f7df ↗

    4. s4 obtain ∃ (Aq : ℕ → ℚ), Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ))

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with Aq : ℕ → ℚ, hAq : Aq = fun (n : ℕ) => ∑ k ∈ Finset.range (n + (1 : ℕ)), (∑ j ∈ Finset.range (k + (1 : ℕ)), Qc n j / ((2 : ℚ) ^ (k - j) - (1 : ℚ))) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k + Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + (1 : ℕ)) - (3 : ℚ)).

      Uses library Finset.range range n is the set of natural numbers less than n. , Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 735–738
        obtain ⟨Aq, hAq⟩ : ∃ Aq : ℕ → ℚ, Aq = fun n =>
            ∑ k ∈ Finset.range (n + 1),
                (∑ j ∈ Finset.range (k + 1), Qc n j / ((2 : ℚ) ^ (k - j) - 1)) * ((3 : ℚ) / (2 : ℚ) ^ n) ^ k +
              Qx n * ∑ j ∈ Finset.range n, (3 : ℚ) / ((2 : ℚ) ^ (j + 1) - 3) := ⟨_, rfl⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 735–738 at 879b5c03f7df ↗

    5. hden have ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with hden : ∀ (n : ℕ), ∃ (d : ℕ), (0 : ℕ) < d ∧ (↑d : ℝ) ^ (2 : ℕ) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) ∧ (∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Qx n) ∧ ∃ (z : ℤ), (↑z : ℚ) = (↑d : ℚ) * Aq n.

      Uses statements erdos-1050--h1-v2--h3.

      Lean, lines 740–742
        have hden : ∀ n : ℕ, ∃ d : ℕ, 0 < d ∧ ((d : ℝ)) ^ 2 ≤ (2 : ℝ) ^ (3 * n * n) ∧
            (∃ z : ℤ, (z : ℚ) = d * Qx n) ∧ ∃ z : ℤ, (z : ℚ) = d * Aq n :=
          erdos_1050__h1_v2__h3 Qc hQc Qx hQx Aq hAq

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 740–742 at 879b5c03f7df ↗

    6. hrem have ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

      Leaves ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with hrem : ∀ (n : ℕ), (0 : ℝ) < (↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ) ∧ ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)) ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

      Lean, lines 744–748
        have hrem : ∀ n : ℕ,
            0 < (Qx n : ℝ) * (3 * ∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - (Aq n : ℝ) ∧
            ((Qx n : ℝ) * (3 * ∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - (Aq n : ℝ)) ^ 2 *
              (2 : ℝ) ^ (4 * n * n) ≤ (2 : ℝ) ^ (2 * n + 4) :=
          hrem_all Qc hQc Qx hQx Aq hAq hden

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 744–748 at 879b5c03f7df ↗

    7. key have ∀ (n : ℕ), (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) = (↑(d n) : ℝ) * ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ))

      Leaves (∀ (n : ℕ), (↑((fun (n : ℕ) => (3 : ℤ) * b n) n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑((fun (n : ℕ) => (3 : ℤ) * b n) n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with key : ∀ (n : ℕ), (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) = (↑(d n) : ℝ) * ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)).

      Lean, lines 754–761
        have key : ∀ n : ℕ, (((3 * b n : ℤ)) : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n =
            (d n : ℝ) * ((Qx n : ℝ) * (3 * ∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - (Aq n : ℝ)) := by
          intro n
          have hb' : (b n : ℝ) = (d n : ℝ) * (Qx n : ℝ) := by exact_mod_cast hb n
          have ha' : (a n : ℝ) = (d n : ℝ) * (Aq n : ℝ) := by exact_mod_cast ha n
          push_cast
          rw [hb', ha']
          ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 754–761 at 879b5c03f7df ↗

      1. key.hb' have (↑(b n) : ℝ) = (↑(d n) : ℝ) * (↑(Qx n) : ℝ)

        Leaves (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) = (↑(d n) : ℝ) * ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with hb' : (↑(b n) : ℝ) = (↑(d n) : ℝ) * (↑(Qx n) : ℝ).

        Lean, line 757
            have hb' : (b n : ℝ) = (d n : ℝ) * (Qx n : ℝ) := by exact_mod_cast hb n

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 757 at 879b5c03f7df ↗

      2. key.ha' have (↑(a n) : ℝ) = (↑(d n) : ℝ) * (↑(Aq n) : ℝ)

        Leaves (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) = (↑(d n) : ℝ) * ((↑(Qx n) : ℝ) * ((3 : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))) - (↑(Aq n) : ℝ)), with ha' : (↑(a n) : ℝ) = (↑(d n) : ℝ) * (↑(Aq n) : ℝ).

        Lean, line 758
            have ha' : (a n : ℝ) = (d n : ℝ) * (Aq n : ℝ) := by exact_mod_cast ha n

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 758 at 879b5c03f7df ↗

    8. pos have ∀ (n : ℕ), (0 : ℝ) < (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)

      Leaves (∀ (n : ℕ), (↑((fun (n : ℕ) => (3 : ℤ) * b n) n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑((fun (n : ℕ) => (3 : ℤ) * b n) n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)), with pos : ∀ (n : ℕ), (0 : ℝ) < (↑((3 : ℤ) * b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ).

      Uses library mul_pos Alias of Left.mul_pos. .

      Lean, lines 762–765
        have pos : ∀ n : ℕ, 0 < (((3 * b n : ℤ)) : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n := by
          intro n
          rw [key n]
          exact mul_pos (by exact_mod_cast hd0 n) (hrem n).1

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 762–765 at 879b5c03f7df ↗

    9. bound have ∀ (n : ℕ), e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n

      Leaves Filter.Tendsto e Filter.atTop (nhds (0 : ℝ)), with bound : ∀ (n : ℕ), e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n.

      Uses library one_div_pow, mul_one_div, le_div_iff₀ See le_div_iff₀' for a version with multiplication on the other side. .

      Lean, lines 769–789
        have bound : ∀ n : ℕ, e n ^ 2 ≤ 64 * (1 / 2 : ℝ) ^ n := by
          intro n
          have h1 : e n ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ (2 : ℝ) ^ (3 * n * n) * (2 : ℝ) ^ (2 * n + 4) := by
            simp only [he]
            rw [key n, mul_pow, mul_assoc]
            exact mul_le_mul (hdb n) (hrem n).2 (by positivity) (by positivity)
          have h2 : (2 : ℝ) ^ (4 * n * n) = (2 : ℝ) ^ (n * n) * (2 : ℝ) ^ (3 * n * n) := by
            rw [← pow_add]; ring_nf
          have h3 : e n ^ 2 * (2 : ℝ) ^ (n * n) ≤ (2 : ℝ) ^ (2 * n + 4) := by
            have hp : (0 : ℝ) < (2 : ℝ) ^ (3 * n * n) := by positivity
            rw [h2] at h1
            nlinarith
          have h4 : (2 : ℝ) ^ (2 * n + 4) * 2 ^ n ≤ 64 * (2 : ℝ) ^ (n * n) := by
            have : 3 * n + 4 ≤ n * n + 6 := by nlinarith [sq_nonneg ((n : ℤ) - 2)]
            calc (2 : ℝ) ^ (2 * n + 4) * 2 ^ n = 2 ^ (3 * n + 4) := by rw [← pow_add]; ring_nf
              _ ≤ 2 ^ (n * n + 6) := pow_le_pow_right₀ (by norm_num) this
              _ = 64 * (2 : ℝ) ^ (n * n) := by rw [pow_add]; norm_num; ring
          have hpn : (0 : ℝ) < (2 : ℝ) ^ n := by positivity
          have hpnn : (0 : ℝ) < (2 : ℝ) ^ (n * n) := by positivity
          rw [one_div_pow, mul_one_div, le_div_iff₀ hpn]
          nlinarith

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 769–789 at 879b5c03f7df ↗

      1. bound.h1 have e n ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) * (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with h1 : e n ^ (2 : ℕ) * (2 : ℝ) ^ ((4 : ℕ) * n * n) ≤ (2 : ℝ) ^ ((3 : ℕ) * n * n) * (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

        Uses library mul_pow, mul_assoc, mul_le_mul Alias of mul_le_mul_of_nonneg'. .

        Lean, lines 771–774
            have h1 : e n ^ 2 * (2 : ℝ) ^ (4 * n * n) ≤ (2 : ℝ) ^ (3 * n * n) * (2 : ℝ) ^ (2 * n + 4) := by
              simp only [he]
              rw [key n, mul_pow, mul_assoc]
              exact mul_le_mul (hdb n) (hrem n).2 (by positivity) (by positivity)

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 771–774 at 879b5c03f7df ↗

      2. bound.h2 have (2 : ℝ) ^ ((4 : ℕ) * n * n) = (2 : ℝ) ^ (n * n) * (2 : ℝ) ^ ((3 : ℕ) * n * n)

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with h2 : (2 : ℝ) ^ ((4 : ℕ) * n * n) = (2 : ℝ) ^ (n * n) * (2 : ℝ) ^ ((3 : ℕ) * n * n).

        Uses library pow_add.

        Lean, lines 775–776
            have h2 : (2 : ℝ) ^ (4 * n * n) = (2 : ℝ) ^ (n * n) * (2 : ℝ) ^ (3 * n * n) := by
              rw [← pow_add]; ring_nf

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 775–776 at 879b5c03f7df ↗

      3. bound.h3 have e n ^ (2 : ℕ) * (2 : ℝ) ^ (n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ))

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with h3 : e n ^ (2 : ℕ) * (2 : ℝ) ^ (n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)).

        Lean, lines 777–780
            have h3 : e n ^ 2 * (2 : ℝ) ^ (n * n) ≤ (2 : ℝ) ^ (2 * n + 4) := by
              have hp : (0 : ℝ) < (2 : ℝ) ^ (3 * n * n) := by positivity
              rw [h2] at h1
              nlinarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 777–780 at 879b5c03f7df ↗

        1. bound.h3.hp have (0 : ℝ) < (2 : ℝ) ^ ((3 : ℕ) * n * n) routine: positivity

          Leaves e n ^ (2 : ℕ) * (2 : ℝ) ^ (n * n) ≤ (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)), with hp : (0 : ℝ) < (2 : ℝ) ^ ((3 : ℕ) * n * n).

          Lean, line 778
                have hp : (0 : ℝ) < (2 : ℝ) ^ (3 * n * n) := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 778 at 879b5c03f7df ↗

      4. bound.h4 have (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * (2 : ℝ) ^ n ≤ (64 : ℝ) * (2 : ℝ) ^ (n * n)

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with h4 : (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * (2 : ℝ) ^ n ≤ (64 : ℝ) * (2 : ℝ) ^ (n * n).

        Lean, lines 781–785
            have h4 : (2 : ℝ) ^ (2 * n + 4) * 2 ^ n ≤ 64 * (2 : ℝ) ^ (n * n) := by
              have : 3 * n + 4 ≤ n * n + 6 := by nlinarith [sq_nonneg ((n : ℤ) - 2)]
              calc (2 : ℝ) ^ (2 * n + 4) * 2 ^ n = 2 ^ (3 * n + 4) := by rw [← pow_add]; ring_nf
                _ ≤ 2 ^ (n * n + 6) := pow_le_pow_right₀ (by norm_num) this
                _ = 64 * (2 : ℝ) ^ (n * n) := by rw [pow_add]; norm_num; ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 781–785 at 879b5c03f7df ↗

        1. bound.h4.this have (3 : ℕ) * n + (4 : ℕ) ≤ n * n + (6 : ℕ) routine: nlinarith

          Leaves (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * (2 : ℝ) ^ n ≤ (64 : ℝ) * (2 : ℝ) ^ (n * n), with this : (3 : ℕ) * n + (4 : ℕ) ≤ n * n + (6 : ℕ).

          Uses library sq_nonneg.

          Lean, line 782
                have : 3 * n + 4 ≤ n * n + 6 := by nlinarith [sq_nonneg ((n : ℤ) - 2)]

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 782 at 879b5c03f7df ↗

        2. bound.h4.s2 calc (2 : ℝ) ^ ((2 : ℕ) * n + (4 : ℕ)) * (2 : ℝ) ^ n = (2 : ℝ) ^ ((3 : ℕ) * n + (4 : ℕ))

          Closes the goal.

          Uses library pow_add.

          Lean, line 783
                calc (2 : ℝ) ^ (2 * n + 4) * 2 ^ n = 2 ^ (3 * n + 4) := by rw [← pow_add]; ring_nf

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 783 at 879b5c03f7df ↗

        3. bound.h4.s3 calc (2 : ℝ) ^ ((3 : ℕ) * n + (4 : ℕ)) ≤ (2 : ℝ) ^ (n * n + (6 : ℕ))

          Closes the goal.

          Uses library pow_le_pow_right₀.

          Lean, line 784
                  _ ≤ 2 ^ (n * n + 6) := pow_le_pow_right₀ (by norm_num) this

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 784 at 879b5c03f7df ↗

        4. bound.h4.s4 calc

          Closes the goal.

          Uses library pow_add.

          Lean, line 785
                  _ = 64 * (2 : ℝ) ^ (n * n) := by rw [pow_add]; norm_num; ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 785 at 879b5c03f7df ↗

      5. bound.hpn have (0 : ℝ) < (2 : ℝ) ^ n routine: positivity

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with hpn : (0 : ℝ) < (2 : ℝ) ^ n.

        Lean, line 786
            have hpn : (0 : ℝ) < (2 : ℝ) ^ n := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 786 at 879b5c03f7df ↗

      6. bound.hpnn have (0 : ℝ) < (2 : ℝ) ^ (n * n) routine: positivity

        Leaves e n ^ (2 : ℕ) ≤ (64 : ℝ) * (1 / 2 : ℝ) ^ n, with hpnn : (0 : ℝ) < (2 : ℝ) ^ (n * n).

        Lean, line 787
            have hpnn : (0 : ℝ) < (2 : ℝ) ^ (n * n) := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 787 at 879b5c03f7df ↗

    10. hsq have Filter.Tendsto (fun (n : ℕ) => e n ^ (2 : ℕ)) Filter.atTop (nhds (0 : ℝ))

      Leaves Filter.Tendsto e Filter.atTop (nhds (0 : ℝ)), with hsq : Filter.Tendsto (fun (n : ℕ) => e n ^ (2 : ℕ)) Filter.atTop (nhds (0 : ℝ)).

      Uses library Filter.Tendsto Filter.Tendsto is the generic "limit of a function" predicate. , Filter.atTop atTop is the filter representing the limit → ∞ on an ordered set. , nhds A set is called a neighborhood of x if it contains an open set around x. , squeeze_zero Special case of the sandwich lemma; see tendsto_of_tendsto_of_tendsto_of_le_of_le and tendsto_of_tendsto_of_tendsto_of_le_of_le' for the general case. , sq_nonneg, tendsto_pow_atTop_nhds_zero_of_lt_one.

      Lean, lines 790–793
        have hsq : Filter.Tendsto (fun n => e n ^ 2) Filter.atTop (nhds 0) := by
          refine squeeze_zero (fun n => sq_nonneg _) bound ?_
          simpa using (tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 2)
            (by norm_num)).const_mul 64

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 790–793 at 879b5c03f7df ↗

    11. this have Filter.Tendsto (fun (x : ℕ) => √(e x ^ (2 : ℕ))) Filter.atTop (nhds √(0 : ℝ))

      Leaves Filter.Tendsto e Filter.atTop (nhds (0 : ℝ)), with this : Filter.Tendsto (fun (x : ℕ) => √(e x ^ (2 : ℕ))) Filter.atTop (nhds √(0 : ℝ)).

      Lean, line 794
        have := hsq.sqrt

      targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, line 794 at 879b5c03f7df ↗

    Proof: targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 1–797 at 879b5c03f7df.

    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/3de2a7dc7466….md, written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06; explainer/03e9a42c8cc9….md, written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06.

    Overview

    Draft · drafted, by the model named above

    The statement asks for integer sequences $a_n, b_n$ with $b_n T - a_n$ never zero and tending to $0$, where $T = \sum_{m \ge 0} 1/(2^{m+3}-3)$. The proof builds them from explicit Padé-type rational approximations in the style of Borwein's $q$-series argument (the file's comment cites annex f593a93a8960 on this node for the informal account). With $x_n = 3/2^n$ it defines three explicit families of rationals, $Q_c(n,k)$, $Q_x(n)$ and $A_q(n)$, and considers the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$. Two estimates do the work:

    • a denominator bound: some positive integer $d_n$ with $d_n^2 \le 2^{3n^2}$ makes $d_n Q_x(n)$ and $d_n A_q(n)$ integers. This is taken from the hole node erdos-1050--h1-v2--h3, not proved here;
    • a remainder bound: $r_n > 0$ and $r_n^2 \, 2^{4n^2} \le 2^{2n+4}$. This is the statement of the node erdos-1050--h1-v2--h4, but the file proves it inline (step hrem_all), so that the proof uses only the hole --h3.

    Then $b_n = 3 d_n Q_x(n)$ and $a_n = d_n A_q(n)$ are integers, $b_n T - a_n = d_n r_n > 0$, and $(b_n T - a_n)^2 \le 64 \cdot 2^{-n}$, which tends to $0$. The four holes --h1 to --h4 are declared dependencies; the proof term uses --h3 only.

    Product identities for the Gaussian coefficients

    Draft · drafted, by the model named above

    These are identities between finite products of numbers $2^a - 1$ and $2^j - 2^i$ in $\mathbb{Q}$. id1_test splits $\prod_{s<n}(2^{s+1}-1)$ at $j \le n$. lower_test and upper_test factor $\prod_{i<j}(2^j - 2^i)$ and $\prod_{j<i\le n}(2^j - 2^i)$ into a power of $2$, a sign and a product of $2^{s+1}-1$; rhs_test does the same for $\prod_{n<K\le 2n}(2^j - 2^K)$. Combined, id1_full says that for $j \le n$, $Q_c(n,j)\cdot 2^j \cdot \prod_{i \le n,\, i \ne j} (2^j - 2^i) = \prod_{n < K \le 2n} (2^j - 2^K)$, where $Q_c(n,j)$ is written out by its defining formula. Read with lagr_eval below, this says that the numbers $Q_c(n,j)\,2^j$ are the Lagrange-interpolation weights, at the nodes $2^0, \dots, 2^n$, of the degree-$n$ polynomial $\prod_{n<K\le 2n}(X - 2^K)$.

    Interpolation and the vanishing coefficients

    Draft · drafted, by the model named above

    lagr_eval is Lagrange interpolation over $\mathbb{Q}$: a polynomial $N$ of degree at most $n$, whose values at $n+1$ distinct points $x_0, \dots, x_n$ are $r_j \prod_{i \ne j}(x_j - x_i)$, equals $\sum_j r_j \prod_{i \ne j}(X - x_i)$. tail_coeff uses it: for every $K > n$, if $Q_c$ satisfies the identity of id1_full, then $\sum_{j \le n} Q_c(n,j)/(2^{K-j}-1) = \prod_{n<L\le 2n}(2^K - 2^L) \big/ \prod_{i \le n}(2^K - 2^i)$. For $n < K \le 2n$ the numerator has the factor $L = K$, so this is zero: these are the coefficients that cancel in the remainder.

    T as a constant plus a power series

    Draft · drafted, by the model named above

    split3T splits, for every $n$, $3T = \sum_{j<n} 3/(2^{j+1}-3) + \sum_{m \ge 0} 3/(2^{m+n+1}-3)$; the first part is the rational constant that appears at the end of $A_q(n)$. tail3 expands the tail, for $n \ge 1$, as a power series in $x_n = 3/2^n$: $\sum_m 3/(2^{m+n+1}-3) = \sum_{s \ge 0} x_n^{s+1}/(2^{s+1}-1)$. cauchy_fin multiplies a polynomial $\sum_{j\le n} q_j x^j$ by a convergent series $\sum_s a_s x^{s+1}$ term by term. h4_series puts these together: for $n \ge 1$, the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$ is the sum over $K > 2n$ only of $\dfrac{\prod_{n<L\le 2n}(2^K - 2^L)}{\prod_{i \le n}(2^K - 2^i)}\, x_n^K$ (a HasSum, with every term for $K \le 2n$ equal to zero).

    Size estimates

    Draft · drafted, by the model named above

    prod_one_sub_ge is the inequality $1 - \sum_i a_i \le \prod_i (1 - a_i)$ for $0 \le a_i \le 1$. nd_bound uses it to show that, for $n \ge 1$ and $K \ge 2n+1$, the coefficient above lies in $(0,\ 2 \cdot 2^{-K}]$. ineq_pow is the numerical fact $9 \cdot 81^n \le 256^n$ for $n \ge 2$. From these, h4_big proves the remainder bound for $n \ge 2$: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. T_facts shows the series for $T$ is summable and $0 < T \le 2/5$, by comparison with $\tfrac15 (\tfrac12)^m$.

    The remainder bound for every n

    Draft · drafted, by the model named above

    hrem_all is the statement of node erdos-1050--h1-v2--h4: for $Q_c$, $Q_x$, $A_q$ given by their formulas, and under the denominator hypothesis of --h3, for every $n$, $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. The proof introduces the denominator hypothesis without a name and does not use it. It takes $0 < T \le 2/5$ from T_facts (s17) and splits on $n$. For $n = 0$: $Q_x(0) = 1$ and $A_q(0) = 0$ (hQx0, hAq0), so $r_0 = 3T > 0$ and the bound reads $9T^2 \le 16$ (e). For $n = 1$: $Q_x(1) = 3/2$ and $A_q(1) = 0$ (hQx1, hAq1), so $r_1 = \tfrac92 T > 0$ and the bound reads $\tfrac{81}{4} T^2 \cdot 16 \le 64$. Both follow from $T \le 2/5$. For $n \ge 2$ it applies h4_big.

    The approximants

    Draft · drafted, by the model named above

    The main proof names the three families by their formulas (each obtain introduces a function and the equation defining it): $Q_c(n,k) = (-1)^k\, 2^{k(k-1)/2} \prod_{i<k} \frac{2^{n-i}-1}{2^{i+1}-1} \prod_{i<n} \frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (s2), the product of a sign, a power of $2$ and two Gaussian binomial coefficients at $q = 2$; $Q_x(n) = \sum_{k \le n} Q_c(n,k)\, x_n^k$ (s3); $A_q(n) = \sum_{k \le n} \big(\sum_{j \le k} Q_c(n,j)/(2^{k-j}-1)\big)\, x_n^k + Q_x(n) \sum_{j<n} 3/(2^{j+1}-3)$ (s4). All are rationals. Exponents are natural numbers, so $2n-k-i$ and $k(k-1)/2$ use truncated subtraction and natural-number division. In $A_q$ the term with $j = k$ divides by $2^0 - 1 = 0$, which Lean defines to be $0$.

    Denominators and remainder

    Draft · drafted, by the model named above

    hden applies the hole erdos-1050--h1-v2--h3 (the theorem erdos_1050__h1_v2__h3 from this node's Context.lean) to these three families: for every $n$ there is a natural number $d_n > 0$ with $d_n^2 \le 2^{3n^2}$ such that $d_n Q_x(n)$ and $d_n A_q(n)$ are integers. hrem applies hrem_all to the same families and to hden: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$ for every $n$.

    The integer sequences

    Draft · drafted, by the model named above

    From hden the proof chooses, for every $n$, the $d_n$ and integers $\beta_n = d_n Q_x(n)$ and $a_n = d_n A_q(n)$ (Lean's choose, not an outline step), and offers $a_n$ and $b_n = 3\beta_n$ as the sequences the statement asks for. Step key shows $b_n T - a_n = d_n\, r_n$, using $\beta_n = d_n Q_x(n)$ (key.hb') and $a_n = d_n A_q(n)$ (key.ha') in $\mathbb{R}$. Step pos concludes $b_n T - a_n > 0$, since $d_n > 0$ and $r_n > 0$; in particular it is never zero, which is the first half of the statement.

    The limit

    Draft · drafted, by the model named above

    Write $e_n = b_n T - a_n$. Step bound shows $e_n^2 \le 64 \cdot (1/2)^n$: squaring key and multiplying the bounds of hden and hrem gives $e_n^2\, 2^{4n^2} \le 2^{3n^2}\, 2^{2n+4}$ (bound.h1); writing $2^{4n^2} = 2^{n^2}\,2^{3n^2}$ (bound.h2) and cancelling $2^{3n^2}$ gives $e_n^2\, 2^{n^2} \le 2^{2n+4}$ (bound.h3); and $2^{2n+4}\, 2^n \le 64 \cdot 2^{n^2}$ because $3n + 4 \le n^2 + 6$ (bound.h4). Step hsq concludes $e_n^2 \to 0$ by squeezing between $0$ and $64 \cdot (1/2)^n$. Step this takes square roots, $\sqrt{e_n^2} \to \sqrt 0 = 0$; since $e_n > 0$ (pos), $\sqrt{e_n^2} = e_n$, so $e_n \to 0$, the second half of the statement.

    Improve these words →

    History: 2 versions on record
    1. 2026-10-06 · written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · explainer/3de2a7dc7466….md · the first version of its chain

      Read this version

      Overview

      The statement asks for integer sequences $a_n, b_n$ with $b_n T - a_n$ never zero and tending to $0$, where $T = \sum_{m \ge 0} 1/(2^{m+3}-3)$. The proof builds them from explicit Padé-type rational approximations in the style of Borwein's $q$-series argument (the file's comment cites annex f593a93a8960 on this node for the informal account). With $x_n = 3/2^n$ it defines three explicit families of rationals, $Q_c(n,k)$, $Q_x(n)$ and $A_q(n)$, and considers the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$. Two estimates do the work:

      • a denominator bound: some positive integer $d_n$ with $d_n^2 \le 2^{3n^2}$ makes $d_n Q_x(n)$ and $d_n A_q(n)$ integers. This is taken from the hole node erdos-1050--h1-v2--h3, not proved here;
      • a remainder bound: $r_n > 0$ and $r_n^2 \, 2^{4n^2} \le 2^{2n+4}$. This is the statement of the node erdos-1050--h1-v2--h4, but the file proves it inline (step hrem_all), so that the proof uses only the hole --h3.

      Then $b_n = 3 d_n Q_x(n)$ and $a_n = d_n A_q(n)$ are integers, $b_n T - a_n = d_n r_n > 0$, and $(b_n T - a_n)^2 \le 64 \cdot 2^{-n}$, which tends to $0$. The four holes --h1 to --h4 are declared dependencies; the proof term uses --h3 only.

      Product identities for the Gaussian coefficients (hrem_all.id1_test hrem_all.lower_test hrem_all.upper_test hrem_all.rhs_test hrem_all.id1_full)

      These are identities between finite products of numbers $2^a - 1$ and $2^j - 2^i$ in $\mathbb{Q}$. id1_test splits $\prod_{s<n}(2^{s+1}-1)$ at $j \le n$. lower_test and upper_test factor $\prod_{i<j}(2^j - 2^i)$ and $\prod_{j<i\le n}(2^j - 2^i)$ into a power of $2$, a sign and a product of $2^{s+1}-1$; rhs_test does the same for $\prod_{n<K\le 2n}(2^j - 2^K)$. Combined, id1_full says that for $j \le n$, $Q_c(n,j)\cdot 2^j \cdot \prod_{i \le n,\, i \ne j} (2^j - 2^i) = \prod_{n < K \le 2n} (2^j - 2^K)$, where $Q_c(n,j)$ is written out by its defining formula. That is, the coefficients $Q_c(n,\cdot)$ are the Lagrange-interpolation weights of the polynomial $\prod_{n<K\le 2n}(X - 2^K)$ at the nodes $2^0, \dots, 2^n$.

      Interpolation and the vanishing coefficients (hrem_all.lagr_eval hrem_all.tail_coeff)

      lagr_eval is Lagrange interpolation over $\mathbb{Q}$: a polynomial $N$ of degree at most $n$, whose values at $n+1$ distinct points $x_0, \dots, x_n$ are $r_j \prod_{i \ne j}(x_j - x_i)$, equals $\sum_j r_j \prod_{i \ne j}(X - x_i)$. tail_coeff uses it: for every $K > n$, if $Q_c$ satisfies the identity of id1_full, then $\sum_{j \le n} Q_c(n,j)/(2^{K-j}-1) = \prod_{n<L\le 2n}(2^K - 2^L) \big/ \prod_{i \le n}(2^K - 2^i)$. For $n < K \le 2n$ the numerator has the factor $L = K$, so this is zero: these are the coefficients that cancel in the remainder.

      T as a constant plus a power series (hrem_all.tail3 hrem_all.split3T hrem_all.cauchy_fin hrem_all.h4_series)

      split3T splits, for every $n$, $3T = \sum_{j<n} 3/(2^{j+1}-3) + \sum_{m \ge 0} 3/(2^{m+n+1}-3)$; the first part is the rational constant that appears at the end of $A_q(n)$. tail3 expands the tail, for $n \ge 1$, as a power series in $x_n = 3/2^n$: $\sum_m 3/(2^{m+n+1}-3) = \sum_{s \ge 0} x_n^{s+1}/(2^{s+1}-1)$. cauchy_fin multiplies a polynomial $\sum_{j\le n} q_j x^j$ by a convergent series $\sum_s a_s x^{s+1}$ term by term. h4_series puts these together: for $n \ge 1$, the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$ is the sum over $K > 2n$ only of $\dfrac{\prod_{n<L\le 2n}(2^K - 2^L)}{\prod_{i \le n}(2^K - 2^i)}\, x_n^K$ (a HasSum, with every term for $K \le 2n$ equal to zero).

      Size estimates (hrem_all.prod_one_sub_ge hrem_all.nd_bound hrem_all.ineq_pow hrem_all.h4_big hrem_all.T_facts)

      prod_one_sub_ge is the inequality $1 - \sum_i a_i \le \prod_i (1 - a_i)$ for $0 \le a_i \le 1$. nd_bound uses it to show that, for $n \ge 1$ and $K \ge 2n+1$, the coefficient above lies in $(0,\ 2 \cdot 2^{-K}]$. ineq_pow is the numerical fact $9 \cdot 81^n \le 256^n$ for $n \ge 2$. From these, h4_big proves the remainder bound for $n \ge 2$: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. T_facts shows the series for $T$ is summable and $0 < T \le 2/5$, by comparison with $\tfrac15 (\tfrac12)^m$.

      The remainder bound for every n (hrem_all hrem_all.s17 hrem_all.hQx0 hrem_all.hAq0 hrem_all.e hrem_all.hQx1 hrem_all.hAq1)

      hrem_all is the statement of node erdos-1050--h1-v2--h4: for $Q_c$, $Q_x$, $A_q$ given by their formulas, and under the denominator hypothesis of --h3, for every $n$, $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. The proof introduces the denominator hypothesis without a name and does not use it. It takes $0 < T \le 2/5$ from T_facts (s17) and splits on $n$. For $n = 0$: $Q_x(0) = 1$ and $A_q(0) = 0$ (hQx0, hAq0), so $r_0 = 3T > 0$ and the bound reads $9T^2 \le 16$ (e). For $n = 1$: $Q_x(1) = 3/2$ and $A_q(1) = 0$ (hQx1, hAq1), so $r_1 = \tfrac92 T > 0$ and the bound reads $\tfrac{81}{4} T^2 \cdot 16 \le 64$. Both follow from $T \le 2/5$. For $n \ge 2$ it applies h4_big.

      The approximants (s2 s3 s4)

      The main proof names the three families by their formulas (each obtain introduces a function and the equation defining it): $Q_c(n,k) = (-1)^k\, 2^{k(k-1)/2} \prod_{i<k} \frac{2^{n-i}-1}{2^{i+1}-1} \prod_{i<n} \frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (s2), the product of a sign, a power of $2$ and two Gaussian binomial coefficients at $q = 2$; $Q_x(n) = \sum_{k \le n} Q_c(n,k)\, x_n^k$ (s3); $A_q(n) = \sum_{k \le n} \big(\sum_{j \le k} Q_c(n,j)/(2^{k-j}-1)\big)\, x_n^k + Q_x(n) \sum_{j<n} 3/(2^{j+1}-3)$ (s4). All are rationals. Exponents are natural numbers, so $2n-k-i$ and $k(k-1)/2$ use truncated subtraction and natural-number division. In $A_q$ the term with $j = k$ divides by $2^0 - 1 = 0$, which Lean defines to be $0$.

      Denominators and remainder (hden hrem)

      hden applies the hole erdos-1050--h1-v2--h3 (the theorem erdos_1050__h1_v2__h3 from this node's Context.lean) to these three families: for every $n$ there is a natural number $d_n > 0$ with $d_n^2 \le 2^{3n^2}$ such that $d_n Q_x(n)$ and $d_n A_q(n)$ are integers. hrem applies hrem_all to the same families and to hden: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$ for every $n$.

      The integer sequences (key pos)

      From hden the proof chooses, for every $n$, the $d_n$ and integers $\beta_n = d_n Q_x(n)$ and $a_n = d_n A_q(n)$ (Lean's choose, not an outline step), and offers $a_n$ and $b_n = 3\beta_n$ as the sequences the statement asks for. Step key shows $b_n T - a_n = d_n\, r_n$, using $\beta_n = d_n Q_x(n)$ (key.hb') and $a_n = d_n A_q(n)$ (key.ha') in $\mathbb{R}$. Step pos concludes $b_n T - a_n > 0$, since $d_n > 0$ and $r_n > 0$; in particular it is never zero, which is the first half of the statement.

      The limit (bound hsq this)

      Write $e_n = b_n T - a_n$. Step bound shows $e_n^2 \le 64 \cdot (1/2)^n$: squaring key and multiplying the bounds of hden and hrem gives $e_n^2\, 2^{4n^2} \le 2^{3n^2}\, 2^{2n+4}$ (bound.h1); dividing by $2^{3n^2}$ (bound.h2) gives $e_n^2\, 2^{n^2} \le 2^{2n+4}$ (bound.h3); and $2^{2n+4}\, 2^n \le 64 \cdot 2^{n^2}$ because $3n + 4 \le n^2 + 6$ (bound.h4). Step hsq concludes $e_n^2 \to 0$ by squeezing between $0$ and $64 \cdot (1/2)^n$. Step this takes square roots, $\sqrt{e_n^2} \to \sqrt 0 = 0$; since $e_n > 0$ (pos), $\sqrt{e_n^2} = e_n$, so $e_n \to 0$, the second half of the statement.

    2. 2026-10-06 · written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · current · explainer/03e9a42c8cc9….md · diff to its predecessor

      Read this version

      Overview

      The statement asks for integer sequences $a_n, b_n$ with $b_n T - a_n$ never zero and tending to $0$, where $T = \sum_{m \ge 0} 1/(2^{m+3}-3)$. The proof builds them from explicit Padé-type rational approximations in the style of Borwein's $q$-series argument (the file's comment cites annex f593a93a8960 on this node for the informal account). With $x_n = 3/2^n$ it defines three explicit families of rationals, $Q_c(n,k)$, $Q_x(n)$ and $A_q(n)$, and considers the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$. Two estimates do the work:

      • a denominator bound: some positive integer $d_n$ with $d_n^2 \le 2^{3n^2}$ makes $d_n Q_x(n)$ and $d_n A_q(n)$ integers. This is taken from the hole node erdos-1050--h1-v2--h3, not proved here;
      • a remainder bound: $r_n > 0$ and $r_n^2 \, 2^{4n^2} \le 2^{2n+4}$. This is the statement of the node erdos-1050--h1-v2--h4, but the file proves it inline (step hrem_all), so that the proof uses only the hole --h3.

      Then $b_n = 3 d_n Q_x(n)$ and $a_n = d_n A_q(n)$ are integers, $b_n T - a_n = d_n r_n > 0$, and $(b_n T - a_n)^2 \le 64 \cdot 2^{-n}$, which tends to $0$. The four holes --h1 to --h4 are declared dependencies; the proof term uses --h3 only.

      Product identities for the Gaussian coefficients (hrem_all.id1_test hrem_all.lower_test hrem_all.upper_test hrem_all.rhs_test hrem_all.id1_full)

      These are identities between finite products of numbers $2^a - 1$ and $2^j - 2^i$ in $\mathbb{Q}$. id1_test splits $\prod_{s<n}(2^{s+1}-1)$ at $j \le n$. lower_test and upper_test factor $\prod_{i<j}(2^j - 2^i)$ and $\prod_{j<i\le n}(2^j - 2^i)$ into a power of $2$, a sign and a product of $2^{s+1}-1$; rhs_test does the same for $\prod_{n<K\le 2n}(2^j - 2^K)$. Combined, id1_full says that for $j \le n$, $Q_c(n,j)\cdot 2^j \cdot \prod_{i \le n,\, i \ne j} (2^j - 2^i) = \prod_{n < K \le 2n} (2^j - 2^K)$, where $Q_c(n,j)$ is written out by its defining formula. Read with lagr_eval below, this says that the numbers $Q_c(n,j)\,2^j$ are the Lagrange-interpolation weights, at the nodes $2^0, \dots, 2^n$, of the degree-$n$ polynomial $\prod_{n<K\le 2n}(X - 2^K)$.

      Interpolation and the vanishing coefficients (hrem_all.lagr_eval hrem_all.tail_coeff)

      lagr_eval is Lagrange interpolation over $\mathbb{Q}$: a polynomial $N$ of degree at most $n$, whose values at $n+1$ distinct points $x_0, \dots, x_n$ are $r_j \prod_{i \ne j}(x_j - x_i)$, equals $\sum_j r_j \prod_{i \ne j}(X - x_i)$. tail_coeff uses it: for every $K > n$, if $Q_c$ satisfies the identity of id1_full, then $\sum_{j \le n} Q_c(n,j)/(2^{K-j}-1) = \prod_{n<L\le 2n}(2^K - 2^L) \big/ \prod_{i \le n}(2^K - 2^i)$. For $n < K \le 2n$ the numerator has the factor $L = K$, so this is zero: these are the coefficients that cancel in the remainder.

      T as a constant plus a power series (hrem_all.tail3 hrem_all.split3T hrem_all.cauchy_fin hrem_all.h4_series)

      split3T splits, for every $n$, $3T = \sum_{j<n} 3/(2^{j+1}-3) + \sum_{m \ge 0} 3/(2^{m+n+1}-3)$; the first part is the rational constant that appears at the end of $A_q(n)$. tail3 expands the tail, for $n \ge 1$, as a power series in $x_n = 3/2^n$: $\sum_m 3/(2^{m+n+1}-3) = \sum_{s \ge 0} x_n^{s+1}/(2^{s+1}-1)$. cauchy_fin multiplies a polynomial $\sum_{j\le n} q_j x^j$ by a convergent series $\sum_s a_s x^{s+1}$ term by term. h4_series puts these together: for $n \ge 1$, the remainder $r_n = Q_x(n)\cdot 3T - A_q(n)$ is the sum over $K > 2n$ only of $\dfrac{\prod_{n<L\le 2n}(2^K - 2^L)}{\prod_{i \le n}(2^K - 2^i)}\, x_n^K$ (a HasSum, with every term for $K \le 2n$ equal to zero).

      Size estimates (hrem_all.prod_one_sub_ge hrem_all.nd_bound hrem_all.ineq_pow hrem_all.h4_big hrem_all.T_facts)

      prod_one_sub_ge is the inequality $1 - \sum_i a_i \le \prod_i (1 - a_i)$ for $0 \le a_i \le 1$. nd_bound uses it to show that, for $n \ge 1$ and $K \ge 2n+1$, the coefficient above lies in $(0,\ 2 \cdot 2^{-K}]$. ineq_pow is the numerical fact $9 \cdot 81^n \le 256^n$ for $n \ge 2$. From these, h4_big proves the remainder bound for $n \ge 2$: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. T_facts shows the series for $T$ is summable and $0 < T \le 2/5$, by comparison with $\tfrac15 (\tfrac12)^m$.

      The remainder bound for every n (hrem_all hrem_all.s17 hrem_all.hQx0 hrem_all.hAq0 hrem_all.e hrem_all.hQx1 hrem_all.hAq1)

      hrem_all is the statement of node erdos-1050--h1-v2--h4: for $Q_c$, $Q_x$, $A_q$ given by their formulas, and under the denominator hypothesis of --h3, for every $n$, $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$. The proof introduces the denominator hypothesis without a name and does not use it. It takes $0 < T \le 2/5$ from T_facts (s17) and splits on $n$. For $n = 0$: $Q_x(0) = 1$ and $A_q(0) = 0$ (hQx0, hAq0), so $r_0 = 3T > 0$ and the bound reads $9T^2 \le 16$ (e). For $n = 1$: $Q_x(1) = 3/2$ and $A_q(1) = 0$ (hQx1, hAq1), so $r_1 = \tfrac92 T > 0$ and the bound reads $\tfrac{81}{4} T^2 \cdot 16 \le 64$. Both follow from $T \le 2/5$. For $n \ge 2$ it applies h4_big.

      The approximants (s2 s3 s4)

      The main proof names the three families by their formulas (each obtain introduces a function and the equation defining it): $Q_c(n,k) = (-1)^k\, 2^{k(k-1)/2} \prod_{i<k} \frac{2^{n-i}-1}{2^{i+1}-1} \prod_{i<n} \frac{2^{2n-k-i}-1}{2^{i+1}-1}$ (s2), the product of a sign, a power of $2$ and two Gaussian binomial coefficients at $q = 2$; $Q_x(n) = \sum_{k \le n} Q_c(n,k)\, x_n^k$ (s3); $A_q(n) = \sum_{k \le n} \big(\sum_{j \le k} Q_c(n,j)/(2^{k-j}-1)\big)\, x_n^k + Q_x(n) \sum_{j<n} 3/(2^{j+1}-3)$ (s4). All are rationals. Exponents are natural numbers, so $2n-k-i$ and $k(k-1)/2$ use truncated subtraction and natural-number division. In $A_q$ the term with $j = k$ divides by $2^0 - 1 = 0$, which Lean defines to be $0$.

      Denominators and remainder (hden hrem)

      hden applies the hole erdos-1050--h1-v2--h3 (the theorem erdos_1050__h1_v2__h3 from this node's Context.lean) to these three families: for every $n$ there is a natural number $d_n > 0$ with $d_n^2 \le 2^{3n^2}$ such that $d_n Q_x(n)$ and $d_n A_q(n)$ are integers. hrem applies hrem_all to the same families and to hden: $r_n > 0$ and $r_n^2\, 2^{4n^2} \le 2^{2n+4}$ for every $n$.

      The integer sequences (key pos)

      From hden the proof chooses, for every $n$, the $d_n$ and integers $\beta_n = d_n Q_x(n)$ and $a_n = d_n A_q(n)$ (Lean's choose, not an outline step), and offers $a_n$ and $b_n = 3\beta_n$ as the sequences the statement asks for. Step key shows $b_n T - a_n = d_n\, r_n$, using $\beta_n = d_n Q_x(n)$ (key.hb') and $a_n = d_n A_q(n)$ (key.ha') in $\mathbb{R}$. Step pos concludes $b_n T - a_n > 0$, since $d_n > 0$ and $r_n > 0$; in particular it is never zero, which is the first half of the statement.

      The limit (bound hsq this)

      Write $e_n = b_n T - a_n$. Step bound shows $e_n^2 \le 64 \cdot (1/2)^n$: squaring key and multiplying the bounds of hden and hrem gives $e_n^2\, 2^{4n^2} \le 2^{3n^2}\, 2^{2n+4}$ (bound.h1); writing $2^{4n^2} = 2^{n^2}\,2^{3n^2}$ (bound.h2) and cancelling $2^{3n^2}$ gives $e_n^2\, 2^{n^2} \le 2^{2n+4}$ (bound.h3); and $2^{2n+4}\, 2^n \le 64 \cdot 2^{n^2}$ because $3n + 4 \le n^2 + 6$ (bound.h4). Step hsq concludes $e_n^2 \to 0$ by squeezing between $0$ and $64 \cdot (1/2)^n$. Step this takes square roots, $\sqrt{e_n^2} \to \sqrt 0 = 0$; since $e_n > 0$ (pos), $\sqrt{e_n^2} = e_n$, so $e_n \to 0$, the second half of the statement.

    Diff of 03e9a42c8cc9 against 3de2a7dc7466
    @@ -13,5 +13,5 @@
     These are identities between finite products of numbers $2^a - 1$ and $2^j - 2^i$ in $\mathbb{Q}$. `id1_test` splits $\prod_{s<n}(2^{s+1}-1)$ at $j \le n$. `lower_test` and `upper_test` factor $\prod_{i<j}(2^j - 2^i)$ and $\prod_{j<i\le n}(2^j - 2^i)$ into a power of $2$, a sign and a product of $2^{s+1}-1$; `rhs_test` does the same for $\prod_{n<K\le 2n}(2^j - 2^K)$. Combined, `id1_full` says that for $j \le n$,
     $Q_c(n,j)\cdot 2^j \cdot \prod_{i \le n,\, i \ne j} (2^j - 2^i) = \prod_{n < K \le 2n} (2^j - 2^K)$,
    -where $Q_c(n,j)$ is written out by its defining formula. That is, the coefficients $Q_c(n,\cdot)$ are the Lagrange-interpolation weights of the polynomial $\prod_{n<K\le 2n}(X - 2^K)$ at the nodes $2^0, \dots, 2^n$.
    +where $Q_c(n,j)$ is written out by its defining formula. Read with `lagr_eval` below, this says that the numbers $Q_c(n,j)\,2^j$ are the Lagrange-interpolation weights, at the nodes $2^0, \dots, 2^n$, of the degree-$n$ polynomial $\prod_{n<K\le 2n}(X - 2^K)$.
     
     ## Interpolation and the vanishing coefficients {steps: hrem_all.lagr_eval, hrem_all.tail_coeff}
    @@ -52,3 +52,3 @@
     ## The limit {steps: bound, hsq, this}
     
    -Write $e_n = b_n T - a_n$. Step `bound` shows $e_n^2 \le 64 \cdot (1/2)^n$: squaring `key` and multiplying the bounds of `hden` and `hrem` gives $e_n^2\, 2^{4n^2} \le 2^{3n^2}\, 2^{2n+4}$ (`bound.h1`); dividing by $2^{3n^2}$ (`bound.h2`) gives $e_n^2\, 2^{n^2} \le 2^{2n+4}$ (`bound.h3`); and $2^{2n+4}\, 2^n \le 64 \cdot 2^{n^2}$ because $3n + 4 \le n^2 + 6$ (`bound.h4`). Step `hsq` concludes $e_n^2 \to 0$ by squeezing between $0$ and $64 \cdot (1/2)^n$. Step `this` takes square roots, $\sqrt{e_n^2} \to \sqrt 0 = 0$; since $e_n > 0$ (`pos`), $\sqrt{e_n^2} = e_n$, so $e_n \to 0$, the second half of the statement.
    +Write $e_n = b_n T - a_n$. Step `bound` shows $e_n^2 \le 64 \cdot (1/2)^n$: squaring `key` and multiplying the bounds of `hden` and `hrem` gives $e_n^2\, 2^{4n^2} \le 2^{3n^2}\, 2^{2n+4}$ (`bound.h1`); writing $2^{4n^2} = 2^{n^2}\,2^{3n^2}$ (`bound.h2`) and cancelling $2^{3n^2}$ gives $e_n^2\, 2^{n^2} \le 2^{2n+4}$ (`bound.h3`); and $2^{2n+4}\, 2^n \le 64 \cdot 2^{n^2}$ because $3n + 4 \le n^2 + 6$ (`bound.h4`). Step `hsq` concludes $e_n^2 \to 0$ by squeezing between $0$ and $64 \cdot (1/2)^n$. Step `this` takes square roots, $\sqrt{e_n^2} \to \sqrt 0 = 0$; since $e_n > 0$ (`pos`), $\sqrt{e_n^2} = e_n$, so $e_n \to 0$, the second half of the statement.

    Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).

  3. erdos-1050 proved

    Statement not audited — fidelity mechanical-only; QA pass incomplete; no signer yet.

    theorem Opn.erdos_1050 :
        Irrational (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 1) - 3)) := 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 →

    Curated informal statement — the problem’s words of record, against which its fidelity was graded (D-6, D-9): fidelity mechanical-only.

    Erdős Problem 1050. The series $\sum_{n=1}^\infty \frac{1}{2^n - 3}$ is irrational. The source sum runs over $n \ge 1$; as a tsum over ℕ (which starts at $0$) it is reindexed $n \mapsto n + 1$, i.e. $\sum_{n=0}^\infty 1/(2^{n+1} - 3)$.

    In words, unverified — what this statement says; written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06; no one has read it against the Lean and signed it. A gloss of a root is not its words of record: the curated statement above is (D-9).

    Draft · drafted, by the model named above

    This file states the theorem Opn.erdos_1050: the real number $\displaystyle \sum_{n=0}^{\infty} \frac{1}{2^{n+1}-3}$ is irrational.

    In detail:

    • The sum is Lean's ∑' over all natural numbers $n = 0, 1, 2, \dots$ (Mathlib's unconditional sum, a tsum). Each term is the real number $1/(2^{n+1}-3)$, computed in $\mathbb{R}$. The terms are $-1, 1, \tfrac{1}{5}, \tfrac{1}{13}, \tfrac{1}{29}, \dots$; the first, at $n = 0$, is $1/(2-3) = -1$.
    • Re-indexed with $m = n+1$, this is the sum $\sum_{m \ge 1} 1/(2^m - 3)$ of Erdős problem 1050. The file's own comment says the statement is imported, as stated, from google-deepmind/formal-conjectures (FormalConjectures/ErdosProblems/1050.lean, Apache-2.0).
    • Irrational x is Mathlib's predicate: $x$ is not equal to $p/q$, read as a real number, for any rational $p/q$.
    • Two Lean conventions do not come into play here, but a reader should know the file leans on neither. Division by zero is defined to be $0$ in Lean; no denominator $2^{n+1}-3$ is zero (it is $-1$ at $n = 0$ and at least $1$ afterwards). And ∑' of a family that is not summable is defined to be $0$; the statement itself does not assert that the series converges, so the claim is about the tsum as Lean defines it. (The series does converge absolutely, since its terms are eventually bounded by a multiple of $2^{-n}$, so the tsum is the ordinary sum; the merged proof checks summability in its step hT.)

    The statement has no hypotheses and no free variables. The file imports all of Mathlib; its body is sorry, the placeholder a statement file carries in place of a proof.

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

    Checked by the kernel — an outline of the proof attested in attestations/000326.json, merge commit e80916551a30.

    Outline of Proof.lean, extracted by the gate at 82834c4684b8 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. s1 obtain ∃ (a : ℕ → ℤ) (b : ℕ → ℤ), (∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ)) ∧ Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ))

      Leaves Irrational (∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ))), with a : ℕ → ℤ, b : ℕ → ℤ, hne : ∀ (n : ℕ), (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ) ≠ (0 : ℝ), hlim : Filter.Tendsto (fun (n : ℕ) => (↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)) Filter.atTop (nhds (0 : ℝ)).

      Uses statements erdos-1050--h1-v2.

      Lean, line 26
        obtain ⟨a, b, hne, hlim⟩ := erdos_1050__h1

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 26 at e80916551a30 ↗

    2. hT have Summable fun (n : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))

      Leaves Irrational (∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ))), with hT : Summable fun (n : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)).

      Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , Summable.of_nonneg_of_le Comparison test of convergence of series of non-negative real numbers. , summable_geometric_two.

      Lean, lines 28–36
        have hT : Summable (fun n : ℕ => (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) := by
          refine Summable.of_nonneg_of_le (fun n => ?_) (fun n => ?_) (summable_geometric_two.mul_left (1 / 4))
          · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)
            have h2 : (0 : ℝ) < 2 ^ (n + 3) - 3 := by rw [pow_add]; norm_num; linarith
            exact le_of_lt (one_div_pos.mpr h2)
          · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)
            have e : (1 / 4 : ℝ) * (1 / 2) ^ n = 1 / (4 * 2 ^ n) := by rw [one_div_pow]; field_simp
            rw [e, pow_add]
            exact one_div_le_one_div_of_le (by positivity) (by norm_num; linarith)

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 28–36 at e80916551a30 ↗

      1. hT.s1 case

        Leaves (0 : ℝ) ≤ (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)).

        Uses library le_of_lt, one_div_pos.

        Lean, lines 30–32
            · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)
              have h2 : (0 : ℝ) < 2 ^ (n + 3) - 3 := by rw [pow_add]; norm_num; linarith
              exact le_of_lt (one_div_pos.mpr h2)

        targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 30–32 at e80916551a30 ↗

        1. hT.s1.h1 have (1 : ℝ) ≤ (2 : ℝ) ^ n

          Leaves (0 : ℝ) ≤ (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)), with h1 : (1 : ℝ) ≤ (2 : ℝ) ^ n.

          Uses library one_le_pow₀.

          Lean, line 30
              · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)

          targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 30 at e80916551a30 ↗

        2. hT.s1.h2 have (0 : ℝ) < (2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)

          Leaves (0 : ℝ) ≤ (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)), with h2 : (0 : ℝ) < (2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ).

          Uses library pow_add.

          Lean, line 31
                have h2 : (0 : ℝ) < 2 ^ (n + 3) - 3 := by rw [pow_add]; norm_num; linarith

          targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 31 at e80916551a30 ↗

      2. hT.s2 case

        Leaves (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) ≤ (1 / 4 : ℝ) * (1 / 2 : ℝ) ^ n.

        Uses library pow_add, one_div_le_one_div_of_le.

        Lean, lines 33–36
            · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)
              have e : (1 / 4 : ℝ) * (1 / 2) ^ n = 1 / (4 * 2 ^ n) := by rw [one_div_pow]; field_simp
              rw [e, pow_add]
              exact one_div_le_one_div_of_le (by positivity) (by norm_num; linarith)

        targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 33–36 at e80916551a30 ↗

        1. hT.s2.h1 have (1 : ℝ) ≤ (2 : ℝ) ^ n

          Leaves (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) ≤ (1 / 4 : ℝ) * (1 / 2 : ℝ) ^ n, with h1 : (1 : ℝ) ≤ (2 : ℝ) ^ n.

          Uses library one_le_pow₀.

          Lean, line 33
              · have h1 : (1 : ℝ) ≤ 2 ^ n := one_le_pow₀ (by norm_num)

          targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 33 at e80916551a30 ↗

        2. hT.s2.e have (1 / 4 : ℝ) * (1 / 2 : ℝ) ^ n = (1 : ℝ) / ((4 : ℝ) * (2 : ℝ) ^ n)

          Leaves (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) ≤ (1 / 4 : ℝ) * (1 / 2 : ℝ) ^ n, with e : (1 / 4 : ℝ) * (1 / 2 : ℝ) ^ n = (1 : ℝ) / ((4 : ℝ) * (2 : ℝ) ^ n).

          Uses library one_div_pow.

          Lean, line 34
                have e : (1 / 4 : ℝ) * (1 / 2) ^ n = 1 / (4 * 2 ^ n) := by rw [one_div_pow]; field_simp

          targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 34 at e80916551a30 ↗

    3. hroot have ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ)) = ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ))

      Leaves Irrational (∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ))), with hroot : ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ)) = ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)).

      Uses library Finset.sum_range_succ, add_assoc.

      Lean, lines 37–41
        have hroot : ∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 1) - 3) = ∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3) := by
          have hs : Summable (fun n : ℕ => (1 : ℝ) / ((2 : ℝ) ^ (n + 1) - 3)) :=
            (summable_nat_add_iff 2).mp (by simpa only [add_assoc] using hT)
          rw [← hs.sum_add_tsum_nat_add 2]
          norm_num [Finset.sum_range_succ, add_assoc]

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 37–41 at e80916551a30 ↗

      1. hroot.hs have Summable fun (n : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ))

        Leaves ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ)) = ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)), with hs : Summable fun (n : ℕ) => (1 : ℝ) / ((2 : ℝ) ^ (n + (1 : ℕ)) - (3 : ℝ)).

        Uses library Summable Summable f means that f has some (infinite) sum with respect to L. , summable_nat_add_iff, add_assoc.

        Lean, lines 38–39
            have hs : Summable (fun n : ℕ => (1 : ℝ) / ((2 : ℝ) ^ (n + 1) - 3)) :=
              (summable_nat_add_iff 2).mp (by simpa only [add_assoc] using hT)

        targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 38–39 at e80916551a30 ↗

    4. hq have (0 : ℝ) < (↑r.den : ℝ)

      Leaves False, with hq : (0 : ℝ) < (↑r.den : ℝ).

      Lean, line 45
        have hq : (0 : ℝ) < r.den := by exact_mod_cast r.den_pos

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 45 at e80916551a30 ↗

    5. hint have ∀ (n : ℕ), (↑(b n * r.num - a n * (↑r.den : ℤ)) : ℝ) = (↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ))

      Leaves False, with hint : ∀ (n : ℕ), (↑(b n * r.num - a n * (↑r.den : ℤ)) : ℝ) = (↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ)).

      Lean, lines 46–51
        have hint : ∀ n : ℕ, ((b n * r.num - a n * r.den : ℤ) : ℝ) =
            (r.den : ℝ) * ((b n : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n) := by
          intro n
          rw [← hr]
          have : (r : ℝ) = r.num / r.den := by exact_mod_cast (Rat.num_div_den r).symm
          rw [this]; push_cast; field_simp

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 46–51 at e80916551a30 ↗

      1. hint.this have (↑r : ℝ) = (↑r.num : ℝ) / (↑r.den : ℝ)

        Leaves (↑(b n * r.num - a n * (↑r.den : ℤ)) : ℝ) = (↑r.den : ℝ) * ((↑(b n) : ℝ) * (↑r : ℝ) - (↑(a n) : ℝ)), with this : (↑r : ℝ) = (↑r.num : ℝ) / (↑r.den : ℝ).

        Uses library Rat.num_div_den.

        Lean, line 50
            have : (r : ℝ) = r.num / r.den := by exact_mod_cast (Rat.num_div_den r).symm

        targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 50 at e80916551a30 ↗

    6. h0 have Filter.Tendsto (fun (n : ℕ) => (↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ))) Filter.atTop (nhds (0 : ℝ))

      Leaves False, with h0 : Filter.Tendsto (fun (n : ℕ) => (↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ))) Filter.atTop (nhds (0 : ℝ)).

      Uses library Filter.Tendsto Filter.Tendsto is the generic "limit of a function" predicate. , Filter.atTop atTop is the filter representing the limit → ∞ on an ordered set. , nhds A set is called a neighborhood of x if it contains an open set around x. .

      Lean, lines 52–54
        have h0 : Filter.Tendsto (fun n : ℕ => (r.den : ℝ) *
            ((b n : ℝ) * (∑' n : ℕ, (1 : ℝ) / ((2 : ℝ) ^ (n + 3) - 3)) - a n)) Filter.atTop (nhds 0) := by
          simpa using hlim.const_mul (r.den : ℝ)

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 52–54 at e80916551a30 ↗

    7. s7 obtain ∃ (N : ℕ), ∀ n ≥ N, dist ((↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ))) (0 : ℝ) < (1 : ℝ)

      Leaves False, with N : ℕ, hN : ∀ n ≥ N, dist ((↑r.den : ℝ) * ((↑(b n) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a n) : ℝ))) (0 : ℝ) < (1 : ℝ).

      Uses library Metric.tendsto_atTop, one_pos Alias of zero_lt_one. .

      Lean, line 55
        obtain ⟨N, hN⟩ := (Metric.tendsto_atTop.mp h0) 1 one_pos

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 55 at e80916551a30 ↗

    8. hsmall have dist ((↑r.den : ℝ) * ((↑(b N) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a N) : ℝ))) (0 : ℝ) < (1 : ℝ)

      Leaves False, with hsmall : dist ((↑r.den : ℝ) * ((↑(b N) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a N) : ℝ))) (0 : ℝ) < (1 : ℝ).

      Uses library le_rfl A version of le_refl where the argument is implicit .

      Lean, line 56
        have hsmall := hN N le_rfl

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 56 at e80916551a30 ↗

    9. hnz have b N * r.num - a N * (↑r.den : ℤ) ≠ (0 : ℤ)

      Leaves False, with hnz : b N * r.num - a N * (↑r.den : ℤ) ≠ (0 : ℤ).

      Uses library Int.cast_zero, mul_eq_zero If α has no zero divisors, then the product of two elements equals zero iff one of them equals zero. .

      Lean, lines 58–63
        have hnz : (b N * r.num - a N * r.den : ℤ) ≠ 0 := by
          intro hz
          apply hne N
          have h2 := hint N
          rw [hz, Int.cast_zero] at h2
          exact (mul_eq_zero.mp h2.symm).resolve_left hq.ne'

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 58–63 at e80916551a30 ↗

      1. hnz.h2 have (↑(b N * r.num - a N * (↑r.den : ℤ)) : ℝ) = (↑r.den : ℝ) * ((↑(b N) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a N) : ℝ))

        Leaves (↑(b N) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a N) : ℝ) = (0 : ℝ), with h2 : (↑(b N * r.num - a N * (↑r.den : ℤ)) : ℝ) = (↑r.den : ℝ) * ((↑(b N) : ℝ) * ∑' (n : ℕ), (1 : ℝ) / ((2 : ℝ) ^ (n + (3 : ℕ)) - (3 : ℝ)) - (↑(a N) : ℝ)).

        Lean, line 61
            have h2 := hint N

        targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 61 at e80916551a30 ↗

    10. this have (1 : ℝ) ≤ |(↑(b N * r.num - a N * (↑r.den : ℤ)) : ℝ)|

      Leaves False, with this : (1 : ℝ) ≤ |(↑(b N * r.num - a N * (↑r.den : ℤ)) : ℝ)|.

      Uses library Int.one_le_abs.

      Lean, line 64
        have : (1 : ℝ) ≤ |((b N * r.num - a N * r.den : ℤ) : ℝ)| := by exact_mod_cast Int.one_le_abs hnz

      targets/erdos-1050/nodes/erdos-1050/Proof.lean, line 64 at e80916551a30 ↗

    Proof: targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 1–65 at e80916551a30.

    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/6dcb5fb7486d….md, written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session, 2026-10-06.

    Overview

    Draft · drafted, by the model named above

    The proof is the classical irrationality criterion, applied to a number $T$ for which another node supplies the approximations. Write $T = \sum_{m \ge 0} 1/(2^{m+3}-3)$. Node erdos-1050--h1-v2 states that there are integer sequences $a_n, b_n$ with $b_n T - a_n \neq 0$ for every $n$ and $b_n T - a_n \to 0$. The proof takes those sequences, shows that the root's sum equals $T$, and then argues: if $T = p/q$ were rational, $q(b_n T - a_n) = b_n p - a_n q$ would be a nonzero integer for every $n$ that also tends to $0$, which is impossible. All the depth sits in erdos-1050--h1-v2; this file is short.

    The approximating sequences

    Draft · drafted, by the model named above

    The proof opens by unpacking the statement of erdos-1050--h1-v2 (in Lean, the theorem erdos_1050__h1, which the node's Context.lean provides): integer sequences $a, b$, the fact hne that $b_n T - a_n \ne 0$ for all $n$, and the fact hlim that $b_n T - a_n \to 0$.

    The root's series is T

    Draft · drafted, by the model named above

    Step hT shows that $\sum_m 1/(2^{m+3}-3)$ is summable, by comparison with the geometric series $\tfrac14 (\tfrac12)^m$: each term is positive, because $2^{m+3} - 3 > 0$ (sub-steps hT.s1.h1, hT.s1.h2), and at most $1/(4 \cdot 2^m)$, because $4 \cdot 2^m \le 2^{m+3} - 3$ whenever $2^m \ge 1$ (sub-steps hT.s2.h1, hT.s2.e).

    Step hroot shows that the root's sum $\sum_{n \ge 0} 1/(2^{n+1}-3)$ equals $T$. Shifting the index by two turns the root's series into the series of hT, so the root's series is summable too (hroot.hs). Its first two terms are $1/(2-3) = -1$ and $1/(4-3) = 1$, which cancel, and its tail from $n = 2$ on is exactly $T$. The proof then rewrites the goal from the irrationality of the root's sum to the irrationality of $T$.

    Suppose T is rational

    Draft · drafted, by the model named above

    Mathlib's Irrational x means $x$ is not the image of any rational number, so the proof assumes a rational $r$ whose value in $\mathbb{R}$ is $T$ (the rintro on the line before hq, which the outline does not list as a step) and derives a contradiction. Write $r = p/q$ in lowest terms, with numerator $p$ = r.num and denominator $q$ = r.den. Step hq records $q > 0$. Step hint shows, for every $n$, that the integer $b_n p - a_n q$, read as a real number, equals $q\,(b_n T - a_n)$; it uses $r = p/q$ (sub-step hint.this) and clears the denominator.

    The integers become small

    Draft · drafted, by the model named above

    Step h0 multiplies the limit hlim by the constant $q$: $q\,(b_n T - a_n) \to 0$. Step s7 reads off the definition of a limit with $\varepsilon = 1$: there is an $N$ such that $|q\,(b_n T - a_n)| < 1$ for all $n \ge N$. Step hsmall takes $n = N$. By hint, this says the integer $b_N p - a_N q$ has absolute value less than $1$.

    The contradiction

    Draft · drafted, by the model named above

    Step hnz shows that the integer $b_N p - a_N q$ is not zero: if it were, hint at $N$ (sub-step hnz.h2) would give $q\,(b_N T - a_N) = 0$, and since $q \ne 0$, $b_N T - a_N = 0$, contradicting hne. Step this then uses that a nonzero integer has absolute value at least $1$. Together with hsmall (absolute value less than $1$), this is a contradiction, which linarith closes on the last line.

    Improve these words →

    History: 1 version on record
    1. 2026-10-06 · written by t1006-w1, drafted with Claude Opus 5.5 (claude-opus-5-5) in a Claude Code agent session · not signed · current · explainer/6dcb5fb7486d….md · the first version of its chain

      Read this version

      Overview

      The proof is the classical irrationality criterion, applied to a number $T$ for which another node supplies the approximations. Write $T = \sum_{m \ge 0} 1/(2^{m+3}-3)$. Node erdos-1050--h1-v2 states that there are integer sequences $a_n, b_n$ with $b_n T - a_n \neq 0$ for every $n$ and $b_n T - a_n \to 0$. The proof takes those sequences, shows that the root's sum equals $T$, and then argues: if $T = p/q$ were rational, $q(b_n T - a_n) = b_n p - a_n q$ would be a nonzero integer for every $n$ that also tends to $0$, which is impossible. All the depth sits in erdos-1050--h1-v2; this file is short.

      The approximating sequences (s1)

      The proof opens by unpacking the statement of erdos-1050--h1-v2 (in Lean, the theorem erdos_1050__h1, which the node's Context.lean provides): integer sequences $a, b$, the fact hne that $b_n T - a_n \ne 0$ for all $n$, and the fact hlim that $b_n T - a_n \to 0$.

      The root's series is T (hT hroot)

      Step hT shows that $\sum_m 1/(2^{m+3}-3)$ is summable, by comparison with the geometric series $\tfrac14 (\tfrac12)^m$: each term is positive, because $2^{m+3} - 3 > 0$ (sub-steps hT.s1.h1, hT.s1.h2), and at most $1/(4 \cdot 2^m)$, because $4 \cdot 2^m \le 2^{m+3} - 3$ whenever $2^m \ge 1$ (sub-steps hT.s2.h1, hT.s2.e).

      Step hroot shows that the root's sum $\sum_{n \ge 0} 1/(2^{n+1}-3)$ equals $T$. Shifting the index by two turns the root's series into the series of hT, so the root's series is summable too (hroot.hs). Its first two terms are $1/(2-3) = -1$ and $1/(4-3) = 1$, which cancel, and its tail from $n = 2$ on is exactly $T$. The proof then rewrites the goal from the irrationality of the root's sum to the irrationality of $T$.

      Suppose T is rational (hq hint)

      Mathlib's Irrational x means $x$ is not the image of any rational number, so the proof assumes a rational $r$ whose value in $\mathbb{R}$ is $T$ (the rintro on the line before hq, which the outline does not list as a step) and derives a contradiction. Write $r = p/q$ in lowest terms, with numerator $p$ = r.num and denominator $q$ = r.den. Step hq records $q > 0$. Step hint shows, for every $n$, that the integer $b_n p - a_n q$, read as a real number, equals $q\,(b_n T - a_n)$; it uses $r = p/q$ (sub-step hint.this) and clears the denominator.

      The integers become small (h0 s7 hsmall)

      Step h0 multiplies the limit hlim by the constant $q$: $q\,(b_n T - a_n) \to 0$. Step s7 reads off the definition of a limit with $\varepsilon = 1$: there is an $N$ such that $|q\,(b_n T - a_n)| < 1$ for all $n \ge N$. Step hsmall takes $n = N$. By hint, this says the integer $b_N p - a_N q$ has absolute value less than $1$.

      The contradiction (hnz this)

      Step hnz shows that the integer $b_N p - a_N q$ is not zero: if it were, hint at $N$ (sub-step hnz.h2) would give $q\,(b_N T - a_N) = 0$, and since $q \ne 0$, $b_N T - a_N = 0$, contradicting hne. Step this then uses that a nonzero integer has absolute value at least $1$. Together with hsmall (absolute value less than $1$), this is a contradiction, which linarith closes on the last line.

    Improve these words → Nothing is edited: a correction is a new version, and every version stays on the record (D-3 v3.30).

Correspondence

Checked by the kernel — each row’s declaration, file, lines and attestation are the attested record; the explainer column says only whether unverified prose exists and who signed it.

StatementDeclarationProof file and linesAttestationExplainer
erdos-1050--h1-v2--h3erdos_1050__h1_v2__h3targets/erdos-1050/nodes/erdos-1050--h1-v2--h3/Proof.lean, lines 1–845 at 2987e49b6fb3attestations/000292.jsonunverified, 22 sections: 22 drafted
erdos-1050--h1-v2erdos_1050__h1targets/erdos-1050/nodes/erdos-1050--h1-v2/Proof.lean, lines 1–797 at 879b5c03f7dfattestations/000319.jsonunverified, 10 sections: 10 drafted
erdos-1050Opn.erdos_1050targets/erdos-1050/nodes/erdos-1050/Proof.lean, lines 1–65 at e80916551a30attestations/000326.jsonunverified, 6 sections: 6 drafted