from itertools import product from fractions import Fraction as Q def run(load,check): reg=load('C286_DATA.json')['target_register'];by={} for i,r in enumerate(reg):by.setdefault(r['center'],[]).append(i) rows=[];lifts=[] for r in load('PREVIOUS_DATA.json')['operator_trials']: if r['operator']!='E' or not r['source_record_indices']:continue upper=[i for i in r['upper_source_record_indices'] if reg[i]['role']=='Flood start'] if not upper:continue rows.append(r) for ui,xi,yi in product(upper,r['input_source_record_indices'],r['source_record_indices']): u,x,y=[reg[i] for i in [ui,xi,yi]];kind='T2' if x['role']=='Noah death' else 'T3';check('MT target and exact E '+str((ui,xi,yi)),y['tradition']=='MT' and y['role']=='Shem death' and Q(u['center'])-Q(25,23)*(u['center']-x['center'])==y['center']) if kind=='T2':valid=(x['tradition']=='MT' and u['Cainan']==x['Cainan']==y['Cainan'] and u['full430']==x['full430']==y['full430'] and u['Terah60']==y['Terah60']==1 and x['Terah60']==0 and u['gear']==y['gear']==x['gear']-1) else:valid=(x['tradition']=='MT' and x['role']=='Flood close' and u['Cainan']==u['full430']==u['Terah60']==y['Cainan']==y['full430']==y['Terah60']==1 and x['Cainan']==x['full430']==x['Terah60']==0 and u['gear']==y['gear']==x['gear']+1) check('typed family rule '+str((ui,xi,yi)),valid);lifts.append({'upper_record_index':ui,'input_record_index':xi,'output_record_index':yi,'template':kind,'upper':u,'input':x,'output':y}) boundary=[] for c,f,g in product([0,1],[0,1],[1,2,3]): h=2951+130*c+215*f+2*(g-1);x=1893+130*c+215*f+2*(g-1);y=1801+130*c+215*f+2*(g-1) expected={'tradition':'MT','role':'Noah death','gear':g+1,'Cainan':c,'Terah60':0,'full430':f};nd=[i for i,r in enumerate(reg) if all(r[k]==v for k,v in expected.items())];allinputs=by.get(x,[]);check('formal family geometry '+str((c,f,g)),h-x==1058 and h-y==1150 and x-y==92);boundary.append({'Cainan':c,'full430':f,'upper_Gear':g,'held':h,'input':x,'output':y,'required_Noah_death_Gear':g+1,'correct_Noah_death_record_indices':nd,'all_input_record_indices':allinputs,'all_input_records':[reg[i] for i in allinputs]}) strip=[r for r in boundary if r['Cainan']==r['full430']==1] for a,z in zip(strip,strip[1:]):check('whole-map +2 correspondence '+str(a['upper_Gear']),z['held']==a['held']+2 and z['input']==a['input']+2 and z['output']==a['output']+2 and (1-Q(25,23))*(z['held']-a['held'])==(1-Q(25,23))*2) return {'step':'C430','Flood_held_coordinate_arrows':rows,'record_labelled_arrows':lifts,'Noah_death_family_boundary_trials':boundary,'C1_F1_three_Gear_strip':strip,'counts':{'Flood_held_coordinate_arrows':len(rows),'record_labelled_E_arrows':len(lifts),'T2_labelled_arrows':sum(x['template']=='T2' for x in lifts),'T3_labelled_arrows':sum(x['template']=='T3' for x in lifts),'formal_coordinate_family_cases':len(boundary),'admitted_Noah_death_input_cases':sum(bool(x['correct_Noah_death_record_indices']) for x in boundary),'Gear3_Noah_death_inputs':sum(bool(x['correct_Noah_death_record_indices']) for x in boundary if x['upper_Gear']==3),'Gear3_any_source_inputs':sum(bool(x['all_input_record_indices']) for x in boundary if x['upper_Gear']==3)},'interpretation':'T2 maps next-Gear MT Noah death with Terah0 to same-Gear MT Shem death with Terah60, holding SP/LXX Flood start with Terah60 and matching Cainan/sojourn. T3 extends the full C1/F1 upper strip through a different MT Flood-close input role. No Gear4 Noah record is created. Translation conjugacy is an exact comparison of changing pivots, not a single fixed-pivot action or source identity.'}