Yang–Mills: the 2026 Lean construction, rerun and read; the mass gap still open
OpenAI's 2026 Lean construction of 4D Yang–Mills as the expert group keeps it: settle what it proves, rerun it, read it; uniqueness and the mass gap are open, and Clay's problem unsolved

Bring the check, the baseline search and what is known
Browse files+8 −0 .gitignore added View file
| @@ -0,0 +1,8 @@ | ||
| 1 | +.lake/ | |
| 2 | +*.olean | |
| 3 | +__pycache__/ | |
| 4 | +.venv/ | |
| 5 | +metrics.json | |
| 6 | +*-metrics.json | |
| 7 | +*.log | |
| 8 | +.DS_Store | |
+186 −0 AGENTS.md added View file
| @@ -0,0 +1,186 @@ | ||
| 1 | +# AGENTS.md | |
| 2 | + | |
| 3 | +Read [README.md](README.md) first, then `KNOWN.md`. `main` is OpenAI's October 2026 Lean proof that four-dimensional | |
| 4 | +quantum Yang–Mills theory exists as a scaling limit of Wilson lattice gauge theory. What we want: what it proves | |
| 5 | +settled by reruns and readings (the group's stronger acceptance theorem built here, the free-field proof of the public | |
| 6 | +statement rerun), a proof that people can read and build, and the open parts (uniqueness, the gap) stated honestly. A | |
| 7 | +change that makes the code shorter or faster but harder to read is not welcome. | |
| 8 | + | |
| 9 | +Never describe a change here as progress on the mass gap or on the Millennium problem. The theorem is fixed, and only | |
| 10 | +its proof changes. The mass gap is not proved, here or anywhere. Do not write that Yang–Mills is "solved" or "half | |
| 11 | +solved". Do not call the committee "independent" without saying OpenAI asked it. | |
| 12 | + | |
| 13 | +## First session | |
| 14 | + | |
| 15 | +In your clone of this project, with Python 3 and no Lean (the clone is large: 9,477 Lean files): | |
| 16 | + | |
| 17 | +```bash | |
| 18 | +python3 checks/challenge.py . # last line: ok: 5 challenge files and the build configuration as approved; … | |
| 19 | +git fetch origin issues && git show origin/issues:BOARD.md # the pieces, and who works on what | |
| 20 | +cat ChallengeSpec.lean # the public statement, 190 lines; JointExistence is its last definition | |
| 21 | +``` | |
| 22 | + | |
| 23 | +Then pick one piece nobody holds. Each issue says what to do, what it needs (reading only, compiling one file, or a | |
| 24 | +full build on a large machine), when it closes and what it does not show. By what you have: | |
| 25 | + | |
| 26 | +- **No Lean, reading only**: one of the group's eight checks against the Lean (V-10 to V-17, one each), V-3 (Clay's | |
| 27 | + statement against A1 to A8 and the Lean), T-3, R-2, L-1 (one row of the table). | |
| 28 | +- **A laptop, no Lean**: V-1 (the package's hashes with code of your own), C-1, S-3 (the import graph without a build). | |
| 29 | +- **A laptop with elan**: V-9 (Armstrong's compiled build: open one file and trace one definition), R-3 or R-4 (state | |
| 30 | + the gap or uniqueness, prove nothing), V-7 (the free-field proof, 72 files). | |
| 31 | +- **A large machine** (a clean build takes hours and about 52 GiB): V-2, V-6, P-1 and the other folder pieces, S-1. | |
| 32 | + | |
| 33 | +## Reruns and readings | |
| 34 | + | |
| 35 | +A rerun of anything (this project, the group's checks, a claim made elsewhere) is a dated record in | |
| 36 | +`routes/<your-branch>/RERUN.md`, one section per run, never replaced: a later run is a new section. The one template: | |
| 37 | + | |
| 38 | +```markdown | |
| 39 | +## 2026-12-02: <what was rerun>, by <who> (<which agent, if one ran it>) | |
| 40 | + | |
| 41 | +- Machine: <CPU model, cores, RAM, OS>; <your own machine, or the site's job number> | |
| 42 | +- Image: <the image tag and id, or `lean --version` and the Mathlib commit; Comparator, lean4export and Landrun or a stand-in> | |
| 43 | +- Commit: <repository URL and the full commit that was rerun> | |
| 44 | +- Command: <each command as typed, with its exit code and wall time> | |
| 45 | +- What it printed: <the lines that carry the verdict, copied, not paraphrased> | |
| 46 | +- What was not checked: <every part of the claim this run does not cover; "none" is almost never true> | |
| 47 | +``` | |
| 48 | + | |
| 49 | +A reading (one of the group's checks against the Lean, a statement against Jaffe and Witten) is a note in the path its | |
| 50 | +piece names, each verdict with the page, the file and the line it rests on. Both close when a second party (someone | |
| 51 | +else's agent, or the house's maintainer agent) has checked them and said so in a review. A rerun says what ran; it | |
| 52 | +never says the theorem is Yang–Mills, and never anything about the gap. | |
| 53 | + | |
| 54 | +## Claim an issue | |
| 55 | + | |
| 56 | +Work on a branch of your own, and say what you take in its notes: | |
| 57 | + | |
| 58 | +```bash | |
| 59 | +git switch -c my-change origin/main | |
| 60 | +mkdir -p routes/my-change | |
| 61 | +cat > routes/my-change/README.md <<'EOF' | |
| 62 | +--- | |
| 63 | +issue: 3 | |
| 64 | +status: working | |
| 65 | +--- | |
| 66 | +# my-change | |
| 67 | + | |
| 68 | +Which files, and what I change in them. | |
| 69 | + | |
| 70 | +## Next | |
| 71 | + | |
| 72 | +The first concrete step. | |
| 73 | +EOF | |
| 74 | +``` | |
| 75 | + | |
| 76 | +A push keeps the claim alive. If you stop, leave `## Next` so whoever continues knows where you stopped. Your change | |
| 77 | +itself is in the Lean files, anywhere in the repository; the notes say what it is. | |
| 78 | + | |
| 79 | +## Changes we want | |
| 80 | + | |
| 81 | +- Using a result from Mathlib in place of our own proof of it, and deleting ours. Check that the statements agree, | |
| 82 | + hypotheses included. If Mathlib states it in another form, keep our lemma as a short wrapper rather than adding a | |
| 83 | + conversion at every caller. | |
| 84 | +- Deleting declarations and files that `Solution.lean` does not need. Say how you found that nothing uses them. The | |
| 85 | + submission's `verification/module-usage.tsv` and `declaration-usage.tsv` are a start, not proof. | |
| 86 | +- Renaming a folder or file whose code name says nothing (`YM/RG08/Mason`) to one that says what it proves, with a | |
| 87 | + module docstring, one folder at a time. | |
| 88 | +- Proving once, as a lemma, an argument that appears several times, and using it everywhere. | |
| 89 | +- Splitting a long proof into lemmas with names and docstrings. A comment that explains a step moves with it. | |
| 90 | +- Fixing linter warnings and deprecations, and wrong docstrings. A docstring says what its declaration states, | |
| 91 | + including both directions of an `iff`. | |
| 92 | +- The group's acceptance checks (`YMReview.Acceptance.combined_acceptance`, `YMReview.OPE.constructed` and the modules | |
| 93 | + they import) built against this tree, in new files with the group's notices (V-6); whether they become fixed | |
| 94 | + statements is a ruling for a person. | |
| 95 | +- A definition that states uniqueness of the limit or the mass gap for this construction, with no theorem claimed and | |
| 96 | + no `sorry` (R-3, R-4), and lemmas proved on the hierarchy's own definitions with every hypothesis in the theorem's | |
| 97 | + name (R-5). | |
| 98 | + | |
| 99 | +## Changes we don't want | |
| 100 | + | |
| 101 | +- Inlining a lemma into its only caller, or folding helper lemmas or named `have` steps into one long proof. A step | |
| 102 | + with a name still tells the reader what it proves. | |
| 103 | +- Cutting an `iff` down to one direction, or dropping conclusions from a lemma, because no caller needs them. | |
| 104 | +- Replacing `simp` with a long `simp only [...]` list, or expanding a tactic into many hand-written steps, to save a | |
| 105 | + second or a few lines. | |
| 106 | +- A `simp` or other flexible tactic followed by steps that depend on the exact form it leaves. Make it the last step, | |
| 107 | + or use `simp only`. | |
| 108 | +- A new `maxHeartbeats` or `maxRecDepth` override without a timing that shows it is needed. | |
| 109 | +- Adding or changing a reference to the literature without checking it against the source. Say which edition you | |
| 110 | + checked and give the theorem number. | |
| 111 | +- Removing or rewording the attributions in `NOTICE` or in the files it names, or `LICENSE`, `THIRD_PARTY.md` and | |
| 112 | + `third_party_licenses/`. A file NOTICE names may be moved or split: then update NOTICE to say where the passage went. | |
| 113 | +- Any change to `Challenge.lean`, `ChallengeSpec.lean`, `PublicWilson.lean`, `PublicTheory.lean`, `comparator.json` | |
| 114 | + or `checks/`: the `challenge` check fails it. It also fails a change to `lakefile.toml` beyond a `require`'s `rev`, | |
| 115 | + `leanOptions`, `defaultTargets`, `lean_exe` or `[cache]`, a dependency outside leanprover and leanprover-community, a | |
| 116 | + `lakefile.lean`, or files under `.lake/`. If you think a statement is wrong, or want a new fixed statement (the | |
| 117 | + acceptance theorem, a mass gap, uniqueness), open an issue titled "Ruling: …" and say why. | |
| 118 | + | |
| 119 | +## Pull requests | |
| 120 | + | |
| 121 | +Keep each pull request to one change; fixing linter warnings in the files you edit doesn't count as a second one. | |
| 122 | +Compile what you changed if you can (`lake exe cache get`, then `lake build` of the modules you changed); if you | |
| 123 | +cannot, push and let the `build` check say. Either way, open the pull request, and don't write in it that it builds: | |
| 124 | +`build` says that. Titles follow [Mathlib's convention](https://leanprover-community.github.io/contribute/commit.html). | |
| 125 | +In the description, name the issue it answers (`Closes #3`), say in two or three sentences what the change does and why | |
| 126 | +it makes the proof easier to read, and keep the title and description in step with the diff when you push more | |
| 127 | +commits. Leave out timings and heartbeat counts unless speed is the reason for the change; then give the few numbers a | |
| 128 | +maintainer needs to decide, per declaration where you can, and say how you measured them. | |
| 129 | + | |
| 130 | +If you want to make the same kind of change in many places, open one pull request first and wait for the maintainer to | |
| 131 | +say we want it before you open the others. | |
| 132 | + | |
| 133 | +## CI | |
| 134 | + | |
| 135 | +Two checks run on every push, and a third, `replay`, is the maintainer's; all three gate the merge. Their code is | |
| 136 | +`checks/` at the approved version, so editing it on your branch changes nothing about your verdict. | |
| 137 | + | |
| 138 | +- **`challenge`**, seconds: the five Comparator challenge files and the build configuration are as approved, and the | |
| 139 | + source has no `sorry`, `admit`, `axiom`, `native_decide`, `implemented_by` or `extern`. Run it yourself: | |
| 140 | + `python3 checks/challenge.py .` | |
| 141 | +- **`build`**: in the project's Lean image with no network, `lake build` ends without error, no module reports | |
| 142 | + `sorry`, and the theorems use no axiom beyond `propext`, `Quot.sound` and `Classical.choice`. It does not run | |
| 143 | + Comparator: its last line says what held and "not replayed". Its logs are kept with the job. If you can build, run | |
| 144 | + `lake exe cache get && lake build` before you push; if you cannot, push and let `build` say. | |
| 145 | +- **`replay`**: the full replay, Comparator on `comparator.json` with Lean's kernel and the pinned tools | |
| 146 | + (`docker/README.md`), which the maintainer's machine runs on a pull request's head once `build` has passed there, | |
| 147 | + and on `main` when it moves (about half an hour), and reports itself. You do nothing for it and need not wait for | |
| 148 | + it; the merge does. | |
| 149 | + | |
| 150 | +A toolchain or Mathlib bump passes `challenge`, but `build` needs a new image first (`docker/README.md`). Lean 4.32.0 | |
| 151 | +is old, so a bump is a large change: open an issue for a person who maintains the project rather than a pull request | |
| 152 | +that cannot pass. | |
| 153 | + | |
| 154 | +## For the maintainer | |
| 155 | + | |
| 156 | +The house's maintainer agent (`yang-mills-maintainer`) comes about every two hours while people work here, at least twice a | |
| 157 | +day, and within minutes when written to. It reviews (first line ``**Review of `<commit>`: <verdict>**``), does not | |
| 158 | +merge, logs each round on the issue "Maintainer log", and opens `Ruling: …` issues (`needs-person`) for what only a | |
| 159 | +person decides. Here, as an `open` problem: | |
| 160 | + | |
| 161 | +- **Claims rerun** (skill `verify-claim`): a pull request's claim is rebuilt in the project's Lean image with the | |
| 162 | + approved checks (the standalone Comparator), `#print axioms` read, and recorded in a dated `RERUN.md`. | |
| 163 | +- **The ledger** (skill `ledger`) in "Where it stands": what main proves and in which setting (the lattice, the | |
| 164 | + dimension, the gauge group), each claim made here or elsewhere with one of the README's four statuses and who | |
| 165 | + reproduced it. Nothing is ever called progress on the mass gap or the Millennium problem. | |
| 166 | +- **Main replayed** in full (`house/maintainer/replay.sh`) at the start of a round when it moved. | |
| 167 | +- **Sources watched**: `yang-mills-group/YM` (the upstream) and new arXiv preprints in math-ph and hep-th that state a | |
| 168 | + mass-gap result for a lattice or continuum gauge theory. | |
| 169 | + | |
| 170 | +Judge every pull request against the two lists above: whether the proof is easier to read after it, not only whether | |
| 171 | +it is shorter or faster. | |
| 172 | + | |
| 173 | +- **Merge** a change we want once `challenge` and `build` have passed on its head, and the description says what it | |
| 174 | + changes and why. | |
| 175 | +- **Request changes** when the description and the diff disagree, when it is two changes in one, when it is on the | |
| 176 | + second list (say which item), or when a reference is added without the edition and theorem number. | |
| 177 | +- **Request changes** when `challenge` or `build` failed: quote the check's last line. | |
| 178 | +- **Request changes** when a description calls the change progress on the mass gap or the Millennium problem. | |
| 179 | +- **Escalate** a change to the five challenge files, to `checks/` or `docker/`, to `lakefile.toml`'s libraries or | |
| 180 | + dependencies, a new dependency, a change to `NOTICE` or the licence files, or two reviews that disagree: say in one | |
| 181 | + sentence what a person must decide. | |
| 182 | +- **Close** a repeat of a change already merged or open, pointing to it, and a mass change opened before the first of | |
| 183 | + its kind was wanted. | |
| 184 | + | |
| 185 | +Never merge on the author's word that it builds: only `build` on its head says so. After a merge, add to `KNOWN.md` | |
| 186 | +what changed and, if it took a lemma from Mathlib, which one. | |
+151 −51 README.md View file
| @@ -1,56 +1,156 @@ | ||
| 1 | -# Wilson Yang–Mills construction | |
| 2 | - | |
| 3 | -Project license: [Apache-2.0](LICENSE). [Source attributions](NOTICE) · [Third-party library licenses](THIRD_PARTY.md) | |
| 4 | - | |
| 5 | -## The public challenge | |
| 6 | - | |
| 7 | -[YangMills.jointExistence](Solution.lean) proves [JointExistence](ChallengeSpec.lean). The reference [Challenge.lean](Challenge.lean) has a Mathlib-only import closure. Its starting point is an earlier challenge at revision eea94292e31734d46498be7836d7e8fa50ca8cd2. | |
| 8 | - | |
| 9 | -For each closed matrix subgroup with nonabelian simple real Lie algebra, choose one Wilson lattice family. For every strictly increasing sequence of volumes, it has a subsequence and a continuum hierarchy with the following properties. | |
| 10 | - | |
| 11 | -- **Wilson origin.** Finite moments integrate products of local insertions against the normalized exponential of the plaquette action on the given group, with product Haar measure. For each insertion a finite set of offsets in lattice units controls every measurement, at every spacing and volume. Changing links outside that patch leaves the insertion unchanged. The ratio of the bare action coefficient to the logarithm of inverse lattice spacing tends to a positive slope, uniformly in the volume. Separated test-function moments have the full mesh limit at suitable fixed volumes, then the asserted volume limit. [Lattice and limits](PublicWilson.lean) · [Wilson bridge](WilsonBridge.lean) | |
| 12 | -- **Wightman reconstruction.** The selected phase has a normalized cyclic vacuum, faithful tempered fields on a common dense domain, positive energy, a unique translation-invariant vacuum up to scalar, covariance and spacelike locality. The symmetry coordinates cover every proper orthochronous affine Poincaré transformation and determine the inverse pullback on test functions. Analytic continuation recovers the selected Euclidean hierarchy at ordered imaginary times and its Wightman vacuum moments on product tests. Integrating the character correlations gives the unselected Wilson limit. The character measure has full support and the separated correlations vary continuously with the character. [W0–W3](PublicTheory.lean) · [Reconstruction bridge](HierarchyBridge.lean) | |
| 13 | -- **All-orders separated OPE.** For each finite cluster and collection of separated spectators, use a single system of coefficients at every truncation degree and in every phase. Both the full word and each term with the cluster replaced by a local insertion are reads of the same hierarchy. The bounds are uniform at all sufficiently small radii for the specified cluster size and separation constants. Permutation symmetry and smoothness hold off the collision diagonals. [Public estimates](ChallengeSpec.lean) · [Derivation of the compact-set bounds](verification/CompactCheck.lean) | |
| 14 | -- **Non-freeness test.** A centered grade-four field has a two-point function with a positive short-distance coefficient of three times the real Lie-algebra dimension divided by π⁴, after multiplication by r⁸ log²(1/r). No finite sum of the specified mass-shell Wick profiles agrees with it at all sufficiently small radii. The detailed theorem identifies this field as the physical centered stress trace and supplies the distributional Wick and Maxwell tests. [Trace bridge](TraceBridge.lean) | |
| 15 | - | |
| 16 | -[The SU(2) specialization](ConcreteSU2.lean) uses the defining representation and the included proof of simplicity. | |
| 17 | - | |
| 18 | -## The detailed construction theorem | |
| 19 | - | |
| 20 | -[YangMills.constructed](Construction.lean) quantifies over each positive blocking-kernel penalty. It chooses the family once, then refines each requested mesh/volume order. Each refinement has one table, one selected Wightman reconstruction, a reconstruction for every character, one OPE reader and a set of contact devices using that reader’s field basis. The public theorem is a projection of this result. | |
| 21 | - | |
| 22 | -- The reader also satisfies integrated single-center estimates and admissible nested OPE estimates. The centered stress trace has countertests to finite Wick-polynomial correlators and to Maxwell Fock realizations obeying the stated physical-wave, vacuum, translation and locality conditions, including the specified invariant-sector test. [Exact statements](YM/Nonperturbative/HeadlineSpec.lean) | |
| 23 | -- The Euclidean contact construction produces continuous distributions on compact smooth tests, at every arity and in every phase. Their restriction to separated configurations agrees with this table’s ordinary correlations. The detailed theorem also retains the collision-resolution estimates, the field-basis identity and the admissible thresholds. This supplies an extension for the constructed prescription. Uniqueness over other contact prescriptions and raw cutoff convergence on collision diagonals are outside the claim. [Restriction proof](ContactBridge.lean) · [Full contact specification](YM/Contacts/Solstice/Result.lean) | |
| 24 | -- The same witnesses retain the leading position-space test comparison in the constructed moving frames. [Continuum theorem](YM/Nonperturbative/Continuum.lean) · [Position-test statement](YM/Pert/Position/Four.lean) | |
| 25 | - | |
| 26 | -The volume limit allows refinement. The Wightman spectrum condition and uniqueness of the vacuum are the spectral conclusions in the public challenge. A positive mass gap, general exclusion of continuous-mass generalized free fields and all-orders MS-bar matching are outside its scope. | |
| 27 | - | |
| 28 | -## Verification | |
| 29 | - | |
| 30 | -The archive includes all YM project sources. A first build requires Git, Lean 4.32.0 (or elan to install it), and access to the nine public repositories pinned in the Lake manifest, or a populated dependency cache. From the extracted directory run | |
| 1 | +# Yang–Mills: the 2026 Lean construction, rerun and read; the mass gap still open | |
| 2 | + | |
| 3 | +What is established, and by whom: Lean's kernel accepts OpenAI's October 2026 proof of a four-dimensional quantum | |
| 4 | +Yang–Mills construction for its public statement, and the expert group judged in its assessment of 2026-11-10, by | |
| 5 | +stronger checks of its own, that it constructs a Wightman theory (existence; whether in the sense Clay asks is | |
| 6 | +disputed). Uniqueness and the mass gap are open, and nobody claims them. Clay's problem is unsolved. | |
| 7 | + | |
| 8 | +This project is that construction as the Yang–Mills group keeps it: what it proves settled here by reruns and | |
| 9 | +readings, the code made readable, and the open parts stated honestly. Nothing here claims the Millennium problem, or | |
| 10 | +any part of it, is solved. | |
| 11 | + | |
| 12 | +## Where it stands (as of 2026-12-02) | |
| 13 | + | |
| 14 | +Clay's problem is one statement: a four-dimensional quantum Yang–Mills theory **with** a mass gap (Jaffe and Witten, | |
| 15 | +the official description). Clay's page says "Unsolved" and "no proof of this property is known" | |
| 16 | +(<https://www.claymath.org/millennium/yang-mills-the-maths-gap/>, read 2026-12-02); Clay has said nothing about the | |
| 17 | +2026 work. No one, OpenAI and the group included, claims uniqueness or a mass gap for this construction. On the lattice | |
| 18 | +a mass gap is proved only at strong coupling, the opposite end from the continuum limit (Shen, Zhu and Zhu 2022), and | |
| 19 | +for finite gauge groups (Adhikari and Cao 2025). | |
| 20 | + | |
| 21 | +The claims of 2026, and how far each has been checked. Four statuses: **Lean-checked, statement read** (a Lean proof | |
| 22 | +passes the kernel, and a named person outside its authors has said in public that its statement says what is claimed); | |
| 23 | +**Lean-checked, statement unread** (the proof passes; nobody outside its authors has said that of the statement); | |
| 24 | +**written argument, unread** (a paper or note no reader outside its authors has said they checked); **refuted** (shown | |
| 25 | +wrong, with the source). Nothing in the table has been rerun in this project yet: the pieces named beside each row are | |
| 26 | +how that changes. | |
| 27 | + | |
| 28 | +| Date | Claim | Who, where | Status | | |
| 29 | +|---|---|---|---| | |
| 30 | +| 2026-05-04 | A lattice mass gap (exponential decay of plaquette correlations) for U(n) Wilson theory at strong coupling, β < 1/(32n(d−1)) | Douglas and Rajasekaran, github.com/mrdouglasny/lgt | Lean-checked, statement unread: by the authors' record (R-6) | | |
| 31 | +| 2026-06-09 | A 4D SU(N) theory "with Mass Gap and Confinement" | Faizal and Shabir, arXiv:2606.19362 | written argument, unread: no expert assessment found | | |
| 32 | +| 2026-10-27 | Existence: `YangMills.jointExistence`, a Wightman theory with a separated operator product expansion and a non-free field, as a subsequential scaling limit of 4D Wilson lattice gauge theory, for every compact simple gauge group | OpenAI; received by the group on 2026-10-27 (archive label `20261028`), kept at github.com/yang-mills-group/YM; this project's starting point | Lean-checked, statement read: the group read it and found it "initially a bit too weak to establish that the theory constructed is Yang–Mills theory" (4th statement, 2026-11-25); Comparator accepted it on 2026-10-30 on a Mac, without isolation or a second kernel (V-2, V-3) | | |
| 33 | +| 2026-11-03, 2026-11-05 | The group's stronger statements of its own, `YMReview.Acceptance.combined_acceptance` (checks A1 to A8) and `YMReview.OPE.constructed`, proved from the same construction | the Yang–Mills group (Douglas, Gross as chair, Jaffe, Klebanov, Nekrasov), github.com/yang-mills-group/YM | Lean-checked, statement unread: its specification calls itself "a proposed acceptance specification, not a record of human signoff". On it rests the group's assessment of 2026-11-10: "In our judgment the submission proves that a relativistic quantum field theory satisfying the Wightman axioms can be constructed …", "It does not prove that the infinite-volume limit is unique or that there is a mass gap", "We do not claim to fully understand the proof yet" (V-6, V-10 to V-17) | | |
| 34 | +| 2026-11-04 | Matching to a specified perturbative reference at every finite order | OpenAI's second package, kept by the group (github.com/yang-mills-group/OpenAI-YM-20261104) | Lean-checked, statement unread: "Agreement of that reference with conventional Yang–Mills perturbation theory remains under review"; one ghost-loop equality "remains unproved in Lean" (V-4) | | |
| 35 | +| 2026-11-13 | The public statement `YangMills.JointExistence` also holds for a generalized free field, "a theory with no Yang–Mills content" | humanise-yang-mills, its pull request #339 | Lean-checked, statement unread: "No human has read the Lean"; it "shows no defect in the upstream Lean proof" (V-7, V-8) | | |
| 36 | +| 2026-11-15 | SU(2) only: a subsequential continuum limit of the plaquette energy, with the Osterwalder–Schrader axioms for that one observable | Alpöge and Sussman, github.com/ethanwsussman/Yang--Mills-LLM-experiment (Lean public 2026-11-21) | Lean-checked, statement unread: "has not been satisfactorily vetted"; the group lists it as work in progress (V-5) | | |
| 37 | +| 2026-11-28 | A lattice mass gap for an anisotropic model with some couplings small; for the isotropic model at any β "so far an open problem" | Hao Shen, arXiv:2611.39042 | written argument, unread | | |
| 38 | + | |
| 39 | +Whether a subsequential limit taken by compactness counts as the existence the problem asks is disputed: Jaffe and | |
| 40 | +Witten's footnote 2 excludes it "unless one also uses other techniques to establish properties of the limit (such as the | |
| 41 | +existence of a mass gap and the axioms)"; the group's 3rd statement (2026-11-09) says the submission proves existence | |
| 42 | +"according to the problem statements which are standard"; Peter Woit (2026-11-25) calls claims that it "solves half of | |
| 43 | +the Millennium prize problem" "simply untrue". The group was asked by OpenAI, used OpenAI's model in its analysis, and | |
| 44 | +says it has "no present connection to the Clay Mathematics Institute". | |
| 45 | + | |
| 46 | +**What the Lean here shows.** That Lean's kernel accepts a proof of `YangMills.jointExistence` from OpenAI's | |
| 47 | +construction: for each compact simple gauge group, a subsequence of Wilson lattice theories whose limit is a Wightman | |
| 48 | +theory with the stated properties. **What it does not show.** That this is Yang–Mills theory in Jaffe and Witten's sense | |
| 49 | +(a generalized free field satisfies the same statement, and the group's stronger theorem is not in this tree yet), that | |
| 50 | +the infinite-volume limit is unique, or that there is a mass gap. | |
| 51 | + | |
| 52 | +## What this project is for | |
| 53 | + | |
| 54 | +The project started from the group's copy of OpenAI's submission (yang-mills-group/YM at | |
| 55 | +`319ecd5274241200b27bb5b143a59133fd670ea6`, folder `submissions/openai-20261028/submission`) on 2026-12-02, and it is its | |
| 56 | +own main line from then on: the Lean work is done here, and nobody re-pins it. The group takes no issues or pull | |
| 57 | +requests (intake by email, no reply promised), so this is an open place for the work around its package. Mostly Lean: | |
| 58 | + | |
| 59 | +- **Settle what it proves**: rerun the package's build and Comparator in isolation (V-2), bring the group's acceptance | |
| 60 | + theorem onto this tree so that the stronger statement is checked here on every push (V-6), rerun the free-field proof | |
| 61 | + (V-7) and say why the free field fails the stronger theorem, if it does (V-8), rerun the perturbative matching (V-4) | |
| 62 | + and Alpöge and Sussman's SU(2) construction (V-5). | |
| 63 | +- **Make it readable and smaller**: 9,477 files and about 988,000 lines, 2,453 linter warnings in the group's record, | |
| 64 | + folders with code names: fix the warnings folder by folder (P-1, P-5 to P-9), rename what reads like a tactic (P-2), | |
| 65 | + name folders after what they prove (P-3), delete what the solution does not reach (S-1, S-3), justify the | |
| 66 | + `maxHeartbeats` overrides (S-2), use Mathlib's lemmas (M-1), a reading guide (P-4). | |
| 67 | +- **The open parts, honestly, and hard**: state the mass gap for this construction and prove nothing (R-3), state | |
| 68 | + uniqueness of the limit (R-4), the conditional lemma "if the mixed limit clusters, all phases agree" (R-5), a | |
| 69 | + strong-coupling lattice gap for a group the construction covers (R-6), a larger proven strong-coupling region (R-1). | |
| 70 | +- **Read**: Clay's statement against the group's A1 to A8 and the Lean (V-3), each of the eight checks (V-10 to V-17), | |
| 71 | + the argument written as mathematics (T-1 to T-3), whose work it rests on (R-2), the table above (L-1), and one | |
| 72 | + published lattice number recomputed (C-1). Reading pieces need no build: a share of the work, not its centre. | |
| 73 | + | |
| 74 | +## How to take part | |
| 75 | + | |
| 76 | +1. Read this page and [`AGENTS.md`](AGENTS.md). Its "First session" takes a few minutes and needs no Lean. | |
| 77 | +2. Pick one piece from the project's issues (titles start with a letter and a number: P, T, S, M, V, R, L, C). The goal | |
| 78 | + issue says where to start by what you have: reading only, a laptop (Scott Armstrong's compiled build lets one file | |
| 79 | + compile without a full build, V-9), or a large machine (a clean build takes hours and about 52 GiB). | |
| 80 | +3. Claim it with a branch and a note in `routes/<your-branch>/README.md` (AGENTS.md shows how), and for a folder piece | |
| 81 | + name the subfolder you hold there, so that two people do not take the same one. Then one change, one pull request. | |
| 82 | +4. A rerun is a dated record in `routes/<your-branch>/RERUN.md`, in the one template AGENTS.md gives: machine, image, | |
| 83 | + commit, command, what it printed, what was not checked. | |
| 84 | + | |
| 85 | +## How work is judged, and when | |
| 86 | + | |
| 87 | +- **Two checks on every push, and the maintainer's `replay`**, all needed for a merge, their code `checks/` at the approved version: `challenge`, in | |
| 88 | + seconds (the six fixed files as approved, the build configuration too, no `sorry`, `admit`, `axiom`, | |
| 89 | + `native_decide`, `implemented_by` or `extern`); `build`, in the project's Lean image with no network: `lake build` | |
| 90 | + ends without error, no declaration uses `sorry`, and the theorems use only the three standard axioms; Comparator does | |
| 91 | + not run on a push. The third, `replay`, is the full replay, Comparator on `comparator.json` with Lean's kernel (about | |
| 92 | + half an hour), which the maintainer's machine runs on a pull request's head once `build` has passed there and reports | |
| 93 | + by itself; the merge waits for it. The image holds main already built, so a commit compiles what it changed; how long one `build` takes on | |
| 94 | + production had not been measured on 2026-12-02 (its limit is 12 hours). | |
| 95 | +- **The site's reading** reads each pull request within minutes of a push and takes it in when the checks and the | |
| 96 | + evidence its piece asks for are there. | |
| 97 | +- **The house's maintainer agent** (`yang-mills-maintainer`) comes about every two hours while people are working here, and | |
| 98 | + at least twice a day. It reruns what a pull request claims, reviews it with a first line "Review of `<commit>`: ready", | |
| 99 | + "changes needed", "needs a person" or "not finished", keeps the table above, and writes one line a round in the | |
| 100 | + "Maintainer log" issue. A question written to it in the channels or with `@yang-mills-maintainer` is answered within | |
| 101 | + minutes. | |
| 102 | +- **A person** decides what no written rule settles: a new statement (the acceptance theorem as a second challenge, a | |
| 103 | + statement of uniqueness or of the gap), a change to the fixed files, two reviews that disagree, any claim about the | |
| 104 | + mass gap. | |
| 105 | + | |
| 106 | +## The statement | |
| 107 | + | |
| 108 | +[`Solution.lean`](Solution.lean) proves `YangMills.jointExistence : YangMills.JointExistence`. For each closed matrix | |
| 109 | +subgroup with nonabelian simple real Lie algebra it chooses one Wilson lattice family; for every strictly increasing | |
| 110 | +sequence of volumes it gives a subsequence and a continuum hierarchy with: a Wilson origin (finite moments are integrals | |
| 111 | +against the Wilson plaquette action, the bare coupling runs logarithmically in the spacing, the mesh limit then the | |
| 112 | +volume limit along the subsequence); a Wightman reconstruction (vacuum, tempered fields, positive energy, a unique | |
| 113 | +translation-invariant vacuum, Poincaré covariance, spacelike locality); a separated operator product expansion at all | |
| 114 | +orders; and a grade-four field that no finite sum of free-field profiles matches. | |
| 115 | + | |
| 116 | +The statement is in [`ChallengeSpec.lean`](ChallengeSpec.lean), on [`PublicWilson.lean`](PublicWilson.lean) and | |
| 117 | +[`PublicTheory.lean`](PublicTheory.lean), which import only Mathlib. [`Challenge.lean`](Challenge.lean) states the | |
| 118 | +theorem with `sorry`; [`comparator.json`](comparator.json), as the submission has it, has Comparator check that | |
| 119 | +`Solution` proves exactly that statement on the three standard axioms. **These five files are fixed**, with | |
| 120 | +`verification/Inventory.lean` (the submission's scan for placeholders, which names `sorryAx` in a metaprogram), and so | |
| 121 | +is the build configuration as far as Comparator depends on it. The statement includes no mass gap and no unique | |
| 122 | +infinite-volume limit. | |
| 123 | + | |
| 124 | +## Build and layout | |
| 125 | + | |
| 126 | +The submission uses Lean 4.32.0 and Mathlib `81a5d257`: | |
| 31 | 127 | |
| 32 | 128 | ```sh |
| 33 | 129 | lake exe cache get |
| 34 | -lake build WilsonReference WilsonConstruction | |
| 35 | -lake env lean -j1 -DmaxHeartbeats=0 -DmaxRecDepth=4096 VerifyJoint.lean | |
| 36 | -lake env lean -j1 -DmaxHeartbeats=0 verification/Usage.lean | |
| 37 | -lake env lean -j1 verification/CompactCheck.lean | |
| 130 | +lake build # WilsonReference and WilsonConstruction | |
| 131 | +lake env comparator comparator.json | |
| 38 | 132 | ``` |
| 39 | 133 | |
| 40 | -[VerifyJoint.lean](VerifyJoint.lean) imports the solution and loads the reference in a separate environment. It checks the exact theorem type, compares the reachable public definitions, audits the permitted axioms, and replays the reachable project declarations in a kernel environment that initially contains only external libraries. The only placeholder in the new files is the reference theorem in Challenge.lean. Solution.lean imports the definitions and the construction. The reference proof is absent from its imports. | |
| 41 | - | |
| 42 | -[Verification log](verification/joint-check.log) · [Headline roots](verification/joint-headlines.txt) · [Frozen reference source hashes](verification/challenge.sha256) · [Standard Comparator configuration](comparator.json) | |
| 43 | - | |
| 44 | -Stock Lake resolved the reference, solution and SU(2) import graphs from an extracted copy using the pinned external packages. The reference has zero YM implementation imports. [Lake import check](verification/archive-graph.log) · [Weakened-statement and unproved-axiom controls](verification/negative-controls.log) | |
| 45 | - | |
| 46 | -[The compact-set check](verification/compact-check.log) derives a uniform norm bound on the complete degree-j coefficient vector and the remainder estimate over every compact separated cluster and spectator set. It uses only the public OPE definition. | |
| 47 | - | |
| 48 | -The public reference was built with only the pinned external libraries on the search path. The solution build re-elaborated all new modules and reused compiled modules of the previously checked Wilson release. The pinned Lean kernel replayed 100,168 project declarations for the 17 advertised results and found only the standard axioms of propositional extensionality, classical choice and quotient soundness. The standalone Comparator executable was not run. [Earlier build record](verification/build.log) | |
| 49 | - | |
| 50 | -## Source coverage | |
| 51 | - | |
| 52 | -The 17 audited theorems reach 100,168 of 250,319 imported project declarations. The tables flag the other 150,151. The 9,458 pre-existing YM modules were matched to their original build inputs. Nine modules carry source credits. Of the eight covered by the recorded credited-source recompile, seven had byte-identical compiled files. In the remaining module, the imports and all 149 kernel declarations, including their types and bodies, matched. [Build-input comparison](verification/source-match.log) · [Credited source checks](verification/attributions.log) | |
| 53 | - | |
| 54 | -[Declaration usage](verification/declaration-usage.tsv) lists the imported project declarations, whether a headline’s elaborated type or proof reaches each one, and a dependency path for reached declarations. [Module usage](verification/module-usage.tsv) gives the counts by module. These counts include declarations generated by Lean. Independent corollaries, helper lemmas used only during elaboration and import-only files can appear outside the proof terms. [Usage check](verification/Usage.lean) | |
| 55 | - | |
| 56 | -[SOURCES.sha256](SOURCES.sha256) covers the files in this source distribution, excluding the manifest itself. | |
| 134 | +The last line needs `comparator`, `lean4export` and `landrun` on `PATH`, at the group's pins (Comparator `d03acab1`, | |
| 135 | +lean4export `4e791520`; [`docker/README.md`](docker/README.md)). The group's passes used a stand-in for Landrun, so a | |
| 136 | +run with real isolation is a new mode, not a repeat. The group's clean build took 183.94 minutes on an Apple Silicon Mac | |
| 137 | +and left about 52 GiB (2026-10-29); a second site rebuilt it on Linux (humanise-yang-mills, 2026-11-12). | |
| 138 | + | |
| 139 | +- The public face at the root: `PublicTheory.lean`, `PublicWilson.lean`, `ChallengeSpec.lean`, `Challenge.lean` | |
| 140 | + (fixed); the bridges to the construction (`PublicView`, `WilsonBridge`, `HierarchyBridge`, `TraceBridge`, | |
| 141 | + `ContactSpec`, `ContactBridge`); `Construction.lean` (`YangMills.constructed`); `Solution.lean`; `ConcreteSU2.lean`. | |
| 142 | +- `YM/` (9,457 files in 102 folders): the construction, headline in `YM/Nonperturbative/Headlines.lean`. The largest | |
| 143 | + folders are `YM/Next`, `YM/PhysicalNext`, `YM/Push` and `YM/RG08`; many folder names are code names. | |
| 144 | +- `Verify.lean`, `VerifyJoint.lean`, `verification/`: the submission's own checks and records | |
| 145 | + (`verification/Inventory.lean`, its scan for placeholders and new axioms, is fixed like the challenge files). `routes/`: one folder | |
| 146 | + per branch that claimed a piece, with its notes and a rerun's `RERUN.md`. `checks/`, `docker/`: the two checks and | |
| 147 | + the Lean image. `KNOWN.md`: what is established and what to mind. `UPSTREAM.md`: the submission's README. | |
| 148 | + | |
| 149 | +## Before 2026-12-02 | |
| 150 | + | |
| 151 | +Until 2026-12-02 this project was a board of exact computations: lattice numbers recomputed by Monte Carlo and checked | |
| 152 | +by its `verify` check (the SU(2) plaquette, the lattice mass gap a·m_G, the continuum limit of m_0++/√σ), and a check | |
| 153 | +of the group's October package against its recorded hashes. Nobody had merged a result there; its Known page of | |
| 154 | +2026-12-01, with the package's recorded hashes, is in main's history, and the plaquette survives as C-1. | |
| 155 | + | |
| 156 | +The construction is OpenAI's; the package, its checks and its assessment are the Yang–Mills group's; thank you to both. | |
+128 −0 README.zh.md added View file
| @@ -0,0 +1,128 @@ | ||
| 1 | +# 杨-米尔斯:复跑、审读 2026 年的 Lean 构造;质量间隙仍然开放 | |
| 2 | + | |
| 3 | +已经确立的是什么、由谁确认:OpenAI 2026 年 10 月的四维量子杨-米尔斯构造,Lean 内核接受了它对公开陈述的证明;专家组在 | |
| 4 | +2026-11-10 的评估里,凭自己更强的检验,判断它构造出了一个 Wightman 理论(存在性;算不算克雷要的那种存在,有争议)。唯一 | |
| 5 | +性和质量间隙仍然开放,没有人声称证明了它们。克雷的题目仍未解决。 | |
| 6 | + | |
| 7 | +本项目就是这个构造,按杨-米尔斯专家组保存的样子放在这里:它到底证明了什么,靠复跑和审读来定;代码改得能读;开放的部分 | |
| 8 | +老老实实地写出来。这里的任何东西都不声称千禧年难题或它的任何一部分已经解决。 | |
| 9 | + | |
| 10 | +## 现状(截至 2026-12-02) | |
| 11 | + | |
| 12 | +克雷的题目是一句话:四维量子杨-米尔斯理论存在,**并且**有质量间隙(贾菲与威滕的官方题面)。克雷的题目页写着“Unsolved”, | |
| 13 | +以及“这一性质还没有证明”(<https://www.claymath.org/millennium/yang-mills-the-maths-gap/>,2026-12-02 读);克雷对 2026 年的 | |
| 14 | +工作没有发表任何说法。包括 OpenAI 和专家组在内,没有人声称这个构造的极限唯一或有质量间隙。格点上的质量间隙只在强耦合区 | |
| 15 | +有证明,那是连续极限的另一端(Shen、Zhu、Zhu 2022),以及有限规范群(Adhikari 与 Cao 2025)。 | |
| 16 | + | |
| 17 | +下表是 2026 年的声称,以及各自被核到哪一步。状态只有四种:**Lean 已核,陈述有人读过**(Lean 证明通过内核,且作者以外有具名 | |
| 18 | +的人公开说过它的陈述就是所声称的);**Lean 已核,陈述无人读过**(证明通过;作者以外没人这样说过它的陈述);**文字论证,无人 | |
| 19 | +读过**(论文或笔记,作者以外没有读者说核过);**已被推翻**(附推翻它的出处)。表里的东西本项目都还没有复跑过:每行旁边的 | |
| 20 | +子任务就是改变这一点的办法。 | |
| 21 | + | |
| 22 | +| 日期 | 声称 | 谁,在哪里 | 状态 | | |
| 23 | +|---|---|---|---| | |
| 24 | +| 2026-05-04 | U(n) Wilson 理论在强耦合区 β < 1/(32n(d−1)) 有格点质量间隙(plaquette 关联指数衰减) | Douglas 与 Rajasekaran,github.com/mrdouglasny/lgt | Lean 已核,陈述无人读过:据作者记录(R-6) | | |
| 25 | +| 2026-06-09 | 一个“有质量间隙和禁闭”的四维 SU(N) 理论 | Faizal 与 Shabir,arXiv:2606.19362 | 文字论证,无人读过:没找到专家评估 | | |
| 26 | +| 2026-10-27 | 存在性:`YangMills.jointExistence`,即对每个紧致单规范群,四维 Wilson 格点规范理论沿子序列的标度极限给出一个 Wightman 理论,带分离的算子乘积展开和一个非自由场 | OpenAI;专家组 2026-10-27 收到(存档标签 `20261028`),保存在 github.com/yang-mills-group/YM;本项目从它开始 | Lean 已核,陈述有人读过:专家组读后认为它“起初稍弱,不足以确立所构造的理论就是杨-米尔斯理论”(第 4 份声明,2026-11-25);Comparator 2026-10-30 在一台 Mac 上接受了它,没有隔离,没有第二个内核(V-2、V-3) | | |
| 27 | +| 2026-11-03、2026-11-05 | 专家组自己写的更强陈述 `YMReview.Acceptance.combined_acceptance`(检查 A1 至 A8)和 `YMReview.OPE.constructed`,由同一构造证出 | 杨-米尔斯专家组(道格拉斯、格罗斯任主席、贾菲、克列巴诺夫、涅克拉索夫),github.com/yang-mills-group/YM | Lean 已核,陈述无人读过:它的规格自称“一份拟议的验收规格,不是人工签字的记录”。专家组 2026-11-10 的评估建立在它之上:“我们判断这份提交证明了满足 Wightman 公理的相对论性量子场论可以构造出来……”“它没有证明无穷体积极限唯一,也没有证明存在质量间隙”“我们还不敢说已完全理解这个证明”(V-6、V-10 至 V-17) | | |
| 28 | +| 2026-11-04 | 在每个有限阶上与一个指定的微扰参照相匹配 | OpenAI 的第二个包,专家组保存(github.com/yang-mills-group/OpenAI-YM-20261104) | Lean 已核,陈述无人读过:“该参照与常规杨-米尔斯微扰论是否一致仍在审查”;有一个鬼圈等式“在 Lean 里仍未证明”(V-4) | | |
| 29 | +| 2026-11-13 | 公开陈述 `YangMills.JointExistence` 对一个广义自由场也成立,“一个没有杨-米尔斯内容的理论” | humanise-yang-mills,它的 PR #339 | Lean 已核,陈述无人读过:“没有人读过这份 Lean”;它“没有显示上游 Lean 证明有缺陷”(V-7、V-8) | | |
| 30 | +| 2026-11-15 | 只针对 SU(2):plaquette 能量沿子序列的连续极限,对这一个可观测量验证了 Osterwalder–Schrader 公理 | Alpöge 与 Sussman,github.com/ethanwsussman/Yang--Mills-LLM-experiment(Lean 2026-11-21 公开) | Lean 已核,陈述无人读过:“还没有得到令人满意的审核”;专家组列为进行中的工作(V-5) | | |
| 31 | +| 2026-11-28 | 某些耦合很小的各向异性模型有格点质量间隙;各向同性模型在任意 β 下“至今是开放问题” | Hao Shen,arXiv:2611.39042 | 文字论证,无人读过 | | |
| 32 | + | |
| 33 | +靠紧性取出的子序列极限算不算题目要的“存在”,有争议:贾菲与威滕题面的脚注 2 排除了这种做法,“除非另用其他技术确立极限的 | |
| 34 | +性质(比如质量间隙的存在和公理)”;专家组第 3 份声明(2026-11-09)说这份提交“按物理和数学中标准的题面”证明了存在性;Peter | |
| 35 | +Woit(2026-11-25)说称它“解决了千禧年难题的一半”的说法“完全不对”。专家组是应 OpenAI 之请组成的,分析中用了 OpenAI 的模型, | |
| 36 | +并说它与克雷数学研究所“目前没有关系”。 | |
| 37 | + | |
| 38 | +**这里的 Lean 说明了什么。** Lean 内核接受了 OpenAI 构造给出的 `YangMills.jointExistence` 的证明:对每个紧致单规范群,一列 | |
| 39 | +Wilson 格点理论沿子序列的极限是一个具有上述性质的 Wightman 理论。**没有说明什么。** 这就是贾菲与威滕意义下的杨-米尔斯理论 | |
| 40 | +(一个广义自由场也满足同一陈述,而专家组更强的定理还不在本仓库里);无穷体积极限唯一;存在质量间隙。 | |
| 41 | + | |
| 42 | +## 本项目做什么 | |
| 43 | + | |
| 44 | +本项目 2026-12-02 从专家组保存的 OpenAI 提交开始(yang-mills-group/YM 的 `319ecd5274241200b27bb5b143a59133fd670ea6`,文件夹 | |
| 45 | +`submissions/openai-20261028/submission`),此后是独立的主线:Lean 的工作都在这里做,不会再跟着上游更新。专家组不收 issue | |
| 46 | +和 PR(只收邮件,不保证回复),所以这里是围绕它那个包公开工作的地方。大部分是 Lean: | |
| 47 | + | |
| 48 | +- **定下它证明了什么**:隔离地复跑整个包的编译和 Comparator(V-2),把专家组的验收定理搬到本仓库,让更强的陈述在每次推送时 | |
| 49 | + 都在这里核(V-6),复跑自由场证明(V-7),说明自由场为什么不满足更强的定理(如果确实不满足,V-8),复跑微扰匹配(V-4)和 | |
| 50 | + Alpöge 与 Sussman 的 SU(2) 构造(V-5)。 | |
| 51 | +- **让它能读、变小**:9,477 个文件、约 98.8 万行,专家组记录里有 2,453 条 linter 警告,文件夹多用代号:一个文件夹一个文件夹地 | |
| 52 | + 修警告(P-1、P-5 至 P-9),改掉看着像策略的字段名(P-2),按内容给文件夹改名(P-3),删掉解答用不到的东西(S-1、S-3), | |
| 53 | + 为 `maxHeartbeats` 的放宽说明理由(S-2),换用 Mathlib 的引理(M-1),一份阅读指南(P-4)。 | |
| 54 | +- **开放的部分,老老实实,而且难**:为这个构造写出质量间隙的陈述、什么也不证(R-3),写出极限唯一性的陈述(R-4),条件引理 | |
| 55 | + “若混合极限有聚集性,则所有相一致”(R-5),对构造覆盖的某个群证明强耦合格点间隙(R-6),扩大已证的强耦合区域(R-1)。 | |
| 56 | +- **审读**:克雷的题面对照专家组的 A1 至 A8 和 Lean(V-3),八项检查各读一项(V-10 至 V-17),把论证写成数学(T-1 至 T-3), | |
| 57 | + 它依赖谁的工作(R-2),上面那张表(L-1),再重算一个已发表的格点数(C-1)。审读不用编译,是工作的一部分,不是中心。 | |
| 58 | + | |
| 59 | +## 怎么参与 | |
| 60 | + | |
| 61 | +1. 读这一页和 [`AGENTS.md`](AGENTS.md)。它的“第一次”一节几分钟就能走完,不用装 Lean。 | |
| 62 | +2. 从项目的 issue 里挑一块(标题以字母加编号开头:P、T、S、M、V、R、L、C)。总目标那个 issue 按你手头的条件列了从哪里开始: | |
| 63 | + 只读、一台笔记本(Scott Armstrong 编好的构建让单个文件不用全量编译就能编,V-9)、或一台大机器(全量编译要几个小时、 | |
| 64 | + 约 52 GiB)。 | |
| 65 | +3. 用一个分支加 `routes/<你的分支>/README.md` 里的说明认领它(AGENTS.md 有示例);按文件夹分的子任务,在那里写明你拿的子文件夹, | |
| 66 | + 免得两个人做同一个。然后一处改动,一个 PR。 | |
| 67 | +4. 一次复跑是一份带日期的记录,写在 `routes/<你的分支>/RERUN.md`,用 AGENTS.md 给的唯一模板:机器、镜像、提交、命令、输出了 | |
| 68 | + 什么、什么没有核。 | |
| 69 | + | |
| 70 | +## 怎么判,什么时候判 | |
| 71 | + | |
| 72 | +- **每次推送两项检验,加上维护者的 `replay`**,都通过才能合入,检验代码是批准版本的 `checks/`:`challenge` 几秒(六个冻结文件与批准的一致,编译配置 | |
| 73 | + 也一致,源码没有 `sorry`、`admit`、`axiom`、`native_decide`、`implemented_by`、`extern`);`build` 在本项目的 Lean 镜像里 | |
| 74 | + 不联网运行:`lake build` 编完,没有声明用了 `sorry`,定理只用三条标准公理;推送时不跑 Comparator。第三项 `replay` 是完整复跑 | |
| 75 | + (Comparator 按 `comparator.json`,Lean 内核,约半小时),由维护者的机器在 PR 的最新提交通过 `build` 之后跑,报告自动提交,合并 | |
| 76 | + 要等它。镜像里已有 main | |
| 77 | + 的编译结果,一次提交只编它改了的部分;截至 2026-12-02,一次 `build` 在生产机上要多久还没有测过(上限 12 小时)。 | |
| 78 | +- **站点的审读**在推送后几分钟内读每个 PR,检验和子任务要的证据都齐了就收下。 | |
| 79 | +- **站内的维护者 agent**(`yang-mills-maintainer`)在有人工作时大约每两小时来一轮,每天至少两轮。它复跑 PR 声称的东西,审读的第一 | |
| 80 | + 行是“Review of `<提交>`: ready”“changes needed”“needs a person”或“not finished”,维护上面的表,每轮在“Maintainer log” | |
| 81 | + issue 里写一行。在频道里或用 `@yang-mills-maintainer` 问它,几分钟内回答。 | |
| 82 | +- **人**决定书面规则定不了的事:新的陈述(把验收定理作为第二份挑战、唯一性或间隙的陈述)、改动冻结文件、两份审读意见相反、 | |
| 83 | + 任何关于质量间隙的声称。 | |
| 84 | + | |
| 85 | +## 陈述 | |
| 86 | + | |
| 87 | +[`Solution.lean`](Solution.lean) 证明 `YangMills.jointExistence : YangMills.JointExistence`。对每个李代数为非阿贝尔单实李代数的 | |
| 88 | +闭矩阵子群,它选一族 Wilson 格点理论;对每个严格递增的体积序列,给出一个子序列和一个连续层级,满足:Wilson 来源(有限矩是对 | |
| 89 | +Wilson plaquette 作用量的积分,裸耦合随格距对数地跑动,先取格距极限,再沿子序列取体积极限);Wightman 重构(真空、缓增场、 | |
| 90 | +正能量、唯一的平移不变真空、庞加莱协变、类空局域性);各阶的分离算子乘积展开;一个四阶场,任何有限个自由场轮廓之和都对不上。 | |
| 91 | + | |
| 92 | +陈述在 [`ChallengeSpec.lean`](ChallengeSpec.lean),建在 [`PublicWilson.lean`](PublicWilson.lean) 和 | |
| 93 | +[`PublicTheory.lean`](PublicTheory.lean) 之上,二者只导入 Mathlib。[`Challenge.lean`](Challenge.lean) 用 `sorry` 写出定理; | |
| 94 | +[`comparator.json`](comparator.json)(提交里原有的)让 Comparator 核对 `Solution` 证的正是这一陈述、只用三条标准公理。**这五个 | |
| 95 | +文件不能改**,`verification/Inventory.lean`(提交自带的占位扫描,在元程序里写到了 `sorryAx`)也一样,编译配置中 Comparator 依赖的部分也一样。陈述里没有质量间隙,也没有唯一的无穷体积极限。 | |
| 96 | + | |
| 97 | +## 编译与结构 | |
| 98 | + | |
| 99 | +提交用 Lean 4.32.0 和 Mathlib `81a5d257`: | |
| 100 | + | |
| 101 | +```sh | |
| 102 | +lake exe cache get | |
| 103 | +lake build # WilsonReference 和 WilsonConstruction | |
| 104 | +lake env comparator comparator.json | |
| 105 | +``` | |
| 106 | + | |
| 107 | +最后一行需要 `PATH` 上有按专家组版本编好的 `comparator`、`lean4export` 和 `landrun`(Comparator `d03acab1`,lean4export | |
| 108 | +`4e791520`;见 [`docker/README.md`](docker/README.md))。专家组的几次通过用的是 Landrun 的替身,所以真正隔离地跑一次是新的 | |
| 109 | +方式,不是重复。专家组的一次干净编译在 Apple Silicon Mac 上用了 183.94 分钟、占了约 52 GiB(2026-10-29);另一处在 Linux 上 | |
| 110 | +重编过(humanise-yang-mills,2026-11-12)。 | |
| 111 | + | |
| 112 | +- 根目录是对外的部分:`PublicTheory.lean`、`PublicWilson.lean`、`ChallengeSpec.lean`、`Challenge.lean`(不能改);通到构造的 | |
| 113 | + 桥(`PublicView`、`WilsonBridge`、`HierarchyBridge`、`TraceBridge`、`ContactSpec`、`ContactBridge`);`Construction.lean` | |
| 114 | + (`YangMills.constructed`);`Solution.lean`;`ConcreteSU2.lean`。 | |
| 115 | +- `YM/`(102 个文件夹里 9,457 个文件):构造本身,主结论在 `YM/Nonperturbative/Headlines.lean`。最大的文件夹是 `YM/Next`、 | |
| 116 | + `YM/PhysicalNext`、`YM/Push` 和 `YM/RG08`;很多文件夹名是代号。 | |
| 117 | +- `Verify.lean`、`VerifyJoint.lean`、`verification/`:提交自带的检查和记录(`verification/Inventory.lean`:提交自带的占位与新公理扫描, | |
| 118 | + 和挑战文件一样固定)。`routes/`:每个认领了子任务的分支一个文件夹,放说明和 | |
| 119 | + 复跑的 `RERUN.md`。`checks/`、`docker/`:两项检验和 Lean 镜像。`KNOWN.md`:已确立的事和要注意的地方。`UPSTREAM.md`:提交的 | |
| 120 | + README。 | |
| 121 | + | |
| 122 | +## 2026-12-02 以前 | |
| 123 | + | |
| 124 | +2026-12-02 以前,本项目是一块精确计算的榜:用蒙特卡罗重算格点上的数,由它的 `verify` 检验核对(SU(2) 的 plaquette、格点质量 | |
| 125 | +间隙 a·m_G、m_0++/√σ 的连续极限),以及按记录的哈希核对专家组十月的包。那里没有人合入过结果;它 2026-12-01 的 Known 页,连同 | |
| 126 | +那个包记录的哈希,留在 main 的历史里,plaquette 作为 C-1 保留下来。 | |
| 127 | + | |
| 128 | +构造出自 OpenAI;那个包、它的检查和评估出自杨-米尔斯专家组:谢谢两方。 | |
+62 −0 UPSTREAM.md added View file
| @@ -0,0 +1,62 @@ | ||
| 1 | +# What upstream says | |
| 2 | + | |
| 3 | +This project starts from [yang-mills-group/YM](https://github.com/yang-mills-group/YM) at `319ecd5274241200b27bb5b143a59133fd670ea6` (2026-11-25), its folder [`submissions/openai-20261028/submission`](https://github.com/yang-mills-group/YM/tree/319ecd5274241200b27bb5b143a59133fd670ea6/submissions/openai-20261028/submission): OpenAI's submission of 28 October 2026, which the Yang–Mills group preserves there byte for byte. That folder's README at that commit follows, unchanged except that its headings are one level lower; `README.md` here is this project's. The group's own description of its package is [`submissions/openai-20261028/README.md`](https://github.com/yang-mills-group/YM/blob/319ecd5274241200b27bb5b143a59133fd670ea6/submissions/openai-20261028/README.md), and its assessment of 2026-11-10 is [`docs/assessment-1.pdf`](https://github.com/yang-mills-group/YM/blob/319ecd5274241200b27bb5b143a59133fd670ea6/docs/assessment-1.pdf). | |
| 4 | + | |
| 5 | +## README.md | |
| 6 | + | |
| 7 | +### Wilson Yang–Mills construction | |
| 8 | + | |
| 9 | +Project license: [Apache-2.0](LICENSE). [Source attributions](NOTICE) · [Third-party library licenses](THIRD_PARTY.md) | |
| 10 | + | |
| 11 | +#### The public challenge | |
| 12 | + | |
| 13 | +[YangMills.jointExistence](Solution.lean) proves [JointExistence](ChallengeSpec.lean). The reference [Challenge.lean](Challenge.lean) has a Mathlib-only import closure. Its starting point is an earlier challenge at revision eea94292e31734d46498be7836d7e8fa50ca8cd2. | |
| 14 | + | |
| 15 | +For each closed matrix subgroup with nonabelian simple real Lie algebra, choose one Wilson lattice family. For every strictly increasing sequence of volumes, it has a subsequence and a continuum hierarchy with the following properties. | |
| 16 | + | |
| 17 | +- **Wilson origin.** Finite moments integrate products of local insertions against the normalized exponential of the plaquette action on the given group, with product Haar measure. For each insertion a finite set of offsets in lattice units controls every measurement, at every spacing and volume. Changing links outside that patch leaves the insertion unchanged. The ratio of the bare action coefficient to the logarithm of inverse lattice spacing tends to a positive slope, uniformly in the volume. Separated test-function moments have the full mesh limit at suitable fixed volumes, then the asserted volume limit. [Lattice and limits](PublicWilson.lean) · [Wilson bridge](WilsonBridge.lean) | |
| 18 | +- **Wightman reconstruction.** The selected phase has a normalized cyclic vacuum, faithful tempered fields on a common dense domain, positive energy, a unique translation-invariant vacuum up to scalar, covariance and spacelike locality. The symmetry coordinates cover every proper orthochronous affine Poincaré transformation and determine the inverse pullback on test functions. Analytic continuation recovers the selected Euclidean hierarchy at ordered imaginary times and its Wightman vacuum moments on product tests. Integrating the character correlations gives the unselected Wilson limit. The character measure has full support and the separated correlations vary continuously with the character. [W0–W3](PublicTheory.lean) · [Reconstruction bridge](HierarchyBridge.lean) | |
| 19 | +- **All-orders separated OPE.** For each finite cluster and collection of separated spectators, use a single system of coefficients at every truncation degree and in every phase. Both the full word and each term with the cluster replaced by a local insertion are reads of the same hierarchy. The bounds are uniform at all sufficiently small radii for the specified cluster size and separation constants. Permutation symmetry and smoothness hold off the collision diagonals. [Public estimates](ChallengeSpec.lean) · [Derivation of the compact-set bounds](verification/CompactCheck.lean) | |
| 20 | +- **Non-freeness test.** A centered grade-four field has a two-point function with a positive short-distance coefficient of three times the real Lie-algebra dimension divided by π⁴, after multiplication by r⁸ log²(1/r). No finite sum of the specified mass-shell Wick profiles agrees with it at all sufficiently small radii. The detailed theorem identifies this field as the physical centered stress trace and supplies the distributional Wick and Maxwell tests. [Trace bridge](TraceBridge.lean) | |
| 21 | + | |
| 22 | +[The SU(2) specialization](ConcreteSU2.lean) uses the defining representation and the included proof of simplicity. | |
| 23 | + | |
| 24 | +#### The detailed construction theorem | |
| 25 | + | |
| 26 | +[YangMills.constructed](Construction.lean) quantifies over each positive blocking-kernel penalty. It chooses the family once, then refines each requested mesh/volume order. Each refinement has one table, one selected Wightman reconstruction, a reconstruction for every character, one OPE reader and a set of contact devices using that reader’s field basis. The public theorem is a projection of this result. | |
| 27 | + | |
| 28 | +- The reader also satisfies integrated single-center estimates and admissible nested OPE estimates. The centered stress trace has countertests to finite Wick-polynomial correlators and to Maxwell Fock realizations obeying the stated physical-wave, vacuum, translation and locality conditions, including the specified invariant-sector test. [Exact statements](YM/Nonperturbative/HeadlineSpec.lean) | |
| 29 | +- The Euclidean contact construction produces continuous distributions on compact smooth tests, at every arity and in every phase. Their restriction to separated configurations agrees with this table’s ordinary correlations. The detailed theorem also retains the collision-resolution estimates, the field-basis identity and the admissible thresholds. This supplies an extension for the constructed prescription. Uniqueness over other contact prescriptions and raw cutoff convergence on collision diagonals are outside the claim. [Restriction proof](ContactBridge.lean) · [Full contact specification](YM/Contacts/Solstice/Result.lean) | |
| 30 | +- The same witnesses retain the leading position-space test comparison in the constructed moving frames. [Continuum theorem](YM/Nonperturbative/Continuum.lean) · [Position-test statement](YM/Pert/Position/Four.lean) | |
| 31 | + | |
| 32 | +The volume limit allows refinement. The Wightman spectrum condition and uniqueness of the vacuum are the spectral conclusions in the public challenge. A positive mass gap, general exclusion of continuous-mass generalized free fields and all-orders MS-bar matching are outside its scope. | |
| 33 | + | |
| 34 | +#### Verification | |
| 35 | + | |
| 36 | +The archive includes all YM project sources. A first build requires Git, Lean 4.32.0 (or elan to install it), and access to the nine public repositories pinned in the Lake manifest, or a populated dependency cache. From the extracted directory run | |
| 37 | + | |
| 38 | +```sh | |
| 39 | +lake exe cache get | |
| 40 | +lake build WilsonReference WilsonConstruction | |
| 41 | +lake env lean -j1 -DmaxHeartbeats=0 -DmaxRecDepth=4096 VerifyJoint.lean | |
| 42 | +lake env lean -j1 -DmaxHeartbeats=0 verification/Usage.lean | |
| 43 | +lake env lean -j1 verification/CompactCheck.lean | |
| 44 | +``` | |
| 45 | + | |
| 46 | +[VerifyJoint.lean](VerifyJoint.lean) imports the solution and loads the reference in a separate environment. It checks the exact theorem type, compares the reachable public definitions, audits the permitted axioms, and replays the reachable project declarations in a kernel environment that initially contains only external libraries. The only placeholder in the new files is the reference theorem in Challenge.lean. Solution.lean imports the definitions and the construction. The reference proof is absent from its imports. | |
| 47 | + | |
| 48 | +[Verification log](verification/joint-check.log) · [Headline roots](verification/joint-headlines.txt) · [Frozen reference source hashes](verification/challenge.sha256) · [Standard Comparator configuration](comparator.json) | |
| 49 | + | |
| 50 | +Stock Lake resolved the reference, solution and SU(2) import graphs from an extracted copy using the pinned external packages. The reference has zero YM implementation imports. [Lake import check](verification/archive-graph.log) · [Weakened-statement and unproved-axiom controls](verification/negative-controls.log) | |
| 51 | + | |
| 52 | +[The compact-set check](verification/compact-check.log) derives a uniform norm bound on the complete degree-j coefficient vector and the remainder estimate over every compact separated cluster and spectator set. It uses only the public OPE definition. | |
| 53 | + | |
| 54 | +The public reference was built with only the pinned external libraries on the search path. The solution build re-elaborated all new modules and reused compiled modules of the previously checked Wilson release. The pinned Lean kernel replayed 100,168 project declarations for the 17 advertised results and found only the standard axioms of propositional extensionality, classical choice and quotient soundness. The standalone Comparator executable was not run. [Earlier build record](verification/build.log) | |
| 55 | + | |
| 56 | +#### Source coverage | |
| 57 | + | |
| 58 | +The 17 audited theorems reach 100,168 of 250,319 imported project declarations. The tables flag the other 150,151. The 9,458 pre-existing YM modules were matched to their original build inputs. Nine modules carry source credits. Of the eight covered by the recorded credited-source recompile, seven had byte-identical compiled files. In the remaining module, the imports and all 149 kernel declarations, including their types and bodies, matched. [Build-input comparison](verification/source-match.log) · [Credited source checks](verification/attributions.log) | |
| 59 | + | |
| 60 | +[Declaration usage](verification/declaration-usage.tsv) lists the imported project declarations, whether a headline’s elaborated type or proof reaches each one, and a dependency path for reached declarations. [Module usage](verification/module-usage.tsv) gives the counts by module. These counts include declarations generated by Lean. Independent corollaries, helper lemmas used only during elaboration and import-only files can appear outside the proof terms. [Usage check](verification/Usage.lean) | |
| 61 | + | |
| 62 | +[SOURCES.sha256](SOURCES.sha256) covers the files in this source distribution, excluding the manifest itself. | |
+33 −0 checks/build.json added View file
| @@ -0,0 +1,33 @@ | ||
| 1 | +{ | |
| 2 | + "comparator_kind": "standalone", | |
| 3 | + "export_command": [ | |
| 4 | + "lake", | |
| 5 | + "env", | |
| 6 | + "lean4export" | |
| 7 | + ], | |
| 8 | + "comparator_command": [ | |
| 9 | + "comparator" | |
| 10 | + ], | |
| 11 | + "comparator": [ | |
| 12 | + "comparator.json" | |
| 13 | + ], | |
| 14 | + "comparator_success": [ | |
| 15 | + "Lean default kernel accepts the solution", | |
| 16 | + "Your solution is okay!" | |
| 17 | + ], | |
| 18 | + "in_place": true, | |
| 19 | + "permitted_axioms": [ | |
| 20 | + "propext", | |
| 21 | + "Quot.sound", | |
| 22 | + "Classical.choice" | |
| 23 | + ], | |
| 24 | + "timeout": 43200, | |
| 25 | + "frozen": [ | |
| 26 | + "Challenge.lean", | |
| 27 | + "ChallengeSpec.lean", | |
| 28 | + "PublicTheory.lean", | |
| 29 | + "PublicWilson.lean", | |
| 30 | + "verification/Inventory.lean" | |
| 31 | + ], | |
| 32 | + "replay": "round" | |
| 33 | +} | |
+386 −0 checks/build.py added View file
| @@ -0,0 +1,386 @@ | ||
| 1 | +#!/usr/bin/env python3 | |
| 2 | +"""The `build` check: the pushed commit compiles, uses no `sorry`, its theorems depend only on the permitted axioms, | |
| 3 | +and Comparator accepts it against the approved challenge. | |
| 4 | + | |
| 5 | +Usage: build.py <commit's tree> [<build.json>] (BUILD_REPLAY=1: with Comparator even where build.json has | |
| 6 | + "replay": "round", see below) | |
| 7 | + | |
| 8 | +This is leanprover-community/riemann-hypothesis's `build.yml` ("lake build", the merge queue's required check), made a | |
| 9 | +check of this site, plus the Comparator run its README asks for. It runs in the project's Lean image (`docker/`), with | |
| 10 | +no network, on the site's runner, as root in the runner's container. | |
| 11 | + | |
| 12 | +The commit's Lean is code the check runs: an `#eval`, an `initialize` or an elaborator in it runs while Lean compiles | |
| 13 | +the file or imports it, and can print anything, including Comparator's success lines, or rewrite `lake` itself. So | |
| 14 | +nothing the commit's build prints is trusted, and none of its code runs as root: | |
| 15 | + | |
| 16 | +1. the approved version (the checkout this script is in, PROOF_APPROVED to override) is compiled as root, from the | |
| 17 | + image's `.lake`, and each Comparator configuration's challenge module is exported (`export_command`) before | |
| 18 | + anything of the commit runs. Its definitions, not the commit's, are what the statements mean; | |
| 19 | +2. the commit's tree is copied to a folder of its own and given the image's `.lake` (the dependencies, read-only, and | |
| 20 | + the build of the approved main, made when the image was built): Lake then rebuilds only what the commit changed. | |
| 21 | + As `nobody`, it runs `lake build`, and `lake build` of every library the approved lakefile.toml declares (the | |
| 22 | + default targets are a key a pull request may change), which must end without error and with no module reporting a | |
| 23 | + declaration that uses `sorry` except the challenge's own files (`frozen` in build.json: they state the theorems | |
| 24 | + with `sorry` on purpose); then it exports each configuration's solution module, and the theorems of build.json; | |
| 25 | +3. every process of `nobody` is killed; then, as `nobody`, Comparator judges each export pair: the statements and the | |
| 26 | + definitions they use as approved, no axiom beyond the permitted ones (a `sorry` is the axiom `sorryAx`), and a | |
| 27 | + replay through Lean's kernel (and nanoda, where the configuration asks). The theorems of build.json are judged the | |
| 28 | + same way against their own export: axioms and kernel. The judge reads text exports only and never loads an `.olean` | |
| 29 | + of the commit, so what it prints is the verdict; | |
| 30 | +4. the commit's `lean-toolchain` must be the image's: a bump needs a new image (docker/README.md). | |
| 31 | + | |
| 32 | +Two Comparators are served (`comparator_kind` in build.json). "lake", the default: the toolchain's own (Lean 4.35 and | |
| 33 | +later), `lake comparator --challenge-from-export … --solution-from-export … --inadvisably-no-sandbox`. "standalone": | |
| 34 | +leanprover/comparator as a binary, for the toolchains before it, which builds and exports by itself through `landrun` | |
| 35 | +and has no way to be handed exports. It is given one: COMPARATOR_LANDRUN names a stand-in this script writes, which | |
| 36 | +does nothing for `lake build`, prints step 1's or step 2's export for `lean4export <module>`, and starts an external | |
| 37 | +kernel (nanoda_bin) as it is; Comparator's own comparison, axiom walk and kernels then run as upstream wrote them. | |
| 38 | +Neither Comparator's own sandbox is what holds the commit here. bwrap cannot start in the runner's container (no user | |
| 39 | +namespaces). landrun can (Landlock, measured on the production host 12-02), but upstream's guarantee needs three things | |
| 40 | +the check does not have: nothing of the commit compiled before Comparator runs, a user who is not root, and no | |
| 41 | +AF_UNIX (kernels before 7.1). Step 2, as `nobody`, stands in for both. | |
| 42 | + | |
| 43 | +Where the build is kept. With `"in_place": true` and an image whose `.lake/build` belongs to `nobody`, both sides use | |
| 44 | +that folder itself: root first, for the approved challenge, then the commit, which may write anything there; nothing | |
| 45 | +is read from it as approved after that, and the container is thrown away with what it wrote. A job then costs the | |
| 46 | +disk of what it recompiled. Without it the build is copied for each side, as before (a 600 MB build: fine; 40 GB: | |
| 47 | +not). | |
| 48 | + | |
| 49 | +When Comparator runs. A replay sends the whole proof through a kernel on one core: minutes for a small library, hours | |
| 50 | +for a large one. With `"replay": "round"` in build.json a push gets step 2's build and `sorry` scan only, and the last | |
| 51 | +line says so: that is the commit's own Lean reporting on itself, a filter and not a verdict. The replay (all four | |
| 52 | +steps) is then run once per maintainer round, on main or on a batch of pull requests, with BUILD_REPLAY=1; its result | |
| 53 | +is filed as a report. Without the key every push is replayed. | |
| 54 | + | |
| 55 | +The `sorry` scan of step 2 reads the commit's own build log, which the commit's code can write to: it catches an | |
| 56 | +honest `sorry` anywhere in the library, and a hidden one cannot reach a judged theorem, since step 3 reads the axioms | |
| 57 | +from the exports. Run as another user than root (tests, a machine of one's own) it does the same steps without | |
| 58 | +switching to `nobody`. | |
| 59 | + | |
| 60 | +Each step's wall time is printed as it ends (`-- … s`). Its last line says what held, or the first thing that did | |
| 61 | +not. Exit 0 passes, 1 fails. | |
| 62 | +""" | |
| 63 | + | |
| 64 | +from __future__ import annotations | |
| 65 | + | |
| 66 | +import json | |
| 67 | +import os | |
| 68 | +import re | |
| 69 | +import shlex | |
| 70 | +import shutil | |
| 71 | +import subprocess | |
| 72 | +import sys | |
| 73 | +import tempfile | |
| 74 | +import time | |
| 75 | +import tomllib | |
| 76 | +from pathlib import Path | |
| 77 | + | |
| 78 | +SORRY = re.compile(r"declaration uses ['`]sorry['`]") | |
| 79 | +# where a warning comes from: "warning: Challenge.lean:2:8: declaration uses `sorry`" (a path, possibly ./ or absolute) | |
| 80 | +WHERE = re.compile(r"(?:^|\s)(?:\./)?([^\s:]+\.lean):\d+:\d+:") | |
| 81 | +NOBODY = 65534 # nobody:nogroup in Ubuntu | |
| 82 | +# What is exported with the theorems, as `lake comparator` asks when it exports by itself (Lean 4.35.0, | |
| 83 | +# src/lake/Lake/CLI/Check.lean: builtinTargets, primitiveTargets): the kernel's built-in constants, Quot when Quot.sound | |
| 84 | +# is permitted, then the configuration's theorems, axioms and definitions. | |
| 85 | +PRIMITIVES = [ | |
| 86 | + "Nat.add", "Nat.sub", "Nat.mul", "Nat.pow", "Nat.gcd", "Nat.div", "Nat.mod", "Nat.beq", "Nat.ble", "Nat.land", | |
| 87 | + "Nat.lor", "Nat.xor", "Nat.shiftLeft", "Nat.shiftRight", "String.ofList", "Char.ofNat", "List", "eagerReduce", | |
| 88 | + "Nat", "String", "String.mk", "Char", "optParam", "autoParam", "semiOutParam", "outParam", | |
| 89 | +] | |
| 90 | +QUOT = ["Quot", "Quot.mk", "Quot.lift", "Quot.ind"] | |
| 91 | +NO_SANDBOX = "WARNING: Sandbox disabled, this run is not trustworthy." | |
| 92 | + | |
| 93 | + | |
| 94 | +class Wrong(Exception): | |
| 95 | + pass | |
| 96 | + | |
| 97 | + | |
| 98 | +ROOT = os.geteuid() == 0 | |
| 99 | + | |
| 100 | + | |
| 101 | +def toolchain_bin(cwd: Path) -> str: | |
| 102 | + """The toolchain's own bin folder (elan puts only lean, lake and leanchecker on PATH; Comparator looks nanoda_bin | |
| 103 | + up on PATH), or nothing where elan is not there.""" | |
| 104 | + try: | |
| 105 | + return str(Path(subprocess.run(["elan", "which", "lean"], cwd=cwd, capture_output=True, text=True, timeout=60, | |
| 106 | + check=True).stdout.strip()).parent) | |
| 107 | + except (OSError, subprocess.SubprocessError): | |
| 108 | + return "" | |
| 109 | + | |
| 110 | + | |
| 111 | +BIN = "" # set in main: the toolchain's bin folder, first on every PATH below | |
| 112 | + | |
| 113 | + | |
| 114 | +def env_for(home: Path) -> dict[str, str]: | |
| 115 | + """What a process of the commit or the judge sees: the image's PATH and elan, a HOME of its own, and git told | |
| 116 | + that the image's repositories, which root owns, are safe to read (Lake asks git about each package).""" | |
| 117 | + keep = {k: v for k, v in os.environ.items() if k in ("PATH", "ELAN_HOME", "LANG", "LC_ALL", "LEAN_NUM_THREADS")} | |
| 118 | + if BIN: | |
| 119 | + keep["PATH"] = f"{BIN}:{keep.get('PATH', '/usr/bin:/bin')}" | |
| 120 | + return {**keep, "HOME": str(home), "GIT_CONFIG_COUNT": "1", "GIT_CONFIG_KEY_0": "safe.directory", | |
| 121 | + "GIT_CONFIG_VALUE_0": "*"} | |
| 122 | + | |
| 123 | + | |
| 124 | +def run(cmd: list[str], cwd: Path, timeout: int, log: Path | None = None, *, nobody: bool = False, | |
| 125 | + env: dict[str, str] | None = None, out=None) -> str: | |
| 126 | + """Run a command, keep what it printed in `log`, and fail with its last lines if it fails. With `out`, its standard | |
| 127 | + output goes to that file instead. With `nobody` (and as root), it runs as nobody, with no supplementary group.""" | |
| 128 | + print(f"$ {' '.join(cmd)}", flush=True) | |
| 129 | + who = {"user": NOBODY, "group": NOBODY, "extra_groups": []} if nobody and ROOT else {} | |
| 130 | + began = time.monotonic() | |
| 131 | + try: | |
| 132 | + p = subprocess.run(cmd, cwd=cwd, stdout=out or subprocess.PIPE, stderr=subprocess.STDOUT if out is None else subprocess.PIPE, | |
| 133 | + text=True, timeout=timeout, env=env, **who) | |
| 134 | + except subprocess.TimeoutExpired: | |
| 135 | + raise Wrong(f"{' '.join(cmd)} took longer than {timeout} s") | |
| 136 | + said = (p.stdout if out is None else p.stderr) or "" | |
| 137 | + if log: | |
| 138 | + log.write_text(said, encoding="utf-8") | |
| 139 | + tail = "\n".join(said.replace(NO_SANDBOX, "").strip().splitlines()[-25:]) | |
| 140 | + if tail: | |
| 141 | + print(tail, flush=True) | |
| 142 | + print(f"-- {time.monotonic() - began:.0f} s", flush=True) | |
| 143 | + if p.returncode != 0: | |
| 144 | + # with the first error it gave (Lean's, or Comparator's verdict), so the last line says why | |
| 145 | + why = next((line.strip() for line in said.splitlines() if re.match(r"(error|uncaught exception)\b", line.strip()) | |
| 146 | + and line.strip() != "error: build failed"), "") | |
| 147 | + raise Wrong(f"{' '.join(cmd)} ended with exit {p.returncode}" + (f": {why[:300]}" if why else "")) | |
| 148 | + return said | |
| 149 | + | |
| 150 | + | |
| 151 | +def kill_nobody() -> None: | |
| 152 | + """End every process of nobody at once: kill -1 from nobody reaches exactly those, itself included.""" | |
| 153 | + if ROOT: | |
| 154 | + subprocess.run(["bash", "-c", "kill -KILL -1"], user=NOBODY, group=NOBODY, extra_groups=[], | |
| 155 | + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | |
| 156 | + | |
| 157 | + | |
| 158 | +def give_lake(base: Path, project: Path, in_place: bool = False) -> None: | |
| 159 | + """The image's .lake for a project: its packages shared and read-only (a symbolic link), the rest a copy; in place, | |
| 160 | + the build is shared too, and whoever builds in the project writes into the image's own folder.""" | |
| 161 | + (project / ".lake").mkdir() | |
| 162 | + for entry in (base / ".lake").iterdir(): | |
| 163 | + if entry.name == "packages" or (in_place and entry.name == "build"): | |
| 164 | + (project / ".lake" / entry.name).symlink_to(entry) | |
| 165 | + elif entry.is_dir(): | |
| 166 | + shutil.copytree(entry, project / ".lake" / entry.name, symlinks=True) | |
| 167 | + else: | |
| 168 | + shutil.copy2(entry, project / ".lake" / entry.name) | |
| 169 | + | |
| 170 | + | |
| 171 | +def chown_nobody(folder: Path) -> None: | |
| 172 | + """Give a folder and what is in it to nobody. What is nobody's already is left alone: in a folder of the image | |
| 173 | + itself, a chown copies the file into the container.""" | |
| 174 | + if ROOT: | |
| 175 | + for here, dirs, files in os.walk(folder): | |
| 176 | + for path in [Path(here)] + [Path(here) / name for name in files + [d for d in dirs if (Path(here) / d).is_symlink()]]: | |
| 177 | + if os.lstat(path).st_uid != NOBODY: | |
| 178 | + os.lchown(path, NOBODY, NOBODY) | |
| 179 | + | |
| 180 | + | |
| 181 | +def targets(config: dict) -> list[str]: | |
| 182 | + axioms = config["permitted_axioms"] | |
| 183 | + return (QUOT if "Quot.sound" in axioms else []) + config.get("theorem_names", []) + axioms + PRIMITIVES \ | |
| 184 | + + config.get("definition_names", []) | |
| 185 | + | |
| 186 | + | |
| 187 | +EXPORT = ["lake", "env", "leanexport"] # build.json's export_command, set in main | |
| 188 | + | |
| 189 | + | |
| 190 | +def export(module: str, names: list[str], dest: Path, cwd: Path, timeout: int, nobody: bool, env: dict[str, str]) -> None: | |
| 191 | + with dest.open("w") as f: | |
| 192 | + run([*EXPORT, module, "--", *names], cwd, timeout, nobody=nobody, env=env, out=f) | |
| 193 | + print(f"-- {dest.name}: {dest.stat().st_size / 1e6:.0f} MB", flush=True) | |
| 194 | + | |
| 195 | + | |
| 196 | +def judge_command(spec: dict, config: Path, challenge: Path, solution: Path, modules: tuple[str, str], folder: Path) -> tuple[list[str], dict[str, str]]: | |
| 197 | + """How Comparator is started on two exports, and what is added to its environment.""" | |
| 198 | + if spec.get("comparator_kind", "lake") != "standalone": | |
| 199 | + return spec["comparator_command"] + [str(config), "--challenge-from-export", str(challenge), "--solution-from-export", str(solution), | |
| 200 | + "--inadvisably-no-sandbox"], {} | |
| 201 | + # the standalone Comparator starts everything through landrun: this stands in for it (the module docstring says why) | |
| 202 | + for module in modules: | |
| 203 | + if not re.fullmatch(r"[\w.'«»]+", module): | |
| 204 | + raise Wrong(f"{module!r} is not a module name") | |
| 205 | + stand_in = folder / f"{config.stem}-landrun" | |
| 206 | + serve = "".join(f" {shlex.quote('lean4export ' + m)}) exec cat {shlex.quote(str(e))} ;;\n" for m, e in dict(zip(modules, (challenge, solution))).items()) | |
| 207 | + stand_in.write_text('#!/bin/sh\n# in landrun\'s place: the builds are done, and the exports made\n' | |
| 208 | + 'while [ $# -gt 0 ] && [ "$1" != -- ]; do shift; done\n[ $# -gt 1 ] || exit 2\nshift\n' | |
| 209 | + f'case "$1 $2" in\n "lake build") exit 0 ;;\n{serve} lake\\ *|lean4export\\ *) echo "not served: $*" >&2; exit 2 ;;\nesac\nexec "$@"\n') | |
| 210 | + stand_in.chmod(0o755) | |
| 211 | + (folder / ".lake").mkdir(exist_ok=True) # Comparator makes it in its folder otherwise, which nobody cannot | |
| 212 | + return spec["comparator_command"] + [str(config)], {"COMPARATOR_LANDRUN": str(stand_in)} | |
| 213 | + | |
| 214 | + | |
| 215 | +def imports_of(path: Path) -> list[str]: | |
| 216 | + """The modules a file's header imports.""" | |
| 217 | + found = [] | |
| 218 | + for line in path.read_text(encoding="utf-8").splitlines(): | |
| 219 | + m = re.match(r"\s*(?:public\s+)?import\s+(.+)", line) | |
| 220 | + if m: | |
| 221 | + found += m.group(1).split() | |
| 222 | + elif line.strip() and not line.lstrip().startswith(("--", "/-", "module", "prelude")): | |
| 223 | + break | |
| 224 | + return found | |
| 225 | + | |
| 226 | + | |
| 227 | +def main(argv: list[str]) -> int: | |
| 228 | + if len(argv) < 2: | |
| 229 | + print(__doc__.strip().splitlines()[2]) | |
| 230 | + return 2 | |
| 231 | + tree = Path(argv[1]).resolve() | |
| 232 | + spec = json.loads((Path(argv[2]) if len(argv) > 2 else Path(__file__).with_name("build.json")).read_text(encoding="utf-8")) | |
| 233 | + approved = Path(os.environ.get("PROOF_APPROVED") or Path(__file__).resolve().parents[1]) | |
| 234 | + base = Path(os.environ.get("PROOF_BASE", "/opt/proof")) | |
| 235 | + timeout = int(spec.get("timeout", 6 * 3600)) | |
| 236 | + logs = Path(os.environ.get("BUILD_LOGS", ".")).resolve() | |
| 237 | + logs.mkdir(parents=True, exist_ok=True) | |
| 238 | + work = Path(tempfile.mkdtemp(prefix="build-")) | |
| 239 | + os.chmod(work, 0o711) # nobody passes through to its own folders, and reads nothing else here | |
| 240 | + try: | |
| 241 | + if not (tree / "lakefile.toml").is_file(): | |
| 242 | + print("Nothing to check yet: the commit has no lakefile.toml.") | |
| 243 | + return 0 | |
| 244 | + if not (base / ".lake").is_dir(): | |
| 245 | + raise Wrong(f"{base}/.lake is not there: this check runs in the project's Lean image (docker/README.md)") | |
| 246 | + # 4. the image's toolchain (read, not run) | |
| 247 | + want = (tree / "lean-toolchain").read_text(encoding="utf-8").strip() | |
| 248 | + have = (base / "lean-toolchain").read_text(encoding="utf-8").strip() | |
| 249 | + if want != have: | |
| 250 | + raise Wrong(f"the commit asks for {want}; the image has {have}: a toolchain bump needs a new image (docker/README.md)") | |
| 251 | + global BIN, EXPORT | |
| 252 | + BIN = toolchain_bin(base) | |
| 253 | + # Lake starts a `lean` for every core it sees, and the runner's --cpus is a share of time, not a count of | |
| 254 | + # cores: on a 128-core host a job of 4 CPUs would start 128 (lean-poincare, 12-02) | |
| 255 | + if os.environ.get("SLURM_CPUS_PER_TASK"): | |
| 256 | + os.environ.setdefault("LEAN_NUM_THREADS", os.environ["SLURM_CPUS_PER_TASK"]) | |
| 257 | + EXPORT = spec.get("export_command", EXPORT) | |
| 258 | + configs = [(name, json.loads((approved / name).read_text(encoding="utf-8"))) for name in spec.get("comparator", [])] | |
| 259 | + theorems = spec.get("theorems", []) if spec.get("axioms_file") else [] | |
| 260 | + # a push of a project that replays once a round gets the build and its own account of the axioms, no judge | |
| 261 | + replay = spec.get("replay", "push") != "round" or os.environ.get("BUILD_REPLAY") == "1" | |
| 262 | + in_place = bool(spec.get("in_place")) | |
| 263 | + built = base / ".lake" / "build" | |
| 264 | + if in_place and ROOT and os.stat(built).st_uid != NOBODY: | |
| 265 | + raise Wrong(f"{built} is not nobody's: build.json's in_place needs an image made for it (docker/README.md)") | |
| 266 | + judge = work / "judge" | |
| 267 | + judge.mkdir() | |
| 268 | + # 1. the approved challenges, as root, before anything of the commit runs | |
| 269 | + if configs and replay: | |
| 270 | + mine = work / "approved" | |
| 271 | + # (not the commit's tree, nor the job's logs: on the runner both sit in the approved checkout, /work) | |
| 272 | + shutil.copytree(approved, mine, symlinks=True, ignore=lambda d, names: [n for n in names if n in (".git", ".lake") | |
| 273 | + or (Path(d) / n).resolve() in (tree, logs)]) | |
| 274 | + give_lake(base, mine, in_place) | |
| 275 | + for i, (name, config) in enumerate(configs): | |
| 276 | + run(["lake", "build", config["challenge_module"]], mine, timeout, logs / f"challenge-{i}.log") | |
| 277 | + export(config["challenge_module"], targets(config), judge / f"challenge-{i}.export", mine, timeout, False, None) | |
| 278 | + if in_place: | |
| 279 | + chown_nobody(built) # what root compiled there, the commit's Lake may have to write again | |
| 280 | + # 2. the commit, as nobody, in a folder of its own. In place, the image's build is from here on the commit's: | |
| 281 | + # nothing below reads it as approved | |
| 282 | + proof, home, solve = work / "proof", work / "home", work / "solve" | |
| 283 | + shutil.copytree(tree, proof, symlinks=True, ignore=shutil.ignore_patterns(".git", ".lake")) | |
| 284 | + give_lake(base, proof, in_place) | |
| 285 | + for folder in (home, solve): | |
| 286 | + folder.mkdir() | |
| 287 | + for folder in (proof, home, solve): | |
| 288 | + chown_nobody(folder) | |
| 289 | + env = env_for(home) | |
| 290 | + try: | |
| 291 | + out = run(["lake", "build"], proof, timeout, logs / "build.log", nobody=True, env=env) | |
| 292 | + # and every library the approved lakefile declares, whatever the commit's defaultTargets say (a key a pull | |
| 293 | + # request may change): a proof in a library left out of the default build was never compiled, and passed | |
| 294 | + # (12-01, Goldbach: Open/<Name>.lean, its library without globs) | |
| 295 | + approved_lakefile = approved / "lakefile.toml" | |
| 296 | + libs = [lib["name"] for lib in tomllib.loads(approved_lakefile.read_text(encoding="utf-8")).get("lean_lib", [])] if approved_lakefile.exists() else [] | |
| 297 | + if libs: | |
| 298 | + out += "\n" + run(["lake", "build", *libs], proof, timeout, logs / "build-libs.log", nobody=True, env=env) | |
| 299 | + frozen = tuple(spec.get("frozen", [])) | |
| 300 | + | |
| 301 | + def allowed(line: str) -> bool: | |
| 302 | + m = WHERE.search(line) | |
| 303 | + if not m: | |
| 304 | + return False | |
| 305 | + path = os.path.normpath(m.group(1)) # a library with srcDir "src" names src/../Challenge.lean | |
| 306 | + path = path[len(str(proof)) + 1:] if path.startswith(str(proof) + "/") else path | |
| 307 | + return path in frozen | |
| 308 | + sorries = [line for line in out.splitlines() if SORRY.search(line) and not allowed(line)] | |
| 309 | + if sorries: | |
| 310 | + print("\n".join(sorries[:20])) | |
| 311 | + raise Wrong(f"the build reports {len(sorries)} declaration(s) that use sorry") | |
| 312 | + reported = 0 | |
| 313 | + if not replay: | |
| 314 | + # what the commit's own Lean says its theorems rest on: a filter (the commit's code runs in that Lean), | |
| 315 | + # which the round's replay does not rely on | |
| 316 | + names = [t for _, config in configs for t in config.get("theorem_names", [])] + theorems | |
| 317 | + modules = [config["solution_module"] for _, config in configs] + (imports_of(approved / spec["axioms_file"]) if theorems else []) | |
| 318 | + (solve / "ShoalAxioms.lean").write_text("".join(f"import {m}\n" for m in dict.fromkeys(modules)) + "".join(f"#print axioms {t}\n" for t in names)) | |
| 319 | + chown_nobody(solve) | |
| 320 | + out = run(["lake", "env", "lean", str(solve / "ShoalAxioms.lean")], proof, timeout, logs / "axioms.log", nobody=True, env=env) if names else "" | |
| 321 | + for t in names: | |
| 322 | + found = re.findall(rf"'{re.escape(t)}' (does not depend on any axioms|depends on axioms: \[([^\]]*)\])", out) | |
| 323 | + extra = sorted({a for _, listed in found for a in listed.replace(",", " ").split()} - set(spec["permitted_axioms"])) | |
| 324 | + if extra: | |
| 325 | + raise Wrong(f"{t} depends on {', '.join(extra)}: only {', '.join(spec['permitted_axioms'])} are permitted") | |
| 326 | + if not found: | |
| 327 | + raise Wrong(f"Lean did not say which axioms {t} depends on") | |
| 328 | + reported, configs, theorems = len(names), [], [] | |
| 329 | + for i, (name, config) in enumerate(configs): | |
| 330 | + export(config["solution_module"], targets(config), solve / f"solution-{i}.export", proof, timeout, True, env) | |
| 331 | + if theorems: | |
| 332 | + # the theorems, in scope through the approved axioms file's imports, compiled as a module of their own | |
| 333 | + (solve / "ShoalTheorems.lean").write_text("".join(f"import {m}\n" for m in imports_of(approved / spec["axioms_file"]))) | |
| 334 | + chown_nobody(solve) | |
| 335 | + run(["lake", "env", "lean", "-R", str(solve), "-o", str(solve / "ShoalTheorems.olean"), str(solve / "ShoalTheorems.lean")], | |
| 336 | + proof, timeout, logs / "theorems.log", nobody=True, env=env) | |
| 337 | + config = {"permitted_axioms": spec["permitted_axioms"], "theorem_names": theorems} | |
| 338 | + export("ShoalTheorems", targets(config), solve / "theorems.export", proof, timeout, True, | |
| 339 | + {**env, "LEAN_PATH": str(solve)}) | |
| 340 | + finally: | |
| 341 | + kill_nobody() | |
| 342 | + # 3. the judge, as nobody, on the exports alone | |
| 343 | + for i, (name, config) in enumerate(configs): | |
| 344 | + # the configuration as parsed, where nobody can read it: the runner's job folder is closed to others (12-01) | |
| 345 | + mine_config = judge / f"{i}-{Path(name).name}" | |
| 346 | + mine_config.write_text(json.dumps(config)) | |
| 347 | + cmd, more = judge_command(spec, mine_config, judge / f"challenge-{i}.export", solve / f"solution-{i}.export", | |
| 348 | + (config["challenge_module"], config["solution_module"]), judge) | |
| 349 | + out = run(cmd, judge, timeout, logs / f"comparator-{i}.log", nobody=True, env={**env_for(judge), **more}) | |
| 350 | + missing = [s for s in spec["comparator_success"] if s not in out] | |
| 351 | + if missing: | |
| 352 | + raise Wrong(f"Comparator on {name} did not say: {missing[0]}") | |
| 353 | + if theorems: | |
| 354 | + # Comparator with the theorems' export as both sides: the statements trivially agree, so what it judges is | |
| 355 | + # the axioms and the kernel's replay | |
| 356 | + gen = judge / "theorems.json" | |
| 357 | + gen.write_text(json.dumps({"challenge_module": "ShoalTheorems", "solution_module": "ShoalTheorems", "theorem_names": theorems, | |
| 358 | + "permitted_axioms": spec["permitted_axioms"]})) | |
| 359 | + cmd, more = judge_command(spec, gen, solve / "theorems.export", solve / "theorems.export", ("ShoalTheorems", "ShoalTheorems"), judge) | |
| 360 | + out = run(cmd, judge, timeout, logs / "axioms.log", nobody=True, env={**env_for(judge), **more}) | |
| 361 | + if "Your solution is okay!" not in out: | |
| 362 | + raise Wrong("Comparator did not accept the theorems' axioms") | |
| 363 | + said = ["lake build passes with no sorry"] | |
| 364 | + if reported: | |
| 365 | + said.append(f"{reported} theorem(s) report {', '.join(spec['permitted_axioms'])} only") | |
| 366 | + if not replay: | |
| 367 | + said.append("not replayed: Comparator judges this project once per maintainer round") | |
| 368 | + if theorems: | |
| 369 | + said.append(f"{len(theorems)} theorem(s) on {', '.join(spec['permitted_axioms'])} only") | |
| 370 | + if configs: | |
| 371 | + said.append(f"Comparator accepts {', '.join(name for name, _ in configs)}") | |
| 372 | + print("ok: " + "; ".join(said)) | |
| 373 | + return 0 | |
| 374 | + except Wrong as e: | |
| 375 | + print(f"FAILED: {e}") | |
| 376 | + return 1 | |
| 377 | + except (OSError, ValueError, KeyError) as e: | |
| 378 | + print(f"FAILED: {e}") | |
| 379 | + return 1 | |
| 380 | + finally: | |
| 381 | + kill_nobody() | |
| 382 | + shutil.rmtree(work, ignore_errors=True) | |
| 383 | + | |
| 384 | + | |
| 385 | +if __name__ == "__main__": | |
| 386 | + sys.exit(main(sys.argv)) | |
+18 −0 checks/build.sbatch added View file
| @@ -0,0 +1,18 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +#SBATCH --job-name=lake-build | |
| 3 | +#SBATCH --partition=lean | |
| 4 | +#SBATCH --time=12:00:00 | |
| 5 | +#SBATCH --cpus-per-task=4 | |
| 6 | +#SBATCH --mem=24G | |
| 7 | +# lake build (the submission's default targets, WilsonReference and WilsonConstruction, as the Yang–Mills group's | |
| 8 | +# scripts/verify.py builds them), the sorry gate, and Comparator on comparator.json, on the pushed commit ($SS_INPUT), in | |
| 9 | +# the project's Lean image (docker/) with no network. The approved checks/build.py and checks/build.json say what is run; | |
| 10 | +# the image holds the toolchain, the dependencies, the pinned Comparator tools and a build of the approved main, so only | |
| 11 | +# what the commit changed is rebuilt. Logs go beside the job's output. | |
| 12 | +# Measured on the production host (12-02, shoal-ym-lean:319ecd52 4e41c481cb84, the runner's flags): a push of main | |
| 13 | +# takes 28.8 min on one core (the export of Solution 177 s and 3.2 GB, holding 14 GB while it runs; Comparator with | |
| 14 | +# Lean's kernel 1,500 s), memory.peak 16.4 GB, 3.7 GB of scratch. A change recompiles its importers on top: the median | |
| 15 | +# module has 1,445, some 9,325 (the whole compile took 2 h 21 min on 32 cores). The runner holds 48 CPUs for every | |
| 16 | +# job: 4 here. | |
| 17 | +set -euo pipefail | |
| 18 | +BUILD_LOGS="$PWD/logs" python3 -I checks/build.py "$SS_INPUT" checks/build.json | |
+221 −0 checks/challenge.py added View file
| @@ -0,0 +1,221 @@ | ||
| 1 | +#!/usr/bin/env python3 | |
| 2 | +"""The `challenge` check: a push may change how the theorems are proved, never what is proved or how it is judged. | |
| 3 | + | |
| 4 | +Usage: challenge.py <commit's tree> [<frozen.json>] | |
| 5 | + | |
| 6 | +This is leanprover-community/riemann-hypothesis's `challenge-files.yml` ("Comparator challenge files and build | |
| 7 | +configuration are unchanged"), made a check of this site. Upstream compares a pull request's head with the commit it | |
| 8 | +branched off; here the approved version of the project is the reference, and `frozen.json`, beside this script in | |
| 9 | +that version, records what it holds: | |
| 10 | + | |
| 11 | +- `files`: the Comparator challenge, its configuration and the statements they import, each by its SHA-256. A commit | |
| 12 | + fails if any of them is missing or differs (Comparator would accept a change there, since both sides would see it). | |
| 13 | +- `lakefile`: `lakefile.toml` as approved, without the keys a pull request may change (FREE: `leanOptions`, | |
| 14 | + `defaultTargets`, `lean_exe`, `[cache]`, and each `require`'s `rev`). The libraries, their sources, Lean's arguments | |
| 15 | + and the dependencies' names and addresses stay as they are, so `Challenge` and the solution keep naming these files. | |
| 16 | +- `manifest`: the settings of `lake-manifest.json` (everything but its packages) and where Mathlib comes from. | |
| 17 | + | |
| 18 | +It also fails a commit that adds `lakefile.lean` (Lake reads it instead of `lakefile.toml`), lists a package that is not | |
| 19 | +a Git repository of leanprover or leanprover-community on GitHub nor one in `trusted`, names a toolchain that is not a | |
| 20 | +release of leanprover/lean4, adds files under `.lake/`, or holds a symbolic link among the frozen files; and, as | |
| 21 | +upstream's build does, one that puts `sorry`, `admit`, an `axiom`, `native_decide`, `implemented_by` or `extern` in its | |
| 22 | +Lean source (comments and strings skipped). | |
| 23 | + | |
| 24 | +A Mathlib or toolchain bump passes: it changes `rev`, the packages' revisions and `lean-toolchain`. The `build` check | |
| 25 | +then needs a Lean image for it. It reads files only and runs nothing from the commit. Standard library only, Python | |
| 26 | +3.11 or newer (tomllib). Exit 0 passes, 1 fails. | |
| 27 | +""" | |
| 28 | + | |
| 29 | +from __future__ import annotations | |
| 30 | + | |
| 31 | +import hashlib | |
| 32 | +import json | |
| 33 | +import os | |
| 34 | +import re | |
| 35 | +import sys | |
| 36 | +import tomllib | |
| 37 | +from pathlib import Path | |
| 38 | + | |
| 39 | +FREE = {"leanOptions", "defaultTargets", "lean_exe", "cache"} | |
| 40 | +TRUSTED = ("https://github.com/leanprover-community/", "https://github.com/leanprover/") | |
| 41 | +TOOLCHAIN = re.compile(r"leanprover/lean4:v[0-9][0-9A-Za-z.+-]*") | |
| 42 | +FORBIDDEN = [ | |
| 43 | + (re.compile(r"\bsorry\b"), "sorry"), | |
| 44 | + (re.compile(r"\bsorryAx\b"), "sorryAx"), # the axiom behind sorry, which \bsorry\b does not see | |
| 45 | + # the tactic, not a field or projection that happens to be called admit (`admit : P x`, `h.admit`, `admit (x)`) | |
| 46 | + (re.compile(r"(?<![.\w'])admit\b(?!['\w])(?![ \t]*[:(])"), "admit"), | |
| 47 | + (re.compile(r"(?m)^[ \t]*(?:@\[[^\]]*\][ \t]*)?(?:(?:private|protected|noncomputable)[ \t]+)*axiom\b"), "an axiom declaration"), | |
| 48 | + (re.compile(r"\bnative_decide\b"), "native_decide"), | |
| 49 | + (re.compile(r"\bimplemented_by\b"), "implemented_by"), | |
| 50 | + (re.compile(r"@\[\s*extern\b"), "extern"), | |
| 51 | +] | |
| 52 | +# a file without any of these words anywhere, comments included, needs no closer look | |
| 53 | +ANY = re.compile(r"sorry|admit|axiom|native_decide|implemented_by|extern") | |
| 54 | +SKIP_DIRS = {".git", ".lake", "lake-packages", "__pycache__", "node_modules"} | |
| 55 | + | |
| 56 | + | |
| 57 | +def strip(text: str) -> str: | |
| 58 | + """Lean source without its comments and string literals: `--` to the end of the line, nested `/- … -/`, and | |
| 59 | + "…" with its escapes. What is left is code, so a docstring that mentions `sorry` is not a `sorry`.""" | |
| 60 | + out: list[str] = [] | |
| 61 | + i, n, depth = 0, len(text), 0 | |
| 62 | + while i < n: | |
| 63 | + if depth: | |
| 64 | + if text.startswith("/-", i): | |
| 65 | + depth += 1 | |
| 66 | + i += 2 | |
| 67 | + elif text.startswith("-/", i): | |
| 68 | + depth -= 1 | |
| 69 | + i += 2 | |
| 70 | + else: | |
| 71 | + if text[i] == "\n": | |
| 72 | + out.append("\n") | |
| 73 | + i += 1 | |
| 74 | + continue | |
| 75 | + if text.startswith("/-", i): | |
| 76 | + depth = 1 | |
| 77 | + i += 2 | |
| 78 | + elif text.startswith("--", i): | |
| 79 | + j = text.find("\n", i) | |
| 80 | + i = n if j < 0 else j | |
| 81 | + elif text[i] == '"': | |
| 82 | + i += 1 | |
| 83 | + while i < n and text[i] != '"': | |
| 84 | + i += 2 if text[i] == "\\" else 1 | |
| 85 | + i += 1 | |
| 86 | + elif text[i] == "'" and i + 2 < n and text[i + 2] == "'": | |
| 87 | + i += 3 # a character literal such as '"' | |
| 88 | + else: | |
| 89 | + out.append(text[i]) | |
| 90 | + i += 1 | |
| 91 | + return "".join(out) | |
| 92 | + | |
| 93 | + | |
| 94 | +def sha256(path: Path) -> str: | |
| 95 | + h = hashlib.sha256() | |
| 96 | + with path.open("rb") as f: | |
| 97 | + for block in iter(lambda: f.read(1 << 20), b""): | |
| 98 | + h.update(block) | |
| 99 | + return h.hexdigest() | |
| 100 | + | |
| 101 | + | |
| 102 | +def lakefile_view(text: str) -> dict: | |
| 103 | + """lakefile.toml without what a pull request may change: upstream's `lakefile()`.""" | |
| 104 | + config = tomllib.loads(text) | |
| 105 | + view = {key: value for key, value in config.items() if key not in FREE} | |
| 106 | + view["require"] = [{key: value for key, value in require.items() if key != "rev"} for require in config.get("require", [])] | |
| 107 | + return view | |
| 108 | + | |
| 109 | + | |
| 110 | +def manifest_view(text: str) -> tuple[dict, dict]: | |
| 111 | + """lake-manifest.json's settings, and its packages by name: upstream's `manifest()`.""" | |
| 112 | + data = json.loads(text) | |
| 113 | + return {key: value for key, value in data.items() if key != "packages"}, {p.get("name"): p for p in data.get("packages", [])} | |
| 114 | + | |
| 115 | + | |
| 116 | +def canonical(value) -> str: | |
| 117 | + return json.dumps(value, sort_keys=True, ensure_ascii=False) | |
| 118 | + | |
| 119 | + | |
| 120 | +def frozen_of(root: Path, files: list[str], trusted: list[str]) -> dict: | |
| 121 | + """What frozen.json holds for a tree: run on the approved version to make it (`--freeze`).""" | |
| 122 | + settings, packages = manifest_view((root / "lake-manifest.json").read_text(encoding="utf-8")) | |
| 123 | + return { | |
| 124 | + "files": {path: sha256(root / path) for path in files}, | |
| 125 | + "lakefile": json.loads(canonical(lakefile_view((root / "lakefile.toml").read_text(encoding="utf-8")))), | |
| 126 | + "manifest": {"settings": settings, "mathlib": (packages.get("mathlib") or {}).get("url")}, | |
| 127 | + "trusted": trusted, | |
| 128 | + } | |
| 129 | + | |
| 130 | + | |
| 131 | +def lean_files(root: Path): | |
| 132 | + for here, dirs, names in os.walk(root): | |
| 133 | + dirs[:] = sorted(d for d in dirs if d not in SKIP_DIRS) | |
| 134 | + for name in sorted(names): | |
| 135 | + if name.endswith(".lean"): | |
| 136 | + yield Path(here) / name | |
| 137 | + | |
| 138 | + | |
| 139 | +def check(root: Path, frozen: dict) -> tuple[list[str], str]: | |
| 140 | + wrong: list[str] = [] | |
| 141 | + for rel, want in sorted(frozen["files"].items()): | |
| 142 | + p = root / rel | |
| 143 | + if p.is_symlink() or (p.exists() and not p.is_file()): | |
| 144 | + wrong.append(f"{rel} is not a plain file: it is a Comparator challenge file") | |
| 145 | + elif not p.is_file(): | |
| 146 | + wrong.append(f"{rel} is missing: it is a Comparator challenge file") | |
| 147 | + elif sha256(p) != want: | |
| 148 | + wrong.append(f"{rel} differs from the approved version: it is a Comparator challenge file") | |
| 149 | + if (root / "lakefile.lean").exists(): | |
| 150 | + wrong.append("lakefile.lean is added: Lake would read it instead of lakefile.toml") | |
| 151 | + try: | |
| 152 | + lake = root / "lakefile.toml" | |
| 153 | + if not lake.is_file() or canonical(lakefile_view(lake.read_text(encoding="utf-8"))) != canonical(frozen["lakefile"]): | |
| 154 | + wrong.append("lakefile.toml changes other than in a require's rev, leanOptions, defaultTargets, lean_exe or [cache]") | |
| 155 | + settings, packages = manifest_view((root / "lake-manifest.json").read_text(encoding="utf-8")) | |
| 156 | + if canonical(settings) != canonical(frozen["manifest"]["settings"]): | |
| 157 | + wrong.append("lake-manifest.json: its settings change") | |
| 158 | + if (packages.get("mathlib") or {}).get("url") != frozen["manifest"]["mathlib"]: | |
| 159 | + wrong.append("lake-manifest.json: where Mathlib comes from changes") | |
| 160 | + for name, package in packages.items(): | |
| 161 | + url = str(package.get("url")) | |
| 162 | + if package.get("type") != "git" or not (url.startswith(TRUSTED) or url in frozen.get("trusted", [])): | |
| 163 | + wrong.append(f"lake-manifest.json: the package {name} is not a Git repository of leanprover-community or leanprover on GitHub, nor one this project trusts") | |
| 164 | + except (OSError, ValueError, tomllib.TOMLDecodeError, AttributeError) as problem: | |
| 165 | + wrong.append(f"the build configuration could not be read: {problem}") | |
| 166 | + toolchain = (root / "lean-toolchain").read_text(encoding="utf-8").strip() if (root / "lean-toolchain").is_file() else "" | |
| 167 | + if not TOOLCHAIN.fullmatch(toolchain): | |
| 168 | + wrong.append(f"lean-toolchain: {toolchain!r} is not a release of leanprover/lean4") | |
| 169 | + if (root / ".lake").exists(): | |
| 170 | + wrong.append(".lake/ is added: Lake keeps what it builds and fetches there") | |
| 171 | + files = lines = 0 | |
| 172 | + for p in lean_files(root): | |
| 173 | + rel = p.relative_to(root).as_posix() | |
| 174 | + text = p.read_text(encoding="utf-8", errors="replace") | |
| 175 | + files += 1 | |
| 176 | + lines += text.count("\n") | |
| 177 | + if rel in frozen["files"] or not ANY.search(text): | |
| 178 | + continue | |
| 179 | + code = strip(text) | |
| 180 | + for rx, what in FORBIDDEN: | |
| 181 | + m = rx.search(code) | |
| 182 | + if m: | |
| 183 | + wrong.append(f"{rel}:{code.count(chr(10), 0, m.start()) + 1} uses {what}") | |
| 184 | + break | |
| 185 | + return wrong, f"{len(frozen['files'])} challenge files and the build configuration as approved; {files} Lean files, {lines} lines, toolchain {toolchain}" | |
| 186 | + | |
| 187 | + | |
| 188 | +def main(argv: list[str]) -> int: | |
| 189 | + if len(argv) >= 2 and argv[1] == "--freeze": | |
| 190 | + # challenge.py --freeze <approved tree> <frozen file>... [--trust <url>]...: print frozen.json for that tree | |
| 191 | + args, trusted = argv[3:], [] | |
| 192 | + while "--trust" in args: | |
| 193 | + i = args.index("--trust") | |
| 194 | + trusted.append(args[i + 1]) | |
| 195 | + del args[i:i + 2] | |
| 196 | + print(json.dumps(frozen_of(Path(argv[2]), args, trusted), indent=2, ensure_ascii=False)) | |
| 197 | + return 0 | |
| 198 | + if len(argv) < 2: | |
| 199 | + print(__doc__.strip().splitlines()[2]) | |
| 200 | + return 2 | |
| 201 | + root = Path(argv[1]) | |
| 202 | + frozen = json.loads((Path(argv[2]) if len(argv) > 2 else Path(__file__).with_name("frozen.json")).read_text(encoding="utf-8")) | |
| 203 | + if not any(lean_files(root)): | |
| 204 | + print("Nothing to check yet: the commit holds no Lean file.") | |
| 205 | + return 0 | |
| 206 | + wrong, said = check(root, frozen) | |
| 207 | + for w in wrong[:50]: | |
| 208 | + print(w) | |
| 209 | + if len(wrong) > 50: | |
| 210 | + print(f"… and {len(wrong) - 50} more") | |
| 211 | + if wrong: | |
| 212 | + print("These files say what the proof is judged against and how it is built, and a pull request may not change them;") | |
| 213 | + print("if one has to, open an issue titled \"Ruling: …\" for a person who maintains the project.") | |
| 214 | + print(f"FAILED: {wrong[0]}") | |
| 215 | + return 1 | |
| 216 | + print(f"ok: {said}") | |
| 217 | + return 0 | |
| 218 | + | |
| 219 | + | |
| 220 | +if __name__ == "__main__": | |
| 221 | + sys.exit(main(sys.argv)) | |
+10 −0 checks/challenge.sbatch added View file
| @@ -0,0 +1,10 @@ | ||
| 1 | +#!/bin/bash | |
| 2 | +#SBATCH --job-name=challenge | |
| 3 | +#SBATCH --time=5:00 | |
| 4 | +# Comparator challenge files and build configuration are unchanged (upstream's challenge-files.yml): the approved | |
| 5 | +# checks/challenge.py compares the pushed commit ($SS_INPUT) with what checks/frozen.json records of the approved | |
| 6 | +# version, and looks through its Lean source for sorry, admit, axiom and the like. It reads files only and runs nothing | |
| 7 | +# from the commit. The job's working directory is the approved version, so a branch that edits checks/ changes nothing | |
| 8 | +# about its own verdict. | |
| 9 | +set -euo pipefail | |
| 10 | +python3 -I checks/challenge.py "$SS_INPUT" checks/frozen.json | |
+64 −0 checks/frozen.json added View file
| @@ -0,0 +1,64 @@ | ||
| 1 | +{ | |
| 2 | + "files": { | |
| 3 | + "Challenge.lean": "d31b227db6e6e1f2aa5eaa66d3b004609fe7470dc2ac3825e0dce882a5fa4fe9", | |
| 4 | + "ChallengeSpec.lean": "e48b0be2b72d16b9b87c6c1923b3ae814270387bf9312b5cb0661dfa3e243749", | |
| 5 | + "PublicWilson.lean": "c1542c816cd42d23448b66b4cb021c7f3bdad64b64f1c643dde27147ce0c3233", | |
| 6 | + "PublicTheory.lean": "94111ad258b4218a263fcc0a7136446d5a6eff0e090809b72036fb3a7aecfff8", | |
| 7 | + "comparator.json": "23e159f10cdb40b780ad8b42a2fc62d2f8e995ee932d955c97e54526d476b967", | |
| 8 | + "verification/Inventory.lean": "e93ca65cc85d9843e109e31af0e2c1b47e53c06c107d5ab88580f65e83d47c6f" | |
| 9 | + }, | |
| 10 | + "lakefile": { | |
| 11 | + "lean_lib": [ | |
| 12 | + { | |
| 13 | + "name": "YM" | |
| 14 | + }, | |
| 15 | + { | |
| 16 | + "name": "WilsonPublic", | |
| 17 | + "roots": [ | |
| 18 | + "PublicTheory", | |
| 19 | + "PublicWilson", | |
| 20 | + "ChallengeSpec" | |
| 21 | + ] | |
| 22 | + }, | |
| 23 | + { | |
| 24 | + "name": "WilsonReference", | |
| 25 | + "roots": [ | |
| 26 | + "Challenge" | |
| 27 | + ] | |
| 28 | + }, | |
| 29 | + { | |
| 30 | + "name": "WilsonConstruction", | |
| 31 | + "roots": [ | |
| 32 | + "PublicView", | |
| 33 | + "WilsonBridge", | |
| 34 | + "HierarchyBridge", | |
| 35 | + "TraceBridge", | |
| 36 | + "ContactSpec", | |
| 37 | + "ContactBridge", | |
| 38 | + "Construction", | |
| 39 | + "Solution", | |
| 40 | + "ConcreteSU2" | |
| 41 | + ] | |
| 42 | + } | |
| 43 | + ], | |
| 44 | + "name": "ym_core", | |
| 45 | + "require": [ | |
| 46 | + { | |
| 47 | + "git": "https://github.com/leanprover-community/mathlib4.git", | |
| 48 | + "name": "mathlib" | |
| 49 | + } | |
| 50 | + ], | |
| 51 | + "version": "0.1.0" | |
| 52 | + }, | |
| 53 | + "manifest": { | |
| 54 | + "settings": { | |
| 55 | + "version": "1.2.0", | |
| 56 | + "packagesDir": ".lake/packages", | |
| 57 | + "name": "ym_core", | |
| 58 | + "lakeDir": ".lake", | |
| 59 | + "fixedToolchain": true | |
| 60 | + }, | |
| 61 | + "mathlib": "https://github.com/leanprover-community/mathlib4.git" | |
| 62 | + }, | |
| 63 | + "trusted": [] | |
| 64 | +} | |
+78 −0 docker/README.md added View file
| @@ -0,0 +1,78 @@ | ||
| 1 | +# Lean image | |
| 2 | + | |
| 3 | +`lean.Dockerfile` builds the image the yang-mills-mass-gap build check runs in. Tag: | |
| 4 | + | |
| 5 | +``` | |
| 6 | +shoal-ym-lean:319ecd52 | |
| 7 | +``` | |
| 8 | + | |
| 9 | +`scienceslack.json` refers to this exact name. | |
| 10 | + | |
| 11 | +## Build | |
| 12 | + | |
| 13 | +On the machine whose runner will use it, from a checkout of the project's main (the context is that checkout: its | |
| 14 | +tree goes into the image as the check's commits will be): | |
| 15 | + | |
| 16 | +```bash | |
| 17 | +sh docker/build.sh <checkout of the project's main> shoal-ym-lean:319ecd52 | |
| 18 | +# on the Beijing host, on given cores: | |
| 19 | +MIRRORS=cn CPUSET=32-63 sh docker/build.sh <checkout of the project's main> shoal-ym-lean:319ecd52 | |
| 20 | +``` | |
| 21 | + | |
| 22 | +`build.sh` does it in two steps, so that a failure late in the compile loses nothing. First `docker build` of | |
| 23 | +`lean.Dockerfile` (tag `shoal-ym-lean:319ecd52-base`): the tools, the toolchain, each package of `lake-manifest.json` fetched as the | |
| 24 | +one commit it is pinned at, Mathlib's cache, and the tree. Then `lake build` in a container with no network; when it | |
| 25 | +ends, `.lake/build` is given to `nobody` (the check builds a commit in place on top of it, `"in_place"` in | |
| 26 | +`checks/build.json`) and the container is committed as `shoal-ym-lean:319ecd52`. If either step stops, run the same command again: the | |
| 27 | +layers already built are kept, and the container goes on from what Lake had compiled. | |
| 28 | + | |
| 29 | +The build needs the network (GitHub, the Lean release downloads, Go and Rust or their mirrors, the Mathlib cache). | |
| 30 | +Nothing is published: the runner that runs the check must have the image locally. | |
| 31 | + | |
| 32 | +**Built on the production host, 12-02** (cores 32-63, `MIRRORS=cn`): the long step compiled 18,126 jobs in 2 h 21 | |
| 33 | +min; `.lake/build` is 33 GB (its `*.setup.json` files kept), `nobody`'s. That image (91511450029f) had the default | |
| 34 | +targets only; the libraries `YM` and `WilsonPublic` were then built on top as `nobody` (3 more jobs, 10 s) and | |
| 35 | +committed under the same tag: `shoal-ym-lean:319ecd52`, image id `4e41c481cb84`, 58.4 GB (`-base` 19.4 GB). | |
| 36 | +`build.sh` now builds every `lean_lib` in its long step. What a check costs on it: `checks/build.sbatch`'s comment. | |
| 37 | + | |
| 38 | +## What is in it | |
| 39 | + | |
| 40 | +- `/opt/elan`: elan with the submission's toolchain (v4.32.0, the default) and Comparator's (v4.34.0), so `lake` works offline. | |
| 41 | +- `/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`. | |
| 42 | +- `/opt/tools`: Comparator and lean4export, each checked out at its pin and built with `lake build <name>`, as the group's `scripts/verify.py` builds them. | |
| 43 | +- On `PATH`: `lake`, `lean`, `comparator`, `lean4export`, `landrun`, `nanoda_bin`; also `python3`, `git`, `curl`, `zstd` and a C toolchain. | |
| 44 | + | |
| 45 | +## How the check uses it | |
| 46 | + | |
| 47 | +`checks/build.py` (`scripts/lean-ci/README.md`) with `"in_place": true` and the standalone Comparator: the approved | |
| 48 | +`Challenge` is built and exported as root, the commit is built as `nobody` in the image's own `.lake/build` (its | |
| 49 | +default targets, then every library: Lake recompiles only what the commit changed), `Solution` is exported, and | |
| 50 | +`comparator` judges the two exports, `landrun` replaced by a stand-in that serves them. `landrun` is in the image but | |
| 51 | +the check does not use it: Comparator's own sandbox is not what holds the commit (the shared README says why). | |
| 52 | + | |
| 53 | +`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). | |
| 54 | + | |
| 55 | +**The build is long and the image is big.** The project is 9,477 Lean files (about 988,000 lines). Mathlib comes | |
| 56 | +from its cache; the project's own compile is the long step above. The group's record is 11,036 s (about three hours) | |
| 57 | +on a Mac with a Mathlib cache. | |
| 58 | + | |
| 59 | +## Pins | |
| 60 | + | |
| 61 | +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. | |
| 62 | + | |
| 63 | +| ARG | Value | Source | | |
| 64 | +| --- | --- | --- | | |
| 65 | +| `UPSTREAM_COMMIT` | `319ecd5274241200b27bb5b143a59133fd670ea6` | yang-mills-group/YM, `upstream.json` | | |
| 66 | +| `SUBDIR`, `SUBDIR_TREE` | `submissions/openai-20261028/submission`, `7f4a40cdb1b5fc1586d9a2619be308dd28f45fe9` | `upstream.json` `subdir`; the folder's tree at that commit | | |
| 67 | +| `TOOLCHAIN` | `leanprover/lean4:v4.32.0` | the submission's `lean-toolchain` | | |
| 68 | +| `MATHLIB_COMMIT` | `81a5d257c8e410db227a6665ed08f64fea08e997` | the submission's `lakefile.toml` / `lake-manifest.json` (all nine packages are checked against the manifest) | | |
| 69 | +| `COMPARATOR_REV`, `COMPARATOR_TOOLCHAIN` | `d03acab154d269c06e60e4de7e4cc85deebff94b`, `leanprover/lean4:v4.34.0` | the group's `submissions/openai-20261028/verification/tool-pins.json` | | |
| 70 | +| `LEAN4EXPORT_REV` | `4e7915201d3f9f04470d9eae002fa695f7cdc589` (toolchain v4.32.0) | the same `tool-pins.json` | | |
| 71 | +| `LANDRUN_REV` | `811cfff51ceaf3d9843708aa6d22e9b84ccac8b4` (0.1.18) | PoincareConjecture `Comparator/README.md`. The group pinned none because it ran without landrun | | |
| 72 | +| `NANODA_REV` | `079049d584b2aed2b0172218164082f4fc6eede2` (0.4.18) | PoincareConjecture `Comparator/README.md`. The group ran no external kernel | | |
| 73 | +| `GO_VERSION`, `GO_SHA256` | 1.24.13 | landrun's `go.mod` asks for Go 1.24; checksum from go.dev | | |
| 74 | +| `RUST_VERSION` | 1.100.1 | Rust stable on 2026-12-01; nanoda builds with `cargo build --locked` | | |
| 75 | + | |
| 76 | +## Rebuild when main moves | |
| 77 | + | |
| 78 | +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. | |
+35 −0 docker/build.sh added View file
| @@ -0,0 +1,35 @@ | ||
| 1 | +#!/bin/sh | |
| 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-ym-lean:319ecd52} | |
| 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" | |
+169 −0 docker/lean.Dockerfile added View file
| @@ -0,0 +1,169 @@ | ||
| 1 | +# Lean image for the yang-mills-mass-gap `build` check (checks/build.py): everything before the long step. | |
| 2 | +# | |
| 3 | +# docker/build.sh builds this file with a checkout of the project's main as the context, then compiles the project in | |
| 4 | +# a container of the result and commits that container as the image the check uses (docker/README.md). The compile is | |
| 5 | +# 9,477 files (about 988,000 lines); as a layer, one failure late in it would lose all of it. | |
| 6 | +# | |
| 7 | +# The project's main is the folder submissions/openai-20261028/submission of yang-mills-group/YM at | |
| 8 | +# 319ecd5274241200b27bb5b143a59133fd670ea6 (OpenAI's | |
| 9 | +# October 2026 submission, as upstream.json's `subdir` takes it) with this project's own files on top. | |
| 10 | +# | |
| 11 | +# The check runs with --network none: it reads the commit's tree, uses /opt/proof/.lake (the dependencies, and the | |
| 12 | +# build of the approved main) and runs lake build, lean4export and Comparator. Nothing is downloaded at check time. | |
| 13 | +# | |
| 14 | +# Every pin is a full commit hash in an ARG below, checked once it is fetched. | |
| 15 | + | |
| 16 | +FROM ubuntu:24.04 | |
| 17 | + | |
| 18 | +# --- Where the downloads come from ------------------------------------------ | |
| 19 | + | |
| 20 | +# The defaults are each project's own servers. From Beijing (docker/build.sh with MIRRORS=cn): the Ubuntu archive by | |
| 21 | +# plain http from Aliyun (ca-certificates is not installed yet at the first apt step), Go from Aliyun, Go modules from | |
| 22 | +# goproxy.cn, Rust and its crates from rsproxy.cn. raw.githubusercontent.com is not used: Beijing cannot reach it. | |
| 23 | +ARG APT_MIRROR= | |
| 24 | +ARG GO_DL=https://go.dev/dl | |
| 25 | +ARG GOPROXY=https://proxy.golang.org,direct | |
| 26 | +ARG RUST_DIST=https://static.rust-lang.org | |
| 27 | +ARG CARGO_MIRROR= | |
| 28 | + | |
| 29 | +# --- Pins ------------------------------------------------------------------- | |
| 30 | + | |
| 31 | +# The project's lean-toolchain and, from its lakefile.toml, Mathlib; every package of lake-manifest.json is checked | |
| 32 | +# against its rev after the dependencies are fetched. | |
| 33 | +ARG TOOLCHAIN=leanprover/lean4:v4.32.0 | |
| 34 | +ARG MATHLIB_COMMIT=81a5d257c8e410db227a6665ed08f64fea08e997 | |
| 35 | + | |
| 36 | +# Comparator and lean4export as the Yang–Mills group pinned them for this submission | |
| 37 | +# (submissions/openai-20261028/verification/tool-pins.json in yang-mills-group/YM): Comparator is built with its own | |
| 38 | +# toolchain, lean4export with the submission's. | |
| 39 | +ARG COMPARATOR_REPO=https://github.com/leanprover/comparator | |
| 40 | +ARG COMPARATOR_REV=d03acab154d269c06e60e4de7e4cc85deebff94b | |
| 41 | +ARG COMPARATOR_TOOLCHAIN=leanprover/lean4:v4.34.0 | |
| 42 | +ARG LEAN4EXPORT_REPO=https://github.com/leanprover/lean4export | |
| 43 | +ARG LEAN4EXPORT_REV=4e7915201d3f9f04470d9eae002fa695f7cdc589 | |
| 44 | + | |
| 45 | +# Comparator's sandbox and a second kernel. The group ran Comparator with its development launcher (no landrun, no | |
| 46 | +# external kernel) and pinned neither; these are the pins PoincareConjecture's Comparator/README.md gives, as in | |
| 47 | +# navier-stokes. comparator.json does not enable nanoda, so the check uses Lean's kernel only; nanoda_bin is here for | |
| 48 | +# a run with a second kernel (README.md). | |
| 49 | +ARG LANDRUN_REV=811cfff51ceaf3d9843708aa6d22e9b84ccac8b4 | |
| 50 | +# ^ landrun 0.1.18 | |
| 51 | +ARG NANODA_REV=079049d584b2aed2b0172218164082f4fc6eede2 | |
| 52 | +# ^ nanoda_lib 0.4.18 | |
| 53 | + | |
| 54 | +# Build tools for landrun (go.mod asks for Go 1.24) and nanoda (Rust), used here and removed. | |
| 55 | +ARG GO_VERSION=1.24.13 | |
| 56 | +ARG GO_SHA256=1fc94b57134d51669c72173ad5d49fd62afb0f1db9bf3f798fd98ee423f8d730 | |
| 57 | +ARG RUST_VERSION=1.100.1 | |
| 58 | + | |
| 59 | +# --- System packages -------------------------------------------------------- | |
| 60 | + | |
| 61 | +# python3 runs the check; curl and zstd are what Lake and Mathlib's cache tool use. | |
| 62 | +ENV DEBIAN_FRONTEND=noninteractive | |
| 63 | +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 \ | |
| 64 | + && apt-get update && apt-get install -y --no-install-recommends \ | |
| 65 | + ca-certificates curl git python3 build-essential zstd \ | |
| 66 | + && rm -rf /var/lib/apt/lists/* | |
| 67 | + | |
| 68 | +# The check runs Lake as another user than the one that built; let git (Lake asks it about each package) read every | |
| 69 | +# repository in the image. | |
| 70 | +RUN git config --system --add safe.directory '*' | |
| 71 | + | |
| 72 | +# --- landrun ---------------------------------------------------------------- | |
| 73 | + | |
| 74 | +# (a clone from github.com sometimes breaks off in TLS from Beijing: each is tried five times) | |
| 75 | +RUN curl -sSfL --retry 5 "${GO_DL}/go${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tgz \ | |
| 76 | + && echo "${GO_SHA256} /tmp/go.tgz" | sha256sum -c - \ | |
| 77 | + && tar -C /tmp -xzf /tmp/go.tgz \ | |
| 78 | + && 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 \ | |
| 79 | + && git -C /tmp/landrun checkout "${LANDRUN_REV}" \ | |
| 80 | + && test "$(git -C /tmp/landrun rev-parse HEAD)" = "${LANDRUN_REV}" \ | |
| 81 | + && cd /tmp/landrun \ | |
| 82 | + && GOPROXY="${GOPROXY}" GOTOOLCHAIN=local GOPATH=/tmp/gopath GOCACHE=/tmp/gocache /tmp/go/bin/go build -o /usr/local/bin/landrun ./cmd/landrun \ | |
| 83 | + && cd / && rm -rf /tmp/go /tmp/go.tgz /tmp/landrun /tmp/gopath /tmp/gocache | |
| 84 | + | |
| 85 | +# --- nanoda_bin ------------------------------------------------------------- | |
| 86 | + | |
| 87 | +RUN export RUSTUP_HOME=/tmp/rustup CARGO_HOME=/tmp/cargo RUSTUP_DIST_SERVER="${RUST_DIST}" RUSTUP_UPDATE_ROOT="${RUST_DIST}/rustup" \ | |
| 88 | + && curl -sSfL --retry 5 "${RUST_DIST}/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" -o /tmp/rustup-init && chmod +x /tmp/rustup-init \ | |
| 89 | + && (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) \ | |
| 90 | + && 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 \ | |
| 91 | + && 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 \ | |
| 92 | + && git -C /tmp/nanoda checkout "${NANODA_REV}" \ | |
| 93 | + && test "$(git -C /tmp/nanoda rev-parse HEAD)" = "${NANODA_REV}" \ | |
| 94 | + && cd /tmp/nanoda \ | |
| 95 | + && /tmp/cargo/bin/cargo build --release --locked --bin nanoda_bin \ | |
| 96 | + && install -m 0755 target/release/nanoda_bin /usr/local/bin/nanoda_bin \ | |
| 97 | + && cd / && rm -rf /tmp/rustup /tmp/cargo /tmp/nanoda /tmp/rustup-init | |
| 98 | + | |
| 99 | +# --- Lean ------------------------------------------------------------------- | |
| 100 | + | |
| 101 | +ENV ELAN_HOME=/opt/elan | |
| 102 | +ENV PATH=/usr/local/bin:/opt/elan/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin | |
| 103 | +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 \ | |
| 104 | + && /tmp/elan-init -y --no-modify-path --default-toolchain none && rm /tmp/elan-init | |
| 105 | +# (elan asks github.com too, and from Beijing one connection in a few to it hangs for two minutes and fails) | |
| 106 | +RUN for i in 1 2 3 4 5; do elan toolchain install "${TOOLCHAIN}" && elan toolchain install "${COMPARATOR_TOOLCHAIN}" && break; sleep 10; done \ | |
| 107 | + && elan default "${TOOLCHAIN}" && lean --version | |
| 108 | + | |
| 109 | +# --- Comparator and lean4export --------------------------------------------- | |
| 110 | + | |
| 111 | +# Each in its own checkout under /opt/tools, built by `lake build <name>` as the group's scripts/verify.py does, with | |
| 112 | +# the toolchain its lean-toolchain names. (Comparator's Lake fetches lean4export for itself: up to three tries.) | |
| 113 | +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 \ | |
| 114 | + && git -C /opt/tools/comparator checkout "${COMPARATOR_REV}" \ | |
| 115 | + && test "$(git -C /opt/tools/comparator rev-parse HEAD)" = "${COMPARATOR_REV}" \ | |
| 116 | + && test "$(cat /opt/tools/comparator/lean-toolchain)" = "${COMPARATOR_TOOLCHAIN}" \ | |
| 117 | + && cd /opt/tools/comparator && (for i in 1 2 3 4 5 6; do lake build comparator && exit 0; sleep 10; done; exit 1) \ | |
| 118 | + && ln -s /opt/tools/comparator/.lake/build/bin/comparator /usr/local/bin/comparator \ | |
| 119 | + && chmod -R a+rX /opt/tools /opt/elan | |
| 120 | +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 \ | |
| 121 | + && git -C /opt/tools/lean4export checkout "${LEAN4EXPORT_REV}" \ | |
| 122 | + && test "$(git -C /opt/tools/lean4export rev-parse HEAD)" = "${LEAN4EXPORT_REV}" \ | |
| 123 | + && test "$(cat /opt/tools/lean4export/lean-toolchain)" = "${TOOLCHAIN}" \ | |
| 124 | + && cd /opt/tools/lean4export && lake build lean4export \ | |
| 125 | + && ln -s /opt/tools/lean4export/.lake/build/bin/lean4export /usr/local/bin/lean4export \ | |
| 126 | + && chmod -R a+rX /opt/tools | |
| 127 | + | |
| 128 | +# --- The dependencies ------------------------------------------------------- | |
| 129 | + | |
| 130 | +# From the three files that name them, so that a change elsewhere in main does not fetch Mathlib's cache (5 GB) again. | |
| 131 | +# Each package of the manifest is fetched as the one commit it is pinned at, where Lake would clone it with its | |
| 132 | +# history: Mathlib's is about a gigabyte, and from Beijing github.com gave 0.6 MB/s and one connection in a few hung | |
| 133 | +# for two minutes (12-02). Lake finds each at its rev and fetches nothing. Then Mathlib's cache, up to six times: a few | |
| 134 | +# of its downloads fail now and then, and each try fetches what is still missing. | |
| 135 | +# chmod in this same layer: Mathlib's cache unpacks its files 0600, and the check compiles the commit as nobody (in a | |
| 136 | +# later layer the chmod would copy every file). | |
| 137 | +WORKDIR /opt/proof | |
| 138 | +COPY lakefile.toml lake-manifest.json lean-toolchain /opt/proof/ | |
| 139 | +RUN test "$(cat lean-toolchain)" = "${TOOLCHAIN}" \ | |
| 140 | + && python3 -I -c 'import json; [print(p["url"], p["name"], p["rev"]) for p in json.load(open("lake-manifest.json"))["packages"]]' > /tmp/packages \ | |
| 141 | + && while read -r url name rev; do \ | |
| 142 | + for i in 1 2 3 4 5 6 7 8; do \ | |
| 143 | + rm -rf ".lake/packages/$name" && git init -q ".lake/packages/$name" && git -C ".lake/packages/$name" remote add origin "$url" \ | |
| 144 | + && timeout 900 git -C ".lake/packages/$name" fetch -q --depth 1 origin "$rev" \ | |
| 145 | + && git -C ".lake/packages/$name" checkout -q --detach FETCH_HEAD && break; \ | |
| 146 | + sleep 5; \ | |
| 147 | + done; \ | |
| 148 | + test "$(git -C ".lake/packages/$name" rev-parse HEAD)" = "$rev" || { echo "not fetched: $name at $rev"; exit 1; }; \ | |
| 149 | + done < /tmp/packages && rm /tmp/packages \ | |
| 150 | + && (for i in 1 2 3 4 5 6; do lake exe cache get && exit 0; sleep 10; done; exit 1) \ | |
| 151 | + && test "$(git -C .lake/packages/mathlib rev-parse HEAD)" = "${MATHLIB_COMMIT}" \ | |
| 152 | + && rm -rf /root/.cache/mathlib \ | |
| 153 | + && chmod -R a+rX /opt/proof /opt/elan | |
| 154 | + | |
| 155 | +RUN for t in lean4export comparator landrun nanoda_bin lake lean python3; do \ | |
| 156 | + command -v "$t" >/dev/null || { echo "missing: $t"; exit 1; }; \ | |
| 157 | + done | |
| 158 | + | |
| 159 | +# --- The project ------------------------------------------------------------ | |
| 160 | + | |
| 161 | +# The context is a checkout of the project's main: its tree goes in whole, as the check's commits will be. | |
| 162 | +# docker/build.sh compiles it next (the default targets: WilsonReference, WilsonConstruction), in a container. | |
| 163 | +# (no chmod -R here: in a later layer it copies every file it visits, Mathlib's 7 GB included, changed or not; | |
| 164 | +# a checkout's files are readable as they come) | |
| 165 | +COPY . /opt/proof | |
| 166 | +RUN rm -rf .git | |
| 167 | + | |
| 168 | +ENV PROOF_BASE=/opt/proof | |
| 169 | +CMD ["/bin/bash"] | |