from research import *
s=begin(841,'Resolve all shared boundaries of the two festival orders','Which overlaps follow from the complete prefix sets?',{},['C839–840'])
f=json.loads((ROOT/'model/festival_forward_path.json').read_text());r=json.loads((ROOT/'model/festival_reverse_path.json').read_text())
common=sorted(set(f['prefix_counts'])&set(r['prefix_counts']))
out=[{'count':n,'years':7*n,'BC':1859-7*n,'forward_step':f['prefix_counts'].index(n),'reverse_step':r['prefix_counts'].index(n)} for n in common]
finish(s,{'shared_boundaries':out,'status':'complete dependent comparison of the two declared orders; no alternative-order search'},'The two paths share only counts0,59,140,199, producing1859,1446,879,466. Their common internal boundaries occur at different step indices, so endpoint agreement does not identify the ordered paths.','Test scaling and order as separate linear operations.',{'exact_set':common==[0,59,140,199],'internal_indices_differ':all(x['forward_step']!=x['reverse_step'] for x in out[1:-1])})
