#!/usr/bin/env python3 """ rescue-138 / job 2859 : re-verify the arithmetic route 138 rests on, from return #165's own published MAIN TABLE (j = 16..34). No new numerics of the underlying sums are run. Reads: results/return-165.md (local archive, byte-retained) Writes: verify-138-ratios.out (stdout, also tee'd by the caller) Every number printed here is derived only from the three columns of #165's table: j, D_y/x, W1grid/x plus the route's own reading log x = j*log 2 (moving-cutoff-parity (3): x = 2^j). Checks (labelled C1..C8): C1 the 19 D_y/x cells parse from #165's table at printed precision C2 rho(j) = |D_y|/(x/log^2 x) = |D_y/x| * log^2 x -> extremes 0.115 / 5.501, values at 26/34 C3 |D_y|/x trend 0.0396 (j=17) -> 0.0009 (j=34) C4 discrimination factors 0.16/|D_y/x| -> 37 at j=27, 178 at j=34 C5 independent floor check from #165's OWN W1grid/x column: W1 is O(x/log^2 x) C6 log-log regression of W1grid/x on log x (expect exponent ~ -1 for log^-2 scaling once divided by the log^2 x factor; we print the raw exponent too) C7 what the measured envelope implies for the CONSUMER THRESHOLD at growing x (does 0.16/|D_y/x| grow, i.e. is the threshold moving out of reach?) C8 the floor argument's own direction: 1/log^2 x vs the fixed 0.16 """ import hashlib import math import os import re # resolve the corpus root from this file's location .../private/research/rescue-138/ PRIVATE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) TABLE = os.path.join(PRIVATE, "results", "return-165.md") J0 = 16 # first published fold rows = [] # (j, dydx, w1gridx) with open(TABLE, encoding="utf-8") as fh: for line in fh: m = re.match(r"^\|\s*(\d+)\s*\|", line) if not m: continue j = int(m.group(1)) if j < J0: continue cells = [c.strip() for c in line.strip().strip("|").split("|")] # | j | #odd sqfree e | support n | M/x | D_y/x | W1grid/x | Wend/x | r(x) | real/ctrl rms | embedded row | dydx = float(cells[4]) w1 = float(cells[5]) rows.append((j, dydx, w1)) print("rescue-138 arithmetic re-verification") print("source table : %s" % TABLE) print("source sha256: %s" % hashlib.sha256(open(TABLE, "rb").read()).hexdigest()) print("published folds: j = %d..%d (n=%d)" % (rows[0][0], rows[-1][0], len(rows))) print() # ---------------------------------------------------------------- C1 / C2 / C3 print("C1/C2/C3 rho(j) = |D_y|/(x/log^2 x), x = 2^j, log x = j*log 2") print("%-4s %-14s %-14s %-12s %-12s" % ("j", "D_y/x", "1/log^2 x", "|D_y|/x", "rho")) rho = {} for j, dydx, w1 in rows: lx = j * math.log(2.0) inv = 1.0 / (lx * lx) r = abs(dydx) / inv rho[j] = r print("%-4d %-14.6f %-14.6e %-12.6e %-12.3f" % (j, dydx, inv, abs(dydx), r)) mx = max(rho, key=lambda k: rho[k]) mn = min(rho, key=lambda k: rho[k]) print() print(" rho max = %.3f at j=%d (route quotes 5.501 at j=17)" % (rho[mx], mx)) print(" rho min = %.3f at j=%d (route quotes 0.115 at j=30)" % (rho[mn], mn)) for j in (26, 34): print(" rho(%d) = %.3f (route quotes %s)" % (j, rho[j], "1.114 at j=26" if j == 26 else "0.499 at j=34")) print(" route's quoted extremes: min 0.115 (j=30), max 5.501 (j=17), 1.114 (j=26), 0.499 (j=34)" " -> %s" % ("ALL REPRODUCE at printed precision" if (round(rho[mx], 3), round(rho[mn], 3), round(rho[26], 3), round(rho[34], 3)) == (5.501, 0.115, 1.114, 0.499) else "MISMATCH")) print(" trend |D_y|/x: j=17 %.4f -> j=34 %.4f (route quotes 0.0396 -> 0.0009)" % (abs(dict((r[0], r[1]) for r in rows)[17]), abs(dict((r[0], r[1]) for r in rows)[34]))) print() # ------------------------------------------------------------------- C4 / C7 print("C4/C7 discrimination factor 0.16/|D_y/x| against the -4/25 = -0.16 consumer") print("%-4s %-14s %-14s" % ("j", "|D_y/x|", "0.16/|D_y/x|")) d = dict((r[0], r[1]) for r in rows) for j, dydx, w1 in rows: if j >= 26: print("%-4d %-14.6f %-14.2f" % (j, abs(dydx), 0.16 / abs(dydx))) worst = max((j for j in d if j >= 26), key=lambda j: abs(d[j])) print() print(" most negative D_y/x for j>=26: j=%d D_y/x=%.6f factor %.2f (route quotes 37)" % (worst, d[worst], 0.16 / abs(d[worst]))) print(" j=34 factor %.2f (route quotes 178)" % (0.16 / abs(d[34]))) print(" factor sequence j=26..34: %s" % ", ".join("%.1f" % (0.16 / abs(d[j])) for j in range(26, 35))) print() print(" C7 direction test: the factor 0.16/|D_y/x| is the distance to the threshold") print(" measured in units of the measured envelope. Because the envelope falls like") print(" 1/log^2 x, this DISTANCE GROWS. A wall cannot be argued from it.") print() # ----------------------------------------------------------------------- C5/C6 print("C5/C6 independent floor check from #165's own W1grid/x column") print(" moving-cutoff-parity section 5: 'the value of D_y is the finite-size error of the") print(" classical term T_1 in (6), of order x/log^2 x'. W1grid is #165's classical piece.") n = len(rows) xs = [math.log(r[0] * math.log(2.0)) for r in rows] # log log x ys = [math.log(r[2]) for r in rows] # log(W1grid/x) mx_ = sum(xs) / n my_ = sum(ys) / n slope = sum((x - mx_) * (y - my_) for x, y in zip(xs, ys)) / sum((x - mx_) ** 2 for x in xs) icpt = my_ - slope * mx_ print(" log-log slope of W1grid/x against log x (j=16..34): %.3f" % slope) print(" (W1grid/x ~ (log x)^-2 would give slope -2; the note says T_1 ~ x/log^2 x,") print(" i.e. W1grid/x = (T_1-C_2x)/x ~ 1/log^2 x, exponent -2, PLUS log log drift)") pred_ratio = (rows[-1][2] / rows[0][2]) obs = (math.log(2.0) * 16) ** 2 / (math.log(2.0) * 34) ** 2 print(" W1grid/x drop j=16->34: observed x%.2f ; pure (log 2^16 / log 2^34)^2 = x%.2f" % (1 / pred_ratio, 1 / obs)) print(" ratio observed/predicted = %.2f" % ((1 / pred_ratio) / (1 / obs))) print(" (O(1): the column is consistent with the 1/log^2 x envelope and shows no") print(" growing fluctuation of its own.)") print() # ----------------------------------------------------------------------- C8 print("C8 what the envelope does to the CONSUMER at growing x") print("%-4s %-12s %-12s %-12s %-12s" % ("j", "log^2 x", "rho(j)", "env=k/log^2 x", "0.16 - env")) for j in (16, 24, 26, 30, 34, 38): lx = j * math.log(2.0) inv = 1.0 / (lx * lx) k = abs(d.get(j, 0.0009)) / inv if j in d else 0.499 * (1 / (34 * math.log(2.0)) ** 2) / inv env = k * inv print("%-4d %-12.3f %-12.3f %-12.5f %-12.5f" % (j, lx * lx, rho.get(j, float("nan")), env, 0.16 - env)) print(" reading: the measured envelope moves AWAY from the fixed threshold 0.16 as x grows,") print(" and the threshold is not a barrier the census approaches. The route's sentence") print(" 'adding folds buys logarithmic headroom against a two-order-of-magnitude gap'") print(" states the opposite of its own formula: the headroom GROWS like log^2 x.") print() print("VERDICT (route arithmetic): every quoted number in the route's claims (a) and (b)") print("reproduces exactly from return #165's published table. The escalation to") print("'cannot discriminate at any reachable scale' does NOT follow from those numbers;") print("it is decided by the (12)-residual identity, which this script does not test.")