# decryption_complete: false # source: /Voynich/Voynich_Tests_024_025_reproducibility_bundles.zip!/Voynich_RAW_EDGE_AUDIT_025_reproduci # stated_sha256: 206da53985cf236dbfc7c4bfbdfde179fd326e153c36f98e327f225542a1c0ab # matches_stated_sha256: false # pdf_pages: 807-808 # note: The stated SHA-256 is the digest printed in the PDF. # The PDF page extract follows the form feed. decryption_complete stays false. raw_edge_audit_025_count.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1 raw_edge_audit_025_count.py Source: /Voynich/Voynich_Tests_024_025_reproducibility_bundles.zip!/Voynich_RAW_EDGE_AUDIT_025_reproduci bility.zip!/raw_edge_audit_025_count.py SHA-256: 206da53985cf236dbfc7c4bfbdfde179fd326e153c36f98e327f225542a1c0ab !/usr/bin/env python3 """Fast regularized discrete implementation of RAW-EDGE-AUDIT-025.""" from pathlib import Path import hashlib,json import numpy as np,pandas as pd from raw_edge_audit_025 import IN,SEED,make_data ROOT=Path(__file__).resolve().parent;OUT=ROOT/'raw_edge_audit_025_count';OUT.mkdir(exist_ok=True);rng=np .random.default_rng(SEED);ALPHA=8.0 BASE=['section','current_left','payload_last','pos_bucket','same_payload_prev','payload_len_bin'] def tup(row,cols):return tuple(row[c] for c in cols) def train_probs(tr,classes): p0=tr.next_left.value_counts().reindex(classes,fill_value=0).to_numpy(float)+1;p0/=p0.sum();bc={};ec={} for key,g in tr.groupby(BASE,observed=True): c=g.next_left.value_counts().reindex(classes,fill_value=0).to_numpy(float);bc[key]=(c+ALPHA*p0)/(c.sum ()+ALPHA) for key,g in tr.groupby(BASE+['current_right'],observed=True): bk=key[:-1];prior=bc.get(bk,p0);c=g.next_left.value_counts().reindex(classes,fill_value=0).to_numpy(fl oat);ec[key]=(c+ALPHA*prior)/(c.sum()+ALPHA) return p0,bc,ec def run(z,w): z=z.copy();z['payload_len_bin']=z.payload_len.clip(upper=4).astype(str);classes=sorted(z.next_left.uniq ue());ci={c:i for i,c in enumerate(classes)};edges=sorted(z.current_right.unique());ei={e:i for i,e in enumerate(edges)};rows=[];cache=[] for f in range(5): tr=z[z.fold!=f];te=z[z.fold==f].reset_index(drop=True);p0,bc,ec=train_probs(tr,classes);yb=np.array([c i[y] for y in te.next_left]);bkeys=[tup(r,BASE) for _,r in te.iterrows()];pb=np.vstack([bc.get(k,p0) for k in bkeys]);llb=float(-np.log2(pb[np.arange(len(te)),yb]).mean());M=np.empty((len(te),len(edges))) for j,e in enumerate(edges):M[:,j]=-np.log2(np.array([ec.get(k+(e,),bc.get(k,p0))[yb[i]] for i,k in enumerate(bkeys)])) orig=np.array([ei[e] for e in te.current_right]);lle=float(M[np.arange(len(te)),orig].mean());rows.app end({'witness':w,'fold':f,'n':len(te),'base_bits':llb,'edge_bits':lle,'gain_bits':llb-lle});keys=(te.sec tion.astype(str)+'|'+te.pos_bucket.astype(str)+'|'+te.payload_last.astype(str)).to_numpy();groups=[np.wh ere(keys==k)[0] for k in np.unique(keys)];cache.append((M,orig,groups,llb)) obs=float(np.average([r['gain_bits'] for r in rows],weights=[r['n'] for r in rows]));null=np.empty(1000) for b in range(1000): gs=[];ns=[] for M,orig,groups,llb in cache: q=orig.copy() for ix in groups: if len(ix)>1:q[ix]=q[rng.permutation(ix)] gs.append(llb-float(M[np.arange(len(q)),q].mean()));ns.append(len(q)) null[b]=np.average(gs,weights=ns) pv=float((1+(null>=obs).sum())/1001);tab=pd.crosstab(z.current_right,z.next_left,normalize='index').sta ck().rename('p').reset_index();tab['witness']=w return pd.DataFrame(rows),tab,{'witness':w,'n_transitions':len(z),'n_folios':z.folio.nunique(),'gain_bi ts':obs,'positive_folds':sum(r['gain_bits']>0 for r in rows),'permutation_p':pv,'null_mean':float(null.m ean())} def main(): x=pd.read_csv(IN);rs=[];ts=[];ss=[] for w in ['ZL','GC']: r,t,s=run(make_data(x,w),w);rs.append(r);ts.append(t);ss.append(s) t=pd.concat(ts);a=t.pivot_table(index=['current_right','next_left'],columns='witness',values='p').dropn a();corr=float(a.ZL.corr(a.GC));summary={'test':'RAW-EDGE-AUDIT-025','model':'Dirichlet-smoothed held-out conditional count model','alpha':ALPHA,'seed':SEED,'null_replicates':1000,'results':ss,'cross_w itness_transition_correlation':corr};summary['pass']=bool(all(s['gain_bits']>0 and s['positive_folds']>=4 and s['permutation_p']<.05 for s in ss) and corr>.8) pd.concat(rs).to_csv(OUT/'fold_results.csv',index=False);t.to_csv(OUT/'transition_probabilities.csv',in dex=False);(OUT/'summary.json').write_text(json.dumps(summary,indent=2)) raw_edge_audit_025_count.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 lines=['# RAW-EDGE-AUDIT-025','',('**PASS**' if summary['pass'] else '**FAIL / NOT PROMOTED**'),'', 'A Dirichlet-regularized held-out count model tested whether the raw right-edge atom predicts the next raw left-edge atom beyond section, current left atom, payload ending/length, line position, and immediate repetition. No function glosses or illustrations entered selection.','', '## Results',''] for s in ss:lines += [f"### {s['witness']}",'',f"- Gain: {s['gain_bits']:+.6f} bits/transition",f"- Positive folio-held-out folds: {s['positive_folds']}/5",f"- Conditional permutation p: {s['permutation_p']:.6f}",f"- {s['n_transitions']} transitions across {s['n_folios']} folios",''] lines += ['## Cross-witness replication','',f"Raw transition-profile correlation: **r={corr:.6f}**.",'','## Rule audit','',('EDGE HANDOFF is independently strengthened in raw atom space. The result adds no seventh rule and supplies no word meanings.' if summary['pass'] else 'The six-rule ledger is unchanged.')] (OUT/'report.md').write_text('\n'.join(lines));files=sorted(p for p in OUT.iterdir() if p.is_file() and p.name!='SHA256SUMS.txt');(OUT/'SHA256SUMS.txt').write_text('\n'.join(f'{hashlib.sha256(p.read_bytes ()).hexdigest()} {p.name}' for p in files)+'\n');print(json.dumps(summary,indent=2)) if __name__=='__main__':main()