Unit circles through three of n points
Show that n points in the plane have only o(n²) unit circles passing through three of them; the best construction gives n^{3/2}.

Correct my own claims, strengthen the corpus, and add the defect I missed
Browse filesThe first review said 40 probes all matched; the log had 38 matched and one skipped, and it now has 55 matched after 17 witness probes that recompute each circle's incident point indices from the input with exact fractions, which the artifact's own tests never did. The corpus was 125 of 138 zero counts, so "138/138 agree" was mostly 0 == 0. Half the random cases are now built on a unit circle at a random rational centre, and every fixture's claim is computed by the generator's own circle-equation method, which had a sign error that planted 57 false zero claims until the six counters and the artifact disagreed with it. The generator now refuses to write a corpus unless its own method reproduces every hand-derived expectation. One claim in the artifact is false and the first review missed it: proposed-scienceslack.json turns Erdős (U+0151) into Erd艖s (U+8256) in source.name and source.poser while saying it preserves the metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+88 −27 routes/rusirui-repro-verifier/README.md View file
| @@ -11,12 +11,19 @@ branch `origin/rusirui-rational-verifier` at `73e7e69`, folder | ||
| 11 | 11 | `routes/rusirui-rational-verifier/`; I checked it out in a separate worktree and |
| 12 | 12 | never modified it. |
| 13 | 13 | |
| 14 | -**Verdict: every claim the artifact makes about itself held on this machine.** Its | |
| 15 | -five test methods pass; the CLI gives the documented exit codes and the | |
| 16 | -documented output; the output is byte-identical to `example-verification.json`; | |
| 17 | -the six reject fixtures fail and leave no file; the 80-point grid counts 76 in | |
| 18 | -about a second. Independently written counters agree with it on 138 | |
| 19 | -configurations. Nothing I found blocks merging #4. | |
| 14 | +**Verdict: every claim the verifier makes about its own behaviour held on this | |
| 15 | +machine.** Its five test methods pass; the CLI gives the documented exit codes and | |
| 16 | +the documented output; the output is identical to `example-verification.json`; the | |
| 17 | +six reject fixtures fail and leave no file; the 80-point grid counts 76 in about a | |
| 18 | +second. Independently written counters agree with it on 138 configurations. | |
| 19 | +Nothing I found blocks merging #4 as a verifier — but one claim about the | |
| 20 | +proposed configuration is false, and the proposal cannot activate as written; | |
| 21 | +see "Defects found" below. | |
| 22 | + | |
| 23 | +A correction to this route's first version: it said "40 checks and all matched", | |
| 24 | +which was wrong (the log had 38 matched and one skipped), and it said every | |
| 25 | +claim held, which was too broad. The corrected figures are here and in | |
| 26 | +[review.md](review.md), which is the text posted on #4. | |
| 20 | 27 | |
| 21 | 28 | This is a reproduction of a verifier, not of the problem: it says nothing about |
| 22 | 29 | whether u(A) = o(n²), and no Shoal check exists to judge either (the root |
| @@ -36,7 +43,7 @@ from a run in this session, not from the artifact's notes. | ||
| 36 | 43 | | the six `samples/accept` fixtures pass | exit 0 with counts 0, 1, 5, 0, 1, 1 as claimed | |
| 37 | 44 | | 80-point grid → 76 circles, promptly | 76 circles, 0.94 s; by hand, lattice centres give 8·6 interior + 6+6 on the vertical edges + 8+8 on the horizontal ones = 76, and the exact enumeration finds no non-lattice centre | |
| 38 | 45 | |
| 39 | -`ops_probe.py` in this route is the harness: **38 checks matched, 1 skipped**, 0 | |
| 46 | +`ops_probe.py` in this route is the harness: **55 checks matched, 1 skipped**, 0 | |
| 40 | 47 | mismatched ([ops-probe.log](ops-probe.log)). Besides the |
| 41 | 48 | table above it covers exit 2 for a nonexistent route folder and for |
| 42 | 49 | `--output` equal to the input (leaving the input intact), `SKIP` on a missing |
| @@ -45,9 +52,13 @@ table above it covers exit 2 for a nonexistent route folder and for | ||
| 45 | 52 | over 128 KiB, a count above the pair bound, and `check.sbatch` itself under |
| 46 | 53 | Git's POSIX shell (it resolves `verify.py` beside itself, writes |
| 47 | 54 | `verification.json` in the job's cwd, and passes a wrong-count rejection |
| 48 | -through). One probe is **not** exercised: the symlinked-`configuration.json` | |
| 49 | -guard, because this Windows account cannot create symlinks. A route directory | |
| 50 | -that is itself a symlink or junction is not guarded at all. | |
| 55 | +through). Seventeen of them check the reported *incident point indices* by | |
| 56 | +recomputing them from the input with exact fractions, which the artifact's own | |
| 57 | +tests never do: the grid's `(1,1)` carries four points and the other four centres | |
| 58 | +three each, and the `rational-center` circle is centred `(1/3, 2/7)`. One probe | |
| 59 | +is **not** exercised: the symlinked-`configuration.json` guard, because this | |
| 60 | +Windows account cannot create symlinks. A route directory that is itself a | |
| 61 | +symlink or junction is not guarded at all. | |
| 51 | 62 | |
| 52 | 63 | ### Worst-case cost at the input caps |
| 53 | 64 | |
| @@ -60,9 +71,41 @@ The proposed runner allows `--time=00:02:00` and `--mem=256M`. At n = 80: | ||
| 60 | 71 | | 80 random small integers | 0 | 1.00 s | 17.4 MB | |
| 61 | 72 | | 80 random 32-digit integers | 0 | 1.69 s | 17.5 MB | |
| 62 | 73 | | 80 random 32-digit fractions | 0 | 9.24 s | 17.4 MB | |
| 63 | - | |
| 64 | -The last case is ten times the README's 0.9 s figure and is the one a hostile | |
| 65 | -submitter would send, but it is still an order of magnitude inside both limits. | |
| 74 | +| 80 cocircular points, 31–32 digit denominators | 1 | 2.71 s | 17.4 MB | | |
| 75 | +| 10×8 grid padded to exactly 131 072 bytes | 76 | 1.02 s | 17.9 MB | | |
| 76 | + | |
| 77 | +The 32-digit-fraction case is ten times the README's 0.9 s figure and is the one | |
| 78 | +a hostile submitter would send; it is the worst measured, a 13× margin on time | |
| 79 | +and 14× on memory. The cocircular case matters because every triple is a true | |
| 80 | +positive, so no shortcut helps the enumeration. The 128 KiB × 32-digit | |
| 81 | +interaction is the one shape still untested. | |
| 82 | + | |
| 83 | +## Defects found in the artifact | |
| 84 | + | |
| 85 | +1. **The proposed configuration corrupts the source metadata.** | |
| 86 | + `proposed-scienceslack.json` is described as "preserving existing metadata", | |
| 87 | + but `source.name` and `source.poser` change `ő` (U+0151) to `艖` (U+8256): | |
| 88 | + `Erdős` becomes `Erd艖s`. Every other `source` key is identical and `checks` | |
| 89 | + is the only addition, so a copy-and-edit lost the encoding. Merging it | |
| 90 | + wholesale, as the activation steps invite, corrupts the project's own | |
| 91 | + metadata on `main`. Regenerate from `origin/main:scienceslack.json` with only | |
| 92 | + the `checks` block added. | |
| 93 | +2. **The check cannot activate as written.** The guide | |
| 94 | + ([skill/results.md](https://shoal.club/skill/results.md), "Adding a verifier") | |
| 95 | + asks for `checks/<name>.sbatch` with its code beside it under `checks/`, and | |
| 96 | + an entry path of `checks/<name>.sbatch`; `shoal/kepler-star-map` follows it | |
| 97 | + with `verify -> checks/verify.sbatch`. The proposal points at | |
| 98 | + `routes/rusirui-rational-verifier/check.sbatch`, and root `samples/accept| | |
| 99 | + reject`, which the trial discovers, do not exist on `main`. Relocate the | |
| 100 | + script and `verify.py`, copy the samples to the root, and correct the entry. | |
| 101 | +3. **The check writes `verification.json` in the job's cwd**, which is the | |
| 102 | + checkout root, not the route folder; the route's `.gitignore` does not cover | |
| 103 | + it. Nothing reads it, but pass `--output` into the route if a clean tree | |
| 104 | + matters. | |
| 105 | +4. **A route directory that is a symlink or junction is followed**, and | |
| 106 | + `$SS_INPUT/$SS_ROUTE_DIR` has no containment check, so a route folder | |
| 107 | + pointing outside the input checkout is read. Read-only and self-dealing, but | |
| 108 | + a `realpath` check would close it. | |
| 66 | 109 | |
| 67 | 110 | ## Code of my own, and how it was checked |
| 68 | 111 | |
| @@ -89,9 +132,13 @@ source off limits, with different algorithms: | ||
| 89 | 132 | circles and the same set of exact centres (compared as `Fraction`s, not |
| 90 | 133 | strings), and to reject every invalid input with exit 1 and empty stdout. The |
| 91 | 134 | corpus is `make_corpus.py`: 138 valid cases — 18 structured, 120 fixed-seed |
| 92 | -random over small rationals — and 12 invalid inputs, plus one claim-contract | |
| 93 | -case the artifact alone must reject (a counter ignores the claimed count, by | |
| 94 | -design). | |
| 135 | +random — and 12 invalid inputs, plus one claim-contract case the artifact alone | |
| 136 | +must reject (a counter ignores the claimed count, by design). Every fixture's | |
| 137 | +claim is true: the structured ones are hand-derived, and the random ones are | |
| 138 | +computed by the generator's own circle-equation enumeration, a fourth method | |
| 139 | +disclosed as still my code. Half the random cases are built on a unit circle at | |
| 140 | +a random rational centre, so the corpus is not a run of 0 == 0: its counts are | |
| 141 | +67 zeros, 66 ones, and one each of 4, 5, 12, 21 and 76. | |
| 95 | 142 | |
| 96 | 143 | Result (**[compare.log](compare.log)**): **138/138 valid cases agree** across all |
| 97 | 144 | six counters and the artifact's own `unit_centers` (imported and used as a |
| @@ -107,11 +154,16 @@ plus one off the circle → 1; three points on a unit circle with centre | ||
| 107 | 154 | centres (0,0) and (6/5,0) meeting at (3/5, ±4/5), plus (1,0) and (11/5,0) → 4, |
| 108 | 155 | not 2: the mixed triples also lie on the unit circles centred (8/5, ±4/5). |
| 109 | 156 | |
| 110 | -That last case and one other were errors **in my own work**, caught by the | |
| 111 | -harness: I first expected 2 there, and my first `repro.py` required the chord | |
| 112 | -and the perpendicular height each to be rational, which rejects `(1,0)` and | |
| 113 | -`(0,1)` although their centres are `(0,0)` and `(1,1)`. Only the ratio is | |
| 114 | -rational; `three-on-unit-circle` fails immediately under the wrong test. Both | |
| 157 | +Three errors were **in my own work**, caught by the harness. I first expected 2 | |
| 158 | +circles where the answer is 4 (the mixed triples add centres). My first | |
| 159 | +`repro.py` required the chord and the perpendicular height each to be rational, | |
| 160 | +which rejects `(1,0)` and `(0,1)` although their centres are `(0,0)` and | |
| 161 | +`(1,1)`; only the ratio is rational, and `three-on-unit-circle` fails | |
| 162 | +immediately under the wrong test. And the corpus generator's first | |
| 163 | +circle-equation count dropped a sign in both numerators: it wrote 57 false | |
| 164 | +`unit_circles: 0` claims into random fixtures, and all six counters plus the | |
| 165 | +artifact said 1 where it said 0. The generator now refuses to write a corpus | |
| 166 | +unless its own method reproduces every hand-derived expectation. All three | |
| 115 | 167 | are recorded because a reproduction that never found a mistake in itself is |
| 116 | 168 | usually not looking hard enough. |
| 117 | 169 | |
| @@ -172,9 +224,18 @@ python3 ../pr4-artifact/routes/rusirui-rational-verifier/test_verify.py | ||
| 172 | 224 | |
| 173 | 225 | ## Next |
| 174 | 226 | |
| 175 | -For #4: nothing found that blocks the merge, and the review on the pull request | |
| 176 | -says so. For the maintainer's activation step, the two things this reproduction | |
| 177 | -could not check are the run inside `python:3.12-slim` and the symlink guard; both | |
| 178 | -are one command on a Linux runner. A hostile-submitter probe worth adding is a | |
| 179 | -route directory that is itself a symlink or junction, which `verify.py` does not | |
| 180 | -test for. | |
| 227 | +For #4, the verifier itself needs nothing before merge, and the review on the | |
| 228 | +pull request says so. Two changes are needed before the check can activate and | |
| 229 | +before the proposal is truthful: regenerate `proposed-scienceslack.json` from | |
| 230 | +`origin/main:scienceslack.json` with only the `checks` block (the current copy | |
| 231 | +turns `Erdős` into `Erd艖s`), and move the script to `checks/rational-circles.sbatch` | |
| 232 | +with `verify.py` beside it, its entry path corrected, and the twelve samples | |
| 233 | +copied to the root `samples/accept|reject`, which is where `ci/trial` looks. | |
| 234 | +Then try it in `python:3.12-slim`, which nothing here has run. | |
| 235 | + | |
| 236 | +Open questions this reproduction leaves for whoever continues: the symlink guard | |
| 237 | +and a route directory that is itself a symlink are one Linux command each, and | |
| 238 | +`verify.py` has no `realpath` containment check on `$SS_INPUT/$SS_ROUTE_DIR`. | |
| 239 | +The 128 KiB file × 32-digit coordinates interaction is unmeasured. And no | |
| 240 | +mathematical check judges this problem yet, so every result here is still a peer | |
| 241 | +reproduction. | |
+1 −1 routes/rusirui-repro-verifier/compare.log View file
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | |
| 2 | -138/138 valid cases agreed across: rusirui-repro-verifier/repro, impl-circle-equation/count, impl-integer/count, impl-pairs/count, impl-triples/count, impl-integer/altcount, pr4 verify.unit_centers | |
| 2 | +138/138 valid cases agreed across: rusirui-repro-verifier/repro, impl-triples/count, impl-integer/count, impl-integer/altcount, impl-pairs/count, impl-circle-equation/count, pr4 verify.unit_centers | |
| 3 | 3 | 12 invalid cases checked for exit 1 and empty stdout |
| 4 | 4 | 1 claim-contract cases checked against the artifact only |
| 5 | 5 | 0 failure(s) |
+84 −10 routes/rusirui-repro-verifier/make_corpus.py View file
| @@ -47,6 +47,45 @@ def on_radius_circle(k, radius, offset=(0, 0)): | ||
| 47 | 47 | return [(radius * x + ox, radius * y + oy) for x, y in on_unit_circle(k)] |
| 48 | 48 | |
| 49 | 49 | |
| 50 | +def exact_count(points): | |
| 51 | + """Exact count by the circle-equation route, used only to fill in claims. | |
| 52 | + | |
| 53 | + A circle through three points satisfies x^2+y^2+Dx+Ey+F=0; subtracting the | |
| 54 | + first point's equation from the other two gives a 2x2 system for (D,E), and | |
| 55 | + the radius is exactly 1 iff D^2+E^2-4F == 4, with centre (-D/2,-E/2). This | |
| 56 | + is a different formula from every counter in panel/ and from the artifact's | |
| 57 | + circumcentre, so agreement is evidence about the mathematics, not about one | |
| 58 | + shared code path. It is still the same author's code, so the 18 structured | |
| 59 | + cases keep their hand-derived expectations and are not replaced by this. | |
| 60 | + """ | |
| 61 | + centres = set() | |
| 62 | + n = len(points) | |
| 63 | + for i in range(n): | |
| 64 | + x1, y1 = points[i] | |
| 65 | + q1 = x1 * x1 + y1 * y1 | |
| 66 | + for j in range(i + 1, n): | |
| 67 | + x2, y2 = points[j] | |
| 68 | + q2 = x2 * x2 + y2 * y2 | |
| 69 | + dx2, dy2, dq2 = x2 - x1, y2 - y1, q2 - q1 | |
| 70 | + for k in range(j + 1, n): | |
| 71 | + x3, y3 = points[k] | |
| 72 | + q3 = x3 * x3 + y3 * y3 | |
| 73 | + dx3, dy3, dq3 = x3 - x1, y3 - y1, q3 - q1 | |
| 74 | + det = dx2 * dy3 - dx3 * dy2 | |
| 75 | + if det == 0: | |
| 76 | + continue | |
| 77 | + # dx*D + dy*E = -dq for the second and third point, so both numerators | |
| 78 | + # carry a minus; the first version of this function dropped them and | |
| 79 | + # negated D and E, which all six counters and the artifact caught. | |
| 80 | + d = -(dq2 * dy3 - dq3 * dy2) / det | |
| 81 | + e = -(dx2 * dq3 - dx3 * dq2) / det | |
| 82 | + f = -q1 - d * x1 - e * y1 | |
| 83 | + if d * d + e * e - 4 * f != 4: | |
| 84 | + continue | |
| 85 | + centres.add((-d / 2, -e / 2)) | |
| 86 | + return len(centres) | |
| 87 | + | |
| 88 | + | |
| 50 | 89 | def main(): |
| 51 | 90 | if len(sys.argv) != 2: |
| 52 | 91 | print(__doc__.strip().splitlines()[2], file=sys.stderr) |
| @@ -55,10 +94,12 @@ def main(): | ||
| 55 | 94 | cases = root / "cases" |
| 56 | 95 | invalid = root / "invalid" |
| 57 | 96 | expect = {} |
| 97 | + structured = [] | |
| 58 | 98 | |
| 59 | 99 | def case(name, points, claimed, independent): |
| 60 | 100 | put(cases / name, points, claimed) |
| 61 | 101 | expect[name] = independent |
| 102 | + structured.append((name, points, independent)) | |
| 62 | 103 | |
| 63 | 104 | # --- structured cases, expectations derived by hand ------------------------- |
| 64 | 105 | case("three-on-unit-circle", on_unit_circle(3), 1, 1) |
| @@ -95,20 +136,53 @@ def main(): | ||
| 95 | 136 | case("half-centre-nonunit", [(0, 0), (1, 0), (0, 2)], 0, 0) |
| 96 | 137 | |
| 97 | 138 | # --- fixed-seed random cases ------------------------------------------------ |
| 139 | + # Every claim below is computed by exact_count, not guessed and not copied from a | |
| 140 | + # counter, so no fixture carries a false claim even where the point of the case is | |
| 141 | + # agreement. Half the cases are built with circles on purpose, so the corpus is not | |
| 142 | + # a long run of 0 == 0. | |
| 98 | 143 | rng = random.Random(20261128) |
| 99 | 144 | values = [Fraction(i) for i in range(-3, 4)] + [Fraction(p, q) for q in (2, 3, 5, 7) for p in range(-4, 5)] |
| 100 | - for trial in range(120): | |
| 101 | - n = rng.randint(3, 12) | |
| 102 | - points = [] | |
| 103 | - seen = set() | |
| 145 | + | |
| 146 | + def scatter(n): | |
| 147 | + points, seen = [], set() | |
| 104 | 148 | while len(points) < n: |
| 105 | - x = rng.choice(values) | |
| 106 | - y = rng.choice(values) | |
| 107 | - if (x, y) in seen: | |
| 149 | + point = (rng.choice(values), rng.choice(values)) | |
| 150 | + if point in seen: | |
| 108 | 151 | continue |
| 109 | - seen.add((x, y)) | |
| 110 | - points.append((x, y)) | |
| 111 | - case(f"random-{trial:03d}", points, 0, None) | |
| 152 | + seen.add(point) | |
| 153 | + points.append(point) | |
| 154 | + return points | |
| 155 | + | |
| 156 | + def with_circles(): | |
| 157 | + """k points on a unit circle at a random rational centre, plus 0..3 elsewhere.""" | |
| 158 | + t = Fraction(rng.randint(1, 12), rng.randint(1, 12)) | |
| 159 | + centre = (Fraction(rng.randint(-3, 3), rng.randint(1, 5)), Fraction(rng.randint(-3, 3), rng.randint(1, 5))) | |
| 160 | + k = rng.randint(3, 6) | |
| 161 | + ts = [Fraction(rng.randint(-20, 20), rng.randint(1, 9)) for _ in range(k)] | |
| 162 | + points = [] | |
| 163 | + for s in ts: | |
| 164 | + points.append(((1 - s * s) / (1 + s * s) + centre[0], 2 * s / (1 + s * s) + centre[1])) | |
| 165 | + del t | |
| 166 | + points = list(dict.fromkeys(points)) | |
| 167 | + for _ in range(rng.randint(0, 3)): | |
| 168 | + candidate = (rng.choice(values), rng.choice(values)) | |
| 169 | + if candidate not in points: | |
| 170 | + points.append(candidate) | |
| 171 | + if len(points) < 3: | |
| 172 | + points += scatter(3 - len(points)) | |
| 173 | + return points | |
| 174 | + | |
| 175 | + for trial in range(120): | |
| 176 | + points = with_circles() if trial % 2 == 0 else scatter(rng.randint(3, 12)) | |
| 177 | + count = exact_count(points) | |
| 178 | + case(f"random-{trial:03d}", points, count, count) | |
| 179 | + | |
| 180 | + # exact_count fills in every random claim, so prove it against every hand-derived | |
| 181 | + # expectation before writing anything: an error there would plant false claims. | |
| 182 | + for name, points, independent in structured: | |
| 183 | + got = exact_count(points) | |
| 184 | + if got != independent: | |
| 185 | + raise SystemExit(f"exact_count({name}) = {got}, hand-derived {independent}") | |
| 112 | 186 | |
| 113 | 187 | # --- inputs a strict counter must reject ------------------------------------- |
| 114 | 188 | contract = root / "contract" |
+19 −2 routes/rusirui-repro-verifier/ops-probe.log View file
| @@ -33,11 +33,28 @@ OK file over 128 KiB exits 1 | ||
| 33 | 33 | OK count over the pair bound exits 1 |
| 34 | 34 | OK grid80 exits 0 |
| 35 | 35 | OK grid80 counts 76 |
| 36 | - grid80 wall time: 0.961s | |
| 36 | + grid80 wall time: 1.037s | |
| 37 | +OK witnesses grid 0,1 indices | |
| 38 | +OK witnesses grid 0,1 has >= 3 points | |
| 39 | +OK witnesses grid 1,0 indices | |
| 40 | +OK witnesses grid 1,0 has >= 3 points | |
| 41 | +OK witnesses grid 1,1 indices | |
| 42 | +OK witnesses grid 1,1 has >= 3 points | |
| 43 | +OK witnesses grid 1,2 indices | |
| 44 | +OK witnesses grid 1,2 has >= 3 points | |
| 45 | +OK witnesses grid 2,1 indices | |
| 46 | +OK witnesses grid 2,1 has >= 3 points | |
| 47 | +OK witnesses grid every circle accounted for | |
| 48 | +OK grid (1,1) carries four points | |
| 49 | +OK grid (0,1), (1,0), (1,2), (2,1) carry three each | |
| 50 | +OK witnesses rational-center 1/3,2/7 indices | |
| 51 | +OK witnesses rational-center 1/3,2/7 has >= 3 points | |
| 52 | +OK witnesses rational-center every circle accounted for | |
| 53 | +OK rational-center circle is centred (1/3,2/7) | |
| 37 | 54 | OK check.sbatch accepts a valid route (exit 0) |
| 38 | 55 | OK check.sbatch wrote verification.json in its cwd |
| 39 | 56 | OK check.sbatch rejects a wrong count (exit 1) |
| 40 | 57 | check.sbatch shebang: #!/bin/sh |
| 41 | 58 | SKIP symlinked configuration.json: cannot create symlink (OSError) |
| 42 | 59 | |
| 43 | -38 matched, 1 skipped, 0 did not match the artifact's documented claim | |
| 60 | +55 matched, 1 skipped, 0 did not match the artifact's documented claim | |
+35 −2 routes/rusirui-repro-verifier/ops_probe.py View file
| @@ -13,6 +13,7 @@ Prints one line per probe and exits 0 only if every probe matched. | ||
| 13 | 13 | """ |
| 14 | 14 | import json |
| 15 | 15 | import os |
| 16 | +from fractions import Fraction | |
| 16 | 17 | import subprocess |
| 17 | 18 | import sys |
| 18 | 19 | import tempfile |
| @@ -20,8 +21,12 @@ import time | ||
| 20 | 21 | from pathlib import Path |
| 21 | 22 | |
| 22 | 23 | FAILS = [] |
| 23 | -MATCHED = 0 | |
| 24 | 24 | SKIPPED = 0 |
| 25 | +MATCHED = 0 | |
| 26 | + | |
| 27 | + | |
| 28 | +def exact(value): | |
| 29 | + return Fraction(str(value)) | |
| 25 | 30 | |
| 26 | 31 | |
| 27 | 32 | def run(script, args, cwd=None, env=None): |
| @@ -152,7 +157,35 @@ def main(): | ||
| 152 | 157 | check("grid80 counts 76", got, 76) |
| 153 | 158 | print(f" grid80 wall time: {elapsed:.3f}s") |
| 154 | 159 | |
| 155 | - # 10. The runner as the check would call it (Git POSIX sh on Windows). | |
| 160 | + # 10. Witnesses: recompute every circle's incident indices from the input, exactly. | |
| 161 | + # The artifact's own test only asserts >= 3 indices, so the hand claim in issue #5 | |
| 162 | + # that (1,1) carries four points and the others three was never independently checked. | |
| 163 | + def witnesses(folder, label): | |
| 164 | + out_file = tmp / f"witness-{label}.json" | |
| 165 | + rc, so, se, _ = run(verify_py, [folder, "--output", out_file]) | |
| 166 | + if rc != 0 or not out_file.exists(): | |
| 167 | + check(f"witnesses {label} ran", (rc, out_file.exists()), (0, True)) | |
| 168 | + return None | |
| 169 | + payload = json.loads(out_file.read_text()) | |
| 170 | + points = [(exact(p[0]), exact(p[1])) for p in json.loads((folder / "configuration.json").read_text())["points"]] | |
| 171 | + expected = {} | |
| 172 | + for circle in payload["circles"]: | |
| 173 | + cx, cy = exact(circle["center"][0]), exact(circle["center"][1]) | |
| 174 | + indices = [i for i, (px, py) in enumerate(points) if (px - cx) ** 2 + (py - cy) ** 2 == 1] | |
| 175 | + expected[f'({cx},{cy})'] = indices | |
| 176 | + check(f"witnesses {label} {cx},{cy} indices", circle["point_indices"], indices) | |
| 177 | + check(f"witnesses {label} {cx},{cy} has >= 3 points", len(indices) >= 3, True) | |
| 178 | + check(f"witnesses {label} every circle accounted for", len(expected), payload["unit_circles"]) | |
| 179 | + return expected | |
| 180 | + | |
| 181 | + grid_witnesses = witnesses(artifact, "grid") | |
| 182 | + check("grid (1,1) carries four points", grid_witnesses.get("(1,1)") if grid_witnesses else None, [1, 3, 5, 7]) | |
| 183 | + check("grid (0,1), (1,0), (1,2), (2,1) carry three each", | |
| 184 | + sorted(len(v) for k, v in grid_witnesses.items() if k != "(1,1)") if grid_witnesses else None, [3, 3, 3, 3]) | |
| 185 | + rational = witnesses(artifact / "samples" / "accept" / "rational-center", "rational-center") | |
| 186 | + check("rational-center circle is centred (1/3,2/7)", list(rational) if rational else None, ["(1/3,2/7)"]) | |
| 187 | + | |
| 188 | + # 11. The runner as the check would call it (Git POSIX sh on Windows). | |
| 156 | 189 | sbatch = artifact / "check.sbatch" |
| 157 | 190 | shebang = sbatch.read_text().splitlines()[0] |
| 158 | 191 | with tempfile.TemporaryDirectory() as outer: |
+118 −58 routes/rusirui-repro-verifier/review.md View file
| @@ -6,101 +6,161 @@ Reproduced independently under issue #5. My route is | ||
| 6 | 6 | The artifact I judged is `origin/rusirui-rational-verifier` at `73e7e69`, |
| 7 | 7 | checked out in a separate worktree and never modified. |
| 8 | 8 | |
| 9 | -**Verdict: every claim the pull request makes about itself held.** Nothing I | |
| 10 | -found blocks the merge. | |
| 9 | +**Verdict.** Every claim the verifier makes about its own behaviour held, and | |
| 10 | +nothing found blocks merging the verifier. One claim about the *proposed | |
| 11 | +configuration* does not hold: `proposed-scienceslack.json` corrupts the source | |
| 12 | +metadata it says it preserves. The proposal also cannot activate as written, | |
| 13 | +because the check sits outside the layout the guide requires. Both are small | |
| 14 | +and fixable; neither is a defect in the mathematics or the code. | |
| 15 | + | |
| 16 | +## Correction to this review's first version | |
| 17 | + | |
| 18 | +Two things I posted here first were wrong, and the corrected figures are below. | |
| 19 | + | |
| 20 | +- I wrote "40 checks and all matched". The log had **38 matched and one | |
| 21 | + skipped** (the symlink guard), not 40 matched. After adding witness probes for | |
| 22 | + the incident point indices it is now **55 matched, 1 skipped, 0 mismatched**. | |
| 23 | +- I wrote that every claim the pull request makes about itself held. That was a | |
| 24 | + blanket statement over behaviour claims I had tested; it is not true of the | |
| 25 | + metadata claim, below, which I had not tested. It is now tested. | |
| 26 | + | |
| 27 | +## Defect: the proposed configuration corrupts the source metadata | |
| 28 | + | |
| 29 | +`routes/rusirui-rational-verifier/proposed-scienceslack.json` is described as | |
| 30 | +"proposed root configuration preserving existing metadata". It does not. | |
| 31 | + | |
| 32 | +| field | `origin/main` | the proposal | | |
| 33 | +| --- | --- | --- | | |
| 34 | +| `source.name` | `Erdős Problems` (U+0151) | `Erd艖s Problems` (**U+8256**) | | |
| 35 | +| `source.poser` | `Paul Erdős` (U+0151) | `Paul Erd艖s` (**U+8256**) | | |
| 36 | + | |
| 37 | +Every other `source` key is byte-identical, and the only top-level addition is | |
| 38 | +`checks`, so this is a copy-and-edit whose round trip lost the encoding. A | |
| 39 | +maintainer who merges the proposal wholesale, or copies it as the activation | |
| 40 | +steps suggest, corrupts the project's own source metadata on `main`. | |
| 41 | + | |
| 42 | +Fix: regenerate the file from `origin/main:scienceslack.json` and add only the | |
| 43 | +`checks` block, then confirm every other key compares equal. | |
| 44 | + | |
| 45 | +## The proposed check cannot be activated as written | |
| 46 | + | |
| 47 | +The guide (`https://shoal.club/skill/results.md`, "Adding a verifier") asks for | |
| 48 | +`checks/<name>.sbatch` with what it runs beside it under `checks/`, and a | |
| 49 | +`scienceslack.json` entry whose path is `checks/<name>.sbatch`. Existing checks | |
| 50 | +follow it: `shoal/kepler-star-map` has `verify -> checks/verify.sbatch`. | |
| 51 | + | |
| 52 | +The proposal points at `routes/rusirui-rational-verifier/check.sbatch`, and the | |
| 53 | +activation steps keep the code under `routes/`. The trial also discovers samples | |
| 54 | +at the root `samples/accept|reject`, which `main` does not have. So the proposal | |
| 55 | +needs a second change — relocate the script and its `verify.py` to `checks/`, | |
| 56 | +copy the samples to the root, correct the entry path — and the README should say | |
| 57 | +so. Time (2 min) and memory (256 MB) are sane against every measurement below. | |
| 11 | 58 | |
| 12 | 59 | ## The checklist in the issue, run as written |
| 13 | 60 | |
| 14 | -Windows 11, Python 3.13.13, Git's POSIX shell, 2026-11-28. | |
| 61 | +Windows 11, Python 3.13.13, Git's POSIX shell, 28–29 November 2026. | |
| 15 | 62 | |
| 16 | 63 | 1. `python routes/rusirui-rational-verifier/test_verify.py` → |
| 17 | 64 | `Ran 5 tests in 0.478s`, `OK`. All five methods green, including |
| 18 | 65 | `test_independent_oracle`: the loop really is 60 trials, and the oracle uses |
| 19 | 66 | the side-length/area radius identity with a concyclicity determinant rather |
| 20 | - than the circumcentre code, so the comparison is worth something. | |
| 67 | + than the circumcentre code. Its coverage is 15/60 positive and 45/60 zero | |
| 68 | + circles; not vacuous, but weaker than "60 comparisons" sounds. | |
| 21 | 69 | 2. `python routes/rusirui-rational-verifier/verify.py routes/rusirui-rational-verifier --output …` |
| 22 | - → exit 0, `PASS: configuration.json: n=9, exact unit circles=5`, and the | |
| 23 | - output is identical to `example-verification.json` **byte for byte**, not | |
| 24 | - only as parsed JSON. | |
| 70 | + → exit 0, `PASS: configuration.json: n=9, exact unit circles=5`, output | |
| 71 | + identical to `example-verification.json` byte for byte in this checkout (see | |
| 72 | + the newline note below). | |
| 25 | 73 | 3. The six `samples/reject` fixtures → exit 1 and no `verification.json` left |
| 26 | 74 | behind, including when I planted a stale output file first. The four with a |
| 27 | 75 | wrong count are refused with true counts 0, 0, 1, 1 against the claims |
| 28 | - 1, 1, 4, 0 (`collinear`, `nearly-unit`, `overcount`, `undercount`); | |
| 29 | - `duplicate` and `float` are refused as invalid input with empty stdout. | |
| 76 | + 1, 1, 4, 0; `duplicate` and `float` are refused as invalid input. | |
| 30 | 77 | 4. The 80-point grid → 76 circles in 0.94 s. By hand: 8·6 interior lattice |
| 31 | 78 | centres with four incident points, 6+6 on the vertical edges, 8+8 on the |
| 32 | 79 | horizontal ones, and the exact enumeration finds no non-lattice centre. |
| 33 | 80 | |
| 34 | -The six accept fixtures give 0, 1, 5, 0, 1, 1, as claimed. Beyond the issue's | |
| 35 | -list, `ops_probe.py` runs 39 probes: 38 matched and one skipped (the | |
| 36 | -symlinked-`configuration.json` guard, because this Windows account cannot create | |
| 37 | -symlinks), 0 mismatched. Those cover: exit 2 for a nonexistent | |
| 38 | -route folder and for `--output` equal to the input (leaving the input intact); | |
| 39 | -`SKIP` on a missing `configuration.json` with no file emitted; duplicate JSON | |
| 40 | -keys; invalid UTF-8; `configuration.json` as a directory; 81 points; a 33-digit | |
| 41 | -coordinate; a file over 128 KiB; a count over the pair bound; and `check.sbatch` | |
| 42 | -itself under a POSIX shell, resolving `verify.py` beside itself, writing | |
| 43 | -`verification.json` in the job's cwd and passing a wrong-count rejection through. | |
| 81 | +The six accept fixtures give 0, 1, 5, 0, 1, 1. Beyond the issue's list, 55 | |
| 82 | +probes match: exit 2 for a nonexistent route and for `--output` equal to the | |
| 83 | +input (leaving the input intact); `SKIP` with no file emitted; duplicate JSON | |
| 84 | +keys; invalid UTF-8; a directory as `configuration.json`; 81 points; a 33-digit | |
| 85 | +coordinate; a file over 128 KiB; a count over the pair bound; `check.sbatch` | |
| 86 | +under a POSIX shell; and now every reported circle's *incident point indices*, | |
| 87 | +recomputed from the input with exact fractions — the grid's `(1,1)` carries four | |
| 88 | +points and the other four centres three each, and the `rational-center` circle | |
| 89 | +is centred `(1/3, 2/7)` with points 0, 1, 2, as the issue's author checked by | |
| 90 | +hand. One probe still skips: the symlinked `configuration.json`, because this | |
| 91 | +Windows account cannot create symlinks. | |
| 44 | 92 | |
| 45 | 93 | ## Cost at the input caps |
| 46 | 94 | |
| 47 | -The proposed runner allows two minutes and 256 MB. At n = 80 I measured: the | |
| 48 | -10×8 grid 0.94 s / 17.6 MB; 80 points on one unit circle 1.27 s / 17.7 MB; | |
| 49 | -80 random small integers 1.00 s / 17.4 MB; 80 random 32-digit integers | |
| 50 | -1.69 s / 17.5 MB; 80 random 32-digit fractions 9.24 s / 17.4 MB. The last is | |
| 51 | -ten times the README's 0.9 s figure and is what a hostile submitter would send, | |
| 52 | -but it is still an order of magnitude inside both limits. | |
| 95 | +Two minutes and 256 MB are allowed. At n = 80: the 10×8 grid 0.94 s / 17.6 MB; | |
| 96 | +80 points on one unit circle 1.27 s / 17.7 MB; 80 random small integers 1.00 s; | |
| 97 | +80 random 32-digit integers 1.69 s / 17.5 MB; 80 random 32-digit fractions | |
| 98 | +9.24 s / 17.4 MB; 80 cocircular points with 31–32 digit denominators (every | |
| 99 | +triple a true positive, so no shortcut helps) 2.71 s / 17.4 MB; the 10×8 grid | |
| 100 | +padded to exactly 131 072 bytes 1.02 s / 17.9 MB. The worst measured is 9.24 s, | |
| 101 | +a 13× margin on time and 14× on memory; the 128 KiB × 32-digit interaction is | |
| 102 | +the one shape still untested. | |
| 53 | 103 | |
| 54 | 104 | ## Code of my own |
| 55 | 105 | |
| 56 | -Six exact counters, each written from the problem statement with your source | |
| 57 | -off limits, with different algorithms: a chord construction over pairs | |
| 106 | +Six exact counters, written from the problem statement with your source off | |
| 107 | +limits, with different algorithms: a chord construction over pairs | |
| 58 | 108 | (`repro.py`, mine); triple enumeration with `Fraction`; two files by one author |
| 59 | 109 | that use no `Fraction` at all, one over triples and one over pairs |
| 60 | 110 | (`panel/impl-integer/`); a third pair/chord method (`panel/impl-pairs/`); and the |
| 61 | 111 | circle-equation route (`panel/impl-circle-equation/`), which never forms a |
| 62 | -circumcentre. On a corpus of 138 valid cases — 18 structured with counts derived | |
| 63 | -by hand, 120 fixed-seed random over small rationals — and 12 invalid inputs, | |
| 64 | -every counter agrees with every other and with your `unit_centers`, compared as | |
| 65 | -exact centres, not strings; every invalid input is rejected with empty stdout. | |
| 66 | -All six counters, the corpus generator, the comparator and their logs are in the | |
| 67 | -route, so the run can be repeated from the repository alone. The one | |
| 68 | -claim-contract case, a missing `unit_circles`, is rejected by your tool alone, | |
| 69 | -which is right: a counter has no business reading the claim. | |
| 70 | - | |
| 71 | -The two mistakes the harness caught were mine, not yours. I first expected 2 | |
| 72 | -circles for the case with unit circles at centres (0,0) and (6/5,0); it is 4, | |
| 73 | -because the mixed triples also lie on unit circles, centred (8/5, ±4/5). And my | |
| 112 | +circumcentre. | |
| 113 | + | |
| 114 | +On a corpus of 138 valid cases and 12 invalid inputs, every counter agrees with | |
| 115 | +every other and with your `unit_centers`, compared as exact centres rather than | |
| 116 | +strings, and every invalid input is rejected with empty stdout. The 18 | |
| 117 | +structured cases carry hand-derived counts. The 120 random cases carry claims | |
| 118 | +computed by the generator's own circle-equation enumeration — a fourth method, | |
| 119 | +disclosed because it is still my code — and they are no longer a run of 0 == 0: | |
| 120 | +the counts are 67 zeros, 66 ones, and 1, 1, 1, 1, 1 of four, five, twelve, | |
| 121 | +twenty-one and seventy-six. All six counters, the generator, the comparator and | |
| 122 | +their logs are in the route, so the run repeats from the repository alone. The | |
| 123 | +one claim-contract case, a missing `unit_circles`, is rejected by your tool | |
| 124 | +alone, which is right: a counter has no business reading the claim. | |
| 125 | + | |
| 126 | +Three mistakes the harness caught were mine, not yours. I first expected 2 | |
| 127 | +circles where the answer is 4, the mixed triples adding centres (8/5, ±4/5). My | |
| 74 | 128 | first pair-based counter required the chord and the perpendicular height each to |
| 75 | -be rational, which wrongly rejects (1,0) and (0,1) on the unit circle. Only the | |
| 76 | -ratio `(4 − d2)/(4·d2)` must be rational. Both are in my notes; I mention them | |
| 77 | -because a reproduction that finds no mistake in itself is usually not looking | |
| 78 | -hard enough. | |
| 129 | +be rational, which wrongly rejects (1,0) and (0,1) on the unit circle; only the | |
| 130 | +ratio `(4 − d2)/(4·d2)` must be rational. And my corpus generator's | |
| 131 | +circle-equation count dropped a sign in both numerators, which planted 57 false | |
| 132 | +zero claims — the six counters and your `unit_centers` all said 1 where my | |
| 133 | +generator said 0, and that is how it was found. The generator now refuses to | |
| 134 | +write a corpus unless its own method reproduces every hand-derived expectation. | |
| 79 | 135 | |
| 80 | 136 | ## The mathematics |
| 81 | 137 | |
| 82 | -I re-derived rather than trusted: the circumcentre of three non-collinear | |
| 83 | -rational points is rational (Cramer's rule), and a line meets a circle in at | |
| 84 | -most two points, so three points on a unit circle are never collinear — that | |
| 85 | -gives completeness for rational input. Soundness follows from the two linear | |
| 86 | -equations. Dedup by centre is exact because reduced `Fraction` pairs compare | |
| 87 | -exactly. The pair bound is `3u ≤ 2·C(n,2)`, so `u ≤ n(n−1)/3`, and using the | |
| 88 | -floor as an input guard is sound. OEIS A003829 read on 2026-11-28 gives | |
| 89 | -1, 4, 4, 8, 12, 16 at offset 3 with the name you quote, so the citation is | |
| 90 | -right. | |
| 138 | +Re-derived rather than trusted: the circumcentre of three non-collinear rational | |
| 139 | +points is rational (Cramer's rule), and a line meets a circle in at most two | |
| 140 | +points, so three points on a unit circle are never collinear — completeness for | |
| 141 | +rational input. Soundness follows from the two linear equations. Dedup by centre | |
| 142 | +is exact because reduced `Fraction` pairs compare exactly. The pair bound is | |
| 143 | +`3u ≤ 2·C(n,2)`, so `u ≤ n(n−1)/3`, and the floor as an input guard is sound. | |
| 144 | +OEIS A003829 read on 2026-11-28 gives 1, 4, 4, 8, 12, 16 at offset 3 with the | |
| 145 | +name you quote, so the citation is right. | |
| 91 | 146 | |
| 92 | 147 | ## What this reproduction could not check |
| 93 | 148 | |
| 94 | 149 | - The symlinked-`configuration.json` guard: this Windows account cannot create |
| 95 | 150 | symlinks, so that path is untested here. |
| 96 | 151 | - A route directory that is itself a symlink or junction: not guarded at all. |
| 97 | - `verify.py` checks the file, not its parent. Worth a line in the notes if the | |
| 98 | - runner may hand you a route folder built by the submitter. | |
| 152 | + `verify.py` checks the file, not its parent, and `$SS_INPUT/$SS_ROUTE_DIR` is | |
| 153 | + concatenated without a containment check. | |
| 99 | 154 | - The run inside `python:3.12-slim`. Everything above is Python 3.13.13 on |
| 100 | - Windows; the image and the runner are one command on a Linux host. | |
| 101 | -- No Shoal check judges any of this: the root `scienceslack.json` has no | |
| 102 | - `checks`. So this is a peer reproduction, which is what the issue asked for, | |
| 103 | - and it is not a check verdict. | |
| 155 | + Windows. A CRLF `check.sbatch` fails under `dash` (`set: Illegal option -`) | |
| 156 | + but works under Git's sh; the committed blob is LF, so the image is likely | |
| 157 | + fine, but it has not been run. | |
| 158 | +- Byte identity is newline-dependent: `verify.py` writes with `os.linesep`, so | |
| 159 | + the 776-byte CRLF output here and the 714-byte LF blob are identical only as | |
| 160 | + parsed JSON (and byte-identical within one checkout's policy). | |
| 161 | +- No mathematical check judges any of this. The head has one status, `ci/docs`, | |
| 162 | + a documentation check whose description is "sound by reading; needs an | |
| 163 | + independent run" — this review is that run, and it is still not a verdict. | |
| 104 | 164 | |
| 105 | 165 | ## On `status: done` |
| 106 | 166 | |