MINIMALIF is consensus in Tapscript
ProvedBitcoinTaproot.minimalif_rejectsAn executed OP_IF whose top stack element is longer than one byte, or is one byte other than 0x01, is a script error (SCRIPT_ERR_TAPSCRIPT_MINIMALIF).
import Definitions.Def_BitcoinTaproot import Definitions.Def_BitcoinScript open BitcoinTaproot BitcoinSer BitcoinSig BitcoinVerify open BitcoinScript hiding Bytes Byte
theorem BitcoinTaproot.minimalif_rejects (c : TapCtx) (ed : ExecData) (ts : TapState) (top : Bytes) (rest : List Bytes)
(hs : ts.st.stack = top :: rest) (h : 1 < top.length ∨ (top.length = 1 ∧ (top.getD 0 0).toNat ≠ 1)) :
BitcoinTaproot.tapExecOp c ed true BitcoinScript.OP_IF 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.minimalif_rejects
Binders. : a TapCtx record (flags cltv, csv, nulldummy; transaction; spent outputs; input index); : an ExecData record; : a TapState record ( : interpreter state with main stack, alt stack, condition stack vfExec, op count; ; ); : a byte string; : a list of byte strings.
Hypotheses.
- (main stack, top first);
- , where is the first byte of read as a natural number (with default if there were no such byte — irrelevant under ).
Conclusion.
where is OP_IF and is script failure.
Unfolded. with opcode OP_IF (or OP_NOTIF) and execute flag inspects the main stack: if it is empty the result is ; if its top element satisfies or ( and ) the result is ; otherwise it delegates to the legacy interpreter's conditional (which pops , converts it to a Boolean by the "any non-zero byte, except negative zero" rule, negates for OP_NOTIF, and pushes the Boolean onto the condition stack). Hypothesis 2 is exactly the rejecting guard, so the result is regardless of , , the other fields of , and .
Edge cases the quantifiers include. , , , (single byte other than — all rejected); or any longer string (rejected); the statement says nothing about or , nor about OP_NOTIF; empty; arbitrary weight and condition stack.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.