# decryption_complete: false # source: /Voynich/Voynich_RECORD_ROLE_PREDICTION_036_reproducibility.zip!/run_record_role_prediction_036. # stated_sha256: 9f5b38f7fbfbf5a1621fb65fe35b54634f82e03c0cece74cf69e5b9f38a024bb # matches_stated_sha256: false # pdf_pages: 752-753 # note: The stated SHA-256 is the digest printed in the PDF. # The PDF page extract follows the form feed. decryption_complete stays false. run_record_role_prediction_036.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1 run_record_role_prediction_036.py Source: /Voynich/Voynich_RECORD_ROLE_PREDICTION_036_reproducibility.zip!/run_record_role_prediction_036. py SHA-256: 9f5b38f7fbfbf5a1621fb65fe35b54634f82e03c0cece74cf69e5b9f38a024bb !/usr/bin/env python3 """RECORD-ROLE-PREDICTION-036: held-out deletion/retention roles across decompressed records.""" from pathlib import Path from collections import Counter,defaultdict import hashlib,json,math import numpy as np,pandas as pd ROOT=Path(__file__).resolve().parent;OUT=ROOT/'record_role_prediction_036';OUT.mkdir(exist_ok=True) LED=ROOT/'gc_segmentation_recovery_035/five_record_anonymous_ledger.csv';F75=ROOT/'fifth_record_prospect ive_033/prospective_cross_witness_records.csv' ALPHA=3.0 def seq(x):return [] if not isinstance(x,str) or not x else x.split(' | ') def retained_labels(a,b): n,m=len(a),len(b);d=[[0]*(m+1) for _ in range(n+1)] for i in range(n): for j in range(m):d[i+1][j+1]=d[i][j]+1 if a[i]==b[j] else max(d[i][j+1],d[i+1][j]) keep=[0]*n;i=n;j=m while i and j: if a[i-1]==b[j-1]:keep[i-1]=1;i-=1;j-=1 elif d[i-1][j]>=d[i][j-1]:i-=1 else:j-=1 return keep def posbin(i,n):return 'START' if i==0 else 'END' if i==n-1 else 'MID' def fit(rows): glob=Counter();pos=defaultdict(Counter);atom=defaultdict(Counter);joint=defaultdict(Counter) for r in rows: a=seq(r.zl_residual);b=seq(r.gc_residual);y=retained_labels(a,b) for i,(x,t) in enumerate(zip(a,y)): p=posbin(i,len(a));glob[t]+=1;pos[p][t]+=1;atom[x][t]+=1;joint[(x,p)][t]+=1 def prob(c,prior):return (c[1]+ALPHA*prior)/(c[0]+c[1]+ALPHA) gp=(glob[1]+1)/(sum(glob.values())+2);return gp,{p:prob(c,gp) for p,c in pos.items()},{x:prob(c,gp) for x,c in atom.items()},{x:prob(c,gp) for x,c in joint.items()} def score(r,model): gp,pm,am,jm=model;a=seq(r.zl_residual);b=seq(r.gc_residual);y=retained_labels(a,b);lb=lf=0;pred=[] for i,(x,t) in enumerate(zip(a,y)): p=posbin(i,len(a));base=pm.get(p,gp);ap=am.get(x,gp);full=jm.get((x,p),(ap+base)/2);base=min(max(base, .02),.98);full=min(max(full,.02),.98) lb+=-math.log2(base if t else 1-base);lf+=-math.log2(full if t else 1-full);pred.append((x,p,t,base,full)) return lb/max(1,len(y)),lf/max(1,len(y)),pred def main(): d=pd.read_csv(LED);folds=[];events=[] for i,r in d.iterrows(): tr=d.drop(i);lb,lf,p=score(r,fit(list(tr.itertuples())));folds.append({'heldout_record':r.record_id,'n _zl_payloads':len(p),'baseline_bits':lb,'role_bits':lf,'gain_bits':lb-lf});events += [{'split':'LOO','record':r.record_id,'payload':x,'position':q,'retained':t,'baseline_p':bp,'role_p':fp} for x,q,t,bp,fp in p] # f75v was excluded from the five-record ledger and is the prospective candidate. f=pd.read_csv(F75);r=f[(f.folio=='f75v')&(f.key=='Q2 A3')].iloc[0];obj=type('R',(),{'zl_residual':r.zl_ residual,'gc_residual':r.gc_residual});lb,lf,p=score(obj,fit(list(d.itertuples())));pros={'record':'f75v :49/49','n_zl_payloads':len(p),'baseline_bits':lb,'role_bits':lf,'gain_bits':lb-lf};events += [{'split':'PROSPECTIVE','record':'f75v:49/49','payload':x,'position':q,'retained':t,'baseline_p':bp,'rol e_p':fp} for x,q,t,bp,fp in p] fd=pd.DataFrame(folds);passed=bool((fd.gain_bits>0).sum()>=4 and fd.gain_bits.mean()>0 and pros['gain_bits']>0) fd.to_csv(OUT/'leave_one_record_out.csv',index=False);pd.DataFrame(events).to_csv(OUT/'payload_role_pre dictions.csv',index=False);pd.DataFrame([pros]).to_csv(OUT/'prospective_f75v.csv',index=False) model=fit(list(d.itertuples()));gp,pm,am,jm=model;roles=[] for x,p in sorted(am.items(),key=lambda z:z[0]):roles.append({'payload':x,'retention_probability':p,'ro run_record_role_prediction_036.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 le':'STABLE' if p>=.67 else 'DELETABLE' if p<=.33 else 'VARIABLE'}) pd.DataFrame(roles).to_csv(OUT/'anonymous_payload_roles.csv',index=False) summary={'test':'RECORD-ROLE-PREDICTION-036','loo_mean_gain_bits':float(fd.gain_bits.mean()),'positive_ loo_records':int((fd.gain_bits>0).sum()),'prospective_f75v':pros,'pass':passed,'gate':'Role model must beat position baseline in >=4/5 LOO records, positive mean gain, and positive prospective f75v gain.','boundary':'Anonymous retention/deletion roles only; no semantics or plaintext.'};(OUT/'summary.json').write_text(json.dumps(summary,indent=2)) report=['# RECORD-ROLE-PREDICTION-036','',('**PASS**' if passed else '**FAIL / NOT PROMOTED**'),'','Payload retention/deletion roles were learned from four physical records and tested on the fifth in rotation. The frozen five-record model then predicted the unused f75v residual transcription.','',f"- Mean LOO gain: {summary['loo_mean_gain_bits']:+.6f} bits/payload",f"- Positive LOO records: {summary['positive_loo_records']}/5",f"- Prospective f75v gain: {pros['gain_bits']:+.6f} bits/payload",'','## Decision','',('Anonymous payload roles predict cross-transcription realization and may be used to attack a sixth record.' if passed else 'The role model does not clear the frozen prediction gate. The five-record decompression ledger remains valid, but it has not yet yielded portable deletion grammar.'),'','## Rule audit','','No seventh rule. CONTEXTUAL INTERNAL REALIZATION strengthens only on a pass.'] (OUT/'report.md').write_text('\n'.join(report));files=sorted(q for q in OUT.iterdir() if q.is_file() and q.name!='SHA256SUMS.txt');(OUT/'SHA256SUMS.txt').write_text('\n'.join(f'{hashlib.sha256(q.read_bytes ()).hexdigest()} {q.name}' for q in files)+'\n');print(json.dumps(summary,indent=2)) if __name__=='__main__':main()