Evidence

verify babylonian.py

Download source fileOpen in research workspace
"""Independent exact replay of the Babylonian/Shem/70-grid model files.

This checker does not import root research code or modify the journal. Original
durations are independently reversed with divmod. Verification groups are not
independent discoveries. Run from any cwd; output is beside this script.
"""
from pathlib import Path
from fractions import Fraction as F
import hashlib
import json

BASE = Path(__file__).resolve().parents[1]
CHECKS=[]
CHECKED=[]

def enc(x):
    if isinstance(x,F): return x.numerator if x.denominator==1 else str(x)
    if isinstance(x,dict): return {str(k):enc(v) for k,v in x.items()}
    if isinstance(x,(list,tuple)): return [enc(v) for v in x]
    return x

def ck(name,actual,expected=True):
    actual,expected=enc(actual),enc(expected)
    CHECKS.append({'name':name,'actual':actual,'expected':expected,'pass':actual==expected})

def verify_model(name,expected,subset=False):
    value=json.loads((BASE/'model'/f'{name}.json').read_text())
    if subset:value={k:value.get(k) for k in expected}
    CHECKED.append(name+'.json')
    ck('model/'+name,value,expected)

def rev(n):
    assert isinstance(n,int) and n>0
    scale=1
    while n%10==0:n//=10;scale*=10
    out=0
    while n:
        n,d=divmod(n,10)
        out=10*out+d
    return out*scale

def path(anchor,legs):
    out=[anchor]
    for n in legs:out.append(out[-1]+rev(n))
    return out

def key(q,x,r=F(70,69)):return F(q)+r*(x-q)
def legs(p):return [a-b for a,b in zip(p,p[1:])]

