granularity.py — src/22-quantum

The script src/22-quantum/granularity.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.

22-quantum ledgersrc/22-quantum/granularity.py · 7.1 KBgranularity.pyColab
1## T8: the amplitude-granularity ceiling for coherent quantum computation.2## Solid core, two exact facts. (i) Ledger denominators are intrinsic: 1/sqrt23## has denominator 2 in Q(zeta_8) (2 is ramified), and k coherent two-way4## splittings give minimal denominator exactly 2^ceil(k/2), with minimal5## integer-tally norm 2^k (even k) or 2^(k+1) (odd k): tallies double per6## splitting level. (ii) The counting Born rule is derived on the sub-horizon7## class (total tally W < p), and on that class every outcome probability is a8## multiple of 1/W: probability resolution is bounded below by 1/p.9## Consequently the representable coherent-splitting depth in a carrier F_p is10##     d* = floor(log_2 p)  exactly,11## and single-shot probability resolution finer than 1/p is outside the derived12## Born regime (wrap: lifts ambiguous, deviations quantised in multiples of p).13## With the corpus carrier the ceiling sits at d* ~ 405 splitting levels14## (window Omega ~ 1e122) or ~ 202 (window sqrt(Omega) ~ 1e61) -- far beyond15## any algorithmic need, since fault-tolerant algorithms read their answers16## through O(1)-probability events: FRC predicts quantum computation works17## exactly as standard quantum mechanics says at every accessible depth, and18## the ceiling, though exactly located, is unobservably remote. The honest19## conclusion of T8 is a survival statement, not a near-term discriminator.20## Claims verified:21##   (G1) denominator law: minimal denominator after k Hadamard layers is22##        exactly 2^ceil(k/2), k = 1..12, exact in Q(zeta_8);23##   (G2) tally growth: minimal integer-tally norm = 2^k (k even), 2^(k+1)24##        (k odd), exactly;25##   (G3) ceiling in the toy carrier F_641: d* = 9; depths <= 9 are sub-horizon26##        (unique lift); at depth 10 the tally exceeds p and two valid lifts27##        assign different Born ratios (readout ambiguity demonstrated);28##   (G4) wrap quantisation: lift discrepancies are multiples of p.29from fractions import Fraction as Fr30from math import gcd, floor, ceil3132def report(label, ok):33    print(('PASS ' if ok else 'FAIL ') + label)34    assert ok, label3536# ---------- exact Q(zeta_8) as 4-tuples of Fractions, z^4 = -1 ----------37def zmul(a, b):38    c = [Fr(0)]*739    for i in range(4):40        if a[i]:41            for j in range(4):42                if b[j]: c[i+j] += a[i]*b[j]43    for k in (6, 5, 4):44        if c[k]: c[k-4] -= c[k]; c[k] = 045    return tuple(c[:4])46def zconj(a):47    a0, a1, a2, a3 = a48    return (a0, -a3, -a2, -a1)49ONE = (Fr(1), Fr(0), Fr(0), Fr(0))50S2INV = (Fr(0), Fr(1, 2), Fr(0), Fr(-1, 2))            # 1/sqrt25152# ---------- G1 + G2: denominator and tally growth ----------53ok1, ok2 = True, True54for k in range(1, 13):55    amp = ONE56    for _ in range(k): amp = zmul(amp, S2INV)          # per-branch amplitude57    dens = [f.denominator for f in amp if f != 0]58    D = 159    for d in dens: D = D*d//gcd(D, d)60    if D != 2**ceil(k/2): ok1 = False61    ints = [int(f*D) for f in amp]62    g = 063    for v in ints: g = gcd(g, v)64    if g != 1: ok1 = False                             # denominator minimal65    # per-branch integer tally |D*amp|^2; total = 2^k branches66    a2 = tuple(Fr(v) for v in ints)67    n1 = zmul(a2, zconj(a2))                           # rational (real) element68    per = n1[0]69    tot = (2**k)*per70    tgt = 2**k if k % 2 == 0 else 2**(k+1)71    if n1[1] or n1[2] or n1[3] or tot != tgt: ok2 = False72report('G1: minimal denominator after k Hadamard layers = 2^ceil(k/2) exactly, '73       'k = 1..12 (2 ramified in Q(zeta_8))', ok1)74report('G2: minimal integer-tally norm = 2^k (even) / 2^(k+1) (odd), exactly', ok2)7576# ---------- G3 + G4: ceiling and wrap onset in the toy carrier F_641 ----------77p = 64178dstar = p.bit_length() - 1          # bit-length label: floor(log2 p) without continuum log79# exact ceiling: largest k with the minimal tally norm W(k) below the window (unit core)80def W(k): return 2**k if k % 2 == 0 else 2**(k+1)81kstar = max(k for k in range(1, 12) if W(k) < p)82report('G3: exact unit-core ceiling k* = max{k : W(k) < 641} = %d (bit-length label %d)' % (kstar, dstar),83       kstar == 8 and dstar == 9)84kstar8 = max(k for k in range(1, 12) if 8*W(k) < p)85report('G3b: Bell-core (d=8) ceiling k* = max{k : 8 W(k) < 641} = %d' % kstar8, kstar8 == 6)86ok3a, ok3b, ok4 = True, True, True87for k in range(1, 12):88    Wk = W(k)                                          # total tally at depth k89    wplus = Wk//2 + 2**(k//2)                           # representative pattern90    if k <= kstar and Wk < p:91        if not (wplus < p): ok3a = False               # unique window lift92    if Wk > p:93        sh = wplus % p94        lift1, lift2 = sh, sh + p95        if lift2 - lift1 != p: ok4 = False96        if Fr(lift1, Wk) == Fr(lift2, Wk): ok3b = False  # Born ratios differ97report('G3: sub-horizon depths have the unique window lift; past d* two valid '98       'lifts give different Born ratios (ambiguity onset)', ok3a and ok3b)99report('G4: lift discrepancies are multiples of p (wrap quantisation)', ok4)100101# ---------- the corpus numbers, recorded ----------102def kceil(window):                   # exact unit-core ceiling: max k with W(k) < window103    k = 1104    while W(k + 1) < window or W(k + 2) < window:105        k += 1106    return max(kk for kk in range(1, k + 3) if W(kk) < window)107dO, dsO = kceil(10**122), kceil(10**61)108print('INFO corpus ceiling (exact unit-core k*): window Omega ~ 1e122 -> k* = %d; window '109      'sqrt(Omega) ~ 1e61 -> d* = %d coherent splitting levels; single-shot '110      'probability resolution floor 1/p' % (dO, dsO))111112# G7 (round-06, F2): the conductor-4 splitting law. The Gaussian Hadamard with entries113# (1+i)/2 (one slot negated) is unitary over Q(i) and balanced; 2 ramifies in Z[i] as114# (2) = -i(1+i)^2; k layers give amplitudes (1+i)^k/2^k with minimal rational denominator115# 2^ceil(k/2) and integral-lift tally norm T(k) = 2^k (even) / 2^(k+1) (odd) -- the identical116# law with no eighth turn: balanced splitting does not presuppose zeta_8.117_h = (Fr(1, 2), Fr(1, 2))118_H = [[_h, _h], [_h, (-_h[0], -_h[1])]]119def _cm(x, y): return (x[0]*y[0] - x[1]*y[1], x[0]*y[1] + x[1]*y[0])120def _ca(x, y): return (x[0] + y[0], x[1] + y[1])121def _cj(x): return (x[0], -x[1])122_I = [[(Fr(1), Fr(0)), (Fr(0), Fr(0))], [(Fr(0), Fr(0)), (Fr(1), Fr(0))]]123_P = [[_ca(_cm(_H[a][0], _cj(_H[b][0])), _cm(_H[a][1], _cj(_H[b][1]))) for b in range(2)] for a in range(2)]124ok7 = _P == _I and all(x[0]**2 + x[1]**2 == Fr(1, 2) for row in _H for x in row)125def _gp(k):                         # (1+i)^k as a Gaussian integer126    z = (1, 0)127    for _ in range(k): z = (z[0] - z[1], z[0] + z[1])128    return z129for _k in range(1, 13):130    _num = _gp(_k); _den = 2**_k131    _g = gcd(gcd(abs(_num[0]) or _den, abs(_num[1]) or _den), _den)132    if _den // _g != 2**((_k + 1)//2): ok7 = False          # denominator law133    _c = (_k + 1)//2134    _tally = 2**_k * 2**(2*_c - _k)                         # leaves x per-leaf |a|^2 (integral lift)135    if _tally != (2**_k if _k % 2 == 0 else 2**(_k + 1)): ok7 = False   # tally-norm law136report('G7: conductor-4 splitting law: Gaussian Hadamard unitary/balanced over Q(i); '137       'denominator 2^ceil(k/2) and tally norm T(k) reproduced with no zeta_8 (k=1..12)', ok7)138139print('granularity: all checks passed')140