from research import *
s=begin(756,'Transfer the cumulative residual field to LXX','Which changed rows explain every LXX-versus-MT rounding difference?',{},['File18 LXX main rows; File51a rounding rule'])
p=json.loads((ROOT/'model/rounding_inputs.json').read_text());q=lambda n:5*((n+2)//5); fields={}
for t,rows in p['native_rows'].items():
    es=[q(x['lifespan'])-x['lifespan'] for x in rows]
    fields[t]={x['name']:{'e':es[i],'D':sum(es[i:]),'actual':1406+sum(z['lifespan'] for z in rows[i:]),'rounded':1406+sum(q(z['lifespan']) for z in rows[i:])} for i,x in enumerate(rows)}
m,l=fields['MT_native_OFF'],fields['LXX_native_ON']
support={n:l[n]['e']-m[n]['e'] for n in m if l[n]['e']!=m[n]['e']}
delta={n:l[n]['D']-m[n]['D'] for n in m if l[n]['D']!=m[n]['D']}
a=artifact('model/all_rounding_fields.json',json.dumps(fields,indent=2)+'\n')
finish(s,{'fields':a,'row_support':support,'nonzero_boundary_differences':delta},'Three LXX residual changes generate the complete comparison: Lamech+4, Arphaxad−2, Shelah−2. Their total cancels, but the Noah–Arphaxad plateau changes−4 and Shelah−2.','Test SP support and explain its changed head residual.',{'support':support=={'Lamech':4,'Arphaxad':-2,'Shelah':-2},'Cainan_zero':l['2nd Cainan']['e']==0,'head_cancellation':l['Adam']['D']==0})
