Miniscript expression
multi(2,A,B,C)
↓Core syntax
.multi 2 [A, B, C]
Static check before compilationWellFormed
Checks the expression and its context, not the signatures or runtime outcome.
- legacy multisig is permitted
1 ≤ 2 ≤ 3- key count and keys are valid
What type does Lean assign?HasType
Base type B, with the modeled n d u s modifiers.
compile↓Modeled Bitcoin Script
2 A B C 3 CHECKMULTISIG
Eval with stack, flags, and transaction context↓Possible CHECKMULTISIG outcomes
- Enough matching signatures and a valid dummy→
true on the stack · spend accepted - Signatures do not meet the threshold→
false on the stack · spend rejected - Invalid legacy dummy→Script error · spend rejected
What Lean lets us check: compiling multi(2,A,B,C) must not weaken its 2-of-3 requirement or change its expected stack behavior. This becomes a precise statement that Lean can prove and recheck whenever the model changes.