I tried this code:
#[kani::requires(x == 0)]
#[kani::requires(x * y < 10)]
fn foo(x: u8, y: u8) {}
#[kani::proof_for_contract(foo)]
fn check_foo() {
foo(kani::any(), kani::any());
}
using the following command line invocation:
cargo kani -Zfunction-contracts
with Kani version: d2f5dbe
I expected to see this happen: Verification successful
Instead, this happened: the multiplication overflow check failed:
SUMMARY:
** 1 of 49 failed
Failed Checks: attempt to multiply with overflow
File: "src/lib.rs", line 2, in foo::{closure#2}
VERIFICATION:- FAILED
I would expect it to succeed because of the previous requires clause.
Interestingly, if I flip the order of the requires clauses, verification succeeds:
#[kani::requires(x * y < 10)]
#[kani::requires(x == 0)]
fn foo(x: u8, y: u8) {}
#[kani::proof_for_contract(foo)]
fn check_foo() {
foo(kani::any(), kani::any());
}
SUMMARY:
** 0 of 49 failed
VERIFICATION:- SUCCESSFUL
I tried this code:
using the following command line invocation:
with Kani version: d2f5dbe
I expected to see this happen: Verification successful
Instead, this happened: the multiplication overflow check failed:
I would expect it to succeed because of the previous
requiresclause.Interestingly, if I flip the order of the
requiresclauses, verification succeeds:SUMMARY: ** 0 of 49 failed VERIFICATION:- SUCCESSFUL