LeanContext: Disentangling Mathematical Resources from Local Formal Context in Lean Whole-Proof Generation
cs.AI
Submitted: 2026-11-05
Updated: 2026-11-05
Code: https://github.com/haaaardcvZ/LeanContext
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: Neural theorem proving increasingly uses retrieved premises and project context to support proof generation.
Terminology
Abstract
Neural theorem proving increasingly uses retrieved premises and project context to support proof generation. Evaluating these resources requires measuring the advantage of target-selected declarations over comparable alternatives and how this advantage depends on training. We introduce LeanContext, a benchmark of 129,826 Lean whole-proof generation problems, to investigate these questions. We group selected complete preceding mathematical declarations as Mathematical Context (MC) and the remaining selected local source commands as Environment Context (EC). Four aligned input views support crossed training and inference evaluations with shared targets and original Lean verification environments. For both diffusion- and autoregressive-based models, selected declarations outperform comparable alternatives by a larger margin when training includes MC. Final-input audits identify omitted declarations referenced by the target. Prioritizing these dependencies improves Pass@32 by 1.40% and 1.70% for LLaDA and Llama, respectively, on 2,000 targets. The selection experiment operates without access to target reference proofs and holds checkpoints, EC, and inference budgets constant. The code and dataset are available at https://github.com/haaaardcvZ/LeanContext.
Sources
- ProofNet: Autoformalizing and Formally Proving Undergraduate-Level Mathematics
- Evaluating Large Language Models Trained on Code
- Qwen2.5-Coder Technical Report
- FIMO: A Challenge Formal Dataset for Automated Theorem Proving
- CombiBench: Benchmarking LLM Capability for Combinatorial Mathematics
- The Llama 3 Herd of Models
- Generative Language Modeling for Automated Theorem Proving
- Qwen2.5 Technical Report
- Qwen3 Technical Report
- DeepSeek-Prover-V2: Advancing Formal Mathematical Reasoning via Reinforcement Learning for Subgoal Decomposition
- LEAN-GitHub: Compiling GitHub LEAN repositories for a versatile LEAN prover
- DeepSeek-Prover: Advancing Theorem Proving in LLMs through Large-Scale Synthetic Data
- Qwen2.5-Math Technical Report: Toward Mathematical Expert Model via Self-Improvement
- Dream 7B: Diffusion Large Language Models
- FormalMATH: Benchmarking Formal Mathematical Reasoning of Large Language Models
- Towards Real-World Industrial-Scale Verification: LLM-Driven Theorem Proving on seL4
Related papers
- Multi-Objective Structured Pruning of LLMs for Latency and Model Size Optimization
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- Embeddings for Preferences, Not Semantics
- Can We Trust Item Response Theory for AI Evaluation?
- Diagnosing Task Insensitivity in Language Agents