from research import *
s=begin(787,'Accumulate cumulative divergence behind equal births','What complete cumulative field accompanies the aligned SP/LXX birth suffix?',{},['C743–744,C778; File18 lifespan rows'])
p=json.loads((ROOT/'model/rounding_inputs.json').read_text());l={x['name']:x['lifespan'] for x in p['native_rows']['LXX_native_ON']};sp={x['name']:x['lifespan'] for x in p['native_rows']['SP_native_OFF']};sp['2nd Cainan']=460
names=['Noah','Shem','Arphaxad','2nd Cainan','Shelah','Eber','Peleg','Reu','Serug','Nahor','Terah','Abraham']
dl=[l[n]-sp[n] for n in names]; dc=[sum(dl[i:]) for i in range(len(dl))]
out=[{'name':n,'birth_difference':0,'lifespan_difference':dl[i],'death_difference':-dl[i],'cumulative_difference':dc[i]} for i,n in enumerate(names)]
a=artifact('model/aligned_birth_divergence.json',json.dumps(out,indent=2)+'\n')
finish(s,{'field':a,'lifespan_differences':dl,'cumulative_differences':dc},'The same twelve birth labels coexist with a cumulative difference rising to574 upstream. Death differences are the negative local lifespan changes; cumulative differences are their running sums. This is a complete example of what each representation retains or forgets.','Test whether the aligned birth family survives row rounding.',{'head':dc[0]==574,'terminal':dc[-1]==0,'recover_local':all(dc[i]-dc[i+1]==dl[i] for i in range(len(dl)-1))})
