The validation-weight budget
ProvedBitcoinTaproot.sigops_budgetAn executed OP_CHECKSIG with a non-empty signature when fewer than 50 weight units remain is a script error (SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT), before any key or signature is examined.
import Definitions.Def_BitcoinTaproot import Definitions.Def_BitcoinScript open BitcoinTaproot BitcoinSer BitcoinSig BitcoinVerify open BitcoinScript hiding Bytes Byte
theorem BitcoinTaproot.sigops_budget (c : TapCtx) (ed : ExecData) (ts : TapState) (pubkey sig : Bytes) (rest : List Bytes)
(hs : ts.st.stack = pubkey :: sig :: rest) (hsig : sig ≠ []) (hw : ts.weightLeft < BitcoinTaproot.VALIDATION_WEIGHT_PER_SIGOP_PASSED) :
BitcoinTaproot.tapExecOp c ed true BitcoinScript.OP_CHECKSIG ts = 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.sigops_budget
Binders. : a TapCtx record (flags; transaction ; list ; index ); : an ExecData record; : a TapState record ( : interpreter state; ; ); : byte strings; : a list of byte strings.
Hypotheses.
- (main stack, top first);
- ;
- as integers (the constant
VALIDATION_WEIGHT_PER_SIGOP_PASSED, which is the integer ).
Conclusion.
where is OP_CHECKSIG.
Unfolded. For OP_CHECKSIG, requires the stack shape of hypothesis 1 (else ) and calls , where is with codeseparatorPos replaced by . In that function by hypothesis 2, so (integer subtraction); the first test "if then " fires because gives . This test precedes the public-key length tests (; Schnorr check; other lengths accept) and the signature verification, none of which are reached. A from makes return .
Edge cases the quantifiers include. of any length, including empty or non-32-byte; of any non-zero length (not only 64/65); negative or exactly ; empty; arbitrary and (never consulted).
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.