Renaissance Labs · Mathematics
26Real functions

Real analysis with epsilon and delta

real-analysis

Prove limits of explicit sequences, epsilon-delta continuity, bounds on recursive sequences and uniform bounds, from the definitions.

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 limit from the definition

Prove, directly from the definition of a limit, that the sequence un=7n+8u_n = \dfrac{7}{n + 8} tends to 00: for every ε>0\varepsilon > 0 there is NN such that ∣un−0∣<ε|u_n - 0| < \varepsilon for all n≥Nn \ge N.

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 sequence tends to 0 (epsilon-N definition). -/
theorem seq_limit :
    ∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, |(7 : ℝ) / ((n : ℝ) + (8 : ℝ)) - 0| < ε := by
  sorry
Show a reference solution
import Mathlib

/-- The sequence tends to 0 (epsilon-N definition). -/
theorem seq_limit :
    ∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, |(7 : ℝ) / ((n : ℝ) + (8 : ℝ)) - 0| < ε := by
  intro ε hε
  refine ⟨⌈(7 : ℝ) / ε⌉₊, fun n hn => ?_⟩
  have h1 : (7 : ℝ) / ε ≤ (n : ℝ) := (Nat.le_ceil _).trans (by exact_mod_cast hn)
  have h2 : (7 : ℝ) ≤ (n : ℝ) * ε := (div_le_iff₀ hε).mp h1
  have hpos : (0 : ℝ) < (n : ℝ) + (8 : ℝ) := by positivity
  rw [sub_zero, abs_of_pos (by positivity), div_lt_iff₀ hpos]
  nlinarith [mul_pos hε (by norm_num : (0 : ℝ) < (8 : ℝ))]

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.

continuity
theorem continuous_at :
    ∀ ε > 0, ∃ δ > 0, ∀ x : ℝ, |x - (-1 : ℝ)| < δ → |((-5 : ℝ) * x ^ 2 + (2 : ℝ)) - ((-5 : ℝ) * (-1 : ℝ) ^ 2 + (2 : ℝ))| < ε
limit sequence
theorem seq_limit :
    ∀ ε > 0, ∃ N : ℕ, ∀ n ≥ N, |((-4 : ℝ) * (n : ℝ) + (9 : ℝ)) / ((5 : ℝ) * (n : ℝ) + (2 : ℝ)) - (-4 : ℝ) / (5 : ℝ)| < ε
sequence bounds
theorem a_bounds :
    ∀ n : ℕ, 0 ≤ a n ∧ a n ≤ (2 : ℝ)
uniform bounds
theorem uniform_bound :
    ∀ n : ℕ, ∀ x ∈ Set.Icc (0 : ℝ) (4 / 5 : ℝ), ∑ i ∈ Finset.range n, x ^ i ≤ 1 / (1 - (4 / 5 : ℝ))

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 real_analysis --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

  • choosing N and delta
  • abs and inequality estimates
  • induction on recursive sequences
  • geometric sums