Proof-of-work acceptance, characterized
ProvedBitcoinPow.checkProofOfWork_iffFor every hash value and every 32-bit word ,
This is DeriveTarget followed by the comparison in CheckProofOfWorkImpl, restated on the exact value of the word. A header passes exactly when its nBits is a well-formed, in-range, positive target and the hash is at most that target.
import Definitions.Def_BitcoinPow
theorem BitcoinPow.checkProofOfWork_iff (hash : Nat) (nBits : BitVec 32) :
BitcoinPow.checkProofOfWork hash nBits = true ↔
BitcoinPow.compactNegative nBits = false ∧ BitcoinPow.compactOverflow nBits = false ∧
0 < BitcoinPow.specTarget nBits ∧ BitcoinPow.specTarget nBits ≤ BitcoinPow.powLimit ∧
hash ≤ BitcoinPow.specTarget nBits := 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)
Statement. For every natural number (any natural number; no bound such as is assumed) and every 32-bit word ("nBits"), with top byte () and low 23 bits , the Boolean value is true if and only if all five of the following hold:
- the "compact negative" flag is false;
- the "compact overflow" flag is false;
- ;
- ;
- ;
where
is the custom "specTarget" value, computed on unbounded natural numbers with no reduction modulo . All inequalities in 3–5 are exactly as written: strict in 3, non-strict in 4 and 5.
The left-hand side, unfolded. is defined through a different quantity, the "setCompact" value
as follows: it is false if (negative flag is true) or or (overflow flag is true) or ; otherwise it equals . So the statement equates a condition phrased with (reduced modulo ) on the left with a condition phrased with (unreduced) on the right.
Binders and hypotheses. Two universally quantified variables, and ; no hypotheses. The claim is a biconditional between "the Boolean equals true" and a five-fold conjunction of propositions. Both directions are asserted: whenever the check returns true, conditions 1–5 hold; and whenever 1–5 hold, the check returns true.
Edge cases visible in the statement. If then both flags are false, , condition 3 fails, and the right side is false. If , both flags are false and . The right side permits exactly (non-strict cap) and exactly. Because is unbounded, the statement covers , where condition 5 forces the right side false since under condition 4.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.