Lean REPL Setup
Setup and verification guide for the Lean environment used by wonton-soup.
Toolchain Contract
- Lean version pinned in
$LEAN_PROJECT_PATH/lean-toolchain(currently4.25.0) leantreeis pinned as a Git dependency inpyproject.tomlanduv.lock.LEAN_PROJECT_PATHmust point to the warmed Lean project. If unset during setup,setup_lean.pycreates this dossier’slean_project/.
Requirements
- Python
3.12+ uvelan
Step 1: Install Pinned Lean
Install elan if needed:
curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | shInstall + select pinned toolchain:
elan install leanprover/lean4:v4.25.0
elan default leanprover/lean4:v4.25.0
lean --versionExpected: Lean (version 4.25.x, ...).
Step 2: Sync Python Dependencies
From dossiers/wonton-soup/:
uv syncStep 3: Build Lean REPL And Create Lean Project
From dossiers/wonton-soup/:
uv run python setup_lean.pyBuilds the bundled leantree REPL, initializes $LEAN_PROJECT_PATH when set, otherwise lean_project/, fetches Mathlib caches, and warms the local build. Run it from this dossier directory inside the pinned Wonton environment so uv uses the flake’s Python 3.12.
Step 4: Export LEAN_PROJECT_PATH
export LEAN_PROJECT_PATH=/path/to/specter-labs/research-registry/dossiers/wonton-soup/lean_projectStep 5: Smoke Test
From dossiers/wonton-soup/:
uv run python wonton.py lean run -m dev --sample 3 --seed 123 --plainExpected signals:
- a new
logs/corpus-YYYY-MM-DD-HHMMSS/directory run_status.jsonwithstatus: completedsummary.json.gzpresent
Platform Notes
- macOS uses
gzcat; most Linux distributions usezcat. - if elan binaries are not discovered, prepend
$HOME/.elan/bintoPATH.
Troubleshooting
lake not found
export PATH="$HOME/.elan/bin:$PATH"Then verify:
lake --versionLean version mismatch
elan override set leanprover/lean4:v4.25.0
lean --versionuv run picked the wrong Python
Rebuild the venv against the flake interpreter:
uv sync --python "$(which python)"
uv run python -VREPL build failures in lean_project/
cd lean_project
lake exe cache get
lake buildIf dependency fetch/build still fails, remove transient build outputs and rebuild with the pinned version active.
LEAN_PROJECT_PATH not respected
Verify current shell value:
echo "$LEAN_PROJECT_PATH"It must resolve to this dossier’s lean_project path, not another repository.