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 returned true
because UInt64 wrapping reduced 4 * delta + 1 to 9, satisfying the
odd-square check. The corresponding mathematical delta is neither square nor
pronic.
Change
The Lean implementation now evaluates the pronic branch only when
4 * delta + 1 fits in UInt64, matching the checked-arithmetic structure in
the native Rust source.
Regression proofs cover values around the overflow boundary.
Proof contract
justifiable_equiv remains explicitly bounded by d.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 EthLambdaProofs
regression cases for 2^62 - 1, 2^62, 2^62 + 2, and UInt64::MAX
ss1738
changed the title
formal: align Lean justifiability overflow semantics
fix: align Lean justifiability overflow semantics
Aug 28, 2026
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
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 returned true
because UInt64 wrapping reduced 4 * delta + 1 to 9, satisfying the
odd-square check. The corresponding mathematical delta is neither square nor
pronic.
Change
The Lean implementation now evaluates the pronic branch only when
4 * delta + 1 fits in UInt64, matching the checked-arithmetic structure in
the native Rust source.
Regression proofs cover values around the overflow boundary.
Proof contract
justifiable_equiv remains explicitly bounded by d.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