Revision 3: exact-zero stop in section 4; Table 12 with the post hoc Lagouanelle variant (branch m>=2: corpus 4 5568, six corpora 18372, multiple/fractional 6540, APS 2960; A' 178/34/28), the controls' missing exit in its caption; the reading of Table 12 restated in 7.1, 6.6 and the conclusion - the analogy order transfers to the classical frame and works better there than in A's split (2809 vs 4042 on multiple roots), and A's layer as a whole (detector with exit) earns its place (+1233 vs -3934). Server: verify 548 OK / 0 BAD, regression x2 1239 passed, PDF 32 pages, 0 errors, 0 overfull.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
vvs
2026-09-22 09:31:40 +01:00
co-authored by Claude Opus 5
parent aa304cd262
commit 1eb2c1664f
9 changed files with 244 additions and 7 deletions
+48
View File
@@ -0,0 +1,48 @@
"""verify_article.py checks the round-3 additions: the post hoc row of Table 12
(sweep_estimated_posthoc.json), A' against it on corpus 4, its fractional-free holds, and the
statement that the transferred detector loses more on simple roots than it gains on multiple ones.
python -u apply_verify_revision3.py
"""
PATH = "verify_article.py"
FUNC = '''
def verify_revision3():
"""Revision 3 (point 5): the post hoc branch m >= 2 and the reading of Table 12."""
print("\\nRevision 3:")
def cost(v):
return v[0] if v[1] else 200
def tot(r, keep=None):
return sum(cost(v) for p, v in r.items() if keep is None or keep(p))
sets = ("APS", "CHA", "NEW", "RJL", "APP", "D")
P = _load("sweep_estimated_posthoc.json")
K = _load("sweep_estimated.json")["k3_analogy"]
seen, four = _load("sweep_fourth_seen.json"), _load("sweep_fourth_fourth.json")
ap = dict(seen["Aprime"])
ap.update(four["Aprime"])
K1 = _load("sweep_controls.json")["K1"]
nonsimple = lambda m: m >= 2.0 or m <= 2.0 / 3.0 # noqa: E731
def group(r):
return sum(tot(r[s], lambda p, _m=K1[s]["mstar"]: nonsimple(_m[p])) for s in ("CHA", "NEW", "D"))
check("Table 12 post hoc row", (tot(P["D"]), sum(tot(P[s]) for s in sets), group(P), tot(P["APS"])),
(5568, 18372, 6540, 2960))
ps = list(ap["D"])
w = sum(cost(ap["D"][p]) < cost(P["D"][p]) for p in ps)
l = sum(cost(ap["D"][p]) > cost(P["D"][p]) for p in ps)
check("A' vs the post hoc variant on corpus 4", (w, len(ps) - w - l, l), (178, 34, 28))
check("post hoc violations", sum(v[2] for s in sets for v in P[s].values()), 0)
gain = group(ap) - group(K)
loss = (sum(tot(K[s]) for s in sets) - group(K)) - (sum(tot(ap[s]) for s in sets) - group(ap))
check("transferred detector: gain on multiple roots < loss elsewhere (vs A')", (gain, loss, gain < loss),
(1233, 3934, True))
'''
src = open(PATH, encoding="utf8").read()
call_old = " verify_revision2()\n\n print()"
marker = '\n\nif __name__ == "__main__":\n main()\n'
assert src.count(call_old) == 1 and src.count(marker) == 1
src = src.replace(call_old, " verify_revision2()\n verify_revision3()\n\n print()").replace(marker, FUNC + marker)
open(PATH, "w", encoding="utf8").write(src)
print("added verify_revision3")