# decryption_complete: false # source: /Voynich/Voynich_PORTABLE_ANONYMOUS_ROLE_BREAKTHROUGH_037_042_reproducibility.zip!/run_exact_ato # stated_sha256: 27ccae8bc9d1a02c04225ca22d7b13e6ef175f37bb600248be669a8c9587a4b8 # matches_stated_sha256: false # pdf_pages: 726-727 # 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_exact_atom_ledger_expansion_037.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1 run_exact_atom_ledger_expansion_037.py Source: /Voynich/Voynich_PORTABLE_ANONYMOUS_ROLE_BREAKTHROUGH_037_042_reproducibility.zip!/run_exact_ato m_ledger_expansion_037.py SHA-256: 27ccae8bc9d1a02c04225ca22d7b13e6ef175f37bb600248be669a8c9587a4b8 !/usr/bin/env python3 """EXACT-ATOM-LEDGER-EXPANSION-037: corpus-wide recovery of missing GC label boundaries.""" from pathlib import Path from collections import defaultdict import hashlib,json,re import numpy as np,pandas as pd import run_geometric_expansion_link_030 as g30 import run_fifth_record_prospective_033 as p33 import run_anonymous_record_decompression_032 as d32 ROOT=Path(__file__).resolve().parent;OUT=ROOT/'exact_atom_ledger_expansion_037';OUT.mkdir(exist_ok=True) EVENTS=pd.read_csv(ROOT/'external_anchor_attack_018/label_prose_events.csv');GC=ROOT/'crosswalk002_input s/Voynich_Line_Local_Reproducibility_2026-08-22/data/GC.txt';KEYS=set(pd.read_csv(ROOT/'dreibilderserie_ schema_028/voynich_role_projection.csv').payload) def raw_blocks(path): pat=re.compile(r'^<([^>.]+)\.([^,>]+),[^>]*>\s*(.*)$');out={};pending=None for s in path.read_text(errors='ignore').splitlines(): m=pat.match(s) if m: if pending:out[(pending[0],pending[1])]=re.findall(r'[A-Z][0-9a-z]',pending[2]) pending=[m.group(1),int(m.group(2)) if m.group(2).isdigit() else m.group(2),m.group(3)] elif pending and s and not s.startswith(('<','#')):pending[2]+=' '+s if pending:out[(pending[0],pending[1])]=re.findall(r'[A-Z][0-9a-z]',pending[2]) return out def exact_subseq(a,b):return any(b[i:i+len(a)]==a for i in range(len(b)-len(a)+1)) if a else False def line_box(lb,fol,line): bs=[b for (f,l,i),b in lb.items() if f==fol and l==line] if not bs:return None return (min(b['x'] for b in bs),min(b['y'] for b in bs),max(b['x']+b['w'] for b in bs),max(b['y']+b['h'] for b in bs)) def query(w,fol,key,qy,coords): e=EVENTS[(EVENTS.witness==w)&(EVENTS.register=='PROSE')&(EVENTS.folio==fol)];cand=[] for line,g in e.groupby('line'): k=(fol,int(line)) if k in coords and len(g)>=2:cand.append({'line':int(line),'payloads':list(g.payload),'box':coords[k]} ) cand=sorted(cand,key=lambda x:x['line']);pos={i for i,c in enumerate(cand) if key in c['payloads'] and any(x!=key for x in c['payloads'])} if not cand or not pos:return None sc=[-abs(((c['box'][1]+c['box'][3])/2-qy)/837) for c in cand];j=int(np.argmax(sc));c=cand[j] return {'line':c['line'],'hit':j in pos,'residual':[x for x in c['payloads'] if x!=key],'full':c['payloads'],'y':(c['box'][1]+c['box'][3])/2,'distance':-sc[j]} def main(): raw=raw_blocks(GC);lb=g30.aligned_label_boxes();base=g30.aligned_prose_lines();added,_=p33.recover_unre stricted(base);coords={**base,**added};zl=EVENTS[(EVENTS.witness=='ZL')&(EVENTS.register=='LABEL')&EVENT S.payload.isin(KEYS)];audit=[];qual=[] old=pd.read_csv(ROOT/'gc_segmentation_recovery_035/five_record_anonymous_ledger.csv');old_phys={(r.foli o,int(r.zl_line),int(r.gc_line)) for r in old.itertuples()} for r in zl.itertuples(): surf=str(r.surface_atoms).split();atoms=raw.get((r.folio,int(r.line)),[]);exact=exact_subseq(surf,atom s);b=line_box(lb,r.folio,int(r.line)) row={'folio':r.folio,'label_line':int(r.line),'key':r.payload,'zl_surface':' '.join(surf),'gc_raw_atoms':' '.join(atoms),'exact_subsequence':int(exact),'has_label_box':int(b is not None)} if exact and b: qy=(b[1]+b[3])/2;z=query('ZL',r.folio,r.payload,qy,coords);g=query('GC',r.folio,r.payload,qy,coords) if z and g: jac=d32.multiset_jaccard(z['residual'],g['residual']);lcs=d32.lcs_ratio(z['residual'],g['residual']) ;new=(r.folio,z['line'],g['line']) not in old_phys;ok=z['hit'] and g['hit'] and run_exact_atom_ledger_expansion_037.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 abs(z['y']-g['y'])/837<=.03 and jac>=.5 and lcs>=.75 and new row.update({'zl_selected_line':z['line'],'gc_selected_line':g['line'],'zl_hit':int(z['hit']),'gc_hit ':int(g['hit']),'vertical_center_delta':abs(z['y']-g['y'])/837,'jaccard':jac,'lcs':lcs,'new_physical_rec ord':int(new),'qualifies':int(ok)}) if ok:qual.append({'record_id':f"{r.folio}:{z['line']}/{g['line']}",'folio':r.folio,'zl_line':z['lin e'],'gc_line':g['line'],'keys':r.payload,'zl_residual':' | '.join(z['residual']),'gc_residual':' | '.join(g['residual']),'multiset_jaccard':jac,'ordered_lcs_ratio':lcs}) audit.append(row) a=pd.DataFrame(audit);q=pd.DataFrame(qual).drop_duplicates(['folio','zl_line','gc_line']) if qual else pd.DataFrame(columns=['record_id','folio','zl_line','gc_line','keys','zl_residual','gc_residual','multis et_jaccard','ordered_lcs_ratio']) expanded=pd.concat([old,q],ignore_index=True);expanded.to_csv(OUT/'expanded_anonymous_ledger.csv',index =False);a.to_csv(OUT/'candidate_audit.csv',index=False);q.to_csv(OUT/'new_qualifying_records.csv',index= False) summary={'test':'EXACT-ATOM-LEDGER-EXPANSION-037','zl_projected_label_events':len(zl),'exact_gc_subsequ ence_events':int(a.exact_subsequence.sum()),'events_with_label_boxes':int(a.has_label_box.sum()),'new_qu alifying_physical_records':len(q),'ledger_records_before':len(old),'ledger_records_after':len(expanded), 'pass':len(q)>=1,'boundary':'Anonymous label-to-record expansions only; no plaintext or semantic gloss.'};(OUT/'summary.json').write_text(json.dumps(summary,indent=2)) report=['# EXACT-ATOM-LEDGER-EXPANSION-037','',('**PASS — LEDGER EXPANDED**' if len(q) else '**FAIL — NO NEW RECORDS**'),'','All projected ZL label events were searched at the same GC locus. Recovery required an exact contiguous atom subsequence, a physical label box, unchanged vertical selection, both-witness key hits, vertical-center agreement <=.03 page heights, residual Jaccard >=.50, ordered LCS >=.75, and a new physical record.','',f"- ZL label events: {len(zl)}",f"- Exact GC subsequence events: {int(a.exact_subsequence.sum())}",f"- New qualifying physical records: {len(q)}",f"- Ledger size: {len(old)} -> {len(expanded)}",''] if len(q):report += ['## New records','',*['- '+r.record_id+f"; key {r.keys}; Jaccard {r.multiset_jaccard:.3f}; LCS {r.ordered_lcs_ratio:.3f}" for r in q.itertuples()],''] report += ['## Rule audit','',('CORE PRESERVATION, EDGE HANDOFF, CONTEXTUAL INTERNAL REALIZATION, and REGISTER SHIFT strengthen; six rules remain.' if len(q) else 'No rule change; six remain.')] (OUT/'report.md').write_text('\n'.join(report));files=sorted(x for x in OUT.iterdir() if x.is_file() and x.name!='SHA256SUMS.txt');(OUT/'SHA256SUMS.txt').write_text('\n'.join(f'{hashlib.sha256(x.read_bytes ()).hexdigest()} {x.name}' for x in files)+'\n');print(json.dumps(summary,indent=2)) if __name__=='__main__':main()