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

## Facts

- Provider: Mathlib Initiative (extraction); leanprover-community Mathlib contributors
- License: Apache-2.0 (https://github.com/leanprover-community/mathlib4/blob/master/LICENSE)
- Size: 259 files
- Format: Parquet (in sampled files)
- Stored at: Hugging Face, https://huggingface.co/datasets/mathlib-initiative/mathlib-tactics
- Access: public, readable without an account
- Category: Mathematics
- Source: https://doi.org/10.1145/3372885.3373824
- Page: https://scigantic.com/archive/cca6be2e-ed42-5e7e-8857-018af92117e6
- Keywords: Mathematics, Parquet, Hugging Face

## About

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.

## Load the data

```python
from datasets import load_dataset
ds = load_dataset("mathlib-initiative/mathlib-tactics")
print(ds)
```

## Data structure

File types in sampled files: Parquet

Example file: `part-000.parquet`

## Open it

- In a hosted notebook with the data mounted: https://scigantic.com/archive/cca6be2e-ed42-5e7e-8857-018af92117e6
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/cca6be2e-ed42-5e7e-8857-018af92117e6
- Over MCP: `get_schema_card` with id `cca6be2e-ed42-5e7e-8857-018af92117e6` at https://api.scigantic.com/mcp

## Related topics

- [Parquet datasets](https://scigantic.com/topics/parquet)
- [Mathematics datasets](https://scigantic.com/topics/mathematics)
