A push-only script leaves exactly its pushes
ProvedBitcoinScript.eval_pushesFor every flag setting and oracle and every list of elements each of at most bytes with , evaluating the script from the empty stack succeeds with stack (top first). This is the evaluation of a standard scriptSig.
import Definitions.Def_BitcoinScript
theorem BitcoinScript.eval_pushes (f : Flags) (o : Oracle) (ps : List Bytes)
(hsz : ∀ p ∈ ps, p.length ≤ BitcoinScript.MAX_SCRIPT_ELEMENT_SIZE)
(hlen : ps.length ≤ BitcoinScript.MAX_STACK_SIZE) :
BitcoinScript.evalScript f o [] (ps.map Instr.push) = some ps.reverse := 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.eval_pushes
Binders and hypothesis. Universally quantified: , a flags record (three arbitrary Booleans); , an arbitrary oracle; and , a finite list of byte lists with . Two hypotheses:
- : for every occurring in , (). Elements of length exactly are allowed; the empty byte list is allowed.
- : (). Exactly pushes are allowed.
Conclusion. An equation between optional lists of byte lists:
Evaluating, from the empty initial stack, the script consisting solely of one data-push instruction per element of (in the same order) succeeds, and the resulting main stack is reversed — i.e. with the last-pushed element on top, since stacks are written top-first.
Unfolding evalScript. runs run from (empty alt stack, empty condition stack, zero operation count) and returns the main-stack component of the final state, if the run succeeds. Here the initial main stack is . run processes instructions one by one via step, failing at the first failing step, and at the end returns the state only if the condition stack is empty.
Unfolding step on a push. For : if the step fails (none). Otherwise, since the condition stack is throughout (no conditional opcode ever appears), and is pushed on the main stack. Then the stack-size check: the step fails if ; here the alt stack stays empty and after the -th push the main stack has elements, so the check passes under . No opCount change occurs for pushes.
So the claim is: under the two hypotheses, every push step succeeds, the final condition stack is empty (it was never touched), and the final main stack is exactly . For the claim reads .
Role of the parameters. and are not consulted by any push step, so the conclusion is claimed uniformly for all flag settings and all oracles. The hypotheses are exactly the two checks a push step performs; the theorem does not claim what happens if either is violated.
What is not said. The theorem is only about scripts made entirely of pushes starting from the empty stack; it says nothing about pushes mixed with opcodes, pushes from a non-empty initial stack (where the limit would include the pre-existing elements), or pushes of elements longer than bytes (no claim that these fail is made here). It does not state that the hypotheses are necessary, only that they suffice. It does not mention verifyScriptPlain, the alt stack, opCount, or the condition stack in the result (all are discarded by evalScript). It does not say the result stack's elements satisfy any numeric or minimality property; a push of a non-minimal encoding, an empty element, or the same element twice is included unchanged. It makes no claim about the uniqueness of the final stack or about pushes being the only way to obtain it.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.