We should document common patterns for proof harnesses, along with explanations/justifications for why they're common or interesting to know about.
For example:
No assumptions or assertions
fn check_fn() {
let input = kani::any();
function_under_test(input);
}
It might be surprising to someone used to writing test harnesses to see a harness with no assertions, but remember that we're checking for panic-freedom by default. (Kind of like how a unit test would ensure an exception isn't thrown by default in Java.) Most functions require some assumptions to write interesting proof harnesses, but many do not. For example, function_under_test might return a Result, and we may wish to prove that it's handling all possible error cases by returning an error Result rather than by panicking.
Ideas for more welcome
- Assumptions, but no assertions
- Basic validity assertions
- Meets specification
- Agrees with model
- Bounding input sizes
We should document common patterns for proof harnesses, along with explanations/justifications for why they're common or interesting to know about.
For example:
No assumptions or assertions
It might be surprising to someone used to writing test harnesses to see a harness with no assertions, but remember that we're checking for panic-freedom by default. (Kind of like how a unit test would ensure an exception isn't thrown by default in Java.) Most functions require some assumptions to write interesting proof harnesses, but many do not. For example,
function_under_testmight return aResult, and we may wish to prove that it's handling all possible error cases by returning an errorResultrather than by panicking.Ideas for more welcome