§5.1, p. 10 — the cost function of a bidirectional channel in closed form
ProvedLNChannels.Exact.cost_functiondifference-equationslightning-networkp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1payment-channels
Let , , , and natural commitments ; let be the roots (4). The bidirectional cost system ((15) with ) has a solution, and every solution satisfies, at every balance ,
At this is the closed form (3) of the channel's cost.
Formalization Note The paper prints the exponent of the numerator's as ; it is (this is what solving the two boundary equations gives, and what reduces to (3) at ). The powers are integer powers (zpow), with a nonnegative exponent on the lattice. Existence of a solution is part of the statement.
Preamble
import Mathlib import Definitions.Def_LNChannels_Exact_alphaPlus import Definitions.Def_LNChannels_Exact_alphaMinus import Definitions.Def_LNChannels_Exact_IsBiCostFn set_option autoImplicit false
Formal statement
namespace LNChannels.Exact
/-- §5.1, p. 10, the display after "which yield the cost function": the cost `J(n)` at every
balance `−l₁ ≤ n ≤ l₂` of a bidirectional channel. The printed exponent `l + n` in the numerator
is read as `l₁ + n`. Powers with exponent depending on `n` are `zpow`s with exponent
`l₁ + n ≥ 0` on the lattice. -/
theorem cost_function (lam₁ lam₂ r B : ℝ) (l₁ l₂ : ℕ)
(hlam₁ : 0 < lam₁) (hlam : lam₁ ≤ lam₂) (hr : 0 < r) (hl₁ : 1 ≤ l₁) (hl₂ : 1 ≤ l₂) :
let a := alphaMinus lam₁ lam₂ r
let b := alphaPlus lam₁ lam₂ r
(∃ J : ℤ → ℝ, IsBiCostFn lam₁ lam₂ r B l₁ l₂ J) ∧
∀ J : ℤ → ℝ, IsBiCostFn lam₁ lam₂ r B l₁ l₂ J →
∀ n : ℤ, -(l₁ : ℤ) ≤ n → n ≤ (l₂ : ℤ) →
J n = (l₁ : ℝ) + l₂ - B *
(((a ^ (l₁ + l₂) - 1) * b ^ ((l₁ : ℤ) + n) - (b ^ (l₁ + l₂) - 1) * a ^ ((l₁ : ℤ) + n)) /
(a ^ l₁ - b ^ l₁ + (b ^ l₁ - 1) * a ^ (l₁ + l₂) - (a ^ l₁ - 1) * b ^ (l₁ + l₂))) := 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, display after "which yield the cost function" (exponent l + n read as l1 + n)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.