from research import *
p=json.loads((ROOT/'model/tradition_displacement_profiles.json').read_text()); names=p['names']; native=p['profiles']['LXX']['C_lower']; cut=names.index('Arphaxad')
s=begin(745,'Locate matched-Cainan translation blocks','Does the familiar430 cumulative alignment extend through the whole matched-state genealogy?',{'comparison':'nativeLXXON minus admittedMTON','insertion_support':'Adam throughArphaxad','cumulative_insertion':460},['File18 §§6B,6D; C739'])
matched=[d-(460 if i<=cut else 0) for i,d in enumerate(native)]; blocks=[]; start=0
for i in range(1,len(names)+1):
    if i==len(names) or matched[i]!=matched[start]:
        blocks.append({'from':names[start],'through':names[i-1],'displacement':matched[start]}); start=i
finish(s,{'matched_profile':matched,'constant_blocks':blocks},'The430 alignment is exactly theAdam-throughLamech plateau. Noah-throughArphaxad differs454, and later blocks follow their own source rows. MatchingCainan removes insertion from the comparison but does not turn the entire genealogy into one translation.','Test pointwise composition of thethree native comparisonfields with all source modes retained.',{'upper_plateau':matched[:9]==[430]*9,'next_plateau':matched[9:12]==[454]*3,'not_global':len(set(matched))>2,'boundary_change':matched[8]-matched[9]==-24})
