# Mathlib Constant Dependencies: Dependency Graph of Lean 4 Theorems and Definitions (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: 131 files
- Format: Parquet (in sampled files)
- Stored at: Hugging Face, https://huggingface.co/datasets/mathlib-initiative/mathlib-const-dep
- Access: public, readable without an account
- Category: Mathematics
- Source: https://doi.org/10.1145/3372885.3373824
- Page: https://scigantic.com/archive/67789800-2913-58c5-9380-61c616fbd969
- Keywords: Mathematics, Parquet, Hugging Face

## About

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).

## Load the data

```python
from datasets import load_dataset
ds = load_dataset("mathlib-initiative/mathlib-const-dep")
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/67789800-2913-58c5-9380-61c616fbd969
- Full record as JSON (schema card included): https://api.scigantic.com/api/archives/67789800-2913-58c5-9380-61c616fbd969
- Over MCP: `get_schema_card` with id `67789800-2913-58c5-9380-61c616fbd969` at https://api.scigantic.com/mcp

## Related topics

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