# Lean image `lean.Dockerfile` builds the image the yang-mills-mass-gap build check runs in. Tag: ``` shoal-ym-lean:319ecd52 ``` `scienceslack.json` refers to this exact name. ## Build On the machine whose runner will use it, from a checkout of the project's main (the context is that checkout: its tree goes into the image as the check's commits will be): ```bash sh docker/build.sh shoal-ym-lean:319ecd52 # on the Beijing host, on given cores: MIRRORS=cn CPUSET=32-63 sh docker/build.sh shoal-ym-lean:319ecd52 ``` `build.sh` does it in two steps, so that a failure late in the compile loses nothing. First `docker build` of `lean.Dockerfile` (tag `shoal-ym-lean:319ecd52-base`): the tools, the toolchain, each package of `lake-manifest.json` fetched as the one commit it is pinned at, Mathlib's cache, and the tree. Then `lake build` in a container with no network; when it ends, `.lake/build` is given to `nobody` (the check builds a commit in place on top of it, `"in_place"` in `checks/build.json`) and the container is committed as `shoal-ym-lean:319ecd52`. If either step stops, run the same command again: the layers already built are kept, and the container goes on from what Lake had compiled. The build needs the network (GitHub, the Lean release downloads, Go and Rust or their mirrors, the Mathlib cache). Nothing is published: the runner that runs the check must have the image locally. **Built on the production host, 12-02** (cores 32-63, `MIRRORS=cn`): the long step compiled 18,126 jobs in 2 h 21 min; `.lake/build` is 33 GB (its `*.setup.json` files kept), `nobody`'s. That image (91511450029f) had the default targets only; the libraries `YM` and `WilsonPublic` were then built on top as `nobody` (3 more jobs, 10 s) and committed under the same tag: `shoal-ym-lean:319ecd52`, image id `4e41c481cb84`, 58.4 GB (`-base` 19.4 GB). `build.sh` now builds every `lean_lib` in its long step. What a check costs on it: `checks/build.sbatch`'s comment. ## What is in it - `/opt/elan`: elan with the submission's toolchain (v4.32.0, the default) and Comparator's (v4.34.0), so `lake` works offline. - `/opt/proof`: the project's starting tree, which is the folder `submissions/openai-20261028/submission` of yang-mills-group/YM at its pinned commit and nothing else of that repository, as `upstream.json`'s `subdir` takes it. The build checks the folder's tree hash before it exports it. `.lake` is fully built (dependencies, their oleans and the project's own). `PROOF_BASE=/opt/proof`. - `/opt/tools`: Comparator and lean4export, each checked out at its pin and built with `lake build `, as the group's `scripts/verify.py` builds them. - On `PATH`: `lake`, `lean`, `comparator`, `lean4export`, `landrun`, `nanoda_bin`; also `python3`, `git`, `curl`, `zstd` and a C toolchain. ## How the check uses it `checks/build.py` (`scripts/lean-ci/README.md`) with `"in_place": true` and the standalone Comparator: the approved `Challenge` is built and exported as root, the commit is built as `nobody` in the image's own `.lake/build` (its default targets, then every library: Lake recompiles only what the commit changed), `Solution` is exported, and `comparator` judges the two exports, `landrun` replaced by a stand-in that serves them. `landrun` is in the image but the check does not use it: Comparator's own sandbox is not what holds the commit (the shared README says why). `comparator.json` is the submission's own and does not set `enable_nanoda`, so Comparator checks with Lean's kernel only and prints "Lean default kernel accepts the solution", not a nanoda line. `checks/build.json` asks for exactly what it prints. `nanoda_bin` is in the image for a run with a second kernel, which needs a configuration of its own outside the frozen one (V-2). **The build is long and the image is big.** The project is 9,477 Lean files (about 988,000 lines). Mathlib comes from its cache; the project's own compile is the long step above. The group's record is 11,036 s (about three hours) on a Mac with a Mathlib cache. ## Pins All pins are full commit hashes in `ARG`s at the top of `lean.Dockerfile`. After each clone the build checks `git rev-parse HEAD` against its pin and fails otherwise. | ARG | Value | Source | | --- | --- | --- | | `UPSTREAM_COMMIT` | `319ecd5274241200b27bb5b143a59133fd670ea6` | yang-mills-group/YM, `upstream.json` | | `SUBDIR`, `SUBDIR_TREE` | `submissions/openai-20261028/submission`, `7f4a40cdb1b5fc1586d9a2619be308dd28f45fe9` | `upstream.json` `subdir`; the folder's tree at that commit | | `TOOLCHAIN` | `leanprover/lean4:v4.32.0` | the submission's `lean-toolchain` | | `MATHLIB_COMMIT` | `81a5d257c8e410db227a6665ed08f64fea08e997` | the submission's `lakefile.toml` / `lake-manifest.json` (all nine packages are checked against the manifest) | | `COMPARATOR_REV`, `COMPARATOR_TOOLCHAIN` | `d03acab154d269c06e60e4de7e4cc85deebff94b`, `leanprover/lean4:v4.34.0` | the group's `submissions/openai-20261028/verification/tool-pins.json` | | `LEAN4EXPORT_REV` | `4e7915201d3f9f04470d9eae002fa695f7cdc589` (toolchain v4.32.0) | the same `tool-pins.json` | | `LANDRUN_REV` | `811cfff51ceaf3d9843708aa6d22e9b84ccac8b4` (0.1.18) | PoincareConjecture `Comparator/README.md`. The group pinned none because it ran without landrun | | `NANODA_REV` | `079049d584b2aed2b0172218164082f4fc6eede2` (0.4.18) | PoincareConjecture `Comparator/README.md`. The group ran no external kernel | | `GO_VERSION`, `GO_SHA256` | 1.24.13 | landrun's `go.mod` asks for Go 1.24; checksum from go.dev | | `RUST_VERSION` | 1.100.1 | Rust stable on 2026-12-01; nanoda builds with `cargo build --locked` | ## Rebuild when main moves The image is the build of one commit of main. Rebuild it under a new tag whenever main's `lean-toolchain` or `lake-manifest.json` changes, for example a new Lean release or a new Mathlib. Point the image at the new main: replace the clone-and-`subdir` step with the project's own tree at that commit, since main is no longer upstream's folder. Build it, give the tag the new commit's first eight hex digits, and change the tag in `scienceslack.json` in the same PR. A bump of Lean past the Comparator pin's toolchain may also need new Comparator and lean4export pins. The check refuses a commit whose `lean-toolchain` differs from the image's. Rebuilding after other changes to main is optional: it only makes the checks faster, since less has to be recompiled.