from pathlib import Path from fractions import Fraction import json,re def run(load,check): root=Path(__file__).resolve().parent.parent register=load('C286_DATA.json')['target_register'] def selected(r): if r['Cainan']!=0:return False return (r['tradition']=='MT' and r['Terah60']==0 and r['full430']==1 and r['role'] in ['Noah birth','Flood start']) or (r['tradition']=='SP' and r['Terah60']==1 and r['full430']==0 and r['role'] in ['Shem birth','Shem death']) regular=[r for r in register if selected(r)] check('declared regular domain contains18 retained records',len(regular)==18) def get(tradition,gear,role,rail=None): hits=[r for r in regular if r['tradition']==tradition and r['gear']==gear and r['role']==role and r.get('rail')==rail] assert len(hits)==1,(tradition,gear,role,rail) return hits[0]['center'] fields={} for row in load('C301_DATA.json')['cumulative_coverage']: s=row['source'] if s['profile'] in ['MT_ON','LXX_OFF'] and s['role'] in ['Shem','Flood']: key=(s['profile'],s['role'],s['index']);assert key not in fields;fields[key]=s['BC'] check('two cumulative profiles retain32 source endpoints',len(fields)==32 and all(0<=key[2]<=7 for key in fields)) f18=(root/'sources/File_18.md').read_text() axis=(root/'sources/AXIS_REPORT.md').read_text() iii=(root/'sources/ENGINE_REPORT_III.md').read_text() guard=(root/'sources/GEAR_REGISTER.md').read_text() sp_native={} for line in f18.splitlines(): m=re.fullmatch(r'\| G([123]) \| (\d+)/(\d+) \| (\d+)/(\d+) \| (\d+)/(\d+) \| (\d+)/(\d+) \|',line.strip()) if m: g,*v=map(int,m.groups()) if v[4] in (2991,2993,2995):sp_native[g]=v check('SP native table binds all six derived Shem pairs',len(sp_native)==3 and all(get('SP',g,'Shem birth',rail)==sp_native[g][4+r]+60 and get('SP',g,'Shem death',rail)==sp_native[g][6+r]+60 for g in (1,2,3) for r,rail in enumerate(('primary','companion')))) check('native primary Noah-to-Shem difference is500',all(v[0]-v[4]==500 for v in sp_native.values())) check('MT normal Noah anchor binds File18 and axis table','| Noah | 2843 | 1893 | 950 | 500 |' in f18 and '3059t/3058n BC' in axis and get('MT',2,'Noah birth')==2843+215) flood_line=next(line for line in f18.splitlines() if line.startswith('| MT |') and '2460' in line and '2456' in line) check('MT three-Gear Flood starts bind source table',all(str(get('MT',g,'Flood start')) in flood_line for g in (1,2,3))) check('MT source pairs retain600 and centered Gear spacing',all(get('MT',g,'Noah birth')-get('MT',g,'Flood start')==600 and get('MT',g,'Noah birth')==3058+2*(g-2) for g in (1,2,3))) check('SP same-frame Noah shift binds650 tradition difference',all(sp_native[g][0]+215-get('MT',g,'Noah birth')==650 for g in (1,2,3))) check('supplement expressly supplies derived LXX OFF field','`5890–5883 BC`' in iii and '`5290–5283 BC`' in iii and '5290+600=5890' in iii) check('comparison guard retained','not automatic source-state identity or a universal execution generator' in guard) check('retained cumulative fields have fixed same-index difference6',all(fields['MT_ON',role,i]-fields['LXX_OFF',role,i]==6 for role in ('Shem','Flood') for i in range(8))) check('retained cumulative source formulas hold',all(fields[p,role,i]==head-i for p,role,head in [('MT_ON','Shem',5896),('MT_ON','Flood',5296),('LXX_OFF','Shem',5890),('LXX_OFF','Flood',5290)] for i in range(8))) offset=12696-8464-(1406-6) check('comparison offset remains2832',offset==2832) rows=[] for g in (3,2,1): mt=[get('MT',g,'Noah birth'),get('MT',g,'Flood start')] for r,rail in enumerate(('primary','companion')): sp=[get('SP',g,'Shem birth',rail),get('SP',g,'Shem death',rail)] delta=sp[0]-mt[0] i=5896-(mt[0]+offset);j=5890-(sp[0]+offset) expected_mt=[b+offset for b in mt];expected_lxx=[b+offset for b in sp] mt_in=all(fields.get(('MT_ON',role,i))==value for role,value in zip(('Shem','Flood'),expected_mt)) lxx_in=all(fields.get(('LXX_OFF',role,j))==value for role,value in zip(('Shem','Flood'),expected_lxx)) phase_checks=[] for m,s in zip(mt,sp): for p in [Fraction(-1,4),Fraction(1,4)]: # Signed BC paired centers are -B; later BC date labels mean +time. phase_checks.append(-m+p+(5+r)==-s+p) check(f'G{g} {rail} preserves both endpoints and phases',delta==sp[1]-mt[1]==650-500+60-215-r and sp[0]-sp[1]==600 and all(phase_checks)) regular_gaps=[8464-b-6 for b in sp] required_cumulative_gaps=[12696-c-1406 for c in expected_lxx] check(f'G{g} {rail} index and bridge equations agree',j==i-1+r and 5296-(mt[1]+offset)==i and 5290-(sp[1]+offset)==j and regular_gaps==required_cumulative_gaps) status='both_fields_admitted' if mt_in and lxx_in else ('target_only_antecedent_outside' if lxx_in else 'both_cumulative_fields_outside') rows.append({'gear':g,'rail':rail,'rail_index':r,'MT_regular_pair':mt,'SP_regular_pair':sp,'BC_label_delta':delta,'forward_time_shift':-delta,'MT_ON_required_index':i,'LXX_OFF_required_index':j,'MT_ON_required_pair':expected_mt,'LXX_OFF_required_pair':expected_lxx,'MT_ON_pair_admitted':mt_in,'LXX_OFF_pair_admitted':lxx_in,'status':status,'outside_values_are_diagnostic_only':True,'phase_translation_passed':all(phase_checks)}) check('H0 rail-blind constant translation fails',sorted({r['BC_label_delta'] for r in rows})==[-6,-5]) check('H1 one rail-labelled rule holds for all Gears',all(r['BC_label_delta']==-5-r['rail_index'] for r in rows)) closed=[r for r in rows if r['status']=='both_fields_admitted'] check('exactly four complete field-to-field transports',len(closed)==4 and {(r['gear'],r['rail']) for r in closed}=={(g,rail) for g in (2,3) for rail in ('primary','companion')}) check('G1 primary is a valid target with absent antecedent',len([r for r in rows if r['status']=='target_only_antecedent_outside'])==1 and next(r for r in rows if r['status']=='target_only_antecedent_outside')['LXX_OFF_required_index']==7) check('G1 companion is outside both cumulative fields',len([r for r in rows if r['status']=='both_cumulative_fields_outside'])==1 and next(r for r in rows if r['status']=='both_cumulative_fields_outside')['LXX_OFF_required_index']==8) prior=load('C302_DATA.json')['complete_segments'] def prior_hit(profile,index,tradition,gear,rail,roles,pair): hits=[p for p in prior if p['profile']==profile and p['index']==index and p['upper']['regular']['tradition']==tradition and p['upper']['regular']['gear']==gear and p['upper']['regular'].get('rail')==rail and [p['upper']['regular']['role'],p['lower']['regular']['role']]==roles and [p['upper']['regular']['center'],p['lower']['regular']['center']]==pair] return len(hits)==1 check('four complete transports bind both ends to C302',all(prior_hit('MT_ON',r['MT_ON_required_index'],'MT',r['gear'],None,['Noah birth','Flood start'],r['MT_regular_pair']) and prior_hit('LXX_OFF',r['LXX_OFF_required_index'],'SP',r['gear'],r['rail'],['Shem birth','Shem death'],r['SP_regular_pair']) for r in closed)) target_rows=[r for r in rows if r['LXX_OFF_pair_admitted']] check('all five admitted SP targets exactly recover C302',len(target_rows)==5 and all(prior_hit('LXX_OFF',r['LXX_OFF_required_index'],'SP',r['gear'],r['rail'],['Shem birth','Shem death'],r['SP_regular_pair']) for r in target_rows) and len([p for p in prior if p['profile']=='LXX_OFF' and p['upper']['regular']['tradition']=='SP'])==5) mt_lxx_indices=sorted(p['index'] for p in prior if p['profile']=='LXX_OFF' and p['upper']['regular']['tradition']=='MT') sp_lxx_indices=sorted(r['LXX_OFF_required_index'] for r in target_rows) missing=sorted(set(range(8))-set(mt_lxx_indices)-set(sp_lxx_indices)) check('C310 cover and missing index remain unchanged',mt_lxx_indices==[0,2] and sp_lxx_indices==[3,4,5,6,7] and missing==[1]) return {'regular_records':regular,'cumulative_records':[{'profile':p,'role':role,'index':i,'BC':v} for (p,role,i),v in sorted(fields.items())],'comparison_offset':offset,'component_formula':{'tradition_offset':650,'role_displacement':-500,'Terah_change':60,'sojourn_change':-215,'SP_companion_change':'-r','BC_label_delta':'-5-r','signed_BC_time_shift':'5+r'},'index_relation':'j=i-1+r','six_comparisons':rows,'hypotheses':{'H0_one_rail_blind_translation':'rejected','H1_one_rail_labelled_rule':'verified_on_declared_domain'},'counts':{'regular_pairs_MT':3,'regular_pairs_SP':6,'same_Gear_comparisons':6,'admitted_complete_cumulative_transports':4,'target_only_boundary_cases':1,'outside_both_fields':1},'retained_LXX_OFF_cover':{'MT':mt_lxx_indices,'SP':sp_lxx_indices,'missing':missing},'source_prescribed_selector_established':False,'new_endpoint_census_performed':False,'new_source_nodes_created':False,'C313_executed':False}