LeanContext: Disentangling Mathematical Resources from Local Formal Context in Lean Whole-Proof Generation

Hang Zhang, Qihao Ye, Litong Liu, Yunbei Zhang, Yugyung Lee +5 more
11/5/2026
cs.AI

Official code: haaaardcvZ/LeanContext (1 star, Python, MIT, last commit 2026-11-06).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

MIT

Companion framework for LeanContext: disentangling mathematical resources from local formal context in Lean whole-proof generation.

10Python, LeanNov 5, 20263 weeks agoMIT

Similar Papers

Cite this paper

@article{zhang2026leancontext,
  title  = {LeanContext: Disentangling Mathematical Resources from Local Formal Context in Lean Whole-Proof Generation},
  author = {Hang Zhang and Qihao Ye and Litong Liu and Yunbei Zhang and Yugyung Lee and Yue Zhou and Bowen Liu and Emily First and Cheng Han and Qiao Zhuang},
  year   = {2026},
  eprint = {2611.08277},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.08277v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.08277.svg)](https://codeofpaper.com/paper/2611.08277)

Discussion