from itertools import product from collections import Counter, defaultdict import hashlib def run(load,read,check): for n in range(470,477): check(f'C{n}_certificate',hashlib.sha256(read(f'C{n}_DATA.json').encode()).hexdigest()==load(f'C{n}_CERTIFICATE.json')['data_sha256']) old=load('C286_DATA.json')['target_register'] def norm(r):return (r['tradition'],r['role'],r['gear'],r['Cainan'],r['Terah60'],r['full430'],r.get('rail'),r['center']) # Regenerate the normalized labelled grid from the controlling source bases. bases={'Noah birth':2841,'Noah death':1891,'Shem birth':2341,'Shem death':1741,'Flood start':2241,'Flood close':2240} records=[] for tr,role,g,C,T,F in product(['MT','SP','LXX'],bases,range(1,4),range(2),range(2),range(2)): rails=['primary','companion'] if tr=='SP' and not role.startswith('Flood') else [None] for rail in rails: x=bases[role]+650*(tr!='MT')+2*(g-1)+130*C+60*T+215*F-(rail=='companion') records.append((tr,role,g,C,T,F,rail,x)) check('regenerated_all528_labels',len(records)==528 and Counter(records)==Counter(map(norm,old))) coords={r[-1] for r in records};at=defaultdict(list) for r in records:at[r[-1]].append(r) check('373_coordinate_domain',len(coords)==373) p1150=sorted((x,x+1150) for x in coords if x+1150 in coords) p1250=sorted((x,x+1250) for x in coords if x+1250 in coords) check('C470_pair_and_label_counts',len(p1150)==51 and sum(len(at[a])*len(at[b]) for a,b in p1150)==101) check('C472_pair_and_label_counts',len(p1250)==74 and sum(len(at[a])*len(at[b]) for a,b in p1250)==130) menu=set(load('C450_DATA.json')['pivots']) # Recover the pivot from each input/output interval, reversing the forward sweep. recovered=[] for (a,b),(c,d) in product(p1150,p1250): twice_p=25*a-23*c if twice_p%2==0 and twice_p//2 in menu and 25*b-23*d==twice_p: recovered.append((a,b,twice_p//2,c,d)) expected=sorted((z['input_pair'][0],z['input_pair'][1],z['second_pivot'],z['output_pair'][0],z['output_pair'][1]) for z in load('C470_DATA.json')['admitted_expansions']) check('reverse_enumeration_three_expansions',sorted(recovered)==expected and len(recovered)==3) check('residue_count16_integer_pairs',sum((a-p)%23==0 for a,b in p1150 for p in menu)==16) ancestors=[] for a,b,q,c,d in recovered: for p in menu: u,v=23*a+2*p,23*b+2*p if u%25==v%25==0 and u//25 in coords and v//25 in coords: ancestors.append((u//25,v//25,p,a,b,q,c,d)) check('single_complete_2K_ancestry',ancestors==[(2148,3206,3620,2020,3170,2756,1956,3206)]) # Confirm the output labels share exactly the claimed MT/SP-or-LXX Shem context. for a,b,p,c,d in recovered: labels=[(lo,hi) for lo in at[c] for hi in at[d]] check(f'output_{c}_{d}_Shem_context',len(labels)==2 and all(lo[:2]==('MT','Shem death') and hi[0] in ('SP','LXX') and hi[1]=='Shem birth' and lo[2:6]==hi[2:6] and hi[6]!='companion' for lo,hi in labels)) # Assign the 130 labels by disjoint role and rail signatures, then verify contexts. classes=Counter();full_pairs=set() for a,b in p1250: for lo,hi in product(at[a],at[b]): delta=tuple(hi[j]-lo[j] for j in range(2,6)) if lo[:2]==('MT','Shem death') and hi[1]=='Shem birth': k='A';wanted=(0,0,0,0) elif lo[:2]==('MT','Flood close'): k='B';wanted=(0,0,0,0) elif lo[:2]==('MT','Flood start'): k='C';wanted=(0,0,0,0) elif lo[:2]==('MT','Noah death') and hi[1]=='Noah birth': k='D';wanted=(-2,-1,0,-1) elif lo[:2]==('MT','Noah death') and hi[1]=='Shem birth': k='E';wanted=(-2,0,-1,1) elif lo[:2]==('SP','Shem death') and lo[6]=='companion': k='F';wanted=(2,-1,1,1) else: k='G';wanted=(-2,0,-1,1) assert delta==wanted,(lo,hi,k) classes[k]+=1;full_pairs.add((lo,hi,k)) old_pairs={(norm(old[z['lower_record']]),norm(old[z['upper_record']]),z['family'][0]) for z in load('C472_DATA.json')['label_pairs']} check('all130_classified_pairs_match',full_pairs==old_pairs) check('seven_family_counts',classes==Counter({'A':48,'B':24,'C':48,'D':2,'E':2,'F':2,'G':4})) context_triplets=[] for g,C,T,F in product(range(1,4),range(2),range(2),range(2)): delta=2*(g-1)+130*C+60*T+215*F A=(1741+delta,2991+delta);B=(2240+delta,3490+delta);Cpair=(2241+delta,3491+delta) assert A in p1250 and B in p1250 and Cpair in p1250 context_triplets.append((A,B,Cpair)) check('24_triplets_500_and499',len(context_triplets)==24 and all(tuple(v+500 for v in a)==c and tuple(v+499 for v in a)==b for a,b,c in context_triplets)) for z in load('C473_DATA.json')['translated_E_tests']: a,b=z['translated_input'];c,d=z['translated_output'];p=z['required_translated_pivot'] check(f'translated_E_{a}_{b}',25*a-2*p==23*c and 25*b-2*p==23*d and a in coords and b not in coords and c in coords and d in coords and p not in coords) # Direct polynomial coefficients and integer quotients, without Fraction or E iteration. profile_count=0;supported=[] for row in load('C475_DATA.json')['inherited_ladder_comparisons']: N=row['Noah_upper'];H=N-500 for p in row['profiles']: a,b=p['pivots'];x,y=map(int,p['stages'][0]);midnums=[25*x-2*a,25*y-2*a];outnums=[625*x-50*a-46*b,625*y-50*a-46*b] assert all(v%23==0 for v in midnums) and all(v%529==0 for v in outnums) stages=[[x,y],[v//23 for v in midnums],[v//529 for v in outnums]] effective=H if p['name'].startswith('Shem') else N ok=all(v in coords for s in stages for v in s) and a in coords and b in coords check(f'profile_{N}_{p["name"]}',50*a+46*b==96*effective and stages==[list(map(int,s)) for s in p['stages']] and ok==p['fully_sourced']) profile_count+=1 if ok:supported.append((N,p['name'])) check('sixteen_profiles_five_sourced',profile_count==16 and len(supported)==5) check('C474_translated_and_held_coefficients',50*4120+46*3256==96*3706) gate_summary={rail:Counter() for rail in ['primary','companion']};endpoint_rows=[] for z in load('C476_DATA.json')['rows']: h=z['upper'];seq=[h-1058,h-1150,h-1250];actual=[v in coords for v in seq] check(f'held_family_{h}',seq==z['lower_path'] and actual==[bool(z['record_indices'][k]) for k in ['input','middle','final']] and all(actual)==z['two_sourced_E_steps']) gate_summary[z['rail']].update({'inputs':actual[0],'middles':actual[1],'finals':actual[2],'complete':all(actual)}) if actual[0] and actual[2]:endpoint_rows.append(z) check('primary_counts4_24_24_4',gate_summary['primary']==Counter(inputs=4,middles=24,finals=24,complete=4)) check('companion_counts5_0_24_0',dict(gate_summary['companion'])==dict(inputs=5,middles=0,finals=24,complete=0)) # Regenerate the 48 cumulative coordinates independently from the six base bands. cr=[] for C,role,base in [(0,'Shem',-5890),(0,'Flood',-5290),(1,'Shem',-6350),(1,'Flood',-5750),(0,'Noah birth',-6840),(1,'Noah birth',-7300)]: for i in range(8):cr.append((C,role,i,base+i)) frozen=load('C365_DATA.json')['cumulative_register'] check('regenerated48_cumulative_records',set(cr)=={(z['Cainan'],z['role'],z['annual_index'],z['coordinate']) for z in frozen}) cc={z[-1] for z in cr};mirror=[] for z in endpoint_rows: for A in [-2639,-2635]: h=z['upper'];a=A-h;seq=[A-v for v in z['lower_path']] assert 23*seq[1]==25*seq[0]-2*a and 23*seq[2]==25*seq[1]-2*a mirror.append((h,A,a in cc and seq[0] in cc,seq[1] in cc,seq[2] in cc)) expected={(z['regular_upper'],z['exchange_constant'],z['complete_input_image'],bool(z['cumulative_record_indices']['middle']),bool(z['cumulative_record_indices']['final'])) for z in load('PREVIOUS_DATA.json')['trials']} check('all18_Mirror_trials_match',set(mirror)==expected and len(mirror)==18) check('Mirror5_initial0_middle2_isolated_finals',sum(z[2] for z in mirror)==5 and sum(z[3] for z in mirror)==0 and sum(z[4] for z in mirror)==2 and not any(z[2] and z[4] for z in mirror)) audit=load('PRE_C478_SEALED_AUDIT.json') check('eight_packets24_publications',audit['status']=='passed' and audit['completed_steps']==list(range(470,478)) and audit['published_files']==24 and audit['standing_controls_unchanged']) return {'step':'C478','method':'Different root-agent implementation: normalized source regeneration, reverse interval-to-pivot enumeration, disjoint label signatures, direct integer polynomial evaluation, regenerated cumulative bands and sealed-byte audit. Not an independent-agent review.','regenerated_labels':528,'regenerated_coordinates':373,'interval_counts':{'1150':51,'1250':74},'reverse_pivot_hits':recovered,'complete_2K_ancestry':ancestors,'1250_label_classes':dict(sorted(classes.items())),'source_triplets':24,'factorization_profiles':profile_count,'fully_sourced_profiles':supported,'held_family_summary':{k:dict(v) for k,v in gate_summary.items()},'regenerated_cumulative_records':48,'Mirror_trial_count':18,'sealed_audit':audit,'discrepancies':[],'canonical_or_graph_edits':False}