DafnyBench Verifier Repair

Iterative synthesis of loop invariants and helper assertions in Dafny guided by Dafny verifier error messages.

Read the paper

The loop

  1. Proposes

    An LLM inserts loop invariants and assertions into a Dafny program while keeping the top-level specification intact.

  2. Judged by

    The Dafny verifier checks whether the program verifies and returns its error message when it does not.

  3. Steers

    The Dafny error message is fed back for up to 10 attempts until the verifier accepts the proof.

Headline result

Verified 68% of the 782 ground-truth formal verification programs in DafnyBench via multi-turn compiler feedback.

What this does not prove

A spec check must prevent the model from trivially satisfying the verifier by weakening `ensures` clauses or adding `assume false`.

How it generalizes the harness

The Dafny deductive verifier enforces formal proof obligations across iterative invariant synthesis.

Classification

Classification of DafnyBench Verifier Repair
What it proposesProof
Generative modelClaude 3 Opus / GPT-4o invariant synthesizer
Algorithmic authorityDafny formal verifier
FeedbackVerifier errors
What gets updatedPrompt context
When it runsAt inference time
ValidityFormal (machine-checked)
EvidenceCode released
LineageOriginal system