from fractions import Fraction as F def run(load,check): reg=load('C286_DATA.json')['target_register'];on=load('PREVIOUS_DATA.json');off=load('C320_DATA.json');rev=load('C314_DATA.json');complete={r['i'] for r in load('C287_DATA.json')['rows'] if r['complete']};rows=[] for r in on['rows']: if not r['matched_context_rectangles']:continue pair=r['matched_context_rectangles'][0];g=pair['Noah']['gear'];i=r['i'];mt={};sp={} roles=['Noah birth','Shem birth','Flood start','Noah death','Shem death'] for role in roles: def match(tr,C,T,rail):return [z for z in reg if z['tradition']==tr and z['gear']==g and z['role']==role and z['Cainan']==C and z['Terah60']==T and z['full430']==1 and (role=='Flood start' or z.get('rail')==rail)] a=match('SP',0,0,'primary');b=match('MT',1,1,None);check(f'i{i} {role} unique source',len(a)==len(b)==1);sp[role]=a[0];mt[role]=b[0] sc=[sp[k]['center'] for k in roles];mc=[mt[k]['center'] for k in roles];res=[b-(a-460) for a,b in zip(sc,mc)] check(f'i{i} actual source spans',[sc[k]-sc[k+1] for k in range(4)]==[500,100,350,150] and [mc[k]-mc[k+1] for k in range(4)]==[500,100,350,150]) check(f'i{i} biographytransport residual',res==[0,0,0,0,0]) check(f'i{i} unchangedlifespans',mc[0]-mc[3]==sc[0]-sc[3]==950 and mc[1]-mc[4]==sc[1]-sc[4]==600) aliases={} for role in ['Shem birth','Shem death']: wanted=sp[role]['center']-460 hits=[z for z in reg if z['tradition']=='MT' and z['role']==role and z['Cainan']==1 and z['Terah60']==1 and z['full430']==1 and z['center']==wanted] check(f'i{i} {role} exact sameGear source match',len(hits)==1 and hits[0]['gear']==g);aliases[role]=hits comps=[] for e in [F(-1,4),F(1,4)]: a=[F(z)+e for z in sc];b=[F(z)+e for z in mc];check(f'i{i} {e} phase residuals',[y-(x-460) for x,y in zip(a,b)]==res) comps.append({'phase':str(e),'SP':[str(z) for z in a],'MT':[str(z) for z in b],'residuals':[str(z) for z in res]}) rows.append({'i':i,'gear':g,'roles':roles,'SP_records':sp,'MT_records':mt,'SP_chain_BC':sc,'MT_chain_BC':mc,'MT_minus_uniform460_image':res,'Shem_exact_matches':aliases,'components':comps}) joint=[] rev_i={r['i'] for r in rev['rows']} for i in range(8): j=10-i;o=bool(off['rows'][i]['matched_context_rectangles']);native=bool(on['rows'][i]['matched_context_rectangles']);reverse=i in rev_i;ck=i in complete;partner=j in complete and j in range(8) joint.append({'i':i,'j_required':j,'OFF600':o,'ON600':native,'reversed_SP500':reverse,'C287_at_i':ck,'C287_at_reversed_j':partner,'OFF_ON_reversed_and_C287_i':o and native and reverse and ck,'with_partner_C287':o and native and reverse and ck and partner}) check('jointcore i3and5',[r['i'] for r in joint if r['OFF_ON_reversed_and_C287_i']]==[3,5]) check('additionalpartnercondition onlyi5',[r['i'] for r in joint if r['with_partner_C287']]==[5]) mt2=next(r for r in rows if r['gear']==2);mt1=next(r for r in rows if r['gear']==1) control={'Noah_G2':mt2['MT_chain_BC'][0],'Shem_G1':mt1['MT_chain_BC'][1],'Shem_death_G1':mt1['MT_chain_BC'][4],'Flood_G2':mt2['MT_chain_BC'][2],'Noah_G2_to_Shem_G1':mt2['MT_chain_BC'][0]-mt1['MT_chain_BC'][1],'Shem_G1_to_Flood_G2':mt1['MT_chain_BC'][1]-mt2['MT_chain_BC'][2],'status':'Distinct Arphaxad-bound/textual502 binding; sourceFile18ยง1.3.5 retains bothmodes.'} check('textualbinding control502and98',control['Noah_G2_to_Shem_G1']==502 and control['Shem_G1_to_Flood_G2']==98) return {'step':'C322','biographies':rows,'joint_support':joint,'counts':{'full_source_biography_pairs':3,'exactphase_biography_pairs':6,'uniform460_full_biography_success':3,'joint_core_rows':2,'joint_with_partner_C287':1},'MT_binding_control':control,'interpretation':'Uniform460 preserves allthree sameGear Noah-bound500harmonic biographies. Textual502 uses distinctNoahG2/ShemG1 binding and must not replace or be replaced by theharmonicstate. Joint support retains source identities.'}