Renaissance Labs · Mathematics
11Number theory

Divisibility, congruences and parity

modular-arithmetic

Prove facts about residues, divisibility, congruences and coprimality for natural numbers and integers, by case analysis on residues.

What the agent does

The agent gets a working directory with a Lean file, Solution.lean, and a problem in words. It edits the file until it compiles and is correct. Tasks are generated from a seed and a difficulty from 1 to 3, so the supply is unlimited and every task is new.

An example task

Instruction, as the agent sees it

Prove a fact about divisibility and residues

Prove that for every integer nn, the number 22 divides 13n5−9n13n^5 - 9n.

What to do

Solution.lean in the working directory states the theorem in Lean 4 with Mathlib, with sorry in place of the proof. Replace every sorry with a proof.

  • Do not change the statement of any theorem or any definition the file gives you. You may add your own lemmas and definitions.
  • Check your work with lake env lean Solution.lean (run it inside /opt/arena/lean, giving the full path to the file). It must compile without errors.
  • A theorem counts only if its proof is complete: no sorry, no new axioms, no native_decide.
  • The reward is 1 if the theorem is proved and 0 otherwise.
Solution.leanthe file the agent starts from
import Mathlib

/-- The integer divides the polynomial value. -/
theorem dvd_poly (n : ℤ) :
    (2 : ℤ) ∣ 13 * n ^ 5 - 9 * n := by
  sorry
Show a reference solution
import Mathlib

/-- The integer divides the polynomial value. -/
theorem dvd_poly (n : ℤ) :
    (2 : ℤ) ∣ 13 * n ^ 5 - 9 * n := by
  have h : ((13 * n ^ 5 - 9 * n : ℤ) : ZMod 2) = 0 := by
    push_cast
    generalize (n : ZMod 2) = x
    revert x
    decide +kernel
  exact (ZMod.intCast_zmod_eq_zero_iff_dvd _ _).1 h

Reference solutions are never shown to the agent. They are compiled in the environment's self-test, so every task has at least one proof that passes.

The families

Each task belongs to one family: a different piece of the area's work.

congruence chain
theorem congr_poly2 (x y : ℤ) (hx : x ≡ 1 [ZMOD 10]) (hy : y ≡ 2 [ZMOD 10]) :
    7 * (x * y) + 2 * y ^ 2 + 3 * x ≡ 5 [ZMOD 10]
divisibility
theorem dvd_poly (n : ℤ) :
    (30 : ℤ) ∣ 7 * n ^ 5 + 53 * n
gcd coprime
theorem coprime_nat (n : ℕ) :
    Nat.Coprime (7 * n + 6) (n + 1)
power residues
theorem residues_of_power (n : ℕ) :
    (7 * n ^ 3 + 7) % 13 = 0 ∨ (7 * n ^ 3 + 7) % 13 = 1 ∨ (7 * n ^ 3 + 7) % 13 = 3 ∨ (7 * n ^ 3 + 7) % 13 = 7 ∨ (7 * n ^ 3 + 7) % 13 = 11

Reward

Range
0 to 1
Checked by
Lean kernel
Deterministic
yes

Every theorem must be stated exactly as given and proved: no sorry, no new axioms, no native_decide. The reward is the share of theorems that pass. A file that does not compile scores 0. The submission is also re-checked by a second kernel run. Read how checking works.

How to run it

1. Set up the Lean projectLean 4.29.1 with Mathlib 5e932f97dd
git clone https://github.com/RenaissanceLabs-EU/lean-arena && cd lean-arena
cd lean && lake exe cache get
2. Generate a taskseed and difficulty pick the task
python3 tools/make_task.py modular_arithmetic --seed 7 --difficulty 2 --out /tmp/task
3. Grade a solutionprints the reward
python3 arena/grade.py --spec /tmp/task/spec.json --solution /tmp/task/Solution.lean

Tasks are also exported as Harbor task folders (instruction.md, task.toml, tests/), the format used by several RL frameworks, with the image built from the Lean project.

How hard is it?

A floor, not a ceiling: how many sampled tasks a single automation call can close with no thought at all. Each theorem was given the tactic first | grind | aesop | simp | omega | norm_num | nlinarith | decide. A task counts as closed only if every theorem in it is. Overall 0 of 24. The rest need a real proof.

Difficulty 1
0 of 8
Difficulty 2
0 of 8
Difficulty 3
0 of 8

Sample: 8 seeds at each difficulty. No model has been run on these tasks yet, so how hard they are for a model is not yet measured.

Good for

  • case analysis on residues
  • Int.ModEq and Nat.ModEq
  • ZMod and decide
  • coprimality and gcd