Repository navigation
Conversation
Replaces the Vec-backed Big in StringToNumber's fallback, the formatters and the power tables with FixedBig<N> (64 limbs for parsing, 32 otherwise; measured at most 57 and 28). BigInt keeps the unbounded Vec-backed Big, trimmed to the operations it uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ytes Byte-level trim and digit helpers replace the str/char calls that crashed the Kani compiler. Kani found add_small leaving a zero top limb on carry-out; fixed. The proofs header lists what is proven, at which bounds, and what is not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Included in #286, which verifies all open phase 7 pull requests together; this merges with it. |
This branch has not been deployed
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.
Stacked on #274 (
claude/js-number-kani): this branch contains its commit (7e7bfa5) plus two more. Merge #274 first, then retarget tomain.What changed
FixedBig<N>: an array-backed big integer (fixed.rs) for the exact Number paths (StringToNumber's exact fallback, the formatters, the power tables). Overflowing operations drop limbs and setlost, so every operation is total at everyN.string_to_number_bytes), since the&strversion crashed the Kani compiler inchardecoding.tests/trim.rscompares the new trimmer withtrim_matcheson every Unicode scalar value.FixedBigand StringToNumber; proofs header corrected.What each new harness proves (symbolic inputs, not sampled)
FixedBig at N = 1..3 (unwind 5): the representation invariant holds after every operation, and:
from_u128,low_u128,bit_len,bitequalu128(N=2);cmp_bigisu128order.add_small,add_assignequalu128addition, withlostexactly on carry out;sub_assignequals saturatingu128subtraction.mul_small: one limb times a word equals theu128product; total on any 3 limbs times any word.div_small: total on any 3 limbs and any word including zero, remainder below the divisor.shl(any shift of a u64, equalsu128shift below 64),shr(any shift of a u128, sticky bit); both total on any 3 limbs.string_to_number_bytes::<2>(unwind 6) with a table having no Eisel-Lemire entry: total on every byte string of up to 3 bytes over a 12-byte alphabet. A 3-byte literal never reaches the exact path, so that path is not covered.Bigtwo-limb harnesses.Kani found one real bug:
add_smallwith a carry out of the top limb left a zero top limb; fixed by trimming.Not proven (stated in the proofs header)
FixedBig::divrem,mul_pow10,mul_pow5,div_pow5,to_decimal,decimal_exact,tables(), and the formatters did not finish in CBMC within 7-12 minutes at small bounds; those harnesses were dropped, not weakened. None produced a counterexample. They are covered bytests/fixed.rsand the differential tests only. ThatN= 2/3 results hold at N = 64 is an argument (all limb access viaget/take/zip), not a Kani result. The crate stays at tier 0.Command results (local, nothing run on CI yet)
cargo xtask verify --part crate clazel-js-number --metrics <tmp>: CRATE PART PASSED; Kani: 33 successfully verified harnesses, 0 failures. (Tier 0, so no mutations or conformance run.)cargo test -p clazel-js-number: all pass (differential tests against Rustf64parsing andDisplayincluded; slowest binary 40 s).cargo clippy -p clazel-js-number --all-targets -- -D warnings: clean.cargo fmt --check: clean.cargo xtask check: STATIC CHECKS PASSED.cargo +nightly-2026-08-21 miri test -p clazel-js-number: all pass; slowest test binary 284 s (under 300 s).CI's full verification has not run on this PR and proof jobs need a
full-verificationapproval.🤖 Generated with Claude Code