from fractions import Fraction as Q def run(load,check): reg=load('C286_DATA.json')['target_register'];rows=[] for f in load('C349_DATA.json')['fields']: z=f['records'];N=z['N']['center'];M=z['M']['center'];R=z['R']['center'];S=z['S']['center'];g=z['N']['gear'] deaths=[x for x in reg if x['tradition']=='SP' and x['role']=='Shem death' and x['gear']==g and x['rail']=='primary' and x['Cainan']==0 and x['Terah60']==0 and x['full430']==1] check('one matched SP death '+str(f['i']),len(deaths)==1);T=deaths[0]['center'] s=Q(N)+Q(25,23)*(M-N);t=s+Q(300,299)*(R-M) upper=lambda x:Q(N)+Q(25,23)*(x-N) lower=lambda x:s+Q(300,299)*(x-M) check('existing source endpoints '+str(f['i']),s==S and t==T and upper(N)==N and upper(M)==lower(M)==S and lower(R)==T) check('input and output legs '+str(f['i']),(N-M,M-R,N-R)==(460,598,1058) and (N-S,S-T,N-T)==(500,600,1100)) check('two established ratios '+str(f['i']),Q(N-S,N-M)==Q(25,23) and Q(S-T,M-R)==Q(300,299)) check('diagnostic total ratio and gain '+str(f['i']),Q(N-T,N-R)==Q(550,529) and (N-T)-(N-R)==42) V=z['V']['center'];P=N-600 check('same sourced endpoint via translated arrow '+str(f['i']),Q(M)+Q(300,299)*(R-M)==V and Q(P)+Q(25,23)*(V-P)==T) # One affine map fixed at N and mapping M to S is forced to be E_N. uniform_R=upper(R) check('no single affine interpolation of all3 '+str(f['i']),uniform_R==z['H']['center'] and uniform_R!=T) rows.append({'i':f['i'],'input_records':[z['N'],z['M'],z['R']],'output_records':[z['N'],z['S'],deaths[0]],'input_gaps':[460,598],'output_gaps':[500,600],'upper_segment':{'slope':'25/23','formula':'N+(25/23)(x-N)'},'lower_segment':{'slope':'300/299','formula':'S+(300/299)(x-M)'},'join':'Both formulas sendM toS','total_input':1058,'total_output':1100,'total_ratio_diagnostic':'550/529','total_gain':42,'uniform_E_R':str(uniform_R),'via_existing_composition':{'R_to_V':R-V,'V_to_T':V-T,'V':z['V'],'SP_Flood_pivot':P}}) return {'step':'C359','rows':rows,'source_status':'All displayed endpoints are existing source records. The two local gap rules are inherited; their joined use is a comparison proposed here, not a reviewed source instruction.','global_550_529_operator_adopted':False,'new_source_nodes':False,'matched_Shem_lifespan':600,'single_affine_map':False}