#!/usr/bin/env python3 """ rescue-138 / job 2859 : exact-arithmetic check of the STRUCTURAL (as opposed to magnitude) obstruction, on the served identities only. Sources quoted, read locally: moving-cutoff-parity.md (3) M = sum_{n in J} f(n), J = (x/2, x], y = ceil(x^{12/25}) moving-cutoff-parity.md (12) S = C2 x - 2 C2 M + D_y + O_A(x/log^A x) moving-cutoff-parity.md (17) D_y = B_L + 2 C2 M + O_A(x/log^A x) moving-cutoff-parity.md (16) D_y >= -4x/25 + o(x) [OPEN] fixed-endpoint-discrepancy.md (2.5) B + 2 C2 M >= -4x/25 + o(x) ~ same consumer fixed-endpoint-discrepancy.md (2.8) S = C2 x + T_I^low + B + O_A(x log^{1-A} x) No sum is evaluated. The script checks what is checkable with exact rationals: the three linear dependencies that make the census class information-free about the consumer, and the fold difference by construction. Every fixture satisfies (12) exactly by construction (r is DEFINED by it), which is the point. Prints: A1 (12) re-arranged: S - C2 x = D_y - 2 C2 M + r x [exact, all fixtures] A2 fold difference, served M: dD = -[ (r_y - r_y') + 2C2 dM ] [exact] and with a y-FREE M this reduces to -x (r_y - r_y'): dD is a residual difference, not an independent estimator. A3 linear dependence: D_y is an exact function of (S, M, r); equivalently any functional of the census row (D_y, M) alone equals one of (S - C2 x + r x, ...) A4 the consumer in census coordinates (17): census(D_y, M) + B_L = -0.16 x -> B_L is a function of (S, M, r); a census row cannot pin it. A5 contrast with #2858's fold measurement: |dD|/x vs |D_y|/x and vs 1/log^2 x from return 1484's own printed table (quoted, not re-run). """ from fractions import Fraction as F import itertools, math C2 = F(6601618, 10000000) # 2*C2 ~ 1.3203236 : the twin-prime constant C2x2 = 2 * C2 # the coefficient 2C_2 appearing in (12)/(17) TARGET = F(4, 25) # 4/25 = 0.16 def check(name, got, want): ok = (got == want) print(" %-58s %s" % (name, "OK" if ok else "FAIL got=%s want=%s" % (got, want))) return ok print("rescue-138 exact-arithmetic identity check (rungs: verified, exact rationals)") print("C2 = %s ; 2*C2 = %s ; consumer threshold 4/25 = %s" % (C2, C2x2, float(TARGET))) print() # ---------------------------------------------------------------- A1 / A3 print("A1/A3 identity (12) and the (D_y, M) <-> (S, r) dictionary") print(" (12): S = C2 x - 2 C2 M + D_y + r x with r the (12)-residual,") print(" i.e. r := (S - C2 x + 2 C2 M - D_y)/x. r is DEFINED, not measured.") fixtures = [] for (x, S, M, D) in [(64, 30, 2, -1), (256, 137, -3, 5), (1024, 501, 7, -11), (4096, 2059, -19, 3), (16384, 8197, 23, -7)]: x, S, M, D = F(x), F(S), F(M), F(D) r = (S - C2 * x + 2 * C2 * M - D) / x fixtures.append((x, S, M, D, r)) allok = True for (x, S, M, D, r) in fixtures: allok &= check("x=%-6s (12): S = C2x - 2C2M + D + r x" % x, S, C2 * x - 2 * C2 * M + D + r * x) allok &= check("x=%-6s D recovered from (S, M, r)" % x, D, S - C2 * x + 2 * C2 * M - r * x) print(" -> a census row is an exact re-encoding of (S, M, r); knowing any two of") print(" the three pins the third. No row is independent evidence about S.") print() # ---------------------------------------------------------------------- A2 print("A2 fold difference with the SERVED (y-free) M") print(" D_y(x) = [S - C2x] + 2C2 M - r_y x (O_A dropped; exact model)") print(" dD(y,y';x) = D_y - D_y' = 2C2 (M - M) - (r_y - r_y') x = -x (r_y - r_y')") pairs = [(F(206), F(230)), (F(399), F(452)), (F(777), F(892))] for i, (x, S, M, Dp, rp) in enumerate(fixtures[:3]): y, yp = pairs[i] Dy = S - C2 * x + 2 * C2 * M - rp * x # residual r_y = rp Dy2 = S - C2 * x + 2 * C2 * M - (rp + F(1, 100)) * x # residual r_y' = rp + 1/100 dD = Dy - Dy2 # = -x (r_y - r_y') = +x/100 allok &= check("x=%-6s dD == -x (r_y - r_y') == +x/100" % x, dD, -x * (rp - (rp + F(1, 100)))) allok &= check("x=%-6s 2C2 (M_y - M_y') == 0 identically" % x, 2 * C2 * (M - M), F(0)) print(" -> #1483's comparator 2C2(M_y - M_y') is identically 0 on the served records") print(" (#1484/c). dD lives entirely inside the (12)-residual, i.e. inside the") print(" quantity that is defined through S. Folding does NOT cancel S; it moves it") print(" into r, so #1449's circularity is inherited unchanged. (#1484 section 4.1)") print() # ---------------------------------------------------------------------- A4 print("A4 consumer in census coordinates, per (17): D_y = B_L + 2 C2 M + O_A(...)") print(" consumer (16)/(2.5): B_L + 2 C2 M >= -0.16 x + o(x)") print(" on a census row, B_L = D_y - 2 C2 M (+ error) exactly, i.e. B_L is a") print(" function of (S, M, r) too; the census supplies no new constraint on it.") for (x, S, M, D, r) in fixtures: BL = D - 2 * C2 * M allok &= check("x=%-6s B_L from the row equals D - 2C2M" % x, BL, D - 2 * C2 * M) print(" -> the row fixes B_L to the same accuracy it fixes D_y; and per A1 that value") print(" is fixed by (S, M). Discriminating the consumer needs information about S") print(" or about a piece of Delta_e that S does not fix through (12).") print() # ---------------------------------------------------------------------- A5 print("A5 contrast: #2858's measured fold difference (return 1484, printed table)") print(" %-6s %-14s %-14s %-14s %-14s" % ("j", "|dD|/x", "|D_y|/x", "|dD|/|D_y|", "|dD|*log^2x/x")) fold_rows = [(16, F(31223, 10**6), F(16647, 10**6)), (18, F(10547, 10**6), F(30072, 10**6)), (20, F(58421, 10**7), F(14966, 10**6))] for (j, dd, dy) in fold_rows: lx = j * math.log(2.0) print(" %-6d %-14.5f %-14.5f %-14.2f %-14.2f" % (j, float(dd), float(dy), float(dd / dy), float(dd) * lx * lx)) print(" -> #2858's fold difference is O(|D_y|) and O(x/log^2 x): the fold is not a") print(" cleaner instrument than the level, it is the same instrument. Consistent") print(" with #1484 section 4.2, quoted here (not re-run).") print() print("ALL EXACT CHECKS PASSED" if allok else "SOME CHECK FAILED")