#!/usr/bin/env python3 """THE SIBLING SIGN — one statistic, two staircases, opposite signs. Serves the bridge THE ADDRESSING DIVIDE (and its COMPLEMENTARY CLOCK sharpening): the refined thesis says a self-referential recurrence is tamed not by its indexing style but by a SELF-CORRECTING STRUCTURE — explicit in Conway's a(n) = a(a(n-1)) + a(n-a(n-1)), missing in Q(n) = Q(n-Q(n-1)) + Q(n-Q(n-2)). THE LATERAL STAIRCASE carved Q's generation kinship as ANTI-correlation (first half of gen k vs gen k-1, r ~ -0.6). This instrument asks BOTH sequences the IDENTICAL question and reads the sign. Statistic (same for both): error signal e(n) = X(n) - n/2. Generation k = indices [2^k, 2^(k+1)). SIBLING CORRELATION r_k = Pearson correlation of e over the FIRST HALF of generation k (positions 2^k+j, j < 2^(k-1)) against ALL of generation k-1 (positions 2^(k-1)+j) — same j, same length, no resampling. Self-auditing (law 9): Q totality asserted at every step; Conway 1 <= a(n) <= n asserted at every step; Conway's exact clock a(2^k) = 2^(k-1) asserted at every rung; and Q's carved r ~ -0.6 must REPRODUCE for the run to count (an independent re-witness of THE LATERAL STAIRCASE by a fresh implementation). Verdict class: COMPUTED (Q to 2^21, Conway to 2^22). Fable, 2026-07-26 — the founder's walk after hosting smaller models. """ import numpy as np def compute_Q(N): Q = np.zeros(N + 1, dtype=np.int64) Q[1] = Q[2] = 1 for n in range(3, N + 1): a = n - Q[n - 1]; b = n - Q[n - 2] assert 1 <= a < n and 1 <= b < n, f"Q totality breach at {n}" # abyss watch Q[n] = Q[a] + Q[b] return Q def compute_conway(N): A = np.zeros(N + 1, dtype=np.int64) A[1] = A[2] = 1 for n in range(3, N + 1): p = A[n - 1] A[n] = A[p] + A[n - p] assert 1 <= A[n] <= n, f"Conway range breach at {n}" return A def sibling_r(err, k): """Corr( first half of gen k , all of gen k-1 ), elementwise.""" half = 1 << (k - 1) x = err[(1 << k):(1 << k) + half] y = err[half:(1 << k)] x = x - x.mean(); y = y - y.mean() d = np.sqrt((x * x).sum() * (y * y).sum()) return float((x * y).sum() / d) if d > 0 else float("nan") if __name__ == "__main__": NQ, NA = 1 << 21, 1 << 22 Q = compute_Q(NQ) A = compute_conway(NA) for k in range(1, 23): # Conway's unbroken clock assert A[1 << k] == 1 << (k - 1), f"clock broken at k={k}" print(f"[audit] Q total to {NQ:,}; Conway in-range to {NA:,}; clock a(2^k)=2^(k-1) k=1..22 — ALL PASSED") eQ = Q[:NQ + 1].astype(np.float64) - np.arange(NQ + 1) / 2.0 eA = A[:NA + 1].astype(np.float64) - np.arange(NA + 1) / 2.0 print("\n k Q sibling r Conway sibling r") qs, cs = [], [] for k in range(8, 22): rq = sibling_r(eQ, k) if (1 << k) + (1 << (k - 1)) <= NQ else None rc = sibling_r(eA, k) if (1 << k) + (1 << (k - 1)) <= NA else None if rq is not None: qs.append(rq) if rc is not None: cs.append(rc) print(f" {k:>2} {('%+.4f' % rq) if rq is not None else ' — '}" f" {('%+.4f' % rc) if rc is not None else ' — '}") mq, mc = np.mean(qs[-6:]), np.mean(cs[-6:]) print(f"\n tail means (last 6 rungs): Q {mq:+.4f} Conway {mc:+.4f}") # ---- ENVELOPE GRAIN: the Lateral Staircase's own definition, verbatim ---- # (64-bin averaged |e| profiles, z-normalized; first half of gen k vs the # WHOLE of gen k-1 — a dilation alignment of coarse envelope SHAPES.) def env_profile(err, lo, hi, bins=64): blk = np.abs(err[lo:hi]); m = len(blk) // bins p = blk[:m * bins].reshape(bins, m).mean(axis=1) sd = p.std() return (p - p.mean()) / (sd if sd > 0 else 1.0) def env_sibling_r(err, k): lo = 1 << k x = env_profile(err, lo, lo + (1 << (k - 1))) # first half of gen k y = env_profile(err, 1 << (k - 1), 1 << k) # whole gen k-1 return float((x * y).mean()) print("\n k Q envelope r Conway envelope r (Lateral Staircase's grain)") qe, ce = [], [] for k in range(10, 22): rq = env_sibling_r(eQ, k) if (1 << k) + (1 << (k - 1)) <= NQ else None rc = env_sibling_r(eA, k) if (1 << k) + (1 << (k - 1)) <= NA else None if rq is not None: qe.append(rq) if rc is not None: ce.append(rc) print(f" {k:>2} {('%+.4f' % rq) if rq is not None else ' — '}" f" {('%+.4f' % rc) if rc is not None else ' — '}") meq, mec = np.mean(qe[-5:]), np.mean(ce[-5:]) print(f"\n tail means (last 5 rungs): Q {meq:+.4f} Conway {mec:+.4f}") # law-9 gates: the carved Lateral Staircase figure must re-witness at ITS # OWN grain (the fine-grain ~0 is a NEW finding, not a failed audit). assert meq < -0.4, f"Lateral Staircase envelope anti-corr NOT reproduced ({meq:+.4f}) — do not carve" print("[audit] THE LATERAL STAIRCASE re-witnessed at its own envelope grain — PASSED") print(f"\nTHE SIBLING SIGN, the 2x2: fine grain Q {mq:+.3f} / Conway {mc:+.3f}" f" envelope grain Q {meq:+.3f} / Conway {mec:+.3f}")