Xinze-Li-Moqian commited on
Commit
9bd7529
·
verified ·
1 Parent(s): b905a79

Fix statistics: verified row counts and kind breakdown

Browse files
Files changed (1) hide show
  1. README.md +34 -23
README.md CHANGED
@@ -16,39 +16,50 @@ size_categories:
16
 
17
  # MathlibGraph: Mathlib Dependency Graph Dataset
18
 
19
- Dependency graph of [Mathlib](https://github.com/leanprover-community/mathlib4) (v4.28.0-rc1), the largest formal mathematics library for Lean 4.
 
 
20
 
21
  ## Files
22
 
23
- | File | Rows | Description |
24
- |------|------|-------------|
25
- | `mathlib_nodes.csv` | 347,356 | Mathlib declarations (name, kind, module) |
26
- | `mathlib_edges.csv` | 10,417,589 | Mathlib dependencies (source, target, is_explicit) |
27
- | `nodes.csv` | 633,364 | Full environment (Lean + Std + Mathlib) |
28
- | `edges.csv` | 10,889,011 | Full environment edges |
 
 
29
 
30
- ## Statistics (Mathlib only)
31
 
32
  | Kind | Count | % |
33
  |------|-------|---|
34
- | theorem | 273,767 | 78.8% |
35
- | definition | 55,671 | 16.0% |
36
- | abbrev | 7,490 | 2.2% |
37
- | constructor | 5,436 | 1.6% |
38
- | inductive | 4,297 | 1.2% |
39
- | other | 695 | 0.2% |
 
 
40
 
41
  ## Quick Start
42
 
43
  ```python
44
- from huggingface_hub import hf_hub_download
45
  import pandas as pd
46
 
47
- nodes = pd.read_csv(hf_hub_download("Xinze-Li-Moqian/MathlibGraph", "mathlib_nodes.csv", repo_type="dataset"))
48
- edges = pd.read_csv(hf_hub_download("Xinze-Li-Moqian/MathlibGraph", "mathlib_edges.csv", repo_type="dataset"))
 
 
 
 
 
49
 
50
- print(f"Nodes: {len(nodes)}, Edges: {len(edges)}")
51
- # Output: Nodes: 347356, Edges: 10417589
52
  ```
53
 
54
  ## Extraction Pipeline
@@ -63,16 +74,16 @@ print(f"Nodes: {len(nodes)}, Edges: {len(edges)}")
63
 
64
  | Column | Type | Description |
65
  |--------|------|-------------|
66
- | name | string | Declaration name (e.g., `CategoryTheory.Functor.comp_id`) |
67
- | kind | string | `theorem`, `definition`, `abbrev`, `inductive`, `constructor`, etc. |
68
- | module | string | Lean namespace (e.g., `CategoryTheory.Functor`) |
69
 
70
  ### mathlib_edges.csv
71
 
72
  | Column | Type | Description |
73
  |--------|------|-------------|
74
  | source | string | Dependent declaration |
75
- | target | string | Dependency |
76
  | is_explicit | bool | Appears in explicit arguments |
77
  | is_simplifier | bool | Used by simplifier |
78
 
 
16
 
17
  # MathlibGraph: Mathlib Dependency Graph Dataset
18
 
19
+ Dependency graph of [Mathlib](https://github.com/leanprover-community/mathlib4) (commit [`534cf0b`](https://github.com/leanprover-community/mathlib4/commit/534cf0b), 2 Feb 2026), the largest formal mathematics library for Lean 4.
20
+
21
+ Companion dataset for the paper: *Formalization Encodes Human Organization: A Network Analysis of Mathlib* ([arXiv:2601.22554](https://arxiv.org/abs/2601.22554)).
22
 
23
  ## Files
24
 
25
+ | File | Rows | Unique entries | Description |
26
+ |------|------|----------------|-------------|
27
+ | `mathlib_nodes.csv` | 317,655 | 308,129 declarations | Mathlib declarations (name, kind, module) |
28
+ | `mathlib_edges.csv` | 8,436,366 | 8,436,366 edges | Mathlib dependencies (source, target, is_explicit) |
29
+ | `nodes.csv` | 633,364 | — | Full environment (Lean + Std + Mathlib) |
30
+ | `edges.csv` | 10,889,011 | — | Full environment edges |
31
+
32
+ > **Note:** `mathlib_nodes.csv` contains 9,526 duplicate name rows produced by `@[to_additive]` mirroring. After deduplication, there are **308,129 unique declarations** — the figure used throughout the paper.
33
 
34
+ ## Statistics (308,129 unique Mathlib declarations)
35
 
36
  | Kind | Count | % |
37
  |------|-------|---|
38
+ | theorem | 243,725 | 79.1% |
39
+ | definition | 48,664 | 15.8% |
40
+ | abbrev | 6,667 | 2.2% |
41
+ | constructor | 4,755 | 1.5% |
42
+ | inductive | 3,813 | 1.2% |
43
+ | opaque | 499 | 0.2% |
44
+ | quotient | 3 | <0.1% |
45
+ | axiom | 3 | <0.1% |
46
 
47
  ## Quick Start
48
 
49
  ```python
50
+ from datasets import load_dataset
51
  import pandas as pd
52
 
53
+ nodes = load_dataset("Xinze-Li-Moqian/MathlibGraph",
54
+ data_files="mathlib_nodes.csv", split="train").to_pandas()
55
+ edges = load_dataset("Xinze-Li-Moqian/MathlibGraph",
56
+ data_files="mathlib_edges.csv", split="train").to_pandas()
57
+
58
+ # Deduplicate nodes (9,526 @[to_additive] mirrors)
59
+ nodes = nodes.drop_duplicates(subset="name", keep="first")
60
 
61
+ print(f"Declarations: {len(nodes):,}, Edges: {len(edges):,}")
62
+ # Output: Declarations: 308,129, Edges: 8,436,366
63
  ```
64
 
65
  ## Extraction Pipeline
 
74
 
75
  | Column | Type | Description |
76
  |--------|------|-------------|
77
+ | name | string | Fully qualified declaration name (e.g., `CategoryTheory.Functor.comp_id`) |
78
+ | kind | string | `theorem`, `definition`, `abbrev`, `inductive`, `constructor`, `opaque`, `axiom`, `quotient` |
79
+ | module | string | Lean module (e.g., `CategoryTheory.Functor`) |
80
 
81
  ### mathlib_edges.csv
82
 
83
  | Column | Type | Description |
84
  |--------|------|-------------|
85
  | source | string | Dependent declaration |
86
+ | target | string | Dependency (premise) |
87
  | is_explicit | bool | Appears in explicit arguments |
88
  | is_simplifier | bool | Used by simplifier |
89