from pathlib import Path import re,hashlib ROOT=Path(__file__).resolve().parent.parent def run(load,check): spec=[('MT_PERSONS','File_02.md',659,716,'6.2 MT minimum Noah/Shem baselines and position matrix'),('PERSON_BASES','File_18.md',1253,1282,'2.2.1 independent MT/LXX and SP person endpoints'),('SP_FIELD','File_18.md',1571,1596,'3.2.1 three Gears, person rails, lifespans and500/502 bindings'),('FLOOD','File_18.md',1540,1552,'3.1.4 independent start/close boundaries'),('VARIANTS','File_18.md',620,627,'1.3 tradition-specific variant forks'),('LXX_REMOVAL','File_18.md',1140,1147,'1.6.2 explicit theoretical LXX removal'),('SP_LOCALITY','File_18.md',433,435,'SP-only person companions and Flood separation'),('DUAL100','File_18.md',755,771,'1.3.5 both Noah-bound and Arphaxad-bound modes'),('E_P','File_46.md',97,133,'explicit E/P scalar protocols'),('E_SQUARED','File_46.md',363,365,'two integral expansions of23 squared'),('J_GAP','File_02.md',718,731,'6.3 gap conversion, not date or Residue Protocol'),('GEARS','File_11.md',46,53,'ordinary offsets; current research scope Noah/Shem/Flood only')];cards=[] for key,name,start,end,section in spec: lines=(ROOT/'sources'/name).read_text().splitlines();text='\n'.join(lines[start-1:end]);check('source excerpt '+key,bool(text) and len(lines)>=end);cards.append({'id':key,'source':name,'section':section,'line_start':start,'line_end':end,'text':text,'excerpt_sha256':hashlib.sha256(text.encode()).hexdigest()}) at={c['id']:c['text'] for c in cards};bases={} for person in ['Noah','Shem']: mt=re.search(r'\| '+person+r' \| (\d+)/(\d+) BC \| (\d+)/(\d+) BC',at['MT_PERSONS']);assert mt bases['MT',person+' birth',None]=int(mt.group(2));bases['MT',person+' death',None]=int(mt.group(4)) lx=re.search(r'\| LXX \| '+person+r' \| (\d+)–(\d+) BC \| (\d+)–(\d+) BC',at['PERSON_BASES']);assert lx a,z=(3,4) if person=='Noah' else (1,2);bases['LXX',person+' birth',None]=int(lx.group(a));bases['LXX',person+' death',None]=int(lx.group(z)) row=next(l for l in at['SP_FIELD'].splitlines() if l.startswith('| G1 |')).split('|')[2:6] for role,cell in zip(['Noah birth','Noah death','Shem birth','Shem death'],row): vals=list(map(int,cell.strip().split('/'))) for rail,val in zip(['primary','companion'],vals):bases['SP',role,rail]=val check('independent person table constants',bases['MT','Noah birth',None]==2841 and bases['MT','Shem birth',None]==2341 and bases['LXX','Noah birth',None]==3621 and bases['LXX','Shem birth',None]==3121 and bases['SP','Shem death','companion']==2390) floods={} for tr,label in [('MT','MT'),('SP','SP'),('LXX','LXX — native Cainan ON')]: line=next(l for l in at['FLOOD'].splitlines() if l.startswith('| '+label+' |'));pairs=re.findall(r'(\d+)→(\d+)',line);assert len(pairs)==3;floods[tr]=int(pairs[2][0]) check('explicit source guards',all(x in at['SP_FIELD'] for x in ['950','600','500','502','inclusive/harmonic','not six independently attested']) and 'not type the Flood close as a companion' in at['SP_FIELD'] and 'do not transfer it to MT/LXX' in at['SP_LOCALITY'] and 'converts a gap, not a date' in at['J_GAP']) reg=load('C286_DATA.json')['target_register'];rows=[] for i,r in enumerate(reg): tr=r['tradition'];native=int(tr=='LXX');shift=130*(r['Cainan']-native)+60*r['Terah60']+2*(r['gear']-1) if r['role'] in ['Flood start','Flood close']:v=floods[tr]+shift+215*(r['full430']-1)-int(r['role']=='Flood close') else:v=bases[tr,r['role'],r.get('rail')]+shift+215*r['full430'] check('independent register reconstruction '+str(i),v==r['center']);rows.append({'record_index':i,'source_record':r,'reconstructed_coordinate':v}) loops=[] for h in load('C405_DATA.json')['loop_translations']:loops+=list(h['Shem_records'].values())+h['P_Shem_death_records'] long=[r for p in load('C411_DATA.json')['long_paths'] for r in p['records']] check('new comparison records within rebuilt menu',len(loops)==52 and len(long)==10 and all(r in reg for r in loops+long)) claims=[{'claim':'Register endpoints, Gear and variant rules','warrant':'Explicit tables and scoped rules; all528 records reconstructed from independently parsed person/Flood baselines.'},{'claim':'Matched Noah-to-Shem500 and the alternative502 binding','warrant':'Explicit qualified source bindings; both retained with their finite Gear domains.'},{'claim':'Flood-to-Shem-death500 role relation and full loop correspondence','warrant':'Derived from independently sourced endpoints and600-year lifespans; exact finite comparisons, not a global date operator.'},{'claim':'3395→2895 bridge and four-step chain','warrant':'Exact derived cross-context arithmetic using source endpoints; no prescription for this combined sequence established in the reviewed passages.'},{'claim':'Source graph normal forms and commuting circuits','warrant':'Derived affine algebra; source roles, contexts and phase qualifications remain necessary.'}] return {'step':'C412','source_excerpt_cards':cards,'person_baselines':[{'tradition':t,'role':r,'rail':rail,'coordinate':v} for (t,r,rail),v in sorted(bases.items(),key=str)],'Flood_G1_full430_native_bases':floods,'reconstructed_register':rows,'claim_status_matrix':claims,'counts':{'source_excerpt_cards':len(cards),'regular_records_reconstructed':len(rows),'new_loop_record_slots_checked':len(loops),'long_chain_record_slots_checked':len(long),'new_source_endpoints':0,'new_protocol_prescriptions_established':0},'interpretation':'All source records reconstruct exactly. SP primary Noah death keeps its inclusive/harmonic qualification; companion and Flood-close distinctions remain explicit. Native LXX already includes Cainan; OFF uses theoretical removal. Current Noah/Shem/Flood Gear scope overrides broader historical source instructions. The500 graph, return circuits and bridge remain derived comparisons, not new canonical operators or independent witnesses.'}