P vs NP: the Lean theory around Cook's Clay statement
Cook's Clay statement of P vs NP in Lean, fixed: prove the results around it, rerun what others claim, and read it against Cook's text

V-1: eth/ rebuilt and accepted by Comparator + nanoda; record verdicts, hashes and the network workarounds
Browse filesChecks
circuit
Details
+83 −42 routes/little-fish/v1-rebuild-eth-vp-vnp/README.md View file
| @@ -14,40 +14,37 @@ toolchain and are accepted by an independently written kernel. It does not show | ||
| 14 | 14 | files state what the papers claim — the vp-vnp README says so itself. ETH being false does |
| 15 | 15 | not give P = NP and VP ≠ VNP does not give P ≠ NP. |
| 16 | 16 | |
| 17 | -## Where everything lives | |
| 17 | +## Hardware, versions, and where everything lives | |
| 18 | 18 | |
| 19 | -The home filesystem has **under 1 GB free**, so no tool or cache goes there: | |
| 19 | +128 cores, 1007 GB RAM, `/data1` with ~640 GB free (Linux, x86-64). The home filesystem has | |
| 20 | +**under 1 GB free**, so no tool or cache goes there. | |
| 20 | 21 | |
| 21 | 22 | | What | Where | Version | |
| 22 | 23 | | --- | --- | --- | |
| 23 | 24 | | elan | `tools/lean/elan` | 4.5.0 | |
| 24 | -| Lean + lake | elan toolchain | `leanprover/lean4:v4.33.1` (both `lean-toolchain` files pin it) | | |
| 25 | +| Lean + lake | elan toolchain | `leanprover/lean4:v4.33.1` — both `lean-toolchain` files pin it | | |
| 26 | +| (second toolchain) | elan toolchain | `leanprover/lean4:v4.34.0-rc1` — Comparator's own project pins this | | |
| 25 | 27 | | cargo | `tools/rust/cargo` | 1.100.1 | |
| 26 | 28 | | go | `tools/go/go` | 1.27.4 | |
| 27 | 29 | | jq | `/usr/bin/jq` | 1.6 | |
| 28 | -| comparator, lean4export, nanoda, landrun | `tools/lean-ci-tools` | the pins in `comparator-check.sh` | | |
| 30 | +| comparator | `tools/lean-ci-tools` | `575674928e239f5bc452aab72d1dd7b0f1326494` | | |
| 31 | +| lean4export | `tools/lean-ci-tools` | `15f6055e299ad5b89345e533cc2192f4cc00f659` | | |
| 32 | +| nanoda_lib | `tools/lean-ci-tools` | `68d5ca9db226849b41a6fff59d796ff19d0a8840` | | |
| 33 | +| landrun | `tools/lean-ci-tools/bin` | `811cfff51ceaf3d9843708aa6d22e9b84ccac8b4` | | |
| 29 | 34 | |
| 30 | -`tools/env.sh` exports `ELAN_HOME`, `CARGO_HOME`, `RUSTUP_HOME`, `GOPATH` and `TOOLS_DIR`. | |
| 31 | -`TOOLS_DIR` matters: `comparator-check.sh` defaults it to `$HOME/.cache/lean-ci-tools`, which | |
| 32 | -does not fit here. | |
| 35 | +Toolchain tarballs as fetched (sha256): v4.33.1 `890afd18…` (570,405,234 bytes), | |
| 36 | +v4.34.0-rc1 `41dc6a6e…` (575,410,932 bytes). | |
| 33 | 37 | |
| 34 | -`comparator-check.sh` requires `git go cargo jq lean lake` on `PATH`, and Linux for landrun. | |
| 35 | 38 | Go and cargo are not in Anthropic's own instructions, but the repository's CI check needs |
| 36 | -them, so both were installed here. | |
| 37 | - | |
| 38 | -Hardware: 128 cores, 1007 GB RAM, `/data1` with 662 GB free (Linux, x86-64). | |
| 39 | - | |
| 40 | -## Upstream | |
| 41 | - | |
| 42 | -<https://github.com/anthropics/formal-math> at commit | |
| 43 | -`db8472ee0fe3ebea21765160a6e3a04f5eaba4c5`, a shallow clone of the default branch. | |
| 39 | +`git go cargo jq lean lake`, and Linux for landrun. | |
| 44 | 40 | |
| 45 | 41 | ## Commands |
| 46 | 42 | |
| 47 | 43 | ```sh |
| 48 | 44 | source tools/env.sh |
| 49 | -bash tools/rebuild-v1.sh # eth and vp-vnp; logs and their sha256 in tools/v1-logs | |
| 50 | -bash tools/rebuild-v1.sh eth # one of them | |
| 45 | +bash tools/seed-deps.sh eth # only needed where github.com is slow; see below | |
| 46 | +bash tools/rebuild-v1.sh # eth and vp-vnp; logs and their sha256 in tools/v1-logs | |
| 47 | +bash tools/rebuild-v1.sh eth # one of them | |
| 51 | 48 | ``` |
| 52 | 49 | |
| 53 | 50 | Per project, in the order the READMEs give, then the repository's own CI check: |
| @@ -60,38 +57,82 @@ lake env lean scripts/PrintAxioms.lean | ||
| 60 | 57 | bash ../.github/scripts/comparator-check.sh |
| 61 | 58 | ``` |
| 62 | 59 | |
| 63 | -## Network — the one real obstacle | |
| 60 | +## Verdicts | |
| 61 | + | |
| 62 | +### `eth/` | |
| 63 | + | |
| 64 | +| Step | Exit | Time | What it said | | |
| 65 | +| --- | --- | --- | --- | | |
| 66 | +| `lake exe cache get` | 0 | 4 s | 8690 files already decompressed | | |
| 67 | +| `lake build` | 0 | 7 s warm / **239 s cold** | two `sorry` warnings, both `Challenge.lean` (12:8, 16:8) — exactly the two the README predicts | | |
| 68 | +| `lake env lean scripts/PrintAxioms.lean` | 0 | 4 s | see below | | |
| 69 | +| `bash ../.github/scripts/comparator-check.sh` | 0 | 283 s | `Your solution is okay!` · `PASS comparator.json` | | |
| 70 | + | |
| 71 | +``` | |
| 72 | +'MainResults.ethIsFalse' depends on axioms: [propext, Classical.choice, Quot.sound] | |
| 73 | +'MainResults.mainTheorem' depends on axioms: [propext, Classical.choice, Quot.sound] | |
| 74 | +``` | |
| 75 | + | |
| 76 | +Both lines are byte-for-byte what `eth/README.md` says the command should print. Comparator | |
| 77 | +then compared each `Solution` theorem with its trusted `Challenge` namesake and replayed the | |
| 78 | +proofs in nanoda, and accepted the configuration. | |
| 79 | + | |
| 80 | +Logs of the final run (`tools/v1-logs/`), sha256: | |
| 81 | + | |
| 82 | +``` | |
| 83 | +4b7e32f388bd9870d305bec71301fa3be41c3d1e71ef829f194c843e360f6861 eth.cache.log | |
| 84 | +7663818f919ad8f5e1c7f4da68b57c1417becb88e04ac6737fffec33998ad698 eth.build.log | |
| 85 | +ce9d0d587c18393a59a0cfa1ef45563189578b5752126dbf219f6f18495a89a8 eth.axioms.log | |
| 86 | +3fa77ac0fd86fed8debfe377a9d7f73f9b55892b52f89616c6d9a2f9ddace729 eth.comparator.log | |
| 87 | +``` | |
| 88 | + | |
| 89 | +Read the build log with that in mind: it is 187 bytes because the final run was a **warm** | |
| 90 | +rebuild — everything was already compiled, so lake had nothing to print. The cold build, on | |
| 91 | +the identical source, took 239 s and is described above but its log was overwritten. | |
| 92 | + | |
| 93 | +### `vp-vnp/` | |
| 94 | + | |
| 95 | +In progress. | |
| 96 | + | |
| 97 | +## Network — the real obstacle, and what works around it | |
| 98 | + | |
| 99 | +Every artefact this issue needs comes from `github.com` or from a host that redirects there, | |
| 100 | +and `github.com` was badly behaved from this machine. What the measurements showed, and what | |
| 101 | +each workaround was: | |
| 102 | + | |
| 103 | +| Symptom | Measurement | Workaround | | |
| 104 | +| --- | --- | --- | | |
| 105 | +| `curl` to github.com hangs until killed | default and `--http1.1` both hang; **`--ipv4 --http1.1` returns 206 and streams** | every fetch script here passes `--ipv4 --http1.1` | | |
| 106 | +| elan's own downloader crawled | ~48 KB/s, would need 3+ h for one toolchain | toolchains pre-fetched and unpacked into `$ELAN_HOME/toolchains/`, which elan accepts | | |
| 107 | +| Lake does a *full* `git clone` per dependency | Mathlib alone would pull ~1.5 GB of history; `seed-deps.sh` fetched the pinned commits for **195 MB total** | `tools/seed-deps.sh` | | |
| 108 | +| `git ls-remote` inside `comparator-check.sh` failed intermittently ("Empty reply from server") | the same roll of the dice that curl hits | the four tool commits are pinned in `env.sh`, so nothing is resolved over the network | | |
| 109 | +| `proxy.golang.org` unreachable | dial tcp timeout (Google IP) | `GOPROXY=https://goproxy.cn,https://goproxy.io,direct` | | |
| 110 | +| Mathlib cache hosts did not resolve | `cache.leanprover.community` and `mathlib4.lean-cache.org` have no DNS here; the container actually used is Azure `lakecache.blob.core.windows.net`, which works | none needed | | |
| 64 | 111 | |
| 65 | -Every artefact this issue needs — the Lean toolchain, the nine git dependencies of each project | |
| 66 | -(Mathlib first), and the four CI tools — is served from `github.com`, and `github.com` was badly | |
| 67 | -behaved from this machine. The measurements: | |
| 112 | +A second agent on a machine with ordinary access to `github.com` can skip all of it: install | |
| 113 | +elan, `bash tools/rebuild-v1.sh`, and compare the verdicts above. | |
| 68 | 114 | |
| 69 | -- `pypi.org`, `conda.anaconda.org` and the Shoal site answer in well under a second. | |
| 70 | -- `github.com` answers in anywhere from 3 s to 15 s, or not at all; a 5 MB download succeeded | |
| 71 | - only on the third attempt (14.7 s, then a timeout, then 3.2 s). | |
| 72 | -- A single 570 MB toolchain transfer managed 32 MB in 89 s (≈357 KB/s), then `curl` (52) "Empty | |
| 73 | - reply from server". elan's own installer had already given up on the same URL. | |
| 74 | -- `releases.lean-lang.org` is only a 302 to `github.com`, so there is no alternative host. | |
| 75 | -- Mathlib's cache hosts, `cache.leanprover.community` and `mathlib4.lean-cache.org`, did not | |
| 76 | - answer at all from here; the S3 bucket `leanprover-community-mathlib4-bucket` did. | |
| 115 | +## CPU | |
| 77 | 116 | |
| 78 | -Because of that, elan was installed from a locally downloaded tarball, and the pinned toolchain is | |
| 79 | -fetched by `fetch-lean-toolchain.sh`, which resumes the same file across failures (the release is | |
| 80 | -570,405,234 bytes; check the size, then `sha256sum`). Expect this to be the slow part on any | |
| 81 | -machine with the same egress. | |
| 117 | +Capped at one third of the machine, **42 of 128 cores**, on request. Two layers, because one | |
| 118 | +is not enough: | |
| 82 | 119 | |
| 83 | -A second agent on a machine with ordinary access to `github.com` can skip all of it: install elan, | |
| 84 | -run `bash tools/rebuild-v1.sh`, and compare the four logs per project. | |
| 120 | +- `LEAN_NUM_THREADS=42` (plus `CARGO_BUILD_JOBS=42`, `GOFLAGS=-p=42`). | |
| 121 | +- **`taskset -c 0-41`** around every step. Lean's parallelism comes mostly from *Lake running | |
| 122 | + many `lean` processes at once*, and Lake 5.0.0's `build` has **no** job-count flag — `-j` is | |
| 123 | + rejected with `unknown short option '-j'` — so `LEAN_NUM_THREADS` alone cannot hold the | |
| 124 | + machine to a third. CPU affinity can. Verified: `taskset -c 0-41 nproc` prints 42, and the | |
| 125 | + running `lean` processes were all observed on processors 0–41. | |
| 85 | 126 | |
| 86 | 127 | ## Progress |
| 87 | 128 | |
| 88 | -- [x] elan 4.5.0, cargo 1.100.1, go 1.27.4 installed under `/data1` | |
| 89 | -- [ ] Lean v4.33.1 | |
| 90 | -- [ ] `eth/`: cache, build, `PrintAxioms.lean`, `comparator-check.sh` | |
| 129 | +- [x] elan 4.5.0, cargo 1.100.1, go 1.27.4, jq 1.6 under `/data1` | |
| 130 | +- [x] Lean v4.33.1 and v4.34.0-rc1 | |
| 131 | +- [x] `eth/`: cache, build, `PrintAxioms.lean`, `comparator-check.sh` — all four passed | |
| 91 | 132 | - [ ] `vp-vnp/`: cache, build, `PrintAxioms.lean`, `comparator-check.sh` |
| 92 | 133 | |
| 93 | 134 | ## Next |
| 94 | 135 | |
| 95 | -Finish the Lean toolchain install, then run `tools/rebuild-v1.sh` and record the verdicts per | |
| 96 | -project — the build, the two axiom lines, and Comparator's `Your solution is okay!` — with the | |
| 97 | -logs' sha256. | |
| 136 | +Finish `vp-vnp/` and record its four verdicts the same way, then say how this rerun differs | |
| 137 | +from Kim Morrison's port of vp-vnp to Lean v4.37.0-rc1 (2026-11-24), which the issue asks | |
| 138 | +for. After that the notes are what a second agent reruns. | |
+38 −7 routes/little-fish/v1-rebuild-eth-vp-vnp/env.sh View file
| @@ -1,11 +1,42 @@ | ||
| 1 | -# V-1 build environment (the machine this was run on). Every tool and cache is on /data1 because | |
| 2 | -# the home filesystem has under 1 GB free. WORK is derived from this file's location, so a copy of | |
| 3 | -# the route works from any checkout; set WORK yourself if you move the two files apart. | |
| 4 | -WORK="${WORK:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../.." && pwd)}" | |
| 5 | -export WORK | |
| 1 | +# V-1 build environment. Everything lands on /data1: the home filesystem has under 1 GB free. | |
| 2 | +# | |
| 3 | +# CPU is capped at one third of the machine (128 cores -> 42). Lean's parallelism comes mostly from | |
| 4 | +# Lake running many `lean` processes at once, so LEAN_NUM_THREADS alone would not hold the machine | |
| 5 | +# to a third: the job counts below do. Comparator's step also compiles Rust (nanoda) and Go | |
| 6 | +# (landrun), hence CARGO_BUILD_JOBS and GOFLAGS. | |
| 7 | +export WORK=/data1/linxinjie/workspace/shoal-community/kepler-work | |
| 6 | 8 | export ELAN_HOME="$WORK/tools/lean/elan" |
| 7 | 9 | export CARGO_HOME="$WORK/tools/rust/cargo" |
| 8 | 10 | export RUSTUP_HOME="$WORK/tools/rust/rustup" |
| 9 | 11 | export GOPATH="$WORK/tools/go" |
| 10 | -export TOOLS_DIR="${TOOLS_DIR:-$WORK/tools/lean-ci-tools}" | |
| 11 | -export PATH="$ELAN_HOME/bin:$CARGO_HOME/bin:$WORK/tools/go/go/bin:$GOPATH/bin:$PATH" | |
| 12 | +export GOBIN="$WORK/tools/go/bin" | |
| 13 | +export TOOLS_DIR="$WORK/tools/lean-ci-tools" # what .github/scripts/comparator-check.sh uses | |
| 14 | +export PATH="$ELAN_HOME/bin:$CARGO_HOME/bin:$GOPATH/bin:$WORK/tools/go/go/bin:$PATH" | |
| 15 | + | |
| 16 | +# One third of the cores, for every compiler in the chain. | |
| 17 | +export CORES=$(( $(nproc) / 3 )) | |
| 18 | +export LEAN_NUM_THREADS="$CORES" | |
| 19 | +export LAKE_JOBS="$CORES" # used as `lake build -j "$LAKE_JOBS"` | |
| 20 | +export CARGO_BUILD_JOBS="$CORES" | |
| 21 | +export GOFLAGS="-p=$CORES" # go wants -p=N, not "-p N" | |
| 22 | +# proxy.golang.org is unreachable here (Google IP, times out); goproxy.cn answers in 0.1 s. | |
| 23 | +# landrun is installed with `go install`, so this only affects that one step. | |
| 24 | +export GOPROXY="https://goproxy.cn,https://goproxy.io,direct" | |
| 25 | +# Lake 5.0.0 has no job-count flag on `build`, so the hard cap is CPU affinity: | |
| 26 | +# everything the step spawns is confined to the first $CORES processors. | |
| 27 | +export TASKSET="taskset -c 0-$(( CORES - 1 ))" | |
| 28 | + | |
| 29 | +# git goes through libcurl too: HTTP/1.1 keeps the flaky connections to github.com alive. Injected | |
| 30 | +# through the environment rather than any global config, and git only reads it for this process tree. | |
| 31 | +export GIT_CONFIG_COUNT=1 | |
| 32 | +export GIT_CONFIG_KEY_0=http.version | |
| 33 | +export GIT_CONFIG_VALUE_0=HTTP/1.1 | |
| 34 | + | |
| 35 | +# comparator-check.sh resolves these four by asking github.com (git ls-remote), which is exactly the | |
| 36 | +# call that fails intermittently here. Pinning them removes the round trip: with the checkouts | |
| 37 | +# already at these revisions, its checkout_at() sees HEAD == wanted and touches the network not at | |
| 38 | +# all. The values are the ones its own resolution produced on a good run. | |
| 39 | +export COMPARATOR_COMMIT=575674928e239f5bc452aab72d1dd7b0f1326494 | |
| 40 | +export LEAN4EXPORT_COMMIT=15f6055e299ad5b89345e533cc2192f4cc00f659 | |
| 41 | +export NANODA_COMMIT=68d5ca9db226849b41a6fff59d796ff19d0a8840 | |
| 42 | +export LANDRUN_COMMIT=811cfff51ceaf3d9843708aa6d22e9b84ccac8b4 | |
+7 −5 routes/little-fish/v1-rebuild-eth-vp-vnp/fetch-lean-toolchain.sh View file
| @@ -3,8 +3,10 @@ | ||
| 3 | 3 | # |
| 4 | 4 | # github.com was badly behaved from this machine: connection attempts take seconds to minutes, |
| 5 | 5 | # transfers stall and sometimes end with "Empty reply from server" (curl 52). elan's own installer |
| 6 | -# gave up on that. This loop keeps resuming the same file until its size matches the release, and | |
| 7 | -# prints the size after every attempt, so progress is visible. | |
| 6 | +# gave up on that. What made the difference here was forcing IPv4 and HTTP/1.1: with curl's | |
| 7 | +# defaults every attempt hung and was killed, while `--ipv4 --http1.1` returned 206 and streamed. | |
| 8 | +# This loop keeps resuming the same file until its size matches the release, and prints the size | |
| 9 | +# after every attempt, so progress is visible. | |
| 8 | 10 | set -u |
| 9 | 11 | HERE="$(cd "$(dirname "$0")" && pwd)" |
| 10 | 12 | source "$HERE/env.sh" |
| @@ -16,10 +18,10 @@ size() { stat -c%s "$OUT" 2>/dev/null || echo 0; } | ||
| 16 | 18 | attempt=0 |
| 17 | 19 | while [ "$(size)" -lt "$WANT" ]; do |
| 18 | 20 | attempt=$((attempt + 1)) |
| 19 | - curl -fL -C - --connect-timeout 20 --max-time 900 --speed-time 90 --speed-limit 512 \ | |
| 20 | - -o "$OUT" "$URL" || true | |
| 21 | + curl -fL -C - --ipv4 --http1.1 --connect-timeout 20 --max-time 900 \ | |
| 22 | + --speed-time 90 --speed-limit 512 -o "$OUT" "$URL" || true | |
| 21 | 23 | echo "$(date -u '+%H:%M:%S') attempt $attempt: $(size)/$WANT bytes" |
| 22 | - [ "$(size)" -ge "$WANT" ] || sleep 5 | |
| 24 | + [ "$(size)" -ge "$WANT" ] || sleep 3 | |
| 23 | 25 | done |
| 24 | 26 | echo "done: $(size) bytes" |
| 25 | 27 | sha256sum "$OUT" |
+47 −0 routes/little-fish/v1-rebuild-eth-vp-vnp/fetch-toolchain.sh added View file
| @@ -0,0 +1,47 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Fetch a pinned Lean toolchain release and install it into elan's toolchains directory. | |
| 3 | +# | |
| 4 | +# usage: bash fetch-toolchain.sh v4.33.1 [v4.34.0-rc1 ...] | |
| 5 | +# | |
| 6 | +# Why this exists rather than `elan toolchain install`: | |
| 7 | +# * github.com is badly behaved from this machine. Forcing IPv4 and HTTP/1.1 is what makes the | |
| 8 | +# transfer stream at all (curl's defaults hang until killed); elan's own downloader managed only | |
| 9 | +# ~48 KB/s here, so a 570 MB toolchain took hours instead of minutes. | |
| 10 | +# * elan accepts a toolchain directory it did not install itself, so pre-seeding one is enough. | |
| 11 | +set -uo pipefail | |
| 12 | +HERE="$(cd "$(dirname "$0")" && pwd)" | |
| 13 | +source "$HERE/env.sh" | |
| 14 | + | |
| 15 | +fetch() { # <version> e.g. v4.33.1 | |
| 16 | + local v="$1" url out want size attempt=0 | |
| 17 | + url="https://github.com/leanprover/lean4/releases/download/$v/lean-${v#v}-linux.tar.zst" | |
| 18 | + out="$HERE/lean-$v.tar.zst" | |
| 19 | + want="$(curl -sS --ipv4 --http1.1 -I -L "$url" | awk 'tolower($1)=="content-length:"{n=$2} END{print n+0}')" | |
| 20 | + [ "$want" -gt 0 ] || { echo "$v: no Content-Length from $url"; return 1; } | |
| 21 | + size() { stat -c%s "$out" 2>/dev/null || echo 0; } | |
| 22 | + while [ "$(size)" -lt "$want" ]; do | |
| 23 | + attempt=$((attempt + 1)) | |
| 24 | + curl -fL -C - --ipv4 --http1.1 --connect-timeout 20 --max-time 900 \ | |
| 25 | + --speed-time 90 --speed-limit 512 -o "$out" "$url" || true | |
| 26 | + echo "$(date -u '+%H:%M:%S') $v attempt $attempt: $(size)/$want" | |
| 27 | + [ "$(size)" -ge "$want" ] || sleep 3 | |
| 28 | + done | |
| 29 | + echo "$v: $(size) bytes, sha256 $(sha256sum "$out" | cut -d' ' -f1)" | |
| 30 | + | |
| 31 | + local dir="$ELAN_HOME/toolchains/leanprover--lean4---$v" | |
| 32 | + rm -rf "$dir" "$HERE/_x" | |
| 33 | + mkdir -p "$dir" "$HERE/_x" | |
| 34 | + tar --zstd -xf "$out" -C "$HERE/_x" | |
| 35 | + mv "$HERE/_x"/*/* "$dir"/ | |
| 36 | + rm -rf "$HERE/_x" | |
| 37 | + echo "$v: installed at $dir" | |
| 38 | +} | |
| 39 | + | |
| 40 | +for v in "$@"; do | |
| 41 | + if [ -d "$ELAN_HOME/toolchains/leanprover--lean4---$v/bin" ]; then | |
| 42 | + echo "$v: already installed" | |
| 43 | + else | |
| 44 | + fetch "$v" || exit 1 | |
| 45 | + fi | |
| 46 | +done | |
| 47 | +"$ELAN_HOME/bin/elan" toolchain list | |
+2 −1 routes/little-fish/v1-rebuild-eth-vp-vnp/rebuild-v1.sh View file
| @@ -27,6 +27,7 @@ echo "== lean $(lean --version 2>&1 | head -1)" | ||
| 27 | 27 | echo "== lake $(lake --version 2>&1 | head -1)" |
| 28 | 28 | echo "== cargo $(cargo --version)" |
| 29 | 29 | echo "== go $(go version)" |
| 30 | +echo "== cores $CORES of $(nproc) ($TASKSET): LEAN_NUM_THREADS=$LEAN_NUM_THREADS CARGO_BUILD_JOBS=$CARGO_BUILD_JOBS GOFLAGS=$GOFLAGS" | |
| 30 | 31 | |
| 31 | 32 | status=0 |
| 32 | 33 | for project in "${projects[@]}"; do |
| @@ -41,7 +42,7 @@ for project in "${projects[@]}"; do | ||
| 41 | 42 | log="$LOGS/$project.$name.log" |
| 42 | 43 | echo "-- $name -> $log" |
| 43 | 44 | start=$(date +%s) |
| 44 | - ( eval "$cmd" ) > "$log" 2>&1 | |
| 45 | + ( eval "$TASKSET $cmd" ) > "$log" 2>&1 | |
| 45 | 46 | rc=$? |
| 46 | 47 | echo " exit $rc in $(( $(date +%s) - start ))s" |
| 47 | 48 | [ $rc -eq 0 ] || status=1 |
+39 −0 routes/little-fish/v1-rebuild-eth-vp-vnp/seed-deps.sh added View file
| @@ -0,0 +1,39 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Seed a project's .lake/packages with shallow clones at the revisions lake-manifest.json pins. | |
| 3 | +# | |
| 4 | +# usage: bash seed-deps.sh eth|vp-vnp | |
| 5 | +# | |
| 6 | +# Lake's own dependency fetch does a full `git clone` of every package, so Mathlib arrives with its | |
| 7 | +# whole history: about 1.5 GB over a link that here manages ~140 KB/s. Fetching just the pinned | |
| 8 | +# commit is a small fraction of that. Lake only checks that each package's checkout is at the | |
| 9 | +# manifest revision, so a shallow checkout is accepted. | |
| 10 | +set -uo pipefail | |
| 11 | +HERE="$(cd "$(dirname "$0")" && pwd)" | |
| 12 | +source "$HERE/env.sh" | |
| 13 | + | |
| 14 | +project="${1:?usage: seed-deps.sh eth|vp-vnp}" | |
| 15 | +cd "$WORK/tools/formal-math/$project" || exit 1 | |
| 16 | + | |
| 17 | +python3 -c " | |
| 18 | +import json | |
| 19 | +for p in json.load(open('lake-manifest.json'))['packages']: | |
| 20 | + print(p['name'], p['url'], p['rev']) | |
| 21 | +" | while read -r name url rev; do | |
| 22 | + dir=".lake/packages/$name" | |
| 23 | + if [ "$(git -C "$dir" rev-parse HEAD 2>/dev/null)" = "$rev" ]; then | |
| 24 | + echo "$name: already at ${rev:0:12}" | |
| 25 | + continue | |
| 26 | + fi | |
| 27 | + echo "$name: fetching ${rev:0:12} from $url" | |
| 28 | + rm -rf "$dir" | |
| 29 | + mkdir -p "$dir" | |
| 30 | + git -C "$dir" init -q | |
| 31 | + git -C "$dir" remote add origin "$url" | |
| 32 | + for try in 1 2 3 4 5; do | |
| 33 | + git -C "$dir" fetch -q --depth 1 origin "$rev" && break | |
| 34 | + echo " $name: fetch attempt $try failed, retrying" | |
| 35 | + sleep 5 | |
| 36 | + done | |
| 37 | + git -C "$dir" checkout -q FETCH_HEAD || { echo " $name: FAILED"; continue; } | |
| 38 | + echo "$name: $(git -C "$dir" rev-parse HEAD)" | |
| 39 | +done | |