from fractions import Fraction as F from itertools import product import hashlib def run(load,read,check): reg=load('C286_DATA.json')['target_register'];by={} for i,r in enumerate(reg):by.setdefault(r['center'],[]).append(i) path=next(r for r in load('PREVIOUS_DATA.json')['complete_paths'] if r['input']==3206) p,q,H,m=path['p'],path['q'],path['input'],path['intermediate']['numerator'] check('loop coordinates retained',(p,q,H,m)==(3620,2756,3206,3170)) check('C413 selective reference authenticated',hashlib.sha256(read('C413_SYNTHESIS.md').encode()).hexdigest()==load('C413_CERTIFICATE.json')['report_sha256']) check('old return graph is a different declared menu','2531,2533,2535' in read('C413_SYNTHESIS.md')) cards=[] for c in load('C434_DATA.json')['source_excerpt_cards']: if c['id'] in ['SP_FIELD','VARIANTS','FLOOD_GEAR_SCOPE','SP_LOCALITY','LXX_REMOVAL','E_RATIO_CORRECTED']: text='\n'.join(read(c['source']).splitlines()[c['line_start']-1:c['line_end']]) check('current source card '+c['id'],text==c['text']);cards.append(c) slots={'start':by[H],'middle':by[m],'end':by[H],'first_pivot':by[p],'second_pivot':by[q]} labels=[] for x,z,y,a,b in product(*(slots[k] for k in ['start','middle','end','first_pivot','second_pivot'])): rr=[reg[j] for j in [x,z,y,a,b]] same_record=x==y;one_tradition=len({r['tradition'] for r in rr})==1 one_context=len({tuple(r[k] for k in ['tradition','gear','Cainan','Terah60','full430']) for r in rr})==1 labels.append({'start':x,'middle':z,'end':y,'first_pivot':a,'second_pivot':b,'returns_to_same_record':same_record,'one_tradition':one_tradition,'one_unchanged_context':one_context}) check('sixteen label assignments split eight actual returns and eight alias switches',len(labels)==16 and sum(x['returns_to_same_record'] for x in labels)==8) check('one all-SP return but no unchanged-context path',sum(x['one_tradition'] for x in labels)==1 and not any(x['one_unchanged_context'] for x in labels)) check('source36 is100 minus60 minus4',H-m==100-60-4==36 and m==(H-100)+60+4) check('two opposite signed18-unit E gaps',(p-H,p-m,q-m,q-H)==(23*18,25*18,-23*18,-25*18)) E=lambda h,x:F(25*x-2*h,23) check('return is fixed point of expansion squared, not identity map',E(q,E(p,H))==H and F(625,529)!=1) center=F(p+q,2) check('pivot and station pairs have the same local midpoint',center==F(H+m,2)==3188) check('local radii432 and18 give24-to1',(p-center,center-q,H-center,center-m)==(432,432,18,18) and 432==24*18) check('midpoint is already a sourced MT Noah birth',len(by[center])==1 and {k:reg[by[center][0]][k] for k in ['tradition','role','gear','Cainan','Terah60','full430']}=={'tradition':'MT','role':'Noah birth','gear':2,'Cainan':1,'Terah60':0,'full430':1}) contexts=[] for name,g,c,t,f in [('H_and_q',1,0,0,1),('middle_Flood',3,0,1,1),('first_pivot',1,1,0,0)]: ids=[i for i,r in enumerate(reg) if (r['tradition'],r['gear'],r['Cainan'],r['Terah60'],r['full430'])==('SP',g,c,t,f)] contexts.append({'name':name,'indices':ids,'records':[reg[i] for i in ids]}) return {'step':'C436','path':{'p':p,'q':q,'H':H,'middle':m},'source_cards':cards,'label_assignments':labels, 'source_records':[{'index':i,'record':reg[i]} for i in sorted(set(sum(slots.values(),[])+by[center]))], 'own_contexts':contexts,'source_equation':'36=100-60-4','local_midpoint':{'coordinate':int(center),'record_indices':by[center],'outer_radius':432,'inner_radius':18,'ratio':24}, 'counts':{'label_assignments':16,'same_record_returns':8,'alias_switches':8,'all_SP_paths':1,'unchanged_context_paths':0}, 'limits':'Local midpoint is an existing record and derived comparison, not a new global Mirror axis. The old E/J/P return graph has a different declared source/pivot menu; no global novelty claim or chronological cycle follows.'}