from fractions import Fraction as Q from itertools import product def run(load,check): E=Q(25,23);J=Q(300,299);P=Q(70,69);reg=load('C286_DATA.json')['target_register'];coords={r['center'] for r in reg};groups={};strips=[];words=[] def aff(a,k):return(k,(1-k)*a) def comp(a,b):return(a[0]*b[0],a[0]*b[1]+a[1]) def at(f,x):return f[0]*x+f[1] for row in load('C385_DATA.json')['rows']: full=row['source_context_lifts'][0]['Noah_input_record']['full430'];groups.setdefault(full,[]).append(row) for full,es in sorted(groups.items()): es.sort(key=lambda r:r['original_tuple'][2]);a,b=es;A,B,x,y,N=a['original_tuple'];A1,B1,y1,v,N1=b['original_tuple'];z=Q(a['E_image_input']);w=Q(b['E_image_output_with_next_Noah']);D=Q(a['required_J_pivot']);D1=Q(b['required_J_pivot']) check('adjacent source strip '+str(full),y==y1 and (A1-A,B1-B,N1-N,D1-D,v-x,w-z)==(2,2,2,2,4,4)) bottom=comp(aff(A1,J),aff(A,J));top=comp(aff(D1,J),aff(D,J));left=comp(aff(N+4,E),bottom);right=comp(top,aff(N,E)) check('whole two-square strip '+str(full),left==right and at(left,x)==w and left[0]==E*J*J) for t,row in enumerate(es): Ap,Bp,xx,yy,nn=row['original_tuple'];dd=Q(row['required_J_pivot']);T=(Q(1),2*t);outT=(Q(1),-2*(t+1));sameT=(Q(1),-2*t) low=comp(outT,comp(aff(Ap,J),T));upper=comp(outT,comp(aff(dd,J),T));vertical=comp(sameT,comp(aff(nn,E),T)) check('translated frame strip '+str((full,t)),low==aff(x,J) and upper==aff(z,J) and vertical==aff(N,E) and comp(upper,vertical)==comp(vertical,low)) for ww in product('PJ',repeat=2): tr=(Q(1),Q(0)) for op,row in zip(ww,es): ap,bp,*_=row['original_tuple'];tr=comp(aff(ap if op=='J' else bp,J if op=='J' else P),tr) via=comp(aff(N+4,E),tr);eq=via==right check('word endpoint and distinct map '+str((full,ww)),at(via,x)==w and eq==(ww==('J','J'))) words.append({'full430':full,'bottom_word':''.join(ww),'common_source_output':str(at(via,x)),'coefficients':list(map(str,via)),'same_affine_map_as_top_JJ':eq}) second_image=N+E*(z-N) check('second E source obstruction '+str(full),second_image.denominator==23 and second_image not in coords) after=[r for r in reg if r['tradition']=='MT' and r['role']=='Noah birth' and r['Cainan']==1 and r['Terah60']==1 and r['full430']==full and r['center']==v+2] check('no next MT Gear endpoint '+str(full),not after) strips.append({'full430':full,'MT_Noah_vertices':[x,y,v],'SP_LXX_Shem_vertices':list(map(str,[z,z+2,w])),'Noah_centers':[N,N+2,N+4],'J_Flood_pivots':[A,A1],'J_Shem_death_pivots':list(map(str,[D,D1])),'strip_coefficients':list(map(str,left)),'second_E_image_at_first_Shem':str(second_image),'second_E_image_source_member':False,'next_MT_Noah_source_records':after}) check('finite strip counts',len(strips)==2 and len(words)==8 and sum(w['same_affine_map_as_top_JJ'] for w in words)==2) return {'step':'C388','strips':strips,'word_trials':words,'counts':{'two_edge_coordinate_strips':2,'SP_LXX_labelled_strips':4,'P_J_bottom_word_trials':8,'same_endpoint_trials':8,'whole_affine_JJ_intertwiners':2,'admitted_second_E_images':0,'admitted_next_MT_Noah_endpoints':0},'reduced_frame':'Subtract2t from both vertices of vertical slice t, and2(t+1) from the next horizontal output. Horizontal J maps reduce to dilations about the initial MT Noah and Shem source points; E_N carries one center to the other and intertwines them.','interpretation':'The E/J square composes across exactly the two recorded regular edges in each branch. All bottom P/J words reach the same source endpoint, but only JJ equals the all-J upper route as an affine map. A second vertical E step and a fourth-Gear horizontal continuation are not source-admitted.'}