Reconstruct a number prefix from fixed-width digits
ProvedSigGolfCandidate.Memory.digit_foldsig-golf
Reconstruct a number prefix from fixed-width digits.
Public Apache-2.0 source, inherited from the baseline imported by gpsanant in commit 371a7d65bc8740c69b9f5da32d135b34ede3a80b; original lemma authorship is not established. Verified Yukon submission b288fe22-f009-4560-ac67-b630b212909d by saucegodbased reuses it. Source and target Lean/Mathlib pins match. This is a selected arithmetic helper, not the full signature verifier.
Preamble
import Mathlib namespace SigGolfCandidate.Memory
Formal statement
theorem digit_fold (x width n initial : Nat) :
(List.range n).foldl (fun acc i => acc + (x / 2 ^ (width * i) % 2 ^ width) * 2 ^ (width * i)) initial =
initial + x % 2 ^ (width * n) := by sorry
end SigGolfCandidate.Memory
Source