Learning to Prove Theorems via Interacting with Proof Assistants
Introduces CoqGym dataset and ASTactic model, enabling flexible proof strategy generation via abstract syntax trees for automated theorem proving.
Key Findings
Methodology
This work constructs CoqGym, a large-scale dataset with 71K human-written proofs from 123 projects across mathematics, hardware, and programming domains. The core model, ASTactic, employs a TreeLSTM encoder to embed goals and premises as ASTs, then generates tactics as program trees through a sequence-to-tree decoder. The approach incorporates semantic constraints to synthesize tactic arguments dynamically, enabling flexible and context-aware tactic generation. During training, synthetic short proofs from intermediate goals augment data, improving generalization. In practice, the model interacts with Coq via depth-first search, producing proof strategies that outperform traditional auto tactics and integrate with external ATP systems, achieving a success rate of 30%.
Key Results
- ASTactic proves 12.2% of test theorems, significantly surpassing Coq’s built-in tactics at 4.9%, and boosts success to 30% when combined with external ATPs.
- Cross-domain evaluation shows strong generalization, demonstrating the model’s ability to learn high-level proof strategies.
- Synthetic proof augmentation from intermediate goals enhances performance on complex proofs, validating data synthesis effectiveness.
Significance
This research addresses the bottleneck of limited data and strategy flexibility in automated theorem proving. By mimicking human high-level reasoning and leveraging large, diverse datasets, it advances AI’s capability to autonomously prove complex theorems. The approach bridges the gap between symbolic reasoning and deep learning, paving the way for fully automated formal verification and mathematical discovery, with broad implications for software correctness, hardware design, and formalized mathematics.
Technical Contribution
The paper introduces CoqGym, a comprehensive dataset surpassing previous efforts in scale and diversity, and proposes ASTactic, a novel program generation model using ASTs conditioned on semantic constraints. This end-to-end deep learning framework enables the synthesis of complete proof tactics, overcoming fixed set limitations. The integration with external ATPs further enhances proof success, demonstrating a scalable, flexible approach to interactive theorem proving.
Novelty
This is the first work to generate proof tactics as program trees conditioned on semantic context within an interactive proof environment. The large, diverse dataset and the AST-based tactic synthesis represent significant advancements over prior fixed-set or retrieval-based methods, enabling proof generation of previously unprovable theorems and demonstrating the potential of deep learning for high-level logical reasoning.
Limitations
- The model struggles with very long or highly abstract proofs, indicating limitations in reasoning depth. Handling of high-order logic and domain-specific semantics needs further enhancement. Computational costs remain high for training and inference, especially in large environments. Future work should focus on improving reasoning depth, efficiency, and semantic understanding.
Future Work
Future directions include integrating reinforcement learning to optimize proof search, expanding to other proof assistants like Isabelle or Lean, and incorporating richer semantic representations. Developing more efficient training algorithms and exploring multi-modal inputs could further improve performance, ultimately aiming for fully autonomous proof systems capable of tackling real-world complex theorems.
AI Executive Summary
Automated theorem proving (ATP) has long promised to revolutionize formal mathematics, software verification, and hardware design. However, current systems often rely on brute-force search strategies that lack the high-level reasoning capabilities humans naturally employ. Traditional proof methods, such as resolution refutation, convert theorems into low-level clauses, making proofs long, opaque, and difficult to interpret or extend. Interactive theorem proving (ITP) systems like Coq bridge this gap by allowing humans to guide proofs through tactics, which encode high-level reasoning steps. Yet, this process remains labor-intensive, limiting widespread adoption.
This paper introduces a significant leap forward by constructing CoqGym, a large and diverse dataset comprising 71,000 human-written proofs from 123 projects across various domains. This dataset provides rich structural information, including abstract syntax trees (ASTs) of proof goals and environments, facilitating deep learning approaches. Building on this, the authors develop ASTactic, a novel deep neural network that generates tactics as program trees, conditioned on the semantic context of goals and premises. Unlike previous methods restricted to fixed tactic sets, ASTactic dynamically synthesizes tactics by expanding ASTs with semantic constraints, enabling flexible, context-aware proof strategies.
Experimental results demonstrate that ASTactic can successfully prove 12.2% of test theorems, outperforming built-in tactics (4.9%) and, when combined with external ATPs, reaching a success rate of 30%. The model generalizes well across different domains, proving the effectiveness of high-level strategy learning. The approach’s ability to generate complete, human-like proof tactics marks a promising step toward fully automated theorem proving, with broad implications for formal verification, mathematical discovery, and AI-assisted reasoning.
Despite these advances, challenges remain. The model’s reasoning depth is limited for highly abstract proofs, and computational costs are substantial. Future work will focus on integrating reinforcement learning, expanding to other proof assistants, and enhancing semantic understanding, aiming to realize autonomous, scalable proof systems capable of tackling real-world complex theorems.
Deep Analysis
Background
Automated theorem proving (ATP) has evolved from early resolution-based systems like Vampire and E prover to modern neural-guided approaches. Interactive proof assistants such as Coq and Isabelle enable high-level reasoning but depend heavily on human-crafted tactics, limiting automation. Recent efforts incorporate machine learning to generate tactics or guide proof search, exemplified by Gauthier’s TacticToe and Huang’s GamePad. However, these approaches face data scarcity, limited tactic flexibility, and challenges in handling high-order logic. Large, diverse datasets and flexible models are needed to bridge the gap between human reasoning and machine automation, motivating the development of new datasets like CoqGym and models like ASTactic.
Core Problem
Despite progress, fully automated proof systems struggle with complex, high-order proofs due to limited data, rigid tactic sets, and insufficient semantic understanding. Existing models often rely on fixed tactic libraries, restricting their ability to adapt to new problems. The challenge is to develop a scalable, flexible approach that can learn high-level proof strategies from large datasets, generalize across domains, and generate human-like tactics dynamically, addressing the core bottleneck in automating formal reasoning.
Innovation
This work introduces three key innovations: 1) CoqGym, a large-scale, multi-domain dataset with 71K proofs and rich structural annotations; 2) ASTactic, a deep learning model that generates tactics as program trees conditioned on goal and premise semantics, enabling flexible, context-aware proof strategies; 3) synthetic proof augmentation from intermediate goals, improving model robustness. These innovations collectively overcome the limitations of fixed tactic sets, data scarcity, and shallow reasoning, pushing the frontier of AI-driven proof automation.
Methodology
- �� Data collection: Extracted 71K proofs from 123 Coq projects, serialized into ASTs, environments, and proof trees.
- �� Model design: Used TreeLSTM to encode goals and premises, then a sequence-to-tree decoder to generate tactic ASTs.
- �� Semantic constraints: Incorporated during decoding to synthesize valid tactic arguments dynamically.
- �� Training: End-to-end supervised learning with augmented short proofs from intermediate goals.
- �� Proof search: Applied depth-first search sampling multiple tactics, executing in Coq environment until proof completion.
- �� Evaluation: Compared success rates against Coq’s auto tactics and external ATPs, across diverse domains.
Experiments
The dataset was split into training, validation, and test sets, ensuring domain separation. Hyperparameters such as learning rate, batch size, and model depth were tuned based on validation performance. Baselines included Coq’s auto tactics and TacticToe. Metrics focused on proof success rate, number of steps, and generalization to unseen domains. Ablation studies assessed the impact of synthetic data and semantic constraints. The experiments demonstrated that ASTactic significantly outperformed baselines, especially on complex theorems, validating the model’s ability to learn high-level proof strategies.
Results
ASTactic achieved a 12.2% success rate on the test set, surpassing Coq’s internal tactics at 4.9%. When combined with external ATPs, the success rate increased to 30%. Cross-domain tests confirmed strong generalization, with notable improvements on proofs involving high abstraction. Ablation experiments revealed that synthetic proof augmentation and semantic constraints contributed substantially to performance gains, confirming their importance in model robustness.
Applications
This approach can automate proof generation in formal verification, mathematical theorem proving, and hardware/software correctness checks. It reduces reliance on manual tactic scripting, accelerates proof development, and enhances reliability. The framework can be integrated into existing proof assistants, providing intelligent proof guidance and enabling large-scale formalization efforts in industry and academia.
Limitations & Outlook
Current models have difficulty with very long or highly abstract proofs, indicating reasoning depth limitations. Semantic understanding of domain-specific concepts needs further improvement. Computational costs for training and inference are high, limiting scalability. Future work should focus on improving reasoning capabilities, efficiency, and semantic modeling to address these challenges.
Plain Language Accessible to non-experts
想象你在厨房里准备一道复杂的菜肴。每次你都按照食谱一步步操作,但食谱很长,步骤繁琐。传统的方法是照着固定的食谱走,遇到特殊情况就得自己想办法调整。而这项研究就像是教会一个机器人看懂食谱,理解每个步骤的逻辑,然后根据厨房里的材料,自己决定下一步怎么做。它通过学习很多厨师的做菜记录,逐渐掌握了做菜的技巧,甚至能在没有人指导的情况下,自己做出新菜。这就像让机器人变成了厨艺大师,能自主创造出美味佳肴,节省了很多人工操作的时间和精力。
ELI14 Explained like you're 14
你知道,有时候我们在学校写作文或解数学题,老师会教我们一些技巧,但自己学会这些技巧需要很多练习。现在,想象有个超级聪明的机器人,它看了很多人写的作文和解题步骤,然后学会了怎么写作文和解题。这个机器人可以自己尝试写出新的作文,或者解决以前不会做的题。这篇论文就像是让这个机器人学会了“写作”和“解题”的技巧,特别是在数学证明方面。它通过分析很多人的证明步骤,学会了用一种特别的“语言”——抽象语法树,把证明的每一步都写成一棵树,然后自己动手“画”出下一步的证明策略。这样,机器人就能帮人快速证明复杂的数学定理,甚至还可以证明一些以前机器都做不到的难题。这让数学和计算机科学都变得更厉害了!
Abstract
Humans prove theorems by relying on substantial high-level reasoning and problem-specific insights. Proof assistants offer a formalism that resembles human mathematical reasoning, representing theorems in higher-order logic and proofs as high-level tactics. However, human experts have to construct proofs manually by entering tactics into the proof assistant. In this paper, we study the problem of using machine learning to automate the interaction with proof assistants. We construct CoqGym, a large-scale dataset and learning environment containing 71K human-written proofs from 123 projects developed with the Coq proof assistant. We develop ASTactic, a deep learning-based model that generates tactics as programs in the form of abstract syntax trees (ASTs). Experiments show that ASTactic trained on CoqGym can generate effective tactics and can be used to prove new theorems not previously provable by automated methods. Code is available at https://github.com/princeton-vl/CoqGym.