Xinze-Li-Moqian commited on
Commit
8d22f23
·
verified ·
1 Parent(s): 6c4c3c6

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +85 -3
README.md CHANGED
@@ -1,3 +1,85 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ task_categories:
4
+ - graph-ml
5
+ language:
6
+ - en
7
+ tags:
8
+ - mathematics
9
+ - lean4
10
+ - mathlib
11
+ - dependency-graph
12
+ - formal-verification
13
+ size_categories:
14
+ - 100K<n<1M
15
+ ---
16
+
17
+ # MathFactor: 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/mathfactor", "mathlib_nodes.csv", repo_type="dataset"))
48
+ edges = pd.read_csv(hf_hub_download("Xinze-Li-Moqian/mathfactor", "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
55
+
56
+ - **Nodes**: [lean4export](https://github.com/leanprover/lean4export) (official leanprover tool)
57
+ - **Edges**: [lean-training-data premises](https://github.com/kim-em/lean-training-data) (Kim Morrison, Mathlib maintainer)
58
+ - **Filtering**: premises whitelist method — `lake exe premises Mathlib` outputs only Mathlib declarations, which we use to filter the full lean4export output
59
+
60
+ ## Schema
61
+
62
+ ### mathlib_nodes.csv
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
+
79
+ ## Citation
80
+
81
+ Part of the [MathFactor](https://github.com/Xinze-Li-Moqian/MathFactor) project — network science analysis of mathematical knowledge.
82
+
83
+ ## License
84
+
85
+ Apache 2.0