File size: 9,040 Bytes
e6424e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
---
pretty_name: Lean Arena
license: cc-by-4.0
language:
- en
task_categories:
- other
tags:
- rl-environment
- harbor
- lean4
- mathlib
- formal-mathematics
- theorem-proving
- verifiable-rewards
- msc2020
size_categories:
- n<1K
thumbnail: https://huggingface.co/datasets/RenaissanceLabsEU/math/resolve/main/assets/social-preview.jpg
configs:
- config_name: combinatorial-identities
  data_files:
  - split: train
    path: data/combinatorial-identities/train.jsonl
  - split: eval
    path: data/combinatorial-identities/eval.jsonl
- config_name: definitions
  data_files:
  - split: train
    path: data/definitions/train.jsonl
  - split: eval
    path: data/definitions/eval.jsonl
- config_name: finite-sums
  data_files:
  - split: train
    path: data/finite-sums/train.jsonl
  - split: eval
    path: data/finite-sums/eval.jsonl
- config_name: group-theory
  data_files:
  - split: train
    path: data/group-theory/train.jsonl
  - split: eval
    path: data/group-theory/eval.jsonl
- config_name: inequalities
  data_files:
  - split: train
    path: data/inequalities/train.jsonl
  - split: eval
    path: data/inequalities/eval.jsonl
- config_name: linear-algebra
  data_files:
  - split: train
    path: data/linear-algebra/train.jsonl
  - split: eval
    path: data/linear-algebra/eval.jsonl
- config_name: logic-and-sets
  data_files:
  - split: train
    path: data/logic-and-sets/train.jsonl
  - split: eval
    path: data/logic-and-sets/eval.jsonl
- config_name: modular-arithmetic
  data_files:
  - split: train
    path: data/modular-arithmetic/train.jsonl
  - split: eval
    path: data/modular-arithmetic/eval.jsonl
- config_name: real-analysis
  data_files:
  - split: train
    path: data/real-analysis/train.jsonl
  - split: eval
    path: data/real-analysis/eval.jsonl
---

# Lean Arena: mathematics environments with a kernel-checked reward

![Lean Arena by Renaissance Labs: mathematics environments for models that prove theorems in Lean.](assets/social-preview.jpg)

