from research import *
s=begin(1198,'State the residual information needed to recover an ordinary row','Which one additional coordinate resolves any remaining joint fibre?',{},['C1190–C1197'])
rows=json.loads((ROOT/'model/ordinary_joint_rounding_fibres.json').read_text())['rows'];recovered=[]
for x in rows:
 u=x['b']-x['B'];b=x['B']+u;r=x['L']-b
 recovered.append([x['tradition'],x['name'],u,b,r])
a=artifact('model/joint_rounding_residual_recovery.json',json.dumps({'recovery':'b=B+u; r=L-B-u','residual_records':recovered,'source_cost':'Any one exact residual or equivalent exact part fixes a row; the residual is not generated by rounding.','alternatives':'For singleton rows the observations already force u.'},indent=2)+'\n')
finish(s,{'recovery':a,'rows':len(recovered)},'One exact residual per ambiguous row supplies what joint rounding removed. Singleton rows need no extra residual, but reading a stored source residual back is reconstruction, not a new discovery.','Connect the joint fibre to the failure of separate rounding to preserve b+r=L.',{'all_recovered':all(z[3]==x['b'] and z[4]==x['r'] for z,x in zip(recovered,rows)),'bounded':all(-2<=z[2]<=2 for z in recovered)})
