#!/usr/bin/env python3 """Root-agent alternate source joins and integer cross-products. No independent-agent claim.""" from pathlib import Path import argparse,json,itertools p=argparse.ArgumentParser();p.add_argument('--sources',type=Path,required=True);p.add_argument('--out',type=Path,required=True);args=p.parse_args() def load(name):return json.loads((args.sources/name).read_text()) checks=[] def check(name,condition): assert condition,name assert name not in checks,name checks.append(name) reg=load('C286_DATA.json')['target_register'] def lookup(trad,role,gear,c,t,f,rail=None): rows=[r for r in reg if (r['tradition'],r['role'],r['gear'],r['Cainan'],r['Terah60'],r['full430'])==(trad,role,gear,c,t,f) and (role.startswith('Flood') or r.get('rail')==rail)] assert len(rows)==1,(trad,role,gear,c,t,f,rail) return rows[0] def center(*a):return lookup(*a)['center'] # Different traversal from the main: all ordered Shem biography states, integer equations only. contexts=list(itertools.product([0,1],repeat=3));adjacent=[] for trad,rail in [('MT',None),('LXX',None),('SP','primary'),('SP','companion')]: for c,t,f in contexts: for gb,gd in itertools.product([1,2,3],repeat=2): B=center(trad,'Shem birth',gb,c,t,f,rail);D=center(trad,'Shem death',gd,c,t,f,rail) check('Shem matrix '+str((trad,rail,c,t,f,gb,gd)),B-D==600+2*(gb-gd)) if gd==gb+1: u=center(trad,'Shem birth',gd,c,t,f,rail);v=center(trad,'Shem death',gb,c,t,f,rail) check('Shem repair '+str((trad,rail,c,t,f,gb)),300*(B-D)==299*(u-D)==299*(B-v)==299*600) adjacent.append((trad,rail,c,t,f,gb)) check('adjacent total',len(adjacent)==64) # Context controls: join source triples first, then test the linear integer equation. context_hits=[] for gear,rail,sp,mt in itertools.product([1,2,3],['primary','companion'],contexts,contexts): sprec=lambda role:center('SP',role,gear,*sp,rail) mtrec=lambda role:center('MT',role,gear,*mt) base=lambda role:center('MT',role,gear,*sp) triples=[(sprec('Noah birth'),mtrec('Noah birth'),sprec('Shem birth')),(sprec('Flood start'),mtrec('Flood start'),sprec('Shem death')),(sprec('Shem death'),mtrec('Shem death'),base('Noah death'))] ok=all(25*x-2*p==23*y for p,x,y in triples) if ok:context_hits.append((gear,rail,list(sp),list(mt))) main_hits=[(r['gear'],r['rail'],r['SP_context'],r['MT_input_context']) for r in load('C357_DATA.json')['hits']] check('context result agrees by independent join',sorted(context_hits,key=str)==sorted(main_hits,key=str) and len(context_hits)==6) # Reconstruct each primary endpoint diagram directly from the register. primary=[];phase_joined=phase_squared=0 for gear,i in [(1,3),(2,5)]: N=center('SP','Noah birth',gear,0,0,1,'primary');S=center('SP','Shem birth',gear,0,0,1,'primary');T=center('SP','Shem death',gear,0,0,1,'primary');P=center('SP','Flood start',gear,0,0,1) M=center('MT','Noah birth',gear,1,1,1);R=center('MT','Flood start',gear+1,1,1,1);V=center('MT','Flood start',gear,1,1,1) W=center('MT','Shem death',gear,1,1,1);Z=center('MT','Noah death',gear,0,0,1);H=center('MT','Shem birth',gear,0,0,1);L=center('MT','Shem death',gear,0,0,1);A=center('MT','Shem death',gear+1,1,1,1) check('three E placements '+str(i),25*M-2*N==23*S and 25*V-2*P==23*T and 25*W-2*T==23*Z) check('joined endpoints '+str(i),23*S==25*M-2*N and 299*(T-S)==300*(R-M)) check('source partition '+str(i),(N-M,M-R,N-S,S-T,N-T)==(460,598,500,600,1100)) check('total weighted ratio '+str(i),529*(N-T)==550*(N-R)) check('Shem rectangle '+str(i),(S-T,T-H,H-L)==(600,50,600) and S-H==T-L==650) check('squared endpoints '+str(i),529*L==625*A-96*S and S-A==1058 and S-L==1250) check('translation source identities '+str(i),S==N-500 and A==R-500 and L==center('MT','Flood start',gear,0,0,1)-500) midpoint_numerator=25*A-2*S check('formal midpoint has no source '+str(i),midpoint_numerator%23==0 and not any(23*r['center']==midpoint_numerator for r in reg)) for sn,sm,sr,ss,st in itertools.product([-1,1],repeat=5): # Four-times coordinates eliminate all phase fractions. n,m,r,s,t=4*N+sn,4*M+sm,4*R+sr,4*S+ss,4*T+st ok=23*s==25*m-2*n and 299*(t-s)==300*(r-m) check('joined phase integer '+str((i,sn,sm,sr,ss,st)),ok==(sn==sm==sr==ss==st));phase_joined+=ok for sp,sa,sl in itertools.product([-1,1],repeat=3): pp,aa,ll=4*S+sp,4*A+sa,4*L+sl;ok=529*ll==625*aa-96*pp check('squared phase integer '+str((i,sp,sa,sl)),ok==(sp==sa==sl));phase_squared+=ok primary.append({'i':i,'Noah':N,'MT_Noah':M,'Flood':R,'SP_Shem_birth':S,'SP_Shem_death':T,'MT_Shem_birth':H,'MT_Shem_death':L,'restored_next_Shem_death':A}) check('phase totals',phase_joined==phase_squared==4) # Selector verification never uses the residual formula from the main. joined_hits=[];squared_hits=[];local_hits=[] for r in load('C319_DATA.json')['rows']: n=r['n'];rr=r['R'];spn=[x for x in reg if x['tradition']=='SP' and x['role']=='Noah birth' and x['Cainan']==x['Terah60']==0 and x['full430']==1 and x['center']==n][0] g=spn['gear'];rail=spn['rail'];m=center('MT','Noah birth',g,1,1,1);s=center('SP','Shem birth',g,0,0,1,rail);t=center('SP','Shem death',g,0,0,1,rail);d=center('MT','Shem death',g,0,0,1);a=rr-500 key=f"{r['a']}{r['b']}:i{r['i']}" exact_joined=23*s==25*m-2*n and 299*(t-s)==300*(rr-m) input_exists=any(x['tradition']=='MT' and x['role']=='Shem death' and x['Cainan']==x['Terah60']==x['full430']==1 and x['center']==a for x in reg) exact_squared=input_exists and 529*d==625*a-96*s if r['joint_admitted'] and exact_joined:joined_hits.append(key) if r['joint_admitted'] and exact_squared:squared_hits.append(key) if r['joint_admitted'] and rail=='primary':local_hits.append(key) check('selector equivalence '+key,exact_joined==(rail=='primary' and r['b']==2)) check('selector source outcomes',sorted(joined_hits)==load('C360_DATA.json')['survivors']==sorted(squared_hits)==load('C362_DATA.json')['source_survivors']) check('local pattern not selector',sorted(local_hits)==load('C358_DATA.json')['survivors']['local'] and len(local_hits)==9) check('physical joined pair crossproduct',625-598==27 and 625*23==25*299+300*23) # Last equation above: width=(25/23+300/299)/4, expressed without fractions. check('physical squared error numerator',625-529==96 and 96==4*24) result={'status':'passed','method':'Root-agent second implementation using independent source joins and integer cross-products, no imported main calculations','new_independent_agent_review':False,'check_count':len(checks),'checks':checks,'adjacent_shem_inputs':len(adjacent),'three_row_context_hits':context_hits,'primary_endpoint_reconstructions':primary,'joined_selector_survivors':sorted(joined_hits),'squared_selector_survivors':sorted(squared_hits),'phase_joined_passes':phase_joined,'phase_squared_passes':phase_squared,'counts_are_not_independent_witnesses':True} args.out.mkdir(parents=True,exist_ok=True);(args.out/'ROOT_SECOND_METHOD_RESULTS.json').write_text(json.dumps(result,ensure_ascii=False,indent=2)+'\n');print(json.dumps({'status':'passed','check_count':len(checks)}))