Curriculum proof repair with learned counterexamples
Yuechun Sun, Jun Yang, Kexin Pei
NeurIPS page · OpenReview · Open on the map
Category: LLM Agents, Evals & Benchmarks › Verified Code Synthesis and Testing · Type: new method · Keywords: formal verification, proof repair, counterexample generation, reinforcement learning, language models
Areas: LLM Reasoning › Reasoning Strategies › Self-Evolution and Improvement; Evaluation & Benchmarks › Language Model and Agent Benchmarks › Formal Verification Benchmarks; RL for LLMs & Agents › LLM Reasoning Reinforcement Learning › Reinforcement Learning for Reasoning
Summary
tool is an LM-based framework for Verus proof repair that learns to generate structured counterexamples to guide proof repair, achieving high success rates on formal verification benchmarks.
Explained to a 5-year-old
People write special instructions to tell computers that their code is safe. Sometimes these instructions are wrong, and the computer says something is broken. This new idea teaches a smart computer to make little examples that show what went wrong, like a puzzle piece. Then the computer uses those examples to fix the instructions so they become correct. This helps the computer finish the work faster and makes fewer mistakes.
Explained to a 5-year-old, longer
Computers need to follow very exact rules to make sure programs are safe. When the rules are not followed, the computer reports an error. Usually people have to look at the error and fix the rules themselves. A new idea lets a smart computer learn to create small examples that show why the rule failed. These examples are like pictures that point out the exact spot where the rule is wrong. The computer then looks at those pictures and understands what needs to be changed. After understanding, it writes a new version of the rule that passes the computer’s check. This whole process happens automatically, without a person having to do every step. It also works when the computer is trying to fix other computers’ rules, making them better too. The result is that programs become safer and take less time to verify. This helps engineers focus on bigger problems instead of tiny mistakes. In the end, the smart computer becomes a helpful assistant for making sure software is correct.
For a technical reader
The paper addresses the difficulty of repairing formal verification proofs, which are often broken by vague error messages. It proposes training a language model to generate concrete counterexamples that pinpoint why a proof fails, using reinforcement learning guided by verifier feedback. A safety gate ensures that any generated proof code is syntactically correct before being applied. The model also incorporates a topological graph reward that respects the dependency order of invariants, improving the reliability of the generated counterexamples. Experiments on seven Verus benchmarks show that this approach significantly outperforms existing baselines and can even boost other repair systems when its counterexamples are used as additional diagnostics.
Problem
Developing correct proofs for formal verification is challenging because developers must diagnose coarse verifier errors and manually repair failed proof obligations. Existing language model approaches rely on hand-engineered prompts or sparse feedback, limiting their effectiveness.
Method
The approach trains a language model to generate structured source-level counterexamples, repair rationales, and repaired proofs in a single trajectory, using reinforcement learning from verifier feedback and a proof-code safety gate. It introduces a topological graph reward that captures invariant dependencies from inductiveness tests and encourages counterexample generation in the correct order. This data-driven diagnostic objective makes the model’s counterexample generation useful for guiding proof repair.
Results
The approach achieves 61.6%/72.2% weighted-average Safe-Pass@1/Safe-Pass@3 on the benchmarks, surpassing the strongest baseline (Claude Sonnet 4.5) by 5.7/6.3 points. Additionally, its learned counterexamples improve existing LM-based repair methods by 64.3% when used as diagnostics.
Contributions
It introduces a data-driven diagnostic objective that trains counterexample generation to directly aid proof repair, a topological graph reward that models invariant dependencies, and a safety gate for proof-code correctness. The method also demonstrates that its generated counterexamples can augment other LM-based repair approaches.
Practical relevance
This work enables more automated and reliable formal verification of critical software, reducing the manual effort required to debug proof failures.
Research questions this paper is counted under
This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction