#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Build the audit revision of the served `TODO.md` (the forward queue / priority board). Base = the copy fetched this window (sha256 ba600056…, 16571 bytes). Four edits, each anchored on a unique line rather than on punctuation (the file mixes ASCII and typographic apostrophes): 1. priority board row 1 (route C): D is closed twice, so the live half is A2's exact B; 2. priority board row 3 (route 9): the transfer is written and priced as ONE named input; 3. the route 9 paragraph: question answered in substance, the two engines and their thresholds, and the retired maintenance sentence; 4. the maintenance bullet asking for the mirrored-pattern correction, which was applied 2026-09-05. Plus a one-line dated note under the board recording the revision. """ import hashlib import os RUN = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SRC = os.path.join(RUN, "evidence", "docs", "TODO.md") DST = os.path.join(RUN, "artifacts", "rev-TODO.md") ROW1 = ("| 1 | C: twin-prime arithmetic | A2's exact B is now the live half: D is closed twice " "(returns #762/#763 on the corollary's scope, #764/#765 on the per-octave rebalancing), so " "no source/structure match for D remains to be checked |") ROW3 = ("| 3 | 9: variance identification | The (H_w) transfer is written and priced as ONE named " "input (return #767): the Progressions Condition of Harper 2025 Thm 1 to level " "2x/Q <= 2 sqrt(E), or the (b)-(c) write-out of the 2012 route |") BOARD_NOTE = ("Revised 2026-09-17 (audit, from the 2026-09-16/17 returns #762 through #768):\n" "row 1's next decision and row 3's status are updated, and one maintenance line is\n" "retired below. The 2026-09-09 rows are otherwise unchanged.") ROUTE9_NEW = """Question ANSWERED IN SUBSTANCE (return #767, job #1552). The weighted form (H_w) is the statement printed in recon-0830-smooth-aps.md section 3.1 read BLOCK-LOCALLY, with the discrepancy summed from e = E rather than from e = 1: the printed full-range reading is false (measured: at d = 7, Q = 7 the left side is 0.7337 / 0.7324 / 0.7315 at x = 19/23/29 against a right side C_A(log^{-A} E + 7/E) that tends to 0; see the 2026-09-17 rider in that note and audit return #768). With that correction the transfer closes on the range the deduction uses, given ONE named input, through two interlocking engines: Harper, JLMS 112 (2025) e70293 = arXiv:2412.19644, Theorem 1, for an ARBITRARY complex sequence, covers D > (4L/M)^{1/3} at the price of a Progressions-Condition Bombieri-Vinogradov-type input to level 2x/Q <= 2 sqrt(E); and Harper arXiv:1208.5992v1 Theorem 2, whose range has no lower bound on Q, covers E >= y, i.e. D <= sqrt(L)/M, at the price of the steps (a)-(d), whose uniform-in-a sieve tail dies at D > (L/M)^{2/5} and is never invoked. Next decision: first the (b)-(c) write-out of the 2012 route, then the Progressions Condition. Payoff: a justified two-branch contribution; the three-branch type of section 3.5 remains the gate before claiming the variance limit. The mirrored-pattern producer correction is APPLIED (2026-09-05 rider at the head of varE-theta2-step.md) and its maintenance bullet is retired below. Model convergence alone does not settle the identification step. A larger Var(41) run has no current decision. """ BULLET_OLD_FIRST = "- Apply the mirrored-pattern correction to research/history/staging/varE-theta2-step.js," BULLET_NEW = """- RETIRED 2026-09-17: the mirrored-pattern correction to research/history/staging/varE-theta2-step.js was APPLIED 2026-09-05 (the rider at the head of that note records that the producer now sums both mirror patterns, is re-embedded, and reproduces delta*X2 = 0.000236 and delta*Xmix = -0.013876 with x = 23 added). The underlying claim Q-verify-record-defects-0830 claim 1 is CONFIRMED; this line is closed, not outstanding. Evidence: return #767.""" def find(lines, needle, what): hits = [i for i, l in enumerate(lines) if needle in l] if len(hits) != 1: raise SystemExit("%s: %d hits for %r" % (what, len(hits), needle)) return hits[0] def main(): text = open(SRC, encoding="utf-8").read() lines = text.split("\n") i1 = find(lines, "| 1 | C: twin-prime arithmetic |", "board row 1") i3 = find(lines, "| 3 | 9: variance identification |", "board row 3") ip = find(lines, "| Parked | Larger enumerations", "board last row") lines[i1], lines[i3] = ROW1, ROW3 lines[ip + 1:ip + 1] = ["", BOARD_NOTE.rstrip("\n")] a = find(lines, "Question: can the weighted form needed for the theta=2 replacement error", "route 9 paragraph start") b = find(lines, "listed under maintenance below.", "route 9 paragraph end") if b <= a: raise SystemExit("route 9 anchors out of order") lines[a:b + 1] = ROUTE9_NEW.rstrip("\n").split("\n") c = find(lines, BULLET_OLD_FIRST, "maintenance bullet") if "then re-embed the affected entries" not in lines[c + 1] or "Keep paper edits coordinated" not in lines[c + 2]: raise SystemExit("the maintenance bullet is not the three lines expected: %r" % lines[c + 1:c + 3]) lines[c:c + 3] = BULLET_NEW.split("\n") out = "\n".join(lines) with open(DST, "w", encoding="utf-8", newline="\n") as fh: fh.write(out) n0 = sum(1 for _ in open(SRC, encoding="utf-8")) n1 = sum(1 for _ in open(DST, encoding="utf-8")) print("base %s lines=%d sha256=%s" % (os.path.basename(SRC), n0, hashlib.sha256(open(SRC, "rb").read()).hexdigest())) print("rev %s lines=%d sha256=%s (%+d)" % (os.path.basename(DST), n1, hashlib.sha256(open(DST, "rb").read()).hexdigest(), n1 - n0)) return 0 if __name__ == "__main__": raise SystemExit(main())