from collections import Counter from fractions import Fraction as Q def run(load,check): reg=load('C271_REGISTER.json');ns={r['cumulative_source']['source_index']:r for r in reg if r['branch']=='Noah'}; fs={r['cumulative_source']['source_index']:r for r in reg if r['branch']=='Flood'} rows=[] for i,n in ns.items(): for j,f in fs.items(): d=n['source_event']['BC_Nisan']-f['source_event']['BC_Nisan'] if d in [598,600,602]:rows.append({'Noah_index':i,'Flood_index':j,'width':d,'Noah':n['id'],'Flood':f['id']}) counts=Counter(r['width'] for r in rows) check('triad counts',counts=={598:4,600:6,602:4}) for r in rows:check('width rule '+str((r['Noah_index'],r['Flood_index'])),r['width']==600+r['Noah_index']-r['Flood_index']) up={j:j+2 for j in ns if j+2 in ns};down={j:j-2 for j in ns if j-2 in ns} check('partial shifts are inverses',all(down[v]==k for k,v in up.items())) check('upper and lower boundaries',[j for j in ns if j not in up]==[7,6] and set(ns)-set(down)=={2,3}) chains=[[2,4,6],[3,5,7]] check('parity chains partition',sorted(sum(chains,[]))==sorted(ns)) for chain in chains:check('chain edges '+str(chain),all(up[a]==b for a,b in zip(chain,chain[1:]))) for j in sorted(ns): for e in [Q(-1,4),Q(1,4)]: x=j+e; M=lambda x:-x;J=lambda x:2-x check(f'MJ translation j{j} phase{e}',M(J(x))==x-2 and J(M(x))==x+2) return {'triad_rows':sorted(rows,key=lambda r:(r['width'],r['Noah_index'])),'counts':dict(counts),'up_shift':up,'down_shift':down,'chains':chains,'global_Mirror_role_swapping_pairs':4,'local_J1_role_swapping_pairs':6,'formal_group':'M,J1 generate two-year translations on the ambient line','register_status':'Only partial restrictions; boundary escape prevents a global action on these finite source records.'}