File size: 3,282 Bytes
fc5b022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498ee78
fc5b022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ee5a056
 
0607f7e
fc5b022
 
 
 
 
ee5a056
fc5b022
 
 
 
 
498ee78
f17915e
498ee78
 
fc5b022
 
 
 
 
498ee78
 
 
 
 
98ba525
498ee78
5f8721e
498ee78
 
98ba525
 
1400e34
fc5b022
 
 
ee5a056
98ba525
ee5a056
 
fc5b022
 
 
 
f9ba8b1
fc5b022
 
 
ee5a056
 
 
fc5b022
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---

license: apache-2.0
task_categories:
  - text-generation
  - feature-extraction
language:
  - en
tags:
  - theorem-proving
  - formal-methods
  - lean4
  - mathlib
  - mathematics
size_categories:
  - 100K<n<1M
dataset_info:
  features:
  - {name: statement, dtype: string}
  - {name: proof, dtype: string}
  - {name: type, dtype: string}
  - {name: symbolic_name, dtype: string}
  - {name: library, dtype: string}
  - {name: filename, dtype: string}
  - {name: imports, list: string}
  - {name: deps, list: string}
  - {name: docstring, dtype: string}
  - {name: source_url, dtype: string}
  - {name: commit, dtype: string}
  splits:
  - {name: train, num_examples: 232431}
  config_name: default
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
---


# Lean4-Mathlib

Structured dataset of mathematical formalizations from the Mathlib4 library for Lean 4.

## Source

- Repository: https://github.com/leanprover-community/mathlib4
- Commit: `b9f14353520df73472ae3825fb53f86559a01319`
- Files: 8170
- License: apache-2.0

## Schema

| Column | Type | Description |
|--------|------|-------------|
| statement | string | Declaration signature/claim with the leading keyword removed (verbatim slice); the full declaration minus its proof |
| proof | string | Verbatim proof/body, empty if the declaration has none |
| type | string | Declaration keyword |
| symbolic_name | string | Declaration identifier |

| library | string | Sub-library |

| filename | string | Repository-relative source path |

| imports | list[string] | File-level `Require`/`Import` modules |

| deps | list[string] | Intra-corpus identifiers referenced |

| docstring | string | Preceding documentation comment, empty if absent |

| source_url | string | Upstream repository |
| commit | string | Upstream commit extracted |

## Statistics

- Entries: 232,431
- With proof: 228,818 (98.4%)
- With docstring: 67,814 (29.2%)
- Libraries: 1103

### By type

| Type | Count |
|---|---|
| theorem | 125,463 |
| lemma | 56,488 |
| def | 31,961 |
| instance | 10,971 |
| abbrev | 3,379 |
| class | 1,937 |
| structure | 1,580 |
| inductive | 326 |
| elab | 168 |
| macro | 147 |
| class inductive | 6 |
| class abbrev | 3 |
| opaque | 2 |

## Example

```

infinite_of_charZero (R A : Type*) [CommRing R] [Ring A] [Algebra R A]

    [CharZero A] : { x : A | IsAlgebraic R x }.Infinite

by

  letI := MulActionWithZero.nontrivial R A

  exact infinite_of_injective_forall_mem Nat.cast_injective isAlgebraic_nat

```

- type: theorem | symbolic_name: `Algebraic.infinite_of_charZero` | Mathlib/Algebra/AlgebraicCard.lean



## Use



Each declaration is split into a `statement` (signature/claim) and a `proof` (body) that are disjoint

and together form the complete declaration, for proof modeling, autoformalization, retrieval, and

dependency analysis via `deps`.



## Citation



```bibtex

@misc{lean4_mathlib_dataset,

  title  = {Lean4-Mathlib},

  author = {Norton, Charles},

  year   = {2026},

  note   = {Extracted from https://github.com/leanprover-community/mathlib4, commit b9f14353520d},

  url    = {https://huggingface.co/datasets/phanerozoic/Lean4-Mathlib}

}

```