Spending distinct present inputs removes exactly valueIn
ProvedBitcoinUtxo.totalValue_spendInputsFor every view with pairwise distinct outpoints and list of outpoints that is itself duplicate-free and all of whose members are present in ,
Without distinctness of the identity fails: a repeated outpoint is counted twice in valueIn but removed once.
import Definitions.Def_BitcoinUtxo open BitcoinUtxo
theorem BitcoinUtxo.totalValue_spendInputs {T : Type} [DecidableEq T] (u : UtxoSet T) :
∀ (ops : List (OutPoint T)), keysNodup u → ops.Nodup → (∀ op ∈ ops, haveCoin u op = true) →
totalValue (spendInputs u ops) = totalValue u - valueIn u ops := 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 of BitcoinUtxo.totalValue_spendInputs.
Let be any type with decidable equality. A UTXO set over is a finite ordered list of pairs with an outpoint over (a transaction id in and an index in ) and a coin (whose output value is the integer ). Write for the coin of the first entry of with outpoint , or "none" if there is none; is the Boolean " is not none". Write for the integer sum of over all entries of (with multiplicity, no range restriction, ). is the proposition that the outpoints of (first components, in list order) have no duplicates. removes every entry of outpoint from , and for a list of outpoints ,
(sequential removal, left to right; ). Finally,
the sum being over the list with multiplicity and equal to for the empty list.
The theorem states: for every type with decidable equality and every UTXO set over , for every finite list of outpoints over , if
- (the outpoints of are pairwise distinct), and
- the list has no duplicate outpoints (as a list over the outpoint type, i.e. no two positions hold the same pair ), and
- for every outpoint occurring in , (every listed outpoint has an entry in ),
then
an exact equality in .
The quantifier over is inside the statement, after is fixed; may be empty, in which case the third hypothesis is vacuous and the conclusion reads . No sign or range condition is imposed on any coin value.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.