The pinning bound is exactly rule 4
ProvedBitcoinReplacement.pinning_cost_tightIf R.evicted = t ::ₘ D then PaysForRBF rate R iff : the bound of pinning_cost is attained, so the pinning cost is neither more nor less than the descendants' fees plus the incremental fee.
import Definitions.Def_BitcoinReplacement
theorem BitcoinReplacement.pinning_cost_tight (rate : BitcoinReplacement.FeeRate)
(t : BitcoinReplacement.Tx) (D : Multiset BitcoinReplacement.Tx)
(R : BitcoinReplacement.Replacement) (hE : R.evicted = t ::ₘ D) :
BitcoinReplacement.PaysForRBF rate R ↔
t.fee + BitcoinReplacement.totalFee D + rate.getFee R.new.vsize ≤ R.new.fee := by sorryRead-back
What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinReplacement.pinning_cost_tight
Setting (unfolded from the preamble). All declarations live in a namespace BitcoinReplacement. A transaction is a pair of natural numbers together with a proof that ; may be . Two transactions are equal exactly when their fees and virtual sizes agree. A fee rate is a pair of natural numbers together with a proof that ; may be , and nothing identifies with . For a fee rate and a natural number ,
computed with natural-number (rounding-down) division; since the inner subtraction is exact, and the value equals . In particular , and for every whenever .
A replacement consists of a transaction , a multiset of transactions , a multiset of transactions , and a proof that as multisets (every transaction value occurs in at most as many times as it occurs in ). Either multiset may be empty, may itself occur in , and no other relation between the three components is imposed. For a multiset of transactions, , summed with multiplicity, so .
is valid at rate (written ) when all three of the following hold:
- () for every transaction value occurring in , (a strict cross-multiplied comparison in ; vacuously true when is empty; nothing is required of elements of that do not occur in );
- (, first conjunct) ;
- (, second conjunct) , where is truncated natural-number subtraction (it returns when the subtrahend exceeds the minuend; under item 2 it coincides with ordinary subtraction).
For a transaction and a multiset of transactions, denotes the multiset obtained from by adding one further copy of .
Statement. For every fee rate , every transaction , every multiset of transactions, and every replacement such that
as an equality of multisets (so is nonempty and consists exactly of one copy of together with the elements of ), the following two conditions are equivalent:
- Left side: , i.e.
with truncated natural-number subtraction;
- Right side:
Edge cases and scope. No validity hypothesis is assumed: is neither assumed nor part of either side, and is not mentioned (it is constrained only by the built-in requirement ). may be empty. Under the hypothesis, . If the term is . The equivalence is a biconditional.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.