Abstract
Automated theorem proving (ATP) is a cornerstone of formal verification, yet it is hampered by the scarcity of human-written proofs and the exponential complexity of search spaces. This paper introduces a self-training framework that addresses these challenges through a co-evolutionary approach. A solver agent learns to navigate high-level, nondeterministic search strategies using AlphaZero-style reinforcement learning, while a teacher agent simultaneously generates a curriculum of increasingly difficult synthetic tasks. Focused on the synthesis of loop invariants, the system demonstrates significant improvements over traditional provers, achieving a 100% success rate on the Code2Inv benchmark with minimal search overhead.
Introduction
The quest for fully automated program verification often centers on finding loop invariants—properties that remain true throughout a loop's execution. Identifying these invariants is traditionally a manual, intuition-heavy process. In the context of "neural" theorem proving, two primary obstacles exist: the lack of large-scale formal proof datasets and the "infinite" variety of tactics available at any proof step.
This research proposes a hybrid solution. Instead of learning from human proofs, the system learns from a synthetic "teacher." Instead of searching an unconstrained space, the agent refines expert-provided nondeterministic strategies.
The Looprl Framework
The core of the proposed system is Looprl, a domain-specific language (DSL) that allows experts to define search strategies as programs. These programs use a choose operator to indicate points where a decision must be made.
As shown in the figure above, the solver operates within an environment that provides:
- Probe: The current state of the program being verified, written in the Looprl DSL.
- Info: The specific proof obligation (e.g., an implication to be proven) and metadata.
- Actions: A list of possible tactics (like
abduct*orconjecture) ranked by the neural network's prior probabilities.
Strategy Events and Abduction
Unlike standard reinforcement learning agents that receive only a binary success/failure signal, this solver is trained to predict "events." These are milestones in the reasoning process, such as abduction (reasoning backward from a goal to find necessary preconditions).
This approach makes the agent's behavior more interpretable and provides a denser reward signal for training. By predicting these events, the neural network learns to rank actions that are logically relevant to the specific proof obligation at hand.
The Teacher-Solver Loop
To overcome data scarcity, the authors implement a Teacher Agent. This agent is also a reinforcement learning model, but its goal is to generate valid programs and invariants. The teacher is rewarded for creating "interesting" problems—those that are challenging for the current solver but still solvable. This creates a natural curriculum, allowing the solver to gradually master more complex logical structures without ever seeing a human-written proof.
Experimental Results
The framework was evaluated on the Code2Inv benchmark, a set of 132 C programs requiring loop invariant synthesis.
- Zero-Search Generalization: The pre-trained solver could solve 61.5% of the problems by simply picking the top-ranked action at every step. This "greedy" success indicates that the network has learned deep structural patterns of loop invariants.
- Full Benchmark Success: When allowed to use Monte-Carlo Tree Search (MCTS) to explore the strategy's search tree, the system solved 100% of the benchmark problems.
- Efficiency: Compared to previous RL-based provers that required hours of training per problem, this agent generalizes to new problems in milliseconds, making it viable for real-world integration.
Conclusion
By combining the structure of expert-written strategies with the flexibility of deep reinforcement learning and synthetic data generation, this work provides a scalable path toward fully automated formal verification. Future work will focus on expanding the teacher's diversity and scaling the framework to handle complex data structures and non-linear arithmetic in large-scale software systems.
Summary updated