Manuscript Offprint

arXiv:2610.31810

PaperFormalizer: Author-in-the-Loop Autoformalization of Research Papers in Lean

Jiyuan Tan, Vasilis Syrgkanis, Jose Blanchet

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

Abstract

Even a carefully proofread paper can leave small gaps in its proofs or its stated assumptions. We introduce PAPERFORMALIZER, a Lean-based agentic pipeline that helps authors find and close such gaps in their own papers and turn each paper into a Lean-verified version. Starting from the LATEX source, PAPERFORMALIZER transcribes the paper into a dependency graph of statements, audits each statement in natural language for faithfulness, ambiguity and correctness, and then formalizes and proves the statements in Lean against Mathlib, optional domain libraries and the author's personal toolkit. Only the author knows what a statement is meant to say and how a formalization gap in a result is best fixed. The pipeline therefore stops and asks the author whenever a statement admits more than one reading, presents every repair, in natural language and TEX symbols, as a proposal that the author can accept, decline or redirect, and leaves to the author every decision that could potentially change what the paper claims. The output is an annotated and revised version of the paper, a report of the changes, and Lean code in which each declaration is linked to the statement it formalizes. The author's toolkit grows as more papers are formalized, and authors can share their verified papers so that researchers who build on them can reuse their Lean code. By making verified papers practical to produce, PAPERFORMALIZER aims to make research that rests on mathematical proofs more robust. PAPERFORMALIZER runs inside a coding agent (Claude Code or Codex) and is available at https://github.com/Jiyuan-Tan/PaperFormalizer. Papers with Lean code shared by users are available at https://paperformalizer.org.

1 Introduction

Many theoretical papers in statistics, machine learning, operations research and mathematics rest on long technical proofs with many tedious details. Even after several rounds of proofreading, an author can easily overlook a detail that seems unimportant, such as a boundary case, a missing regularity condition, or a step that needs an assumption the paper never states. Most of the time, such gaps have no effect on the main conclusions.

A proof assistant such as Lean [1], with its mathematical library Mathlib [2], accepts a proof only when every step follows from the definitions and earlier results, so no gap can pass unnoticed. Formalizing a paper in Lean is therefore a reliable way for authors to find and close the gaps in their own proofs, and the result is a paper whose mathematics is Lean-verified. Formalizing a research paper by hand, however, can take weeks of work from someone fluent in both the paper's field and Lean. Recent agentic systems formalize informal mathematics automatically, but a research paper raises two problems that a machine cannot settle alone. First, natural language is ambiguous. A statement can admit several readings, and a formalization of the wrong one proves something the author never meant. Second, when a statement turns out to be false, there are usually many ways to fix it. The repair that changes the least in logic may still miss what the author intends, for

Stage I: natural language review

Figure

Figure 1: Workflow of PAPERFORMALIZER. Stage I turns the LATEX source into a reviewed and repaired dependency graph. Stage II formalizes and proves the revised statements in Lean. Dashed purple arrows mark the points where the author takes part (Section 3); the dashed green arrow is the feedback loop into the personal toolkit (Section 4).

example by giving up the part of the result the author cares about most. Both problems depend on the author's intent, so the author has to take part in the process. We introduce PAPERFORMALIZER, a Lean-based pipeline that helps authors improve their own papers. PAPERFORMALIZER points the author to each gap in the proofs, recommends how to close it, and produces a Lean-verified version of the paper, while the author keeps every decision about what the paper claims.

The pipeline has two stages, natural language review and autoformalization (Figure 1). In the first stage, one agent transcribes the TEX source into a dependency graph whose nodes are the statements of the paper. A second agent then checks each node closely for correctness and ambiguity and proposes repairs for the problems it finds. Whenever the agent is unsure what a statement is meant to say, it stops and asks the author, in natural language and TEX symbols, and the author decides on every repair that would weaken a main result. Once the paper passes this stage, the pipeline formalizes each statement in Lean automatically. The final output is a revised paper and a report of what was changed, together with the Lean code. We used PAPERFORMALIZER on three of our own papers. Five of the seven results in one paper and 15 of the 29 results in another needed some revision, and for each of them the pipeline proposed a repair that largely preserve the statement of the main results in the paper. (Section 5 and Table ??).

Each verified paper also makes the next one cheaper to verify. A researcher often works in related areas and uses the same techniques across papers, so much of the Lean code written for one paper can be reused in the next. Each author can keep a personal toolkit that grows as they formalize more papers. We also provide a place where authors can share a verified paper together with its Lean code, so that researchers who build on the paper can reuse most of that code.

Intended use. We designed PAPERFORMALIZER for authors who want to strengthen their own papers, before submission or after publication. The pipeline makes its key decisions together with the author, because the right reading of a statement and the right repair of an error depend on what the author intends. A repair proposed without the author is only the pipeline's best guess, and the author may have a different reading in mind or prefer a different fix. PAPERFORMALIZER is therefore a tool for improving a paper together with its authors.

Related work. There is some recent work in this direction. OSVerify [3] and Rethlas-OSV review the mathematics of solutions and papers in natural language, passing only audited findings to human experts. Rethlas and Archon [4], LeanMarathon [5] and LeanFlow [6] formalize informal arguments or whole papers in Lean 4. PAPERFORMALIZER sits between these two scenarios and puts the author in the loop, with the goal of producing a verified version of the author's paper. It first reviews the paper in natural language and proposes repairs for the errors it finds, then formalizes every statement in Lean, and it asks the author whenever a statement can be read in more than one way or a repair would qualitatively change a main result.