"""Exact rational identities for the disjoint two-quadruple-port compression.""" from fractions import Fraction as Q from pathlib import Path import json def P4(m):return m**3/Q(24)-Q(3,16)*m*m+Q(211,336)*m def L(b,D): c=(3*b-1+D)/2;d=(3*b-1-D)/2 return 12*b*b-8*b*(c+d)+6*(c*c+d*d) # Identities are polynomials of degree at most three in b, two in D; # rectangular interpolation grids therefore certify them identically. for b in map(Q,range(4)): assert P4(4*b+1)-P4(4*b-5)==12*b*b-21*b+Q(757,56) for D in map(Q,range(3)): assert L(b,D)==15*b*b-10*b+3+3*D*D tau=-L(b,D)+(3*b-1)**2 assert tau==-6*b*b+4*b-2-3*D*D assert tau+P4(4*b+1)-P4(4*b-5)==6*b*b-17*b+Q(645,56)-3*D*D bound=6*b*b-17*b+Q(645,56)-3*(b/2-Q(3,4))**2 assert bound==Q(21,4)*b*b-Q(59,4)*b+Q(1101,112) b0=Q(13,4) minimum=Q(21,4)*b0*b0-Q(59,4)*b0+Q(1101,112) assert minimum==Q(7771,448)>0 assert Q(21,2)*b0-Q(59,4)>0 record=dict(status='PASS',head_order_change=-6,old_root_degree=4,new_root_degree=4, score_margin=str(minimum),minimum_b=str(b0), identities='Exact polynomial interpolation on rational rectangular grids', scope='Algebraic certificate; graph construction proved in accompanying TeX') Path(__file__).with_suffix('.json').write_text(json.dumps(record,indent=2)+'\n') print('PASS: all polynomial identities; uniform J4 margin',minimum)