Download AUTHORING.md from RenaissanceLabsEU/math: direct link, hf CLI and curl.
- Browser
- Download file 4.48 kB
-
https://huggingface.co/datasets/RenaissanceLabsEU/math/resolve/main/AUTHORING.md
- Command line
-
hf download hf://datasets/RenaissanceLabsEU/math/AUTHORING.md
-
curl -L -o AUTHORING.md https://huggingface.co/datasets/RenaissanceLabsEU/math/resolve/main/AUTHORING.md
Authoring a Lean environment
An environment is a generator of Lean tasks in one area of mathematics (an MSC2020 area). Each task gives an agent a Solution.lean containing statements with sorry; the agent replaces the sorrys; a hidden grader (arena/grade.py + lean/verifier/Verify.lean) gives a reward in [0, 1]. Read envs/finite_sums/ (kind prove) and envs/definitions/ (kind define) first and copy their shape. arena/core.py is the task model.
Files in envs/<folder>/ (folder name uses underscores)
__init__.py(empty),env.toml(keys as in the two examples:namekebab-case,title,msctwo-digit area,kind,summaryone sentence at most 160 characters,skilla short phrase,good_forlist,familieslist).gen.py:generate(seed, difficulty, family=None) -> arena.core.Task;FAMILIESlist; default familysorted(FAMILIES)[seed % len(FAMILIES)]; difficulty 1, 2 or 3; randomness only fromrng_for(ENV + "/" + family, seed, difficulty). Python 3.9, standard library only. 3 to 5 families per environment.
Rules
- Every statement must be true and the reference proof must compile. The reference proofs are real Lean proofs in
Theorem.proof(or reference definitions inTask.solution). Never ship a family whose proof is only checked for some seeds: the self-test compiles 30 tasks per run; run it with several sizes. - Two code paths for anything numeric. If a statement depends on computed values (a constant, a bound, a count), compute them in Python and assert them against an independent Python check before returning, as
finite_sumsdoes with exact fractions. - Exact statements, no vacuity. No hypotheses that are contradictory, no statements trivially true by
rfl/simp/decideat difficulty 2 and 3 (difficulty 1 may need one real idea). Avoid statements a singleomega,norm_num,simpordecidecall closes in every family: each family should need a genuine proof idea at difficulty 2 and above (induction, case analysis, a Mathlib lemma search, a construction). Check by tryingby decide,by simp,by omega,by norm_num,by aesop,by nlinarithyourself on a sample and reporting which tasks fall to one-liners, then redesign those. - The instruction states the problem in words (
informal, Markdown with maths in\( \)and\[ \]). Give each theorem a one-lineinformaldoc comment. The statement is also inSolution.lean. - Variety. Parameters vary enough that at least 90 percent of tasks differ across 10 seeds per difficulty (the self-test checks this). Difficulty 1: one idea. 2: two ideas or a longer proof. 3: a multi-step argument or a cross-lemma combination. Multi-theorem tasks (a lemma plus a main theorem that uses it) are welcome; use
weightto weight the main theorem. - Mathlib names: this project is on Lean 4.29.1 with the Mathlib in
lean/.lake/packages/mathlib. Usegrep -rnthere to confirm names before using them.∑ i ∈ s, f iis current syntax. Hidden state: do not leak reference proofs into the instruction or start file. - Prefer
provetasks. Adefinetask is good only when the hiddennative_decidetest makes a meaningful check; followenvs/definitions/. - American English, short plain sentences, no em dashes, no emoji.
Self-test
ARENA_SLOTS=3 python3 tools/selftest.py <folder> 10 --e2e 2
It checks determinism, 90 percent distinct tasks, that every reference solution compiles (batched in one Lean run), and that the real grader gives the reference solution 1.0 and the untouched start file 0.0. It must print 0 failures. ARENA_SLOTS=3 is mandatory: it caps concurrent Lean processes machine-wide so memory is not exhausted. Never run more than one selftest at once yourself, never run lake build, lake update or anything that rebuilds Mathlib, and do not edit anything under lean/ or arena/. A compile of the batch takes a few minutes; use timeout of 600000 ms and run it in the background if needed.
Also write tests/test_<folder>.py (plain asserts): for each family, at least two hand-derived facts about the generator (for example the exact statement produced for a fixed seed, or a Python-side value worked by hand) so a regression in the generator is caught.
Report
Report only: families, which Mathlib lemmas the proofs rely on, anything you were unsure about, the one-liner findings from rule 3, and the self-test output lines.