#!/usr/bin/env python3 """Route 172 rescue (job #4476): exact-rational checks on the RECORDED next experiment and on the recorded certification condition. Everything here is exact rational arithmetic on numbers quoted verbatim from the public record (the same inputs return #1972 used, plus #1942's diagnostic band): #1641 : A = 2583/10000, cap constant for the restricted support T #1942 : q_cap(17) = 19057856843500607/5000000000000000, diagnostic band lam_max in [3.799, 3.812], e_witness = c0^T E_sym c0, delta_witness = c0^T Delta_sym c0 #1869 : q_uncap(17) = 19506902637809427/5000000000000000 (a LOWER bound for the uncapped optimum at d = 17: the #1606 witness value) Claim 1: the recorded next experiment's STOP branch is unreachable, and its question is already answered at d = 17, by monotonicity alone. Claim 2: the recorded certification condition ("cap cost below the 1.547% deficit") is insufficient; the true target is 1 - tau/q_uncap. Claim 3: the input rationals are consistent with the published floats/signs. No network, no engine, no private source. Deterministic. stdout only. """ from __future__ import annotations import json import os import sys from fractions import Fraction as Fr HERE = os.path.dirname(os.path.abspath(__file__)) SCALE = 10 ** 15 # --- inputs quoted verbatim from the public record ------------------------- A = Fr(2583, 10000) # #1641 TAU = 1 / A # #1641 Q_CAP = Fr(19057856843500607, 5000000000000000) # #1942 (exact) Q_UNCAP = Fr(19506902637809427, 5000000000000000) # #1869 (exact) Q_UPPER = Fr(3812, 1000) # #1942 diagnostic Q_LOWER = Fr(3799, 1000) # #1942 diagnostic E_WITNESS = Fr( int("-2395449869144760771798151254551337974239913547740345826010941211787762039945297345067209893325048023324578729153446274154724331437342060180529838500801367823155894720425516241314839672146657342842815756180097912985242773505785491860932014731048311368851792201855597861182373829074924907543002679928872500211565402096981666929718592492582703998366463026120785703087374336"), int("342465014216638570579237368747942351171452466893268147264772952121744824778417898907694165925484538266832088370106851668978737670076445779296478628197209264024258105359363373179342541758978211715569167457591115484630973730907446141910399279931541511521393171238608143756814119703403024462592023018471613477588502339784071241336305996876062637627031819490442310333251953125"), ) # #1942 DELTA_WITNESS = Fr( int("21159935350797581943200002270864443551771686908608110103426178388358329567313192898335500045840210837184458868348916782917227473033749331113945195401289055873842951573597647477379367094643417864464452185180818798401355609871103970405194773449690715090352818108850477021775030254163516105813395756480147624640171458730500106358150993753781111142403046417417371648"), int("431315440776192913314034962484906244416786387056373778116458529562385815003332014642387091257017976068933047595895076755422049058870787317801983945400301542363697944593834471161268387316247494127883139959390765324304196473570500760474712934414887642809536726679992896682546451676590201566981120211249549145992254080274027820164429578821226514295920590972900390625"), ) # #1942 # --- derived exact quantities --------------------------------------------- CAP_COST = 1 - Q_CAP / Q_UNCAP # 1 - q_cap/q_uncap DEFICIT = 1 - Q_CAP / TAU # 1 - q_cap/tau EXCESS = Q_UNCAP / TAU - 1 # q_uncap/tau - 1 C_TARGET = 1 - TAU / Q_UNCAP # the largest cap cost that still certifies def f(x, n=10): return format(float(x), ".%dg" % n) results = [] def check(name, ok, detail=""): results.append({"check": name, "ok": bool(ok), "detail": detail}) return bool(ok) print("=== inputs ===") print("A =", A, "=", f(A)) print("tau = 1/A =", TAU, "=", f(TAU, 17)) print("q_cap(17) =", Q_CAP, "=", f(Q_CAP, 17)) print("q_uncap(17) =", Q_UNCAP, "=", f(Q_UNCAP, 17), "(lower bound, #1606 witness)") print() print("=== Claim 3: input consistency with the published floats/signs ===") check("q_cap(17) reproduces the recorded 3.8115713687001214", format(float(Q_CAP), ".17g") == "3.8115713687001214", format(float(Q_CAP), ".17g")) check("q_uncap(17) reproduces the recorded 3.9013805275618854", format(float(Q_UNCAP), ".17g") == "3.9013805275618854", format(float(Q_UNCAP), ".17g")) check("tau reproduces the recorded 3.8714672861014323", format(float(TAU), ".17g") == "3.8714672861014323", format(float(TAU), ".17g")) check("e_witness < 0 (numerator cap correction is a subtraction)", E_WITNESS < 0, f(E_WITNESS, 6)) check("delta_witness > 0 (denominator cap correction is a subtraction)", DELTA_WITNESS > 0, f(DELTA_WITNESS, 6)) check("e_witness matches the recorded -6.9947287159e-03 to 1e-12 relative", abs(float(E_WITNESS) + 6.9947287159e-03) < 1e-12, f(E_WITNESS, 12)) check("delta_witness matches the recorded +4.9059072202e-02 to 1e-12 relative", abs(float(DELTA_WITNESS) - 4.9059072202e-02) < 1e-12, f(DELTA_WITNESS, 12)) print() print("=== Claim 1: the recorded STOP branch is unreachable ===") print("recorded stop: 'the sequence saturates at or below #1942's 3.812 ceiling'") print("recorded anchor: q_uncap(17) >= 3.9013805275618854 (a witness value, exact)") check("q_uncap(17) > the 3.812 ceiling, so the stop branch is already false at d = 17", Q_UNCAP > Q_UPPER, "%s > %s" % (f(Q_UNCAP, 17), f(Q_UPPER))) check("q_uncap(17) > tau: the recorded question ('does it clear tau before it saturates?') is already answered YES at d = 17", Q_UNCAP > TAU, "%s > %s (excess %s)" % (f(Q_UNCAP, 17), f(TAU, 17), f(EXCESS, 6))) check("the diagnostic band [3.799, 3.812] lies strictly below the uncapped anchor, so it cannot serve as a ceiling for an UNCAPPED sequence", Q_LOWER < Q_UNCAP and Q_UPPER < Q_UNCAP, "band upper %s, anchor %s" % (f(Q_UPPER), f(Q_UNCAP, 17))) check("monotonicity premise holds numerically on the published pair: q_cap(17) < q_uncap(17)", Q_CAP < Q_UNCAP, "%s < %s" % (f(Q_CAP, 17), f(Q_UNCAP, 17))) print() print(" Rationale (no computation): the even-signature basis") print(" V_d = span{ b_{a,alpha} = (1+eps-P1)^a P_alpha : a + |alpha| <= d }") print(" is nested, V_17 subset V_19 subset V_21, and the generalized Rayleigh") print(" quotient sup over a subspace is monotone under subspace inclusion, so") print(" M(17) <= M(19) <= M(21). With M(17) >= q_uncap(17) > 3.812 and > tau,") print(" every d >= 17 gives M(d) > 3.812. The stop branch cannot fire; the") print(" continue branch fires identically for every input.") print() print("=== Claim 2: the recorded certification condition is insufficient ===") print("cap_cost = 1 - q_cap/q_uncap =", f(CAP_COST, 8), "=", format(float(CAP_COST) * 100, ".6f") + " %") print("deficit = 1 - q_cap/tau =", f(DEFICIT, 8), "=", format(float(DEFICIT) * 100, ".6f") + " %") print("excess = q_uncap/tau - 1 =", f(EXCESS, 8), "=", format(float(EXCESS) * 100, ".6f") + " %") print("true target c* = 1 - tau/q_uncap =", f(C_TARGET, 8), "=", format(float(C_TARGET) * 100, ".6f") + " %") print() check("cap_cost reproduces the recorded 2.301984% to 1e-9", abs(float(CAP_COST) - 0.023019840855639122) < 1e-12, format(float(CAP_COST), ".17g")) check("deficit reproduces the recorded 1.547112% to 1e-9", abs(float(DEFICIT) - 0.015471115464758642) < 1e-12, format(float(DEFICIT), ".17g")) # The route says continuing is justified by a schedule whose cap cost falls # "below the 1.547% deficit". Test that stated condition directly. Q_AT_STATED = Q_UNCAP * (1 - DEFICIT) check("a cap cost equal to the stated '1.547% deficit' still FAILS to certify", Q_AT_STATED < TAU, "q_cap = %s < tau = %s" % (f(Q_AT_STATED, 17), f(TAU, 17))) check("the true target is smaller than the stated one by a factor > 1.9", DEFICIT / C_TARGET > Fr(19, 10), "stated %s vs true %s, ratio %s" % (format(float(DEFICIT) * 100, ".6f") + " %", format(float(C_TARGET) * 100, ".6f") + " %", f(DEFICIT / C_TARGET, 5))) check("the cap cost must be divided by more than 3 to certify", CAP_COST / C_TARGET > 3, "factor %s" % f(CAP_COST / C_TARGET, 8)) check("uncapped_excess_over_tau reproduces the recorded 0.007726590269234999", abs(float(EXCESS) - 0.007726590269234999) < 1e-15, format(float(EXCESS), ".17g")) # the route's own relation, re-derived: (q_cap/tau)*(1+y) = q_uncap/tau Y = (Q_UNCAP / TAU) * TAU / Q_CAP - 1 check("decomposition identity: cap_cost = 1 - q_cap/(tau*(1+y)) with y = 2.356224%", abs(float(Y) - 0.02356223986759352) < 1e-14, format(float(Y), ".17g")) ok = all(r["ok"] for r in results) out = { "tool": "verify-route172-obstruction/1.0.0", "route": 172, "job": 4476, "checks": results, "values": { "A": str(A), "tau": str(TAU), "q_cap_17": str(Q_CAP), "q_uncap_17": str(Q_UNCAP), "cap_cost": str(CAP_COST), "deficit": str(DEFICIT), "uncapped_excess_over_tau": str(EXCESS), "true_cap_cost_target": str(C_TARGET), "cap_cost_reduction_needed": str(CAP_COST / C_TARGET), "stated_reconsider_target": str(DEFICIT), "stated_target_ratio": str(DEFICIT / C_TARGET), }, "all_ok": ok, } with open(os.path.join(HERE, "route172-obstruction.json"), "w", encoding="utf-8", newline="\n") as fh: json.dump(out, fh, indent=1, ensure_ascii=False, sort_keys=True) print() print("--- checks: %d run, %d failed ---" % (len(results), sum(1 for r in results if not r["ok"]))) for r in results: if not r["ok"]: print("FAIL:", r["check"], "|", r["detail"]) print("ROUTE172-OBSTRUCTION", "PASS" if ok else "FAIL") sys.exit(0 if ok else 1)