Open Proof Network

Problems / erdos-1050 / erdos-1050--h1-v2--h2--h1

Numerator integrality (Borwein Lemma 3)

erdos-1050--h1-v2--h2--h1

proved

Hole numerator_integral of erdos-1050--h1-v2--h2 (split by 20260929T194647Z-t0929-1-partial.lean).

$\displaystyle \exists\, a:\mathbb{N}\to\mathbb{Z}\ \ \forall n\ge 1:\qquad a(n)\;=\;9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr)$

There is a sequence of integers $a(n)$ such that for every $n\ge 1$ the identity holds in $\mathbb{R}$, that is, $9^n W(n)(S_1(n)-S_2(n))$ is an integer, where, with $c=8/3$, $W(n)=(n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$ for $1\le k\le n$, $S_1(n)=\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$ and $S_2(n)=\sum_{i=1}^{n-1}\dfrac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$, all sums finite. Here $n-2$ is natural-number subtraction (so $(n-2)!=1$ at $n=1$), $\lfloor (n+1)/2\rfloor$ is natural-number division, the exponent $l-k$ is an integer (so $2^{l-k}$ may be $1/2$ and so on), at $n=1$ the product over $t$ is empty and $S_2(1)=0$, and nothing is required of $a(0)$.

unverified · history

Lean
theorem erdos_1050__h1_v2__h2__h1 : ∃ (a : ℕ → ℤ),
  ∀ (n : ℕ),
    (1 : ℕ) ≤ n →
      (↑(a n) : ℝ) =
        (9 : ℝ) ^ n *
            (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) *
              ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) *
          (∑ k ∈ Finset.Icc (1 : ℕ) n,
              ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                  ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ -
            ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)),
              (∑ k ∈ Finset.Icc (1 : ℕ) n,
                  ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                      ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                    (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) /
                ((2 : ℝ) ^ i - (1 : ℝ))) := by
  sorry
Why does it end in sorry?

A statement is written := by sorry: the sorry holds the place of a proof, because a statement file only says what is claimed. A proof the gate checked is its own file, Proof.lean. How to read a proof page →

Explainer

Informal account, unverified — unverified prose about a kernel-checked proof; shown section by section, each labelled with who drafted, wrote or verified it (D-3 v3.31).

Unverified: explainer, its words from explainer/dbda1b664f81….md, written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent, 2026-10-06; explainer/dec3b03a5a2b….md, written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent, 2026-10-06.

What is proved, and the plan

Draft · drafted, by the model named above

Fix $c = 8/3$. For $n \ge 1$ and $1 \le k \le n$ write $$D_k=\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr),\qquad A_k(x)=-\frac{\prod_{t=1}^{n-1}\bigl(1-x\,2^{\,t+k}\bigr)}{D_k},\qquad h_i=\bigl(1-c\,2^{i}\bigr)^{-1},$$ $$P(n)=\prod_{k=1}^{n}\bigl(1-c\,2^k\bigr),\qquad M_n=\prod_{k=\lceil n/2\rceil}^{n}\bigl(1-2^k\bigr),\qquad W(n)=(n-2)!\,P(n)\,M_n .$$ The statement asks for integers $a(n)$ with $a(n)=9^nW(n)\bigl(S_1(n)-S_2(n)\bigr)$ for $n\ge1$, where $S_1=\sum_{k=1}^n A_k(c)\sum_{i=1}^k h_i$ and $S_2=\sum_{i=1}^{n-1} B_i/(2^i-1)$ with $B_i=\sum_{k=1}^n A_k(c)\,(c\,2^k)^{-i}$.

The proof shows separately that $9^nW(n)S_1(n)$ is an integer (head_integral) and that $9^nW(n)S_2(n)$ is an integer (hmer), and takes $a(n)=a_1(n)-a_2(n)$; the last four lines of the proof check the identity by ring. The factor $(n-2)!$ is carried along as an integer and plays no other part. The proof uses no other node of the graph (the outline lists none), and its comments point to annex a03db62f… on this node for the informal argument.

Throughout, $H_e=\sum_{k=1}^{n}(2^k)^e/D_k$ for $e \ge 0$ (a sum the proof shows to be an integer).

Read it step by step (7 more sections)

Finite sums of integers

Draft · drafted, by the model named above

hsumZ is bookkeeping: if every term $g(i)$, $i\in s$, of a finite sum of reals is (the image of) an integer, so is the sum. It is proved by induction on the finite set $s$, and is used whenever a sum is shown to be an integer term by term.

Lagrange sums at the nodes $2^k$

Draft · drafted, by the model named above

For a finite set $s$ of naturals and $k\in s$ write $D_s(k)=\prod_{l\in s,\ l\ne k}(1-2^{\,l-k})$; for $s=\{1,\dots,n\}$ this is $D_k$.

h0: for nonempty $s$, $\sum_{k\in s}1/D_s(k)=1$. Mathlib's Lagrange basis polynomials for the nodes $2^{-k}$ sum to $1$; evaluating that identity at $0$ gives exactly these terms.

hrec: for $a\in s$ and any weight $f$,

$$\sum_{k\in s}\frac{2^k f(k)}{D_s(k)}=\sum_{k\in s\setminus\{a\}}\frac{2^k f(k)}{D_{s\setminus\{a\}}(k)}+2^a\sum_{k\in s}\frac{f(k)}{D_s(k)},$$ by splitting off the factor $l=a$ from each $D_s(k)$.

hW: for every $s$ and every $e\ge0$, $\sum_{k\in s}(2^k)^e/D_s(k)$ is an integer. Induction on $|s|+e$: the empty set gives $0$, $e=0$ gives $1$ by h0, and otherwise hrec with $f(k)=(2^k)^{e-1}$ writes the sum as the sum for $(s\setminus\{a\},e)$ plus $2^a$ times the sum for $(s,e-1)$. In particular every $H_e$ is an integer.

hV: for $m+1<|s|$, $\sum_{k\in s}(2^k)^{-(m+1)}/D_s(k)=0$. Induction on $m$, again from hrec, with h0 in the base case.

Geometric sums, a divisibility, and an integer polynomial

Draft · drafted, by the model named above

hgeo: for $m\ge1$ and every $k$, $\sum_{i=1}^{k}2^{-im}=\dfrac{1-2^{-km}}{2^m-1}$, by induction on $k$.

hdvd: for $1\le i\le n-1$, the integer $2^i-1$ divides $\prod_{k=\lceil n/2\rceil}^{n}(1-2^k)$. The multiple $k_0=i\lfloor n/i\rfloor$ of $i$ lies in $[\lceil n/2\rceil,n]$, and $2^i-1$ divides $2^{k_0}-1$. This is what the factor $M_n$ in the statement is for.

hpoly: for $n\ge1$ there are integers $\alpha_0,\dots,\alpha_{n-1}$ with $\prod_{t=1}^{n-1}(1-2^t y)=\sum_{j<n}\alpha_j y^j$ for every real $y$ (the coefficients of that integer polynomial, of degree less than $n$). Consequently $A_k(x)=-\frac1{D_k}\sum_{j<n}\alpha_j\,(x\,2^k)^j$.

The residues are integers

Draft · drafted, by the model named above

residue_integral: for $1\le i\le n$, the number $b_i=\sum_{k=i}^{n}A_k(2^{-i})$ is an integer. In fact each term is. Write $k=i+d$ and $Q(m)=\prod_{s=1}^{m}(1-2^s)$, which is never $0$.

At $x=2^{-i}$ the numerator of $A_k$ is the integer $\prod_{t=1}^{n-1}(1-2^{\,t+d})$.

$D_k$ splits into the factors with $l<k$ and $l>k$; the first part times $\prod_{s=1}^{k-1}(-2^s)$ is $Q(k-1)$, and the second part is $Q(n-k)$.

Two identities about $Q$: $Q(a+b)$ is an integer multiple of $Q(a)Q(b)$ (the Gaussian binomial coefficient at $q=2$ is an integer), and $Q(d)\prod_{t=1}^{m}(1-2^{\,t+d})=Q(d+m)$.

Together these give numerator $=z_1z_2\,Q(k-1)Q(n-k)$ for integers $z_1,z_2$, so the term $A_k(2^{-i})$ equals the integer $-z_1z_2\prod_{s=1}^{k-1}(-2^s)$.

The polynomial part

Draft · drafted, by the model named above

polypart_integral: for $n\ge1$, with $R(n)=\sum_{i=1}^{n}b_i\,h_i$, the number $3^n M_n\bigl(S_1(n)-R(n)\bigr)$ is an integer. So $S_1$ differs from its "residue part" $R$ by something whose denominators are only powers of $3$ and divisors of $M_n$.

Exchanging the order of summation, $R=\sum_{k=1}^{n}\sum_{i=1}^{k}A_k(2^{-i})\,h_i$, so $S_1-R=\sum_{k}\sum_{i\le k}\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i$.

For each $k$ and $i\ge1$, using hpoly and the factorisation of $y^j-c^j$ with $y=2^{-i}$:

$$\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i=\frac1{D_k}\sum_{j<n}\sum_{s<j}\alpha_j\,2^{kj}\,c^{s}\,2^{-i(j-s)} .$$

Summing over $i=1,\dots,k$ with hgeo turns $2^{kj}\sum_i 2^{-i(j-s)}$ into $\bigl((2^k)^j-(2^k)^s\bigr)/(2^{j-s}-1)$.

Summing over $k$ then gives $\sum_{j<n}\sum_{s<j}\alpha_j\,c^s\,(H_j-H_s)/(2^{j-s}-1)$. Here $H_j,H_s$ are integers by hW, $2^{j-s}-1$ divides $M_n$ by hdvd (as $1\le j-s\le n-1$), and $3^n c^s=3^{n-s}8^s$. Each term times $3^nM_n$ is therefore an integer, and so is the sum.

The first sum $S_1$

Draft · drafted, by the model named above

head_integral produces integers $a_1(n)$ with $a_1(n)=9^nW(n)S_1(n)$ for $n\ge1$. Writing $S_1=(S_1-R)+R$: $$9^nW(n)S_1=(n-2)!\Bigl[\bigl(3^nP(n)\bigr)\cdot 3^nM_n(S_1-R)+3^nM_n\cdot\bigl(3^nP(n)R\bigr)\Bigr].$$ Here $3^nP(n)=\prod_{k=1}^n(3-8\cdot2^k)$ is an integer, $3^nM_n(S_1-R)$ is an integer by polypart_integral, and $3^nP(n)R$ is an integer because $3^nP(n)\,h_i=3\prod_{j\ne i}(3-8\cdot2^j)$ and each $b_i$ is an integer by residue_integral. The sequence $a_1$ is then chosen from these integers (with value $0$ at $n=0$); s12 unpacks it.

The second sum $S_2$

Draft · drafted, by the model named above

hmer produces integers $a_2(n)$ with $a_2(n)=9^nW(n)S_2(n)$ for $n\ge1$. Its step key shows that for $1\le i\le n-1$ the number $3^{\,n-1-i}B_i$ is an integer: expanding $A_k(c)$ with hpoly, $$B_i=-\sum_{j<n}\alpha_j\sum_{k=1}^{n}\frac{(c\,2^k)^{\,j-i}}{D_k}.$$ For $j<i$ the inner sum is $c^{-(i-j)}$ times a sum that vanishes by hV (since $1\le i-j<n$); for $j\ge i$ it is $c^{\,j-i}H_{j-i}$, and $3^{\,n-1-i}c^{\,j-i}=3^{\,n-1-j}8^{\,j-i}$.

Then each term of $9^nW(n)S_2(n)$ is an integer: write $9^n=3^{i+1}\cdot3^{\,n-1-i}\cdot3^n$, use $3^nP(n)=\prod_k(3-8\cdot 2^k)$, and use hdvd to write $M_n=(2^i-1)q$, which cancels the denominator $2^i-1$. The term becomes $3^{i+1}(n-2)!\prod_k(3-8\cdot2^k)\,q$ times the integer from key. (Inside hmer the proof restates hdvd and hsumZ as local copies.) s14 unpacks $a_2$, and the proof ends with $a=a_1-a_2$.

Improve these words →

History: 2 versions on record
  1. 2026-10-06 · written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent · not signed · explainer/dbda1b664f81….md · the first version of its chain

    Read this version

    What is proved, and the plan

    Fix $c = 8/3$. For $n \ge 1$ and $1 \le k \le n$ write $$D_k=\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr),\qquad A_k(x)=-\frac{\prod_{t=1}^{n-1}\bigl(1-x\,2^{\,t+k}\bigr)}{D_k},\qquad h_i=\bigl(1-c\,2^{i}\bigr)^{-1},$$ $$P(n)=\prod_{k=1}^{n}\bigl(1-c\,2^k\bigr),\qquad M_n=\prod_{k=\lceil n/2\rceil}^{n}\bigl(1-2^k\bigr),\qquad W(n)=(n-2)!\,P(n)\,M_n .$$ The statement asks for integers $a(n)$ with $a(n)=9^nW(n)\bigl(S_1(n)-S_2(n)\bigr)$ for $n\ge1$, where $S_1=\sum_{k=1}^n A_k(c)\sum_{i=1}^k h_i$ and $S_2=\sum_{i=1}^{n-1} B_i/(2^i-1)$ with $B_i=\sum_{k=1}^n A_k(c)\,(c\,2^k)^{-i}$.

    The proof shows separately that $9^nW(n)S_1(n)$ is an integer (head_integral) and that $9^nW(n)S_2(n)$ is an integer (hmer), and takes $a(n)=a_1(n)-a_2(n)$; the last four lines of the proof check the identity by ring. The factor $(n-2)!$ is carried along as an integer and plays no other part. The proof uses no other node of the graph (the outline lists none), and its comments point to annex a03db62f… on this node for the informal argument.

    Throughout, $H_e=\sum_{k=1}^{n}(2^k)^e/D_k$ for $e \ge 0$ (a sum the proof shows to be an integer).

    Finite sums of integers (hsumZ)

    hsumZ is bookkeeping: if every term $g(i)$, $i\in s$, of a finite sum of reals is (the image of) an integer, so is the sum. It is proved by induction on the finite set $s$, and is used whenever a sum is shown to be an integer term by term.

    Lagrange sums at the nodes $2^k$ (h0 hrec hW hV)

    For a finite set $s$ of naturals and $k\in s$ write $D_s(k)=\prod_{l\in s,\ l\ne k}(1-2^{\,l-k})$; for $s=\{1,\dots,n\}$ this is $D_k$.

    • h0: for nonempty $s$, $\sum_{k\in s}1/D_s(k)=1$. Mathlib's Lagrange basis polynomials for the nodes $2^{-k}$ sum to $1$; evaluating that identity at $0$ gives exactly these terms.
    • hrec: for $a\in s$ and any weight $f$,

    $$\sum_{k\in s}\frac{2^k f(k)}{D_s(k)}=\sum_{k\in s\setminus\{a\}}\frac{2^k f(k)}{D_{s\setminus\{a\}}(k)}+2^a\sum_{k\in s}\frac{f(k)}{D_s(k)},$$ by splitting off the factor $l=a$ from each $D_s(k)$.

    • hW: for every $s$ and every $e\ge0$, $\sum_{k\in s}(2^k)^e/D_s(k)$ is an integer. Induction on $|s|+e$: the empty set gives $0$, $e=0$ gives $1$ by h0, and otherwise hrec with $f(k)=(2^k)^{e-1}$ writes the sum as the sum for $(s\setminus\{a\},e)$ plus $2^a$ times the sum for $(s,e-1)$. In particular every $H_e$ is an integer.
    • hV: for $m+1<|s|$, $\sum_{k\in s}(2^k)^{-(m+1)}/D_s(k)=0$. Induction on $m$, again from hrec, with h0 in the base case.

    Geometric sums, a divisibility, and an integer polynomial (hdvd hgeo hpoly)

    • hgeo: for $m\ge1$ and every $k$, $\sum_{i=1}^{k}2^{-im}=\dfrac{1-2^{-km}}{2^m-1}$, by induction on $k$.
    • hdvd: for $1\le i\le n-1$, the integer $2^i-1$ divides $\prod_{k=\lceil n/2\rceil}^{n}(1-2^k)$. The multiple $k_0=i\lfloor n/i\rfloor$ of $i$ lies in $[\lceil n/2\rceil,n]$, and $2^i-1$ divides $2^{k_0}-1$. This is what the factor $M_n$ in the statement is for.
    • hpoly: for $n\ge1$ there are integers $\alpha_0,\dots,\alpha_{n-1}$ with $\prod_{t=1}^{n-1}(1-2^t y)=\sum_{j<n}\alpha_j y^j$ for every real $y$ (the coefficients of that integer polynomial, of degree less than $n$). Consequently $A_k(x)=-\frac1{D_k}\sum_{j<n}\alpha_j\,(x\,2^k)^j$.

    The residues are integers (residue_integral)

    residue_integral: for $1\le i\le n$, the number $b_i=\sum_{k=i}^{n}A_k(2^{-i})$ is an integer. In fact each term is. Write $k=i+d$ and $Q(m)=\prod_{s=1}^{m}(1-2^s)$, which is never $0$.

    • At $x=2^{-i}$ the numerator of $A_k$ is the integer $\prod_{t=1}^{n-1}(1-2^{\,t+d})$.
    • $D_k$ splits into the factors with $l<k$ and $l>k$; the first part times $\prod_{s=1}^{k-1}(-2^s)$ is $Q(k-1)$, and the second part is $Q(n-k)$.
    • Two identities about $Q$: $Q(a+b)$ is an integer multiple of $Q(a)Q(b)$ (the Gaussian binomial coefficient at $q=2$ is an integer), and $Q(d)\prod_{t=1}^{m}(1-2^{\,t+d})=Q(d+m)$.
    • Together these give numerator $=z_1z_2\,Q(k-1)Q(n-k)$ for integers $z_1,z_2$, so the term $A_k(2^{-i})$ equals the integer $-z_1z_2\prod_{s=1}^{k-1}(-2^s)$.

    The polynomial part (polypart_integral)

    polypart_integral: for $n\ge1$, with $R(n)=\sum_{i=1}^{n}b_i\,h_i$, the number $3^n M_n\bigl(S_1(n)-R(n)\bigr)$ is an integer. So $S_1$ differs from its "residue part" $R$ by something whose denominators are only powers of $3$ and divisors of $M_n$.

    • Exchanging the order of summation, $R=\sum_{k=1}^{n}\sum_{i=1}^{k}A_k(2^{-i})\,h_i$, so $S_1-R=\sum_{k}\sum_{i\le k}\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i$.
    • For each $k$ and $i\ge1$, using hpoly and the factorisation of $y^j-c^j$ with $y=2^{-i}$:

    $$\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i=\frac1{D_k}\sum_{j<n}\sum_{s<j}\alpha_j\,2^{kj}\,c^{s}\,2^{-i(j-s)} .$$

    • Summing over $i=1,\dots,k$ with hgeo turns $2^{kj}\sum_i 2^{-i(j-s)}$ into $\bigl((2^k)^j-(2^k)^s\bigr)/(2^{j-s}-1)$.
    • Summing over $k$ then gives $\sum_{j<n}\sum_{s<j}\alpha_j\,c^s\,(H_j-H_s)/(2^{j-s}-1)$. Here $H_j,H_s$ are integers by hW, $2^{j-s}-1$ divides $M_n$ by hdvd (as $1\le j-s\le n-1$), and $3^n c^s=3^{n-s}8^s$. Each term times $3^nM_n$ is therefore an integer, and so is the sum.

    The first sum $S_1$ (head_integral s12)

    head_integral produces integers $a_1(n)$ with $a_1(n)=9^nW(n)S_1(n)$ for $n\ge1$. Writing $S_1=(S_1-R)+R$: $$9^nW(n)S_1=(n-2)!\Bigl[\bigl(3^nP(n)\bigr)\cdot 3^nM_n(S_1-R)+3^nM_n\cdot\bigl(3^nP(n)R\bigr)\Bigr].$$ Here $3^nP(n)=\prod_{k=1}^n(3-8\cdot2^k)$ is an integer, $3^nM_n(S_1-R)$ is an integer by polypart_integral, and $3^nP(n)R$ is an integer because $3^nP(n)\,h_i=3\prod_{j\ne i}(3-8\cdot2^j)$ and each $b_i$ is an integer by residue_integral. The sequence $a_1$ is then chosen from these integers (with value $0$ at $n=0$); s12 unpacks it.

    The second sum $S_2$ (hmer s14)

    hmer produces integers $a_2(n)$ with $a_2(n)=9^nW(n)S_2(n)$ for $n\ge1$. Its step key shows that for $1\le i\le n-1$ the number $3^{\,n-1-i}B_i$ is an integer: expanding $A_k(c)$ with hpoly, $$B_i=-\sum_{j<n}\alpha_j\sum_{k=1}^{n}\frac{(c\,2^k)^{\,j-i}}{D_k}.$$ For $j<i$ the inner sum is $c^{-(i-j)}$ times a sum that vanishes by hV (since $1\le i-j<n$); for $j\ge i$ it is $c^{\,j-i}H_{j-i}$, and $3^{\,n-1-i}c^{\,j-i}=3^{\,n-1-j}8^{\,j-i}$.

    Then each term of $9^nW(n)S_2(n)$ is an integer: write $9^n=3^{i+1}\cdot3^{\,n-1-i}\cdot3^n$, use $3^nP(n)=\prod_k(3-8\cdot 2^k)$, and use hdvd to write $M_n=(2^i-1)q$, which cancels the denominator $2^i-1$. The term becomes $3^{i+1}(n-2)!\prod_k(3-8\cdot2^k)\,q$ times the integer from key. (Inside hmer the proof restates hdvd and hsumZ as local copies.) s14 unpacks $a_2$, and the proof ends with $a=a_1-a_2$.

  2. 2026-10-06 · written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent · not signed · current · explainer/dec3b03a5a2b….md · diff to its predecessor

    Read this version

    What is proved, and the plan

    Fix $c = 8/3$. For $n \ge 1$ and $1 \le k \le n$ write $$D_k=\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr),\qquad A_k(x)=-\frac{\prod_{t=1}^{n-1}\bigl(1-x\,2^{\,t+k}\bigr)}{D_k},\qquad h_i=\bigl(1-c\,2^{i}\bigr)^{-1},$$ $$P(n)=\prod_{k=1}^{n}\bigl(1-c\,2^k\bigr),\qquad M_n=\prod_{k=\lceil n/2\rceil}^{n}\bigl(1-2^k\bigr),\qquad W(n)=(n-2)!\,P(n)\,M_n .$$ The statement asks for integers $a(n)$ with $a(n)=9^nW(n)\bigl(S_1(n)-S_2(n)\bigr)$ for $n\ge1$, where $S_1=\sum_{k=1}^n A_k(c)\sum_{i=1}^k h_i$ and $S_2=\sum_{i=1}^{n-1} B_i/(2^i-1)$ with $B_i=\sum_{k=1}^n A_k(c)\,(c\,2^k)^{-i}$.

    The proof shows separately that $9^nW(n)S_1(n)$ is an integer (head_integral) and that $9^nW(n)S_2(n)$ is an integer (hmer), and takes $a(n)=a_1(n)-a_2(n)$; the last four lines of the proof check the identity by ring. The factor $(n-2)!$ is carried along as an integer and plays no other part. The proof uses no other node of the graph (the outline lists none), and its comments point to annex a03db62f… on this node for the informal argument.

    Throughout, $H_e=\sum_{k=1}^{n}(2^k)^e/D_k$ for $e \ge 0$ (a sum the proof shows to be an integer).

    Finite sums of integers (hsumZ)

    hsumZ is bookkeeping: if every term $g(i)$, $i\in s$, of a finite sum of reals is (the image of) an integer, so is the sum. It is proved by induction on the finite set $s$, and is used whenever a sum is shown to be an integer term by term.

    Lagrange sums at the nodes $2^k$ (h0 hrec hW hV)

    For a finite set $s$ of naturals and $k\in s$ write $D_s(k)=\prod_{l\in s,\ l\ne k}(1-2^{\,l-k})$; for $s=\{1,\dots,n\}$ this is $D_k$.

    h0: for nonempty $s$, $\sum_{k\in s}1/D_s(k)=1$. Mathlib's Lagrange basis polynomials for the nodes $2^{-k}$ sum to $1$; evaluating that identity at $0$ gives exactly these terms.

    hrec: for $a\in s$ and any weight $f$,

    $$\sum_{k\in s}\frac{2^k f(k)}{D_s(k)}=\sum_{k\in s\setminus\{a\}}\frac{2^k f(k)}{D_{s\setminus\{a\}}(k)}+2^a\sum_{k\in s}\frac{f(k)}{D_s(k)},$$ by splitting off the factor $l=a$ from each $D_s(k)$.

    hW: for every $s$ and every $e\ge0$, $\sum_{k\in s}(2^k)^e/D_s(k)$ is an integer. Induction on $|s|+e$: the empty set gives $0$, $e=0$ gives $1$ by h0, and otherwise hrec with $f(k)=(2^k)^{e-1}$ writes the sum as the sum for $(s\setminus\{a\},e)$ plus $2^a$ times the sum for $(s,e-1)$. In particular every $H_e$ is an integer.

    hV: for $m+1<|s|$, $\sum_{k\in s}(2^k)^{-(m+1)}/D_s(k)=0$. Induction on $m$, again from hrec, with h0 in the base case.

    Geometric sums, a divisibility, and an integer polynomial (hdvd hgeo hpoly)

    hgeo: for $m\ge1$ and every $k$, $\sum_{i=1}^{k}2^{-im}=\dfrac{1-2^{-km}}{2^m-1}$, by induction on $k$.

    hdvd: for $1\le i\le n-1$, the integer $2^i-1$ divides $\prod_{k=\lceil n/2\rceil}^{n}(1-2^k)$. The multiple $k_0=i\lfloor n/i\rfloor$ of $i$ lies in $[\lceil n/2\rceil,n]$, and $2^i-1$ divides $2^{k_0}-1$. This is what the factor $M_n$ in the statement is for.

    hpoly: for $n\ge1$ there are integers $\alpha_0,\dots,\alpha_{n-1}$ with $\prod_{t=1}^{n-1}(1-2^t y)=\sum_{j<n}\alpha_j y^j$ for every real $y$ (the coefficients of that integer polynomial, of degree less than $n$). Consequently $A_k(x)=-\frac1{D_k}\sum_{j<n}\alpha_j\,(x\,2^k)^j$.

    The residues are integers (residue_integral)

    residue_integral: for $1\le i\le n$, the number $b_i=\sum_{k=i}^{n}A_k(2^{-i})$ is an integer. In fact each term is. Write $k=i+d$ and $Q(m)=\prod_{s=1}^{m}(1-2^s)$, which is never $0$.

    At $x=2^{-i}$ the numerator of $A_k$ is the integer $\prod_{t=1}^{n-1}(1-2^{\,t+d})$.

    $D_k$ splits into the factors with $l<k$ and $l>k$; the first part times $\prod_{s=1}^{k-1}(-2^s)$ is $Q(k-1)$, and the second part is $Q(n-k)$.

    Two identities about $Q$: $Q(a+b)$ is an integer multiple of $Q(a)Q(b)$ (the Gaussian binomial coefficient at $q=2$ is an integer), and $Q(d)\prod_{t=1}^{m}(1-2^{\,t+d})=Q(d+m)$.

    Together these give numerator $=z_1z_2\,Q(k-1)Q(n-k)$ for integers $z_1,z_2$, so the term $A_k(2^{-i})$ equals the integer $-z_1z_2\prod_{s=1}^{k-1}(-2^s)$.

    The polynomial part (polypart_integral)

    polypart_integral: for $n\ge1$, with $R(n)=\sum_{i=1}^{n}b_i\,h_i$, the number $3^n M_n\bigl(S_1(n)-R(n)\bigr)$ is an integer. So $S_1$ differs from its "residue part" $R$ by something whose denominators are only powers of $3$ and divisors of $M_n$.

    Exchanging the order of summation, $R=\sum_{k=1}^{n}\sum_{i=1}^{k}A_k(2^{-i})\,h_i$, so $S_1-R=\sum_{k}\sum_{i\le k}\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i$.

    For each $k$ and $i\ge1$, using hpoly and the factorisation of $y^j-c^j$ with $y=2^{-i}$:

    $$\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i=\frac1{D_k}\sum_{j<n}\sum_{s<j}\alpha_j\,2^{kj}\,c^{s}\,2^{-i(j-s)} .$$

    Summing over $i=1,\dots,k$ with hgeo turns $2^{kj}\sum_i 2^{-i(j-s)}$ into $\bigl((2^k)^j-(2^k)^s\bigr)/(2^{j-s}-1)$.

    Summing over $k$ then gives $\sum_{j<n}\sum_{s<j}\alpha_j\,c^s\,(H_j-H_s)/(2^{j-s}-1)$. Here $H_j,H_s$ are integers by hW, $2^{j-s}-1$ divides $M_n$ by hdvd (as $1\le j-s\le n-1$), and $3^n c^s=3^{n-s}8^s$. Each term times $3^nM_n$ is therefore an integer, and so is the sum.

    The first sum $S_1$ (head_integral s12)

    head_integral produces integers $a_1(n)$ with $a_1(n)=9^nW(n)S_1(n)$ for $n\ge1$. Writing $S_1=(S_1-R)+R$: $$9^nW(n)S_1=(n-2)!\Bigl[\bigl(3^nP(n)\bigr)\cdot 3^nM_n(S_1-R)+3^nM_n\cdot\bigl(3^nP(n)R\bigr)\Bigr].$$ Here $3^nP(n)=\prod_{k=1}^n(3-8\cdot2^k)$ is an integer, $3^nM_n(S_1-R)$ is an integer by polypart_integral, and $3^nP(n)R$ is an integer because $3^nP(n)\,h_i=3\prod_{j\ne i}(3-8\cdot2^j)$ and each $b_i$ is an integer by residue_integral. The sequence $a_1$ is then chosen from these integers (with value $0$ at $n=0$); s12 unpacks it.

    The second sum $S_2$ (hmer s14)

    hmer produces integers $a_2(n)$ with $a_2(n)=9^nW(n)S_2(n)$ for $n\ge1$. Its step key shows that for $1\le i\le n-1$ the number $3^{\,n-1-i}B_i$ is an integer: expanding $A_k(c)$ with hpoly, $$B_i=-\sum_{j<n}\alpha_j\sum_{k=1}^{n}\frac{(c\,2^k)^{\,j-i}}{D_k}.$$ For $j<i$ the inner sum is $c^{-(i-j)}$ times a sum that vanishes by hV (since $1\le i-j<n$); for $j\ge i$ it is $c^{\,j-i}H_{j-i}$, and $3^{\,n-1-i}c^{\,j-i}=3^{\,n-1-j}8^{\,j-i}$.

    Then each term of $9^nW(n)S_2(n)$ is an integer: write $9^n=3^{i+1}\cdot3^{\,n-1-i}\cdot3^n$, use $3^nP(n)=\prod_k(3-8\cdot 2^k)$, and use hdvd to write $M_n=(2^i-1)q$, which cancels the denominator $2^i-1$. The term becomes $3^{i+1}(n-2)!\prod_k(3-8\cdot2^k)\,q$ times the integer from key. (Inside hmer the proof restates hdvd and hsumZ as local copies.) s14 unpacks $a_2$, and the proof ends with $a=a_1-a_2$.

