Mathlib Tactics: Lean 4 Proof Steps with Goal States from the Mathlib Library (Mathlib Initiative)

Provider
Mathlib Initiative (extraction); leanprover-community Mathlib contributors
License
Apache-2.0 (source)
Size
259 files
Format
Parquet (in sampled files)
Stored at
Hugging Face (https://huggingface.co/datasets/mathlib-initiative/mathlib-tactics)
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

Every tactic invocation in Mathlib, the community library of formalized mathematics for the Lean 4 interactive theorem prover, paired with the proof goals before and after the step. The rows were extracted with the lean_scout tool from Mathlib commit fc4f59e5 (Lean v4.36.0), and there are about 2.02 million of them. Each row gives the module, source start and end positions, the pretty-printed tactic text (ppTac), its elaborator and syntax kind, the list of goals it acted on (pretty-printed hypotheses and target, the term each goal was assigned, and the constants and free variables used), and the goals left afterwards. This is the standard kind of training and evaluation data for neural theorem proving, tactic prediction and premise selection, which means learning which proof step a mathematician would write next in a formal proof. The data is in about 250 Parquet shards plus a manifest.json; read it with pyarrow, pandas or Hugging Face datasets. Mathlib is released under the Apache-2.0 license by the leanprover-community. Cite the Mathlib paper (The Lean Mathematical Library, CPP 2020, doi 10.1145/3372885.3373824) or the mathlib4 repository.

How to load this dataset in Python

from datasets import load_dataset
ds = load_dataset("mathlib-initiative/mathlib-tactics")
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 Tactics: Lean 4 Proof Steps with Goal States from the Mathlib Library (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