Add division scalability example to debugging-slow-proofs guide - #4781
Draft
CYJ904 wants to merge 4 commits into
Draft
Add division scalability example to debugging-slow-proofs guide#4781CYJ904 wants to merge 4 commits into
CYJ904 wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new division example can fail due to signed-division overflow and the added performance claims read as overly strong guarantees without caveats.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Kani documentation guide on debugging slow proofs by adding concrete verification-time data for integer division and a worked example showing how bounding operands can reduce solver workload.
Changes:
- Replaces a generic warning about expensive arithmetic with measured
cargo kanitimings across small integer bit-widths. - Adds a new “Division: Bound Both Operands” subsection under “Partition the Input Space” with illustrative harnesses and guidance.
File summaries
| File | Description |
|---|---|
| docs/src/debugging-slow-proofs.md | Adds division scalability timing data and a new subsection demonstrating operand bounding to improve proof performance |
Review details
Suppressed comments (1)
docs/src/debugging-slow-proofs.md:121
- This sentence makes a fairly strong performance guarantee ("typically brings ... well under a second") that may not hold across machines/solvers/Kani versions. Consider phrasing it as an empirical guideline ("can often") and mentioning that results vary with solver and timeout settings.
In practice, bounding both operands to a small representative range typically brings verification for `i32` and larger integer types down to well under a second, compared to unconstrained runs that may take significantly longer or fail to converge within a reasonable timeout.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…m/CYJ904/kani into docs/division-scalability-example
Author
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.
Description of changes:
Adds concrete verification-time data and a worked example to the
"Debugging Slow Proofs" guide, specifically around integer division.
In the "Large Value Operations" section, replaces the generic
statement that division/multiplication can be expensive with real
cargo kanitiming data (i8: ~0.15s, i16: ~25s, u16: ~55s forfull-range harnesses), showing that verification cost grows sharply
with bit-width rather than linearly.
Adds a new "Division: Bound Both Operands" subsection under
"Partition the Input Space", showing that for division/modulo,
bounding only the divisor is often not enough — the dividend
typically needs to be bounded as well to make verification converge
in reasonable time.
Context
While writing Kani proof harnesses for
unchecked_div_exactinverify-rust-std, I found that unconstrained division harnesses became impractically slow fori32and larger integer types due to state-space explosion in the underlying SAT solver. The existing guide already documents thegeneral "partition the input space" pattern (linking to #3006 for
future automatic support), but did not include any concrete timing
data, nor call out that division specifically often requires bounding
both operands rather than just one. This PR adds that missing detail
based on real measurements from that work.
Issues resolved
None — this is a documentation improvement rather than a bug fix, and
was not tied to a pre-filed issue.
Manual testing
mdbook buildlocally to confirm the book builds successfullywith the new content.
mdbook serveto visually verify formatting, heading levels,and Rust code block syntax highlighting for the new section.
cargo kaniruns againstunchecked_div_exact, not estimates.By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.