Mathlib Types: Lean 4 Declaration Names, Type Signatures and Docstrings from Mathlib (Mathlib Initiative)

Provider
Mathlib Initiative (extraction); leanprover-community Mathlib contributors
License
Apache-2.0 (source)
Size
131 files
Format
Parquet (in sampled files)
Stored at
Hugging Face (https://huggingface.co/datasets/mathlib-initiative/mathlib-types)
Access
Free and public. No account with the data provider is needed.
Category
Mathematics
Source
https://doi.org/10.1145/3372885.3373824

About this dataset

The name, module, type signature and documentation string of every declaration in Mathlib, the Lean 4 library of formalized mathematics. That covers about 807,000 theorems, lemmas, definitions and structures, extracted with lean_scout from Mathlib commit fc4f59e5. Each row holds the fully qualified constant name, the Mathlib module that defines it, its pretty-printed type (for a theorem, the formal statement of what it proves), its docstring where one exists, and an allowCompletion flag. Researchers use it for formal-statement retrieval, autoformalization (translating informal mathematics into Lean), premise selection and building search engines over formal mathematics. It pairs with the Mathlib Constant Dependencies and Mathlib Tactics datasets from the same commit. The data is in Parquet shards with a manifest.json; read it with pyarrow, pandas or Hugging Face datasets. Mathlib is Apache-2.0 licensed by the leanprover-community. Cite the Mathlib paper (CPP 2020, doi 10.1145/3372885.3373824).

How to load this dataset in Python

from datasets import load_dataset
ds = load_dataset("mathlib-initiative/mathlib-types")
print(ds)

Data structure

File types in sampled files: Parquet

Files

Example file: part-000.parquet

Analyze this dataset without downloading it

On Scigantic, Mathlib Types: Lean 4 Declaration Names, Type Signatures and Docstrings from Mathlib (Mathlib Initiative) opens in a hosted JupyterLab notebook with the data already mounted, so you can read files where they are stored instead of copying them first. Each notebook includes an AI assistant that can see the mounted files and write and run analysis code. Open the dataset page to launch a notebook, or browse the full catalog.

This page is also available as Markdown and as JSON.

Related Mathematics datasets