Skip to content
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

Create an API for loop contracts #3168

Open
qinheping opened this issue May 1, 2024 · 0 comments
Open

Create an API for loop contracts #3168

qinheping opened this issue May 1, 2024 · 0 comments
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.

Comments

@qinheping
Copy link
Contributor

Requested feature: Loop contracts
Use case: Verify the provided loop contracts, and use the loop contracts to abstract out the loops from the verification process.
Link to relevant documentation (Rust reference, Nomicon, RFC): #3167

Test case:

#[kani::proof]
fn main() {
    let mut x: u64 = kani::any_where(|i| *i >= 1);

    #[kani::loop_invariant(x >= 1)]
    while x > 1{
        x = x - 1;
    };

    assert!(x == 1);
}
@qinheping qinheping added the [C] Feature / Enhancement A new feature request or enhancement to an existing feature. label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Feature / Enhancement A new feature request or enhancement to an existing feature.
Projects
None yet
Development

No branches or pull requests

1 participant