from fractions import Fraction as Q def run(load,check): E=Q(25,23);reg=load('C286_DATA.json')['target_register'];coords=sorted({r['center'] for r in reg});by={x:[i for i,r in enumerate(reg) if r['center']==x] for x in coords};graphs=[];trials=[] for k,row in enumerate(load('C385_DATA.json')['rows']): A,B,x,y,N=row['original_tuple'];edges=[];fixed=[] for p in coords: q=N+E*(p-N);hit=q in by;trials.append({'Noah_pivot':N,'input':p,'image':str(q),'source_member':hit}) if hit: item={'input':p,'output':int(q),'input_record_indices':by[p],'output_record_indices':by[q],'input_distance_from_Noah':N-p,'output_distance_from_Noah':N-int(q)} (fixed if p==q else edges).append(item) forward={e['input']:e['output'] for e in edges};incoming={e['output'] for e in edges};paths=[] for start in sorted(set(forward)-incoming): path=[start] while path[-1] in forward: nxt=forward[path[-1]];assert nxt not in path;path.append(nxt) paths.append(path) check('graph lossless '+str(k),sum(len(p)-1 for p in paths)==len(edges) and len(fixed)==1 and fixed[0]['input']==N) expected={(x,N-500),(B,N-650),(A,N-1150),(N-1150,N-1250)} check('four expected E edges present '+str(k),expected<=set(forward.items())) extras=[e for e in edges if (e['input'],e['output']) not in expected] for e in extras: e['input_source_records']=[reg[j] for j in e['input_record_indices']] e['output_source_records']=[reg[j] for j in e['output_record_indices']] units=[e for e in extras if (e['input_distance_from_Noah'],e['output_distance_from_Noah'])==(23,25)] check('unit E source edges only full branch '+str(k),len(units)==(1 if N in [3706,3708] else 0)) for e in units: ng=row['source_context_lifts'][0]['Noah_input_record']['gear'] for tradition in ['SP','LXX']: ins=[q for q in e['input_source_records'] if q['tradition']==tradition] outs=[q for q in e['output_source_records'] if q['tradition']==tradition] check('coherent reverse Gear unit E '+str((k,tradition)),len(ins)==len(outs)==1 and ins[0]['role']==outs[0]['role']=='Noah birth' and ins[0]['gear']==ng+1 and outs[0]['gear']==ng and all(q['Cainan']==1 and q['Terah60']==1 and q['full430']==0 for q in [ins[0],outs[0]])) check('unit E variant arithmetic '+str(k),e['output']==N-215+130+60 and e['input']==N-215+130+60+2) graphs.append({'Noah_pivot':N,'pivot_contexts':[l['Noah_input_record'] for l in row['source_context_lifts']],'original_tuple':row['original_tuple'],'edges':edges,'fixed_points':fixed,'maximal_paths':paths,'additional_edges_beyond_four_expected':extras}) check('full finite input domain',len(coords)==373 and len(trials)==1492 and len(graphs)==4) check('observed graph closure',sum(len(g['edges']) for g in graphs)==29 and sum(len(g['maximal_paths']) for g in graphs)==25 and sum(len(g['additional_edges_beyond_four_expected']) for g in graphs)==13 and all(sum(len(p)==3 for p in g['maximal_paths'])==1 for g in graphs)) return {'step':'C392','coordinate_menu':coords,'register':reg,'trials':trials,'graphs':graphs,'counts':{'held_Noah_pivots':4,'distinct_input_coordinates':373,'E_evaluations':len(trials),'nontrivial_coordinate_edges':sum(len(g['edges']) for g in graphs),'fixed_coordinate_points':sum(len(g['fixed_points']) for g in graphs),'maximal_paths':sum(len(g['maximal_paths']) for g in graphs),'maximum_path_edges':max(len(p)-1 for g in graphs for p in g['maximal_paths']),'additional_edges_beyond_expected':sum(len(g['additional_edges_beyond_four_expected']) for g in graphs)},'interpretation':'Finite exact E graph at four existing Noah centers; coordinate edges retain every frozen source alias. Source labels must be qualified before interpreting any extra edge. No generated coordinate, phase or Gear is admitted.'}