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

DevFeed: [LeanContext: Disentangling Mathematical Resources from Local Formal Context in Lean Whole-Proof Generation](<https://devfeed.tech/articles/leancontext-disentangling-mathematical-resources-from-local-formal-context-in-lean-whole-proof-generation-120303.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2611.08277>)

Author: Hang Zhang, Qihao Ye, Litong Liu, Yunbei Zhang, Yugyung Lee, Yue Zhou, Bowen Liu, Emily First, Cheng Han, Qiao Zhuang

Published: 2026-11-06T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [Lean](<https://devfeed.tech/topics/lean.md>), [Retrieval Augmented Generation (RAG)](<https://devfeed.tech/topics/retrieval-augmented-generation-rag.md>)

Tags: [000](<https://devfeed.tech/tags/000.md>), [2](<https://devfeed.tech/tags/2.md>), [abstract](<https://devfeed.tech/tags/abstract.md>), [alternatives](<https://devfeed.tech/tags/alternatives.md>), [arxiv](<https://devfeed.tech/tags/arxiv.md>), [audits](<https://devfeed.tech/tags/audits.md>), [autoregressive](<https://devfeed.tech/tags/autoregressive.md>), [based](<https://devfeed.tech/tags/based.md>), [benchmark](<https://devfeed.tech/tags/benchmark.md>), [code](<https://devfeed.tech/tags/code.md>), [commands](<https://devfeed.tech/tags/commands.md>), [complete](<https://devfeed.tech/tags/complete.md>), [context](<https://devfeed.tech/tags/context.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [dataset](<https://devfeed.tech/tags/dataset.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [formal](<https://devfeed.tech/tags/formal.md>), [generation](<https://devfeed.tech/tags/generation.md>), [lean](<https://devfeed.tech/tags/lean.md>), [local](<https://devfeed.tech/tags/local.md>), [resources](<https://devfeed.tech/tags/resources.md>)

## AI overview

LeanContext is a benchmark of 129,826 Lean whole-proof generation problems that separates selected preceding mathematical declarations (Mathematical Context, MC) from other selected local source commands (Environment Context, EC). Its four aligned input views support crossed training and inference evaluations with shared targets and original Lean verification environments. For both diffusion and autoregressive models, selected declarations outperform comparable alternatives by a larger margin when training includes MC. Auditing final inputs for omitted declarations referenced by targets, then prioritizing those dependencies, raises Pass@32 by 1.40% for LLaDA and 1.70% for Llama across 2,000 targets. The selection experiment does not use target reference proofs and holds checkpoints, EC, and inference budgets constant.

## Source excerpt

arXiv:2611.08277v1 Announce Type: new 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.