Navier–Stokes: the Lean blow-up proof, cleaned up together
OpenAI's 2026 Lean proofs of blowup for forced Navier–Stokes and Euler, rerun by others, not refereed, no ruling from Clay; cleaned up together: more readable, faster to build

| 1 | |
| 2 | # Build the Lean image of the `build` check, on the machine whose runner will use it. |
| 3 | # |
| 4 | # sh docker/build.sh <checkout of the project's main> [<tag>] |
| 5 | # |
| 6 | # MIRRORS=cn take apt, Go and Rust from the mirrors a host in Beijing can reach (lean.Dockerfile's ARGs) |
| 7 | # CPUSET=32-63 the cores the build may use (Docker's classic builder honours it; the default is all of them) |
| 8 | # NAME=… the name of step 2's container (the default is made from the tag) |
| 9 | # |
| 10 | # Two steps, so that a failure late in the compile loses nothing: |
| 11 | # 1. docker build of lean.Dockerfile: the tools, the toolchain, the dependencies with Mathlib's cache, the tree; |
| 12 | # 2. `lake build` of the project, and of every `lean_lib` its lakefile.toml declares (the check builds them all on each |
| 13 | # push: checks/build.py), in a container named after the tag, with no network. If it stops (a full disk, a |
| 14 | # reboot), run this script again: the container is still there and Lake goes on from what it had built. When it |
| 15 | # ends, the build becomes nobody's (the check then builds a commit on top of it without copying it: checks/build.py) |
| 16 | # and the container is committed as the image. |
| 17 | set -eu |
| 18 | main=$(cd "$1" && pwd) |
| 19 | tag=${2:-shoal-ns-lean:f9e8bc5b} |
| 20 | name=${NAME:-build-$(printf %s "$tag" | tr ':/' '--')} |
| 21 | cpus=${CPUSET:+--cpuset-cpus $CPUSET} |
| 22 | mirrors= |
| 23 | if [ "${MIRRORS:-}" = cn ]; then |
| 24 | mirrors="--build-arg APT_MIRROR=http://mirrors.aliyun.com/ubuntu --build-arg GO_DL=https://mirrors.aliyun.com/golang --build-arg GOPROXY=https://goproxy.cn,direct --build-arg RUST_DIST=https://rsproxy.cn --build-arg CARGO_MIRROR=sparse+https://rsproxy.cn/index/" |
| 25 | fi |
| 26 | # (the classic builder: BuildKit ignores --cpuset-cpus; the host's network: through Docker's bridge downloads crawl) |
| 27 | DOCKER_BUILDKIT=0 docker build --network host $cpus $mirrors -f "$main/docker/lean.Dockerfile" -t "$tag-base" "$main" |
| 28 | libs=$(python3 -I -c 'import sys, tomllib; print(*[l["name"] for l in tomllib.load(open(sys.argv[1], "rb")).get("lean_lib", [])])' "$main/lakefile.toml") |
| 29 | docker container inspect "$name" >/dev/null 2>&1 \ |
| 30 | || docker create --name "$name" --network none $cpus "$tag-base" bash -c \ |
| 31 | "date +'lake build starts %T' && lake build && lake build $libs && chown -R nobody:nogroup .lake/build && chmod -R a+rX .lake/build && date +'lake build ends %T'" |
| 32 | docker start -a "$name" |
| 33 | docker commit -c 'CMD ["/bin/bash"]' "$name" "$tag" |
| 34 | docker rm "$name" |
| 35 | docker image inspect --format "$tag {{.Id}} {{.Size}} bytes" "$tag" |