# decryption_complete: false # source: /Voynich/Voynich_FIFTH_RECORD_ATTACK_033_034_reproducibility.zip!/run_keyless_expansion_compatib # stated_sha256: 3175d88d0a238b8709a8dddb28db9ce25d2791c402b23704f5a66a0657e666a0 # matches_stated_sha256: false # pdf_pages: 449-450 # 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_keyless_expansion_compatibility_034.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1 run_keyless_expansion_compatibility_034.py Source: /Voynich/Voynich_FIFTH_RECORD_ATTACK_033_034_reproducibility.zip!/run_keyless_expansion_compatib ility_034.py SHA-256: 3175d88d0a238b8709a8dddb28db9ce25d2791c402b23704f5a66a0657e666a0 !/usr/bin/env python3 """KEYLESS-EXPANSION-COMPATIBILITY-034: validate geometry-selected non-echo records by frame.""" from pathlib import Path from collections import Counter import hashlib,json,math import numpy as np,pandas as pd import run_geometric_expansion_link_030 as g30 import run_fifth_record_prospective_033 as p33 ROOT=Path(__file__).resolve().parent;OUT=ROOT/'keyless_expansion_compatibility_034';OUT.mkdir(exist_ok=T rue) EVENTS=pd.read_csv(ROOT/'external_anchor_attack_018/label_prose_events.csv') def score_frames(frames,kc,gc,nk,ng,v):return float(np.mean([math.log((kc[x]+1)/(nk+v))-math.log((gc[x]+ 1)/(ng+v)) for x in frames])) def main(): lb=g30.aligned_label_boxes();base=g30.aligned_prose_lines();added,_=p33.recover_unrestricted(base);coor ds={**base,**added};rows=[] for w in ('ZL','GC'): old={(q['folio'],q['key']) for q in g30.build(w,lb,base)} qs=[q for q in g30.build(w,lb,coords) if (q['folio'],q['key']) not in old] e=EVENTS[(EVENTS.witness==w)&(EVENTS.register=='PROSE')] for q in qs: # Frame dictionary is learned on other folios from lines containing the key. tr=e[e.folio!=q['folio']];keylines=set(zip(tr[tr.payload==q['key']].folio,tr[tr.payload==q['key']].li ne));kg=tr[[((f,l) in keylines) for f,l in zip(tr.folio,tr.line)]] kc=Counter(kg.left_function+'>'+kg.right_function);gc=Counter(tr.left_function+'>'+tr.right_function) ;v=len(gc);nk=sum(kc.values());ng=sum(gc.values()) scores=[] for c in q['cand']: z=e[(e.folio==q['folio'])&(e.line==c['line'])];frames=list(z.left_function+'>'+z.right_function);sco res.append(score_frames(frames,kc,gc,nk,ng,v) if frames and nk else -999.) geo=[] for c in q['cand']: _,y0,_,y1=c['box'];geo.append(-abs((y0+y1)/2/837-q['qy']/837)) j=int(np.argmax(geo));rank=1+sum(x>scores[j] for x in scores);pct=1-(rank-1)/max(len(scores)-1,1) rows.append({'witness':w,'folio':q['folio'],'key':q['key'],'selected_line':q['cand'][j]['line'],'key_ echo':int(j in q['pos']),'candidate_lines':len(scores),'training_key_frame_tokens':nk,'selected_frame_sc ore':scores[j],'frame_rank':rank,'frame_percentile':pct,'top_quartile':int(pct>=.75),'residual':' | '.join(x for x in q['cand'][j]['payloads'] if x!=q['key'])}) d=pd.DataFrame(rows);paired=[] for (f,k),g in d.groupby(['folio','key']): if set(g.witness)=={'ZL','GC'}: z=g[g.witness=='ZL'].iloc[0];c=g[g.witness=='GC'].iloc[0];paired.append({'folio':f,'key':k,'zl_line': z.selected_line,'gc_line':c.selected_line,'zl_frame_percentile':z.frame_percentile,'gc_frame_percentile' :c.frame_percentile,'both_top_quartile':int(z.top_quartile and c.top_quartile),'both_keyless':int(not z.key_echo and not c.key_echo)}) p=pd.DataFrame(paired);qual=p[(p.both_top_quartile==1)&(p.both_keyless==1)] if len(p) else p;passed=len(qual)>=1 d.to_csv(OUT/'witness_frame_compatibility.csv',index=False);p.to_csv(OUT/'paired_keyless_candidates.csv ',index=False);qual.to_csv(OUT/'qualifying_keyless_records.csv',index=False) summary={'test':'KEYLESS-EXPANSION-COMPATIBILITY-034','new_queries_scored':len(d),'paired_candidates':l en(p),'qualifying_keyless_records':len(qual),'pass':passed,'gate':'Geometry-selected non-echo line must rank in top frame quartile under other-folio key dictionary in both ZL and GC.','boundary':'Anonymous frame compatibility; one candidate does not independently establish semantics or plaintext.'};(OUT/'summary.json').write_text(json.dumps(summary,indent=2)) report=['# KEYLESS-EXPANSION-COMPATIBILITY-034','',('**PASS — KEYLESS FIFTH RECORD COMPATIBLE**' if passed else '**FAIL — KEYLESS CANDIDATE NOT COMPATIBLE**'),'','The geometry-selected record was frozen before frame inspection. Its frame compatibility was learned only from other-folio occurrences of the label key. No exact key echo was required.','',f"- New witness queries: {len(d)}",f"- Paired run_keyless_expansion_compatibility_034.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 candidates: {len(p)}",f"- Qualifying keyless records: {len(qual)}",''] for r in paired:report += [f"- {r['folio']} / {r['key']}: ZL percentile {r['zl_frame_percentile']:.3f}; GC {r['gc_frame_percentile']:.3f}; both top quartile {r['both_top_quartile']}"] report += ['','## Decision boundary','',('This supplies the fifth structurally compatible physical expansion record, but because the keyless gate was introduced after Test 033 exposed the echo assumption, it is marked prospective-compatible rather than fully confirmatory.' if passed else 'The fifth record is not earned.'),'','## Rule audit','','The six-rule count remains unchanged.'] (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()