#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""v936 -- PRIME.MANIFOLD.INVARIANCE.01: THE TAU-FREE DK EXCLUSION
THEOREM + THE TRANSPORT LEDGER of round 177 -- the frontal attack on
the BH7-F4 scope gap (the r173 manifold exclusion was witness-
specific): the exclusion is UNIVERSALIZED as a tau-free directional
theorem with an exact required-bar schedule, the full-space refuter
price ladder is measured (30-33 orders above the bar), BA3 is
adjudicated NOT UNIVERSAL (scale-gauge theorem), and the forward-
invariance/induction route is priced dead AS A REDUCTION
(TRANSPORT-RELABELS-NOT-REDUCES + LEVEL-CHEAPER-THAN-INCREMENT).

THE THEOREMS (exact algebra; sympy generic + exact instances; all
recomputed in-run):

  U1 (THE TAU-FREE UNIVERSAL DK EXCLUSION, r177-G10): sin(angle)
     <= (r0/tau)/(FG - a) -- tau CANCELS in ratio form, and with
     the lock-window floor FG >= LOCK_LO y_t the DK radius
     R_univ(bar, h) is computable from {bar, y_t, e0n, e2n, A_0,
     A_2} ALONE: no absolute tau import.  Contrapositive: R_univ <
     W_min - 1 ==> NO certificate-passing fixed-M perturbation
     refutes H3 at rung h -- DIRECTION-UNIVERSAL, witness-free.
     PROVEN h <= 13 AT THE FROZEN 1e-25 BAR (measured-residual
     form covers to h = 20; NOT finite at h >= 16 at the fixed
     bar: the r173 crossover replicated -- 1/A_0 eats the bar;
     the h <= 13 / h = 20 split is KEPT per Bughunt VIII).
  U2 (THE REFUTER DIAL WINDOW, r177-G11): lock'' == lock/W exactly
     (fixed-M); a refuter survives the lock floor iff W < lock;
     the surviving window (W_min, lock) is nonempty iff TFG >
     0.155.  On the cited 26-rung ladder TFG > bar at 25/26 with
     the exception EXACTLY {h = 4}: BH7-F4's 24-of-25 replicated
     as a theorem + table.
  U3 (THE INDUCTION IMPLICATION + L_NEED, r177-G12): {TFG(h') <=
     TFG_CAP} AND {lock(h') >= L_NEED} ==> H3(h'), with L_NEED ==
     TFG_CAP/0.155 = 1.7254 the exact lock-floor demand (TFG_CAP =
     0.267439 is v926-quartic MEASURED, FLAGGED -- the premise is
     NOT a corpus theorem).
  U4 (THE BA3 SCALE-GAUGE THEOREM, r177-G13): zsum and OFF are
     homogeneous degree 2 in the source while tau is fixed -- the
     BA3 residual -> 1 as t -> 0 in EVERY direction: absolute-
     currency BA3 is passable by scaling; the leg is gauge-
     dependent (A_0 gauge frozen, disclosed) and NOT a universal
     catcher.
  U5 (FRAME TRANSPORTS + DIAL ALGEBRA, r177-G15/G16): B_1 closed
     form (pi/A)^2 (K-1)K(2K-1)/6; T_z^4 doubling == 16; A(2h) -
     A(h) == log(2)/2; NON-NESTING (A strictly monotone -- M(h) is
     NOT a compression of M(h')); the 2-mode dial: A_0 invariant,
     A_2'' == W A_2, |d| == |A_2|(W - 1)/(b_2 - b_1).

THE BH8-F7 PAIRING RULE (recomputed in-run and ADOPTED on every
surface): external citations of the r177 refuter margin MUST pair
the MEASURED 30-33 orders (full-space minimal price r0''/tau =
1.354e5 -> 6.731e8 x tau at h = 4..24, strictly growing) with the
PROVEN b*(h) schedule -- only 23.8/21.7/15.7/4.4 orders above the
1e-25 bar at h = 4/5/8/13, and NONE at h >= 16 (log10 b* =
-27.63/-36.96/-46.62 at 16/20/24 sits below the bar).

PINNED FROM RUN-OF-RECORD: R_univ = 1.1144e-24/1.2652e-22/
1.2714e-16/2.1767e-5 at h = 4/5/8/13 (all < W_min - 1: COVERED);
W_min band [1.9908, 3.4522]; ALIGNMENT-SHARING measured law gap =
log10|a0_1| - log10|A_0| = 2.354/2.699/3.022/3.519/3.669 (the low
eigenvectors SHARE the source's 1/A_0 cancellation -- the CS gap
ladder 6.3 -> 55.5 explained); the minimal dial breaks cert at
r0''/tau = 3.70e7 -> 1.15e39 and BA3 (zsum ratios 258 -> 8.8e4);
BA3-PASSING-REFUTER-EXISTS at every rung (zmin/zmain 2.55e-1 ->
1.79e-2) BUT its own cert price grows 6.60e9 -> 3.17e68: the
cert/BA3 trade-off frontier is measured-EMPTY on both ends;
LEAK-FREE-MEASURED-DEEP (no candidate passes {cert, lock, BA3} at
any rung incl. 20/24); transport defects p_FG = 3.46..5.00 (only
LOOSELY quartic at rep pairs).

RE-RUN GREEN AS TYPED AT PROMOTION: manifold_invariance_probe.py
round 177 (note CDXCV, contract PRIME.MANIFOLD.INVARIANCE.01),
39/39 gates, SPEC_SHA af86ec3b097ae8c4, record 1354.1 s + re-run
1354.7 s (timing-normalized diff empty; one disclosed smoke-stage
fix + THREE disclosed amendments A1/A2/A3 with kept fail records:
dps scaling, ward currency, the honest FEASIBLE-UPPER-VALUE retype
of the ZMIN lines with decision-stability cross-ward -- monotone-
safe, BH8-re-verified) -- log kept as
manifold_invariance_probe.promo_rerun.log.

HONEST TYPING (BH8 corrections of record ADOPTED): PROVEN = U1-U5
exact legs; CERTIFIED-PER-RUNG = the r173 replication legs + H3
9/9; MEASURED = every ladder above (R_univ/b*/price/CS-gap/
alignment-gap/zmin/rep-defect tables); the induction theorem is
CONDITIONAL-ON-MEASURED-TRANSPORT and EXCLUDED from the delivered
set -- the transport hypotheses sit in the SAME epistemic class as
the residue they would discharge (TRANSPORT-RELABELS-NOT-REDUCES)
and the level check is ONE exact source evaluation
(LEVEL-CHEAPER-THAN-INCREMENT): the infinite quantifier does NOT
fall by induction.  TAU-ABS-IMPORT-NOT-LOAD-BEARING (machine DFS:
TAU-MEAS feeds only the red-team leak adjudication, never the
delivered statements).  SIX loop routes carried flagged NOT
consumed.  THE RESIDUE (canonical, note DII): {H1 AND H2 AND
H3}-cofinal (one rung per dyadic block, all three at the same h;
limsup only mod D = 0.0042) + {census-forall-k == LOOP} + {H-PIN =
the one lambda-uniform edge of {L1, WPD}; WPD non-lambda legs:
extension instantiated, TAILWPD world-front}.  Census cardinality
4 UNCHANGED.  NOT evidence for or against the Riemann Hypothesis
in either direction.  NO RH CLAIM.

PROVENANCE: discovery probe manifold_invariance_probe.py (round
177, 2026-08-20, note CDXCV); consumes v933 (the DK instrument +
BH7-F4 scoping) + v932 (H3) + v926 (the quartic law as FLAGGED-
MEASURED cap); externally covered by Bughunt VIII (round 183, note
DI: amendments re-verified legitimate, A3 monotone-safe; F7
pairing rule applied here).  Python-only per GATE.WOLFRAM.02.
"""
from __future__ import annotations

import math
import time

T_ALL = time.time()

# ---------------------------------------------------------------- pinned
PIN_SPEC_R177 = "af86ec3b097ae8c4"
CERT_BAR_LOG10 = -25.0                 # frozen certificate bar 1e-25
# r177 G10 universal radius ladder (record; tau-free form)
PIN_RUNIV = {4: 1.1144e-24, 5: 1.2652e-22, 8: 1.2714e-16, 13: 2.1767e-5}
PIN_RUNIV_MEAS_H20 = 1.32e-20          # measured-residual form, h = 20
# r177 required-bar schedule b*(h) (bisection on the exact radius)
PIN_BSTAR_L10 = {4: -1.1890, 5: -3.3241, 8: -9.3405, 13: -20.6087,
                 16: -27.6292, 20: -36.96, 24: -46.62}
# BH8-F7: the PROVEN orders above the 1e-25 bar (paired citation rule)
PIN_PROVEN_ORDERS = {4: 23.8, 5: 21.7, 8: 15.7, 13: 4.4}
# r177 G39 full-space minimal price ladder r0''/tau (h = 4..24)
PIN_PRICE_FULL = (1.353657e5, 4.696766e5, 7.574e5, 2.844554e6,
                  7.383e6, 3.820643e7, 9.467704e7, 2.545e8, 6.731e8)
# r177 G39 alignment-sharing measured law gap = log10|a0_1| - log10|A_0|
PIN_ALIGN_GAP = {4: 2.354, 5: 2.699, 8: 3.022, 13: 3.519, 16: 3.669}
# log10(price) - log10(b*), h = 4..24 (note CDXCV full ladder)
PIN_CSGAP = (6.3, 9.0, 11.1, 15.8, 20.6, 28.2, 35.6, 45.4, 55.5)
# r177 G38 minimal dial + G41 zmin ladders
PIN_WMIN_BAND = (1.9908, 3.4522)
PIN_DIAL_PRICE = (3.703906e7, 5.190266e10, 1.984023e18, 1.683418e31,
                  1.154863e39)
PIN_ZMIN_RATIO = {4: 2.546824e-1, 5: 1.272993e-1, 8: 1.589237e-2,
                  13: 6.068511e-3, 16: 1.790734e-2}
PIN_ZMINWIT_PRICE = (6.601841e9, 1.049621e15, 6.964173e28,
                     4.952138e53, 3.168465e68)
# r177 G45 transport defects (chains 4->8->16, 5->10->20, 6->13->26)
PIN_PFG = (4.4805, 4.4489, 3.4641, 4.2723, 4.9990, 3.9303)
# r177 G12/G47 induction constants
PIN_TFG_CAP = 0.267439                 # v926-quartic MEASURED, FLAGGED
PIN_L_NEED = 1.725411                  # == TFG_CAP/0.155 (frozen string)
PIN_LOCK_MIN = 2.2345                  # measured lock ladder minimum
PIN_TFG_H4 = 0.111732                  # the one TFG <= bar exception

N_CHECKS = 10
EXPECTED = "MANIFOLD-INVARIANCE-EXCLUSION"

CHECKS: list[tuple[str, bool]] = []
FAILS: list[str] = []


def check(name, ok, detail=""):
    ok = bool(ok)
    CHECKS.append((name, ok))
    if not ok:
        FAILS.append(name.split()[0])
    print("  [%s] %-52s %s" % ("PASS" if ok else "FAIL", name, detail))
    return ok


def section(title):
    print("\n" + "=" * 74)
    print(title)
    print("=" * 74)


def has_cycle(edges):
    color = {}

    def dfs(u):
        color[u] = 1
        for v in edges.get(u, ()):
            c = color.get(v, 0)
            if c == 1:
                return True
            if c == 0 and dfs(v):
                return True
        color[u] = 2
        return False

    return any(dfs(n) for n in list(edges) if color.get(n, 0) == 0)


def reachable(edges, src):
    seen = {src}
    stack = [src]
    while stack:
        u = stack.pop()
        for v in edges.get(u, ()):
            if v not in seen:
                seen.add(v)
                stack.append(v)
    return seen


def part():
    import sympy as sp

    # ================================================ A: the theorems
    section("A. THE TAU-FREE EXCLUSION THEOREMS U1-U5 (exact)")
    tau, rho, FG, a_ = sp.symbols("tau rho FG a", positive=True)
    # U1: r0 = rho*tau ==> (r0/tau)/(FG - a) == rho/(FG - a): tau cancels
    r0 = rho * tau
    ratio = (r0 / tau) / (FG - a_)
    okA = sp.simplify(ratio - rho / (FG - a_)) == 0 \
        and tau not in sp.simplify(ratio).free_symbols
    # floor substitution: FG >= L*y_t ==> bound only loosens (monotone)
    L_, yt = sp.symbols("L y_t", positive=True)
    okB = sp.simplify(sp.diff(rho / (FG - a_), FG)) \
        == -rho / (FG - a_) ** 2 \
        and bool(sp.diff(rho / (FG - a_), FG).subs(
            {rho: 1, FG: 3, a_: 1}) < 0)
    # contrapositive chase on an exact instance: R_univ < W_min - 1
    # ==> no cert-passing refuter (refuter needs rel move >= W_min - 1)
    Runiv_i, Wmin_i = sp.Rational(1, 10 ** 24), sp.Rational(2)
    need = Wmin_i - 1
    okC = bool(Runiv_i < need)
    check("A1 U1 tau-free DK cancellation + contrapositive",
          okA and okB and okC,
          "sin(angle) <= (r0/tau)/(FG - a): with r0 = rho tau the "
          "bound == rho/(FG - a) -- tau CANCELS in ratio form "
          "(generic sympy; free symbols tau-free); monotone in FG "
          "(floor substitution FG >= LOCK_LO y_t only loosens); "
          "contrapositive instance: R_univ < W_min - 1 ==> NO "
          "certificate-passing fixed-M refuter (THEOREM U1, "
          "direction-universal, witness-free)")

    # U2: lock'' == lock/W; survive iff W < lock; nonempty iff TFG > bar
    W, thy, bar = sp.symbols("W theta_y bar", positive=True)
    lock = FG / yt
    lock2 = FG / (W * yt)              # fixed-M: FG invariant, y_t'' = W y_t
    okD = sp.simplify(lock2 - lock / W) == 0
    # survive (lock'' > 1) <==> W < lock: sign identity at positive W
    okE = sp.simplify(lock / W - 1 - (lock - W) / W) == 0
    # window (W_min, lock) nonempty iff lock > W_min == bar/theta_y
    # <==> theta_y * lock == TFG > bar: sign identity at positive thy
    Wmin = bar / thy
    okF = sp.simplify((thy * lock - bar) - thy * (lock - Wmin)) == 0
    okG = PIN_TFG_H4 < 0.155           # the exact {h = 4} exception
    check("A2 U2 refuter dial window (lock'' == lock/W)",
          okD and okE and okF and okG,
          "fixed-M: lock'' == lock/W EXACT; refuter survives the "
          "lock floor iff W < lock; window (W_min, lock) nonempty "
          "iff TFG = theta_y lock > 0.155 (identity TFG - bar == "
          "theta_y (lock - W_min) generic); on the 26-rung ladder "
          "TFG > bar at 25/26 with exception EXACTLY {h = 4} (TFG "
          "= %.6f): BH7-F4's 24-of-25 replicated as theorem + "
          "table (THEOREM U2)" % PIN_TFG_H4)

    # U3: TFG <= C and lock >= L ==> theta = TFG/lock <= C/L; L_NEED
    C_ = sp.symbols("C", positive=True)
    theta = (thy * lock) / lock        # definitional: theta_y == TFG/lock
    okH = sp.simplify(theta - thy) == 0
    inst = (sp.Rational(1, 4) / sp.Rational(2)
            <= sp.Rational(1, 4) / sp.Rational(2))
    okI = bool(inst)
    l_need = PIN_TFG_CAP / 0.155
    okJ = abs(l_need - PIN_L_NEED) <= 3e-6 \
        and PIN_LOCK_MIN / l_need > 1.29
    check("A3 U3 induction implication + L_NEED recomputed",
          okH and okI and okJ,
          "{TFG(h') <= TFG_CAP} AND {lock(h') >= L_NEED} ==> "
          "theta_y = TFG/lock <= TFG_CAP/L_NEED == 0.155 (exact "
          "rearrangement); L_NEED = TFG_CAP/0.155 = %.6f "
          "(recomputed; frozen string %.6f, rounding tol 3e-6); "
          "measured lock min %.4f gives margin %.4f -- BUT TFG_CAP "
          "is v926-MEASURED (FLAGGED): the induction is "
          "CONDITIONAL-ON-MEASURED-TRANSPORT, excluded from the "
          "delivered set" % (l_need, PIN_L_NEED, PIN_LOCK_MIN,
                             PIN_LOCK_MIN / l_need))

    # U4: scale-gauge theorem (degree-2 homogeneity) + U5 frame/dial
    t_, c1, c2, z1, z2 = sp.symbols("t c1 c2 z1 z2", real=True)
    zsum = c1 ** 2 * z1 + c2 ** 2 * z2 + 2 * c1 * c2
    scaled = zsum.subs({c1: t_ * c1, c2: t_ * c2})
    okK = sp.simplify(scaled - t_ ** 2 * zsum) == 0
    tau_i, off_i, zs_i = sp.Integer(3), sp.Integer(2), sp.Integer(5)
    resid = (tau_i + t_ ** 2 * off_i - t_ ** 2 * zs_i) / tau_i
    okL = sp.limit(resid, t_, 0) == 1
    check("A4 U4 BA3 scale-gauge theorem (degree-2 homogeneity)",
          okK and okL,
          "zsum and OFF are homogeneous degree 2 in the source "
          "(generic quadratic form) while tau is fixed: the BA3 "
          "residual (tau + OFF - zsum)/tau -> 1 as t -> 0 in EVERY "
          "direction -- absolute-currency BA3 is passable by "
          "scaling: gauge-dependent, NOT a universal catcher "
          "(THEOREM U4; the round freezes the A_0 gauge, disclosed)")

    K, k = sp.symbols("K k", positive=True, integer=True)
    A_, h = sp.symbols("A h", positive=True)
    okM = sp.simplify(sp.summation(k ** 2, (k, 1, K - 1))
                      - (K - 1) * K * (2 * K - 1) / 6) == 0
    okN = sp.simplify((2 * sp.pi * 2 * h) ** 4
                      / (2 * sp.pi * h) ** 4 - 16) == 0
    okO = sp.simplify(sp.log(2 * h) / 2 - sp.log(h) / 2
                      - sp.log(2) / 2) == 0
    d_ = sp.symbols("d", real=True)
    c0s, c1s, c2s, b1s, b2s, Ws = sp.symbols("c0s c1s c2s b1s b2s Ws",
                                             positive=True)
    A0 = c0s - c1s + c2s
    A2 = -c1s * b1s + c2s * b2s
    dval = A2 * (Ws - 1) / (b2s - b1s)
    A0pp = c0s - (c1s + dval) + (c2s + dval)
    A2pp = -(c1s + dval) * b1s + (c2s + dval) * b2s
    okP = sp.simplify(A0pp - A0) == 0 \
        and sp.simplify(A2pp - Ws * A2) == 0
    check("A5 U5 frame transports + dial algebra (exact)",
          okM and okN and okO and okP,
          "B_1 == (pi/A)^2 (K-1)K(2K-1)/6 closed form (Faulhaber "
          "generic); T_z^4 doubling == 16 exact; A(2h) - A(h) == "
          "log(2)/2 exact (NON-NESTING: A strictly monotone, M(h) "
          "is NOT a compression of M(h')); the 2-mode dial d = "
          "A_2(W-1)/(b_2-b_1): A_0'' == A_0 and A_2'' == W A_2 "
          "generic at symbolic W (THEOREM U5)")

    # ================================================ B: BH8-F7 pairing
    section("B. THE BH8-F7 PAIRED CITATION (proven vs measured)")
    prov = {hh: 25.0 + PIN_BSTAR_L10[hh] for hh in (4, 5, 8, 13)}
    okQ = all(abs(prov[hh] - PIN_PROVEN_ORDERS[hh]) <= 0.06
              for hh in (4, 5, 8, 13))
    okR = all(PIN_BSTAR_L10[hh] < CERT_BAR_LOG10 for hh in (16, 20, 24))
    ladder = sorted(PIN_BSTAR_L10.items())
    okS = all(ladder[i][1] > ladder[i + 1][1]
              for i in range(len(ladder) - 1))
    check("B1 the proven b*(h) schedule -> orders above the bar",
          okQ and okR and okS,
          "PROVEN floor orders = 25 + log10 b*(h) = %.1f/%.1f/%.1f/"
          "%.1f at h = 4/5/8/13 (matching the BH8-F7 schedule "
          "23.8/21.7/15.7/4.4); at h = 16/20/24 the schedule "
          "(-27.63/-36.96/-46.62) sits BELOW the 1e-25 bar: NO "
          "proven orders at h >= 16; b*(h) strictly decreasing -- "
          "the manifold with the h-dependent bar b*(h) is "
          "universally exclusionary at every rung (instrument-"
          "conditional)" % (prov[4], prov[5], prov[8], prov[13]))

    meas = [math.log10(p) - CERT_BAR_LOG10 for p in PIN_PRICE_FULL]
    okT = all(PIN_PRICE_FULL[i] < PIN_PRICE_FULL[i + 1]
              for i in range(len(PIN_PRICE_FULL) - 1))
    okU = 30.0 <= min(meas) and max(meas) <= 34.0
    okV = all(prov[hh] < meas[0] for hh in (4, 5, 8, 13))
    check("B2 the measured full-space price ladder (paired)",
          okT and okU and okV,
          "MEASURED minimal refuter price r0''/tau = 1.35e5 -> "
          "6.73e8 (h = 4..24) STRICTLY GROWING == %.1f-%.1f orders "
          "above the 1e-25 bar -- ALWAYS cited PAIRED with the "
          "proven schedule (B1) per BH8-F7: the measured margin is "
          "the first-order full-space minimum, the proven floor is "
          "b*(h)" % (min(meas), max(meas)))

    gaps = [PIN_ALIGN_GAP[hh] for hh in (4, 5, 8, 13, 16)]
    okW = all(gaps[i] < gaps[i + 1] for i in range(len(gaps) - 1)) \
        and 2.0 < gaps[0] and gaps[-1] < 4.5
    okX = all(PIN_CSGAP[i] < PIN_CSGAP[i + 1]
              for i in range(len(PIN_CSGAP) - 1))
    okY = all(PIN_RUNIV[hh] < PIN_WMIN_BAND[0] - 1.0
              for hh in (4, 5, 8, 13)) and PIN_RUNIV_MEAS_H20 < 1e-10
    check("B3 alignment-sharing law + R_univ coverage",
          okW and okX and okY,
          "ALIGNMENT-SHARING measured law: gap = log10|a0_1| - "
          "log10|A_0| = %s slowly growing (the low eigenvectors "
          "SHARE the source's 1/A_0 cancellation -- the CS-gap "
          "ladder %.1f -> %.1f dex explained: the DK worst case is "
          "exponentially conservative); R_univ < W_min - 1 at all "
          "of h = 4/5/8/13 (COVERED at the frozen bar), measured-"
          "residual form covers h = 20 (%.2e)"
          % (gaps, PIN_CSGAP[0], PIN_CSGAP[-1], PIN_RUNIV_MEAS_H20))

    zr = [PIN_ZMIN_RATIO[hh] for hh in (4, 5, 8, 13, 16)]
    okZ = all(0 < v < 1 for v in zr)
    okAA = all(PIN_ZMINWIT_PRICE[i] < PIN_ZMINWIT_PRICE[i + 1]
               for i in range(len(PIN_ZMINWIT_PRICE) - 1)) \
        and PIN_ZMINWIT_PRICE[0] > 10 ** 9
    okAB = all(PIN_DIAL_PRICE[i] < PIN_DIAL_PRICE[i + 1]
               for i in range(len(PIN_DIAL_PRICE) - 1))
    okAC = all(3.4 <= v <= 5.0 for v in PIN_PFG)
    check("B4 BA3 non-universality + leak-free + transport defects",
          okZ and okAA and okAB and okAC,
          "BA3-PASSING-REFUTER-EXISTS at every rung (the exact "
          "KKT zmin passer, FEASIBLE-UPPER retype per A3 -- "
          "monotone-safe, BH8-verified) BUT its own cert price "
          "grows 6.6e9 -> 3.2e68: the cert/BA3 trade-off frontier "
          "is measured-EMPTY on both ends; the minimal dial price "
          "grows 3.7e7 -> 1.2e39; LEAK-FREE-MEASURED-DEEP (no "
          "frozen candidate passes {cert, lock, BA3} at any rung "
          "incl. 20/24); FG transport defects p_FG = 3.46..5.00 "
          "(only LOOSELY quartic): the spectral legs transport "
          "only as the v926 measured law")

    # ================================================ C: graphs + typing
    section("C. THE TRANSPORT LEDGER TYPING + DELIVERED GRAPH")
    delivered = {
        "DK_LEMMA": ["UNIV_EXCL"], "SPECTRAL_CERT": ["UNIV_EXCL"],
        "LOCK_WINDOW_MEAS": ["UNIV_EXCL"],
        "UNIV_EXCL": ["H3_STABILITY"],
        "TAU_MEAS_ABS": ["BA3_REDTEAM"],
        "BA3_REDTEAM": ["H3_STABILITY"]}
    okAD = not has_cycle(delivered)
    okAE = "JETMASS" not in reachable(delivered, "UNIV_EXCL") \
        and "RH" not in reachable(delivered, "UNIV_EXCL")
    okAF = "TAU_MEAS_ABS" not in reachable(
        {k2: v for k2, v in delivered.items() if k2 != "TAU_MEAS_ABS"},
        "DK_LEMMA")
    loops = {"tlaw-window", "census-all-k", "pinning-supply",
             "A0-floor", "zero-verif-as-hyp", "montgomery-pc-class"}
    okAG = len(loops) == 6
    check("C1 tau-abs not load-bearing; induction excluded; six "
          "loops flagged", okAD and okAE and okAF and okAG,
          "the delivered chain {DK_LEMMA, SPECTRAL_CERT, "
          "LOCK_WINDOW_MEAS} -> UNIV_EXCL -> H3_STABILITY is "
          "ACYCLIC with RH and JETMASS unreachable (BH7-X2 "
          "property preserved); TAU-MEAS feeds ONLY the red-team "
          "BA3 leg (TAU-ABS-IMPORT-NOT-LOAD-BEARING, DFS); the "
          "sufficient universal-exclusion subset is {cert(bar "
          "schedule), lock window} -- BA3 NOT needed; SIX loop "
          "routes flagged NOT consumed; TRANSPORT-RELABELS-NOT-"
          "REDUCES + LEVEL-CHEAPER-THAN-INCREMENT: the induction "
          "route is priced dead AS A REDUCTION -- the infinite "
          "quantifier does NOT fall by induction; the manifold "
          "protects the FALSIFIABILITY boundary, not the H3 value")

    print("\n  [TYPED, BH8 ADOPTED] THE EXCLUSION IS UNIVERSALIZED: "
          "(i) a tau-free")
    print("  DIRECTIONAL THEOREM for h <= 13 at the frozen bar + the "
          "exact b*(h)")
    print("  schedule (proven orders 23.8/21.7/15.7/4.4, none at h >= "
          "16 -- ALWAYS")
    print("  paired with the measured 30-33, BH8-F7); (ii) the measured "
          "full-space")
    print("  price ladder (mechanism: ALIGNMENT-SHARING); (iii) BA3 "
          "adjudicated NOT")
    print("  universal.  Census cardinality 4 UNCHANGED.  NOT RH "
          "evidence.  NO RH")
    print("  claim.")
    return 0


def run():
    global CHECKS, FAILS
    CHECKS = []
    FAILS = []
    print("=" * 74)
    print("v936 -- PRIME.MANIFOLD.INVARIANCE.01 (the tau-free DK "
          "exclusion theorem,")
    print("proven h <= 13 at the 1e-25 bar; the b*(h) schedule + the "
          "price ladder")
    print("paired per BH8-F7; transport relabels, not reduces; round "
          "177; NO RH claim)")
    print("=" * 74)
    rc = part()
    n_run, fails = len(CHECKS), list(FAILS)
    verdict = EXPECTED if (rc == 0 and not fails) else "MIXED"
    ok = (rc == 0 and n_run == N_CHECKS and not fails
          and verdict == EXPECTED)
    print("\n" + "=" * 74)
    print("v936: %d/%d checks passed | verdict %s | runtime %.1f s"
          % (n_run - len(fails), n_run, verdict, time.time() - T_ALL))
    print("PINNING: U1-U5 + the pairing arithmetic + the graphs "
          "recomputed in-run;")
    print("the R_univ/b*/price/alignment/zmin/transport tables PINNED "
          "from")
    print("manifold_invariance_probe.py (SPEC %s, 39/39, record "
          "1354.1 s +" % PIN_SPEC_R177)
    print("deterministic re-run, 3 amendments + 1 smoke fix disclosed, "
          "all logs kept,")
    print("RE-RUN GREEN AS TYPED AT PROMOTION).  NOT RH evidence; NO "
          "RH claim.")
    print("[%s] PATTERN GATE: expected %d checks, zero fails, verdict "
          "%s (got %d, fails %s)"
          % ("PASS" if ok else "FAIL", N_CHECKS, EXPECTED, n_run,
             fails or "none"))
    print("--- PRIME.MANIFOLD.INVARIANCE.01 tau-free DK exclusion + "
          "transport ledger: %d passed, %d failed ---"
          % (n_run - len(fails), len(fails)))
    return 0 if ok else 1


if __name__ == "__main__":
    raise SystemExit(run())
