from research import *
s=begin(887,'Verify the anchored order law on a complete source field','Do both compositions preserve the same interval pattern while shifting placement?',{},['C878 complete File46 field','C886'])
heads=[r['head'] for r in json.loads((ROOT/'model/File46_full_head_image.json').read_text())]
def D(k,a,x):return a+k*(x-a)
rows=[{'head':x,'left':D(E,14006,D(P,4836,x)),'right':D(P,4836,D(E,14006,x))} for x in heads]
for r in rows:r['difference']=r['left']-r['right']
edge_checks=[(a['left']-b['left'],a['right']-b['right'],E*P*(a['head']-b['head'])) for a,b in zip(rows,rows[1:])]
art=artifact('model/complete_anchor_order_field.json',json.dumps(clean(rows),indent=2)+'\n')
finish(s,{'field':art,'number_of_heads':len(rows),'common_difference':rows[0]['difference']},'The complete five-head diagnostic has the same scaled gaps in both orders and the same constant displacement at every head. Anchor order changes placement; intermediate divisibility changes domain. These are separate mechanisms.','Relate the NT return family directly to the general grid theorem.',{'whole_displacement':all(r['difference']==F(18340,1587) for r in rows),'same_gaps':all(a==b==c for a,b,c in edge_checks)})
