Skip to content

Tracking Issue: Automatic Harnesses #3832

@carolynzech

Description

@carolynzech

Requested feature: Make proof harnesses optional, when possible
Use case: There are plenty of "boilerplate harnesses" that look something like this:

fn foo(x: u8, y: u8) { ... }

#[kani::proof]
fn foo_proof() {
  let x = kani::any();
  let y = kani::any();
  foo(x, y);
}

There's nothing surprising in this harness--the user just creates arbitrary variables for each argument of the function they're verifying, and then calls the function. Ideally, the user shouldn't have to write this harness at all; Kani should detect that each of the arguments implements Arbitrary, then attempt to verify it automatically.

Tasks

(We define "standard harness" as a #[kani::proof] harness and a "contract harness" as a #[kani::proof_for_contract] harness).
I'll break these tasks down into subtasks as I start working, but a road map for now:

  • Autogenerate standard harnesses for types that already implement Arbitrary (either provided by Kani or implemented by the user)
  • Detect which functions have contracts and autogenerate contract harnesses for them.
  • Try to derive/implement Arbitrary for other types in the crate if doing so would allow us to verify more functions
  • Extend the harness autogeneration to support more complex use cases:
    • Types with invariants that the harnesses need to respect
    • Pointers
    • Loops
    • Generics
  • Default timeout & loop unwinding bounds
  • Filters to include/exclude certain functions
  • Logging about which functions were skipped

Sub-issues

Metadata

Metadata

Assignees

Labels

T-TrackingIssueIssues used to track a large amount of work related to a featureZ-AutoharnessIssue related to autoharness subcommand[C] Feature / EnhancementA new feature request or enhancement to an existing feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions