Datasets:
Mathlib Refactor History
This release is a source-level history of public declarations in
leanprover-community/mathlib4,
pinned to commit e72c1e277f31441626621f7d0c7207862fc25569. It connects a complete
commit index to statement-change scans and lossless before/after bundles for
refactor-shaped historical events.
The package contains 157.7 MiB of compressed/derived data in
17 data files. Exact byte counts and both compressed and
canonical SHA-256 digests are recorded in RELEASE_MANIFEST.json.
Data layers
| Layer | Records | Hub access | Meaning |
|---|---|---|---|
refactor_pair_catalog |
13,905 | Default viewer configuration | Compact lookup table with provenance, screening status, declaration counts, shard location, and per-record hash |
commits |
33,999 | Viewer configuration | Every commit reachable from the frozen snapshot, including first-parent metadata, changed Lean files, PR reference, and historical Lean toolchain when present |
statement_scans |
33,999 | Viewer configuration | Source-structure changes for the same commits, including public declaration events and high-recall structural signals |
| Full refactor pairs | 13,905 | data/refactor_pairs/*.jsonl.gz |
Complete nested before/after declaration bundles with source statements, context, alignment, provenance, and screening metadata |
The full pair payload has 11 record-aligned shards. It is kept
outside the hosted viewer configurations because 46 valid records are larger than
1 MiB and the largest is about 50 MiB. Nothing is removed: use the catalog's
full_record_file and record_index_in_shard fields to locate a full record.
Important quality status
This is a high-recall structural release, not an expert-verified gold dataset.
- 13,900 pair boundaries are
provisional_structural; 5 use curated pilot overrides. - AI screening labels are triage metadata. They do not establish mathematical equivalence, shared intent, quality, or preference.
- Proof-body-only changes to theorems and lemmas are ignored by the statement scanner. Definition/abbreviation value changes are retained.
- 76 commit-level scan records contain truncated event previews; their summaries remain complete, and full pair materialization recomputed structural events from the parsed-blob cache.
- There are no train/validation/test splits. The split is named
fullto avoid implying that the records are ready-made training examples.
Do not report model performance on these pairs as gold refactoring accuracy without an independent human review and a documented filtering protocol.
Load the viewer-friendly tables
from datasets import load_dataset
repo_id = "YOUR_NAMESPACE/mathlib-refactor-history"
catalog = load_dataset(
repo_id, "refactor_pair_catalog", split="full"
)
commits = load_dataset(repo_id, "commits", split="full")
scans = load_dataset(repo_id, "statement_scans", split="full")
Stream the lossless full pair records
Download the snapshot and let the JSON loader decompress the Gzip shards:
from pathlib import Path
from datasets import load_dataset
from huggingface_hub import snapshot_download
repo_id = "YOUR_NAMESPACE/mathlib-refactor-history"
snapshot = Path(snapshot_download(repo_id, repo_type="dataset"))
pair_files = [str(path) for path in sorted(
snapshot.glob("data/refactor_pairs/*.jsonl.gz")
)]
pairs = load_dataset(
"json",
data_files={"full": pair_files},
split="full",
streaming=True,
)
first_pair = next(iter(pairs))
For a dependency-light workflow, use gzip -dc and parse one JSON object per
line. Run python3 scripts/verify_release.py after downloading to check every
file, decompressed table digest, record count, and pair-to-catalog mapping.
Schemas and identifiers
schemas/commit_history.schema.jsondescribes commit records. Primary key:commit.schemas/statement_history_scan.schema.jsondescribes scan records. Primary key:commit.schemas/pair.schema.jsondescribes full pair records. Primary key:pair_id.schemas/refactor_pair_catalog.schema.jsondescribes the compact catalog.
All commit- and scan-level tables have one record per reachable commit and join on
commit. Pair provenance contains before_commit and after_commit; the release
does not assert that all provisional bundles express one minimal mathematical
intent.
Construction and reproducibility
The history was indexed and scanned from the frozen Mathlib snapshot. The source
parser is lean-source-declarations-v0.4; the statement scanner is
source-structure-v0.1. The package retains the canonical uncompressed SHA-256 of
each source JSONL in RELEASE_MANIFEST.json, so repackaging does not change data
identity.
The package deliberately excludes local Git/build caches, SQLite parsed-blob
caches, archived parser versions, duplicated benchmark materializations,
discussion bodies, consumer-graph build trees, and pending natural-language or
visibility drafts. See docs/decisions/0001-hugging-face-release-package.md for
the scope rationale.
Personal and sensitive information
Commit records retain public Git author names and commit subjects for provenance; they do not contain author email addresses. Pair records contain excerpts of the publicly licensed Mathlib source and public GitHub URLs. An automated pre-release scan found no local absolute workspace paths, Hugging Face/GitHub access tokens, PEM private keys, or AWS access-key patterns in the selected canonical sources. Automated scanning cannot prove the absence of all sensitive content.
GitHub and Zulip discussion bodies are intentionally not included in this release. Please use public identities responsibly and follow applicable deletion or correction requests.
License and attribution
The release is distributed under Apache License 2.0. It includes mechanically
derived metadata and source excerpts from Mathlib, which is also distributed
under Apache License 2.0. See LICENSE and NOTICE.md. Repository links and
commit hashes are retained for provenance and attribution.
Citation
Until an archival DOI is assigned, cite the Hugging Face dataset revision you used together with the pinned Mathlib snapshot. Also cite Mathlib according to the guidance in the upstream Mathlib repository.
- Downloads last month
- 18