Download certify_rotation_bound.py from PureOne/neoryae-aegis: direct link, hf CLI and curl.
- Browser
- Download file 10.9 kB
-
https://huggingface.co/datasets/PureOne/neoryae-aegis/resolve/main/certify_rotation_bound.py
- Command line
-
hf download hf://datasets/PureOne/neoryae-aegis/certify_rotation_bound.py
-
curl -L -o certify_rotation_bound.py https://huggingface.co/datasets/PureOne/neoryae-aegis/resolve/main/certify_rotation_bound.py
10.9 kB
| """Exact rational certificate for amplified complete-disk barrier lower bound. | |
| This combines exact angular exterior waste, convex-reward cap-capacity | |
| packing, and localized additive redundancy with the classical overlap lemma. | |
| All verification uses fractions and integer square roots. Decimal strings | |
| are display-only, never inputs to a verification inequality. | |
| """ | |
| from fractions import Fraction as F | |
| from math import isqrt, factorial | |
| from decimal import Decimal, localcontext | |
| import json | |
| from pathlib import Path | |
| class I: | |
| def __init__(self, lo, hi=None): | |
| self.lo = F(lo) | |
| self.hi = self.lo if hi is None else F(hi) | |
| assert self.lo <= self.hi | |
| def wrap(value): | |
| return value if isinstance(value, I) else I(value) | |
| def __add__(self, other): | |
| other = I.wrap(other) | |
| return I(self.lo + other.lo, self.hi + other.hi) | |
| __radd__ = __add__ | |
| def __neg__(self): | |
| return I(-self.hi, -self.lo) | |
| def __sub__(self, other): | |
| return self + (-I.wrap(other)) | |
| def __rsub__(self, other): | |
| return I.wrap(other) - self | |
| def __mul__(self, other): | |
| other = I.wrap(other) | |
| products = [x * y for x in (self.lo, self.hi) for y in (other.lo, other.hi)] | |
| return I(min(products), max(products)) | |
| __rmul__ = __mul__ | |
| def __truediv__(self, other): | |
| other = I.wrap(other) | |
| assert other.lo * other.hi > 0, "interval division through zero" | |
| return self * I(1 / other.hi, 1 / other.lo) | |
| def __rtruediv__(self, other): | |
| return I.wrap(other) / self | |
| def square(self): | |
| return self * self | |
| def sqrt(self, digits=70): | |
| assert self.lo >= 0 | |
| scale = 10**digits | |
| lower = isqrt((self.lo.numerator * scale**2) // self.lo.denominator) | |
| upper = isqrt((self.hi.numerator * scale**2) // self.hi.denominator) + 1 | |
| return I(F(lower, scale), F(upper, scale)) | |
| def display(self): | |
| with localcontext() as context: | |
| context.prec = 45 | |
| return [str(Decimal(x.numerator) / Decimal(x.denominator)) | |
| for x in (self.lo, self.hi)] | |
| def arctan_rational_enclosure(x, terms=80): | |
| """Alternating series with its signed next-term remainder.""" | |
| x = F(x) | |
| assert 0 < x < 1 | |
| partial = sum(((-1)**j * x**(2*j+1) / (2*j+1) | |
| for j in range(terms)), F(0)) | |
| next_term = (-1)**terms * x**(2*terms+1) / (2*terms+1) | |
| return I(min(partial, partial+next_term), max(partial, partial+next_term)) | |
| def pi_enclosure(digits=80): | |
| """Machin's identity, followed by outward rational decimal rounding. | |
| tan(4*atan(1/5)-atan(1/239))=1 by exact rational algebra and the | |
| angle lies in (0,pi/2), hence pi=16*atan(1/5)-4*atan(1/239). | |
| """ | |
| raw = 16*arctan_rational_enclosure(F(1, 5))-4*arctan_rational_enclosure(F(1, 239)) | |
| scale = 10**digits | |
| lower = raw.lo.numerator*scale // raw.lo.denominator | |
| upper = (raw.hi.numerator*scale+raw.hi.denominator-1)//raw.hi.denominator | |
| return I(F(lower, scale), F(upper, scale)) | |
| def cos_enclosure(x, terms=16): | |
| """Exact interval Taylor sum; alternating remainder, for 0<=x<=1.""" | |
| x = I.wrap(x) | |
| assert 0 <= x.lo <= x.hi <= 1 | |
| square, power, partial = x.square(), I(1), I(0) | |
| for n in range(terms): | |
| term = power / factorial(2*n) | |
| partial = partial+term if n % 2 == 0 else partial-term | |
| power = power*square | |
| remainder_bound = (power/factorial(2*terms)).hi | |
| return partial+(I(0, remainder_bound) if terms % 2 == 0 | |
| else I(-remainder_bound, 0)) | |
| def main(): | |
| r = I(F(1425248, 10**10)) | |
| t = I(F(972532002, 10**9)) | |
| delta = I(F(84450517, 10**13)) | |
| kappa = I(F(3343199, 10**6)) | |
| pi_interval = pi_enclosure() | |
| rotation_angle = pi_interval/(4*kappa) | |
| rotation_cosine = cos_enclosure(rotation_angle) | |
| a = 1 + r | |
| root2 = I(2).sqrt() | |
| sine = (2 - root2).sqrt() / 2 | |
| cosine = (2 + root2).sqrt() / 2 | |
| w = (a.square() - t.square()).sqrt() | |
| eta = (1 - t) / 2 | |
| omega = ((a.square().square() - t.square()).sqrt() + w) / (a.square() - 1) | |
| far_coefficient = root2 / (1 - 1 / (root2 * t)) | |
| final_eta = eta - omega * delta / 2 | |
| A = 2 * (t * sine - w * cosine) | |
| B = 2 * (t * cosine + w * sine) | |
| D_opposed = 2 * a | |
| A_neighbor, B_neighbor = A / root2, B / root2 | |
| D_neighbor = root2 * (t + w) | |
| opposed_rhs = eta.square() * A.square() / ( | |
| 2 * D_opposed * (A.square() + (eta + B).square())) | |
| neighbor_rhs = eta.square() * A_neighbor.square() / ( | |
| 2 * D_neighbor * (A_neighbor.square() + (eta + B_neighbor).square())) | |
| denominator = A.square() + (eta + B).square() | |
| C0 = A.square() + B.square() | |
| opposed_first_derivative = A.square() * eta * (C0 + B * eta) / ( | |
| D_opposed * denominator.square()) | |
| def q(value): | |
| return value.square() * A.square() / ( | |
| 2 * D_opposed * (A.square() + (value + B).square())) | |
| def q_prime(value): | |
| den = A.square() + (value + B).square() | |
| return A.square() * value * (C0 + B * value) / ( | |
| D_opposed * den.square()) | |
| maximum_flow = 2 * eta | |
| reward = q(4 * eta / 3) + q(2 * eta / 3) | |
| reward_derivative = 4 * q_prime(4 * eta / 3) / 3 + 2 * q_prime(2 * eta / 3) / 3 | |
| robust_coefficient = I(F(1, 2)) + kappa*reward_derivative/pi_interval | |
| robust_coefficient_upper = I(F(500388302, 10**9)) | |
| opposed_second_derivative_sign = ( | |
| C0.square() - 3 * C0 * maximum_flow.square() | |
| - 2 * B * maximum_flow.square() * maximum_flow) | |
| conditions = { | |
| "r_positive": r, | |
| "r_below_sec_lambda_minus_one": 1 / cosine - 1 - r, | |
| "t_above_a_cos_lambda": t - a * cosine, | |
| "t_below_one": 1 - t, | |
| "w_squared_positive": a.square() - t.square(), | |
| "eta_positive": eta, | |
| "final_eta_positive_for_W_at_most_delta": final_eta, | |
| "eta_positive_at_certified_initial_reward": eta - omega * kappa * reward / 2, | |
| "far_radius_exceeds_near_annulus": root2 * t - a, | |
| "far_radius_exceeds_one": root2 * t - 1, | |
| "near_coefficient_dominates_far": omega - far_coefficient, | |
| "strip_numerator_positive": A, | |
| "t_exceeds_w_for_neighbor_enclosing_disc": t - w, | |
| "opposed_localized_projection_slack": 1 - t * sine - w * cosine, | |
| "neighbor_localized_projection_slack": 1 - t * cosine - w * sine, | |
| "neighbor_branch_dominates_on_whole_eta_interval": | |
| 2 * a * C0 - D_neighbor * (A.square() + (root2 * maximum_flow + B).square()), | |
| "opposed_second_derivative_positive_on_whole_eta_interval": opposed_second_derivative_sign, | |
| "rational_rotation_factor_positive": kappa, | |
| "rotation_factor_gate_t_minus_cos_pi_over_4kappa": t-rotation_cosine, | |
| "additive_monotonicity_slack": 1 - kappa * omega * reward_derivative / 2, | |
| "rotated_reward_contradiction_margin": kappa * reward - delta, | |
| "robust_missed_line_coefficient_upper_slack": robust_coefficient_upper-robust_coefficient, | |
| } | |
| for name, interval in conditions.items(): | |
| assert interval.lo > 0, name | |
| # q(eta)=c*eta^2/(A^2+(eta+B)^2) increases for eta>=0: | |
| # the derivative's positive factor is A^2+B^2+B*eta. | |
| assert A.lo > 0 and B.lo > 0 and A_neighbor.lo > 0 and B_neighbor.lo > 0 | |
| result = { | |
| "status": "PASS", "arithmetic": "Exact rational interval arithmetic, integer-square-root enclosures, Machin pi, and alternating cosine Taylor enclosures; decimal strings are display-only.", | |
| "method": "Continuous rotational averaging with sharp per-point cap-occupancy bound, exact angular exterior Crofton waste, convex-reward cap-capacity packing, and localized additive projection redundancy, using the classical four-cap strip lemma.", | |
| "parameters": {"r": str(r.lo), "t": str(t.lo), "delta": str(delta.lo), | |
| "kappa": str(kappa.lo), | |
| "robust_missed_line_coefficient_upper": str(robust_coefficient_upper.lo), | |
| "lambda": "pi/8; sine and cosine evaluated by exact radical enclosures"}, | |
| "bound": "Every conventional rectifiable opaque barrier of the unit disk has length strictly greater than pi+8.4450517e-6.", | |
| "robust_bound": "For every finite straight set B, length(B)+0.500388302*U(B) is strictly greater than pi+8.4450517e-6, where U(B) is missed unit-disk line measure in dtheta*dp coordinates.", | |
| "exact_robust_missed_line_coefficient": robust_coefficient.display(), | |
| "scope": "Unconditional complete-barrier lower-bound improvement; the unrestricted optimum is not determined. Independent literature priority remains to be checked.", | |
| "analytic_dependencies": [ | |
| "Kawamura--Moriyama--Otachi--Pach strip-overlap lemma and its normal-window-localized proof: https://doi.org/10.4230/LIPIcs.SoCG.2016.46, Section 6.", | |
| "Kiderlen--Pausinger disk-cap geometry: https://doi.org/10.1007/s10474-026-01606-x, Section 3.2.", | |
| "The accompanying manuscript proves exact orientation-position exterior waste, convex-reward capacity packing with disjoint material allocations, continuous rotational redundancy reuse, and the final monotonicity argument."], | |
| "pi_enclosure_by_Machin_identity": pi_interval.display(), | |
| "rotation_angle_pi_over_4kappa": rotation_angle.display(), | |
| "cosine_enclosure_at_rotation_angle": rotation_cosine.display(), | |
| "exact_exterior_coefficient": omega.display(), | |
| "far_exterior_coefficient": far_coefficient.display(), | |
| "initial_good_mass_eta0": eta.display(), | |
| "final_good_mass_at_W_equal_delta": final_eta.display(), | |
| "opposed_overlap_derivative_at_eta0": opposed_first_derivative.display(), | |
| "packing_reward_derivative_at_eta0": reward_derivative.display(), | |
| "maximum_flow_for_convexity_and_branch_comparison": maximum_flow.display(), | |
| "capacity_packing_reward": "R(eta)=q(4*eta/3)+q(2*eta/3). The alternative 2*q(eta) is at least q(4*eta/3), since the quadratic denominator of q increases on nonnegative arguments.", | |
| "positive_intervals": {name: interval.display() for name, interval in conditions.items()}, | |
| "opposed_overlap_bound": opposed_rhs.display(), | |
| "neighbor_overlap_bound": neighbor_rhs.display(), | |
| "certified_initial_packing_reward": reward.display(), | |
| "certified_initial_rotated_reward": (kappa*reward).display(), | |
| "published_selected_parameter_increment": "1.0764570174055761e-6 (floating reconstruction; background only)", | |
| "improvement_over_published_displayed_1_076457e_6": str( | |
| delta.lo - F(1076457, 10**12)), | |
| } | |
| output = Path(__file__).with_name("ROTATION_BOUND_CERTIFICATE.json") | |
| output.write_text(json.dumps(result, indent=2) + "\n") | |
| print(json.dumps(result, indent=2)) | |
| if __name__ == "__main__": | |
| main() | |