# decryption_complete: false # source: /Voynich/Voynich_FIVE_RECORD_ANONYMOUS_DECOMPRESSION_035_reproducibility.zip!/run_gc_segmentatio # stated_sha256: 515cef52f435413747985144e01fc0a2681dfbdb4897af59357a8da6cdd4241b # matches_stated_sha256: false # pdf_pages: 459-460 # 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_gc_segmentation_recovery_035.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1 run_gc_segmentation_recovery_035.py Source: /Voynich/Voynich_FIVE_RECORD_ANONYMOUS_DECOMPRESSION_035_reproducibility.zip!/run_gc_segmentatio n_recovery_035.py SHA-256: 515cef52f435413747985144e01fc0a2681dfbdb4897af59357a8da6cdd4241b !/usr/bin/env python3 """GC-SEGMENTATION-RECOVERY-035: prospective exact-subsequence recovery of f67r2 A1 label.""" 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/'gc_segmentation_recovery_035';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' FOL='f67r2';LABEL_LINE=56;KEY='A1';ZL_SURFACE=['Q2','A1','B2'];REPS=10000;SEED=20260830 def raw_gc_atoms(): lines=GC.read_text(errors='ignore').splitlines();pat=re.compile(r'^]+>\s*(.*)$') for s in lines: m=pat.match(s) if m:return re.findall(r'[A-Z][0-9a-z]',m.group(1)) return [] def candidate_query(w,qx,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'])} scores=[] for c in cand: _,y0,_,y1=c['box'];scores.append(-abs((y0+y1)/2/837-qy/837)) j=int(np.argmax(scores));c=cand[j];return {'witness':w,'selected_line':c['line'],'hit':j in pos,'full':c['payloads'],'residual':[x for x in c['payloads'] if x!=KEY],'vertical_distance':-scores[j],'candidates':len(cand)} def main(): atoms=raw_gc_atoms();exact=any(atoms[i:i+len(ZL_SURFACE)]==ZL_SURFACE for i in range(len(atoms)-len(ZL_SURFACE)+1)) lb=g30.aligned_label_boxes();linebs=[b for (f,l,i),b in lb.items() if f==FOL and l==LABEL_LINE] if not linebs:raise RuntimeError('No physical label-line boxes') x0=min(b['x'] for b in linebs);x1=max(b['x']+b['w'] for b in linebs);y0=min(b['y'] for b in linebs);y1=max(b['y']+b['h'] for b in linebs);qx=(x0+x1)/2;qy=(y0+y1)/2 base=g30.aligned_prose_lines();added,_=p33.recover_unrestricted(base);coords={**base,**added};z=candida te_query('ZL',qx,qy,coords);g=candidate_query('GC',qx,qy,coords) jac=d32.multiset_jaccard(z['residual'],g['residual']);lcs=d32.lcs_ratio(z['residual'],g['residual']);pa ssed=bool(exact and z['hit'] and g['hit'] and jac>=.5 and lcs>=.75 and z['selected_line']==g['selected_line']) row={'record_id':f'{FOL}:{z["selected_line"]}/{g["selected_line"]}','folio':FOL,'zl_line':z['selected_l ine'],'gc_line':g['selected_line'],'keys':KEY,'zl_residual':' | '.join(z['residual']),'gc_residual':' | '.join(g['residual']),'multiset_jaccard':jac,'ordered_lcs_ratio':lcs};pd.DataFrame([row]).to_csv(OUT/'pr ospective_fifth_record.csv',index=False) # Append to the four-record ledger and recompute record-pairing null. old=pd.read_csv(ROOT/'anonymous_record_decompression_032/deduplicated_anonymous_record_ledger.csv');led ger=pd.concat([old,pd.DataFrame([row])],ignore_index=True) if passed else old.copy();ledger.to_csv(OUT/'five_record_anonymous_ledger.csv',index=False) zseq=[x.split(' | ') if isinstance(x,str) and x else [] for x in ledger.zl_residual];gseq=[x.split(' | ') if isinstance(x,str) and x else [] for x in ledger.gc_residual];obs=float(np.mean([d32.multiset_jacca rd(a,b) for a,b in zip(zseq,gseq)]));rng=np.random.default_rng(SEED);null=[] for _ in range(REPS): p=rng.permutation(len(gseq));null.append(float(np.mean([d32.multiset_jaccard(zseq[i],gseq[j]) for i,j run_gc_segmentation_recovery_035.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 in enumerate(p)]))) pv=(1+sum(x>=obs for x in null))/(REPS+1);promoted=bool(passed and len(ledger)>=5 and obs>=.5 and pv<.05) pd.DataFrame({'replicate':range(REPS),'jaccard':null}).to_csv(OUT/'five_record_pairing_null.csv',index= False) summary={'test':'GC-SEGMENTATION-RECOVERY-035','gc_raw_atoms':atoms,'zl_token_exact_subsequence_in_gc': exact,'selected':{'ZL':{**z,'full':' | '.join(z['full']),'residual':' | '.join(z['residual'])},'GC':{**g,'full':' | '.join(g['full']),'residual':' | '.join(g['residual'])}},'new_record_jaccard':jac,'new_record_lcs_ratio':lcs,'prospective_record_pass':pa ssed,'ledger_physical_records':len(ledger),'ledger_mean_jaccard':obs,'ledger_pairing_p':pv,'five_record_ ledger_promoted':promoted,'boundary':'Anonymous records only; exact atom segmentation recovery is not phonetic or semantic translation.'};(OUT/'summary.json').write_text(json.dumps(summary,indent=2,default= lambda x:x.item())) report=['# GC-SEGMENTATION-RECOVERY-035','',('**PASS — FIVE-RECORD ANONYMOUS LEDGER PROMOTED**' if promoted else '**FAIL / NOT PROMOTED**'),'','The missing GC label was recoverable only when the ZL token was required to occur as an exact contiguous atom subsequence in the unsegmented GC label line. No fuzzy atoms or semantic information were used.','',f"- Exact GC subsequence: {exact}",f"- ZL / GC selected line: {z['selected_line']} / {g['selected_line']}",f"- Both contain key: {z['hit']} / {g['hit']}",f"- New-record Jaccard / ordered LCS: {jac:.4f} / {lcs:.4f}",f"- Physical records in ledger: {len(ledger)}",f"- Five-record mean Jaccard: {obs:.4f}",f"- Pairing permutation p: {pv:.6f}",'','## Boundary','','Promotion establishes reproducible anonymous record decompression. It does not assign words, sounds, or plaintext meanings.','', '## Rule audit','',('CORE PRESERVATION, EDGE HANDOFF, CONTEXTUAL INTERNAL REALIZATION, and REGISTER SHIFT are strengthened. Six rules remain.' if promoted else 'No promotion; six rules remain.')] (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,default=lambda x:x.item())) if __name__=='__main__':main()