SIGHASH_SINGLE without an output fails
ProvedBitcoinTaproot.sighash_single_missingFor a valid hash type whose output type is SIGHASH_SINGLE and an input index with no corresponding output, sigHashSchnorr is none: unlike the legacy sighash there is no uint256::ONE quirk in BIP341.
import Definitions.Def_BitcoinTaproot open BitcoinTaproot BitcoinSer BitcoinSig BitcoinVerify open BitcoinScript hiding Bytes Byte
theorem BitcoinTaproot.sighash_single_missing (tx : Tx) (spent : List TxOut) (inPos hashType : Nat) (tapscript : Bool) (ed : ExecData)
(hv : hashType ≤ 3 ∨ (0x81 ≤ hashType ∧ hashType ≤ 0x83)) (h3 : hashType &&& 3 = 3) (hout : tx.vout.length ≤ inPos) :
BitcoinTaproot.sigHashSchnorr tx spent inPos hashType tapscript ed = none := 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: BitcoinTaproot.sighash_single_missing
Binders. : a transaction (natural version, list of inputs , list of outputs , natural lock time); : a list of outputs; : natural numbers; : a Boolean; : an ExecData record (annexPresent : Boolean, annexHash, tapleafHash : byte strings, codeseparatorPos : natural).
Hypotheses.
- ;
- (bitwise AND on naturals);
- .
Conclusion.
Unfolded: first tests the guard of hypothesis 1 (it passes). It then sets the output type if , else . By hypothesis 2, (since ) and , the file's SIGHASH_SINGLE. Combined with hypothesis 1 this means . When the function computes the "single output" component as: if , otherwise the SHA-256 of the serialized output . When that component is the whole function returns without computing the tagged hash. Hypothesis 3 makes that component .
Edge cases the quantifiers include. empty (then every qualifies); also beyond (irrelevant, the default input is never reached); of any length; the Boolean and the record are arbitrary and unused.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.