"""THE COLLISION LADDER's own named next step, run at last (2026-07-23). The ladder's honest corpse (TABLE.md, JAM 5 sitting) left one live falsification clause unattempted: "if a future walker CAN reach a rung's birthday scale (feasible only for small M -- maybe L=6 with a bigger M, since that's the one region where sqrt(S) is still a computable number of steps) and it SURVIVES well past its own birthday horizon, that would be real evidence of structure beating chance -- the first test this ladder hasn't yet run." State space at window (L, M): S = M^(L+1) (n mod M, plus L trailing Q-values mod M). Pure-chance birthday collision is expected near sqrt(S) = M^((L+1)/2) draws (this is exactly the scale the existing (6,54) collision matched within 11%). This instrument fixes L=6, raises M past 54, computes that theoretical birthday, and runs the real probe several multiples past it. Performance note: the deposited probe() (predictive_index_scaling_ probe.py) keys its dict on an (L+1)-tuple of ints, which is exact but memory-heavy at tens of millions of entries. This instrument packs the same (n mod M, Q-window mod M) state into a single Python int (base-M positional encoding) -- mathematically identical, lighter to hash and store. SELF-AUDIT below re-derives the exact result already on record (L=6, M=54 collision) with the packed encoding before any new claim is trusted at larger scale. """ import time def build_q(n_max: int): Q = [0] * (n_max + 1) Q[1] = 1 if n_max >= 2: Q[2] = 1 for n in range(3, n_max + 1): a = n - Q[n - 1] b = n - Q[n - 2] assert 1 <= a < n and 1 <= b < n, "Q UNDEFINED (totality fails) at n=%d" % n Q[n] = Q[a] + Q[b] assert Q[n] > 0, "Q NONPOSITIVE at n=%d" % n return Q def probe_packed(Q, n_max: int, L: int, M: int, start: int = None): """Identical semantics to the deposited probe(), packed-int keys.""" seen = {} lo = start if start is not None else L for n in range(lo, n_max): state = n % M for i in range(n - L + 1, n + 1): state = state * M + (Q[i] % M) nxt = Q[n + 1] prior = seen.get(state) if prior is not None: prev_n, prev_nxt = prior if prev_nxt != nxt: return ("COLLISION", n, prev_n, prev_nxt, nxt) else: seen[state] = (n, nxt) return ("SURVIVED", n_max, None, None, None) def birthday(M: int, L: int) -> float: return M ** ((L + 1) / 2.0) def self_audit(Q_small): """Re-derive the (6,54) collision already on record with the packed encoding, on the same small Q used elsewhere in this territory.""" verdict, n, pn, pnxt, nxt = probe_packed(Q_small, len(Q_small) - 1, 6, 54) print("SELF-AUDIT (L=6, M=54, packed encoding vs. deposited probe):") print(" verdict=%s n=%s (n1=%s,next=%s) vs (n2=%s,next=%s)" % (verdict, n, pn, pnxt, n, nxt)) return verdict, n RUNGS = [ (72, 4), # birthday ~72^3.5; run to 4x that (85, 3), # birthday ~85^3.5; run to 3x that ] L = 6 def main(): print("building Q(1..2,000,000) for the self-audit slice ...") Q_audit = build_q(2_000_000) v, n = self_audit(Q_audit) print(" (history's independently-recorded (6,54) collision should match" " this n within the deposited jam sheet's own figure)\n") plans = [] for M, mult in RUNGS: b = birthday(M, L) n_needed = int(b * mult) + L + 10 plans.append((M, mult, b, n_needed)) n_max = max(p[3] for p in plans) print("Stretch test. L fixed at %d. State space S = M^%d." % (L, L + 1)) for M, mult, b, n_needed in plans: print(" M=%-3d theoretical birthday sqrt(S)=%.0f target=%dx -> need n>=%d" % (M, b, mult, n_needed)) print("\nbuilding Q(1..%d), shared across both rungs ..." % n_max) t0 = time.time() Q = build_q(n_max) print(" built in %.1fs. Q TOTALITY WITNESS: positive and defined through" " n=%d (prior recorded bound: 6,000,000)" % (time.time() - t0, n_max)) print("\n M | L | birthday(M,L) | n_max run | verdict | actual/theory | time") for M, mult, b, n_needed in plans: t0 = time.time() verdict, n, pn, pnxt, nxt = probe_packed(Q, n_needed, L, M) dt = time.time() - t0 if verdict == "COLLISION": ratio = n / b print(" %-3d| %2d | %13.0f | %10d | COLLISION | %.3fx | %.1fs" % (M, L, b, n_needed, ratio, dt)) print(" witness: (n1=%d,next=%d) vs (n2=%d,next=%d)" % (pn, pnxt, n, nxt)) else: print(" %-3d| %2d | %13.0f | %10d | SURVIVED | past %.2fx | %.1fs" % (M, L, b, n_needed, n_needed / b, dt)) print("\nHonest reading: a SURVIVED verdict at several multiples past its own") print("theoretical birthday scale is the ladder's own named evidence standard") print("for structure beating chance -- not proof, but the first real data") print("this specific test has produced. A COLLISION near ratio ~1.0x instead") print("confirms pure-chance behavior continues to hold at this rung.") if __name__ == "__main__": main()