arXiv:2611.09048cs.LGNov 2026

Manuscript Offprint

arXiv:2611.09048

LeanDojo-v2: A Comprehensive Library for AI-Assisted Theorem Proving in Lean

Ryan Hsiang, William Adkisson, Robert Joseph George, Anima Anandkumar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Building on recent progress in machine learning for formal theorem proving in Lean, we introduce LeanDojo-v2: an end-to-end framework that unifies repository data extraction, LLM fine-tuning, proof search, AI autocompletion, and LLM-assisted theorem proving in a single software library. In addition, we provide Lean4Code, a lightweight IDE that integrates the various features of LeanDojo-v2 through a simple, mathematician-friendly UI. These tools will enable mathematicians and researchers to easily fine-tune language models on domain-specific Lean codebases and experiment with LLM-assisted theorem proving without a complex setup.

1 Introduction

Theorem proving with proof assistants such as Lean has enabled mathematicians to formalize mathematical concepts and proofs in a way that computers can verify with absolute certainty. Lean serves as both a programming language and a proof assistant, enabling mathematicians to formalize complex mathematical structures and verify the correctness of their proofs mechanically. This formalization process ensures mathematical rigor and makes mathematical knowledge machine-readable and amenable to AI assistance.

Machine learning, particularly with large language models (LLMs), has been shown to excel at solving mathematical problems. However, reasoning in natural language is unverifiable and prone to hallucinations and logical errors. Thus, combining machine learning with proof assistants such as Lean can make machine-generated proofs rigorous and verifiable.

In recent years, various tools have been developed to integrate machine learning with the Lean theorem prover. LeanDojo[1] processes Lean repository information, such as premises and proofs, into training data. ReProver[1] trains retrieval-augmented language models using data generated by LeanDojo. LeanCopilot[2] is an AI-assistant that integrates the ReProver models with the Lean 4 VSCode extension. LeanAgent[3] extends upon ReProver by applying curriculum learning across different mathematical domains. For proof optimization, ImProver [4] rewrite proofs that optimize for an arbitrary criterion. Other data-extraction frameworks have also been developed, such as the ntp-toolkit [5], Lean4trace [6], and LeanNavigator [7].

Another essential tool for machine-based theorem proving in Lean is a read-eval-print loop (REPL), i.e., a programming interface that executes Lean tactics and returns the updated goal. Popular Lean REPLs include LeanDojo, Pantograph[8], and Kimina Lean Server[9]. In particular, Pantograph provides a Python interface for running Lean code, allowing users to apply a tactic to an unsolved goal and receive the resulting goal.

39th Conference on Neural Information Processing Systems (NeurIPS 2025) Workshop: MATH-AI.

Despite these efforts to advance the field of AI-assisted theorem proving, there are still significant technical hurdles in its implementation. Most of the tools described above are separate, research-oriented projects, which may be outdated and require nontrivial effort to maintain and update. In addition, all aforementioned tools require some level of programming/technical expertise to set up and use, which may be challenging for mathematicians without a programming background.

To address these limitations, we introduce LeanDojo-v2, a unified infrastructure for Lean-based AI tools. It provides standardized APIs for data extraction, model training, and theorem proving, integrating frameworks such as LeanDojo and LeanAgent. Our contributions include an LLM fine-tuning pipeline, support for large-model inference, and theorem proving via both proof search and whole-proof generation.

In addition, we introduce Lean4Code, a lightweight Lean 4 native code editor. We build Lean4Code as a VSCodium-based code editor, leading to a familiar feel for current developers, and a user-friendly experience for mathematicians. Lean4Code also comes with the VSCode Lean4 extension already built in, making it the first Lean native code editor. Finally, Lean4Code comes with three custom extensions, an interactive user interface for LeanDojo, LeanCopilot, and ByteDance's Agent TARS[10], providing an interactive interface for LeanDojo-v2 tools.