from itertools import product def run(load,read,check): reg=load('C286_DATA.json')['target_register'];old=load('PREVIOUS_DATA.json') expected={(x['center'],x['lower_record'],x['upper_record']) for x in old['labelled_pairs'] if x['roles']==['Noah birth','Noah death']} births=[(i,r) for i,r in enumerate(reg) if r['role']=='Noah birth'];deaths=[(i,r) for i,r in enumerate(reg) if r['role']=='Noah death'] hits=[];derived=[];families=[];solutions=[] for g,t in product([1,2],[0,1]): c=3188+2*(g-1)+60*t;actual=set();predicted=set() for (i,b),(j,d) in product(births,deaths): if b['center']+d['center']==2*c:actual.add((c,j,i)) cond=(b['tradition']!='MT' and d['tradition']!='MT' and b['Cainan']+d['Cainan']==1 and b['full430']+d['full430']==1 and b['Terah60']==d['Terah60']==t and b['gear']+d['gear']==2*g and int(b.get('rail')=='companion')+int(d.get('rail')=='companion')==1) if cond:predicted.add((c,j,i)) check(f'complete9216-pair rule equivalence c{c}',actual==predicted=={x for x in expected if x[0]==c}) abstract=[] for cs,ts,fs,gs,es in product(range(3),range(3),range(3),range(2,7),range(3)): if 130*cs+60*ts+215*fs+2*(gs-2)-es==344+4*(g-1)+120*t:abstract.append((cs,ts,fs,gs,es)) check(f'unique bounded context-sum solution c{c}',abstract==[(1,2*t,1,2*g,1)]) solutions.append({'center':c,'base_gear':g,'Terah60':t,'sum_solution':abstract[0]}) hits.extend(sorted(actual));derived.extend(sorted(predicted)) coords={(reg[j]['center'],reg[i]['center']) for _,j,i in actual} families.append({'center':c,'labelled_pairs':len(actual),'coordinate_pairs':len(coords),'gear_pairs':[(a,b) for a,b in product([1,2,3],repeat=2) if a+b==2*g]}) check('full128-label class and64 coordinate-center cases',len(hits)==128 and sum(r['coordinate_pairs'] for r in families)==64) check('MT cannot participate by the source range bound',max(b['center']+d['center'] for _,b in births for _,d in deaths if 'MT' in [b['tradition'],d['tradition']])==6200<6376) check('Noah base sum and context complement',3491+2541==6032 and 130+215-1==344 and 6032+344==2*3188) return {'step':'C439','comparison_count':4*len(births)*len(deaths),'families':families, 'hits':[{'center':c,'death_record':j,'birth_record':i,'death':reg[j],'birth':reg[i]} for c,j,i in hits], 'context_sum_solutions':solutions,'rule':{'Cainan_sum':1,'sojourn_F_sum':1,'Terah':'both equal center referenceT','Gear_sum':'2*center referenceg','SP_companion_count':1}, 'counts':{'role_pair_trials':36864,'abstract_context_trials':1620,'labelled_pairs':128,'coordinate_center_pairs':64}, 'limits':'Cross-context complementary endpoints, not128 Noah biographies. The companion remains SP-only; LXX labels are valid only in their declared Cainan state.'}