def main():
    # Independent declared source coordinates, not copied from root model values.
    C,Flood,Q,N,R,B,J,X=13396,4716,1406,6,536,606,586,1446
    sp_source=[Q,Flood,Flood+600,C]
    source_legs=[b-a for a,b in zip(sp_source,sp_source[1:])]
    sp2=path(Q,source_legs)
    sp3=path(N,[Q-N]+source_legs)
    lx2=path(Q,[3236-Q,5486-3236])
    lx3=path(N,[Q-N,3236-Q,5486-3236])
    sr3=path(N,[1400,3106-Q,4406-3106])
    H2,H3,D2,D3=lx2[-1],lx3[-1],sp2[1],sp3[2]
    S2,S3=sp2[2],sp3[3]
    ck('independent spine outputs',[H2,H3,D2,D3,S2,S3,sp2[-1],sp3[-1]],
       [10436,13136,2736,5436,3336,6036,11416,14116])
    verify_model('babylonian_inputs',{
      'LXX_regular_head_conquest':H2,'LXX_regular_head_nativity':H3,
      'SP_inverse_cumulative_Flood_conquest':D2,'SP_inverse_cumulative_Flood_nativity':D3,
      'MT_cumulative_Shem_birth':4836+600,'Babylon_start':B,
      'Jerusalem_destruction':J,'restoration':R,'Exodus':X,'Conquest':Q,'Nativity':N,
      'MT_cumulative_Creation':14006,'MT_regular_Creation':4106,
      'SP_regular_inverse_head_nativity':sr3[-1],'SP_regular_Fall':4406})
    p2,p3=[H2,D2,R],[H3,D3,R]
    verify_model('babylonian_paths',{
      'conquest_stage':{'nodes':p2,'legs':legs(p2),'total':H2-R},
      'nativity_stage':{'nodes':p3,'legs':legs(p3),'total':H3-R},
      'identities':[sum(legs(p2))==H2-R,sum(legs(p3))==H3-R]})
    verify_model('stage_rectangle',{'low_edge':[H2,D2],'high_edge':[H3,D3],
      'endpoint_displacements':[H3-H2,D3-D2],'lengths':[H2-D2,H3-D3]})
    mt_pair,sp_pair,lx_pair=[14006,4106],[sr3[-1],4406],[H2,R]
    verify_model('interval_9900',{'MT':mt_pair,'SP':sp_pair,'LXX_Babylon':lx_pair,
      'MT_to_SP':sp_pair[0]-mt_pair[0],'MT_to_LXX':lx_pair[0]-mt_pair[0],
      'lengths':[p[0]-p[1] for p in (mt_pair,sp_pair,lx_pair)]})
    ck('9900 complete pair MT to SP',[v+300 for v in mt_pair],sp_pair)
    ck('9900 complete pair MT to LXX',[v-3570 for v in mt_pair],lx_pair)
    verify_model('exile_key',{'held_node':D3,'endpoints':[B,R],
      'radii':[D3-B,D3-R],'units70':[F(D3-B,70),F(D3-R,70)],'endpoint_gap':B-R})
    alt=key(R,D3,F(69,70))
    verify_model('fixed_total_cuts',{'outer':[H3,R],'named_cut':D3,
      'alternative_cut':alt,'alternative_check':H3-7770,'cut_displacement':D3-alt,
      'leg_pairs':[[H3-D3,D3-R],[H3-alt,alt-R]]},subset=True)
    verify_model('two_70_operations',{
      'local_key':{'held':D3,'moving_endpoint':[B,R],'radius':[D3-B,D3-R],
                   'whole_total':[H3-B,H3-R]},
      'repartition':{'held_outer':[H3,R],'moving_cut':[D3,alt],
                     'legs':[[H3-D3,D3-R],[H3-alt,alt-R]],'whole_total':[H3-R,H3-R]}},subset=True)
    verify_model('SP_Shem_path',{'source_nodes':sp_source,'source_legs':source_legs,
      'inverse_nodes':sp2,'shifts':[a-b for a,b in zip(sp2[1:],sp_source[1:])]})
    # Source roles: native rounded LXX Shem birth=3336, lifetime=600.
    lxx_shem_birth,lxx_shem_life=3336,600
    verify_model('Shem_whole_edge',{
      'SP_inverse_cumulative_life':[S2,D2],
      'LXX_regular_life':[lxx_shem_birth,lxx_shem_birth-lxx_shem_life],
      'SP_original_cumulative_life':[Flood+600,Flood],
      'translation':D2-Flood,'length':S2-D2},subset=True)
    verify_model('three_MSS_junction',{
      'Conquest_stage':{'LXX_head':H2,'SP_inverse_Shem':S2,'SP_inverse_Flood_and_LXX_Shem_death':D2},
      'Nativity_stage':{'LXX_head':H3,'SP_inverse_Shem':S3,'SP_inverse_Flood_and_MT_cum_Shem':D3},
      'preserved_edges':[H2-S2,S2-D2,H2-D2],
      'translated_edges':[H3-S3,S3-D3,H3-D3]})
    source_off=5496-130
    verify_model('named_partition_key',{'anchor':R,'input':source_off,
      'output':key(R,source_off),'reciprocal':key(R,D3,F(69,70)),
      'radii':[source_off-R,D3-R],
      'whole_paths':[[H3,source_off,R],[H3,D3,R]]})
    p=[D2,X,J]
    verify_model('exodus_destruction_path',{'nodes':p,'legs':legs(p),
      'units430':[F(x,430) for x in legs(p)],'total':D2-J,'total430':F(D2-J,430)})
    grid_nodes=[B,1866,source_off,D3,H3,sp3[-1]]
    verify_model('restoration70_grid',{'origin':R,'unit':70,
      'nodes':{str(v):F(v-R,70) for v in grid_nodes}},subset=True)
    if (BASE/'model/12600_common_refinement.json').exists():
        common=[H3,D3,1866,R]
        verify_model('12600_common_refinement',{'nodes':common,'legs':legs(common),
          'units70':[F(v,70) for v in legs(common)],'upper_merge':H3-1866,
          'lower_merge':D3-R,'total':H3-R})

    # Domain checks: a moving cut with two fixed outer endpoints is a local
    # operation on the cut, not an affine transformation of every path node.
    ck('fixed source actual no-Cainan comparison',source_off,5366)
    ck('local forward key at Shem',key(D3,B),R)
    ck('local reciprocal at Shem',key(D3,R,F(69,70)),B)
    ck('source-appointed cut forward key',key(R,source_off),D3)
    ck('signed cut reciprocal displacement',key(R,D3,F(69,70))-D3,-70)
    ck('fixed total after cut move',sum([H3-source_off,source_off-R]),H3-R)
    ck('global affine image of outer LXX head',key(R,H3),F(306328,23))
    ck('global key cannot keep outer head fixed',key(R,H3)==H3,False)
    ck('Covenant Key image of middle junction',key(1866,D3,F(25,23)),F(132168,23))
    ck('Covenant Key junction displacement',key(1866,D3,F(25,23))-D3,F(7140,23))
    ck('Covenant head key',key(1866,H3,F(25,23)),sp3[-1])
    ck('two-stage Babylonian local key exact miss',key(D2,B),F(13228,23))
    ck('two-stage image is not restoration',key(D2,B)==R,False)
    ck('70 grid Covenant law',19+(180-19)*F(25,23),194)
    ck('Covenant source spans',[H3-1866,sp3[-1]-1866],[70*161,70*175])
    ck('same fixed junction spans',[H3-D3,sp3[-1]-D3],[70*110,70*124])
    ck('Babylonian destruction divisions',[B-J,J-R,B-R],[20,50,70])
    ck('SP inverse Flood Babylonian radii',[D2-B,D2-J,D2-R],[2130,2150,2200])
    ck('Enochian tail',D2-N,F(15,2)*364)
    ck('Enochian tail other registers',[39*70,21*130],[2730,2730])
    ck('Enochian tail versus stage shift',(D2-N)-(H3-H2),30)
    ck('File29 actual MT +60 Year6 counterpart',4176-X,D2-N)
    ck('first-stage 70 grid',[F(D2-N,70),F(H2-N,70),F(sp2[-1]-N,70)],[39,149,163])
    ck('stage and anchor net increment',(H3-H2)-(R-N),31*70)
    ck('other selected 70-grid coordinates',
       {str(v):F(v-R,70) for v in (J,Q,X,N)},
       {'586':F(5,7),'1406':F(87,7),'1446':13,'6':F(-53,7)})

    evidence=BASE/'evidence/File29.md'
    data=evidence.read_bytes()
    ck('File29 frozen source SHA',hashlib.sha256(data).hexdigest(),
       '0066d07fd7bf2db4faaf79368833880e98b1900c52666903892673718f131421')
    text=data.decode('utf-8')
    ck('File29 explicitly names source state','File_25 LXX Year-6 / 2Cainan-removed Decimal Invariance coordinate' in text)
    ck('File29 records independent no-Cainan rail','5366 − 4456 = 910' in text)
    ck('File29 records Enochian counterpart','4176 − 1446 = 2730' in text)
    binding_path=BASE/'model/source_bindings.json'
    if binding_path.exists():
        bindings=json.loads(binding_path.read_text())
        for filename,record in bindings.items():
            bound=BASE/'evidence'/filename
            ck('bound evidence exists: '+filename,bound.is_file())
            if bound.is_file():
                payload=bound.read_bytes()
                ck('bound source bytes and SHA: '+filename,
                   [len(payload),hashlib.sha256(payload).hexdigest()],
                   [record['bytes'],record['sha256']])
        CHECKED.append('source_bindings.json')
    present=sorted(p.name for p in (BASE/'model').glob('*.json'))
    non_arithmetic={'babylonian_kernel.json','claim_ledger_first50.json'}
    return [name for name in present if name not in CHECKED and name not in non_arithmetic]

