from research import *
s=begin(1218,'Lift source translations to Rounded values plus residuals','How can a non-grid row change act coherently on the Rounded representation?',{},['C1213–C1217','prep/round_joint_fibres.md'])
def Qz(x):return 5*((x+2)//5)
out=[]
for x,d in [(777,-24),(595,-24),(438,27),(433,27)]:
 y=Qz(x);rho=x-y;k=Qz(rho+d);out.append({'x':x,'d':d,'Q_x':y,'rho':rho,'rounded_shift':k,'new_rounded':y+k,'new_residual':rho+d-k})
a=artifact('model/rounded_residual_translation.json',json.dumps({'formula':'T_d(y,rho)=(y+Q_Z(rho+d), rho+d-Q_Z(rho+d))','premise':'y in5Z, rho in[-2,2], x=y+rho; source durations and admitted endpoints remain nonnegative','examples':out,'information':'Keeping the residual restores a lossless coordinate representation, not reduced source information.'},indent=2)+'\n')
finish(s,{'translation':a,'examples':out},'The retained residual determines how an off-grid change crosses rounded cells. This single rule explains why the same−24 change produces−20 in Lamech’s rounded lifespan and−25 in his rounded remainder.','Verify the lifted rule across every ordinary existing tradition comparison.',{'all_examples':all(z['new_rounded']==Qz(z['x']+z['d']) and z['new_rounded']+z['new_residual']==z['x']+z['d'] for z in out),'different_shifts':[out[0]['rounded_shift'],out[1]['rounded_shift']]==[-20,-25]})