Diff of dec3b03a5a2b against dbda1b664f81
@@ -19,16 +19,22 @@
 For a finite set $s$ of naturals and $k\in s$ write $D_s(k)=\prod_{l\in s,\ l\ne k}(1-2^{\,l-k})$; for $s=\{1,\dots,n\}$ this is $D_k$.
 
-- `h0`: for nonempty $s$, $\sum_{k\in s}1/D_s(k)=1$. Mathlib's Lagrange basis polynomials for the nodes $2^{-k}$ sum to $1$; evaluating that identity at $0$ gives exactly these terms.
-- `hrec`: for $a\in s$ and any weight $f$,
+`h0`: for nonempty $s$, $\sum_{k\in s}1/D_s(k)=1$. Mathlib's Lagrange basis polynomials for the nodes $2^{-k}$ sum to $1$; evaluating that identity at $0$ gives exactly these terms.
+
+`hrec`: for $a\in s$ and any weight $f$,
+
 $$\sum_{k\in s}\frac{2^k f(k)}{D_s(k)}=\sum_{k\in s\setminus\{a\}}\frac{2^k f(k)}{D_{s\setminus\{a\}}(k)}+2^a\sum_{k\in s}\frac{f(k)}{D_s(k)},$$
 by splitting off the factor $l=a$ from each $D_s(k)$.
-- `hW`: for every $s$ and every $e\ge0$, $\sum_{k\in s}(2^k)^e/D_s(k)$ is an integer. Induction on $|s|+e$: the empty set gives $0$, $e=0$ gives $1$ by `h0`, and otherwise `hrec` with $f(k)=(2^k)^{e-1}$ writes the sum as the sum for $(s\setminus\{a\},e)$ plus $2^a$ times the sum for $(s,e-1)$. In particular every $H_e$ is an integer.
-- `hV`: for $m+1<|s|$, $\sum_{k\in s}(2^k)^{-(m+1)}/D_s(k)=0$. Induction on $m$, again from `hrec`, with `h0` in the base case.
+
+`hW`: for every $s$ and every $e\ge0$, $\sum_{k\in s}(2^k)^e/D_s(k)$ is an integer. Induction on $|s|+e$: the empty set gives $0$, $e=0$ gives $1$ by `h0`, and otherwise `hrec` with $f(k)=(2^k)^{e-1}$ writes the sum as the sum for $(s\setminus\{a\},e)$ plus $2^a$ times the sum for $(s,e-1)$. In particular every $H_e$ is an integer.
+
+`hV`: for $m+1<|s|$, $\sum_{k\in s}(2^k)^{-(m+1)}/D_s(k)=0$. Induction on $m$, again from `hrec`, with `h0` in the base case.
 
 ## Geometric sums, a divisibility, and an integer polynomial {steps: hdvd hgeo hpoly}
 
-- `hgeo`: for $m\ge1$ and every $k$, $\sum_{i=1}^{k}2^{-im}=\dfrac{1-2^{-km}}{2^m-1}$, by induction on $k$.
-- `hdvd`: for $1\le i\le n-1$, the integer $2^i-1$ divides $\prod_{k=\lceil n/2\rceil}^{n}(1-2^k)$. The multiple $k_0=i\lfloor n/i\rfloor$ of $i$ lies in $[\lceil n/2\rceil,n]$, and $2^i-1$ divides $2^{k_0}-1$. This is what the factor $M_n$ in the statement is for.
-- `hpoly`: for $n\ge1$ there are integers $\alpha_0,\dots,\alpha_{n-1}$ with $\prod_{t=1}^{n-1}(1-2^t y)=\sum_{j<n}\alpha_j y^j$ for every real $y$ (the coefficients of that integer polynomial, of degree less than $n$). Consequently $A_k(x)=-\frac1{D_k}\sum_{j<n}\alpha_j\,(x\,2^k)^j$.
+`hgeo`: for $m\ge1$ and every $k$, $\sum_{i=1}^{k}2^{-im}=\dfrac{1-2^{-km}}{2^m-1}$, by induction on $k$.
+
+`hdvd`: for $1\le i\le n-1$, the integer $2^i-1$ divides $\prod_{k=\lceil n/2\rceil}^{n}(1-2^k)$. The multiple $k_0=i\lfloor n/i\rfloor$ of $i$ lies in $[\lceil n/2\rceil,n]$, and $2^i-1$ divides $2^{k_0}-1$. This is what the factor $M_n$ in the statement is for.
+
+`hpoly`: for $n\ge1$ there are integers $\alpha_0,\dots,\alpha_{n-1}$ with $\prod_{t=1}^{n-1}(1-2^t y)=\sum_{j<n}\alpha_j y^j$ for every real $y$ (the coefficients of that integer polynomial, of degree less than $n$). Consequently $A_k(x)=-\frac1{D_k}\sum_{j<n}\alpha_j\,(x\,2^k)^j$.
 
 ## The residues are integers {steps: residue_integral}
@@ -36,8 +42,11 @@
 `residue_integral`: for $1\le i\le n$, the number $b_i=\sum_{k=i}^{n}A_k(2^{-i})$ is an integer. In fact each term is. Write $k=i+d$ and $Q(m)=\prod_{s=1}^{m}(1-2^s)$, which is never $0$.
 
-- At $x=2^{-i}$ the numerator of $A_k$ is the integer $\prod_{t=1}^{n-1}(1-2^{\,t+d})$.
-- $D_k$ splits into the factors with $l<k$ and $l>k$; the first part times $\prod_{s=1}^{k-1}(-2^s)$ is $Q(k-1)$, and the second part is $Q(n-k)$.
-- Two identities about $Q$: $Q(a+b)$ is an integer multiple of $Q(a)Q(b)$ (the Gaussian binomial coefficient at $q=2$ is an integer), and $Q(d)\prod_{t=1}^{m}(1-2^{\,t+d})=Q(d+m)$.
-- Together these give numerator $=z_1z_2\,Q(k-1)Q(n-k)$ for integers $z_1,z_2$, so the term $A_k(2^{-i})$ equals the integer $-z_1z_2\prod_{s=1}^{k-1}(-2^s)$.
+At $x=2^{-i}$ the numerator of $A_k$ is the integer $\prod_{t=1}^{n-1}(1-2^{\,t+d})$.
+
+$D_k$ splits into the factors with $l<k$ and $l>k$; the first part times $\prod_{s=1}^{k-1}(-2^s)$ is $Q(k-1)$, and the second part is $Q(n-k)$.
+
+Two identities about $Q$: $Q(a+b)$ is an integer multiple of $Q(a)Q(b)$ (the Gaussian binomial coefficient at $q=2$ is an integer), and $Q(d)\prod_{t=1}^{m}(1-2^{\,t+d})=Q(d+m)$.
+
+Together these give numerator $=z_1z_2\,Q(k-1)Q(n-k)$ for integers $z_1,z_2$, so the term $A_k(2^{-i})$ equals the integer $-z_1z_2\prod_{s=1}^{k-1}(-2^s)$.
 
 ## The polynomial part {steps: polypart_integral}
@@ -45,9 +54,13 @@
 `polypart_integral`: for $n\ge1$, with $R(n)=\sum_{i=1}^{n}b_i\,h_i$, the number $3^n M_n\bigl(S_1(n)-R(n)\bigr)$ is an integer. So $S_1$ differs from its "residue part" $R$ by something whose denominators are only powers of $3$ and divisors of $M_n$.
 
-- Exchanging the order of summation, $R=\sum_{k=1}^{n}\sum_{i=1}^{k}A_k(2^{-i})\,h_i$, so $S_1-R=\sum_{k}\sum_{i\le k}\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i$.
-- For each $k$ and $i\ge1$, using `hpoly` and the factorisation of $y^j-c^j$ with $y=2^{-i}$:
+Exchanging the order of summation, $R=\sum_{k=1}^{n}\sum_{i=1}^{k}A_k(2^{-i})\,h_i$, so $S_1-R=\sum_{k}\sum_{i\le k}\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i$.
+
+For each $k$ and $i\ge1$, using `hpoly` and the factorisation of $y^j-c^j$ with $y=2^{-i}$:
+
 $$\bigl(A_k(c)-A_k(2^{-i})\bigr)h_i=\frac1{D_k}\sum_{j<n}\sum_{s<j}\alpha_j\,2^{kj}\,c^{s}\,2^{-i(j-s)} .$$
-- Summing over $i=1,\dots,k$ with `hgeo` turns $2^{kj}\sum_i 2^{-i(j-s)}$ into $\bigl((2^k)^j-(2^k)^s\bigr)/(2^{j-s}-1)$.
-- Summing over $k$ then gives $\sum_{j<n}\sum_{s<j}\alpha_j\,c^s\,(H_j-H_s)/(2^{j-s}-1)$. Here $H_j,H_s$ are integers by `hW`, $2^{j-s}-1$ divides $M_n$ by `hdvd` (as $1\le j-s\le n-1$), and $3^n c^s=3^{n-s}8^s$. Each term times $3^nM_n$ is therefore an integer, and so is the sum.
+
+Summing over $i=1,\dots,k$ with `hgeo` turns $2^{kj}\sum_i 2^{-i(j-s)}$ into $\bigl((2^k)^j-(2^k)^s\bigr)/(2^{j-s}-1)$.
+
+Summing over $k$ then gives $\sum_{j<n}\sum_{s<j}\alpha_j\,c^s\,(H_j-H_s)/(2^{j-s}-1)$. Here $H_j,H_s$ are integers by `hW`, $2^{j-s}-1$ divides $M_n$ by `hdvd` (as $1\le j-s\le n-1$), and $3^n c^s=3^{n-s}8^s$. Each term times $3^nM_n$ is therefore an integer, and so is the sum.
 
 ## The first sum $S_1$ {steps: head_integral s12}

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

How it was proved

Proved by Proof.lean, checked by the kernel. Its attestation, 000332, records the gate’s run.

The proof step by step (outline)

