"""Exact numerical guards for the explicit remainder appendix. These rational checks support, but do not replace, the all-n proof. Python standard library only. No sampling or floating point is used. """ from fractions import Fraction as Q import json n0=10000 beta=Q(25,129); gamma=Q(125,258); mu=Q(125,16641) c=Q(8242,49923); alpha=Q(8257,49923); gain=mu/25 cap=Q(21119,11094000) checks={ 'dual_weights_admissible_at_threshold': Q(4,5)+Q(4*(n0+1),n0*n0)/beta**2 < Q(9,10), 'mu_lower_bound_positive':mu*n0*n0-n0-1>0, 'g_below_m':(Q(1,2)-gamma)*n0>1, 'g_above_m_over_two':(gamma-Q(1,4))*n0>1, 'entire_rank_band_below_g':(gamma-Q(9,20))*n0>1, 'high_D_mass_defect_below_six':1/beta+Q(1,2)<6, 'high_D_product_error_below_one':12*mu+Q(1,25)<1, 'dual_objective_error_below_two': Q(1,2)+3*mu/4+Q(1,n0)+Q(1,2*n0*n0)<2, 'small_D_band_error_below_402':1-9*mu+Q(7,20)+400<402, 'low_D_gain_stronger':cap>gain, 'small_rho_gain_stronger':Q(2975,399384)>gain, 'large_rho_gain_stronger':Q(186,79507)>gain, 'tail_gain_stronger':Q(1822061,103041072)>gain, 'small_n_covered_by_16':n0*(Q(1,6)-c)<16, 'coefficient_identity':alpha-gain==c, 'largest_SC_quadratic_allowance_below_500':409<500, } assert all(checks.values()), checks print(json.dumps({'status':'all exact rational guards passed', 'threshold':n0,'coefficient':str(c),'quadratic_constant':500, 'checks':checks},indent=2))