Learning to Disprove: Formal Counterexample Generation with Large Language Models

arXiv:2603.19514 · cs.AI · Submitted 2026-03-19 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: I'm Tom.

Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.

Tom: Today's paper: "Learning to Disprove".

Jane: The gist The paper addresses the gap in mathematical reasoning AI by fine-tuning large language models to generate formal counterexamples,

Tom: First, who's behind it and why it matters.

Title and authors: Tom: The paper's title itself, "Learning to Disprove: Formal Counterexample Generation with Large Language Models," sets the stage for what they are doing. It’s not just about generating random math problems; it’s specifically about learning to disprove statements formally.

Jane: And the authors are Zhaoyu Li, Kaiyu Yang, Xiaoxing Ma, and Zhendong Su from ETH Zurich and University of Toronto >

Tom: They are focusing on formal counterexample generation as a task for large language models, which means the AI has to do two things: propose a counterexample and then produce a formal proof that can be verified by the Lean four theorem prover <ref:2603.19514#pg1,the Lean 4 theorem prover>.

Lu: The implication here is that they move beyond just proof construction, which is what most current AI efforts in math focus on >

Meng: It’s about creating an AI that can actually check its own work by finding things that contradict its initial assumptions >

Jane: So, the summary of this paper explains how they do this by using a symbolic mutation strategy to synthesize training data and then employing a multi-reward guided training scheme >

The paper's summary: Tom: Let’s unpack that a bit more. They use symbolic mutation to create diverse training data by systematically extracting theorems and discarding selected hypotheses, which they call theorem mutated version: ∃ x: X, H2 x → C x:= by sorry theorem original version (x: X): H1 x → H2 x → C x:= by proof (correct) >

Jane: So they take a theorem and drop one of the hypotheses, like discarding H1, to create a new problem that needs to be solved >

Lu: And then for the expert stage, they introduce two rewards. One reward is based on whether the generated counterexample can prove the mutated version with dropped hypothesis >

Meng: The other reward checks if it proves both the necessary condition ¬H1(x*) and the target theorem H2(x*) → C(x*) >

Jane: So they combine those two rewards as a final sample weight for supervised fine-tuning, which is how they guide the model to find these counterexamples effectively >

Tom: It’s a structured way to train the LLM to not just guess, but to actively search for instances that disprove the original theorem's claim >

The paper's improvements: Tom: Now let's look at what they suggest are the improvements over existing methods. They tackle two big problems right away: a severe scarcity of training data and exceptionally sparse reward signals during training >

Jane: To handle the data scarcity, they use that symbolic mutation strategy to synthesize a large-sized unlabeled dataset, even beyond what is already available in datasets like CounterMath >

Lu: And to fix the sparse reward problem, they use a multi-reward strategy where the reward remains valid even when LLMs solve hard problems >

Meng: They also mention techniques like reducing the sample weight of the first formal proof and using group relative policy optimization to encourage longer formal proofs instead of just short ones >

Jane: So they’re addressing both sides: making sure they have enough data and making sure the learning signal is strong enough when things get difficult >

Conclusion: Tom: So to wrap up, this paper shows that combining symbolic mutation with a multi-reward scheme successfully addresses data scarcity and sparse reward signals >

Jane: The results show a relative improvement of forty-seven percent to seventy-four percent in the pass@one success rate compared to the strongest baseline on three newly collected benchmarks >

Lu: It confirms that this integrated approach yields significant performance gains across counterexample search, verification of autoformalized results, and reasoning steps >

Meng: For deployment, it suggests that this framework provides a practical copilot for validating mathematical conjectures, which is useful when you need to check a conjecture before committing resources >

Lalam: I’m pretty sure the core implication here is moving towards enhancing self-reflective reasoning capabilities in LLMs, giving them the ability to self-verify their logical processes >

Tom: It gives them a way to engage in a guess-and-check paradigm for mathematical discovery, which is really interesting for how we think about AI reliability >

Jane: So, the paper "Learning to Disprove: Formal Counterexample Generation with Large Language Models" provides a promising direction for making LLMs more self-corrective and reliable when dealing with formal logic.

Zenan Li, Zhaoyu Li, Kaiyu Yang, Xiaoxing Ma, Zhendong Su

ETH Zurich · University of Toronto · MiroMind · Nanjing University

cs.AI

Submitted: 2026-03-19

Updated: 2026-10-14

Code: https://github.com/leanprover-community/plausible

Project page: https://leanprover-community.github.io/con-nf/doc/Lean/Linter/UnusedVariables.html

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 75/100

The gist: The gist The paper addresses the gap in mathematical reasoning AI by fine-tuning large language models to generate formal counterexamples, which requires both proposing candidate instances and

Key concepts

Formal Counterexample Generation
This is the core task where an AI must not only suggest a potential answer that disproves a theorem but also write a complete, formal proof using tools like Lean 4 to verify that the proposed counterexample actually works against the original statement.
Symbolic Mutation Strategy
This technique automatically creates new training problems by taking existing theorems and systematically removing one of their hypotheses. This process generates a large, varied dataset of 'before and after' scenarios, helping the LLM learn how to break logical structures.
Multi-Reward Guided Training
Instead of a single reward signal, this system uses two rewards: one for finding an actual counterexample that contradicts the removed hypothesis, and another for proving the target theorem. This dual reward system ensures the model learns both finding disproofs and maintaining formal correctness.
Lean 4 Theorem Prover
Lean 4 is a specific, powerful software tool used to automatically check if a mathematical statement or a proposed counterexample is logically sound. It acts as the automated 'judge' that verifies the formal proofs generated by the AI model.

Terminology

Summary