Checked by the kernel — an outline of the attested proof below: attestations/000332.json, merge commit b88a90ea8e90.

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. hsumZ have ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g 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 28–36
      have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
        intro s g
        induction s using Finset.induction_on with
        | empty => intro _; exact ⟨0, by simp⟩
        | insert a s ha ih =>
          intro h
          obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
          obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
          exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 28–36 at b88a90ea8e90 ↗

    1. hsumZ.s1 case printed form did not read back: shown as its Lean lines only
    2. hsumZ.s2 case

      Leaves (∀ i ∈ insert a s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with a : ℕ, s : Finset ℕ, ha : a ∉ s, ih : (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i.

      Uses library Exists.intro Existential introduction. , Finset.sum_insert.

      Lean, lines 32–36
          | insert a s ha ih =>
            intro h
            obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
            obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
            exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 32–36 at b88a90ea8e90 ↗

      1. hsumZ.s2.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = g a

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with za : ℤ, hza : (↑za : ℝ) = g a.

        Uses library Finset.mem_insert_self.

        Lean, line 34
              obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 34 at b88a90ea8e90 ↗

      2. hsumZ.s2.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with zs : ℤ, hzs : (↑zs : ℝ) = ∑ i ∈ s, g i.

        Uses library Finset.mem_insert_of_mem.

        Lean, line 35
              obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 35 at b88a90ea8e90 ↗

  2. h0 have ∀ (s : Finset ℕ), s.Nonempty → ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (1 : ℝ)

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with h0 : ∀ (s : Finset ℕ), s.Nonempty → ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (1 : ℝ).

    Uses library Finset Finset α is the type of finite sets of elements of α. , Polynomial.eval_finset_sum Alias of Polynomial.eval_finsetSum. , Polynomial.eval_one, Eq.trans Equality is transitive: if a = b and b = c then a = c. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Lagrange.basis Lagrange basis polynomials indexed by s : Finset ι, defined at nodes v i for a map v : ι → F. , Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , one_div, Finset.prod_inv_distrib, Finset.prod_congr, Lagrange.basisDivisor basisDivisor x y is the unique linear or constant polynomial such that when evaluated at x it gives 1 and y it gives 0 (where when x = y it is identically 0). , Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_sub, Polynomial.eval_X, zpow_sub₀, two_ne_zero, zpow_natCast, mul_inv, zero_sub, mul_assoc, inv_mul_cancel₀, neg_ne_zero, inv_ne_zero, mul_one.

    Lean, lines 38–54
      have h0 : ∀ s : Finset ℕ, s.Nonempty → ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = 1 := by
        intro s hs
        have hv : Set.InjOn (fun k : ℕ => ((2 : ℝ) ^ k)⁻¹) (s : Set ℕ) := by
          intro a _ b _ hab
          exact pow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) (inv_injective hab)
        have hsum := congrArg (Polynomial.eval (0 : ℝ)) (Lagrange.sum_basis hv hs)
        rw [Polynomial.eval_finset_sum, Polynomial.eval_one] at hsum
        refine Eq.trans (Finset.sum_congr rfl (fun k hk => ?_)) hsum
        unfold Lagrange.basis
        rw [Polynomial.eval_prod, one_div, ← Finset.prod_inv_distrib]
        refine Finset.prod_congr rfl (fun l hl => ?_)
        have ha : (2 : ℝ) ^ k ≠ 0 := by positivity
        have hb : (2 : ℝ) ^ l ≠ 0 := by positivity
        simp only [Lagrange.basisDivisor, Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_sub, Polynomial.eval_X]
        rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast,
          show ((2 : ℝ) ^ k)⁻¹ - ((2 : ℝ) ^ l)⁻¹ = (1 - (2 : ℝ) ^ l / (2 : ℝ) ^ k) * (-((2 : ℝ) ^ l)⁻¹) by field_simp; ring,
          mul_inv, zero_sub, mul_assoc, inv_mul_cancel₀ (neg_ne_zero.mpr (inv_ne_zero hb)), mul_one]

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 38–54 at b88a90ea8e90 ↗

    1. h0.hv have Set.InjOn (fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) (↑s : Set ℕ)

      Leaves ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (1 : ℝ), with hv : Set.InjOn (fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) (↑s : Set ℕ).

      Uses library Set.InjOn f is injective on s if the restriction of f to s is injective. , Set A set is a collection of elements of some type α. , pow_right_injective₀, inv_injective.

      Lean, lines 40–42
          have hv : Set.InjOn (fun k : ℕ => ((2 : ℝ) ^ k)⁻¹) (s : Set ℕ) := by
            intro a _ b _ hab
            exact pow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) (inv_injective hab)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 40–42 at b88a90ea8e90 ↗

    2. h0.hsum have Polynomial.eval (0 : ℝ) (∑ j ∈ s, Lagrange.basis s (fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) j) = Polynomial.eval (0 : ℝ) (1 : Polynomial ℝ)

      Leaves ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (1 : ℝ), with hsum : Polynomial.eval (0 : ℝ) (∑ j ∈ s, Lagrange.basis s (fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) j) = Polynomial.eval (0 : ℝ) (1 : Polynomial ℝ).

      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 , Lagrange.sum_basis.

      Lean, line 43
          have hsum := congrArg (Polynomial.eval (0 : ℝ)) (Lagrange.sum_basis hv hs)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 43 at b88a90ea8e90 ↗

    3. h0.ha have (2 : ℝ) ^ k ≠ (0 : ℝ) routine: positivity

      Leaves ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))⁻¹ = Polynomial.eval (0 : ℝ) (Lagrange.basisDivisor ((fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) k) ((fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) l)), with ha : (2 : ℝ) ^ k ≠ (0 : ℝ).

      Lean, line 49
          have ha : (2 : ℝ) ^ k ≠ 0 := by positivity

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 49 at b88a90ea8e90 ↗

    4. h0.hb have (2 : ℝ) ^ l ≠ (0 : ℝ) routine: positivity

      Leaves ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))⁻¹ = Polynomial.eval (0 : ℝ) (Lagrange.basisDivisor ((fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) k) ((fun (k : ℕ) => ((2 : ℝ) ^ k)⁻¹) l)), with hb : (2 : ℝ) ^ l ≠ (0 : ℝ).

      Lean, line 50
          have hb : (2 : ℝ) ^ l ≠ 0 := by positivity

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 50 at b88a90ea8e90 ↗

  3. hrec have ∀ (s : Finset ℕ) (a : ℕ) (f : ℕ → ℝ), a ∈ s → ∑ k ∈ s, (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hrec : ∀ (s : Finset ℕ) (a : ℕ) (f : ℕ → ℝ), a ∈ s → ∑ k ∈ s, (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

    Uses library Finset Finset α is the type of finite sets of elements of α. , 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. , mul_add Alias of left_distrib. , Finset.mul_sum, add_left_comm, Finset.sum_add_distrib.

    Lean, lines 56–78
      have hrec : ∀ (s : Finset ℕ) (a : ℕ) (f : ℕ → ℝ), a ∈ s → ∑ k ∈ s, (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
        intro s a f ha
        rw [← Finset.add_sum_erase s (fun k => f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) ha, ← Finset.add_sum_erase s (fun k => (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) ha, mul_add, Finset.mul_sum, add_left_comm, ← Finset.sum_add_distrib]
        congr 1
        · ring
        · refine Finset.sum_congr rfl (fun k hk => ?_)
          have hka : k ≠ a := Finset.ne_of_mem_erase hk
          have hmem : a ∈ s.erase k := Finset.mem_erase.mpr ⟨Ne.symm hka, ha⟩
          have hsplit := Finset.mul_prod_erase (s.erase k) (fun l => (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) hmem
          rw [Finset.erase_right_comm] at hsplit
          rw [← hsplit]
          have hρ : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) ≠ 0 := by
            intro h1
            have h2 : (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) = 2 ^ (0 : ℤ) := by rw [zpow_zero]; linarith
            have h3 := zpow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) h2
            omega
          have hq : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) * (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)))⁻¹ = 1 := mul_inv_cancel₀ hρ
          have hak : (2 : ℝ) ^ a = (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) * 2 ^ k := by
            rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast]
            field_simp
          simp only [div_eq_mul_inv, mul_inv]
          rw [hak]
          linear_combination ((2 : ℝ) ^ k * f k * (∏ l ∈ (s.erase a).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))))⁻¹) * hq

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 56–78 at b88a90ea8e90 ↗

    1. hrec.s1 case routine: ring

      Leaves (2 : ℝ) ^ a * f a / ∏ l ∈ s.erase a, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑a : ℤ))) = (2 : ℝ) ^ a * (f a / ∏ l ∈ s.erase a, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑a : ℤ)))).

      Lean, line 60
          · ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 60 at b88a90ea8e90 ↗

    2. hrec.s2 case

      Leaves ∑ x ∈ s.erase a, (2 : ℝ) ^ x * f x / ∏ l ∈ s.erase x, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑x : ℤ))) = ∑ x ∈ s.erase a, ((2 : ℝ) ^ x * f x / ∏ l ∈ (s.erase a).erase x, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑x : ℤ))) + (2 : ℝ) ^ a * (f x / ∏ l ∈ s.erase x, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑x : ℤ))))).

      Uses library Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.erase_right_comm, div_eq_mul_inv Dividing by an element is the same as multiplying by its inverse. , mul_inv.

      Lean, lines 61–78
          · refine Finset.sum_congr rfl (fun k hk => ?_)
            have hka : k ≠ a := Finset.ne_of_mem_erase hk
            have hmem : a ∈ s.erase k := Finset.mem_erase.mpr ⟨Ne.symm hka, ha⟩
            have hsplit := Finset.mul_prod_erase (s.erase k) (fun l => (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) hmem
            rw [Finset.erase_right_comm] at hsplit
            rw [← hsplit]
            have hρ : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) ≠ 0 := by
              intro h1
              have h2 : (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) = 2 ^ (0 : ℤ) := by rw [zpow_zero]; linarith
              have h3 := zpow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) h2
              omega
            have hq : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) * (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)))⁻¹ = 1 := mul_inv_cancel₀ hρ
            have hak : (2 : ℝ) ^ a = (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) * 2 ^ k := by
              rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast]
              field_simp
            simp only [div_eq_mul_inv, mul_inv]
            rw [hak]
            linear_combination ((2 : ℝ) ^ k * f k * (∏ l ∈ (s.erase a).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))))⁻¹) * hq

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 61–78 at b88a90ea8e90 ↗

      1. hrec.s2.hka have k ≠ a

        Leaves (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hka : k ≠ a.

        Uses library Finset.ne_of_mem_erase.

        Lean, line 62
              have hka : k ≠ a := Finset.ne_of_mem_erase hk

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 62 at b88a90ea8e90 ↗

      2. hrec.s2.hmem have a ∈ s.erase k

        Leaves (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hmem : a ∈ s.erase k.

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

        Lean, line 63
              have hmem : a ∈ s.erase k := Finset.mem_erase.mpr ⟨Ne.symm hka, ha⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 63 at b88a90ea8e90 ↗

      3. hrec.s2.hsplit have ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase k).erase a, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))) = ∏ x ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ)))

        Leaves (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hsplit : ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase k).erase a, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))) = ∏ x ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))).

        Uses library 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, line 64
              have hsplit := Finset.mul_prod_erase (s.erase k) (fun l => (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) hmem

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 64 at b88a90ea8e90 ↗

      4. hrec.s2.h_x3c1 (hρ) have (1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) ≠ (0 : ℝ)

        Leaves (2 : ℝ) ^ k * f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ)))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))))), with hρ : (1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) ≠ (0 : ℝ).

        Lean, lines 67–71
              have hρ : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) ≠ 0 := by
                intro h1
                have h2 : (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) = 2 ^ (0 : ℤ) := by rw [zpow_zero]; linarith
                have h3 := zpow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) h2
                omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 67–71 at b88a90ea8e90 ↗

        1. hrec.s2.h_x3c1.h2 have (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) = (2 : ℝ) ^ (0 : ℤ)

          Leaves False, with h2 : (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) = (2 : ℝ) ^ (0 : ℤ).

          Uses library zpow_zero.

          Lean, line 69
                  have h2 : (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) = 2 ^ (0 : ℤ) := by rw [zpow_zero]; linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 69 at b88a90ea8e90 ↗

        2. hrec.s2.h_x3c1.h3 have (↑a : ℤ) - (↑k : ℤ) = (0 : ℤ)

          Leaves False, with h3 : (↑a : ℤ) - (↑k : ℤ) = (0 : ℤ).

          Uses library zpow_right_injective₀.

          Lean, line 70
                  have h3 := zpow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) h2

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 70 at b88a90ea8e90 ↗

      5. hrec.s2.hq have ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)))⁻¹ = (1 : ℝ)

        Leaves (2 : ℝ) ^ k * f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ)))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))))), with hq : ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)))⁻¹ = (1 : ℝ).

        Uses library mul_inv_cancel₀.

        Lean, line 72
              have hq : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) * (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)))⁻¹ = 1 := mul_inv_cancel₀ hρ

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 72 at b88a90ea8e90 ↗

      6. hrec.s2.hak have (2 : ℝ) ^ a = (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) * (2 : ℝ) ^ k

        Leaves (2 : ℝ) ^ k * f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ)))) = (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * (f k / (((1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ))) * ∏ x ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑x : ℤ) - (↑k : ℤ))))), with hak : (2 : ℝ) ^ a = (2 : ℝ) ^ ((↑a : ℤ) - (↑k : ℤ)) * (2 : ℝ) ^ k.

        Uses library zpow_sub₀, two_ne_zero, zpow_natCast.

        Lean, lines 73–75
              have hak : (2 : ℝ) ^ a = (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) * 2 ^ k := by
                rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast]
                field_simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 73–75 at b88a90ea8e90 ↗

  4. hW have ∀ (N : ℕ) (s : Finset ℕ) (e : ℕ), s.card + e = N → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hW : ∀ (N : ℕ) (s : Finset ℕ) (e : ℕ), s.card + e = N → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

    Uses library Finset Finset α is the type of finite sets of elements of α. .

    Lean, lines 80–103
      have hW : ∀ N : ℕ, ∀ (s : Finset ℕ) (e : ℕ), s.card + e = N → ∃ z : ℤ, (z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
        intro N
        induction N with
        | zero =>
          intro s e h
          have hs : s = ∅ := Finset.card_eq_zero.mp (by omega)
          subst hs
          exact ⟨0, by simp⟩
        | succ N ih =>
          intro s e h
          rcases s.eq_empty_or_nonempty with rfl | hs
          · exact ⟨0, by simp⟩
          rcases Nat.eq_zero_or_pos e with rfl | he
          · exact ⟨1, by rw [Int.cast_one]; exact (h0 s hs).symm.trans (Finset.sum_congr rfl (fun k _ => by rw [pow_zero]))⟩
          obtain ⟨e', rfl⟩ : ∃ e', e = e' + 1 := ⟨e - 1, by omega⟩
          obtain ⟨a, ha⟩ := hs
          obtain ⟨z1, hz1⟩ := ih (s.erase a) (e' + 1) (by rw [Finset.card_erase_of_mem ha]; have := Finset.card_pos.mpr ⟨a, ha⟩; omega)
          obtain ⟨z2, hz2⟩ := ih s e' (by omega)
          refine ⟨z1 + 2 ^ a * z2, ?_⟩
          have hr := hrec s a (fun k => ((2 : ℝ) ^ k) ^ e') ha
          simp only [← pow_succ'] at hr
          push_cast
          rw [hz1, hz2]
          exact hr.symm

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 80–103 at b88a90ea8e90 ↗

    1. hW.s1 case

      Leaves ∀ (s : Finset ℕ) (e : ℕ), s.card + e = (0 : ℕ) → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

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

      Lean, lines 83–87
          | zero =>
            intro s e h
            have hs : s = ∅ := Finset.card_eq_zero.mp (by omega)
            subst hs
            exact ⟨0, by simp⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 83–87 at b88a90ea8e90 ↗

      1. hW.s1.hs have s = ∅

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hs : s = ∅.

        Uses library Finset.card_eq_zero.

        Lean, line 85
              have hs : s = ∅ := Finset.card_eq_zero.mp (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 85 at b88a90ea8e90 ↗

    2. hW.s2 case

      Leaves ∀ (s : Finset ℕ) (e : ℕ), s.card + e = N + (1 : ℕ) → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with N : ℕ, ih : ∀ (s : Finset ℕ) (e : ℕ), s.card + e = N → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

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

      Lean, lines 88–103
          | succ N ih =>
            intro s e h
            rcases s.eq_empty_or_nonempty with rfl | hs
            · exact ⟨0, by simp⟩
            rcases Nat.eq_zero_or_pos e with rfl | he
            · exact ⟨1, by rw [Int.cast_one]; exact (h0 s hs).symm.trans (Finset.sum_congr rfl (fun k _ => by rw [pow_zero]))⟩
            obtain ⟨e', rfl⟩ : ∃ e', e = e' + 1 := ⟨e - 1, by omega⟩
            obtain ⟨a, ha⟩ := hs
            obtain ⟨z1, hz1⟩ := ih (s.erase a) (e' + 1) (by rw [Finset.card_erase_of_mem ha]; have := Finset.card_pos.mpr ⟨a, ha⟩; omega)
            obtain ⟨z2, hz2⟩ := ih s e' (by omega)
            refine ⟨z1 + 2 ^ a * z2, ?_⟩
            have hr := hrec s a (fun k => ((2 : ℝ) ^ k) ^ e') ha
            simp only [← pow_succ'] at hr
            push_cast
            rw [hz1, hz2]
            exact hr.symm

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 88–103 at b88a90ea8e90 ↗

      1. hW.s2.s1 case

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ ∅, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ ∅.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Uses library Exists.intro Existential introduction. .

        Lean, line 91
              · exact ⟨0, by simp⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 91 at b88a90ea8e90 ↗

      2. hW.s2.s2 case

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (0 : ℕ) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Uses library Exists.intro Existential introduction. , Int.cast_one, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , pow_zero.

        Lean, line 93
              · exact ⟨1, by rw [Int.cast_one]; exact (h0 s hs).symm.trans (Finset.sum_congr rfl (fun k _ => by rw [pow_zero]))⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 93 at b88a90ea8e90 ↗

      3. hW.s2.s3 obtain ∃ (e' : ℕ), e = e' + (1 : ℕ)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with e' : ℕ, h : s.card + (e' + (1 : ℕ)) = N + (1 : ℕ), he : e' + (1 : ℕ) > (0 : ℕ).

        Uses library Exists.intro Existential introduction. .

        Lean, line 94
              obtain ⟨e', rfl⟩ : ∃ e', e = e' + 1 := ⟨e - 1, by omega⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 94 at b88a90ea8e90 ↗

      4. hW.s2.s4 obtain s.Nonempty

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with a : ℕ, ha : a ∈ s.

        Lean, line 95
              obtain ⟨a, ha⟩ := hs

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 95 at b88a90ea8e90 ↗

      5. hW.s2.s5 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s.erase a, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with z1 : ℤ, hz1 : (↑z1 : ℝ) = ∑ k ∈ s.erase a, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Uses library Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. .

        Lean, line 96
              obtain ⟨z1, hz1⟩ := ih (s.erase a) (e' + 1) (by rw [Finset.card_erase_of_mem ha]; have := Finset.card_pos.mpr ⟨a, ha⟩; omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 96 at b88a90ea8e90 ↗

        1. hW.s2.s5.this have (0 : ℕ) < s.card

          Leaves s.card - (1 : ℕ) + (e' + (1 : ℕ)) = N, with this : (0 : ℕ) < s.card.

          Uses library Finset.card_pos, Exists.intro Existential introduction. .

          Lean, line 96
                obtain ⟨z1, hz1⟩ := ih (s.erase a) (e' + 1) (by rw [Finset.card_erase_of_mem ha]; have := Finset.card_pos.mpr ⟨a, ha⟩; omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 96 at b88a90ea8e90 ↗

      6. hW.s2.s6 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

        Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with z2 : ℤ, hz2 : (↑z2 : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Lean, line 97
              obtain ⟨z2, hz2⟩ := ih s e' (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 97 at b88a90ea8e90 ↗

      7. hW.s2.hr have ∑ k ∈ s, (2 : ℝ) ^ k * ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

        Leaves (↑(z1 + (2 : ℤ) ^ a * z2) : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ (e' + (1 : ℕ)) / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hr : ∑ k ∈ s, (2 : ℝ) ^ k * ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e' / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Lean, line 99
              have hr := hrec s a (fun k => ((2 : ℝ) ^ k) ^ e') ha

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 99 at b88a90ea8e90 ↗

  5. hV have ∀ (m : ℕ) (s : Finset ℕ), m + (1 : ℕ) < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ)

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hV : ∀ (m : ℕ) (s : Finset ℕ), m + (1 : ℕ) < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

    Uses library Finset Finset α is the type of finite sets of elements of α. .

    Lean, lines 105–132
      have hV : ∀ m : ℕ, ∀ s : Finset ℕ, m + 1 < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = 0 := by
        intro m
        induction m with
        | zero =>
          intro s hs
          obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
          have hne : (s.erase a).Nonempty := Finset.card_pos.mp (by rw [Finset.card_erase_of_mem ha]; omega)
          have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹) ha
          have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ = 1 := fun k => by
            rw [zero_add, pow_one]; exact mul_inv_cancel₀ (by positivity)
          simp only [e] at h
          rw [h0 s ⟨a, ha⟩, h0 _ hne] at h
          have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
          rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
          · exact absurd h5 h2a
          · exact h5
        | succ m ih =>
          intro s hs
          obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
          have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹) ha
          have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ = (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ := fun k => by
            rw [pow_succ' _ (m + 1), mul_inv, ← mul_assoc, mul_inv_cancel₀ (by positivity), one_mul]
          simp only [e] at h
          rw [ih s (by omega), ih (s.erase a) (by rw [Finset.card_erase_of_mem ha]; omega)] at h
          have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
          rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
          · exact absurd h5 h2a
          · exact h5

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 105–132 at b88a90ea8e90 ↗

    1. hV.s1 case

      Leaves ∀ (s : Finset ℕ), (0 : ℕ) + (1 : ℕ) < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

      Uses library Nat.zero Zero, the smallest natural number. , Exists.intro Existential introduction. , mul_eq_zero If α has no zero divisors, then the product of two elements equals zero iff one of them equals zero. .

      Lean, lines 108–120
          | zero =>
            intro s hs
            obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
            have hne : (s.erase a).Nonempty := Finset.card_pos.mp (by rw [Finset.card_erase_of_mem ha]; omega)
            have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹) ha
            have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ = 1 := fun k => by
              rw [zero_add, pow_one]; exact mul_inv_cancel₀ (by positivity)
            simp only [e] at h
            rw [h0 s ⟨a, ha⟩, h0 _ hne] at h
            have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
            rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
            · exact absurd h5 h2a
            · exact h5

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 108–120 at b88a90ea8e90 ↗

      1. hV.s1.s1 obtain s.Nonempty

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with a : ℕ, ha : a ∈ s.

        Uses library Finset.card_pos.

        Lean, line 110
              obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 110 at b88a90ea8e90 ↗

      2. hV.s1.hne have (s.erase a).Nonempty

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with hne : (s.erase a).Nonempty.

        Uses library Finset.card_pos, Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. .

        Lean, line 111
              have hne : (s.erase a).Nonempty := Finset.card_pos.mp (by rw [Finset.card_erase_of_mem ha]; omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 111 at b88a90ea8e90 ↗

      3. hV.s1.h have ∑ k ∈ s, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with h : ∑ k ∈ s, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Lean, line 112
              have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹) ha

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 112 at b88a90ea8e90 ↗

      4. hV.s1.e have ∀ (k : ℕ), (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ = (1 : ℝ)

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with e : ∀ (k : ℕ), (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ = (1 : ℝ).

        Uses library zero_add, pow_one, mul_inv_cancel₀.

        Lean, lines 113–114
              have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ = 1 := fun k => by
                rw [zero_add, pow_one]; exact mul_inv_cancel₀ (by positivity)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 113–114 at b88a90ea8e90 ↗

      5. hV.s1.h2a have (2 : ℝ) ^ a ≠ (0 : ℝ) routine: positivity

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with h2a : (2 : ℝ) ^ a ≠ (0 : ℝ).

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

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 117 at b88a90ea8e90 ↗

      6. hV.s1.s6 case

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

        Uses library absurd Anything follows from two contradictory hypotheses. .

        Lean, line 119
              · exact absurd h5 h2a

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 119 at b88a90ea8e90 ↗

      7. hV.s1.s7 case

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ ((0 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

        Lean, line 120
              · exact h5

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 120 at b88a90ea8e90 ↗

    2. hV.s2 case

      Leaves ∀ (s : Finset ℕ), m + (1 : ℕ) + (1 : ℕ) < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with m : ℕ, ih : ∀ (s : Finset ℕ), m + (1 : ℕ) < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

      Uses library Nat.succ The successor of a natural number n. , Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. , mul_eq_zero If α has no zero divisors, then the product of two elements equals zero iff one of them equals zero. .

      Lean, lines 121–132
          | succ m ih =>
            intro s hs
            obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
            have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹) ha
            have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ = (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ := fun k => by
              rw [pow_succ' _ (m + 1), mul_inv, ← mul_assoc, mul_inv_cancel₀ (by positivity), one_mul]
            simp only [e] at h
            rw [ih s (by omega), ih (s.erase a) (by rw [Finset.card_erase_of_mem ha]; omega)] at h
            have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
            rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
            · exact absurd h5 h2a
            · exact h5

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 121–132 at b88a90ea8e90 ↗

      1. hV.s2.s1 obtain s.Nonempty

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with a : ℕ, ha : a ∈ s.

        Uses library Finset.card_pos.

        Lean, line 123
              obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 123 at b88a90ea8e90 ↗

      2. hV.s2.h have ∑ k ∈ s, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with h : ∑ k ∈ s, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (s.erase a).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

        Lean, line 124
              have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹) ha

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 124 at b88a90ea8e90 ↗

      3. hV.s2.e have ∀ (k : ℕ), (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ = (((2 : ℝ) ^ k) ^ (m + (1 : ℕ)))⁻¹

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with e : ∀ (k : ℕ), (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ = (((2 : ℝ) ^ k) ^ (m + (1 : ℕ)))⁻¹.

        Uses library pow_succ', mul_inv, mul_assoc, mul_inv_cancel₀, one_mul.

        Lean, lines 125–126
              have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ = (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ := fun k => by
                rw [pow_succ' _ (m + 1), mul_inv, ← mul_assoc, mul_inv_cancel₀ (by positivity), one_mul]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 125–126 at b88a90ea8e90 ↗

      4. hV.s2.h2a have (2 : ℝ) ^ a ≠ (0 : ℝ) routine: positivity

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ), with h2a : (2 : ℝ) ^ a ≠ (0 : ℝ).

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

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 129 at b88a90ea8e90 ↗

      5. hV.s2.s5 case

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

        Uses library absurd Anything follows from two contradictory hypotheses. .

        Lean, line 131
              · exact absurd h5 h2a

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 131 at b88a90ea8e90 ↗

      6. hV.s2.s6 case

        Leaves ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ s.erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (0 : ℝ).

        Lean, line 132
              · exact h5

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 132 at b88a90ea8e90 ↗

  6. hgeo have ∀ (m : ℕ), (1 : ℕ) ≤ m → ∀ (k : ℕ), ∑ i ∈ Finset.Icc (1 : ℕ) k, ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hgeo : ∀ (m : ℕ), (1 : ℕ) ≤ m → ∀ (k : ℕ), ∑ i ∈ Finset.Icc (1 : ℕ) k, ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)).

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

    Lean, lines 134–150
      have hgeo : ∀ m : ℕ, 1 ≤ m → ∀ k : ℕ, ∑ i ∈ Finset.Icc 1 k, (((2 : ℝ) ^ i)⁻¹) ^ m = (1 - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - 1) := by
        intro m hm k
        have hB : (2 : ℝ) ^ m - 1 ≠ 0 := by
          have : (2 : ℝ) ≤ 2 ^ m := by
            calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
              _ ≤ 2 ^ m := pow_le_pow_right₀ (by norm_num) hm
          linarith
        induction k with
        | zero => simp
        | succ k ih =>
          rw [Finset.sum_Icc_succ_top (by omega), ih, inv_pow, pow_succ, mul_pow]
          have hX : ((2 : ℝ) ^ k) ^ m ≠ 0 := by positivity
          have hY : (2 : ℝ) ^ m ≠ 0 := by positivity
          generalize ((2 : ℝ) ^ k) ^ m = X at hX ⊢
          generalize (2 : ℝ) ^ m = Y at hY hB ⊢
          field_simp
          ring

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 134–150 at b88a90ea8e90 ↗

    1. hgeo.hB have (2 : ℝ) ^ m - (1 : ℝ) ≠ (0 : ℝ)

      Leaves ∑ i ∈ Finset.Icc (1 : ℕ) k, ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)), with hB : (2 : ℝ) ^ m - (1 : ℝ) ≠ (0 : ℝ).

      Lean, lines 136–140
          have hB : (2 : ℝ) ^ m - 1 ≠ 0 := by
            have : (2 : ℝ) ≤ 2 ^ m := by
              calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                _ ≤ 2 ^ m := pow_le_pow_right₀ (by norm_num) hm
            linarith

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 136–140 at b88a90ea8e90 ↗

      1. hgeo.hB.this have (2 : ℝ) ≤ (2 : ℝ) ^ m

        Leaves (2 : ℝ) ^ m - (1 : ℝ) ≠ (0 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ m.

        Lean, lines 137–139
              have : (2 : ℝ) ≤ 2 ^ m := by
                calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                  _ ≤ 2 ^ m := pow_le_pow_right₀ (by norm_num) hm

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 137–139 at b88a90ea8e90 ↗

        1. hgeo.hB.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ)

          Closes the goal.

          Uses library pow_one.

          Lean, line 138
                  calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 138 at b88a90ea8e90 ↗

        2. hgeo.hB.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ m

          Closes the goal.

          Uses library pow_le_pow_right₀.

          Lean, line 139
                    _ ≤ 2 ^ m := pow_le_pow_right₀ (by norm_num) hm

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 139 at b88a90ea8e90 ↗

    2. hgeo.s2 case routine: simp

      Leaves ∑ i ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ (0 : ℕ)) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)).

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

      Lean, line 142
          | zero => simp

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 142 at b88a90ea8e90 ↗

    3. hgeo.s3 case

      Leaves ∑ i ∈ Finset.Icc (1 : ℕ) (k + (1 : ℕ)), ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ (k + (1 : ℕ))) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)), with k : ℕ, ih : ∑ i ∈ Finset.Icc (1 : ℕ) k, ((2 : ℝ) ^ i)⁻¹ ^ m = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)).

      Uses library Nat.succ The successor of a natural number n. , Finset.sum_Icc_succ_top, inv_pow, pow_succ, mul_pow.

      Lean, lines 143–150
          | succ k ih =>
            rw [Finset.sum_Icc_succ_top (by omega), ih, inv_pow, pow_succ, mul_pow]
            have hX : ((2 : ℝ) ^ k) ^ m ≠ 0 := by positivity
            have hY : (2 : ℝ) ^ m ≠ 0 := by positivity
            generalize ((2 : ℝ) ^ k) ^ m = X at hX ⊢
            generalize (2 : ℝ) ^ m = Y at hY hB ⊢
            field_simp
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 143–150 at b88a90ea8e90 ↗

      1. hgeo.s3.hX have ((2 : ℝ) ^ k) ^ m ≠ (0 : ℝ) routine: positivity

        Leaves ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)) + (((2 : ℝ) ^ k) ^ m * (2 : ℝ) ^ m)⁻¹ = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m * (2 : ℝ) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)), with hX : ((2 : ℝ) ^ k) ^ m ≠ (0 : ℝ).

        Lean, line 145
              have hX : ((2 : ℝ) ^ k) ^ m ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 145 at b88a90ea8e90 ↗

      2. hgeo.s3.hY have (2 : ℝ) ^ m ≠ (0 : ℝ) routine: positivity

        Leaves ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)) + (((2 : ℝ) ^ k) ^ m * (2 : ℝ) ^ m)⁻¹ = ((1 : ℝ) - (((2 : ℝ) ^ k) ^ m * (2 : ℝ) ^ m)⁻¹) / ((2 : ℝ) ^ m - (1 : ℝ)), with hY : (2 : ℝ) ^ m ≠ (0 : ℝ).

        Lean, line 146
              have hY : (2 : ℝ) ^ m ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 146 at b88a90ea8e90 ↗

  7. hdvd have ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k)

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hdvd : ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k).

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

    Lean, lines 151–165
      have hdvd : ∀ n i : ℕ, 1 ≤ i → i ≤ n - 1 → ((2 : ℤ) ^ i - 1) ∣ ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k) := by
        intro n i hi1 hi2
        obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩
        have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i
        have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith
        have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))
        have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩
        have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
          have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
          rw [one_pow, ← pow_mul, ← hk0] at this
          exact this
        have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
          have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
          rw [this]; exact (dvd_neg).mpr h1
        exact h2.trans (Finset.dvd_prod_of_mem (fun k => (1 : ℤ) - 2 ^ k) hmem)

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 151–165 at b88a90ea8e90 ↗

    1. hdvd.s1 obtain ∃ (k0 : ℕ), k0 = i * (n / i)

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with k0 : ℕ, hk0 : k0 = i * (n / i).

      Uses library Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, line 153
          obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 153 at b88a90ea8e90 ↗

    2. hdvd.hle have k0 ≤ n

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hle : k0 ≤ n.

      Uses library mul_comm, Nat.div_mul_le_self.

      Lean, line 154
          have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 154 at b88a90ea8e90 ↗

    3. hdvd.hlt have n < k0 + i

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hlt : n < k0 + i.

      Lean, line 155
          have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 155 at b88a90ea8e90 ↗

      1. hdvd.hlt.this have n < i * (n / i + (1 : ℕ))

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

        Uses library Nat.lt_mul_div_succ.

        Lean, line 155
            have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 155 at b88a90ea8e90 ↗

    4. hdvd.hge have i ≤ k0

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hge : i ≤ k0.

      Uses library Nat.le_mul_of_pos_right, Nat.div_pos.

      Lean, line 156
          have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 156 at b88a90ea8e90 ↗

    5. hdvd.hmem have k0 ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hmem : k0 ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n.

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.mem_Icc, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

      Lean, line 157
          have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 157 at b88a90ea8e90 ↗

    6. hdvd.h1 have (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ)

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with h1 : (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ).

      Uses library one_pow, pow_mul.

      Lean, lines 158–161
          have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
            have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
            rw [one_pow, ← pow_mul, ← hk0] at this
            exact this

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 158–161 at b88a90ea8e90 ↗

      1. hdvd.h1.this have (2 : ℤ) ^ i - (1 : ℤ) ∣ ((2 : ℤ) ^ i) ^ (n / i) - (1 : ℤ) ^ (n / i)

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ), with this : (2 : ℤ) ^ i - (1 : ℤ) ∣ ((2 : ℤ) ^ i) ^ (n / i) - (1 : ℤ) ^ (n / i).

        Uses library sub_dvd_pow_sub_pow.

        Lean, line 159
              have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 159 at b88a90ea8e90 ↗

    7. hdvd.h2 have (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0

      Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with h2 : (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0.

      Uses library dvd_neg An element a of a semigroup with a distributive negation divides the negation of an element b iff a divides b. .

      Lean, lines 162–164
          have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
            have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
            rw [this]; exact (dvd_neg).mpr h1

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 162–164 at b88a90ea8e90 ↗

      1. hdvd.h2.this have (1 : ℤ) - (2 : ℤ) ^ k0 = -((2 : ℤ) ^ k0 - (1 : ℤ)) routine: ring

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0, with this : (1 : ℤ) - (2 : ℤ) ^ k0 = -((2 : ℤ) ^ k0 - (1 : ℤ)).

        Lean, line 163
              have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 163 at b88a90ea8e90 ↗

  8. hpoly have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (α : ℕ → ℤ), ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hpoly : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (α : ℕ → ℤ), ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j.

    Uses library Finset.Icc 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. , Polynomial.C C a is the constant polynomial a. , Polynomial.X X is the polynomial variable (aka indeterminate). , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Polynomial.coeff_map.

    Lean, lines 166–183
      have hpoly : ∀ n : ℕ, 1 ≤ n → ∃ α : ℕ → ℤ, ∀ y : ℝ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (α j : ℝ) * y ^ j := by
        intro n hn
        refine ⟨fun j => (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X)).coeff j, fun y => ?_⟩
        have hdeg : (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))).natDegree < n := by
          refine lt_of_le_of_lt (Polynomial.natDegree_map_le) ?_
          refine lt_of_le_of_lt (Polynomial.natDegree_prod_le _ _) ?_
          refine lt_of_le_of_lt (Finset.sum_le_sum (g := fun _ => 1) (fun t _ => ?_)) ?_
          · compute_degree
          · simp only [Finset.sum_const, smul_eq_mul, mul_one, Nat.card_Icc]; omega
        have hev := Polynomial.eval_eq_sum_range' hdeg y
        have hev2 : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (2 : ℝ) ^ t * y) = Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))) := by
          rw [Polynomial.map_prod, Polynomial.eval_prod]
          refine Finset.prod_congr rfl (fun t _ => ?_)
          simp
        rw [hev2, hev]
        refine Finset.sum_congr rfl (fun j _ => ?_)
        rw [Polynomial.coeff_map]
        rfl

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 166–183 at b88a90ea8e90 ↗

    1. hpoly.hdeg have (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))).natDegree < n

      Leaves ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑((fun (j : ℕ) => (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X)).coeff j) j) : ℝ) * y ^ j, with hdeg : (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))).natDegree < n.

      Uses library Polynomial.map map f p maps a polynomial p across a ring hom f , Int.castRingHom coe : ℤ → α as a RingHom. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Polynomial.C C a is the constant polynomial a. , Polynomial.X X is the polynomial variable (aka indeterminate). , lt_of_le_of_lt, Polynomial.natDegree_map_le, Polynomial.natDegree_prod_le, Finset.sum_le_sum In an ordered additive commutative monoid, if each summand f i of one finite sum is less than or equal to the corresponding summand g i of another finite sum, then ∑ i ∈ s, f i ≤ ∑ i ∈ s, g i. .

      Lean, lines 169–174
          have hdeg : (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))).natDegree < n := by
            refine lt_of_le_of_lt (Polynomial.natDegree_map_le) ?_
            refine lt_of_le_of_lt (Polynomial.natDegree_prod_le _ _) ?_
            refine lt_of_le_of_lt (Finset.sum_le_sum (g := fun _ => 1) (fun t _ => ?_)) ?_
            · compute_degree
            · simp only [Finset.sum_const, smul_eq_mul, mul_one, Nat.card_Icc]; omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 169–174 at b88a90ea8e90 ↗

      1. hpoly.hdeg.s1 case

        Leaves ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X).natDegree ≤ (1 : ℕ).

        Lean, line 173
              · compute_degree

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 173 at b88a90ea8e90 ↗

      2. hpoly.hdeg.s2 case routine: simp, omega

        Leaves ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (1 : ℕ) < n.

        Uses library Finset.sum_const, smul_eq_mul, mul_one, Nat.card_Icc.

        Lean, line 174
              · simp only [Finset.sum_const, smul_eq_mul, mul_one, Nat.card_Icc]; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 174 at b88a90ea8e90 ↗

    2. hpoly.hev have Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))) = ∑ i ∈ Finset.range n, (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))).coeff i * y ^ i

      Leaves ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑((fun (j : ℕ) => (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X)).coeff j) j) : ℝ) * y ^ j, with hev : Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))) = ∑ i ∈ Finset.range n, (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))).coeff i * y ^ i.

      Uses library Polynomial.eval_eq_sum_range'.

      Lean, line 175
          have hev := Polynomial.eval_eq_sum_range' hdeg y

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 175 at b88a90ea8e90 ↗

    3. hpoly.hev2 have ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X)))

      Leaves ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑((fun (j : ℕ) => (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X)).coeff j) j) : ℝ) * y ^ j, with hev2 : ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : Polynomial ℤ) - (Polynomial.C : ℤ → Polynomial ℤ) ((2 : ℤ) ^ t) * Polynomial.X))).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Polynomial.eval eval x p is the evaluation of the polynomial p at x , Polynomial.map map f p maps a polynomial p across a ring hom f , Int.castRingHom coe : ℤ → α as a RingHom. , Polynomial.C C a is the constant polynomial a. , Polynomial.X X is the polynomial variable (aka indeterminate). , Polynomial.map_prod, Polynomial.eval_prod Polynomial evaluation commutes with Finset.prod , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 176–179
          have hev2 : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (2 : ℝ) ^ t * y) = Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))) := by
            rw [Polynomial.map_prod, Polynomial.eval_prod]
            refine Finset.prod_congr rfl (fun t _ => ?_)
            simp

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 176–179 at b88a90ea8e90 ↗

  9. residue_integral have ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with residue_integral : ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

    Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , eq_div_iff, Int.cast_neg, Int.cast_mul.

    Lean, lines 184–311
      have residue_integral : ∀ n i : ℕ, 1 ≤ i → i ≤ n → ∃ z : ℤ, (z : ℝ) = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := by
        have hQne : ∀ m : ℕ, (∏ s ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ s)) ≠ 0 := by
          intro m
          refine Finset.prod_ne_zero_iff.mpr (fun s hs => ?_)
          have h1 := (Finset.mem_Icc.mp hs).1
          have h2 : (2 : ℤ) ≤ 2 ^ s := by
            calc (2 : ℤ) = 2 ^ 1 := by norm_num
              _ ≤ 2 ^ s := pow_le_pow_right₀ (by norm_num) h1
          omega
        have hG : ∀ N a b : ℕ, a + b = N → ∃ z : ℤ, (∏ s ∈ Finset.Icc 1 (a + b), ((1 : ℤ) - 2 ^ s)) = z * ((∏ s ∈ Finset.Icc 1 a, ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 b, ((1 : ℤ) - 2 ^ s))) := by
          intro N
          induction N with
          | zero =>
            intro a b h
            obtain ⟨rfl, rfl⟩ : a = 0 ∧ b = 0 := by omega
            exact ⟨1, by simp⟩
          | succ N ih =>
            intro a b h
            rcases Nat.eq_zero_or_pos a with rfl | ha
            · exact ⟨1, by simp⟩
            rcases Nat.eq_zero_or_pos b with rfl | hb
            · exact ⟨1, by simp⟩
            obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩
            obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩
            obtain ⟨z1, h1⟩ := ih a' (b' + 1) (by omega)
            obtain ⟨z2, h2⟩ := ih (a' + 1) b' (by omega)
            refine ⟨2 ^ (b' + 1) * z1 + z2, ?_⟩
            have e1 : a' + 1 + (b' + 1) = (a' + (b' + 1)) + 1 := by omega
            have e2 : a' + 1 + b' = a' + (b' + 1) := by omega
            have hA := Finset.prod_Icc_succ_top (show 1 ≤ a' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
            have hB := Finset.prod_Icc_succ_top (show 1 ≤ b' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
            have hC := Finset.prod_Icc_succ_top (show 1 ≤ a' + (b' + 1) + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
            beta_reduce at hA hB hC
            rw [e2, hA] at h2
            rw [hB] at h1
            rw [e1, hC, hA, hB]
            linear_combination (2 ^ (b' + 1) * (1 - 2 ^ (a' + 1))) * h1 + (1 - 2 ^ (b' + 1)) * h2
        have hN : ∀ m d : ℕ, (∏ s ∈ Finset.Icc 1 d, ((1 : ℤ) - 2 ^ s)) * (∏ t ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ (t + d))) = ∏ s ∈ Finset.Icc 1 (d + m), ((1 : ℤ) - 2 ^ s) := by
          intro m d
          induction m with
          | zero => simp
          | succ m ih =>
            rw [Finset.prod_Icc_succ_top (by omega), show d + (m + 1) = (d + m) + 1 by omega, Finset.prod_Icc_succ_top (by omega), ← mul_assoc, ih,
              show m + 1 + d = d + m + 1 by omega]
        have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
          intro s g
          induction s using Finset.induction_on with
          | empty => intro _; exact ⟨0, by simp⟩
          | insert a s ha ih =>
            intro h
            obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
            obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
            exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
        intro n i hi hin
        refine hsumZ _ _ (fun k hk => ?_)
        have hk' := Finset.mem_Icc.mp hk
        obtain ⟨d, rfl⟩ : ∃ d, k = i + d := ⟨k - i, by omega⟩
        -- numerator
        have hNr : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d))) = ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) := by
          push_cast
          refine Finset.prod_congr rfl (fun t _ => ?_)
          have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
          rw [show t + (i + d) = i + (t + d) by omega, pow_add, ← mul_assoc, inv_mul_cancel₀ h2i, one_mul]
        -- denominator
        have hset : (Finset.Icc 1 n).erase (i + d) = Finset.Icc 1 (i + d - 1) ∪ Finset.Icc (i + d + 1) n := by
          ext l
          simp only [Finset.mem_erase, Finset.mem_Icc, Finset.mem_union]
          omega
        have hdisj : Disjoint (Finset.Icc 1 (i + d - 1)) (Finset.Icc (i + d + 1) n) := by
          rw [Finset.disjoint_left]
          intro l h1 h2
          simp only [Finset.mem_Icc] at h1 h2
          omega
        have hD1 : (∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
          have hrefl : ∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ∏ s ∈ Finset.Icc 1 (i + d - 1), (1 - ((2 : ℝ) ^ s)⁻¹) := by
            refine Finset.prod_nbij' (fun l => i + d - l) (fun s => i + d - s) ?_ ?_ ?_ ?_ ?_
            · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl; omega
            · intro l hl
              simp only [Finset.mem_Icc] at hl
              rw [← zpow_natCast, ← zpow_neg]
              congr 2
              push_cast [Nat.cast_sub (show l ≤ i + d by omega)]
              ring
          rw [hrefl]
          push_cast
          rw [← Finset.prod_mul_distrib]
          refine Finset.prod_congr rfl (fun s _ => ?_)
          have h2s : (2 : ℝ) ^ s ≠ 0 := by positivity
          field_simp
          ring
        have hD2 : ∏ l ∈ Finset.Icc (i + d + 1) n, (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
          push_cast
          refine Finset.prod_nbij' (fun l => l - (i + d)) (fun s => s + (i + d)) ?_ ?_ ?_ ?_ ?_
          · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
          · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
          · intro l hl; simp only [Finset.mem_Icc] at hl; omega
          · intro l hl; simp only [Finset.mem_Icc] at hl; omega
          · intro l hl
            simp only [Finset.mem_Icc] at hl
            rw [← zpow_natCast]
            congr 2
            push_cast [Nat.cast_sub (show i + d ≤ l by omega)]
            ring
        obtain ⟨z1, hz1⟩ := hG _ d (n - 1) rfl
        obtain ⟨z2, hz2⟩ := hG _ (i + d - 1) (n - (i + d)) rfl
        rw [show i + d - 1 + (n - (i + d)) = n - 1 by omega] at hz2
        have hNZ : (∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d))) = z1 * z2 * ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s))) := by
          apply mul_left_cancel₀ (hQne d)
          rw [hN (n - 1) d, hz1, hz2]
          ring
        have hNZ' : ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) = (z1 : ℝ) * z2 * (((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ)) := by
          exact_mod_cast hNZ
        have hQ1 : ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _
        have hQ2 : ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _
        have hDr : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
          rw [hset, Finset.prod_union hdisj, hD2, ← hD1]
          ring
        have hDne : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) ≠ 0 := by
          intro h0
          rw [h0, zero_mul] at hDr
          exact mul_ne_zero hQ1 hQ2 hDr.symm
        refine ⟨-(z1 * z2 * (∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s))), ?_⟩
        rw [hNr, eq_div_iff hDne, hNZ']
        rw [Int.cast_neg, Int.cast_mul, Int.cast_mul]
        linear_combination (-((z1 : ℝ) * z2)) * hDr

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 184–311 at b88a90ea8e90 ↗

    1. residue_integral.hQne have ∀ (m : ℕ), ∏ s ∈ Finset.Icc (1 : ℕ) m, ((1 : ℤ) - (2 : ℤ) ^ s) ≠ (0 : ℤ)

      Leaves ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hQne : ∀ (m : ℕ), ∏ s ∈ Finset.Icc (1 : ℕ) m, ((1 : ℤ) - (2 : ℤ) ^ s) ≠ (0 : ℤ).

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

      Lean, lines 185–192
          have hQne : ∀ m : ℕ, (∏ s ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ s)) ≠ 0 := by
            intro m
            refine Finset.prod_ne_zero_iff.mpr (fun s hs => ?_)
            have h1 := (Finset.mem_Icc.mp hs).1
            have h2 : (2 : ℤ) ≤ 2 ^ s := by
              calc (2 : ℤ) = 2 ^ 1 := by norm_num
                _ ≤ 2 ^ s := pow_le_pow_right₀ (by norm_num) h1
            omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 185–192 at b88a90ea8e90 ↗

      1. residue_integral.hQne.h1 have (1 : ℕ) ≤ s

        Leaves (1 : ℤ) - (2 : ℤ) ^ s ≠ (0 : ℤ), with h1 : (1 : ℕ) ≤ s.

        Uses library Finset.mem_Icc.

        Lean, line 188
              have h1 := (Finset.mem_Icc.mp hs).1

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 188 at b88a90ea8e90 ↗

      2. residue_integral.hQne.h2 have (2 : ℤ) ≤ (2 : ℤ) ^ s

        Leaves (1 : ℤ) - (2 : ℤ) ^ s ≠ (0 : ℤ), with h2 : (2 : ℤ) ≤ (2 : ℤ) ^ s.

        Lean, lines 189–191
              have h2 : (2 : ℤ) ≤ 2 ^ s := by
                calc (2 : ℤ) = 2 ^ 1 := by norm_num
                  _ ≤ 2 ^ s := pow_le_pow_right₀ (by norm_num) h1

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 189–191 at b88a90ea8e90 ↗

        1. residue_integral.hQne.h2.s1 calc (2 : ℤ) = (2 : ℤ) ^ (1 : ℕ) routine: norm_num

          Closes the goal.

          Lean, line 190
                  calc (2 : ℤ) = 2 ^ 1 := by norm_num

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 190 at b88a90ea8e90 ↗

        2. residue_integral.hQne.h2.s2 calc (2 : ℤ) ^ (1 : ℕ) ≤ (2 : ℤ) ^ s

          Closes the goal.

          Uses library pow_le_pow_right₀.

          Lean, line 191
                    _ ≤ 2 ^ s := pow_le_pow_right₀ (by norm_num) h1

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 191 at b88a90ea8e90 ↗

    2. residue_integral.hG have ∀ (N a b : ℕ), a + b = N → ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s))

      Leaves ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hG : ∀ (N a b : ℕ), a + b = N → ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)).

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

      Lean, lines 193–220
          have hG : ∀ N a b : ℕ, a + b = N → ∃ z : ℤ, (∏ s ∈ Finset.Icc 1 (a + b), ((1 : ℤ) - 2 ^ s)) = z * ((∏ s ∈ Finset.Icc 1 a, ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 b, ((1 : ℤ) - 2 ^ s))) := by
            intro N
            induction N with
            | zero =>
              intro a b h
              obtain ⟨rfl, rfl⟩ : a = 0 ∧ b = 0 := by omega
              exact ⟨1, by simp⟩
            | succ N ih =>
              intro a b h
              rcases Nat.eq_zero_or_pos a with rfl | ha
              · exact ⟨1, by simp⟩
              rcases Nat.eq_zero_or_pos b with rfl | hb
              · exact ⟨1, by simp⟩
              obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩
              obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩
              obtain ⟨z1, h1⟩ := ih a' (b' + 1) (by omega)
              obtain ⟨z2, h2⟩ := ih (a' + 1) b' (by omega)
              refine ⟨2 ^ (b' + 1) * z1 + z2, ?_⟩
              have e1 : a' + 1 + (b' + 1) = (a' + (b' + 1)) + 1 := by omega
              have e2 : a' + 1 + b' = a' + (b' + 1) := by omega
              have hA := Finset.prod_Icc_succ_top (show 1 ≤ a' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
              have hB := Finset.prod_Icc_succ_top (show 1 ≤ b' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
              have hC := Finset.prod_Icc_succ_top (show 1 ≤ a' + (b' + 1) + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
              beta_reduce at hA hB hC
              rw [e2, hA] at h2
              rw [hB] at h1
              rw [e1, hC, hA, hB]
              linear_combination (2 ^ (b' + 1) * (1 - 2 ^ (a' + 1))) * h1 + (1 - 2 ^ (b' + 1)) * h2

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 193–220 at b88a90ea8e90 ↗

      1. residue_integral.hG.s1 case

        Leaves ∀ (a b : ℕ), a + b = (0 : ℕ) → ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)).

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

        Lean, lines 196–199
              | zero =>
                intro a b h
                obtain ⟨rfl, rfl⟩ : a = 0 ∧ b = 0 := by omega
                exact ⟨1, by simp⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 196–199 at b88a90ea8e90 ↗

        1. residue_integral.hG.s1.s1 obtain a = (0 : ℕ) ∧ b = (0 : ℕ) routine: omega

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) ((0 : ℕ) + (0 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((1 : ℤ) - (2 : ℤ) ^ s)), with h : (0 : ℕ) + (0 : ℕ) = (0 : ℕ).

          Lean, line 198
                  obtain ⟨rfl, rfl⟩ : a = 0 ∧ b = 0 := by omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 198 at b88a90ea8e90 ↗

      2. residue_integral.hG.s2 case

        Leaves ∀ (a b : ℕ), a + b = N + (1 : ℕ) → ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)), with N : ℕ, ih : ∀ (a b : ℕ), a + b = N → ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)).

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

        Lean, lines 200–220
              | succ N ih =>
                intro a b h
                rcases Nat.eq_zero_or_pos a with rfl | ha
                · exact ⟨1, by simp⟩
                rcases Nat.eq_zero_or_pos b with rfl | hb
                · exact ⟨1, by simp⟩
                obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩
                obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩
                obtain ⟨z1, h1⟩ := ih a' (b' + 1) (by omega)
                obtain ⟨z2, h2⟩ := ih (a' + 1) b' (by omega)
                refine ⟨2 ^ (b' + 1) * z1 + z2, ?_⟩
                have e1 : a' + 1 + (b' + 1) = (a' + (b' + 1)) + 1 := by omega
                have e2 : a' + 1 + b' = a' + (b' + 1) := by omega
                have hA := Finset.prod_Icc_succ_top (show 1 ≤ a' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
                have hB := Finset.prod_Icc_succ_top (show 1 ≤ b' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
                have hC := Finset.prod_Icc_succ_top (show 1 ≤ a' + (b' + 1) + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
                beta_reduce at hA hB hC
                rw [e2, hA] at h2
                rw [hB] at h1
                rw [e1, hC, hA, hB]
                linear_combination (2 ^ (b' + 1) * (1 - 2 ^ (a' + 1))) * h1 + (1 - 2 ^ (b' + 1)) * h2

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 200–220 at b88a90ea8e90 ↗

        1. residue_integral.hG.s2.s1 case

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) ((0 : ℕ) + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)).

          Uses library Exists.intro Existential introduction. .

          Lean, line 203
                  · exact ⟨1, by simp⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 203 at b88a90ea8e90 ↗

        2. residue_integral.hG.s2.s2 case

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a + (0 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((1 : ℤ) - (2 : ℤ) ^ s)).

          Uses library Exists.intro Existential introduction. .

          Lean, line 205
                  · exact ⟨1, by simp⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 205 at b88a90ea8e90 ↗

        3. residue_integral.hG.s2.s3 obtain ∃ (a' : ℕ), a = a' + (1 : ℕ)

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + b), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b, ((1 : ℤ) - (2 : ℤ) ^ s)), with a' : ℕ, h : a' + (1 : ℕ) + b = N + (1 : ℕ), ha : a' + (1 : ℕ) > (0 : ℕ).

          Uses library Exists.intro Existential introduction. .

          Lean, line 206
                  obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 206 at b88a90ea8e90 ↗

        4. residue_integral.hG.s2.s4 obtain ∃ (b' : ℕ), b = b' + (1 : ℕ)

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with b' : ℕ, hb : b' + (1 : ℕ) > (0 : ℕ), h : a' + (1 : ℕ) + (b' + (1 : ℕ)) = N + (1 : ℕ).

          Uses library Exists.intro Existential introduction. .

          Lean, line 207
                  obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 207 at b88a90ea8e90 ↗

        5. residue_integral.hG.s2.s5 obtain ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) a', ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s))

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with z1 : ℤ, h1 : ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z1 * ((∏ s ∈ Finset.Icc (1 : ℕ) a', ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)).

          Lean, line 208
                  obtain ⟨z1, h1⟩ := ih a' (b' + 1) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 208 at b88a90ea8e90 ↗

        6. residue_integral.hG.s2.s6 obtain ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + b'), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b', ((1 : ℤ) - (2 : ℤ) ^ s))

          Leaves ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with z2 : ℤ, h2 : ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + b'), ((1 : ℤ) - (2 : ℤ) ^ s) = z2 * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) b', ((1 : ℤ) - (2 : ℤ) ^ s)).

          Lean, line 209
                  obtain ⟨z2, h2⟩ := ih (a' + 1) b' (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 209 at b88a90ea8e90 ↗

        7. residue_integral.hG.s2.e1 have a' + (1 : ℕ) + (b' + (1 : ℕ)) = a' + (b' + (1 : ℕ)) + (1 : ℕ) routine: omega

          Leaves ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = ((2 : ℤ) ^ (b' + (1 : ℕ)) * z1 + z2) * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with e1 : a' + (1 : ℕ) + (b' + (1 : ℕ)) = a' + (b' + (1 : ℕ)) + (1 : ℕ).

          Lean, line 211
                  have e1 : a' + 1 + (b' + 1) = (a' + (b' + 1)) + 1 := by omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 211 at b88a90ea8e90 ↗

        8. residue_integral.hG.s2.e2 have a' + (1 : ℕ) + b' = a' + (b' + (1 : ℕ)) routine: omega

          Leaves ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = ((2 : ℤ) ^ (b' + (1 : ℕ)) * z1 + z2) * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with e2 : a' + (1 : ℕ) + b' = a' + (b' + (1 : ℕ)).

          Lean, line 212
                  have e2 : a' + 1 + b' = a' + (b' + 1) := by omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 212 at b88a90ea8e90 ↗

        9. residue_integral.hG.s2.hA have ∏ k ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) a', ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (a' + (1 : ℕ)))

          Leaves ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = ((2 : ℤ) ^ (b' + (1 : ℕ)) * z1 + z2) * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with hA : ∏ k ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) a', ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (a' + (1 : ℕ))).

          Uses library Finset.prod_Icc_succ_top.

          Lean, line 213
                  have hA := Finset.prod_Icc_succ_top (show 1 ≤ a' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 213 at b88a90ea8e90 ↗

        10. residue_integral.hG.s2.hB have ∏ k ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) b', ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (b' + (1 : ℕ)))

          Leaves ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = ((2 : ℤ) ^ (b' + (1 : ℕ)) * z1 + z2) * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with hB : ∏ k ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) b', ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (b' + (1 : ℕ))).

          Uses library Finset.prod_Icc_succ_top.

          Lean, line 214
                  have hB := Finset.prod_Icc_succ_top (show 1 ≤ b' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 214 at b88a90ea8e90 ↗

        11. residue_integral.hG.s2.hC have ∏ k ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ)) + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (a' + (b' + (1 : ℕ)) + (1 : ℕ)))

          Leaves ∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ) + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = ((2 : ℤ) ^ (b' + (1 : ℕ)) * z1 + z2) * ((∏ s ∈ Finset.Icc (1 : ℕ) (a' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (b' + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)), with hC : ∏ k ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ)) + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) (a' + (b' + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ k)) * ((1 : ℤ) - (2 : ℤ) ^ (a' + (b' + (1 : ℕ)) + (1 : ℕ))).

          Uses library Finset.prod_Icc_succ_top.

          Lean, line 215
                  have hC := Finset.prod_Icc_succ_top (show 1 ≤ a' + (b' + 1) + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 215 at b88a90ea8e90 ↗

    3. residue_integral.hN have ∀ (m d : ℕ), (∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ t ∈ Finset.Icc (1 : ℕ) m, ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = ∏ s ∈ Finset.Icc (1 : ℕ) (d + m), ((1 : ℤ) - (2 : ℤ) ^ s)

      Leaves ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hN : ∀ (m d : ℕ), (∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ t ∈ Finset.Icc (1 : ℕ) m, ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = ∏ s ∈ Finset.Icc (1 : ℕ) (d + m), ((1 : ℤ) - (2 : ℤ) ^ s).

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

      Lean, lines 221–227
          have hN : ∀ m d : ℕ, (∏ s ∈ Finset.Icc 1 d, ((1 : ℤ) - 2 ^ s)) * (∏ t ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ (t + d))) = ∏ s ∈ Finset.Icc 1 (d + m), ((1 : ℤ) - 2 ^ s) := by
            intro m d
            induction m with
            | zero => simp
            | succ m ih =>
              rw [Finset.prod_Icc_succ_top (by omega), show d + (m + 1) = (d + m) + 1 by omega, Finset.prod_Icc_succ_top (by omega), ← mul_assoc, ih,
                show m + 1 + d = d + m + 1 by omega]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 221–227 at b88a90ea8e90 ↗

      1. residue_integral.hN.s1 case routine: simp

        Leaves (∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ t ∈ Finset.Icc (1 : ℕ) (0 : ℕ), ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = ∏ s ∈ Finset.Icc (1 : ℕ) (d + (0 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s).

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

        Lean, line 224
              | zero => simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 224 at b88a90ea8e90 ↗

      2. residue_integral.hN.s2 case

        Leaves (∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ t ∈ Finset.Icc (1 : ℕ) (m + (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = ∏ s ∈ Finset.Icc (1 : ℕ) (d + (m + (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s), with m : ℕ, ih : (∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ t ∈ Finset.Icc (1 : ℕ) m, ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = ∏ s ∈ Finset.Icc (1 : ℕ) (d + m), ((1 : ℤ) - (2 : ℤ) ^ s).

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

        Lean, lines 225–227
              | succ m ih =>
                rw [Finset.prod_Icc_succ_top (by omega), show d + (m + 1) = (d + m) + 1 by omega, Finset.prod_Icc_succ_top (by omega), ← mul_assoc, ih,
                  show m + 1 + d = d + m + 1 by omega]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 225–227 at b88a90ea8e90 ↗

    4. residue_integral.hsumZ have ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

      Leaves ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g 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 228–236
          have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
            intro s g
            induction s using Finset.induction_on with
            | empty => intro _; exact ⟨0, by simp⟩
            | insert a s ha ih =>
              intro h
              obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
              obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
              exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 228–236 at b88a90ea8e90 ↗

      1. residue_integral.hsumZ.s1 case printed form did not read back: shown as its Lean lines only
      2. residue_integral.hsumZ.s2 case

        Leaves (∀ i ∈ insert a s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with a : ℕ, s : Finset ℕ, ha : a ∉ s, ih : (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i.

        Uses library Exists.intro Existential introduction. , Finset.sum_insert.

        Lean, lines 232–236
              | insert a s ha ih =>
                intro h
                obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
                obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
                exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 232–236 at b88a90ea8e90 ↗

        1. residue_integral.hsumZ.s2.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = g a

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with za : ℤ, hza : (↑za : ℝ) = g a.

          Uses library Finset.mem_insert_self.

          Lean, line 234
                  obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 234 at b88a90ea8e90 ↗

        2. residue_integral.hsumZ.s2.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with zs : ℤ, hzs : (↑zs : ℝ) = ∑ i ∈ s, g i.

          Uses library Finset.mem_insert_of_mem.

          Lean, line 235
                  obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 235 at b88a90ea8e90 ↗

    5. residue_integral.hk' have i ≤ k ∧ k ≤ n

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))), with hk' : i ≤ k ∧ k ≤ n.

      Uses library Finset.mem_Icc.

      Lean, line 239
          have hk' := Finset.mem_Icc.mp hk

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 239 at b88a90ea8e90 ↗

    6. residue_integral.s6 obtain ∃ (d : ℕ), k = i + d

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with d : ℕ, hk : i + d ∈ Finset.Icc i n, hk' : i ≤ i + d ∧ i + d ≤ n.

      Uses library Exists.intro Existential introduction. .

      Lean, line 240
          obtain ⟨d, rfl⟩ : ∃ d, k = i + d := ⟨k - i, by omega⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 240 at b88a90ea8e90 ↗

    7. residue_integral.hNr have ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d))) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d))) : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hNr : ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d))) = (↑(∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d))) : ℝ).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , pow_add, mul_assoc, inv_mul_cancel₀, one_mul.

      Lean, lines 242–246
          have hNr : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d))) = ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) := by
            push_cast
            refine Finset.prod_congr rfl (fun t _ => ?_)
            have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
            rw [show t + (i + d) = i + (t + d) by omega, pow_add, ← mul_assoc, inv_mul_cancel₀ h2i, one_mul]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 242–246 at b88a90ea8e90 ↗

      1. residue_integral.hNr.h2i have (2 : ℝ) ^ i ≠ (0 : ℝ) routine: positivity

        Leaves (1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)) = (1 : ℝ) - (2 : ℝ) ^ (t + d), with h2i : (2 : ℝ) ^ i ≠ (0 : ℝ).

        Lean, line 245
              have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 245 at b88a90ea8e90 ↗

    8. residue_integral.hset have (Finset.Icc (1 : ℕ) n).erase (i + d) = Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)) ∪ Finset.Icc (i + d + (1 : ℕ)) n

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hset : (Finset.Icc (1 : ℕ) n).erase (i + d) = Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)) ∪ Finset.Icc (i + d + (1 : ℕ)) n.

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

      Lean, lines 248–251
          have hset : (Finset.Icc 1 n).erase (i + d) = Finset.Icc 1 (i + d - 1) ∪ Finset.Icc (i + d + 1) n := by
            ext l
            simp only [Finset.mem_erase, Finset.mem_Icc, Finset.mem_union]
            omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 248–251 at b88a90ea8e90 ↗

    9. residue_integral.hdisj have Disjoint (Finset.Icc (1 : ℕ) (i + d - (1 : ℕ))) (Finset.Icc (i + d + (1 : ℕ)) n)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hdisj : Disjoint (Finset.Icc (1 : ℕ) (i + d - (1 : ℕ))) (Finset.Icc (i + d + (1 : ℕ)) n).

      Uses library Disjoint Two elements of a lattice are disjoint if their inf is the bottom element. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.disjoint_left, Finset.mem_Icc.

      Lean, lines 252–256
          have hdisj : Disjoint (Finset.Icc 1 (i + d - 1)) (Finset.Icc (i + d + 1) n) := by
            rw [Finset.disjoint_left]
            intro l h1 h2
            simp only [Finset.mem_Icc] at h1 h2
            omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 252–256 at b88a90ea8e90 ↗

    10. residue_integral.hD1 have (∏ l ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ)))) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), -(2 : ℤ) ^ s) : ℝ) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hD1 : (∏ l ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ)))) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), -(2 : ℤ) ^ s) : ℝ) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_mul_distrib, Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, lines 257–276
          have hD1 : (∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
            have hrefl : ∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ∏ s ∈ Finset.Icc 1 (i + d - 1), (1 - ((2 : ℝ) ^ s)⁻¹) := by
              refine Finset.prod_nbij' (fun l => i + d - l) (fun s => i + d - s) ?_ ?_ ?_ ?_ ?_
              · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
              · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
              · intro l hl; simp only [Finset.mem_Icc] at hl; omega
              · intro l hl; simp only [Finset.mem_Icc] at hl; omega
              · intro l hl
                simp only [Finset.mem_Icc] at hl
                rw [← zpow_natCast, ← zpow_neg]
                congr 2
                push_cast [Nat.cast_sub (show l ≤ i + d by omega)]
                ring
            rw [hrefl]
            push_cast
            rw [← Finset.prod_mul_distrib]
            refine Finset.prod_congr rfl (fun s _ => ?_)
            have h2s : (2 : ℝ) ^ s ≠ 0 := by positivity
            field_simp
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 257–276 at b88a90ea8e90 ↗

      1. residue_integral.hD1.hrefl have ∏ l ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) = ∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ s)⁻¹)

        Leaves (∏ l ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ)))) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), -(2 : ℤ) ^ s) : ℝ) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ), with hrefl : ∏ l ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) = ∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ s)⁻¹).

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_nbij' Reorder a product. .

        Lean, lines 258–269
              have hrefl : ∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ∏ s ∈ Finset.Icc 1 (i + d - 1), (1 - ((2 : ℝ) ^ s)⁻¹) := by
                refine Finset.prod_nbij' (fun l => i + d - l) (fun s => i + d - s) ?_ ?_ ?_ ?_ ?_
                · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
                · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
                · intro l hl; simp only [Finset.mem_Icc] at hl; omega
                · intro l hl; simp only [Finset.mem_Icc] at hl; omega
                · intro l hl
                  simp only [Finset.mem_Icc] at hl
                  rw [← zpow_natCast, ← zpow_neg]
                  congr 2
                  push_cast [Nat.cast_sub (show l ≤ i + d by omega)]
                  ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 258–269 at b88a90ea8e90 ↗

        1. residue_integral.hD1.hrefl.s1 case

          Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), i + d - a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)).

          Uses library Finset.mem_Icc.

          Lean, line 260
                  · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 260 at b88a90ea8e90 ↗

        2. residue_integral.hD1.hrefl.s2 case

          Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), i + d - a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)).

          Uses library Finset.mem_Icc.

          Lean, line 261
                  · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 261 at b88a90ea8e90 ↗

        3. residue_integral.hD1.hrefl.s3 case

          Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), i + d - (i + d - a) = a.

          Uses library Finset.mem_Icc.

          Lean, line 262
                  · intro l hl; simp only [Finset.mem_Icc] at hl; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 262 at b88a90ea8e90 ↗

        4. residue_integral.hD1.hrefl.s4 case

          Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), i + d - (i + d - a) = a.

          Uses library Finset.mem_Icc.

          Lean, line 263
                  · intro l hl; simp only [Finset.mem_Icc] at hl; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 263 at b88a90ea8e90 ↗

        5. residue_integral.hD1.hrefl.s5 case

          Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), (1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - (↑(i + d) : ℤ)) = (1 : ℝ) - ((2 : ℝ) ^ (i + d - a))⁻¹.

          Uses library Finset.mem_Icc, zpow_natCast, zpow_neg, Nat.cast_sub.

          Lean, lines 264–269
                  · intro l hl
                    simp only [Finset.mem_Icc] at hl
                    rw [← zpow_natCast, ← zpow_neg]
                    congr 2
                    push_cast [Nat.cast_sub (show l ≤ i + d by omega)]
                    ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 264–269 at b88a90ea8e90 ↗

      2. residue_integral.hD1.h2s have (2 : ℝ) ^ s ≠ (0 : ℝ) routine: positivity

        Leaves ((1 : ℝ) - ((2 : ℝ) ^ s)⁻¹) * -(2 : ℝ) ^ s = (1 : ℝ) - (2 : ℝ) ^ s, with h2s : (2 : ℝ) ^ s ≠ (0 : ℝ).

        Lean, line 274
              have h2s : (2 : ℝ) ^ s ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 274 at b88a90ea8e90 ↗

    11. residue_integral.hD2 have ∏ l ∈ Finset.Icc (i + d + (1 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hD2 : ∏ l ∈ Finset.Icc (i + d + (1 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_nbij' Reorder a product. .

      Lean, lines 277–289
          have hD2 : ∏ l ∈ Finset.Icc (i + d + 1) n, (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
            push_cast
            refine Finset.prod_nbij' (fun l => l - (i + d)) (fun s => s + (i + d)) ?_ ?_ ?_ ?_ ?_
            · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl; omega
            · intro l hl; simp only [Finset.mem_Icc] at hl; omega
            · intro l hl
              simp only [Finset.mem_Icc] at hl
              rw [← zpow_natCast]
              congr 2
              push_cast [Nat.cast_sub (show i + d ≤ l by omega)]
              ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 277–289 at b88a90ea8e90 ↗

      1. residue_integral.hD2.s1 case

        Leaves ∀ a ∈ Finset.Icc (i + d + (1 : ℕ)) n, a - (i + d) ∈ Finset.Icc (1 : ℕ) (n - (i + d)).

        Uses library Finset.mem_Icc.

        Lean, line 280
              · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 280 at b88a90ea8e90 ↗

      2. residue_integral.hD2.s2 case

        Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (n - (i + d)), a + (i + d) ∈ Finset.Icc (i + d + (1 : ℕ)) n.

        Uses library Finset.mem_Icc.

        Lean, line 281
              · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 281 at b88a90ea8e90 ↗

      3. residue_integral.hD2.s3 case

        Leaves ∀ a ∈ Finset.Icc (i + d + (1 : ℕ)) n, a - (i + d) + (i + d) = a.

        Uses library Finset.mem_Icc.

        Lean, line 282
              · intro l hl; simp only [Finset.mem_Icc] at hl; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 282 at b88a90ea8e90 ↗

      4. residue_integral.hD2.s4 case

        Leaves ∀ a ∈ Finset.Icc (1 : ℕ) (n - (i + d)), a + (i + d) - (i + d) = a.

        Uses library Finset.mem_Icc.

        Lean, line 283
              · intro l hl; simp only [Finset.mem_Icc] at hl; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 283 at b88a90ea8e90 ↗

      5. residue_integral.hD2.s5 case

        Leaves ∀ a ∈ Finset.Icc (i + d + (1 : ℕ)) n, (1 : ℝ) - (2 : ℝ) ^ ((↑a : ℤ) - ((↑i : ℤ) + (↑d : ℤ))) = (1 : ℝ) - (2 : ℝ) ^ (a - (i + d)).

        Uses library Finset.mem_Icc, zpow_natCast, Nat.cast_sub.

        Lean, lines 284–289
              · intro l hl
                simp only [Finset.mem_Icc] at hl
                rw [← zpow_natCast]
                congr 2
                push_cast [Nat.cast_sub (show i + d ≤ l by omega)]
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 284–289 at b88a90ea8e90 ↗

    12. residue_integral.s12 obtain ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (d + (n - (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with z1 : ℤ, hz1 : ∏ s ∈ Finset.Icc (1 : ℕ) (d + (n - (1 : ℕ))), ((1 : ℤ) - (2 : ℤ) ^ s) = z1 * ((∏ s ∈ Finset.Icc (1 : ℕ) d, ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)).

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

      Lean, line 290
          obtain ⟨z1, hz1⟩ := hG _ d (n - 1) rfl

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 290 at b88a90ea8e90 ↗

    13. residue_integral.s13 obtain ∃ (z : ℤ), ∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ) + (n - (i + d))), ((1 : ℤ) - (2 : ℤ) ^ s) = z * ((∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with z2 : ℤ, hz2 : ∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ) + (n - (i + d))), ((1 : ℤ) - (2 : ℤ) ^ s) = z2 * ((∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)).

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

      Lean, line 291
          obtain ⟨z2, hz2⟩ := hG _ (i + d - 1) (n - (i + d)) rfl

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 291 at b88a90ea8e90 ↗

    14. residue_integral.hNZ have ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = z1 * z2 * ((∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hNZ : ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d)) = z1 * z2 * ((∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) * ∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)).

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

      Lean, lines 293–296
          have hNZ : (∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d))) = z1 * z2 * ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s))) := by
            apply mul_left_cancel₀ (hQne d)
            rw [hN (n - 1) d, hz1, hz2]
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 293–296 at b88a90ea8e90 ↗

    15. residue_integral.hNZ' have (↑(∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d))) : ℝ) = (↑z1 : ℝ) * (↑z2 : ℝ) * ((↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hNZ' : (↑(∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ (t + d))) : ℝ) = (↑z1 : ℝ) * (↑z2 : ℝ) * ((↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ)).

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

      Lean, lines 297–298
          have hNZ' : ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) = (z1 : ℝ) * z2 * (((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ)) := by
            exact_mod_cast hNZ

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 297–298 at b88a90ea8e90 ↗

    16. residue_integral.hQ1 have (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) ≠ (0 : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hQ1 : (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) ≠ (0 : ℝ).

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

      Lean, line 299
          have hQ1 : ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 299 at b88a90ea8e90 ↗

    17. residue_integral.hQ2 have (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) ≠ (0 : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hQ2 : (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) ≠ (0 : ℝ).

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

      Lean, line 300
          have hQ2 : ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 300 at b88a90ea8e90 ↗

    18. residue_integral.hDr have (∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ)))) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), -(2 : ℤ) ^ s) : ℝ) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hDr : (∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ)))) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), -(2 : ℤ) ^ s) : ℝ) = (↑(∏ s ∈ Finset.Icc (1 : ℕ) (i + d - (1 : ℕ)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ) * (↑(∏ s ∈ Finset.Icc (1 : ℕ) (n - (i + d)), ((1 : ℤ) - (2 : ℤ) ^ s)) : ℝ).

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

      Lean, lines 301–303
          have hDr : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
            rw [hset, Finset.prod_union hdisj, hD2, ← hD1]
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 301–303 at b88a90ea8e90 ↗

    19. residue_integral.hDne have ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) ≠ (0 : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d)))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))), with hDne : ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase (i + d), ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑(i + d) : ℤ))) ≠ (0 : ℝ).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , MulZeroClass.zero_mul Zero is a left absorbing element for multiplication , mul_ne_zero.

      Lean, lines 304–307
          have hDne : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) ≠ 0 := by
            intro h0
            rw [h0, zero_mul] at hDr
            exact mul_ne_zero hQ1 hQ2 hDr.symm

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 304–307 at b88a90ea8e90 ↗

  10. polypart_integral have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with polypart_integral : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹).

    Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.mul_sum, Finset.sum_sub_distrib, sub_mul Alias of mul_sub_right_distrib. , Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.sum_comm, Exists.intro Existential introduction. .

    Lean, lines 312–397
      have polypart_integral : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) - (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
        intro n hn
        obtain ⟨α, hα⟩ := hpoly n hn
        obtain ⟨D, hD⟩ : ∃ D : ℕ → ℝ, ∀ k, D k = ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := ⟨fun k => _, fun k => rfl⟩
        have hA : ∀ (x : ℝ) (k : ℕ), ∏ t ∈ Finset.Icc 1 (n - 1), (1 - x * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * (x * 2 ^ k) ^ j := by
          intro x k
          rw [← hα]
          refine Finset.prod_congr rfl (fun t _ => ?_)
          rw [pow_add]; ring
        simp only [← hD, hA]
        -- (a) one double sum
        have hswap : ∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ k ∈ Finset.Icc 1 n, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ := by
          simp only [Finset.sum_mul]
          refine Finset.sum_comm' (fun i k => ?_)
          simp only [Finset.mem_Icc]
          omega
        rw [hswap]
        simp only [Finset.mul_sum]
        rw [← Finset.sum_sub_distrib]
        simp only [← Finset.sum_sub_distrib, ← sub_mul]
        -- (b) per (k, i)
        have hb : ∀ (k i : ℕ), 1 ≤ i → (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s))) / D k := by
          intro k i hi
          have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
          have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
            have : (2 : ℝ) ≤ 2 ^ i := by
              calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi
            intro h0
            linarith
          have hch : (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹ := by
            rw [show (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) = ((2 : ℝ) ^ i)⁻¹ * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) by field_simp, mul_assoc, mul_inv_cancel₀ hne, mul_one]
          have hj : ∀ j : ℕ, ((((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s) := by
            intro j
            have hg := geom_sum₂_mul (8 / 3 : ℝ) (((2 : ℝ) ^ i)⁻¹) j
            have hg' : (((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - 1 - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) := by
              linear_combination hg
            rw [hg', mul_assoc, hch, Finset.sum_mul]
            refine Finset.sum_congr rfl (fun s hs => ?_)
            have hs' := Finset.mem_range.mp hs
            rw [mul_assoc, ← pow_succ, show j - 1 - s + 1 = j - s by omega]
          have e1 : (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j - ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) / D k := by
            ring
          rw [e1, ← Finset.sum_sub_distrib, Finset.sum_mul]
          congr 1
          refine Finset.sum_congr rfl (fun j _ => ?_)
          rw [← Finset.mul_sum, ← hj j, mul_pow, mul_pow]
          ring
        -- (c) sum over i
        have hc : ∀ k : ℕ, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - 1) := by
          intro k
          rw [Finset.sum_congr rfl (fun i hi => hb k i (Finset.mem_Icc.mp hi).1), ← Finset.sum_div, Finset.sum_comm, Finset.sum_div]
          refine Finset.sum_congr rfl (fun j _ => ?_)
          rw [Finset.sum_comm, Finset.sum_div]
          refine Finset.sum_congr rfl (fun s hs => ?_)
          have hs' := Finset.mem_range.mp hs
          rw [Finset.sum_congr rfl (fun i _ => (mul_assoc _ _ _).symm), ← Finset.mul_sum, hgeo (j - s) (by omega) k]
          have hjs : ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s) := by
            rw [← pow_add]; congr 1; omega
          have hZ : ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = 1 := mul_inv_cancel₀ (by positivity)
          rw [hjs]
          linear_combination (-((α j : ℝ) * ((2 : ℝ) ^ k) ^ s * (8 / 3 : ℝ) ^ s / ((2 : ℝ) ^ (j - s) - 1) / D k)) * hZ
        rw [Finset.sum_congr rfl (fun k _ => hc k), Finset.sum_comm, Finset.mul_sum]
        refine hsumZ _ _ (fun j hj => ?_)
        rw [Finset.sum_comm, Finset.mul_sum]
        refine hsumZ _ _ (fun s hs => ?_)
        have hj' := Finset.mem_range.mp hj
        have hs' := Finset.mem_range.mp hs
        obtain ⟨wj, hwj⟩ := hW _ (Finset.Icc 1 n) j rfl
        obtain ⟨ws, hws⟩ := hW _ (Finset.Icc 1 n) s rfl
        obtain ⟨q, hq⟩ := hdvd n (j - s) (by omega) (by omega)
        have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ (j - s) - 1) * q := by exact_mod_cast hq
        have hB : (2 : ℝ) ^ (j - s) - 1 ≠ 0 := by
          have : (2 : ℝ) ≤ 2 ^ (j - s) := by
            calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
              _ ≤ 2 ^ (j - s) := pow_le_pow_right₀ (by norm_num) (by omega)
          linarith
        have h3 : (3 : ℝ) ^ n = 3 ^ (n - s) * 3 ^ s := by rw [← pow_add]; congr 1; omega
        have h83 : (8 / 3 : ℝ) ^ s * 3 ^ s = 8 ^ s := by rw [← mul_pow]; norm_num
        refine ⟨3 ^ (n - s) * 8 ^ s * q * α j * (wj - ws), ?_⟩
        simp only [← hD] at hwj hws
        push_cast
        rw [hwj, hws, hqR, h3, ← h83, ← Finset.sum_sub_distrib]
        rw [Finset.mul_sum, Finset.mul_sum]
        refine Finset.sum_congr rfl (fun k _ => ?_)
        field_simp

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 312–397 at b88a90ea8e90 ↗

    1. polypart_integral.s1 obtain ∃ (α : ℕ → ℤ), ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with α : ℕ → ℤ, hα : ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j.

      Lean, line 314
          obtain ⟨α, hα⟩ := hpoly n hn

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 314 at b88a90ea8e90 ↗

    2. polypart_integral.s2 obtain ∃ (D : ℕ → ℝ), ∀ (k : ℕ), D k = ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with D : ℕ → ℝ, hD : ∀ (k : ℕ), D k = ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, line 315
          obtain ⟨D, hD⟩ : ∃ D : ℕ → ℝ, ∀ k, D k = ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := ⟨fun k => _, fun k => rfl⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 315 at b88a90ea8e90 ↗

    3. polypart_integral.hA have ∀ (x : ℝ) (k : ℕ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - x * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (x * (2 : ℝ) ^ k) ^ j

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with hA : ∀ (x : ℝ) (k : ℕ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - x * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (x * (2 : ℝ) ^ k) ^ j.

      Uses library Finset.Icc 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_congr, rfl rfl : a = a is the unique constructor of the equality type. , pow_add.

      Lean, lines 316–320
          have hA : ∀ (x : ℝ) (k : ℕ), ∏ t ∈ Finset.Icc 1 (n - 1), (1 - x * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * (x * 2 ^ k) ^ j := by
            intro x k
            rw [← hα]
            refine Finset.prod_congr rfl (fun t _ => ?_)
            rw [pow_add]; ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 316–320 at b88a90ea8e90 ↗

    4. polypart_integral.hswap have ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ k ∈ Finset.Icc (1 : ℕ) n, ∑ i ∈ Finset.Icc (1 : ℕ) k, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ x ∈ Finset.Icc (1 : ℕ) n, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ x) ^ j) / D x * ∑ i ∈ Finset.Icc (1 : ℕ) x, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ x ∈ Finset.Icc (1 : ℕ) n, (∑ x_1 ∈ Finset.Icc x n, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ x)⁻¹ * (2 : ℝ) ^ x_1) ^ j) / D x_1) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ x)⁻¹), with hswap : ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ k ∈ Finset.Icc (1 : ℕ) n, ∑ i ∈ Finset.Icc (1 : ℕ) k, (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

      Uses library Finset.Icc 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_mul, Finset.sum_comm' Generalization of Finset.sum_comm to the case when the inner Finsets depend on the outer variable. , Finset.mem_Icc.

      Lean, lines 323–327
          have hswap : ∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ k ∈ Finset.Icc 1 n, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ := by
            simp only [Finset.sum_mul]
            refine Finset.sum_comm' (fun i k => ?_)
            simp only [Finset.mem_Icc]
            omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 323–327 at b88a90ea8e90 ↗

    5. polypart_integral.hb have ∀ (k i : ℕ), (1 : ℕ) ≤ i → ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, ∑ x_1 ∈ Finset.Icc (1 : ℕ) x, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ x) ^ j) / D x - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ x_1)⁻¹ * (2 : ℝ) ^ x) ^ j) / D x) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ x_1)⁻¹, with hb : ∀ (k i : ℕ), (1 : ℕ) ≤ i → ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k.

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

      Lean, lines 333–359
          have hb : ∀ (k i : ℕ), 1 ≤ i → (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s))) / D k := by
            intro k i hi
            have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
            have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
              have : (2 : ℝ) ≤ 2 ^ i := by
                calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                  _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi
              intro h0
              linarith
            have hch : (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹ := by
              rw [show (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) = ((2 : ℝ) ^ i)⁻¹ * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) by field_simp, mul_assoc, mul_inv_cancel₀ hne, mul_one]
            have hj : ∀ j : ℕ, ((((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s) := by
              intro j
              have hg := geom_sum₂_mul (8 / 3 : ℝ) (((2 : ℝ) ^ i)⁻¹) j
              have hg' : (((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - 1 - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) := by
                linear_combination hg
              rw [hg', mul_assoc, hch, Finset.sum_mul]
              refine Finset.sum_congr rfl (fun s hs => ?_)
              have hs' := Finset.mem_range.mp hs
              rw [mul_assoc, ← pow_succ, show j - 1 - s + 1 = j - s by omega]
            have e1 : (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j - ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) / D k := by
              ring
            rw [e1, ← Finset.sum_sub_distrib, Finset.sum_mul]
            congr 1
            refine Finset.sum_congr rfl (fun j _ => ?_)
            rw [← Finset.mul_sum, ← hj j, mul_pow, mul_pow]
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 333–359 at b88a90ea8e90 ↗

      1. polypart_integral.hb.h2i have (2 : ℝ) ^ i ≠ (0 : ℝ) routine: positivity

        Leaves ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k, with h2i : (2 : ℝ) ^ i ≠ (0 : ℝ).

        Lean, line 335
              have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 335 at b88a90ea8e90 ↗

      2. polypart_integral.hb.hne have (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ)

        Leaves ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k, with hne : (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ).

        Lean, lines 336–341
              have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
                have : (2 : ℝ) ≤ 2 ^ i := by
                  calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                    _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi
                intro h0
                linarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 336–341 at b88a90ea8e90 ↗

        1. polypart_integral.hb.hne.this have (2 : ℝ) ≤ (2 : ℝ) ^ i

          Leaves (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ i.

          Lean, lines 337–339
                  have : (2 : ℝ) ≤ 2 ^ i := by
                    calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                      _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 337–339 at b88a90ea8e90 ↗

          1. polypart_integral.hb.hne.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ)

            Closes the goal.

            Uses library pow_one.

            Lean, line 338
                      calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 338 at b88a90ea8e90 ↗

          2. polypart_integral.hb.hne.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ i

            Closes the goal.

            Uses library pow_le_pow_right₀.

            Lean, line 339
                        _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 339 at b88a90ea8e90 ↗

      3. polypart_integral.hb.hch have (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹

        Leaves ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k, with hch : (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹.

        Uses library mul_assoc, mul_inv_cancel₀, mul_one.

        Lean, lines 342–343
              have hch : (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹ := by
                rw [show (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) = ((2 : ℝ) ^ i)⁻¹ * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) by field_simp, mul_assoc, mul_inv_cancel₀ hne, mul_one]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 342–343 at b88a90ea8e90 ↗

      4. polypart_integral.hb.hj have ∀ (j : ℕ), (((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s)

        Leaves ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k, with hj : ∀ (j : ℕ), (((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s).

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

        Lean, lines 344–352
              have hj : ∀ j : ℕ, ((((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s) := by
                intro j
                have hg := geom_sum₂_mul (8 / 3 : ℝ) (((2 : ℝ) ^ i)⁻¹) j
                have hg' : (((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - 1 - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) := by
                  linear_combination hg
                rw [hg', mul_assoc, hch, Finset.sum_mul]
                refine Finset.sum_congr rfl (fun s hs => ?_)
                have hs' := Finset.mem_range.mp hs
                rw [mul_assoc, ← pow_succ, show j - 1 - s + 1 = j - s by omega]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 344–352 at b88a90ea8e90 ↗

        1. polypart_integral.hb.hj.hg have (∑ i_1 ∈ Finset.range j, (8 / 3 : ℝ) ^ i_1 * ((2 : ℝ) ^ i)⁻¹ ^ (j - (1 : ℕ) - i_1)) * ((8 / 3 : ℝ) - ((2 : ℝ) ^ i)⁻¹) = (8 / 3 : ℝ) ^ j - ((2 : ℝ) ^ i)⁻¹ ^ j

          Leaves (((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s), with hg : (∑ i_1 ∈ Finset.range j, (8 / 3 : ℝ) ^ i_1 * ((2 : ℝ) ^ i)⁻¹ ^ (j - (1 : ℕ) - i_1)) * ((8 / 3 : ℝ) - ((2 : ℝ) ^ i)⁻¹) = (8 / 3 : ℝ) ^ j - ((2 : ℝ) ^ i)⁻¹ ^ j.

          Uses library geom_sum₂_mul.

          Lean, line 346
                  have hg := geom_sum₂_mul (8 / 3 : ℝ) (((2 : ℝ) ^ i)⁻¹) j

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 346 at b88a90ea8e90 ↗

        2. polypart_integral.hb.hj.hg' have ((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - (1 : ℕ) - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ))

          Leaves (((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s), with hg' : ((2 : ℝ) ^ i)⁻¹ ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - (1 : ℕ) - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)).

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

          Lean, lines 347–348
                  have hg' : (((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - 1 - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) := by
                    linear_combination hg

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 347–348 at b88a90ea8e90 ↗

        3. polypart_integral.hb.hj.hs' have s < j

          Leaves (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - (1 : ℕ) - s) * ((2 : ℝ) ^ i)⁻¹ = (8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s), with hs' : s < j.

          Uses library Finset.mem_range.

          Lean, line 351
                  have hs' := Finset.mem_range.mp hs

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 351 at b88a90ea8e90 ↗

      5. polypart_integral.hb.e1 have ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j - ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ / D k routine: ring

        Leaves ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ i)⁻¹ ^ (j - s))) / D k, with e1 : ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j - ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ / D k.

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

        Lean, lines 353–354
              have e1 : (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j - ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) / D k := by
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 353–354 at b88a90ea8e90 ↗

    6. polypart_integral.hc have ∀ (k : ℕ), ∑ i ∈ Finset.Icc (1 : ℕ) k, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - (1 : ℝ))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, ∑ x_1 ∈ Finset.Icc (1 : ℕ) x, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ x) ^ j) / D x - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ x_1)⁻¹ * (2 : ℝ) ^ x) ^ j) / D x) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ x_1)⁻¹, with hc : ∀ (k : ℕ), ∑ i ∈ Finset.Icc (1 : ℕ) k, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / D k - (-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * (((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ k) ^ j) / D k) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)).

      Uses library Finset.Icc 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. , Finset.mem_Icc, Finset.sum_div, Finset.sum_comm, mul_assoc, Finset.mul_sum.

      Lean, lines 361–373
          have hc : ∀ k : ℕ, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - 1) := by
            intro k
            rw [Finset.sum_congr rfl (fun i hi => hb k i (Finset.mem_Icc.mp hi).1), ← Finset.sum_div, Finset.sum_comm, Finset.sum_div]
            refine Finset.sum_congr rfl (fun j _ => ?_)
            rw [Finset.sum_comm, Finset.sum_div]
            refine Finset.sum_congr rfl (fun s hs => ?_)
            have hs' := Finset.mem_range.mp hs
            rw [Finset.sum_congr rfl (fun i _ => (mul_assoc _ _ _).symm), ← Finset.mul_sum, hgeo (j - s) (by omega) k]
            have hjs : ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s) := by
              rw [← pow_add]; congr 1; omega
            have hZ : ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = 1 := mul_inv_cancel₀ (by positivity)
            rw [hjs]
            linear_combination (-((α j : ℝ) * ((2 : ℝ) ^ k) ^ s * (8 / 3 : ℝ) ^ s / ((2 : ℝ) ^ (j - s) - 1) / D k)) * hZ

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 361–373 at b88a90ea8e90 ↗

      1. polypart_integral.hc.hs' have s < j

        Leaves (∑ x ∈ Finset.Icc (1 : ℕ) k, (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * ((2 : ℝ) ^ x)⁻¹ ^ (j - s))) / D k = (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hs' : s < j.

        Uses library Finset.mem_range.

        Lean, line 367
              have hs' := Finset.mem_range.mp hs

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 367 at b88a90ea8e90 ↗

      2. polypart_integral.hc.hjs have ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s)

        Leaves (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * (8 / 3 : ℝ) ^ s * (((1 : ℝ) - (((2 : ℝ) ^ k) ^ (j - s))⁻¹) / ((2 : ℝ) ^ (j - s) - (1 : ℝ))) / D k = (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hjs : ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s).

        Uses library pow_add.

        Lean, lines 369–370
              have hjs : ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s) := by
                rw [← pow_add]; congr 1; omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 369–370 at b88a90ea8e90 ↗

      3. polypart_integral.hc.hZ have ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = (1 : ℝ)

        Leaves (↑(α j) : ℝ) * ((2 : ℝ) ^ k) ^ j * (8 / 3 : ℝ) ^ s * (((1 : ℝ) - (((2 : ℝ) ^ k) ^ (j - s))⁻¹) / ((2 : ℝ) ^ (j - s) - (1 : ℝ))) / D k = (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hZ : ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = (1 : ℝ).

        Uses library mul_inv_cancel₀.

        Lean, line 371
              have hZ : ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = 1 := mul_inv_cancel₀ (by positivity)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 371 at b88a90ea8e90 ↗

    7. polypart_integral.hj' have j < n

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hj' : j < n.

      Uses library Finset.mem_range.

      Lean, line 378
          have hj' := Finset.mem_range.mp hj

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 378 at b88a90ea8e90 ↗

    8. polypart_integral.hs' have s < j

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hs' : s < j.

      Uses library Finset.mem_range.

      Lean, line 379
          have hs' := Finset.mem_range.mp hs

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 379 at b88a90ea8e90 ↗

    9. polypart_integral.s9 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ j / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with wj : ℤ, hwj : (↑wj : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ j / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, line 380
          obtain ⟨wj, hwj⟩ := hW _ (Finset.Icc 1 n) j rfl

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 380 at b88a90ea8e90 ↗

    10. polypart_integral.s10 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ s / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with ws : ℤ, hws : (↑ws : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ s / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , rfl rfl : a = a is the unique constructor of the equality type. .

      Lean, line 381
          obtain ⟨ws, hws⟩ := hW _ (Finset.Icc 1 n) s rfl

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 381 at b88a90ea8e90 ↗

    11. polypart_integral.s11 obtain (2 : ℤ) ^ (j - s) - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with q : ℤ, hq : ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k) = ((2 : ℤ) ^ (j - s) - (1 : ℤ)) * q.

      Lean, line 382
          obtain ⟨q, hq⟩ := hdvd n (j - s) (by omega) (by omega)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 382 at b88a90ea8e90 ↗

    12. polypart_integral.hqR have ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k) = ((2 : ℝ) ^ (j - s) - (1 : ℝ)) * (↑q : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hqR : ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k) = ((2 : ℝ) ^ (j - s) - (1 : ℝ)) * (↑q : ℝ).

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

      Lean, line 383
          have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ (j - s) - 1) * q := by exact_mod_cast hq

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 383 at b88a90ea8e90 ↗

    13. polypart_integral.hB have (2 : ℝ) ^ (j - s) - (1 : ℝ) ≠ (0 : ℝ)

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with hB : (2 : ℝ) ^ (j - s) - (1 : ℝ) ≠ (0 : ℝ).

      Lean, lines 384–388
          have hB : (2 : ℝ) ^ (j - s) - 1 ≠ 0 := by
            have : (2 : ℝ) ≤ 2 ^ (j - s) := by
              calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                _ ≤ 2 ^ (j - s) := pow_le_pow_right₀ (by norm_num) (by omega)
            linarith

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 384–388 at b88a90ea8e90 ↗

      1. polypart_integral.hB.this have (2 : ℝ) ≤ (2 : ℝ) ^ (j - s)

        Leaves (2 : ℝ) ^ (j - s) - (1 : ℝ) ≠ (0 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ (j - s).

        Lean, lines 385–387
              have : (2 : ℝ) ≤ 2 ^ (j - s) := by
                calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                  _ ≤ 2 ^ (j - s) := pow_le_pow_right₀ (by norm_num) (by omega)

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 385–387 at b88a90ea8e90 ↗

        1. polypart_integral.hB.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ)

          Closes the goal.

          Uses library pow_one.

          Lean, line 386
                  calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 386 at b88a90ea8e90 ↗

        2. polypart_integral.hB.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ (j - s)

          Closes the goal.

          Uses library pow_le_pow_right₀.

          Lean, line 387
                    _ ≤ 2 ^ (j - s) := pow_le_pow_right₀ (by norm_num) (by omega)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 387 at b88a90ea8e90 ↗

    14. polypart_integral.h3 have (3 : ℝ) ^ n = (3 : ℝ) ^ (n - s) * (3 : ℝ) ^ s

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with h3 : (3 : ℝ) ^ n = (3 : ℝ) ^ (n - s) * (3 : ℝ) ^ s.

      Uses library pow_add.

      Lean, line 389
          have h3 : (3 : ℝ) ^ n = 3 ^ (n - s) * 3 ^ s := by rw [← pow_add]; congr 1; omega

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 389 at b88a90ea8e90 ↗

    15. polypart_integral.h83 have (8 / 3 : ℝ) ^ s * (3 : ℝ) ^ s = (8 : ℝ) ^ s

      Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ x ∈ Finset.Icc (1 : ℕ) n, (↑(α j) : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ x) ^ j - ((2 : ℝ) ^ x) ^ s) / D x) / ((2 : ℝ) ^ (j - s) - (1 : ℝ)), with h83 : (8 / 3 : ℝ) ^ s * (3 : ℝ) ^ s = (8 : ℝ) ^ s.

      Uses library mul_pow.

      Lean, line 390
          have h83 : (8 / 3 : ℝ) ^ s * 3 ^ s = 8 ^ s := by rw [← mul_pow]; norm_num

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 390 at b88a90ea8e90 ↗

  11. head_integral have ∃ (a₁ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with head_integral : ∃ (a₁ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

    Uses library Nat.factorial Nat.factorial n is the factorial of n. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , Classical.choose Given that there exists an element satisfying p, returns one such element. , dif_pos, Classical.choose_spec.

    Lean, lines 398–454
      have head_integral : ∃ a₁ : ℕ → ℤ, ∀ n : ℕ, 1 ≤ n → (a₁ n : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
        have hsumZ0 : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
          intro s g
          induction s using Finset.induction_on with
          | empty => intro _; exact ⟨0, by simp⟩
          | insert a s ha ih =>
            intro h
            obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
            obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
            exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
        have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
          intro n hn
          obtain ⟨zE, hzE⟩ := polypart_integral n hn
          have hR : ∃ zR : ℤ, (zR : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) := by
            rw [Finset.mul_sum]
            refine hsumZ0 _ _ (fun i hi => ?_)
            have hi' := Finset.mem_Icc.mp hi
            obtain ⟨zb, hzb⟩ := residue_integral n i hi'.1 hi'.2
            refine ⟨zb * (3 * ∏ j ∈ (Finset.Icc 1 n).erase i, ((3 : ℤ) - 8 * 2 ^ j)), ?_⟩
            have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
              have : (2 : ℝ) ≤ 2 ^ i := by
                calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                  _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
              intro h0
              linarith
            have hsplit : (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) = (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) :=
              (Finset.mul_prod_erase _ (fun k => (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) hi).symm
            have he : ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc 1 n).erase i, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ (n - 1))⁻¹ := by
              rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem hi, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
            have h3 : (3 : ℝ) ^ n = 3 * 3 ^ (n - 1) := by
              rw [← pow_succ']; congr 1; omega
            have h3ne : (3 : ℝ) ^ (n - 1) ≠ 0 := by positivity
            obtain ⟨b, hb⟩ : ∃ b : ℝ, b = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := ⟨_, rfl⟩
            rw [← hb] at hzb ⊢
            push_cast
            rw [hzb, hsplit, he, h3]
            have hne' : (3 : ℝ) - 8 * 2 ^ i ≠ 0 := by
              intro h0
              apply hne
              linear_combination (1 / 3 : ℝ) * h0
            field_simp
          obtain ⟨zR, hzR⟩ := hR
          have hPZ : ∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) := by
            rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
              Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
            have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
            field_simp
          have h9 : (9 : ℝ) ^ n = 3 ^ n * 3 ^ n := by
            rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
          refine ⟨(Nat.factorial (n - 2) : ℤ) * ((∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * zE + 3 ^ n * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k)) * zR), ?_⟩
          push_cast
          rw [hzE, hzR, hPZ, h9]
          ring
        refine ⟨fun n => if h : 1 ≤ n then Classical.choose (hn n h) else 0, fun n hn' => ?_⟩
        simp only [dif_pos hn']
        exact Classical.choose_spec (hn n hn')

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 398–454 at b88a90ea8e90 ↗

    1. head_integral.hsumZ0 have ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

      Leaves ∃ (a₁ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with hsumZ0 : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g 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 399–407
          have hsumZ0 : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
            intro s g
            induction s using Finset.induction_on with
            | empty => intro _; exact ⟨0, by simp⟩
            | insert a s ha ih =>
              intro h
              obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
              obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
              exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 399–407 at b88a90ea8e90 ↗

      1. head_integral.hsumZ0.s1 case printed form did not read back: shown as its Lean lines only
      2. head_integral.hsumZ0.s2 case

        Leaves (∀ i ∈ insert a s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with a : ℕ, s : Finset ℕ, ha : a ∉ s, ih : (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i.

        Uses library Exists.intro Existential introduction. , Finset.sum_insert.

        Lean, lines 403–407
              | insert a s ha ih =>
                intro h
                obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
                obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
                exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 403–407 at b88a90ea8e90 ↗

        1. head_integral.hsumZ0.s2.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = g a

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with za : ℤ, hza : (↑za : ℝ) = g a.

          Uses library Finset.mem_insert_self.

          Lean, line 405
                  obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 405 at b88a90ea8e90 ↗

        2. head_integral.hsumZ0.s2.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with zs : ℤ, hzs : (↑zs : ℝ) = ∑ i ∈ s, g i.

          Uses library Finset.mem_insert_of_mem.

          Lean, line 406
                  obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 406 at b88a90ea8e90 ↗

    2. head_integral.hn have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

      Leaves ∃ (a₁ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with hn : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

      Uses library Nat.factorial Nat.factorial n is the factorial of n. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. .

      Lean, lines 408–451
          have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
            intro n hn
            obtain ⟨zE, hzE⟩ := polypart_integral n hn
            have hR : ∃ zR : ℤ, (zR : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) := by
              rw [Finset.mul_sum]
              refine hsumZ0 _ _ (fun i hi => ?_)
              have hi' := Finset.mem_Icc.mp hi
              obtain ⟨zb, hzb⟩ := residue_integral n i hi'.1 hi'.2
              refine ⟨zb * (3 * ∏ j ∈ (Finset.Icc 1 n).erase i, ((3 : ℤ) - 8 * 2 ^ j)), ?_⟩
              have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
                have : (2 : ℝ) ≤ 2 ^ i := by
                  calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                    _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
                intro h0
                linarith
              have hsplit : (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) = (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) :=
                (Finset.mul_prod_erase _ (fun k => (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) hi).symm
              have he : ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc 1 n).erase i, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ (n - 1))⁻¹ := by
                rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                  Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem hi, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
              have h3 : (3 : ℝ) ^ n = 3 * 3 ^ (n - 1) := by
                rw [← pow_succ']; congr 1; omega
              have h3ne : (3 : ℝ) ^ (n - 1) ≠ 0 := by positivity
              obtain ⟨b, hb⟩ : ∃ b : ℝ, b = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := ⟨_, rfl⟩
              rw [← hb] at hzb ⊢
              push_cast
              rw [hzb, hsplit, he, h3]
              have hne' : (3 : ℝ) - 8 * 2 ^ i ≠ 0 := by
                intro h0
                apply hne
                linear_combination (1 / 3 : ℝ) * h0
              field_simp
            obtain ⟨zR, hzR⟩ := hR
            have hPZ : ∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) := by
              rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
              have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
              field_simp
            have h9 : (9 : ℝ) ^ n = 3 ^ n * 3 ^ n := by
              rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
            refine ⟨(Nat.factorial (n - 2) : ℤ) * ((∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * zE + 3 ^ n * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k)) * zR), ?_⟩
            push_cast
            rw [hzE, hzR, hPZ, h9]
            ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 408–451 at b88a90ea8e90 ↗

      1. head_integral.hn.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with zE : ℤ, hzE : (↑zE : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹).

        Lean, line 410
              obtain ⟨zE, hzE⟩ := polypart_integral n hn

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 410 at b88a90ea8e90 ↗

      2. head_integral.hn.hR have ∃ (zR : ℤ), (↑zR : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with hR : ∃ (zR : ℤ), (↑zR : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.mul_sum, Exists.intro Existential introduction. .

        Lean, lines 411–439
              have hR : ∃ zR : ℤ, (zR : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) := by
                rw [Finset.mul_sum]
                refine hsumZ0 _ _ (fun i hi => ?_)
                have hi' := Finset.mem_Icc.mp hi
                obtain ⟨zb, hzb⟩ := residue_integral n i hi'.1 hi'.2
                refine ⟨zb * (3 * ∏ j ∈ (Finset.Icc 1 n).erase i, ((3 : ℤ) - 8 * 2 ^ j)), ?_⟩
                have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
                  have : (2 : ℝ) ≤ 2 ^ i := by
                    calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                      _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
                  intro h0
                  linarith
                have hsplit : (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) = (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) :=
                  (Finset.mul_prod_erase _ (fun k => (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) hi).symm
                have he : ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc 1 n).erase i, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ (n - 1))⁻¹ := by
                  rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                    Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem hi, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
                have h3 : (3 : ℝ) ^ n = 3 * 3 ^ (n - 1) := by
                  rw [← pow_succ']; congr 1; omega
                have h3ne : (3 : ℝ) ^ (n - 1) ≠ 0 := by positivity
                obtain ⟨b, hb⟩ : ∃ b : ℝ, b = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := ⟨_, rfl⟩
                rw [← hb] at hzb ⊢
                push_cast
                rw [hzb, hsplit, he, h3]
                have hne' : (3 : ℝ) - 8 * 2 ^ i ≠ 0 := by
                  intro h0
                  apply hne
                  linear_combination (1 / 3 : ℝ) * h0
                field_simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 411–439 at b88a90ea8e90 ↗

        1. head_integral.hn.hR.hi' have (1 : ℕ) ≤ i ∧ i ≤ n

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with hi' : (1 : ℕ) ≤ i ∧ i ≤ n.

          Uses library Finset.mem_Icc.

          Lean, line 414
                  have hi' := Finset.mem_Icc.mp hi

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 414 at b88a90ea8e90 ↗

        2. head_integral.hn.hR.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with zb : ℤ, hzb : (↑zb : ℝ) = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

          Lean, line 415
                  obtain ⟨zb, hzb⟩ := residue_integral n i hi'.1 hi'.2

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 415 at b88a90ea8e90 ↗

        3. head_integral.hn.hR.hne have (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ)

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with hne : (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ).

          Lean, lines 417–422
                  have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
                    have : (2 : ℝ) ≤ 2 ^ i := by
                      calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                        _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
                    intro h0
                    linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 417–422 at b88a90ea8e90 ↗

          1. head_integral.hn.hR.hne.this have (2 : ℝ) ≤ (2 : ℝ) ^ i

            Leaves (1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ i.

            Lean, lines 418–420
                      have : (2 : ℝ) ≤ 2 ^ i := by
                        calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                          _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 418–420 at b88a90ea8e90 ↗

            1. head_integral.hn.hR.hne.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ)

              Closes the goal.

              Uses library pow_one.

              Lean, line 419
                          calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 419 at b88a90ea8e90 ↗

            2. head_integral.hn.hR.hne.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ i

              Closes the goal.

              Uses library pow_le_pow_right₀.

              Lean, line 420
                            _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1

              targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 420 at b88a90ea8e90 ↗

        4. head_integral.hn.hR.hsplit have ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with hsplit : ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k).

          Uses library Finset.Icc 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 423–424
                  have hsplit : (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) = (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) :=
                    (Finset.mul_prod_erase _ (fun k => (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) hi).symm

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 423–424 at b88a90ea8e90 ↗

        5. head_integral.hn.hR.he have ∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ (n - (1 : ℕ)))⁻¹

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with he : ∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ (n - (1 : ℕ)))⁻¹.

          Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem $\#(s \setminus \{a\}) = \#s - 1$ if $a \in s$. , Nat.card_Icc, Nat.add_sub_cancel, inv_pow.

          Lean, lines 425–427
                  have he : ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc 1 n).erase i, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ (n - 1))⁻¹ := by
                    rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                      Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem hi, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 425–427 at b88a90ea8e90 ↗

        6. head_integral.hn.hR.h3 have (3 : ℝ) ^ n = (3 : ℝ) * (3 : ℝ) ^ (n - (1 : ℕ))

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with h3 : (3 : ℝ) ^ n = (3 : ℝ) * (3 : ℝ) ^ (n - (1 : ℕ)).

          Uses library pow_succ'.

          Lean, lines 428–429
                  have h3 : (3 : ℝ) ^ n = 3 * 3 ^ (n - 1) := by
                    rw [← pow_succ']; congr 1; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 428–429 at b88a90ea8e90 ↗

        7. head_integral.hn.hR.h3ne have (3 : ℝ) ^ (n - (1 : ℕ)) ≠ (0 : ℝ) routine: positivity

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with h3ne : (3 : ℝ) ^ (n - (1 : ℕ)) ≠ (0 : ℝ).

          Lean, line 430
                  have h3ne : (3 : ℝ) ^ (n - 1) ≠ 0 := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 430 at b88a90ea8e90 ↗

        8. head_integral.hn.hR.s8 obtain ∃ (b : ℝ), b = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

          Leaves (↑(zb * ((3 : ℤ) * ∏ j ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℤ) - (8 : ℤ) * (2 : ℤ) ^ j))) : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with b : ℝ, hb : b = ∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

          Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, line 431
                  obtain ⟨b, hb⟩ : ∃ b : ℝ, b = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := ⟨_, rfl⟩

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 431 at b88a90ea8e90 ↗

        9. head_integral.hn.hR.hne' have (3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ)

          Leaves b * ((3 : ℝ) * ∏ x ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ x)) = (3 : ℝ) * (3 : ℝ) ^ (n - (1 : ℕ)) * (((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ((∏ k ∈ (Finset.Icc (1 : ℕ) n).erase i, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ (n - (1 : ℕ)))⁻¹)) * (b * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹), with hne' : (3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ i ≠ (0 : ℝ).

          Lean, lines 435–438
                  have hne' : (3 : ℝ) - 8 * 2 ^ i ≠ 0 := by
                    intro h0
                    apply hne
                    linear_combination (1 / 3 : ℝ) * h0

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 435–438 at b88a90ea8e90 ↗

      3. head_integral.hn.s3 obtain ∃ (zR : ℤ), (↑zR : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with zR : ℤ, hzR : (↑zR : ℝ) = ((3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) n, (∑ k ∈ Finset.Icc i n, (-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

        Lean, line 440
              obtain ⟨zR, hzR⟩ := hR

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 440 at b88a90ea8e90 ↗

      4. head_integral.hn.hPZ have ∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k) = (3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with hPZ : ∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k) = (3 : ℝ) ^ n * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k).

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow.

        Lean, lines 441–445
              have hPZ : ∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) := by
                rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
                  Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
                have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
                field_simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 441–445 at b88a90ea8e90 ↗

        1. head_integral.hn.hPZ.h3n have (3 : ℝ) ^ n ≠ (0 : ℝ) routine: positivity

          Leaves ∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k) = (3 : ℝ) ^ n * ((∏ x ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ x)) * ((3 : ℝ) ^ n)⁻¹), with h3n : (3 : ℝ) ^ n ≠ (0 : ℝ).

          Lean, line 444
                  have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 444 at b88a90ea8e90 ↗

      5. head_integral.hn.h9 have (9 : ℝ) ^ n = (3 : ℝ) ^ n * (3 : ℝ) ^ n

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹, with h9 : (9 : ℝ) ^ n = (3 : ℝ) ^ n * (3 : ℝ) ^ n.

        Uses library mul_pow.

        Lean, lines 446–447
              have h9 : (9 : ℝ) ^ n = 3 ^ n * 3 ^ n := by
                rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 446–447 at b88a90ea8e90 ↗

  12. s12 obtain ∃ (a₁ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with a₁ : ℕ → ℤ, h₁ : ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₁ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹.

    Lean, line 455
      obtain ⟨a₁, h₁⟩ := head_integral

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 455 at b88a90ea8e90 ↗

  13. hmer have ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hmer : ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)).

    Uses library Nat.factorial Nat.factorial n is the factorial of n. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Exists.intro Existential introduction. , Classical.choose Given that there exists an element satisfying p, returns one such element. , dif_pos, Classical.choose_spec.

    Lean, lines 456–556
      have hmer : ∃ a₂ : ℕ → ℤ, ∀ n : ℕ, 1 ≤ n → (a₂ n : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ i ∈ Finset.Icc 1 (n - 1), (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - 1)) := by
        have key : ∀ n : ℕ, 1 ≤ n → ∀ i : ℕ, 1 ≤ i → i ≤ n - 1 → ∃ z : ℤ, (z : ℝ) = (3 : ℝ) ^ (n - 1 - i) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) := by
          intro n hn i hi1 hi2
          obtain ⟨α, hα⟩ := hpoly n hn
          have hA : ∀ k : ℕ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j := by
            intro k
            rw [← hα]
            refine Finset.prod_congr rfl (fun t _ => ?_)
            rw [pow_add]; ring
          simp only [hA]
          have e1 : ∑ k ∈ Finset.Icc 1 n, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc 1 n, (-(α j : ℝ)) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) := by
            rw [Finset.sum_comm]
            refine Finset.sum_congr rfl (fun k _ => ?_)
            rw [neg_div, neg_mul, Finset.sum_div, Finset.sum_mul, ← Finset.sum_neg_distrib]
            refine Finset.sum_congr rfl (fun j _ => ?_)
            ring
          rw [e1, Finset.mul_sum]
          refine hsumZ _ _ (fun j hj => ?_)
          have hj' := Finset.mem_range.mp hj
          rw [← Finset.mul_sum]
          have hcX : ∀ k : ℕ, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ≠ 0 := fun k => by positivity
          rcases lt_or_ge j i with hji | hji
          · refine ⟨0, ?_⟩
            have hvan : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc 1 n, (((2 : ℝ) ^ k) ^ (i - j - 1 + 1))⁻¹ / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
              rw [Finset.mul_sum]
              refine Finset.sum_congr rfl (fun k _ => ?_)
              have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
                rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
                  mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]
              rw [hk, mul_div_assoc, show i - j - 1 + 1 = i - j by omega]
            rw [hvan, hV (i - j - 1) (Finset.Icc 1 n) (by rw [Nat.card_Icc]; omega)]
            simp
          · obtain ⟨w, hw⟩ := hW _ (Finset.Icc 1 n) (j - i) rfl
            refine ⟨-(α j) * 3 ^ (n - 1 - j) * 8 ^ (j - i) * w, ?_⟩
            have hpos : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc 1 n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
              rw [Finset.mul_sum]
              refine Finset.sum_congr rfl (fun k _ => ?_)
              have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
                rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
                  mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]
              rw [hk, mul_div_assoc]
            have h3 : (3 : ℝ) ^ (n - 1 - i) = 3 ^ (n - 1 - j) * 3 ^ (j - i) := by rw [← pow_add]; congr 1; omega
            have h83 : (8 / 3 : ℝ) ^ (j - i) * 3 ^ (j - i) = 8 ^ (j - i) := by rw [← mul_pow]; norm_num
            push_cast
            rw [hpos, hw, h3, ← h83]
            ring
        have hW3 : ∀ n : ℕ, ∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ n)⁻¹ := by
          intro n
          rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
            Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
        have hdvd : ∀ n i : ℕ, 1 ≤ i → i ≤ n - 1 → ((2 : ℤ) ^ i - 1) ∣ ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k) := by
          intro n i hi1 hi2
          obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩
          have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i
          have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith
          have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))
          have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩
          have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
            have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
            rw [one_pow, ← pow_mul, ← hk0] at this
            exact this
          have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
            have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
            rw [this]; exact (dvd_neg).mpr h1
          exact h2.trans (Finset.dvd_prod_of_mem (fun k => (1 : ℤ) - 2 ^ k) hmem)
        have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
          intro s g
          induction s using Finset.induction_on with
          | empty => intro _; exact ⟨0, by simp⟩
          | insert a s ha ih =>
            intro h
            obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
            obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
            exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
        have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ i ∈ Finset.Icc 1 (n - 1), (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - 1)) := by
          intro n hn
          rw [Finset.mul_sum]
          refine hsumZ _ _ (fun i hi => ?_)
          have hi' := Finset.mem_Icc.mp hi
          obtain ⟨z1, hz1⟩ := key n hn i hi'.1 hi'.2
          obtain ⟨q, hq⟩ := hdvd n i hi'.1 hi'.2
          have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ i - 1) * q := by exact_mod_cast hq
          have h2i : (2 : ℝ) ^ i - 1 ≠ 0 := by
            have : (2 : ℝ) ≤ 2 ^ i := by
              calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
            linarith
          have h9 : (9 : ℝ) ^ n = 3 ^ (i + 1) * 3 ^ (n - 1 - i) * 3 ^ n := by
            rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
            congr 1
            rw [← pow_add]
            congr 1
            omega
          refine ⟨3 ^ (i + 1) * (Nat.factorial (n - 2) : ℤ) * (∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * q * z1, ?_⟩
          push_cast
          rw [hz1, hW3 n, hqR, h9]
          have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
          field_simp
        refine ⟨fun n => if h : 1 ≤ n then Classical.choose (hn n h) else 0, fun n hn' => ?_⟩
        simp only [dif_pos hn']
        exact Classical.choose_spec (hn n hn')

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 456–556 at b88a90ea8e90 ↗

    1. hmer.key have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∀ (i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹

      Leaves ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)), with key : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∀ (i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹.

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

      Lean, lines 457–501
          have key : ∀ n : ℕ, 1 ≤ n → ∀ i : ℕ, 1 ≤ i → i ≤ n - 1 → ∃ z : ℤ, (z : ℝ) = (3 : ℝ) ^ (n - 1 - i) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) := by
            intro n hn i hi1 hi2
            obtain ⟨α, hα⟩ := hpoly n hn
            have hA : ∀ k : ℕ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j := by
              intro k
              rw [← hα]
              refine Finset.prod_congr rfl (fun t _ => ?_)
              rw [pow_add]; ring
            simp only [hA]
            have e1 : ∑ k ∈ Finset.Icc 1 n, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc 1 n, (-(α j : ℝ)) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) := by
              rw [Finset.sum_comm]
              refine Finset.sum_congr rfl (fun k _ => ?_)
              rw [neg_div, neg_mul, Finset.sum_div, Finset.sum_mul, ← Finset.sum_neg_distrib]
              refine Finset.sum_congr rfl (fun j _ => ?_)
              ring
            rw [e1, Finset.mul_sum]
            refine hsumZ _ _ (fun j hj => ?_)
            have hj' := Finset.mem_range.mp hj
            rw [← Finset.mul_sum]
            have hcX : ∀ k : ℕ, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ≠ 0 := fun k => by positivity
            rcases lt_or_ge j i with hji | hji
            · refine ⟨0, ?_⟩
              have hvan : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc 1 n, (((2 : ℝ) ^ k) ^ (i - j - 1 + 1))⁻¹ / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                rw [Finset.mul_sum]
                refine Finset.sum_congr rfl (fun k _ => ?_)
                have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
                  rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
                    mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]
                rw [hk, mul_div_assoc, show i - j - 1 + 1 = i - j by omega]
              rw [hvan, hV (i - j - 1) (Finset.Icc 1 n) (by rw [Nat.card_Icc]; omega)]
              simp
            · obtain ⟨w, hw⟩ := hW _ (Finset.Icc 1 n) (j - i) rfl
              refine ⟨-(α j) * 3 ^ (n - 1 - j) * 8 ^ (j - i) * w, ?_⟩
              have hpos : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc 1 n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                rw [Finset.mul_sum]
                refine Finset.sum_congr rfl (fun k _ => ?_)
                have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
                  rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
                    mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]
                rw [hk, mul_div_assoc]
              have h3 : (3 : ℝ) ^ (n - 1 - i) = 3 ^ (n - 1 - j) * 3 ^ (j - i) := by rw [← pow_add]; congr 1; omega
              have h83 : (8 / 3 : ℝ) ^ (j - i) * 3 ^ (j - i) = 8 ^ (j - i) := by rw [← mul_pow]; norm_num
              push_cast
              rw [hpos, hw, h3, ← h83]
              ring

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 457–501 at b88a90ea8e90 ↗

      1. hmer.key.s1 obtain ∃ (α : ℕ → ℤ), ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹, with α : ℕ → ℤ, hα : ∀ (y : ℝ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * y ^ j.

        Lean, line 459
              obtain ⟨α, hα⟩ := hpoly n hn

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 459 at b88a90ea8e90 ↗

      2. hmer.key.hA have ∀ (k : ℕ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹, with hA : ∀ (k : ℕ), ∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j.

        Uses library Finset.Icc 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_congr, rfl rfl : a = a is the unique constructor of the equality type. , pow_add.

        Lean, lines 460–464
              have hA : ∀ k : ℕ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j := by
                intro k
                rw [← hα]
                refine Finset.prod_congr rfl (fun t _ => ?_)
                rw [pow_add]; ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 460–464 at b88a90ea8e90 ↗

      3. hmer.key.e1 have ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc (1 : ℕ) n, -(↑(α j) : ℝ) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))))

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ x ∈ Finset.Icc (1 : ℕ) n, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ x) ^ j) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase x, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑x : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ x) ^ i)⁻¹, with e1 : ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∑ j ∈ Finset.range n, (↑(α j) : ℝ) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc (1 : ℕ) n, -(↑(α j) : ℝ) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))).

        Uses library Finset.Icc 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_comm, Finset.sum_congr, rfl rfl : a = a is the unique constructor of the equality type. , neg_div, neg_mul, Finset.sum_div, Finset.sum_mul, Finset.sum_neg_distrib.

        Lean, lines 466–471
              have e1 : ∑ k ∈ Finset.Icc 1 n, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc 1 n, (-(α j : ℝ)) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) := by
                rw [Finset.sum_comm]
                refine Finset.sum_congr rfl (fun k _ => ?_)
                rw [neg_div, neg_mul, Finset.sum_div, Finset.sum_mul, ← Finset.sum_neg_distrib]
                refine Finset.sum_congr rfl (fun j _ => ?_)
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 466–471 at b88a90ea8e90 ↗

      4. hmer.key.hj' have j < n

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, -(↑(α j) : ℝ) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hj' : j < n.

        Uses library Finset.mem_range.

        Lean, line 474
              have hj' := Finset.mem_range.mp hj

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 474 at b88a90ea8e90 ↗

      5. hmer.key.hcX have ∀ (k : ℕ), (8 / 3 : ℝ) * (2 : ℝ) ^ k ≠ (0 : ℝ)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with hcX : ∀ (k : ℕ), (8 / 3 : ℝ) * (2 : ℝ) ^ k ≠ (0 : ℝ).

        Lean, line 476
              have hcX : ∀ k : ℕ, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ≠ 0 := fun k => by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 476 at b88a90ea8e90 ↗

      6. hmer.key.s6 case

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))).

        Uses library Exists.intro Existential introduction. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Nat.card_Icc.

        Lean, lines 478–487
              · refine ⟨0, ?_⟩
                have hvan : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc 1 n, (((2 : ℝ) ^ k) ^ (i - j - 1 + 1))⁻¹ / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                  rw [Finset.mul_sum]
                  refine Finset.sum_congr rfl (fun k _ => ?_)
                  have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
                    rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
                      mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]
                  rw [hk, mul_div_assoc, show i - j - 1 + 1 = i - j by omega]
                rw [hvan, hV (i - j - 1) (Finset.Icc 1 n) (by rw [Nat.card_Icc]; omega)]
                simp

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 478–487 at b88a90ea8e90 ↗

        1. hmer.key.s6.hvan have ∑ k ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc (1 : ℕ) n, (((2 : ℝ) ^ k) ^ (i - j - (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

          Leaves (↑(0 : ℤ) : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with hvan : ∑ k ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc (1 : ℕ) n, (((2 : ℝ) ^ k) ^ (i - j - (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

          Uses library Finset.Icc 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_div_assoc.

          Lean, lines 479–485
                  have hvan : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc 1 n, (((2 : ℝ) ^ k) ^ (i - j - 1 + 1))⁻¹ / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                    rw [Finset.mul_sum]
                    refine Finset.sum_congr rfl (fun k _ => ?_)
                    have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
                      rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
                        mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]
                    rw [hk, mul_div_assoc, show i - j - 1 + 1 = i - j by omega]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 479–485 at b88a90ea8e90 ↗

          1. hmer.key.s6.hvan.hk have ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹

            Leaves ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ((((2 : ℝ) ^ k) ^ (i - j - (1 : ℕ) + (1 : ℕ)))⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹.

            Uses library pow_add, mul_inv, mul_assoc, mul_inv_cancel₀, pow_ne_zero, one_mul, mul_pow.

            Lean, lines 482–484
                      have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
                        rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
                          mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 482–484 at b88a90ea8e90 ↗

      7. hmer.key.s7 case

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))).

        Uses library Exists.intro Existential introduction. .

        Lean, lines 488–501
              · obtain ⟨w, hw⟩ := hW _ (Finset.Icc 1 n) (j - i) rfl
                refine ⟨-(α j) * 3 ^ (n - 1 - j) * 8 ^ (j - i) * w, ?_⟩
                have hpos : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc 1 n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                  rw [Finset.mul_sum]
                  refine Finset.sum_congr rfl (fun k _ => ?_)
                  have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
                    rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
                      mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]
                  rw [hk, mul_div_assoc]
                have h3 : (3 : ℝ) ^ (n - 1 - i) = 3 ^ (n - 1 - j) * 3 ^ (j - i) := by rw [← pow_add]; congr 1; omega
                have h83 : (8 / 3 : ℝ) ^ (j - i) * 3 ^ (j - i) = 8 ^ (j - i) := by rw [← mul_pow]; norm_num
                push_cast
                rw [hpos, hw, h3, ← h83]
                ring

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 488–501 at b88a90ea8e90 ↗

        1. hmer.key.s7.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

          Leaves ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with w : ℤ, hw : (↑w : ℝ) = ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

          Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , rfl rfl : a = a is the unique constructor of the equality type. .

          Lean, line 488
                · obtain ⟨w, hw⟩ := hW _ (Finset.Icc 1 n) (j - i) rfl

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 488 at b88a90ea8e90 ↗

        2. hmer.key.s7.hpos have ∑ k ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))

          Leaves (↑(-α j * (3 : ℤ) ^ (n - (1 : ℕ) - j) * (8 : ℤ) ^ (j - i) * w) : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with hpos : ∑ k ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))).

          Uses library Finset.Icc 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_div_assoc.

          Lean, lines 490–496
                  have hpos : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc 1 n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
                    rw [Finset.mul_sum]
                    refine Finset.sum_congr rfl (fun k _ => ?_)
                    have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
                      rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
                        mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]
                    rw [hk, mul_div_assoc]

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 490–496 at b88a90ea8e90 ↗

          1. hmer.key.s7.hpos.hk have ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i)

            Leaves ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ))) = (8 / 3 : ℝ) ^ (j - i) * (((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))), with hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹ = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i).

            Uses library pow_add, mul_assoc, mul_inv_cancel₀, pow_ne_zero, mul_one, mul_pow.

            Lean, lines 493–495
                      have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
                        rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
                          mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 493–495 at b88a90ea8e90 ↗

        3. hmer.key.s7.h3 have (3 : ℝ) ^ (n - (1 : ℕ) - i) = (3 : ℝ) ^ (n - (1 : ℕ) - j) * (3 : ℝ) ^ (j - i)

          Leaves (↑(-α j * (3 : ℤ) ^ (n - (1 : ℕ) - j) * (8 : ℤ) ^ (j - i) * w) : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with h3 : (3 : ℝ) ^ (n - (1 : ℕ) - i) = (3 : ℝ) ^ (n - (1 : ℕ) - j) * (3 : ℝ) ^ (j - i).

          Uses library pow_add.

          Lean, line 497
                  have h3 : (3 : ℝ) ^ (n - 1 - i) = 3 ^ (n - 1 - j) * 3 ^ (j - i) := by rw [← pow_add]; congr 1; omega

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 497 at b88a90ea8e90 ↗

        4. hmer.key.s7.h83 have (8 / 3 : ℝ) ^ (j - i) * (3 : ℝ) ^ (j - i) = (8 : ℝ) ^ (j - i)

          Leaves (↑(-α j * (3 : ℤ) ^ (n - (1 : ℕ) - j) * (8 : ℤ) ^ (j - i) * w) : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * (-(↑(α j) : ℝ) * ∑ i_1 ∈ Finset.Icc (1 : ℕ) n, ((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ j * (((8 / 3 : ℝ) * (2 : ℝ) ^ i_1) ^ i)⁻¹ / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase i_1, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑i_1 : ℤ)))), with h83 : (8 / 3 : ℝ) ^ (j - i) * (3 : ℝ) ^ (j - i) = (8 : ℝ) ^ (j - i).

          Uses library mul_pow.

          Lean, line 498
                  have h83 : (8 / 3 : ℝ) ^ (j - i) * 3 ^ (j - i) = 8 ^ (j - i) := by rw [← mul_pow]; norm_num

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 498 at b88a90ea8e90 ↗

    2. hmer.hW3 have ∀ (n : ℕ), ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ n)⁻¹

      Leaves ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)), with hW3 : ∀ (n : ℕ), ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ n)⁻¹.

      Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.prod_congr, rfl rfl : a = a is the unique constructor of the equality type. , Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow.

      Lean, lines 502–505
          have hW3 : ∀ n : ℕ, ∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ n)⁻¹ := by
            intro n
            rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
              Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 502–505 at b88a90ea8e90 ↗

    3. hmer.hdvd have ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k)

      Leaves ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)), with hdvd : ∀ (n i : ℕ), (1 : ℕ) ≤ i → i ≤ n - (1 : ℕ) → (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k).

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

      Lean, lines 506–520
          have hdvd : ∀ n i : ℕ, 1 ≤ i → i ≤ n - 1 → ((2 : ℤ) ^ i - 1) ∣ ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k) := by
            intro n i hi1 hi2
            obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩
            have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i
            have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith
            have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))
            have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩
            have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
              have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
              rw [one_pow, ← pow_mul, ← hk0] at this
              exact this
            have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
              have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
              rw [this]; exact (dvd_neg).mpr h1
            exact h2.trans (Finset.dvd_prod_of_mem (fun k => (1 : ℤ) - 2 ^ k) hmem)

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 506–520 at b88a90ea8e90 ↗

      1. hmer.hdvd.s1 obtain ∃ (k0 : ℕ), k0 = i * (n / i)

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with k0 : ℕ, hk0 : k0 = i * (n / i).

        Uses library Exists.intro Existential introduction. , rfl rfl : a = a is the unique constructor of the equality type. .

        Lean, line 508
              obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 508 at b88a90ea8e90 ↗

      2. hmer.hdvd.hle have k0 ≤ n

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hle : k0 ≤ n.

        Uses library mul_comm, Nat.div_mul_le_self.

        Lean, line 509
              have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 509 at b88a90ea8e90 ↗

      3. hmer.hdvd.hlt have n < k0 + i

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hlt : n < k0 + i.

        Lean, line 510
              have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 510 at b88a90ea8e90 ↗

        1. hmer.hdvd.hlt.this have n < i * (n / i + (1 : ℕ))

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

          Uses library Nat.lt_mul_div_succ.

          Lean, line 510
                have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 510 at b88a90ea8e90 ↗

      4. hmer.hdvd.hge have i ≤ k0

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hge : i ≤ k0.

        Uses library Nat.le_mul_of_pos_right, Nat.div_pos.

        Lean, line 511
              have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 511 at b88a90ea8e90 ↗

      5. hmer.hdvd.hmem have k0 ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with hmem : k0 ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n.

        Uses library Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.mem_Icc, And.intro And.intro : a → b → a ∧ b is the constructor for the And operation. .

        Lean, line 512
              have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 512 at b88a90ea8e90 ↗

      6. hmer.hdvd.h1 have (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ)

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with h1 : (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ).

        Uses library one_pow, pow_mul.

        Lean, lines 513–516
              have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
                have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
                rw [one_pow, ← pow_mul, ← hk0] at this
                exact this

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 513–516 at b88a90ea8e90 ↗

        1. hmer.hdvd.h1.this have (2 : ℤ) ^ i - (1 : ℤ) ∣ ((2 : ℤ) ^ i) ^ (n / i) - (1 : ℤ) ^ (n / i)

          Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ (2 : ℤ) ^ k0 - (1 : ℤ), with this : (2 : ℤ) ^ i - (1 : ℤ) ∣ ((2 : ℤ) ^ i) ^ (n / i) - (1 : ℤ) ^ (n / i).

          Uses library sub_dvd_pow_sub_pow.

          Lean, line 514
                  have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 514 at b88a90ea8e90 ↗

      7. hmer.hdvd.h2 have (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0

        Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k), with h2 : (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0.

        Uses library dvd_neg An element a of a semigroup with a distributive negation divides the negation of an element b iff a divides b. .

        Lean, lines 517–519
              have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
                have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
                rw [this]; exact (dvd_neg).mpr h1

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 517–519 at b88a90ea8e90 ↗

        1. hmer.hdvd.h2.this have (1 : ℤ) - (2 : ℤ) ^ k0 = -((2 : ℤ) ^ k0 - (1 : ℤ)) routine: ring

          Leaves (2 : ℤ) ^ i - (1 : ℤ) ∣ (1 : ℤ) - (2 : ℤ) ^ k0, with this : (1 : ℤ) - (2 : ℤ) ^ k0 = -((2 : ℤ) ^ k0 - (1 : ℤ)).

          Lean, line 518
                  have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 518 at b88a90ea8e90 ↗

    4. hmer.hsumZ have ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

      Leaves ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)), with hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g 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 521–529
          have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
            intro s g
            induction s using Finset.induction_on with
            | empty => intro _; exact ⟨0, by simp⟩
            | insert a s ha ih =>
              intro h
              obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
              obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
              exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 521–529 at b88a90ea8e90 ↗

      1. hmer.hsumZ.s1 case printed form did not read back: shown as its Lean lines only
      2. hmer.hsumZ.s2 case

        Leaves (∀ i ∈ insert a s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with a : ℕ, s : Finset ℕ, ha : a ∉ s, ih : (∀ i ∈ s, ∃ (z : ℤ), (↑z : ℝ) = g i) → ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i.

        Uses library Exists.intro Existential introduction. , Finset.sum_insert.

        Lean, lines 525–529
              | insert a s ha ih =>
                intro h
                obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
                obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
                exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 525–529 at b88a90ea8e90 ↗

        1. hmer.hsumZ.s2.s1 obtain ∃ (z : ℤ), (↑z : ℝ) = g a

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with za : ℤ, hza : (↑za : ℝ) = g a.

          Uses library Finset.mem_insert_self.

          Lean, line 527
                  obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 527 at b88a90ea8e90 ↗

        2. hmer.hsumZ.s2.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ s, g i

          Leaves ∃ (z : ℤ), (↑z : ℝ) = ∑ i ∈ insert a s, g i, with zs : ℤ, hzs : (↑zs : ℝ) = ∑ i ∈ s, g i.

          Uses library Finset.mem_insert_of_mem.

          Lean, line 528
                  obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 528 at b88a90ea8e90 ↗

    5. hmer.hn have ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))

      Leaves ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)), with hn : ∀ (n : ℕ), (1 : ℕ) ≤ n → ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)).

      Uses library Nat.factorial Nat.factorial n is the factorial of n. , Finset.Icc The finset $[a, b]$ of elements x such that a ≤ x and x ≤ b. , Finset.mul_sum, Exists.intro Existential introduction. .

      Lean, lines 530–553
          have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ i ∈ Finset.Icc 1 (n - 1), (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - 1)) := by
            intro n hn
            rw [Finset.mul_sum]
            refine hsumZ _ _ (fun i hi => ?_)
            have hi' := Finset.mem_Icc.mp hi
            obtain ⟨z1, hz1⟩ := key n hn i hi'.1 hi'.2
            obtain ⟨q, hq⟩ := hdvd n i hi'.1 hi'.2
            have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ i - 1) * q := by exact_mod_cast hq
            have h2i : (2 : ℝ) ^ i - 1 ≠ 0 := by
              have : (2 : ℝ) ≤ 2 ^ i := by
                calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                  _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
              linarith
            have h9 : (9 : ℝ) ^ n = 3 ^ (i + 1) * 3 ^ (n - 1 - i) * 3 ^ n := by
              rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
              congr 1
              rw [← pow_add]
              congr 1
              omega
            refine ⟨3 ^ (i + 1) * (Nat.factorial (n - 2) : ℤ) * (∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * q * z1, ?_⟩
            push_cast
            rw [hz1, hW3 n, hqR, h9]
            have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
            field_simp

      targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 530–553 at b88a90ea8e90 ↗

      1. hmer.hn.hi' have (1 : ℕ) ≤ i ∧ i ≤ n - (1 : ℕ)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hi' : (1 : ℕ) ≤ i ∧ i ≤ n - (1 : ℕ).

        Uses library Finset.mem_Icc.

        Lean, line 534
              have hi' := Finset.mem_Icc.mp hi

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 534 at b88a90ea8e90 ↗

      2. hmer.hn.s2 obtain ∃ (z : ℤ), (↑z : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with z1 : ℤ, hz1 : (↑z1 : ℝ) = (3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹.

        Lean, line 535
              obtain ⟨z1, hz1⟩ := key n hn i hi'.1 hi'.2

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 535 at b88a90ea8e90 ↗

      3. hmer.hn.s3 obtain (2 : ℤ) ^ i - (1 : ℤ) ∣ ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with q : ℤ, hq : ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℤ) - (2 : ℤ) ^ k) = ((2 : ℤ) ^ i - (1 : ℤ)) * q.

        Lean, line 536
              obtain ⟨q, hq⟩ := hdvd n i hi'.1 hi'.2

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 536 at b88a90ea8e90 ↗

      4. hmer.hn.hqR have ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k) = ((2 : ℝ) ^ i - (1 : ℝ)) * (↑q : ℝ)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with hqR : ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k) = ((2 : ℝ) ^ i - (1 : ℝ)) * (↑q : ℝ).

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

        Lean, line 537
              have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ i - 1) * q := by exact_mod_cast hq

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 537 at b88a90ea8e90 ↗

      5. hmer.hn.h2i have (2 : ℝ) ^ i - (1 : ℝ) ≠ (0 : ℝ)

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with h2i : (2 : ℝ) ^ i - (1 : ℝ) ≠ (0 : ℝ).

        Lean, lines 538–542
              have h2i : (2 : ℝ) ^ i - 1 ≠ 0 := by
                have : (2 : ℝ) ≤ 2 ^ i := by
                  calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                    _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
                linarith

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 538–542 at b88a90ea8e90 ↗

        1. hmer.hn.h2i.this have (2 : ℝ) ≤ (2 : ℝ) ^ i

          Leaves (2 : ℝ) ^ i - (1 : ℝ) ≠ (0 : ℝ), with this : (2 : ℝ) ≤ (2 : ℝ) ^ i.

          Lean, lines 539–541
                  have : (2 : ℝ) ≤ 2 ^ i := by
                    calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
                      _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1

          targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 539–541 at b88a90ea8e90 ↗

          1. hmer.hn.h2i.this.s1 calc (2 : ℝ) = (2 : ℝ) ^ (1 : ℕ)

            Closes the goal.

            Uses library pow_one.

            Lean, line 540
                      calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 540 at b88a90ea8e90 ↗

          2. hmer.hn.h2i.this.s2 calc (2 : ℝ) ^ (1 : ℕ) ≤ (2 : ℝ) ^ i

            Closes the goal.

            Uses library pow_le_pow_right₀.

            Lean, line 541
                        _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1

            targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 541 at b88a90ea8e90 ↗

      6. hmer.hn.h9 have (9 : ℝ) ^ n = (3 : ℝ) ^ (i + (1 : ℕ)) * (3 : ℝ) ^ (n - (1 : ℕ) - i) * (3 : ℝ) ^ n

        Leaves ∃ (z : ℤ), (↑z : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with h9 : (9 : ℝ) ^ n = (3 : ℝ) ^ (i + (1 : ℕ)) * (3 : ℝ) ^ (n - (1 : ℕ) - i) * (3 : ℝ) ^ n.

        Uses library mul_pow, pow_add.

        Lean, lines 543–548
              have h9 : (9 : ℝ) ^ n = 3 ^ (i + 1) * 3 ^ (n - 1 - i) * 3 ^ n := by
                rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
                congr 1
                rw [← pow_add]
                congr 1
                omega

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, lines 543–548 at b88a90ea8e90 ↗

      7. hmer.hn.h3n have (3 : ℝ) ^ n ≠ (0 : ℝ) routine: positivity

        Leaves ((3 : ℝ) ^ (i + (1 : ℕ)) * (↑(n - (2 : ℕ)).factorial : ℝ) * ∏ x ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ x)) * (↑q : ℝ) * ((3 : ℝ) ^ (n - (1 : ℕ) - i) * ∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (3 : ℝ) ^ (i + (1 : ℕ)) * (3 : ℝ) ^ (n - (1 : ℕ) - i) * (3 : ℝ) ^ n * ((↑(n - (2 : ℕ)).factorial : ℝ) * ((∏ k ∈ Finset.Icc (1 : ℕ) n, ((3 : ℝ) - (8 : ℝ) * (2 : ℝ) ^ k)) * ((3 : ℝ) ^ n)⁻¹) * (((2 : ℝ) ^ i - (1 : ℝ)) * (↑q : ℝ))) * ((∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with h3n : (3 : ℝ) ^ n ≠ (0 : ℝ).

        Lean, line 552
              have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity

        targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 552 at b88a90ea8e90 ↗

  14. s14 obtain ∃ (a₂ : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))

    Leaves ∃ (a : ℕ → ℤ), ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ - ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ))), with a₂ : ℕ → ℤ, h₂ : ∀ (n : ℕ), (1 : ℕ) ≤ n → (↑(a₂ n) : ℝ) = (9 : ℝ) ^ n * (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) * ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), (∑ k ∈ Finset.Icc (1 : ℕ) n, ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - (1 : ℝ)).

    Lean, line 557
      obtain ⟨a₂, h₂⟩ := hmer

    targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, line 557 at b88a90ea8e90 ↗

