from fractions import Fraction from collections import defaultdict import hashlib def run(load,read,check): check('C429_data_certificate',hashlib.sha256(read('C429_DATA.json').encode()).hexdigest()==load('C429_CERTIFICATE.json')['data_sha256']) check('C434_report_certificate',hashlib.sha256(read('C434_REPORT.md').encode()).hexdigest()==load('C434_CERTIFICATE.json')['report_sha256']) r=load('C286_DATA.json')['target_register'];ix=defaultdict(list) for i,z in enumerate(r):ix[z['center']].append(i) menu=load('C450_DATA.json')['pivots'] def E(h,x):return Fraction(25*x-2*h,23) def profile(name,inputs,pivots): stages=[list(map(Fraction,inputs))] for p in pivots:stages.append([E(p,x) for x in stages[-1]]) return {'name':name,'pivots':pivots,'stages':[[str(v) for v in s] for s in stages],'pivot_record_indices':[ix.get(p,[]) for p in pivots],'stage_record_indices':[[ix.get(int(v),[]) if v.denominator==1 else [] for v in s] for s in stages],'all_points_sourced':all(v.denominator==1 and int(v) in ix for s in stages for v in s),'all_pivots_sourced':all(p in ix for p in pivots),'pivots_in_active_menu':all(p in menu for p in pivots),'fully_sourced':all(p in ix for p in pivots) and all(v.denominator==1 and int(v) in ix for s in stages for v in s)} rows=[] inherited=load('C429_DATA.json')['complete_fixed_pivot_E2_ladders'] check('four_inherited_upper_coordinates',sorted(x['held_upper'] for x in inherited)==[3491,3493,3706,3708]) for old in inherited: N=old['held_upper'];H=N-500;p=N-86;q=N-950 ps=[profile('inherited_Noah_held',[N-1058,N],[N,N]),profile('Shem_held_partner',[H-1058,H],[H,H]),profile('Shem_split_partner',[H-1058,H],[p,q]),profile('Noah_translated_split',[N-1058,N],[p+500,q+500])] check(str(N)+'_inherited_ladder',old['input_lower']==N-1058 and old['E_intermediate']=={'numerator':N-1150,'denominator':1} and old['output']=={'numerator':N-1250,'denominator':1} and ps[0]['fully_sourced']) check(str(N)+'_weighted_pivot_identity',25*p+23*q==48*H) for x in [0,1,H-1058,H]:check(str(N)+'_Shem_affine_equality_'+str(x),E(q,E(p,x))==E(H,E(H,x))) for x in [0,1,N-1058,N]:check(str(N)+'_Noah_affine_equality_'+str(x),E(q+500,E(p+500,x))==E(N,E(N,x))) check(str(N)+'_Shem_split_explicit_stages',ps[2]['stages']==[[str(H-1058),str(H)],[str(H-1186),str(H-36)],[str(H-1250),str(H)]]) rows.append({'Noah_upper':N,'Shem_upper':H,'split_pivots':[p,q],'profiles':ps}) allps=[p for z in rows for p in z['profiles']] complete=[{'Noah_upper':z['Noah_upper'],'profile':p['name'],'active_menu':p['pivots_in_active_menu']} for z in rows for p in z['profiles'] if p['fully_sourced']] check('five_fully_sourced_profiles',len(complete)==5) check('only3706_Shem_split_complete',[(z['Noah_upper'],p['name']) for z in rows for p in z['profiles'] if p['fully_sourced'] and p['pivots_in_active_menu']]==[(3706,'Shem_split_partner')]) coords=sorted({int(Fraction(v)) for p in allps for s in p['stages'] for v in s}|{h for p in allps for h in p['pivots']}) return {'step':'C475','inherited_ladder_comparisons':rows,'fully_sourced_profiles':complete,'source_resolution':[{'coordinate':x,'record_indices':ix.get(x,[]),'records':[r[i] for i in ix.get(x,[])]} for x in coords],'counts':{'inherited_ladders':len(rows),'profiles':len(allps),'fully_sourced_profiles':len(complete),'fully_sourced_active_menu_profiles':sum(p['fully_sourced'] and p['pivots_in_active_menu'] for p in allps)},'domain_note':'Only the four authenticated C429 complete held ladders and their specified formal partners; no new pivot or date admitted.'}