#!/usr/bin/env python3 """Independent finite C314 reversal check, standard library only. --sources DIR contains PREVIOUS_DATA.json (C313), C286_DATA.json, C287_DATA.json, C271_REGISTER.json. Without --sources, read completed siblings. No new nodes, annual stations, anchor fit, or later-step computation. """ import argparse from fractions import Fraction as F import hashlib import json from pathlib import Path def main(): p=argparse.ArgumentParser() p.add_argument('--sources',type=Path) p.add_argument('--out',type=Path,default=Path(__file__).parent) a=p.parse_args() root=Path(__file__).resolve().parents[1] defaults={'PREVIOUS_DATA.json':root/'C313/evidence/DATA.json', 'C286_DATA.json':root/'C313/sources/C286_DATA.json', 'C287_DATA.json':root/'C313/sources/C287_DATA.json', 'C271_REGISTER.json':root/'C313/sources/C271_REGISTER.json'} data={}; hashes={} for n,default in defaults.items(): path=a.sources/n if a.sources else default raw=path.read_bytes();data[n]=json.loads(raw) hashes[n]=hashlib.sha256(raw).hexdigest() before=data['PREVIOUS_DATA.json']; reg=data['C286_DATA.json']['target_register'] four=data['C287_DATA.json']; ancestry=data['C271_REGISTER.json'] assert before['parameters']['annual_indices']==[3,4,5,6,7] assert before['parameters']['17K']==8993==17*529 cases=before['rows']; domain=[r['index'] for r in cases] assert domain==[3,4,5,6,7] complete={r['i'] for r in four['rows'] if r['complete']} assert complete=={2,3,4,5} states=('tradition','gear','rail','Cainan','Terah60','full430') phases=(F(-1,4),F(1,4)) def source(center,role,gear,rail): xs=[r for r in reg if r['tradition']=='SP' and r['Cainan']==0 and r['Terah60']==0 and r['full430']==1 and r['role']==role and r['center']==center and r['gear']==gear and r['rail']==rail] assert len(xs)==1 return xs[0] rows=[] for r in cases: j=r['index'];i=10-j s=r['normalized_Shem_birth']['center'];d=r['normalized_Shem_death']['center'] gear=r['normalized_Shem_birth']['gear'];rail=r['normalized_Shem_birth']['rail'] n=3703+i; qi=-5290+i; qj=-5290+j nr=source(n,'Noah birth',gear,rail) sr=source(s,'Shem birth',gear,rail) dr=source(d,'Shem death',gear,rail) assert nr==r['source_matched_Noah'] and all(nr[k]==sr[k]==dr[k] for k in states) assert s==3213-j and d==s-600 assert n-s==500 and s-d==600 and n-d==1100 ar=[x for x in ancestry if x['branch']=='Noah' and x['source_event']['tradition']=='SP' and x['source_event']['gear']==gear and x['source_event']['rail']==rail] assert len(ar)==1 ar=ar[0] assert ar['source_event']['BC_Nisan']==n and ar['cumulative_source']['source_index']==i parts=[] for es in phases: en=-es nc=F(qi)+en+8993;sc=F(s)-es;dc=F(d)-es assert nc-sc==500 and sc-dc==600 and nc-dc==1100 node=[x for x in ar['phases'] if F(x['cumulative_coordinate'])==qi+en] assert len(node)==1 and F(node[0]['reflected_coordinate'])==nc candidates=[(k,e) for k in domain for e in phases if F(3703+k)+e-(F(s)-es)==500] assert candidates==[(i,en)] # J^2 is checked on the index-phase labels without retyping event identity. assert (10-i,-en)==(j,es) assert (i,en)!=(j,es) assert qi+en+qj+es==-10570 parts.append({'Shem_ancestry_offset':str(es),'Noah_ancestry_offset':str(en),'Shem_cumulative_coordinate':str(qj+es),'Noah_cumulative_coordinate':str(qi+en),'Noah_component':str(nc),'Shem_birth_component':str(sc),'Shem_death_component':str(dc),'Noah_minus_Shem':'500','Shem_life':'600','Noah_minus_Shem_death':'1100','Noah_C271_reflected_phase':node[0]['reflected_phase'],'unique_matching_index_and_phase':[i,str(en)]}) rows.append({'Shem_index_j':j,'Noah_index_i':i,'gear':gear,'rail':rail,'source_biography_BC':[n,s,d],'typed_binding_preserved':True,'phase_cases':parts,'direct_17K_Noah_admitted':True,'C287_complete_at_Noah_i':i in complete,'C287_complete_at_Shem_j':j in complete,'C287_complete_at_both_indices':i in complete and j in complete,'Noah_i_C287_ON_Shem_required_index':i+2,'index_reflection_is_involution':10-i==j}) assert [r['Noah_index_i'] for r in rows]==[7,6,5,4,3] assert [r['Shem_index_j'] for r in rows if r['C287_complete_at_Noah_i']]==[5,6,7] assert [r['Shem_index_j'] for r in rows if r['C287_complete_at_both_indices']]==[5] points={(j,e) for j in domain for e in phases} image={(10-j,-e) for j,e in points} assert image==points orbits=[];todo=set(points) while todo: x=min(todo);y=(10-x[0],-x[1]);todo-={x,y} orbits.append([[x[0],str(x[1])],[y[0],str(y[1])]]) assert len(orbits)==5 result={'step':'C314','status':'passed','input_sha256':hashes,'scope':'Independent finite arithmetic and frozen-register membership check; no source-rule audit or global-axis claim.','formulas':{'Noah':'N(i,en)=3703+i+en','Shem_birth':'S(j,es)=3213-j-es','Shem_death':'D(j,es)=2613-j-es','binding_equation':'N-S=490+i+j+en+es','necessary_and_sufficient_for500_on_integer_indices_and_quarter_phases':'i+j=10 and en=-es','finite_label_map':'J(j,es)=(10-j,-es)','local_coordinate_sum':'q_Noah+q_Shem=-10570 (equation consequence, no new global axis)'},'rows':rows,'involution':{'domain_indices':domain,'index_orbits':[[3,7],[4,6],[5]],'index_fixed_point':5,'phase_label_orbits':orbits,'phase_label_fixed_points':0,'closed_on_this_five_case_domain':True},'counts':{'source_labelled_biographies':5,'exact_phase_biographies':10,'full_finite_component_comparisons_for_uniqueness':100,'unique_matching_components':10,'C287_complete_at_Noah_i':3,'C287_complete_at_Shem_j':3,'C287_complete_at_both_indices':1},'boundary_findings':['The direct17K Noah records exist for all five pairings.','For j3 and j4, paired i7 and i6 require C287 ON-Shem indices9 and8, outside the retained0..7 field.','The reverse C287 boundary affects j6 and j7 when checking completeness at the original Shem-index side.','Only j=i5 has C287 complete rows at both paired indices.','No absent component is repaired and no field is extended.'],'interpretation':'The reversal is forced once these endpoint formulas, normalization and500-year target are fixed. It is a derived correspondence between differently indexed, oppositely phased cumulative ancestries, not a recovered source-prescribed selector, an event-identity replacement, or a new global Mirror axis.','suggested_next_bounded_question':'Test whether the finite500-year correspondence commutes with the admitted regular SP Noah-to-Flood relation while preserving the complete Shem-life endpoint and both SP rails; keep source-event and seasonal labels explicit.','later_step_executed':False} a.out.mkdir(parents=True,exist_ok=True) (a.out/'C314_Independent_Math_Results.json').write_text(json.dumps(result,indent=2)+'\n') print(json.dumps({'status':'passed','source_biographies':5,'phase_biographies':10,'paired_C287_complete':3,'both_indices_C287_complete':1})) if __name__=='__main__':main()