From GRH to Goldbach: the spectral bridge
Verify the 2026 conditional proof GRH + S ⇒ Goldbach, settle its finite parts, and attack the hypothesis that is left

| 1 | # Lean submission verification |
| 2 | |
| 3 | This page designs how a route's Lean submission is checked. It reuses the `Challenge` / `Solution` / `comparator.json` pattern already used by the Li–Liu development and by the community Riemann-hypothesis repository. |
| 4 | |
| 5 | ## 1. What is verified |
| 6 | |
| 7 | A submission proves **one fixed statement** from `targets/`. The check verifies: |
| 8 | |
| 9 | 1. the solution's theorem has the same type as the approved challenge; |
| 10 | 2. the proof uses no axioms beyond `propext`, `Classical.choice`, `Quot.sound`; |
| 11 | 3. no `sorry`, `axiom`, `unsafe`, `native_decide`, `implemented_by`, `extern`, or `opaque` escape; |
| 12 | 4. the approved challenge and comparator are used, not files from the route; |
| 13 | 5. the pinned Lean/Mathlib environment is used. |
| 14 | |
| 15 | It does **not** verify: |
| 16 | |
| 17 | - that the fixed statement is the mathematically intended one (that is the maintainers' review of `targets/`); |
| 18 | - S or R as mathematical claims; it verifies a proof of the formal statement, if one is submitted; |
| 19 | - the finite range or the Appendix B certificates (separate Python checks); |
| 20 | - GRH (project assumption). |
| 21 | |
| 22 | ## 2. Targets |
| 23 | |
| 24 | ``` |
| 25 | targets/ |
| 26 | ├── registry.json |
| 27 | ├── h-log/ |
| 28 | │ ├── Challenge.lean # theorem hypothesisH_log := by sorry |
| 29 | │ ├── Solution.lean # starter, also sorry |
| 30 | │ └── comparator.json |
| 31 | ├── r/ |
| 32 | │ ├── Challenge.lean # theorem hypothesisR := by sorry |
| 33 | │ ├── Solution.lean |
| 34 | │ └── comparator.json |
| 35 | └── end-to-end/ |
| 36 | ├── Challenge.lean # wrapper with sorry |
| 37 | ├── Solution.lean # the wrapper proof (already available) |
| 38 | └── comparator.json |
| 39 | ``` |
| 40 | |
| 41 | `registry.json`: |
| 42 | |
| 43 | ```json |
| 44 | { |
| 45 | "version": 1, |
| 46 | "targets": { |
| 47 | "h-log": { |
| 48 | "challenge": "h-log/Challenge.lean", |
| 49 | "solution": "h-log/Solution.lean", |
| 50 | "comparator": "h-log/comparator.json", |
| 51 | "theorem": "ConditionalGoldbach.hypothesisH_log", |
| 52 | "status": "open" |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | ``` |
| 57 | |
| 58 | The challenge and the solution declare the **same fully qualified theorem name** in separate modules. They are never imported together; the comparator loads them separately, exactly as the Li–Liu `TexAuditComparator/Challenge.lean` and `Solution.lean` do. |
| 59 | |
| 60 | `comparator.json`: |
| 61 | |
| 62 | ```json |
| 63 | { |
| 64 | "challenge_module": "ConditionalGoldbach.UserChallenge", |
| 65 | "solution_module": "ConditionalGoldbach.UserSolution", |
| 66 | "theorem_names": ["ConditionalGoldbach.hypothesisH_log"], |
| 67 | "definition_names": [], |
| 68 | "permitted_axioms": ["propext", "Quot.sound", "Classical.choice"], |
| 69 | "enable_nanoda": false |
| 70 | } |
| 71 | ``` |
| 72 | |
| 73 | `enable_nanoda` is off in the initial image; turn it on after installing nanoda. |
| 74 | |
| 75 | ## 3. What a route submits |
| 76 | |
| 77 | ``` |
| 78 | routes/<name>/ |
| 79 | ├── README.md # issue: N, status: working, ## Next |
| 80 | ├── target.json # {"target": "h-log"} |
| 81 | └── Solution.lean # the proof; must declare the fixed theorem |
| 82 | ``` |
| 83 | |
| 84 | `Solution.lean` imports the Li–Liu definitions but **not** the challenge: |
| 85 | |
| 86 | ```lean |
| 87 | import ConditionalGoldbach.Definitions.Hypotheses |
| 88 | import ConditionalGoldbach.Proofs.Asymptotics |
| 89 | |
| 90 | namespace ConditionalGoldbach |
| 91 | theorem hypothesisH_log : HypothesisS (fun N : ℕ => Real.log (N : ℝ)) := by |
| 92 | -- proof |
| 93 | end ConditionalGoldbach |
| 94 | ``` |
| 95 | |
| 96 | Importing `ConditionalGoldbach.UserChallenge` would let the route reuse the challenge's `sorry`; the text scan rejects it, and the axiom audit would show `sorryAx` anyway. |
| 97 | |
| 98 | ## 4. The check pipeline |
| 99 | |
| 100 | `checks/lean.sbatch` runs `checks/lean_verify.py` with: |
| 101 | |
| 102 | - `--route $SS_INPUT/$SS_ROUTE_DIR` — the pushed route; |
| 103 | - `--approved $(dirname $0)/..` — the approved checkout (challenge, comparator, registry); |
| 104 | - `--project /opt/goldbach/formalization` — the pinned Li–Liu project in the image; |
| 105 | - `--metrics $SS_INPUT/$SS_ROUTE_DIR/lean-metrics.json`. |
| 106 | |
| 107 | The verifier: |
| 108 | |
| 109 | 1. reads `route/target.json`; the target must be in the approved `registry.json`; |
| 110 | 2. strips comments from `route/Solution.lean` and rejects forbidden constructs; |
| 111 | 3. copies the **approved** `targets/<challenge>` to `ConditionalGoldbach/UserChallenge.lean`; |
| 112 | 4. copies `route/Solution.lean` to `ConditionalGoldbach/UserSolution.lean`; |
| 113 | 5. copies the approved `comparator.json` to the work directory; |
| 114 | 6. runs: |
| 115 | ```bash |
| 116 | lake build ConditionalGoldbach.UserChallenge |
| 117 | lake build ConditionalGoldbach.UserSolution |
| 118 | lake comparator --config comparator.json |
| 119 | ``` |
| 120 | 7. runs `#print axioms <theorem>` and parses the axiom set; |
| 121 | 8. writes `lean-metrics.json` `{"score": 1, "subtasks": {"<target>": 1}}` and prints `<target>: proved` on success; |
| 122 | 9. exits 1 with the first error otherwise; a route with no `target.json` or `Solution.lean` is told what is missing. |
| 123 | |
| 124 | The route never supplies the challenge, the comparator, the toolchain, or the lakefile. Only `Solution.lean` and `target.json` are read from the route. |
| 125 | |
| 126 | ## 5. Anti-cheating |
| 127 | |
| 128 | | Attempt | Caught by | |
| 129 | |---|---| |
| 130 | | `sorry` / `admit` | axiom audit (`sorryAx`); text scan | |
| 131 | | `axiom` declaration | comparator's permitted axioms; text scan | |
| 132 | | `native_decide` | `Lean.ofReduceBool` in the axiom set | |
| 133 | | `unsafe`, `implemented_by`, `extern`, `opaque` | text scan | |
| 134 | | importing `UserChallenge` to reuse `sorry` | text scan; `sorryAx` | |
| 135 | | changing the statement | comparator type equality against the approved challenge | |
| 136 | | changing the comparator or `targets/` | the check uses the approved versions | |
| 137 | | changing `lakefile`/`lean-toolchain` | the check builds in the image's project; route files are ignored | |
| 138 | | shadowing a definition | comparator type equality | |
| 139 | | a proof with an extra axiom | comparator and `#print axioms` | |
| 140 | |
| 141 | The Lean kernel is trusted. The check does not try to detect "mathematically wrong but type-correct" statements; that is why the challenges are reviewed and frozen. |
| 142 | |
| 143 | ## 6. The image |
| 144 | |
| 145 | **Not published yet (2026-11-27)**, and the project declares no `lean` check until a runner has it. Once published, the public image lives on **Hugging Face**: |
| 146 | |
| 147 | ``` |
| 148 | registry.hf.co/<hf-org>/goldbach-lean:4.35 |
| 149 | ``` |
| 150 | |
| 151 | `docker/lean-check.Dockerfile` builds it: |
| 152 | |
| 153 | - Ubuntu 24.04, `elan`, Lean `v4.35.0`; |
| 154 | - Li–Liu development at `c55db645f3b4aed00374fe4aa1fcee2428c88c4b`; |
| 155 | - `lake update`, `lake exe cache get`, `lake build`; |
| 156 | - `GOLDBACH_LEAN_PROJECT=/opt/goldbach/formalization`. |
| 157 | |
| 158 | Publishing (details in `docker/README.md`): |
| 159 | |
| 160 | 1. `scripts/lean-docker.sh build`; |
| 161 | 2. `docker login registry.hf.co -u <hf-user> -p <hf-token>`; |
| 162 | 3. `scripts/lean-docker.sh publish registry.hf.co/<hf-org>/goldbach-lean:4.35`; |
| 163 | 4. make the Hugging Face repository public; verify an anonymous pull on a clean machine; |
| 164 | 5. pin the digest in `checks.lean.image` and `docker/README.md`. |
| 165 | |
| 166 | The runner and local Docker pull the same public image. No network is used at check time (`--network none` locally; the runner's image is prebuilt). |
| 167 | |
| 168 | **License.** The Li–Liu repository has no declared license. A public image containing its Lean code redistributes that code. Get the authors' permission, or publish a toolchain-only image (Lean + Mathlib + cache) and build the Li layer privately. Do not publish the Li layer without permission. |
| 169 | |
| 170 | ## 7. Lean environment: remote default, Docker optional, existing Lean |
| 171 | |
| 172 | The default is **remote**: a route submits `target.json` and `Solution.lean`, and the project's runner runs the `lean` check in `goldbach-lean:4.35`. The user installs nothing. Read the verdict from `GET /api/repos/<owner>/<repo>/commits/<sha>/status`. |
| 173 | |
| 174 | The agent asks the user **once**, before the first Lean task: “Do you want a local Lean environment?” The default is no. Record the answer; do not ask every session. |
| 175 | |
| 176 | ### 7.1 Docker (optional) |
| 177 | |
| 178 | ```bash |
| 179 | scripts/lean-docker.sh setup # pull, or build from docker/lean-check.Dockerfile |
| 180 | scripts/lean-docker.sh check h-log routes/my-route |
| 181 | scripts/lean-docker.sh shell |
| 182 | ``` |
| 183 | |
| 184 | `check` runs with `--network none` and mounts the repository read-only. The verifier copies the approved Challenge and the route's solution into `/opt/goldbach/formalization/ConditionalGoldbach/` inside the container and writes scratch files under `/tmp`; it does not write to the mounted repository and never sees a token. |
| 185 | |
| 186 | If the image is published, `GOLDBACH_LEAN_IMAGE=ghcr.io/<org>/goldbach-lean:4.35 scripts/lean-docker.sh setup` pulls it. Otherwise `setup` builds it; the first build is heavy, later checks are fast. |
| 187 | |
| 188 | ### 7.2 Existing Lean |
| 189 | |
| 190 | ```bash |
| 191 | GOLDBACH_LEAN_PROJECT=/path/to/conditional-goldbach-lean/formalization \ |
| 192 | scripts/lean-local.sh h-log routes/my-route |
| 193 | ``` |
| 194 | |
| 195 | The script copies `UserChallenge.lean`/`UserSolution.lean` into that project; use a disposable copy. |
| 196 | |
| 197 | ### 7.3 Raw command |
| 198 | |
| 199 | ```bash |
| 200 | docker run --rm --network none -v "$PWD:/work:ro" goldbach-lean:4.35 \ |
| 201 | python3 /work/checks/lean_verify.py \ |
| 202 | --route /work/routes/my-route \ |
| 203 | --approved /work \ |
| 204 | --project /opt/goldbach/formalization \ |
| 205 | --work /tmp/lean-work |
| 206 | ``` |
| 207 | |
| 208 | ## 8. Adding a target |
| 209 | |
| 210 | 1. Add `targets/<id>/Challenge.lean` with the fixed statement and `sorry`. |
| 211 | 2. Add `targets/<id>/Solution.lean` with the same statement and `sorry` (or the known proof, for an available target). |
| 212 | 3. Add `targets/<id>/comparator.json` with the theorem name. |
| 213 | 4. Add the target to `targets/registry.json`. |
| 214 | 5. Open a pull request; the maintainers approve the new target by moving the `checks` tag. |
| 215 | |
| 216 | A target whose statement is not exactly the intended one is worse than no target: it verifies the wrong claim. Review it like a paper theorem. |
| 217 | |
| 218 | ## 9. Status |
| 219 | |
| 220 | This design is implemented as: |
| 221 | |
| 222 | - `targets/registry.json`, `targets/h-log/`, `targets/r/`, `targets/end-to-end/`; |
| 223 | - `checks/lean_verify.py`, `checks/lean.sbatch`; |
| 224 | - `docker/lean-check.Dockerfile`, `docker/README.md`; |
| 225 | - `scripts/lean-local.sh`, `scripts/lean-docker.sh`; |
| 226 | - the `lean` entry in `scienceslack.json`. |
| 227 | |
| 228 | **The default path is remote**: the platform's runner runs the `lean` check in `goldbach-lean:4.35`; the user installs nothing. Docker and `lean-local.sh` are optional local iteration paths. The agent asks the user once whether they want a local environment and records the answer. |
| 229 | |
| 230 | The Python orchestrator and the shell/paths are testable without Lean; the Lean build and comparator are **not** run in this repository. |
| 231 | |
| 232 | Deployment order: |
| 233 | |
| 234 | 1. build `goldbach-lean:4.35` from `docker/lean-check.Dockerfile`; |
| 235 | 2. run the `end-to-end` target through `checks/lean.sbatch`; it must print `end-to-end: proved`; |
| 236 | 3. set `checks.lean.gate` to `true` in `scienceslack.json` and approve the rules; |
| 237 | 4. open the `h-log` and `r` targets to routes. |
| 238 | |
| 239 | The initial `gate` is `false` so a missing image cannot block merges. |