#!/usr/bin/env python3 """Apply the reviewer-prescribed corrections on top of the #767 reconstruction. Base: out/target-4ce085c4.md -- the file finding #767 names by sha, rebuilt from the version chain and verified byte-for-byte. Every replacement asserts its old string occurs EXACTLY ONCE and its new string zero times, so a drifted base fails loudly instead of being patched in the wrong place. Writes bytes; the document is LF-only UTF-8 and stays that way. """ import hashlib import os import sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") HERE = os.path.dirname(os.path.abspath(__file__)) os.chdir(HERE) SRC = "out/target-4ce085c4.md" DST = "out/SEARCH-CONVENTIONS.md" raw = open(SRC, "rb").read() assert b"\r" not in raw, "base has CR" text = raw.decode("utf-8") edits = [] def sub(old, new, tag): global text n = text.count(old) assert n == 1, "%s: old string occurs %d times, expected 1" % (tag, n) assert text.count(new) == 0, "%s: new string already present" % tag text = text.replace(old, new) edits.append(tag) print("applied: %s" % tag) # ---------------------------------------------------------------- #2567 (+ #33, #753) # Verbatim from finding #2567 (review #432 of return #1659). The reviewer supplies both # cells and the verdict, and forbids two things explicitly: do not say p. 47 prints the # B = 1 constraint, and do not mark the row live. Math in TeX per the success criteria. OLD_2567 = ('| Is "charge constraints are strictly sofic" in print? | **Yes**, ' 'Marcus–Roth–Siegel §2.3 p. 47, with the same appendability argument | ' 'settled; stop deriving it |') NEW_2567 = ( '| Is "charge constraints are strictly sofic" in print? | ' '**Yes for binary charge constraints with $B \\ge 2$; not for our ternary language.** ' 'Marcus–Roth–Siegel §2.3 p. 47 prints that the binary 2-charge system (their Fig. 2.6) is ' 'not finite-type, by appendability (`+` extends `-+-+...-+` but not `++-+-+...-+`). The binary ' '`B = 1` constraint (Fig. 1.14 p. 16) is of finite type (forbid `++`, `--`) with capacity 0 ' 'bits (Table 3.2 p. 75). The ternary walk language is a zero-loop extension of the `B = 1` ' 'constraint; that it is sofic and not of finite type ($+2\\,0^k\\,+2$) is elementary and is ' 'not printed there. | ' 'settled 2026-09-25 against the pages: cite MRS only for the binary constraints; the ternary ' 'soficity is derived (`exact-fold-L` §3, §8) |') sub(OLD_2567, NEW_2567, "#2567 sofic row (closes #33, #753)") # ------------------------------------------------------------------------ #2568 naming # "Line 98 names the ternary instance 'alternate mark inversion' (correct: AMI output is the # ternary zero-loop language). exact-fold-L §8 (#1253 revision) instead calls the binary # B = 1 constraint AMI. Reconcile the naming in whichever file is revised next." # The note goes in the LAST cell ("where it lives"), not the OWNING-convention cell: §6 parses # that column out of §1 at run time as this check's clearing vocabulary, and it must stay the # literature's wording rather than acquire cross-file bookkeeping. OLD_2568 = ('Norris–Bloomberg, *IEEE Trans. Magn.* **17 (1981)**; Lind–Marcus, CUP 1995 |') NEW_2568 = ( 'Norris–Bloomberg, *IEEE Trans. Magn.* **17 (1981)**; Lind–Marcus, CUP 1995. Calling the ' 'ternary instance "alternate mark inversion" is right, and it is what this row and the §3 row ' 'mean by it; `exact-fold-L.md` §8 instead calls the binary `B = 1` constraint AMI — one term for ' 'two objects. The row above states which is which and `exact-fold-L.md` is the file that still ' 'has to follow (finding #2568). |') sub(OLD_2568, NEW_2568, "#2568 AMI naming reconciled in §1 (last cell)") # --------------------------------------------------------------------- #2045 (second item) # "The Halberstam–Richert access row (currently line 233) has 3 cells where its header has 4. # The owners should fill the missing cell." Header: question | answer | what was actually # searched | where it is worked. The row's second cell carries both the answer and the channel # list, so it is split: the channel list becomes the missing third cell. OLD_2045 = ('; Dover 2011 ' 'ISBN 9780486479392 | 2026-09-07 ') NEW_2045 = ('; Dover 2011 ' 'ISBN 9780486479392 | archive.org lending item `sievemethods0000halb` (page image and ' 'djvu text, both refused anonymously); Google Books search-inside on three volume ids; ' 'HathiTrust, ScienceDirect and zbMATH web; the zbMATH API; and six secondary ' 'candidates (Montgomery Bull. AMS 1976; Ford 2023 notes; Greaves; arXiv 2410.14133, ' '2503.04045, 2211.11012, 2606.17955, 1907.06393) | 2026-09-07 ') sub(OLD_2045, NEW_2045, "#2045 Halberstam–Richert row: missing third cell filled") # ----------------------------------------------------------------------------- #761 # "Restrict the 10^4 statement to the shifted-prime and Lambda(n-2)mu(n) objects, and say # two-point Chowla sums are published to 10^8 (Luo-Ye; also recorded in #479 prior-art1125.md)." OLD_761 = ('no published or tabulated values above x=10^4 for any of these objects (Carella ' 'arXiv:2206.12956 has shift-1 Liouville at 10^4; Luo--Ye arXiv:2401.18082 has unweighted ' 'shift-only sums to 10^8; Humphries--Shekatkar--Wong arXiv:1704.07979 is Liouville on ' 'primes in progressions, not shifted primes)') NEW_761 = ('no published or tabulated values above $x = 10^4$ for the shifted-prime and ' '$\\Lambda(n-2)\\mu(n)$ objects (Carella arXiv:2206.12956 has shift-1 Liouville at ' '$10^4$; Humphries--Shekatkar--Wong arXiv:1704.07979 is Liouville on primes in ' 'progressions, not shifted primes); **two-point Chowla sums are the exception and ARE ' 'published to $10^8$** (Luo--Ye arXiv:2401.18082 (3.6)/Table 2L at $X = 10^4..10^8$ for ' '$h = 1..5, 10, 100, 1000$; the same is recorded in #479 `prior-art1125.md`)') sub(OLD_761, NEW_761, "#761 finite-tables row: 10^4 statement restricted") # --------------------------------------------------- the row this revision re-introduces # #1350's census row (restored by the #767 reconstruction) carries RAW pipe characters inside # its code spans -- `|T_x|`, `||C||`-style -- which break the markdown table: it is the only row # whose cell count disagrees with its header in the block this revision ADDS to the served file. # The reviewer's findings for this row (#762, #763) do not mention it, but serving a row that # breaks the table it sits in would be a defect this revision introduces, so the pipes are # escaped. The three rows that are already served with the same problem (lines 87, 88, 90, # "L² spread...", "two slots killed...", "the fold recursion...") are NOT touched: they are # outside the assigned findings and the instruction forbids unrelated rewrites. sub('`|T_x|`', '`\\|T_x\\|`', "restored census row: pipes escaped in `|T_x|`") sub('`|{r : 0 ≤ r < primorial(n), gcd(r, P) = 1, gcd(r+2, P) = 1}|`', '`\\|{r : 0 ≤ r < primorial(n), gcd(r, P) = 1, gcd(r+2, P) = 1}\\|`', "restored census row: pipes escaped in the count formula") out = text.encode("utf-8") assert b"\r" not in out open(DST, "wb").write(out) sha = hashlib.sha256(out).hexdigest() print() print("%d edits: %s" % (len(edits), ", ".join(edits))) print("wrote %s: %d lines, %d bytes" % (DST, text.count("\n") + 1, len(out))) print("sha256 %s" % sha) print("base %s (346 bytes smaller than this)" % hashlib.sha256(raw).hexdigest())