Repository navigation
Use a table of powers of ten in the decimal_seq Kani annotations - #704
Merged
feliperodri merged 1 commit intoOct 3, 2026
Merged
feliperodri merged 1 commit into
feliperodri merged 1 commit into
Conversation
feliperodri
approved these changes
Oct 3, 2026
feliperodri
left a comment
Member
There was a problem hiding this comment.
Approved — verified locally on this branch with the pinned Kani (783e7f7):
| without this PR | with it | |
|---|---|---|
check_number_of_digits_decimal_left_shift |
fails on 1u64 << shift < 10u64.pow(n as u32 + 1), as in CI |
passes (49 s) |
check_round |
no result after 4.5+ min (CI: cancelled at 6 h) | passes (2.6 s) |
check_left_shift, check_right_shift |
— | pass |
POW10 is exactly 10⁰…10¹⁹ and #[cfg(kani)]-only, and round returns early unless decimal_point < 19, so POW10[kani::index] stays in bounds. Still needed after the move to nightly-2026-09-25, since #637's checked_pow invariant is unchanged there.
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.
On this sync,
check_number_of_digits_decimal_left_shiftfails andcheck_rounddoes not finish; partition 2 of run 35923786600 was cancelled after 6 h. Both come fromu64::pow. The newpowgoes throughstrict_powtochecked_pow, whose loop carriesloop_invariant(self == 0 || (acc > 0 && base > 0))from #637, so under-Z loop-contractsapowwith a non-constant exponent yields only some positive value. The counterexample Kani reports isshift = 9,n = 2, with512 < 10u64.pow(3)evaluating to false.This replaces
10u64.pow(..)in the loop invariant ofDecimalSeq::roundand in the harness with aPOW10table. #637's invariant, whichNonZero::checked_powneeds, stays as it is.With the pinned Kani (783e7f7d1), the four
decimal_seq_verifyharnesses pass:check_roundin 1.5 s andcheck_number_of_digits_decimal_left_shiftin 30 s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.