The gist The paper addresses the gap in mathematical reasoning AI by fine-tuning large language models to generate formal counterexamples, which requires both proposing candidate instances and producing formal proofs verifiable by theorem provers.

How it works

The proposed framework integrates a symbolic mutation strategy for generating vast amounts of training data with a multi-reward guided training scheme to enhance model performance and efficiency. The core idea is to move beyond focusing solely on proof construction by equipping models with the ability to find counterexamples, which is vital for self-verification of logical processes.

The training process involves two main stages:

  1. Counterexample problem synthesis. This stage focuses on creating a large-sized unlabeled dataset by applying a mutation strategy to formally provable theorems. The mutation involves discarding one of the hypotheses of a theorem, such as transforming theorem original version into theorem mutated version: ∃ x: X, H2 x → C x. This process is rigorously guided by using the Lean 4 theorem prover to analyze the formal proof and identify redundant hypotheses.

  2. Multi-reward guided training. This stage employs an expert iteration pipeline where the LLM repeatedly generates counterexamples and formal proofs. The reward signal is multi-reward based, where a valid counterexample should contradict the removed hypothesis, leading to two distinct rewards: one based on whether x∗ proves the necessary condition ¬H1(x∗), and another based on whether it proves the target theorem H2(x∗) → C(x∗). These two rewards are combined as the final sample weight for supervised fine-tuning.

Key Components and Challenges

The paper identifies two significant challenges in this task: a severe scarcity of training data and exceptionally sparse reward signals during training. The existing dataset, CounterMath (Li et al., 2025), is too limited for practical LLM training.

To address the sparse reward problem, the multi-reward strategy ensures that the reward remains valid even when LLMs solve hard problems. Furthermore, to mitigate issues where formal reasoning models might fall into a low-difficulty trap by generating shorter proofs, the sample weight of the first formal proof is reduced, and techniques like group relative policy optimization (GRPO) can be employed to encourage longer formal proofs.

Experimental Results

Experiments on three newly collected benchmarks validate the advantages of the proposed approach. Leveraging the mutation strategy, 575K counterexample data points were synthesized for fine-tuning. The results show that the fine-tuned model achieves a relative improvement of 47% to 74% in pass@1 success rate compared to the strongest baseline.

The performance comparison across different models is summarized in Table 2, where the fine-tuned model substantially outperforms existing state-of-the-art LLMs by a large margin. For instance, for pass@1 on the FOR-COUNTER benchmark, our model solves 222 problems compared to 63 for the strongest baseline.

Conclusion

The proposed framework successfully addresses data scarcity and sparse reward signals by combining symbolic mutation with a multi-reward scheme. Experiments demonstrate that this integrated approach yields significant performance gains in counterexample generation, verification of autoformalized results, and reasoning steps. The work establishes a promising direction for enhancing the self-reflective and self-corrective reasoning capabilities of LLMs. The framework provides a practical copilot for validating mathematical conjectures.

Limitations

Several limitations remain, including the data quality of synthetic data, as generated data often lacks careful selection which downgrades training efficiency. Additionally, the limited capability of the LLMs significantly compromises performance when using smaller models like 7B. These limitations are noted for future work and further investigation.

References

The paper cites numerous works related to mathematical reasoning LLMs, formal theorem proving tools like Lean 4, and reinforcement learning techniques such as GRPO. It also references foundational concepts in computer science and mathematics relevant to the task. The paper's methodology draws connections to existing work on neural theorem proving and formal data synthesis methods. The authors acknowledge the need for sequential informal-to-formal reasoning in this paradigm. The paper's experimental setup details the use of specific LLMs and verification tools like lean-repl. The authors also reference related concepts such as autoformalization and various benchmarks in the field. The paper's ethical statement confirms no human subjects or sensitive data were involved. The reproducibility statement provides a link to the source code. The references section lists foundational texts and recent papers in the domain. The paper explicitly discusses the difference between informal-to-formal reasoning and other methods. The authors also reference specific LLM models used in the experiments. The paper's evaluation relies on established metrics like pass@k rates. The authors also reference the work of various researchers in the field of mathematical reasoning LLMs.

Improvements for AI systems

  1. Bold header: Symbolic mutation strategy for data synthesis

This strategy systematically extracts theorems and discarding selected hypotheses, thereby producing diverse counterexample instances, which significantly enriches the dataset beyond existing curated collections. This allows LLMs to be trained on a much larger and more diverse set of problem instances.

  1. Bold header: Multi-reward guided training framework

The introduction of a multi-reward function based on the proven success rate of both the extracted problem and discarded hypothesis ensures that the reward remains valid even when LLMs solve hard problems, overcoming the issue where the training reward vanishes. This leads to a model that is more robust and learns from difficult examples.

  1. Bold header: Two-stage informal-to-formal reasoning pipeline

The system implements a sequential pattern of informal-to-formal reasoning, where the LLM first proposes a counterexample and then generates formal proofs for both the mutated and dropped hypothesis theorems. This structure is crucial for establishing a two-stage, informal-to-formal process that differs from methods where informal and formal reasoning are congruent.

  1. Bold header: Improved performance on specialized tasks

The fine-tuned model achieves significant improvements across three applicable tasks: counterexample search, verification of autoformalized results, and verification of reasoning steps. This demonstrates the system's ability to not only find counterexamples but also to verify complex logical processes automatically.

  1. Bold header: Enhanced self-reflective reasoning capabilities

By training LLMs on counterexample generation, the framework aims to equip models with the ability to self-verify their logical processes, thereby strengthening both their reasoning reliability and explanatory power. This enables LLMs to engage in a guess-and-check paradigm for mathematical discovery.

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 constructs candidate counterexample-generation tasks by systematically extracting theorems and removing selected hypotheses. 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 substantial performance gains.

Sources

Related papers