Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§5.1, p. 10 — the general solution J(n)=l1+l2+k1α−n+k2α+nJ(n)=l_1+l_2+k_1\alpha_-^n+k_2\alpha_+^nJ(n)=l1​+l2​+k1​α−n​+k2​α+n​ of (15)

Proved
LNChannels.Exact.general_solution

by mikedeng1 · Oct 15, 2026 · Mathlib 0df444a (Lean v4.33.1)

difference-equationsp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1payment-channels

Let λ1,λ2,r>0\lambda_1,\lambda_2,r>0λ1​,λ2​,r>0, let l1,l2≥1l_1,l_2\ge1l1​,l2​≥1 be natural numbers, and let α±\alpha_\pmα±​ be the roots (4). A function J:Z→RJ:\mathbb Z\to\mathbb RJ:Z→R satisfies the difference equation (15),

J(n)=(l1+l2)rr+λ2+λ1+J(n+1)λ2r+λ2+λ1+J(n−1)λ1r+λ2+λ1,J(n)=(l_1+l_2)\frac{r}{r+\lambda_2+\lambda_1}+J(n+1)\frac{\lambda_2}{r+\lambda_2+\lambda_1}+J(n-1)\frac{\lambda_1}{r+\lambda_2+\lambda_1},J(n)=(l1​+l2​)r+λ2​+λ1​r​+J(n+1)r+λ2​+λ1​λ2​​+J(n−1)r+λ2​+λ1​λ1​​,

at every interior balance −l1<n<l2-l_1<n<l_2−l1​<n<l2​ if and only if there are real constants k1,k2k_1,k_2k1​,k2​ with

J(n)=l1+l2+k1α− n+k2α+ nfor all −l1≤n≤l2.J(n)=l_1+l_2+k_1\alpha_-^{\,n}+k_2\alpha_+^{\,n}\qquad\text{for all } -l_1\le n\le l_2 .J(n)=l1​+l2​+k1​α−n​+k2​α+n​for all −l1​≤n≤l2​.

This reduces the cost of a bidirectional channel to the two constants k1,k2k_1,k_2k1​,k2​, which the boundary conditions then determine.

Formalization Note Powers α± n\alpha_\pm^{\,n}α±n​ with n∈Zn\in\mathbb Zn∈Z are integer powers (zpow); the roots are positive under the hypotheses. Both directions are asserted.

Preamble
import Mathlib
import Definitions.Def_LNChannels_Exact_alphaPlus
import Definitions.Def_LNChannels_Exact_alphaMinus

set_option autoImplicit false
Formal statement
namespace LNChannels.Exact

/-- §5.1, p. 10: on the lattice `−l₁ ≤ n ≤ l₂`, `J` satisfies the difference equation (15) at
every interior balance `−l₁ < n < l₂` if and only if `J(n) = l₁ + l₂ + k₁ α₋ⁿ + k₂ α₊ⁿ` there for
some constants `k₁, k₂` (integer powers, `zpow`). -/
theorem general_solution (lam₁ lam₂ r : ℝ) (l₁ l₂ : ℕ)
    (hlam₁ : 0 < lam₁) (hlam₂ : 0 < lam₂) (hr : 0 < r) (hl₁ : 1 ≤ l₁) (hl₂ : 1 ≤ l₂)
    (J : ℤ → ℝ) :
    let a := alphaMinus lam₁ lam₂ r
    let b := alphaPlus lam₁ lam₂ r
    (∀ n : ℤ, -(l₁ : ℤ) < n → n < (l₂ : ℤ) →
        J n = ((l₁ : ℝ) + l₂) * (r / (r + lam₂ + lam₁))
              + J (n + 1) * (lam₂ / (r + lam₂ + lam₁))
              + J (n - 1) * (lam₁ / (r + lam₂ + lam₁))) ↔
      ∃ k₁ k₂ : ℝ, ∀ n : ℤ, -(l₁ : ℤ) ≤ n → n ≤ (l₂ : ℤ) →
        J n = (l₁ : ℝ) + l₂ + k₁ * a ^ n + k₂ * b ^ n := by sorry

end LNChannels.Exact
Source
Guasoni, Huberman & Shikhelman, Lightning Network Economics: Channels, Management Science (Articles in Advance, Nov. 6, 2023), p. 10 (PDF p. 11), §5.1, "The general solution to (15) is"
Human review
  • Endorsed by Shuze Chen · Oct 15, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 15, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me