Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kani_metadata/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ pub enum UnstableFeature {
/// Allow replacing certain items with stubs (mocks).
/// See [RFC-0002](https://model-checking.github.io/kani/rfc/rfcs/0002-function-stubbing.html)
Stubbing,
/// Enable quantifiers [RFC 10](https://model-checking.github.io/kani/rfc/rfcs/0010-quantifiers.html)
Quantifiers,
/// Automatically check that uninitialized memory is not used.
UninitChecks,
/// Enable an unstable option or subcommand.
Expand Down
10 changes: 10 additions & 0 deletions library/kani_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ macro_rules! kani_intrinsics {
assert!(cond, "{}", msg);
}

#[crate::kani::unstable_feature(
feature = "quantifiers",
issue = 2546,
reason = "experimental quantifiers"
)]
#[inline(never)]
#[kanitool::fn_marker = "ForallHook"]
pub fn kani_forall<T, F>(lower_bound: T, upper_bound: T, predicate: F) -> bool
Expand All @@ -636,6 +641,11 @@ macro_rules! kani_intrinsics {
predicate(lower_bound)
}

#[crate::kani::unstable_feature(
feature = "quantifiers",
issue = 2546,
reason = "experimental quantifiers"
)]
#[inline(never)]
#[kanitool::fn_marker = "ExistsHook"]
pub fn kani_exists<T, F>(lower_bound: T, upper_bound: T, predicate: F) -> bool
Expand Down
1 change: 1 addition & 0 deletions tests/expected/quantifiers/assert_with_exists_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn exists_assert_harness() {
Expand Down
1 change: 1 addition & 0 deletions tests/expected/quantifiers/assert_with_exists_pass.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn exists_assert_harness() {
Expand Down
1 change: 1 addition & 0 deletions tests/expected/quantifiers/assert_with_forall_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn forall_assert_harness() {
Expand Down
1 change: 1 addition & 0 deletions tests/expected/quantifiers/assert_with_forall_pass.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn forall_assert_harness() {
Expand Down
1 change: 1 addition & 0 deletions tests/expected/quantifiers/assume_with_exists_fail.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn exists_assume_harness() {
Expand Down
2 changes: 1 addition & 1 deletion tests/expected/quantifiers/contracts_fail.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Zfunction-contracts
// kani-flags: -Zfunction-contracts -Z quantifiers

/// Copy only first 7 elements and left the last one unchanged.
#[kani::ensures(|ret| { unsafe{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT

// kani-flags: -Z quantifiers
/// Quantifier with no external variable in the closure

#[kani::proof]
Expand Down
1 change: 1 addition & 0 deletions tests/kani/Quantifiers/array.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn vec_assert_forall_harness() {
Expand Down
2 changes: 1 addition & 1 deletion tests/kani/Quantifiers/contracts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Zfunction-contracts
// kani-flags: -Zfunction-contracts -Zquantifiers

#[kani::requires(i==0)]
#[kani::ensures(|ret| {
Expand Down
1 change: 1 addition & 0 deletions tests/kani/Quantifiers/even.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn quantifier_even_harness() {
Expand Down
1 change: 1 addition & 0 deletions tests/kani/Quantifiers/from_raw_part_fixme.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

//! FIXME: <https://github.com/model-checking/kani/issues/4020>

Expand Down
1 change: 1 addition & 0 deletions tests/kani/Quantifiers/no_array.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Kani Contributors
// SPDX-License-Identifier: Apache-2.0 OR MIT
// kani-flags: -Z quantifiers

#[kani::proof]
fn forall_assert_harness() {
Expand Down
Loading