try:
    additional=main()
except Exception as exc:
    ck('verification execution',type(exc).__name__+': '+str(exc),'successful replay')
    additional=[]
failed=[c for c in CHECKS if not c['pass']]
result={'status':'PASS' if not failed else 'FAIL','grouped_check_count':len(CHECKS),
  'failed_check_count':len(failed),'models_checked':CHECKED,
  'additional_model_files_not_checked':additional,
  'non_arithmetic_models':['babylonian_kernel.json','claim_ledger_first50.json'],
  'scope':'Independent exact arithmetic replay of fixed source pairs, Babylonian paths, local cut/Key domain, Shem incidence and named70-grid. Verification count is not independent evidence.',
  'method':'Fraction arithmetic and integer divmod decimal reversal of original durations only; no parent research import or journal edit.',
  'checks':CHECKS}
Path(__file__).with_name('babylonian_root_verification.json').write_text(json.dumps(result,indent=2,ensure_ascii=False)+'\n')
print(json.dumps({k:result[k] for k in ('status','grouped_check_count','failed_check_count','additional_model_files_not_checked')}))
if failed:
    for item in failed:print(json.dumps(item))
    raise SystemExit(1)

Linked sources and evidence

Edition and provenance

verify_babylonian.py

SHA-256 fdfbcb850751f50ca2e44f36f8ea904fd3d1809f4633d598b46ff00b22b9c1e3

C480–C1634/Research_Cycles/C1483_C1582/c1483_c1582/agents/verify_babylonian.py