Skip to content

Commit f429190

Browse files
author
Carolyn Zech
authored
Update README (#4291)
Update our README to make it clearer that Kani is useful for *both* safety and correctness, not mostly safety with correctness on the side. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent 100857e commit f429190

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

README.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44

55
The Kani Rust Verifier is a bit-precise model checker for Rust.
66

7-
Kani is particularly useful for verifying unsafe code blocks in Rust, where the "[unsafe superpowers](https://doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html#unsafe-superpowers)" are unchecked by the compiler.
8-
___
9-
Kani verifies:
10-
* Memory safety (e.g., null pointer dereferences)
11-
* User-specified assertions (i.e., `assert!(...)`)
12-
* The absence of panics (e.g., `unwrap()` on `None` values)
13-
* The absence of some types of unexpected behavior (e.g., arithmetic overflows)
7+
Kani is useful for checking both safety and correctness of Rust code.
8+
- *Safety*: Kani automatically checks for many kinds of [undefined behavior](https://model-checking.github.io/kani/undefined-behaviour.html).
9+
This makes it particularly useful for verifying unsafe code blocks in Rust, where the "[unsafe superpowers](https://doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html#unsafe-superpowers)" are unchecked by the compiler.
10+
- *Correctness*: Kani automatically checks panics (e.g. `unwrap()` on `None`), arithmetic overflows, and custom correctness properties, either in the form of assertions (`assert!(...)`) or [function contracts](https://model-checking.github.io/kani/reference/experimental/contracts.html).
1411

1512
## Installation
1613

@@ -28,15 +25,12 @@ See [the installation guide](https://model-checking.github.io/kani/install-guide
2825
Similar to testing, you write a harness, but with Kani you can check all possible values using `kani::any()`:
2926

3027
```rust
31-
use my_crate::{function_under_test, meets_specification, precondition};
28+
use my_crate::{function_under_test, meets_specification};
3229

3330
#[kani::proof]
3431
fn check_my_property() {
3532
// Create a nondeterministic input
36-
let input = kani::any();
37-
38-
// Constrain it according to the function's precondition
39-
kani::assume(precondition(input));
33+
let input: u8 = kani::any();
4034

4135
// Call the function under verification
4236
let output = function_under_test(input);
@@ -46,9 +40,8 @@ fn check_my_property() {
4640
}
4741
```
4842

49-
Kani will then try to prove that all valid inputs produce acceptable outputs, without panicking or executing unexpected behavior.
50-
Otherwise Kani will generate a trace that points to the failure.
51-
We recommend following [the tutorial](https://model-checking.github.io/kani/kani-tutorial.html) to learn more about how to use Kani.
43+
Kani will try to prove that all valid inputs produce outputs that satisfy the specification, without panicking or exhibiting unexpected behavior.
44+
This example is simple; we highly recommend following [the tutorial](https://model-checking.github.io/kani/kani-tutorial.html) to learn more about how to use Kani.
5245

5346
## GitHub Action
5447

docs/src/getting-started.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Getting started
22

33
Kani is an open-source verification tool that uses [model checking](./tool-comparison.md) to analyze Rust programs.
4-
Kani is particularly useful for verifying unsafe code blocks in Rust, where the "[unsafe superpowers](https://doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html#unsafe-superpowers)" are unchecked by the compiler.
5-
Some example properties you can prove with Kani include memory safety properties (e.g., null pointer dereferences, use-after-free, etc.), the absence of certain runtime errors (i.e., index out of bounds, panics), and the absence of some types of unexpected behavior (e.g., arithmetic overflows).
6-
Kani can also prove custom properties provided in the form of user-specified assertions.
7-
As Kani uses model checking, Kani will either prove the property, disprove the
8-
property (with a counterexample), or may run out of resources.
4+
Kani is useful for checking both safety and correctness of Rust code.
5+
- *Safety*: Kani automatically checks for many kinds of [undefined behavior](./undefined-behaviour.md).
6+
This makes it particularly useful for verifying unsafe code blocks in Rust, where the "[unsafe superpowers](https://doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html#unsafe-superpowers)" are unchecked by the compiler.
7+
- *Correctness*: Kani automatically checks panics (e.g. `unwrap()` on `None`), arithmetic overflows, and custom correctness properties, either in the form of assertions (`assert!(...)`) or [function contracts](https://model-checking.github.io/kani/reference/experimental/contracts.html).
8+
9+
Since Kani uses model checking, Kani will either prove the property, disprove the property (with a counterexample), or may run out of resources.
910

1011
Kani uses proof harnesses to analyze programs.
1112
Proof harnesses are similar to test harnesses, especially property-based test harnesses.

0 commit comments

Comments
 (0)