An overflowed lax parse never verifies
ProvedBitcoinSig.overflow_rejectedIf parseDerLax sig = some (0, 0) — the zero signature that the lax parser substitutes on overflow — then pubkeyVerify pk hash sig = false for every key and hash.
import Definitions.Def_BitcoinSig open BitcoinSig BitcoinSer
theorem BitcoinSig.overflow_rejected (pk hash sig : Bytes) (h : BitcoinSig.parseDerLax sig = some (0, 0)) :
BitcoinSig.pubkeyVerify pk hash sig = false := 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: BitcoinSig.overflow_rejected
Binders and hypothesis. Universally quantified over three byte strings , , , with one hypothesis : parseDerLax = some . That is, the lax DER parser does not reject structurally (the result is not "none"), and the pair it returns is .
How the hypothesis can arise. Per the definition of parseDerLax, the pair is produced in exactly these situations after the structural phase succeeds (sequence tag 0x30, a sequence-length byte whose long-form length bytes — if any — are skipped unread, two integers each with tag 0x02 and a short or long-form length that fits within the input, trailing bytes ignored): (a) after stripping leading zero bytes, the integer or the integer still has more than 32 bytes; or (b) both fit in 32 bytes but the big-endian value of or of is ; or (c) both integers genuinely have value (for example zero-length integers, or integers consisting only of zero bytes). The hypothesis does not distinguish these cases.
Conclusion.
Unfolding. pubkeyVerify is: false if pubkeyValid is false (first byte does not announce the actual length); false if parsePubkey is "none" (not a valid compressed/uncompressed/hybrid point); false if parseDerLax is "none"; otherwise, with the parsed point and the parsed pair, ecdsaVerifyRaw (some ) (beVal ) (normalizeS ). Under , , normalizeS , and ecdsaVerifyRaw begins with "if or or or then false", which fires. So every branch of pubkeyVerify yields false, whatever and are — including a perfectly valid key and any message bytes (which have no length constraint and are read big-endian modulo ).
What is not said. The statement does not say that signatures with over-long or overflowing integers are rejected by the encoding checks (isValidSignatureEncoding, checkSignatureEncoding) — it concerns only pubkeyVerify. It does not say what checkLowS returns on such a signature (by the definition it returns true, since is not high, but that is not part of this statement). It does not say anything about signatures for which parseDerLax returns "none" (also false in pubkeyVerify, but not asserted here) or returns some other pair. It does not say that arises only from overflow; a signature honestly encoding also satisfies the hypothesis and is covered. It does not mention checkECDSASignature or the hash-type byte: here is the DER body as passed to pubkeyVerify, without any trailing hash-type byte being stripped.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.