Mathlib Constant Dependencies: Dependency Graph of Lean 4 Theorems and Definitions (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-const-dep)
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 direct dependency graph of Mathlib, the Lean 4 library of formalized mathematics. For each of about 807,000 declarations (theorems, lemmas, definitions, instances), the row lists the constants its statement and proof refer to directly. Fields are name, module, deps (the list of constants used) and allowCompletion. The graph was extracted with lean_scout from Mathlib commit fc4f59e5, the same commit as the Mathlib Types and Mathlib Tactics datasets, so the names join across all three. It supports premise selection (which earlier lemmas a proof needs), graph analyses of how a large body of mathematics is built, and dependency-aware retrieval for automated theorem provers. The data is in Parquet shards with a manifest.json; read it with pyarrow, pandas, polars or networkx after loading. 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-const-dep")
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 Constant Dependencies: Dependency Graph of Lean 4 Theorems and Definitions (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