from research import *
s=begin(1164,'Factor the complete post-Flood triangle throughSP','Can the same source-realized composition explain early blocks and exceptional rows too?',{},['C1153','C1163'])
d=json.loads((ROOT/'model/postflood_rows.json').read_text());mt=d['MT_native_OFF'];sp=d['SP_native_OFF_official145'];lx=[r for r in d['LXX_native_ON'] if r['name']!='2nd Cainan']
tri=[]
for a,b,c in zip(mt,sp,lx):
 tri.append({'name':a['name'],'MT_to_SP':[b['b']-a['b'],b['L']-a['L']],'SP_to_LXX':[c['b']-b['b'],c['L']-b['L']],'direct_MT_to_LXX':[c['b']-a['b'],c['L']-a['L']]})
art=artifact('model/postflood_complete_source_triangle.json',json.dumps({'rows':tri,'normal_form_coordinates':['R_delta_b','A_delta_L'],'scope':'nine common named rows; native Cainan remains a separate insertion'},indent=2)+'\n')
finish(s,{'complete_source_triangle':art,'SP_to_LXX_life_changes':[r['SP_to_LXX'][1] for r in tri]},'Every common post-Flood row admits the source-realized triangle. SP andLXX share the begetting measurement, so their final edge changes only remainder and lifespan:27/27, four100s, two60s, and the unchangedShem row.','Express that final edge as a disjoint three-amplitude source pattern.',{'all_birth_edges_zero':all(r['SP_to_LXX'][0]==0 for r in tri),'composition':all([x+y for x,y in zip(r['MT_to_SP'],r['SP_to_LXX'])]==r['direct_MT_to_LXX'] for r in tri),'nine_rows':len(tri)==9})
