OP_SUCCESSx makes the script succeed
ProvedBitcoinTaproot.opsuccess_acceptsIf the OP_SUCCESSx pre-scan of a script returns true, executeTapscript returns true for every context, execution data, stack and weight: the script's body is never executed (BIP342).
import Definitions.Def_BitcoinTaproot open BitcoinTaproot BitcoinSer BitcoinSig BitcoinVerify open BitcoinScript hiding Bytes Byte
theorem BitcoinTaproot.opsuccess_accepts (c : TapCtx) (ed : ExecData) (stack : List Bytes) (script : Bytes) (weight : Int)
(h : BitcoinTaproot.opSuccessScan script.length script = some true) :
BitcoinTaproot.executeTapscript c ed stack script weight = true := 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.opsuccess_accepts
Binders. : a TapCtx record (flags cltv, csv, nulldummy; transaction; list of spent outputs; input index); : an ExecData record; : a list of byte strings; : a byte string; .
Hypothesis. .
Here is a fuel-bounded scan of the byte string : if is empty the result is ; else if the fuel is the result is ; else one instruction is read from the front of by the bundle's GetOp (bytes are pushes — a direct push of bytes for , or PUSHDATA1/2/4 with a 1/2/4-byte little-endian length — and reading fails, giving , if the length prefix or the push data runs past the end; any byte is a non-push opcode). On a push the scan continues on the remainder with fuel ; on an opcode byte , if holds the result is , otherwise the scan continues. holds iff . So the hypothesis says: reading instruction by instruction from the start, an OP_SUCCESSx byte is reached before any malformed push and before the end.
Conclusion.
Unfolded: first evaluates ; on it returns , on it returns immediately, and only on does it go on to the stack-size test (), the element-size test (every element bytes), parsing, running the Tapscript loop from the initial state (main stack , empty alt stack and condition stack, weight , code-separator position , opcode position ), and the final "exactly one element, and it is true" test. The theorem asserts the second case.
Edge cases the quantifiers include. with more than elements or with elements longer than bytes (still ); negative; that would fail to parse after the success opcode (the scan stops at the first success opcode, so later bytes are unconstrained); the success opcode may be preceded by pushes and by non-success opcodes; and are never consulted.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.