#!/usr/bin/env python3 """Job #1912 (triage, route 77) -- exact, offline citation/definition ledger. Every check is a string/structure test on the SERVED sources fetched this turn (work/src1912/*.json replies, unwrapped `raw`) or a small exact integer computation from their stated definitions. No published number is recomputed and no census is re-run: this is the triage's "map the weakest assumption" step, not a reproduction. """ import json import os import re import sys D = os.path.dirname(os.path.abspath(__file__)) REP = os.path.join(D, "replies") def raw(name): with open(os.path.join(REP, name)) as fh: j = json.load(fh) return j["raw"] if isinstance(j, dict) and "raw" in j else j # served sources PROD = raw("anchored-calm.js.json") # research/natal-cap-13-anchored-calm.js AW = raw("anchored-windows.md.json") # research/anchored-windows.md CL = raw("calm-lemma.md.json") # research/natal-cap-19-calm-lemma.md R = [] # (name, passed, detail) def chk(name, cond, detail=""): R.append((name, bool(cond), str(detail))) # ---------------------------------------------------------------- A1-A2: the # route's own prior_art_md claims anchored-windows.md 4 states the corrected # sentence. The served file does not contain the word at all, and its 4 is a # different section. chk("A1 anchored-windows.md contains no 'mirror'/'fixed' phase sentence", len(re.findall(r"mirror|fixed phase|W/2", AW, re.I)) == 0, "occurrences=%d" % len(re.findall(r"mirror|fixed phase|W/2", AW, re.I))) chk("A2 anchored-windows.md 4 is the dip-constant section, not a phase statement", "## 4. The dip constant is e^{2\u03b3}/4" in AW, re.search(r"^## 4\..*$", AW, re.M).group(0)) # --------------------------------------------------------------- A3-A5: the # corpus document that DOES carry the two-degenerate-phase framing. chk("A3 calm-lemma Lemma 3 headline asserts TWO degenerate phases", "Lemma 3 (Mirror-Phase Doubling Lemma \u2014 the two degenerate phases" in CL) chk("A4 calm-lemma states the self-pairing condition modulo W", "**self-paired iff 2t \u2261 0 (mod W)**, i.e. exactly t = 0 and t = W/2" in CL) chk("A5 calm-lemma t=0 branch is a MIRROR step on the class pair", "The self-pairing swaps the two classes" in CL) # ------------------------------------------------------------- A6-A8: what the # served producer itself already says and how it enumerates. # NB: the header is comment-wrapped, so match across the "// " line breaks. FLAT = re.sub(r"\n//\s*", " ", PROD) chk("A6 producer header states the integer-phase orbit reading", all(s in FLAT for s in [ "the unique fixed point INSIDE the window is t = W/2", "the anchor's mirror partner is the integer phase W itself", "lies just OUTSIDE the enumerated window"])) chk("A7 producer enumerates exactly the levels x = 11, 13, 17", "for(const x of [11,13,17]) runLevel(x);" in PROD) chk("A8 producer's mirror check wraps modulo W, so phase W is not enumerated", "(W-t)%W" in PROD, "wrap=%d, enumerate loops over t (W-t) mod W has TWO fixed phases: 0 and W/2. So "fixed # phase" is convention-dependent, which is exactly the ambiguity to repair. cyc = {x: [t for t in range(W) if (W - t) % W == t % W] for x, W in Wv.items()} chk("A13a cyclic reading Z_W: exactly two fixed phases {0, W/2}", all(v == [0, W // 2] for (x, W), v in zip(Wv.items(), cyc.values())), cyc) # (b) as INTEGER phases the involution pairs t with W-t, so the single fixed # phase in the closed window [0,W] is W/2 and t=0 pairs with t=W. intv = {x: [t for t in range(W + 1) if W - t == t] for x, W in Wv.items()} img = {x: sorted({W - t for t in range(W + 1)})[:2] + sorted({W - t for t in range(W + 1)})[-2:] for x, W in Wv.items()} chk("A13b integer reading [0,W]: exactly one fixed phase, W/2", all(v == [W // 2] for (x, W), v in zip(Wv.items(), intv.values())), intv) chk("A14 integer mirror sends 0 to W, i.e. the partner is not in the window", all(sorted({W - t for t in range(W)}) == list(range(1, W + 1)) for W in Wv.values()), "0 -> W at every level") def primes_between(a, b): out = [] for n in range(a, b + 1): if n > 1 and all(n % d for d in range(2, int(n ** .5) + 1)): out.append(n) return out def pair_invariant(W, q): """Lemma 3 t=0 branch: does c -> (W-2-c) mod q map {0,q-2} to itself?""" P = {0, (q - 2) % q} img = {(W - 2 - c) % q for c in P} return img == P levels = [(11, 2310, primes_between(13, 47)), (13, 30030, primes_between(17, 173))] cnt = {} for x, W, qs in levels: cnt[x] = (sum(1 for q in qs if pair_invariant(W, q)), len(qs)) chk("A15 t=0 class-pair invariance fails for EVERY scour prime tested", all(v[0] == 0 for v in cnt.values()), "invariant q / total: %s" % cnt) def swap_invariant(W, q): """W/2 branch (calm-lemma Lemma 3, second bullet): the mirror swaps the two classes {W/2, W/2-2}. mu(c) = (W-2-c) mod q; the swap is the integer identity W-2-(W/2) = W/2-2, so it is expected for EVERY q.""" h = W // 2 P = {h % q, (h - 2) % q} return {(W - 2 - c) % q for c in P} == P dbl = {} for x, W, qs in levels: dbl[x] = (sum(1 for q in qs if swap_invariant(W, q)), len(qs)) chk("A16 W/2 branch: the class pair {W/2,W/2-2} is mirror-invariant at EVERY q", all(v[0] == v[1] for v in dbl.values()), "invariant q / total: %s" % dbl) # ------------------------------------------------------------------ A17: the # consequence the route's repair rests on: anchor calm cannot be a mirror # constraint, because the anchor has no invariant class pair at any q. chk("A17 the two tails are NOT distinguished by the same symmetry", all(v[0] == 0 for v in cnt.values()) and all(v[0] == v[1] for v in dbl.values()), "t=0 mirror-invariant for 0/%d primes, W/2 for %d/%d" % (cnt[11][1], dbl[11][0], dbl[11][1])) fails = [n for n, p, d in R if not p] for n, p, d in R: print(("PASS " if p else "FAIL ") + n + (" [" + d + "]" if d else "")) print() print("checks=%d passed=%d failed=%d" % (len(R), len(R) - len(fails), len(fails))) print("all_pass=%s" % (not fails)) sys.exit(1 if fails else 0)