Datasets:
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 3 new columns ({'name', 'module', 'kind'}) and 4 missing columns ({'is_explicit', 'target', 'source', 'is_simplifier'}).
This happened while the csv dataset builder was generating data using
hf://datasets/MathNetwork/MathlibGraph/mathlib_nodes.csv (at revision ea419982710d5223ad8c6217e4469e886b902247), [/tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/mathlib_edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/mathlib_edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/mathlib_nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/mathlib_nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/nodes.csv)]
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1890, in _prepare_split_single
writer.write_table(table)
File "/usr/local/lib/python3.12/site-packages/datasets/arrow_writer.py", line 760, in write_table
pa_table = table_cast(pa_table, self._schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2272, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
name: string
kind: string
module: string
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 591
to
{'source': Value('string'), 'target': Value('string'), 'is_explicit': Value('bool'), 'is_simplifier': Value('bool')}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1347, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 980, in convert_to_parquet
builder.download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 884, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 947, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1739, in _prepare_split
for job_id, done, content in self._prepare_split_single(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1892, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 3 new columns ({'name', 'module', 'kind'}) and 4 missing columns ({'is_explicit', 'target', 'source', 'is_simplifier'}).
This happened while the csv dataset builder was generating data using
hf://datasets/MathNetwork/MathlibGraph/mathlib_nodes.csv (at revision ea419982710d5223ad8c6217e4469e886b902247), [/tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/mathlib_edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/mathlib_edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/mathlib_nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/mathlib_nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/declaration/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/module/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/module/nodes.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/edges.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/edges.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/metrics.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/metrics.csv), /tmp/hf-datasets-cache/medium/datasets/14220812636551-config-parquet-and-info-MathNetwork-MathlibGraph-252291db/hub/datasets--MathNetwork--MathlibGraph/snapshots/ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/nodes.csv (origin=hf://datasets/MathNetwork/MathlibGraph@ea419982710d5223ad8c6217e4469e886b902247/v2/namespace/nodes.csv)]
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
source string | target string | is_explicit bool | is_simplifier bool |
|---|---|---|---|
Commute.exp_right | Eq.mpr | true | false |
Commute.exp_right | Algebra.to_smulCommClass | false | false |
Commute.exp_right | instHSMul | false | false |
Commute.exp_right | IsScalarTower.right | false | false |
Commute.exp_right | DivisionCommMonoid.toDivisionMonoid | false | false |
Commute.exp_right | Commute.pow_right | true | false |
Commute.exp_right | DivInvOneMonoid.toInvOneClass | false | false |
Commute.exp_right | Ring.toNonAssocRing | false | false |
Commute.exp_right | IsTopologicalRing.toIsTopologicalSemiring | false | false |
Commute.exp_right | Monoid.toMulOneClass | false | false |
Commute.exp_right | congrArg | true | false |
Commute.exp_right | NormedSpace.exp_eq_tsum | true | false |
Commute.exp_right | NormedSpace.exp | false | false |
Commute.exp_right | Rat | true | false |
Commute.exp_right | AddGroupWithOne.toAddMonoidWithOne | false | false |
Commute.exp_right | Algebra | true | false |
Commute.exp_right | Classical.propDecidable | false | false |
Commute.exp_right | Commute | true | false |
Commute.exp_right | Rat.commSemiring | false | false |
Commute.exp_right | Algebra.toSMul | false | false |
Commute.exp_right | DivisionMonoid.toDivInvOneMonoid | false | false |
Commute.exp_right | Field.toDivisionRing | false | false |
Commute.exp_right | Monoid.toNatPow | false | false |
Commute.exp_right | Algebra.toModule | false | false |
Commute.exp_right | id | true | false |
Commute.exp_right | MulOne.toMul | false | false |
Commute.exp_right | NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring | false | false |
Commute.exp_right | Nonempty.some | false | false |
Commute.exp_right | AddMonoidWithOne.toNatCast | false | false |
Commute.exp_right | Commute.tsum_right | true | false |
Commute.exp_right | DivisionRing.toRing | false | false |
Commute.exp_right | NonAssocSemiring.toMulZeroOneClass | false | false |
Commute.exp_right | dif_neg | true | false |
Commute.exp_right | Nat.cast | true | false |
Commute.exp_right | Field.toSemifield | false | false |
Commute.exp_right | NonAssocRing.toNonUnitalNonAssocRing | false | false |
Commute.exp_right | SummationFilter.instNeBotUnconditional | false | false |
Commute.exp_right | dite | true | false |
Commute.exp_right | MulZeroOneClass.toMulOneClass | false | false |
Commute.exp_right | IsTopologicalRing | false | false |
Commute.exp_right | NonUnitalNonAssocSemiring.toAddCommMonoid | false | false |
Commute.exp_right | AddMonoidWithOne.toOne | false | false |
Commute.exp_right | TopologicalSpace | false | false |
Commute.exp_right | MulOneClass.toMulOne | false | false |
Commute.exp_right | Commute.smul_right | true | false |
Commute.exp_right | NormedSpace.exp_def | true | false |
Commute.exp_right | Inv.inv | true | false |
Commute.exp_right | Semifield.toDivisionSemiring | false | false |
Commute.exp_right | Rat.instField | false | false |
Commute.exp_right | Rat.instCharZero | false | false |
Commute.exp_right | HPow.hPow | false | false |
Commute.exp_right | Distrib.toMul | false | false |
Commute.exp_right | Nat.factorial | true | false |
Commute.exp_right | tsum | false | false |
Commute.exp_right | NormedSpace.definition._proof_1._@.Mathlib.Analysis.Normed.Algebra.Exponential.267156490._hygCtx._hyg.8 | false | false |
Commute.exp_right | Nat | false | false |
Commute.exp_right | T2Space | false | false |
Commute.exp_right | Nonempty.casesOn | true | false |
Commute.exp_right | Semifield.toCommGroupWithZero | false | false |
Commute.exp_right | NormedSpace.definition._proof_2._@.Mathlib.Analysis.Normed.Algebra.Exponential.267156490._hygCtx._hyg.8 | false | false |
Commute.exp_right | DivisionSemiring.toSemiring | false | false |
Commute.exp_right | One.toOfNat1 | false | false |
Commute.exp_right | NonUnitalNonAssocSemiring.toDistrib | false | false |
Commute.exp_right | Nonempty | true | false |
Commute.exp_right | CommGroupWithZero.toDivisionCommMonoid | false | false |
Commute.exp_right | HSMul.hSMul | false | false |
Commute.exp_right | InvOneClass.toInv | false | false |
Commute.exp_right | Semifield.toCommSemiring | false | false |
Commute.exp_right | instHPow | false | false |
Commute.exp_right | NormedSpace.expSeries | false | false |
Commute.exp_right | OfNat.ofNat | false | false |
Commute.exp_right | Semiring.toNonAssocSemiring | false | false |
Commute.exp_right | Ring.toSemiring | false | false |
Commute.exp_right | Eq | false | false |
Commute.exp_right | Commute.one_right | true | false |
Commute.exp_right | Ring | false | false |
Commute.exp_right | Ring.toAddGroupWithOne | false | false |
Commute.exp_right | Not | false | false |
Commute.exp_right | MonoidWithZero.toMonoid | false | false |
Commute.exp_right | FormalMultilinearSeries.sum | false | false |
Commute.exp_right | SummationFilter.unconditional | false | false |
Commute.exp_right | Semiring.toMonoidWithZero | false | false |
AddGroupNorm.add_apply | Real | false | false |
AddGroupNorm.add_apply | Real.instAdd | false | false |
AddGroupNorm.add_apply | instHAdd | false | false |
AddGroupNorm.add_apply | AddGroup | false | false |
AddGroupNorm.add_apply | HAdd.hAdd | false | false |
AddGroupNorm.add_apply | AddGroupNorm.funLike | false | false |
AddGroupNorm.add_apply | AddGroupNorm.instAdd | false | false |
AddGroupNorm.add_apply | Eq | false | false |
AddGroupNorm.add_apply | DFunLike.coe | false | false |
AddGroupNorm.add_apply | AddGroupNorm | false | false |
AddGroupNorm.add_apply | rfl | true | false |
HahnModule.instBaseModule | DistribMulAction.toDistribSMul | false | false |
HahnModule.instBaseModule | inferInstanceAs | true | false |
HahnModule.instBaseModule | AddMonoid.toAddZeroClass | false | false |
HahnModule.instBaseModule | HahnModule | false | false |
HahnModule.instBaseModule | AddZeroClass.toAddZero | false | false |
HahnModule.instBaseModule | PartialOrder | false | false |
HahnModule.instBaseModule | HahnSeries.instAddCommMonoid | false | false |
MathlibGraph: The Multinetwork of Mathlib
Dependency graph of Mathlib (commit 534cf0b, 2 Feb 2026), the largest formal mathematics library for Lean 4 (v4.28.0-rc1).
Three dependency layers (declarations, modules, namespaces), each with nodes, edges, and precomputed network metrics.
Quick Stats
| Declarations | Modules | Namespaces (k=2) | |
|---|---|---|---|
| Nodes | 308,129 | 7,564 | 10,097 |
| Edges | 8,436,366 | 20,881 | 332,081 (weighted) |
| DAG depth | 83 | 154 | 7 (after SCC condensation) |
| Louvain modularity | 0.478 | 0.610 | 0.270 |
| Synthesized edges | 74.2% | — | — |
| In cycles | 5,732 nodes | 0 (DAG) | 6,055 nodes (38 SCCs) |
Files
Raw Data (v1)
| File | Rows | Description |
|---|---|---|
mathlib_edges.csv |
8,436,366 | Declaration dependency edges |
mathlib_nodes.csv |
317,655 | Declarations before deduplication |
nodes.csv / edges.csv |
633K / 10.9M | Full environment (Lean + Std + Mathlib) |
mechanisms.ndjson |
— | Lean language mechanism extractions |
tactic_usage.ndjson |
— | Per-declaration tactic usage profiles |
Three-Layer Graphs (v2)
Each layer has nodes.csv, edges.csv, and metrics.csv:
| Folder | Nodes | Edges | Metrics | Description |
|---|---|---|---|---|
v2/declaration/ |
308,129 | (use root mathlib_edges.csv) |
308,129 x 11 | Theorems, definitions, and other named constants |
v2/module/ |
7,564 | 20,881 | 7,564 x 10 | Source files linked by import statements |
v2/namespace/ |
10,097 | 332,081 | 10,097 x 11 | Depth-2 dotted-name prefixes, weighted edges |
v2/summary.json contains headline statistics for all three levels.
Quick Start
from datasets import load_dataset
# Declaration level
decl = load_dataset("MathNetwork/MathlibGraph",
data_files="v2/declaration/metrics.csv", split="train").to_pandas()
edges = load_dataset("MathNetwork/MathlibGraph",
data_files="mathlib_edges.csv", split="train").to_pandas()
# Module level
mod_nodes = load_dataset("MathNetwork/MathlibGraph",
data_files="v2/module/nodes.csv", split="train").to_pandas()
mod_edges = load_dataset("MathNetwork/MathlibGraph",
data_files="v2/module/edges.csv", split="train").to_pandas()
# Namespace level
ns_nodes = load_dataset("MathNetwork/MathlibGraph",
data_files="v2/namespace/nodes.csv", split="train").to_pandas()
ns_edges = load_dataset("MathNetwork/MathlibGraph",
data_files="v2/namespace/edges.csv", split="train").to_pandas()
Schema
v2/declaration/nodes.csv
Deduplicated from mathlib_nodes.csv (317,655 to 308,129 rows; 9,526 @[to_additive] mirrors removed).
| Column | Type | Description |
|---|---|---|
| name | str | Fully qualified declaration name |
| kind | str | theorem, definition, abbrev, inductive, constructor, opaque, axiom, or quotient |
| module | str | Parent namespace (null for 30,944 Lean core declarations) |
v2/declaration/metrics.csv
All columns from nodes.csv plus:
| Column | Type | Description |
|---|---|---|
| namespace_depth2 | str | First 2 dot-separated components (e.g., Mathlib.Algebra) |
| namespace_depth3 | str | First 3 dot-separated components |
| in_degree | int | Declarations that depend on this one |
| out_degree | int | Declarations this one depends on |
| pagerank | float | PageRank (alpha=0.85) |
| betweenness | float | Betweenness centrality (k=500, seed=42) |
| community_id | int | Louvain community |
| dag_layer | int | Topological depth; -1 for 5,732 nodes in cycles |
| file_module | str | Source file module (from Lean environment, 278K coverage) |
| is_tactic_proof | bool | Whether the proof uses tactics (78,315 declarations) |
| tactic_count | int | Number of tactics used in the proof |
| top_tactic | str | Most frequently used tactic in this proof |
| is_instance | bool | Whether this is a typeclass instance (26,415 declarations) |
| instance_class | str | Which typeclass this instance implements |
| is_coercion | bool | Whether this is a coercion (241 declarations) |
| to_additive_pair | str | Name of the corresponding additive/multiplicative variant |
| def_height | float | Definitional height in the kernel (42,935 declarations) |
v2/module/nodes.csv
| Column | Type | Description |
|---|---|---|
| module | str | Dotted module name (e.g., Mathlib.Algebra.Group.Defs) |
| decl_count | int | Declarations defined in this source file |
v2/module/edges.csv
| Column | Type | Description |
|---|---|---|
| source | str | Importing module |
| target | str | Imported module |
| is_exported | bool | Whether this is a public import (20,699 of 20,881) |
v2/module/metrics.csv
| Column | Type | Description |
|---|---|---|
| module | str | Module name |
| decl_count | int | Declarations in this module (full decl_module mapping, 499K coverage) |
| in_degree | int | Modules that import this one |
| out_degree | int | Modules this one imports |
| pagerank | float | PageRank on module import graph |
| betweenness | float | Betweenness centrality (exact) |
| dag_layer | int | Topological depth in module DAG |
| community_id | int | Louvain community |
| cohesion | float | Fraction of declaration edges staying within module |
| import_utilization_median | float | Median fraction of imported declarations used |
v2/namespace/nodes.csv
| Column | Type | Description |
|---|---|---|
| namespace | str | Depth-2 namespace (e.g., Mathlib.Algebra) |
| decl_count | int | Declarations in this namespace |
| in_cycle | bool | True if this namespace is in a strongly connected component |
| scc_id | int | SCC identifier (-1 if not in a cycle) |
v2/namespace/edges.csv
| Column | Type | Description |
|---|---|---|
| source | str | Source namespace |
| target | str | Target namespace |
| weight | int | Number of declaration-level edges between these namespaces |
v2/namespace/metrics.csv
| Column | Type | Description |
|---|---|---|
| namespace | str | Depth-2 namespace |
| decl_count | int | Declarations in this namespace |
| in_degree | int | Unweighted in-degree |
| out_degree | int | Unweighted out-degree |
| edge_weight_sum | int | Total declaration edges involving this namespace |
| pagerank | float | Weighted PageRank (alpha=0.85) |
| betweenness | float | Weighted betweenness (k=300, seed=42) |
| community_id | int | Louvain community (weighted undirected) |
| cross_ns_ratio | float | Fraction of edges crossing namespace boundaries |
| in_cycle | bool | In a strongly connected component (6,055 of 10,097) |
| scc_id | int | SCC identifier (-1 if acyclic) |
Methodology
- Extraction: lean4export (nodes) + lean-training-data (edges) + importGraph (module graph) + jixia (metadata)
- Deduplication: by name, 317,655 to 308,129 rows (9,526
@[to_additive]mirrors) - Self-loops: 4,755 constructor self-references filtered
- PageRank: alpha=0.85, max_iter=100, tol=1e-6
- Betweenness: declaration k=500, namespace k=300, module exact; seed=42
- Communities: Louvain, resolution=1.0, random_state=42, undirected projection
- DAG layers: Kahn's algorithm; cycle nodes get layer=-1; namespace graph condensed via SCC
- Namespace cycles: 6,055 of 10,097 namespaces in 38 SCCs (largest: 5,899 nodes)
Hold-Out Experiments
We validate the premise retrieval results with two levels of hold-out experiments to assess information leakage. In the original experiment, all network features (degree, PageRank, betweenness, community, DAG layer) are precomputed on the full graph. Hold-out experiments recompute features on a reduced graph to test whether full-graph computation inflates AUC.
Edge-level hold-out
- Randomly remove 20% of edges, recompute all features on remaining 80% graph
- Tests whether full-graph feature computation inflates AUC
Declaration-level hold-out
- Split theorems 80/20, remove ALL edges (incoming and outgoing) of test theorems from training graph
- Test theorems have zero degree in training graph
- Simulates the real scenario: predicting premises for a brand new theorem
Results (Split 1, seed=42)
| Method | AUC (original) | AUC (edge hold-out) | AUC (decl hold-out) |
|---|---|---|---|
| Random | 0.499 | 0.497 | 0.500 |
| Same module | 0.563 | 0.562 | 0.563 |
| Same namespace | 0.590 | 0.590 | 0.592 |
| Same community | 0.768 | 0.755 | 0.500 |
| Network features | 0.991 | 0.988 | 0.978 |
| All features | 0.994 | 0.992 | 0.984 |
The community feature drops to random (0.500) in declaration-level hold-out because test declarations become isolated nodes with unique community IDs. Despite this, the combined network feature model retains AUC=0.978, confirming that degree, PageRank, and DAG position carry genuine predictive signal independent of information leakage.
Full 5-split results with mean and std are in experiments/holdout_decl_level.json (updated incrementally).
Experiment Files
| File | Description |
|---|---|
experiments/premise_retrieval_results.json |
Original experiment: 6 methods, 4 metrics, 95% CI |
experiments/premise_retrieval_hard_negatives.json |
Hard negatives (same-community) variant |
experiments/holdout_edge_level.json |
Edge-level hold-out (1 split) |
experiments/holdout_decl_level.json |
Declaration-level hold-out (5 splits, incremental) |
License
Apache 2.0
- Downloads last month
- 60