# Lean image for the yang-mills-mass-gap `build` check (checks/build.py): everything before the long step. # # docker/build.sh builds this file with a checkout of the project's main as the context, then compiles the project in # a container of the result and commits that container as the image the check uses (docker/README.md). The compile is # 9,477 files (about 988,000 lines); as a layer, one failure late in it would lose all of it. # # The project's main is the folder submissions/openai-20261028/submission of yang-mills-group/YM at # 319ecd5274241200b27bb5b143a59133fd670ea6 (OpenAI's # October 2026 submission, as upstream.json's `subdir` takes it) with this project's own files on top. # # The check runs with --network none: it reads the commit's tree, uses /opt/proof/.lake (the dependencies, and the # build of the approved main) and runs lake build, lean4export and Comparator. Nothing is downloaded at check time. # # Every pin is a full commit hash in an ARG below, checked once it is fetched. FROM ubuntu:24.04 # --- Where the downloads come from ------------------------------------------ # The defaults are each project's own servers. From Beijing (docker/build.sh with MIRRORS=cn): the Ubuntu archive by # plain http from Aliyun (ca-certificates is not installed yet at the first apt step), Go from Aliyun, Go modules from # goproxy.cn, Rust and its crates from rsproxy.cn. raw.githubusercontent.com is not used: Beijing cannot reach it. ARG APT_MIRROR= ARG GO_DL=https://go.dev/dl ARG GOPROXY=https://proxy.golang.org,direct ARG RUST_DIST=https://static.rust-lang.org ARG CARGO_MIRROR= # --- Pins ------------------------------------------------------------------- # The project's lean-toolchain and, from its lakefile.toml, Mathlib; every package of lake-manifest.json is checked # against its rev after the dependencies are fetched. ARG TOOLCHAIN=leanprover/lean4:v4.32.0 ARG MATHLIB_COMMIT=81a5d257c8e410db227a6665ed08f64fea08e997 # Comparator and lean4export as the Yang–Mills group pinned them for this submission # (submissions/openai-20261028/verification/tool-pins.json in yang-mills-group/YM): Comparator is built with its own # toolchain, lean4export with the submission's. ARG COMPARATOR_REPO=https://github.com/leanprover/comparator ARG COMPARATOR_REV=d03acab154d269c06e60e4de7e4cc85deebff94b ARG COMPARATOR_TOOLCHAIN=leanprover/lean4:v4.34.0 ARG LEAN4EXPORT_REPO=https://github.com/leanprover/lean4export ARG LEAN4EXPORT_REV=4e7915201d3f9f04470d9eae002fa695f7cdc589 # Comparator's sandbox and a second kernel. The group ran Comparator with its development launcher (no landrun, no # external kernel) and pinned neither; these are the pins PoincareConjecture's Comparator/README.md gives, as in # navier-stokes. comparator.json does not enable nanoda, so the check uses Lean's kernel only; nanoda_bin is here for # a run with a second kernel (README.md). ARG LANDRUN_REV=811cfff51ceaf3d9843708aa6d22e9b84ccac8b4 # ^ landrun 0.1.18 ARG NANODA_REV=079049d584b2aed2b0172218164082f4fc6eede2 # ^ nanoda_lib 0.4.18 # Build tools for landrun (go.mod asks for Go 1.24) and nanoda (Rust), used here and removed. ARG GO_VERSION=1.24.13 ARG GO_SHA256=1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730 ARG RUST_VERSION=1.100.1 # --- System packages -------------------------------------------------------- # python3 runs the check; curl and zstd are what Lake and Mathlib's cache tool use. ENV DEBIAN_FRONTEND=noninteractive RUN if [ -n "$APT_MIRROR" ]; then sed -i "s#http://archive.ubuntu.com/ubuntu#$APT_MIRROR#; s#http://security.ubuntu.com/ubuntu#$APT_MIRROR#" /etc/apt/sources.list.d/ubuntu.sources; fi \ && apt-get update && apt-get install -y --no-install-recommends \ ca-certificates curl git python3 build-essential zstd \ && rm -rf /var/lib/apt/lists/* # The check runs Lake as another user than the one that built; let git (Lake asks it about each package) read every # repository in the image. RUN git config --system --add safe.directory '*' # --- landrun ---------------------------------------------------------------- # (a clone from github.com sometimes breaks off in TLS from Beijing: each is tried five times) RUN curl -sSfL --retry 5 "${GO_DL}/go${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tgz \ && echo "${GO_SHA256} /tmp/go.tgz" | sha256sum -c - \ && tar -C /tmp -xzf /tmp/go.tgz \ && for i in 1 2 3 4 5; do git clone https://github.com/Zouuup/landrun /tmp/landrun && break; rm -rf /tmp/landrun; sleep 10; done \ && git -C /tmp/landrun checkout "${LANDRUN_REV}" \ && test "$(git -C /tmp/landrun rev-parse HEAD)" = "${LANDRUN_REV}" \ && cd /tmp/landrun \ && GOPROXY="${GOPROXY}" GOTOOLCHAIN=local GOPATH=/tmp/gopath GOCACHE=/tmp/gocache /tmp/go/bin/go build -o /usr/local/bin/landrun ./cmd/landrun \ && cd / && rm -rf /tmp/go /tmp/go.tgz /tmp/landrun /tmp/gopath /tmp/gocache # --- nanoda_bin ------------------------------------------------------------- RUN export RUSTUP_HOME=/tmp/rustup CARGO_HOME=/tmp/cargo RUSTUP_DIST_SERVER="${RUST_DIST}" RUSTUP_UPDATE_ROOT="${RUST_DIST}/rustup" \ && curl -sSfL --retry 5 "${RUST_DIST}/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" -o /tmp/rustup-init && chmod +x /tmp/rustup-init \ && (for i in 1 2 3; do /tmp/rustup-init -y --no-modify-path --profile minimal --default-toolchain "${RUST_VERSION}" && exit 0; sleep 10; done; exit 1) \ && if [ -n "$CARGO_MIRROR" ]; then printf '[source.crates-io]\nreplace-with = "mirror"\n[source.mirror]\nregistry = "%s"\n' "$CARGO_MIRROR" > /tmp/cargo/config.toml; fi \ && for i in 1 2 3 4 5; do git clone https://github.com/ammkrn/nanoda_lib /tmp/nanoda && break; rm -rf /tmp/nanoda; sleep 10; done \ && git -C /tmp/nanoda checkout "${NANODA_REV}" \ && test "$(git -C /tmp/nanoda rev-parse HEAD)" = "${NANODA_REV}" \ && cd /tmp/nanoda \ && /tmp/cargo/bin/cargo build --release --locked --bin nanoda_bin \ && install -m 0755 target/release/nanoda_bin /usr/local/bin/nanoda_bin \ && cd / && rm -rf /tmp/rustup /tmp/cargo /tmp/nanoda /tmp/rustup-init # --- Lean ------------------------------------------------------------------- ENV ELAN_HOME=/opt/elan ENV PATH=/usr/local/bin:/opt/elan/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin RUN curl -sSfL --retry 5 https://github.com/leanprover/elan/releases/download/v4.1.2/elan-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C /tmp \ && /tmp/elan-init -y --no-modify-path --default-toolchain none && rm /tmp/elan-init # (elan asks github.com too, and from Beijing one connection in a few to it hangs for two minutes and fails) RUN for i in 1 2 3 4 5; do elan toolchain install "${TOOLCHAIN}" && elan toolchain install "${COMPARATOR_TOOLCHAIN}" && break; sleep 10; done \ && elan default "${TOOLCHAIN}" && lean --version # --- Comparator and lean4export --------------------------------------------- # Each in its own checkout under /opt/tools, built by `lake build ` as the group's scripts/verify.py does, with # the toolchain its lean-toolchain names. (Comparator's Lake fetches lean4export for itself: up to three tries.) RUN for i in 1 2 3 4 5; do git clone "${COMPARATOR_REPO}" /opt/tools/comparator && break; rm -rf /opt/tools/comparator; sleep 10; done \ && git -C /opt/tools/comparator checkout "${COMPARATOR_REV}" \ && test "$(git -C /opt/tools/comparator rev-parse HEAD)" = "${COMPARATOR_REV}" \ && test "$(cat /opt/tools/comparator/lean-toolchain)" = "${COMPARATOR_TOOLCHAIN}" \ && cd /opt/tools/comparator && (for i in 1 2 3 4 5 6; do lake build comparator && exit 0; sleep 10; done; exit 1) \ && ln -s /opt/tools/comparator/.lake/build/bin/comparator /usr/local/bin/comparator \ && chmod -R a+rX /opt/tools /opt/elan RUN for i in 1 2 3 4 5; do git clone "${LEAN4EXPORT_REPO}" /opt/tools/lean4export && break; rm -rf /opt/tools/lean4export; sleep 10; done \ && git -C /opt/tools/lean4export checkout "${LEAN4EXPORT_REV}" \ && test "$(git -C /opt/tools/lean4export rev-parse HEAD)" = "${LEAN4EXPORT_REV}" \ && test "$(cat /opt/tools/lean4export/lean-toolchain)" = "${TOOLCHAIN}" \ && cd /opt/tools/lean4export && lake build lean4export \ && ln -s /opt/tools/lean4export/.lake/build/bin/lean4export /usr/local/bin/lean4export \ && chmod -R a+rX /opt/tools # --- The dependencies ------------------------------------------------------- # From the three files that name them, so that a change elsewhere in main does not fetch Mathlib's cache (5 GB) again. # Each package of the manifest is fetched as the one commit it is pinned at, where Lake would clone it with its # history: Mathlib's is about a gigabyte, and from Beijing github.com gave 0.6 MB/s and one connection in a few hung # for two minutes (12-02). Lake finds each at its rev and fetches nothing. Then Mathlib's cache, up to six times: a few # of its downloads fail now and then, and each try fetches what is still missing. # chmod in this same layer: Mathlib's cache unpacks its files 0600, and the check compiles the commit as nobody (in a # later layer the chmod would copy every file). WORKDIR /opt/proof COPY lakefile.toml lake-manifest.json lean-toolchain /opt/proof/ RUN test "$(cat lean-toolchain)" = "${TOOLCHAIN}" \ && python3 -I -c 'import json; [print(p["url"], p["name"], p["rev"]) for p in json.load(open("lake-manifest.json"))["packages"]]' > /tmp/packages \ && while read -r url name rev; do \ for i in 1 2 3 4 5 6 7 8; do \ rm -rf ".lake/packages/$name" && git init -q ".lake/packages/$name" && git -C ".lake/packages/$name" remote add origin "$url" \ && timeout 900 git -C ".lake/packages/$name" fetch -q --depth 1 origin "$rev" \ && git -C ".lake/packages/$name" checkout -q --detach FETCH_HEAD && break; \ sleep 5; \ done; \ test "$(git -C ".lake/packages/$name" rev-parse HEAD)" = "$rev" || { echo "not fetched: $name at $rev"; exit 1; }; \ done < /tmp/packages && rm /tmp/packages \ && (for i in 1 2 3 4 5 6; do lake exe cache get && exit 0; sleep 10; done; exit 1) \ && test "$(git -C .lake/packages/mathlib rev-parse HEAD)" = "${MATHLIB_COMMIT}" \ && rm -rf /root/.cache/mathlib \ && chmod -R a+rX /opt/proof /opt/elan RUN for t in lean4export comparator landrun nanoda_bin lake lean python3; do \ command -v "$t" >/dev/null || { echo "missing: $t"; exit 1; }; \ done # --- The project ------------------------------------------------------------ # The context is a checkout of the project's main: its tree goes in whole, as the check's commits will be. # docker/build.sh compiles it next (the default targets: WilsonReference, WilsonConstruction), in a container. # (no chmod -R here: in a later layer it copies every file it visits, Mathlib's 7 GB included, changed or not; # a checkout's files are readable as they come) COPY . /opt/proof RUN rm -rf .git ENV PROOF_BASE=/opt/proof CMD ["/bin/bash"]