from research import *
s=begin(863,'Derive the local generator of the NT–MT field','Does a terminal value plus every local difference reconstruct the whole comparison?',{},['C862 complete named field'])
f=json.loads((ROOT/'model/NT_MT_field.json').read_text())
edges=[]
for a,b in zip(f,f[1:]):
 nt=a['NT']-b['NT']; mt=a['MT_rounded']-b['MT_rounded']
 edges.append({'from':a['name'],'to':b['name'],'NT_edge':nt,'MT_edge':mt,'difference':nt-mt})
reconstructed=[f[-1]['G']]
for e in reversed(edges):reconstructed.insert(0,reconstructed[0]+e['difference'])
a=artifact('model/NT_MT_edge_generator.json',json.dumps({'terminal':1710,'edges':edges,'reconstructed':reconstructed},indent=2)+'\n')
finish(s,{'generator':a,'Cainan_contraction':edges[11],'Noah_edge':edges[9]},'All 22 differences are generated by G_i−G_next=NT_edge−MT_edge and terminal1710. The sole 140-year NT shared-name edge records the intervening Cainan; the Noah edge explains the −430 local change.','Restore the admitted MT Cainan explicitly and compare the two edge measures.',{'all_reconstructed':reconstructed==[r['G'] for r in f],'unique_double_edge':[e['from'] for e in edges if e['NT_edge']==140]==['Arphaxad'],'Noah':edges[9]['difference']==-430})
