from research import *
s=begin(1234,'Reconstruct the full MT path to Moses','Does ordered row rounding generate the entire selected birth field?',{},['C1233','model/complete_source_row_packet.json','File51a §3.1'])
def Q(x):return 5*((x+2)//5)
d=json.loads((ROOT/'model/complete_source_row_packet.json').read_text());edges=[{'name':r['name'],'actual':r['b_ledger'],'rounded':Q(r['b_ledger'])} for r in d['MT']]+[{'name':n,'actual':x,'rounded':Q(x)} for n,x in [('Abraham',100),('Isaac',60),('Jacob',91),('Joseph',39),('Entry',350)]]
out=[]
for i,e in enumerate(edges):
 out.append(dict(e,next=edges[i+1]['name'] if i+1<len(edges) else 'Moses',actual_BC=1526+sum(x['actual'] for x in edges[i:]),rounded_BC=1526+sum(x['rounded'] for x in edges[i:])))
out.append({'name':'Moses','actual_BC':1526,'rounded_BC':1526})
a=artifact('model/Moses_MT_complete_path.json',json.dumps({'rows':out,'actual_total':sum(e['actual'] for e in edges),'rounded_total':sum(e['rounded'] for e in edges),'source_state':'strictShem+2excluded;Terah70;CainanOFF','mechanism':'round each selected interval, then accumulate toMoses1526'},indent=2)+'\n')
finish(s,{'complete_path':a,'nodes':len(out),'head_actual':out[0]['actual_BC'],'head_rounded':out[0]['rounded_BC']},'The complete25-node path generates strictActual4112 and Rounded4106 at Adam, withMoses1526 held. Its2580 span is obtained from the source intervals rather than inserted as a target.','Compare every one of the23 named source births with the literal table.',{'25nodes':len(out)==25,'heads':[out[0]['actual_BC'],out[0]['rounded_BC']]==[4112,4106],'total2580':sum(e['rounded'] for e in edges)==2580})
