TL;DR
This paper introduces Magnushammer, a novel transformer-based approach to premise selection for automated theorem proving. By leveraging contrastive learning, Magnushammer significantly outperforms existing tools like Sledgehammer, achieving higher success rates in proving theorems and setting a new state-of-the-art when combined with language models. This work also introduces a large, open-source dataset for premise selection.
What Problem Does This Paper Address?
Automated theorem proving (ATP) is a long-standing challenge in AI, aiming to mechanically verify mathematical proofs. A critical sub-problem is "premise selection," where the system must identify relevant facts (lemmas, theorems) from a vast knowledge base to construct a proof for a given statement. Traditional methods, like Sledgehammer, rely on complex symbolic techniques, external theorem provers, and significant domain-specific engineering. This makes them difficult to adapt to different proof assistants and computationally expensive. The authors aim to address this by developing a data-driven, neural-network-based approach that requires less manual effort and is more adaptable.
Methods
Magnushammer employs a two-stage approach:
- SELECT Stage: This stage uses a transformer model to embed proof states and premises into a common latent space. It then uses cosine similarity to quickly retrieve a set of the most relevant premises (e.g., top 1024). This stage is designed for speed and scalability, requiring only a single pass through the neural network. It's trained using a contrastive loss (InfoNCE).
- RERANK Stage: The premises retrieved by SELECT are then re-ranked by a separate component of the transformer model. This stage takes both the proof state and a retrieved premise as input and outputs a relevance score. This allows for a more accurate, context-aware assessment of premise relevance. This stage is trained using a binary cross-entropy loss.
The core of Magnushammer is a shared transformer backbone, pre-trained on a large text corpus (The Pile) and then fine-tuned for the premise selection task. This approach avoids the need for logic translation and external ATPs, simplifying the process and making it more generalizable.
Datasets
- The Pile: Used for pre-training the transformer backbone.
- HUMAN PROOFS LIBRARY (HPL): A newly created dataset derived from the Archive of Formal Proofs and the Isabelle Standard library. It consists of 4.4 million premise selection instances and 433,000 unique premises, representing textual representations of (proof state, relevant premise) pairs.
- MACHINE-AUGMENTED PROOFS LIBRARY (MAPL): This dataset is a union of HPL and premises generated by Sledgehammer, providing a larger and more diverse dataset.
- PISA and miniF2F: Standard benchmarks used for evaluating the performance of premise selection methods in theorem proving.
Key Insights and Ideas
- Transformer Power for Formal Reasoning: The paper demonstrates that a transformer architecture, commonly used for natural language processing, can be effectively adapted for the highly structured domain of formal mathematics.
- Contrastive Learning is Key: The success of Magnushammer hinges on contrastive training, which allows the model to learn meaningful embeddings for proof states and premises, enabling effective retrieval and ranking.
- Data-Driven vs. Engineering-Heavy: Magnushammer's success highlights the potential of data-driven approaches to surpass heavily engineered symbolic methods in complex AI tasks like theorem proving, reducing the need for domain expertise.
- Two-Stage Retrieval is Effective: The SELECT-RERANK architecture provides a good balance between computational efficiency and accuracy, allowing for fast initial retrieval followed by more precise re-ranking.
- Pre-training Matters: Pre-training the transformer backbone on a large text corpus significantly boosts performance, even with limited fine-tuning data.
Key Results
- Outperforms Sledgehammer: On the PISA benchmark, Magnushammer achieved a 59.5% proof rate, significantly outperforming Sledgehammer's 38.3%. On miniF2F, it achieved 34.0% vs. Sledgehammer's 20.9%.
- State-of-the-Art with Thor: When combined with the language-model-based theorem prover Thor, Magnushammer improved the state-of-the-art proof success rate on PISA from 57.0% to 71.0%.
- Data Efficiency: Magnushammer achieved strong performance even with only 0.1% of the MAPL dataset (around 4,000 samples), demonstrating its data efficiency, especially when starting from a pre-trained model.
- Scalability: Magnushammer shows remarkable scalability, maintaining high proof rates across varying computational budgets.
- New Dataset: The paper introduces the largest publicly available premise selection dataset to date, which is crucial for training and evaluating such models.
Limitations and Future Work
- Proof Representation: The current representation of proof states and premises is based on Isabelle's textual format. The authors suggest that richer semantic information (e.g., function definitions, object types) could further improve performance.
- Generalization to Other Proof Assistants: While Magnushammer is designed to be general, it has only been evaluated on Isabelle. The authors plan to evaluate it on other proof assistants like Lean.
- Integrated Proof Generation: The current work focuses on premise selection. Future work could explore integrating premise selection more deeply into language models for end-to-end proof generation, potentially modeling implicit dependencies between premises.
- Computational Budget: While Magnushammer scales well, the RERANK stage is computationally more intensive than SELECT. Future work might explore optimizing this stage.
Summary updated