SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.15626 · NeurIPS · 2023

LeanDojo: Theorem Proving with Retrieval-Augmented Language Models

Anima Anandkumar, U Austin, Mit, Caltech, Kaiyu Yang, Alex Gu, Shixing Yu, Santa Uc, Aidan Swope, Rahul Chalamala, Peiyang Song, Saad Godil, and 2 more

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2306.15626.json · badge: /api/ran/2306.15626.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
lean-dojo/LeanDojo canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
lean-dojo/reprover canonical (classifier label)
classifier basis: census
1 ran · 0 no recorded run
FunctionStatusWhere it lives
camel_case Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/utils.py
code served (permissive licence) · get_code("f3b0fa0cd9b61ec2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

_CAMEL_CASE_REGEX = re.compile('(_|-)+')

def camel_case(s: str) -> str:
    """Convert the string ``s`` to camel case."""
    return _CAMEL_CASE_REGEX.sub(' ', s).title().replace(' ', '')

ARGS = {
    "s": "hello_world_example"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_md5 Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/utils.py
code served (permissive licence) · get_code("a0290932b4cf10e0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib
from pathlib import Path
import tempfile

# Create a temporary file with some content
with tempfile.NamedTemporaryFile(mode='wb', delete=False) as f:
    temp_path = Path(f.name)
    f.write(b"Hello, this is test content for MD5 hashing.\n" * 100)

ARGS = {
    "path": temp_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_repo_type Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/data_extraction/lean.py
code served (permissive licence) · get_code("b08f3b85685d51b3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned RepoType. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import urllib.parse
from enum import Enum
from pathlib import Path
from unittest.mock import MagicMock, patch

_SSH_TO_HTTPS_REGEX = re.compile('git@github\\.com:(?P<user>.+)/(?P<repo>.+?)(\\.git)?')

class RepoType(Enum):
    GITHUB = 0
    REMOTE = 1
    LOCAL = 2

def ssh_to_https(url: str) -> str:
    m = _SSH_TO_HTTPS_REGEX.fullmatch(url)
    return f"https://github.com/{m.group('user')}/{m.group('repo')}" if m else url

def url_exists(url: str) -> bool:
    return False

def is_git_repo(path: Path) -> bool:
    return False

def get_repo_type(url: str):
    """Get the type of the repository.

    Args:
        url (str): The URL of the repository.
    Returns:
        Optional[str]: The type of the repository (None if the repo cannot be found).
    """
    url = ssh_to_https(url)
    parsed_url = urllib.parse.urlparse(url)
    if parsed_url.scheme in ['http', 'https']:
        if 'github.com' in url:
            if not url.startswith('https://'):
                return None
            else:
                return RepoType.GITHUB
        elif url_exists(url):
            return RepoType.REMOTE
    elif is_git_repo(Path(parsed_url.path)):
        return RepoType.LOCAL
    return None

ARGS = {
    "url": "https://github.com/openai/gpt-2"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
loguru — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RepoType — a RepoType output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RepoType output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_new_version Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/data_extraction/trace.py
code served (permissive licence) · get_code("06f09eade0632c08")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

ARGS = {
    "v": "4.3.0"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_url Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/data_extraction/lean.py
code served (permissive licence) · get_code("bee7f6c1e3fcb6b4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
import os
from enum import Enum

_URL_REGEX = re.compile('(?P<url>.*?)/*')

_SSH_TO_HTTPS_REGEX = re.compile('git@github\\.com:(?P<user>.+)/(?P<repo>.+?)(\\.git)?')

class RepoType(Enum):
    GITHUB = 0
    REMOTE = 1
    LOCAL = 2

def ssh_to_https(url: str) -> str:
    m = _SSH_TO_HTTPS_REGEX.fullmatch(url)
    return f"https://github.com/{m.group('user')}/{m.group('repo')}" if m else url

def normalize_url(url: str, repo_type: RepoType=RepoType.GITHUB) -> str:
    if repo_type == RepoType.LOCAL:
        return os.path.abspath(url)
    url = _URL_REGEX.fullmatch(url)['url']
    return ssh_to_https(url)

ARGS = {
    "url": "https://github.com/user/repo",
    "repo_type": RepoType.GITHUB
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_goals Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/interaction/parse_goals.py
code served (permissive licence) · get_code("4098df97894629fe")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
from typing import List
from dataclasses import dataclass

_DECL_REGEX = re.compile('(?<=\\n)(?P<idents>.+?)\\s+\\:(?P<lean_type>.+?)\\n(?=\\S)', re.DOTALL)

_CASE_REGEX = re.compile('case\\s\\S+\\n')

_SPACE_REGEX = re.compile('\\s+')

@dataclass(frozen=True)
class Declaration:
    """A declaration in the local context."""
    ident: str
    lean_type: str

    def __post_init__(self) -> None:
        assert _SPACE_REGEX.search(self.ident) is None

def _parse_local_context(ctx_pp: str) -> List[Declaration]:
    """Parse the local context of a goal."""
    m = _CASE_REGEX.match(ctx_pp)
    if m is not None:
        ctx_pp = ctx_pp[m.end():]
    decls = []
    for m in _DECL_REGEX.finditer('\n' + ctx_pp + '⊢'):
        lean_type = m['lean_type'].strip()
        if lean_type.endswith(','):
            lean_type = lean_type[:-1].strip()
        for ident in m['idents'].strip().split():
            decls.append(Declaration(ident.strip(), lean_type))
    return decls

@dataclass(frozen=True)
class Goal:
    """A goal in Lean."""
    assumptions: List[Declaration]
    conclusion: str

    @classmethod
    def from_pp(cls, pp: str) -> 'Goal':
        """Parse a pretty-printed goal."""
        assert pp.count('⊢') == 1
        ctx, concl = pp.split('⊢')
        assumptions = _parse_local_context(ctx)
        return cls(assumptions, concl.strip())

def parse_goals(pp: str) -> List[Goal]:
    """Parse a list of pretty-printed goals."""
    return [Goal.from_pp(g) for g in pp.split('\n\n') if '⊢' in g]


# Setup code to construct valid arguments for parse_goals
ARGS = {
    "pp": """x : Nat
y : Nat
⊢ x + y = y + x

a : Bool
b : Bool
⊢ a ∧ b = b ∧ a"""
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_marks Ran
ran; our contract draft was wrong, not the code
lean-dojo/reprover/common.py
pointer only (licence: MIT); the stored copy get_code serves, from fveler/fvel, is pointer only (licence: NONE) · get_code("1d4020e8b4d983e5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from fveler/fvel, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

ssh_to_https Ran
ran on a synthesized input
lean-dojo/LeanDojo/src/lean_dojo/data_extraction/lean.py
code served (permissive licence) · get_code("5b82edfee86e401f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

_SSH_TO_HTTPS_REGEX = re.compile('git@github\\.com:(?P<user>.+)/(?P<repo>.+?)(\\.git)?')

def ssh_to_https(url: str) -> str:
    m = _SSH_TO_HTTPS_REGEX.fullmatch(url)
    return f"https://github.com/{m.group('user')}/{m.group('repo')}" if m else url

ARGS = {
    "url": "git@github.com:torvalds/linux.git"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
execute Not yet run
unverified (harvested, no recorded run)
lean-dojo/LeanDojo/src/lean_dojo/utils.py
code served (permissive licence) · get_code("58b9a44ed03f6513")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
remove_marks 1 other paper
1 later
2406.14408 (2024-06)
FVEL: Interactive Formal Verification Environment with Large Language Models via Theorem Proving

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) have shown promise in proving formal theorems using proof assistants such as Lean. However, existing methods are difficult to reproduce or build on, due to private code, data, and large compute requirements. This has created substantial barriers to research on machine learning methods for theorem proving. This paper removes these barriers by introducing LeanDojo: an open-source Lean playground consisting of toolkits, data, models, and benchmarks. LeanDojo extracts data from Lean and enables interaction with the proof environment programmatically. It contains fine-grained annotations of premises in proofs, providing valuable data for premise selection-a key bottleneck in theorem proving. Using this data, we develop ReProver (Retrieval-Augmented Prover): an LLM-based prover augmented with retrieval for selecting premises from a vast math library. It is inexpensive and needs only one GPU week of training. Our retriever leverages LeanDojo's program analysis capability to identify accessible premises and hard negative examples, which makes retrieval much more effective. Furthermore, we construct a new benchmark consisting of 98,734 theorems and proofs extracted from Lean's math library. It features challenging data split requiring the prover to generalize to theorems relying on novel premises that are never used in training. We use this benchmark for training and evaluation, and experimental results demonstrate the effectiveness of ReProver over non-retrieval baselines and GPT-4. We thus provide the first set of open-source LLM-based theorem provers without any proprietary datasets and release it under a permissive MIT license to facilitate further research. * Research conducted while Saad Godil was at NVIDIA. 37th Conference on Neural Information Processing Systems (NeurIPS 2023) Track on Datasets and Benchmarks.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2306.15626")
get_code_for_paper("2306.15626")
have("2306.15626")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2306.15626.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2306.15626.svg)](https://syntology.ai/paper/2306.15626)

Connect an agent — have() is free.