The proof in Lean (Proof.lean)

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

Proof.lean — its sha256 is the artifact_hash of the attestation below, so these are the bytes the gate checked. Rendered from targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Proof.lean, sha256 4829240ca0f3.
import Mathlib
import Nodes.«erdos-1050--h1-v2--h2--h1».Context

/-! Hole `numerator_integral` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/

theorem erdos_1050__h1_v2__h2__h1 : ∃ (a : ℕ → ℤ),
  ∀ (n : ℕ),
    (1 : ℕ) ≤ n →
      (↑(a n) : ℝ) =
        (9 : ℝ) ^ n *
            (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) *
              ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) *
          (∑ k ∈ Finset.Icc (1 : ℕ) n,
              ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                  ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ -
            ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)),
              (∑ k ∈ Finset.Icc (1 : ℕ) n,
                  ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                      ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                    (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) /
                ((2 : ℝ) ^ i - (1 : ℝ))) := by
  -- alpha0 = S1 - S2. The S2 part (the 1/(2^i - 1) terms) is `hmer` below. The S1 part (`head_integral`) is assembled
  -- from two holes by partial fractions in the parameter c = 8/3: S1 = (polynomial part) + sum_i b_i / (1 - c 2^i), where
  -- b_i = sum_(k >= i) A_k(2^-i) is the residue. Informal argument: annex
  -- a03db62f0576f792454c3f95d14fb02d193662242ec562819da63116009d326b on this node.
  have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
    intro s g
    induction s using Finset.induction_on with
    | empty => intro _; exact ⟨0, by simp⟩
    | insert a s ha ih =>
      intro h
      obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
      obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
      exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
  -- (L0) the Lagrange basis sums to 1: the degree-0 case
  have h0 : ∀ s : Finset ℕ, s.Nonempty → ∑ k ∈ s, (1 : ℝ) / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = 1 := by
    intro s hs
    have hv : Set.InjOn (fun k : ℕ => ((2 : ℝ) ^ k)⁻¹) (s : Set ℕ) := by
      intro a _ b _ hab
      exact pow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) (inv_injective hab)
    have hsum := congrArg (Polynomial.eval (0 : ℝ)) (Lagrange.sum_basis hv hs)
    rw [Polynomial.eval_finset_sum, Polynomial.eval_one] at hsum
    refine Eq.trans (Finset.sum_congr rfl (fun k hk => ?_)) hsum
    unfold Lagrange.basis
    rw [Polynomial.eval_prod, one_div, ← Finset.prod_inv_distrib]
    refine Finset.prod_congr rfl (fun l hl => ?_)
    have ha : (2 : ℝ) ^ k ≠ 0 := by positivity
    have hb : (2 : ℝ) ^ l ≠ 0 := by positivity
    simp only [Lagrange.basisDivisor, Polynomial.eval_mul, Polynomial.eval_C, Polynomial.eval_sub, Polynomial.eval_X]
    rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast,
      show ((2 : ℝ) ^ k)⁻¹ - ((2 : ℝ) ^ l)⁻¹ = (1 - (2 : ℝ) ^ l / (2 : ℝ) ^ k) * (-((2 : ℝ) ^ l)⁻¹) by field_simp; ring,
      mul_inv, zero_sub, mul_assoc, inv_mul_cancel₀ (neg_ne_zero.mpr (inv_ne_zero hb)), mul_one]
  -- the recursion h_e(s) = h_e(s minus a) + y_a h_(e-1)(s), for any weight f
  have hrec : ∀ (s : Finset ℕ) (a : ℕ) (f : ℕ → ℝ), a ∈ s → ∑ k ∈ s, (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = ∑ k ∈ s.erase a, (2 : ℝ) ^ k * f k / ∏ l ∈ (s.erase a).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) + (2 : ℝ) ^ a * ∑ k ∈ s, f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
    intro s a f ha
    rw [← Finset.add_sum_erase s (fun k => f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) ha, ← Finset.add_sum_erase s (fun k => (2 : ℝ) ^ k * f k / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) ha, mul_add, Finset.mul_sum, add_left_comm, ← Finset.sum_add_distrib]
    congr 1
    · ring
    · refine Finset.sum_congr rfl (fun k hk => ?_)
      have hka : k ≠ a := Finset.ne_of_mem_erase hk
      have hmem : a ∈ s.erase k := Finset.mem_erase.mpr ⟨Ne.symm hka, ha⟩
      have hsplit := Finset.mul_prod_erase (s.erase k) (fun l => (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) hmem
      rw [Finset.erase_right_comm] at hsplit
      rw [← hsplit]
      have hρ : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) ≠ 0 := by
        intro h1
        have h2 : (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) = 2 ^ (0 : ℤ) := by rw [zpow_zero]; linarith
        have h3 := zpow_right_injective₀ (by norm_num : (0 : ℝ) < 2) (by norm_num) h2
        omega
      have hq : (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ))) * (1 - (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)))⁻¹ = 1 := mul_inv_cancel₀ hρ
      have hak : (2 : ℝ) ^ a = (2 : ℝ) ^ ((a : ℤ) - (k : ℤ)) * 2 ^ k := by
        rw [zpow_sub₀ two_ne_zero, zpow_natCast, zpow_natCast]
        field_simp
      simp only [div_eq_mul_inv, mul_inv]
      rw [hak]
      linear_combination ((2 : ℝ) ^ k * f k * (∏ l ∈ (s.erase a).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))))⁻¹) * hq
  -- (L) complete homogeneous sums at the nodes 2^k are integers
  have hW : ∀ N : ℕ, ∀ (s : Finset ℕ) (e : ℕ), s.card + e = N → ∃ z : ℤ, (z : ℝ) = ∑ k ∈ s, ((2 : ℝ) ^ k) ^ e / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
    intro N
    induction N with
    | zero =>
      intro s e h
      have hs : s = ∅ := Finset.card_eq_zero.mp (by omega)
      subst hs
      exact ⟨0, by simp⟩
    | succ N ih =>
      intro s e h
      rcases s.eq_empty_or_nonempty with rfl | hs
      · exact ⟨0, by simp⟩
      rcases Nat.eq_zero_or_pos e with rfl | he
      · exact ⟨1, by rw [Int.cast_one]; exact (h0 s hs).symm.trans (Finset.sum_congr rfl (fun k _ => by rw [pow_zero]))⟩
      obtain ⟨e', rfl⟩ : ∃ e', e = e' + 1 := ⟨e - 1, by omega⟩
      obtain ⟨a, ha⟩ := hs
      obtain ⟨z1, hz1⟩ := ih (s.erase a) (e' + 1) (by rw [Finset.card_erase_of_mem ha]; have := Finset.card_pos.mpr ⟨a, ha⟩; omega)
      obtain ⟨z2, hz2⟩ := ih s e' (by omega)
      refine ⟨z1 + 2 ^ a * z2, ?_⟩
      have hr := hrec s a (fun k => ((2 : ℝ) ^ k) ^ e') ha
      simp only [← pow_succ'] at hr
      push_cast
      rw [hz1, hz2]
      exact hr.symm
  -- (L-) and they vanish in negative degree above minus the number of nodes
  have hV : ∀ m : ℕ, ∀ s : Finset ℕ, m + 1 < s.card → ∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) = 0 := by
    intro m
    induction m with
    | zero =>
      intro s hs
      obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
      have hne : (s.erase a).Nonempty := Finset.card_pos.mp (by rw [Finset.card_erase_of_mem ha]; omega)
      have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹) ha
      have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ = 1 := fun k => by
        rw [zero_add, pow_one]; exact mul_inv_cancel₀ (by positivity)
      simp only [e] at h
      rw [h0 s ⟨a, ha⟩, h0 _ hne] at h
      have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
      rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (0 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
      · exact absurd h5 h2a
      · exact h5
    | succ m ih =>
      intro s hs
      obtain ⟨a, ha⟩ : s.Nonempty := Finset.card_pos.mp (by omega)
      have h := hrec s a (fun k => (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹) ha
      have e : ∀ k : ℕ, (2 : ℝ) ^ k * (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ = (((2 : ℝ) ^ k) ^ (m + 1))⁻¹ := fun k => by
        rw [pow_succ' _ (m + 1), mul_inv, ← mul_assoc, mul_inv_cancel₀ (by positivity), one_mul]
      simp only [e] at h
      rw [ih s (by omega), ih (s.erase a) (by rw [Finset.card_erase_of_mem ha]; omega)] at h
      have h2a : (2 : ℝ) ^ a ≠ 0 := by positivity
      rcases mul_eq_zero.mp (show (2 : ℝ) ^ a * (∑ k ∈ s, (((2 : ℝ) ^ k) ^ (m + 1 + 1))⁻¹ / ∏ l ∈ s.erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = 0 by linarith) with h5 | h5
      · exact absurd h5 h2a
      · exact h5
  -- geometric sums in 2^(-m)
  have hgeo : ∀ m : ℕ, 1 ≤ m → ∀ k : ℕ, ∑ i ∈ Finset.Icc 1 k, (((2 : ℝ) ^ i)⁻¹) ^ m = (1 - (((2 : ℝ) ^ k) ^ m)⁻¹) / ((2 : ℝ) ^ m - 1) := by
    intro m hm k
    have hB : (2 : ℝ) ^ m - 1 ≠ 0 := by
      have : (2 : ℝ) ≤ 2 ^ m := by
        calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
          _ ≤ 2 ^ m := pow_le_pow_right₀ (by norm_num) hm
      linarith
    induction k with
    | zero => simp
    | succ k ih =>
      rw [Finset.sum_Icc_succ_top (by omega), ih, inv_pow, pow_succ, mul_pow]
      have hX : ((2 : ℝ) ^ k) ^ m ≠ 0 := by positivity
      have hY : (2 : ℝ) ^ m ≠ 0 := by positivity
      generalize ((2 : ℝ) ^ k) ^ m = X at hX ⊢
      generalize (2 : ℝ) ^ m = Y at hY hB ⊢
      field_simp
      ring
  have hdvd : ∀ n i : ℕ, 1 ≤ i → i ≤ n - 1 → ((2 : ℤ) ^ i - 1) ∣ ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k) := by
    intro n i hi1 hi2
    obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩
    have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i
    have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith
    have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))
    have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩
    have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
      have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
      rw [one_pow, ← pow_mul, ← hk0] at this
      exact this
    have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
      have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
      rw [this]; exact (dvd_neg).mpr h1
    exact h2.trans (Finset.dvd_prod_of_mem (fun k => (1 : ℤ) - 2 ^ k) hmem)
  have hpoly : ∀ n : ℕ, 1 ≤ n → ∃ α : ℕ → ℤ, ∀ y : ℝ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (2 : ℝ) ^ t * y) = ∑ j ∈ Finset.range n, (α j : ℝ) * y ^ j := by
    intro n hn
    refine ⟨fun j => (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X)).coeff j, fun y => ?_⟩
    have hdeg : (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))).natDegree < n := by
      refine lt_of_le_of_lt (Polynomial.natDegree_map_le) ?_
      refine lt_of_le_of_lt (Polynomial.natDegree_prod_le _ _) ?_
      refine lt_of_le_of_lt (Finset.sum_le_sum (g := fun _ => 1) (fun t _ => ?_)) ?_
      · compute_degree
      · simp only [Finset.sum_const, smul_eq_mul, mul_one, Nat.card_Icc]; omega
    have hev := Polynomial.eval_eq_sum_range' hdeg y
    have hev2 : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (2 : ℝ) ^ t * y) = Polynomial.eval y (Polynomial.map (Int.castRingHom ℝ) (∏ t ∈ Finset.Icc 1 (n - 1), (1 - Polynomial.C ((2 : ℤ) ^ t) * Polynomial.X))) := by
      rw [Polynomial.map_prod, Polynomial.eval_prod]
      refine Finset.prod_congr rfl (fun t _ => ?_)
      simp
    rw [hev2, hev]
    refine Finset.sum_congr rfl (fun j _ => ?_)
    rw [Polynomial.coeff_map]
    rfl
  have residue_integral : ∀ n i : ℕ, 1 ≤ i → i ≤ n → ∃ z : ℤ, (z : ℝ) = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := by
    have hQne : ∀ m : ℕ, (∏ s ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ s)) ≠ 0 := by
      intro m
      refine Finset.prod_ne_zero_iff.mpr (fun s hs => ?_)
      have h1 := (Finset.mem_Icc.mp hs).1
      have h2 : (2 : ℤ) ≤ 2 ^ s := by
        calc (2 : ℤ) = 2 ^ 1 := by norm_num
          _ ≤ 2 ^ s := pow_le_pow_right₀ (by norm_num) h1
      omega
    have hG : ∀ N a b : ℕ, a + b = N → ∃ z : ℤ, (∏ s ∈ Finset.Icc 1 (a + b), ((1 : ℤ) - 2 ^ s)) = z * ((∏ s ∈ Finset.Icc 1 a, ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 b, ((1 : ℤ) - 2 ^ s))) := by
      intro N
      induction N with
      | zero =>
        intro a b h
        obtain ⟨rfl, rfl⟩ : a = 0 ∧ b = 0 := by omega
        exact ⟨1, by simp⟩
      | succ N ih =>
        intro a b h
        rcases Nat.eq_zero_or_pos a with rfl | ha
        · exact ⟨1, by simp⟩
        rcases Nat.eq_zero_or_pos b with rfl | hb
        · exact ⟨1, by simp⟩
        obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩
        obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩
        obtain ⟨z1, h1⟩ := ih a' (b' + 1) (by omega)
        obtain ⟨z2, h2⟩ := ih (a' + 1) b' (by omega)
        refine ⟨2 ^ (b' + 1) * z1 + z2, ?_⟩
        have e1 : a' + 1 + (b' + 1) = (a' + (b' + 1)) + 1 := by omega
        have e2 : a' + 1 + b' = a' + (b' + 1) := by omega
        have hA := Finset.prod_Icc_succ_top (show 1 ≤ a' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
        have hB := Finset.prod_Icc_succ_top (show 1 ≤ b' + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
        have hC := Finset.prod_Icc_succ_top (show 1 ≤ a' + (b' + 1) + 1 by omega) (fun s => (1 : ℤ) - 2 ^ s)
        beta_reduce at hA hB hC
        rw [e2, hA] at h2
        rw [hB] at h1
        rw [e1, hC, hA, hB]
        linear_combination (2 ^ (b' + 1) * (1 - 2 ^ (a' + 1))) * h1 + (1 - 2 ^ (b' + 1)) * h2
    have hN : ∀ m d : ℕ, (∏ s ∈ Finset.Icc 1 d, ((1 : ℤ) - 2 ^ s)) * (∏ t ∈ Finset.Icc 1 m, ((1 : ℤ) - 2 ^ (t + d))) = ∏ s ∈ Finset.Icc 1 (d + m), ((1 : ℤ) - 2 ^ s) := by
      intro m d
      induction m with
      | zero => simp
      | succ m ih =>
        rw [Finset.prod_Icc_succ_top (by omega), show d + (m + 1) = (d + m) + 1 by omega, Finset.prod_Icc_succ_top (by omega), ← mul_assoc, ih,
          show m + 1 + d = d + m + 1 by omega]
    have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
      intro s g
      induction s using Finset.induction_on with
      | empty => intro _; exact ⟨0, by simp⟩
      | insert a s ha ih =>
        intro h
        obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
        obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
        exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
    intro n i hi hin
    refine hsumZ _ _ (fun k hk => ?_)
    have hk' := Finset.mem_Icc.mp hk
    obtain ⟨d, rfl⟩ : ∃ d, k = i + d := ⟨k - i, by omega⟩
    -- numerator
    have hNr : ∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + (i + d))) = ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) := by
      push_cast
      refine Finset.prod_congr rfl (fun t _ => ?_)
      have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
      rw [show t + (i + d) = i + (t + d) by omega, pow_add, ← mul_assoc, inv_mul_cancel₀ h2i, one_mul]
    -- denominator
    have hset : (Finset.Icc 1 n).erase (i + d) = Finset.Icc 1 (i + d - 1) ∪ Finset.Icc (i + d + 1) n := by
      ext l
      simp only [Finset.mem_erase, Finset.mem_Icc, Finset.mem_union]
      omega
    have hdisj : Disjoint (Finset.Icc 1 (i + d - 1)) (Finset.Icc (i + d + 1) n) := by
      rw [Finset.disjoint_left]
      intro l h1 h2
      simp only [Finset.mem_Icc] at h1 h2
      omega
    have hD1 : (∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
      have hrefl : ∏ l ∈ Finset.Icc 1 (i + d - 1), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ∏ s ∈ Finset.Icc 1 (i + d - 1), (1 - ((2 : ℝ) ^ s)⁻¹) := by
        refine Finset.prod_nbij' (fun l => i + d - l) (fun s => i + d - s) ?_ ?_ ?_ ?_ ?_
        · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
        · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
        · intro l hl; simp only [Finset.mem_Icc] at hl; omega
        · intro l hl; simp only [Finset.mem_Icc] at hl; omega
        · intro l hl
          simp only [Finset.mem_Icc] at hl
          rw [← zpow_natCast, ← zpow_neg]
          congr 2
          push_cast [Nat.cast_sub (show l ≤ i + d by omega)]
          ring
      rw [hrefl]
      push_cast
      rw [← Finset.prod_mul_distrib]
      refine Finset.prod_congr rfl (fun s _ => ?_)
      have h2s : (2 : ℝ) ^ s ≠ 0 := by positivity
      field_simp
      ring
    have hD2 : ∏ l ∈ Finset.Icc (i + d + 1) n, (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ))) = ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
      push_cast
      refine Finset.prod_nbij' (fun l => l - (i + d)) (fun s => s + (i + d)) ?_ ?_ ?_ ?_ ?_
      · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
      · intro l hl; simp only [Finset.mem_Icc] at hl ⊢; omega
      · intro l hl; simp only [Finset.mem_Icc] at hl; omega
      · intro l hl; simp only [Finset.mem_Icc] at hl; omega
      · intro l hl
        simp only [Finset.mem_Icc] at hl
        rw [← zpow_natCast]
        congr 2
        push_cast [Nat.cast_sub (show i + d ≤ l by omega)]
        ring
    obtain ⟨z1, hz1⟩ := hG _ d (n - 1) rfl
    obtain ⟨z2, hz2⟩ := hG _ (i + d - 1) (n - (i + d)) rfl
    rw [show i + d - 1 + (n - (i + d)) = n - 1 by omega] at hz2
    have hNZ : (∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d))) = z1 * z2 * ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s)) * (∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s))) := by
      apply mul_left_cancel₀ (hQne d)
      rw [hN (n - 1) d, hz1, hz2]
      ring
    have hNZ' : ((∏ t ∈ Finset.Icc 1 (n - 1), ((1 : ℤ) - 2 ^ (t + d)) : ℤ) : ℝ) = (z1 : ℝ) * z2 * (((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ)) := by
      exact_mod_cast hNZ
    have hQ1 : ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _
    have hQ2 : ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) ≠ 0 := by exact_mod_cast hQne _
    have hDr : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) * ((∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s) : ℤ) : ℝ) = ((∏ s ∈ Finset.Icc 1 (i + d - 1), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) * ((∏ s ∈ Finset.Icc 1 (n - (i + d)), ((1 : ℤ) - 2 ^ s) : ℤ) : ℝ) := by
      rw [hset, Finset.prod_union hdisj, hD2, ← hD1]
      ring
    have hDne : (∏ l ∈ (Finset.Icc 1 n).erase (i + d), (1 - (2 : ℝ) ^ ((l : ℤ) - ((i + d : ℕ) : ℤ)))) ≠ 0 := by
      intro h0
      rw [h0, zero_mul] at hDr
      exact mul_ne_zero hQ1 hQ2 hDr.symm
    refine ⟨-(z1 * z2 * (∏ s ∈ Finset.Icc 1 (i + d - 1), (-(2 : ℤ) ^ s))), ?_⟩
    rw [hNr, eq_div_iff hDne, hNZ']
    rw [Int.cast_neg, Int.cast_mul, Int.cast_mul]
    linear_combination (-((z1 : ℝ) * z2)) * hDr
  have polypart_integral : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k)) * ((∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) - (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
    intro n hn
    obtain ⟨α, hα⟩ := hpoly n hn
    obtain ⟨D, hD⟩ : ∃ D : ℕ → ℝ, ∀ k, D k = ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := ⟨fun k => _, fun k => rfl⟩
    have hA : ∀ (x : ℝ) (k : ℕ), ∏ t ∈ Finset.Icc 1 (n - 1), (1 - x * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * (x * 2 ^ k) ^ j := by
      intro x k
      rw [← hα]
      refine Finset.prod_congr rfl (fun t _ => ?_)
      rw [pow_add]; ring
    simp only [← hD, hA]
    -- (a) one double sum
    have hswap : ∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ k ∈ Finset.Icc 1 n, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ := by
      simp only [Finset.sum_mul]
      refine Finset.sum_comm' (fun i k => ?_)
      simp only [Finset.mem_Icc]
      omega
    rw [hswap]
    simp only [Finset.mul_sum]
    rw [← Finset.sum_sub_distrib]
    simp only [← Finset.sum_sub_distrib, ← sub_mul]
    -- (b) per (k, i)
    have hb : ∀ (k i : ℕ), 1 ≤ i → (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = (∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * ((2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s))) / D k := by
      intro k i hi
      have h2i : (2 : ℝ) ^ i ≠ 0 := by positivity
      have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
        have : (2 : ℝ) ≤ 2 ^ i := by
          calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
            _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi
        intro h0
        linarith
      have hch : (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((2 : ℝ) ^ i)⁻¹ := by
        rw [show (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) = ((2 : ℝ) ^ i)⁻¹ * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) by field_simp, mul_assoc, mul_inv_cancel₀ hne, mul_one]
      have hj : ∀ j : ℕ, ((((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - s) := by
        intro j
        have hg := geom_sum₂_mul (8 / 3 : ℝ) (((2 : ℝ) ^ i)⁻¹) j
        have hg' : (((2 : ℝ) ^ i)⁻¹) ^ j - (8 / 3 : ℝ) ^ j = (∑ s ∈ Finset.range j, (8 / 3 : ℝ) ^ s * (((2 : ℝ) ^ i)⁻¹) ^ (j - 1 - s)) * (((2 : ℝ) ^ i)⁻¹ - (8 / 3 : ℝ)) := by
          linear_combination hg
        rw [hg', mul_assoc, hch, Finset.sum_mul]
        refine Finset.sum_congr rfl (fun s hs => ?_)
        have hs' := Finset.mem_range.mp hs
        rw [mul_assoc, ← pow_succ, show j - 1 - s + 1 = j - s by omega]
      have e1 : (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ((∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j - ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) / D k := by
        ring
      rw [e1, ← Finset.sum_sub_distrib, Finset.sum_mul]
      congr 1
      refine Finset.sum_congr rfl (fun j _ => ?_)
      rw [← Finset.mul_sum, ← hj j, mul_pow, mul_pow]
      ring
    -- (c) sum over i
    have hc : ∀ k : ℕ, ∑ i ∈ Finset.Icc 1 k, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / D k - -(∑ j ∈ Finset.range n, (α j : ℝ) * (((2 : ℝ) ^ i)⁻¹ * 2 ^ k) ^ j) / D k) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ = ∑ j ∈ Finset.range n, ∑ s ∈ Finset.range j, (α j : ℝ) * (8 / 3 : ℝ) ^ s * ((((2 : ℝ) ^ k) ^ j - ((2 : ℝ) ^ k) ^ s) / D k) / ((2 : ℝ) ^ (j - s) - 1) := by
      intro k
      rw [Finset.sum_congr rfl (fun i hi => hb k i (Finset.mem_Icc.mp hi).1), ← Finset.sum_div, Finset.sum_comm, Finset.sum_div]
      refine Finset.sum_congr rfl (fun j _ => ?_)
      rw [Finset.sum_comm, Finset.sum_div]
      refine Finset.sum_congr rfl (fun s hs => ?_)
      have hs' := Finset.mem_range.mp hs
      rw [Finset.sum_congr rfl (fun i _ => (mul_assoc _ _ _).symm), ← Finset.mul_sum, hgeo (j - s) (by omega) k]
      have hjs : ((2 : ℝ) ^ k) ^ j = ((2 : ℝ) ^ k) ^ s * ((2 : ℝ) ^ k) ^ (j - s) := by
        rw [← pow_add]; congr 1; omega
      have hZ : ((2 : ℝ) ^ k) ^ (j - s) * (((2 : ℝ) ^ k) ^ (j - s))⁻¹ = 1 := mul_inv_cancel₀ (by positivity)
      rw [hjs]
      linear_combination (-((α j : ℝ) * ((2 : ℝ) ^ k) ^ s * (8 / 3 : ℝ) ^ s / ((2 : ℝ) ^ (j - s) - 1) / D k)) * hZ
    rw [Finset.sum_congr rfl (fun k _ => hc k), Finset.sum_comm, Finset.mul_sum]
    refine hsumZ _ _ (fun j hj => ?_)
    rw [Finset.sum_comm, Finset.mul_sum]
    refine hsumZ _ _ (fun s hs => ?_)
    have hj' := Finset.mem_range.mp hj
    have hs' := Finset.mem_range.mp hs
    obtain ⟨wj, hwj⟩ := hW _ (Finset.Icc 1 n) j rfl
    obtain ⟨ws, hws⟩ := hW _ (Finset.Icc 1 n) s rfl
    obtain ⟨q, hq⟩ := hdvd n (j - s) (by omega) (by omega)
    have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ (j - s) - 1) * q := by exact_mod_cast hq
    have hB : (2 : ℝ) ^ (j - s) - 1 ≠ 0 := by
      have : (2 : ℝ) ≤ 2 ^ (j - s) := by
        calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
          _ ≤ 2 ^ (j - s) := pow_le_pow_right₀ (by norm_num) (by omega)
      linarith
    have h3 : (3 : ℝ) ^ n = 3 ^ (n - s) * 3 ^ s := by rw [← pow_add]; congr 1; omega
    have h83 : (8 / 3 : ℝ) ^ s * 3 ^ s = 8 ^ s := by rw [← mul_pow]; norm_num
    refine ⟨3 ^ (n - s) * 8 ^ s * q * α j * (wj - ws), ?_⟩
    simp only [← hD] at hwj hws
    push_cast
    rw [hwj, hws, hqR, h3, ← h83, ← Finset.sum_sub_distrib]
    rw [Finset.mul_sum, Finset.mul_sum]
    refine Finset.sum_congr rfl (fun k _ => ?_)
    field_simp
  have head_integral : ∃ a₁ : ℕ → ℤ, ∀ n : ℕ, 1 ≤ n → (a₁ n : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
    have hsumZ0 : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
      intro s g
      induction s using Finset.induction_on with
      | empty => intro _; exact ⟨0, by simp⟩
      | insert a s ha ih =>
        intro h
        obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
        obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
        exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
    have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (∑ i ∈ Finset.Icc 1 k, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹)) := by
      intro n hn
      obtain ⟨zE, hzE⟩ := polypart_integral n hn
      have hR : ∃ zR : ℤ, (zR : ℝ) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∑ i ∈ Finset.Icc 1 n, (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) * (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹) := by
        rw [Finset.mul_sum]
        refine hsumZ0 _ _ (fun i hi => ?_)
        have hi' := Finset.mem_Icc.mp hi
        obtain ⟨zb, hzb⟩ := residue_integral n i hi'.1 hi'.2
        refine ⟨zb * (3 * ∏ j ∈ (Finset.Icc 1 n).erase i, ((3 : ℤ) - 8 * 2 ^ j)), ?_⟩
        have hne : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) ≠ 0 := by
          have : (2 : ℝ) ≤ 2 ^ i := by
            calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
              _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
          intro h0
          linarith
        have hsplit : (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) = (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ i) * ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) :=
          (Finset.mul_prod_erase _ (fun k => (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) hi).symm
        have he : ∏ k ∈ (Finset.Icc 1 n).erase i, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ (Finset.Icc 1 n).erase i, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ (n - 1))⁻¹ := by
          rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
            Finset.prod_mul_distrib, Finset.prod_const, Finset.card_erase_of_mem hi, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
        have h3 : (3 : ℝ) ^ n = 3 * 3 ^ (n - 1) := by
          rw [← pow_succ']; congr 1; omega
        have h3ne : (3 : ℝ) ^ (n - 1) ≠ 0 := by positivity
        obtain ⟨b, hb⟩ : ∃ b : ℝ, b = (∑ k ∈ Finset.Icc i n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - ((2 : ℝ) ^ i)⁻¹ * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k)))) := ⟨_, rfl⟩
        rw [← hb] at hzb ⊢
        push_cast
        rw [hzb, hsplit, he, h3]
        have hne' : (3 : ℝ) - 8 * 2 ^ i ≠ 0 := by
          intro h0
          apply hne
          linear_combination (1 / 3 : ℝ) * h0
        field_simp
      obtain ⟨zR, hzR⟩ := hR
      have hPZ : ∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k) = (3 : ℝ) ^ n * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) := by
        rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
          Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
        have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
        field_simp
      have h9 : (9 : ℝ) ^ n = 3 ^ n * 3 ^ n := by
        rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
      refine ⟨(Nat.factorial (n - 2) : ℤ) * ((∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * zE + 3 ^ n * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k)) * zR), ?_⟩
      push_cast
      rw [hzE, hzR, hPZ, h9]
      ring
    refine ⟨fun n => if h : 1 ≤ n then Classical.choose (hn n h) else 0, fun n hn' => ?_⟩
    simp only [dif_pos hn']
    exact Classical.choose_spec (hn n hn')
  obtain ⟨a₁, h₁⟩ := head_integral
  have hmer : ∃ a₂ : ℕ → ℤ, ∀ n : ℕ, 1 ≤ n → (a₂ n : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ i ∈ Finset.Icc 1 (n - 1), (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - 1)) := by
    have key : ∀ n : ℕ, 1 ≤ n → ∀ i : ℕ, 1 ≤ i → i ≤ n - 1 → ∃ z : ℤ, (z : ℝ) = (3 : ℝ) ^ (n - 1 - i) * (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) := by
      intro n hn i hi1 hi2
      obtain ⟨α, hα⟩ := hpoly n hn
      have hA : ∀ k : ℕ, ∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k)) = ∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j := by
        intro k
        rw [← hα]
        refine Finset.prod_congr rfl (fun t _ => ?_)
        rw [pow_add]; ring
      simp only [hA]
      have e1 : ∑ k ∈ Finset.Icc 1 n, (-(∑ j ∈ Finset.range n, (α j : ℝ) * ((8 / 3 : ℝ) * 2 ^ k) ^ j) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ∑ j ∈ Finset.range n, ∑ k ∈ Finset.Icc 1 n, (-(α j : ℝ)) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) := by
        rw [Finset.sum_comm]
        refine Finset.sum_congr rfl (fun k _ => ?_)
        rw [neg_div, neg_mul, Finset.sum_div, Finset.sum_mul, ← Finset.sum_neg_distrib]
        refine Finset.sum_congr rfl (fun j _ => ?_)
        ring
      rw [e1, Finset.mul_sum]
      refine hsumZ _ _ (fun j hj => ?_)
      have hj' := Finset.mem_range.mp hj
      rw [← Finset.mul_sum]
      have hcX : ∀ k : ℕ, ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ≠ 0 := fun k => by positivity
      rcases lt_or_ge j i with hji | hji
      · refine ⟨0, ?_⟩
        have hvan : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * ∑ k ∈ Finset.Icc 1 n, (((2 : ℝ) ^ k) ^ (i - j - 1 + 1))⁻¹ / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
          rw [Finset.mul_sum]
          refine Finset.sum_congr rfl (fun k _ => ?_)
          have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = ((8 / 3 : ℝ) ^ (i - j))⁻¹ * (((2 : ℝ) ^ k) ^ (i - j))⁻¹ := by
            rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (i - j) from by rw [← pow_add]; congr 1; omega,
              mul_inv, ← mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), one_mul, mul_pow, mul_inv]
          rw [hk, mul_div_assoc, show i - j - 1 + 1 = i - j by omega]
        rw [hvan, hV (i - j - 1) (Finset.Icc 1 n) (by rw [Nat.card_Icc]; omega)]
        simp
      · obtain ⟨w, hw⟩ := hW _ (Finset.Icc 1 n) (j - i) rfl
        refine ⟨-(α j) * 3 ^ (n - 1 - j) * 8 ^ (j - i) * w, ?_⟩
        have hpos : ∑ k ∈ Finset.Icc 1 n, (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ)))) = (8 / 3 : ℝ) ^ (j - i) * ∑ k ∈ Finset.Icc 1 n, ((2 : ℝ) ^ k) ^ (j - i) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - (k : ℤ))) := by
          rw [Finset.mul_sum]
          refine Finset.sum_congr rfl (fun k _ => ?_)
          have hk : ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j * ((((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) = (8 / 3 : ℝ) ^ (j - i) * ((2 : ℝ) ^ k) ^ (j - i) := by
            rw [show ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ j = ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ (j - i) * ((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i from by rw [← pow_add]; congr 1; omega,
              mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ (hcX k)), mul_one, mul_pow]
          rw [hk, mul_div_assoc]
        have h3 : (3 : ℝ) ^ (n - 1 - i) = 3 ^ (n - 1 - j) * 3 ^ (j - i) := by rw [← pow_add]; congr 1; omega
        have h83 : (8 / 3 : ℝ) ^ (j - i) * 3 ^ (j - i) = 8 ^ (j - i) := by rw [← mul_pow]; norm_num
        push_cast
        rw [hpos, hw, h3, ← h83]
        ring
    have hW3 : ∀ n : ℕ, ∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = (∏ k ∈ Finset.Icc 1 n, ((3 : ℝ) - 8 * 2 ^ k)) * ((3 : ℝ) ^ n)⁻¹ := by
      intro n
      rw [Finset.prod_congr rfl (fun k _ => (by ring : (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k) = ((3 : ℝ) - 8 * 2 ^ k) * (3 : ℝ)⁻¹)),
        Finset.prod_mul_distrib, Finset.prod_const, Nat.card_Icc, Nat.add_sub_cancel, inv_pow]
    have hdvd : ∀ n i : ℕ, 1 ≤ i → i ≤ n - 1 → ((2 : ℤ) ^ i - 1) ∣ ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℤ) - 2 ^ k) := by
      intro n i hi1 hi2
      obtain ⟨k0, hk0⟩ : ∃ k0, k0 = i * (n / i) := ⟨_, rfl⟩
      have hle : k0 ≤ n := by rw [hk0, mul_comm]; exact Nat.div_mul_le_self n i
      have hlt : n < k0 + i := by rw [hk0]; have := Nat.lt_mul_div_succ n (by omega : 0 < i); linarith
      have hge : i ≤ k0 := by rw [hk0]; exact Nat.le_mul_of_pos_right i (Nat.div_pos (by omega) (by omega))
      have hmem : k0 ∈ Finset.Icc ((n + 1) / 2) n := Finset.mem_Icc.mpr ⟨by omega, hle⟩
      have h1 : ((2 : ℤ) ^ i - 1) ∣ (2 : ℤ) ^ k0 - 1 := by
        have := sub_dvd_pow_sub_pow ((2 : ℤ) ^ i) 1 (n / i)
        rw [one_pow, ← pow_mul, ← hk0] at this
        exact this
      have h2 : ((2 : ℤ) ^ i - 1) ∣ (1 : ℤ) - 2 ^ k0 := by
        have : (1 : ℤ) - 2 ^ k0 = -((2 : ℤ) ^ k0 - 1) := by ring
        rw [this]; exact (dvd_neg).mpr h1
      exact h2.trans (Finset.dvd_prod_of_mem (fun k => (1 : ℤ) - 2 ^ k) hmem)
    have hsumZ : ∀ (s : Finset ℕ) (g : ℕ → ℝ), (∀ i ∈ s, ∃ z : ℤ, (z : ℝ) = g i) → ∃ z : ℤ, (z : ℝ) = ∑ i ∈ s, g i := by
      intro s g
      induction s using Finset.induction_on with
      | empty => intro _; exact ⟨0, by simp⟩
      | insert a s ha ih =>
        intro h
        obtain ⟨za, hza⟩ := h a (Finset.mem_insert_self a s)
        obtain ⟨zs, hzs⟩ := ih (fun i hi => h i (Finset.mem_insert_of_mem hi))
        exact ⟨za + zs, by rw [Finset.sum_insert ha]; push_cast; rw [hza, hzs]⟩
    have hn : ∀ n : ℕ, 1 ≤ n → ∃ z : ℤ, (z : ℝ) = (9 : ℝ) ^ n * ((Nat.factorial (n - 2) : ℝ) * (∏ k ∈ Finset.Icc 1 n, (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) * (∏ k ∈ Finset.Icc ((n + 1) / 2) n, (1 - (2 : ℝ) ^ k))) * (∑ i ∈ Finset.Icc 1 (n - 1), (∑ k ∈ Finset.Icc 1 n, (-(∏ t ∈ Finset.Icc 1 (n - 1), (1 - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) / ∏ l ∈ (Finset.Icc 1 n).erase k, (1 - (2 : ℝ) ^ ((l : ℤ) - k))) * (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) / ((2 : ℝ) ^ i - 1)) := by
      intro n hn
      rw [Finset.mul_sum]
      refine hsumZ _ _ (fun i hi => ?_)
      have hi' := Finset.mem_Icc.mp hi
      obtain ⟨z1, hz1⟩ := key n hn i hi'.1 hi'.2
      obtain ⟨q, hq⟩ := hdvd n i hi'.1 hi'.2
      have hqR : ∏ k ∈ Finset.Icc ((n + 1) / 2) n, ((1 : ℝ) - 2 ^ k) = ((2 : ℝ) ^ i - 1) * q := by exact_mod_cast hq
      have h2i : (2 : ℝ) ^ i - 1 ≠ 0 := by
        have : (2 : ℝ) ≤ 2 ^ i := by
          calc (2 : ℝ) = 2 ^ 1 := (pow_one 2).symm
            _ ≤ 2 ^ i := pow_le_pow_right₀ (by norm_num) hi'.1
        linarith
      have h9 : (9 : ℝ) ^ n = 3 ^ (i + 1) * 3 ^ (n - 1 - i) * 3 ^ n := by
        rw [show (9 : ℝ) = 3 * 3 by norm_num, mul_pow]
        congr 1
        rw [← pow_add]
        congr 1
        omega
      refine ⟨3 ^ (i + 1) * (Nat.factorial (n - 2) : ℤ) * (∏ k ∈ Finset.Icc 1 n, ((3 : ℤ) - 8 * 2 ^ k)) * q * z1, ?_⟩
      push_cast
      rw [hz1, hW3 n, hqR, h9]
      have h3n : (3 : ℝ) ^ n ≠ 0 := by positivity
      field_simp
    refine ⟨fun n => if h : 1 ≤ n then Classical.choose (hn n h) else 0, fun n hn' => ?_⟩
    simp only [dif_pos hn']
    exact Classical.choose_spec (hn n hn')
  obtain ⟨a₂, h₂⟩ := hmer
  refine ⟨fun n => a₁ n - a₂ n, fun n hn => ?_⟩
  push_cast
  rw [h₁ n hn, h₂ n hn]
  ring

What is known

Notes

  • Annex to erdos-1050--h1-v2--h2--h1 (the numerator integrality of the Padé construction for sum 1/(2^n - 3)). full text →

Work on it

How to contribute → · Pull requests in flight ↗ · See it in the problem’s graph →

Record

Statement: the Lean file and its words (3 versions)

Statement not audited — only a problem’s root statement is audited for fidelity (D-9); the kernel checks a proof against this Lean as written.

import Mathlib
import Nodes.«erdos-1050--h1-v2--h2--h1».Context

/-! Hole `numerator_integral` of a merged partial proof, as a node (D-12 #5, D-29).
Statement generated by the gate from the assembly; immutable (D-3). -/

theorem erdos_1050__h1_v2__h2__h1 : ∃ (a : ℕ → ℤ),
  ∀ (n : ℕ),
    (1 : ℕ) ≤ n →
      (↑(a n) : ℝ) =
        (9 : ℝ) ^ n *
            (((↑(n - (2 : ℕ)).factorial : ℝ) * ∏ k ∈ Finset.Icc (1 : ℕ) n, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ k)) *
              ∏ k ∈ Finset.Icc ((n + (1 : ℕ)) / (2 : ℕ)) n, ((1 : ℝ) - (2 : ℝ) ^ k)) *
          (∑ k ∈ Finset.Icc (1 : ℕ) n,
              ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                  ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                ∑ i ∈ Finset.Icc (1 : ℕ) k, ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ i)⁻¹ -
            ∑ i ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)),
              (∑ k ∈ Finset.Icc (1 : ℕ) n,
                  ((-∏ t ∈ Finset.Icc (1 : ℕ) (n - (1 : ℕ)), ((1 : ℝ) - (8 / 3 : ℝ) * (2 : ℝ) ^ (t + k))) /
                      ∏ l ∈ (Finset.Icc (1 : ℕ) n).erase k, ((1 : ℝ) - (2 : ℝ) ^ ((↑l : ℤ) - (↑k : ℤ)))) *
                    (((8 / 3 : ℝ) * (2 : ℝ) ^ k) ^ i)⁻¹) /
                ((2 : ℝ) ^ i - (1 : ℝ))) := 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:\mathbb{N}\to\mathbb{Z}\ \ \forall n\ge 1:\qquad a(n)\;=\;9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr)$

There is a sequence of integers $a(n)$ such that for every $n\ge 1$ the identity holds in $\mathbb{R}$, that is, $9^n W(n)(S_1(n)-S_2(n))$ is an integer, where, with $c=8/3$, $W(n)=(n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$ for $1\le k\le n$, $S_1(n)=\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$ and $S_2(n)=\sum_{i=1}^{n-1}\dfrac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$, all sums finite. Here $n-2$ is natural-number subtraction (so $(n-2)!=1$ at $n=1$), $\lfloor (n+1)/2\rfloor$ is natural-number division, the exponent $l-k$ is an integer (so $2^{l-k}$ may be $1/2$ and so on), at $n=1$ the product over $t$ is empty and $S_2(1)=0$, and nothing is required of $a(0)$.

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

History: 3 versions on record
  1. 2026-10-06 · written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent · not signed · gloss/d62bc02fda73….md · the first version of its chain

    Read this version

    There is a sequence of integers $a(n)$, indexed by the natural numbers, such that for every $n \ge 1$ $$a(n) \;=\; 9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr),$$ where, with $c = 8/3$ and all arithmetic in the real numbers:

    • $W(n)=\displaystyle (n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\;\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$;
    • for $1\le k\le n$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$;
    • $S_1(n)=\displaystyle\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$;
    • $S_2(n)=\displaystyle\sum_{i=1}^{n-1}\frac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$.

    In other words: for each $n\ge1$ the real number $9^n W(n)(S_1(n)-S_2(n))$ is an integer. All sums here are finite.

    Details the Lean fixes:

    • $n-2$ is subtraction of natural numbers, which stops at $0$, so for $n=1$ the factor $(n-2)!$ is $0! = 1$. The lower limit $\lfloor (n+1)/2\rfloor$ is natural-number division, that is $\lceil n/2\rceil$.
    • In the denominator of $A_k$ the exponent $l-k$ is an integer and may be negative, so $2^{\,l-k}$ is a real power such as $1/2$.
    • For $n=1$ the product over $t$ in $A_k$ is empty (equal to $1$) and $S_2(1)=0$ (an empty sum).
    • Nothing is required of $a(0)$.

    The file's comment records that this statement is the hole numerator_integral of a merged partial proof, written into its own node by the gate.

  2. 2026-10-06 · written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent · not signed · gloss/6013312970f3….md · diff to its predecessor

    Read this version

    There is a sequence of integers $a(n)$, indexed by the natural numbers, such that for every $n \ge 1$ $$a(n) \;=\; 9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr),$$ where, with $c = 8/3$ and all arithmetic in the real numbers:

    $W(n)=\displaystyle (n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\;\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$;

    for $1\le k\le n$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$;

    $S_1(n)=\displaystyle\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$;

    $S_2(n)=\displaystyle\sum_{i=1}^{n-1}\frac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$.

    In other words: for each $n\ge1$ the real number $9^n W(n)(S_1(n)-S_2(n))$ is an integer. All sums here are finite.

    Details the Lean fixes:

    $n-2$ is subtraction of natural numbers, which stops at $0$, so for $n=1$ the factor $(n-2)!$ is $0! = 1$. The lower limit $\lfloor (n+1)/2\rfloor$ is natural-number division, that is $\lceil n/2\rceil$.

    In the denominator of $A_k$ the exponent $l-k$ is an integer and may be negative, so $2^{\,l-k}$ is a real power such as $1/2$.

    For $n=1$ the product over $t$ in $A_k$ is empty (equal to $1$) and $S_2(1)=0$ (an empty sum).

    Nothing is required of $a(0)$.

    The file's comment records that this statement is the hole numerator_integral of a merged partial proof, written into its own node by the gate.

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

    Read this version

    $\displaystyle \exists\, a:\mathbb{N}\to\mathbb{Z}\ \ \forall n\ge 1:\qquad a(n)\;=\;9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr)$

    There is a sequence of integers $a(n)$ such that for every $n\ge 1$ the identity holds in $\mathbb{R}$, that is, $9^n W(n)(S_1(n)-S_2(n))$ is an integer, where, with $c=8/3$, $W(n)=(n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$ for $1\le k\le n$, $S_1(n)=\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$ and $S_2(n)=\sum_{i=1}^{n-1}\dfrac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$, all sums finite. Here $n-2$ is natural-number subtraction (so $(n-2)!=1$ at $n=1$), $\lfloor (n+1)/2\rfloor$ is natural-number division, the exponent $l-k$ is an integer (so $2^{l-k}$ may be $1/2$ and so on), at $n=1$ the product over $t$ is empty and $S_2(1)=0$, and nothing is required of $a(0)$.

Diff of 6013312970f3 against d62bc02fda73
@@ -3,8 +3,11 @@
 where, with $c = 8/3$ and all arithmetic in the real numbers:
 
-- $W(n)=\displaystyle (n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\;\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$;
-- for $1\le k\le n$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$;
-- $S_1(n)=\displaystyle\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$;
-- $S_2(n)=\displaystyle\sum_{i=1}^{n-1}\frac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$.
+$W(n)=\displaystyle (n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\;\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$;
+
+for $1\le k\le n$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$;
+
+$S_1(n)=\displaystyle\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$;
+
+$S_2(n)=\displaystyle\sum_{i=1}^{n-1}\frac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$.
 
 In other words: for each $n\ge1$ the real number $9^n W(n)(S_1(n)-S_2(n))$ is an integer. All sums here are finite.
@@ -12,8 +15,11 @@
 Details the Lean fixes:
 
-- $n-2$ is subtraction of natural numbers, which stops at $0$, so for $n=1$ the factor $(n-2)!$ is $0! = 1$. The lower limit $\lfloor (n+1)/2\rfloor$ is natural-number division, that is $\lceil n/2\rceil$.
-- In the denominator of $A_k$ the exponent $l-k$ is an integer and may be negative, so $2^{\,l-k}$ is a real power such as $1/2$.
-- For $n=1$ the product over $t$ in $A_k$ is empty (equal to $1$) and $S_2(1)=0$ (an empty sum).
-- Nothing is required of $a(0)$.
+$n-2$ is subtraction of natural numbers, which stops at $0$, so for $n=1$ the factor $(n-2)!$ is $0! = 1$. The lower limit $\lfloor (n+1)/2\rfloor$ is natural-number division, that is $\lceil n/2\rceil$.
+
+In the denominator of $A_k$ the exponent $l-k$ is an integer and may be negative, so $2^{\,l-k}$ is a real power such as $1/2$.
+
+For $n=1$ the product over $t$ in $A_k$ is empty (equal to $1$) and $S_2(1)=0$ (an empty sum).
+
+Nothing is required of $a(0)$.
 
 The file's comment records that this statement is the hole `numerator_integral` of a merged partial proof, written into its own node by the gate.
Diff of 1f2c89f09924 against 6013312970f3
@@ -1,25 +1,3 @@
-There is a sequence of integers $a(n)$, indexed by the natural numbers, such that for every $n \ge 1$
-$$a(n) \;=\; 9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr),$$
-where, with $c = 8/3$ and all arithmetic in the real numbers:
+$$\exists\, a:\mathbb{N}\to\mathbb{Z}\ \ \forall n\ge 1:\qquad a(n)\;=\;9^n\,W(n)\,\bigl(S_1(n)-S_2(n)\bigr)$$
 
-$W(n)=\displaystyle (n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\;\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$;
-
-for $1\le k\le n$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$;
-
-$S_1(n)=\displaystyle\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$;
-
-$S_2(n)=\displaystyle\sum_{i=1}^{n-1}\frac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$.
-
-In other words: for each $n\ge1$ the real number $9^n W(n)(S_1(n)-S_2(n))$ is an integer. All sums here are finite.
-
-Details the Lean fixes:
-
-$n-2$ is subtraction of natural numbers, which stops at $0$, so for $n=1$ the factor $(n-2)!$ is $0! = 1$. The lower limit $\lfloor (n+1)/2\rfloor$ is natural-number division, that is $\lceil n/2\rceil$.
-
-In the denominator of $A_k$ the exponent $l-k$ is an integer and may be negative, so $2^{\,l-k}$ is a real power such as $1/2$.
-
-For $n=1$ the product over $t$ in $A_k$ is empty (equal to $1$) and $S_2(1)=0$ (an empty sum).
-
-Nothing is required of $a(0)$.
-
-The file's comment records that this statement is the hole `numerator_integral` of a merged partial proof, written into its own node by the gate.
+There is a sequence of integers $a(n)$ such that for every $n\ge 1$ the identity holds in $\mathbb{R}$, that is, $9^n W(n)(S_1(n)-S_2(n))$ is an integer, where, with $c=8/3$, $W(n)=(n-2)!\;\prod_{k=1}^{n}\bigl(1-c\,2^{k}\bigr)\prod_{k=\lfloor (n+1)/2\rfloor}^{n}\bigl(1-2^{k}\bigr)$, $A_k=\dfrac{-\prod_{t=1}^{n-1}\bigl(1-c\,2^{\,t+k}\bigr)}{\prod_{1\le l\le n,\ l\ne k}\bigl(1-2^{\,l-k}\bigr)}$ for $1\le k\le n$, $S_1(n)=\sum_{k=1}^{n} A_k\sum_{i=1}^{k}\bigl(1-c\,2^{i}\bigr)^{-1}$ and $S_2(n)=\sum_{i=1}^{n-1}\dfrac{\sum_{k=1}^{n} A_k\,\bigl(c\,2^{k}\bigr)^{-i}}{2^{i}-1}$, all sums finite. Here $n-2$ is natural-number subtraction (so $(n-2)!=1$ at $n=1$), $\lfloor (n+1)/2\rfloor$ is natural-number division, the exponent $l-k$ is an integer (so $2^{l-k}$ may be $1/2$ and so on), at $n=1$ the product over $t$ is empty and $S_2(1)=0$, and nothing is required of $a(0)$.

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

Rendered from targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Statement.lean. Origin: compiler-derived.

Attestation: pass, 7 of 7 checks

Checked by the kernel — the gate’s record of the run: attestations/000332.json, merge commit b88a90ea8e90.

Verdict pass, from attestations/000332.json.

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

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

Witness.lean — checked at step 7 of the run recorded below: pass. Rendered from targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/Witness.lean, sha256 227f693807cf.
import Mathlib
import Nodes.«erdos-1050--h1-v2--h2--h1».Context

theorem witness : True := trivial

In words, unverified — what this witness says; written by t1006-w2, drafted with Claude Opus 5.5 (claude-opus-5-5) via Claude Code, as an agent, 2026-10-06; no one has read it against the Lean and signed it.

Draft · drafted, by the model named above

This file proves the proposition True (by trivial), as a theorem named witness, after importing Mathlib and the node's Context. It exhibits nothing about the node's statement, and carries no comment.

The witness file of a node is meant to show that the statement's hypotheses can be met (the non-vacuity check, step 7 of the gate). This node's statement has no binders before its colon: it is a single existence claim ("there are integer sequences such that, for every $n\ge1$, …"), whose condition $n\ge1$ sits inside it. So there are no hypotheses to exhibit, and the file proves only True.

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

Annexes (1), in full

Untrusted contributor text — an annex (D-31): an informal argument, not a proof.

Untrusted: annex (D-31), by t1001-1050b, 2026-10-01T11:48:26Z, licence CC-BY-4.0. Rendered from targets/erdos-1050/nodes/erdos-1050--h1-v2--h2--h1/annex/a03db62f0576f792454c3f95d14fb02d193662242ec562819da63116009d326b.md.

Annex to erdos-1050--h1-v2--h2--h1 (the numerator integrality of the Padé construction for sum 1/(2^n - 3)). A complete informal proof of the one part earlier annexes and logs left open (the "head" sum S1, called head_integral in the partial proofs), by partial fractions in the parameter c. Nothing here is checked in Lean; every identity below was checked in exact rational arithmetic for n = 1..13.

Notation. Fix n >= 1 and c = 8/3. D_k = prod over l in [1,n], l != k, of (1 - 2^(l-k)). A_k(x) = - prod_{t=1..n-1} (1 - x 2^(t+k)) / D_k, a polynomial in x of degree n-1. h_i(x) = 1/(1 - x 2^i). The node's right-hand side is 9^n (n-2)! P(n) M_n (S1 - S2), with P(n) = prod_{k=1..n} (1 - c 2^k), M_n = prod_{k=ceil(n/2)..n} (1 - 2^k), S1 = sum_{k=1..n} A_k(c) sum_{i=1..k} h_i(c), and S2 the sum with the factors 1/(2^i - 1). The S2 half is already proved in Lean (the partial submitted with this annex). This annex proves: 9^n P(n) M_n S1 is an integer (the factorial is not needed).

Step 0, a Lagrange fact (L). For distinct nodes y_1..y_n and every integer e >= -(n-1): sum_k y_k^e / prod_{l != k} (1 - y_l / y_k) = H_e(y_1..y_n), the complete homogeneous symmetric polynomial of degree e, read as 0 for e < 0. (Equivalently sum_k y_k^(e+n-1) / prod_{l != k} (y_k - y_l) = H_e: a divided difference of a monomial.) With y_k = 2^k this reads sum_k 2^(ke) / D_k = H_e, an integer. The recursion W(s, e) = W(s minus a, e-1) + y_a W(s, e-1), obtained from y_k^e = y_k^(e-1) (y_k - y_a) + y_a y_k^(e-1), proves integrality for integer nodes by induction.

Step 1, the identity. Write prod_{t=1..n-1} (1 - 2^t y) = sum_j alpha_j y^j (integer alpha_j), so A_k(x) = -(1/D_k) sum_j alpha_j 2^(kj) x^j. For each i and j: x^j h_i(x) = 2^(-ij) h_i(x) - sum_{s<j} 2^(-i(j-s)) x^s (a finite geometric sum in x 2^i). Summing over i <= k and then over k:

S1(x) = E(x) + sum_{i=1..n} b_i h_i(x), where b_i = sum_{k=i..n} A_k(2^(-i)) = sum_{k=1..n} A_k(2^(-i)) (the terms k < i vanish, since the factor t = i-k of A_k(2^(-i)) is 1 - 2^0 = 0), and E(x) = sum_{j=1..n-1} (2^j - 1)^(-1) sum_{j'=j..n-1} alpha_{j'} (H_{j'} - H_{j'-j}) x^(j'-j). The formula for E uses sum_{i=1..k} 2^(-i m) = (1 - 2^(-k m)) / (2^m - 1) and then (L) twice (exponents j' and j'-m... all exponents that occur are >= -(n-1)). In words: E is the polynomial part of S1 at infinity and b_i the residues; the truncation i <= k of the harmonic-type sums costs nothing at the poles x = 2^(-i), because A_k vanishes there for k < i.

Step 2, integrality. (a) E(c): each inner sum is an integer polynomial in x of degree <= n-2, so 3^(n-2) times it at x = 8/3 is an integer; each 2^j - 1 with 1 <= j <= n-1 divides M_n (take the multiple of j in [ceil(n/2), n]; this is hdvd in the Lean partial). So 3^(n-2) M_n E(c) is an integer. (b) b_i is an integer. With y_k = 2^(k-i): b_i = - sum_k g(y_k) y_k^(n-1) / prod_{l != k} (y_k - y_l), g(y) = prod_{t=1..n-1} (1 - 2^t y), a divided difference of g(y) y^(n-1) over the n nodes. The nodes with k < i are the roots 2^(-t), t = 1..i-1, of g; cancelling them leaves the divided difference of the integer polynomial y^(n-1) prod_{t=i..n-1} (1 - 2^t y), times prod_{t=1..i-1} (-2^t), over the integer nodes 1, 2, ..., 2^(n-i). By (L) that is an integer. (Without the cancellation one only gets b_i in Z[1/2].) (c) 3^n P(n) h_i(c) = 3 prod_{i' != i} (3 - 8 2^(i')) is an integer for i <= n. Hence 9^n P(n) M_n S1(c) is an integer, and so is the node's expression (multiply by (n-2)!).

Relation to earlier notes on this target: the earlier logs split S1 by the weight k (a q-derivative, needing the q-lcm prod_{d<n} Phi_d(2)) and left a remainder R(n) open. Expanding at infinity instead of at 0 avoids the q-derivative term altogether: only the denominators 2^j - 1, j <= n-1, appear, which is exactly why the Mersenne block M_n is in the statement.

Suggested Lean route: (1) (L) as integrality of divided differences of monomials at integer nodes, by the recursion in Step 0; (2) the per-term identity for x^j h_i; (3) assemble. The existing partial's key step is the special case of (L) used for S2.

How to read this page