from fractions import Fraction as Q def run(load,check): reg=load('C286_DATA.json')['target_register'];cum=load('C365_DATA.json')['cumulative_register'];rows=[] for fld in load('C378_DATA.json')['fields']: field=fld['field'];menu=reg if field=='regular' else cum;key='center' if field=='regular' else 'coordinate' for k,edge in enumerate(fld['hits']): u,v,A,B=[edge[t] for t in ['input','output','J_pivot','P_pivot']];h=v-u;V=Q(25*v-23*u,2);outer=u+230*h;ids=[i for i,r in enumerate(menu) if Q(r[key])==V];src=[menu[i] for i in ids] check('signed unique E return '+str((field,k)),V==u+Q(25,2)*h and V+Q(25,23)*(v-V)==u) check('signed common P J geometry '+str((field,k)),u-A==299*h and u-B==69*h and B-A==230*h) check('signed loop pivot spans '+str((field,k)),V-A==Q(623,2)*h and V-B==Q(163,2)*h and outer-V==Q(435,2)*h and outer-A==529*h) supported=field=='regular' and u in [3031,3033] check('complete source membership '+str((field,k)),bool(ids)==supported) if src:check('admitted pivot is existing MT Noah '+str(k),len(src)==1 and src[0]['tradition']=='MT' and src[0]['role']=='Noah birth' and src[0]['Cainan']==src[0]['Terah60']==0 and src[0]['full430']==1) rows.append({'field':field,'common_edge':[u,v],'J_pivot':A,'P_pivot':B,'signed_gain':h,'unique_E_return_pivot':str(V),'source_record_indices':ids,'source_records':src,'existing_529_outer_coordinate':outer,'signed_outer_side':529*h,'source_E_P_J_loop':bool(ids)}) known={tuple(h[t] for t in ['E_output','E_input','E_Noah_pivot']) for h in load('C396_DATA.json')['hits'] if h['P_return_source_records']};actual={(r['common_edge'][0],r['common_edge'][1],int(Q(r['unique_E_return_pivot']))) for r in rows if r['source_E_P_J_loop']} check('complete correspondence to family census',known==actual and len(actual)==2) check('all ten common edges covered',len(rows)==10 and sum(r['field']=='cumulative' for r in rows)==6) return {'step':'C399','rows':rows,'counts':{'common_coordinate_edges':10,'cumulative_edges':6,'regular_edges':4,'admitted_return_E_pivots':2,'complete_cumulative_loops':0,'complete_regular_loops':2},'signed_formulas':{'E_return_pivot':'V=u+25h/2','V_minus_J':'623h/2','V_minus_P':'163h/2','original529_outer_minus_V':'435h/2','original529_side':'529h'},'interpretation':'Exactly the two lower-full430 regular edges support the complete source E/P/J loop. All six cumulative and both original full430 regular common edges lack the uniquely required E return pivot. The signed equations explain the same algebra in both orientations without providing missing source points.'}