A disabled opcode fails the script wherever it appears
ProvedBitcoinScript.disabled_failsFor every flag setting, oracle, script, and state, if the script contains any of the fifteen disabled opcodes (CAT, SUBSTR, LEFT, RIGHT, INVERT, AND, OR, XOR, 2MUL, 2DIV, MUL, DIV, MOD, LSHIFT, RSHIFT), running it fails — even when the opcode sits in a branch that would not execute. This is the CVE-2010-5137 rule.
import Definitions.Def_BitcoinScript
theorem BitcoinScript.disabled_fails (f : Flags) (o : Oracle) (script : Script) (c : Byte)
(hc : BitcoinScript.isDisabled c = true) (hmem : Instr.op c ∈ script) :
∀ s : State, BitcoinScript.run f o s script = 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: BitcoinScript.disabled_fails
Binders and hypothesis. Universally quantified: , a record of three Booleans (cltv, csv, nulldummy), arbitrary; , an oracle (eight arbitrary functions: five byte-list hash functions, a signature check returning an optional Boolean, and two integer predicates), arbitrary; , a finite list of instructions, each either for a byte list or for a byte ; and , a byte. Two hypotheses:
- : , i.e. is one of the fifteen bytes (CAT), (SUBSTR), (LEFT), (RIGHT), (INVERT), (AND), (OR), (XOR), (2MUL), (2DIV), (MUL), (DIV), (MOD), (LSHIFT), (RSHIFT).
- : the instruction is a member of the list — it occurs at least once, at any position.
Conclusion. For every machine state (any main stack, any alt stack, any condition stack vfExec, any operation count opCount, with no constraints whatsoever):
The universal quantifier over is part of the conclusion, after the hypotheses.
Unfolding run. is if and none otherwise; applies and, if that yields , continues as ; if the step yields none, the result is none. So the conclusion says: processing the instructions of in order from state ends in failure — either some instruction before the disabled one already fails, or the disabled one does.
Unfolding step on the relevant instruction. When step reaches it computes , which is true for every disabled byte (all are ); if it returns none; otherwise it increments the count and then tests before looking at whether the branch is executing — and returns none. So in the model the disabled byte fails in both executed and non-executed branches, and whether the operation-count check or the disabled check fires first does not matter for the conclusion. Every earlier instruction either succeeds (and the run proceeds toward ) or fails (none), and later instructions are irrelevant because run stops at the first none.
Scope of the quantifiers. The statement covers scripts of any length and any content around the disabled opcode: scripts that would otherwise fail for unrelated reasons, scripts consisting solely of , scripts where appears inside an IF-branch that is not executed (vfExec containing false), scripts where appears after an unbalanced conditional. The initial state may already have an over-limit opCount, a stack exceeding elements, or a non-empty vfExec; the conclusion is claimed regardless.
What is not said. The theorem does not say where or why the run fails — it does not say the failure happens at the disabled instruction, only that the overall result is none. It does not say anything about evalScript or verifyScriptPlain directly (though they are defined via run); it is stated for run with an arbitrary starting state rather than for State.initial. It does not say that scripts without disabled opcodes succeed, nor that the fifteen listed bytes are the only bytes that always cause failure (e.g. OP_RETURN, OP_VERIF-range bytes, or unknown bytes are not mentioned). It does not consider a disabled byte appearing as the data of a instruction — only the instruction is required to be a member. It does not assert anything about the oracle or the flags; both are arbitrary and play no role in the conclusion.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.