Without overflow, SetCompact decodes the exact value
ProvedBitcoinPow.setCompact_eq_specFor every 32-bit word whose overflow flag is clear,
The 256-bit register arithmetic of SetCompact (a left shift that drops carried-out bits) loses nothing when the flag is clear, so the decoded target is the mathematical value (or for ).
import Definitions.Def_BitcoinPow
theorem BitcoinPow.setCompact_eq_spec (c : BitVec 32) (h : BitcoinPow.compactOverflow c = false) :
BitcoinPow.setCompact c = BitcoinPow.specTarget c := 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 32-bit word (an integer with ), writing for its top byte () and for its low 23 bits (): if the Boolean "compact overflow" flag
is false — that is, if , or ( and ( or ) and ( or )) — then the two natural numbers
are equal: . Here is the custom "setCompact" value (a right shift by bits when , otherwise a left shift by bits followed by reduction modulo ) and is the custom "specTarget" value (the same without any modular reduction).
Binders and hypotheses. One universally quantified variable ranging over all 32-bit words, and one hypothesis, namely that the overflow flag of equals the Boolean false. This is a one-directional implication (hypothesis equality), not an equivalence; nothing is asserted about words whose overflow flag is true. Bit 23 of is irrelevant to every quantity involved.
Edge cases visible in the statement. For the two sides are syntactically the same computation (floor division by equals right shift by bits) regardless of the hypothesis. For the only possible difference is the reduction modulo in . If the hypothesis holds and both sides are . The hypothesis permits, for example, with , with , and any with .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.