CheckTransaction yields distinct inputs and in-range outputs
ProvedBitcoinUtxo.checkTransaction_outputsFor every transaction with : the input outpoints of are pairwise distinct, and every output value of satisfies . These are the two facts of CheckTransaction that the value accounting consumes: the duplicate-input rejection (CVE-2018-17144) and the output-range loop (CVE-2010-5139).
import Definitions.Def_BitcoinUtxo open BitcoinUtxo
theorem BitcoinUtxo.checkTransaction_outputs {T : Type} [DecidableEq T] (tx : Tx T) (h : checkTransaction tx = true) :
tx.vin.Nodup ∧ ∀ o ∈ tx.vout, 0 ≤ o.value ∧ o.value ≤ MAX_MONEY := 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.checkTransaction_outputs.
Let be any type with decidable equality. A transaction over is a record with a transaction id , a finite list of inputs (each an outpoint: a transaction id in together with an index in ), a finite list of outputs (each an output record with an integer and a Boolean ), and an independent Boolean flag . The constant is the integer , and is the Boolean "".
The Boolean is the conjunction of:
- is non-empty;
- is non-empty;
- the output loop started at accumulator succeeds: walking through in order with running total , , no step fails, where step fails if , or if , or if (i.e. not );
- the list has no duplicate entries.
The theorem states: for every type with decidable equality and every transaction over , if , then
- the list has no duplicate outpoints, and
- for every output occurring in , and (both inequalities non-strict).
The conclusion says nothing about the non-emptiness of or , nothing about the partial sums or the total being at most , and nothing about or , even though some of these are tested by the hypothesis. The universal statement over outputs is vacuous if were empty, but the hypothesis rules that out.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.