Skip to content

Tutorial: proof harness patterns #847

Description

@tedinski

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [C] Feature / EnhancementA new feature request or enhancement to an existing feature.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions