Verify Rust Standard Library - Challenge 11: Safety of Methods for Numeric Primitive Types#985
Open
Verify Rust Standard Library - Challenge 11: Safety of Methods for Numeric Primitive Types#985
Conversation
automergerpr-permission-manager bot
pushed a commit
that referenced
this pull request
Mar 14, 2026
Collapse `prove-rs` into `prove`: - ProveRSOpts merged into ProveOpts - `kmir prove` is the primary command (`prove-rs` kept as alias for backwards compatibility) - adds `parsed_smir` option for programmatic use (useful for tests with many start symbols like #985)
This is needed while we still have `thunk` in the semantics to catch UB
Tested with `time make test-verify-rust-std TEST_ARGS='-k unchecked_add'` which resulted in a 17.8% reduction in time (110.643 seconds): - Before: 10m22.304s - After: 8m31.661s
caf61b6 to
f54ce95
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.
This PR adds infrastructure for verify-rust-std (docs / github) challenges. challenges and implements Challenge 11: Safety of Methods for Numeric Primitives:
files
--terminate-on-thunkPart 3 (floats) is blocked: KMIR lacks float value support. Harnesses exist in to_int_unchecked-fail.rs and should be moved to to_int_unchecked.rs once passing.
Progress
Part 1 - Unsafe Integer Methods (
i8–i128,u8–u128). Proofs for soundness and proofs catching UB:unchecked_addunchecked_subunchecked_mulunchecked_shlunchecked_shrunchecked_neg(signed only)Part 2 - Safe API Verification. Proofs for soundness:
wrapping_shl(i8–i128,u8–u128)wrapping_shr(i8–i128,u8–u128)widening_mul(u8–u64)carrying_mul(u8–u64)Part 3 — Float to Integer Conversion:
to_int_unchecked(f16,f32,f64,f128) See "Floats" section belowFloats
#995 adds preliminary float support for KMIR, however there are restrictions. The haskell backend does not contain a float module and will fail for any float hooks. This means that symbolic floats or any float expression that is not able to be rewritten by the booster backend or simplified / executed by the LLVM backend will fail. While verification of floats as mapping to real numbers remains open research, bitvector verification is well defined and would be sufficient to solve this verification problem. If A. a Float.hs module was added to the haskell-backend, and B. the z3 dependency was connected to solve queries such as this with bitvectors, then I believe this challenge is achievable.