Adding a coin at a fresh outpoint adds its value, or nothing if unspendable
ProvedBitcoinUtxo.totalValue_add_freshFor every view , outpoint absent from , and coin ,
This is AddCoin on a fresh outpoint: an OP_RETURN-style output is dropped, any other is stored.
import Definitions.Def_BitcoinUtxo open BitcoinUtxo
theorem BitcoinUtxo.totalValue_add_fresh {T : Type} [DecidableEq T] (u : UtxoSet T) (op : OutPoint T) (c : Coin)
(h : getCoin u op = none) :
totalValue (addCoin u op c) = totalValue u + (if c.out.unspendable then 0 else c.out.value) := 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_add_fresh.
Let be any type with decidable equality. A UTXO set over is a finite ordered list of pairs with an outpoint (a transaction id in and an index ) and a coin (a record with an output , itself a record with an integer and a Boolean , together with a height and a Boolean ). Write for the coin of the first entry of with outpoint , or "none" if no entry has outpoint . Write for the integer sum of over all entries of (every entry counted, no range restriction, ). Write for with every entry of outpoint removed. The operation is defined as
i.e. an unspendable coin leaves untouched, while a spendable one first deletes all entries at and then prepends .
The theorem states: for every type with decidable equality, every UTXO set over , every outpoint over and every coin , if (no entry of has outpoint ), then
an exact equality of integers.
There is no hypothesis that the outpoints of are pairwise distinct (no keysNodup), and no restriction on the sign or size of or of the values in ; may be empty. The hypothesis guarantees that removes nothing.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.