from research import *
s=begin(773,'Recover all four Terah birth states','Does the finite rule reproduce each literal birth/death/begetting combination?',{},['File18 lines643–648'])
import re
p=json.loads((ROOT/'model/variant_inputs.json').read_text());literal=p['convenience_tables']['MT_LXX_Terah_regular_four_states']['rows'];out=[]
for so,te in [(0,0),(0,1),(1,0),(1,1)]:
    birth=2021+215*so+60*te; b=70+60*te
    out.append([birth,birth-205,b,birth-b])
expected=[]
for row in literal:
    z=row['cells'];bd=[int(n) for n in re.findall(r'\d+',z[1])];expected.append(bd+[int(z[2]),int(re.search(r'\d+',z[3]).group())])
finish(s,{'generated':out,'literal':expected},'All four Terah states follow one supported birth shift with lifespan205 retained. Abraham is insensitive to the Terah switch but responds to the Sojourn placement.','Recover all four inserted-Cainan states without applying its own insertion twice.',{'literal_match':out==expected})
