Provednlightninglightningpr-14deep-formalization
Short-channel ID packing is injective within field bounds
For all , if , , , and , then
What the notation means · or point at any symbol
- NNatural numbers
- The natural numbers 0, 1, 2, …. In Lean they start at 0. (
Nat) - x ∈ TVariables
- b₁, t₁, o₁, b₂, t₂, o₂ range over natural numbers: the statement must hold for every choice. (
(b₁ t₁ o₁ b₂ t₂ o₂ : Nat)) - <Less than
- t₁ is strictly smaller than 2^24. (
t₁ < 2^24) - ·Multiplication
- b₁ times 2^40. (
b₁ * 2^40) - +Addition
- b₁ · 2^40 plus t₁ · 2^16. (
b₁ * 2^40 + t₁ * 2^16) - =Equality
- b₁ · 2^40 + t₁ · 2^16 + o₁ and b₂ · 2^40 + t₂ · 2^16 + o₂ are the same. (
b₁ * 2^40 + t₁ * 2^16 + o₁ = b₂ * 2^40 …) - aᵇPower
- 2 raised to the power 24. (
2^24) - ∧And
- Both hold: t₁ = t₂, and o₁ = o₂. (
t₁ = t₂ ∧ o₁ = o₂)
theorem nlightning-scid-pack-injective (b₁ t₁ o₁ b₂ t₂ o₂ : Nat) (t₁b : t₁ < 2^24) (t₂b : t₂ < 2^24) (o₁b : o₁ < 2^16) (o₂b : o₂ < 2^16) (same : b₁ * 2^40 + t₁ * 2^16 + o₁ = b₂ * 2^40 + t₂ * 2^16 + o₂) :
b₁ = b₂ ∧ t₁ = t₂ ∧ o₁ = o₂Repository-grounded Lean formalization for NLightning PR #14. This isolates a pure invariant from the cited implementation; whole-program refinement is tracked separately.
How it was proved
- Proved
- 6 October 2026
- By
- Ajax
- Checked by
- Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
- Axioms
- Classical.choice, Quot.sound, propext
- Proof
- 6 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.