from fractions import Fraction as Q from itertools import product def run(load,check): E=Q(25,23);J=Q(300,299);lam=E*J;reg=load('C286_DATA.json')['target_register'];rows=[];phases=[];bios=[] def aff(a,k):return(k,(1-k)*a) def comp(a,b):return(a[0]*b[0],a[0]*b[1]+a[1]) def at(f,x):return f[0]*x+f[1] for k,row in enumerate(load('PREVIOUS_DATA.json')['rows']): N=row['Noah_pivot'];x=row['E_input'];y=row['E_output'];A=row['return_J_pivot'];JE=comp(aff(A,J),aff(N,E));EJ=comp(aff(N,E),aff(A,J)) check('two source endpoint loops '+str(k),at(JE,x)==x and at(EJ,y)==y and at(aff(N,E),x)==y and at(aff(A,J),y)==x) check('exact loop maps '+str(k),JE==aff(x,lam) and EJ==aff(y,lam) and lam==Q(7500,6877)>1) check('loop order defect '+str(k),JE[1]-EJ[1]==-Q(1246,6877) and N-A==623 and lam-1==Q(623,6877)) check('not global inverses '+str(k),JE!=(Q(1),Q(0)) and EJ!=(Q(1),Q(0))) good=[] for eps in product([Q(-1,4),Q(1,4)],repeat=4): n,a,u,v=[Q(w)+e for w,e in zip([N,A,x,y],eps)];ok=at(aff(n,E),u)==v and at(aff(a,J),v)==u phases.append({'row':k,'offsets':list(map(str,eps)),'both_source_edges':ok}) if ok:good.append(list(map(str,eps))) check('matched component loop '+str(k),len(good)==2 and all(len(set(p))==1 for p in good)) for tr in ['SP','LXX']: src=next(r for r in row['input_source_records'] if r['tradition']==tr);dst=next(r for r in row['output_source_records'] if r['tradition']==tr) def death(p):return next(r for r in reg if r['role']=='Noah death' and all(r.get(t)==p.get(t) for t in ['tradition','gear','rail','Cainan','Terah60','full430'])) dx=death(src);dy=death(dst) check('typed950 biography '+str((k,tr)),x-dx['center']==y-dy['center']==950 and dy['center']==dx['center']-2) de=at(aff(N,E),dx['center'])-dy['center'];dj=at(aff(A,J),dy['center'])-dx['center'];dl=at(JE,dx['center'])-dx['center'] check('biography obstruction '+str((k,tr)),de==-Q(1900,23) and dj==-Q(950,299) and dl==-Q(591850,6877)) bios.append({'row':k,'tradition':tr,'input_death_record':dx,'output_death_record':dy,'E_death_residual':str(de),'J_death_residual':str(dj),'full_loop_death_residual':str(dl),'source_lifespan':950,'SP_primary_qualification':'inclusive/harmonic' if tr=='SP' else None}) rows.append({'Noah_pivot':N,'Flood_pivot':A,'E_input':x,'E_output':y,'J_after_E_coefficients':list(map(str,JE)),'E_after_J_coefficients':list(map(str,EJ)),'J_after_E_fixed_source':x,'E_after_J_fixed_source':y,'pivot_span':N-A,'loop_slope':str(lam),'order_defect_JE_minus_EJ':str(JE[1]-EJ[1]),'source_component_loops':good}) check('phase and lifespan inventories',len(phases)==32 and sum(t['both_source_edges'] for t in phases)==4 and len(bios)==4) check('one physical map stretches phase gap',(lam-1)/2==Q(623,13754)) return {'step':'C395','rows':rows,'phase_trials':phases,'biography_trials':bios,'counts':{'source_endpoint_loops':2,'affine_loop_maps':4,'phase_assignments':32,'matched_component_loops':4,'whole950_biography_passes':0},'loop_multiplier':str(lam),'half_year_spacing_excess':str((lam-1)/2),'interpretation':'Each composition fixes its selected source endpoint but is a nonidentity dilation with multiplier7500/6877. The two orders have different fixed points and do not commute. Matched-component comparisons survive; one physical-time map and whole950 biographies do not.'}