**972 tasks in 9 environments in which a model proves a theorem, or writes a definition, in Lean 4 with Mathlib.** By [Renaissance Labs](https://renaissancelabs.eu). The map of all 63 areas of mathematics, with how much of each Mathlib already formalizes, is at [math.renaissancelabs.eu](https://math.renaissancelabs.eu); source code at [RenaissanceLabs-EU/lean-arena](https://github.com/RenaissanceLabs-EU/lean-arena).

The agent gets a folder with `Solution.lean` (a theorem ending in `sorry`, or a definition to write) and an instruction, and edits the file. A hidden verifier returns a reward of 1 if the Lean kernel accepts the result, and 0 otherwise. There is no model grader and no partial credit for text that merely looks like a proof.

## Environments

Each environment is a subset (`load_dataset("RenaissanceLabsEU/math", "<name>")` loads its task index).

| Subset | Area | Kind | What the agent does | Task families |
|---|---|---|---|---|
| [`combinatorial-identities`](tasks/combinatorial-identities) | MSC 05 | prove | Prove binomial sums, Fibonacci identities, closed forms of linear recurrences, and counting arguments with injections and pigeonholes. | binomial_sums, counting, fibonacci, linear_recurrence |
| [`definitions`](tasks/definitions) | MSC 11 | define | Turn a number-theoretic definition written in words into a computable Lean function that agrees with it on hidden inputs. | count, divisors, extremum, pairs, sequence, sum |
| [`finite-sums`](tasks/finite-sums) | MSC 40 | prove | Prove a closed form for a finite sum: polynomial, geometric or telescoping, by induction on the number of terms. | geometric, polynomial, telescoping |
| [`group-theory`](tasks/group-theory) | MSC 20 | prove | Prove facts about abstract groups: commutativity from exponent laws, inverses, subgroup membership and Lagrange, homomorphism kernels. | hom, inverse, involution, subgroup |
| [`inequalities`](tasks/inequalities) | MSC 26 | prove | Prove real inequalities: AM-GM, Cauchy-Schwarz, absolute values and monotone functions, with hints, case splits and lemma reuse. | abs_ineq, amgm, cauchy, monotone |
| [`linear-algebra`](tasks/linear-algebra) | MSC 15 | prove | Prove facts about 2x2 matrices, matrix powers, linear independence of explicit vectors, and kernels, ranges and projections of linear maps. | det_trace, independence, linear_map, matrix_pow |
| [`logic-and-sets`](tasks/logic-and-sets) | MSC 03 | prove | Prove set identities and image statements, Finset cardinality facts and equivalence relations. | finset_card, relations, set_identities |
| [`modular-arithmetic`](tasks/modular-arithmetic) | MSC 11 | prove | Prove facts about residues, divisibility, congruences and coprimality for natural numbers and integers, by case analysis on residues. | congruence_chain, divisibility, gcd_coprime, power_residues |
| [`real-analysis`](tasks/real-analysis) | MSC 26 | prove | Prove limits of explicit sequences, epsilon-delta continuity, bounds on recursive sequences and uniform bounds, from the definitions. | continuity, limit_sequence, sequence_bounds, uniform_bounds |

Every subset has a `train` split (84 tasks) and an `eval` split (24 tasks). Each has three difficulty levels.

## How a task is checked

`tests/grade.py` compiles the submission, re-checks it with `leanchecker`, then runs `Verify.lean`, which loads the hidden reference and the submission into separate environments and compares kernel terms. It requires that the task's own definitions are unchanged, that each target has exactly the reference statement, and that the proof depends only on `propext`, `Classical.choice` and `Quot.sound`. `sorry`, `native_decide`, new axioms, a changed definition and a weakened statement are all rejected; `tools/verifier_cheats.py` tests these.

## Layout

```
tasks/<env>/<task_id>/     one Harbor task directory per task
  instruction.md           what the agent is asked to do
  task.toml                metadata and limits (2 CPUs, 6 GB, no internet)
  environment/             Dockerfile and workdir/Solution.lean, copied to /app
  solution/                the reference solution, never shown to the agent
  tests/                   test.sh, grade.py, Verify.lean, spec.json: the hidden verifier
data/<env>/{train,eval}.jsonl   the task index shown in the viewer, with the instruction and the start file
envs/<env>/                the seeded generator (gen.py) and env.toml; the contract is in AUTHORING.md
arena/  lean/  docker/  tools/  tests/   the task model, grader, Lean project, image, and checks
reference/                 Mathlib coverage per area and the one-tactic baseline numbers
```

Lean 4.29.1 with Mathlib at commit `5e932f97dd25535344f80f9dd8da3aab83df0fe6`. The image in `docker/Dockerfile` builds Lean, the Mathlib cache and the grader (about 15 GB).

## What we measured, and what we did not

- Every reference solution compiles and passes the grader in a batched Lean run (`tools/selftest.py`).
- The Docker path was run end to end on one held-out task per environment (9 tasks, no network): the reference solution got reward 1.0 and the untouched start file 0.0. A grade takes about 2.5 minutes in a container, mostly importing Mathlib several times.
- **One-tactic floor.** A single automation tactic (`first | grind | aesop | simp | omega | norm_num | nlinarith | decide`) closes 15 of 192 sampled proving tasks (difficulty 1 / 2 / 3 per environment below). That is a floor for how much of the set needs no real proof, not a model score.

| Environment | Closed by one tactic (d1 / d2 / d3, of 8 each) |
|---|---|
| `combinatorial-identities` | 0 of 8 / 0 of 8 / 0 of 8 |
| `finite-sums` | 0 of 8 / 0 of 8 / 0 of 8 |
| `group-theory` | 2 of 8 / 1 of 8 / 0 of 8 |
| `inequalities` | 2 of 8 / 0 of 8 / 2 of 8 |
| `linear-algebra` | 3 of 8 / 0 of 8 / 0 of 8 |
| `logic-and-sets` | 2 of 8 / 2 of 8 / 1 of 8 |
| `modular-arithmetic` | 0 of 8 / 0 of 8 / 0 of 8 |
| `real-analysis` | 0 of 8 / 0 of 8 / 0 of 8 |

## Limits

- **No model baseline yet.** We have not published how any language model scores on these tasks.
- **The eval split is in distribution.** Train and eval come from the same generators with different seeds. A model that learns the templates will do well on both. It measures practice on these families, not general theorem proving.
- **Some easy tasks fall to one tactic** (see the table), and `definitions` tasks are checked for type and unchanged given definitions, with the solver's own value allowed.
- The tasks are synthetic and templated. The area pages of the website (descriptions, landmark theorems, open problems, figure captions) were written with AI help and have not been reviewed by a research mathematician.
- Mathlib coverage per area is a count of `theorem` and `lemma` declarations mapped by hand from Mathlib directories to MSC areas. It is a size proxy, not a measure of how much of an area is formalized.

## Licenses

Code MIT, data and content CC BY 4.0 (see `LICENSE`). Mathlib and Lean are Apache 2.0 and are not redistributed here.