Skip to content

Lean example: lean-eval problems checked by lake comparator - #54

Merged
mtrager merged 3 commits into
mainfrom
lean-example
Nov 30, 2026
Merged

mtrager merged 3 commits into
mainfrom
lean-example

Conversation

@mtrager

@mtrager mtrager commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator

Adds examples/lean/: an AutoHelix setup for proving lean-eval problems, checked by lake comparator.

  • setup.py LEAN_EVAL_CHECKOUT PROBLEM_ID --dir DIR makes a project from lean-eval's generated/<id>/ (Mathlib-only problems with theorem holes; refuses a checkout not on Lean v4.36.0). Nothing of lean-eval is vendored.
  • template/check.py is the gate (builds, statements unchanged, permitted axioms, sorry allowed), the strict observe check (proved, sorry_decls, errors, builds, lines) and the stop command. It builds the submission in a fresh project next to trusted copies of the fixed files; build output is escaped and never sets metrics.
  • tests/check_cases.py: ten cheating cases (edited Solution.lean, spoofed metric lines, a new axiom, native_decide, a weakened statement, notation that redefines a term, ...) on two fixture problems. Needs Lean, about 20 minutes, run by hand: all ten pass on Linux with Lean v4.36.0, and spoof fails when the escaping is removed.
  • The README lists what the check enforces and what it doesn't (the agent's session runs as the user and can change Mathlib, the toolchain or the stored check.py; for a benchmark, make them read-only and re-check proofs), and a short results paragraph: 16 of 20 lean-eval problems proved with Opus 5.5, each re-checked with comparator in paranoid mode.
  • Links from the root README's "finish a Lean proof" and examples/README.md; tests/test_examples.py covers setup (with a faked lake) and the toolchain refusal.

…y lake comparator

setup.py scaffolds a bundled problem (problems/) or a lean-eval problem (--lean-eval DIR ID)
in lean-eval's workspace layout: the agent writes Submission.lean and Submission/; the trusted
Challenge.lean, ChallengeDeps.lean, Solution.lean and config.json live in autohelix/NAME/ with
check.py (gate: lake comparator with sorry allowed; observe: the strict check and metrics;
stop: proved = 1). goal-text.py derives the /goal arm's text from the config.
examples/lean/README.md: what the check enforces (and doesn't), the loop, setup.
tests/check_cases.py runs check.py's gate and strict check on ten known submissions
(tests/cases/, expectations in tests/cases.json; the complete-proof case uses a small
test statement in tests/fixture/, not the bundled problem's solution). goal-text.py
(the /goal comparison's prompt) removed. tests/test_examples.py: the example's setup.py
writes a config that validates.
…t enforce

setup.py takes a lean-eval checkout and a problem id, and refuses a checkout
not on Lean v4.36.0. The dimension formula moves into the tests' fixture,
a lean-eval-shaped checkout. The README gets a short results paragraph and
says plainly that the agent's session can change what the check trusts
(Mathlib, the toolchain, the stored check.py). check.py exits 2 without
bwrap; check_cases.py reads metrics anywhere in a line, so the spoof case
tests the escaping.
@mtrager
mtrager merged commit 4963a73 into main Nov 30, 2026
10 checks passed
@mtrager
mtrager deleted the lean-example branch November 30, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant