proofs
Provednlightninglightningpr-14deep-formalization

Every BOLT 12 invoice-request range lies in the invoice range

For all t∈N\htmlData{mx=1}{t \in \htmlData{mx=0}{\mathbb{N}}}:

((t≤159∨1000000000≤t∧t≤2999999999)  ⟹  (t≤239∨1000000000≤t∧t≤3999999999))\begin{aligned} & \left(\right. (\htmlData{mx=1}{t} \mathrel{\htmlData{mx=2}{\leq}} 159 \mathbin{\htmlData{mx=8}{\lor}} 1000000000 \mathrel{\htmlData{mx=4}{\leq}} \htmlData{mx=3}{t} \mathbin{\htmlData{mx=7}{\land}} \htmlData{mx=5}{t} \mathrel{\htmlData{mx=6}{\leq}} 2999999999) \\ & \htmlData{mx=0}{\implies} (\htmlData{mx=9}{t} \mathrel{\htmlData{mx=10}{\leq}} 239 \mathbin{\htmlData{mx=16}{\lor}} 1000000000 \mathrel{\htmlData{mx=12}{\leq}} \htmlData{mx=11}{t} \mathbin{\htmlData{mx=15}{\land}} \htmlData{mx=13}{t} \mathrel{\htmlData{mx=14}{\leq}} 3999999999) \left.\right) \end{aligned}
What the notation means · or point at any symbol
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (Nat)
⟹Implies
If t ≤ 159 ∨ 1000000000 ≤ t ∧ t ≤ 2999999999, then t ≤ 239 ∨ 1000000000 ≤ t ∧ t ≤ 3999999999. (Between types, A → B is the type of functions from A to B.) ((t ≤ 159 ∨ (1000000000 ≤ t ∧ t ≤ 299999…)
≤At most
t is less than or equal to 159. (t ≤ 159)
∨Or
At least one holds: t ≤ 159, or 1000000000 ≤ t ∧ t ≤ 2999999999. (t ≤ 159 ∨ (1000000000 ≤ t ∧ t ≤ 2999999…)
∧And
Both hold: 1000000000 ≤ t, and t ≤ 2999999999. (1000000000 ≤ t ∧ t ≤ 2999999999)

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.

More proved statements