Automated Lean 4 formalization and verification badges for research papers.
paper-badger fetches an arXiv paper (or uses a local LaTeX directory), extracts theorem-like statements, runs LLM-backed prover and verifier agents to formalize them in Lean 4 + Mathlib, and inserts verified-badges links back into the paper source.
arXiv paper ──> extract statements ──> LLM prover ──> Lean compilation
│ │
│ LLM verifier
│ │
└──────────────── insert badges <────────────── accept / retry
- Downloads and extracts an arXiv source bundle (or copies a local directory).
- Detects definitions, lemmas, propositions, corollaries, and theorems.
- Initializes a Lean 4 + Mathlib workspace.
- Loops: prover agent proposes a formalization,
lake buildcompiles it, verifier agent checks correctness. - Accepted statements get a
\leanproof{}or\leanformalized{}badge inserted into the LaTeX source. - Progress is saved to
state.jsonafter every task, so runs are fully resumable.
pip install paper-badgerOr run directly without installing:
uvx paper-badger 2002.10752paper-badger 2002.10752The run subcommand is implied, so paper-badger run 2002.10752 is equivalent.
paper-badger run my-paper --paper-dir path/to/latex/By default the prover is codex and the verifier is claude. To use Claude for both:
paper-badger run 2002.10752 --prover-backend claude --verifier-backend claudepaper-badger monitor 2002.10752 # live dashboard
paper-badger monitor 2002.10752 --once # single snapshot| Mode | Behavior |
|---|---|
local |
file:// links relative to the paper directory (default) |
github |
GitHub blob links using --repo-url and --branch |
auto |
GitHub links when repo info is provided, local otherwise |
paper-badger run 2002.10752 \
--badge-link-mode github \
--repo-url https://github.com/you/repo \
--branch mainruns/<paper-id>/
paper/ # LaTeX sources (badges inserted here)
<RootModule>/Formalizations/ # Generated Lean files
state.json # Resumable run state
TODO.md # Task checklist
PROVER.md # Current prover status
ISSUES.md # Paper issues found during the run