fix: align Lean justifiability overflow semantics - #597
Draft
ss1738 wants to merge 1 commit into
Draft
Conversation
ss1738
force-pushed
the
draft/lean-justifiability-overflow
branch
from
August 28, 2026 15:22
c009c09 to
d0848b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
While extending the existing justifiability formalization, I found a
fixed-width arithmetic boundary outside the current proof domain.
For
delta = 2^62 + 2, the previous Lean implementation returnedtruebecause
UInt64wrapping reduced4 * delta + 1to9, satisfying theodd-square check. The corresponding mathematical delta is neither square nor
pronic.
Change
The Lean implementation now evaluates the pronic branch only when
4 * delta + 1fits inUInt64, matching the checked-arithmetic structure inthe native Rust source.
Regression proofs cover values around the overflow boundary.
Proof contract
justifiable_equivremains explicitly bounded byd.toNat < 2^62.This PR does not strengthen that theorem to a total equivalence result.
The Rust-side documentation has also been updated to state the actual proof
domain rather than claiming correctness for all natural numbers.
Testing
cd formal && lake build EthLambdaProofs2^62 - 1,2^62,2^62 + 2, andUInt64::MAX