-
Notifications
You must be signed in to change notification settings - Fork 134
Introduce BoundedArbitrary trait and macro for bounded proofs #4000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8d08836 to
99ef1cf
Compare
99ef1cf to
061abd7
Compare
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments on the tests.
|
This is a link to the rendered docs for the reference: https://github.com/sgpthomas/kani/blob/bounded_arbitrary/docs/src/reference/experimental/bounded_arbitrary.md |
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments on the documentation
carolynzech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write tests for Option, Result, HashMap, etc. as well?
061abd7 to
6a5a3dd
Compare
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of comments
b6fd641 to
0684144
Compare
0684144 to
d8f8403
Compare
d8f8403 to
4d12a65
Compare
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Mostly minor comments. Please make sure to add a description to all the tests.
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can we make sure this doesn't break anything in https://github.com/model-checking/verify-rust-std/?
zhassan-aws
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
9de733a
This PR introduces the trait `BoundedArbitrary` which allows for creation of symbolic values for types up to some bound. This is useful for doing bounded proofs on types like strings and vecs. I wrote a more detailed overview of what this PR provides as a new section in the book. The implementation of BoundedArbitrary for the container types that I provide are pretty basic and experimental at the moment. Any pointers here would be useful, and we will probably need to iterate on their implementations based on actual performance testing. I added a test case that should fail verification using the `cover!` macro, however, I'm not sure that I used this correctly. Let me know if I should make this an expect test, or something else. I slightly restructured how we deal with the the `std/core` usage in `kani_core::kani_lib`. Previously we passed in either `std` or `core` to `kani_core::generate_arbitrary` and `generate_arbitrary` renamed the import with `use $core as core_path`. However, I couldn't use that same strategy for `kani_core::generate_bounded_arbitrary` because the import names would clash. So I lifted the `use $core as core_path` out of the `kani_core::generate_*` macros. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Sammy Thomas <[email protected]>
This PR introduces the trait
BoundedArbitrarywhich allows for creation of symbolic values for types up to some bound. This is useful for doing bounded proofs on types like strings and vecs. I wrote a more detailed overview of what this PR provides as a new section in the book.The implementation of BoundedArbitrary for the container types that I provide are pretty basic and experimental at the moment. Any pointers here would be useful, and we will probably need to iterate on their implementations based on actual performance testing.
I added a test case that should fail verification using the
cover!macro, however, I'm not sure that I used this correctly. Let me know if I should make this an expect test, or something else.I slightly restructured how we deal with the the
std/coreusage inkani_core::kani_lib. Previously we passed in eitherstdorcoretokani_core::generate_arbitraryandgenerate_arbitraryrenamed the import withuse $core as core_path. However, I couldn't use that same strategy forkani_core::generate_bounded_arbitrarybecause the import names would clash. So I lifted theuse $core as core_pathout of thekani_core::generate_*macros.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.