#!/usr/bin/env python3 """revise663b.py -- the three-spot correction to `research/fixed-endpoint-discrepancy.md`. Supersedes the two-spot revision filed as audit #298: the same defect (the document says an absolute-value, all-moduli theorem beyond 1/2 does not exist, while BFI II+III's main result, quoted as Theorem A of Maynard I section 1.1, carries the bars at level x^(1/2+delta)) appears in three places, and this revision fixes all three against the served head. """ import io, difflib, hashlib SRC = "fixed-endpoint-discrepancy.md" DST = "fixed-endpoint-discrepancy-revised2.md" old1 = (" Source theorem and first unmatched hypothesis, if any: none imported beyond (BV*), " "(3a.9), PNT; for the band, every source in section 3 fails at absolute values over all " "moduli near x^(1/2+eps') in one fixed class, or at the signed weight") new1 = (" Source theorem and first unmatched hypothesis, if any: none imported beyond (BV*), " "(3a.9), PNT; for the band, every source in section 3 fails at the saving needed over all " "moduli near x^(1/2+eps') in one fixed class - BFI II+III Theorem A (as in Maynard I " "section 1.1) has the absolute values and the level x^(1/2+delta), but its delta^2 x/log x " "term accumulates over the (eps+eps')log x/log 2 blocks to about eps'^3 x/(3 log 2), of the " "order of the whole target o(x/log x) - or at the signed weight") old2 = ("| BFI II + III Theorem A (as in Maynard I section 1.1; primaries unreached) | " "no absolute values, Q=x^(1/2+delta), fixed a: " "sum_{q~Q}(pi(x;q,a)-pi(x)/phi(q))=O(delta^2 x/log x+x(log log x)^O(1)/log^3 x) |") new2 = ("| BFI II + III Theorem A (as in Maynard I section 1.1; primaries unreached) | " "**absolute values over all q in [Q,2Q]**, Q=x^(1/2+delta), fixed a: " "sum_{q~Q}|pi(x;q,a)-pi(x)/phi(q)|=O(delta^2 x/log x+x(log log x)^O(1)/log^3 x) |") old3 = """(4.9) is a case of the Elliott–Halberstam range beyond 1/2 in absolute value and is not supplied by any source in section 3: the absolute-value theorems stop at x^(1/2) or need a convenient divisor; the beyond-1/2 theorems have no absolute values or need well-factorable weights, and the matrix records where each fails.""" new3 = """(4.9) is a case of the Elliott–Halberstam range beyond 1/2 in absolute value and is not supplied by any source in section 3 — but the absolute-value, all-moduli theorem beyond 1/2 does exist, and is quoted in the matrix: BFI II+III (Math. Ann. 277 (1987) 361-393), read as Theorem A of [Maynard I, arXiv:2006.06572](https://arxiv.org/abs/2006.06572) section 1.1, whose summand sum_{q in [Q,2Q], (q,a)=1}|pi(x;q,a)-pi(x)/phi(q)| carries the absolute values and is O_a(delta^2 x/log x + x(log log x)^O(1)/(log x)^3). What fails is the shape of that error term over the level range, not the level and not the absolute value: at delta = eps' a single block already gives a constant multiple of x/log x, and accumulated over the (eps+eps')log x/log 2 dyadic blocks the delta^2 term gives about eps'^3 x/(3 log 2), a constant multiple of x against a target of o(x/log x) — short by a factor about eps'^3 log x. The log-power term alone, accumulated, is o(x/log x), so a version of Theorem A O(1)-uniform in delta <= eps' would supply (4.9), once the tau(q)^3 weight (itself of order (log x)^3) is handled. The other beyond-1/2 statements need well-factorable weights (BFI I Theorems 10, level x^(4/7)), smooth moduli (Zhang–Polymath, x^(1/2+7/300)) or a convenient-sized factor (Maynard I Theorem 1.1), and the matrix records where each fails.""" t = io.open(SRC, encoding="utf-8").read() for k, (o, n) in enumerate(((old1, new1), (old2, new2), (old3, new3)), 1): assert t.count(o) == 1, ("spot %d" % k, t.count(o)) r = t.replace(old1, new1).replace(old2, new2).replace(old3, new3) io.open(DST, "w", encoding="utf-8", newline="\n").write(r) diff = list(difflib.unified_diff(t.splitlines(True), r.splitlines(True), "a/research/fixed-endpoint-discrepancy.md", "b/research/fixed-endpoint-discrepancy.md", n=2)) io.open("fixed-endpoint-discrepancy-3spots.patch", "w", encoding="utf-8", newline="\n").write("".join(diff)) hunks = sum(1 for l in diff if l.startswith("@@")) changed = sum(1 for l in diff if l[:1] in "+-" and not l.startswith(("+++", "---"))) print("hunks", hunks, "changed lines", changed) for name, data in ((SRC, t), (DST, r)): b = data.encode("utf-8") print("%-40s sha256 %s %d bytes" % (name, hashlib.sha256(b).hexdigest(), len(b))) print("--- first hunk only ---") print("".join([l for l in diff if l.startswith("@@") or True])[:900])