Learning to Disprove: Formal Counterexample Generation with Large Language Models
Zenan Li, Zhaoyu Li, Kaiyu Yang, Xiaoxing Ma, Zhendong Su
cs.AI
Mar 19, 2026 · v1
TL;DR
Fine-tunes LLMs to generate formal counterexamples with proofs automatically verified in Lean 4.
Abstract
Mathematical reasoning demands two critical, complementary skills: constructing rigorous proofs for true statements and discovering counterexamples that disprove false ones. However, current AI efforts in mathematics focus almost exclusively on proof construction, often neglecting the equally important task of finding counterexamples. In this paper, we address this gap by fine-tuning large language models (LLMs) to reason about and generate counterexamples. We formalize this task as formal counterexample generation, which requires LLMs not only to propose candidate counterexamples but also to produce formal proofs that can be automatically verified in the Lean 4 theorem prover. To enable effective learning, we introduce a symbolic mutation strategy that synthesizes diverse training data by systematically extracting theorems and discarding selected hypotheses, thereby producing diverse counterexample instances. Together with curated datasets, this strategy enables a multi-reward expert iteration framework that substantially enhances both the effectiveness and efficiency of training LLMs for counterexample generation and theorem proving. Experiments on three newly collected benchmarks validate the advantages of our approach, showing that the mutation strategy and training framework yield significant performance gains.
Problem
Current AI mathematical reasoning focuses almost exclusively on proof construction, neglecting the equally important task of finding counterexamples to disprove false statements. No systematic framework exists for training LLMs to generate formal counterexamples.
Approach
The authors formalize counterexample generation as producing a witness x* and a Lean proof that P(x*) is false given a universally quantified conjecture. They propose a two-stage framework: (1) counterexample problem synthesis via symbolic mutation of seed theorems from Mathlib, Leanworkbook, MiniF2F, and PutnamBench (generating 575,039 mutated theorems from 321,929 seeds), and (2) multi-reward guided training using expert iteration where the LLM generates candidates verified by Lean. Multiple reward signals guide training beyond single-reward approaches.
Results
The framework achieves 49.8% pass@1 on the validation set, a 24.4 percentage point improvement over the best baseline (Leanabell at 25.4%). At pass@9, it reaches 54.1% versus 39.9% for the best baseline. On the For-Counter subset, the method achieves 20.9% pass@1 compared to 15.2% for the next best model.
| Model | @1 | @4 | @9 |
|---|
| Leanabell | 25.4% | 36.0% | 39.9% |
| STP | 23.7% | 33.2% | 37.5% |
| Goedel-v2 | 14.0% | 31.1% | 38.2% |
| Ours | 49.8% | 52.7% | 54.1% |
Counterexample generation pass rates